mirror of
https://github.com/googlemaps/android-samples.git
synced 2025-12-08 18:02:20 +00:00
* feat: Adds a new sample demonstrating how to use Google Maps with Firebase Realtime Database on Android. * feat(viewmodel): Add tests and error handling for controller logic This commit introduces unit tests for the `MarkersViewModel` and enhances the app's robustness by adding error handling and improving documentation. - **ViewModel Unit Tests:** Adds unit tests for `MarkersViewModel` using Mockito, Turbine, and Robolectric. The tests verify the controller/agent logic, ensuring that state is correctly managed based on the `controllerId` from Firebase. It also tests the new error reporting mechanism. - **Error Handling:** Implements a `SharedFlow` in the `MarkersViewModel` to propagate database errors to the UI. The `MainActivity` now observes this flow and displays errors to the user in a `Snackbar`. - **Architecture Documentation:** Replaces the static SVG architecture diagram with a more detailed Mermaid diagram in `ARCHITECTURE.md`. The new documentation explains the controller/agent synchronization pattern used for animations. - **Dependency Updates:** Upgrades Gradle to version 9.1.0 and adds `mockito-kotlin` and `turbine` as test dependencies. The `libs.versions.toml` file is reorganized for better clarity. * chore: Configure Gradle JVM args and expose ViewModel property This commit includes two maintenance changes: enabling custom JVM arguments for the Gradle daemon and updating the visibility of a property in the `MarkersViewModel`. * chore: Annotate the version catalog and build.gradle.kts file - **Gradle Build Documentation:** Introduces extensive documentation and organization to the `libs.versions.toml` and `app/build.gradle.kts` files. Dependencies, plugins, and versions are now grouped logically with comments explaining their purpose, improving maintainability and clarity. - **README Update:** The main `README.md` is updated to include a description of the new `FireMarkers` sample. - **Manifest Cleanup:** Removes the redundant `android:label` from the `MainActivity` in the manifest. * chore: adds copyright to the new source files * chore: headers --------- Co-authored-by: Enrique López Mañas <eenriquelopez@gmail.com>
70 lines
1.9 KiB
Plaintext
70 lines
1.9 KiB
Plaintext
digraph Architecture {
|
|
rankdir=TB;
|
|
node [shape=box, style=rounded];
|
|
|
|
subgraph "cluster_firebase" {
|
|
label="Firebase Cloud";
|
|
style="filled";
|
|
color="lightgrey";
|
|
MarkersDB [label="Firebase Realtime Database
|
|
/markers"];
|
|
AnimationDB [label="Firebase Realtime Database
|
|
/animation"];
|
|
}
|
|
|
|
subgraph "cluster_android" {
|
|
label="Android App";
|
|
style="filled";
|
|
color="lightgrey";
|
|
|
|
subgraph "cluster_ui" {
|
|
label="UI Layer (View)";
|
|
A [label="MainActivity"];
|
|
B [label="MapScreen Composable"];
|
|
C [label="TopAppBar Actions
|
|
(toggleAnimation, seedDatabase, clearMarkers, takeControl)"];
|
|
D [label="GoogleMap Composable"];
|
|
}
|
|
|
|
subgraph "cluster_vm" {
|
|
label="State & Logic Layer (ViewModel)";
|
|
VM [label="MarkersViewModel"];
|
|
}
|
|
|
|
subgraph "cluster_data" {
|
|
label="Data Layer";
|
|
FC [label="FirebaseConnection"];
|
|
SD [label="ShapeData"];
|
|
M [label="MarkerData Model"];
|
|
}
|
|
|
|
subgraph "cluster_di" {
|
|
label="Dependency Injection";
|
|
Hilt [label="Hilt/Dagger"];
|
|
}
|
|
}
|
|
|
|
// --- Interactions ---
|
|
A -> B;
|
|
B -> C;
|
|
B -> D [label="Renders Markers"];
|
|
C -> VM [label="Calls function"];
|
|
VM -> FC [label="Uses"];
|
|
VM -> SD [label="Reads shape vectors"];
|
|
|
|
// Controller writes to Firebase
|
|
VM -> AnimationDB [label="Writes animation state"];
|
|
VM -> MarkersDB [label="Writes marker data"];
|
|
|
|
// All clients listen for real-time updates
|
|
MarkersDB -> FC [label="Real-time updates", style=dashed];
|
|
AnimationDB -> FC [label="Real-time updates", style=dashed];
|
|
|
|
FC -> VM;
|
|
VM -> B [label="Updates StateFlow"];
|
|
VM -> M [label="Uses Model"];
|
|
|
|
// --- DI Graph ---
|
|
Hilt -> FC [label="Injects"];
|
|
Hilt -> VM [label="Injects"];
|
|
} |