mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-12-23 07:36:48 +00:00
Ensure account and tab switching is done without animations
This commit is contained in:
parent
dae7b85d3d
commit
5ab9566ca5
4 changed files with 23 additions and 9 deletions
|
@ -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 a new issue