RealityCheck

interface RealityCheck

RealityCheck is the main interface for the RealityCheck module.
It is used to get the latest dk.ds.rc.domain.model.RealityCheckMessage object, and to accept the notification displayed by the frontend.

  • To get RealityCheckMessages, call getRealityCheckMessages and subscribe to the observable it returns.

  • the method getRealityCheckMessages will return the latest RealityCheckMessage object when the cache is updated.

  • which only happens when there has gone at least 1 hour since the last update in real active app time or an hour after acceptRealityCheck has been called.

When opening and closing the app, remember to call appDidEnterBackground and appDidEnterForeground respectively.

  • When the app is in the background, the next RealityCheckMessage call will be stopped until the app enters the foreground again.

acceptRealityCheck is used to accept the notification displayed by the frontend. and will disable updating the cache for an hour.
It also has methods for moving the time forward on the server for testing purposes.

Functions

Link copied to clipboard
abstract fun acceptRealityCheck(notificationId: String): Completable

Call this when the user accepts the RealityCheck notification displayed on the app UI. Check the method for additional information.

Link copied to clipboard
abstract fun appDidEnterBackground()

Call this when putting the app into the background. Check the method for additional information.

Link copied to clipboard
abstract fun appDidEnterForeground()

Resumes the RealityCheckMessage call using the time saved from appDidEnterBackground. check the method for additional information.

Link copied to clipboard
abstract fun getRealityCheckMessages(): Observable<RealityCheckMessage>

Returns an observable that can/should be subscribed to, that will return the latest RealityCheckMessage object. Check the method for additional information.

Link copied to clipboard
abstract fun moveSessionTimeStartDebugOnly(mockTimeInMinutes: Int): Completable

This is used for testing purposes. Check the method for additional information.

Link copied to clipboard
abstract fun userDidLogin()

Call this method when the user logs in. It will start calling for messages with the pre-defined delay and retry interval. it will also start the internal time controller.

Link copied to clipboard
abstract fun userDidLogout()

Call this method when the user logs out but haven't shut down the app manually. It will stop calling for messages and stop the internal time controller.