diff --git a/Tusker/MainSceneDelegate.swift b/Tusker/MainSceneDelegate.swift index c4be65615d..d03ee87ce2 100644 --- a/Tusker/MainSceneDelegate.swift +++ b/Tusker/MainSceneDelegate.swift @@ -142,7 +142,7 @@ class MainSceneDelegate: UIResponder, UIWindowSceneDelegate { } func activateAccount(_ account: LocalData.UserAccountInfo, animated: Bool) { - + let oldMostRecentAccount = LocalData.shared.mostRecentAccountID LocalData.shared.setMostRecentAccount(account) window!.windowScene!.session.mastodonController = MastodonController.getForAccount(account) @@ -150,7 +150,7 @@ class MainSceneDelegate: UIResponder, UIWindowSceneDelegate { if let container = window?.rootViewController as? AccountSwitchingContainerViewController { let direction: AccountSwitchingContainerViewController.AnimationDirection if animated, - let oldIndex = LocalData.shared.accounts.firstIndex(where: { $0.id == LocalData.shared.mostRecentAccountID }), + let oldIndex = LocalData.shared.accounts.firstIndex(where: { $0.id == oldMostRecentAccount }), let newIndex = LocalData.shared.accounts.firstIndex(of: account) { direction = newIndex > oldIndex ? .upwards : .downwards } else {