예제 #1
0
        protected virtual async Task Act(ISyncManager syncManager)
        {
            var progressMonitoring = MonitorProgress(syncManager);
            await syncManager.ForceFullSync();

            await progressMonitoring;
        }
 public IObservable <Unit> Execute()
 => userDataSource.Current
 .FirstAsync()
 .SelectMany(createWorkspace)
 .SelectMany(updateDefaultWorkspace)
 .SelectMany(_ => syncManager.PushSync().LastAsync())
 .SelectMany(_ => syncManager.ForceFullSync().LastAsync())
 .SelectUnit();
예제 #3
0
 public IObservable <SyncOutcome> Execute()
 {
     analyticsService.BackgroundSyncStarted.Track();
     return(syncManager.ForceFullSync()
            .LastAsync()
            .Select(_ => SyncOutcome.NewData)
            .Catch((Exception error) => syncFailed(error))
            .Do(outcome =>
                analyticsService.BackgroundSyncFinished.Track(outcome.ToString())));
 }
예제 #4
0
        private async void onInteractorFactory(ISyncManager syncManager)
        {
            lastTimeUsageStorage.SetLogin(timeService.CurrentDateTime);

            await syncManager.ForceFullSync();

            onboardingStorage.SetIsNewUser(false);

            await navigationService.Navigate <MainTabBarViewModel>();
        }
예제 #5
0
        private async Task tryAgain()
        {
            var anyWorkspaceIsAvailable = await syncManager.ForceFullSync()
                                          .Where(state => state == SyncState.Sleep)
                                          .SelectMany(_ => interactorFactory.GetAllWorkspaces().Execute())
                                          .Any(workspaces => workspaces.Any());

            if (anyWorkspaceIsAvailable)
            {
                Close();
            }
        }
예제 #6
0
        private async void onInteractorFactory(ISyncManager syncManager)
        {
            successfulSignupSubject.OnNext(Unit.Default);

            lastTimeUsageStorage.SetLogin(timeService.CurrentDateTime);

            await syncManager.ForceFullSync();

            onboardingStorage.SetIsNewUser(true);
            onboardingStorage.SetUserSignedUp();

            await navigationService.Navigate <MainTabBarViewModel>();
        }
예제 #7
0
        public void Start(ISyncManager syncManager)
        {
            Stop();

            backgroundService.AppResumedFromBackground
            .Where(timeInBackground => timeInBackground >= MinimumTimeInBackgroundForFullSync)
            .SelectMany(_ => syncManager.ForceFullSync())
            .Subscribe()
            .DisposedBy(syncingDisposeBag);

            timeService.MidnightObservable
            .Subscribe(_ => syncManager.CleanUp())
            .DisposedBy(syncingDisposeBag);
        }
        public IObservable <SyncOutcome> Execute()
        {
            var syncTimeStopwatch = stopwatchProvider.Create(MeasuredOperation.BackgroundSync);

            syncTimeStopwatch.Start();
            analyticsService.BackgroundSyncStarted.Track();
            return(syncManager.ForceFullSync()
                   .LastAsync()
                   .Select(_ => SyncOutcome.NewData)
                   .Catch((Exception error) => syncFailed(error))
                   .Do(outcome =>
            {
                syncTimeStopwatch.Stop();
                analyticsService.BackgroundSyncFinished.Track(outcome.ToString());
            }));
        }
예제 #9
0
        private async void sync(ISyncManager syncManager, ITimeEntriesSource timeEntries)
        {
            var numberOfSyncedTimeEntries = 0;

            // To ignore time entries created/updated in the app it is enough to filter out all the ones which need sync.
            // There is still a problem with the entities which are created in the app and are immediately pushed
            // during the initial sync. I think it's OK to include these for the time being and re-evaluate this
            // decision once we collect some data.

            var subscription =
                Observable.Merge(
                    timeEntries.Created.Where(timeEntry => timeEntry.SyncStatus == SyncStatus.InSync).SelectUnit(),
                    timeEntries.Updated.Where(update => update.Entity.SyncStatus == SyncStatus.InSync).SelectUnit(),
                    timeEntries.Deleted.SelectUnit())
                .Subscribe(_ => numberOfSyncedTimeEntries++);

            await syncManager.ForceFullSync();

            subscription.Dispose();

            analyticsService.NumberOfSyncedTimeEntriesWhenResumingTheAppFromBackground.Track(numberOfSyncedTimeEntries);
        }
예제 #10
0
        protected override async Task Act(ISyncManager syncManager)
        {
            await syncManager.PullTimeEntries();

            await syncManager.ForceFullSync();
        }
예제 #11
0
 public static void InitiateFullSync <T>(this ISyncManager syncManager, T _)
 {
     syncManager.ForceFullSync();
 }
예제 #12
0
 public static void InitiateFullSync(this ISyncManager syncManager)
 {
     var _ = syncManager.ForceFullSync();
 }
예제 #13
0
        private void onSyncManager(ISyncManager syncManager)
        {
            syncManager.ForceFullSync();

            navigationService.Navigate <MainTabBarViewModel>();
        }
예제 #14
0
 private async Task refresh()
 {
     await syncManager.ForceFullSync();
 }