private bool shouldScheduleSyncJob(IKeyValueStorage keyValueStorage)
        {
            var now = DateTimeOffset.Now;
            var hasPendingJobScheduled = keyValueStorage.GetBool(HasPendingSyncJobServiceScheduledKey);
            var lastSyncJobScheduledAt = keyValueStorage.GetDateTimeOffset(LastSyncJobScheduledAtKey).GetValueOrDefault();

            return(!hasPendingJobScheduled || now.Subtract(lastSyncJobScheduledAt).TotalHours > jobScheduleExpirationInHours);
        }
Пример #2
0
 public override bool GetBool(string key)
 {
     return(delegator.GetBool(key));
 }
Пример #3
0
 public bool HasNoWorkspace()
 {
     return(keyValueStorage.GetBool(noWorkspaceKey));
 }
Пример #4
0
 public static PushNotificationsConfiguration ReadStoredPushNotificationsConfiguration(this IKeyValueStorage keyValueStorage)
 => new PushNotificationsConfiguration(
     keyValueStorage.GetBool(RemoteConfigKeys.RegisterPushNotificationsTokenWithServerParameter),
     keyValueStorage.GetBool(RemoteConfigKeys.HandlePushNotificationsParameter));
Пример #5
0
 public bool CompletedOnboarding() => keyValueStorage.GetBool(completedOnboardingKey);
Пример #6
0
        public SettingsStorage(Version version, IKeyValueStorage keyValueStorage)
        {
            Ensure.Argument.IsNotNull(keyValueStorage, nameof(keyValueStorage));

            this.version         = version;
            this.keyValueStorage = keyValueStorage;

            (isNewUserSubject, IsNewUser) = prepareSubjectAndObservable(isNewUserKey, keyValueStorage.GetBool);
            (enabledCalendarsSubject, EnabledCalendars) = prepareSubjectAndObservable(EnabledCalendarIds());
            (isManualModeEnabledSubject, IsManualModeEnabledObservable) = prepareSubjectAndObservable(preferManualModeKey, keyValueStorage.GetBool);
            (areRunningTimerNotificationsEnabledSubject, AreRunningTimerNotificationsEnabledObservable) = prepareSubjectAndObservable(runningTimerNotificationsKey, keyValueStorage.GetBool);
            (areStoppedTimerNotificationsEnabledSubject, AreStoppedTimerNotificationsEnabledObservable) = prepareSubjectAndObservable(stoppedTimerNotificationsKey, keyValueStorage.GetBool);
            (hasTappedTimeEntrySubject, HasTappedTimeEntry)                     = prepareSubjectAndObservable(hasTappedTimeEntryKey, keyValueStorage.GetBool);
            (hasEditedTimeEntrySubject, HasEditedTimeEntry)                     = prepareSubjectAndObservable(hasEditedTimeEntryKey, keyValueStorage.GetBool);
            (hasSelectedProjectSubject, HasSelectedProject)                     = prepareSubjectAndObservable(hasSelectedProjectKey, keyValueStorage.GetBool);
            (stopButtonWasTappedSubject, StopButtonWasTappedBefore)             = prepareSubjectAndObservable(stopButtonWasTappedBeforeKey, keyValueStorage.GetBool);
            (userSignedUpUsingTheAppSubject, UserSignedUpUsingTheApp)           = prepareSubjectAndObservable(userSignedUpUsingTheAppKey, keyValueStorage.GetBool);
            (startButtonWasTappedSubject, StartButtonWasTappedBefore)           = prepareSubjectAndObservable(startButtonWasTappedBeforeKey, keyValueStorage.GetBool);
            (projectOrTagWasAddedSubject, ProjectOrTagWasAddedBefore)           = prepareSubjectAndObservable(projectOrTagWasAddedBeforeKey, keyValueStorage.GetBool);
            (calendarNotificationsEnabledSubject, CalendarNotificationsEnabled) = prepareSubjectAndObservable(calendarNotificationsEnabledKey, keyValueStorage.GetBool);
            (navigatedAwayFromMainViewAfterTappingStopButtonSubject, NavigatedAwayFromMainViewAfterTappingStopButton) = prepareSubjectAndObservable(navigatedAwayFromMainViewAfterTappingStopButtonKey, keyValueStorage.GetBool);
            (hasTimeEntryBeenContinuedSubject, HasTimeEntryBeenContinued) = prepareSubjectAndObservable(hasTimeEntryBeenContinuedKey, keyValueStorage.GetBool);
            (timeSpanBeforeCalendarNotificationsSubject, TimeSpanBeforeCalendarNotifications) = prepareSubjectAndObservable(keyValueStorage.GetTimeSpan(timeSpanBeforeCalendarNotificationsKey) ?? defaultTimeSpanBeforeCalendarNotificationsSubject);
            (swipeActionsEnabledSubject, SwipeActionsEnabled) = prepareSubjectAndObservable(swipeActionsDisabledKey, key => !keyValueStorage.GetBool(key));
        }
Пример #7
0
 public void Upsert_Bool()
 {
     kvs.Upsert(key, true);
     Assert.AreEqual(true, kvs.GetBool(key));
 }
Пример #8
0
 public bool IsNewUser() => keyValueStorage.GetBool(isNewUserKey);