Created
January 15, 2026 22:07
-
-
Save LethalMaus/4e677e5753b7dabe561ce9af1508eb68 to your computer and use it in GitHub Desktop.
ControlStatusChip.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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