When you open the application, the repository returns Observable :
fun role(): Observable<Triple<Role, Boolean, List<Int>>> { return repository .data() .map { val bgList = it.directions .flatMap { it.departments } .flatMap { it.businessGroups } when { bgList.size > 1 -> Role.MANAGER it.directions.isNotEmpty() -> Role.RBG it.directions.isEmpty() -> Role.NOT_RBG else -> Role.NOT_RBG } } .map { val requireBg = (it == Role.MANAGER && preferences.bgSelect.get() == null) Triple(it, requireBg, tabs()) } } But if the role changes in the settings, the data coming from the server changes and you have to force this sequence to be called again.
I created a class:
class BgChange @Inject constructor() { val change: Subject<Any> = PublishSubject.create() fun isBgChange(): Observable<Any> = change } When I click on the button in the settings, onNext is onNext : bgChange.change.onNext(Any()) Now, as I understand it, I need to add this signal to my sequence using the flatMap operator so that when I call onNext Observable re-emit data. All attempts failed. Explain how this can be done?