public Task ExecuteAsync() { if (_preferencesService.ContainsKey(START_DATETIME)) { MigrateDateTimeToEpoch(START_DATETIME, PreferenceKey.StartDateTimeEpoch, TimeSpan.Zero, DateTime.UtcNow); } if (_preferencesService.ContainsKey(TERMS_OF_SERVICE_LAST_UPDATE_DATETIME)) { MigrateDateTimeToEpoch( TERMS_OF_SERVICE_LAST_UPDATE_DATETIME, PreferenceKey.TermsOfServiceLastUpdateDateTimeEpoch, -TIME_DIFFERENCIAL_JST_UTC, FALLBACK_DATETIME ); } if (_preferencesService.ContainsKey(PRIVACY_POLICY_LAST_UPDATE_DATETIME)) { MigrateDateTimeToEpoch( PRIVACY_POLICY_LAST_UPDATE_DATETIME, PreferenceKey.PrivacyPolicyLastUpdateDateTimeEpoch, -TIME_DIFFERENCIAL_JST_UTC, FALLBACK_DATETIME ); } return(Task.CompletedTask); }
public async Task Migrate(TermsType termsType, bool isAgree) { loggerService.StartMethod(); var applicationPropertyKey = termsType == TermsType.TermsOfService ? TermsOfServiceLastUpdateDateKey : PrivacyPolicyLastUpdateDateKey; var preferenceKey = termsType == TermsType.TermsOfService ? PreferenceKey.TermsOfServiceLastUpdateDateTime : PreferenceKey.PrivacyPolicyLastUpdateDateTime; if (preferencesService.ContainsKey(applicationPropertyKey)) { return; } if (isAgree) { if (applicationPropertyService.ContainsKey(applicationPropertyKey)) { var lastUpdateDate = (DateTime)applicationPropertyService.GetProperties(applicationPropertyKey); preferencesService.SetValue(preferenceKey, lastUpdateDate); } else { preferencesService.SetValue(preferenceKey, new DateTime()); } } await applicationPropertyService.Remove(applicationPropertyKey); loggerService.EndMethod(); }
public Task ExecuteAsync() { if (_preferencesService.ContainsKey(START_DATETIME)) { MigrateDateTimeToEpoch(START_DATETIME, PreferenceKey.StartDateTimeEpoch, timeZoneInfo: null, fallbackDateTime: DateTime.UtcNow ); } if (_preferencesService.ContainsKey(TERMS_OF_SERVICE_LAST_UPDATE_DATETIME)) { MigrateDateTimeToEpoch( TERMS_OF_SERVICE_LAST_UPDATE_DATETIME, PreferenceKey.TermsOfServiceLastUpdateDateTimeEpoch, timeZoneInfo: AppConstants.TIMEZONE_JST, fallbackDateTime: AppConstants.COCOA_FIRST_RELEASE_DATE ); } if (_preferencesService.ContainsKey(PRIVACY_POLICY_LAST_UPDATE_DATETIME)) { MigrateDateTimeToEpoch( PRIVACY_POLICY_LAST_UPDATE_DATETIME, PreferenceKey.PrivacyPolicyLastUpdateDateTimeEpoch, timeZoneInfo: AppConstants.TIMEZONE_JST, fallbackDateTime: AppConstants.COCOA_FIRST_RELEASE_DATE ); } return(Task.CompletedTask); }
private Version GuessVersion() { if (_preferencesService.ContainsKey(PreferenceKey.StartDateTimeEpoch)) { return(VERSION_1_3_0); } if (_preferencesService.ContainsKey(PREFERENCE_KEY_START_DATETIME)) { return(VERSION_1_2_2); } return(VERSION_1_0_0); }
public SendEventLogState GetSendEventLogState(EventType eventType) { string stateString = EMPTY_DICT; try { _loggerService.StartMethod(); if (!_preferencesService.ContainsKey(PreferenceKey.SendEventLogState)) { return(SendEventLogState.NotSet); } stateString = _preferencesService.GetStringValue( PreferenceKey.SendEventLogState, EMPTY_DICT ); IDictionary <string, int> stateDict = JsonConvert.DeserializeObject <IDictionary <string, int> >(stateString); if (!stateDict.ContainsKey(eventType.ToString())) { return(SendEventLogState.NotSet); } int value = stateDict[eventType.ToString()]; return((SendEventLogState)Enum.ToObject(typeof(SendEventLogState), value)); } catch (JsonReaderException exception) { _preferencesService.SetStringValue(PreferenceKey.SendEventLogState, EMPTY_DICT); _loggerService.Exception($"JsonSerializationException {stateString}", exception); _loggerService.Warning($"Preference-key {PreferenceKey.SendEventLogState} has been initialized."); } finally { _loggerService.EndMethod(); } return(SendEventLogState.NotSet); }
public bool IsAllAgreed() { return(_preferencesService.ContainsKey(PreferenceKey.TermsOfServiceLastUpdateDateTimeEpoch) && _preferencesService.ContainsKey(PreferenceKey.PrivacyPolicyLastUpdateDateTimeEpoch)) ; }