SyncListenerManager

@Singleton
class SyncListenerManager @Inject constructor(val configService: ConfigService, val configurationRegistry: ConfigurationRegistry, val sharedPreferencesHelper: SharedPreferencesHelper, val context: Context, val dispatcherProvider: DefaultDispatcherProvider)

A singleton class that maintains a list of OnSyncListener that have been registered to listen to SyncJobStatus emitted to indicate sync progress.

Constructors

Link copied to clipboard
@Inject
constructor(configService: ConfigService, configurationRegistry: ConfigurationRegistry, sharedPreferencesHelper: SharedPreferencesHelper, context: Context, dispatcherProvider: DefaultDispatcherProvider)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

This function removes onSyncListener from the list of registered OnSyncListener's to stop receiving sync state events.

Link copied to clipboard
suspend fun loadResourceSearchParams(): ResourceSearchParams

This function is used to retrieve search parameters for the various ResourceType's synced by the application. The function returns a pair of maps, one contains the the custom Resource types and the other returns the supported FHIR ResourceTypes. The OpenSrpDownloadManager does not support downloading of custom resource, a separate worker is implemented instead to download the custom resources.

Link copied to clipboard
fun registerSyncListener(onSyncListener: OnSyncListener, lifecycle: Lifecycle)

Register OnSyncListener for SyncJobStatus. Typically the OnSyncListener will be implemented in a an Activity/Fragment. This function ensures the OnSyncListener is removed for the _onSyncListeners list when the Lifecycle changes to Lifecycle.State.DESTROYED