chore: KMP audit — commonize code, centralize utilities, eliminate dead abstractions (#5133)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
James Rich 2026-04-14 21:17:50 -05:00 committed by GitHub
parent 50ade01e55
commit 72b981f73b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
132 changed files with 2186 additions and 916 deletions

View file

@ -39,6 +39,8 @@ import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import co.touchlab.kermit.Logger
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.TimeoutCancellationException
import kotlinx.coroutines.delay
import kotlinx.coroutines.withTimeout
import org.jetbrains.compose.resources.stringResource
@ -75,8 +77,11 @@ fun CurrentlyConnectedInfo(
while (bleDevice.device.isConnected) {
try {
rssi = withTimeout(RSSI_TIMEOUT.seconds) { bleDevice.device.readRssi() }
} catch (_: TimeoutCancellationException) {
Logger.d { "RSSI read timed out" }
} catch (e: CancellationException) {
throw e
} catch (e: Exception) {
// RSSI reading failures (or timeouts) are common; log as debug to avoid Crashlytics noise
Logger.d(e) { "Failed to read RSSI ${e.message}" }
}
delay(RSSI_DELAY.seconds)