barbeau / gpstest

The #1 open-source Android GNSS/GPS test program
Apache License 2.0
1.78k stars 364 forks source link

Wear OS - Re-use app Composables in Wear OS version #613

Closed barbeau closed 1 year ago

barbeau commented 1 year ago

Describe the bug For the Location values shown at the top of the Wear UI, we're duplicating a lot of code that already exists in the app version.

For example, PR https://github.com/barbeau/gpstest/issues/609 fixed the UI to initialize default values correctly (as blanks), and this is effectively just copying/pasting code from the app version.

Currently most of the Wear OS Location data fields are missing units (e.g., Bearing, Speed), and to fix this we would need to copy more code that already exists in the app. Similarly, we'd like to eventually introduce preferences to set units (e.g., meters vs feet), and all this code already exists in the app.

We should move the existing mobile app Location field @Composable functions to the library and reference these in both the mobile app and Wear OS version. To ease sharing code, we can use the default preference values in Wear OS right now for units, etc., and in a future update add a preference screen to change them. So they won't be configurable after this issue is closed, but all the code required to switch between units will be in place.

@adaext Would you be able to work on this?

To Reproduce Steps to reproduce the behavior:

  1. Launch app - look at Location UI fields (e.g., Lat, Long, Bearing, etc.) and their implementation in Wear OS and app

Expected behavior Code should not be duplicated across app and Wear OS versions - it should existing in the library instead.

Observed behavior We're duplicating code in the app and Wear OS versions - these Composable functions should be moved to the library and referenced in both versions.

App, Device and Android version:

N/A