use concat(listOf())

This commit is contained in:
Andrei Vereha 2021-05-02 10:00:11 +02:00
parent 4bd5e7c625
commit c36e521efb

View file

@ -467,19 +467,25 @@ class OmnipodDashPumpPlugin @Inject constructor(
commandQueue.customCommand(CommandHandleTimeChange(false), null) commandQueue.customCommand(CommandHandleTimeChange(false), null)
} }
private fun observeAddNewActiveCommandToHistory(observeCreateHistoryEntry: Single<String>): Observable<PodEvent> {
return observeCreateHistoryEntry.flatMapObservable {
podStateManager.createActiveCommand(it).toObservable<PodEvent>()
}
}
private fun executeProgrammingCommand( private fun executeProgrammingCommand(
historyId: Single<String>, observeCreateHistoryEntry: Single<String>,
command: Observable<PodEvent> command: Observable<PodEvent>
): PumpEnactResult { ): PumpEnactResult {
return Single.create<PumpEnactResult> { source -> return Single.create<PumpEnactResult> { source ->
Observable.concat( Observable.concat(
podStateManager.observeNoActiveCommand(), listOf(
historyId.flatMapObservable { recordId -> podStateManager.observeNoActiveCommand(),
podStateManager.createActiveCommand(recordId).toObservable() observeAddNewActiveCommandToHistory(observeCreateHistoryEntry),
}, command,
command, history.updateFromState(podStateManager).toObservable(),
history.updateFromState(podStateManager).toObservable(), podStateManager.updateActiveCommand().toObservable(),
podStateManager.updateActiveCommand().toObservable(), )
).subscribeBy( ).subscribeBy(
onNext = { podEvent -> onNext = { podEvent ->
aapsLogger.debug( aapsLogger.debug(