Add fake watch setting and improve FakeLibPebble#226
Conversation
Allow selecting a fake watch type from debug settings to use FakeLibPebble instead of a real Bluetooth connection. Simplify FakeLibPebble by removing random data generation and adding displayName to WatchHardwarePlatform.
|
cc @ericmigi |
|
Why do you want this? |
I was working on a feature that required access to the settings of a watch but I was having a lot of difficulty connecting a watch to a google phone emulator and this seemed like a very simple work around so that you could access and test features that required a connected watch without the watch really being there. |
|
@sjp4 is there anything blocking this from going forward? i've got several things i'd like to work on and improve and this would make it so much easier to work on these things? |
Use `binds` to register additional types directly on the LibPebble singleton instead of defining separate singleites with manual casts. For LibPebble3 resolution, replace the unsafe cast with a safe `as?` cast and provide a clearer error message when fake watches are in use.
Move add, remove, and set active fake watch operations out of WatchSettingsScreen and into CoreConfigHolder extension functions. Also add a transform-based update method to CoreConfigHolder.
Simplifies the consumer hardware filter in WatchSettingsScreen and fixes FakeLibPebble to filter by ID and watchface type.
sjp4
left a comment
There was a problem hiding this comment.
@sjp4 is there anything blocking this from going forward? i've got several things i'd like to work on and improve and this would make it so much easier to work on these things?
At the base level, this breaks the only thing we currently use FakeLibPebble for (compose previews) by removing randomisation.
Given that FakeLibPebble is only designed to power a few specific screens right now, the behaviour in a lot of the app will be undefined (likely crashes, weird behaviour in many places). It's also losing a lot of functionality that is not bluetooth related (i.e. that might be better served with a mock device transport in libpebble).
If we did go this route (powering the entire app with FakeLibPebble), we do not want to expose it to users (even behind the debug options flag) - it would need to be behind a buildconfig flag configured in gradle properties. We would also not want it controlled like that in settings/libpebbleconfig - it should use the discovery flow to add new devices, and persist them internally to FakeLibPebble.
| PEBBLE_ROBERT_BIGBOARD_2(247u, WatchType.EMERY, "robert_bb2"), | ||
| CORE_OBELIX_BIGBOARD(244u, WatchType.EMERY, "obelix_bb"), | ||
| CORE_OBELIX_BIGBOARD_2(243u, WatchType.EMERY, "obelix_bb2"), | ||
| enum class WatchHardwarePlatform(val protocolNumber: UByte, private val _watchType: WatchType, val revision: String, val displayName: String, val isConsumer: Boolean = false) { |
There was a problem hiding this comment.
Adding a user-facing name to a board doesn't really make sense - this is probably the wrong layer to do this (also many of the isConsumer flags here are wrong)
| val fakeActiveWatch: WatchHardwarePlatform? = null, | ||
| ) { | ||
| init { | ||
| require(fakeActiveWatch == null || fakeActiveWatch in fakeWatches) { |
|
Thank you for the reply. let me see if i can implement this in a different
manner!
Sincerely,
Justin Sunseri
…On Fri, Jun 5, 2026 at 9:50 AM Steve Penna ***@***.***> wrote:
***@***.**** commented on this pull request.
@sjp4 <https://github.com/sjp4> is there anything blocking this from
going forward? i've got several things i'd like to work on and improve and
this would make it so much easier to work on these things?
At the base level, this breaks the only thing we currently use
FakeLibPebble for (compose previews) by removing randomisation.
Given that FakeLibPebble is only designed to power a few specific screens
right now, the behaviour in a lot of the app will be undefined (likely
crashes, weird behaviour in many places). It's also losing a lot of
functionality that is not bluetooth related (i.e. that might be better
served with a mock device transport in libpebble).
If we did go this route (powering the entire app with FakeLibPebble), we
do not want to expose it to users (even behind the debug options flag) - it
would need to be behind a buildconfig flag configured in gradle properties.
We would also not want it controlled like that in settings/libpebbleconfig
- it should use the discovery flow to add new devices, and persist them
internally to FakeLibPebble.
------------------------------
In
libpebble3/src/commonMain/kotlin/io/rebble/libpebblecommon/metadata/WatchHardwarePlatform.kt
<#226 (comment)>
:
> - PEBBLE_SILK(14u, WatchType.DIORITE, "silk"),
- CORE_ASTERIX(15u, WatchType.FLINT, "asterix"),
- CORE_OBELIX_EVT(16u, WatchType.EMERY, "obelix_evt"),
- CORE_OBELIX_DVT(17u, WatchType.EMERY, "obelix_dvt"),
- CORE_OBELIX_PVT(18u, WatchType.EMERY, "obelix_pvt"),
- CORE_GETAFIX_EVT(19u, WatchType.GABBRO, "getafix_evt"),
- CORE_GETAFIX_DVT(20u, WatchType.GABBRO, "getafix_dvt"),
- CORE_GETAFIX_DVT2(21u, WatchType.GABBRO, "getafix_dvt2"),
- PEBBLE_SILK_BIGBOARD(250u, WatchType.DIORITE, "silk_bb"),
- PEBBLE_SILK_BIGBOARD_2_PLUS(248u, WatchType.DIORITE, "silk_bb2"),
- PEBBLE_ROBERT_EVT(13u, WatchType.EMERY, "robert_evt"),
- PEBBLE_ROBERT_BIGBOARD(249u, WatchType.EMERY, "robert_bb"),
- PEBBLE_ROBERT_BIGBOARD_2(247u, WatchType.EMERY, "robert_bb2"),
- CORE_OBELIX_BIGBOARD(244u, WatchType.EMERY, "obelix_bb"),
- CORE_OBELIX_BIGBOARD_2(243u, WatchType.EMERY, "obelix_bb2"),
+enum class WatchHardwarePlatform(val protocolNumber: UByte, private val _watchType: WatchType, val revision: String, val displayName: String, val isConsumer: Boolean = false) {
Adding a user-facing name to a board doesn't really make sense - this is
probably the wrong layer to do this (also many of the isConsumer flags here
are wrong)
------------------------------
In util/src/commonMain/kotlin/coredevices/util/CoreConfig.kt
<#226 (comment)>
:
> @@ -93,7 +99,15 @@ data class CoreConfig(
val obfuscateSensitiveLogs: Boolean = true,
val hidePermissionWarningBadges: Boolean = false,
val androidForegroundServiceForWatchConnection: Boolean = false,
-)
+ val fakeWatches: Set<WatchHardwarePlatform> = emptySet(),
+ val fakeActiveWatch: WatchHardwarePlatform? = null,
+) {
+ init {
+ require(fakeActiveWatch == null || fakeActiveWatch in fakeWatches) {
this would crash the app on start
—
Reply to this email directly, view it on GitHub
<#226?email_source=notifications&email_token=AAGEPF4K3WAEBEM233SVX4346IRPPA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINBTGI3DSMZZGI2KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#pullrequestreview-4432693924>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGEPF73R7FMK4GN57X672D46IRPPAVCNFSM6AAAAACZULQNL6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHM2DIMZSGY4TGOJSGQ>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AAGEPF5KCJEI6VX57XVEXCT46IRPPA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINBTGI3DSMZZGI2KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG>
and Android
<https://github.com/notifications/mobile/android/AAGEPF4M25MX6DEU4LVI5GL46IRPPA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINBTGI3DSMZZGI2KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>.
Download it today!
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
…meout-slider-improvements
…ble previews - Add fakeWatchEnabled Gradle property exposed via CommonBuildKonfig - Remove fake watch state from CoreConfig; persist in FakeWatchConfigStore - Remove displayName/isConsumer from WatchHardwarePlatform; add UI-layer mapping - Restore default FakeLibPebble randomized behavior for previews/tests - Add ConfiguredFakeLibPebble for build-flag-enabled deterministic fake watches - Gate watchModule selection and settings UI behind FAKE_WATCH_ENABLED
- Move fakeWatchItems and FakeWatchPickerDialog to coredevices.pebble.fake package - Add StateFlow-based fakeWatches/activeFakeWatch to FakeWatchConfigStore - Collect fake watch state in WatchSettingsScreen and pass to fakeWatchItems - Fix UI not updating when removing fake watches
|
@sjp4 hopefully you like this implementation better |
Allow selecting a fake watch type from debug settings to use FakeLibPebble instead of a real Bluetooth connection. Simplify FakeLibPebble by removing random data generation and adding displayName to WatchHardwarePlatform.