feat(service): Overhaul MeshServiceExample#4263
Merged
Merged
Conversation
…st stubs
This commit completely revamps the `mesh_service_example` application, migrating it from an XML-based layout to a modern, feature-rich UI built with Jetpack Compose. It also introduces a `FakeIMeshService` stub to facilitate easier testing of `IMeshService` integrations.
### Key Changes:
- **Compose UI Rewrite:** The `mesh_service_example` has been rewritten using Jetpack Compose, featuring a `MeshServiceViewModel` to manage state and interactions with the `MeshService`. The new UI demonstrates a wider range of `IMeshService` functionalities, including:
- Displaying node information and connection status.
- Sending and receiving broadcast text messages.
- Requesting actions per-node (Traceroute, Telemetry, Position, etc.).
- Controlling local device functions (Start/Stop GPS, Reboot Radio).
- **`FakeIMeshService` Stub:**
- Introduced `FakeIMeshService`, a stub implementation of the `IMeshService` AIDL interface.
- This fake serves as a reliable test double for developers building apps that interact with the Meshtastic service, enabling robust unit testing without a running service.
- Added a contract test (`IMeshServiceContractTest`) to ensure the fake implementation stays in sync with the AIDL definition.
- **ViewModel and Testing:**
- `MeshServiceViewModel` now encapsulates all logic for interacting with the `IMeshService`.
- Unit tests for the `MeshServiceViewModel` have been added, demonstrating how to use `FakeIMeshService` for testing client-side logic.
- **Build & Dependency Updates:**
- Added Compose, Activity Compose, and other related UI dependencies to the example app.
- Enabled `unitTests.isReturnDefaultValues = true` in `core/service` and `mesh_service_example` to support Robolectric-less unit testing.
- Removed the unused OSMDroid dependency from the example.
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4263 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 3 3
Lines 23 23
Branches 7 7
=====================================
Misses 23 23 ☔ View full report in Codecov by Sentry. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit completely revamps the
mesh_service_exampleapplication, migrating it from an XML-based layout to a modern, feature-rich UI built with Jetpack Compose. It also introduces aFakeIMeshServicestub to facilitate easier testing ofIMeshServiceintegrations.Key Changes:
Compose UI Rewrite: The
mesh_service_examplehas been rewritten using Jetpack Compose, featuring aMeshServiceViewModelto manage state and interactions with theMeshService. The new UI demonstrates a wider range ofIMeshServicefunctionalities, including:FakeIMeshServiceStub:FakeIMeshService, a stub implementation of theIMeshServiceAIDL interface.IMeshServiceContractTest) to ensure the fake implementation stays in sync with the AIDL definition.ViewModel and Testing:
MeshServiceViewModelnow encapsulates all logic for interacting with theIMeshService.MeshServiceViewModelhave been added, demonstrating how to useFakeIMeshServicefor testing client-side logic.Build & Dependency Updates:
unitTests.isReturnDefaultValues = trueincore/serviceandmesh_service_exampleto support Robolectric-less unit testing.