Class RateMyAppStorage
- java.lang.Object
-
- com.zendesk.sdk.storage.RateMyAppStorage
-
- All Implemented Interfaces:
- SdkStorage.UserStorage
public class RateMyAppStorage extends java.lang.Object implements SdkStorage.UserStorage
This class handles the storage for preferences and settings for theRateMyAppDialog
-
-
Constructor Summary
Constructors Constructor and Description RateMyAppStorage(Context context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidclearUserData()This method will be called when user data must be clearedjava.lang.StringgetCacheKey()Gets the cache key for the user storage.longgetCanShowAfterTime()Gets the time in milliseconds (UTC) that the dialog is permitted to show after.intgetNumberOfLaunches()Gets the number of the times thatcom.zendesk.sdk.rating.ui.RateMyAppDialog#show(android.support.v4.app.FragmentActivity)has been calledjava.lang.StringgetSavedFeedback()Gets the saved feedback for theFeedbackConnectorif there is any.voidincrementNumberOfLaunches()Increments the number of launches of theRateMyAppDialogbooleanisDontShowAgain()Checks if the dialog should never be shown again to the user.booleanisLaunchTimeMet()Checks if the time condition of theRateMyAppDialoghas been met.booleanisNumberOfLaunchesMet()Checks if the number of launches condition of theRateMyAppDialoghas been met.booleanisRatedForCurrentVersion()Checks if the app has been rated for the current version of the app.voidreset()Resets all stored data for RateMyApp.voidsetDontShowAgain()Stores the version that the user had when they chose don't remind me again.voidsetRatedForCurrentVersion()Stores the version of the app that was rated.voidsetSavedFeedback(java.lang.String feedback)Sets the saved feedback for theFeedbackConnector
-
-
-
Method Detail
-
getNumberOfLaunches
public int getNumberOfLaunches()
Gets the number of the times thatcom.zendesk.sdk.rating.ui.RateMyAppDialog#show(android.support.v4.app.FragmentActivity)has been called- Returns:
- the number of times show has been called on the dialog, or 0 if it is the first time.
-
getCanShowAfterTime
public long getCanShowAfterTime()
Gets the time in milliseconds (UTC) that the dialog is permitted to show after.The
RateMyAppDialogcan be configured to not show until a certain period of time has elapsed. This is controlled byRateMyAppSettings.getDuration()that is specified by the server. For example if on the first launch the system clock is 1388534400000 (Wednesday, January 1, 2014 12:00:00 AM UTC) and the minimum time specified is one week (604800000) then this method will return (1388534400000 + 604800000 = 1389139200000). On the next launch this method will check the current time in milliseconds against 1389139200000 and if the current time is greater than or equal to 1389139200000 then we're ok to show the dialog from a time point of view.- Returns:
- the time, in milliseconds UTC when the dialog will be allowed to be shown.
-
incrementNumberOfLaunches
public void incrementNumberOfLaunches()
Increments the number of launches of theRateMyAppDialog
-
isNumberOfLaunchesMet
public boolean isNumberOfLaunchesMet()
Checks if the number of launches condition of theRateMyAppDialoghas been met.This setting is determined by checking if the current number of times that the
com.zendesk.sdk.rating.ui.RateMyAppDialog#show(android.support.v4.app.FragmentActivity)has been invoked is larger thanRateMyAppSettings.getVisits()- Returns:
- true if the current number of launches is greater than or equal to
-
isLaunchTimeMet
public boolean isLaunchTimeMet()
Checks if the time condition of theRateMyAppDialoghas been met.- Returns:
- true if the time condition of the dialog has been met.
-
isRatedForCurrentVersion
public boolean isRatedForCurrentVersion()
Checks if the app has been rated for the current version of the app.- Returns:
- true if the app has been rated, false otherwise
-
setRatedForCurrentVersion
public void setRatedForCurrentVersion()
Stores the version of the app that was rated.The version that is saved is automatically read from your App's metadata.
-
isDontShowAgain
public boolean isDontShowAgain()
Checks if the dialog should never be shown again to the user.- Returns:
- true if the user has previous selected the don't show me again button, false otherwise
-
setDontShowAgain
public void setDontShowAgain()
Stores the version that the user had when they chose don't remind me again. This will cause the dialog to never show again.This may also be used to ensure that the dialog doesn't show again after feedback has been sent.
-
getSavedFeedback
public java.lang.String getSavedFeedback()
Gets the saved feedback for theFeedbackConnectorif there is any.- Returns:
- The saved feedback for the or null if there was no saved feedback
-
setSavedFeedback
public void setSavedFeedback(java.lang.String feedback)
Sets the saved feedback for theFeedbackConnector- Parameters:
feedback- The feedback to save for the specified connector
-
reset
public void reset()
Resets all stored data for RateMyApp. Calling this may result in the dialog being shown again even if the user has previously called don't show me again or already rated for the current version.
-
clearUserData
public void clearUserData()
Description copied from interface:SdkStorage.UserStorageThis method will be called when user data must be cleared- Specified by:
clearUserDatain interfaceSdkStorage.UserStorage
-
getCacheKey
public java.lang.String getCacheKey()
Description copied from interface:SdkStorage.UserStorageGets the cache key for the user storage.- Specified by:
getCacheKeyin interfaceSdkStorage.UserStorage- Returns:
- the cache key for the user storage
-
-