Skip to content

Instantly share code, notes, and snippets.

@kirich1409
Created August 8, 2022 16:10
Show Gist options
  • Save kirich1409/330eaf442c77f93889ec1d6dd53a70a1 to your computer and use it in GitHub Desktop.
Save kirich1409/330eaf442c77f93889ec1d6dd53a70a1 to your computer and use it in GitHub Desktop.
Порефакторил код
override fun observe(permissions: List<MintPermission>): Flow<List<MintPermissionStatus>> {
return statusesController.observe()
.combine(permissions.asFlow()) { statuses, permission ->
statuses.getStatus(permission)
}
.runningList()
.distinctUntilChanged()
}
fun <T> Flow<T>.runningList(): Flow<List<T>> {
return flow {
emit(this@runningList.toList())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment