From 68a87d1658ab4da83afd6a35e651fdfde53c92ad Mon Sep 17 00:00:00 2001 From: Blomios Date: Sat, 25 Jul 2026 19:51:43 +0200 Subject: [PATCH] feat(watch): Android Wear Data Layer adapter + foreground service (#91-D) --- android/app/build.gradle.kts | 5 + android/app/src/main/AndroidManifest.xml | 20 ++ .../kotlin/com/gametime/app/MainActivity.kt | 9 +- .../watch/PhoneWatchBridgeListenerService.kt | 63 ++++ .../gametime/app/watch/WatchBridgePlugin.kt | 214 ++++++++++++ .../watch/WatchCompanionForegroundService.kt | 58 ++++ android/app/src/main/res/values/wear.xml | 5 + lib/application/app_bootstrap.dart | 29 +- lib/infrastructure/infrastructure.dart | 1 + .../native_watch_bridge_channel.dart | 137 ++++++++ .../watch_bridge/watch_bridge.dart | 2 + .../watch_bridge/wear_data_layer_adapter.dart | 183 ++++++++++ .../wear_data_layer_adapter_test.dart | 319 ++++++++++++++++++ 13 files changed, 1037 insertions(+), 8 deletions(-) create mode 100644 android/app/src/main/kotlin/com/gametime/app/watch/PhoneWatchBridgeListenerService.kt create mode 100644 android/app/src/main/kotlin/com/gametime/app/watch/WatchBridgePlugin.kt create mode 100644 android/app/src/main/kotlin/com/gametime/app/watch/WatchCompanionForegroundService.kt create mode 100644 android/app/src/main/res/values/wear.xml create mode 100644 lib/infrastructure/watch_bridge/native_watch_bridge_channel.dart create mode 100644 lib/infrastructure/watch_bridge/watch_bridge.dart create mode 100644 lib/infrastructure/watch_bridge/wear_data_layer_adapter.dart create mode 100644 test/infrastructure/watch_bridge/wear_data_layer_adapter_test.dart diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 9994ece..694f359 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -1,5 +1,6 @@ plugins { id("com.android.application") + id("org.jetbrains.kotlin.android") // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. id("dev.flutter.flutter-gradle-plugin") } @@ -40,3 +41,7 @@ kotlin { flutter { source = "../.." } + +dependencies { + implementation("com.google.android.gms:play-services-wearable:19.0.0") +} diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 00d050e..43248fa 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,9 @@ + + + + + + + + + + + +