Beispiel #1
0
        protected override async void NavigateToFirstViewModel(object hint = null)
        {
            onboardingStorage.SetFirstOpened(timeService.CurrentDateTime);

            if (accessRestrictionStorage.IsApiOutdated() || accessRestrictionStorage.IsClientOutdated())
            {
                await navigationService.Navigate <OutdatedAppViewModel>();

                return;
            }

            if (!userAccessManager.TryInitializingAccessToUserData(out var syncManager, out var interactorFactory))
            {
                await navigationService.Navigate <TFirstViewModelWhenNotLoggedIn>();

                return;
            }

            var user = await interactorFactory.GetCurrentUser().Execute();

            if (accessRestrictionStorage.IsUnauthorized(user.ApiToken))
            {
                await navigationService.Navigate <TokenResetViewModel>();

                return;
            }

            syncManager.ForceFullSync().Subscribe();

            await navigationService.Navigate <MainTabBarViewModel>();
        }
Beispiel #2
0
        protected override async void NavigateToFirstViewModel(object hint = null)
        {
            onboardingStorage.SetFirstOpened(timeService.CurrentDateTime);

            if (accessRestrictionStorage.IsApiOutdated() || accessRestrictionStorage.IsClientOutdated())
            {
                await navigationService.Navigate <OnboardingViewModel>();

                await navigationService.Navigate <OutdatedAppViewModel>();

                return;
            }

            var dataSource = loginManager.GetDataSourceIfLoggedIn();

            if (dataSource == null)
            {
                await navigationService.Navigate <TFirstViewModelWhenNotLoggedIn>();

                return;
            }

            var user = await dataSource.User.Current.FirstAsync();

            if (accessRestrictionStorage.IsUnauthorized(user.ApiToken))
            {
                await navigationService.Navigate <TokenResetViewModel>();

                return;
            }

            var _ = dataSource.StartSyncing();

            await navigationService.Navigate <MainViewModel>();
        }
Beispiel #3
0
        public async void Start(object hint = null)
        {
            if (accessRestrictionStorage.IsApiOutdated() || accessRestrictionStorage.IsClientOutdated())
            {
                await navigationService.Navigate <OnboardingViewModel>();

                await navigationService.Navigate <OutdatedAppViewModel>();

                return;
            }

            var dataSource = loginManager.GetDataSourceIfLoggedIn();

            if (dataSource == null)
            {
                await navigationService.Navigate <OnboardingViewModel>();

                return;
            }

            var user = await dataSource.User.Current;

            if (accessRestrictionStorage.IsUnauthorized(user.ApiToken))
            {
                await navigationService.Navigate <TokenResetViewModel>();

                return;
            }

            var _ = dataSource.StartSyncing();

            await navigationService.Navigate <MainViewModel>();
        }