Package com.zendesk.sdk.storage
Interface SdkSettingsStorage
-
public interface SdkSettingsStorageThis class contains methods for interacting with the storedSdkSettings.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description booleanareSettingsUpToDate(long duration, java.util.concurrent.TimeUnit timeUnit)Determine if the stored settings older than the provided amount of time.voiddeleteStoredSettings()Deletes any storedMobileSettingsthat may be present in theSharedPreferences.SafeMobileSettingsgetStoredSettings()booleanhasStoredSdkSettings()This method can check to see if there are any storedMobileSettingsin theSharedPreferencesvoidsetStoredSettings(SafeMobileSettings mobileSettings)Saves the suppliedMobileSettingstoSharedPreferences.
-
-
-
Method Detail
-
hasStoredSdkSettings
boolean hasStoredSdkSettings()
This method can check to see if there are any storedMobileSettingsin theSharedPreferences- Returns:
- true if the storage has
MobileSettingsstored
-
areSettingsUpToDate
boolean areSettingsUpToDate(long duration, java.util.concurrent.TimeUnit timeUnit)Determine if the stored settings older than the provided amount of time.- Parameters:
duration- the time duration in the giventimeUnittimeUnit- the unit of thedurationargument- Returns:
trueif the settings are loaded in the provided time range,falseif they are outdated.
-
getStoredSettings
SafeMobileSettings getStoredSettings()
Gets the storedMobileSettingsfrom theSharedPreferences, wrapped in aSafeMobileSettings.If the
MobileSettingswere found but do not deserialise correctly then the saved settings will be removed usingSdkSettingsStorage.deleteStoredSettings()as this is probably due to irrecoverable differences in the stored model and a new one.- Returns:
- The
SafeMobileSettingswhich wraps theMobileSettingsif they are available in storage or null if there were no saved settings or there was a problem with deserialisation. TheSafeMobileSettingswill handle the case that theMobileSettings, or any of its properties, are null.
-
setStoredSettings
void setStoredSettings(SafeMobileSettings mobileSettings)
Saves the suppliedMobileSettingstoSharedPreferences.If the supplied
MobileSettingsis null then this will not save the settings toSharedPreferences. If the intention is to delete them then please useSdkSettingsStorage.deleteStoredSettings()- Parameters:
mobileSettings- TheSafeMobileSettingsto save.
-
deleteStoredSettings
void deleteStoredSettings()
Deletes any storedMobileSettingsthat may be present in theSharedPreferences.Note that this clears all keys that have been created by this class. Please be wary of this if you are using this class to store more than just the JSON representation of the
MobileSettingsusing the MOBILE_SETTINGS_KEY
-
-