Skip to content

KMP SDK: Improve Robustness of Access Point Feature#781

Merged
tcamise-gpsw merged 10 commits intomainfrom
update_kmp_sdk
Jun 18, 2025
Merged

KMP SDK: Improve Robustness of Access Point Feature#781
tcamise-gpsw merged 10 commits intomainfrom
update_kmp_sdk

Conversation

@tcamise-gpsw
Copy link
Copy Markdown
Collaborator

@tcamise-gpsw tcamise-gpsw commented Jun 18, 2025

This pull request includes several updates to improve the Kotlin multiplatform SDK, with key changes to upgrade the JVM target, enhance the AccessPointViewModel functionality, and refactor the GoProFacade class. Additionally, it introduces UI updates for better error handling and disconnect functionality, and includes dependency updates.

JVM Target Upgrade:

  • Updated JVM target from JVM_11 to JVM_17 across multiple build.gradle.kts files for better compatibility and performance. ([[1]](https://github.com/gopro/OpenGoPro/pull/781/files#diff-e81b6236410e18cd23afb3d71adabdf1ab5263f6f7f7b6c3b751a787905eed1bL19-R19), [[2]](https://github.com/gopro/OpenGoPro/pull/781/files#diff-e81b6236410e18cd23afb3d71adabdf1ab5263f6f7f7b6c3b751a787905eed1bL111-R112), Fe759893L5R5, [[3]](https://github.com/gopro/OpenGoPro/pull/781/files#diff-110d05125eb6cdef18fba6341e5cc233f92dfcbb200bad745759f5de17acdb82L50-R51), [[4]](https://github.com/gopro/OpenGoPro/pull/781/files#diff-f41a7d41a620239b3d83dab813444e79bfb42849affd5df3ee5ce7ee06af91d9L24-R23), [[5]](https://github.com/gopro/OpenGoPro/pull/781/files#diff-f41a7d41a620239b3d83dab813444e79bfb42849affd5df3ee5ce7ee06af91d9L112-R111))

ViewModel Enhancements:

  • Added _errorMessage and setErrorMessage for improved error handling in AccessPointViewModel. ([demos/kotlin/kmp_sdk/composeApp/src/commonMain/kotlin/presenter/AccessPointViewModel.ktR35-R110](https://github.com/gopro/OpenGoPro/pull/781/files#diff-0b0ad7c418548276414f4ac51508cf5e3861c06d820e4b7d625c14ca1a1f038fR35-R110))
  • Replaced direct state updates with setState for better encapsulation. ([demos/kotlin/kmp_sdk/composeApp/src/commonMain/kotlin/presenter/AccessPointViewModel.ktR35-R110](https://github.com/gopro/OpenGoPro/pull/781/files#diff-0b0ad7c418548276414f4ac51508cf5e3861c06d820e4b7d625c14ca1a1f038fR35-R110))
  • Introduced a disconnect method and updated scanForSsids and connectToSsid methods to use the new state management approach. ([demos/kotlin/kmp_sdk/composeApp/src/commonMain/kotlin/presenter/AccessPointViewModel.ktR35-R110](https://github.com/gopro/OpenGoPro/pull/781/files#diff-0b0ad7c418548276414f4ac51508cf5e3861c06d820e4b7d625c14ca1a1f038fR35-R110))

UI Updates:

  • Integrated SnackbarMessageHandler to display error messages in AccessPointScreen. ([demos/kotlin/kmp_sdk/composeApp/src/commonMain/kotlin/ui/screens/connected/AccessPointScreen.ktR43-R49](https://github.com/gopro/OpenGoPro/pull/781/files#diff-7c4ffd2eea7dd10eb02354b6813b92b5f07547ff0cf66e0f2f1dca0de2e6b8e4R43-R49))
  • Added a "Disconnect" button and corresponding functionality to ScanScreen for better user control. ([[1]](https://github.com/gopro/OpenGoPro/pull/781/files#diff-7c4ffd2eea7dd10eb02354b6813b92b5f07547ff0cf66e0f2f1dca0de2e6b8e4L64-R78), [[2]](https://github.com/gopro/OpenGoPro/pull/781/files#diff-7c4ffd2eea7dd10eb02354b6813b92b5f07547ff0cf66e0f2f1dca0de2e6b8e4R100-R104))

Refactor of GoProFacade:

  • Removed GpDescriptorManager and refactored accessPointState and cohnState to directly use feature states. ([[1]](https://github.com/gopro/OpenGoPro/pull/781/files#diff-6a41897cd99e32876d9d1e713d2e777bccc442a7074a3c1ed7ada85321552e6aL65-L74), [[2]](https://github.com/gopro/OpenGoPro/pull/781/files#diff-6a41897cd99e32876d9d1e713d2e777bccc442a7074a3c1ed7ada85321552e6aL88-R78), [[3]](https://github.com/gopro/OpenGoPro/pull/781/files#diff-6a41897cd99e32876d9d1e713d2e777bccc442a7074a3c1ed7ada85321552e6aL108-R98))
  • Simplified state management by delegating to FeaturesContainer. ([demos/kotlin/kmp_sdk/wsdk/src/commonMain/kotlin/com/gopro/open_gopro/gopro/GoProFacade.ktL88-R78](https://github.com/gopro/OpenGoPro/pull/781/files#diff-6a41897cd99e32876d9d1e713d2e777bccc442a7074a3c1ed7ada85321552e6aL88-R78))

Dependency and Documentation Updates:

  • Updated dependencies in libs.versions.toml, including uiToolingPreview and navigationCompose. ([[1]](https://github.com/gopro/OpenGoPro/pull/781/files#diff-bc2be05eb27c7f962b622a9e0d672ad25fb5c319ce5058caa2c07b7593b2b953L14-R14), [[2]](https://github.com/gopro/OpenGoPro/pull/781/files#diff-bc2be05eb27c7f962b622a9e0d672ad25fb5c319ce5058caa2c07b7593b2b953L36-R36))
  • Fixed typos in SDK documentation. ([[1]](https://github.com/gopro/OpenGoPro/pull/781/files#diff-f450cb1277a78f22267d58032ed4c6d9eb1292481951734a2125f1ddaceefd6cL214-R217), [[2]](https://github.com/gopro/OpenGoPro/pull/781/files#diff-fc930ee7cab98738253e3a5724cae115d88c04772ac394815ff01d4df1648013L80-R82))

@tcamise-gpsw tcamise-gpsw requested a review from Copilot June 18, 2025 21:38
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the robustness of the Access Point and COHN features by introducing state flows, retry logic, and better error handling, and updates JVM targets to Java 17 across modules.

  • Introduce MutableStateFlow/StateFlow for both CohnFeature and AccessPointFeature to track feature state.
  • Add retry (robustlyConnect) and timeout logic for AP connections, and streamline COHN provisioning flows.
  • Refactor GoProFacade to surface feature state directly, remove outdated descriptor manager, and bump JVM compatibility to 17.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
demos/kotlin/kmp_sdk/wsdk/src/commonMain/kotlin/com/gopro/open_gopro/gopro/features/CohnFeature.kt Added state flow, private getState(), certificate handling, and BLE-availability loop
demos/kotlin/kmp_sdk/wsdk/src/commonMain/kotlin/com/gopro/open_gopro/gopro/features/AccessPointFeature.kt Added state flow, robustlyConnect, retry/timeout logic, and disconnect helper
demos/kotlin/kmp_sdk/wsdk/src/commonMain/kotlin/com/gopro/open_gopro/gopro/GoProFacade.kt Removed custom descriptor manager, wired feature state properties
demos/kotlin/kmp_sdk/wsdk/src/commonMain/kotlin/com/gopro/open_gopro/gopro/FeaturesContainer.kt Updated FeatureContext to include CoroutineScope
build.gradle.kts files (wsdk, simplifiedApp, composeApp) Bumped jvmTarget and source/target compatibility to Java 17
demos/kotlin/kmp_sdk/simplifiedApp/src/commonMain/kotlin/App.kt Updated example to match new AP connect API
demos/kotlin/kmp_sdk/gradle/libs.versions.toml Adjusted Compose and tooling preview versions
demos/kotlin/kmp_sdk/docs/sdk_documentation.md Corrected typo in example and aligned with new API
demos/kotlin/kmp_sdk/composeApp/src/commonMain/kotlin/ui/screens/connected/AccessPointScreen.kt Added error snackbar and disconnect button UI
demos/kotlin/kmp_sdk/composeApp/src/commonMain/kotlin/presenter/AccessPointViewModel.kt Added error state, unified state setter, and disconnect handling

@tcamise-gpsw tcamise-gpsw merged commit f5310a5 into main Jun 18, 2025
1 check passed
@tcamise-gpsw tcamise-gpsw deleted the update_kmp_sdk branch June 18, 2025 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kotlin SDK: Connecting to access points via the GoPro compose app rarely appears to work

2 participants