KvnRepository

class KvnRepository(api: KvnApi, cache: KvnCache, platform: Platform)

This repository give access to KVN messages.

The KVN messages are provided by Observable for a given platform and should be shown to the user if effected.

Constructors

Link copied to clipboard
constructor(api: KvnApi, cache: KvnCache, platform: Platform)

Functions

Link copied to clipboard
fun getAllMessageUserViews(): Observable<Set<Long>>

Get all message user views, This Observable will emmit all the message id's saveMessageUserView has been called upon.

Link copied to clipboard
fun getKvnMessages(strategy: KvnLoadStrategy = KvnLoadStrategy.CACHE): Observable<List<KvnMessage>>

Get all KVN messages, This Observable will emmit all kvn messages when updated, use REFRESH strategy to fetch from server.

Link copied to clipboard
fun getKvnMessagesWithPolling(period: Long = 2, timeUnit: TimeUnit = TimeUnit.MINUTES): Observable<List<KvnMessage>>

Get all KVN messages, This Observable will keep calling get kvn messages with REFRESH strategy on the given period interval.

Link copied to clipboard
fun getNewMessageUpdates(): Observable<KvnMessage>

This Observable emits if there is any new messages after getKvnMessages with a KvnLoadStrategy.REFRESH is called. Subscribing to this observable does not trigger any updates

Link copied to clipboard

This Observable emits if there is any messages removed after getKvnMessages with a KvnLoadStrategy.REFRESH is called. Subscribing to this observable does not trigger any updates

Link copied to clipboard
fun saveMessageUserInteraction(messageId: Long): Completable

Log when a kvn message dialog have been interacted with, if user select subscribe or unsubscribe.

Link copied to clipboard
fun saveMessageUserView(messageId: Long): Completable

Log when a kvn message have been shown to a user.

Link copied to clipboard
fun subscribeToMessageNotification(messageId: Long, subscriberAddress: String, notificationType: KvnNotificationType): Completable

User email or sms subscription for Kvn message notification. This sign the user up for getting a notification when a KVN message is resolved

Link copied to clipboard
fun unSubscribeFromMessageNotification(messageId: Long, subscriberAddress: String): Completable

User email or sms un-subscription for Kvn message notification. This remove the current subscription a user has requested for a given message id and email or phone number