-
public class RenewableVisitor
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringVISITOR_ACCESS_TOKENpublic final static StringVISITOR_FCM_TOKENpublic final static StringVISITOR_IDpublic final static StringACCESS_TOKEN_EXPIRES_ATprivate Observable<Visitor>renewableVisitorObservable
-
Constructor Summary
Constructors Constructor Description RenewableVisitor(GliaEnvironment env, AppStates appStates, SiteTokenRepository siteTokenRepository, PushNotificationsInternal pushNotifications)RenewableVisitor(GliaEnvironment environment, AppStates appStates, VisitorApi visitorApi, SiteTokenRepository siteTokenRepository, Scheduler scheduler, PushNotificationsInternal pushNotifications)
-
Method Summary
Modifier and Type Method Description synchronized Observable<Visitor>getRenewableVisitorObservable()Returns hot observable that emits new Visitor instance everytime the Visitor token has expired and was renewed. static voidclearSavedState(@NotNull() Context context)static voidclearSavedState(@NonNull() SharedPreferences sharedPreferences)Single<Visitor>getVisitor()-
-
Constructor Detail
-
RenewableVisitor
RenewableVisitor(GliaEnvironment env, AppStates appStates, SiteTokenRepository siteTokenRepository, PushNotificationsInternal pushNotifications)
-
RenewableVisitor
RenewableVisitor(GliaEnvironment environment, AppStates appStates, VisitorApi visitorApi, SiteTokenRepository siteTokenRepository, Scheduler scheduler, PushNotificationsInternal pushNotifications)
-
-
Method Detail
-
getRenewableVisitorObservable
@NonNull() synchronized Observable<Visitor> getRenewableVisitorObservable()
Returns hot observable that emits new Visitor instance everytime the Visitor token has expired and was renewed. Visitor token is attempted to be renewed when: - Visitor token has expired and Visitor is online - Visitor came online
When renewing of the Visitor fails for temporary reasons,the request is retried with exponential backoff and Visitoris eventually emitted. Observable can error with AUTHENTICATION_ERROR in the case App Token is invalid.
-
clearSavedState
static void clearSavedState(@NotNull() Context context)
-
clearSavedState
static void clearSavedState(@NonNull() SharedPreferences sharedPreferences)
-
getVisitor
@NonNull() Single<Visitor> getVisitor()
-
-
-
-