mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
3.7 KiB
3.7 KiB
Task Playbooks
Use these as practical recipes. Keep edits minimal and aligned with existing module boundaries.
Playbook A: Add or update a user-visible string
- Add/update key in
core/resources/src/commonMain/composeResources/values/strings.xml. - Import generated resource symbol in UI code (
org.meshtastic.core.resources.<key>). - Use
stringResource(Res.string.<key>)in Compose. - If the string appears in a shared dialog, prefer
core:uidialog components. - Verify no hardcoded user-facing strings were introduced.
Reference examples:
feature/node/src/androidMain/kotlin/org/meshtastic/feature/node/list/NodeListScreen.ktcore/ui/src/commonMain/kotlin/org/meshtastic/core/ui/component/AlertDialogs.kt
Playbook B: Add shared ViewModel logic in a feature module
- Implement or extend base ViewModel logic in
feature/<name>/src/commonMain/.... - Keep shared class free of Android framework dependencies.
- Keep Android framework dependencies out of shared logic; if the module already uses Koin annotations in
commonMain, keep patterns consistent and ensure app root inclusion. - Add/update Android wrapper in
app/src/main/kotlin/org/meshtastic/app/...with@KoinViewModelwhen Android instantiation is needed. - Update navigation entry points in
app/src/main/kotlin/org/meshtastic/app/navigation/...to resolve wrapper ViewModels withkoinViewModel().
Reference examples:
- Shared base:
feature/messaging/src/commonMain/kotlin/org/meshtastic/feature/messaging/MessageViewModel.kt - Android wrapper:
app/src/main/kotlin/org/meshtastic/app/messaging/AndroidMessageViewModel.kt - Navigation usage:
app/src/main/kotlin/org/meshtastic/app/navigation/SettingsNavigation.kt
Playbook C: Add a new dependency or service binding
- Check
gradle/libs.versions.tomlfor existing library and version alias. - Add new dependency to version catalog first (if truly new).
- Wire implementation in the owning module (
core:*,feature:*, orapp) following existing architecture. - Register bindings/modules in app Koin graph where needed.
- For Android system integration (WorkManager, service bootstrapping), wire via
MeshUtilApplicationand app-layer modules.
Reference examples:
- App startup and Koin bootstrap:
app/src/main/kotlin/org/meshtastic/app/MeshUtilApplication.kt - App module scan:
app/src/main/kotlin/org/meshtastic/app/MainKoinModule.kt
Playbook D: Add or modify navigation flow
- Define/extend route keys in
core:navigation. - Implement feature entry/content using Navigation 3 types (
NavKey,NavBackStack,EntryProviderScope). - Add graph entries under
app/src/main/kotlin/org/meshtastic/app/navigation. - Use backstack mutation (
add,removeLastOrNull) instead of introducing controller-coupled APIs. - Verify deep-link behavior if route is externally reachable.
Reference examples:
- App graph wiring:
app/src/main/kotlin/org/meshtastic/app/navigation/SettingsNavigation.kt - Feature intro graph pattern:
feature/intro/src/androidMain/kotlin/org/meshtastic/feature/intro/IntroNavGraph.kt
Playbook E: Add flavor/platform-specific UI implementation
- Keep shared contracts in
core:uior feature shared code. - Inject flavor/platform implementation via
CompositionLocalfromapp. - Avoid direct dependency from shared modules to Google Maps/osmdroid/other Android SDK-only APIs.
- Keep adapter types narrow and stable (interfaces, DTO-like params).
Reference examples:
- Contract:
core/ui/src/commonMain/kotlin/org/meshtastic/core/ui/util/MapViewProvider.kt - Provider wiring:
app/src/main/kotlin/org/meshtastic/app/MainActivity.kt - Consumer side:
feature/map/src/androidMain/kotlin/org/meshtastic/feature/map/MapScreen.kt