Better viewId for some tabs

This commit is contained in:
Thomas Ricouard 2023-01-29 11:52:11 +01:00
parent e84a57ed7f
commit e5b6e79fa9
3 changed files with 7 additions and 3 deletions

View file

@ -13,6 +13,7 @@ struct MessagesTab: View {
@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
@ -29,7 +30,7 @@ struct MessagesTab: View {
}
}
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar)
.id(currentAccount.account?.id)
.id(appAccount.currentAccount.id)
}
.onChange(of: $popToRootTab.wrappedValue) { popToRootTab in
if popToRootTab == .messages {

View file

@ -11,6 +11,7 @@ struct NotificationsTab: View {
@EnvironmentObject private var theme: Theme
@EnvironmentObject private var client: Client
@EnvironmentObject private var watcher: StreamWatcher
@EnvironmentObject private var appAccount: AppAccountsManager
@EnvironmentObject private var currentAccount: CurrentAccount
@EnvironmentObject private var userPreferences: UserPreferences
@StateObject private var routerPath = RouterPath()
@ -33,7 +34,7 @@ struct NotificationsTab: View {
}
}
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar)
.id(currentAccount.account?.id)
.id(appAccount.currentAccount.id)
}
.onAppear {
routerPath.client = client

View file

@ -8,6 +8,7 @@ import SwiftUI
import Timeline
struct TimelineTab: View {
@EnvironmentObject private var appAccount: AppAccountsManager
@EnvironmentObject private var theme: Theme
@EnvironmentObject private var currentAccount: CurrentAccount
@EnvironmentObject private var preferences: UserPreferences
@ -36,7 +37,7 @@ struct TimelineTab: View {
toolbarView
}
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar)
.id(currentAccount.account?.id)
.id(appAccount.currentAccount.id)
}
.onAppear {
routerPath.client = client
@ -143,6 +144,7 @@ struct TimelineTab: View {
if UIDevice.current.userInterfaceIdiom != .pad {
ToolbarItem(placement: .navigationBarLeading) {
AppAccountsSelectorView(routerPath: routerPath)
.id(currentAccount.account?.id)
}
}
statusEditorToolbarItem(routerPath: routerPath,