mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-23 00:40:59 +00:00
Fix account swap for favorites and bookmarks
This commit is contained in:
parent
9ec9c94c9a
commit
3d29c9e600
2 changed files with 18 additions and 0 deletions
|
@ -2,6 +2,7 @@ import SwiftUI
|
|||
import Env
|
||||
import AppAccount
|
||||
import DesignSystem
|
||||
import Network
|
||||
|
||||
@MainActor
|
||||
struct NavigationTab<Content: View>: View {
|
||||
|
@ -11,6 +12,7 @@ struct NavigationTab<Content: View>: View {
|
|||
@Environment(CurrentAccount.self) private var currentAccount
|
||||
@Environment(UserPreferences.self) private var userPreferences
|
||||
@Environment(Theme.self) private var theme
|
||||
@Environment(Client.self) private var client
|
||||
|
||||
var content: () -> Content
|
||||
|
||||
|
@ -26,10 +28,18 @@ struct NavigationTab<Content: View>: View {
|
|||
.withEnvironments()
|
||||
.withAppRouter()
|
||||
.withSheetDestinations(sheetDestinations: $routerPath.presentedSheet)
|
||||
.withSafariRouter()
|
||||
.toolbar {
|
||||
ToolbarTab(routerPath: $routerPath)
|
||||
}
|
||||
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar)
|
||||
.onChange(of: client.id) {
|
||||
routerPath.path = []
|
||||
}
|
||||
.onAppear {
|
||||
routerPath.client = client
|
||||
}
|
||||
.withSafariRouter()
|
||||
}
|
||||
.environment(routerPath)
|
||||
}
|
||||
|
|
|
@ -38,5 +38,13 @@ public struct AccountStatusesListView: View {
|
|||
await viewModel.fetchNewestStatuses(pullToRefresh: false)
|
||||
isLoaded = true
|
||||
}
|
||||
.onChange(of: client.id) { _, _ in
|
||||
isLoaded = false
|
||||
viewModel.client = client
|
||||
Task {
|
||||
await viewModel.fetchNewestStatuses(pullToRefresh: false)
|
||||
isLoaded = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue