Skip to content

Commit

Permalink
ignore some system app UUIDs when trying to resolve a PKJS app
Browse files Browse the repository at this point in the history
  • Loading branch information
crc-32 committed Nov 29, 2024
1 parent 873d35e commit 4df8d9a
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.rebble.cobble.shared.handlers

import com.benasher44.uuid.uuidFrom
import io.ktor.client.HttpClient
import io.rebble.cobble.shared.Logging
import io.rebble.cobble.shared.PlatformContext
Expand All @@ -19,6 +20,18 @@ class PKJSLifecycleHandler(
private val httpClient: HttpClient by inject()
private val lockerDao: LockerDao by inject()
var pkjsApp: PKJSApp? = null

companion object {
private val SYSTEM_APP_UUIDS = setOf(
uuidFrom("dec0424c-0625-4878-b1f2-147e57e83688"), // Home
uuidFrom("07e0d9cb-8957-4bf7-9d42-35bf47caadfe"), // Settings
uuidFrom("1f03293d-47af-4f28-b960-f2b02a6dd757"), // Music
uuidFrom("b2cae818-10f8-46df-ad2b-98ad2254a3c1"), // Notifications
uuidFrom("67a32d95-ef69-46d4-a0b9-854cc62f97f9"), // Alarms
uuidFrom("18e443ce-38fd-47c8-84d5-6d0c775fbe55"), // Watchfaces
uuidFrom("8f3c8686-31a1-4f5f-91f5-01600c9bdc59"), // TicToc
)
}
init {
pebbleDevice.negotiationScope.launch {
val deviceScope = pebbleDevice.connectionScope.filterNotNull().first()
Expand All @@ -29,6 +42,10 @@ class PKJSLifecycleHandler(
private fun listenForPKJSLifecycleChanges(scope: CoroutineScope) {
pebbleDevice.currentActiveApp.filterNotNull().onEach {
pkjsApp?.stop()
// Ignore system apps we know won't be in the locker and don't use pkjs
if (it in SYSTEM_APP_UUIDS) {
return@onEach
}
val appFile = getAppPbwFile(platformContext, it.toString())
if (!appFile.exists()) {
Logging.d("Downloading app $it for js")
Expand Down

0 comments on commit 4df8d9a

Please sign in to comment.