Remote Local Sync

abstract class RemoteLocalSync<fromAPI : Any, fromDB : Any>

Base class for configuring offline capabilities

Author

Jimly A.

Since

27-May-21

Parameters

fromAPI

return data type from API

fromDB

return data type from DB

Constructors

Link copied to clipboard
fun RemoteLocalSync()

Functions

Link copied to clipboard
fun asObservable(): Observable<fromDB>

method to return as observable

Link copied to clipboard
abstract fun loadFromAPI(): Single<fromAPI>

method define how load data from API

Link copied to clipboard
abstract fun loadFromDB(): Single<fromDB>

method to define how load data from database

Link copied to clipboard
abstract fun saveToDB(data: fromDB)

method to define how storing data to db

Link copied to clipboard
abstract fun shouldFetch(data: fromDB): Boolean

method to define do we need to fetch data from API?

Link copied to clipboard
abstract fun syncData(dataFromAPI: fromAPI, dataFromDb: fromDB): fromDB

method to define new data from API

Sources

Link copied to clipboard