private void navigateAccordingToAccessLevel(AccessLevel accessLevel, AppStart app) { var navigationService = IosDependencyContainer.Instance.NavigationService; switch (accessLevel) { case AccessLevel.AccessRestricted: navigationService.Navigate <OutdatedAppViewModel>(null); return; case AccessLevel.NotLoggedIn: navigationService.Navigate <LoginViewModel, CredentialsParameter>(CredentialsParameter.Empty, null); return; case AccessLevel.TokenRevoked: navigationService.Navigate <TokenResetViewModel>(null); return; case AccessLevel.LoggedIn: app.ForceFullSync(); var viewModel = IosDependencyContainer.Instance .ViewModelLoader .Load <MainTabBarViewModel>(); viewModel.Initialize(); Window.RootViewController = ViewControllerLocator.GetViewController(viewModel); return; } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); var dependencyContainer = AndroidDependencyContainer.Instance; registerTimezoneChangedBroadcastReceiver(dependencyContainer.TimeService); registerApplicationLifecycleObserver(dependencyContainer.BackgroundService); var app = new AppStart(dependencyContainer); app.UpdateOnboardingProgress(); var accessLevel = app.GetAccessLevel(); if (accessLevel != AccessLevel.LoggedIn) { navigateAccordingToAccessLevel(accessLevel); Finish(); return; } clearAllViewModelsAndSetupRootViewModel( dependencyContainer.ViewModelCache, dependencyContainer.ViewModelLoader); var navigationUrl = Intent.Data?.ToString() ?? getTrackUrlFromProcessedText(); if (string.IsNullOrEmpty(navigationUrl)) { app.ForceFullSync(); StartActivity(typeof(MainTabBarActivity)); Finish(); return; } handleDeepLink(new Uri(navigationUrl), dependencyContainer); return; }