Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cloudshooterhuman/e7b5da14ba86c6c4b42fb2a12217af1e to your computer and use it in GitHub Desktop.
Save cloudshooterhuman/e7b5da14ba86c6c4b42fb2a12217af1e to your computer and use it in GitHub Desktop.
/**
* toggleAutoDownflow() : method triggered by remote config, should
* be used when notifications based downflow is broken.
*/
private fun toggleAutoDownflow() {
automaticDownflowDisposable?.dispose()
isAutomaticDownflowActivated = remoteConfig.automaticDownflow.activated
automaticDownflowIntervalInMinutes = remoteConfig.automaticDownflow.intervalInMinutes
if (isAutomaticDownflowActivated) {
automaticDownflowDisposable =
Observable
.interval(automaticDownflowIntervalInMinutes, MINUTES)
.doOnNext {
if (autoDownflowTourneeAndOtDisposable == null ||
autoDownflowTourneeAndOtDisposable?.isDisposed == true
) {
downflowTourneeAndOtDisposable = initAutoDownflowTourneeAndOtSubject()
}
autoDownflowTourneeAndOtSubject
.onNext(null)
}
.subscribe({}, { logger.logException(AutomaticDownflowException(it.message)) })
.addTo(compositeDisposable)
}
}
private fun initAutoUpflowObservable() = automaticUpflowObservable
.subscribe({}, { logger.logException(AutomaticUpflowException(it.message)) })
.addTo(compositeDisposable)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment