public IObservable <IThreadSafeTimeEntry> Execute()
 => dataSource.TimeEntries
 .GetAll(te => !te.IsDeleted)
 .Select(timeEntries => timeEntries.MaxBy(te => te.Start))
 .Select(newTimeEntry)
 .SelectMany(dataSource.TimeEntries.Create)
 .Do(_ => syncManager.InitiatePushSync())
 .Track(StartTimeEntryEvent.With(TimeEntryStartOrigin.ContinueMostRecent), analyticsService);
예제 #2
0
        private async Task updatePreferences(
            New <DurationFormat> durationFormat = default(New <DurationFormat>),
            New <DateFormat> dateFormat         = default(New <DateFormat>),
            New <TimeFormat> timeFormat         = default(New <TimeFormat>),
            New <bool> collapseTimeEntries      = default(New <bool>))
        {
            var preferencesDto = new EditPreferencesDTO
            {
                DurationFormat      = durationFormat,
                DateFormat          = dateFormat,
                TimeOfDayFormat     = timeFormat,
                CollapseTimeEntries = collapseTimeEntries
            };

            await interactorFactory.UpdatePreferences(preferencesDto).Execute();

            syncManager.InitiatePushSync();
        }
예제 #3
0
        private async Task <bool> delete(ActionType actionType, int entriesCount, IInteractor <IObservable <Unit> > deletionInteractor)
        {
            var isDeletionConfirmed = await View.ConfirmDestructiveAction(actionType, entriesCount);

            if (!isDeletionConfirmed)
            {
                return(false);
            }

            await deletionInteractor.Execute();

            syncManager.InitiatePushSync();

            var deleteMode = entriesCount > 1
                ? DeleteTimeEntryOrigin.GroupedEditView
                : DeleteTimeEntryOrigin.EditView;

            analyticsService.DeleteTimeEntry.Track(deleteMode);

            return(true);
        }
 public static void InitiatePushSync <T>(this ISyncManager syncManager, T _)
 {
     syncManager.InitiatePushSync();
 }