Commit 506ace5d authored by Kateryna Kostiuk's avatar Kateryna Kostiuk

UI/UX: account

Navigate so smart list when account removed

Change-Id: I0c2d2a819c4619300f514a5ff67b97d2abfa0ceb
parent 0eb233d5
......@@ -33,6 +33,7 @@ public enum AppState: State {
case needToOnboard(animated: Bool, isFirstAccount: Bool)
case addAccount
case allSet
case accountRemoved
}
public enum VCType: String {
......@@ -87,6 +88,8 @@ final class AppCoordinator: Coordinator, StateableResponsive {
self.showMainInterface()
case .addAccount:
self.showWalkthrough(animated: false, isAccountFirst: false)
case .accountRemoved:
self.accountRemoved()
}
}).disposed(by: self.disposeBag)
}
......@@ -99,6 +102,10 @@ final class AppCoordinator: Coordinator, StateableResponsive {
self.dispatchApplication()
}
func accountRemoved() {
self.tabBarViewController.selectedIndex = 0
}
/// Handles the switch between the three supported screens.
private func dispatchApplication() {
if self.injectionBag.accountService.accounts.isEmpty {
......
......@@ -502,6 +502,7 @@ class MeViewModel: ViewModel, Stateable {
UserDefaults.standard.set(allAccounts[1].id, forKey: self.accountService.selectedAccountID)
self.accountService.currentAccount = allAccounts[1]
self.accountService.removeAccount(id: account.id)
self.stateSubject.onNext(MeState.accountRemoved)
}
lazy var accountEnabled: Variable<Bool> = {
......
......@@ -30,6 +30,7 @@ public enum MeState: State {
case linkNewDevice
case blockedContacts
case needToOnboard
case accountRemoved
}
/// This Coordinator drives the me/settings navigation
......@@ -65,7 +66,8 @@ class MeCoordinator: Coordinator, StateableResponsive {
self.showBlockedContacts()
case .needToOnboard:
self.needToOnboard()
case .accountRemoved:
self.accountRemoved()
}
}).disposed(by: self.disposeBag)
}
......@@ -76,6 +78,12 @@ class MeCoordinator: Coordinator, StateableResponsive {
}
}
func accountRemoved() {
if let parent = self.parentCoordinator as? AppCoordinator {
parent.stateSubject.onNext(AppState.accountRemoved)
}
}
func start () {
let meViewController = MeViewController.instantiate(with: self.injectionBag)
meViewController.model = EditProfileViewModel(profileService: self.injectionBag.profileService,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment