mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-12-25 14:32:20 +01:00
50 lines
1.4 KiB
Swift
50 lines
1.4 KiB
Swift
import Account
|
|
import AppAccount
|
|
import Conversations
|
|
import DesignSystem
|
|
import Env
|
|
import Models
|
|
import Network
|
|
import Shimmer
|
|
import SwiftUI
|
|
|
|
struct MessagesTab: View {
|
|
@EnvironmentObject private var theme: Theme
|
|
@EnvironmentObject private var watcher: StreamWatcher
|
|
@EnvironmentObject private var client: Client
|
|
@EnvironmentObject private var currentAccount: CurrentAccount
|
|
@EnvironmentObject private var appAccount: AppAccountsManager
|
|
@StateObject private var routerPath = RouterPath()
|
|
@Binding var popToRootTab: Tab
|
|
|
|
var body: some View {
|
|
NavigationStack(path: $routerPath.path) {
|
|
ConversationsListView()
|
|
.withAppRouter()
|
|
.withSheetDestinations(sheetDestinations: $routerPath.presentedSheet)
|
|
.toolbar {
|
|
if UIDevice.current.userInterfaceIdiom != .pad {
|
|
ToolbarItem(placement: .navigationBarLeading) {
|
|
AppAccountsSelectorView(routerPath: routerPath)
|
|
}
|
|
}
|
|
}
|
|
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar)
|
|
.id(client.id)
|
|
}
|
|
.onChange(of: $popToRootTab.wrappedValue) { popToRootTab in
|
|
if popToRootTab == .messages {
|
|
routerPath.path = []
|
|
}
|
|
}
|
|
.onChange(of: client.id) { _ in
|
|
routerPath.path = []
|
|
}
|
|
.onAppear {
|
|
routerPath.client = client
|
|
}
|
|
.withSafariRouter()
|
|
.environmentObject(routerPath)
|
|
}
|
|
}
|