Skip to content

Instantly share code, notes, and snippets.

@mig35
Created March 30, 2020 09:28
Show Gist options
  • Save mig35/b075ccb49adc4cab5ec6bfab398c6133 to your computer and use it in GitHub Desktop.
Save mig35/b075ccb49adc4cab5ec6bfab398c6133 to your computer and use it in GitHub Desktop.
open class SingleWithTagStrategy(private val tag: Any) : SingleStrategy() {
override fun shouldAddToPendingActions(
pendingActionCommands: RemoveOnlyList<ActionCommand<*, *>>,
runningActionCommands: List<ActionCommand<*, *>>
): Boolean =
!pendingActionCommands.any { command ->
command.strategy.let { it is SingleWithTagStrategy && it.tag == tag }
}
&&
!runningActionCommands.any { command ->
command.strategy.let { it is SingleWithTagStrategy && it.tag == tag }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment