Ensure account and tab switching is done without animations
This commit is contained in:
parent
dae7b85d3d
commit
5ab9566ca5
|
@ -133,14 +133,18 @@ struct IceCubesApp: App {
|
|||
TabView(selection: .init(get: {
|
||||
selectedTab
|
||||
}, set: { newTab in
|
||||
if newTab == selectedTab {
|
||||
/// Stupid hack to trigger onChange binding in tab views.
|
||||
popToRootTab = .other
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) {
|
||||
popToRootTab = selectedTab
|
||||
var transaction = Transaction()
|
||||
transaction.disablesAnimations = true
|
||||
withTransaction(transaction) {
|
||||
if newTab == selectedTab {
|
||||
/// Stupid hack to trigger onChange binding in tab views.
|
||||
popToRootTab = .other
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) {
|
||||
popToRootTab = selectedTab
|
||||
}
|
||||
}
|
||||
selectedTab = newTab
|
||||
}
|
||||
selectedTab = newTab
|
||||
HapticManager.shared.fireHaptic(of: .tabSelection)
|
||||
})) {
|
||||
ForEach(availableTabs) { tab in
|
||||
|
|
|
@ -75,7 +75,9 @@ struct SideBarView<Content: View>: View {
|
|||
if account.id == appAccounts.currentAccount.id {
|
||||
selectedTab = .profile
|
||||
} else {
|
||||
withAnimation {
|
||||
var transation = Transaction()
|
||||
transation.disablesAnimations = true
|
||||
withTransaction(transation) {
|
||||
appAccounts.currentAccount = account
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,11 @@ public struct AppAccountView: View {
|
|||
{
|
||||
routerPath.navigate(to: .accountSettingsWithAccount(account: account, appAccount: viewModel.appAccount))
|
||||
} else {
|
||||
appAccounts.currentAccount = viewModel.appAccount
|
||||
var transation = Transaction()
|
||||
transation.disablesAnimations = true
|
||||
withTransaction(transation) {
|
||||
appAccounts.currentAccount = viewModel.appAccount
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,11 @@ public struct AppAccountsSelectorView: View {
|
|||
{
|
||||
routerPath.navigate(to: .accountDetailWithAccount(account: account))
|
||||
} else {
|
||||
appAccounts.currentAccount = viewModel.appAccount
|
||||
var transation = Transaction()
|
||||
transation.disablesAnimations = true
|
||||
withTransaction(transation) {
|
||||
appAccounts.currentAccount = viewModel.appAccount
|
||||
}
|
||||
}
|
||||
|
||||
HapticManager.shared.fireHaptic(of: .buttonPress)
|
||||
|
|
Loading…
Reference in New Issue