mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-12-27 07:25:26 +01:00
52 lines
1.4 KiB
Swift
52 lines
1.4 KiB
Swift
import SwiftUI
|
|
import Timeline
|
|
import Network
|
|
import KeychainSwift
|
|
import Env
|
|
|
|
@main
|
|
struct IceCubesApp: App {
|
|
public static let defaultServer = "mastodon.social"
|
|
|
|
@StateObject private var appAccountsManager = AppAccountsManager()
|
|
@StateObject private var currentAccount = CurrentAccount()
|
|
@StateObject private var quickLook = QuickLook()
|
|
|
|
var body: some Scene {
|
|
WindowGroup {
|
|
TabView {
|
|
TimelineTab()
|
|
.tabItem {
|
|
Label("Home", systemImage: "globe")
|
|
}
|
|
if appAccountsManager.currentClient.isAuth {
|
|
NotificationsTab()
|
|
.tabItem {
|
|
Label("Notifications", systemImage: "bell")
|
|
}
|
|
AccountTab()
|
|
.tabItem {
|
|
Label("Profile", systemImage: "person.circle")
|
|
}
|
|
}
|
|
SettingsTabs()
|
|
.tabItem {
|
|
Label("Settings", systemImage: "gear")
|
|
}
|
|
}
|
|
.tint(.brand)
|
|
.onChange(of: appAccountsManager.currentClient) { newClient in
|
|
currentAccount.setClient(client: newClient)
|
|
}
|
|
.onAppear {
|
|
currentAccount.setClient(client: appAccountsManager.currentClient)
|
|
}
|
|
.environmentObject(appAccountsManager)
|
|
.environmentObject(appAccountsManager.currentClient)
|
|
.environmentObject(quickLook)
|
|
.environmentObject(currentAccount)
|
|
.quickLookPreview($quickLook.url, in: quickLook.urls)
|
|
}
|
|
}
|
|
}
|