Skip to content

Commit

Permalink
Fix account swap for favorites and bookmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimillian committed Jan 4, 2024
1 parent 9ec9c94 commit 3d29c9e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions IceCubesApp/App/Tabs/NavigationTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import SwiftUI
import Env
import AppAccount
import DesignSystem
import Network

@MainActor
struct NavigationTab<Content: View>: View {
Expand All @@ -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

Expand All @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
}

0 comments on commit 3d29c9e

Please sign in to comment.