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 void
clearUserData()
This method will be called when user data must be clearedjava.lang.String
getCacheKey()
Gets the cache key for the user storage.PushRegistrationResponse
getPushRegistrationResponse()
Gets aPushRegistrationResponse
ornull
from storage.boolean
hasStoredPushRegistrationResponse()
void
removePushRegistrationResponse()
Removes a storedPushRegistrationResponse
, if any, from storage.void
storePushRegistrationResponse(PushRegistrationResponse response)
Puts aPushRegistrationResponse
into storage in serialized form.
-
-
-
Method Detail
-
storePushRegistrationResponse
public void storePushRegistrationResponse(PushRegistrationResponse response)
Description copied from interface:PushRegistrationResponseStorage
Puts aPushRegistrationResponse
into 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 onePushRegistrationResponse
can be stored at a time. Each invocation of this method will overwrite any previously storedPushRegistrationResponse
.- Specified by:
storePushRegistrationResponse
in interfacePushRegistrationResponseStorage
- Parameters:
response
- thePushRegistrationResponse
to store.
-
getPushRegistrationResponse
public PushRegistrationResponse getPushRegistrationResponse()
Description copied from interface:PushRegistrationResponseStorage
Gets aPushRegistrationResponse
ornull
from storage. If aPushRegistrationResponse
has previously been stored withPushRegistrationResponseStorage.storePushRegistrationResponse(PushRegistrationResponse)
and it has not been removed from storage, the stored object will be the return value. If noPushRegistrationResponse
has 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:
getPushRegistrationResponse
in interfacePushRegistrationResponseStorage
- Returns:
- the stored
PushRegistrationResponse
, ornull
if there isn't one.
-
hasStoredPushRegistrationResponse
public boolean hasStoredPushRegistrationResponse()
Description copied from interface:PushRegistrationResponseStorage
- Specified by:
hasStoredPushRegistrationResponse
in interfacePushRegistrationResponseStorage
- Returns:
true
if there is aPushRegistrationResponse
in storage,false
if not.
-
removePushRegistrationResponse
public void removePushRegistrationResponse()
Description copied from interface:PushRegistrationResponseStorage
Removes 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 anidentifier
different 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:
removePushRegistrationResponse
in interfacePushRegistrationResponseStorage
-
clearUserData
public void clearUserData()
Description copied from interface:SdkStorage.UserStorage
This method will be called when user data must be cleared- Specified by:
clearUserData
in interfaceSdkStorage.UserStorage
-
getCacheKey
public java.lang.String getCacheKey()
Description copied from interface:SdkStorage.UserStorage
Gets the cache key for the user storage.- Specified by:
getCacheKey
in interfaceSdkStorage.UserStorage
- Returns:
- the cache key for the user storage
-
-