Created
August 29, 2022 09:18
-
-
Save cloudshooterhuman/e7b5da14ba86c6c4b42fb2a12217af1e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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