mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-02-17 02:05:13 +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 Env
|
||||||
import AppAccount
|
import AppAccount
|
||||||
import DesignSystem
|
import DesignSystem
|
||||||
|
import Network
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
struct NavigationTab<Content: View>: View {
|
struct NavigationTab<Content: View>: View {
|
||||||
|
@ -11,6 +12,7 @@ struct NavigationTab<Content: View>: View {
|
||||||
@Environment(CurrentAccount.self) private var currentAccount
|
@Environment(CurrentAccount.self) private var currentAccount
|
||||||
@Environment(UserPreferences.self) private var userPreferences
|
@Environment(UserPreferences.self) private var userPreferences
|
||||||
@Environment(Theme.self) private var theme
|
@Environment(Theme.self) private var theme
|
||||||
|
@Environment(Client.self) private var client
|
||||||
|
|
||||||
var content: () -> Content
|
var content: () -> Content
|
||||||
|
|
||||||
|
@ -26,10 +28,18 @@ struct NavigationTab<Content: View>: View {
|
||||||
.withEnvironments()
|
.withEnvironments()
|
||||||
.withAppRouter()
|
.withAppRouter()
|
||||||
.withSheetDestinations(sheetDestinations: $routerPath.presentedSheet)
|
.withSheetDestinations(sheetDestinations: $routerPath.presentedSheet)
|
||||||
|
.withSafariRouter()
|
||||||
.toolbar {
|
.toolbar {
|
||||||
ToolbarTab(routerPath: $routerPath)
|
ToolbarTab(routerPath: $routerPath)
|
||||||
}
|
}
|
||||||
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar)
|
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar)
|
||||||
|
.onChange(of: client.id) {
|
||||||
|
routerPath.path = []
|
||||||
|
}
|
||||||
|
.onAppear {
|
||||||
|
routerPath.client = client
|
||||||
|
}
|
||||||
|
.withSafariRouter()
|
||||||
}
|
}
|
||||||
.environment(routerPath)
|
.environment(routerPath)
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,5 +38,13 @@ public struct AccountStatusesListView: View {
|
||||||
await viewModel.fetchNewestStatuses(pullToRefresh: false)
|
await viewModel.fetchNewestStatuses(pullToRefresh: false)
|
||||||
isLoaded = true
|
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