Package com.zendesk.sdk.network.impl
Class StubPushRegistrationResponseStorage
- java.lang.Object
-
- com.zendesk.sdk.network.impl.StubPushRegistrationResponseStorage
-
- All Implemented Interfaces:
- PushRegistrationResponseStorage, SdkStorage.UserStorage
public class StubPushRegistrationResponseStorage extends java.lang.Object implements PushRegistrationResponseStorage
-
-
Constructor Summary
Constructors Constructor and Description StubPushRegistrationResponseStorage()
-
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.PushRegistrationResponsegetPushRegistrationResponse()Gets aPushRegistrationResponseornullfrom storage.booleanhasStoredPushRegistrationResponse()voidremovePushRegistrationResponse()Removes a storedPushRegistrationResponse, if any, from storage.voidstorePushRegistrationResponse(PushRegistrationResponse response)Puts aPushRegistrationResponseinto storage in serialized form.
-
-
-
Method Detail
-
storePushRegistrationResponse
public void storePushRegistrationResponse(PushRegistrationResponse response)
Description copied from interface:PushRegistrationResponseStoragePuts aPushRegistrationResponseinto storage in serialized form. This method is called automatically by any successful call tocom.zendesk.sdk.network.PushRegistrationProvider#registerDeviceWithIdentifier(String, Locale, ZendeskCallback)orcom.zendesk.sdk.network.PushRegistrationProvider#registerDeviceWithUAChannelId(String, Locale, ZendeskCallback). Only onePushRegistrationResponsecan be stored at a time. Each invocation of this method will overwrite any previously storedPushRegistrationResponse.- Specified by:
storePushRegistrationResponsein interfacePushRegistrationResponseStorage- Parameters:
response- thePushRegistrationResponseto store.
-
getPushRegistrationResponse
public PushRegistrationResponse getPushRegistrationResponse()
Description copied from interface:PushRegistrationResponseStorageGets aPushRegistrationResponseornullfrom storage. If aPushRegistrationResponsehas previously been stored withPushRegistrationResponseStorage.storePushRegistrationResponse(PushRegistrationResponse)and it has not been removed from storage, the stored object will be the return value. If noPushRegistrationResponsehas previously been stored, or storage has not been cleared by a 401 event or registration with a different identifier, this method will return null.- Specified by:
getPushRegistrationResponsein interfacePushRegistrationResponseStorage- Returns:
- the stored
PushRegistrationResponse, ornullif there isn't one.
-
hasStoredPushRegistrationResponse
public boolean hasStoredPushRegistrationResponse()
Description copied from interface:PushRegistrationResponseStorage- Specified by:
hasStoredPushRegistrationResponsein interfacePushRegistrationResponseStorage- Returns:
trueif there is aPushRegistrationResponsein storage,falseif not.
-
removePushRegistrationResponse
public void removePushRegistrationResponse()
Description copied from interface:PushRegistrationResponseStorageRemoves a storedPushRegistrationResponse, if any, from storage. This is called in the event of a call tocom.zendesk.sdk.network.PushRegistrationProvider#registerDeviceWithIdentifier(String, Locale, ZendeskCallback)orcom.zendesk.sdk.network.PushRegistrationProvider#registerDeviceWithUAChannelId(String, Locale, ZendeskCallback)with anidentifierdifferent to the one in the storedPushRegistrationResponse. It is also called in any "clear all storage" event, such as a 401 response from Zendesk.- Specified by:
removePushRegistrationResponsein interfacePushRegistrationResponseStorage
-
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
-
-