Skip to content

Instantly share code, notes, and snippets.

@LethalMaus
Created January 15, 2026 22:07
Show Gist options
  • Select an option

  • Save LethalMaus/4e677e5753b7dabe561ce9af1508eb68 to your computer and use it in GitHub Desktop.

Select an option

Save LethalMaus/4e677e5753b7dabe561ce9af1508eb68 to your computer and use it in GitHub Desktop.
ControlStatusChip.kt
Chip(
modifier = Modifier.fillMaxWidth(),
enabled = !isRequesting,
colors = ChipDefaults.primaryChipColors(),
onClick = {
coroutineScope.launch {
showEmergency = false
isRequesting = true
val delivered = manager.requestControl()
val success = delivered && withTimeoutOrNull(5000) {
manager.controlStatus.first { it.holder == localDevice }
} != null
isRequesting = false
showEmergency = !success
}
},
label = {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment