diff --git a/.copilotignore b/.copilotignore
new file mode 100644
index 000000000..02ec3ad1d
--- /dev/null
+++ b/.copilotignore
@@ -0,0 +1,27 @@
+# Ignore build artifacts and generated files from Copilot indexing
+# This saves context window tokens and prevents Copilot from hallucinating off of minified code.
+
+# Build directories
+**/build/**
+.gradle/
+.idea/
+
+# Android generated files
+**/generated/**
+.cxx/
+.externalNativeBuild/
+
+# Git history & worktrees
+.git/
+.worktrees/
+
+# Protobuf (Prevents Copilot from suggesting raw protobuf byte buffers)
+core/proto/
+
+# Environment and secrets
+local.properties
+secrets.properties
+*.jks
+
+# Agent References (Prevents pollution of project space with external code)
+.agent_refs/
diff --git a/.gemini/settings.json b/.gemini/settings.json
new file mode 100644
index 000000000..5e535b215
--- /dev/null
+++ b/.gemini/settings.json
@@ -0,0 +1,5 @@
+{
+ "context": {
+ "fileName": ["AGENTS.md", "GEMINI.md"]
+ }
+}
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 000000000..d4581f651
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,13 @@
+# These are supported funding model platforms
+
+github: meshtastic
+patreon: # Replace with a single Patreon username
+open_collective: meshtastic
+ko_fi: # Replace with a single Ko-fi username
+tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
+community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
+liberapay: # Replace with a single Liberapay username
+issuehunt: # Replace with a single IssueHunt username
+otechie: # Replace with a single Otechie username
+lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
+custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
new file mode 100644
index 000000000..ef57ec56d
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -0,0 +1,182 @@
+name: Bug Report
+description: File a bug report.
+title: "[Bug]: "
+labels: [bug]
+projects: [meshtastic/Meshtastic-Android]
+body:
+ - type: markdown
+ attributes:
+ value: |
+ Thank you for helping to make Meshtastic-Android better by reporting a bug. :hugs:
+
+ Please provide as much detail as possible so we can efficiently address your issue and avoid unnecessary back-and-forth.
+
+ - type: input
+ id: contact
+ attributes:
+ label: Contact Details
+ description: How can we get in touch with you if we need more info?
+ placeholder: ex. email@example.com, discord username
+ validations:
+ required: false
+
+ - type: checkboxes
+ id: checklist
+ attributes:
+ label: "Checklist"
+ description: |
+ Please make sure you have done the following before submitting your bug report.
+ Bug reports that do not meet these criteria will be closed.
+ Requests that do not meet these criteria will be closed.
+ Links:
+ [**OPEN ISSUES**](https://github.com/meshtastic/Meshtastic-Android/issues)
+ [**CLOSED ISSUES**](https://github.com/meshtastic/Meshtastic-Android/issues?q=is%3Aissue+is%3Aclosed)
+ [Contribution Guidelines](https://github.com/meshtastic/Meshtastic-Android/blob/main/README.md#contributing)
+ options:
+ - label: |
+ I am able to reproduce the bug with the latest version.
+ required: true
+ - label: |
+ I have updated to the latest *Alpha* firmware, and am able to reproduce the bug. Many issues are fixed quickly in alpha before the general beta release.
+ required: true
+ - label: |
+ I made sure that there are no existing **OPEN or CLOSED issues** which I could contribute my information to.
+ required: true
+ - label: |
+ I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
+ required: true
+ - label: |
+ This issue contains only one bug.
+ required: true
+ - label: |
+ I have read and understood the **Contribution Guidelines**.
+ required: true
+ - label: |
+ I agree to follow this project's Code of Conduct
+ required: true
+ - label: |
+ I actually read this list, and should be taken seriously.
+ required: false
+ - type: input
+ id: app-version
+ attributes:
+ label: Affected app version
+ description: |
+ In which Meshtastic-Android app version did you encounter the bug?
+ Can be seen on the bottom of the `Settings` screen in the app.
+ placeholder: "x.y.z-channel.x (build) flavor"
+ validations:
+ required: true
+
+ - type: input
+ id: phone-os
+ attributes:
+ label: Affected Android version
+ description: |
+ With what operating system (+ version) did you encounter the bug?
+ placeholder: "Example: Android 14"
+ validations:
+ required: true
+
+ - type: input
+ id: phone-model
+ attributes:
+ label: Affected phone model
+ description: |
+ On what phone did you encounter the bug?
+ placeholder: "Example: Samsung Galaxy S20 / Google Pixel 8"
+ validations:
+ required: true
+
+ - type: input
+ id: hardware-model
+ attributes:
+ label: Affected node model
+ placeholder: "Example: Seeed T1000-E, Heltec v3, etc."
+ description: |
+ On which hardware device (Node) did you encounter the bug?
+ validations:
+ required: true
+
+ - type: input
+ id: firmware-version
+ attributes:
+ label: Affected node firmware version
+ placeholder: "x.x.x"
+ description: "Which Meshtastic firmware version did you encounter the bug?"
+ validations:
+ required: true
+
+ - type: textarea
+ id: steps-to-reproduce
+ attributes:
+ label: Steps to reproduce the bug
+ description: |
+ What did you do for the bug to show up?
+
+ If you can't cause the bug to show up again reliably (and hence don't have a proper set of steps to give us), please still try to give as many details as possible on how you think you encountered the bug.
+ placeholder: |
+ 1. Go to '...'
+ 2. Press on '....'
+ 3. Swipe down to '....'
+ validations:
+ required: true
+
+ - type: textarea
+ id: actual-behavior
+ attributes:
+ label: Actual behavior
+ description: |
+ Tell us what happens with the steps given above.
+
+ - type: textarea
+ id: expected-behavior
+ attributes:
+ label: Expected behavior
+ description: |
+ Tell us what you expect to happen.
+
+ - type: textarea
+ id: screen-media
+ attributes:
+ label: Screenshots/Screen recordings
+ description: |
+ A picture or video is worth a thousand words.
+ Provide as much context as possible so we know what we are looking at.
+
+ Add screenshots or a screen recording to help explain your problem, provide detailed context to help us know what to look for.
+ GitHub supports uploads of images and (small) videos directly in the text box.
+
+ - type: textarea
+ id: logs
+ attributes:
+ label: Relevant log output
+ description: |
+ Logs help us to diagnose and reproduce issues, particularly when they are unique to your setup.
+ Depending on the issue, the following logs may be useful:
+ - App logs: This will help with most issues. If possible, provide the relevant output of:
+ `adb logcat -d | grep com.geeksville.mesh`
+ - Mesh logs: UI issues, communication issues etc.
+ - ` App > Settings > Advanced > Debug Panel > Export specific / export all `
+ - Broader Android logs: Potentially useful if the issue goes beyond the app (connections, network etc.)
+ `adb logcat -d`
+ - Firmware logs: Useful for all connection issues with nodes
+ - These are piped to the USB serial port on the node, the most foolproof is to use the 'open serial' button on the web-flasher interface, and then save the output.
+ - The app needs to be connecting to the node via Bluetooth or Network for this to work.
+ render: shell
+
+ - type: textarea
+ id: additional-information
+ attributes:
+ label: Additional information
+ description: |
+ Any other information you'd like to include, for instance that
+ * the affected device is foldable or a TV
+ * you have disabled all animations on your device or otherwise changed system settings
+ * you are using battery optimization or power saving mode
+ * you are using a custom Android ROM or launcher
+ * your ferret chewed your antennas
+ * you are using a VPN
+ * you live in a faraday cage
+ * you dismissed all popups telling you not to do things you shouldn't do without reading them
+ * ...
\ No newline at end of file
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 000000000..1b6deb1b1
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,10 @@
+blank_issues_enabled: false
+contact_links:
+ - name: Meshtastic Android Discussions
+ url: https://github.com/orgs/meshtastic/discussions/categories/android
+ about: Please ask and answer questions here.
+ - name: Meshtastic Website
+ url: https://meshtastic.org/
+ about: Docs and other ways to contact us here.
+
+
diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml
new file mode 100644
index 000000000..1c7881533
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.yml
@@ -0,0 +1,61 @@
+name: Feature Request
+description: File a request for new feature or functionality.
+title: "[Feature Request]: "
+labels: [enhancement]
+projects: [meshtastic/Meshtastic-Android]
+body:
+ - type: checkboxes
+ id: checklist
+ attributes:
+ label: Checklist
+ description: |
+ Please make sure you have done the following before submitting your feature request.
+ Requests that do not meet these criteria will be closed.
+ Links:
+ [**OPEN ISSUES**](https://github.com/meshtastic/Meshtastic-Android/issues)
+ [**CLOSED ISSUES**](https://github.com/meshtastic/Meshtastic-Android/issues?q=is%3Aissue+is%3Aclosed)
+ [Contribution Guidelines](https://github.com/meshtastic/Meshtastic-Android/blob/main/README.md#contributing)
+ options:
+ - label:
+ I have used the search function for **OPEN ISSUES** to see if someone else has already submitted the same feature request.
+ required: true
+ - label: |
+ I have **also** used the search function for **CLOSED ISSUES** to see if the feature was already implemented and is just waiting to be released, or if the feature was rejected.
+ required: true
+ - label: |
+ I will describe the request with as much detail as possible.
+ required: true
+ - label: |
+ This request contains only one single feature, **not** a list of multiple (related) features.
+ required: true
+ - label: |
+ I have read and understood the **Contribution Guidelines**.
+ required: true
+ - label: |
+ I agree to follow this project's Code of Conduct
+ required: true
+ - type: input
+ id: contact
+ attributes:
+ label: Contact Details
+ description: How can we get in touch with you if we need more info?
+ placeholder: ex. email@example.com, discord username
+ validations:
+ required: false
+ - type: textarea
+ id: feature
+ attributes:
+ label: Feature or improvement you want
+ description: Try to be as specific as possible. Please not only explain what the feature does, but also how.
+ - type: textarea
+ id: reason
+ attributes:
+ label: Why should this be added?
+ description: |
+ What problem does the feature solve? In what use-cases is the feature needed?
+ Is this supported by the firmware? Please provide links to relevant firmware issues or PRs if applicable.
+ - type: textarea
+ id: screenshots
+ attributes:
+ label: Screenshots / Drawings / Technical details
+ description: If your request is about (or includes) changing or extending the UI, describe what the UI would look like and how the user would interact with it.
\ No newline at end of file
diff --git a/.github/ISSUE_TEMPLATE/zbug_report_internal.yml b/.github/ISSUE_TEMPLATE/zbug_report_internal.yml
new file mode 100644
index 000000000..5f01a4573
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/zbug_report_internal.yml
@@ -0,0 +1,180 @@
+name: Internal testing - Bug Report
+description: File a bug report.
+title: "[Bug]: "
+labels: [bug, ch_testing]
+projects: [meshtastic/Meshtastic-Android]
+body:
+ - type: markdown
+ attributes:
+ value: |
+ This Bug report is only for the internal testing builds. If you are not on the list, or didn't seek one out deliberately, you should use the generic Bug Report. :hugs:
+
+ Please provide as much detail as possible so we can efficiently reproduce the issue.
+
+ - type: input
+ id: contact
+ attributes:
+ label: Contact Details
+ description: How can we get in touch with you if we need more info?
+ placeholder: ex. email@example.com, discord username
+ validations:
+ required: false
+
+ - type: checkboxes
+ id: checklist
+ attributes:
+ label: "Checklist"
+ description: |
+ Please make sure you have done the following before submitting your bug report.
+ Bug reports that do not meet these criteria will be closed.
+ Requests that do not meet these criteria will be closed.
+ Links:
+ [**OPEN ISSUES**](https://github.com/meshtastic/Meshtastic-Android/issues)
+ [**CLOSED ISSUES**](https://github.com/meshtastic/Meshtastic-Android/issues?q=is%3Aissue+is%3Aclosed)
+ [Contribution Guidelines](https://github.com/meshtastic/Meshtastic-Android/blob/main/README.md#contributing)
+ options:
+ - label: |
+ I am able to reproduce the bug with the latest version.
+ required: true
+ - label: |
+ I have updated to the latest *Alpha* firmware, and am able to reproduce the bug. Many issues are fixed quickly in alpha before the general beta release.
+ required: true
+ - label: |
+ I made sure that there are no existing **OPEN or CLOSED issues** which I could contribute my information to.
+ required: true
+ - label: |
+ I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
+ required: true
+ - label: |
+ This issue contains only one bug.
+ required: true
+ - label: |
+ I have read and understood the **Contribution Guidelines**.
+ required: true
+ - label: |
+ I agree to follow this project's Code of Conduct
+ required: true
+
+ - type: input
+ id: app-version
+ attributes:
+ label: Affected app version
+ description: |
+ In which Meshtastic-Android app version did you encounter the bug?
+ Can be seen on the bottom of the `Settings` screen in the app.
+ placeholder: "x.y.z-channel.x (build) flavor"
+ validations:
+ required: true
+
+ - type: input
+ id: phone-os
+ attributes:
+ label: Affected Android version
+ description: |
+ With what operating system (+ version) did you encounter the bug?
+ placeholder: "Example: Android 14"
+ validations:
+ required: true
+
+ - type: input
+ id: phone-model
+ attributes:
+ label: Affected phone model
+ description: |
+ On what phone did you encounter the bug?
+ placeholder: "Example: Samsung Galaxy S20 / Google Pixel 8"
+ validations:
+ required: true
+
+ - type: input
+ id: hardware-model
+ attributes:
+ label: Affected node model
+ placeholder: "Example: Seeed T1000-E, Heltec v3, etc."
+ description: |
+ On which hardware device (Node) did you encounter the bug?
+ validations:
+ required: true
+
+ - type: input
+ id: firmware-version
+ attributes:
+ label: Affected node firmware version
+ placeholder: "x.x.x"
+ description: "Which Meshtastic firmware version did you encounter the bug?"
+ validations:
+ required: true
+
+ - type: textarea
+ id: steps-to-reproduce
+ attributes:
+ label: Steps to reproduce the bug
+ description: |
+ What did you do for the bug to show up?
+
+ If you can't cause the bug to show up again reliably (and hence don't have a proper set of steps to give us), please still try to give as many details as possible on how you think you encountered the bug.
+ placeholder: |
+ 1. Go to '...'
+ 2. Press on '....'
+ 3. Swipe down to '....'
+ validations:
+ required: true
+
+ - type: textarea
+ id: actual-behavior
+ attributes:
+ label: Actual behavior
+ description: |
+ Tell us what happens with the steps given above.
+
+ - type: textarea
+ id: expected-behavior
+ attributes:
+ label: Expected behavior
+ description: |
+ Tell us what you expect to happen.
+
+ - type: textarea
+ id: screen-media
+ attributes:
+ label: Screenshots/Screen recordings
+ description: |
+ A picture or video is worth a thousand words.
+ Provide as much context as possible so we know what we are looking at.
+
+ Add screenshots or a screen recording to help explain your problem, provide detailed context to help us know what to look for.
+ GitHub supports uploads of images and (small) videos directly in the text box.
+
+ - type: textarea
+ id: logs
+ attributes:
+ label: Relevant log output
+ description: |
+ Logs help us to diagnose and reproduce issues, particularly when they are unique to your setup.
+ Depending on the issue, the following logs may be useful:
+ - App logs: This will help with most issues. If possible, provide the relevant output of:
+ `adb logcat -d | grep com.geeksville.mesh`
+ - Mesh logs: UI issues, communication issues etc.
+ - ` App > Settings > Advanced > Debug Panel > Export specific / export all `
+ - Broader Android logs: Potentially useful if the issue goes beyond the app (connections, network etc.)
+ `adb logcat -d`
+ - Firmware logs: Useful for all connection issues with nodes
+ - These are piped to the USB serial port on the node, the most foolproof is to use the 'open serial' button on the web-flasher interface, and then save the output.
+ - The app needs to be connecting to the node via Bluetooth or Network for this to work.
+ render: shell
+
+ - type: textarea
+ id: additional-information
+ attributes:
+ label: Additional information
+ description: |
+ Any other information you'd like to include, for instance that
+ * the affected device is foldable or a TV
+ * you have disabled all animations on your device or otherwise changed system settings
+ * you are using battery optimization or power saving mode
+ * you are using a custom Android ROM or launcher
+ * your ferret chewed your antennas
+ * you are using a VPN
+ * you live in a faraday cage
+ * you dismissed all popups telling you not to do things you shouldn't do without reading them
+ * ...
\ No newline at end of file
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index f25903e74..fde9ba798 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -2,8 +2,27 @@
(Please delete all these tips and replace with your text)
+- Before starting on some new big chunk of code, it it is optional but highly recommended to open an issue first to say "Hey, I think this idea X should be implemented and I'm starting work on it. My general plan is Y, any feedback is appreciated." This will allow other devs to potentially save you time by not accidentally duplicating work etc...
- Mention "#(issue)" in the description, when applicable
- Please do not check in files that don't have real changes
- Please do not reformat lines that you didn't have to change the code on
- If your other co-developers have comments on your PR please tweak as needed
- Do not use any external image service, just paste or drag and drop the image here and it will be uploaded automatically
+- Please also enable "Allow edits by maintainers".
+
+
\ No newline at end of file
diff --git a/.github/actions/gradle-setup/action.yml b/.github/actions/gradle-setup/action.yml
new file mode 100644
index 000000000..a42959190
--- /dev/null
+++ b/.github/actions/gradle-setup/action.yml
@@ -0,0 +1,40 @@
+name: Gradle Setup
+description: Setup Java and Gradle for KMP builds
+inputs:
+ cache_read_only:
+ description: 'Whether Gradle cache is read-only'
+ default: 'true'
+ jdk_distribution:
+ description: 'JDK distribution (temurin or jetbrains)'
+ default: 'temurin'
+ gradle_encryption_key:
+ description: 'Encryption key for Gradle remote cache'
+ required: false
+runs:
+ using: composite
+ steps:
+ - name: Copy CI Gradle properties
+ shell: bash
+ run: mkdir -p ~/.gradle && cp .github/ci-gradle.properties ~/.gradle/gradle.properties
+
+ - name: Validate Gradle Wrapper
+ uses: gradle/actions/wrapper-validation@v6
+
+ - name: Set up JDK 21
+ uses: actions/setup-java@v5
+ with:
+ java-version: '21'
+ distribution: ${{ inputs.jdk_distribution }}
+ token: ${{ github.token }}
+
+ - name: Setup Gradle
+ uses: gradle/actions/setup-gradle@v6
+ with:
+ cache-read-only: ${{ inputs.cache_read_only }}
+ cache-encryption-key: ${{ inputs.gradle_encryption_key }}
+ cache-cleanup: on-success
+ add-job-summary: always
+ gradle-home-cache-includes: |
+ caches
+ notifications
+ ~/.m2/repository/org/robolectric
\ No newline at end of file
diff --git a/.github/ci-gradle.properties b/.github/ci-gradle.properties
new file mode 100644
index 000000000..e4d203ef7
--- /dev/null
+++ b/.github/ci-gradle.properties
@@ -0,0 +1,52 @@
+#
+# CI-specific Gradle properties.
+#
+# This file is copied to ~/.gradle/gradle.properties by the gradle-setup
+# composite action, overriding the dev-oriented values in the repo-root
+# gradle.properties. Inspired by the nowinandroid & sqldelight patterns.
+#
+
+# ── Daemon ────────────────────────────────────────────────────────────
+# Single-use CI runners never reuse a daemon, so the startup cost is pure
+# overhead. Disabling it also avoids "daemon disappeared" warnings.
+org.gradle.daemon=false
+
+# ── Memory ────────────────────────────────────────────────────────────
+# Standard GitHub runners have 7 GB RAM. Keep Gradle + Kotlin daemon
+# within budget (4g Gradle + 2g Kotlin daemon + 1g OS/tooling headroom).
+org.gradle.jvmargs=-Xmx4g -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8
+kotlin.daemon.jvm.options=-Xmx2g -XX:+UseParallelGC
+
+# ── Parallelism ───────────────────────────────────────────────────────
+org.gradle.parallel=true
+org.gradle.workers.max=4
+
+# ── Caching & Configuration ──────────────────────────────────────────
+org.gradle.caching=true
+org.gradle.configuration-cache=true
+org.gradle.configureondemand=false
+org.gradle.vfs.watch=false
+org.gradle.isolated-projects=true
+
+# ── Kotlin ────────────────────────────────────────────────────────────
+# Incremental compilation is wasted on fresh CI checkouts (no prior build
+# state to diff against). Disabling avoids the overhead of maintaining
+# incremental state that will never be reused.
+kotlin.incremental=false
+kotlin.code.style=official
+kotlin.parallel.tasks.in.project=true
+
+# ── KSP ──────────────────────────────────────────────────────────────
+# In CI, KSP incremental processing adds overhead without benefit (fresh
+# checkouts). Keep intermodule incremental off (no prior state).
+ksp.incremental=false
+ksp.run.in.process=true
+
+# ── Android ──────────────────────────────────────────────────────────
+android.experimental.lint.analysisPerComponent=true
+# Disable unused build features to reduce build time
+android.defaults.buildfeatures.resvalues=false
+android.defaults.buildfeatures.shaders=false
+
+# ── Misc ─────────────────────────────────────────────────────────────
+org.gradle.welcome=never
diff --git a/.github/copilot-commit-message-instructions.md b/.github/copilot-commit-message-instructions.md
new file mode 100644
index 000000000..93c242d16
--- /dev/null
+++ b/.github/copilot-commit-message-instructions.md
@@ -0,0 +1,27 @@
+# GitHub Copilot Commit Message Instructions
+
+
+You are an expert Git maintainer enforcing Conventional Commits.
+
+
+
+1. **Format:** Use the Conventional Commits format: `(): ` (Replace angle brackets with actual text, do NOT output angle brackets).
+2. **Types allowed:**
+ - `feat` (new feature for the user, not a new feature for build script)
+ - `fix` (bug fix for the user, not a fix to a build script)
+ - `docs` (changes to the documentation)
+ - `style` (formatting, missing semi colons, etc; no production code change)
+ - `refactor` (refactoring production code, e.g. KMP migration, extracting to commonMain)
+ - `test` (adding missing tests, refactoring tests; no production code change)
+ - `chore` (updating grunt tasks etc; no production code change)
+3. **Scope:** Use the module or logical component as the scope (e.g., `ui`, `navigation`, `ble`, `firmware`, `deps`, `ai`).
+4. **Subject line:**
+ - Use the imperative, present tense: "change" not "changed" nor "changes".
+ - Do not capitalize the first letter.
+ - Do not use a period (.) at the end.
+ - Keep it under 50 characters if possible.
+5. **Body (Optional but recommended for large diffs):**
+ - Leave one blank line after the subject.
+ - Explain *why* the change was made, not just *what* changed.
+ - If migrating to KMP or extracting to `commonMain`, explicitly state "Decoupled from Android framework".
+
diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md
new file mode 100644
index 000000000..e856cbe8f
--- /dev/null
+++ b/.github/copilot-instructions.md
@@ -0,0 +1,6 @@
+# Meshtastic Android - GitHub Copilot Guide
+
+> **Note:** The canonical instructions for all AI Agents have been deduplicated.
+
+You MUST immediately read and internalize the unified instructions located at the root of the repository in `AGENTS.md`.
+After reading `AGENTS.md`, consult the `.skills/` directory for task-specific playbooks.
diff --git a/.github/copilot-pull-request-instructions.md b/.github/copilot-pull-request-instructions.md
new file mode 100644
index 000000000..8e79d63d2
--- /dev/null
+++ b/.github/copilot-pull-request-instructions.md
@@ -0,0 +1,18 @@
+# GitHub Copilot Pull Request Instructions
+
+
+You are an expert open-source maintainer. Your goal is to write clear, professional, and highly structured Pull Request descriptions based on the provided diffs.
+
+
+
+1. **Remove Boilerplate:** Always delete the "tips" section at the top of the `PULL_REQUEST_TEMPLATE.md` before generating your text.
+2. **Context First:** Start with a clear, 1-2 sentence summary of *why* this change is being made. If the branch name or commits reference an issue (e.g., `fix-1234`), explicitly add `Fixes #1234` or `Resolves #1234`.
+3. **Structured Changes:** Break down the code changes into bullet points categorized by:
+ - 🌟 **New Features** (UI, modules, logic)
+ - 🛠️ **Refactoring & Architecture** (KMP migrations, Koin DI updates)
+ - 🐛 **Bug Fixes**
+ - 🧹 **Chores** (Dependencies, formatting, docs)
+4. **Architecture Callouts:** If the diff includes moving files from `androidMain` to `commonMain`, or migrating from Android Views to Compose, highlight this as a "KMP Migration Milestone".
+5. **Testing Callouts:** If the diff includes changes to `commonTest` or mentions tests, add a section called "Testing Performed" and list the tests that were added/modified.
+6. **No "Magic" Text:** Do not invent URLs or insert fake image placeholders. Leave the HTML comment block for images intact so the user can manually add their screenshots.
+
diff --git a/.github/instructions/android-source-set.instructions.md b/.github/instructions/android-source-set.instructions.md
new file mode 100644
index 000000000..6179bc61a
--- /dev/null
+++ b/.github/instructions/android-source-set.instructions.md
@@ -0,0 +1,11 @@
+---
+applyTo: "**/androidMain/**/*.kt"
+---
+
+# Android Source-Set Rules
+
+- This is `androidMain` — Android framework imports (`android.*`, `java.*`) are allowed here.
+- Do NOT put business logic here. Business logic belongs in `commonMain`.
+- If you find identical pure-Kotlin logic in both `androidMain` and `jvmMain`, extract it to `commonMain`.
+- Use `expect`/`actual` only for small platform primitives. Prefer interfaces + DI.
+- Keep `expect` declarations in `FileIo.kt` and shared helpers in `FileIoUtils.kt` to avoid JVM duplicate class errors.
diff --git a/.github/instructions/build-logic.instructions.md b/.github/instructions/build-logic.instructions.md
new file mode 100644
index 000000000..d61fa34b8
--- /dev/null
+++ b/.github/instructions/build-logic.instructions.md
@@ -0,0 +1,10 @@
+---
+applyTo: "build-logic/**/*.kt"
+---
+
+# Build-Logic Convention Plugin Rules
+
+- Prefer lazy Gradle configuration (`configureEach`, `withPlugin`, provider APIs).
+- Avoid `afterEvaluate` unless there is no viable lazy alternative.
+- Check `gradle/libs.versions.toml` for version catalog aliases before adding new ones.
+- Convention plugins: `meshtastic.kmp.feature`, `meshtastic.kmp.library`, `meshtastic.kmp.jvm.android`, `meshtastic.koin`.
diff --git a/.github/instructions/ci-workflows.instructions.md b/.github/instructions/ci-workflows.instructions.md
new file mode 100644
index 000000000..55a72b328
--- /dev/null
+++ b/.github/instructions/ci-workflows.instructions.md
@@ -0,0 +1,14 @@
+---
+applyTo: "**/*.yml"
+excludeAgent: "code-review"
+---
+
+# CI Workflow Rules
+
+- Prefer explicit Gradle task paths (`app:lintFdroidDebug`) over shorthand (`lintDebug`).
+- CI uses `.github/ci-gradle.properties` — don't assume local `gradle.properties` values.
+- CI passes `-Pci=true` to enable full processor usage via `maxParallelForks`.
+- Use `fetch-depth: 0` only where needed (spotless ratcheting, version code). Use `fetch-depth: 1` otherwise.
+- Desktop build matrix: `macos-latest`, `windows-latest`, `ubuntu-24.04`, `ubuntu-24.04-arm`.
+- Lightweight jobs (labelers, triage, stale): use `ubuntu-24.04-arm` runners.
+- Gradle-heavy jobs: use `ubuntu-24.04` runners.
diff --git a/.github/instructions/kmp-common.instructions.md b/.github/instructions/kmp-common.instructions.md
new file mode 100644
index 000000000..7dac915bc
--- /dev/null
+++ b/.github/instructions/kmp-common.instructions.md
@@ -0,0 +1,20 @@
+---
+applyTo: "**/commonMain/**/*.kt"
+---
+
+# KMP commonMain Rules
+
+- NEVER import `java.*` or `android.*` in `commonMain`.
+- Use `org.meshtastic.core.common.util.ioDispatcher` instead of `Dispatchers.IO`.
+- Use Okio (`BufferedSource`/`BufferedSink`) instead of `java.io.*`.
+- Use `kotlinx.coroutines.sync.Mutex` instead of `java.util.concurrent.locks.*`.
+- Use `atomicfu` or Mutex-guarded `mutableMapOf()` instead of `ConcurrentHashMap`.
+- Use `jetbrains-*` catalog aliases for lifecycle/navigation dependencies.
+- Use `compose-multiplatform-*` catalog aliases for CMP dependencies.
+- Never use plain `androidx.compose` dependencies in `commonMain`.
+- Strings: use `stringResource(Res.string.key)` from `core:resources`. No hardcoded strings.
+- CMP `stringResource` only supports `%N$s` and `%N$d` — pre-format floats with `NumberFormatter.format()`.
+- Use `MetricFormatter` from `core:common` for display strings (temperature, voltage, percent, signal). Avoid scattered `formatString("%.1f°C", val)` calls.
+- Check `gradle/libs.versions.toml` before adding dependencies.
+- Use `safeCatching {}` from `core:common` instead of `runCatching {}` in coroutine/suspend contexts. Keep `runCatching` only in cleanup/teardown code.
+- Use `kotlinx.coroutines.CancellationException`, not `kotlin.coroutines.cancellation.CancellationException`.
diff --git a/.github/lsp.json b/.github/lsp.json
new file mode 100644
index 000000000..983ecf785
--- /dev/null
+++ b/.github/lsp.json
@@ -0,0 +1,12 @@
+{
+ "lspServers": {
+ "kotlin": {
+ "command": "kotlin-language-server",
+ "args": [],
+ "fileExtensions": {
+ ".kt": "kotlin",
+ ".kts": "kotlin"
+ }
+ }
+ }
+}
diff --git a/.github/meshtastic_logo.png b/.github/meshtastic_logo.png
new file mode 100644
index 000000000..11c5db18c
Binary files /dev/null and b/.github/meshtastic_logo.png differ
diff --git a/.github/release.yml b/.github/release.yml
new file mode 100644
index 000000000..6ec1c03ba
--- /dev/null
+++ b/.github/release.yml
@@ -0,0 +1,36 @@
+# .github/release.yml - GitHub Release Notes Configuration
+
+changelog:
+ exclude:
+ labels:
+ - dependencies
+ - automation
+ - release
+ - repo
+ - skip-changelog
+ - chore
+ - ci
+ - build
+ - testing
+ - test
+ - refactor
+ - documentation
+ - translation
+ authors:
+ - renovate[bot]
+ - dependabot[bot]
+ - github-actions[bot]
+
+ categories:
+ - title: 🏗️ Features
+ labels:
+ - enhancement
+ - feature
+ - title: 🛠️ Fixes
+ labels:
+ - bug
+ - bugfix
+ - fix
+ - title: 📝 Other Changes
+ labels:
+ - '*'
diff --git a/.github/renovate.json b/.github/renovate.json
new file mode 100644
index 000000000..1faa1a4ad
--- /dev/null
+++ b/.github/renovate.json
@@ -0,0 +1,96 @@
+{
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
+ "extends": [
+ ":dependencyDashboard",
+ ":semanticCommitTypeAll(chore)",
+ ":ignoreModulesAndTests",
+ "group:recommended",
+ "replacements:all",
+ "workarounds:all"
+ ],
+ "commitMessageTopic": "{{depName}}",
+ "labels": [
+ "dependencies"
+ ],
+ "git-submodules": {
+ "enabled": true
+ },
+ "bundler": {
+ "enabled": true
+ },
+ "packageRules": [
+ {
+ "description": "Automerge non-major updates for stable versions",
+ "matchUpdateTypes": [
+ "minor",
+ "patch",
+ "pin",
+ "digest"
+ ],
+ "matchCurrentVersion": "!/^0/",
+ "automerge": true
+ },
+ {
+ "description": "Automerge patch updates for unstable (0.x) versions",
+ "matchUpdateTypes": [
+ "patch",
+ "pin",
+ "digest"
+ ],
+ "matchCurrentVersion": "/^0/",
+ "automerge": true
+ },
+ {
+ "description": "Automerge pins and digests regardless of version",
+ "matchUpdateTypes": [
+ "pin",
+ "digest"
+ ],
+ "automerge": true
+ },
+ {
+ "description": "Meshtastic Protobufs changelog link",
+ "matchPackageNames": [
+ "https://github.com/meshtastic/protobufs.git"
+ ],
+ "changelogUrl": "https://github.com/meshtastic/protobufs/compare/{{currentDigest}}...{{newDigest}}",
+ "automerge": true
+ },
+ {
+ "description": "Group CMP and the androidx.compose artifacts that track it so Renovate bumps them together (see PR #5180)",
+ "groupName": "compose-multiplatform",
+ "matchPackageNames": [
+ "/^org\\.jetbrains\\.compose/",
+ "androidx.compose.runtime:runtime-tracing",
+ "androidx.compose.ui:ui-test-manifest"
+ ]
+ },
+ {
+ "description": "Restrict sensitive infrastructure to manual minor updates",
+ "matchUpdateTypes": [
+ "minor"
+ ],
+ "matchPackageNames": [
+ "/^org\\.jetbrains\\.kotlin/",
+ "/^org\\.jetbrains\\.kotlinx/",
+ "/^org\\.jetbrains\\.compose/",
+ "/^com\\.google\\.dagger/",
+ "/^androidx\\.hilt/",
+ "/^com\\.google\\.protobuf/",
+ "/^androidx\\.lifecycle/",
+ "/^androidx\\.navigation/",
+ "/^androidx\\.datastore/",
+ "/^androidx\\.compose\\.material3\\.adaptive/",
+ "/^androidx\\.compose\\.material3:material3-adaptive-navigation-suite$/"
+ ],
+ "automerge": false
+ },
+ {
+ "description": "Disable automerge for major updates (safety net)",
+ "matchUpdateTypes": [
+ "major"
+ ],
+ "automerge": false
+ }
+ ]
+}
diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml
deleted file mode 100644
index 364ced3b1..000000000
--- a/.github/workflows/android.yml
+++ /dev/null
@@ -1,44 +0,0 @@
-name: Android CI
-
-on:
- push:
- pull_request:
- branches: [ master ]
-
-jobs:
-
- ci-build:
- runs-on: ubuntu-latest
- steps:
-
- - name: Checkout code
- uses: actions/checkout@v3
- with:
- submodules: 'recursive'
-
- - name: Mock files for CI
- run: |
- rm ./app/google-services.json
- cp ./app/google-services-example.json ./app/google-services.json
- rm ./app/src/main/res/values/curfirmwareversion.xml
- cp ./app/special/curfirmwareversion.xml ./app/src/main/res/values/
-
- - name: Set up JDK 11
- uses: actions/setup-java@v3
- with:
- java-version: '11'
- distribution: 'temurin'
- cache: gradle
-
- - name: Validate Gradle wrapper
- uses: gradle/wrapper-validation-action@v1
-
- - name: Build debug APK
- run: ./gradlew assembleDebug
-
- - name: Upload APK
- uses: actions/upload-artifact@v3
- with:
- name: app-debug
- path: app/build/outputs/apk/debug/app-debug.apk
- retention-days: 30
diff --git a/.github/workflows/create-or-promote-release.yml b/.github/workflows/create-or-promote-release.yml
new file mode 100644
index 000000000..3c6ddd61a
--- /dev/null
+++ b/.github/workflows/create-or-promote-release.yml
@@ -0,0 +1,166 @@
+name: Create or Promote Release
+
+on:
+ workflow_dispatch:
+ inputs:
+ base_version:
+ description: 'Base version for the release (e.g., 2.3.0)'
+ required: true
+ channel:
+ description: 'The channel to create a release for or promote to'
+ required: true
+ type: choice
+ options:
+ - internal
+ - closed
+ - open
+ - production
+ dry_run:
+ description: 'If true, calculates the tag but does not push it or start the release'
+ required: true
+ type: boolean
+ default: false
+ build_desktop:
+ description: 'Whether to build the desktop distribution'
+ required: true
+ type: boolean
+ default: false
+
+permissions:
+ contents: write
+ pull-requests: read
+ id-token: write
+ attestations: write
+
+jobs:
+ determine-tags:
+ runs-on: ubuntu-24.04-arm
+ outputs:
+ tag_to_process: ${{ steps.calculate_tags.outputs.tag_to_process }}
+ release_name: ${{ steps.calculate_tags.outputs.release_name }}
+ final_tag: ${{ steps.calculate_tags.outputs.final_tag }}
+ from_channel: ${{ steps.calculate_tags.outputs.from_channel }}
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v6
+ with:
+ fetch-depth: 0
+ token: ${{ secrets.CROWDIN_GITHUB_TOKEN }}
+
+ - name: Calculate tags
+ id: calculate_tags
+ run: |
+ BASE_VERSION="${{ inputs.base_version }}"
+ CHANNEL="${{ inputs.channel }}"
+
+ if [[ "$CHANNEL" == "internal" ]]; then
+ # This is a new build, create a new internal tag
+ LATEST_TAG=$(git tag --list "v${BASE_VERSION}-internal.*" --sort=-v:refname | head -n 1)
+
+ if [ -z "$LATEST_TAG" ]; then
+ INCREMENT=1
+ else
+ INCREMENT=$(echo "$LATEST_TAG" | sed -n "s/.*-internal\.\([0-9]*\)/\1/p" | awk '{print $1+1}')
+ fi
+
+ NEW_TAG="v${BASE_VERSION}-internal.${INCREMENT}"
+ echo "Calculated new tag: $NEW_TAG"
+ echo "tag_to_process=$NEW_TAG" >> $GITHUB_OUTPUT
+ echo "release_name=$NEW_TAG" >> $GITHUB_OUTPUT
+ echo "final_tag=$NEW_TAG" >> $GITHUB_OUTPUT
+ else
+ # This is a promotion, find the latest tag from the previous channel to promote
+ FROM_CHANNEL="internal"
+ if [[ "$CHANNEL" == "open" ]]; then
+ FROM_CHANNEL="closed"
+ elif [[ "$CHANNEL" == "production" ]]; then
+ FROM_CHANNEL="open"
+ fi
+
+ LATEST_TAG_TO_PROMOTE=$(git tag --list "v${BASE_VERSION}-${FROM_CHANNEL}.*" --sort=-v:refname | head -n 1)
+
+ if [ -z "$LATEST_TAG_TO_PROMOTE" ]; then
+ echo "::error::No ${FROM_CHANNEL} release found for base version ${BASE_VERSION} to promote."
+ exit 1
+ fi
+
+ echo "Found latest ${FROM_CHANNEL} tag to promote: $LATEST_TAG_TO_PROMOTE"
+
+ # Calculate the increment for the TARGET channel
+ if [[ "$CHANNEL" != "production" ]]; then
+ LATEST_CHANNEL_TAG=$(git tag --list "v${BASE_VERSION}-${CHANNEL}.*" --sort=-v:refname | head -n 1)
+
+ if [ -z "$LATEST_CHANNEL_TAG" ]; then
+ INCREMENT=1
+ else
+ INCREMENT=$(echo "$LATEST_CHANNEL_TAG" | sed -n "s/.*-${CHANNEL}\.\([0-9]*\)/\1/p" | awk '{print $1+1}')
+ fi
+
+ NEW_TAG="v${BASE_VERSION}-${CHANNEL}.${INCREMENT}"
+ else
+ # Production is special, it has no increment
+ NEW_TAG="v${BASE_VERSION}"
+ fi
+
+ echo "New release name will be: $NEW_TAG"
+ echo "Final tag will be: $NEW_TAG"
+ echo "from_channel=${FROM_CHANNEL}" >> $GITHUB_OUTPUT
+ echo "tag_to_process=${LATEST_TAG_TO_PROMOTE}" >> $GITHUB_OUTPUT
+ echo "release_name=${NEW_TAG}" >> $GITHUB_OUTPUT
+ echo "final_tag=${NEW_TAG}" >> $GITHUB_OUTPUT
+ fi
+ shell: bash
+
+ - name: Create and Push Release Tag
+ if: ${{ !inputs.dry_run && inputs.channel == 'internal' }}
+ env:
+ FINAL_TAG: ${{ steps.calculate_tags.outputs.final_tag }}
+ run: |
+ echo "Tagging and pushing release: $FINAL_TAG"
+ git tag "$FINAL_TAG"
+ git push origin "$FINAL_TAG"
+ shell: bash
+
+ call-release-workflow:
+ if: ${{ !inputs.dry_run && inputs.channel == 'internal' }}
+ needs: determine-tags
+ uses: ./.github/workflows/release.yml
+ with:
+ tag_name: ${{ needs.determine-tags.outputs.final_tag }}
+ channel: ${{ inputs.channel }}
+ base_version: ${{ inputs.base_version }}
+ build_desktop: ${{ inputs.build_desktop }}
+ secrets: inherit
+
+ call-promote-workflow:
+ if: ${{ !inputs.dry_run && inputs.channel != 'internal' }}
+ needs: determine-tags
+ uses: ./.github/workflows/promote.yml
+ with:
+ tag_name: ${{ needs.determine-tags.outputs.tag_to_process }}
+ release_name: ${{ needs.determine-tags.outputs.release_name }}
+ final_tag: ${{ needs.determine-tags.outputs.final_tag }}
+ channel: ${{ inputs.channel }}
+ base_version: ${{ inputs.base_version }}
+ from_channel: ${{ needs.determine-tags.outputs.from_channel }}
+ secrets: inherit
+
+ cleanup-on-failure:
+ needs: [determine-tags, call-release-workflow]
+ if: ${{ (failure() || cancelled()) && !inputs.dry_run && inputs.channel == 'internal' }}
+ runs-on: ubuntu-24.04-arm
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v6
+ with:
+ fetch-depth: 0
+ - name: Delete Failed or Cancelled Tag
+ env:
+ FINAL_TAG: ${{ needs.determine-tags.outputs.final_tag }}
+ run: |
+ if [ -n "$FINAL_TAG" ]; then
+ echo "Release workflow failed or was cancelled. Deleting tag $FINAL_TAG to allow a clean retry..."
+ git push origin :refs/tags/"$FINAL_TAG" || echo "Tag was not pushed or already deleted."
+ else
+ echo "No tag was created to delete."
+ fi
diff --git a/.github/workflows/dependency-submission.yml b/.github/workflows/dependency-submission.yml
new file mode 100644
index 000000000..10535d723
--- /dev/null
+++ b/.github/workflows/dependency-submission.yml
@@ -0,0 +1,29 @@
+name: Dependency Submission
+
+on:
+ push:
+ branches: [ 'main' ]
+ workflow_dispatch:
+
+permissions:
+ contents: write
+
+jobs:
+ dependency-submission:
+ runs-on: ubuntu-24.04
+ if: github.repository == 'meshtastic/Meshtastic-Android'
+
+ steps:
+ - uses: actions/checkout@v6
+ - uses: actions/setup-java@v5
+ with:
+ distribution: temurin
+ java-version: 21
+ token: ${{ github.token }}
+
+ - name: Generate and submit dependency graph
+ uses: gradle/actions/dependency-submission@v6
+ with:
+ build-scan-publish: true
+ build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
+ build-scan-terms-of-use-agree: "yes"
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
new file mode 100644
index 000000000..f7c8151c7
--- /dev/null
+++ b/.github/workflows/docs.yml
@@ -0,0 +1,83 @@
+# This workflow builds and deploys the Dokka documentation to GitHub Pages.
+
+name: Deploy Documentation
+
+on:
+ push:
+ branches:
+ - main
+ paths:
+ # Only rebuild docs when source code changes (Dokka generates from KDoc)
+ - 'app/src/**'
+ - 'core/**/src/**'
+ - 'feature/**/src/**'
+ - 'desktop/src/**'
+ - 'build-logic/**'
+ - 'build.gradle.kts'
+ - 'settings.gradle.kts'
+ - '.github/workflows/docs.yml'
+
+ # Allows you to run this workflow manually from the Actions tab
+ workflow_dispatch:
+ inputs:
+ ref:
+ description: 'The branch, tag or SHA to checkout'
+ required: false
+ type: string
+
+ # Allow this workflow to be called from other workflows
+ workflow_call:
+ inputs:
+ ref:
+ description: 'The branch, tag or SHA to checkout'
+ required: false
+ type: string
+
+# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
+permissions:
+ contents: read
+ pages: write
+ id-token: write
+
+# Allow only one concurrent deployment; cancel queued runs since only the latest
+# main state matters for documentation.
+concurrency:
+ group: "pages"
+ cancel-in-progress: true
+
+jobs:
+ build-docs:
+ if: github.repository == 'meshtastic/Meshtastic-Android'
+ runs-on: ubuntu-24.04
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v6
+ with:
+ fetch-depth: 0
+ submodules: 'recursive'
+ ref: ${{ inputs.ref || '' }}
+
+ - name: Gradle Setup
+ uses: ./.github/actions/gradle-setup
+ with:
+ gradle_encryption_key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
+
+ - name: Build Dokka HTML documentation
+ run: ./gradlew dokkaGeneratePublicationHtml
+
+ - name: Upload artifact
+ uses: actions/upload-pages-artifact@v5
+ with:
+ path: build/dokka/html
+
+ deploy:
+ if: github.repository == 'meshtastic/Meshtastic-Android'
+ environment:
+ name: github-pages
+ url: ${{ steps.deployment.outputs.page_url }}
+ runs-on: ubuntu-24.04-arm
+ needs: build-docs
+ steps:
+ - name: Deploy to GitHub Pages
+ id: deployment
+ uses: actions/deploy-pages@v5
diff --git a/.github/workflows/main-check.yml b/.github/workflows/main-check.yml
new file mode 100644
index 000000000..eaf3f54d3
--- /dev/null
+++ b/.github/workflows/main-check.yml
@@ -0,0 +1,26 @@
+name: Main CI (Verify & Build)
+
+on:
+ push:
+ branches: [ main ]
+ paths-ignore:
+ - '**/*.md'
+ - 'docs/**'
+
+permissions:
+ contents: read
+
+concurrency:
+ group: main-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ validate-and-build:
+ if: github.repository == 'meshtastic/Meshtastic-Android'
+ uses: ./.github/workflows/reusable-check.yml
+ with:
+ run_lint: true
+ run_unit_tests: false
+ run_desktop_builds: false
+ upload_artifacts: true
+ secrets: inherit
diff --git a/.github/workflows/main-push-changelog.yml b/.github/workflows/main-push-changelog.yml
new file mode 100644
index 000000000..da161e44e
--- /dev/null
+++ b/.github/workflows/main-push-changelog.yml
@@ -0,0 +1,71 @@
+name: Main Push Changelog
+
+on:
+ push:
+ branches:
+ - main
+
+permissions:
+ contents: write
+ pull-requests: read
+
+concurrency:
+ group: main-push-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ main-push-changelog:
+ name: Generate main push changelog
+ runs-on: ubuntu-24.04-arm
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v6
+ with:
+ fetch-depth: 0
+
+ - name: Determine last tag
+ id: last_prod_tag
+ run: |
+ TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
+ echo "Found last tag: $TAG"
+ echo "tag=$TAG" >> "$GITHUB_OUTPUT"
+
+ - name: Generate changelog from last tag to current
+ if: steps.last_prod_tag.outputs.tag != ''
+ uses: mikepenz/release-changelog-builder-action@v6
+ id: changelog
+ with:
+ configuration: .github/release.yml
+ fromTag: ${{ steps.last_prod_tag.outputs.tag }}
+ toTag: ${{ github.sha }}
+ outputFile: main-push-changelog.md
+ fetchViaCommits: true
+ fetchReviewers: false
+ fetchReleaseInformation: false
+ fetchReviews: false
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Upload changelog artifact
+ if: steps.last_prod_tag.outputs.tag != ''
+ uses: actions/upload-artifact@v7
+ with:
+ name: main-push-changelog
+ path: main-push-changelog.md
+
+ - name: Print main push summary
+ env:
+ LAST_TAG: ${{ steps.last_prod_tag.outputs.tag }}
+ run: |
+ echo "Pushed to main"
+ echo "SHA: $GITHUB_SHA"
+ echo "Actor: $GITHUB_ACTOR"
+ echo "Ref: $GITHUB_REF"
+ echo ""
+ if [ "$LAST_TAG" != "" ]; then
+ echo "Changelog since last tag ($LAST_TAG)":
+ echo "----------------------------------------"
+ cat main-push-changelog.md
+ else
+ echo "No tag found. Skipping changelog generation."
+ fi
diff --git a/.github/workflows/merge-queue.yml b/.github/workflows/merge-queue.yml
new file mode 100644
index 000000000..44d31183d
--- /dev/null
+++ b/.github/workflows/merge-queue.yml
@@ -0,0 +1,38 @@
+name: Android CI (Merge Queue)
+
+on:
+ merge_group:
+ types: [checks_requested]
+
+permissions:
+ contents: read
+
+concurrency:
+ group: build-mq-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ android-check:
+ if: github.repository == 'meshtastic/Meshtastic-Android'
+ uses: ./.github/workflows/reusable-check.yml
+ with:
+ run_lint: true
+ run_unit_tests: true
+ upload_artifacts: false
+ secrets: inherit
+
+ check-workflow-status:
+ name: Check Workflow Status
+ runs-on: ubuntu-24.04-arm
+ permissions: {}
+ needs:
+ - android-check
+ if: always()
+ steps:
+ - name: Check Workflow Status
+ run: |
+ if [[ "${{ needs.android-check.result }}" == "failure" || "${{ needs.android-check.result }}" == "cancelled" ]]; then
+ echo "::error::Android Check failed"
+ exit 1
+ fi
+ echo "All jobs passed successfully"
diff --git a/.github/workflows/models_issue_triage.yml b/.github/workflows/models_issue_triage.yml
new file mode 100644
index 000000000..a02fb8ed8
--- /dev/null
+++ b/.github/workflows/models_issue_triage.yml
@@ -0,0 +1,204 @@
+name: Issue Triage (Models)
+
+on:
+ issues:
+ types: [opened]
+
+permissions:
+ issues: write
+ models: read
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.issue.number }}
+ cancel-in-progress: true
+
+jobs:
+ triage:
+ if: ${{ github.repository == 'meshtastic/Meshtastic-Android' && github.event.issue.user.type != 'Bot' }}
+ runs-on: ubuntu-24.04-arm
+ steps:
+ # ─────────────────────────────────────────────────────────────────────────
+ # Step 1: Quality check (spam/AI-slop detection) - runs first, exits early if spam
+ # ─────────────────────────────────────────────────────────────────────────
+ - name: Detect spam or low-quality content
+ uses: actions/ai-inference@v2
+ id: quality
+ continue-on-error: true
+ with:
+ max-tokens: 20
+ prompt: |
+ Is this GitHub issue spam, AI-generated slop, or low quality?
+
+ Title: ${{ github.event.issue.title }}
+ Body: ${{ github.event.issue.body }}
+
+ Respond with exactly one of: spam, ai-generated, needs-review, ok
+ system-prompt: You detect spam and low-quality contributions. Be conservative - only flag obvious spam or AI slop.
+ model: openai/gpt-4o-mini
+
+ - name: Apply quality label if needed
+ if: steps.quality.outputs.response != '' && steps.quality.outputs.response != 'ok'
+ uses: actions/github-script@v9
+ env:
+ QUALITY_LABEL: ${{ steps.quality.outputs.response }}
+ with:
+ script: |
+ const label = (process.env.QUALITY_LABEL || '').trim().toLowerCase();
+ const labelMeta = {
+ 'spam': { color: 'd73a4a', description: 'Possible spam' },
+ 'ai-generated': { color: 'fbca04', description: 'Possible AI-generated low-quality content' },
+ 'needs-review': { color: 'f9d0c4', description: 'Needs human review' },
+ };
+ const meta = labelMeta[label];
+ if (!meta) return;
+
+ // Ensure label exists
+ try {
+ await github.rest.issues.getLabel({ owner: context.repo.owner, repo: context.repo.repo, name: label });
+ } catch (e) {
+ if (e.status !== 404) throw e;
+ await github.rest.issues.createLabel({ owner: context.repo.owner, repo: context.repo.repo, name: label, color: meta.color, description: meta.description });
+ }
+
+ // Apply label
+ await github.rest.issues.addLabels({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.payload.issue.number, labels: [label] });
+
+ // Set output to skip remaining steps
+ core.setOutput('is_spam', 'true');
+
+ # ─────────────────────────────────────────────────────────────────────────
+ # Step 2: Duplicate detection - only if not spam
+ # ─────────────────────────────────────────────────────────────────────────
+ - name: Detect duplicate issues
+ if: steps.quality.outputs.response == 'ok' || steps.quality.outputs.response == ''
+ uses: pelikhan/action-genai-issue-dedup@bdb3b5d9451c1090ffcdf123d7447a5e7c7a2528 # v0.0.19
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+
+ # ─────────────────────────────────────────────────────────────────────────
+ # Step 3: Completeness check + auto-labeling (combined into one AI call)
+ # ─────────────────────────────────────────────────────────────────────────
+ - name: Determine if completeness check should be skipped
+ if: steps.quality.outputs.response == 'ok' || steps.quality.outputs.response == ''
+ uses: actions/github-script@v9
+ id: check-skip
+ with:
+ script: |
+ const title = (context.payload.issue.title || '').toLowerCase();
+ const labels = (context.payload.issue.labels || []).map(label => label.name);
+ const hasFeatureRequest = title.includes('feature request');
+ const hasEnhancement = labels.includes('enhancement');
+ const shouldSkip = hasFeatureRequest && hasEnhancement;
+ core.setOutput('should_skip', shouldSkip ? 'true' : 'false');
+
+ - name: Analyze issue completeness and determine labels
+ if: (steps.quality.outputs.response == 'ok' || steps.quality.outputs.response == '') && steps.check-skip.outputs.should_skip != 'true'
+ uses: actions/ai-inference@v2
+ id: analysis
+ continue-on-error: true
+ with:
+ prompt: |
+ Analyze this GitHub issue for the Meshtastic Android app and determine if it needs labels.
+
+ If this looks like a bug in the Android app (crash, ANR, UI glitch, connection failure, Bluetooth issues, notification problems, map issues), request app logs and explain how to get them:
+
+ Android app debug logs:
+ - Open the Meshtastic app, go to Settings > Debug > Save Logs
+ - Reproduce the problem, then share/attach the exported log file
+
+ Android logcat (if app logs are insufficient):
+ - Connect phone via USB with USB debugging enabled
+ - Run: adb logcat -s Meshtastic:* *:E
+ - Reproduce the problem, then copy/paste the relevant output
+
+ Also request key context if missing: Android version, phone model, app version, Meshtastic device model, firmware version, connection type (BLE/USB/TCP), steps to reproduce, expected vs actual.
+
+ Respond ONLY with JSON:
+ {
+ "complete": true|false,
+ "comment": "Your helpful comment requesting missing info, or empty string if complete",
+ "label": "needs-logs" | "needs-info" | "none"
+ }
+
+ Use "needs-logs" if this is an app bug AND no logs are attached.
+ Use "needs-info" if basic info like firmware version or steps to reproduce are missing.
+ Use "none" if the issue is complete or is a feature request.
+
+ Title: ${{ github.event.issue.title }}
+ Body: ${{ github.event.issue.body }}
+ system-prompt: You are a helpful assistant that triages GitHub issues. Be conservative with labels.
+ model: openai/gpt-4o-mini
+
+ - name: Process analysis result
+ if: (steps.quality.outputs.response == 'ok' || steps.quality.outputs.response == '') && steps.check-skip.outputs.should_skip != 'true' && steps.analysis.outputs.response != ''
+ uses: actions/github-script@v9
+ id: process
+ env:
+ AI_RESPONSE: ${{ steps.analysis.outputs.response }}
+ with:
+ script: |
+ const raw = (process.env.AI_RESPONSE || '').trim();
+
+ let complete = false;
+ let comment = '';
+ let label = 'none';
+
+ try {
+ const parsed = JSON.parse(raw);
+ complete = !!parsed.complete;
+ comment = (parsed.comment ?? '').toString().trim();
+ label = (parsed.label ?? 'none').toString().trim().toLowerCase();
+ } catch {
+ // If JSON parse fails, treat as incomplete with raw response as comment
+ complete = false;
+ comment = raw;
+ label = 'none';
+ }
+
+ // Validate label
+ const allowedLabels = new Set(['needs-logs', 'needs-info', 'none']);
+ if (!allowedLabels.has(label)) label = 'none';
+
+ core.setOutput('should_comment', (!complete && comment.length > 0) ? 'true' : 'false');
+ core.setOutput('comment_body', comment);
+ core.setOutput('label', label);
+
+ - name: Apply triage label
+ if: steps.process.outputs.label != '' && steps.process.outputs.label != 'none'
+ uses: actions/github-script@v9
+ env:
+ LABEL_NAME: ${{ steps.process.outputs.label }}
+ with:
+ script: |
+ const label = process.env.LABEL_NAME;
+ const labelMeta = {
+ 'needs-logs': { color: 'cfd3d7', description: 'Device logs requested for triage' },
+ 'needs-info': { color: 'f9d0c4', description: 'More information requested for triage' },
+ };
+ const meta = labelMeta[label];
+ if (!meta) return;
+
+ // Ensure label exists
+ try {
+ await github.rest.issues.getLabel({ owner: context.repo.owner, repo: context.repo.repo, name: label });
+ } catch (e) {
+ if (e.status !== 404) throw e;
+ await github.rest.issues.createLabel({ owner: context.repo.owner, repo: context.repo.repo, name: label, color: meta.color, description: meta.description });
+ }
+
+ // Apply label
+ await github.rest.issues.addLabels({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.payload.issue.number, labels: [label] });
+
+ - name: Comment on issue
+ if: steps.process.outputs.should_comment == 'true'
+ uses: actions/github-script@v9
+ env:
+ COMMENT_BODY: ${{ steps.process.outputs.comment_body }}
+ with:
+ script: |
+ await github.rest.issues.createComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: context.payload.issue.number,
+ body: process.env.COMMENT_BODY
+ });
diff --git a/.github/workflows/models_pr_triage.yml b/.github/workflows/models_pr_triage.yml
new file mode 100644
index 000000000..c2a1aaf25
--- /dev/null
+++ b/.github/workflows/models_pr_triage.yml
@@ -0,0 +1,144 @@
+name: PR Triage (Models)
+
+on:
+ pull_request_target:
+ types: [opened]
+
+permissions:
+ pull-requests: write
+ issues: write
+ models: read
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
+ cancel-in-progress: true
+
+jobs:
+ triage:
+ if: ${{ github.repository == 'meshtastic/Meshtastic-Android' && github.event.pull_request.user.type != 'Bot' }}
+ runs-on: ubuntu-24.04-arm
+ steps:
+ # ─────────────────────────────────────────────────────────────────────────
+ # Step 1: Check if PR already has automation/type labels (skip if so)
+ # ─────────────────────────────────────────────────────────────────────────
+ - name: Check existing labels
+ uses: actions/github-script@v9
+ id: check-labels
+ with:
+ script: |
+ const skipLabels = new Set(['automation', 'release']);
+ const typeLabels = new Set(['bugfix', 'enhancement', 'dependencies', 'repo', 'refactor']);
+ const prLabels = context.payload.pull_request.labels.map(l => l.name);
+
+ const shouldSkipAll = prLabels.some(l => skipLabels.has(l));
+ const hasTypeLabel = prLabels.some(l => typeLabels.has(l));
+
+ core.setOutput('skip_all', shouldSkipAll ? 'true' : 'false');
+ core.setOutput('has_type_label', hasTypeLabel ? 'true' : 'false');
+
+ # ─────────────────────────────────────────────────────────────────────────
+ # Step 2: Quality check (spam/AI-slop detection)
+ # ─────────────────────────────────────────────────────────────────────────
+ - name: Detect spam or low-quality content
+ if: steps.check-labels.outputs.skip_all != 'true'
+ uses: actions/ai-inference@v2
+ id: quality
+ continue-on-error: true
+ env:
+ PR_TITLE: ${{ github.event.pull_request.title }}
+ PR_BODY: ${{ github.event.pull_request.body }}
+ with:
+ max-tokens: 20
+ prompt: |
+ Is this GitHub pull request spam, AI-generated slop, or low quality?
+
+ Title: ${{ env.PR_TITLE }}
+ Body: ${{ env.PR_BODY }}
+
+ Respond with exactly one of: spam, ai-generated, needs-review, ok
+ system-prompt: You detect spam and low-quality contributions. Be conservative - only flag obvious spam or AI slop.
+ model: openai/gpt-4o-mini
+
+ - name: Apply quality label if needed
+ if: steps.check-labels.outputs.skip_all != 'true' && steps.quality.outputs.response != '' && steps.quality.outputs.response != 'ok'
+ uses: actions/github-script@v9
+ id: quality-label
+ env:
+ QUALITY_LABEL: ${{ steps.quality.outputs.response }}
+ with:
+ script: |
+ const label = (process.env.QUALITY_LABEL || '').trim().toLowerCase();
+ const labelMeta = {
+ 'spam': { color: 'd73a4a', description: 'Possible spam' },
+ 'ai-generated': { color: 'fbca04', description: 'Possible AI-generated low-quality content' },
+ 'needs-review': { color: 'f9d0c4', description: 'Needs human review' },
+ };
+ const meta = labelMeta[label];
+ if (!meta) return;
+
+ // Ensure label exists
+ try {
+ await github.rest.issues.getLabel({ owner: context.repo.owner, repo: context.repo.repo, name: label });
+ } catch (e) {
+ if (e.status !== 404) throw e;
+ await github.rest.issues.createLabel({ owner: context.repo.owner, repo: context.repo.repo, name: label, color: meta.color, description: meta.description });
+ }
+
+ // Apply label
+ await github.rest.issues.addLabels({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.payload.pull_request.number, labels: [label] });
+
+ core.setOutput('is_spam', 'true');
+
+ # ─────────────────────────────────────────────────────────────────────────
+ # Step 3: Auto-label PR type (bugfix/enhancement/refactor)
+ # ─────────────────────────────────────────────────────────────────────────
+ - name: Classify PR for labeling
+ if: steps.check-labels.outputs.skip_all != 'true' && steps.check-labels.outputs.has_type_label != 'true' && (steps.quality.outputs.response == 'ok' || steps.quality.outputs.response == '')
+ uses: actions/ai-inference@v2
+ id: classify
+ continue-on-error: true
+ env:
+ PR_TITLE: ${{ github.event.pull_request.title }}
+ PR_BODY: ${{ github.event.pull_request.body }}
+ with:
+ max-tokens: 30
+ prompt: |
+ Classify this pull request for the Meshtastic Android app into exactly one category.
+
+ Return exactly one of: bugfix, enhancement, refactor
+
+ Use bugfix if it fixes a bug, crash, or incorrect behavior.
+ Use enhancement if it adds a new feature, improves performance, or adds new functionality.
+ Use refactor if it restructures code without changing behavior, cleans up code, or improves architecture.
+
+ Title: ${{ env.PR_TITLE }}
+ Body: ${{ env.PR_BODY }}
+ system-prompt: You classify pull requests into categories. Be conservative and pick the most appropriate single label.
+ model: openai/gpt-4o-mini
+
+ - name: Apply type label
+ if: steps.check-labels.outputs.skip_all != 'true' && steps.check-labels.outputs.has_type_label != 'true' && steps.classify.outputs.response != ''
+ uses: actions/github-script@v9
+ env:
+ TYPE_LABEL: ${{ steps.classify.outputs.response }}
+ with:
+ script: |
+ const label = (process.env.TYPE_LABEL || '').trim().toLowerCase();
+ const labelMeta = {
+ 'bugfix': { color: 'd73a4a', description: 'Bug fix' },
+ 'enhancement': { color: 'a2eeef', description: 'New feature or enhancement' },
+ 'refactor': { color: 'c5def5', description: 'Code restructuring without behavior change' },
+ };
+ const meta = labelMeta[label];
+ if (!meta) return;
+
+ // Ensure label exists
+ try {
+ await github.rest.issues.getLabel({ owner: context.repo.owner, repo: context.repo.repo, name: label });
+ } catch (e) {
+ if (e.status !== 404) throw e;
+ await github.rest.issues.createLabel({ owner: context.repo.owner, repo: context.repo.repo, name: label, color: meta.color, description: meta.description });
+ }
+
+ // Apply label
+ await github.rest.issues.addLabels({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.payload.pull_request.number, labels: [label] });
diff --git a/.github/workflows/moderate.yml b/.github/workflows/moderate.yml
new file mode 100644
index 000000000..4b8f94bfa
--- /dev/null
+++ b/.github/workflows/moderate.yml
@@ -0,0 +1,31 @@
+name: AI Moderator
+on:
+ issues:
+ types: [opened]
+ issue_comment:
+ types: [created]
+ pull_request_review_comment:
+ types: [created]
+
+jobs:
+ spam-detection:
+ if: github.repository == 'meshtastic/Meshtastic-Android'
+ runs-on: ubuntu-24.04-arm
+ permissions:
+ issues: write
+ pull-requests: write
+ models: read
+ contents: read
+ steps:
+ - uses: actions/checkout@v6
+ - uses: github/ai-moderator@v1
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
+ spam-label: 'spam'
+ ai-label: 'ai-generated'
+ minimize-detected-comments: true
+ # Built-in prompt configuration (all enabled by default)
+ enable-spam-detection: true
+ enable-link-spam-detection: true
+ enable-ai-detection: true
+ # custom-prompt-path: '.github/prompts/my-custom.prompt.yml' # Optional
diff --git a/.github/workflows/post-release-cleanup.yml b/.github/workflows/post-release-cleanup.yml
new file mode 100644
index 000000000..d62c36ed9
--- /dev/null
+++ b/.github/workflows/post-release-cleanup.yml
@@ -0,0 +1,78 @@
+name: Post-Release Cleanup
+
+on:
+ workflow_dispatch:
+ inputs:
+ base_version:
+ description: 'The base version to clean up (e.g., 2.3.0)'
+ required: true
+ type: string
+ confirm_deletion:
+ description: 'WARNING: This is a destructive action. Set to true to perform deletion. Defaults to a dry run.'
+ required: true
+ type: boolean
+ default: false
+
+permissions:
+ contents: write
+
+jobs:
+ cleanup_prereleases:
+ runs-on: ubuntu-24.04-arm
+ environment: Release
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v6
+ with:
+ fetch-depth: 0
+
+ - name: Cleanup pre-releases and their tags
+ id: cleanup_releases
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ BASE_VERSION="${{ github.event.inputs.base_version }}"
+ TAG_PREFIX="v${BASE_VERSION}-"
+ echo "Searching for pre-releases with tag prefix '$TAG_PREFIX'."
+ RELEASES_TO_DELETE=$(gh release list --json tagName,isPrerelease --limit 100 | jq -r --arg prefix "$TAG_PREFIX" '.[] | select(.isPrerelease == true and .tagName != null and (.tagName | startswith($prefix))) | .tagName')
+
+ if [ -z "$RELEASES_TO_DELETE" ]; then
+ echo "No pre-releases found for base version $BASE_VERSION."
+ else
+ if [[ "${{ github.event.inputs.confirm_deletion }}" == "true" ]]; then
+ echo "!!! DELETING RELEASES AND TAGS !!!"
+ echo "The following pre-releases and their tags will be deleted:"
+ echo "$RELEASES_TO_DELETE"
+ echo "$RELEASES_TO_DELETE" | xargs -n 1 gh release delete --cleanup-tag --yes
+ else
+ echo "DRY RUN: The following pre-releases and their tags would be deleted:"
+ echo "$RELEASES_TO_DELETE"
+ fi
+ fi
+
+ - name: Cleanup dangling pre-release tags
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ BASE_VERSION="${{ github.event.inputs.base_version }}"
+ TAG_PREFIX="v${BASE_VERSION}-"
+ echo "Searching for any remaining remote pre-release tags with prefix '$TAG_PREFIX'."
+
+ # This finds all remote tags matching the pattern. Some may have been deleted in the previous step.
+ TAGS_TO_DELETE=$(git ls-remote --tags origin "refs/tags/${TAG_PREFIX}*" | awk '{print $2}' | sed 's|refs/tags/||')
+
+ if [ -z "$TAGS_TO_DELETE" ]; then
+ echo "No dangling pre-release tags found."
+ else
+ if [[ "${{ github.event.inputs.confirm_deletion }}" == "true" ]]; then
+ echo "!!! DELETING DANGLING TAGS !!!"
+ echo "The following pre-release tags will be deleted:"
+ # We pipe to xargs which will run the command for each tag.
+ # If a tag was already deleted by the previous 'release delete' step, this will fail for that tag.
+ # We add '|| true' to ignore any errors and ensure the workflow doesn't fail.
+ echo "$TAGS_TO_DELETE" | xargs -n 1 -I {} sh -c 'git push --delete origin {} || true'
+ else
+ echo "DRY RUN: The following dangling pre-release tags would be deleted:"
+ echo "$TAGS_TO_DELETE"
+ fi
+ fi
diff --git a/.github/workflows/pr_enforce_labels.yml b/.github/workflows/pr_enforce_labels.yml
new file mode 100644
index 000000000..fa68a597b
--- /dev/null
+++ b/.github/workflows/pr_enforce_labels.yml
@@ -0,0 +1,37 @@
+name: Check PR Labels
+
+on:
+ pull_request:
+ types: [edited, labeled]
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
+ cancel-in-progress: true
+
+permissions:
+ pull-requests: read
+ contents: read
+
+jobs:
+ check-label:
+ # Skip bot PRs — they already have labels from the workflows/bots that create them
+ if: >-
+ github.event.pull_request.user.login != 'renovate[bot]' &&
+ github.event.pull_request.user.login != 'github-actions[bot]' &&
+ github.event.pull_request.user.login != 'dependabot[bot]' &&
+ github.event.pull_request.head.ref != 'scheduled-updates' &&
+ github.event.pull_request.head.ref != 'l10n_main'
+ runs-on: ubuntu-24.04-arm
+ steps:
+ - name: Check for PR labels
+ uses: actions/github-script@v9
+ with:
+ script: |
+ // Extract labels from the payload directly to avoid extra API calls
+ const latestLabels = context.payload.pull_request.labels.map(label => label.name);
+ const requiredLabels = ['bugfix', 'enhancement', 'automation', 'dependencies', 'repo', 'release', 'refactor'];
+ console.log('Labels from payload:', latestLabels);
+ const hasRequiredLabel = latestLabels.some(label => requiredLabels.includes(label));
+ if (!hasRequiredLabel) {
+ core.setFailed(`PR must have at least one of the following labels before it can be merged: ${requiredLabels.join(', ')}.`);
+ }
diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml
new file mode 100644
index 000000000..df16866f3
--- /dev/null
+++ b/.github/workflows/promote.yml
@@ -0,0 +1,190 @@
+name: Promote Release
+
+on:
+ workflow_call:
+ inputs:
+ base_version:
+ description: 'The base version for the release (e.g., 2.3.0)'
+ required: true
+ type: string
+ tag_name:
+ description: 'The tag that triggered the release'
+ required: true
+ type: string
+ release_name:
+ description: 'The desired name for the GitHub release'
+ required: true
+ type: string
+ final_tag:
+ description: 'The final tag for the release'
+ required: true
+ type: string
+ commit_sha:
+ description: 'The commit SHA to tag'
+ required: false
+ type: string
+ channel:
+ description: 'The channel to promote to'
+ required: true
+ type: string
+ from_channel:
+ description: 'The channel to promote from'
+ required: true
+ type: string
+ secrets:
+ GSERVICES:
+ required: true
+ KEYSTORE:
+ required: true
+ KEYSTORE_FILENAME:
+ required: true
+ KEYSTORE_PROPERTIES:
+ required: true
+ DATADOG_APPLICATION_ID:
+ required: true
+ DATADOG_CLIENT_TOKEN:
+ required: true
+ GOOGLE_MAPS_API_KEY:
+ required: true
+ GOOGLE_PLAY_JSON_KEY:
+ required: true
+ GRADLE_ENCRYPTION_KEY:
+ required: true
+ DISCORD_WEBHOOK_ANDROID:
+ required: false
+
+concurrency:
+ group: ${{ github.workflow }}-${{ inputs.tag_name }}
+ cancel-in-progress: true
+
+permissions:
+ contents: write
+ pull-requests: read
+ id-token: write
+ attestations: write
+
+jobs:
+ prepare-build-info:
+ runs-on: ubuntu-24.04-arm
+ outputs:
+ APP_VERSION_NAME: ${{ steps.prep_version.outputs.APP_VERSION_NAME }}
+ APP_VERSION_CODE: ${{ steps.calculate_version_code.outputs.versionCode }}
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v6
+ with:
+ ref: ${{ inputs.commit_sha || inputs.tag_name }}
+ fetch-depth: 0
+ submodules: 'recursive'
+
+ - name: Prep APP_VERSION_NAME
+ id: prep_version
+ env:
+ INPUT_TAG_NAME: ${{ inputs.tag_name }}
+ run: |
+ VERSION_NAME=$(echo $INPUT_TAG_NAME | sed 's/-.*//' | sed 's/v//')
+ echo "APP_VERSION_NAME=$VERSION_NAME" >> $GITHUB_OUTPUT
+ echo "Parsed Version: $VERSION_NAME"
+
+ - name: Extract VERSION_CODE_OFFSET from config.properties
+ id: get_version_code_offset
+ run: |
+ OFFSET=$(grep '^VERSION_CODE_OFFSET=' config.properties | cut -d'=' -f2)
+ echo "VERSION_CODE_OFFSET=$OFFSET" >> $GITHUB_OUTPUT
+
+ - name: Calculate Version Code from Git Commit Count
+ id: calculate_version_code
+ run: |
+ COMMIT_COUNT=$(git rev-list --count HEAD)
+ OFFSET=${{ steps.get_version_code_offset.outputs.VERSION_CODE_OFFSET }}
+ VERSION_CODE=$((COMMIT_COUNT + OFFSET))
+ echo "versionCode=$VERSION_CODE" >> $GITHUB_OUTPUT
+ shell: bash
+
+ promote-release:
+ runs-on: ubuntu-24.04-arm
+ environment: Release
+ needs: [ prepare-build-info ]
+ steps:
+ - name: Promote to next channel
+ uses: kevin-david/promote-play-release@v1.2.0
+ with:
+ service-account-json-raw: ${{ secrets.GOOGLE_PLAY_JSON_KEY }}
+ package-name: 'com.geeksville.mesh'
+ from-track: ${{ inputs.from_channel == 'closed' && 'NewAlpha' || (inputs.from_channel == 'open' && 'beta' || 'internal') }}
+ to-track: ${{ inputs.channel == 'closed' && 'NewAlpha' || (inputs.channel == 'open' && 'beta' || 'production') }}
+ user-fraction: ${{ (inputs.channel == 'production' && '0.1') || (inputs.channel == 'open' && '0.5') || '1.0' }}
+
+ update-github-release:
+ runs-on: ubuntu-24.04-arm
+ needs: [ prepare-build-info, promote-release ]
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v6
+ with:
+ ref: ${{ inputs.commit_sha || inputs.tag_name }}
+ fetch-depth: 0
+ submodules: 'recursive'
+
+ - name: Push Git Tag on Success
+ if: ${{ inputs.commit_sha != '' }}
+ run: |
+ git tag ${{ inputs.final_tag }} ${{ inputs.commit_sha }}
+ git push origin ${{ inputs.final_tag }}
+
+ - name: Update GitHub Release with gh CLI
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ gh release edit ${{ inputs.tag_name }} \
+ --tag ${{ inputs.final_tag }} \
+ --title "${{ inputs.release_name }} (${{ needs.prepare-build-info.outputs.APP_VERSION_CODE }})" \
+ --draft=false \
+ --prerelease=${{ inputs.channel != 'production' }}
+
+ - name: Notify Discord
+ if: ${{ inputs.channel != 'internal' }}
+ env:
+ DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_ANDROID }}
+ VERSION: ${{ inputs.final_tag }}
+ CHANNEL: ${{ inputs.channel }}
+ run: |
+ if [[ -z "$DISCORD_WEBHOOK" ]]; then
+ echo "No Discord webhook provided. Skipping notification."
+ exit 0
+ fi
+
+ # Determine Track Name for Display
+ if [ "$CHANNEL" == "closed" ]; then TRACK="Alpha (Closed)"; fi
+ if [ "$CHANNEL" == "open" ]; then TRACK="Beta (Open)"; fi
+ if [ "$CHANNEL" == "production" ]; then TRACK="Production"; fi
+
+ # Construct JSON Payload
+ PAYLOAD=$(cat <> $GITHUB_ENV
+ else
+ # Use a timestamp-based version for manual/branch builds to avoid collisions
+ # or use the base version + suffix
+ BASE_VERSION=$(grep "VERSION_NAME_BASE" config.properties | cut -d'=' -f2)
+ echo "VERSION_NAME=${BASE_VERSION}${VERSION_SUFFIX}" >> $GITHUB_ENV
+ fi
+
+ - name: Publish to GitHub Packages
+ run: ./gradlew :core:api:publish :core:model:publish :core:proto:publish
+ env:
+ GITHUB_ACTOR: ${{ github.actor }}
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/pull-request-target.yml b/.github/workflows/pull-request-target.yml
new file mode 100644
index 000000000..d37cecf43
--- /dev/null
+++ b/.github/workflows/pull-request-target.yml
@@ -0,0 +1,67 @@
+name: "Pull Request Labeler"
+on:
+ pull_request_target:
+ types: [opened, synchronize]
+# Do not execute arbitrary code on this workflow.
+# See warnings at https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#pull_request_target
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
+ cancel-in-progress: true
+
+jobs:
+ labeler:
+ permissions:
+ contents: read
+ pull-requests: write
+ runs-on: ubuntu-24.04-arm
+ steps:
+ - name: Auto-label PR
+ uses: actions/github-script@v9
+ with:
+ script: |
+ const branch = context.payload.pull_request.head.ref;
+ const labels = new Set();
+
+ // enhancement: branch contains feat
+ if (/feat/i.test(branch)) labels.add('enhancement');
+
+ // bugfix: branch starts with fix or bug
+ if (/^(fix|bug)/i.test(branch)) labels.add('bugfix');
+
+ // refactor: branch starts with refactor
+ if (/^refactor/i.test(branch)) labels.add('refactor');
+
+ // repo: branch contains repo or ci
+ if (/repo|ci/i.test(branch)) {
+ labels.add('repo');
+ } else {
+ // Also label 'repo' if .github files were changed (needs one API call)
+ try {
+ const files = await github.paginate(
+ github.rest.pulls.listFiles,
+ { owner: context.repo.owner, repo: context.repo.repo, pull_number: context.payload.pull_request.number, per_page: 100 },
+ (res) => res.data.map(f => f.filename)
+ );
+ if (files.some(f => f.startsWith('.github/'))) labels.add('repo');
+ } catch (e) {
+ core.warning(`Could not list PR files (rate limited?): ${e.message}`);
+ }
+ }
+
+ if (labels.size > 0) {
+ const labelArray = [...labels];
+ core.info(`Applying labels: ${labelArray.join(', ')}`);
+ try {
+ await github.rest.issues.addLabels({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: context.payload.pull_request.number,
+ labels: labelArray,
+ });
+ } catch (e) {
+ core.warning(`Could not apply labels (rate limited?): ${e.message}`);
+ }
+ } else {
+ core.info('No labels matched for this PR.');
+ }
diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml
new file mode 100644
index 000000000..d450711ce
--- /dev/null
+++ b/.github/workflows/pull-request.yml
@@ -0,0 +1,134 @@
+name: Pull Request CI
+
+on:
+ pull_request:
+ branches: [ main ]
+
+permissions:
+ contents: read
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ # 1. CHANGE DETECTION: Prevents unnecessary builds
+ check-changes:
+ if: github.repository == 'meshtastic/Meshtastic-Android' && !( github.head_ref == 'scheduled-updates' || github.head_ref == 'l10n_main' )
+ runs-on: ubuntu-24.04-arm
+ outputs:
+ android: ${{ steps.filter.outputs.android }}
+ steps:
+ - uses: actions/checkout@v6
+ - uses: dorny/paths-filter@v4
+ id: filter
+ with:
+ token: ''
+ filters: |
+ android:
+ # CI/workflow implementation
+ - '.github/workflows/**'
+ - '.github/actions/**'
+ # Product modules validated by reusable-check
+ - 'app/**'
+ - 'baselineprofile/**'
+ - 'desktop/**'
+ - 'core/**'
+ - 'feature/**'
+ # Shared build infrastructure
+ - 'build-logic/**'
+ - 'config/**'
+ - 'gradle/**'
+ # Root build entrypoints/config that can alter task graph or outputs
+ - 'build.gradle.kts'
+ - 'config.properties'
+ - 'compose_compiler_config.conf'
+ - 'gradle.properties'
+ - 'gradlew'
+ - 'gradlew.bat'
+ - 'settings.gradle.kts'
+ - 'test.gradle.kts'
+
+ # 1b. FILTER DRIFT CHECK: Ensures check-changes stays aligned with module roots
+ verify-check-changes-filter:
+ if: github.repository == 'meshtastic/Meshtastic-Android' && !( github.head_ref == 'scheduled-updates' || github.head_ref == 'l10n_main' )
+ runs-on: ubuntu-24.04-arm
+ steps:
+ - uses: actions/checkout@v6
+ - name: Verify module roots are represented in check-changes filter
+ run: |
+ python3 - <<'PY'
+ import re
+ from pathlib import Path
+
+ settings = Path('settings.gradle.kts').read_text()
+ workflow = Path('.github/workflows/pull-request.yml').read_text()
+
+ module_roots = {
+ module.split(':')[0]
+ for module in re.findall(r'":([^"]+)"', settings)
+ }
+
+ allowed_extra_roots = {'baselineprofile'}
+ expected_roots = module_roots | allowed_extra_roots
+
+ filter_paths = {
+ path.split('/')[0]
+ for path in re.findall(r"-\s*'([^']+/\*\*)'", workflow)
+ }
+
+ actual_module_roots = filter_paths & expected_roots
+
+ missing = sorted(expected_roots - actual_module_roots)
+ unexpected = sorted(actual_module_roots - expected_roots)
+
+ if missing or unexpected:
+ print('check-changes filter drift detected:')
+ if missing:
+ print(' Missing roots:', ', '.join(missing))
+ if unexpected:
+ print(' Unexpected roots:', ', '.join(unexpected))
+ raise SystemExit(1)
+
+ print('check-changes filter is aligned with settings.gradle module roots.')
+ PY
+
+ # 2. VALIDATION & BUILD: Delegate to reusable-check.yml
+ # We disable coverage and desktop builds for PRs to keep feedback fast
+ # (< 10 mins). Desktop compilation is already covered by the :desktop:test
+ # task in the shard-app test shard.
+ validate-and-build:
+ needs: check-changes
+ if: needs.check-changes.outputs.android == 'true'
+ uses: ./.github/workflows/reusable-check.yml
+ with:
+ run_lint: true
+ run_unit_tests: true
+ run_coverage: false
+ run_desktop_builds: false
+ upload_artifacts: true
+ secrets: inherit
+
+ # 3. WORKFLOW STATUS: Ensures required checks are satisfied
+ check-workflow-status:
+ name: Check Workflow Status
+ runs-on: ubuntu-24.04-arm
+ permissions: {}
+ needs: [check-changes, verify-check-changes-filter, validate-and-build]
+ if: always()
+ steps:
+ - name: Check Workflow Status
+ run: |
+ if [[ "${{ needs.verify-check-changes-filter.result }}" == "failure" || "${{ needs.verify-check-changes-filter.result }}" == "cancelled" ]]; then
+ echo "::error::check-changes filter verification failed"
+ exit 1
+ fi
+
+ # If changes were detected but build failed, fail the status check
+ if [[ "${{ needs.check-changes.outputs.android }}" == "true" && ("${{ needs.validate-and-build.result }}" == "failure" || "${{ needs.validate-and-build.result }}" == "cancelled") ]]; then
+ echo "::error::Android Check failed"
+ exit 1
+ fi
+
+ # If no changes were detected, this still succeeds to satisfy required status check
+ echo "Workflow status satisfied."
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index a13207022..40d8e40f3 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,132 +1,353 @@
name: Make Release
+
on:
- workflow_dispatch:
+ workflow_call:
inputs:
- version:
- description: "Release version (Example: 1.0.0, must match app/gradle.build 'versionName')"
+ base_version:
+ description: 'The base version for the release (e.g., 2.3.0)'
required: true
- default: '1.0.0'
+ type: string
+ tag_name:
+ description: 'The tag that triggered the release'
+ required: true
+ type: string
+ commit_sha:
+ description: 'The commit SHA to build and tag'
+ required: false
+ type: string
+ channel:
+ description: 'The channel to create a release for or promote to'
+ required: true
+ type: string
+ build_desktop:
+ description: 'Whether to build the desktop distribution'
+ required: false
+ type: boolean
+ default: false
+ secrets:
+ GSERVICES:
+ required: true
+ KEYSTORE:
+ required: true
+ KEYSTORE_FILENAME:
+ required: true
+ KEYSTORE_PROPERTIES:
+ required: true
+ DATADOG_APPLICATION_ID:
+ required: true
+ DATADOG_CLIENT_TOKEN:
+ required: true
+ GOOGLE_MAPS_API_KEY:
+ required: true
+ GOOGLE_PLAY_JSON_KEY:
+ required: true
+ GRADLE_ENCRYPTION_KEY:
+ required: true
+ GRADLE_CACHE_URL:
+ required: false
+ GRADLE_CACHE_USERNAME:
+ required: false
+ GRADLE_CACHE_PASSWORD:
+ required: false
+ INTERNAL_BUILDS_HOST:
+ required: false
+ INTERNAL_BUILDS_HOST_PAT:
+ required: false
+
+concurrency:
+ group: ${{ github.workflow }}-${{ inputs.tag_name }}
+ cancel-in-progress: true
+
+permissions:
+ contents: write
+ pull-requests: read
+ id-token: write
+ attestations: write
jobs:
- release-build:
- runs-on: ubuntu-latest
+ prepare-build-info:
+ runs-on: ubuntu-24.04-arm
+ outputs:
+ APP_VERSION_NAME: ${{ steps.prep_version.outputs.APP_VERSION_NAME }}
+ APP_VERSION_CODE: ${{ steps.calculate_version_code.outputs.versionCode }}
+ env:
+ GRADLE_CACHE_URL: ${{ secrets.GRADLE_CACHE_URL }}
+ GRADLE_CACHE_USERNAME: ${{ secrets.GRADLE_CACHE_USERNAME }}
+ GRADLE_CACHE_PASSWORD: ${{ secrets.GRADLE_CACHE_PASSWORD }}
steps:
+ - name: Checkout code
+ uses: actions/checkout@v6
+ with:
+ ref: ${{ inputs.tag_name }}
+ fetch-depth: 0
+ submodules: 'recursive'
+ - name: Prep APP_VERSION_NAME
+ id: prep_version
+ env:
+ INPUT_TAG_NAME: ${{ inputs.tag_name }}
+ run: |
+ VERSION_NAME=$(echo $INPUT_TAG_NAME | sed 's/-.*//' | sed 's/v//')
+ echo "APP_VERSION_NAME=$VERSION_NAME" >> $GITHUB_OUTPUT
+ echo "Parsed Version: $VERSION_NAME"
- - name: Checkout code
- uses: actions/checkout@v3
- with:
- submodules: 'recursive'
+ - name: Extract VERSION_CODE_OFFSET from config.properties
+ id: get_version_code_offset
+ run: |
+ OFFSET=$(grep '^VERSION_CODE_OFFSET=' config.properties | cut -d'=' -f2)
+ echo "VERSION_CODE_OFFSET=$OFFSET" >> $GITHUB_OUTPUT
- - name: Load secrets
- run: |
- rm ./app/google-services.json
- echo $GSERVICES > ./app/google-services.json
- echo $KEYSTORE | base64 -di > ./app/$KEYSTORE_FILENAME
- echo "$KEYSTORE_PROPERTIES" > ./keystore.properties
- env:
+ - name: Calculate Version Code from Git Commit Count
+ id: calculate_version_code
+ run: |
+ COMMIT_COUNT=$(git rev-list --count HEAD)
+ OFFSET=${{ steps.get_version_code_offset.outputs.VERSION_CODE_OFFSET }}
+ VERSION_CODE=$((COMMIT_COUNT + OFFSET))
+ echo "versionCode=$VERSION_CODE" >> $GITHUB_OUTPUT
+ shell: bash
+
+ release-google:
+ runs-on: ubuntu-24.04
+ needs: [prepare-build-info]
+ environment: Release
+ env:
+ GRADLE_CACHE_URL: ${{ secrets.GRADLE_CACHE_URL }}
+ GRADLE_CACHE_USERNAME: ${{ secrets.GRADLE_CACHE_USERNAME }}
+ GRADLE_CACHE_PASSWORD: ${{ secrets.GRADLE_CACHE_PASSWORD }}
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v6
+ with:
+ ref: ${{ inputs.tag_name }}
+ fetch-depth: 0
+ submodules: 'recursive'
+
+ - name: Gradle Setup
+ uses: ./.github/actions/gradle-setup
+ with:
+ gradle_encryption_key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
+ cache_read_only: 'false'
+
+ - name: Load secrets
+ env:
GSERVICES: ${{ secrets.GSERVICES }}
KEYSTORE: ${{ secrets.KEYSTORE }}
KEYSTORE_FILENAME: ${{ secrets.KEYSTORE_FILENAME }}
KEYSTORE_PROPERTIES: ${{ secrets.KEYSTORE_PROPERTIES }}
+ DATADOG_APPLICATION_ID: ${{ secrets.DATADOG_APPLICATION_ID }}
+ DATADOG_CLIENT_TOKEN: ${{ secrets.DATADOG_CLIENT_TOKEN }}
+ GOOGLE_MAPS_API_KEY: ${{ secrets.GOOGLE_MAPS_API_KEY }}
+ GOOGLE_PLAY_JSON_KEY: ${{ secrets.GOOGLE_PLAY_JSON_KEY }}
+ run: |
+ rm -f ./app/google-services.json
+ echo $GSERVICES > ./app/google-services.json
+ echo $KEYSTORE | base64 -di > ./app/$KEYSTORE_FILENAME
+ echo "$KEYSTORE_PROPERTIES" > ./keystore.properties
+ echo "datadogApplicationId=$DATADOG_APPLICATION_ID" >> ./secrets.properties
+ echo "datadogClientToken=$DATADOG_CLIENT_TOKEN" >> ./secrets.properties
+ echo "MAPS_API_KEY=$GOOGLE_MAPS_API_KEY" >> ./secrets.properties
+ echo "$GOOGLE_PLAY_JSON_KEY" > ./fastlane/play-store-credentials.json
- - name: Set up JDK 11
- uses: actions/setup-java@v3
- with:
- java-version: '11'
- distribution: 'temurin'
- # Note: we don't use caches on release builds because we don't want to accidentally not have a virgin build machine
+ - name: Setup Fastlane
+ uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: '3.4.9'
+ bundler-cache: true
- - name: Find firmware release tag
- id: firmware_version
- uses: oprypin/find-latest-tag@v1
- with:
- repository: meshtastic/Meshtastic-device
- releases-only: true
- token: ${{ secrets.GITHUB_TOKEN }}
+ - name: Build and Deploy Google Play to Internal Track with Fastlane
+ env:
+ VERSION_NAME: ${{ needs.prepare-build-info.outputs.APP_VERSION_NAME }}
+ VERSION_CODE: ${{ needs.prepare-build-info.outputs.APP_VERSION_CODE }}
+ run: bundle exec fastlane internal
- - name: Create version strings
- run: |
- echo "CUR_FIRMWARE_VERSION=$(echo ${{ steps.firmware_version.outputs.tag }}|sed -e 's/^v//')" >> $GITHUB_ENV
- echo "SHORT_FIRMWARE_VERSION=$(echo ${{ steps.firmware_version.outputs.tag }}|sed -e 's/^v//' -e 's/.\{8\}$//')" >> $GITHUB_ENV
+ - name: List outputs
+ run: ls -R app/build/outputs/
- - name: Create curfirmwareversion.xml
- run: |
- rm ./app/src/main/res/values/curfirmwareversion.xml
- echo -e "\n ${{ env.CUR_FIRMWARE_VERSION }} \n ${{ env.SHORT_FIRMWARE_VERSION }} \n " > ./app/src/main/res/values/curfirmwareversion.xml
+ - name: Upload Google AAB artifact
+ if: always()
+ uses: actions/upload-artifact@v7
+ with:
+ name: google-aab
+ path: app/build/outputs/bundle/googleRelease/app-google-release.aab
+ retention-days: 1
-# - name: Fetch firmware release
-# uses: dsaltares/fetch-gh-release-asset@master
-# with:
-# repo: meshtastic/Meshtastic-device
-# file: firmware-${{ env.CUR_FIRMWARE_VERSION }}.zip
-# version: tags/${{ steps.firmware_version.outputs.tag }}
-# target: firmware.zip
-# token: ${{ secrets.GITHUB_TOKEN }}
+ - name: Upload Google APK artifact
+ if: always()
+ uses: actions/upload-artifact@v7
+ with:
+ name: google-apk
+ path: app/build/outputs/apk/google/release/*.apk
+ retention-days: 1
-# - name: Unzip firmware into assets/firmware
-# run: |
-# rm -rf ./app/src/main/assets/firmware
-# mkdir -p ./app/src/main/assets/firmware
-# unzip -qq ./firmware.zip 'littlefs-*.bin' 'firmware-heltec*.bin' 'firmware-tbeam*.bin' 'firmware-tlora*.bin' 'firmware-nano*.bin' -d ./app/src/main/assets/firmware
-# rm ./firmware.zip
+ - name: Attest Google AAB provenance
+ if: success()
+ uses: actions/attest-build-provenance@v4
+ with:
+ subject-path: app/build/outputs/bundle/googleRelease/app-google-release.aab
- - name: Mock firmware assets for release
- run: |
- rm -rf ./app/src/main/assets/firmware
- mkdir -p ./app/src/main/assets/firmware
+ - name: Attest Google APK provenance
+ if: success()
+ uses: actions/attest-build-provenance@v4
+ with:
+ subject-path: app/build/outputs/apk/google/release/*.apk
- - name: Validate Gradle wrapper
- uses: gradle/wrapper-validation-action@v1
+ release-fdroid:
+ runs-on: ubuntu-24.04
+ needs: [prepare-build-info]
+ environment: Release
+ env:
+ GRADLE_CACHE_URL: ${{ secrets.GRADLE_CACHE_URL }}
+ GRADLE_CACHE_USERNAME: ${{ secrets.GRADLE_CACHE_USERNAME }}
+ GRADLE_CACHE_PASSWORD: ${{ secrets.GRADLE_CACHE_PASSWORD }}
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v6
+ with:
+ ref: ${{ inputs.tag_name }}
+ fetch-depth: 0
+ submodules: 'recursive'
- - name: Gradle bundleRelease
- run: ./gradlew bundleRelease
+ - name: Gradle Setup
+ uses: ./.github/actions/gradle-setup
+ with:
+ gradle_encryption_key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
+ cache_read_only: 'false'
- - name: Gradle assembleRelease
- run: ./gradlew assembleRelease
+ - name: Load secrets
+ env:
+ KEYSTORE: ${{ secrets.KEYSTORE }}
+ KEYSTORE_FILENAME: ${{ secrets.KEYSTORE_FILENAME }}
+ KEYSTORE_PROPERTIES: ${{ secrets.KEYSTORE_PROPERTIES }}
+ run: |
+ echo $KEYSTORE | base64 -di > ./app/$KEYSTORE_FILENAME
+ echo "$KEYSTORE_PROPERTIES" > ./keystore.properties
-# - name: Upload Release to Play Store
-# run: cp ./app/src/main/play/release-notes/en-US/production.txt ./app/src/main/play/release-notes/whatsnew-en-US.txt
-# - uses: r0adkll/upload-google-play@v1
-# with:
-# serviceAccountJsonPlainText: ${{ secrets.GSERVICES }}
-# packageName: com.geeksville.mesh
-# releaseFiles: app/build/outputs/bundle/release/app-release.aab
-# track: internal
-# whatsNewDirectory: app/src/main/play/release-notes
-# mappingFile: app/build/outputs/mapping/release/mapping.txt
+ - name: Setup Fastlane
+ uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: '3.4.9'
+ bundler-cache: true
- - name: Create GitHub release
- uses: actions/create-release@v1
- id: create_release
- with:
- draft: true
- prerelease: true
- release_name: Meshtastic Android ${{ github.event.inputs.version}} alpha
- tag_name: ${{ github.event.inputs.version}}
- body: |
- Autogenerated by github action, developer should edit as required before publishing...
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Build F-Droid with Fastlane
+ env:
+ VERSION_NAME: ${{ needs.prepare-build-info.outputs.APP_VERSION_NAME }}
+ VERSION_CODE: ${{ needs.prepare-build-info.outputs.APP_VERSION_CODE }}
+ run: bundle exec fastlane fdroid_build
- - name: Add AAB to release
- uses: actions/upload-release-asset@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- upload_url: ${{ steps.create_release.outputs.upload_url }}
- asset_path: app/build/outputs/bundle/release/app-release.aab
- asset_name: app-release-${{ github.event.inputs.version}}.aab
- asset_content_type: application/zip
+ - name: List outputs
+ run: ls -R app/build/outputs/
- - name: Add APK to release
- uses: actions/upload-release-asset@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- upload_url: ${{ steps.create_release.outputs.upload_url }}
- asset_path: app/build/outputs/apk/release/app-release.apk
- asset_name: app-release-${{ github.event.inputs.version}}.apk
- asset_content_type: application/zip
+ - name: Upload F-Droid APK artifact
+ if: always()
+ uses: actions/upload-artifact@v7
+ with:
+ name: fdroid-apk
+ path: app/build/outputs/apk/fdroid/release/*.apk
+ retention-days: 1
-# - name: Gradle publishBundle
-# run: ./gradlew publishBundle
+ - name: Attest F-Droid APK provenance
+ if: success()
+ uses: actions/attest-build-provenance@v4
+ with:
+ subject-path: app/build/outputs/apk/fdroid/release/*.apk
+
+ release-desktop:
+ if: ${{ inputs.build_desktop }}
+ runs-on: ${{ matrix.os }}
+ needs: [prepare-build-info]
+ environment: Release
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [macos-latest, windows-latest, ubuntu-24.04, ubuntu-24.04-arm]
+ env:
+ GRADLE_CACHE_URL: ${{ secrets.GRADLE_CACHE_URL }}
+ GRADLE_CACHE_USERNAME: ${{ secrets.GRADLE_CACHE_USERNAME }}
+ GRADLE_CACHE_PASSWORD: ${{ secrets.GRADLE_CACHE_PASSWORD }}
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v6
+ with:
+ ref: ${{ inputs.tag_name }}
+ fetch-depth: 0
+ submodules: 'recursive'
+
+ - name: Gradle Setup
+ uses: ./.github/actions/gradle-setup
+ with:
+ gradle_encryption_key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
+ cache_read_only: 'false'
+
+ - name: Install dependencies for AppImage
+ if: runner.os == 'Linux'
+ run: sudo apt-get update && sudo apt-get install -y libfuse2
+
+ - name: Package Native Distributions
+ env:
+ ORG_GRADLE_PROJECT_appVersionName: ${{ needs.prepare-build-info.outputs.APP_VERSION_NAME }}
+ APPIMAGE_EXTRACT_AND_RUN: 1
+ run: ./gradlew :desktop:packageReleaseDistributionForCurrentOS -PaboutLibraries.release=true --no-daemon
+
+ - name: List Desktop Binaries
+ if: runner.os == 'Linux'
+ run: ls -R desktop/build/compose/binaries/main-release
+
+ - name: Upload Desktop Artifacts
+ if: always()
+ uses: actions/upload-artifact@v7
+ with:
+ name: desktop-${{ runner.os }}-${{ runner.arch }}
+ path: |
+ desktop/build/compose/binaries/main-release/*/*.dmg
+ desktop/build/compose/binaries/main-release/*/*.msi
+ desktop/build/compose/binaries/main-release/*/*.exe
+ desktop/build/compose/binaries/main-release/*/*.deb
+ desktop/build/compose/binaries/main-release/*/*.rpm
+ desktop/build/compose/binaries/main-release/*/*.AppImage
+ retention-days: 1
+ if-no-files-found: ignore
+
+ github-release:
+ if: ${{ !cancelled() && !failure() }}
+ runs-on: ubuntu-24.04-arm
+ needs: [prepare-build-info, release-google, release-fdroid, release-desktop]
+ env:
+ INTERNAL_BUILDS_HOST: ${{ secrets.INTERNAL_BUILDS_HOST }}
+ permissions:
+ contents: write
+ id-token: write
+ attestations: write
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v6
+ with:
+ ref: ${{ inputs.tag_name }}
+
+ - name: Download all artifacts
+ uses: actions/download-artifact@v8
+ with:
+ path: ./artifacts
+
+ - name: Create or Update GitHub Release
+ uses: softprops/action-gh-release@v3
+ with:
+ tag_name: ${{ inputs.tag_name }}
+ target_commitish: ${{ inputs.commit_sha || github.sha }}
+ name: ${{ inputs.tag_name }} (${{ needs.prepare-build-info.outputs.APP_VERSION_CODE }})
+ generate_release_notes: true
+ files: ./artifacts/**/*
+ draft: true
+ prerelease: true
+
+ - name: Create or Update internal GitHub Release
+ continue-on-error: true
+ if: ${{ env.INTERNAL_BUILDS_HOST != '' }}
+ uses: softprops/action-gh-release@v3
+ with:
+ repository: ${{ secrets.INTERNAL_BUILDS_HOST }}
+ token: ${{ secrets.INTERNAL_BUILDS_HOST_PAT }}
+ tag_name: ${{ inputs.tag_name }}
+ name: ${{ inputs.tag_name }} (${{ needs.prepare-build-info.outputs.APP_VERSION_CODE }})
+ generate_release_notes: false
+ files: ./artifacts/**/*
+ draft: false
+ prerelease: true
\ No newline at end of file
diff --git a/.github/workflows/reusable-check.yml b/.github/workflows/reusable-check.yml
new file mode 100644
index 000000000..632bf1ea4
--- /dev/null
+++ b/.github/workflows/reusable-check.yml
@@ -0,0 +1,315 @@
+name: Reusable Android Check
+
+on:
+ workflow_call:
+ inputs:
+ run_lint:
+ type: boolean
+ default: true
+ run_unit_tests:
+ type: boolean
+ default: true
+ run_coverage:
+ type: boolean
+ default: true
+ run_desktop_builds:
+ type: boolean
+ default: true
+ upload_artifacts:
+ type: boolean
+ default: true
+ secrets:
+ GRADLE_ENCRYPTION_KEY:
+ required: false
+ CODECOV_TOKEN:
+ required: false
+ DATADOG_APPLICATION_ID:
+ required: false
+ DATADOG_CLIENT_TOKEN:
+ required: false
+ GOOGLE_MAPS_API_KEY:
+ required: false
+ GRADLE_CACHE_URL:
+ required: false
+ GRADLE_CACHE_USERNAME:
+ required: false
+ GRADLE_CACHE_PASSWORD:
+ required: false
+
+env:
+ DATADOG_APPLICATION_ID: ${{ secrets.DATADOG_APPLICATION_ID }}
+ DATADOG_CLIENT_TOKEN: ${{ secrets.DATADOG_CLIENT_TOKEN }}
+ MAPS_API_KEY: ${{ secrets.GOOGLE_MAPS_API_KEY }}
+ GITHUB_TOKEN: ${{ github.token }}
+ GRADLE_CACHE_URL: ${{ secrets.GRADLE_CACHE_URL }}
+ GRADLE_CACHE_USERNAME: ${{ secrets.GRADLE_CACHE_USERNAME }}
+ GRADLE_CACHE_PASSWORD: ${{ secrets.GRADLE_CACHE_PASSWORD }}
+ # Fallback VERSION_CODE for the lint-check job itself (which computes the real
+ # value from git). Downstream jobs override this with the git-derived value.
+ VERSION_CODE: ${{ github.run_number }}
+
+jobs:
+ # ── Lint & Static Analysis ──────────────────────────────────────────
+ lint-check:
+ runs-on: ubuntu-24.04
+ permissions:
+ contents: read
+ timeout-minutes: 30
+ outputs:
+ cache_read_only: ${{ steps.cache_config.outputs.cache_read_only }}
+ version_code: ${{ steps.version_code.outputs.version_code }}
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v6
+ with:
+ fetch-depth: 0
+ filter: 'blob:none'
+ submodules: true
+
+ - name: Determine cache read-only setting
+ id: cache_config
+ shell: bash
+ run: |
+ if [[ "${{ github.ref }}" == "refs/heads/main" ]] || [[ "${{ github.event_name }}" == "merge_group" ]] || [[ "${{ github.ref }}" == gh-readonly-queue/* ]]; then
+ echo "cache_read_only=false" >> "$GITHUB_OUTPUT"
+ else
+ echo "cache_read_only=true" >> "$GITHUB_OUTPUT"
+ fi
+
+ - name: Calculate version code from git commit count
+ id: version_code
+ shell: bash
+ run: |
+ COMMIT_COUNT=$(git rev-list --count HEAD)
+ OFFSET=$(grep '^VERSION_CODE_OFFSET=' config.properties | cut -d'=' -f2 || echo 0)
+ VERSION_CODE=$((COMMIT_COUNT + OFFSET))
+ echo "version_code=$VERSION_CODE" >> "$GITHUB_OUTPUT"
+
+ - name: Gradle Setup
+ uses: ./.github/actions/gradle-setup
+ with:
+ gradle_encryption_key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
+ cache_read_only: ${{ steps.cache_config.outputs.cache_read_only }}
+
+ - name: Lint, Analysis & KMP Smoke Compile
+ if: inputs.run_lint == true
+ run: ./gradlew spotlessCheck detekt app:lintFdroidDebug app:lintGoogleDebug core:barcode:lintFdroidDebug core:barcode:lintGoogleDebug core:api:lintDebug kmpSmokeCompile -Pci=true --continue --scan
+
+ - name: KMP Smoke Compile (lint skipped)
+ if: inputs.run_lint == false
+ run: ./gradlew kmpSmokeCompile -Pci=true --continue --scan
+
+ # ── Sharded Unit Tests ──────────────────────────────────────────────
+ # Tests are split into 3 shards that run in parallel:
+ # shard-core: core:* KMP module tests (allTests)
+ # shard-feature: feature:* KMP module tests (allTests)
+ # shard-app: Pure-Android/JVM tests (app, desktop, core:barcode, etc.)
+ test-shards:
+ runs-on: ubuntu-24.04
+ permissions:
+ contents: read
+ timeout-minutes: 45
+ needs: lint-check
+ if: inputs.run_unit_tests == true
+ env:
+ VERSION_CODE: ${{ needs.lint-check.outputs.version_code }}
+ strategy:
+ fail-fast: false
+ matrix:
+ shard:
+ - name: shard-core
+ tasks: >-
+ :core:ble:allTests
+ :core:common:allTests
+ :core:data:allTests
+ :core:database:allTests
+ :core:domain:allTests
+ :core:model:allTests
+ :core:navigation:allTests
+ :core:network:allTests
+ :core:prefs:allTests
+ :core:repository:allTests
+ :core:service:allTests
+ :core:takserver:allTests
+ :core:testing:allTests
+ :core:ui:allTests
+ kover: >-
+ :core:ble:koverXmlReport
+ :core:common:koverXmlReport
+ :core:data:koverXmlReport
+ :core:database:koverXmlReport
+ :core:domain:koverXmlReport
+ :core:model:koverXmlReport
+ :core:navigation:koverXmlReport
+ :core:network:koverXmlReport
+ :core:prefs:koverXmlReport
+ :core:repository:koverXmlReport
+ :core:service:koverXmlReport
+ :core:takserver:koverXmlReport
+ :core:testing:koverXmlReport
+ :core:ui:koverXmlReport
+ - name: shard-feature
+ tasks: >-
+ :feature:connections:allTests
+ :feature:firmware:allTests
+ :feature:intro:allTests
+ :feature:map:allTests
+ :feature:messaging:allTests
+ :feature:node:allTests
+ :feature:settings:allTests
+ kover: >-
+ :feature:connections:koverXmlReport
+ :feature:firmware:koverXmlReport
+ :feature:intro:koverXmlReport
+ :feature:map:koverXmlReport
+ :feature:messaging:koverXmlReport
+ :feature:node:koverXmlReport
+ :feature:settings:koverXmlReport
+ - name: shard-app
+ tasks: >-
+ :app:testFdroidDebugUnitTest
+ :app:testGoogleDebugUnitTest
+ :desktop:test
+ :core:barcode:testFdroidDebugUnitTest
+ :core:barcode:testGoogleDebugUnitTest
+ kover: >-
+ :app:koverXmlReportFdroidDebug
+ :app:koverXmlReportGoogleDebug
+ :core:barcode:koverXmlReportFdroidDebug
+ :core:barcode:koverXmlReportGoogleDebug
+ :desktop:koverXmlReport
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v6
+ with:
+ fetch-depth: 1
+ submodules: true
+
+ - name: Gradle Setup
+ uses: ./.github/actions/gradle-setup
+ with:
+ gradle_encryption_key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
+ cache_read_only: ${{ needs.lint-check.outputs.cache_read_only }}
+
+ - name: Run Tests & Coverage (${{ matrix.shard.name }})
+ run: |
+ kover_tasks=""
+ if [[ "${{ inputs.run_coverage }}" == "true" ]]; then
+ kover_tasks="${{ matrix.shard.kover }}"
+ fi
+ ./gradlew ${{ matrix.shard.tasks }} $kover_tasks -Pci=true --continue --scan
+
+ - name: Upload test results to Codecov
+ if: ${{ !cancelled() }}
+ uses: codecov/codecov-action@v6
+ with:
+ token: ${{ secrets.CODECOV_TOKEN }}
+ slug: meshtastic/Meshtastic-Android
+ flags: ${{ matrix.shard.name }}
+ fail_ci_if_error: false
+ report_type: test_results
+ files: "**/build/test-results/**/*.xml"
+
+ - name: Upload coverage to Codecov
+ if: ${{ !cancelled() && inputs.run_coverage }}
+ uses: codecov/codecov-action@v6
+ with:
+ token: ${{ secrets.CODECOV_TOKEN }}
+ slug: meshtastic/Meshtastic-Android
+ flags: ${{ matrix.shard.name }}
+ fail_ci_if_error: false
+ files: "**/build/reports/kover/report*.xml"
+
+ - name: Upload shard reports
+ if: ${{ always() && inputs.upload_artifacts }}
+ uses: actions/upload-artifact@v7
+ with:
+ name: reports-${{ matrix.shard.name }}
+ path: |
+ **/build/reports
+ **/build/test-results
+ retention-days: 7
+
+ # ── Android Build ────────────────────────────────────────────────────
+ android-check:
+ runs-on: ubuntu-24.04
+ permissions:
+ contents: read
+ timeout-minutes: 60
+ needs: lint-check
+ env:
+ VERSION_CODE: ${{ needs.lint-check.outputs.version_code }}
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v6
+ with:
+ fetch-depth: 1
+ submodules: true
+
+ - name: Gradle Setup
+ uses: ./.github/actions/gradle-setup
+ with:
+ gradle_encryption_key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
+ cache_read_only: ${{ needs.lint-check.outputs.cache_read_only }}
+
+ - name: Build Android APKs
+ run: ./gradlew app:assembleFdroidDebug app:assembleGoogleDebug -Pci=true --parallel --configuration-cache --continue --scan
+
+ - name: Upload debug artifact
+ if: ${{ inputs.upload_artifacts }}
+ uses: actions/upload-artifact@v7
+ with:
+ name: app-debug-apks
+ path: app/build/outputs/apk/*/debug/*.apk
+ retention-days: 7
+
+ - name: Report App Size
+ if: always()
+ run: |
+ echo "### App Size Report" >> $GITHUB_STEP_SUMMARY
+ echo "| Artifact | Size |" >> $GITHUB_STEP_SUMMARY
+ echo "| --- | --- |" >> $GITHUB_STEP_SUMMARY
+ find app/build/outputs/apk -name "*.apk" -exec du -h {} + | awk '{print "| " $2 " | " $1 " |"}' >> $GITHUB_STEP_SUMMARY
+
+ # ── Desktop Build ───────────────────────────────────────────────────
+ build-desktop:
+ name: Build Desktop Debug (${{ matrix.os }})
+ if: inputs.run_desktop_builds == true
+ runs-on: ${{ matrix.os }}
+ permissions:
+ contents: read
+ timeout-minutes: 60
+ needs: lint-check
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [macos-latest, windows-latest, ubuntu-24.04, ubuntu-24.04-arm]
+ env:
+ VERSION_CODE: ${{ needs.lint-check.outputs.version_code }}
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v6
+ with:
+ fetch-depth: 1
+ submodules: true
+
+ - name: Gradle Setup
+ uses: ./.github/actions/gradle-setup
+ with:
+ gradle_encryption_key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
+ cache_read_only: ${{ needs.lint-check.outputs.cache_read_only }}
+
+ - name: Build Desktop
+ run: ./gradlew :desktop:createDistributable -Pci=true --scan
+
+ - name: Upload Desktop artifact
+ if: ${{ inputs.upload_artifacts }}
+ uses: actions/upload-artifact@v7
+ with:
+ name: desktop-app-${{ runner.os }}-${{ runner.arch }}
+ path: desktop/build/compose/binaries/main/app/
+ retention-days: 7
diff --git a/.github/workflows/scheduled-updates.yml b/.github/workflows/scheduled-updates.yml
new file mode 100644
index 000000000..2399d1f88
--- /dev/null
+++ b/.github/workflows/scheduled-updates.yml
@@ -0,0 +1,145 @@
+name: Scheduled Updates (Firmware, Hardware, Translations)
+
+on:
+ schedule:
+ - cron: '0 */4 * * *' # Run every 4 hours (was hourly — reduced to cut cascade CI cost)
+ workflow_dispatch: # Allow manual triggering
+
+jobs:
+ update_assets:
+ runs-on: ubuntu-24.04
+ if: github.repository == 'meshtastic/Meshtastic-Android'
+ permissions:
+ contents: write # To commit files and push branches
+ pull-requests: write # To create pull requests
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v6
+ with:
+ token: ${{ secrets.CROWDIN_GITHUB_TOKEN }}
+
+ - name: Update firmware releases list
+ run: |
+ firmware_file_path="app/src/main/assets/firmware_releases.json"
+ temp_firmware_file="/tmp/new_firmware_releases.json"
+
+ echo "Fetching latest firmware releases..."
+ curl -s --fail https://api.meshtastic.org/github/firmware/list > "$temp_firmware_file"
+
+ if ! jq empty "$temp_firmware_file" 2>/dev/null; then
+ echo "::error::Firmware API returned invalid JSON data. Skipping firmware update."
+ else
+ if [ ! -f "$firmware_file_path" ] || ! jq --sort-keys . "$temp_firmware_file" | diff -q - <(jq --sort-keys . "$firmware_file_path"); then
+ echo "Changes detected in firmware list or local file missing. Updating $firmware_file_path."
+ cp "$temp_firmware_file" "$firmware_file_path"
+ else
+ echo "No changes detected in firmware list."
+ fi
+ fi
+
+ - name: Update hardware list
+ run: |
+ hardware_file_path="app/src/main/assets/device_hardware.json"
+ temp_hardware_file="/tmp/new_device_hardware.json"
+
+ echo "Fetching latest device hardware data..."
+ curl -s --fail https://api.meshtastic.org/resource/deviceHardware > "$temp_hardware_file"
+
+ if ! jq empty "$temp_hardware_file" 2>/dev/null; then
+ echo "::error::Hardware API returned invalid JSON data. Skipping hardware update."
+ else
+ if [ ! -f "$hardware_file_path" ] || ! jq --sort-keys . "$temp_hardware_file" | diff -q - <(jq --sort-keys . "$hardware_file_path"); then
+ echo "Changes detected in hardware list or local file missing. Updating $hardware_file_path."
+ cp "$temp_hardware_file" "$hardware_file_path"
+ else
+ echo "No changes detected in hardware list."
+ fi
+ fi
+
+ - name: Sync with Crowdin
+ uses: crowdin/github-action@v2
+ with:
+ base_url: 'https://meshtastic.crowdin.com/api/v2'
+ config: 'crowdin.yml'
+ crowdin_branch_name: 'main'
+ upload_sources: true
+ upload_sources_args: '--preserve-hierarchy'
+ upload_translations: false
+ download_translations: true
+ download_translations_args: '--preserve-hierarchy'
+ create_pull_request: false
+ commit_message: 'chore(l10n): New Crowdin Translations from scheduled update'
+ push_translations: false
+ push_sources: false
+ localization_branch_name: ${{ github.ref_name }}
+ env:
+ GITHUB_TOKEN: ${{ secrets.CROWDIN_GITHUB_TOKEN }}
+ CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
+ CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
+
+ - name: Fix file permissions
+ run: sudo chown -R $USER:$USER .
+
+ - name: Gradle Setup
+ uses: ./.github/actions/gradle-setup
+ with:
+ gradle_encryption_key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
+ cache_read_only: 'false'
+
+ - name: Update Graphs
+ run: ./gradlew graphUpdate
+ continue-on-error: true
+
+ - name: Create Pull Request if changes occurred
+ uses: peter-evans/create-pull-request@v8
+ with:
+ token: ${{ secrets.CROWDIN_GITHUB_TOKEN }}
+ commit-message: |
+ chore: Scheduled updates (Firmware, Hardware, Translations, Graphs)
+
+ Automated updates for:
+ - Firmware releases list
+ - Device hardware list
+ - Crowdin source string uploads
+ - Crowdin translation downloads
+ - Module dependency graphs
+ title: 'chore: Scheduled updates (Firmware, Hardware, Translations, Graphs)'
+ body: |
+ This PR includes automated updates from the scheduled workflow:
+
+ - Updated `firmware_releases.json` from the Meshtastic API (if changed).
+ - Updated `device_hardware.json` from the Meshtastic API (if changed).
+ - Source strings were uploaded to Crowdin.
+ - Latest translations were downloaded from Crowdin (if available).
+ - Updated module dependency graphs in README.md files (if changed).
+
+ Please review the changes.
+ branch: 'scheduled-updates'
+ base: 'main'
+ delete-branch: true
+ add-paths: |
+ app/src/main/assets/firmware_releases.json
+ app/src/main/assets/device_hardware.json
+ fastlane/metadata/android/**
+ **/strings.xml
+ **/README.md
+ labels: |
+ automation
+ l10n
+ firmware
+ hardware
+
+ check-workflow-status:
+ name: Check Workflow Status
+ runs-on: ubuntu-24.04-arm
+ permissions: {}
+ needs:
+ - update_assets
+ if: always()
+ steps:
+ - name: Check Workflow Status
+ if: "contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')"
+ run: |
+ echo "One of the dependent jobs failed or was cancelled. Failing the workflow."
+ exit 1
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
new file mode 100644
index 000000000..f1ae45660
--- /dev/null
+++ b/.github/workflows/stale.yml
@@ -0,0 +1,26 @@
+name: Close Stale Issues
+on:
+ schedule:
+ - cron: 0 6 * * *
+ workflow_dispatch: {}
+
+permissions:
+ issues: write
+ pull-requests: write
+ actions: write
+
+jobs:
+ stale_issues:
+ name: Close Stale Issues
+ runs-on: ubuntu-24.04-arm
+ if: github.repository == 'meshtastic/Meshtastic-Android'
+
+ steps:
+ - name: Stale PR+Issues
+ uses: actions/stale@v10.2.0
+ with:
+ days-before-stale: 30
+ stale-issue-message: This issue has not had any comment or update in the last 30 days. If it is still relevant, please post update comments. If no comments are made, this issue will be closed in 7 days.
+ exempt-issue-labels: 'has sponsor,needs sponsor,help wanted,backlog,security issue,l10n,dependencies'
+ exempt-pr-labels: 'has sponsor,needs sponsor,help wanted,backlog,security issue,l10n,dependencies'
+ operations-per-run: 100
diff --git a/.gitignore b/.gitignore
index a66408bdd..447d8a28e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,17 +3,21 @@
!/.idea/codeStyles
!/.idea/dictionaries/
!/.idea/runConfigurations/
+!/.idea/icon.svg
*.iws
*.iml
.gradle
/local.properties
.DS_Store
-/build
+**/build/**
/captures
.externalNativeBuild
.cxx
/app/release
+/buildSrc/build
+**/debug/**
+**/release/**
# Java KeyStore certificates
*.jks
@@ -21,3 +25,34 @@ keystore.properties
# AGP profiling traces
*.trace
+
+# Kotlin compiler
+.kotlin
+
+# VS code
+.vscode/settings.json
+
+# Secrets
+/secrets.properties
+/fastlane/play-store-credentials.json
+**/google-services.json
+
+# Generated library definitions
+**/src/main/resources/aboutlibraries.json
+
+/fastlane/report.xml
+
+/build-logic/convention/build/*
+/build-logic/build/
+
+# Personal build scripts
+build-and-install-android.sh
+wireless-install.sh
+
+# Git worktrees
+.worktrees/
+/firebase-debug.log.jdk/
+firebase-debug.log
+.agent_plans/
+.agent_refs/
+.agent_artifacts/
diff --git a/.gitmodules b/.gitmodules
index 5b0a38e1e..e115fe990 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,6 +1,3 @@
-[submodule "app/src/main/proto"]
- path = app/src/main/proto
+[submodule "app proto submodule"]
+ path = core/proto/src/main/proto
url = https://github.com/meshtastic/protobufs.git
-[submodule "design"]
- path = design
- url = https://github.com/meshtastic/design.git
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index f69257a71..5f6f66925 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -1,5 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/icon.svg b/.idea/icon.svg
new file mode 100644
index 000000000..e6863f6a6
--- /dev/null
+++ b/.idea/icon.svg
@@ -0,0 +1,16 @@
+
+
+
+Created with Fabric.js 4.6.0
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
deleted file mode 100644
index 8a10375bd..000000000
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.jdk b/.jdk
new file mode 120000
index 000000000..096e1a9e3
--- /dev/null
+++ b/.jdk
@@ -0,0 +1 @@
+/home/james/.jdks/ms-17.0.18
\ No newline at end of file
diff --git a/.pr5167.diff b/.pr5167.diff
new file mode 100644
index 000000000..d0a809449
--- /dev/null
+++ b/.pr5167.diff
@@ -0,0 +1,295 @@
+diff --git a/core/common/src/commonMain/kotlin/org/meshtastic/core/common/di/ApplicationCoroutineScope.kt b/core/common/src/commonMain/kotlin/org/meshtastic/core/common/di/ApplicationCoroutineScope.kt
+new file mode 100644
+index 0000000000..2a27b96906
+--- /dev/null
++++ b/core/common/src/commonMain/kotlin/org/meshtastic/core/common/di/ApplicationCoroutineScope.kt
+@@ -0,0 +1,39 @@
++/*
++ * Copyright (c) 2026 Meshtastic LLC
++ *
++ * This program is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation, either version 3 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program. If not, see .
++ */
++package org.meshtastic.core.common.di
++
++import kotlinx.coroutines.CoroutineScope
++import kotlinx.coroutines.SupervisorJob
++import org.koin.core.annotation.Single
++import org.meshtastic.core.common.util.ioDispatcher
++
++/**
++ * A process-wide [CoroutineScope] that outlives individual ViewModels and UI components.
++ *
++ * Use this scope for fire-and-forget cleanup work that must continue after a ViewModel's own scope has been cancelled
++ * (for example, deleting temporary files in `onCleared()`). Backed by a [SupervisorJob] so failures in one child do not
++ * cancel siblings, and by [ioDispatcher] so work runs off the main thread.
++ *
++ * Prefer scoping work to a more specific scope (like `viewModelScope`) whenever possible; this scope is an escape hatch
++ * and should be used sparingly.
++ */
++interface ApplicationCoroutineScope : CoroutineScope
++
++@Single(binds = [ApplicationCoroutineScope::class])
++internal class ApplicationCoroutineScopeImpl : ApplicationCoroutineScope {
++ override val coroutineContext = SupervisorJob() + ioDispatcher
++}
+diff --git a/core/ui/src/androidMain/kotlin/org/meshtastic/core/ui/util/PlatformUtils.kt b/core/ui/src/androidMain/kotlin/org/meshtastic/core/ui/util/PlatformUtils.kt
+index 231c84d401..5365ab95e2 100644
+--- a/core/ui/src/androidMain/kotlin/org/meshtastic/core/ui/util/PlatformUtils.kt
++++ b/core/ui/src/androidMain/kotlin/org/meshtastic/core/ui/util/PlatformUtils.kt
+@@ -37,12 +37,12 @@ import androidx.lifecycle.compose.LifecycleEventEffect
+ import co.touchlab.kermit.Logger
+ import com.eygraber.uri.toAndroidUri
+ import com.eygraber.uri.toKmpUri
+-import kotlinx.coroutines.Dispatchers
+ import kotlinx.coroutines.withContext
+ import org.jetbrains.compose.resources.StringResource
+ import org.jetbrains.compose.resources.getString
+ import org.meshtastic.core.common.gpsDisabled
+ import org.meshtastic.core.common.util.CommonUri
++import org.meshtastic.core.common.util.ioDispatcher
+ import java.net.URLEncoder
+
+ @Composable
+@@ -146,7 +146,7 @@ actual fun rememberReadTextFromUri(): suspend (uri: CommonUri, maxChars: Int) ->
+ val context = LocalContext.current
+ return remember(context) {
+ { uri, maxChars ->
+- withContext(Dispatchers.IO) {
++ withContext(ioDispatcher) {
+ @Suppress("TooGenericExceptionCaught")
+ try {
+ val androidUri = uri.toAndroidUri()
+diff --git a/core/ui/src/jvmMain/kotlin/org/meshtastic/core/ui/util/PlatformUtils.kt b/core/ui/src/jvmMain/kotlin/org/meshtastic/core/ui/util/PlatformUtils.kt
+index 031e1fe35d..a938f92ea6 100644
+--- a/core/ui/src/jvmMain/kotlin/org/meshtastic/core/ui/util/PlatformUtils.kt
++++ b/core/ui/src/jvmMain/kotlin/org/meshtastic/core/ui/util/PlatformUtils.kt
+@@ -20,10 +20,10 @@ package org.meshtastic.core.ui.util
+
+ import androidx.compose.runtime.Composable
+ import co.touchlab.kermit.Logger
+-import kotlinx.coroutines.Dispatchers
+ import kotlinx.coroutines.withContext
+ import org.jetbrains.compose.resources.StringResource
+ import org.meshtastic.core.common.util.CommonUri
++import org.meshtastic.core.common.util.ioDispatcher
+ import java.awt.Desktop
+ import java.awt.FileDialog
+ import java.awt.Frame
+@@ -89,7 +89,7 @@ actual fun rememberOpenFileLauncher(onUriReceived: (CommonUri?) -> Unit): (mimeT
+ /** JVM — Reads text from a file URI. */
+ @Composable
+ actual fun rememberReadTextFromUri(): suspend (uri: CommonUri, maxChars: Int) -> String? = { uri, maxChars ->
+- withContext(Dispatchers.IO) {
++ withContext(ioDispatcher) {
+ @Suppress("TooGenericExceptionCaught")
+ try {
+ val file = File(URI(uri.toString()))
+diff --git a/feature/firmware/src/commonMain/kotlin/org/meshtastic/feature/firmware/FirmwareUpdateViewModel.kt b/feature/firmware/src/commonMain/kotlin/org/meshtastic/feature/firmware/FirmwareUpdateViewModel.kt
+index dc1c459716..f8ff9fcac8 100644
+--- a/feature/firmware/src/commonMain/kotlin/org/meshtastic/feature/firmware/FirmwareUpdateViewModel.kt
++++ b/feature/firmware/src/commonMain/kotlin/org/meshtastic/feature/firmware/FirmwareUpdateViewModel.kt
+@@ -35,6 +35,7 @@ import kotlinx.coroutines.launch
+ import kotlinx.coroutines.withTimeoutOrNull
+ import org.jetbrains.compose.resources.StringResource
+ import org.koin.core.annotation.KoinViewModel
++import org.meshtastic.core.common.di.ApplicationCoroutineScope
+ import org.meshtastic.core.common.util.CommonUri
+ import org.meshtastic.core.common.util.safeCatching
+ import org.meshtastic.core.database.entity.FirmwareRelease
+@@ -91,6 +92,7 @@ class FirmwareUpdateViewModel(
+ private val firmwareUpdateManager: FirmwareUpdateManager,
+ private val usbManager: FirmwareUsbManager,
+ private val fileHandler: FirmwareFileHandler,
++ private val applicationScope: ApplicationCoroutineScope,
+ ) : ViewModel() {
+
+ private val _state = MutableStateFlow(FirmwareUpdateState.Idle)
+@@ -124,12 +126,10 @@ class FirmwareUpdateViewModel(
+
+ override fun onCleared() {
+ super.onCleared()
+- // viewModelScope is already cancelled when onCleared() runs, so launch cleanup in a
+- // standalone scope. SupervisorJob prevents the coroutine from propagating failures to a
+- // shared parent, and NonCancellable on the launch keeps cleanup running even if the scope
+- // is cancelled concurrently.
+- @OptIn(kotlinx.coroutines.DelicateCoroutinesApi::class)
+- kotlinx.coroutines.GlobalScope.launch(NonCancellable) {
++ // viewModelScope is already cancelled when onCleared() runs, so launch cleanup on the
++ // application-wide scope (SupervisorJob + ioDispatcher). NonCancellable keeps cleanup
++ // running even if something tries to cancel it mid-flight.
++ applicationScope.launch(NonCancellable) {
+ tempFirmwareFile = cleanupTemporaryFiles(fileHandler, tempFirmwareFile)
+ }
+ }
+diff --git a/feature/firmware/src/commonTest/kotlin/org/meshtastic/feature/firmware/FirmwareUpdateIntegrationTest.kt b/feature/firmware/src/commonTest/kotlin/org/meshtastic/feature/firmware/FirmwareUpdateIntegrationTest.kt
+index 4c48a1ced5..030d84effd 100644
+--- a/feature/firmware/src/commonTest/kotlin/org/meshtastic/feature/firmware/FirmwareUpdateIntegrationTest.kt
++++ b/feature/firmware/src/commonTest/kotlin/org/meshtastic/feature/firmware/FirmwareUpdateIntegrationTest.kt
+@@ -108,6 +108,7 @@ class FirmwareUpdateIntegrationTest {
+ firmwareUpdateManager,
+ usbManager,
+ fileHandler,
++ TestApplicationCoroutineScope(testDispatcher),
+ )
+
+ @Test
+diff --git a/feature/firmware/src/commonTest/kotlin/org/meshtastic/feature/firmware/FirmwareUpdateViewModelTest.kt b/feature/firmware/src/commonTest/kotlin/org/meshtastic/feature/firmware/FirmwareUpdateViewModelTest.kt
+index 7032ed4088..a8eddff838 100644
+--- a/feature/firmware/src/commonTest/kotlin/org/meshtastic/feature/firmware/FirmwareUpdateViewModelTest.kt
++++ b/feature/firmware/src/commonTest/kotlin/org/meshtastic/feature/firmware/FirmwareUpdateViewModelTest.kt
+@@ -124,6 +124,7 @@ class FirmwareUpdateViewModelTest {
+ firmwareUpdateManager,
+ usbManager,
+ fileHandler,
++ TestApplicationCoroutineScope(testDispatcher),
+ )
+
+ @Test
+diff --git a/feature/firmware/src/commonTest/kotlin/org/meshtastic/feature/firmware/TestApplicationCoroutineScope.kt b/feature/firmware/src/commonTest/kotlin/org/meshtastic/feature/firmware/TestApplicationCoroutineScope.kt
+new file mode 100644
+index 0000000000..3ef5c44ef4
+--- /dev/null
++++ b/feature/firmware/src/commonTest/kotlin/org/meshtastic/feature/firmware/TestApplicationCoroutineScope.kt
+@@ -0,0 +1,26 @@
++/*
++ * Copyright (c) 2026 Meshtastic LLC
++ *
++ * This program is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation, either version 3 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program. If not, see .
++ */
++package org.meshtastic.feature.firmware
++
++import kotlinx.coroutines.CoroutineDispatcher
++import kotlinx.coroutines.CoroutineScope
++import kotlinx.coroutines.SupervisorJob
++import org.meshtastic.core.common.di.ApplicationCoroutineScope
++
++internal class TestApplicationCoroutineScope(dispatcher: CoroutineDispatcher) :
++ ApplicationCoroutineScope,
++ CoroutineScope by CoroutineScope(SupervisorJob() + dispatcher)
+diff --git a/feature/firmware/src/jvmTest/kotlin/org/meshtastic/feature/firmware/FirmwareUpdateViewModelFileTest.kt b/feature/firmware/src/jvmTest/kotlin/org/meshtastic/feature/firmware/FirmwareUpdateViewModelFileTest.kt
+index acb1545bdd..23a0d03ab2 100644
+--- a/feature/firmware/src/jvmTest/kotlin/org/meshtastic/feature/firmware/FirmwareUpdateViewModelFileTest.kt
++++ b/feature/firmware/src/jvmTest/kotlin/org/meshtastic/feature/firmware/FirmwareUpdateViewModelFileTest.kt
+@@ -116,6 +116,7 @@ class FirmwareUpdateViewModelFileTest {
+ firmwareUpdateManager,
+ usbManager,
+ fileHandler,
++ TestApplicationCoroutineScope(testDispatcher),
+ )
+
+ // -----------------------------------------------------------------------
+diff --git a/feature/settings/src/androidMain/kotlin/org/meshtastic/feature/settings/debugging/LogExporter.kt b/feature/settings/src/androidMain/kotlin/org/meshtastic/feature/settings/debugging/LogExporter.kt
+index c251b4d5ef..315ad1da85 100644
+--- a/feature/settings/src/androidMain/kotlin/org/meshtastic/feature/settings/debugging/LogExporter.kt
++++ b/feature/settings/src/androidMain/kotlin/org/meshtastic/feature/settings/debugging/LogExporter.kt
+@@ -27,6 +27,7 @@ import co.touchlab.kermit.Logger
+ import kotlinx.coroutines.Dispatchers
+ import kotlinx.coroutines.launch
+ import kotlinx.coroutines.withContext
++import org.meshtastic.core.common.util.ioDispatcher
+ import org.meshtastic.core.resources.Res
+ import org.meshtastic.core.resources.debug_export_failed
+ import org.meshtastic.core.resources.debug_export_success
+@@ -48,7 +49,7 @@ actual fun rememberLogExporter(logsProvider: suspend () -> List) =
+- withContext(Dispatchers.IO) {
++ withContext(ioDispatcher) {
+ try {
+ if (logs.isEmpty()) {
+ withContext(Dispatchers.Main) { context.showToast(Res.string.debug_export_failed, "No logs to export") }
+diff --git a/feature/settings/src/androidMain/kotlin/org/meshtastic/feature/settings/tak/PrefExporter.kt b/feature/settings/src/androidMain/kotlin/org/meshtastic/feature/settings/tak/PrefExporter.kt
+index 9afde85e5f..a28a576788 100644
+--- a/feature/settings/src/androidMain/kotlin/org/meshtastic/feature/settings/tak/PrefExporter.kt
++++ b/feature/settings/src/androidMain/kotlin/org/meshtastic/feature/settings/tak/PrefExporter.kt
+@@ -24,9 +24,9 @@ import androidx.compose.runtime.Composable
+ import androidx.compose.runtime.rememberCoroutineScope
+ import androidx.compose.ui.platform.LocalContext
+ import co.touchlab.kermit.Logger
+-import kotlinx.coroutines.Dispatchers
+ import kotlinx.coroutines.launch
+ import kotlinx.coroutines.withContext
++import org.meshtastic.core.common.util.ioDispatcher
+
+ @Composable
+ actual fun rememberDataPackageExporter(dataPackageProvider: suspend () -> ByteArray): (fileName: String) -> Unit {
+@@ -41,7 +41,7 @@ actual fun rememberDataPackageExporter(dataPackageProvider: suspend () -> ByteAr
+ return { fileName -> exportLauncher.launch(fileName) }
+ }
+
+-private suspend fun exportZipToUri(context: Context, targetUri: Uri, data: ByteArray) = withContext(Dispatchers.IO) {
++private suspend fun exportZipToUri(context: Context, targetUri: Uri, data: ByteArray) = withContext(ioDispatcher) {
+ try {
+ context.contentResolver.openOutputStream(targetUri)?.use { os -> os.write(data) }
+ Logger.i { "TAK data package exported successfully to $targetUri" }
+diff --git a/feature/settings/src/jvmMain/kotlin/org/meshtastic/feature/settings/debugging/LogExporter.kt b/feature/settings/src/jvmMain/kotlin/org/meshtastic/feature/settings/debugging/LogExporter.kt
+index 5b63cc90a3..a9a7285593 100644
+--- a/feature/settings/src/jvmMain/kotlin/org/meshtastic/feature/settings/debugging/LogExporter.kt
++++ b/feature/settings/src/jvmMain/kotlin/org/meshtastic/feature/settings/debugging/LogExporter.kt
+@@ -19,9 +19,9 @@ package org.meshtastic.feature.settings.debugging
+ import androidx.compose.runtime.Composable
+ import androidx.compose.runtime.rememberCoroutineScope
+ import co.touchlab.kermit.Logger
+-import kotlinx.coroutines.Dispatchers
+ import kotlinx.coroutines.launch
+ import kotlinx.coroutines.withContext
++import org.meshtastic.core.common.util.ioDispatcher
+ import java.awt.FileDialog
+ import java.awt.Frame
+ import java.io.File
+@@ -41,7 +41,7 @@ actual fun rememberLogExporter(logsProvider: suspend () -> List ByteAr
+ if (directory != null && file != null) {
+ val targetFile = File(directory, file)
+ val data = dataPackageProvider()
+- withContext(Dispatchers.IO) { targetFile.writeBytes(data) }
++ withContext(ioDispatcher) { targetFile.writeBytes(data) }
+ Logger.i { "TAK data package exported successfully to ${targetFile.absolutePath}" }
+ }
+ }
diff --git a/.project b/.project
deleted file mode 100644
index 6079e350e..000000000
--- a/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
- Mesh Util
- Project MeshUtil created by Buildship.
-
-
-
-
- org.eclipse.buildship.core.gradleprojectbuilder
-
-
-
-
-
- org.eclipse.buildship.core.gradleprojectnature
-
-
diff --git a/.ruby-version b/.ruby-version
new file mode 100644
index 000000000..7bcbb3808
--- /dev/null
+++ b/.ruby-version
@@ -0,0 +1 @@
+3.4.9
diff --git a/.run/Pre-Commit [spotlessApply detekt].run.xml b/.run/Pre-Commit [spotlessApply detekt].run.xml
new file mode 100644
index 000000000..e5dd9e926
--- /dev/null
+++ b/.run/Pre-Commit [spotlessApply detekt].run.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ true
+ false
+
+ false
+ false
+
+ false
+ false
+ false
+ false
+
+
+
\ No newline at end of file
diff --git a/.settings/org.eclipse.buildship.core.prefs b/.settings/org.eclipse.buildship.core.prefs
deleted file mode 100644
index f8483ac09..000000000
--- a/.settings/org.eclipse.buildship.core.prefs
+++ /dev/null
@@ -1,13 +0,0 @@
-arguments=
-auto.sync=false
-build.scans.enabled=false
-connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
-connection.project.dir=
-eclipse.preferences.version=1
-gradle.user.home=
-java.home=/usr/lib/jvm/java-8-oracle
-jvm.arguments=
-offline.mode=false
-override.workspace.settings=true
-show.console.view=true
-show.executions.view=true
diff --git a/.skills/code-review/SKILL.md b/.skills/code-review/SKILL.md
new file mode 100644
index 000000000..acab253d5
--- /dev/null
+++ b/.skills/code-review/SKILL.md
@@ -0,0 +1,66 @@
+# Skill: Code Review
+
+## Description
+Perform comprehensive code reviews for `Meshtastic-Android`, ensuring changes adhere to KMP architecture, Kotlin Multiplatform conventions, MAD standards, and CMP best practices.
+
+## Code Review Checklist
+
+When reviewing code, meticulously verify the following categories. Flag any deviations and propose the canonical project pattern as a fix.
+
+### 1. KMP Architecture & Source Set Boundaries
+- [ ] **No Platform Bleed:** Ensure absolutely no `java.*` or `android.*` imports exist in `commonMain` source sets.
+- [ ] **KMP Native Alternatives:** Verify the use of KMP alternatives for standard JVM libraries:
+ - `java.util.concurrent.locks.*` -> `kotlinx.coroutines.sync.Mutex`
+ - `java.util.concurrent.ConcurrentHashMap` -> `atomicfu` or Mutex-guarded `mutableMapOf()`
+ - `java.io.*` -> `Okio` (`BufferedSource`/`BufferedSink`)
+ - `java.util.Locale` -> Kotlin `uppercase()`/`lowercase()` (purged from `commonMain`)
+- [ ] **Coroutine Safety:** Use `safeCatching {}` from `core:common` instead of `runCatching {}` in coroutine/suspend contexts. `runCatching` silently swallows `CancellationException`, breaking structured concurrency. Keep `runCatching` only in cleanup/teardown code (abort, close, eviction). Use `kotlinx.coroutines.CancellationException` (not `kotlin.coroutines.cancellation.CancellationException`).
+- [ ] **Shared Helpers:** If `androidMain` and `jvmMain` contain identical pure-Kotlin logic, mandate extracting it to a shared function in `commonMain`.
+- [ ] **File Naming Conflicts:** For `expect`/`actual` declarations, ensure files sharing the same package namespace have distinct names (e.g., keep `expect` in `LogExporter.kt` and shared helpers in `LogFormatter.kt`) to avoid duplicate class errors on the JVM target.
+- [ ] **Interface & DI Over `expect`/`actual`:** Check that `expect`/`actual` is reserved for small platform primitives. Interfaces + DI should be preferred for larger capabilities.
+
+### 2. UI & Compose Multiplatform (CMP)
+- [ ] **Compose Multiplatform Resources:** Ensure NO hardcoded strings. Must use `core:resources` (e.g., `stringResource(Res.string.key)` or asynchronous `getStringSuspend(Res.string.key)` for ViewModels/Coroutines). NEVER use blocking `getString()` in a coroutine.
+- [ ] **String Formatting:** CMP only supports `%N$s` and `%N$d`. Flag any float formats (`%N$.1f`) in Compose string resources; they must be pre-formatted using `NumberFormatter.format()` from `core:common`. Use `MetricFormatter` for metric-specific displays (temperature, voltage, current, percent, humidity, pressure, SNR, RSSI).
+- [ ] **Centralized Dialogs & Alerts:** Flag inline alert-rendering logic. Mandate the use of `AlertHost(alertManager)` or `SharedDialogs` from `core:ui/commonMain`.
+- [ ] **Placeholders:** Require `PlaceholderScreen(name)` from `core:ui/commonMain` for unimplemented desktop/JVM features. No inline placeholders in feature modules.
+- [ ] **Adaptive Layouts:** Verify use of `currentWindowAdaptiveInfo(supportLargeAndXLargeWidth = true)` to support desktop/tablet breakpoints (≥ 1200dp).
+
+### 3. Navigation & State
+- [ ] **Shared Navigation Graphs:** Feature navigation graphs must be defined as extension functions on `EntryProviderScope` in `commonMain` (e.g., `fun EntryProviderScope.settingsGraph(...)`). Flag any graphs defined in platform-specific source sets.
+- [ ] **Navigation Host:** Ensure `MeshtasticNavDisplay` (from `core:ui/commonMain`) is used as the host instead of invoking `NavDisplay` directly. Host modules should not configure `entryDecorators` themselves.
+- [ ] **ViewModel Scoping:** ViewModels obtained via `koinViewModel()` must be inside `entry` blocks to correctly tie to the backstack lifetime.
+
+### 4. Dependency Injection (Koin Annotations)
+- [ ] **Annotation Usage:** Ensure Koin is configured via annotations (`@Single`, `@Factory`, `@KoinViewModel`).
+- [ ] **Root Assembly:** Confirm that the root Koin DI graph is only assembled in host shells (`app` and `desktop`).
+
+### 5. Networking, DB & I/O
+- [ ] **Ktor Strictly:** Check that Ktor is used for all HTTP networking. Flag and reject any usage of OkHttp.
+- [ ] **HTTP Configuration:** Verify timeouts and base URLs use `HttpClientDefaults` from `core:network`. Never hardcode timeouts in feature modules. `DefaultRequest` sets the base URL; feature API services use relative paths.
+- [ ] **Image Loading (Coil):** Coil must use `coil-network-ktor3` in host modules. Feature modules should ONLY depend on `libs.coil` (coil-compose) and never configure fetchers.
+- [ ] **Room KMP:** Ensure `factory = { MeshtasticDatabaseConstructor.initialize() }` is used in `Room.databaseBuilder`. DAOs and Entities must reside in `commonMain`.
+- [ ] **Room Patterns:** Verify use of `@Upsert` for insert-or-update logic. Check for `LIMIT 1` on single-row queries. Flag N+1 query patterns (loops calling single-row queries) — batch with chunked `WHERE IN` instead.
+- [ ] **Bluetooth (BLE):** All Bluetooth communication must be routed through `core:ble` using Kable abstractions.
+
+### 6. Dependency Catalog Aliases
+- [ ] **JetBrains vs. AndroidX:**
+ - In `commonMain`: Must use `jetbrains-*` aliases (e.g., `jetbrains-lifecycle-*`, `jetbrains-navigation3-ui`).
+ - In `androidMain`: Can use `androidx-*` or `jetbrains-*` as appropriate, but do not mix them up in `commonMain`.
+- [ ] **Compose Multiplatform:** Ensure `compose-multiplatform-*` aliases are used instead of plain `androidx.compose` in all KMP modules.
+
+### 7. Testing
+- [ ] **Test Placement:** New Compose UI tests must go in `commonTest` using `runComposeUiTest {}` from `androidx.compose.ui.test.v2` (not the deprecated v1 `androidx.compose.ui.test` package) + `kotlin.test.Test`. Do not add `androidTest` (instrumented) tests.
+- [ ] **Shared Test Utilities:** Test fakes, doubles, and utilities should be placed in `core:testing`.
+- [ ] **Libraries:** Verify usage of `Turbine` for Flow testing, `Kotest` for property-based testing, and `Mokkery` for mocking.
+- [ ] **Robolectric Configuration:** Check that Compose UI tests running via Robolectric on JVM are pinned to `@Config(sdk = [34])` to prevent Java 21 / SDK 35 compatibility issues.
+
+### 8. ProGuard / R8 Rules
+- [ ] **New Dependencies:** If a new reflection-heavy dependency is added (DI, serialization, JNI, ServiceLoader), verify keep rules exist in **both** `app/proguard-rules.pro` (R8) and `desktop/proguard-rules.pro` (ProGuard). The two files must stay aligned.
+- [ ] **Release Smoke-Test:** For dependency or ProGuard rule changes, verify `assembleRelease` and `./gradlew :desktop:runRelease` succeed.
+
+## Review Output Guidelines
+1. **Be Specific & Constructive:** Provide exact file references and code snippets illustrating the required project pattern.
+2. **Reference the Docs:** Cite `AGENTS.md` and project architecture playbooks to justify change requests (e.g., "Per AGENTS.md, `java.io.*` cannot be used in `commonMain`; please migrate to Okio").
+3. **Enforce Build Health:** Remind authors to run `./gradlew test allTests` locally to verify changes, especially since KMP `test` tasks are ambiguous.
+4. **Praise Good Patterns:** Acknowledge correct usage of complex architecture requirements, like proper Navigation 3 scene transitions or elegant `commonMain` helper extractions.
diff --git a/.skills/compose-ui/SKILL.md b/.skills/compose-ui/SKILL.md
new file mode 100644
index 000000000..22fe1b489
--- /dev/null
+++ b/.skills/compose-ui/SKILL.md
@@ -0,0 +1,61 @@
+# Skill: Compose Multiplatform (CMP) UI
+
+## Description
+Guidelines for building shared UI, adaptive layouts, and handling strings/resources in Meshtastic-Android. The codebase uses Material 3 Adaptive.
+
+## 1. UI Components & Layouts
+- **Material 3 / Adaptive:** Use `currentWindowAdaptiveInfo(supportLargeAndXLargeWidth = true)` to support Large (1200dp) and XL (1600dp) breakpoints. Investigate 3-pane "Power User" scenes using Navigation 3 Scenes and draggable dividers for desktop/tablets.
+- **Dialogs & Alerts:** Use centralized components like `AlertHost(alertManager)` from `core:ui/commonMain`. Do NOT trigger alerts inline or duplicate alert logic. Use `SharedDialogs(uiViewModel)` for general popups.
+- **Placeholders:** Use `PlaceholderScreen(name)` from `core:ui/commonMain` for unimplemented desktop/JVM features.
+- **Theme Picker:** Use `ThemePickerDialog` from `feature:settings/commonMain`.
+- **Platform Implementations:** Inject platform-specific behavior (e.g., Map providers) via `CompositionLocal` from the `app` or `desktop` shells. Do not tightly couple Google Maps/osmdroid dependencies to `commonMain`.
+
+## 2. Strings & Resources
+- **Multiplatform Resources:** MUST use `core:resources` (e.g., `stringResource(Res.string.your_key)`). Never use hardcoded strings.
+- **ViewModels/Coroutines:** Use the asynchronous `getStringSuspend(Res.string.your_key)`. NEVER use blocking `getString()` in a coroutine context.
+- **Formatting Constraints:** CMP `stringResource` only supports `%N$s` (string) and `%N$d` (integer).
+ - **No Float formatting:** Formats like `%N$.1f` pass through unsubstituted. Pre-format in Kotlin using `NumberFormatter.format(value, decimalPlaces)` from `core:common` and pass as a string argument (`%N$s`):
+ ```kotlin
+ val formatted = NumberFormatter.format(batteryLevel, 1) // "73.5"
+ stringResource(Res.string.battery_percent, formatted) // uses %1$s
+ ```
+ - **Percent Literals:** Use bare `%` (not `%%`) for literal percent signs in CMP-consumed strings.
+
+### String Formatting Decision Tree
+Choose the right tool for the job:
+
+| Scenario | Tool | Example |
+|----------|------|---------|
+| **Metric display** (temp, voltage, %, signal) | `MetricFormatter.*` | `MetricFormatter.temperature(25.0f, isFahrenheit)` → `"77.0°F"` |
+| **Simple number + unit** | `NumberFormatter` + interpolation | `"${NumberFormatter.format(val, 1)} dB"` |
+| **Localized template from strings.xml** | `stringResource(Res.string.key, preFormattedArgs)` | `stringResource(Res.string.battery, formatted)` |
+| **Non-composable template** (notifications, plain functions) | `formatString(template, args)` | `formatString(template, label, value)` |
+| **Hex formatting** | `formatString` | `formatString("!%08x", nodeNum)` |
+| **Date/time** | `DateFormatter` | `DateFormatter.format(instant)` |
+
+**Rules:**
+1. **NEVER use `%.Nf` in strings.xml** — CMP cannot substitute them. Use `%N$s` and pre-format floats.
+2. **Prefer `MetricFormatter`** over scattered `formatString("%.1f°C", temp)` calls.
+3. **`formatString` (pure Kotlin)** is a pure-Kotlin `commonMain` implementation for: hex formats, multi-arg templates fetched at runtime, and chart axis formatters. Located in `core:common` `Formatter.kt`.
+4. **`NumberFormatter`** always uses `.` as decimal separator — intentional for mesh networking precision.
+
+- **Workflow to Add a String:**
+ 1. Add to `core/resources/src/commonMain/composeResources/values/strings.xml`.
+ 2. Use the generated `org.meshtastic.core.resources.` symbol.
+ 3. Validate UI presentation.
+
+## 3. Tooling & Capabilities
+- **Image Loading:** Use `libs.coil` (Coil Compose) in feature modules. Configuration/Networking for Coil (`coil-network-ktor3`) happens strictly in the `app` and `desktop` host modules.
+- **QR Codes:** Use `rememberQrCodePainter` from `core:ui/commonMain` powered by `qrcode-kotlin`. No ZXing or Android Bitmap APIs in shared code.
+
+## 4. Compose Previews
+- **Preview in commonMain:** CMP 1.11+ supports `@Preview` in `commonMain` via `compose-multiplatform-ui-tooling-preview`. Place preview functions alongside their composables.
+- **Import:** Use `androidx.compose.ui.tooling.preview.Preview`. The JetBrains-prefixed import (`org.jetbrains.compose.ui.tooling.preview.Preview`) is deprecated.
+
+## 5. Dialog & State Patterns
+- **Dialog State Preservation:** Use `rememberSaveable` for dialog state (search queries, selected tabs, expanded flags) to preserve across configuration changes. Boolean and String types are auto-saveable — no custom `Saver` needed.
+
+## Reference Anchors
+- **Shared Strings:** `core/resources/src/commonMain/composeResources/values/strings.xml`
+- **Platform abstraction contract:** `core/ui/src/commonMain/kotlin/org/meshtastic/core/ui/util/MapViewProvider.kt`
+- **Provider wiring:** `app/src/main/kotlin/org/meshtastic/app/MainActivity.kt`
diff --git a/.skills/implement-feature/SKILL.md b/.skills/implement-feature/SKILL.md
new file mode 100644
index 000000000..0277bee10
--- /dev/null
+++ b/.skills/implement-feature/SKILL.md
@@ -0,0 +1,41 @@
+# Skill: Implement a Feature
+
+## Description
+A step-by-step workflow for implementing a new feature in the Meshtastic-Android codebase, ensuring KMP compatibility and proper architecture.
+
+## Workflow
+
+### 1. Update Dependencies & Aliases
+- Check `gradle/libs.versions.toml` before adding libraries.
+- Use `jetbrains-*` aliases for lifecycle/navigation/adaptive dependencies in `commonMain`.
+- Use `compose-multiplatform-*` aliases for CMP dependencies.
+
+### 2. Define the State & ViewModels
+- Follow MVI/UDF patterns.
+- Extend shared ViewModel logic in `feature//src/commonMain/kotlin/org/meshtastic/feature//ViewModel.kt`.
+- Use `stateInWhileSubscribed` (from `core:ui`) for sharing state flows.
+- Keep the ViewModel free of Android framework dependencies.
+
+### 3. Build the UI
+- Use Jetpack Compose Multiplatform (CMP).
+- Define strings in `core:resources` (see the `compose-ui` skill).
+- Support adaptive layouts (Large/XL breakpoints).
+
+### 4. Wire Navigation & DI
+- Define typed route objects in `core:navigation`.
+- Export the navigation graph as an extension function on `EntryProviderScope` in `commonMain` (e.g., `fun EntryProviderScope.myFeatureGraph()`).
+- Add the required DI bindings via Koin Annotations (`@Factory`, `@Single`, `@KoinViewModel`) in `commonMain`.
+- **CRITICAL:** Ensure the module is registered in the app root graphs (`AppKoinModule.kt`, `DesktopKoinModule.kt`) and the navigation is injected into the root entry provider in the host shell.
+
+### 5. Validate Platform Separation
+- If you need a platform-specific API (like camera or specific mapping SDK), define an interface in `commonMain`, implement it in the host shell, and inject it via `CompositionLocal` or Koin.
+
+### 6. Verify Locally
+- Run the baseline checks (see `testing-ci` skill):
+ ```bash
+ ./gradlew spotlessCheck spotlessApply detekt assembleDebug test allTests
+ ```
+- If the feature adds a new reflection-heavy dependency, add keep rules to **both** `app/proguard-rules.pro` and `desktop/proguard-rules.pro`, then verify release builds:
+ ```bash
+ ./gradlew assembleFdroidRelease :desktop:runRelease
+ ```
diff --git a/.skills/kmp-architecture/SKILL.md b/.skills/kmp-architecture/SKILL.md
new file mode 100644
index 000000000..46602c430
--- /dev/null
+++ b/.skills/kmp-architecture/SKILL.md
@@ -0,0 +1,61 @@
+# Skill: KMP Architecture & Source-Set Bridging
+
+## Description
+Guidelines on managing Kotlin Multiplatform (KMP) source-sets, expected abstractions, networking, database, and platform integration rules.
+
+## 1. Source-Set Boundaries
+- **`commonMain`:** All business logic, DB entities, API network logic, ViewModels, and UI rendering. NO `java.*` or `android.*` imports.
+- **`androidMain`:** Android framework integration (`Context`, system services, NFC hardware, BLE Android bindings).
+- **`jvmMain` / `jvmAndroidMain`:** Shared JVM code between Android and Desktop. Uses the `meshtastic.kmp.jvm.android` convention plugin to bridge `jvm` and `android` source sets without manual `dependsOn` hacks.
+- **`app` / `desktop`:** Host shells. Responsible for Koin DI root wiring, `MainKoinModule`, host-level UI themes, and running the `MeshtasticNavDisplay`.
+
+## 2. Bridging Strategies
+- **Interface + DI (Preferred):** Expose an interface in `core:repository` or `core:ui` (e.g. `LocationRepository`, `MapViewProvider`), implement it in `androidMain` or the host `app`, and bind it via Koin or `CompositionLocal`.
+- **`expect`/`actual` (Restricted):** Use only when a platform API cannot be abstracted cleanly (e.g. low-level File I/O mappings, `uppercase()` Locale helpers). Avoid deep class hierarchies using `expect`/`actual`.
+ - **Naming:** Keep `expect` in `FileIo.kt`, but put shared helpers in `FileIoUtils.kt` to prevent JVM duplicate class errors.
+- **Shared Helpers:** Do not duplicate pure Kotlin logic between `androidMain` and `jvmMain`. Extract to a `commonMain` helper.
+
+## 3. Core Libraries & Constraints
+- **Concurrency:** `kotlinx.coroutines`. Use `org.meshtastic.core.common.util.ioDispatcher` over `Dispatchers.IO` directly. Inject `CoroutineDispatchers` from `core:di` into classes that need dispatchers — never reference `Dispatchers.IO`/`Main`/`Default` directly in business logic.
+- **Error Handling:** Use `safeCatching {}` from `core:common` instead of `runCatching {}` in coroutine/suspend contexts. `runCatching` swallows `CancellationException`, breaking structured concurrency. Keep `runCatching` only in cleanup/teardown code (abort, close, eviction loops).
+- **Standard Library Replacements:**
+ - `ConcurrentHashMap` -> `atomicfu` or Mutex-guarded `mutableMapOf()`.
+ - `java.util.concurrent.locks.*` -> `kotlinx.coroutines.sync.Mutex`.
+ - `java.io.*` -> `Okio` (`BufferedSource`/`BufferedSink`).
+- **Networking:** Pure **Ktor**. No OkHttp. Ktor `Logging` plugin for debugging.
+- **HTTP Configuration:** Use `HttpClientDefaults` from `core:network` for shared base URL (`API_BASE_URL`), timeouts, and retry constants. Both Android (`NetworkModule`) and Desktop (`DesktopKoinModule`) HttpClient instances must use these. Feature API services use relative paths; `DefaultRequest` sets the base URL.
+- **BLE:** Route through `core:ble` using **Kable**.
+- **Room KMP:** Use `factory = { MeshtasticDatabaseConstructor.initialize() }` in `Room.databaseBuilder`.
+
+## 4. Hierarchy & Source-Set Conventions
+- **Hierarchy template first:** Prefer Kotlin's default hierarchy template and convention plugins over manual `dependsOn(...)` graphs. Manual source-set wiring should be reserved for cases the template cannot model.
+- **`expect`/`actual` restraint:** Prefer interfaces + DI for platform capabilities; use `expect`/`actual` for small unavoidable platform primitives. Avoid broad expect/actual class hierarchies when an interface-based boundary is sufficient.
+- **Shared helpers over duplicated lambdas:** When `androidMain` and `jvmMain` contain identical pure-Kotlin logic (formatting, action dispatch, validation), extract to `commonMain`. Examples: `formatLogsTo()`, `handleNodeAction()`, `findNodeByNameSuffix()`, `MeshtasticAppShell`, `BaseRadioTransportFactory`.
+
+## 5. Dependency Catalog Aliases
+- **JetBrains fork aliases:** Version catalog aliases for JetBrains-forked AndroidX artifacts use the `jetbrains-*` prefix (e.g., `jetbrains-lifecycle-runtime-compose`, `jetbrains-navigation3-ui`). Plain `androidx-*` aliases are true Google AndroidX artifacts. Never mix them up in `commonMain`.
+- **Compose Multiplatform:** Version catalog aliases for Compose Multiplatform artifacts use the `compose-multiplatform-*` prefix (e.g., `compose-multiplatform-material3`, `compose-multiplatform-foundation`). Never use plain `androidx.compose` dependencies in `commonMain`.
+- **Dependencies:** Always check `gradle/libs.versions.toml` before assuming a library is available.
+
+## 6. I/O & Serialization
+- **Okio standard:** This project standardizes on Okio (`BufferedSource`/`BufferedSink`). JetBrains recommends `kotlinx-io` (built on Okio), but this project has not migrated. Do not introduce `kotlinx-io` without an explicit decision.
+- **Room KMP:** Always use `factory = { MeshtasticDatabaseConstructor.initialize() }` in `Room.databaseBuilder` and `inMemoryDatabaseBuilder`. DAOs and Entities reside in `commonMain`.
+- **Room Patterns:**
+ - Use `@Upsert` for insert-or-update operations instead of manual `INSERT OR IGNORE` + `UPDATE` logic.
+ - Use `LIMIT 1` on `@Query` methods that expect a single row.
+ - Prevent N+1 queries: batch operations with `@Upsert fun putAll(items: List)` or chunked `WHERE IN` queries (chunk size ≤ 999 to respect SQLite bind parameter limit).
+
+## 7. Build-Logic Conventions
+- In `build-logic/convention`, prefer lazy Gradle configuration (`configureEach`, `withPlugin`, provider APIs). Avoid `afterEvaluate` in convention plugins unless there is no viable lazy alternative.
+
+## 8. Onboarding a New Target (Desktop/iOS)
+1. Ensure all new logic compiles against the KMP core (`jvm()`, `iosArm64()`, etc.).
+2. Do not use platform-specific constructs in `commonMain` or you break the iOS/Desktop builds.
+3. Test using `kmpSmokeCompile` to verify cross-platform compilation.
+4. For desktop wiring, copy the pattern in `desktop/src/main/kotlin/org/meshtastic/desktop/di/DesktopKoinModule.kt` and use `NoopStubs.kt` to temporarily mock missing platform implementations.
+
+## Reference Anchors
+- **Shared Okio I/O:** `core/domain/src/commonMain/kotlin/org/meshtastic/core/domain/usecase/settings/ImportProfileUseCase.kt`
+- **Desktop DI Stubs:** `desktop/src/main/kotlin/org/meshtastic/desktop/stub/NoopStubs.kt`
+- **Version Catalog:** `gradle/libs.versions.toml`
+- **Convention Plugins:** `build-logic/convention/`
diff --git a/.skills/navigation-and-di/SKILL.md b/.skills/navigation-and-di/SKILL.md
new file mode 100644
index 000000000..c9d7336a6
--- /dev/null
+++ b/.skills/navigation-and-di/SKILL.md
@@ -0,0 +1,56 @@
+# Skill: DI and Navigation 3 Architecture
+
+## Description
+This skill covers dependency injection (Koin Annotations 4.2.x) and JetBrains Navigation 3 (1.1.x) architecture, constraints, and anti-patterns within the Meshtastic-Android KMP codebase.
+
+## Dependency Injection (Koin)
+
+### Guidelines
+1. **Annotations First:** Use `@Module`, `@ComponentScan`, and `@KoinViewModel` annotations directly in `commonMain` shared modules to encapsulate dependency graphs per feature.
+2. **App Root Assembly:** Don't assume feature/core `@Module` classes are active automatically. Ensure they are included by the app root module (`@Module(includes = [...])`) in `app/src/main/kotlin/org/meshtastic/app/di/AppKoinModule.kt` and `desktop/.../DesktopKoinModule.kt`.
+3. **No Platform Bleed:** Don't put Android framework dependencies (`Context`, `Activity`, `Application`) into shared `commonMain` business logic. Inject interfaces instead.
+4. **Resolution:** Resolve app-layer wrappers via `koinViewModel()` or injected bindings within Compose navigation graphs.
+
+### Anti-Patterns
+- **A1 Module Compile Safety:** Do **not** enable `compileSafety`. It is a single boolean that enables A1 per-module checks — there is no separate A3 full-graph mode. Runtime graph verification is handled by `KoinVerificationTest` and `DesktopKoinTest` instead.
+- **Default Parameters:** Do **not** expect Koin to inject default parameters automatically. The K2 plugin's `skipDefaultValues = true` behavior skips parameters with default Kotlin values.
+
+### Koin Startup Pattern (K2 Compiler Plugin)
+The project uses the **K2 Compiler Plugin** (`koin-compiler-plugin`, not KSP). The canonical startup uses the plugin's typed `startKoin()` stub, which the plugin transforms at compile time via IR:
+```kotlin
+// Bootstrap class — separate from @Module, references the root module graph
+@KoinApplication(modules = [AppKoinModule::class])
+object AndroidKoinApp
+
+// In Application.onCreate()
+startKoin {
+ androidContext(this@MeshUtilApplication)
+ workManagerFactory()
+}
+```
+- `@KoinApplication` goes on a **dedicated bootstrap object**, not on a `@Module` class.
+- `startKoin()` (from `org.koin.plugin.module.dsl`) is a compiler plugin stub — if the plugin isn't applied, it throws `NotImplementedError`.
+- `stopKoin()` uses the standard runtime API (`org.koin.core.context.stopKoin`).
+- `compileSafety` must stay **disabled** — it enables A1 per-module checks that break our inverted-dependency architecture. There is no separate A3 full-graph flag.
+
+## Navigation 3
+
+### Guidelines
+1. **Types:** Use Navigation 3 types consistently (`NavKey`, `NavBackStack`, `EntryProviderScope`).
+2. **Typed Routes:** Keep route definitions in `core:navigation/src/commonMain/.../Routes.kt` as `@Serializable sealed interface` hierarchies. Don't use ad-hoc strings.
+3. **Graph Assembly:** Define feature navigation graphs as extension functions on `EntryProviderScope` in `commonMain` (e.g., `fun EntryProviderScope.settingsGraph(backStack)`).
+4. **Host Integration:** Use `MeshtasticNavDisplay` (from `core:ui/commonMain`) as the Navigation 3 host. Do not configure decorators manually inside feature modules.
+5. **Back Handlers:** Use `NavigationBackHandler` from `androidx.navigationevent:navigationevent-compose` for back gestures in multiplatform code. Do not use Android's `BackHandler`.
+6. **Deep Links:** Use `DeepLinkRouter.route()` in `core:navigation` to synthesize typed backstacks from RESTful paths.
+
+### Anti-Patterns
+- **Single Backstack for Multiple Tabs:** Do **not** use a single `NavBackStack` list for multiple tabs. Use `MultiBackstack` (from `core:navigation`).
+- **Decorator Reuse Across Tabs:** Do **not** reuse the same `NavEntryDecorator` instances across different backstacks. When rendering an active tab in `MeshtasticNavDisplay`, you **must** supply a fresh set of decorators (using `remember(backStack) { ... }`) bound to the active backstack instance to prevent permanent `ViewModelStore` destruction.
+- **Custom Backstack Mutation:** Do **not** mutate back navigation with custom stacks disconnected from the app backstack. Mutate `NavBackStack` directly with `add(...)` and `removeLastOrNull()`.
+
+## Reference Anchors
+- **App Startup / Koin Bootstrap:** `app/src/main/kotlin/org/meshtastic/app/MeshUtilApplication.kt`
+- **DI Bootstrap Object:** `app/src/main/kotlin/org/meshtastic/app/di/AndroidKoinApp.kt`
+- **DI App Wiring:** `app/src/main/kotlin/org/meshtastic/app/di/AppKoinModule.kt`
+- **Shared Routes:** `core/navigation/src/commonMain/kotlin/org/meshtastic/core/navigation/Routes.kt`
+- **Desktop Nav Shell:** `desktop/src/main/kotlin/org/meshtastic/desktop/ui/DesktopMainScreen.kt`
diff --git a/.skills/new-branch/SKILL.md b/.skills/new-branch/SKILL.md
new file mode 100644
index 000000000..d63f3f4c2
--- /dev/null
+++ b/.skills/new-branch/SKILL.md
@@ -0,0 +1,79 @@
+# Skill: New Branch Bootstrap
+
+## Description
+Canonical recipe for spinning up a fresh working branch off the latest upstream `main`. Use this skill
+whenever the user says things like *"make a new branch off fetched origin/main"*, *"peel off a fresh
+branch"*, *"dust off #NNNN"*, or otherwise signals the start of a new unit of work.
+
+This replaces the ad-hoc prose that used to be retyped at the start of every session.
+
+## When to Use
+- Starting any new feature, fix, chore, or refactor.
+- Rebasing a stale PR onto current `main` (see [Rebase variant](#rebase-variant)).
+- Reproducing a CI failure from a clean baseline.
+
+## Preconditions (verify before branching)
+1. **Clean worktree.** If `git status --porcelain` is non-empty, ask the user before proceeding.
+2. **Upstream remote present.** `git remote -v` must list `upstream` pointing at
+ `meshtastic/Meshtastic-Android`. If only `origin` exists on a fork, treat `origin` as upstream.
+3. **Submodules initialised.** `core/proto/src/main/proto` must be populated — see AGENTS.md
+ workspace bootstrap rules.
+4. **Secrets bootstrapped.** If `local.properties` is missing, copy `secrets.defaults.properties`
+ (required for `google` flavor builds).
+
+## Standard Recipe
+
+```bash
+# 1. Fetch latest upstream
+git fetch upstream --prune --tags
+
+# 2. Create the branch from upstream/main (never from a local stale main)
+git switch -c upstream/main
+
+# 3. Ensure submodules track the new base
+git submodule update --init --recursive
+
+# 4. Sanity check
+git --no-pager log -1 --oneline
+```
+
+## Branch Naming
+Use conventional-commit style prefixes that match the PR title convention in AGENTS.md
+``:
+
+| Prefix | Use for |
+| :--- | :--- |
+| `feat/` | New user-visible behavior |
+| `fix/` | Bug fixes |
+| `refactor/` | Code structure changes, no behavior change |
+| `chore/` | Tooling, deps, CI, cleanup |
+| `docs/` | Documentation only |
+
+Keep the slug short and kebab-case, e.g. `fix/r8-animation-release`, `chore/koin-application-migration`.
+
+## Rebase Variant
+When the user says *"rebase #NNNN"* or *"dust off PR NNNN"*:
+
+```bash
+git fetch upstream --prune
+gh pr checkout # checks out the PR head locally
+git rebase upstream/main
+git submodule update --init --recursive
+# Resolve conflicts, then:
+git push --force-with-lease
+```
+
+Never use plain `--force`. Always `--force-with-lease` to avoid clobbering collaborator pushes.
+
+## Post-Branch Checklist
+- [ ] Branch name follows conventional prefix.
+- [ ] Submodules up to date.
+- [ ] `local.properties` exists.
+- [ ] `ANDROID_HOME` exported (see AGENTS.md workspace bootstrap).
+- [ ] Optional: run `./gradlew assembleDebug` once to catch environment regressions before editing.
+
+## Tip: Prefer `/delegate` for Long Audits
+If the user's opening prompt is a sweeping audit or investigation (e.g. *"audit changes since
+v2.7.13 for regressions"*, *"investigate why animations are broken on release"*), consider
+suggesting `/delegate` — the GitHub cloud agent can execute the branch + investigation + PR
+end-to-end while the user keeps working locally. See AGENTS.md ``.
diff --git a/.skills/project-overview/SKILL.md b/.skills/project-overview/SKILL.md
new file mode 100644
index 000000000..2224fa7ad
--- /dev/null
+++ b/.skills/project-overview/SKILL.md
@@ -0,0 +1,83 @@
+# Skill: Project Overview & Codebase Map
+
+## Description
+Module directory, namespacing conventions, environment setup, and troubleshooting for Meshtastic-Android.
+
+- **Build System:** Gradle (Kotlin DSL). JDK 21 REQUIRED. Target SDK: API 36. Min SDK: API 26.
+- **Flavors:** `fdroid` (OSS only) · `google` (Maps + DataDog analytics)
+- **Android-only Modules:** `core:api` (AIDL), `core:barcode` (CameraX). Shared contracts abstracted into `core:ui/commonMain`.
+
+## Codebase Map
+
+| Directory | Description |
+| :--- | :--- |
+| `app/` | Main application module. Contains `MainActivity`, Koin DI modules, and app-level logic. Uses package `org.meshtastic.app`. |
+| `build-logic/` | Convention plugins for shared build configuration (e.g., `meshtastic.kmp.feature`, `meshtastic.kmp.library`, `meshtastic.kmp.jvm.android`, `meshtastic.koin`). |
+| `config/` | Detekt static analysis rules (`config/detekt/detekt.yml`) and Spotless formatting config (`config/spotless/.editorconfig`). |
+| `docs/` | Architecture docs and agent playbooks. See `docs/kmp-status.md` and `docs/roadmap.md` for current status. |
+| `core/model` | Domain models and common data structures. |
+| `core:proto` | Protobuf definitions (Git submodule). |
+| `core:common` | Low-level utilities, I/O abstractions (Okio), and common types. |
+| `core:database` | Room KMP database implementation. |
+| `core:datastore` | Multiplatform DataStore for preferences. |
+| `core:repository` | High-level domain interfaces (e.g., `NodeRepository`, `LocationRepository`). |
+| `core:domain` | Pure KMP business logic and UseCases. |
+| `core:data` | Core manager implementations and data orchestration. |
+| `core:network` | KMP networking layer using Ktor, MQTT abstractions, and shared transport (`StreamFrameCodec`, `TcpTransport`, `SerialTransport`, `BleRadioInterface`). |
+| `core:di` | Common DI qualifiers and dispatchers. |
+| `core:navigation` | Shared navigation keys/routes for Navigation 3 using `@Serializable sealed interface` hierarchies. `DeepLinkRouter` for typed backstack synthesis, and `MeshtasticNavSavedStateConfig` with `subclassesOfSealed()` for automatic polymorphic backstack persistence. |
+| `core:ui` | Shared Compose UI components (`MeshtasticAppShell`, `MeshtasticNavDisplay`, `MeshtasticNavigationSuite`, `AlertHost`, `SharedDialogs`, `PlaceholderScreen`, `MainAppBar`, dialogs, preferences) and platform abstractions. |
+| `core:service` | KMP service layer; Android bindings stay in `androidMain`. |
+| `core:api` | Public AIDL/API integration module for external clients. |
+| `core:prefs` | KMP preferences layer built on DataStore abstractions. |
+| `core:barcode` | Barcode scanning (Android-only). |
+| `core:nfc` | NFC abstractions (KMP). Android NFC hardware implementation in `androidMain`. |
+| `core/ble/` | Bluetooth Low Energy stack using Kable. |
+| `core/resources/` | Centralized string and image resources (Compose Multiplatform). |
+| `core/testing/` | Shared test doubles, fakes, and utilities for `commonTest` across all KMP modules. |
+| `feature/` | Feature modules (e.g., `settings`, `map`, `messaging`, `node`, `intro`, `connections`, `firmware`, `wifi-provision`, `widget`). All are KMP except `widget`. Use `meshtastic.kmp.feature` convention plugin. |
+| `feature/wifi-provision` | KMP WiFi provisioning via BLE (Nymea protocol). Uses `core:ble` Kable abstractions. |
+| `feature/firmware` | Fully KMP firmware update system: Unified OTA (BLE + WiFi), native Nordic Secure DFU protocol (pure KMP), USB/UF2 updates, and `FirmwareRetriever` with manifest-based resolution. Desktop is a first-class target. |
+| `desktop/` | Compose Desktop application. Thin host shell relying on feature modules for shared UI. Full Koin DI graph, TCP, Serial/USB, and BLE transports. Versioning via `config.properties` + `GitVersionValueSource`. |
+
+## Namespacing
+- **Standard:** Use the `org.meshtastic.*` namespace for all code.
+- **Legacy:** Maintain the `com.geeksville.mesh` Application ID.
+
+## Environment Setup
+1. **JDK 21 MUST be used** to prevent Gradle sync/build failures.
+2. **Secrets:** Copy `secrets.defaults.properties` to `local.properties`:
+ ```properties
+ MAPS_API_KEY=dummy_key
+ datadogApplicationId=dummy_id
+ datadogClientToken=dummy_token
+ ```
+
+## Workspace Bootstrap (MUST run before any build)
+Agents **MUST** perform these steps automatically at the start of every session before running any Gradle task. Do not wait for the user to tell you.
+
+1. **Android SDK:** `ANDROID_HOME` may not be set in agent workspaces. Detect and export it:
+ ```bash
+ # Check common macOS/Linux locations in order of preference
+ if [ -z "$ANDROID_HOME" ]; then
+ for dir in "$HOME/Library/Android/sdk" "$HOME/Android/Sdk" "/opt/android-sdk"; do
+ if [ -d "$dir" ]; then export ANDROID_HOME="$dir"; break; fi
+ done
+ fi
+ ```
+ All `./gradlew` invocations must include `ANDROID_HOME` in the environment. If the SDK cannot be found, ask the user for the path.
+
+2. **Proto submodule:** `core/proto/src/main/proto` is a Git submodule containing Protobuf definitions. It must be initialized or builds will fail with proto generation errors:
+ ```bash
+ git submodule update --init
+ ```
+
+3. **Init secrets:** If `local.properties` does not exist, copy `secrets.defaults.properties` to `local.properties`. Without this the `google` flavor build fails:
+ ```bash
+ [ -f local.properties ] || cp secrets.defaults.properties local.properties
+ ```
+
+## Troubleshooting
+- **Build Failures:** Check `gradle/libs.versions.toml` for dependency conflicts.
+- **Configuration Cache:** Add `--no-configuration-cache` if cache-related issues persist.
+- **Koin Injection Failures:** Verify the component is included in `AppKoinModule`.
diff --git a/.skills/testing-ci/SKILL.md b/.skills/testing-ci/SKILL.md
new file mode 100644
index 000000000..1c8b7b901
--- /dev/null
+++ b/.skills/testing-ci/SKILL.md
@@ -0,0 +1,85 @@
+# Skill: Testing and CI Verification
+
+## Description
+Guidelines and commands for verifying code changes locally and understanding the Meshtastic-Android CI pipeline. Use this to determine which testing matrix is needed based on the change type.
+
+## 1) Baseline local verification order
+
+Run in a single invocation for routine changes to ensure code formatting, analysis, and basic compilation:
+
+```bash
+./gradlew spotlessCheck spotlessApply detekt assembleDebug test allTests
+```
+
+> **Why no `clean`?** Incremental builds are safe and significantly faster. Only use `clean` when debugging stale cache issues.
+
+> **Why `test allTests` and not just `test`:**
+> In KMP modules, the `test` task name is **ambiguous**. Gradle matches both `testAndroid` and
+> `testAndroidHostTest` and refuses to run either, silently skipping KMP modules.
+> `allTests` is the `KotlinTestReport` lifecycle task registered by the KMP plugin.
+> Conversely, `allTests` does **not** cover pure-Android modules (`:app`, `:core:api`, etc.), which is why both `test` and `allTests` are needed.
+
+*Note: If testing Compose UI on the JVM (Robolectric) with Java 21, pin tests to `@Config(sdk = [34])` to avoid SDK 35 compatibility crashes.*
+
+## 2) Change-type verification matrix
+
+- `docs-only` changes: Usually no Gradle run required, but run `spotlessCheck` if practical.
+- `UI text/resource` changes: `spotlessCheck`, `detekt`, `assembleDebug`.
+- `feature/commonMain logic` changes: `spotlessCheck`, `detekt`, `test allTests`, `assembleDebug`.
+- `navigation/DI wiring` changes: `spotlessCheck`, `detekt`, `assembleDebug`, `test allTests`, plus flavor unit tests if available.
+ - If touching any KMP module, also run `kmpSmokeCompile`.
+- `worker/service/background` changes: Broad tests, targeted WorkManager checks.
+- `BLE/networking/core repository`: `spotlessCheck`, `detekt`, `assembleDebug`, `test allTests`.
+
+## 3) Flavor checks
+
+Run these when relevant to map, provider, or flavor-specific behavior:
+
+```bash
+./gradlew lintFdroidDebug lintGoogleDebug
+./gradlew testFdroidDebug testGoogleDebug
+```
+
+## 4) CI Pipeline Architecture
+
+CI is defined in `.github/workflows/reusable-check.yml` and structured as four parallel job groups:
+
+1. **`lint-check`** — Runs spotless, detekt, Android lint, and KMP smoke compile in a single Gradle invocation (avoids 3x cold-start overhead). Uses `fetch-depth: 0` (full clone) for spotless ratcheting and version code calculation. Produces `cache_read_only` output and computed `version_code` for downstream jobs.
+2. **`test-shards`** — A 3-shard matrix that runs unit tests in parallel (depends on `lint-check`):
+ - `shard-core`: `allTests` for all `core:*` KMP modules.
+ - `shard-feature`: `allTests` for all `feature:*` KMP modules.
+ - `shard-app`: Explicit test tasks for pure-Android/JVM modules (`app`, `desktop`, `core:barcode`).
+ Each shard generates Kover XML coverage and uploads test results + coverage to Codecov with per-shard flags.
+ Downstream jobs use `fetch-depth: 1` and receive `VERSION_CODE` from lint-check via env var, enabling shallow clones.
+3. **`android-check`** — Builds APKs for all flavors (depends on `lint-check`).
+4. **`build-desktop`** — Multi-OS matrix (`macos-latest`, `windows-latest`, `ubuntu-24.04`, `ubuntu-24.04-arm`) that builds desktop distributions via `createDistributable` (depends on `lint-check`).
+
+### Runner Strategy (Three Tiers)
+- **`ubuntu-24.04-arm`** — Lightweight/utility jobs (status checks, labelers, triage, changelog, release metadata, stale, moderation). Benefits from ARM runners' shorter queue times.
+- **`ubuntu-24.04`** — Main Gradle-heavy jobs (CI `lint-check`/`test-shards`/`android-check`, release builds, Dokka, publish, dependency-submission). Pin for reproducibility.
+- **Desktop runners:** Multi-OS matrix (`macos-latest`, `windows-latest`, `ubuntu-24.04`, `ubuntu-24.04-arm`) for the `build-desktop` job and release packaging.
+
+### CI Gradle Properties
+`gradle.properties` is tuned for local dev (8g heap, 4g Kotlin daemon). CI uses `.github/ci-gradle.properties`, which the `gradle-setup` composite action copies to `~/.gradle/gradle.properties`. Key CI overrides:
+- `org.gradle.daemon=false` (single-use runners)
+- `kotlin.incremental=false` (fresh checkouts)
+- `-Xmx4g` Gradle heap, `-Xmx2g` Kotlin daemon
+- VFS watching disabled, workers capped at 4
+- `org.gradle.isolated-projects=true` for better parallelism
+- Disables unused Android build features (`resvalues`, `shaders`)
+
+### CI Conventions
+- **KMP Smoke Compile:** `./gradlew kmpSmokeCompile` is a lifecycle task (registered in `RootConventionPlugin`) that auto-discovers all KMP modules and depends on their `compileKotlinJvm` + `compileKotlinIosSimulatorArm64` tasks.
+- **`maxParallelForks` CI logic:** `ProjectExtensions.kt` checks `project.findProperty("ci") == "true"` and uses full available processors in CI (4 forks on std runners) vs. half locally. All CI invocations pass `-Pci=true`.
+- **Detekt report formats:** Detekt.kt checks `project.findProperty("ci") == "true"` and disables html, txt, md reports in CI; only xml + sarif are retained for GitHub annotations.
+- **Robolectric SDK caching:** The `gradle-setup` composite action caches `~/.m2/repository/org/robolectric` to prevent flaky `SocketException` on SDK downloads. Cache key is `robolectric-{version}-sdk{level}` — update when bumping version or SDK level.
+- **`mavenLocal()` gated:** Disabled by default to prevent CI cache poisoning. Pass `-PuseMavenLocal` for local JitPack testing.
+- **JUnit parallel execution:** Enabled project-wide with classes running sequentially (`junit.jupiter.execution.parallel.mode.classes.default=same_thread`) to avoid `Dispatchers.setMain()` races. Cross-module parallelism comes from Gradle forks (`maxParallelForks`).
+- **`test-retry` plugin:** Applied to all module types (maxRetries=2, maxFailures=10).
+- **`fail-fast: false`:** Test sharding does not cancel other shards on failure.
+- **Explicit Gradle task paths:** Prefer `app:lintFdroidDebug` over shorthand `lintDebug` in CI.
+- **Pull request CI:** Main-only (`.github/workflows/pull-request.yml` targets `main`).
+- **Cache writes:** Trusted on `main` and merge queue runs; other refs use read-only cache.
+- **Path filtering:** `check-changes` in `pull-request.yml` must include module dirs plus build/workflow entrypoints (`build-logic/**`, `gradle/**`, `.github/workflows/**`, `gradlew`, `settings.gradle.kts`, etc.).
+- **AboutLibraries:** Runs in `offlineMode` by default (no GitHub/SPDX API calls). Release builds pass `-PaboutLibraries.release=true` via Fastlane/Gradle CLI to enable remote license fetching. Do NOT re-gate on `CI` or `GITHUB_TOKEN` alone.
+
diff --git a/AGENTS.md b/AGENTS.md
new file mode 100644
index 000000000..c1bafdd96
--- /dev/null
+++ b/AGENTS.md
@@ -0,0 +1,108 @@
+# Meshtastic Android - Unified Agent & Developer Guide
+
+
+You are an expert Android and Kotlin Multiplatform (KMP) engineer working on Meshtastic-Android, a decentralized mesh networking application. You must maintain strict architectural boundaries, use Modern Android Development (MAD) standards, and adhere to Compose Multiplatform and JetBrains Navigation 3 patterns.
+
+
+
+- **Project Goal:** Decouple business logic from the Android framework for seamless multi-platform execution (Android, Desktop, iOS) while maintaining a high-performance native Android experience.
+- **Language & Tech:** Kotlin 2.3+ (JDK 21 REQUIRED), Gradle Kotlin DSL, Ktor, Okio, Room KMP.
+- **Core Architecture:**
+ - `commonMain` is pure KMP. `androidMain` is strictly for Android framework bindings.
+ - App root DI and graph assembly live in the `app` and `desktop` host shells.
+- **Skills Directory:** You **MUST** consult the relevant `.skills/` module before executing work:
+ - `.skills/project-overview/` - Codebase map, module directory, namespacing, environment setup, troubleshooting.
+ - `.skills/kmp-architecture/` - Bridging, expect/actual, source-sets, catalog aliases, build-logic conventions.
+ - `.skills/compose-ui/` - Adaptive UI, placeholders, string resources.
+ - `.skills/navigation-and-di/` - JetBrains Navigation 3 & Koin 4.2+ annotations.
+ - `.skills/testing-ci/` - Validation commands, CI pipeline architecture, CI Gradle properties.
+ - `.skills/implement-feature/` - Step-by-step feature workflow.
+ - `.skills/code-review/` - PR validation checklist.
+ - `.skills/new-branch/` - Canonical recipe for branching off upstream/main and rebasing stale PRs.
+- **Active Status:** Read `docs/kmp-status.md` and `docs/roadmap.md` to understand the current KMP migration epoch.
+
+
+
+- **Workspace Bootstrap (MUST run first):** Before executing any Gradle task in a new workspace, agents MUST automatically:
+ 1. **Find the Android SDK** — `ANDROID_HOME` is often unset in agent worktrees. Probe `~/Library/Android/sdk`, `~/Android/Sdk`, and `/opt/android-sdk`. Export the first one found. If none exist, ask the user.
+ 2. **Init the proto submodule** — Run `git submodule update --init`. The `core/proto/src/main/proto` submodule contains Protobuf definitions required for builds.
+ 3. **Init secrets** — If `local.properties` does not exist, copy `secrets.defaults.properties` to `local.properties`. Without this the `google` flavor build fails.
+- **Think First:** Reason through the problem before writing code. For complex KMP tasks involving multiple modules or source sets, outline your approach step-by-step before executing.
+- **Plan Before Execution:** Use the git-ignored `.agent_plans/` directory to write markdown implementation plans (`plan.md`) and Mermaid diagrams (`.mmd`) for complex refactors before modifying code.
+- **Atomic Execution:** Follow your plan step-by-step. Do not jump ahead. Use TDD where feasible (write `commonTest` fakes first).
+- **Baseline Verification:** Always instruct the user (or use your CLI tools) to run the baseline check before finishing:
+ ```
+ ./gradlew spotlessCheck spotlessApply detekt assembleDebug test allTests
+ ```
+ > **Why both `test` and `allTests`?** In KMP modules, `test` is ambiguous and Gradle silently skips them. `allTests` is the KMP lifecycle task that covers KMP modules. Conversely, `allTests` does NOT cover pure-Android modules (`:app`, `:core:api`), so both tasks are required.
+ > For KMP cross-platform compilation, also run `./gradlew kmpSmokeCompile` (compiles all KMP modules for JVM + iOS Simulator — used by CI's `lint-check` job).
+
+
+
+- **Codebase Search:** Use whatever search and navigation tools your environment provides (file search, grep/ripgrep, symbol lookup, semantic search, etc.) to map out project boundaries before coding. Prefer `rg` (ripgrep) over `grep` or `find` for raw text search.
+- **Terminal Pagers:** When running shell commands like `git diff` or `git log`, ALWAYS use `--no-pager` (e.g., `git --no-pager diff`) to prevent getting stuck in an interactive prompt.
+- **Fetch Up-to-Date Docs:** If your environment supports web search, MCP servers, or documentation lookup tools, actively query them for the latest documentation on Koin 4.x, JetBrains Navigation 3, and Compose Multiplatform 1.11.
+- **Clone Reference Repos:** If documentation is insufficient, use shell commands to clone bleeding-edge KMP dependency repositories into the local `.agent_refs/` directory (git-ignored) to inspect their source and test suites. Recommended:
+ - `https://github.com/JetBrains/kotlin-multiplatform-dev-docs` (Official Docs)
+ - `https://github.com/InsertKoinIO/koin` (Koin Annotations 4.x)
+ - `https://github.com/JetBrains/compose-multiplatform` (Navigation 3, Adaptive UI)
+ - `https://github.com/JuulLabs/kable` (BLE)
+ - `https://github.com/coil-kt/coil` (Coil 3 KMP)
+ - `https://github.com/ktorio/ktor` (Ktor Networking)
+- **Formatting Hooks:** Always run `./gradlew spotlessApply` as an automatic formatting hook to fix style violations after editing.
+
+
+
+`AGENTS.md` is the single source of truth for agent instructions. Agent-specific files redirect here:
+- `.github/copilot-instructions.md` — Copilot redirect to `AGENTS.md`.
+- `CLAUDE.md` — Claude Code entry point; imports `AGENTS.md` via `@AGENTS.md` and adds Claude-specific instructions.
+- `GEMINI.md` — Gemini redirect to `AGENTS.md`. Gemini CLI also configured via `.gemini/settings.json` to read `AGENTS.md` directly.
+
+Do NOT duplicate content into agent-specific files. When you modify architecture, module targets, CI tasks, validation commands, or agent workflow rules, update `AGENTS.md`, `.skills/`, and `docs/kmp-status.md` as needed.
+
+
+
+- **No Lazy Coding:** DO NOT use placeholders like `// ... existing code ...`. Always provide complete, valid code blocks for the sections you modify to ensure correct diff application.
+- **No Framework Bleed:** NEVER import `java.*` or `android.*` in `commonMain`. Use KMP equivalents: `Okio` for `java.io.*`, `kotlinx.coroutines.sync.Mutex` for `java.util.concurrent.locks.*`, `atomicfu` or Mutex-guarded `mutableMapOf()` for `ConcurrentHashMap`. Use `org.meshtastic.core.common.util.ioDispatcher` instead of `Dispatchers.IO` directly.
+- **Koin Annotations:** Use `@Single`, `@Factory`, and `@KoinViewModel` inside `commonMain` instead of manual constructor trees. Do not enable A1 module compile safety — A3 full-graph validation (`VerifyModule`) is the correct approach because interfaces and implementations live in separate modules. Always register new feature modules in **both** `AppKoinModule.kt` and `DesktopKoinModule.kt`; they are not auto-activated.
+- **CMP Over Android:** Use `compose-multiplatform` constraints. `stringResource` only supports `%N$s` and `%N$d` — pre-format floats with `NumberFormatter.format()` from `core:common` and pass as `%N$s`. In ViewModels/coroutines use `getStringSuspend(Res.string.key)`; never blocking `getString()`. Always use `MeshtasticNavDisplay` (not raw `NavDisplay`) as the navigation host, and `NavigationBackHandler` (not Android's `BackHandler`) for back gestures in shared code.
+- **ProGuard:** When adding a reflection-heavy dependency, add keep rules to **both** `app/proguard-rules.pro` and `desktop/proguard-rules.pro` and verify release builds.
+- **Always Check Docs:** If unsure about an abstraction, search `core:ui/commonMain` or `core:navigation/commonMain` before assuming it doesn't exist.
+- **Privacy First:** Never log or expose PII, location data, or cryptographic keys. Meshtastic is used for sensitive off-grid communication — treat all user data with extreme caution.
+- **Dependency Discipline:** Never add a library without first checking `libs.versions.toml` and justifying its inclusion against the project's size and complexity goals. Prefer removing dependencies over adding them.
+- **Zero Lint Tolerance:** A task is incomplete if `detekt` fails or `spotlessCheck` does not pass for touched modules.
+- **Read Before Refactoring:** When a pattern contradicts best practices, analyze whether it is legacy debt or a deliberate architectural choice before proposing a change.
+
+
+
+These tips apply when the agent is the GitHub Copilot CLI. Other agent runtimes may ignore this
+section.
+
+- **Delegate long autonomous work.** For sweeping audits, multi-hour investigations, or "fleet"
+ prompts (*"investigate why X is broken on release"*, *"audit the diff since tag vX.Y.Z"*,
+ *"review the codebase for best practices against spec Z"*), prefer `/delegate` so the GitHub
+ cloud agent opens a PR while the user keeps working locally. Don't tie up an interactive
+ session on work that can run unattended.
+- **Use `/research` for "latest hotness" prompts.** When the user asks for *"the latest scoop"*
+ on Kotlin / KMP / Compose / Koin trends, the built-in `/research` slash command performs deep
+ research across GitHub and the web with better source grounding than an ad-hoc prompt.
+- **Use `/plan` mode for "noodle it out" prompts.** When the user asks for an implementation
+ plan, a "walk me through next steps", or explicitly says "don't do anything yet" — switch to
+ plan mode (Shift+Tab or `/plan`). Plans persist in the session workspace and keep the agent
+ from prematurely editing files. Continue to write long-form plans and Mermaid diagrams to
+ `.agent_plans/` (git-ignored) for multi-module refactors.
+- **`/share` audit and review outputs.** After large audits, PR safety reviews, or release-cycle
+ quality passes, offer `/share` to export the findings to a gist or markdown file. These
+ reports are valuable artifacts — don't let them die in session history.
+- **Prefer `/rewind` or `ctrl+s` over retyping.** If a turn went sideways, `/rewind` reverts
+ file changes and the turn; `ctrl+s` submits while preserving the input for quick iteration.
+ Avoid re-issuing the same prompt verbatim.
+- **New-branch flow lives in a skill.** When the user says "fresh branch off fetched origin/main"
+ or "rebase PR #NNNN", consult `.skills/new-branch/SKILL.md` rather than re-deriving the recipe.
+
+
+
+- **Commit Hygiene:** Squash fixup/polish/review-feedback commits before opening a PR. Each commit should represent a logical, self-contained unit of work — not a back-and-forth conversation.
+- **PR Descriptions:** Keep PR descriptions concise and scannable. State *what changed* and *why*, not a per-commit play-by-play. Use a short summary paragraph followed by a bullet list of changes. Avoid tables, headers-per-commit, or verbose breakdowns. Reference the `meshtastic/firmware` repo PRs for tone and style.
+- **PR Titles:** Use conventional commit format: `feat(scope):`, `fix(scope):`, `refactor(scope):`, `chore(scope):`. Keep titles under ~72 characters.
+
diff --git a/CLAUDE.md b/CLAUDE.md
new file mode 100644
index 000000000..eb5cd5e5c
--- /dev/null
+++ b/CLAUDE.md
@@ -0,0 +1,9 @@
+# Meshtastic Android - Claude Code Guide
+
+@AGENTS.md
+
+## Claude-Specific Instructions
+
+- **Think First:** Always outline your step-by-step reasoning inside `` tags before writing code or shell commands. Claude models perform significantly better on complex KMP tasks when they "think out loud" first.
+- **Skills:** The `.skills/` directory contains task-specific instruction modules. Load them as needed — only the skill relevant to your current task.
+- **Plan Mode:** Use plan mode for architectural changes spanning multiple modules. Write plans to `.agent_plans/` (git-ignored). The Copilot-CLI-specific `/plan`, `/delegate`, `/research`, and `/share` guidance in `AGENTS.md` does not apply to Claude Code — skip the `` section.
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 000000000..6843fc85d
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,4 @@
+# Contributor Covenant Code of Conduct
+
+The Meshtastic Firmware project is subject to the code of conduct for the parent project, which can be found here:
+https://meshtastic.org/docs/legal/conduct/
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 000000000..d4fe0b740
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,94 @@
+# Contributing to Meshtastic-Android
+
+Thank you for your interest in contributing to Meshtastic-Android! We welcome contributions from everyone. Please take a moment to review these guidelines to help us maintain a high-quality, collaborative project.
+
+## How to Contribute
+
+- **Fork the repository** and create your branch from `main` or the appropriate feature branch.
+- **Make your changes** in a logical, atomic manner.
+- **Test your changes** thoroughly before submitting a pull request.
+- **Submit a pull request** (PR) with a clear description of your changes and the problem they solve.
+- If you are addressing an existing issue, please reference it in your PR (e.g., `Fixes #123`).
+
+## Code Style
+
+- Follow the [Kotlin Coding Conventions](https://kotlinlang.org/docs/coding-conventions.html) for Kotlin code.
+- Use Android Studio's default formatting settings.
+- We use [spotless](https://github.com/diffplug/spotless) for automated code formatting. You can run `./gradlew spotlessApply` to format your code automatically.
+ - You can also run `./gradlew spotlessInstallGitPrePushHook --no-configuration-cache` to install a pre-push Git hook that will run a `spotlessCheck`.
+- Write clear, descriptive variable and function names.
+- Add comments where necessary, especially for complex logic.
+- Keep methods and classes focused and concise.
+- **Strings:** Use localised strings via the **Compose Multiplatform Resource** library in `:core:resources`.
+ - Do **not** use the legacy `app/src/main/res/values/strings.xml`.
+ - **Definition:** Add strings to `core/resources/src/commonMain/composeResources/values/strings.xml`.
+ - **Usage:**
+ ```kotlin
+ import org.jetbrains.compose.resources.stringResource
+ import org.meshtastic.core.resources.Res
+ import org.meshtastic.core.resources.your_string_key
+
+ Text(text = stringResource(Res.string.your_string_key))
+ ```
+
+### Linting
+
+Meshtastic-Android uses [Detekt](https://detekt.dev/) for static code analysis and linting of Kotlin code.
+
+- Run `./gradlew detekt` before submitting your pull request to ensure your code passes all lint checks.
+- Fix any Detekt warnings or errors reported in your code.
+- It is possible to suppress warnings individually, but this should be used very sparingly.
+- You can find Detekt configuration in the `config/detekt` directory. If you believe a rule should be changed or suppressed, discuss it in your PR.
+
+Consistent linting helps keep the codebase clean and maintainable.
+
+### Testing
+
+Meshtastic-Android uses unit tests, Robolectric JVM tests, and instrumented UI tests to ensure code quality and reliability.
+
+- **Unit tests** are located in the `src/test/` directory of each module.
+- **Compose UI Tests (JVM)** are preferred for component testing and are also located in `src/test/` using **Robolectric**.
+ - Note: If using Java 21, pin your Robolectric tests to `@Config(sdk = [34])` to avoid SDK 35 compatibility issues.
+- **Instrumented tests** (including full E2E UI tests) are located in `src/androidTest/`. For Compose UI, use the [Jetpack Compose Testing APIs](https://developer.android.com/jetpack/compose/testing).
+
+#### Guidelines for Testing
+
+- Add or update tests for any new features or bug fixes.
+- Ensure all tests pass by running:
+ - `./gradlew test` for unit and Robolectric tests
+ - `./gradlew connectedAndroidTest` for instrumented tests
+- For UI components, write Robolectric Compose tests where possible for faster execution.
+- If your change is difficult to test, explain why in your pull request.
+
+Comprehensive testing helps prevent regressions and ensures a stable experience for all users.
+
+
+## Pull Requests
+
+- branches should start with:
+ - bugfix
+ - enhancement
+ - dependencies
+ - repo
+ - reserved (release, automation)
+- Ensure your branch is up to date with the latest `main` branch before submitting a PR.
+- Provide a meaningful title and description for your PR.
+- Include information on how to test and/or replicate if it is not obvious.
+- Include screenshots or logs if your change affects the UI or user experience.
+- Be responsive to feedback and make requested changes promptly.
+- Squash commits if requested by a maintainer.
+
+## Issue Reporting
+
+- Search existing issues before opening a new one to avoid duplicates.
+- Provide a clear and descriptive title.
+- Include steps to reproduce, expected behavior, and actual behavior.
+- Attach logs, screenshots, or other helpful context if applicable.
+
+## Community Standards
+
+- Be respectful and considerate in all interactions.
+- The Meshtastic Android project is subject to the code of conduct for the parent project, which can be [found here:](https://meshtastic.org/docs/legal/conduct/)
+- Help others by reviewing pull requests and answering questions when possible.
+
+Thank you for helping make Meshtastic-Android better!
diff --git a/GEMINI.md b/GEMINI.md
new file mode 100644
index 000000000..72a350afb
--- /dev/null
+++ b/GEMINI.md
@@ -0,0 +1,6 @@
+# Meshtastic Android - Google Gemini Guide
+
+> **Note:** The canonical instructions for all AI Agents have been deduplicated.
+
+You MUST immediately read and internalize the unified instructions located at the root of the repository in `AGENTS.md`.
+After reading `AGENTS.md`, consult the `.skills/` directory for task-specific playbooks.
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 000000000..7a118b49b
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,3 @@
+source "https://rubygems.org"
+
+gem "fastlane"
diff --git a/Gemfile.lock b/Gemfile.lock
new file mode 100644
index 000000000..cf6a1b9c0
--- /dev/null
+++ b/Gemfile.lock
@@ -0,0 +1,238 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ CFPropertyList (3.0.8)
+ abbrev (0.1.2)
+ addressable (2.9.0)
+ public_suffix (>= 2.0.2, < 8.0)
+ artifactory (3.0.17)
+ atomos (0.1.3)
+ aws-eventstream (1.4.0)
+ aws-partitions (1.1240.0)
+ aws-sdk-core (3.245.0)
+ aws-eventstream (~> 1, >= 1.3.0)
+ aws-partitions (~> 1, >= 1.992.0)
+ aws-sigv4 (~> 1.9)
+ base64
+ bigdecimal
+ jmespath (~> 1, >= 1.6.1)
+ logger
+ aws-sdk-kms (1.123.0)
+ aws-sdk-core (~> 3, >= 3.244.0)
+ aws-sigv4 (~> 1.5)
+ aws-sdk-s3 (1.219.0)
+ aws-sdk-core (~> 3, >= 3.244.0)
+ aws-sdk-kms (~> 1)
+ aws-sigv4 (~> 1.5)
+ aws-sigv4 (1.12.1)
+ aws-eventstream (~> 1, >= 1.0.2)
+ babosa (1.0.4)
+ base64 (0.2.0)
+ benchmark (0.5.0)
+ bigdecimal (4.1.2)
+ claide (1.1.0)
+ colored (1.2)
+ colored2 (3.1.2)
+ commander (4.6.0)
+ highline (~> 2.0.0)
+ csv (3.3.5)
+ declarative (0.0.20)
+ digest-crc (0.7.0)
+ rake (>= 12.0.0, < 14.0.0)
+ domain_name (0.6.20240107)
+ dotenv (2.8.1)
+ emoji_regex (3.2.3)
+ excon (0.112.0)
+ faraday (1.10.5)
+ faraday-em_http (~> 1.0)
+ faraday-em_synchrony (~> 1.0)
+ faraday-excon (~> 1.1)
+ faraday-httpclient (~> 1.0)
+ faraday-multipart (~> 1.0)
+ faraday-net_http (~> 1.0)
+ faraday-net_http_persistent (~> 1.0)
+ faraday-patron (~> 1.0)
+ faraday-rack (~> 1.0)
+ faraday-retry (~> 1.0)
+ ruby2_keywords (>= 0.0.4)
+ faraday-cookie_jar (0.0.8)
+ faraday (>= 0.8.0)
+ http-cookie (>= 1.0.0)
+ faraday-em_http (1.0.0)
+ faraday-em_synchrony (1.0.1)
+ faraday-excon (1.1.0)
+ faraday-httpclient (1.0.1)
+ faraday-multipart (1.2.0)
+ multipart-post (~> 2.0)
+ faraday-net_http (1.0.2)
+ faraday-net_http_persistent (1.2.0)
+ faraday-patron (1.0.0)
+ faraday-rack (1.0.0)
+ faraday-retry (1.0.4)
+ faraday_middleware (1.2.1)
+ faraday (~> 1.0)
+ fastimage (2.4.1)
+ fastlane (2.233.0)
+ CFPropertyList (>= 2.3, < 4.0.0)
+ abbrev (~> 0.1.2)
+ addressable (>= 2.8, < 3.0.0)
+ artifactory (~> 3.0)
+ aws-sdk-s3 (~> 1.197)
+ babosa (>= 1.0.3, < 2.0.0)
+ base64 (~> 0.2.0)
+ benchmark (>= 0.1.0)
+ bundler (>= 1.17.3, < 5.0.0)
+ colored (~> 1.2)
+ commander (~> 4.6)
+ csv (~> 3.3)
+ dotenv (>= 2.1.1, < 3.0.0)
+ emoji_regex (>= 0.1, < 4.0)
+ excon (>= 0.71.0, < 1.0.0)
+ faraday (~> 1.0)
+ faraday-cookie_jar (~> 0.0.6)
+ faraday_middleware (~> 1.0)
+ fastimage (>= 2.1.0, < 3.0.0)
+ fastlane-sirp (>= 1.1.0)
+ gh_inspector (>= 1.1.2, < 2.0.0)
+ google-apis-androidpublisher_v3 (~> 0.3)
+ google-apis-playcustomapp_v1 (~> 0.1)
+ google-cloud-env (>= 1.6.0, <= 2.1.1)
+ google-cloud-storage (~> 1.31)
+ highline (~> 2.0)
+ http-cookie (~> 1.0.5)
+ json (< 3.0.0)
+ jwt (>= 2.1.0, < 3)
+ logger (>= 1.6, < 2.0)
+ mini_magick (>= 4.9.4, < 5.0.0)
+ multipart-post (>= 2.0.0, < 3.0.0)
+ mutex_m (~> 0.3.0)
+ naturally (~> 2.2)
+ nkf (~> 0.2.0)
+ optparse (>= 0.1.1, < 1.0.0)
+ ostruct (>= 0.1.0)
+ plist (>= 3.1.0, < 4.0.0)
+ rubyzip (>= 2.0.0, < 3.0.0)
+ security (= 0.1.5)
+ simctl (~> 1.6.3)
+ terminal-notifier (>= 2.0.0, < 3.0.0)
+ terminal-table (~> 3)
+ tty-screen (>= 0.6.3, < 1.0.0)
+ tty-spinner (>= 0.8.0, < 1.0.0)
+ word_wrap (~> 1.0.0)
+ xcodeproj (>= 1.13.0, < 2.0.0)
+ xcpretty (~> 0.4.1)
+ xcpretty-travis-formatter (>= 0.0.3, < 2.0.0)
+ fastlane-sirp (1.1.0)
+ gh_inspector (1.1.3)
+ google-apis-androidpublisher_v3 (0.99.0)
+ google-apis-core (>= 0.15.0, < 2.a)
+ google-apis-core (0.18.0)
+ addressable (~> 2.5, >= 2.5.1)
+ googleauth (~> 1.9)
+ httpclient (>= 2.8.3, < 3.a)
+ mini_mime (~> 1.0)
+ mutex_m
+ representable (~> 3.0)
+ retriable (>= 2.0, < 4.a)
+ google-apis-iamcredentials_v1 (0.26.0)
+ google-apis-core (>= 0.15.0, < 2.a)
+ google-apis-playcustomapp_v1 (0.17.0)
+ google-apis-core (>= 0.15.0, < 2.a)
+ google-apis-storage_v1 (0.61.0)
+ google-apis-core (>= 0.15.0, < 2.a)
+ google-cloud-core (1.8.0)
+ google-cloud-env (>= 1.0, < 3.a)
+ google-cloud-errors (~> 1.0)
+ google-cloud-env (2.1.1)
+ faraday (>= 1.0, < 3.a)
+ google-cloud-errors (1.6.0)
+ google-cloud-storage (1.59.0)
+ addressable (~> 2.8)
+ digest-crc (~> 0.4)
+ google-apis-core (>= 0.18, < 2)
+ google-apis-iamcredentials_v1 (~> 0.18)
+ google-apis-storage_v1 (>= 0.42)
+ google-cloud-core (~> 1.6)
+ googleauth (~> 1.9)
+ mini_mime (~> 1.0)
+ googleauth (1.11.2)
+ faraday (>= 1.0, < 3.a)
+ google-cloud-env (~> 2.1)
+ jwt (>= 1.4, < 3.0)
+ multi_json (~> 1.11)
+ os (>= 0.9, < 2.0)
+ signet (>= 0.16, < 2.a)
+ highline (2.0.3)
+ http-cookie (1.0.8)
+ domain_name (~> 0.5)
+ httpclient (2.9.0)
+ mutex_m
+ jmespath (1.6.2)
+ json (2.19.4)
+ jwt (2.10.2)
+ base64
+ logger (1.7.0)
+ mini_magick (4.13.2)
+ mini_mime (1.1.5)
+ multi_json (1.20.1)
+ multipart-post (2.4.1)
+ mutex_m (0.3.0)
+ nanaimo (0.4.0)
+ naturally (2.3.0)
+ nkf (0.2.0)
+ optparse (0.8.1)
+ os (1.1.4)
+ ostruct (0.6.3)
+ plist (3.7.2)
+ public_suffix (7.0.5)
+ rake (13.4.2)
+ representable (3.2.0)
+ declarative (< 0.1.0)
+ trailblazer-option (>= 0.1.1, < 0.2.0)
+ uber (< 0.2.0)
+ retriable (3.4.1)
+ rexml (3.4.4)
+ rouge (3.28.0)
+ ruby2_keywords (0.0.5)
+ rubyzip (2.4.1)
+ security (0.1.5)
+ signet (0.21.0)
+ addressable (~> 2.8)
+ faraday (>= 0.17.5, < 3.a)
+ jwt (>= 1.5, < 4.0)
+ multi_json (~> 1.10)
+ simctl (1.6.10)
+ CFPropertyList
+ naturally
+ terminal-notifier (2.0.0)
+ terminal-table (3.0.2)
+ unicode-display_width (>= 1.1.1, < 3)
+ trailblazer-option (0.1.2)
+ tty-cursor (0.7.1)
+ tty-screen (0.8.2)
+ tty-spinner (0.9.3)
+ tty-cursor (~> 0.7)
+ uber (0.1.0)
+ unicode-display_width (2.6.0)
+ word_wrap (1.0.0)
+ xcodeproj (1.27.0)
+ CFPropertyList (>= 2.3.3, < 4.0)
+ atomos (~> 0.1.3)
+ claide (>= 1.0.2, < 2.0)
+ colored2 (~> 3.1)
+ nanaimo (~> 0.4.0)
+ rexml (>= 3.3.6, < 4.0)
+ xcpretty (0.4.1)
+ rouge (~> 3.28.0)
+ xcpretty-travis-formatter (1.0.1)
+ xcpretty (~> 0.2, >= 0.0.7)
+
+PLATFORMS
+ arm64-darwin-24
+ ruby
+
+DEPENDENCIES
+ fastlane
+
+BUNDLED WITH
+ 2.7.2
diff --git a/README.md b/README.md
index ae0bd0cf7..2cc1ffe1c 100644
--- a/README.md
+++ b/README.md
@@ -1,81 +1,106 @@
-# Meshtastic-Android
+
+
+
+Meshtastic-Android

-[](https://github.com/meshtastic/Meshtastic-Android/actions/workflows/android.yml)
+[](https://github.com/meshtastic/Meshtastic-Android/actions/workflows/pull-request.yml)
+[](https://codecov.io/gh/meshtastic/Meshtastic-Android)
+[](https://crowdin.meshtastic.org/android)
[](https://cla-assistant.io/meshtastic/Meshtastic-Android)
[](https://opencollective.com/meshtastic/)
[](https://vercel.com?utm_source=meshtastic&utm_campaign=oss)
-This is a tool for using Android with open-source mesh radios. For more information see our webpage: [meshtastic.org](https://www.meshtastic.org). If you are looking for the the device side code, see [here](https://github.com/meshtastic/Meshtastic-device).
+This is a tool for using Android (and Compose Desktop) with open-source mesh radios. For more information see our webpage: [meshtastic.org](https://www.meshtastic.org). If you are looking for the device side code, see [here](https://github.com/meshtastic/firmware).
-This project is currently beta testing, if you have questions or feedback
-please [Join our discussion forum](https://meshtastic.discourse.group/). We would love to hear from
-you!
+This project is currently beta testing across various providers. If you have questions or feedback please [Join our discussion forum](https://github.com/orgs/meshtastic/discussions) or the [Discord Group](https://discord.gg/meshtastic) . We would love to hear from you!
+
+
+
+## Get Meshtastic
+
+The easiest, and fastest way to get the latest beta releases is to use our [github releases](https://github.com/meshtastic/Meshtastic-Android/releases). It is recommend to use these with [Obtainium](https://github.com/ImranR98/Obtainium) to get the latest updates.
+
+Alternatively, these other providers are also available, but may be slower to update.
[ ](https://mesh.tastic.app/fdroid/repo)
+width="24%">](https://f-droid.org/packages/com.geeksville.mesh/)
+[ ](https://apt.izzysoft.de/fdroid/index/apk/com.geeksville.mesh)
+[ ](https://github.com/meshtastic/Meshtastic-Android/releases)
[ ](https://play.google.com/store/apps/details?id=com.geeksville.mesh&referrer=utm_source%3Dgithub-android-readme)
+width="24%">](https://play.google.com/store/apps/details?id=com.geeksville.mesh&referrer=utm_source%3Dgithub-android-readme)
-If you want to join the Play Store beta program go to [this URL](https://play.google.com/apps/testing/com.geeksville.mesh) and opt-in to the alpha/beta test.
-If you encounter any problems or have questions, [post in the forum](https://meshtastic.discourse.group/) and we'll help.
+The play store is the last to update of these options, but if you want to join the Play Store testing program go to [this URL](https://play.google.com/apps/testing/com.geeksville.mesh) and opt-in to become a tester.
+If you encounter any problems or have questions, [ask us on the discord](https://discord.gg/meshtastic), [create an issue](https://github.com/meshtastic/Meshtastic-Android/issues), or [post in the forum](https://github.com/orgs/meshtastic/discussions) and we'll help as we can.
-However, if you must use 'raw' APKs you can get them from our [github releases](https://github.com/meshtastic/Meshtastic-Android/releases). This is not recommended because if you manually install an APK it will not automatically update.
+## Documentation
-## Build instructions
+The project's documentation is generated with [Dokka](https://kotlinlang.org/docs/dokka-introduction.html) and hosted on GitHub Pages. It is automatically updated on every push to the `main` branch.
-If you would like to develop this application we'd love your help! These build instructions are brief and should be improved, please send a PR if you can.
+[**View Documentation**](https://meshtastic.github.io/Meshtastic-Android/)
-- Use Android Studio to build/debug
-- Use "git submodule update --init --recursive" to pull in the various submodules we depend on
-- There are a few config files which you'll need to copy from templates included in the project. Run
- the following commands to do so:
+### Generating Locally
-```bash
-rm ./app/google-services.json
-cp ./app/google-services-example.json ./app/google-services.json
-rm ./app/src/main/res/values/curfirmwareversion.xml
-cp ./app/special/curfirmwareversion.xml ./app/src/main/res/values/
+You can generate the documentation locally to preview your changes.
+
+1. **Run the Dokka task:**
+ ```bash
+ ./gradlew dokkaGeneratePublicationHtml
+ ```
+2. **View the output:**
+ The generated HTML files will be located in the `build/dokka/html` directory. You can open the `index.html` file in your browser to view the documentation.
+
+## Architecture
+
+### Modern Android Development (MAD)
+The app follows modern Android development practices, built on top of a shared Kotlin Multiplatform (KMP) Core:
+- **KMP Modules:** Business logic (`core:domain`), data sources (`core:data`, `core:database`, `core:datastore`), and communications (`core:network`, `core:ble`) are entirely platform-agnostic, targeting Android and Compose Desktop.
+- **UI:** JetBrains Compose Multiplatform (Material 3) using Compose Multiplatform resources.
+- **State Management:** Unidirectional Data Flow (UDF) with ViewModels, Coroutines, and Flow.
+- **Dependency Injection:** Koin with Koin Annotations (K2 Compiler Plugin).
+- **Navigation:** JetBrains Navigation 3 (Multiplatform routing with RESTful deep linking).
+- **Data Layer:** Repository pattern with Room KMP (local DB), DataStore (prefs), and Protobuf (device comms).
+
+### Bluetooth Low Energy (BLE)
+The BLE stack uses a multiplatform interface-driven architecture. Platform-agnostic interfaces live in `commonMain`, utilizing the **Kable** multiplatform BLE library to handle device communication across all supported targets (Android, Desktop). This provides a robust, Coroutine-based architecture for reliable device communication while remaining fully KMP compatible. See [core/ble/README.md](core/ble/README.md) for details.
+
+## Translations
+
+You can help translate the app into your native language using [Crowdin](https://crowdin.meshtastic.org/android).
+
+## API & Integration
+
+Developers can integrate with the Meshtastic Android app using our published API library via **JitPack**. This allows third-party applications (like the ATAK plugin) to communicate with the mesh service via AIDL.
+
+For detailed integration instructions, see [core/api/README.md](core/api/README.md).
+
+Additionally, the app includes a built-in **Local TAK Server** feature that can be enabled in settings. This runs a local TCP server on port 8089 to allow ATAK clients to connect directly and route their traffic over the mesh.
+
+## Building the Android App
+> [!WARNING]
+> Debug and release builds can be installed concurrently. This is solely to enable smoother development, and you should avoid running both apps simultaneously. To ensure proper function, force quit the app not in use.
+
+https://meshtastic.org/docs/development/android/
+
+Note: when building the `google` flavor locally you will need to supply your own [Google Maps Android SDK api key](https://developers.google.com/maps/documentation/android-sdk/get-api-key) `MAPS_API_KEY` in `local.properties` in order to use Google Maps.
+e.g.
+```properties
+MAPS_API_KEY=your_google_maps_api_key_here
```
-- Now you should be able to select "Run / Run" in the IDE and it will happily start running on your
- phone or the emulator. Note: The emulators don't support bluetooth, so some features can not be
- used in that environment.
+## Contributing guidelines
-## Analytics setup
+For detailed instructions on how to contribute, please see our [CONTRIBUTING.md](CONTRIBUTING.md) file.
+For details on our release process, see the [RELEASE_PROCESS.md](RELEASE_PROCESS.md) file.
-- analytics are included but can be disabled by the user on the settings screen
+## Repository Statistics
-- on dev devices
+
-```bash
-adb shell setprop debug.firebase.analytics.app com.geeksville.mesh
-adb shell setprop log.tag.FirebaseCrashlytics DEBUG
-```
-
-for verbose logging:
-
-```bash
-adb shell setprop log.tag.FA VERBOSE
-```
-
-# Credits
-
-This project is the work of volunteers:
-
-- @artemisoftnian: Contributed Spanish translations.
-- @CycloMies: Contributed Swedish, Finnish and German translations.
-- @eriktheV-king: Contributed Dutch and French translations.
-- @Lgoix: Contributed tooltip for radio mode
-- @Eugene: Contributed Russian translation.
-- @Jinx17: Contributed Slovenian translation.
-- @Konradrundfunk: Contributed German fixes.
-- @Mango-sauce: Contributed Chinese translation.
-- @NEKLAN: Contributed Japanese translation.
-- @Ohcdh: Contributed Irish and Italian translations.
-- @Slavino: Contributed Slovak translation.
-- @Zone: Contributed Turkish translation.
-
-Copyright 2022, Geeksville Industries, LLC. GPL V3 license
+Copyright 2025, Meshtastic LLC. GPL-3.0 license
diff --git a/RELEASE_PROCESS.md b/RELEASE_PROCESS.md
new file mode 100644
index 000000000..8a1feb203
--- /dev/null
+++ b/RELEASE_PROCESS.md
@@ -0,0 +1,65 @@
+# Meshtastic-Android Release Process
+
+This guide summarizes the steps for releasing a new version of Meshtastic-Android. The process is fully automated via GitHub Actions and Fastlane.
+
+## Overview
+
+The entire release process is managed by a single, manually-triggered GitHub Action: **`Create or Promote Release`**.
+
+- **Trigger:** To start a new release or promote an existing one, a developer manually runs the workflow from the GitHub Actions tab.
+- **Inputs:** The workflow requires two inputs:
+ 1. `version`: The base version number you are releasing (e.g., `2.4.0`).
+ 2. `channel`: The release channel you are targeting (`internal`, `closed`, `open`, or `production`).
+- **Automation:** The workflow handles everything automatically:
+ - **Syncs Assets:** Fetches the latest firmware/hardware lists, protobuf definitions, and translations (Crowdin).
+ - **Generates Changelog:** Creates a clean changelog from commits since the last production release and commits it to the repo.
+ - **Updates Config:** Automatically bumps the `VERSION_NAME_BASE` in `config.properties`.
+ - **Verifies & Tags:** Runs lint checks, builds the app, and *only* tags the release if successful.
+ - **Deploys:** Uploads the build to the correct Google Play track and attaches artifacts (`.aab`/`.apk`) to a GitHub Release.
+- **Changelog:** Release notes are auto-generated from PR labels. Ensure PRs are labeled correctly to maintain an accurate changelog.
+
+## Release Steps
+
+### 1. Start an Internal Release
+
+1. Navigate to the **Actions** tab in the GitHub repository.
+2. Select the **`Create or Promote Release`** workflow.
+3. Click the **"Run workflow"** dropdown.
+4. Enter the base `version` (e.g., `2.4.0`).
+5. Select the `internal` channel.
+6. Click **"Run workflow"**.
+
+The workflow will:
+1. **Create a new commit** on the current branch containing updated assets, translations, and the new changelog.
+2. **Tag** that commit with an incremental internal tag (e.g., `v2.4.0-internal.1`).
+3. **Build & Deploy** the verified artifact to the Play Store Internal track.
+4. Publish a **draft** pre-release on GitHub.
+
+### 2. Promote to the Next Channel
+
+Once an internal build has been verified, you can promote it to a wider audience.
+
+1. Run the **`Create or Promote Release`** workflow again with the same base `version`.
+2. Select the next channel in the sequence (e.g., `closed`, then `open`).
+3. The workflow will create a new incremental tag for that channel (e.g., `v2.4.0-closed.1`) and create a **published** pre-release on GitHub.
+
+### 3. Promote to Production
+
+After testing is complete on all pre-release channels, you can create the final public release.
+
+1. Run the **`Create or Promote Release`** workflow one last time.
+2. Use the same base `version`.
+3. Select the `production` channel.
+4. The workflow will create a clean version tag (e.g., `v2.4.0`) and create a **published, stable** (non-prerelease) release on GitHub.
+
+### 4. Post-Release
+
+1. **Verify:** Check the Google Play Console to ensure the build is available on the correct track.
+2. **Merge:** Merge the release branch (if one was used for stabilization) back into `main`.
+
+## Build Attestations & Provenance
+
+All release artifacts are accompanied by explicit GitHub build attestations (provenance). This provides cryptographic proof that the artifacts were built by our trusted GitHub Actions workflow, ensuring supply chain integrity.
+
+- You can view and verify provenance in the GitHub UI under each release asset.
+- For more details, see [GitHub's documentation on build provenance](https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#provenance-attestations).
diff --git a/SECURITY.md b/SECURITY.md
new file mode 100644
index 000000000..dc4df33df
--- /dev/null
+++ b/SECURITY.md
@@ -0,0 +1,12 @@
+# Security Policy
+
+## Supported Versions
+
+| App Version | Supported |
+| ---------------- | ------------------ |
+| 2.7.x | :white_check_mark: |
+| <= 2.6.x | :x: |
+
+## Reporting a Vulnerability
+
+We support the private reporting of potential security vulnerabilities. Please go to the Security tab to file a report with a description of the potential vulnerability and reproduction scripts (preferred) or steps, and our developers will review.
diff --git a/TODO.md b/TODO.md
deleted file mode 100644
index 5e50be3b0..000000000
--- a/TODO.md
+++ /dev/null
@@ -1,58 +0,0 @@
-# Misc todo
-
-* move analytics out with https://blog.gradle.org/optional-dependencies
-
-# Android 30 location tasks
-
-* https://developer.android.com/about/versions/11/privacy/location#background-location - ask for foreground and background location separately
-* add "help location checkbox"
-* turn off "provideLocation" checkbox if we don't have background permission. If someone tries to turn it on, raise dialog then ask for background permissions
-* add help button to location checkbox
-
-# Documentation tasks
-
-Mostly for geeksville
-
-Document the following in application behavior
-*change ls_secs is 1 hr normally, which is fine because if there are other nodes in the mesh and they send us a packet we will wake any time during ls_secs and update app state
-* use states for meshservice: disconnected -> connected-> devsleep -> disconnected (3 states)
-* when device enters LS state radiointerfaceservice publishes "Broadcasting connection=false", meshservice should then enter devicesleepstate for ls_secs + 30s (to allow for some margin)
-
-* describe user experience: devices always point to each other and show distance, you can send texts between nodes
-the channel is encrypted, you can share the the channel key with others by qr code or by sharing a special link
-
-* take video of the app
-
-# Post 1.0
-
-* show pointer arrow on the outside of the user icons, always pointing towards them
-* Use setLargeIcon to show user icons in the notification: file:///home/kevinh/packages/android-sdk-linux/docs/design/patterns/notifications.html
-* Our notification about messages should use VISIBLITY_PRIVATE + setPublicVersion per file:///home/kevinh/packages/android-sdk-linux/docs/guide/topics/ui/notifiers/notifications.html
-* Use LocationRequest.setSmallestDisplacement to save battery and decrease net activity
-* use platform theme (dark or light)
-* Do PRIORITY_BALANCED_POWER_ACCURACY for our gps updates when no one in the mesh is nearer than 200 meters
-* spend some quality power consumption tuning with https://developer.android.com/studio/profile/energy-profiler and https://developer.android.com/topic/performance/power/battery-historian
-* use google signin to get user name (make optional)
-* keep past messages in db, one db per channel (currently we just keep an array in saved preferences)
-* show user avatars in chat (use the google user info api)
-* let users save old channels (i.e. have a menu of channels the user can use)
-* if the rxpacket queue on the device overflows (because android hasn't connected in a while) send a special packet to android which means 'X packets have been dropped because you were offline' -drop oldest packets first
-* make sw update work over BLE
-
-# Signal alpha release
-Do this "Signal app compatible" release relatively soon after the alpha release of the android app.
-
-* call onNodeDBChanged after we haven't heard a packet from the mesh in a while - because that's how we decide we have less than 2 nodes in the mesh and should stop listening to the local GPS
-* add large packet reassembly?
-* optionally turn off crypto in signal - preferably though see if there is a nice way to be a peer of signal/sms and now mesh.
-* change signal package ID - if distributing modified binary
-* investigate the Signal SMS message flow path, see if I could just make Mesh a third peer to signal & sms?
-* make signal work when there is no internet up
-* make Signal rx path work
-* send Signal message type. It seems to be? " public static final int WHISPER_TYPE = 2;
- public static final int PREKEY_TYPE = 3;
- public static final int SENDERKEY_TYPE = 4;
- public static final int SENDERKEY_DISTRIBUTION_TYPE = 5;"
-
-# Done
-
diff --git a/app/.classpath b/app/.classpath
deleted file mode 100644
index eb19361b5..000000000
--- a/app/.classpath
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/app/.gitignore b/app/.gitignore
deleted file mode 100644
index 7863aa700..000000000
--- a/app/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/build
-/debug
-/release
-google-services.json
diff --git a/app/.project b/app/.project
deleted file mode 100644
index ac485d7c3..000000000
--- a/app/.project
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
- app
- Project app created by Buildship.
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.buildship.core.gradleprojectbuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
- org.eclipse.buildship.core.gradleprojectnature
-
-
diff --git a/app/.settings/org.eclipse.buildship.core.prefs b/app/.settings/org.eclipse.buildship.core.prefs
deleted file mode 100644
index b1886adb4..000000000
--- a/app/.settings/org.eclipse.buildship.core.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-connection.project.dir=..
-eclipse.preferences.version=1
diff --git a/app/README.md b/app/README.md
new file mode 100644
index 000000000..ff6f5542f
--- /dev/null
+++ b/app/README.md
@@ -0,0 +1,70 @@
+# `:app`
+
+## Overview
+The `:app` module is the entry point for the Meshtastic Android application. It orchestrates the various feature modules, manages global state, and provides the main UI shell.
+
+## Key Components
+
+### 1. `MainActivity` & `Main.kt`
+The single Activity of the application. It hosts the shared `MeshtasticNavDisplay` navigation shell and manages the root UI structure (Navigation Bar, Rail, etc.).
+
+### 2. `MeshService`
+The core background service that manages long-running communication with the mesh radio. While it is declared in the `:app` manifest for system visibility, its implementation resides in the `:core:service` module. It runs as a **Foreground Service** to ensure reliable communication even when the app is in the background.
+
+### 3. Koin Application
+`MeshUtilApplication` is the Koin entry point, providing the global dependency injection container.
+
+## Architecture
+The module primarily serves as a "glue" layer, connecting:
+- `core:*` modules for shared logic.
+- `feature:*` modules for specific user-facing screens.
+
+## Module dependency graph
+
+
+```mermaid
+graph TB
+ :app[app]:::android-application
+ :app -.-> :core:ble
+ :app -.-> :core:common
+ :app -.-> :core:data
+ :app -.-> :core:database
+ :app -.-> :core:datastore
+ :app -.-> :core:di
+ :app -.-> :core:domain
+ :app -.-> :core:model
+ :app -.-> :core:navigation
+ :app -.-> :core:network
+ :app -.-> :core:nfc
+ :app -.-> :core:prefs
+ :app -.-> :core:proto
+ :app -.-> :core:service
+ :app -.-> :core:resources
+ :app -.-> :core:ui
+ :app -.-> :core:barcode
+ :app -.-> :core:takserver
+ :app -.-> :feature:intro
+ :app -.-> :feature:messaging
+ :app -.-> :feature:connections
+ :app -.-> :feature:map
+ :app -.-> :feature:node
+ :app -.-> :feature:settings
+ :app -.-> :feature:firmware
+ :app -.-> :feature:wifi-provision
+ :app -.-> :feature:widget
+
+classDef android-application fill:#CAFFBF,stroke:#000,stroke-width:2px,color:#000;
+classDef android-application-compose fill:#CAFFBF,stroke:#000,stroke-width:2px,color:#000;
+classDef compose-desktop-application fill:#CAFFBF,stroke:#000,stroke-width:2px,color:#000;
+classDef android-feature fill:#FFD6A5,stroke:#000,stroke-width:2px,color:#000;
+classDef android-library fill:#9BF6FF,stroke:#000,stroke-width:2px,color:#000;
+classDef android-library-compose fill:#9BF6FF,stroke:#000,stroke-width:2px,color:#000;
+classDef android-test fill:#A0C4FF,stroke:#000,stroke-width:2px,color:#000;
+classDef jvm-library fill:#BDB2FF,stroke:#000,stroke-width:2px,color:#000;
+classDef kmp-feature fill:#FFD6A5,stroke:#000,stroke-width:2px,color:#000;
+classDef kmp-library-compose fill:#FFC1CC,stroke:#000,stroke-width:2px,color:#000;
+classDef kmp-library fill:#FFC1CC,stroke:#000,stroke-width:2px,color:#000;
+classDef unknown fill:#FFADAD,stroke:#000,stroke-width:2px,color:#000;
+
+```
+
diff --git a/app/build.gradle b/app/build.gradle
deleted file mode 100644
index 12cb89a31..000000000
--- a/app/build.gradle
+++ /dev/null
@@ -1,224 +0,0 @@
-plugins {
- id 'com.android.application'
- id 'kotlin-android'
- id 'kotlin-kapt'
- id 'kotlin-parcelize'
- id 'kotlinx-serialization'
- id 'dagger.hilt.android.plugin'
- id 'com.github.triplet.play'
- id 'de.mobilej.unmock'
- // id "app.brant.amazonappstorepublisher"
-
- // protobufs
- id 'com.google.protobuf'
-
- // Firebase Crashlytics
- id 'com.google.gms.google-services'
- id 'com.google.firebase.crashlytics'
-}
-
-unMock {
- keep "android.net.Uri"
- keep "android.util.Base64"
-}
-
-def keystorePropertiesFile = rootProject.file("keystore.properties")
-def keystoreProperties = new Properties()
-if (keystorePropertiesFile.exists()) {
- keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
-}
-
-android {
- signingConfigs {
- release {
- keyAlias keystoreProperties['keyAlias']
- keyPassword keystoreProperties['keyPassword']
- storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
- storePassword keystoreProperties['storePassword']
- }
- }
- compileSdkVersion 33
- defaultConfig {
- applicationId "com.geeksville.mesh"
- minSdkVersion 21 // The oldest emulator image I have tried is 22 (though 21 probably works)
- targetSdkVersion 31
- versionCode 30008 // format is Mmmss (where M is 1+the numeric major number
- versionName "2.0.8"
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
-
- // per https://developer.android.com/studio/write/vector-asset-studio
- vectorDrawables.useSupportLibrary = true
- }
- buildTypes {
- release {
- if (keystoreProperties['storeFile']) {
- signingConfig signingConfigs.release
- }
- minifyEnabled true
- shrinkResources true
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- debug {
- pseudoLocalesEnabled true
- }
- }
- defaultConfig {
- // We have to list all translated languages here, because some of our libs have bogus languages that google play
- // doesn't like and we need to strip them (gr)
- resConfigs "cs", "de", "el", "en", "es", "fi", "fr", "fr-rHT", "ga", "hu", "it", "ja", "ko", "nl", "nb", "pl", "pt", "pt-rBR", "ro", "ru", "sk", "sl", "sq", "sv", "tr", "zh", "uk"
-
- ndk {
- // abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
- }
- }
- buildFeatures {
- viewBinding true
- }
- buildFeatures {
- compose true
- }
- // Set both the Java and Kotlin compilers to target Java 8.
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
- kotlinOptions {
- jvmTarget = "1.8"
- freeCompilerArgs += ['-opt-in=kotlin.RequiresOptIn']
- }
- composeOptions {
- kotlinCompilerExtensionVersion compose_version
- }
- lint {
- abortOnError false
- }
- namespace 'com.geeksville.mesh'
-}
-
-play {
- // configure per https://github.com/Triple-T/gradle-play-publisher#authenticating-gradle-play-publisher
- track = 'internal'
- defaultToAppBundles = true
- serviceAccountCredentials = file("../../play-credentials.json")
-}
-
-// per protobuf-gradle-plugin docs, this is recommended for android
-protobuf {
- protoc {
- artifact = 'com.google.protobuf:protoc:3.21.1'
- }
- generateProtoTasks {
- all().each { task ->
- task.builtins {
- java {
- // turned off for now so I can use json printing in debug panel
- // use the smaller android version of the library
- //option "lite"
- }
- kotlin {
- }
- }
- }
- }
-}
-
-dependencies {
-
- implementation fileTree(dir: 'libs', include: ['*.jar'])
- def appcompat_version = '1.6.0-rc01'
- implementation "androidx.appcompat:appcompat:$appcompat_version"
- // For loading and tinting drawables on older versions of the platform
- implementation "androidx.appcompat:appcompat-resources:$appcompat_version"
-
- implementation 'androidx.core:core-ktx:1.8.0'
- implementation 'androidx.fragment:fragment-ktx:1.5.2'
- implementation 'androidx.cardview:cardview:1.0.0'
- implementation 'androidx.recyclerview:recyclerview:1.2.1'
- implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
- implementation 'com.google.android.material:material:1.6.1'
- implementation 'androidx.viewpager2:viewpager2:1.0.0'
-
- // Lifecycle
- implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
- implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version"
- implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
- implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
- implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
- implementation "androidx.lifecycle:lifecycle-process:$lifecycle_version"
-
- implementation "androidx.room:room-runtime:$room_version"
- kapt "androidx.room:room-compiler:$room_version"
- implementation "com.google.dagger:hilt-android:$hilt_version"
- kapt "com.google.dagger:hilt-compiler:$hilt_version"
- implementation "androidx.datastore:datastore:$datastore_version"
-
- // Compose
- implementation "androidx.compose.runtime:runtime:$compose_version"
- implementation "androidx.compose.ui:ui:$compose_version"
- implementation "androidx.compose.foundation:foundation:$compose_version"
- implementation "androidx.compose.foundation:foundation-layout:$compose_version"
- implementation "androidx.compose.material:material:$compose_version"
- implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
- implementation "androidx.compose.ui:ui-tooling:$compose_version"
- implementation "com.google.android.material:compose-theme-adapter:1.1.14"
-
- // Osmdroid & Maps
- implementation 'org.osmdroid:osmdroid-android:6.1.14'
- implementation 'com.github.MKergall:osmbonuspack:6.9.0'
- implementation 'org.osmdroid:osmdroid-wms:6.1.14'
- api 'mil.nga.mgrs:mgrs-android:2.2.0'
- implementation 'org.osmdroid:osmdroid-geopackage:6.1.14'
-
- // optional - Kotlin Extensions and Coroutines support for Room
- implementation "androidx.room:room-ktx:$room_version"
-
- // optional - Test helpers
- testImplementation "androidx.room:room-testing:$room_version"
- testImplementation 'junit:junit:4.13.2'
- androidTestImplementation 'androidx.test.ext:junit:1.1.3'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
-
- // kotlin serialization
- implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:1.0-M1-1.4.0-rc"
-
- // rate this app
- implementation 'com.suddenh4x.ratingdialog:awesome-app-rating:2.4.0'
-
- // Coroutines
- implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
- implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
-
- // For now I'm not using javalite, because I want JSON printing
- implementation 'com.google.protobuf:protobuf-kotlin:3.21.5'
-
- // For UART access
- // implementation 'com.google.android.things:androidthings:1.0'
- implementation 'com.github.mik3y:usb-serial-for-android:3.4.6'
-
- // Add the Firebase SDK for Crashlytics.
- implementation 'com.google.firebase:firebase-crashlytics:18.2.6'
- implementation 'com.google.firebase:firebase-analytics:20.1.0'
-
- // barcode support
- // per https://github.com/journeyapps/zxing-android-embedded#older-sdk-versions for minSdkVersion 21
- implementation('com.journeyapps:zxing-android-embedded:4.3.0') { transitive = false }
- //noinspection GradleDependency
- implementation 'com.google.zxing:core:3.3.0' // <-- don't update
-
- def work_version = '2.7.1'
- // Work Request - used to delay boot event handling
- implementation "androidx.work:work-runtime-ktx:$work_version"
-
- implementation "androidx.core:core-splashscreen:1.0.0-beta02"
-
- // App intro
- implementation 'com.github.AppIntro:AppIntro:6.2.0'
-}
-
-kapt {
- correctErrorTypes true
-}
-
-repositories {
- maven { url "https://jitpack.io" }
-}
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
new file mode 100644
index 000000000..d239d0530
--- /dev/null
+++ b/app/build.gradle.kts
@@ -0,0 +1,338 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+import com.android.build.api.dsl.ApplicationExtension
+import com.mikepenz.aboutlibraries.plugin.DuplicateMode
+import com.mikepenz.aboutlibraries.plugin.DuplicateRule
+import org.meshtastic.buildlogic.GitVersionValueSource
+import org.meshtastic.buildlogic.configProperties
+import java.io.FileInputStream
+import java.util.Properties
+
+val gitVersionProvider = providers.of(GitVersionValueSource::class.java) {}
+
+plugins {
+ alias(libs.plugins.meshtastic.android.application)
+ alias(libs.plugins.meshtastic.android.application.flavors)
+ alias(libs.plugins.meshtastic.android.application.compose)
+ id("meshtastic.koin")
+ alias(libs.plugins.kotlin.parcelize)
+ alias(libs.plugins.secrets)
+ alias(libs.plugins.aboutlibraries)
+ id("dev.mokkery")
+}
+
+val keystorePropertiesFile = rootProject.file("keystore.properties")
+val keystoreProperties = Properties()
+
+if (keystorePropertiesFile.exists()) {
+ FileInputStream(keystorePropertiesFile).use { keystoreProperties.load(it) }
+}
+
+configure {
+ namespace = "org.meshtastic.app"
+
+ signingConfigs {
+ create("release") {
+ keyAlias = keystoreProperties["keyAlias"] as String?
+ keyPassword = keystoreProperties["keyPassword"] as String?
+ storeFile = keystoreProperties["storeFile"]?.let { file(it) }
+ storePassword = keystoreProperties["storePassword"] as String?
+ }
+ }
+ defaultConfig {
+ applicationId = configProperties.getProperty("APPLICATION_ID")
+
+ val vcOffset = configProperties.getProperty("VERSION_CODE_OFFSET")?.toInt() ?: 0
+ println("Version code offset: $vcOffset")
+ versionCode =
+ (
+ project.findProperty("android.injected.version.code")?.toString()?.toInt()
+ ?: System.getenv("VERSION_CODE")?.toInt()
+ ?: (gitVersionProvider.get().toInt() + vcOffset)
+ )
+ versionName =
+ (
+ project.findProperty("android.injected.version.name")?.toString()
+ ?: System.getenv("VERSION_NAME")
+ ?: configProperties.getProperty("VERSION_NAME_BASE")
+ )
+ buildConfigField("String", "MIN_FW_VERSION", "\"${configProperties.getProperty("MIN_FW_VERSION")}\"")
+ buildConfigField("String", "ABS_MIN_FW_VERSION", "\"${configProperties.getProperty("ABS_MIN_FW_VERSION")}\"")
+ // We have to list all translated languages here,
+ // because some of our libs have bogus languages that google play
+ // doesn't like and we need to strip them (gr)
+ @Suppress("UnstableApiUsage")
+ val ci = project.findProperty("ci")?.toString()?.toBoolean() ?: false
+ if (ci) {
+ println("CI build detected - limiting locale filters for faster packaging")
+ androidResources.localeFilters.addAll(listOf("en"))
+ } else {
+ androidResources.localeFilters.addAll(
+ listOf(
+ "en",
+ "ar",
+ "bg",
+ "ca",
+ "cs",
+ "de",
+ "el",
+ "es",
+ "et",
+ "fi",
+ "fr",
+ "ga",
+ "gl",
+ "hr",
+ "ht",
+ "hu",
+ "is",
+ "it",
+ "iw",
+ "ja",
+ "ko",
+ "lt",
+ "nl",
+ "no",
+ "pl",
+ "pt",
+ "pt-rBR",
+ "ro",
+ "ru",
+ "sk",
+ "sl",
+ "sq",
+ "sr",
+ "srp",
+ "sv",
+ "tr",
+ "uk",
+ "zh-rCN",
+ "zh-rTW",
+ ),
+ )
+ }
+ ndk { abiFilters += listOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64") }
+
+ val disableSplits =
+ project.gradle.startParameter.taskNames.any {
+ it.contains("bundle", ignoreCase = true) || it.contains("google", ignoreCase = true)
+ }
+
+ // Enable ABI splits to generate smaller APKs per architecture for F-Droid/IzzyOnDroid
+ splits {
+ abi {
+ isEnable = !disableSplits
+ reset()
+ include("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
+ isUniversalApk = true
+ }
+ }
+
+ dependenciesInfo {
+ // Disables dependency metadata when building APKs (for IzzyOnDroid/F-Droid)
+ includeInApk = false
+ // Disables dependency metadata when building Android App Bundles (for Google Play)
+ includeInBundle = false
+ }
+
+ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
+ }
+
+ // Configure existing product flavors (defined by convention plugin)
+ // with their dynamic version names.
+ productFlavors {
+ configureEach {
+ versionName = "${defaultConfig.versionName} (${defaultConfig.versionCode}) $name"
+ if (name == "google") {
+ manifestPlaceholders["MAPS_API_KEY"] = "dummy"
+ }
+ }
+ }
+
+ buildTypes {
+ release {
+ if (keystoreProperties["storeFile"] != null) {
+ signingConfig = signingConfigs.named("release").get()
+ } else {
+ signingConfig = signingConfigs.getByName("debug")
+ }
+ isDebuggable = false
+ }
+ }
+ bundle { language { enableSplit = false } }
+
+ testOptions { unitTests { isIncludeAndroidResources = true } }
+}
+
+secrets {
+ defaultPropertiesFileName = "secrets.defaults.properties"
+ propertiesFileName = "secrets.properties"
+}
+
+androidComponents {
+ onVariants(selector().withBuildType("debug")) { variant ->
+ variant.flavorName?.let { flavor -> variant.applicationId = "com.geeksville.mesh.$flavor.debug" }
+ }
+
+ onVariants(selector().withBuildType("release")) { variant ->
+ if (variant.flavorName == "google") {
+ val variantNameCapped = variant.name.replaceFirstChar { it.uppercase() }
+ val minifyTaskName = "minify${variantNameCapped}WithR8"
+ val uploadTaskName = "uploadMapping$variantNameCapped"
+ if (project.tasks.findByName(uploadTaskName) != null && project.tasks.findByName(minifyTaskName) != null) {
+ tasks.named(minifyTaskName).configure { finalizedBy(uploadTaskName) }
+ }
+ }
+ }
+}
+
+project.afterEvaluate {
+ logger.lifecycle(
+ "Version code is set to: ${extensions.getByType().defaultConfig.versionCode}",
+ )
+}
+
+dependencies {
+ implementation(projects.core.ble)
+ implementation(projects.core.common)
+ implementation(projects.core.data)
+ implementation(projects.core.database)
+ implementation(projects.core.datastore)
+ implementation(projects.core.di)
+ implementation(projects.core.domain)
+ implementation(projects.core.model)
+ implementation(projects.core.navigation)
+ implementation(libs.jetbrains.lifecycle.viewmodel.navigation3)
+ implementation(projects.core.network)
+ implementation(projects.core.nfc)
+ implementation(projects.core.prefs)
+ implementation(projects.core.proto)
+ implementation(projects.core.service)
+ implementation(projects.core.resources)
+ implementation(projects.core.ui)
+ implementation(projects.core.barcode)
+ implementation(projects.core.takserver)
+ implementation(projects.feature.intro)
+ implementation(projects.feature.messaging)
+ implementation(projects.feature.connections)
+ implementation(projects.feature.map)
+ implementation(projects.feature.node)
+ implementation(projects.feature.settings)
+ implementation(projects.feature.firmware)
+ implementation(projects.feature.wifiProvision)
+ implementation(projects.feature.widget)
+
+ implementation(libs.jetbrains.compose.material3.adaptive)
+ implementation(libs.jetbrains.compose.material3.adaptive.layout)
+ implementation(libs.jetbrains.compose.material3.adaptive.navigation)
+ implementation(libs.material)
+ implementation(libs.compose.multiplatform.animation)
+ implementation(libs.compose.multiplatform.material3)
+ implementation(libs.compose.multiplatform.ui.tooling.preview)
+ implementation(libs.compose.multiplatform.ui)
+ implementation(libs.androidx.glance.appwidget)
+ implementation(libs.androidx.glance.appwidget.preview)
+ implementation(libs.androidx.glance.material3)
+ implementation(libs.androidx.lifecycle.process)
+ implementation(libs.jetbrains.lifecycle.viewmodel.compose)
+ implementation(libs.jetbrains.lifecycle.runtime.compose)
+ implementation(libs.jetbrains.navigation3.ui)
+ implementation(libs.ktor.client.android)
+ implementation(libs.ktor.client.content.negotiation)
+ implementation(libs.ktor.serialization.kotlinx.json)
+ implementation(libs.ktor.client.logging)
+ implementation(libs.coil)
+ implementation(libs.coil.network.ktor3)
+ implementation(libs.coil.svg)
+ implementation(libs.androidx.core.splashscreen)
+ implementation(libs.kotlinx.serialization.json)
+ implementation(libs.usb.serial.android)
+ implementation(libs.androidx.work.runtime.ktx)
+ implementation(libs.koin.android)
+ implementation(libs.koin.compose.viewmodel)
+ implementation(libs.koin.androidx.workmanager)
+ implementation(libs.koin.annotations)
+ implementation(libs.accompanist.permissions)
+ implementation(libs.kermit)
+ implementation(libs.kotlinx.datetime)
+
+ debugImplementation(libs.androidx.compose.ui.test.manifest)
+ debugImplementation(libs.androidx.glance.preview)
+
+ googleImplementation(libs.location.services)
+ googleImplementation(libs.play.services.maps)
+ googleImplementation(libs.maps.compose)
+ googleImplementation(libs.maps.compose.utils)
+ googleImplementation(libs.maps.compose.widgets)
+ googleImplementation(libs.dd.sdk.android.logs)
+ googleImplementation(libs.dd.sdk.android.rum)
+ googleImplementation(libs.dd.sdk.android.session.replay)
+ googleImplementation(libs.dd.sdk.android.session.replay.material)
+ googleImplementation(libs.dd.sdk.android.timber)
+ googleImplementation(libs.dd.sdk.android.trace)
+ googleImplementation(libs.dd.sdk.android.trace.otel)
+ googleImplementation(platform(libs.firebase.bom))
+ googleImplementation(libs.firebase.analytics)
+ googleImplementation(libs.firebase.crashlytics)
+
+ fdroidImplementation(libs.osmdroid.android)
+ fdroidImplementation(libs.osmdroid.geopackage) { exclude(group = "com.j256.ormlite") }
+ fdroidImplementation(libs.osmbonuspack)
+
+ testImplementation(kotlin("test-junit"))
+ testImplementation(libs.androidx.work.testing)
+ testImplementation(libs.koin.test)
+ testRuntimeOnly(libs.junit.vintage.engine)
+ testImplementation(libs.kotlinx.coroutines.test)
+ testImplementation(libs.robolectric)
+ testImplementation(libs.androidx.test.core)
+ testImplementation(libs.compose.multiplatform.ui.test)
+ testImplementation(libs.androidx.test.ext.junit)
+ testImplementation(libs.androidx.glance.appwidget)
+}
+
+aboutLibraries {
+ // Run offline by default to avoid burning GitHub API calls on every build.
+ // Release builds pass -PaboutLibraries.release=true to fetch full license text + funding info.
+ val isReleaseBuild = providers.gradleProperty("aboutLibraries.release").map { it.toBoolean() }.getOrElse(false)
+ val ghToken = providers.environmentVariable("GITHUB_TOKEN")
+
+ offlineMode = !isReleaseBuild
+
+ collect {
+ fetchRemoteLicense = isReleaseBuild && ghToken.isPresent
+ fetchRemoteFunding = isReleaseBuild && ghToken.isPresent
+ if (ghToken.isPresent) {
+ gitHubApiToken = ghToken.get()
+ }
+ }
+ export {
+ excludeFields = listOf("generated")
+ outputFile = file("src/main/resources/aboutlibraries.json")
+ }
+ library {
+ duplicationMode = DuplicateMode.MERGE
+ duplicationRule = DuplicateRule.SIMPLE
+ }
+}
+
+// Ensure aboutlibraries.json is always up-to-date during the build.
+// This is required since AboutLibraries v11+ no longer auto-exports.
+tasks
+ .matching { it.name.startsWith("process") && it.name.endsWith("Resources") }
+ .configureEach { dependsOn("exportLibraryDefinitions") }
diff --git a/app/detekt-baseline.xml b/app/detekt-baseline.xml
new file mode 100644
index 000000000..c373eea43
--- /dev/null
+++ b/app/detekt-baseline.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/app/google-services-example.json b/app/google-services-example.json
deleted file mode 100644
index c1161dacc..000000000
--- a/app/google-services-example.json
+++ /dev/null
@@ -1,40 +0,0 @@
-{
- "project_info": {
- "project_number": "1111",
- "firebase_url": "https://xxx.firebaseio.com",
- "project_id": "xxx",
- "storage_bucket": "xxx.appspot.com"
- },
- "client": [
- {
- "client_info": {
- "mobilesdk_app_id": "1:xxx:android:1111",
- "android_client_info": {
- "package_name": "com.geeksville.mesh"
- }
- },
- "oauth_client": [
- {
- "client_id": "111-xxx.apps.googleusercontent.com",
- "client_type": 3
- }
- ],
- "api_key": [
- {
- "current_key": "xxx-c"
- }
- ],
- "services": {
- "appinvite_service": {
- "other_platform_oauth_client": [
- {
- "client_id": "111-xxx.apps.googleusercontent.com",
- "client_type": 3
- }
- ]
- }
- }
- }
- ],
- "configuration_version": "1"
-}
\ No newline at end of file
diff --git a/app/google-services.json b/app/google-services.json
deleted file mode 120000
index 0caed9a6f..000000000
--- a/app/google-services.json
+++ /dev/null
@@ -1 +0,0 @@
-../../google-services.json
\ No newline at end of file
diff --git a/app/google-services.json b/app/google-services.json
new file mode 100644
index 000000000..73d076ce6
--- /dev/null
+++ b/app/google-services.json
@@ -0,0 +1,67 @@
+{
+ "project_info": {
+ "project_number": "1111",
+ "firebase_url": "https://xxx.firebaseio.com",
+ "project_id": "xxx",
+ "storage_bucket": "xxx.appspot.com"
+ },
+ "client": [
+ {
+ "client_info": {
+ "mobilesdk_app_id": "1:xxx:android:1111",
+ "android_client_info": {
+ "package_name": "com.geeksville.mesh"
+ }
+ },
+ "oauth_client": [
+ {
+ "client_id": "111-xxx.apps.googleusercontent.com",
+ "client_type": 1,
+ "android_info": {
+ "package_name": "com.geeksville.mesh"
+ }
+ },
+ {
+ "client_id": "111-xxx.apps.googleusercontent.com",
+ "client_type": 1,
+ "android_info": {
+ "package_name": "com.geeksville.mesh"
+ }
+ },
+ {
+ "client_id": "111-xxx.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ],
+ "api_key": [
+ {
+ "current_key": "APlaceholderAPIKeyWith-ThirtyNineCharsX"
+ }
+ ],
+ "services": {
+ "appinvite_service": {
+ "other_platform_oauth_client": [
+ {
+ "client_id": "111-xxx.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ]
+ }
+ }
+ },
+ {
+ "client_info": {
+ "mobilesdk_app_id": "1:xxx:android:1111",
+ "android_client_info": {
+ "package_name": "com.geeksville.mesh.google.debug"
+ }
+ },
+ "api_key": [
+ {
+ "current_key": "APlaceholderAPIKeyWith-ThirtyNineCharsX"
+ }
+ ]
+ }
+ ],
+ "configuration_version": "1"
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
index 45e42cc0e..de2b3144c 100644
--- a/app/proguard-rules.pro
+++ b/app/proguard-rules.pro
@@ -1,47 +1,45 @@
-# Add project specific ProGuard rules here.
-# You can control the set of applied configuration files using the
-# proguardFiles setting in build.gradle.
+# ============================================================================
+# Meshtastic Android — ProGuard / R8 rules for release minification
+# ============================================================================
+# Open-source project: obfuscation and optimization are disabled. We rely on
+# tree-shaking (unused code removal) for APK size reduction.
#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
+# Cross-platform library rules (Koin, kotlinx-serialization, Wire, Room,
+# Ktor, Coil, Kable, Kermit, Okio, DataStore, Paging, Lifecycle, Navigation 3,
+# AboutLibraries, Markdown, QRCode, CMP resources, core model) live in
+# config/proguard/shared-rules.pro and are wired in by the
+# AndroidApplicationConventionPlugin. This file holds only Android-specific
+# rules and R8-only directives.
+# ============================================================================
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
+# ---- General ----------------------------------------------------------------
-# Uncomment this to preserve the line number information for
-# debugging stack traces.
-#-keepattributes SourceFile,LineNumberTable
-
-# If you keep the line number information, uncomment this to
-# hide the original source file name.
-#-renamesourcefileattribute SourceFile
-
-# per https://medium.com/@kenkyee/android-kotlin-coroutine-best-practices-bc033fed62e7
--keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
--keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}
--keepclassmembernames class kotlinx.** { volatile ; }
-
-# Needed for protobufs
--keepclassmembers class * extends com.google.protobuf.GeneratedMessageV3 { ; }
--keep class com.geeksville.mesh.**{*;}
--keepclassmembers class * extends com.google.protobuf.GeneratedMessageLite { ; }
-
-
-# for kotlinx.serialization
--keepattributes *Annotation*, InnerClasses
--dontnote kotlinx.serialization.SerializationKt
--keep,includedescriptorclasses class com.geeksville.mesh.**$$serializer { *; }
--keepclassmembers class com.geeksville.mesh.** {
- *** Companion;
-}
--keepclasseswithmembers class com.geeksville.mesh.** {
- kotlinx.serialization.KSerializer serializer(...);
-}
-
-# Our app is opensource no need to obsfucate
+# Open-source — no need to obfuscate
-dontobfuscate
--optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable
\ No newline at end of file
+
+# Disable R8 optimization passes. Tree-shaking (unused code removal) still
+# runs — only method-body rewrites and call-site transformations are suppressed.
+#
+# Why: CMP 1.11 ships consumer rules with -assumenosideeffects on
+# Composer.() and ComposerImpl.(), plus -assumevalues on
+# ComposeRuntimeFlags and ComposeStackTraceMode. These optimization directives
+# let R8 rewrite *call sites* (class-init triggers, flag reads) even when the
+# target classes are preserved by -keep rules. The result is that the Compose
+# recomposer/frame-clock/animation state machines silently freeze on their
+# first frame in release builds. -dontoptimize is the only directive that
+# disables processing of -assumenosideeffects/-assumevalues. See #5146.
+-dontoptimize
+
+# Dump the full merged R8 configuration (app rules + all library consumer rules)
+# for auditing. Inspect this file after a release build to see what libraries inject.
+-printconfiguration build/outputs/mapping/r8-merged-config.txt
+
+# ---- Networking (transitive references from Ktor on Android) ----------------
+
+-dontwarn org.conscrypt.**
+-dontwarn org.bouncycastle.**
+-dontwarn org.openjsse.**
+
+# Compose runtime/ui/animation/foundation/material3 keep rules now live in
+# config/proguard/shared-rules.pro so both Android (R8) and desktop (ProGuard)
+# get the same defence-in-depth coverage against CMP 1.11 optimizer folding.
diff --git a/app/special/curfirmwareversion.xml b/app/special/curfirmwareversion.xml
deleted file mode 100644
index efe170b9c..000000000
--- a/app/special/curfirmwareversion.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
- 0.2.0.abcdefg
- 0.2.0
-
diff --git a/app/src/androidTest/java/com/geeksville/mesh/ChannelTest.kt b/app/src/androidTest/java/com/geeksville/mesh/ChannelTest.kt
deleted file mode 100644
index adb8e32c2..000000000
--- a/app/src/androidTest/java/com/geeksville/mesh/ChannelTest.kt
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.geeksville.mesh
-
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import com.geeksville.mesh.model.Channel
-import org.junit.Assert
-import org.junit.Test
-import org.junit.runner.RunWith
-
-@RunWith(AndroidJUnit4::class)
-class ChannelTest {
- @Test
- fun channelUrlGood() {
- val ch = Channel.emulated
-
- Assert.assertTrue(ch.getChannelUrl().toString().startsWith(Channel.prefix))
- Assert.assertEquals(Channel(ch.getChannelUrl()), ch)
- }
-}
\ No newline at end of file
diff --git a/app/src/androidTest/java/com/geeksville/mesh/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/geeksville/mesh/ExampleInstrumentedTest.kt
deleted file mode 100644
index 2e96d2f76..000000000
--- a/app/src/androidTest/java/com/geeksville/mesh/ExampleInstrumentedTest.kt
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.geeksville.mesh
-
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import androidx.test.platform.app.InstrumentationRegistry
-import org.junit.Assert.assertEquals
-import org.junit.Test
-import org.junit.runner.RunWith
-
-/**
- * Instrumented test, which will execute on an Android device.
- *
- * See [testing documentation](http://d.android.com/tools/testing).
- */
-@RunWith(AndroidJUnit4::class)
-class ExampleInstrumentedTest {
- @Test
- fun useAppContext() {
- // Context of the app under test.
- val appContext = InstrumentationRegistry.getInstrumentation().targetContext
- assertEquals("com.geeksville.mesh", appContext.packageName)
- }
-}
diff --git a/app/src/fdroid/java/org/meshtastic/app/map/cluster/MarkerClusterer.java b/app/src/fdroid/java/org/meshtastic/app/map/cluster/MarkerClusterer.java
new file mode 100644
index 000000000..38e51da52
--- /dev/null
+++ b/app/src/fdroid/java/org/meshtastic/app/map/cluster/MarkerClusterer.java
@@ -0,0 +1,216 @@
+/*
+ * Copyright (c) 2025 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package org.meshtastic.app.map.cluster;
+
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Point;
+import android.view.MotionEvent;
+
+import org.meshtastic.app.map.model.MarkerWithLabel;
+
+import org.osmdroid.util.BoundingBox;
+import org.osmdroid.views.MapView;
+import org.osmdroid.views.overlay.Overlay;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.ListIterator;
+
+/**
+ * An overlay allowing to perform markers clustering.
+ * Usage: put your markers inside with add(Marker), and add the MarkerClusterer to the map overlays.
+ * Depending on the zoom level, markers will be displayed separately, or grouped as a single Marker.
+ *
+ * This abstract class provides the framework. Sub-classes have to implement the clustering algorithm,
+ * and the rendering of a cluster.
+ *
+ * @author M.Kergall
+ *
+ */
+public abstract class MarkerClusterer extends Overlay {
+
+ /** impossible value for zoom level, to force clustering */
+ protected static final int FORCE_CLUSTERING = -1;
+
+ protected ArrayList mItems = new ArrayList();
+ protected Point mPoint = new Point();
+ protected ArrayList mClusters = new ArrayList();
+ protected int mLastZoomLevel;
+ protected Bitmap mClusterIcon;
+ protected String mName, mDescription;
+
+ // abstract methods:
+
+ /** clustering algorithm */
+ public abstract ArrayList clusterer(MapView mapView);
+ /** Build the marker for a cluster. */
+ public abstract MarkerWithLabel buildClusterMarker(StaticCluster cluster, MapView mapView);
+ /** build clusters markers to be used at next draw */
+ public abstract void renderer(ArrayList clusters, Canvas canvas, MapView mapView);
+
+ public MarkerClusterer() {
+ super();
+ mLastZoomLevel = FORCE_CLUSTERING;
+ }
+
+ public void setName(String name){
+ mName = name;
+ }
+
+ public String getName(){
+ return mName;
+ }
+
+ public void setDescription(String description){
+ mDescription = description;
+ }
+
+ public String getDescription(){
+ return mDescription;
+ }
+
+ /** Set the cluster icon to be drawn when a cluster contains more than 1 marker.
+ * If not set, default will be the default osmdroid marker icon (which is really inappropriate as a cluster icon). */
+ public void setIcon(Bitmap icon){
+ mClusterIcon = icon;
+ }
+
+ /** Add the Marker.
+ * Important: Markers added in a MarkerClusterer should not be added in the map overlays. */
+ public void add(MarkerWithLabel marker){
+ mItems.add(marker);
+ }
+
+ /** Force a rebuild of clusters at next draw, even without a zooming action.
+ * Should be done when you changed the content of a MarkerClusterer. */
+ public void invalidate(){
+ mLastZoomLevel = FORCE_CLUSTERING;
+ }
+
+ /** @return the Marker at id (starting at 0) */
+ public MarkerWithLabel getItem(int id){
+ return mItems.get(id);
+ }
+
+ /** @return the list of Markers. */
+ public ArrayList getItems(){
+ return mItems;
+ }
+
+ protected void hideInfoWindows(){
+ for (MarkerWithLabel m : mItems){
+ if (m.isInfoWindowShown())
+ m.closeInfoWindow();
+ }
+ }
+
+ @Override public void draw(Canvas canvas, MapView mapView, boolean shadow) {
+ if (shadow)
+ return;
+ //if zoom has changed and mapView is now stable, rebuild clusters:
+ int zoomLevel = mapView.getZoomLevel();
+ if (zoomLevel != mLastZoomLevel && !mapView.isAnimating()){
+ hideInfoWindows();
+ mClusters = clusterer(mapView);
+ renderer(mClusters, canvas, mapView);
+ mLastZoomLevel = zoomLevel;
+ }
+
+ for (StaticCluster cluster:mClusters){
+ MarkerWithLabel marker = cluster.getMarker();
+ marker.draw(canvas, mapView, false);
+ }
+ }
+
+ public Iterable reversedClusters() {
+ return new Iterable() {
+ @Override
+ public Iterator iterator() {
+ final ListIterator i = mClusters.listIterator(mClusters.size());
+ return new Iterator() {
+ @Override
+ public boolean hasNext() {
+ return i.hasPrevious();
+ }
+
+ @Override
+ public StaticCluster next() {
+ return i.previous();
+ }
+
+ @Override
+ public void remove() {
+ i.remove();
+ }
+ };
+ }
+ };
+ }
+
+ @Override public boolean onSingleTapConfirmed(final MotionEvent event, final MapView mapView){
+ for (final StaticCluster cluster : reversedClusters()) {
+ if (cluster.getMarker().onSingleTapConfirmed(event, mapView))
+ return true;
+ }
+ return false;
+ }
+
+ @Override public boolean onLongPress(final MotionEvent event, final MapView mapView) {
+ for (final StaticCluster cluster : reversedClusters()) {
+ if (cluster.getMarker().onLongPress(event, mapView))
+ return true;
+ }
+ return false;
+ }
+
+ @Override public boolean onTouchEvent(final MotionEvent event, final MapView mapView) {
+ for (StaticCluster cluster : reversedClusters()) {
+ if (cluster.getMarker().onTouchEvent(event, mapView))
+ return true;
+ }
+ return false;
+ }
+
+ @Override public boolean onDoubleTap(final MotionEvent event, final MapView mapView) {
+ for (final StaticCluster cluster : reversedClusters()) {
+ if (cluster.getMarker().onDoubleTap(event, mapView))
+ return true;
+ }
+ return false;
+ }
+
+ @Override public BoundingBox getBounds(){
+ if (mItems.size() == 0)
+ return null;
+ double minLat = Double.MAX_VALUE;
+ double minLon = Double.MAX_VALUE;
+ double maxLat = -Double.MAX_VALUE;
+ double maxLon = -Double.MAX_VALUE;
+ for (final MarkerWithLabel item : mItems) {
+ final double latitude = item.getPosition().getLatitude();
+ final double longitude = item.getPosition().getLongitude();
+ minLat = Math.min(minLat, latitude);
+ minLon = Math.min(minLon, longitude);
+ maxLat = Math.max(maxLat, latitude);
+ maxLon = Math.max(maxLon, longitude);
+ }
+ return new BoundingBox(maxLat, maxLon, minLat, minLon);
+ }
+
+}
diff --git a/app/src/fdroid/java/org/meshtastic/app/map/cluster/RadiusMarkerClusterer.java b/app/src/fdroid/java/org/meshtastic/app/map/cluster/RadiusMarkerClusterer.java
new file mode 100644
index 000000000..e2710352a
--- /dev/null
+++ b/app/src/fdroid/java/org/meshtastic/app/map/cluster/RadiusMarkerClusterer.java
@@ -0,0 +1,213 @@
+/*
+ * Copyright (c) 2025 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package org.meshtastic.app.map.cluster;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.Rect;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
+import android.view.MotionEvent;
+
+import org.meshtastic.app.map.model.MarkerWithLabel;
+
+import org.osmdroid.bonuspack.R;
+import org.osmdroid.util.BoundingBox;
+import org.osmdroid.util.GeoPoint;
+import org.osmdroid.views.MapView;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * Radius-based Clustering algorithm:
+ * create a cluster using the first point from the cloned list.
+ * All points that are found within the neighborhood are added to this cluster.
+ * Then all the neighbors and the main point are removed from the list of points.
+ * It continues until the list is empty.
+ *
+ * Largely inspired from GridMarkerClusterer by M.Kergall
+ *
+ * @author sidorovroman92@gmail.com
+ */
+
+public class RadiusMarkerClusterer extends MarkerClusterer {
+
+ protected int mMaxClusteringZoomLevel = 7;
+ protected int mRadiusInPixels = 100;
+ protected double mRadiusInMeters;
+ protected Paint mTextPaint;
+ private ArrayList mClonedMarkers;
+ protected boolean mAnimated;
+ int mDensityDpi;
+
+ /** cluster icon anchor */
+ public float mAnchorU = MarkerWithLabel.ANCHOR_CENTER, mAnchorV = MarkerWithLabel.ANCHOR_CENTER;
+ /** anchor point to draw the number of markers inside the cluster icon */
+ public float mTextAnchorU = MarkerWithLabel.ANCHOR_CENTER, mTextAnchorV = MarkerWithLabel.ANCHOR_CENTER;
+
+ public RadiusMarkerClusterer(Context ctx) {
+ super();
+ mTextPaint = new Paint();
+ mTextPaint.setColor(Color.WHITE);
+ mTextPaint.setTextSize(15 * ctx.getResources().getDisplayMetrics().density);
+ mTextPaint.setFakeBoldText(true);
+ mTextPaint.setTextAlign(Paint.Align.CENTER);
+ mTextPaint.setAntiAlias(true);
+ Drawable clusterIconD = ctx.getResources().getDrawable(R.drawable.marker_cluster);
+ Bitmap clusterIcon = ((BitmapDrawable) clusterIconD).getBitmap();
+ setIcon(clusterIcon);
+ mAnimated = true;
+ mDensityDpi = ctx.getResources().getDisplayMetrics().densityDpi;
+ }
+
+ /** If you want to change the default text paint (color, size, font) */
+ public Paint getTextPaint(){
+ return mTextPaint;
+ }
+
+ /** Set the radius of clustering in pixels. Default is 100px. */
+ public void setRadius(int radius){
+ mRadiusInPixels = radius;
+ }
+
+ /** Set max zoom level with clustering. When zoom is higher or equal to this level, clustering is disabled.
+ * You can put a high value to disable this feature. */
+ public void setMaxClusteringZoomLevel(int zoom){
+ mMaxClusteringZoomLevel = zoom;
+ }
+
+ /** Radius-Based clustering algorithm */
+ @Override public ArrayList clusterer(MapView mapView) {
+
+ ArrayList clusters = new ArrayList();
+ convertRadiusToMeters(mapView);
+
+ mClonedMarkers = new ArrayList(mItems); //shallow copy
+ while (!mClonedMarkers.isEmpty()) {
+ MarkerWithLabel m = mClonedMarkers.get(0);
+ StaticCluster cluster = createCluster(m, mapView);
+ clusters.add(cluster);
+ }
+ return clusters;
+ }
+
+ private StaticCluster createCluster(MarkerWithLabel m, MapView mapView) {
+ GeoPoint clusterPosition = m.getPosition();
+
+ StaticCluster cluster = new StaticCluster(clusterPosition);
+ cluster.add(m);
+
+ mClonedMarkers.remove(m);
+
+ if (mapView.getZoomLevel() > mMaxClusteringZoomLevel) {
+ //above max level => block clustering:
+ return cluster;
+ }
+
+ Iterator it = mClonedMarkers.iterator();
+ while (it.hasNext()) {
+ MarkerWithLabel neighbor = it.next();
+ double distance = clusterPosition.distanceToAsDouble(neighbor.getPosition());
+ if (distance <= mRadiusInMeters) {
+ cluster.add(neighbor);
+ it.remove();
+ }
+ }
+
+ return cluster;
+ }
+
+ @Override public MarkerWithLabel buildClusterMarker(StaticCluster cluster, MapView mapView) {
+ MarkerWithLabel m = new MarkerWithLabel(mapView, "", null);
+ m.setPosition(cluster.getPosition());
+ m.setInfoWindow(null);
+ m.setAnchor(mAnchorU, mAnchorV);
+
+ Bitmap finalIcon = Bitmap.createBitmap(mClusterIcon.getScaledWidth(mDensityDpi),
+ mClusterIcon.getScaledHeight(mDensityDpi), mClusterIcon.getConfig());
+ Canvas iconCanvas = new Canvas(finalIcon);
+ iconCanvas.drawBitmap(mClusterIcon, 0, 0, null);
+ String text = "" + cluster.getSize();
+ int textHeight = (int) (mTextPaint.descent() + mTextPaint.ascent());
+ iconCanvas.drawText(text,
+ mTextAnchorU * finalIcon.getWidth(),
+ mTextAnchorV * finalIcon.getHeight() - textHeight / 2,
+ mTextPaint);
+ m.setIcon(new BitmapDrawable(mapView.getContext().getResources(), finalIcon));
+
+ return m;
+ }
+
+ @Override public void renderer(ArrayList clusters, Canvas canvas, MapView mapView) {
+ for (StaticCluster cluster : clusters) {
+ if (cluster.getSize() == 1) {
+ //cluster has only 1 marker => use it as it is:
+ cluster.setMarker(cluster.getItem(0));
+ } else {
+ //only draw 1 Marker at Cluster center, displaying number of Markers contained
+ MarkerWithLabel m = buildClusterMarker(cluster, mapView);
+ cluster.setMarker(m);
+ }
+ }
+ }
+
+ private void convertRadiusToMeters(MapView mapView) {
+
+ Rect mScreenRect = mapView.getIntrinsicScreenRect(null);
+
+ int screenWidth = mScreenRect.right - mScreenRect.left;
+ int screenHeight = mScreenRect.bottom - mScreenRect.top;
+
+ BoundingBox bb = mapView.getBoundingBox();
+
+ double diagonalInMeters = bb.getDiagonalLengthInMeters();
+ double diagonalInPixels = Math.sqrt(screenWidth * screenWidth + screenHeight * screenHeight);
+ double metersInPixel = diagonalInMeters / diagonalInPixels;
+
+ mRadiusInMeters = mRadiusInPixels * metersInPixel;
+ }
+
+ public void setAnimation(boolean animate){
+ mAnimated = animate;
+ }
+
+ public void zoomOnCluster(MapView mapView, StaticCluster cluster){
+ BoundingBox bb = cluster.getBoundingBox();
+ if (bb.getLatNorth()!=bb.getLatSouth() || bb.getLonEast()!=bb.getLonWest()) {
+ bb = bb.increaseByScale(2.3f);
+ mapView.zoomToBoundingBox(bb, true);
+ } else //all points exactly at the same place:
+ mapView.setExpectedCenter(bb.getCenterWithDateLine());
+ }
+
+ @Override public boolean onSingleTapConfirmed(final MotionEvent event, final MapView mapView){
+ for (final StaticCluster cluster : reversedClusters()) {
+ if (cluster.getMarker().onSingleTapConfirmed(event, mapView)) {
+ if (mAnimated && cluster.getSize() > 1)
+ zoomOnCluster(mapView, cluster);
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/app/src/fdroid/java/org/meshtastic/app/map/cluster/StaticCluster.java b/app/src/fdroid/java/org/meshtastic/app/map/cluster/StaticCluster.java
new file mode 100644
index 000000000..324a34b52
--- /dev/null
+++ b/app/src/fdroid/java/org/meshtastic/app/map/cluster/StaticCluster.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2025 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package org.meshtastic.app.map.cluster;
+
+import org.meshtastic.app.map.model.MarkerWithLabel;
+
+import org.osmdroid.util.BoundingBox;
+import org.osmdroid.util.GeoPoint;
+
+import java.util.ArrayList;
+
+/**
+ * Cluster of Markers.
+ * @author M.Kergall
+ */
+public class StaticCluster {
+ protected final ArrayList mItems = new ArrayList();
+ protected GeoPoint mCenter;
+ protected MarkerWithLabel mMarker;
+
+ public StaticCluster(GeoPoint center) {
+ mCenter = center;
+ }
+
+ public void setPosition(GeoPoint center){
+ mCenter = center;
+ }
+
+ public GeoPoint getPosition() {
+ return mCenter;
+ }
+
+ public int getSize() {
+ return mItems.size();
+ }
+
+ public MarkerWithLabel getItem(int index) {
+ return mItems.get(index);
+ }
+
+ public boolean add(MarkerWithLabel t) {
+ return mItems.add(t);
+ }
+
+ /** set the Marker to be displayed for this cluster */
+ public void setMarker(MarkerWithLabel marker){
+ mMarker = marker;
+ }
+
+ /** @return the Marker to be displayed for this cluster */
+ public MarkerWithLabel getMarker(){
+ return mMarker;
+ }
+
+ public BoundingBox getBoundingBox(){
+ if (getSize()==0)
+ return null;
+ GeoPoint p = getItem(0).getPosition();
+ BoundingBox bb = new BoundingBox(p.getLatitude(), p.getLongitude(), p.getLatitude(), p.getLongitude());
+ for (int i=1; i .
+ */
+package org.meshtastic.app.analytics
+
+import co.touchlab.kermit.Logger
+import co.touchlab.kermit.Severity
+import org.koin.core.annotation.Single
+import org.meshtastic.app.BuildConfig
+import org.meshtastic.core.repository.DataPair
+import org.meshtastic.core.repository.PlatformAnalytics
+
+/**
+ * F-Droid specific implementation of [PlatformAnalytics]. This provides no-op implementations for analytics and other
+ * platform services.
+ */
+@Single
+class FdroidPlatformAnalytics : PlatformAnalytics {
+ init {
+ // For F-Droid builds we don't initialize external analytics services.
+ // In debug builds we attach a DebugTree for convenient local logging, but
+ // release builds rely on system logging only.
+ if (BuildConfig.DEBUG) {
+ Logger.setMinSeverity(Severity.Debug)
+ Logger.i { "F-Droid platform no-op analytics initialized (Debug mode)." }
+ } else {
+ Logger.setMinSeverity(Severity.Info)
+ Logger.i { "F-Droid platform no-op analytics initialized." }
+ }
+ }
+
+ override fun setDeviceAttributes(firmwareVersion: String, model: String) {
+ // No-op for F-Droid
+ Logger.d { "Set device attributes called: firmwareVersion=$firmwareVersion, deviceHardware=$model" }
+ }
+
+ override val isPlatformServicesAvailable: Boolean
+ get() = false
+
+ override fun track(event: String, vararg properties: DataPair) {
+ Logger.d { "Track called: event=$event, properties=${properties.toList()}" }
+ }
+}
diff --git a/app/src/fdroid/kotlin/org/meshtastic/app/di/FDroidNetworkModule.kt b/app/src/fdroid/kotlin/org/meshtastic/app/di/FDroidNetworkModule.kt
new file mode 100644
index 000000000..fba7a417f
--- /dev/null
+++ b/app/src/fdroid/kotlin/org/meshtastic/app/di/FDroidNetworkModule.kt
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.di
+
+import org.koin.core.annotation.Module
+import org.koin.core.annotation.Single
+import org.meshtastic.core.model.NetworkDeviceHardware
+import org.meshtastic.core.model.NetworkFirmwareReleases
+import org.meshtastic.core.network.service.ApiService
+
+@Module
+class FDroidNetworkModule {
+
+ @Single
+ fun provideApiService(): ApiService = object : ApiService {
+ override suspend fun getDeviceHardware(): List =
+ throw NotImplementedError("API calls to getDeviceHardware are not supported on Fdroid builds.")
+
+ override suspend fun getFirmwareReleases(): NetworkFirmwareReleases =
+ throw NotImplementedError("API calls to getFirmwareReleases are not supported on Fdroid builds.")
+ }
+}
diff --git a/app/src/fdroid/kotlin/org/meshtastic/app/di/FlavorModule.kt b/app/src/fdroid/kotlin/org/meshtastic/app/di/FlavorModule.kt
new file mode 100644
index 000000000..5a192d437
--- /dev/null
+++ b/app/src/fdroid/kotlin/org/meshtastic/app/di/FlavorModule.kt
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.di
+
+import org.koin.core.annotation.Module
+
+@Module(includes = [FDroidNetworkModule::class])
+class FlavorModule
diff --git a/app/src/fdroid/kotlin/org/meshtastic/app/intro/AnalyticsIntro.kt b/app/src/fdroid/kotlin/org/meshtastic/app/intro/AnalyticsIntro.kt
new file mode 100644
index 000000000..a9065a24a
--- /dev/null
+++ b/app/src/fdroid/kotlin/org/meshtastic/app/intro/AnalyticsIntro.kt
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.intro
+
+import androidx.compose.runtime.Composable
+
+@Composable
+fun AnalyticsIntro() {
+ // no-op for fdroid
+}
diff --git a/app/src/fdroid/kotlin/org/meshtastic/app/map/FdroidMapViewProvider.kt b/app/src/fdroid/kotlin/org/meshtastic/app/map/FdroidMapViewProvider.kt
new file mode 100644
index 000000000..21c2d4fde
--- /dev/null
+++ b/app/src/fdroid/kotlin/org/meshtastic/app/map/FdroidMapViewProvider.kt
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map
+
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.ui.Modifier
+import org.koin.compose.viewmodel.koinViewModel
+import org.koin.core.annotation.Single
+import org.meshtastic.core.ui.util.MapViewProvider
+
+/** OSMDroid implementation of [MapViewProvider]. */
+@Single
+class FdroidMapViewProvider : MapViewProvider {
+ @Composable
+ override fun MapView(modifier: Modifier, navigateToNodeDetails: (Int) -> Unit, waypointId: Int?) {
+ val mapViewModel: MapViewModel = koinViewModel()
+ LaunchedEffect(waypointId) { mapViewModel.setWaypointId(waypointId) }
+ org.meshtastic.app.map.MapView(
+ modifier = modifier,
+ mapViewModel = mapViewModel,
+ navigateToNodeDetails = navigateToNodeDetails,
+ )
+ }
+}
diff --git a/app/src/fdroid/kotlin/org/meshtastic/app/map/GetMapViewProvider.kt b/app/src/fdroid/kotlin/org/meshtastic/app/map/GetMapViewProvider.kt
new file mode 100644
index 000000000..48b1aa7fc
--- /dev/null
+++ b/app/src/fdroid/kotlin/org/meshtastic/app/map/GetMapViewProvider.kt
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map
+
+import org.meshtastic.core.ui.util.MapViewProvider
+
+fun getMapViewProvider(): MapViewProvider = FdroidMapViewProvider()
diff --git a/app/src/fdroid/kotlin/org/meshtastic/app/map/MapUtils.kt b/app/src/fdroid/kotlin/org/meshtastic/app/map/MapUtils.kt
new file mode 100644
index 000000000..1243fdc8a
--- /dev/null
+++ b/app/src/fdroid/kotlin/org/meshtastic/app/map/MapUtils.kt
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map
+
+import android.content.Context
+import android.util.TypedValue
+import org.osmdroid.util.BoundingBox
+import org.osmdroid.util.GeoPoint
+import kotlin.math.log2
+import kotlin.math.pow
+
+private const val DEGREES_IN_CIRCLE = 360.0
+private const val METERS_PER_DEGREE_LATITUDE = 111320.0
+private const val ZOOM_ADJUSTMENT_FACTOR = 0.8
+
+/**
+ * Calculates the zoom level required to fit the entire [BoundingBox] inside the map view.
+ *
+ * @return The zoom level as a Double value.
+ */
+fun BoundingBox.requiredZoomLevel(): Double {
+ val topLeft = GeoPoint(this.latNorth, this.lonWest)
+ val bottomRight = GeoPoint(this.latSouth, this.lonEast)
+ val latLonWidth = topLeft.distanceToAsDouble(GeoPoint(topLeft.latitude, bottomRight.longitude))
+ val latLonHeight = topLeft.distanceToAsDouble(GeoPoint(bottomRight.latitude, topLeft.longitude))
+ val requiredLatZoom = log2(DEGREES_IN_CIRCLE / (latLonHeight / METERS_PER_DEGREE_LATITUDE))
+ val requiredLonZoom = log2(DEGREES_IN_CIRCLE / (latLonWidth / METERS_PER_DEGREE_LATITUDE))
+ return maxOf(requiredLatZoom, requiredLonZoom) * ZOOM_ADJUSTMENT_FACTOR
+}
+
+/**
+ * Creates a new bounding box with adjusted dimensions based on the provided [zoomFactor].
+ *
+ * @return A new [BoundingBox] with added [zoomFactor]. Example:
+ * ```
+ * // Setting the zoom level directly using setZoom()
+ * map.setZoom(14.0)
+ * val boundingBoxZoom14 = map.boundingBox
+ *
+ * // Using zoomIn() results the equivalent BoundingBox with setZoom(15.0)
+ * val boundingBoxZoom15 = boundingBoxZoom14.zoomIn(1.0)
+ * ```
+ */
+fun BoundingBox.zoomIn(zoomFactor: Double): BoundingBox {
+ val center = GeoPoint((latNorth + latSouth) / 2, (lonWest + lonEast) / 2)
+ val latDiff = latNorth - latSouth
+ val lonDiff = lonEast - lonWest
+
+ val newLatDiff = latDiff / (2.0.pow(zoomFactor))
+ val newLonDiff = lonDiff / (2.0.pow(zoomFactor))
+
+ return BoundingBox(
+ center.latitude + newLatDiff / 2,
+ center.longitude + newLonDiff / 2,
+ center.latitude - newLatDiff / 2,
+ center.longitude - newLonDiff / 2,
+ )
+}
+
+// Converts SP to pixels.
+fun Context.spToPx(sp: Float): Int =
+ TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, sp, resources.displayMetrics).toInt()
+
+// Converts DP to pixels.
+fun Context.dpToPx(dp: Float): Int =
+ TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, resources.displayMetrics).toInt()
diff --git a/app/src/fdroid/kotlin/org/meshtastic/app/map/MapView.kt b/app/src/fdroid/kotlin/org/meshtastic/app/map/MapView.kt
new file mode 100644
index 000000000..b4d0e1bbd
--- /dev/null
+++ b/app/src/fdroid/kotlin/org/meshtastic/app/map/MapView.kt
@@ -0,0 +1,962 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map
+
+import android.Manifest
+import androidx.appcompat.content.res.AppCompatResources
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.ColumnScope
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.wrapContentHeight
+import androidx.compose.foundation.layout.wrapContentWidth
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.material3.AlertDialogDefaults
+import androidx.compose.material3.BasicAlertDialog
+import androidx.compose.material3.Checkbox
+import androidx.compose.material3.DropdownMenu
+import androidx.compose.material3.DropdownMenuItem
+import androidx.compose.material3.ExperimentalMaterial3Api
+import androidx.compose.material3.HorizontalDivider
+import androidx.compose.material3.Icon
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Scaffold
+import androidx.compose.material3.Slider
+import androidx.compose.material3.Surface
+import androidx.compose.material3.Text
+import androidx.compose.material3.TextButton
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.derivedStateOf
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableDoubleStateOf
+import androidx.compose.runtime.mutableFloatStateOf
+import androidx.compose.runtime.mutableStateListOf
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.rememberCoroutineScope
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.hapticfeedback.HapticFeedbackType
+import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.platform.LocalDensity
+import androidx.compose.ui.platform.LocalHapticFeedback
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.viewinterop.AndroidView
+import androidx.lifecycle.compose.collectAsStateWithLifecycle
+import co.touchlab.kermit.Logger
+import com.google.accompanist.permissions.ExperimentalPermissionsApi
+import com.google.accompanist.permissions.rememberMultiplePermissionsState
+import com.google.android.material.dialog.MaterialAlertDialogBuilder
+import kotlinx.coroutines.launch
+import org.jetbrains.compose.resources.StringResource
+import org.jetbrains.compose.resources.stringResource
+import org.koin.compose.viewmodel.koinViewModel
+import org.meshtastic.app.R
+import org.meshtastic.app.map.cluster.RadiusMarkerClusterer
+import org.meshtastic.app.map.component.CacheLayout
+import org.meshtastic.app.map.component.DownloadButton
+import org.meshtastic.app.map.component.EditWaypointDialog
+import org.meshtastic.app.map.model.CustomTileSource
+import org.meshtastic.app.map.model.MarkerWithLabel
+import org.meshtastic.core.common.gpsDisabled
+import org.meshtastic.core.common.util.DateFormatter
+import org.meshtastic.core.common.util.nowMillis
+import org.meshtastic.core.common.util.nowSeconds
+import org.meshtastic.core.model.DataPacket
+import org.meshtastic.core.model.Node
+import org.meshtastic.core.resources.Res
+import org.meshtastic.core.resources.calculating
+import org.meshtastic.core.resources.cancel
+import org.meshtastic.core.resources.clear
+import org.meshtastic.core.resources.close
+import org.meshtastic.core.resources.delete_for_everyone
+import org.meshtastic.core.resources.delete_for_me
+import org.meshtastic.core.resources.expires
+import org.meshtastic.core.resources.getString
+import org.meshtastic.core.resources.last_heard_filter_label
+import org.meshtastic.core.resources.location_disabled
+import org.meshtastic.core.resources.map_cache_info
+import org.meshtastic.core.resources.map_cache_manager
+import org.meshtastic.core.resources.map_cache_size
+import org.meshtastic.core.resources.map_cache_tiles
+import org.meshtastic.core.resources.map_clear_tiles
+import org.meshtastic.core.resources.map_download_complete
+import org.meshtastic.core.resources.map_download_errors
+import org.meshtastic.core.resources.map_download_region
+import org.meshtastic.core.resources.map_node_popup_details
+import org.meshtastic.core.resources.map_offline_manager
+import org.meshtastic.core.resources.map_purge_fail
+import org.meshtastic.core.resources.map_purge_success
+import org.meshtastic.core.resources.map_style_selection
+import org.meshtastic.core.resources.map_subDescription
+import org.meshtastic.core.resources.map_tile_source
+import org.meshtastic.core.resources.only_favorites
+import org.meshtastic.core.resources.show_precision_circle
+import org.meshtastic.core.resources.show_waypoints
+import org.meshtastic.core.resources.waypoint_delete
+import org.meshtastic.core.resources.you
+import org.meshtastic.core.ui.component.BasicListItem
+import org.meshtastic.core.ui.component.ListItem
+import org.meshtastic.core.ui.icon.Check
+import org.meshtastic.core.ui.icon.Favorite
+import org.meshtastic.core.ui.icon.Layers
+import org.meshtastic.core.ui.icon.Lens
+import org.meshtastic.core.ui.icon.MeshtasticIcons
+import org.meshtastic.core.ui.icon.PinDrop
+import org.meshtastic.core.ui.util.formatAgo
+import org.meshtastic.core.ui.util.showToast
+import org.meshtastic.feature.map.BaseMapViewModel.MapFilterState
+import org.meshtastic.feature.map.LastHeardFilter
+import org.meshtastic.feature.map.component.MapButton
+import org.meshtastic.feature.map.component.MapControlsOverlay
+import org.meshtastic.proto.Config.DisplayConfig.DisplayUnits
+import org.meshtastic.proto.Waypoint
+import org.osmdroid.bonuspack.utils.BonusPackHelper.getBitmapFromVectorDrawable
+import org.osmdroid.config.Configuration
+import org.osmdroid.events.MapEventsReceiver
+import org.osmdroid.events.MapListener
+import org.osmdroid.events.ScrollEvent
+import org.osmdroid.events.ZoomEvent
+import org.osmdroid.tileprovider.cachemanager.CacheManager
+import org.osmdroid.tileprovider.modules.SqliteArchiveTileWriter
+import org.osmdroid.tileprovider.tilesource.ITileSource
+import org.osmdroid.tileprovider.tilesource.OnlineTileSourceBase
+import org.osmdroid.tileprovider.tilesource.TileSourcePolicyException
+import org.osmdroid.util.BoundingBox
+import org.osmdroid.util.GeoPoint
+import org.osmdroid.views.MapView
+import org.osmdroid.views.overlay.MapEventsOverlay
+import org.osmdroid.views.overlay.Marker
+import org.osmdroid.views.overlay.Polygon
+import org.osmdroid.views.overlay.infowindow.InfoWindow
+import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay
+import java.io.File
+import kotlin.math.roundToInt
+
+private fun MapView.updateMarkers(
+ nodeMarkers: List,
+ waypointMarkers: List,
+ nodeClusterer: RadiusMarkerClusterer,
+) {
+ Logger.d { "Showing on map: ${nodeMarkers.size} nodes ${waypointMarkers.size} waypoints" }
+
+ overlays.removeAll { overlay ->
+ overlay is MarkerWithLabel || (overlay is Marker && overlay !in nodeClusterer.items)
+ }
+
+ overlays.addAll(waypointMarkers)
+
+ nodeClusterer.items.clear()
+ nodeClusterer.items.addAll(nodeMarkers)
+ nodeClusterer.invalidate()
+}
+
+private fun cacheManagerCallback(onTaskComplete: () -> Unit, onTaskFailed: (Int) -> Unit) =
+ object : CacheManager.CacheManagerCallback {
+ override fun onTaskComplete() {
+ onTaskComplete()
+ }
+
+ override fun onTaskFailed(errors: Int) {
+ onTaskFailed(errors)
+ }
+
+ override fun updateProgress(progress: Int, currentZoomLevel: Int, zoomMin: Int, zoomMax: Int) {
+ // NOOP since we are using the build in UI
+ }
+
+ override fun downloadStarted() {
+ // NOOP since we are using the build in UI
+ }
+
+ override fun setPossibleTilesInArea(total: Int) {
+ // NOOP since we are using the build in UI
+ }
+ }
+
+/**
+ * Main composable for displaying the map view, including nodes, waypoints, and user location. It handles user
+ * interactions for map manipulation, filtering, and offline caching.
+ *
+ * @param mapViewModel The [MapViewModel] providing data and state for the map.
+ * @param navigateToNodeDetails Callback to navigate to the details screen of a selected node.
+ */
+@OptIn(ExperimentalPermissionsApi::class) // Added for Accompanist
+@Suppress("CyclomaticComplexMethod", "LongMethod")
+@Composable
+fun MapView(
+ modifier: Modifier = Modifier,
+ mapViewModel: MapViewModel = koinViewModel(),
+ navigateToNodeDetails: (Int) -> Unit,
+) {
+ var mapFilterExpanded by remember { mutableStateOf(false) }
+
+ val mapFilterState by mapViewModel.mapFilterStateFlow.collectAsStateWithLifecycle()
+ val isConnected by mapViewModel.isConnected.collectAsStateWithLifecycle()
+
+ var cacheEstimate by remember { mutableStateOf("") }
+
+ var zoomLevelMin by remember { mutableDoubleStateOf(0.0) }
+ var zoomLevelMax by remember { mutableDoubleStateOf(0.0) }
+
+ var downloadRegionBoundingBox: BoundingBox? by remember { mutableStateOf(null) }
+ var myLocationOverlay: MyLocationNewOverlay? by remember { mutableStateOf(null) }
+
+ var showDownloadButton: Boolean by remember { mutableStateOf(false) }
+ var showEditWaypointDialog by remember { mutableStateOf(null) }
+ var showCacheManagerDialog by remember { mutableStateOf(false) }
+ var showCurrentCacheInfo by remember { mutableStateOf(false) }
+ var showPurgeTileSourceDialog by remember { mutableStateOf(false) }
+ var showMapStyleDialog by remember { mutableStateOf(false) }
+
+ val scope = rememberCoroutineScope()
+ val context = LocalContext.current
+ val density = LocalDensity.current
+
+ val haptic = LocalHapticFeedback.current
+ fun performHapticFeedback() = haptic.performHapticFeedback(HapticFeedbackType.LongPress)
+
+ // Accompanist permissions state for location
+ val locationPermissionsState =
+ rememberMultiplePermissionsState(permissions = listOf(Manifest.permission.ACCESS_FINE_LOCATION))
+ var triggerLocationToggleAfterPermission by remember { mutableStateOf(false) }
+
+ fun loadOnlineTileSourceBase(): ITileSource {
+ val id = mapViewModel.mapStyleId
+ Logger.d { "mapStyleId from prefs: $id" }
+ return CustomTileSource.getTileSource(id).also {
+ zoomLevelMax = it.maximumZoomLevel.toDouble()
+ showDownloadButton = if (it is OnlineTileSourceBase) it.tileSourcePolicy.acceptsBulkDownload() else false
+ }
+ }
+
+ val initialCameraView = remember {
+ val nodes = mapViewModel.nodes.value
+ val nodesWithPosition = nodes.filter { it.validPosition != null }
+ val geoPoints = nodesWithPosition.map { GeoPoint(it.latitude, it.longitude) }
+ BoundingBox.fromGeoPoints(geoPoints)
+ }
+ val map =
+ rememberMapViewWithLifecycle(
+ applicationId = mapViewModel.applicationId,
+ box = initialCameraView,
+ tileSource = loadOnlineTileSourceBase(),
+ )
+
+ val nodeClusterer = remember { RadiusMarkerClusterer(context) }
+
+ fun MapView.toggleMyLocation() {
+ if (context.gpsDisabled()) {
+ Logger.d { "Telling user we need location turned on for MyLocationNewOverlay" }
+ scope.launch { context.showToast(Res.string.location_disabled) }
+ return
+ }
+
+ Logger.d { "user clicked MyLocationNewOverlay ${myLocationOverlay == null}" }
+ if (myLocationOverlay == null) {
+ myLocationOverlay =
+ MyLocationNewOverlay(this).apply {
+ enableMyLocation()
+ enableFollowLocation()
+ getBitmapFromVectorDrawable(context, R.drawable.ic_map_location_dot)?.let {
+ setPersonIcon(it)
+ setPersonAnchor(0.5f, 0.5f)
+ }
+ getBitmapFromVectorDrawable(context, R.drawable.ic_map_navigation)?.let {
+ setDirectionIcon(it)
+ setDirectionAnchor(0.5f, 0.5f)
+ }
+ }
+ overlays.add(myLocationOverlay)
+ } else {
+ myLocationOverlay?.apply {
+ disableMyLocation()
+ disableFollowLocation()
+ }
+ overlays.remove(myLocationOverlay)
+ myLocationOverlay = null
+ }
+ }
+
+ // Effect to toggle MyLocation after permission is granted
+ LaunchedEffect(locationPermissionsState.allPermissionsGranted) {
+ if (locationPermissionsState.allPermissionsGranted && triggerLocationToggleAfterPermission) {
+ map.toggleMyLocation()
+ triggerLocationToggleAfterPermission = false
+ }
+ }
+
+ // Keep screen on while location tracking is active
+ LaunchedEffect(myLocationOverlay) {
+ val activity = context as? android.app.Activity ?: return@LaunchedEffect
+ if (myLocationOverlay != null) {
+ activity.window.addFlags(android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
+ } else {
+ activity.window.clearFlags(android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
+ }
+ }
+
+ val nodes by mapViewModel.nodes.collectAsStateWithLifecycle()
+ val waypoints by mapViewModel.waypoints.collectAsStateWithLifecycle(emptyMap())
+ val selectedWaypointId by mapViewModel.selectedWaypointId.collectAsStateWithLifecycle()
+ val myId by mapViewModel.myId.collectAsStateWithLifecycle()
+
+ LaunchedEffect(selectedWaypointId, waypoints) {
+ if (selectedWaypointId != null && waypoints.containsKey(selectedWaypointId)) {
+ waypoints[selectedWaypointId]?.waypoint?.let { pt ->
+ val geoPoint = GeoPoint((pt.latitude_i ?: 0) * 1e-7, (pt.longitude_i ?: 0) * 1e-7)
+ map.controller.setCenter(geoPoint)
+ map.controller.setZoom(WAYPOINT_ZOOM)
+ }
+ }
+ }
+
+ val markerIcon = remember { AppCompatResources.getDrawable(context, R.drawable.ic_location_on) }
+
+ fun MapView.onNodesChanged(nodes: Collection): List {
+ val nodesWithPosition = nodes.filter { it.validPosition != null }
+ val ourNode = mapViewModel.ourNodeInfo.value
+ val displayUnits = mapViewModel.config.display?.units ?: DisplayUnits.METRIC
+ val mapFilterStateValue = mapViewModel.mapFilterStateFlow.value // Access mapFilterState directly
+ return nodesWithPosition.mapNotNull { node ->
+ if (mapFilterStateValue.onlyFavorites && !node.isFavorite && !node.equals(ourNode)) {
+ return@mapNotNull null
+ }
+ if (
+ mapFilterStateValue.lastHeardFilter.seconds != 0L &&
+ (nowSeconds - node.lastHeard) > mapFilterStateValue.lastHeardFilter.seconds &&
+ node.num != ourNode?.num
+ ) {
+ return@mapNotNull null
+ }
+
+ val (p, u) = node.position to node.user
+ val nodePosition = GeoPoint(node.latitude, node.longitude)
+ MarkerWithLabel(mapView = this, label = "${u.short_name} ${formatAgo(p.time)}").apply {
+ id = u.id
+ title = u.long_name
+ snippet =
+ getString(
+ Res.string.map_node_popup_details,
+ node.gpsString(),
+ formatAgo(node.lastHeard),
+ formatAgo(p.time),
+ if (node.batteryStr != "") node.batteryStr else "?",
+ )
+ ourNode?.distanceStr(node, displayUnits)?.let { dist ->
+ ourNode.bearing(node)?.let { bearing ->
+ subDescription = getString(Res.string.map_subDescription, bearing, dist)
+ }
+ }
+ setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM)
+ position = nodePosition
+ icon = markerIcon
+ setNodeColors(node.colors)
+ if (!mapFilterStateValue.showPrecisionCircle) {
+ setPrecisionBits(0)
+ } else {
+ setPrecisionBits(p.precision_bits)
+ }
+ setOnLongClickListener {
+ navigateToNodeDetails(node.num)
+ true
+ }
+ }
+ }
+ }
+
+ fun showDeleteMarkerDialog(waypoint: Waypoint) {
+ val builder = MaterialAlertDialogBuilder(context)
+ builder.setTitle(getString(Res.string.waypoint_delete))
+ builder.setNeutralButton(getString(Res.string.cancel)) { _, _ ->
+ Logger.d { "User canceled marker delete dialog" }
+ }
+ builder.setNegativeButton(getString(Res.string.delete_for_me)) { _, _ ->
+ Logger.d { "User deleted waypoint ${waypoint.id} for me" }
+ mapViewModel.deleteWaypoint(waypoint.id)
+ }
+ if (waypoint.locked_to in setOf(0, mapViewModel.myNodeNum ?: 0) && isConnected) {
+ builder.setPositiveButton(getString(Res.string.delete_for_everyone)) { _, _ ->
+ Logger.d { "User deleted waypoint ${waypoint.id} for everyone" }
+ mapViewModel.sendWaypoint(waypoint.copy(expire = 1))
+ mapViewModel.deleteWaypoint(waypoint.id)
+ }
+ }
+ val dialog = builder.show()
+ for (
+ button in
+ setOf(
+ androidx.appcompat.app.AlertDialog.BUTTON_NEUTRAL,
+ androidx.appcompat.app.AlertDialog.BUTTON_NEGATIVE,
+ androidx.appcompat.app.AlertDialog.BUTTON_POSITIVE,
+ )
+ ) {
+ with(dialog.getButton(button)) {
+ textSize = 12F
+ isAllCaps = false
+ }
+ }
+ }
+
+ fun showMarkerLongPressDialog(id: Int) {
+ performHapticFeedback()
+ Logger.d { "marker long pressed id=$id" }
+ val waypoint = waypoints[id]?.waypoint ?: return
+ // edit only when unlocked or lockedTo myNodeNum
+ if (waypoint.locked_to in setOf(0, mapViewModel.myNodeNum ?: 0) && isConnected) {
+ showEditWaypointDialog = waypoint
+ } else {
+ showDeleteMarkerDialog(waypoint)
+ }
+ }
+
+ fun getUsername(id: String?) = if (id == DataPacket.ID_LOCAL || (myId != null && id == myId)) {
+ getString(Res.string.you)
+ } else {
+ mapViewModel.getUser(id).long_name
+ }
+
+ @Suppress("MagicNumber")
+ fun MapView.onWaypointChanged(waypoints: Collection, selectedWaypointId: Int?): List {
+ return waypoints.mapNotNull { waypoint ->
+ val pt = waypoint.waypoint ?: return@mapNotNull null
+ if (!mapFilterState.showWaypoints) return@mapNotNull null // Use collected mapFilterState
+ val lock = if (pt.locked_to != 0) "\uD83D\uDD12" else ""
+ val time = DateFormatter.formatDateTime(waypoint.time)
+ val label = pt.name + " " + formatAgo((waypoint.time / 1000).toInt())
+ val emoji = String(Character.toChars(if (pt.icon == 0) 128205 else pt.icon))
+ val now = nowMillis
+ val expireTimeMillis = pt.expire * 1000L
+ val expireTimeStr =
+ when {
+ pt.expire == 0 || pt.expire == Int.MAX_VALUE -> "Never"
+ expireTimeMillis <= now -> "Expired"
+ else -> DateFormatter.formatRelativeTime(expireTimeMillis)
+ }
+ MarkerWithLabel(this, label, emoji).apply {
+ id = "${pt.id}"
+ title = "${pt.name} (${getUsername(waypoint.from)}$lock)"
+ snippet = "[$time] ${pt.description} " + getString(Res.string.expires) + ": $expireTimeStr"
+ position = GeoPoint((pt.latitude_i ?: 0) * 1e-7, (pt.longitude_i ?: 0) * 1e-7)
+ if (selectedWaypointId == pt.id) {
+ showInfoWindow()
+ }
+ setOnLongClickListener {
+ showMarkerLongPressDialog(pt.id)
+ true
+ }
+ }
+ }
+ }
+
+ val mapEventsReceiver =
+ object : MapEventsReceiver {
+ override fun singleTapConfirmedHelper(p: GeoPoint): Boolean {
+ InfoWindow.closeAllInfoWindowsOn(map)
+ return true
+ }
+
+ override fun longPressHelper(p: GeoPoint): Boolean {
+ performHapticFeedback()
+ val enabled = isConnected && downloadRegionBoundingBox == null
+
+ if (enabled) {
+ showEditWaypointDialog =
+ Waypoint(latitude_i = (p.latitude * 1e7).toInt(), longitude_i = (p.longitude * 1e7).toInt())
+ }
+ return true
+ }
+ }
+
+ fun MapView.drawOverlays() {
+ if (overlays.none { it is MapEventsOverlay }) {
+ overlays.add(0, MapEventsOverlay(mapEventsReceiver))
+ }
+ if (myLocationOverlay != null && overlays.none { it is MyLocationNewOverlay }) {
+ overlays.add(myLocationOverlay)
+ }
+ if (overlays.none { it is RadiusMarkerClusterer }) {
+ overlays.add(nodeClusterer)
+ }
+
+ addCopyright()
+ addScaleBarOverlay(density)
+ createLatLongGrid(false)
+
+ invalidate()
+ }
+
+ fun MapView.generateBoxOverlay() {
+ overlays.removeAll { it is Polygon }
+ val zoomFactor = 1.3
+ zoomLevelMin = minOf(zoomLevelDouble, zoomLevelMax)
+ downloadRegionBoundingBox = boundingBox.zoomIn(zoomFactor)
+ val polygon =
+ Polygon().apply {
+ points = Polygon.pointsAsRect(downloadRegionBoundingBox).map { GeoPoint(it.latitude, it.longitude) }
+ }
+ overlays.add(polygon)
+ invalidate()
+ val tileCount: Int =
+ CacheManager(this)
+ .possibleTilesInArea(downloadRegionBoundingBox, zoomLevelMin.toInt(), zoomLevelMax.toInt())
+ cacheEstimate = getString(Res.string.map_cache_tiles, tileCount)
+ }
+
+ val boxOverlayListener =
+ object : MapListener {
+ override fun onScroll(event: ScrollEvent): Boolean {
+ if (downloadRegionBoundingBox != null) {
+ event.source.generateBoxOverlay()
+ }
+ return true
+ }
+
+ override fun onZoom(event: ZoomEvent): Boolean = false
+ }
+
+ fun startDownload() {
+ val boundingBox = downloadRegionBoundingBox ?: return
+ try {
+ val outputName = buildString {
+ append(Configuration.getInstance().osmdroidBasePath.absolutePath)
+ append(File.separator)
+ append("mainFile.sqlite")
+ }
+ val writer = SqliteArchiveTileWriter(outputName)
+ val cacheManager = CacheManager(map, writer)
+ cacheManager.downloadAreaAsync(
+ context,
+ boundingBox,
+ zoomLevelMin.toInt(),
+ zoomLevelMax.toInt(),
+ cacheManagerCallback(
+ onTaskComplete = {
+ scope.launch { context.showToast(Res.string.map_download_complete) }
+ writer.onDetach()
+ },
+ onTaskFailed = { errors ->
+ scope.launch { context.showToast(Res.string.map_download_errors, errors) }
+ writer.onDetach()
+ },
+ ),
+ )
+ } catch (ex: TileSourcePolicyException) {
+ Logger.d { "Tile source does not allow archiving: ${ex.message}" }
+ } catch (ex: Exception) {
+ Logger.d { "Tile source exception: ${ex.message}" }
+ }
+ }
+
+ Scaffold(
+ modifier = modifier,
+ floatingActionButton = {
+ DownloadButton(showDownloadButton && downloadRegionBoundingBox == null) { showCacheManagerDialog = true }
+ },
+ ) { innerPadding ->
+ Box(modifier = Modifier.fillMaxSize().padding(innerPadding)) {
+ AndroidView(
+ factory = {
+ map.apply {
+ setDestroyMode(false)
+ addMapListener(boxOverlayListener)
+ }
+ },
+ modifier = Modifier.fillMaxSize(),
+ update = { mapView ->
+ with(mapView) {
+ updateMarkers(
+ onNodesChanged(nodes),
+ onWaypointChanged(waypoints.values, selectedWaypointId),
+ nodeClusterer,
+ )
+ }
+ mapView.drawOverlays()
+ }, // Renamed map to mapView to avoid conflict
+ )
+ if (downloadRegionBoundingBox != null) {
+ CacheLayout(
+ cacheEstimate = cacheEstimate,
+ onExecuteJob = { startDownload() },
+ onCancelDownload = {
+ downloadRegionBoundingBox = null
+ map.overlays.removeAll { it is Polygon }
+ map.invalidate()
+ },
+ modifier = Modifier.align(Alignment.BottomCenter),
+ )
+ } else {
+ MapControlsOverlay(
+ modifier = Modifier.align(Alignment.TopCenter).padding(top = 8.dp),
+ onToggleFilterMenu = { mapFilterExpanded = true },
+ filterDropdownContent = {
+ FdroidMainMapFilterDropdown(
+ expanded = mapFilterExpanded,
+ onDismissRequest = { mapFilterExpanded = false },
+ mapFilterState = mapFilterState,
+ mapViewModel = mapViewModel,
+ )
+ },
+ mapTypeContent = {
+ MapButton(
+ icon = MeshtasticIcons.Layers,
+ contentDescription = stringResource(Res.string.map_style_selection),
+ onClick = { showMapStyleDialog = true },
+ )
+ },
+ isLocationTrackingEnabled = myLocationOverlay != null,
+ onToggleLocationTracking = {
+ if (locationPermissionsState.allPermissionsGranted) {
+ map.toggleMyLocation()
+ } else {
+ triggerLocationToggleAfterPermission = true
+ locationPermissionsState.launchMultiplePermissionRequest()
+ }
+ },
+ )
+ }
+ }
+ }
+
+ if (showMapStyleDialog) {
+ MapStyleDialog(
+ selectedMapStyle = mapViewModel.mapStyleId,
+ onDismiss = { showMapStyleDialog = false },
+ onSelectMapStyle = {
+ mapViewModel.mapStyleId = it
+ map.setTileSource(loadOnlineTileSourceBase())
+ },
+ )
+ }
+
+ if (showCacheManagerDialog) {
+ CacheManagerDialog(
+ onClickOption = { option ->
+ when (option) {
+ CacheManagerOption.CurrentCacheSize -> {
+ scope.launch { context.showToast(Res.string.calculating) }
+ showCurrentCacheInfo = true
+ }
+ CacheManagerOption.DownloadRegion -> map.generateBoxOverlay()
+
+ CacheManagerOption.ClearTiles -> showPurgeTileSourceDialog = true
+ CacheManagerOption.Cancel -> Unit
+ }
+ showCacheManagerDialog = false
+ },
+ onDismiss = { showCacheManagerDialog = false },
+ )
+ }
+
+ if (showCurrentCacheInfo) {
+ CacheInfoDialog(mapView = map, onDismiss = { showCurrentCacheInfo = false })
+ }
+
+ if (showPurgeTileSourceDialog) {
+ PurgeTileSourceDialog(onDismiss = { showPurgeTileSourceDialog = false })
+ }
+
+ if (showEditWaypointDialog != null) {
+ EditWaypointDialog(
+ waypoint = showEditWaypointDialog ?: return, // Safe call
+ onSendClicked = { waypoint ->
+ Logger.d { "User clicked send waypoint ${waypoint.id}" }
+ showEditWaypointDialog = null
+
+ val newId = if (waypoint.id == 0) mapViewModel.generatePacketId() else waypoint.id
+ val newName = if (waypoint.name.isNullOrEmpty()) "Dropped Pin" else waypoint.name
+ val newExpire = if (waypoint.expire == 0) Int.MAX_VALUE else waypoint.expire
+ val newLockedTo = if (waypoint.locked_to != 0) mapViewModel.myNodeNum ?: 0 else 0
+ val newIcon = if (waypoint.icon == 0) 128205 else waypoint.icon
+
+ mapViewModel.sendWaypoint(
+ waypoint.copy(
+ id = newId,
+ name = newName,
+ expire = newExpire,
+ locked_to = newLockedTo,
+ icon = newIcon,
+ ),
+ )
+ },
+ onDeleteClicked = { waypoint ->
+ Logger.d { "User clicked delete waypoint ${waypoint.id}" }
+ showEditWaypointDialog = null
+ showDeleteMarkerDialog(waypoint)
+ },
+ onDismissRequest = {
+ Logger.d { "User clicked cancel marker edit dialog" }
+ showEditWaypointDialog = null
+ },
+ )
+ }
+}
+
+/** F-Droid main map filter dropdown — favorites, waypoints, precision circle, and last-heard time filter slider. */
+@Composable
+private fun FdroidMainMapFilterDropdown(
+ expanded: Boolean,
+ onDismissRequest: () -> Unit,
+ mapFilterState: MapFilterState,
+ mapViewModel: MapViewModel,
+) {
+ DropdownMenu(
+ expanded = expanded,
+ onDismissRequest = onDismissRequest,
+ modifier = Modifier.background(MaterialTheme.colorScheme.surface),
+ ) {
+ DropdownMenuItem(
+ text = {
+ Row(modifier = Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
+ Icon(
+ imageVector = MeshtasticIcons.Favorite,
+ contentDescription = null,
+ modifier = Modifier.padding(end = 8.dp),
+ tint = MaterialTheme.colorScheme.onSurface,
+ )
+ Text(text = stringResource(Res.string.only_favorites), modifier = Modifier.weight(1f))
+ Checkbox(
+ checked = mapFilterState.onlyFavorites,
+ onCheckedChange = { mapViewModel.toggleOnlyFavorites() },
+ modifier = Modifier.padding(start = 8.dp),
+ )
+ }
+ },
+ onClick = { mapViewModel.toggleOnlyFavorites() },
+ )
+ DropdownMenuItem(
+ text = {
+ Row(modifier = Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
+ Icon(
+ imageVector = MeshtasticIcons.PinDrop,
+ contentDescription = null,
+ modifier = Modifier.padding(end = 8.dp),
+ tint = MaterialTheme.colorScheme.onSurface,
+ )
+ Text(text = stringResource(Res.string.show_waypoints), modifier = Modifier.weight(1f))
+ Checkbox(
+ checked = mapFilterState.showWaypoints,
+ onCheckedChange = { mapViewModel.toggleShowWaypointsOnMap() },
+ modifier = Modifier.padding(start = 8.dp),
+ )
+ }
+ },
+ onClick = { mapViewModel.toggleShowWaypointsOnMap() },
+ )
+ DropdownMenuItem(
+ text = {
+ Row(modifier = Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
+ Icon(
+ imageVector = MeshtasticIcons.Lens,
+ contentDescription = null,
+ modifier = Modifier.padding(end = 8.dp),
+ tint = MaterialTheme.colorScheme.onSurface,
+ )
+ Text(text = stringResource(Res.string.show_precision_circle), modifier = Modifier.weight(1f))
+ Checkbox(
+ checked = mapFilterState.showPrecisionCircle,
+ onCheckedChange = { mapViewModel.toggleShowPrecisionCircleOnMap() },
+ modifier = Modifier.padding(start = 8.dp),
+ )
+ }
+ },
+ onClick = { mapViewModel.toggleShowPrecisionCircleOnMap() },
+ )
+ HorizontalDivider()
+ Column(modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp)) {
+ val filterOptions = LastHeardFilter.entries
+ val selectedIndex = filterOptions.indexOf(mapFilterState.lastHeardFilter)
+ var sliderPosition by remember(selectedIndex) { mutableFloatStateOf(selectedIndex.toFloat()) }
+ Text(
+ text =
+ stringResource(
+ Res.string.last_heard_filter_label,
+ stringResource(mapFilterState.lastHeardFilter.label),
+ ),
+ style = MaterialTheme.typography.labelLarge,
+ )
+ Slider(
+ value = sliderPosition,
+ onValueChange = { sliderPosition = it },
+ onValueChangeFinished = {
+ val newIndex = sliderPosition.roundToInt().coerceIn(0, filterOptions.size - 1)
+ mapViewModel.setLastHeardFilter(filterOptions[newIndex])
+ },
+ valueRange = 0f..(filterOptions.size - 1).toFloat(),
+ steps = filterOptions.size - 2,
+ )
+ }
+ }
+}
+
+@Composable
+private fun MapStyleDialog(selectedMapStyle: Int, onDismiss: () -> Unit, onSelectMapStyle: (Int) -> Unit) {
+ val selected = remember { mutableStateOf(selectedMapStyle) }
+
+ MapsDialog(onDismiss = onDismiss) {
+ CustomTileSource.mTileSources.values.forEachIndexed { index, style ->
+ ListItem(
+ text = style,
+ trailingIcon = if (index == selected.value) MeshtasticIcons.Check else null,
+ onClick = {
+ selected.value = index
+ onSelectMapStyle(index)
+ onDismiss()
+ },
+ )
+ }
+ }
+}
+
+private enum class CacheManagerOption(val label: StringResource) {
+ CurrentCacheSize(label = Res.string.map_cache_size),
+ DownloadRegion(label = Res.string.map_download_region),
+ ClearTiles(label = Res.string.map_clear_tiles),
+ Cancel(label = Res.string.cancel),
+}
+
+@Composable
+private fun CacheManagerDialog(onClickOption: (CacheManagerOption) -> Unit, onDismiss: () -> Unit) {
+ MapsDialog(title = stringResource(Res.string.map_offline_manager), onDismiss = onDismiss) {
+ CacheManagerOption.entries.forEach { option ->
+ ListItem(text = stringResource(option.label), trailingIcon = null) {
+ onClickOption(option)
+ onDismiss()
+ }
+ }
+ }
+}
+
+@Composable
+private fun CacheInfoDialog(mapView: MapView, onDismiss: () -> Unit) {
+ val (cacheCapacity, currentCacheUsage) =
+ remember(mapView) {
+ val cacheManager = CacheManager(mapView)
+ cacheManager.cacheCapacity() to cacheManager.currentCacheUsage()
+ }
+
+ MapsDialog(
+ title = stringResource(Res.string.map_cache_manager),
+ onDismiss = onDismiss,
+ negativeButton = { TextButton(onClick = { onDismiss() }) { Text(text = stringResource(Res.string.close)) } },
+ ) {
+ val capacityMb = (cacheCapacity / (1024 * 1024)).toLong()
+ val usageMb = (currentCacheUsage / (1024 * 1024)).toLong()
+ Text(modifier = Modifier.padding(16.dp), text = stringResource(Res.string.map_cache_info, capacityMb, usageMb))
+ }
+}
+
+@Composable
+private fun PurgeTileSourceDialog(onDismiss: () -> Unit) {
+ val scope = rememberCoroutineScope()
+ val context = LocalContext.current
+ val cache = SqlTileWriterExt()
+
+ val sourceList by derivedStateOf { cache.sources.map { it.source as String } }
+
+ val selected = remember { mutableStateListOf() }
+
+ MapsDialog(
+ title = stringResource(Res.string.map_tile_source),
+ positiveButton = {
+ TextButton(
+ enabled = selected.isNotEmpty(),
+ onClick = {
+ selected.forEach { selectedIndex ->
+ val source = sourceList[selectedIndex]
+ scope.launch {
+ context.showToast(
+ if (cache.purgeCache(source)) {
+ getString(Res.string.map_purge_success, source)
+ } else {
+ getString(Res.string.map_purge_fail)
+ },
+ )
+ }
+ }
+
+ onDismiss()
+ },
+ ) {
+ Text(text = stringResource(Res.string.clear))
+ }
+ },
+ negativeButton = { TextButton(onClick = onDismiss) { Text(text = stringResource(Res.string.cancel)) } },
+ onDismiss = onDismiss,
+ ) {
+ sourceList.forEachIndexed { index, source ->
+ val isSelected = selected.contains(index)
+ BasicListItem(
+ text = source,
+ trailingContent = { Checkbox(checked = isSelected, onCheckedChange = {}) },
+ onClick = {
+ if (isSelected) {
+ selected.remove(index)
+ } else {
+ selected.add(index)
+ }
+ },
+ ) {}
+ }
+ }
+}
+
+@OptIn(ExperimentalMaterial3Api::class)
+@Composable
+private fun MapsDialog(
+ title: String? = null,
+ onDismiss: () -> Unit,
+ positiveButton: (@Composable () -> Unit)? = null,
+ negativeButton: (@Composable () -> Unit)? = null,
+ content: @Composable ColumnScope.() -> Unit,
+) {
+ BasicAlertDialog(onDismissRequest = onDismiss) {
+ Surface(
+ modifier = Modifier.wrapContentWidth().wrapContentHeight(),
+ shape = MaterialTheme.shapes.large,
+ color = AlertDialogDefaults.containerColor,
+ tonalElevation = AlertDialogDefaults.TonalElevation,
+ ) {
+ Column {
+ title?.let {
+ Text(
+ modifier = Modifier.padding(start = 16.dp, top = 16.dp, end = 16.dp, bottom = 8.dp),
+ text = it,
+ style = MaterialTheme.typography.titleLarge,
+ )
+ }
+
+ Column(modifier = Modifier.verticalScroll(rememberScrollState())) { content() }
+ if (positiveButton != null || negativeButton != null) {
+ Row(Modifier.align(Alignment.End)) {
+ positiveButton?.invoke()
+ negativeButton?.invoke()
+ }
+ }
+ }
+ }
+ }
+}
+
+private const val WAYPOINT_ZOOM = 15.0
diff --git a/app/src/fdroid/kotlin/org/meshtastic/app/map/MapViewExtensions.kt b/app/src/fdroid/kotlin/org/meshtastic/app/map/MapViewExtensions.kt
new file mode 100644
index 000000000..3cc0dbaf0
--- /dev/null
+++ b/app/src/fdroid/kotlin/org/meshtastic/app/map/MapViewExtensions.kt
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map
+
+import android.graphics.Color
+import android.graphics.DashPathEffect
+import android.graphics.Paint
+import android.graphics.Typeface
+import androidx.compose.ui.unit.Density
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import androidx.core.content.ContextCompat
+import org.meshtastic.app.R
+import org.meshtastic.proto.Position
+import org.osmdroid.util.GeoPoint
+import org.osmdroid.views.MapView
+import org.osmdroid.views.overlay.CopyrightOverlay
+import org.osmdroid.views.overlay.Marker
+import org.osmdroid.views.overlay.Polyline
+import org.osmdroid.views.overlay.ScaleBarOverlay
+import org.osmdroid.views.overlay.advancedpolyline.MonochromaticPaintList
+import org.osmdroid.views.overlay.gridlines.LatLonGridlineOverlay2
+
+/** Adds copyright to map depending on what source is showing */
+fun MapView.addCopyright() {
+ if (overlays.none { it is CopyrightOverlay }) {
+ val copyrightNotice: String = tileProvider.tileSource.copyrightNotice ?: return
+ val copyrightOverlay = CopyrightOverlay(context)
+ copyrightOverlay.setCopyrightNotice(copyrightNotice)
+ overlays.add(copyrightOverlay)
+ }
+}
+
+/**
+ * Create LatLong Grid line overlay
+ *
+ * @param enabled: turn on/off gridlines
+ */
+fun MapView.createLatLongGrid(enabled: Boolean) {
+ val latLongGridOverlay = LatLonGridlineOverlay2()
+ latLongGridOverlay.isEnabled = enabled
+ if (latLongGridOverlay.isEnabled) {
+ val textPaint =
+ Paint().apply {
+ textSize = 40f
+ color = Color.GRAY
+ isAntiAlias = true
+ isFakeBoldText = true
+ textAlign = Paint.Align.CENTER
+ }
+ latLongGridOverlay.textPaint = textPaint
+ latLongGridOverlay.setBackgroundColor(Color.TRANSPARENT)
+ latLongGridOverlay.setLineWidth(3.0f)
+ latLongGridOverlay.setLineColor(Color.GRAY)
+ overlays.add(latLongGridOverlay)
+ }
+}
+
+fun MapView.addScaleBarOverlay(density: Density) {
+ if (overlays.none { it is ScaleBarOverlay }) {
+ val scaleBarOverlay =
+ ScaleBarOverlay(this).apply {
+ setAlignBottom(true)
+ with(density) {
+ setScaleBarOffset(15.dp.toPx().toInt(), 40.dp.toPx().toInt())
+ setTextSize(12.sp.toPx())
+ }
+ textPaint.apply {
+ isAntiAlias = true
+ typeface = Typeface.DEFAULT_BOLD
+ }
+ }
+ overlays.add(scaleBarOverlay)
+ }
+}
+
+fun MapView.addPolyline(density: Density, geoPoints: List, onClick: () -> Unit): Polyline {
+ val polyline =
+ Polyline(this).apply {
+ val borderPaint =
+ Paint().apply {
+ color = Color.BLACK
+ isAntiAlias = true
+ strokeWidth = with(density) { 10.dp.toPx() }
+ style = Paint.Style.STROKE
+ strokeJoin = Paint.Join.ROUND
+ strokeCap = Paint.Cap.ROUND
+ pathEffect = DashPathEffect(floatArrayOf(80f, 60f), 0f)
+ }
+ outlinePaintLists.add(MonochromaticPaintList(borderPaint))
+ val fillPaint =
+ Paint().apply {
+ color = Color.WHITE
+ isAntiAlias = true
+ strokeWidth = with(density) { 6.dp.toPx() }
+ style = Paint.Style.FILL_AND_STROKE
+ strokeJoin = Paint.Join.ROUND
+ strokeCap = Paint.Cap.ROUND
+ pathEffect = DashPathEffect(floatArrayOf(80f, 60f), 0f)
+ }
+ outlinePaintLists.add(MonochromaticPaintList(fillPaint))
+ setPoints(geoPoints)
+ setOnClickListener { _, _, _ ->
+ onClick()
+ true
+ }
+ }
+ overlays.add(polyline)
+
+ return polyline
+}
+
+fun MapView.addPositionMarkers(positions: List, onClick: (Int) -> Unit): List {
+ val navIcon = ContextCompat.getDrawable(context, R.drawable.ic_map_navigation)
+ val markers =
+ positions.map { pos ->
+ Marker(this).apply {
+ icon = navIcon
+ rotation = ((pos.ground_track ?: 0) * 1e-5).toFloat()
+ setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_CENTER)
+ position = GeoPoint((pos.latitude_i ?: 0) * 1e-7, (pos.longitude_i ?: 0) * 1e-7)
+ setOnMarkerClickListener { _, _ ->
+ onClick(pos.time)
+ true
+ }
+ }
+ }
+ overlays.addAll(markers)
+
+ return markers
+}
diff --git a/app/src/fdroid/kotlin/org/meshtastic/app/map/MapViewModel.kt b/app/src/fdroid/kotlin/org/meshtastic/app/map/MapViewModel.kt
new file mode 100644
index 000000000..1ffe68aa1
--- /dev/null
+++ b/app/src/fdroid/kotlin/org/meshtastic/app/map/MapViewModel.kt
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map
+
+import androidx.lifecycle.SavedStateHandle
+import kotlinx.coroutines.flow.MutableStateFlow
+import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.asStateFlow
+import org.koin.core.annotation.KoinViewModel
+import org.meshtastic.core.common.BuildConfigProvider
+import org.meshtastic.core.model.RadioController
+import org.meshtastic.core.repository.MapPrefs
+import org.meshtastic.core.repository.NodeRepository
+import org.meshtastic.core.repository.PacketRepository
+import org.meshtastic.core.repository.RadioConfigRepository
+import org.meshtastic.core.ui.viewmodel.stateInWhileSubscribed
+import org.meshtastic.feature.map.BaseMapViewModel
+import org.meshtastic.proto.LocalConfig
+
+@Suppress("LongParameterList")
+@KoinViewModel
+class MapViewModel(
+ mapPrefs: MapPrefs,
+ packetRepository: PacketRepository,
+ nodeRepository: NodeRepository,
+ radioController: RadioController,
+ radioConfigRepository: RadioConfigRepository,
+ buildConfigProvider: BuildConfigProvider,
+ savedStateHandle: SavedStateHandle,
+) : BaseMapViewModel(mapPrefs, nodeRepository, packetRepository, radioController) {
+
+ private val _selectedWaypointId = MutableStateFlow(savedStateHandle.get("waypointId"))
+ val selectedWaypointId: StateFlow = _selectedWaypointId.asStateFlow()
+
+ fun setWaypointId(id: Int?) {
+ if (_selectedWaypointId.value != id) {
+ _selectedWaypointId.value = id
+ }
+ }
+
+ var mapStyleId: Int
+ get() = mapPrefs.mapStyle.value
+ set(value) {
+ mapPrefs.setMapStyle(value)
+ }
+
+ val localConfig = radioConfigRepository.localConfigFlow.stateInWhileSubscribed(initialValue = LocalConfig())
+
+ val config
+ get() = localConfig.value
+
+ val applicationId = buildConfigProvider.applicationId
+}
diff --git a/app/src/fdroid/kotlin/org/meshtastic/app/map/MapViewWithLifecycle.kt b/app/src/fdroid/kotlin/org/meshtastic/app/map/MapViewWithLifecycle.kt
new file mode 100644
index 000000000..c16d87163
--- /dev/null
+++ b/app/src/fdroid/kotlin/org/meshtastic/app/map/MapViewWithLifecycle.kt
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map
+
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.DisposableEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableDoubleStateOf
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.saveable.Saver
+import androidx.compose.runtime.saveable.rememberSaveable
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.platform.LocalContext
+import androidx.lifecycle.Lifecycle
+import androidx.lifecycle.LifecycleEventObserver
+import androidx.lifecycle.compose.LocalLifecycleOwner
+import org.osmdroid.config.Configuration
+import org.osmdroid.tileprovider.tilesource.ITileSource
+import org.osmdroid.tileprovider.tilesource.TileSourceFactory
+import org.osmdroid.util.BoundingBox
+import org.osmdroid.util.GeoPoint
+import org.osmdroid.views.CustomZoomButtonsController
+import org.osmdroid.views.MapView
+
+private const val MIN_ZOOM_LEVEL = 1.5
+private const val MAX_ZOOM_LEVEL = 20.0
+private const val DEFAULT_ZOOM_LEVEL = 15.0
+
+@Suppress("MagicNumber")
+@Composable
+fun rememberMapViewWithLifecycle(
+ applicationId: String,
+ box: BoundingBox,
+ tileSource: ITileSource = TileSourceFactory.DEFAULT_TILE_SOURCE,
+): MapView {
+ val zoom =
+ if (box.requiredZoomLevel().isFinite()) {
+ (box.requiredZoomLevel() - 0.5).coerceAtLeast(MIN_ZOOM_LEVEL)
+ } else {
+ DEFAULT_ZOOM_LEVEL
+ }
+ val center = GeoPoint(box.centerLatitude, box.centerLongitude)
+ return rememberMapViewWithLifecycle(
+ applicationId = applicationId,
+ zoomLevel = zoom,
+ mapCenter = center,
+ tileSource = tileSource,
+ )
+}
+
+@Suppress("LongMethod")
+@Composable
+internal fun rememberMapViewWithLifecycle(
+ applicationId: String,
+ zoomLevel: Double = MIN_ZOOM_LEVEL,
+ mapCenter: GeoPoint = GeoPoint(0.0, 0.0),
+ tileSource: ITileSource = TileSourceFactory.DEFAULT_TILE_SOURCE,
+): MapView {
+ var savedZoom by rememberSaveable { mutableDoubleStateOf(zoomLevel) }
+ var savedCenter by
+ rememberSaveable(
+ stateSaver =
+ Saver(
+ save = { mapOf("latitude" to it.latitude, "longitude" to it.longitude) },
+ restore = { GeoPoint(it["latitude"] ?: 0.0, it["longitude"] ?: .0) },
+ ),
+ ) {
+ mutableStateOf(mapCenter)
+ }
+
+ val context = LocalContext.current
+ val mapView = remember {
+ MapView(context).apply {
+ clipToOutline = true
+
+ // Required to get online tiles
+ Configuration.getInstance().userAgentValue = applicationId
+ setTileSource(tileSource)
+ isVerticalMapRepetitionEnabled = false // disables map repetition
+ setMultiTouchControls(true)
+ val bounds = overlayManager.tilesOverlay.bounds // bounds scrollable map
+ setScrollableAreaLimitLatitude(bounds.actualNorth, bounds.actualSouth, 0)
+ // scales the map tiles to the display density of the screen
+ isTilesScaledToDpi = true
+ // sets the minimum zoom level (the furthest out you can zoom)
+ minZoomLevel = MIN_ZOOM_LEVEL
+ maxZoomLevel = MAX_ZOOM_LEVEL
+ // Disables default +/- button for zooming
+ zoomController.setVisibility(CustomZoomButtonsController.Visibility.SHOW_AND_FADEOUT)
+
+ controller.setZoom(savedZoom)
+ controller.setCenter(savedCenter)
+ }
+ }
+ val lifecycle = LocalLifecycleOwner.current.lifecycle
+ DisposableEffect(lifecycle) {
+ val observer = LifecycleEventObserver { _, event ->
+ when (event) {
+ Lifecycle.Event.ON_PAUSE -> {
+ mapView.onPause()
+ }
+
+ Lifecycle.Event.ON_RESUME -> {
+ mapView.onResume()
+ }
+
+ Lifecycle.Event.ON_STOP -> {
+ savedCenter = mapView.projection.currentCenter
+ savedZoom = mapView.zoomLevelDouble
+ }
+
+ else -> {}
+ }
+ }
+
+ lifecycle.addObserver(observer)
+
+ onDispose { lifecycle.removeObserver(observer) }
+ }
+ return mapView
+}
diff --git a/app/src/fdroid/kotlin/org/meshtastic/app/map/SqlTileWriterExt.kt b/app/src/fdroid/kotlin/org/meshtastic/app/map/SqlTileWriterExt.kt
new file mode 100644
index 000000000..112449d1f
--- /dev/null
+++ b/app/src/fdroid/kotlin/org/meshtastic/app/map/SqlTileWriterExt.kt
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map
+
+import android.database.Cursor
+import org.meshtastic.core.common.util.nowMillis
+import org.osmdroid.tileprovider.modules.DatabaseFileArchive
+import org.osmdroid.tileprovider.modules.SqlTileWriter
+
+/**
+ * Extended the sqlite tile writer to have some additional query functions. A this point it's unclear if there is a need
+ * to put these with the osmdroid-android library, thus they were put here as more of an example.
+ *
+ * created on 12/21/2016.
+ *
+ * @author Alex O'Ree
+ * @since 5.6.2
+ */
+class SqlTileWriterExt : SqlTileWriter() {
+ fun select(rows: Int, offset: Int): Cursor? = this.db?.rawQuery(
+ "select " +
+ DatabaseFileArchive.COLUMN_KEY +
+ "," +
+ COLUMN_EXPIRES +
+ "," +
+ DatabaseFileArchive.COLUMN_PROVIDER +
+ " from " +
+ DatabaseFileArchive.TABLE +
+ " limit ? offset ?",
+ arrayOf(rows.toString() + "", offset.toString() + ""),
+ )
+
+ /**
+ * gets all the tiles sources that we have tiles for in the cache database and their counts
+ *
+ * @return
+ */
+ val sources: List
+ get() {
+ val db = db
+ val ret: MutableList = ArrayList()
+ if (db == null) {
+ return ret
+ }
+ var cur: Cursor? = null
+ try {
+ cur =
+ db.rawQuery(
+ "select " +
+ DatabaseFileArchive.COLUMN_PROVIDER +
+ ",count(*) " +
+ ",min(length(" +
+ DatabaseFileArchive.COLUMN_TILE +
+ ")) " +
+ ",max(length(" +
+ DatabaseFileArchive.COLUMN_TILE +
+ ")) " +
+ ",sum(length(" +
+ DatabaseFileArchive.COLUMN_TILE +
+ ")) " +
+ "from " +
+ DatabaseFileArchive.TABLE +
+ " " +
+ "group by " +
+ DatabaseFileArchive.COLUMN_PROVIDER,
+ null,
+ )
+ while (cur.moveToNext()) {
+ val c = SourceCount()
+ c.source = cur.getString(0)
+ c.rowCount = cur.getLong(1)
+ c.sizeMin = cur.getLong(2)
+ c.sizeMax = cur.getLong(3)
+ c.sizeTotal = cur.getLong(4)
+ c.sizeAvg = c.sizeTotal / c.rowCount
+ ret.add(c)
+ }
+ } catch (e: Exception) {
+ catchException(e)
+ } finally {
+ cur?.close()
+ }
+ return ret
+ }
+
+ val rowCountExpired: Long
+ get() = getRowCount("$COLUMN_EXPIRES", arrayOf(nowMillis.toString()))
+
+ class SourceCount {
+ var rowCount: Long = 0
+ var source: String? = null
+ var sizeTotal: Long = 0
+ var sizeMin: Long = 0
+ var sizeMax: Long = 0
+ var sizeAvg: Long = 0
+ }
+}
diff --git a/app/src/fdroid/kotlin/org/meshtastic/app/map/component/CacheLayout.kt b/app/src/fdroid/kotlin/org/meshtastic/app/map/component/CacheLayout.kt
new file mode 100644
index 000000000..986918e06
--- /dev/null
+++ b/app/src/fdroid/kotlin/org/meshtastic/app/map/component/CacheLayout.kt
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.component
+
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.ExperimentalLayoutApi
+import androidx.compose.foundation.layout.FlowRow
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.wrapContentHeight
+import androidx.compose.material3.Button
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.text.style.TextAlign
+import androidx.compose.ui.tooling.preview.Preview
+import androidx.compose.ui.unit.dp
+import org.jetbrains.compose.resources.stringResource
+import org.meshtastic.core.resources.Res
+import org.meshtastic.core.resources.cancel
+import org.meshtastic.core.resources.map_select_download_region
+import org.meshtastic.core.resources.map_start_download
+import org.meshtastic.core.resources.map_tile_download_estimate
+
+@OptIn(ExperimentalLayoutApi::class)
+@Composable
+fun CacheLayout(
+ cacheEstimate: String,
+ onExecuteJob: () -> Unit,
+ onCancelDownload: () -> Unit,
+ modifier: Modifier = Modifier,
+) {
+ Column(
+ modifier =
+ modifier
+ .fillMaxWidth()
+ .wrapContentHeight()
+ .background(color = MaterialTheme.colorScheme.background)
+ .padding(8.dp),
+ ) {
+ Text(
+ text = stringResource(Res.string.map_select_download_region),
+ modifier = Modifier.fillMaxWidth(),
+ textAlign = TextAlign.Center,
+ style = MaterialTheme.typography.headlineSmall,
+ )
+
+ Spacer(modifier = Modifier.height(8.dp))
+
+ Text(
+ text = stringResource(Res.string.map_tile_download_estimate) + " " + cacheEstimate,
+ modifier = Modifier.fillMaxWidth(),
+ textAlign = TextAlign.Center,
+ style = MaterialTheme.typography.bodyLarge,
+ )
+
+ FlowRow(
+ modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp),
+ horizontalArrangement = Arrangement.spacedBy(space = 8.dp),
+ ) {
+ Button(onClick = onCancelDownload, modifier = Modifier.weight(1f)) {
+ Text(text = stringResource(Res.string.cancel), color = MaterialTheme.colorScheme.onPrimary)
+ }
+ Button(onClick = onExecuteJob, modifier = Modifier.weight(1f)) {
+ Text(text = stringResource(Res.string.map_start_download), color = MaterialTheme.colorScheme.onPrimary)
+ }
+ }
+ }
+}
+
+@Preview(showBackground = true)
+@Composable
+private fun CacheLayoutPreview() {
+ CacheLayout(cacheEstimate = "100 tiles", onExecuteJob = {}, onCancelDownload = {})
+}
diff --git a/app/src/fdroid/kotlin/org/meshtastic/app/map/component/DownloadButton.kt b/app/src/fdroid/kotlin/org/meshtastic/app/map/component/DownloadButton.kt
new file mode 100644
index 000000000..7568d695a
--- /dev/null
+++ b/app/src/fdroid/kotlin/org/meshtastic/app/map/component/DownloadButton.kt
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.component
+
+import androidx.compose.animation.AnimatedVisibility
+import androidx.compose.animation.core.FastOutSlowInEasing
+import androidx.compose.animation.core.tween
+import androidx.compose.animation.slideInHorizontally
+import androidx.compose.animation.slideOutHorizontally
+import androidx.compose.material3.FloatingActionButton
+import androidx.compose.material3.Icon
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.scale
+import org.jetbrains.compose.resources.stringResource
+import org.meshtastic.core.resources.Res
+import org.meshtastic.core.resources.map_download_region
+import org.meshtastic.core.ui.icon.Download
+import org.meshtastic.core.ui.icon.MeshtasticIcons
+
+@Composable
+fun DownloadButton(enabled: Boolean, onClick: () -> Unit) {
+ AnimatedVisibility(
+ visible = enabled,
+ enter =
+ slideInHorizontally(
+ initialOffsetX = { it },
+ animationSpec = tween(durationMillis = 600, easing = FastOutSlowInEasing),
+ ),
+ exit =
+ slideOutHorizontally(
+ targetOffsetX = { it },
+ animationSpec = tween(durationMillis = 600, easing = FastOutSlowInEasing),
+ ),
+ ) {
+ FloatingActionButton(onClick = onClick, contentColor = MaterialTheme.colorScheme.primary) {
+ Icon(
+ imageVector = MeshtasticIcons.Download,
+ contentDescription = stringResource(Res.string.map_download_region),
+ modifier = Modifier.scale(1.25f),
+ )
+ }
+ }
+}
+
+// @Preview(showBackground = true)
+// @Composable
+// private fun DownloadButtonPreview() {
+// DownloadButton(true, onClick = {})
+// }
diff --git a/app/src/fdroid/kotlin/org/meshtastic/app/map/component/EditWaypointDialog.kt b/app/src/fdroid/kotlin/org/meshtastic/app/map/component/EditWaypointDialog.kt
new file mode 100644
index 000000000..c41798bf0
--- /dev/null
+++ b/app/src/fdroid/kotlin/org/meshtastic/app/map/component/EditWaypointDialog.kt
@@ -0,0 +1,357 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.component
+
+import android.app.DatePickerDialog
+import android.widget.DatePicker
+import android.widget.TimePicker
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.ExperimentalLayoutApi
+import androidx.compose.foundation.layout.FlowRow
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.wrapContentWidth
+import androidx.compose.foundation.shape.CircleShape
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.foundation.text.KeyboardActions
+import androidx.compose.foundation.text.KeyboardOptions
+import androidx.compose.material3.AlertDialog
+import androidx.compose.material3.Button
+import androidx.compose.material3.IconButton
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Switch
+import androidx.compose.material3.Text
+import androidx.compose.material3.TextButton
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.input.ImeAction
+import androidx.compose.ui.text.input.KeyboardType
+import androidx.compose.ui.text.style.TextAlign
+import androidx.compose.ui.tooling.preview.Preview
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import kotlinx.datetime.LocalDateTime
+import kotlinx.datetime.Month
+import kotlinx.datetime.toInstant
+import kotlinx.datetime.toLocalDateTime
+import org.jetbrains.compose.resources.stringResource
+import org.meshtastic.core.common.util.nowSeconds
+import org.meshtastic.core.common.util.systemTimeZone
+import org.meshtastic.core.resources.Res
+import org.meshtastic.core.resources.cancel
+import org.meshtastic.core.resources.date
+import org.meshtastic.core.resources.delete
+import org.meshtastic.core.resources.description
+import org.meshtastic.core.resources.expires
+import org.meshtastic.core.resources.locked
+import org.meshtastic.core.resources.name
+import org.meshtastic.core.resources.send
+import org.meshtastic.core.resources.time
+import org.meshtastic.core.resources.waypoint_edit
+import org.meshtastic.core.resources.waypoint_new
+import org.meshtastic.core.ui.component.EditTextPreference
+import org.meshtastic.core.ui.emoji.EmojiPickerDialog
+import org.meshtastic.core.ui.icon.CalendarMonth
+import org.meshtastic.core.ui.icon.Lock
+import org.meshtastic.core.ui.icon.MeshtasticIcons
+import org.meshtastic.core.ui.theme.AppTheme
+import org.meshtastic.proto.Waypoint
+import kotlin.time.Duration.Companion.hours
+import kotlin.time.Instant
+
+@Suppress("LongMethod", "CyclomaticComplexMethod")
+@OptIn(ExperimentalLayoutApi::class)
+@Composable
+fun EditWaypointDialog(
+ waypoint: Waypoint,
+ onSendClicked: (Waypoint) -> Unit,
+ onDeleteClicked: (Waypoint) -> Unit,
+ onDismissRequest: () -> Unit,
+ modifier: Modifier = Modifier,
+) {
+ var waypointInput by remember { mutableStateOf(waypoint) }
+ val title = if (waypoint.id == 0) Res.string.waypoint_new else Res.string.waypoint_edit
+
+ @Suppress("MagicNumber")
+ val emoji = if (waypointInput.icon == 0) 128205 else waypointInput.icon
+ var showEmojiPickerView by remember { mutableStateOf(false) }
+
+ // Get current context for dialogs
+ val context = LocalContext.current
+ val tz = systemTimeZone
+
+ // Determine locale-specific date format
+ val dateFormat = remember { android.text.format.DateFormat.getDateFormat(context) }
+ // Check if 24-hour format is preferred
+ val is24Hour = remember { android.text.format.DateFormat.is24HourFormat(context) }
+ val timeFormat = remember { android.text.format.DateFormat.getTimeFormat(context) }
+
+ val currentInstant =
+ remember(waypointInput.expire) {
+ val expire = waypointInput.expire
+ if (expire != 0 && expire != Int.MAX_VALUE) {
+ kotlin.time.Instant.fromEpochSeconds(expire.toLong())
+ } else {
+ kotlin.time.Clock.System.now() + 8.hours
+ }
+ }
+
+ // State to hold selected date and time
+ var selectedDate by
+ remember(currentInstant) {
+ mutableStateOf(
+ if (waypointInput.expire != 0 && waypointInput.expire != Int.MAX_VALUE) {
+ dateFormat.format(java.util.Date(currentInstant.toEpochMilliseconds()))
+ } else {
+ ""
+ },
+ )
+ }
+ var selectedTime by
+ remember(currentInstant) {
+ mutableStateOf(
+ if (waypointInput.expire != 0 && waypointInput.expire != Int.MAX_VALUE) {
+ timeFormat.format(java.util.Date(currentInstant.toEpochMilliseconds()))
+ } else {
+ ""
+ },
+ )
+ }
+
+ if (!showEmojiPickerView) {
+ AlertDialog(
+ onDismissRequest = onDismissRequest,
+ shape = RoundedCornerShape(16.dp),
+ text = {
+ Column(modifier = modifier.fillMaxWidth()) {
+ Text(
+ text = stringResource(title),
+ style =
+ MaterialTheme.typography.titleLarge.copy(
+ fontWeight = FontWeight.Bold,
+ textAlign = TextAlign.Center,
+ ),
+ modifier = Modifier.fillMaxWidth().padding(bottom = 16.dp),
+ )
+ EditTextPreference(
+ title = stringResource(Res.string.name),
+ value = waypointInput.name,
+ maxSize = 29,
+ enabled = true,
+ isError = false,
+ keyboardOptions =
+ KeyboardOptions.Default.copy(keyboardType = KeyboardType.Text, imeAction = ImeAction.Done),
+ keyboardActions = KeyboardActions(onDone = {}),
+ onValueChanged = { waypointInput = waypointInput.copy(name = it) },
+ trailingIcon = {
+ IconButton(onClick = { showEmojiPickerView = true }) {
+ Text(
+ text = String(Character.toChars(emoji)),
+ modifier =
+ Modifier.background(MaterialTheme.colorScheme.background, CircleShape)
+ .padding(4.dp),
+ fontSize = 24.sp,
+ color = Color.Unspecified.copy(alpha = 1f),
+ )
+ }
+ },
+ )
+ EditTextPreference(
+ title = stringResource(Res.string.description),
+ value = waypointInput.description,
+ maxSize = 99,
+ enabled = true,
+ isError = false,
+ keyboardOptions =
+ KeyboardOptions.Default.copy(keyboardType = KeyboardType.Text, imeAction = ImeAction.Done),
+ keyboardActions = KeyboardActions(onDone = {}),
+ onValueChanged = { waypointInput = waypointInput.copy(description = it) },
+ )
+ Row(
+ modifier = Modifier.fillMaxWidth().size(48.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Image(
+ imageVector = MeshtasticIcons.Lock,
+ contentDescription = stringResource(Res.string.locked),
+ )
+ Text(stringResource(Res.string.locked))
+ Switch(
+ modifier = Modifier.fillMaxWidth().wrapContentWidth(Alignment.End),
+ checked = waypointInput.locked_to != 0,
+ onCheckedChange = { waypointInput = waypointInput.copy(locked_to = if (it) 1 else 0) },
+ )
+ }
+
+ val ldt = currentInstant.toLocalDateTime(tz)
+ val datePickerDialog =
+ DatePickerDialog(
+ context,
+ { _: DatePicker, selectedYear: Int, selectedMonth: Int, selectedDay: Int ->
+ val newLdt =
+ LocalDateTime(
+ year = selectedYear,
+ month = Month(selectedMonth + 1),
+ day = selectedDay,
+ hour = ldt.hour,
+ minute = ldt.minute,
+ second = ldt.second,
+ nanosecond = ldt.nanosecond,
+ )
+ waypointInput = waypointInput.copy(expire = newLdt.toInstant(tz).epochSeconds.toInt())
+ },
+ ldt.year,
+ ldt.month.ordinal,
+ ldt.day,
+ )
+
+ val timePickerDialog =
+ android.app.TimePickerDialog(
+ context,
+ { _: TimePicker, selectedHour: Int, selectedMinute: Int ->
+ val newLdt =
+ LocalDateTime(
+ year = ldt.year,
+ month = ldt.month,
+ day = ldt.day,
+ hour = selectedHour,
+ minute = selectedMinute,
+ second = ldt.second,
+ nanosecond = ldt.nanosecond,
+ )
+ waypointInput = waypointInput.copy(expire = newLdt.toInstant(tz).epochSeconds.toInt())
+ },
+ ldt.hour,
+ ldt.minute,
+ is24Hour,
+ )
+
+ Row(
+ modifier = Modifier.fillMaxWidth().size(48.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Image(
+ imageVector = MeshtasticIcons.CalendarMonth,
+ contentDescription = stringResource(Res.string.expires),
+ )
+ Text(stringResource(Res.string.expires))
+ Switch(
+ modifier = Modifier.fillMaxWidth().wrapContentWidth(Alignment.End),
+ checked = waypointInput.expire != Int.MAX_VALUE && waypointInput.expire != 0,
+ onCheckedChange = { isChecked ->
+ if (isChecked) {
+ waypointInput = waypointInput.copy(expire = currentInstant.epochSeconds.toInt())
+ } else {
+ waypointInput = waypointInput.copy(expire = Int.MAX_VALUE)
+ }
+ },
+ )
+ }
+
+ if (waypointInput.expire != Int.MAX_VALUE && waypointInput.expire != 0) {
+ Row(
+ modifier = Modifier.fillMaxWidth(),
+ horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.CenterHorizontally),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Column(horizontalAlignment = Alignment.CenterHorizontally) {
+ Button(onClick = { datePickerDialog.show() }) { Text(stringResource(Res.string.date)) }
+ Text(
+ modifier = Modifier.padding(top = 4.dp),
+ text = selectedDate,
+ style = MaterialTheme.typography.bodyMedium,
+ textAlign = TextAlign.Center,
+ )
+ }
+ Column(horizontalAlignment = Alignment.CenterHorizontally) {
+ Button(onClick = { timePickerDialog.show() }) { Text(stringResource(Res.string.time)) }
+ Text(
+ modifier = Modifier.padding(top = 4.dp),
+ text = selectedTime,
+ style = MaterialTheme.typography.bodyMedium,
+ textAlign = TextAlign.Center,
+ )
+ }
+ }
+ }
+ }
+ },
+ confirmButton = {
+ FlowRow(
+ modifier = modifier.padding(start = 20.dp, end = 20.dp, bottom = 16.dp),
+ horizontalArrangement = Arrangement.spacedBy(8.dp),
+ verticalArrangement = Arrangement.Center,
+ ) {
+ TextButton(modifier = modifier.weight(1f), onClick = onDismissRequest) {
+ Text(stringResource(Res.string.cancel))
+ }
+ if (waypoint.id != 0) {
+ Button(
+ modifier = modifier.weight(1f),
+ onClick = { onDeleteClicked(waypointInput) },
+ enabled = !(waypointInput.name.isNullOrEmpty()),
+ ) {
+ Text(stringResource(Res.string.delete))
+ }
+ }
+ Button(modifier = modifier.weight(1f), onClick = { onSendClicked(waypointInput) }, enabled = true) {
+ Text(stringResource(Res.string.send))
+ }
+ }
+ },
+ )
+ } else {
+ EmojiPickerDialog(onDismiss = { showEmojiPickerView = false }) {
+ showEmojiPickerView = false
+ waypointInput = waypointInput.copy(icon = it.codePointAt(0))
+ }
+ }
+}
+
+@Preview(showBackground = true)
+@Composable
+@Suppress("MagicNumber")
+private fun EditWaypointFormPreview() {
+ AppTheme {
+ EditWaypointDialog(
+ waypoint =
+ Waypoint(
+ id = 123,
+ name = "Test 123",
+ description = "This is only a test",
+ icon = 128169,
+ expire = (nowSeconds.toInt() + 8 * 3600),
+ ),
+ onSendClicked = {},
+ onDeleteClicked = {},
+ onDismissRequest = {},
+ )
+ }
+}
diff --git a/app/src/fdroid/kotlin/org/meshtastic/app/map/model/CustomTileSource.kt b/app/src/fdroid/kotlin/org/meshtastic/app/map/model/CustomTileSource.kt
new file mode 100644
index 000000000..de0f8c6c2
--- /dev/null
+++ b/app/src/fdroid/kotlin/org/meshtastic/app/map/model/CustomTileSource.kt
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.model
+
+import org.osmdroid.tileprovider.tilesource.ITileSource
+import org.osmdroid.tileprovider.tilesource.OnlineTileSourceBase
+import org.osmdroid.tileprovider.tilesource.TileSourceFactory
+import org.osmdroid.tileprovider.tilesource.TileSourcePolicy
+import org.osmdroid.util.MapTileIndex
+
+@Suppress("UnusedPrivateProperty")
+class CustomTileSource {
+
+ companion object {
+ val OPENWEATHER_RADAR =
+ OnlineTileSourceAuth(
+ "Open Weather Map",
+ 1,
+ 22,
+ 256,
+ ".png",
+ arrayOf("https://tile.openweathermap.org/map/"),
+ "Openweathermap",
+ TileSourcePolicy(
+ 4,
+ TileSourcePolicy.FLAG_NO_BULK or
+ TileSourcePolicy.FLAG_NO_PREVENTIVE or
+ TileSourcePolicy.FLAG_USER_AGENT_MEANINGFUL or
+ TileSourcePolicy.FLAG_USER_AGENT_NORMALIZED,
+ ),
+ "precipitation",
+ "",
+ )
+ private val ESRI_IMAGERY =
+ object :
+ OnlineTileSourceBase(
+ "ESRI World Overview",
+ 1,
+ 20,
+ 256,
+ ".jpg",
+ arrayOf("https://clarity.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/MapServer/tile/"),
+ "Esri, Maxar, Earthstar Geographics, and the GIS User Community",
+ TileSourcePolicy(
+ 4,
+ TileSourcePolicy.FLAG_NO_BULK or
+ TileSourcePolicy.FLAG_NO_PREVENTIVE or
+ TileSourcePolicy.FLAG_USER_AGENT_MEANINGFUL or
+ TileSourcePolicy.FLAG_USER_AGENT_NORMALIZED,
+ ),
+ ) {
+ override fun getTileURLString(pMapTileIndex: Long): String = baseUrl +
+ (
+ MapTileIndex.getZoom(pMapTileIndex).toString() +
+ "/" +
+ MapTileIndex.getY(pMapTileIndex) +
+ "/" +
+ MapTileIndex.getX(pMapTileIndex) +
+ mImageFilenameEnding
+ )
+ }
+
+ private val ESRI_WORLD_TOPO =
+ object :
+ OnlineTileSourceBase(
+ "ESRI World TOPO",
+ 1,
+ 20,
+ 256,
+ ".jpg",
+ arrayOf("https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/"),
+ "Esri, HERE, Garmin, FAO, NOAA, USGS, © OpenStreetMap contributors, and the GIS User Community ",
+ TileSourcePolicy(
+ 4,
+ TileSourcePolicy.FLAG_NO_BULK or
+ TileSourcePolicy.FLAG_NO_PREVENTIVE or
+ TileSourcePolicy.FLAG_USER_AGENT_MEANINGFUL or
+ TileSourcePolicy.FLAG_USER_AGENT_NORMALIZED,
+ ),
+ ) {
+ override fun getTileURLString(pMapTileIndex: Long): String = baseUrl +
+ (
+ MapTileIndex.getZoom(pMapTileIndex).toString() +
+ "/" +
+ MapTileIndex.getY(pMapTileIndex) +
+ "/" +
+ MapTileIndex.getX(pMapTileIndex) +
+ mImageFilenameEnding
+ )
+ }
+ private val USGS_HYDRO_CACHE =
+ object :
+ OnlineTileSourceBase(
+ "USGS Hydro Cache",
+ 0,
+ 18,
+ 256,
+ "",
+ arrayOf("https://basemap.nationalmap.gov/arcgis/rest/services/USGSHydroCached/MapServer/tile/"),
+ "USGS",
+ TileSourcePolicy(
+ 2,
+ TileSourcePolicy.FLAG_NO_PREVENTIVE or
+ TileSourcePolicy.FLAG_USER_AGENT_MEANINGFUL or
+ TileSourcePolicy.FLAG_USER_AGENT_NORMALIZED,
+ ),
+ ) {
+ override fun getTileURLString(pMapTileIndex: Long): String = baseUrl +
+ (
+ MapTileIndex.getZoom(pMapTileIndex).toString() +
+ "/" +
+ MapTileIndex.getY(pMapTileIndex) +
+ "/" +
+ MapTileIndex.getX(pMapTileIndex) +
+ mImageFilenameEnding
+ )
+ }
+ private val USGS_SHADED_RELIEF =
+ object :
+ OnlineTileSourceBase(
+ "USGS Shaded Relief Only",
+ 0,
+ 18,
+ 256,
+ "",
+ arrayOf(
+ "https://basemap.nationalmap.gov/arcgis/rest/services/USGSShadedReliefOnly/MapServer/tile/",
+ ),
+ "USGS",
+ TileSourcePolicy(
+ 2,
+ TileSourcePolicy.FLAG_NO_PREVENTIVE or
+ TileSourcePolicy.FLAG_USER_AGENT_MEANINGFUL or
+ TileSourcePolicy.FLAG_USER_AGENT_NORMALIZED,
+ ),
+ ) {
+ override fun getTileURLString(pMapTileIndex: Long): String = baseUrl +
+ (
+ MapTileIndex.getZoom(pMapTileIndex).toString() +
+ "/" +
+ MapTileIndex.getY(pMapTileIndex) +
+ "/" +
+ MapTileIndex.getX(pMapTileIndex) +
+ mImageFilenameEnding
+ )
+ }
+
+ /** WMS TILE SERVER More research is required to get this to function correctly with overlays */
+ val NOAA_RADAR_WMS =
+ NOAAWmsTileSource(
+ "Recent Weather Radar",
+ arrayOf(
+ "https://new.nowcoast.noaa.gov/arcgis/services/nowcoast/" +
+ "radar_meteo_imagery_nexrad_time/MapServer/WmsServer?",
+ ),
+ "1",
+ "1.1.0",
+ "",
+ "EPSG%3A3857",
+ "",
+ "image/png",
+ )
+
+ /** =============================================================================================== */
+ private val MAPNIK: OnlineTileSourceBase = TileSourceFactory.MAPNIK
+ private val USGS_TOPO: OnlineTileSourceBase = TileSourceFactory.USGS_TOPO
+ private val OPEN_TOPO: OnlineTileSourceBase = TileSourceFactory.OpenTopo
+ private val USGS_SAT: OnlineTileSourceBase = TileSourceFactory.USGS_SAT
+ private val SEAMAP: OnlineTileSourceBase = TileSourceFactory.OPEN_SEAMAP
+ val DEFAULT_TILE_SOURCE: OnlineTileSourceBase = TileSourceFactory.DEFAULT_TILE_SOURCE
+
+ /** Source for each available [ITileSource] and their display names. */
+ val mTileSources: Map =
+ mapOf(
+ MAPNIK to "OpenStreetMap",
+ USGS_TOPO to "USGS TOPO",
+ OPEN_TOPO to "Open TOPO",
+ ESRI_WORLD_TOPO to "ESRI World TOPO",
+ USGS_SAT to "USGS Satellite",
+ ESRI_IMAGERY to "ESRI World Overview",
+ )
+
+ fun getTileSource(index: Int): ITileSource = mTileSources.keys.elementAtOrNull(index) ?: DEFAULT_TILE_SOURCE
+
+ fun getTileSource(aName: String): ITileSource {
+ for (tileSource: ITileSource in mTileSources.keys) {
+ if (tileSource.name().equals(aName)) {
+ return tileSource
+ }
+ }
+ throw IllegalArgumentException("No such tile source: $aName")
+ }
+ }
+}
diff --git a/app/src/fdroid/kotlin/org/meshtastic/app/map/model/MarkerWithLabel.kt b/app/src/fdroid/kotlin/org/meshtastic/app/map/model/MarkerWithLabel.kt
new file mode 100644
index 000000000..da94a7725
--- /dev/null
+++ b/app/src/fdroid/kotlin/org/meshtastic/app/map/model/MarkerWithLabel.kt
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.model
+
+import android.graphics.Canvas
+import android.graphics.Color
+import android.graphics.Paint
+import android.graphics.RectF
+import android.view.MotionEvent
+import org.meshtastic.app.map.dpToPx
+import org.meshtastic.app.map.spToPx
+import org.osmdroid.views.MapView
+import org.osmdroid.views.overlay.Marker
+import org.osmdroid.views.overlay.Polygon
+
+class MarkerWithLabel(mapView: MapView?, label: String, emoji: String? = null) : Marker(mapView) {
+
+ companion object {
+ private const val LABEL_CORNER_RADIUS_DP = 4f
+ private const val LABEL_Y_OFFSET_DP = 34f
+ private const val FONT_SIZE_SP = 14f
+ private const val EMOJI_FONT_SIZE_SP = 20f
+ }
+
+ private val labelYOffsetPx by lazy { mapView?.context?.dpToPx(LABEL_Y_OFFSET_DP) ?: 100 }
+
+ private val labelCornerRadiusPx by lazy { mapView?.context?.dpToPx(LABEL_CORNER_RADIUS_DP) ?: 12 }
+
+ private var nodeColor: Int = Color.GRAY
+
+ fun setNodeColors(colors: Pair) {
+ nodeColor = colors.second
+ }
+
+ private var precisionBits: Int? = null
+
+ fun setPrecisionBits(bits: Int) {
+ precisionBits = bits
+ }
+
+ @Suppress("MagicNumber")
+ private fun getPrecisionMeters(): Double? = when (precisionBits) {
+ 10 -> 23345.484932
+ 11 -> 11672.7369
+ 12 -> 5836.36288
+ 13 -> 2918.175876
+ 14 -> 1459.0823719999053
+ 15 -> 729.53562
+ 16 -> 364.7622
+ 17 -> 182.375556
+ 18 -> 91.182212
+ 19 -> 45.58554
+ else -> null
+ }
+
+ private var onLongClickListener: (() -> Boolean)? = null
+
+ fun setOnLongClickListener(listener: () -> Boolean) {
+ onLongClickListener = listener
+ }
+
+ private val mLabel = label
+ private val mEmoji = emoji
+ private val textPaint =
+ Paint().apply {
+ textSize = mapView?.context?.spToPx(FONT_SIZE_SP)?.toFloat() ?: 40f
+ color = Color.DKGRAY
+ isAntiAlias = true
+ isFakeBoldText = true
+ textAlign = Paint.Align.CENTER
+ }
+ private val emojiPaint =
+ Paint().apply {
+ textSize = mapView?.context?.spToPx(EMOJI_FONT_SIZE_SP)?.toFloat() ?: 80f
+ isAntiAlias = true
+ textAlign = Paint.Align.CENTER
+ }
+
+ private val bgPaint = Paint().apply { color = Color.WHITE }
+
+ private fun getTextBackgroundSize(text: String, x: Float, y: Float): RectF {
+ val fontMetrics = textPaint.fontMetrics
+ val halfTextLength = textPaint.measureText(text) / 2 + 3
+ return RectF((x - halfTextLength), (y + fontMetrics.top), (x + halfTextLength), (y + fontMetrics.bottom))
+ }
+
+ override fun onLongPress(event: MotionEvent?, mapView: MapView?): Boolean {
+ val touched = hitTest(event, mapView)
+ if (touched && this.id != null) {
+ return onLongClickListener?.invoke() ?: super.onLongPress(event, mapView)
+ }
+ return super.onLongPress(event, mapView)
+ }
+
+ @Suppress("MagicNumber")
+ override fun draw(c: Canvas, osmv: MapView?, shadow: Boolean) {
+ super.draw(c, osmv, false)
+ val p = mPositionPixels
+ val bgRect = getTextBackgroundSize(mLabel, p.x.toFloat(), (p.y - labelYOffsetPx.toFloat()))
+ bgRect.inset(-8F, -2F)
+
+ if (mLabel.isNotEmpty()) {
+ c.drawRoundRect(bgRect, labelCornerRadiusPx.toFloat(), labelCornerRadiusPx.toFloat(), bgPaint)
+ c.drawText(mLabel, (p.x - 0F), (p.y - labelYOffsetPx.toFloat()), textPaint)
+ }
+ mEmoji?.let { c.drawText(it, (p.x - 0f), (p.y - 30f), emojiPaint) }
+
+ getPrecisionMeters()?.let { radius ->
+ val polygon =
+ Polygon(osmv).apply {
+ points = Polygon.pointsAsCircle(position, radius)
+ fillPaint.apply {
+ color = nodeColor
+ alpha = 48
+ }
+ outlinePaint.apply {
+ color = nodeColor
+ alpha = 64
+ }
+ }
+ polygon.draw(c, osmv, false)
+ }
+ }
+}
diff --git a/app/src/main/java/com/geeksville/mesh/model/map/NOAAWmsTileSource.kt b/app/src/fdroid/kotlin/org/meshtastic/app/map/model/NOAAWmsTileSource.kt
similarity index 51%
rename from app/src/main/java/com/geeksville/mesh/model/map/NOAAWmsTileSource.kt
rename to app/src/fdroid/kotlin/org/meshtastic/app/map/model/NOAAWmsTileSource.kt
index a99cf1f9b..ac438397a 100644
--- a/app/src/main/java/com/geeksville/mesh/model/map/NOAAWmsTileSource.kt
+++ b/app/src/fdroid/kotlin/org/meshtastic/app/map/model/NOAAWmsTileSource.kt
@@ -1,7 +1,23 @@
-package com.geeksville.mesh.model.map
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.model
import android.content.res.Resources
-import android.util.Log
+import co.touchlab.kermit.Logger
import org.osmdroid.api.IMapView
import org.osmdroid.tileprovider.tilesource.OnlineTileSourceBase
import org.osmdroid.tileprovider.tilesource.TileSourcePolicy
@@ -20,33 +36,40 @@ open class NOAAWmsTileSource(
style: String?,
format: String,
) : OnlineTileSourceBase(
- aName, 0, 5, 256, "png", aBaseUrl, "", TileSourcePolicy(
+ aName,
+ 0,
+ 5,
+ 256,
+ "png",
+ aBaseUrl,
+ "",
+ TileSourcePolicy(
2,
- TileSourcePolicy.FLAG_NO_BULK
- or TileSourcePolicy.FLAG_NO_PREVENTIVE
- or TileSourcePolicy.FLAG_USER_AGENT_MEANINGFUL
- or TileSourcePolicy.FLAG_USER_AGENT_NORMALIZED
- )
+ TileSourcePolicy.FLAG_NO_BULK or
+ TileSourcePolicy.FLAG_NO_PREVENTIVE or
+ TileSourcePolicy.FLAG_USER_AGENT_MEANINGFUL or
+ TileSourcePolicy.FLAG_USER_AGENT_NORMALIZED,
+ ),
) {
// array indexes for array to hold bounding boxes.
- private val MINX = 0
- private val MAXX = 1
- private val MINY = 2
- private val MAXY = 3
+ private val minX = 0
+ private val maxX = 1
+ private val minY = 2
+ private val maxY = 3
// Web Mercator n/w corner of the map.
- private val TILE_ORIGIN = doubleArrayOf(-20037508.34789244, 20037508.34789244)
+ private val tileOrigin = doubleArrayOf(-20037508.34789244, 20037508.34789244)
- //array indexes for that data
- private val ORIG_X = 0
- private val ORIG_Y = 1 // "
+ // array indexes for that data
+ private val origX = 0
+ private val origY = 1 // "
// Size of square world map in meters, using WebMerc projection.
- private val MAP_SIZE = 20037508.34789244 * 2
+ private val mapSize = 20037508.34789244 * 2
private var layer = ""
private var version = "1.1.0"
- private var srs = "EPSG%3A3857" //used by geo server
+ private var srs = "EPSG%3A3857" // used by geo server
private var format = ""
private var time = ""
private var style: String? = null
@@ -54,7 +77,7 @@ open class NOAAWmsTileSource(
private var forceHttp = false
init {
- Log.i(IMapView.LOGTAG, "WMS support is BETA. Please report any issues")
+ Logger.withTag(IMapView.LOGTAG).i { "WMS support is BETA. Please report any issues" }
layer = layername
this.version = version
this.srs = srs
@@ -63,26 +86,7 @@ open class NOAAWmsTileSource(
if (time != null) this.time = time
}
-// fun createFrom(endpoint: WMSEndpoint, layer: WMSLayer): WMSTileSource? {
-// var srs: String? = "EPSG:900913"
-// if (layer.srs.isNotEmpty()) {
-// srs = layer.srs[0]
-// }
-// return if (layer.styles.isEmpty()) {
-// WMSTileSource(
-// layer.name, arrayOf(endpoint.baseurl), layer.name,
-// endpoint.wmsVersion, srs, null, layer.pixelSize
-// )
-// } else WMSTileSource(
-// layer.name, arrayOf(endpoint.baseurl), layer.name,
-// endpoint.wmsVersion, srs, layer.styles[0], layer.pixelSize
-// )
-// }
-
-
- private fun tile2lon(x: Int, z: Int): Double {
- return x / 2.0.pow(z.toDouble()) * 360.0 - 180
- }
+ private fun tile2lon(x: Int, z: Int): Double = x / 2.0.pow(z.toDouble()) * 360.0 - 180
private fun tile2lat(y: Int, z: Int): Double {
val n = Math.PI - 2.0 * Math.PI * y / 2.0.pow(z.toDouble())
@@ -92,30 +96,26 @@ open class NOAAWmsTileSource(
// Return a web Mercator bounding box given tile x/y indexes and a zoom
// level.
private fun getBoundingBox(x: Int, y: Int, zoom: Int): DoubleArray {
- val tileSize = MAP_SIZE / 2.0.pow(zoom.toDouble())
- val minx = TILE_ORIGIN[ORIG_X] + x * tileSize
- val maxx = TILE_ORIGIN[ORIG_X] + (x + 1) * tileSize
- val miny = TILE_ORIGIN[ORIG_Y] - (y + 1) * tileSize
- val maxy = TILE_ORIGIN[ORIG_Y] - y * tileSize
+ val tileSize = mapSize / 2.0.pow(zoom.toDouble())
+ val minx = tileOrigin[origX] + x * tileSize
+ val maxx = tileOrigin[origX] + (x + 1) * tileSize
+ val miny = tileOrigin[origY] - (y + 1) * tileSize
+ val maxy = tileOrigin[origY] - y * tileSize
val bbox = DoubleArray(4)
- bbox[MINX] = minx
- bbox[MINY] = miny
- bbox[MAXX] = maxx
- bbox[MAXY] = maxy
+ bbox[minX] = minx
+ bbox[minY] = miny
+ bbox[maxX] = maxx
+ bbox[maxY] = maxy
return bbox
}
- fun isForceHttps(): Boolean {
- return forceHttps
- }
+ fun isForceHttps(): Boolean = forceHttps
fun setForceHttps(forceHttps: Boolean) {
this.forceHttps = forceHttps
}
- fun isForceHttp(): Boolean {
- return forceHttp
- }
+ fun isForceHttp(): Boolean = forceHttp
fun setForceHttp(forceHttp: Boolean) {
this.forceHttp = forceHttp
@@ -126,8 +126,7 @@ open class NOAAWmsTileSource(
if (forceHttps) baseUrl = baseUrl.replace("http://", "https://")
if (forceHttp) baseUrl = baseUrl.replace("https://", "http://")
val sb = StringBuilder(baseUrl)
- if (!baseUrl.endsWith("&"))
- sb.append("service=WMS")
+ if (!baseUrl.endsWith("&")) sb.append("service=WMS")
sb.append("&request=GetMap")
sb.append("&version=").append(version)
sb.append("&layers=").append(layer)
@@ -139,16 +138,17 @@ open class NOAAWmsTileSource(
sb.append("&srs=").append(srs)
sb.append("&size=").append(getSize())
sb.append("&bbox=")
- val bbox = getBoundingBox(
- MapTileIndex.getX(pMapTileIndex),
- MapTileIndex.getY(pMapTileIndex),
- MapTileIndex.getZoom(pMapTileIndex)
- )
- sb.append(bbox[MINX]).append(",")
- sb.append(bbox[MINY]).append(",")
- sb.append(bbox[MAXX]).append(",")
- sb.append(bbox[MAXY])
- Log.i(IMapView.LOGTAG, sb.toString())
+ val bbox =
+ getBoundingBox(
+ MapTileIndex.getX(pMapTileIndex),
+ MapTileIndex.getY(pMapTileIndex),
+ MapTileIndex.getZoom(pMapTileIndex),
+ )
+ sb.append(bbox[minX]).append(",")
+ sb.append(bbox[minY]).append(",")
+ sb.append(bbox[maxX]).append(",")
+ sb.append(bbox[maxY])
+ Logger.withTag(IMapView.LOGTAG).i { sb.toString() }
return sb.toString()
}
@@ -156,6 +156,5 @@ open class NOAAWmsTileSource(
val height = Resources.getSystem().displayMetrics.heightPixels
val width = Resources.getSystem().displayMetrics.widthPixels
return "$width,$height"
-
}
-}
\ No newline at end of file
+}
diff --git a/app/src/fdroid/kotlin/org/meshtastic/app/map/model/OnlineTileSourceAuth.kt b/app/src/fdroid/kotlin/org/meshtastic/app/map/model/OnlineTileSourceAuth.kt
new file mode 100644
index 000000000..3d51133bd
--- /dev/null
+++ b/app/src/fdroid/kotlin/org/meshtastic/app/map/model/OnlineTileSourceAuth.kt
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.model
+
+import org.osmdroid.tileprovider.tilesource.OnlineTileSourceBase
+import org.osmdroid.tileprovider.tilesource.TileSourcePolicy
+import org.osmdroid.util.MapTileIndex
+
+@Suppress("LongParameterList")
+open class OnlineTileSourceAuth(
+ name: String,
+ zoomLevel: Int,
+ zoomMaxLevel: Int,
+ tileSizePixels: Int,
+ imageFileNameEnding: String,
+ baseUrl: Array,
+ pCopyright: String,
+ tileSourcePolicy: TileSourcePolicy,
+ layerName: String?,
+ apiKey: String,
+) : OnlineTileSourceBase(
+ name,
+ zoomLevel,
+ zoomMaxLevel,
+ tileSizePixels,
+ imageFileNameEnding,
+ baseUrl,
+ pCopyright,
+ tileSourcePolicy,
+) {
+ private var layerName = ""
+ private var apiKey = ""
+
+ init {
+ if (layerName != null) {
+ this.layerName = layerName
+ }
+ this.apiKey = apiKey
+ }
+
+ override fun getTileURLString(pMapTileIndex: Long): String = "$baseUrl$layerName/" +
+ (
+ MapTileIndex.getZoom(pMapTileIndex).toString() +
+ "/" +
+ MapTileIndex.getX(pMapTileIndex).toString() +
+ "/" +
+ MapTileIndex.getY(pMapTileIndex).toString()
+ ) +
+ mImageFilenameEnding +
+ "?appId=$apiKey"
+}
diff --git a/app/src/fdroid/kotlin/org/meshtastic/app/map/node/NodeMapScreen.kt b/app/src/fdroid/kotlin/org/meshtastic/app/map/node/NodeMapScreen.kt
new file mode 100644
index 000000000..b7795180f
--- /dev/null
+++ b/app/src/fdroid/kotlin/org/meshtastic/app/map/node/NodeMapScreen.kt
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.node
+
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.padding
+import androidx.compose.material3.Scaffold
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.ui.Modifier
+import androidx.lifecycle.compose.collectAsStateWithLifecycle
+import org.meshtastic.core.ui.component.MainAppBar
+import org.meshtastic.feature.map.node.NodeMapViewModel
+
+@Composable
+fun NodeMapScreen(nodeMapViewModel: NodeMapViewModel, onNavigateUp: () -> Unit) {
+ val node by nodeMapViewModel.node.collectAsStateWithLifecycle()
+ val positions by nodeMapViewModel.positionLogs.collectAsStateWithLifecycle()
+
+ Scaffold(
+ topBar = {
+ MainAppBar(
+ title = node?.user?.long_name ?: "",
+ ourNode = null,
+ showNodeChip = false,
+ canNavigateUp = true,
+ onNavigateUp = onNavigateUp,
+ actions = {},
+ onClickChip = {},
+ )
+ },
+ ) { paddingValues ->
+ NodeTrackOsmMap(
+ positions = positions,
+ applicationId = nodeMapViewModel.applicationId,
+ mapStyleId = nodeMapViewModel.mapStyleId,
+ modifier = Modifier.fillMaxSize().padding(paddingValues),
+ )
+ }
+}
diff --git a/app/src/fdroid/kotlin/org/meshtastic/app/map/node/NodeTrackMap.kt b/app/src/fdroid/kotlin/org/meshtastic/app/map/node/NodeTrackMap.kt
new file mode 100644
index 000000000..77b595d88
--- /dev/null
+++ b/app/src/fdroid/kotlin/org/meshtastic/app/map/node/NodeTrackMap.kt
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.node
+
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import org.koin.compose.viewmodel.koinViewModel
+import org.meshtastic.feature.map.node.NodeMapViewModel
+import org.meshtastic.proto.Position
+
+/**
+ * Flavor-unified entry point for the embeddable node-track map. Resolves [destNum] to obtain
+ * [NodeMapViewModel.applicationId] and [NodeMapViewModel.mapStyleId], then delegates to the OSMDroid implementation
+ * ([NodeTrackOsmMap]).
+ *
+ * Supports optional synchronized selection via [selectedPositionTime] and [onPositionSelected].
+ */
+@Composable
+fun NodeTrackMap(
+ destNum: Int,
+ positions: List,
+ modifier: Modifier = Modifier,
+ selectedPositionTime: Int? = null,
+ onPositionSelected: ((Int) -> Unit)? = null,
+) {
+ val vm = koinViewModel()
+ vm.setDestNum(destNum)
+ NodeTrackOsmMap(
+ positions = positions,
+ applicationId = vm.applicationId,
+ mapStyleId = vm.mapStyleId,
+ modifier = modifier,
+ selectedPositionTime = selectedPositionTime,
+ onPositionSelected = onPositionSelected,
+ )
+}
diff --git a/app/src/fdroid/kotlin/org/meshtastic/app/map/node/NodeTrackOsmMap.kt b/app/src/fdroid/kotlin/org/meshtastic/app/map/node/NodeTrackOsmMap.kt
new file mode 100644
index 000000000..a6aec4c2d
--- /dev/null
+++ b/app/src/fdroid/kotlin/org/meshtastic/app/map/node/NodeTrackOsmMap.kt
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.node
+
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.padding
+import androidx.compose.material3.DropdownMenu
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Slider
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.platform.LocalDensity
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.viewinterop.AndroidView
+import androidx.lifecycle.compose.collectAsStateWithLifecycle
+import org.jetbrains.compose.resources.stringResource
+import org.koin.compose.viewmodel.koinViewModel
+import org.meshtastic.app.map.MapViewModel
+import org.meshtastic.app.map.addCopyright
+import org.meshtastic.app.map.addPolyline
+import org.meshtastic.app.map.addPositionMarkers
+import org.meshtastic.app.map.addScaleBarOverlay
+import org.meshtastic.app.map.model.CustomTileSource
+import org.meshtastic.app.map.rememberMapViewWithLifecycle
+import org.meshtastic.core.common.util.nowSeconds
+import org.meshtastic.core.model.util.GeoConstants.DEG_D
+import org.meshtastic.core.resources.Res
+import org.meshtastic.core.resources.last_heard_filter_label
+import org.meshtastic.feature.map.LastHeardFilter
+import org.meshtastic.feature.map.component.MapControlsOverlay
+import org.meshtastic.proto.Position
+import org.osmdroid.util.BoundingBox
+import org.osmdroid.util.GeoPoint
+import kotlin.math.roundToInt
+
+/**
+ * A focused OSMDroid map composable that renders **only** a node's position track — a dashed polyline with directional
+ * markers for each historical position.
+ *
+ * Applies the [lastHeardTrackFilter][org.meshtastic.feature.map.BaseMapViewModel.MapFilterState.lastHeardTrackFilter]
+ * from [MapViewModel] to filter positions by time, matching the behavior of the Google Maps implementation. Includes a
+ * minimal [MapControlsOverlay][org.meshtastic.feature.map.component.MapControlsOverlay] with a track time filter slider
+ * so users can adjust the time range directly from the map.
+ *
+ * Supports optional synchronized selection via [selectedPositionTime] and [onPositionSelected].
+ *
+ * Unlike the main [org.meshtastic.app.map.MapView], this composable does **not** include node clusters, waypoints, or
+ * location tracking. It is designed to be embedded inside the position-log adaptive layout.
+ */
+@Composable
+fun NodeTrackOsmMap(
+ positions: List,
+ applicationId: String,
+ mapStyleId: Int,
+ modifier: Modifier = Modifier,
+ selectedPositionTime: Int? = null,
+ onPositionSelected: ((Int) -> Unit)? = null,
+ mapViewModel: MapViewModel = koinViewModel(),
+) {
+ val density = LocalDensity.current
+ val mapFilterState by mapViewModel.mapFilterStateFlow.collectAsStateWithLifecycle()
+ val lastHeardTrackFilter = mapFilterState.lastHeardTrackFilter
+
+ val filteredPositions =
+ remember(positions, lastHeardTrackFilter) {
+ positions.filter {
+ lastHeardTrackFilter == LastHeardFilter.Any || it.time > nowSeconds - lastHeardTrackFilter.seconds
+ }
+ }
+
+ val geoPoints =
+ remember(filteredPositions) {
+ filteredPositions.map { GeoPoint((it.latitude_i ?: 0) * DEG_D, (it.longitude_i ?: 0) * DEG_D) }
+ }
+ val cameraView = remember(geoPoints) { BoundingBox.fromGeoPoints(geoPoints) }
+ val mapView =
+ rememberMapViewWithLifecycle(
+ applicationId = applicationId,
+ box = cameraView,
+ tileSource = CustomTileSource.getTileSource(mapStyleId),
+ )
+
+ var filterMenuExpanded by remember { mutableStateOf(false) }
+
+ Box(modifier = modifier) {
+ AndroidView(
+ modifier = Modifier.matchParentSize(),
+ factory = { mapView },
+ update = { map ->
+ map.overlays.clear()
+ map.addCopyright()
+ map.addScaleBarOverlay(density)
+ map.addPolyline(density, geoPoints) {}
+ map.addPositionMarkers(filteredPositions) { time -> onPositionSelected?.invoke(time) }
+ // Center on selected position
+ if (selectedPositionTime != null) {
+ val selected = filteredPositions.find { it.time == selectedPositionTime }
+ if (selected != null) {
+ val point = GeoPoint((selected.latitude_i ?: 0) * DEG_D, (selected.longitude_i ?: 0) * DEG_D)
+ map.controller.animateTo(point)
+ }
+ }
+ },
+ )
+
+ // Track filter controls overlay
+ MapControlsOverlay(
+ modifier = Modifier.align(Alignment.TopCenter).padding(top = 8.dp),
+ onToggleFilterMenu = { filterMenuExpanded = true },
+ filterDropdownContent = {
+ DropdownMenu(expanded = filterMenuExpanded, onDismissRequest = { filterMenuExpanded = false }) {
+ Column(modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp)) {
+ val filterOptions = LastHeardFilter.entries
+ val selectedIndex = filterOptions.indexOf(lastHeardTrackFilter)
+ var sliderPosition by remember(selectedIndex) { mutableFloatStateOf(selectedIndex.toFloat()) }
+
+ Text(
+ text =
+ stringResource(
+ Res.string.last_heard_filter_label,
+ stringResource(lastHeardTrackFilter.label),
+ ),
+ style = MaterialTheme.typography.labelLarge,
+ )
+ Slider(
+ value = sliderPosition,
+ onValueChange = { sliderPosition = it },
+ onValueChangeFinished = {
+ val newIndex = sliderPosition.roundToInt().coerceIn(0, filterOptions.size - 1)
+ mapViewModel.setLastHeardTrackFilter(filterOptions[newIndex])
+ },
+ valueRange = 0f..(filterOptions.size - 1).toFloat(),
+ steps = filterOptions.size - 2,
+ )
+ }
+ }
+ },
+ )
+ }
+}
diff --git a/app/src/fdroid/kotlin/org/meshtastic/app/map/traceroute/TracerouteMap.kt b/app/src/fdroid/kotlin/org/meshtastic/app/map/traceroute/TracerouteMap.kt
new file mode 100644
index 000000000..fcf1d47e9
--- /dev/null
+++ b/app/src/fdroid/kotlin/org/meshtastic/app/map/traceroute/TracerouteMap.kt
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.traceroute
+
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import org.meshtastic.core.model.TracerouteOverlay
+import org.meshtastic.proto.Position
+
+/**
+ * Flavor-unified entry point for the embeddable traceroute map. Delegates to the OSMDroid implementation
+ * ([TracerouteOsmMap]).
+ */
+@Composable
+fun TracerouteMap(
+ tracerouteOverlay: TracerouteOverlay?,
+ tracerouteNodePositions: Map,
+ onMappableCountChanged: (shown: Int, total: Int) -> Unit,
+ modifier: Modifier = Modifier,
+) {
+ TracerouteOsmMap(
+ tracerouteOverlay = tracerouteOverlay,
+ tracerouteNodePositions = tracerouteNodePositions,
+ onMappableCountChanged = onMappableCountChanged,
+ modifier = modifier,
+ )
+}
diff --git a/app/src/fdroid/kotlin/org/meshtastic/app/map/traceroute/TracerouteOsmMap.kt b/app/src/fdroid/kotlin/org/meshtastic/app/map/traceroute/TracerouteOsmMap.kt
new file mode 100644
index 000000000..55b49154a
--- /dev/null
+++ b/app/src/fdroid/kotlin/org/meshtastic/app/map/traceroute/TracerouteOsmMap.kt
@@ -0,0 +1,288 @@
+/*
+ * Copyright (c) 2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+@file:Suppress("MagicNumber")
+
+package org.meshtastic.app.map.traceroute
+
+import android.graphics.Paint
+import androidx.appcompat.content.res.AppCompatResources
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.toArgb
+import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.platform.LocalDensity
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.viewinterop.AndroidView
+import androidx.lifecycle.compose.collectAsStateWithLifecycle
+import org.koin.compose.viewmodel.koinViewModel
+import org.meshtastic.app.R
+import org.meshtastic.app.map.MapViewModel
+import org.meshtastic.app.map.addCopyright
+import org.meshtastic.app.map.addScaleBarOverlay
+import org.meshtastic.app.map.model.CustomTileSource
+import org.meshtastic.app.map.model.MarkerWithLabel
+import org.meshtastic.app.map.rememberMapViewWithLifecycle
+import org.meshtastic.app.map.zoomIn
+import org.meshtastic.core.model.TracerouteOverlay
+import org.meshtastic.core.model.util.GeoConstants.EARTH_RADIUS_METERS
+import org.meshtastic.core.ui.theme.TracerouteColors
+import org.meshtastic.core.ui.util.formatAgo
+import org.meshtastic.feature.map.tracerouteNodeSelection
+import org.meshtastic.proto.Position
+import org.osmdroid.util.BoundingBox
+import org.osmdroid.util.GeoPoint
+import org.osmdroid.views.overlay.Marker
+import org.osmdroid.views.overlay.Polyline
+import kotlin.math.PI
+import kotlin.math.abs
+import kotlin.math.asin
+import kotlin.math.atan2
+import kotlin.math.cos
+import kotlin.math.sin
+
+private const val TRACEROUTE_OFFSET_METERS = 100.0
+private const val TRACEROUTE_SINGLE_POINT_ZOOM = 12.0
+private const val TRACEROUTE_ZOOM_OUT_LEVELS = 0.5
+
+/**
+ * A focused OSMDroid map composable that renders **only** traceroute visualization — node markers for each hop and
+ * forward/return offset polylines with auto-centering camera.
+ *
+ * Unlike the main `MapView`, this composable does **not** include node clusters, waypoints, location tracking, or any
+ * map controls. It is designed to be embedded inside `TracerouteMapScreen`'s scaffold.
+ */
+@Composable
+fun TracerouteOsmMap(
+ tracerouteOverlay: TracerouteOverlay?,
+ tracerouteNodePositions: Map,
+ onMappableCountChanged: (shown: Int, total: Int) -> Unit,
+ modifier: Modifier = Modifier,
+ mapViewModel: MapViewModel = koinViewModel(),
+) {
+ val context = LocalContext.current
+ val density = LocalDensity.current
+ val nodes by mapViewModel.nodes.collectAsStateWithLifecycle()
+ val markerIcon = remember { AppCompatResources.getDrawable(context, R.drawable.ic_location_on) }
+
+ // Resolve which nodes to display for the traceroute
+ val tracerouteSelection =
+ remember(tracerouteOverlay, tracerouteNodePositions, nodes) {
+ mapViewModel.tracerouteNodeSelection(
+ tracerouteOverlay = tracerouteOverlay,
+ tracerouteNodePositions = tracerouteNodePositions,
+ nodes = nodes,
+ )
+ }
+ val displayNodes = tracerouteSelection.nodesForMarkers
+ val nodeLookup = tracerouteSelection.nodeLookup
+
+ // Report mappable count
+ LaunchedEffect(tracerouteOverlay, displayNodes) {
+ if (tracerouteOverlay != null) {
+ onMappableCountChanged(displayNodes.size, tracerouteOverlay.relatedNodeNums.size)
+ }
+ }
+
+ // Compute polyline GeoPoints from node positions
+ val forwardPoints =
+ remember(tracerouteOverlay, nodeLookup) {
+ tracerouteOverlay?.forwardRoute?.mapNotNull {
+ nodeLookup[it]?.let { node -> GeoPoint(node.latitude, node.longitude) }
+ } ?: emptyList()
+ }
+ val returnPoints =
+ remember(tracerouteOverlay, nodeLookup) {
+ tracerouteOverlay?.returnRoute?.mapNotNull {
+ nodeLookup[it]?.let { node -> GeoPoint(node.latitude, node.longitude) }
+ } ?: emptyList()
+ }
+
+ // Compute offset polylines for visual separation
+ val headingReferencePoints =
+ remember(forwardPoints, returnPoints) {
+ when {
+ forwardPoints.size >= 2 -> forwardPoints
+ returnPoints.size >= 2 -> returnPoints
+ else -> emptyList()
+ }
+ }
+ val forwardOffsetPoints =
+ remember(forwardPoints, headingReferencePoints) {
+ offsetPolyline(
+ points = forwardPoints,
+ offsetMeters = TRACEROUTE_OFFSET_METERS,
+ headingReferencePoints = headingReferencePoints,
+ sideMultiplier = 1.0,
+ )
+ }
+ val returnOffsetPoints =
+ remember(returnPoints, headingReferencePoints) {
+ offsetPolyline(
+ points = returnPoints,
+ offsetMeters = TRACEROUTE_OFFSET_METERS,
+ headingReferencePoints = headingReferencePoints,
+ sideMultiplier = -1.0,
+ )
+ }
+
+ // Camera auto-center
+ var hasCentered by remember(tracerouteOverlay) { mutableStateOf(false) }
+
+ // Build initial camera from all traceroute points
+ val allPoints = remember(forwardPoints, returnPoints) { (forwardPoints + returnPoints).distinct() }
+ val initialCameraView =
+ remember(allPoints) { if (allPoints.isEmpty()) null else BoundingBox.fromGeoPoints(allPoints) }
+
+ val mapView =
+ rememberMapViewWithLifecycle(
+ applicationId = mapViewModel.applicationId,
+ box = initialCameraView ?: BoundingBox(),
+ tileSource = CustomTileSource.getTileSource(mapViewModel.mapStyleId),
+ )
+
+ // Center camera on traceroute bounds
+ LaunchedEffect(tracerouteOverlay, forwardPoints, returnPoints) {
+ if (tracerouteOverlay == null || hasCentered) return@LaunchedEffect
+ if (allPoints.isNotEmpty()) {
+ if (allPoints.size == 1) {
+ mapView.controller.setCenter(allPoints.first())
+ mapView.controller.setZoom(TRACEROUTE_SINGLE_POINT_ZOOM)
+ } else {
+ mapView.zoomToBoundingBox(
+ BoundingBox.fromGeoPoints(allPoints).zoomIn(-TRACEROUTE_ZOOM_OUT_LEVELS),
+ true,
+ )
+ }
+ hasCentered = true
+ }
+ }
+
+ AndroidView(
+ modifier = modifier,
+ factory = { mapView.apply { setDestroyMode(false) } },
+ update = { map ->
+ map.overlays.clear()
+ map.addCopyright()
+ map.addScaleBarOverlay(density)
+
+ // Render traceroute polylines
+ buildTraceroutePolylines(forwardOffsetPoints, returnOffsetPoints, density).forEach { map.overlays.add(it) }
+
+ // Render simple node markers
+ displayNodes.forEach { node ->
+ val position = GeoPoint(node.latitude, node.longitude)
+ val marker =
+ MarkerWithLabel(mapView = map, label = "${node.user.short_name} ${formatAgo(node.position.time)}")
+ .apply {
+ id = node.user.id
+ title = node.user.long_name
+ setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM)
+ this.position = position
+ icon = markerIcon
+ setNodeColors(node.colors)
+ }
+ map.overlays.add(marker)
+ }
+
+ map.invalidate()
+ },
+ )
+}
+
+private fun buildTraceroutePolylines(
+ forwardPoints: List,
+ returnPoints: List,
+ density: androidx.compose.ui.unit.Density,
+): List {
+ val polylines = mutableListOf()
+
+ fun buildPolyline(points: List, color: Int, strokeWidth: Float): Polyline = Polyline().apply {
+ setPoints(points)
+ outlinePaint.apply {
+ this.color = color
+ this.strokeWidth = strokeWidth
+ strokeCap = Paint.Cap.ROUND
+ strokeJoin = Paint.Join.ROUND
+ style = Paint.Style.STROKE
+ }
+ }
+
+ forwardPoints
+ .takeIf { it.size >= 2 }
+ ?.let { points ->
+ polylines.add(buildPolyline(points, TracerouteColors.OutgoingRoute.toArgb(), with(density) { 6.dp.toPx() }))
+ }
+ returnPoints
+ .takeIf { it.size >= 2 }
+ ?.let { points ->
+ polylines.add(buildPolyline(points, TracerouteColors.ReturnRoute.toArgb(), with(density) { 5.dp.toPx() }))
+ }
+ return polylines
+}
+
+// --- Haversine offset math for OSMDroid (no SphericalUtil available) ---
+
+private fun Double.toRad(): Double = this * PI / 180.0
+
+private fun bearingRad(from: GeoPoint, to: GeoPoint): Double {
+ val lat1 = from.latitude.toRad()
+ val lat2 = to.latitude.toRad()
+ val dLon = (to.longitude - from.longitude).toRad()
+ return atan2(sin(dLon) * cos(lat2), cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(dLon))
+}
+
+private fun GeoPoint.offsetPoint(headingRad: Double, offsetMeters: Double): GeoPoint {
+ val distanceByRadius = offsetMeters / EARTH_RADIUS_METERS
+ val lat1 = latitude.toRad()
+ val lon1 = longitude.toRad()
+ val lat2 = asin(sin(lat1) * cos(distanceByRadius) + cos(lat1) * sin(distanceByRadius) * cos(headingRad))
+ val lon2 =
+ lon1 + atan2(sin(headingRad) * sin(distanceByRadius) * cos(lat1), cos(distanceByRadius) - sin(lat1) * sin(lat2))
+ return GeoPoint(lat2 * 180.0 / PI, lon2 * 180.0 / PI)
+}
+
+private fun offsetPolyline(
+ points: List,
+ offsetMeters: Double,
+ headingReferencePoints: List = points,
+ sideMultiplier: Double = 1.0,
+): List {
+ val headingPoints = headingReferencePoints.takeIf { it.size >= 2 } ?: points
+ if (points.size < 2 || headingPoints.size < 2 || offsetMeters == 0.0) return points
+
+ val headings =
+ headingPoints.mapIndexed { index, _ ->
+ when (index) {
+ 0 -> bearingRad(headingPoints[0], headingPoints[1])
+ headingPoints.lastIndex ->
+ bearingRad(headingPoints[headingPoints.lastIndex - 1], headingPoints[headingPoints.lastIndex])
+
+ else -> bearingRad(headingPoints[index - 1], headingPoints[index + 1])
+ }
+ }
+
+ return points.mapIndexed { index, point ->
+ val heading = headings[index.coerceIn(0, headings.lastIndex)]
+ val perpendicularHeading = heading + (PI / 2 * sideMultiplier)
+ point.offsetPoint(perpendicularHeading, abs(offsetMeters))
+ }
+}
diff --git a/app/src/fdroid/kotlin/org/meshtastic/app/node/component/InlineMap.kt b/app/src/fdroid/kotlin/org/meshtastic/app/node/component/InlineMap.kt
new file mode 100644
index 000000000..447765522
--- /dev/null
+++ b/app/src/fdroid/kotlin/org/meshtastic/app/node/component/InlineMap.kt
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.node.component
+
+import android.view.ViewGroup
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.remember
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.viewinterop.AndroidView
+import org.meshtastic.core.model.Node
+import org.osmdroid.tileprovider.tilesource.TileSourceFactory
+import org.osmdroid.util.GeoPoint
+import org.osmdroid.views.MapView
+import org.osmdroid.views.overlay.Marker
+
+@Composable
+fun InlineMap(node: Node, modifier: Modifier = Modifier) {
+ val context = androidx.compose.ui.platform.LocalContext.current
+
+ val map = remember {
+ MapView(context).apply {
+ layoutParams =
+ ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
+
+ // Default osmdroid tile source.
+ setTileSource(TileSourceFactory.MAPNIK)
+ setMultiTouchControls(false)
+
+ controller.setZoom(15.0)
+ }
+ }
+
+ LaunchedEffect(node.num) {
+ val point = GeoPoint(node.latitude, node.longitude)
+
+ map.overlays.clear()
+
+ val marker =
+ Marker(map).apply {
+ position = point
+ setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM)
+ }
+ map.overlays.add(marker)
+
+ map.controller.animateTo(point)
+ }
+
+ AndroidView(factory = { map }, modifier = modifier)
+}
diff --git a/app/src/fdroid/kotlin/org/meshtastic/app/node/metrics/TracerouteMapOverlayInsets.kt b/app/src/fdroid/kotlin/org/meshtastic/app/node/metrics/TracerouteMapOverlayInsets.kt
new file mode 100644
index 000000000..d6515eeb7
--- /dev/null
+++ b/app/src/fdroid/kotlin/org/meshtastic/app/node/metrics/TracerouteMapOverlayInsets.kt
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.node.metrics
+
+import androidx.compose.foundation.layout.PaddingValues
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.unit.dp
+import org.meshtastic.core.ui.util.TracerouteMapOverlayInsets
+
+fun getTracerouteMapOverlayInsets(): TracerouteMapOverlayInsets = TracerouteMapOverlayInsets(
+ overlayAlignment = Alignment.BottomEnd,
+ overlayPadding = PaddingValues(end = 16.dp, bottom = 16.dp),
+ contentHorizontalAlignment = Alignment.End,
+)
diff --git a/app/src/fdroid/res/drawable/ic_location_on.xml b/app/src/fdroid/res/drawable/ic_location_on.xml
new file mode 100644
index 000000000..b93f33174
--- /dev/null
+++ b/app/src/fdroid/res/drawable/ic_location_on.xml
@@ -0,0 +1,14 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/fdroid/res/drawable/ic_map_location_dot.xml b/app/src/fdroid/res/drawable/ic_map_location_dot.xml
new file mode 100644
index 000000000..2935f162e
--- /dev/null
+++ b/app/src/fdroid/res/drawable/ic_map_location_dot.xml
@@ -0,0 +1,11 @@
+
+
+
\ No newline at end of file
diff --git a/app/src/fdroid/res/drawable/ic_map_navigation.xml b/app/src/fdroid/res/drawable/ic_map_navigation.xml
new file mode 100644
index 000000000..83d579f8a
--- /dev/null
+++ b/app/src/fdroid/res/drawable/ic_map_navigation.xml
@@ -0,0 +1,11 @@
+
+
+
\ No newline at end of file
diff --git a/app/src/fdroidDebug/res/drawable-anydpi/ic_launcher_background.xml b/app/src/fdroidDebug/res/drawable-anydpi/ic_launcher_background.xml
new file mode 100644
index 000000000..170282ec9
--- /dev/null
+++ b/app/src/fdroidDebug/res/drawable-anydpi/ic_launcher_background.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
diff --git a/app/src/fdroidDebug/res/values/strings.xml b/app/src/fdroidDebug/res/values/strings.xml
new file mode 100644
index 000000000..2571a435c
--- /dev/null
+++ b/app/src/fdroidDebug/res/values/strings.xml
@@ -0,0 +1,19 @@
+
+
+ Fdroid Debug
+
diff --git a/app/src/google/AndroidManifest.xml b/app/src/google/AndroidManifest.xml
new file mode 100644
index 000000000..c4138cb0b
--- /dev/null
+++ b/app/src/google/AndroidManifest.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/google/kotlin/org/meshtastic/app/analytics/GooglePlatformAnalytics.kt b/app/src/google/kotlin/org/meshtastic/app/analytics/GooglePlatformAnalytics.kt
new file mode 100644
index 000000000..0583dd78e
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/analytics/GooglePlatformAnalytics.kt
@@ -0,0 +1,343 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.analytics
+
+import android.app.Application
+import android.content.Context
+import android.os.Bundle
+import android.provider.Settings
+import androidx.lifecycle.ProcessLifecycleOwner
+import androidx.lifecycle.lifecycleScope
+import co.touchlab.kermit.LogWriter
+import co.touchlab.kermit.Severity
+import com.datadog.android.Datadog
+import com.datadog.android.DatadogSite
+import com.datadog.android.core.configuration.Configuration
+import com.datadog.android.log.Logger
+import com.datadog.android.log.Logs
+import com.datadog.android.log.LogsConfiguration
+import com.datadog.android.privacy.TrackingConsent
+import com.datadog.android.rum.GlobalRumMonitor
+import com.datadog.android.rum.Rum
+import com.datadog.android.rum.RumActionType
+import com.datadog.android.rum.RumConfiguration
+import com.datadog.android.sessionreplay.SessionReplay
+import com.datadog.android.sessionreplay.SessionReplayConfiguration
+import com.datadog.android.sessionreplay.TextAndInputPrivacy
+import com.datadog.android.trace.Trace
+import com.datadog.android.trace.TraceConfiguration
+import com.datadog.android.trace.opentelemetry.DatadogOpenTelemetry
+import com.google.android.gms.common.ConnectionResult
+import com.google.android.gms.common.GoogleApiAvailabilityLight
+import com.google.firebase.Firebase
+import com.google.firebase.analytics.FirebaseAnalytics.ConsentStatus
+import com.google.firebase.analytics.FirebaseAnalytics.ConsentType
+import com.google.firebase.analytics.analytics
+import com.google.firebase.crashlytics.crashlytics
+import com.google.firebase.crashlytics.setCustomKeys
+import com.google.firebase.initialize
+import io.opentelemetry.api.GlobalOpenTelemetry
+import kotlinx.coroutines.CancellationException
+import kotlinx.coroutines.flow.launchIn
+import kotlinx.coroutines.flow.onEach
+import org.koin.core.annotation.Single
+import org.meshtastic.app.BuildConfig
+import org.meshtastic.core.repository.AnalyticsPrefs
+import org.meshtastic.core.repository.DataPair
+import org.meshtastic.core.repository.PlatformAnalytics
+import co.touchlab.kermit.Logger as KermitLogger
+
+/**
+ * Google Play Services specific implementation of [PlatformAnalytics]. This helper initializes and manages Firebase and
+ * Datadog services, and subscribes to analytics preference changes to update consent accordingly.
+ *
+ * This implementation delays initialization of SDKs until user consent is granted to reduce tracking "noise" and
+ * respect privacy-focused environments.
+ */
+@Single
+class GooglePlatformAnalytics(private val context: Context, private val analyticsPrefs: AnalyticsPrefs) :
+ PlatformAnalytics {
+
+ private val sampleRate = 100f // Match Apple: 100% sampling for cross-platform DataDog comparison
+
+ private var datadogLogger: Logger? = null
+ private var isFirebaseInitialized = false
+
+ private val isInTestLab: Boolean
+ get() {
+ val testLabSetting = Settings.System.getString(context.contentResolver, "firebase.test.lab")
+ return "true" == testLabSetting
+ }
+
+ companion object {
+ private const val TAG = "GooglePlatformAnalytics"
+ private const val SERVICE_NAME = "org.meshtastic"
+
+ private const val KEY_PRIORITY = "priority"
+ private const val KEY_TAG = "tag"
+ private const val KEY_MESSAGE = "message"
+ }
+
+ init {
+ // Setup Kermit log writers immediately, they will handle delayed SDK initialization gracefully.
+ val writers = buildList {
+ add(DatadogLogWriter())
+ add(CrashlyticsLogWriter())
+ if (BuildConfig.DEBUG) {
+ add(co.touchlab.kermit.LogcatWriter())
+ }
+ }
+ KermitLogger.setLogWriters(writers)
+ KermitLogger.setMinSeverity(if (BuildConfig.DEBUG) Severity.Debug else Severity.Info)
+
+ // Initial consent state
+ updateAnalyticsConsent(analyticsPrefs.analyticsAllowed.value)
+
+ // Subscribe to analytics preference changes
+ analyticsPrefs.analyticsAllowed
+ .onEach { allowed -> updateAnalyticsConsent(allowed) }
+ .launchIn(ProcessLifecycleOwner.get().lifecycleScope)
+ }
+
+ /**
+ * Ensures that Datadog and Firebase SDKs are initialized if allowed. This is called lazily when consent is granted.
+ */
+ private fun ensureInitialized() {
+ if (!analyticsPrefs.analyticsAllowed.value || isInTestLab) return
+
+ if (!Datadog.isInitialized()) {
+ initDatadog(context as Application)
+ datadogLogger =
+ Logger.Builder()
+ .setService(SERVICE_NAME)
+ .setNetworkInfoEnabled(false) // Disable to avoid collecting Local IP/SSID
+ .setRemoteSampleRate(sampleRate)
+ .setBundleWithTraceEnabled(true)
+ .setBundleWithRumEnabled(true)
+ .build()
+ }
+
+ if (!isFirebaseInitialized) {
+ initCrashlytics(context as Application)
+ isFirebaseInitialized = true
+ }
+ }
+
+ private fun initDatadog(application: Application) {
+ val configuration =
+ Configuration.Builder(
+ clientToken = BuildConfig.datadogClientToken,
+ env = if (BuildConfig.DEBUG) "Local" else "Production",
+ variant = BuildConfig.FLAVOR,
+ )
+ .useSite(DatadogSite.US5)
+ .setCrashReportsEnabled(true)
+ .setUseDeveloperModeWhenDebuggable(true)
+ .build()
+ // Initialize with PENDING, consent will be updated via updateAnalyticsConsent
+ Datadog.initialize(application, configuration, TrackingConsent.PENDING)
+ Datadog.setVerbosity(if (BuildConfig.DEBUG) android.util.Log.DEBUG else android.util.Log.WARN)
+
+ val rumConfiguration =
+ RumConfiguration.Builder(BuildConfig.datadogApplicationId)
+ .trackAnonymousUser(true)
+ .trackBackgroundEvents(true) // Match Apple: track background events for cross-platform parity
+ .trackFrustrations(false) // Disable click-tracking based frustration detection
+ .trackLongTasks()
+ .trackNonFatalAnrs(true)
+ .setSessionSampleRate(sampleRate)
+ .build()
+ Rum.enable(rumConfiguration)
+
+ val logsConfig = LogsConfiguration.Builder().build()
+ Logs.enable(logsConfig)
+
+ val traceConfig = TraceConfiguration.Builder().setNetworkInfoEnabled(true).build()
+ Trace.enable(traceConfig)
+
+ // Session Replay for debug builds only, matching Apple's TestFlight-only gating.
+ // Masks all text inputs to protect message content.
+ if (BuildConfig.DEBUG) {
+ val sessionReplayConfig =
+ SessionReplayConfiguration.Builder(sampleRate)
+ .setTextAndInputPrivacy(TextAndInputPrivacy.MASK_ALL_INPUTS)
+ .build()
+ SessionReplay.enable(sessionReplayConfig)
+ }
+
+ GlobalOpenTelemetry.set(DatadogOpenTelemetry(serviceName = SERVICE_NAME))
+ }
+
+ private fun initCrashlytics(application: Application) {
+ Firebase.initialize(application)
+
+ // Deny all ad-related consent types by default to minimize tracking noise
+ Firebase.analytics.setConsent(
+ mapOf(
+ ConsentType.AD_STORAGE to ConsentStatus.DENIED,
+ ConsentType.AD_USER_DATA to ConsentStatus.DENIED,
+ ConsentType.AD_PERSONALIZATION to ConsentStatus.DENIED,
+ ConsentType.ANALYTICS_STORAGE to ConsentStatus.DENIED,
+ ),
+ )
+
+ // Explicitly disable analytics collection until we confirm user consent
+ Firebase.analytics.setAnalyticsCollectionEnabled(false)
+ }
+
+ /**
+ * Updates the consent status for analytics, performance, and crash reporting services.
+ *
+ * @param allowed True if analytics are allowed, false otherwise.
+ */
+ fun updateAnalyticsConsent(allowed: Boolean) {
+ if (isInTestLab) return
+
+ if (allowed) {
+ ensureInitialized()
+ }
+
+ KermitLogger.i { if (allowed) "Analytics enabled" else "Analytics disabled" }
+
+ if (Datadog.isInitialized()) {
+ Datadog.setTrackingConsent(if (allowed) TrackingConsent.GRANTED else TrackingConsent.NOT_GRANTED)
+ }
+
+ if (isFirebaseInitialized) {
+ Firebase.crashlytics.isCrashlyticsCollectionEnabled = allowed
+ Firebase.analytics.setAnalyticsCollectionEnabled(allowed)
+
+ if (allowed) {
+ Firebase.crashlytics.sendUnsentReports()
+ // Ensure ad-related PII collection remains disabled even if analytics is allowed
+ Firebase.analytics.setUserProperty("allow_personalized_ads", "false")
+ }
+
+ // Manage Analytics Storage consent for Advanced Consent Mode
+ val consentStatus = if (allowed) ConsentStatus.GRANTED else ConsentStatus.DENIED
+ Firebase.analytics.setConsent(
+ mapOf(
+ ConsentType.ANALYTICS_STORAGE to consentStatus,
+ // Keep ad-related types explicitly denied
+ ConsentType.AD_STORAGE to ConsentStatus.DENIED,
+ ConsentType.AD_USER_DATA to ConsentStatus.DENIED,
+ ConsentType.AD_PERSONALIZATION to ConsentStatus.DENIED,
+ ),
+ )
+ }
+ }
+
+ override fun setDeviceAttributes(firmwareVersion: String, model: String) {
+ if (!Datadog.isInitialized() || !GlobalRumMonitor.isRegistered()) return
+ GlobalRumMonitor.get().addAttribute("firmware_version", firmwareVersion.extractSemanticVersion())
+ GlobalRumMonitor.get().addAttribute("device_hardware", model)
+ }
+
+ override fun trackConnect(
+ firmwareVersion: String?,
+ transportType: String?,
+ hardwareModel: String?,
+ nodes: Int,
+ connectionRestored: Boolean,
+ ) {
+ if (!Datadog.isInitialized() || !GlobalRumMonitor.isRegistered()) return
+ val attributes = buildMap {
+ firmwareVersion?.let { put("firmwareVersion", it) }
+ transportType?.let { put("transportType", it) }
+ hardwareModel?.let { put("hardwareModel", it) }
+ put("nodes", nodes)
+ if (connectionRestored) put("connectionRestored", true)
+ }
+ GlobalRumMonitor.get().addAction(RumActionType.CUSTOM, "connect", attributes)
+ }
+
+ private val isGooglePlayAvailable: Boolean
+ get() =
+ GoogleApiAvailabilityLight.getInstance().isGooglePlayServicesAvailable(context).let {
+ it != ConnectionResult.SERVICE_MISSING && it != ConnectionResult.SERVICE_INVALID
+ }
+
+ override val isPlatformServicesAvailable: Boolean
+ get() = isGooglePlayAvailable
+
+ private inner class CrashlyticsLogWriter : LogWriter() {
+ override fun log(severity: Severity, message: String, tag: String, throwable: Throwable?) {
+ if (!isFirebaseInitialized) return
+ if (!Firebase.crashlytics.isCrashlyticsCollectionEnabled) return
+
+ // Add the log to the Crashlytics log buffer so it appears in reports
+ Firebase.crashlytics.log("$severity/$tag: $message")
+
+ // Filter out normal coroutine cancellations
+ if (throwable is CancellationException) return
+
+ // Only record non-fatal exceptions for actual Errors (Severity.Error or Severity.Assert)
+ if (severity >= Severity.Error) {
+ if (throwable != null) {
+ Firebase.crashlytics.recordException(throwable)
+ } else {
+ Firebase.crashlytics.setCustomKeys {
+ key(KEY_PRIORITY, severity.ordinal)
+ key(KEY_TAG, tag)
+ key(KEY_MESSAGE, message)
+ }
+ Firebase.crashlytics.recordException(Exception(message))
+ }
+ }
+ }
+ }
+
+ private inner class DatadogLogWriter : LogWriter() {
+ override fun log(severity: Severity, message: String, tag: String, throwable: Throwable?) {
+ val logger = datadogLogger ?: return
+ val datadogPriority =
+ when (severity) {
+ Severity.Verbose -> android.util.Log.VERBOSE
+ Severity.Debug -> android.util.Log.DEBUG
+ Severity.Info -> android.util.Log.INFO
+ Severity.Warn -> android.util.Log.WARN
+ Severity.Error -> android.util.Log.ERROR
+ Severity.Assert -> android.util.Log.ASSERT
+ }
+ logger.log(datadogPriority, message, throwable, mapOf("tag" to tag))
+ }
+ }
+
+ private fun String.extractSemanticVersion(): String {
+ val regex = "^(\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))?$".toRegex()
+ val matchResult = regex.find(this)
+ return matchResult?.groupValues?.drop(1)?.filter { it.isNotEmpty() }?.joinToString(".") ?: this
+ }
+
+ override fun track(event: String, vararg properties: DataPair) {
+ if (!isFirebaseInitialized) return
+ val bundle = Bundle()
+ properties.forEach {
+ val value = it.value
+ when (value) {
+ is Double -> bundle.putDouble(it.name, value)
+ is Int -> bundle.putLong(it.name, value.toLong()) // Firebase expects Long for integer values in bundles
+ is Long -> bundle.putLong(it.name, value)
+ is Float -> bundle.putDouble(it.name, value.toDouble())
+ is String -> bundle.putString(it.name, value) // Explicitly handle String
+ else -> bundle.putString(it.name, value.toString()) // Fallback for other types
+ }
+ KermitLogger.withTag(TAG).d { "Analytics: track $event (${it.name} : $value)" }
+ }
+ Firebase.analytics.logEvent(event, bundle)
+ }
+}
diff --git a/app/src/google/kotlin/org/meshtastic/app/di/FlavorModule.kt b/app/src/google/kotlin/org/meshtastic/app/di/FlavorModule.kt
new file mode 100644
index 000000000..802f3b150
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/di/FlavorModule.kt
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.di
+
+import org.koin.core.annotation.Module
+import org.meshtastic.app.map.prefs.di.GoogleMapsKoinModule
+
+@Module(includes = [GoogleNetworkModule::class, GoogleMapsKoinModule::class])
+class FlavorModule
diff --git a/app/src/google/kotlin/org/meshtastic/app/di/GoogleNetworkModule.kt b/app/src/google/kotlin/org/meshtastic/app/di/GoogleNetworkModule.kt
new file mode 100644
index 000000000..eede9d6e3
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/di/GoogleNetworkModule.kt
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.di
+
+import org.koin.core.annotation.Module
+import org.koin.core.annotation.Single
+import org.meshtastic.core.network.service.ApiService
+import org.meshtastic.core.network.service.ApiServiceImpl
+
+@Module
+class GoogleNetworkModule {
+
+ @Single fun bindApiService(apiServiceImpl: ApiServiceImpl): ApiService = apiServiceImpl
+}
diff --git a/app/src/google/kotlin/org/meshtastic/app/intro/AnalyticsIntro.kt b/app/src/google/kotlin/org/meshtastic/app/intro/AnalyticsIntro.kt
new file mode 100644
index 000000000..fdad2c363
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/intro/AnalyticsIntro.kt
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.intro
+
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.padding
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.text.style.TextAlign
+import androidx.compose.ui.tooling.preview.Preview
+import androidx.compose.ui.unit.dp
+import org.jetbrains.compose.resources.stringResource
+import org.meshtastic.core.resources.Res
+import org.meshtastic.core.resources.analytics_notice
+import org.meshtastic.core.resources.analytics_platforms
+import org.meshtastic.core.resources.datadog_link
+import org.meshtastic.core.resources.firebase_link
+import org.meshtastic.core.resources.for_more_information_see_our_privacy_policy
+import org.meshtastic.core.resources.privacy_url
+import org.meshtastic.core.ui.component.AutoLinkText
+
+@Composable
+fun AnalyticsIntro(modifier: Modifier = Modifier) {
+ Column(
+ modifier = modifier.fillMaxWidth().padding(top = 24.dp),
+ horizontalAlignment = Alignment.CenterHorizontally,
+ verticalArrangement = Arrangement.spacedBy(4.dp),
+ ) {
+ Text(
+ modifier = Modifier.fillMaxWidth(),
+ textAlign = TextAlign.Center,
+ text = stringResource(Res.string.analytics_notice),
+ style = MaterialTheme.typography.bodySmall,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ )
+ Text(
+ modifier = Modifier.fillMaxWidth().padding(top = 8.dp),
+ textAlign = TextAlign.Center,
+ text = stringResource(Res.string.analytics_platforms),
+ style = MaterialTheme.typography.labelMedium,
+ color = MaterialTheme.colorScheme.onSurface,
+ )
+ AutoLinkText(
+ text = stringResource(Res.string.firebase_link),
+ style = MaterialTheme.typography.bodySmall,
+ modifier = Modifier.fillMaxWidth(),
+ textAlign = TextAlign.Center,
+ )
+ AutoLinkText(
+ text = stringResource(Res.string.datadog_link),
+ style = MaterialTheme.typography.bodySmall,
+ modifier = Modifier.fillMaxWidth(),
+ textAlign = TextAlign.Center,
+ )
+
+ Text(
+ modifier = Modifier.fillMaxWidth().padding(top = 8.dp),
+ textAlign = TextAlign.Center,
+ text = stringResource(Res.string.for_more_information_see_our_privacy_policy),
+ style = MaterialTheme.typography.bodySmall,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ )
+ AutoLinkText(
+ text = stringResource(Res.string.privacy_url),
+ style = MaterialTheme.typography.bodySmall,
+ modifier = Modifier.fillMaxWidth(),
+ textAlign = TextAlign.Center,
+ )
+ }
+}
+
+@Preview(showBackground = true)
+@Composable
+private fun AnalyticsIntroPreview() {
+ AnalyticsIntro()
+}
diff --git a/app/src/google/kotlin/org/meshtastic/app/map/GetMapViewProvider.kt b/app/src/google/kotlin/org/meshtastic/app/map/GetMapViewProvider.kt
new file mode 100644
index 000000000..8a441fa70
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/map/GetMapViewProvider.kt
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map
+
+import org.meshtastic.core.ui.util.MapViewProvider
+
+fun getMapViewProvider(): MapViewProvider = GoogleMapViewProvider()
diff --git a/app/src/google/kotlin/org/meshtastic/app/map/GoogleMapViewProvider.kt b/app/src/google/kotlin/org/meshtastic/app/map/GoogleMapViewProvider.kt
new file mode 100644
index 000000000..940c4ab5a
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/map/GoogleMapViewProvider.kt
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map
+
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.ui.Modifier
+import org.koin.compose.viewmodel.koinViewModel
+import org.koin.core.annotation.Single
+import org.meshtastic.core.ui.util.MapViewProvider
+
+/** Google Maps implementation of [MapViewProvider]. */
+@Single
+class GoogleMapViewProvider : MapViewProvider {
+ @Composable
+ override fun MapView(modifier: Modifier, navigateToNodeDetails: (Int) -> Unit, waypointId: Int?) {
+ val mapViewModel: MapViewModel = koinViewModel()
+ LaunchedEffect(waypointId) { mapViewModel.setWaypointId(waypointId) }
+ org.meshtastic.app.map.MapView(
+ modifier = modifier,
+ mapViewModel = mapViewModel,
+ navigateToNodeDetails = navigateToNodeDetails,
+ )
+ }
+}
diff --git a/app/src/google/kotlin/org/meshtastic/app/map/LocationHandler.kt b/app/src/google/kotlin/org/meshtastic/app/map/LocationHandler.kt
new file mode 100644
index 000000000..1aa4a7bab
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/map/LocationHandler.kt
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map
+
+import android.Manifest
+import android.app.Activity
+import android.content.ActivityNotFoundException
+import android.content.pm.PackageManager
+import androidx.activity.compose.rememberLauncherForActivityResult
+import androidx.activity.result.IntentSenderRequest
+import androidx.activity.result.contract.ActivityResultContracts
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.platform.LocalContext
+import androidx.core.content.ContextCompat
+import co.touchlab.kermit.Logger
+import com.google.android.gms.common.api.ResolvableApiException
+import com.google.android.gms.location.LocationRequest
+import com.google.android.gms.location.LocationServices
+import com.google.android.gms.location.LocationSettingsRequest
+import com.google.android.gms.location.Priority
+
+private const val INTERVAL_MILLIS = 10000L
+
+@Suppress("LongMethod")
+@Composable
+fun LocationPermissionsHandler(onPermissionResult: (Boolean) -> Unit) {
+ val context = LocalContext.current
+ var localHasPermission by remember {
+ mutableStateOf(
+ ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) ==
+ PackageManager.PERMISSION_GRANTED,
+ )
+ }
+
+ val requestLocationPermissionLauncher =
+ rememberLauncherForActivityResult(contract = ActivityResultContracts.RequestPermission()) { isGranted ->
+ localHasPermission = isGranted
+ // Defer to the LaunchedEffect(localHasPermission) to check settings before confirming via
+ // onPermissionResult
+ // if permission is granted. If not granted, immediately report false.
+ if (!isGranted) {
+ onPermissionResult(false)
+ }
+ }
+
+ val locationSettingsLauncher =
+ rememberLauncherForActivityResult(contract = ActivityResultContracts.StartIntentSenderForResult()) { result ->
+ if (result.resultCode == Activity.RESULT_OK) {
+ Logger.d { "Location settings changed by user." }
+ // User has enabled location services or improved accuracy.
+ onPermissionResult(true) // Settings are now adequate, and permission was already granted.
+ } else {
+ Logger.d { "Location settings change cancelled by user." }
+ // User chose not to change settings. The permission itself is still granted,
+ // but the experience might be degraded. For the purpose of enabling map features,
+ // we consider this as success if the core permission is there.
+ // If stricter handling is needed (e.g., block feature if settings not optimal),
+ // this logic might change.
+ onPermissionResult(localHasPermission)
+ }
+ }
+
+ LaunchedEffect(Unit) {
+ // Initial permission check
+ when (ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION)) {
+ PackageManager.PERMISSION_GRANTED -> {
+ if (!localHasPermission) {
+ localHasPermission = true
+ }
+ // If permission is already granted, proceed to check location settings.
+ // The LaunchedEffect(localHasPermission) will handle this.
+ // No need to call onPermissionResult(true) here yet, let settings check complete.
+ }
+
+ else -> {
+ // Request permission if not granted. The launcher's callback will update localHasPermission.
+ requestLocationPermissionLauncher.launch(Manifest.permission.ACCESS_FINE_LOCATION)
+ }
+ }
+ }
+
+ LaunchedEffect(localHasPermission) {
+ // Handles logic after permission status is known/updated
+ if (localHasPermission) {
+ // Permission is granted, now check location settings
+ val locationRequest = LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, INTERVAL_MILLIS).build()
+
+ val builder = LocationSettingsRequest.Builder().addLocationRequest(locationRequest)
+
+ val client = LocationServices.getSettingsClient(context)
+ val task = client.checkLocationSettings(builder.build())
+
+ task.addOnSuccessListener {
+ Logger.d { "Location settings are satisfied." }
+ onPermissionResult(true) // Permission granted and settings are good
+ }
+
+ task.addOnFailureListener { exception ->
+ if (exception is ResolvableApiException) {
+ try {
+ val intentSenderRequest = IntentSenderRequest.Builder(exception.resolution).build()
+ locationSettingsLauncher.launch(intentSenderRequest)
+ // Result of this launch will be handled by locationSettingsLauncher's callback
+ } catch (sendEx: ActivityNotFoundException) {
+ Logger.d { "Error launching location settings resolution ${sendEx.message}." }
+ onPermissionResult(true) // Permission is granted, but settings dialog failed. Proceed.
+ }
+ } else {
+ Logger.d { "Location settings are not satisfiable.${exception.message}" }
+ onPermissionResult(true) // Permission is granted, but settings not ideal. Proceed.
+ }
+ }
+ } else {
+ // If permission is not granted, report false.
+ // This case is primarily handled by the requestLocationPermissionLauncher's callback
+ // if the initial state was denied, or if user denies it.
+ onPermissionResult(false)
+ }
+ }
+}
diff --git a/app/src/google/kotlin/org/meshtastic/app/map/MBTilesProvider.kt b/app/src/google/kotlin/org/meshtastic/app/map/MBTilesProvider.kt
new file mode 100644
index 000000000..6ac756f6b
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/map/MBTilesProvider.kt
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map
+
+import android.database.sqlite.SQLiteDatabase
+import com.google.android.gms.maps.model.Tile
+import com.google.android.gms.maps.model.TileProvider
+import java.io.File
+
+class MBTilesProvider(private val file: File) :
+ TileProvider,
+ AutoCloseable {
+ private var database: SQLiteDatabase? = null
+
+ init {
+ openDatabase()
+ }
+
+ private fun openDatabase() {
+ if (database == null && file.exists()) {
+ database = SQLiteDatabase.openDatabase(file.absolutePath, null, SQLiteDatabase.OPEN_READONLY)
+ }
+ }
+
+ override fun getTile(x: Int, y: Int, zoom: Int): Tile? {
+ val db = database ?: return null
+
+ var tile: Tile? = null
+ // Convert Google Maps y coordinate to standard TMS y coordinate
+ val tmsY = (1 shl zoom) - 1 - y
+
+ val cursor =
+ db.rawQuery(
+ "SELECT tile_data FROM tiles WHERE zoom_level = ? AND tile_column = ? AND tile_row = ?",
+ arrayOf(zoom.toString(), x.toString(), tmsY.toString()),
+ )
+
+ if (cursor.moveToFirst()) {
+ val tileData = cursor.getBlob(0)
+ tile = Tile(256, 256, tileData)
+ }
+ cursor.close()
+
+ return tile ?: TileProvider.NO_TILE
+ }
+
+ override fun close() {
+ database?.close()
+ database = null
+ }
+}
diff --git a/app/src/google/kotlin/org/meshtastic/app/map/MapView.kt b/app/src/google/kotlin/org/meshtastic/app/map/MapView.kt
new file mode 100644
index 000000000..c8f2f3fee
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/map/MapView.kt
@@ -0,0 +1,1125 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+@file:Suppress("MagicNumber")
+
+package org.meshtastic.app.map
+
+import android.Manifest
+import android.app.Activity
+import android.content.Intent
+import android.net.Uri
+import android.view.WindowManager
+import androidx.activity.compose.rememberLauncherForActivityResult
+import androidx.activity.result.contract.ActivityResultContracts
+import androidx.appcompat.app.AppCompatDelegate
+import androidx.compose.foundation.isSystemInDarkTheme
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.width
+import androidx.compose.material3.Card
+import androidx.compose.material3.ExperimentalMaterial3Api
+import androidx.compose.material3.Icon
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.ModalBottomSheet
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.DisposableEffect
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.key
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.rememberCoroutineScope
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.unit.dp
+import androidx.lifecycle.compose.collectAsStateWithLifecycle
+import co.touchlab.kermit.Logger
+import com.google.accompanist.permissions.ExperimentalPermissionsApi
+import com.google.accompanist.permissions.rememberMultiplePermissionsState
+import com.google.android.gms.location.LocationCallback
+import com.google.android.gms.location.LocationRequest
+import com.google.android.gms.location.LocationResult
+import com.google.android.gms.location.LocationServices
+import com.google.android.gms.location.Priority
+import com.google.android.gms.maps.CameraUpdateFactory
+import com.google.android.gms.maps.model.CameraPosition
+import com.google.android.gms.maps.model.JointType
+import com.google.android.gms.maps.model.LatLng
+import com.google.android.gms.maps.model.LatLngBounds
+import com.google.maps.android.SphericalUtil
+import com.google.maps.android.compose.CameraPositionState
+import com.google.maps.android.compose.ComposeMapColorScheme
+import com.google.maps.android.compose.GoogleMap
+import com.google.maps.android.compose.MapEffect
+import com.google.maps.android.compose.MapProperties
+import com.google.maps.android.compose.MapType
+import com.google.maps.android.compose.MapUiSettings
+import com.google.maps.android.compose.MapsComposeExperimentalApi
+import com.google.maps.android.compose.MarkerComposable
+import com.google.maps.android.compose.MarkerInfoWindowComposable
+import com.google.maps.android.compose.Polyline
+import com.google.maps.android.compose.TileOverlay
+import com.google.maps.android.compose.rememberCameraPositionState
+import com.google.maps.android.compose.rememberUpdatedMarkerState
+import com.google.maps.android.compose.widgets.ScaleBar
+import com.google.maps.android.data.Layer
+import com.google.maps.android.data.geojson.GeoJsonLayer
+import com.google.maps.android.data.kml.KmlLayer
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.launch
+import org.jetbrains.compose.resources.stringResource
+import org.json.JSONObject
+import org.koin.compose.viewmodel.koinViewModel
+import org.meshtastic.app.map.component.ClusterItemsListDialog
+import org.meshtastic.app.map.component.CustomMapLayersSheet
+import org.meshtastic.app.map.component.CustomTileProviderManagerSheet
+import org.meshtastic.app.map.component.EditWaypointDialog
+import org.meshtastic.app.map.component.MapFilterDropdown
+import org.meshtastic.app.map.component.MapTypeDropdown
+import org.meshtastic.app.map.component.NodeClusterMarkers
+import org.meshtastic.app.map.component.NodeMapFilterDropdown
+import org.meshtastic.app.map.component.WaypointMarkers
+import org.meshtastic.app.map.model.NodeClusterItem
+import org.meshtastic.core.common.util.nowMillis
+import org.meshtastic.core.common.util.nowSeconds
+import org.meshtastic.core.model.Node
+import org.meshtastic.core.model.TracerouteOverlay
+import org.meshtastic.core.model.util.GeoConstants.DEG_D
+import org.meshtastic.core.model.util.GeoConstants.HEADING_DEG
+import org.meshtastic.core.model.util.metersIn
+import org.meshtastic.core.model.util.mpsToKmph
+import org.meshtastic.core.model.util.mpsToMph
+import org.meshtastic.core.model.util.toString
+import org.meshtastic.core.resources.Res
+import org.meshtastic.core.resources.alt
+import org.meshtastic.core.resources.heading
+import org.meshtastic.core.resources.latitude
+import org.meshtastic.core.resources.longitude
+import org.meshtastic.core.resources.manage_map_layers
+import org.meshtastic.core.resources.map_tile_source
+import org.meshtastic.core.resources.position
+import org.meshtastic.core.resources.sats
+import org.meshtastic.core.resources.speed
+import org.meshtastic.core.resources.timestamp
+import org.meshtastic.core.resources.track_point
+import org.meshtastic.core.ui.component.NodeChip
+import org.meshtastic.core.ui.icon.Layers
+import org.meshtastic.core.ui.icon.Map
+import org.meshtastic.core.ui.icon.MeshtasticIcons
+import org.meshtastic.core.ui.icon.TripOrigin
+import org.meshtastic.core.ui.theme.TracerouteColors
+import org.meshtastic.core.ui.util.formatAgo
+import org.meshtastic.core.ui.util.formatPositionTime
+import org.meshtastic.feature.map.BaseMapViewModel.MapFilterState
+import org.meshtastic.feature.map.LastHeardFilter
+import org.meshtastic.feature.map.component.MapButton
+import org.meshtastic.feature.map.component.MapControlsOverlay
+import org.meshtastic.feature.map.tracerouteNodeSelection
+import org.meshtastic.proto.Config.DisplayConfig.DisplayUnits
+import org.meshtastic.proto.Position
+import org.meshtastic.proto.Waypoint
+import kotlin.math.abs
+import kotlin.math.max
+
+// region --- Map Mode ---
+
+/**
+ * Discriminated mode for [MapView] — replaces the original pile of nullable parameters with a type-safe sealed
+ * hierarchy. Each mode carries only the data it needs; the shared infrastructure (location tracking, tile providers,
+ * controls overlay) is available in every mode.
+ */
+sealed interface GoogleMapMode {
+ /** Standard map: node clusters, waypoints, custom layers, waypoint editing. */
+ data object Main : GoogleMapMode
+
+ /** Focused node position track: polyline + gradient markers for historical positions. */
+ data class NodeTrack(
+ val focusedNode: Node?,
+ val positions: List,
+ val selectedPositionTime: Int? = null,
+ val onPositionSelected: ((Int) -> Unit)? = null,
+ ) : GoogleMapMode
+
+ /** Traceroute visualization: offset forward/return polylines + hop markers. */
+ data class Traceroute(
+ val overlay: TracerouteOverlay?,
+ val nodePositions: Map,
+ val onMappableCountChanged: (shown: Int, total: Int) -> Unit,
+ ) : GoogleMapMode
+}
+
+// endregion
+
+private const val TRACEROUTE_OFFSET_METERS = 100.0
+private const val TRACEROUTE_BOUNDS_PADDING_PX = 120
+
+@Suppress("CyclomaticComplexMethod", "LongMethod")
+@OptIn(MapsComposeExperimentalApi::class, ExperimentalMaterial3Api::class, ExperimentalPermissionsApi::class)
+@Composable
+fun MapView(
+ modifier: Modifier = Modifier,
+ mapViewModel: MapViewModel = koinViewModel(),
+ navigateToNodeDetails: (Int) -> Unit = {},
+ mode: GoogleMapMode = GoogleMapMode.Main,
+) {
+ val context = LocalContext.current
+ val coroutineScope = rememberCoroutineScope()
+ val mapLayers by mapViewModel.mapLayers.collectAsStateWithLifecycle()
+
+ // --- Location permissions ---
+ val locationPermissionsState =
+ rememberMultiplePermissionsState(permissions = listOf(Manifest.permission.ACCESS_FINE_LOCATION))
+ var triggerLocationToggleAfterPermission by remember { mutableStateOf(false) }
+
+ // --- Location tracking ---
+ var isLocationTrackingEnabled by remember { mutableStateOf(false) }
+ var followPhoneBearing by remember { mutableStateOf(false) }
+
+ LaunchedEffect(locationPermissionsState.allPermissionsGranted) {
+ if (locationPermissionsState.allPermissionsGranted && triggerLocationToggleAfterPermission) {
+ isLocationTrackingEnabled = true
+ triggerLocationToggleAfterPermission = false
+ }
+ }
+
+ // --- File picker for map layers (Main mode) ---
+ val filePickerLauncher =
+ rememberLauncherForActivityResult(contract = ActivityResultContracts.StartActivityForResult()) { result ->
+ if (result.resultCode == Activity.RESULT_OK) {
+ result.data?.data?.let { uri ->
+ val fileName = uri.getFileName(context)
+ mapViewModel.addMapLayer(uri, fileName)
+ }
+ }
+ }
+
+ // --- UI state ---
+ var mapFilterMenuExpanded by remember { mutableStateOf(false) }
+ val mapFilterState by mapViewModel.mapFilterStateFlow.collectAsStateWithLifecycle()
+ val ourNodeInfo by mapViewModel.ourNodeInfo.collectAsStateWithLifecycle()
+ var editingWaypoint by remember { mutableStateOf(null) }
+
+ val selectedGoogleMapType by mapViewModel.selectedGoogleMapType.collectAsStateWithLifecycle()
+ val currentCustomTileProviderUrl by mapViewModel.selectedCustomTileProviderUrl.collectAsStateWithLifecycle()
+
+ var mapTypeMenuExpanded by remember { mutableStateOf(false) }
+ var showCustomTileManagerSheet by remember { mutableStateOf(false) }
+
+ // --- Camera ---
+ // Main mode persists camera; NodeTrack/Traceroute use ephemeral state with auto-centering.
+ val cameraPositionState =
+ if (mode is GoogleMapMode.Main) mapViewModel.cameraPositionState else rememberCameraPositionState()
+
+ if (mode is GoogleMapMode.Main) {
+ LaunchedEffect(cameraPositionState.isMoving) {
+ if (!cameraPositionState.isMoving) {
+ mapViewModel.saveCameraPosition(cameraPositionState.position)
+ }
+ }
+ }
+
+ // --- FusedLocation ---
+ val fusedLocationClient = remember { LocationServices.getFusedLocationProviderClient(context) }
+ val locationCallback = remember {
+ object : LocationCallback() {
+ override fun onLocationResult(locationResult: LocationResult) {
+ if (isLocationTrackingEnabled) {
+ locationResult.lastLocation?.let { location ->
+ val latLng = LatLng(location.latitude, location.longitude)
+ val cameraUpdate =
+ if (followPhoneBearing) {
+ val bearing =
+ if (location.hasBearing()) {
+ location.bearing
+ } else {
+ cameraPositionState.position.bearing
+ }
+ CameraUpdateFactory.newCameraPosition(
+ CameraPosition.Builder()
+ .target(latLng)
+ .zoom(cameraPositionState.position.zoom)
+ .bearing(bearing)
+ .build(),
+ )
+ } else {
+ CameraUpdateFactory.newLatLngZoom(latLng, cameraPositionState.position.zoom)
+ }
+ coroutineScope.launch {
+ try {
+ cameraPositionState.animate(cameraUpdate)
+ } catch (e: IllegalStateException) {
+ Logger.d { "Error animating camera to location: ${e.message}" }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ LaunchedEffect(isLocationTrackingEnabled, locationPermissionsState.allPermissionsGranted) {
+ if (isLocationTrackingEnabled && locationPermissionsState.allPermissionsGranted) {
+ val locationRequest =
+ LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, 5000L)
+ .setMinUpdateIntervalMillis(2000L)
+ .build()
+ try {
+ @Suppress("MissingPermission")
+ fusedLocationClient.requestLocationUpdates(locationRequest, locationCallback, null)
+ Logger.d { "Started location tracking" }
+ } catch (e: SecurityException) {
+ Logger.d { "Location permission not available: ${e.message}" }
+ isLocationTrackingEnabled = false
+ }
+ } else {
+ fusedLocationClient.removeLocationUpdates(locationCallback)
+ Logger.d { "Stopped location tracking" }
+ }
+ }
+
+ DisposableEffect(Unit) { onDispose { fusedLocationClient.removeLocationUpdates(locationCallback) } }
+
+ // --- Node & waypoint data ---
+ val allNodes by mapViewModel.nodesWithPosition.collectAsStateWithLifecycle(listOf())
+ val waypoints by mapViewModel.waypoints.collectAsStateWithLifecycle(emptyMap())
+ val displayableWaypoints = waypoints.values.mapNotNull { it.waypoint }
+ val selectedWaypointId by mapViewModel.selectedWaypointId.collectAsStateWithLifecycle()
+
+ val filteredNodes =
+ allNodes
+ .filter { node -> !mapFilterState.onlyFavorites || node.isFavorite || node.num == ourNodeInfo?.num }
+ .filter { node ->
+ mapFilterState.lastHeardFilter.seconds == 0L ||
+ (nowSeconds - node.lastHeard) <= mapFilterState.lastHeardFilter.seconds ||
+ node.num == ourNodeInfo?.num
+ }
+
+ val myNodeNum = mapViewModel.myNodeNum
+ val isConnected by mapViewModel.isConnected.collectAsStateWithLifecycle()
+ val theme by mapViewModel.theme.collectAsStateWithLifecycle()
+ val dark =
+ when (theme) {
+ AppCompatDelegate.MODE_NIGHT_YES -> true
+ AppCompatDelegate.MODE_NIGHT_NO -> false
+ AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM -> isSystemInDarkTheme()
+ else -> isSystemInDarkTheme()
+ }
+ val mapColorScheme = if (dark) ComposeMapColorScheme.DARK else ComposeMapColorScheme.LIGHT
+
+ // --- Mode-specific data ---
+ // Node track: apply time filter
+ val sortedTrackPositions =
+ if (mode is GoogleMapMode.NodeTrack) {
+ val lastHeardTrackFilter = mapFilterState.lastHeardTrackFilter
+ remember(mode.positions, lastHeardTrackFilter) {
+ mode.positions
+ .filter {
+ lastHeardTrackFilter == LastHeardFilter.Any ||
+ it.time > nowSeconds - lastHeardTrackFilter.seconds
+ }
+ .sortedBy { it.time }
+ }
+ } else {
+ emptyList()
+ }
+
+ // Traceroute: resolve node selection + polylines. Collected unconditionally per Compose rules
+ // (composable calls cannot be conditional), but only consumed in Traceroute mode. Uses all
+ // nodes, not just those with positions, so getNodeOrFallback can resolve metadata for hops
+ // whose positions come from snapshots.
+ val allNodesForTraceroute by mapViewModel.nodes.collectAsStateWithLifecycle(listOf())
+ val tracerouteSelection =
+ if (mode is GoogleMapMode.Traceroute) {
+ remember(mode.overlay, mode.nodePositions, allNodesForTraceroute) {
+ mapViewModel.tracerouteNodeSelection(
+ tracerouteOverlay = mode.overlay,
+ tracerouteNodePositions = mode.nodePositions,
+ nodes = allNodesForTraceroute,
+ )
+ }
+ } else {
+ null
+ }
+ val tracerouteDisplayNodes = tracerouteSelection?.nodesForMarkers ?: emptyList()
+
+ if (mode is GoogleMapMode.Traceroute) {
+ LaunchedEffect(mode.overlay, tracerouteDisplayNodes) {
+ if (mode.overlay != null) {
+ mode.onMappableCountChanged(tracerouteDisplayNodes.size, mode.overlay.relatedNodeNums.size)
+ }
+ }
+ }
+
+ val tracerouteForwardPoints: List =
+ if (mode is GoogleMapMode.Traceroute && tracerouteSelection != null) {
+ val nodeLookup = tracerouteSelection.nodeLookup
+ remember(mode.overlay, nodeLookup) {
+ mode.overlay?.forwardRoute?.mapNotNull { nodeLookup[it]?.position?.toLatLng() } ?: emptyList()
+ }
+ } else {
+ emptyList()
+ }
+ val tracerouteReturnPoints: List =
+ if (mode is GoogleMapMode.Traceroute && tracerouteSelection != null) {
+ val nodeLookup = tracerouteSelection.nodeLookup
+ remember(mode.overlay, nodeLookup) {
+ mode.overlay?.returnRoute?.mapNotNull { nodeLookup[it]?.position?.toLatLng() } ?: emptyList()
+ }
+ } else {
+ emptyList()
+ }
+ val tracerouteHeadingReferencePoints =
+ remember(tracerouteForwardPoints, tracerouteReturnPoints) {
+ when {
+ tracerouteForwardPoints.size >= 2 -> tracerouteForwardPoints
+ tracerouteReturnPoints.size >= 2 -> tracerouteReturnPoints
+ else -> emptyList()
+ }
+ }
+ val tracerouteForwardOffsetPoints =
+ remember(tracerouteForwardPoints, tracerouteHeadingReferencePoints) {
+ offsetPolyline(tracerouteForwardPoints, TRACEROUTE_OFFSET_METERS, tracerouteHeadingReferencePoints, 1.0)
+ }
+ val tracerouteReturnOffsetPoints =
+ remember(tracerouteReturnPoints, tracerouteHeadingReferencePoints) {
+ offsetPolyline(tracerouteReturnPoints, TRACEROUTE_OFFSET_METERS, tracerouteHeadingReferencePoints, -1.0)
+ }
+
+ // Auto-centering for NodeTrack / Traceroute modes
+ var hasCentered by remember(mode) { mutableStateOf(false) }
+
+ if (mode is GoogleMapMode.NodeTrack) {
+ LaunchedEffect(sortedTrackPositions, hasCentered) {
+ if (hasCentered || sortedTrackPositions.isEmpty()) return@LaunchedEffect
+ val points = sortedTrackPositions.map { it.toLatLng() }
+ val cameraUpdate =
+ if (points.size == 1) {
+ CameraUpdateFactory.newLatLngZoom(points.first(), max(cameraPositionState.position.zoom, 12f))
+ } else {
+ val bounds = LatLngBounds.builder()
+ points.forEach { bounds.include(it) }
+ CameraUpdateFactory.newLatLngBounds(bounds.build(), 80)
+ }
+ try {
+ cameraPositionState.animate(cameraUpdate)
+ hasCentered = true
+ } catch (e: IllegalStateException) {
+ Logger.d { "Error centering track map: ${e.message}" }
+ }
+ }
+
+ // Animate to selected position marker when card is tapped in the list
+ LaunchedEffect(mode.selectedPositionTime) {
+ val selectedTime = mode.selectedPositionTime ?: return@LaunchedEffect
+ val selectedPos = sortedTrackPositions.find { it.time == selectedTime } ?: return@LaunchedEffect
+ try {
+ cameraPositionState.animate(CameraUpdateFactory.newLatLng(selectedPos.toLatLng()))
+ } catch (e: IllegalStateException) {
+ Logger.d { "Error animating to selected position: ${e.message}" }
+ }
+ }
+ }
+
+ if (mode is GoogleMapMode.Traceroute) {
+ LaunchedEffect(mode.overlay, tracerouteForwardPoints, tracerouteReturnPoints) {
+ if (mode.overlay == null || hasCentered) return@LaunchedEffect
+ val allPoints = (tracerouteForwardPoints + tracerouteReturnPoints).distinct()
+ if (allPoints.isNotEmpty()) {
+ val cameraUpdate =
+ if (allPoints.size == 1) {
+ CameraUpdateFactory.newLatLngZoom(
+ allPoints.first(),
+ max(cameraPositionState.position.zoom, 12f),
+ )
+ } else {
+ val bounds = LatLngBounds.builder()
+ allPoints.forEach { bounds.include(it) }
+ CameraUpdateFactory.newLatLngBounds(bounds.build(), TRACEROUTE_BOUNDS_PADDING_PX)
+ }
+ try {
+ cameraPositionState.animate(cameraUpdate)
+ hasCentered = true
+ } catch (e: IllegalStateException) {
+ Logger.d { "Error centering traceroute overlay: ${e.message}" }
+ }
+ }
+ }
+ }
+
+ // --- Tile & layers state ---
+ var showLayersBottomSheet by remember { mutableStateOf(false) }
+
+ val onAddLayerClicked = {
+ val intent =
+ Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
+ addCategory(Intent.CATEGORY_OPENABLE)
+ type = "*/*"
+ val mimeTypes =
+ arrayOf(
+ "application/vnd.google-earth.kml+xml",
+ "application/vnd.google-earth.kmz",
+ "application/vnd.geo+json",
+ "application/geo+json",
+ "application/json",
+ )
+ putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes)
+ }
+ filePickerLauncher.launch(intent)
+ }
+ val onRemoveLayer = { layerId: String -> mapViewModel.removeMapLayer(layerId) }
+ val onToggleVisibility = { layerId: String -> mapViewModel.toggleLayerVisibility(layerId) }
+
+ val effectiveGoogleMapType = if (currentCustomTileProviderUrl != null) MapType.NONE else selectedGoogleMapType
+
+ var showClusterItemsDialog by remember { mutableStateOf?>(null) }
+
+ // --- Keep screen on while location tracking ---
+ LaunchedEffect(isLocationTrackingEnabled) {
+ val activity = context as? Activity ?: return@LaunchedEffect
+ val window = activity.window
+ if (isLocationTrackingEnabled) {
+ window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
+ } else {
+ window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
+ }
+ }
+
+ // --- Main UI ---
+ val isMainMode = mode is GoogleMapMode.Main
+
+ Box(modifier = modifier) {
+ GoogleMap(
+ mapColorScheme = mapColorScheme,
+ modifier = Modifier.fillMaxSize(),
+ cameraPositionState = cameraPositionState,
+ uiSettings =
+ MapUiSettings(
+ zoomControlsEnabled = true,
+ mapToolbarEnabled = isMainMode,
+ compassEnabled = false,
+ myLocationButtonEnabled = false,
+ rotationGesturesEnabled = true,
+ scrollGesturesEnabled = true,
+ tiltGesturesEnabled = isMainMode,
+ zoomGesturesEnabled = true,
+ ),
+ properties =
+ MapProperties(
+ mapType = effectiveGoogleMapType,
+ isMyLocationEnabled = isLocationTrackingEnabled && locationPermissionsState.allPermissionsGranted,
+ ),
+ onMapLongClick = { latLng ->
+ if (isMainMode && isConnected) {
+ editingWaypoint =
+ Waypoint(
+ latitude_i = (latLng.latitude / DEG_D).toInt(),
+ longitude_i = (latLng.longitude / DEG_D).toInt(),
+ )
+ }
+ },
+ ) {
+ // Custom tile overlay (all modes)
+ key(currentCustomTileProviderUrl) {
+ currentCustomTileProviderUrl?.let { url ->
+ val config =
+ mapViewModel.customTileProviderConfigs.collectAsStateWithLifecycle().value.find {
+ it.urlTemplate == url || it.localUri == url
+ }
+ mapViewModel.getTileProvider(config)?.let { tileProvider ->
+ TileOverlay(tileProvider = tileProvider, fadeIn = true, transparency = 0f, zIndex = -1f)
+ }
+ }
+ }
+
+ when (mode) {
+ is GoogleMapMode.Main ->
+ MainMapContent(
+ nodeClusterItems =
+ filteredNodes.map { node ->
+ val latLng =
+ LatLng(
+ (node.position.latitude_i ?: 0) * DEG_D,
+ (node.position.longitude_i ?: 0) * DEG_D,
+ )
+ NodeClusterItem(
+ node = node,
+ nodePosition = latLng,
+ nodeTitle = "${node.user.short_name} ${formatAgo(node.position.time)}",
+ nodeSnippet = "${node.user.long_name}",
+ myNodeNum = myNodeNum,
+ )
+ },
+ mapFilterState = mapFilterState,
+ navigateToNodeDetails = navigateToNodeDetails,
+ displayableWaypoints = displayableWaypoints,
+ myNodeNum = myNodeNum,
+ isConnected = isConnected,
+ onEditWaypointRequest = { editingWaypoint = it },
+ selectedWaypointId = selectedWaypointId,
+ mapLayers = mapLayers,
+ mapViewModel = mapViewModel,
+ cameraPositionState = cameraPositionState,
+ coroutineScope = coroutineScope,
+ onShowClusterItemsDialog = { showClusterItemsDialog = it },
+ )
+
+ is GoogleMapMode.NodeTrack -> {
+ val displayUnits by mapViewModel.displayUnits.collectAsStateWithLifecycle()
+ if (mode.focusedNode != null && sortedTrackPositions.isNotEmpty()) {
+ NodeTrackOverlay(
+ focusedNode = mode.focusedNode,
+ sortedPositions = sortedTrackPositions,
+ displayUnits = displayUnits,
+ myNodeNum = myNodeNum,
+ selectedPositionTime = mode.selectedPositionTime,
+ onPositionSelected = mode.onPositionSelected,
+ )
+ }
+ }
+
+ is GoogleMapMode.Traceroute ->
+ TracerouteMapContent(
+ forwardOffsetPoints = tracerouteForwardOffsetPoints,
+ returnOffsetPoints = tracerouteReturnOffsetPoints,
+ forwardPointCount = tracerouteForwardPoints.size,
+ returnPointCount = tracerouteReturnPoints.size,
+ displayNodes = tracerouteDisplayNodes,
+ )
+ }
+ }
+
+ // Scale bar
+ ScaleBar(
+ cameraPositionState = cameraPositionState,
+ modifier = Modifier.align(Alignment.BottomStart).padding(bottom = if (isMainMode) 48.dp else 16.dp),
+ )
+
+ // Waypoint edit dialog (Main mode only)
+ if (isMainMode) {
+ editingWaypoint?.let { waypointToEdit ->
+ EditWaypointDialog(
+ waypoint = waypointToEdit,
+ onSendClicked = { updatedWp ->
+ var finalWp = updatedWp
+ if (updatedWp.id == 0) {
+ finalWp = finalWp.copy(id = mapViewModel.generatePacketId() ?: 0)
+ }
+ if ((updatedWp.icon ?: 0) == 0) {
+ finalWp = finalWp.copy(icon = 0x1F4CD)
+ }
+ mapViewModel.sendWaypoint(finalWp)
+ editingWaypoint = null
+ },
+ onDeleteClicked = { wpToDelete ->
+ if ((wpToDelete.locked_to ?: 0) == 0 && isConnected && wpToDelete.id != 0) {
+ mapViewModel.sendWaypoint(wpToDelete.copy(expire = 1))
+ }
+ mapViewModel.deleteWaypoint(wpToDelete.id)
+ editingWaypoint = null
+ },
+ onDismissRequest = { editingWaypoint = null },
+ )
+ }
+ }
+
+ // Controls overlay
+ val visibleNetworkLayers = mapLayers.filter { it.isNetwork && it.isVisible }
+ val showRefresh = visibleNetworkLayers.isNotEmpty()
+ val isRefreshingLayers = visibleNetworkLayers.any { it.isRefreshing }
+
+ MapControlsOverlay(
+ modifier = Modifier.align(Alignment.TopCenter).padding(top = 8.dp),
+ onToggleFilterMenu = { mapFilterMenuExpanded = true },
+ filterDropdownContent = {
+ if (mode is GoogleMapMode.NodeTrack) {
+ NodeMapFilterDropdown(
+ expanded = mapFilterMenuExpanded,
+ onDismissRequest = { mapFilterMenuExpanded = false },
+ mapViewModel = mapViewModel,
+ )
+ } else {
+ MapFilterDropdown(
+ expanded = mapFilterMenuExpanded,
+ onDismissRequest = { mapFilterMenuExpanded = false },
+ mapViewModel = mapViewModel,
+ )
+ }
+ },
+ mapTypeContent = {
+ Box {
+ MapButton(
+ icon = MeshtasticIcons.Map,
+ contentDescription = stringResource(Res.string.map_tile_source),
+ onClick = { mapTypeMenuExpanded = true },
+ )
+ MapTypeDropdown(
+ expanded = mapTypeMenuExpanded,
+ onDismissRequest = { mapTypeMenuExpanded = false },
+ mapViewModel = mapViewModel,
+ onManageCustomTileProvidersClicked = {
+ mapTypeMenuExpanded = false
+ showCustomTileManagerSheet = true
+ },
+ )
+ }
+ },
+ layersContent = {
+ MapButton(
+ icon = MeshtasticIcons.Layers,
+ contentDescription = stringResource(Res.string.manage_map_layers),
+ onClick = { showLayersBottomSheet = true },
+ )
+ },
+ isLocationTrackingEnabled = isLocationTrackingEnabled,
+ onToggleLocationTracking = {
+ if (locationPermissionsState.allPermissionsGranted) {
+ isLocationTrackingEnabled = !isLocationTrackingEnabled
+ if (!isLocationTrackingEnabled) {
+ followPhoneBearing = false
+ }
+ } else {
+ triggerLocationToggleAfterPermission = true
+ locationPermissionsState.launchMultiplePermissionRequest()
+ }
+ },
+ bearing = cameraPositionState.position.bearing,
+ onCompassClick = {
+ if (isLocationTrackingEnabled) {
+ followPhoneBearing = !followPhoneBearing
+ } else {
+ coroutineScope.launch {
+ try {
+ val currentPosition = cameraPositionState.position
+ val newCameraPosition = CameraPosition.Builder(currentPosition).bearing(0f).build()
+ cameraPositionState.animate(CameraUpdateFactory.newCameraPosition(newCameraPosition))
+ Logger.d { "Oriented map to north" }
+ } catch (e: IllegalStateException) {
+ Logger.d { "Error orienting map to north: ${e.message}" }
+ }
+ }
+ }
+ },
+ followPhoneBearing = followPhoneBearing,
+ showRefresh = showRefresh,
+ isRefreshing = isRefreshingLayers,
+ onRefresh = { mapViewModel.refreshAllVisibleNetworkLayers() },
+ )
+ }
+
+ // --- Bottom sheets & dialogs ---
+ if (showLayersBottomSheet) {
+ ModalBottomSheet(onDismissRequest = { showLayersBottomSheet = false }) {
+ CustomMapLayersSheet(
+ mapLayers = mapLayers,
+ onToggleVisibility = onToggleVisibility,
+ onRemoveLayer = onRemoveLayer,
+ onAddLayerClicked = onAddLayerClicked,
+ onRefreshLayer = { mapViewModel.refreshMapLayer(it) },
+ onAddNetworkLayer = { name, url -> mapViewModel.addNetworkMapLayer(name, url) },
+ )
+ }
+ }
+ showClusterItemsDialog?.let {
+ ClusterItemsListDialog(
+ items = it,
+ onDismiss = { showClusterItemsDialog = null },
+ onItemClick = { item ->
+ navigateToNodeDetails(item.node.num)
+ showClusterItemsDialog = null
+ },
+ )
+ }
+ if (showCustomTileManagerSheet) {
+ ModalBottomSheet(onDismissRequest = { showCustomTileManagerSheet = false }) {
+ CustomTileProviderManagerSheet(mapViewModel = mapViewModel)
+ }
+ }
+}
+
+// region --- Main Map Content ---
+
+@Suppress("LongParameterList")
+@OptIn(MapsComposeExperimentalApi::class)
+@Composable
+private fun MainMapContent(
+ nodeClusterItems: List,
+ mapFilterState: MapFilterState,
+ navigateToNodeDetails: (Int) -> Unit,
+ displayableWaypoints: List,
+ myNodeNum: Int?,
+ isConnected: Boolean,
+ onEditWaypointRequest: (Waypoint) -> Unit,
+ selectedWaypointId: Int?,
+ mapLayers: List,
+ mapViewModel: MapViewModel,
+ cameraPositionState: CameraPositionState,
+ coroutineScope: CoroutineScope,
+ onShowClusterItemsDialog: (List?) -> Unit,
+) {
+ NodeClusterMarkers(
+ nodeClusterItems = nodeClusterItems,
+ mapFilterState = mapFilterState,
+ navigateToNodeDetails = navigateToNodeDetails,
+ onClusterClick = { cluster ->
+ val items = cluster.items.toList()
+ val allSameLocation = items.size > 1 && items.all { it.position == items.first().position }
+ if (allSameLocation) {
+ onShowClusterItemsDialog(items)
+ } else {
+ val bounds = LatLngBounds.builder()
+ cluster.items.forEach { bounds.include(it.position) }
+ coroutineScope.launch {
+ cameraPositionState.animate(
+ CameraUpdateFactory.newCameraPosition(
+ CameraPosition.Builder()
+ .target(bounds.build().center)
+ .zoom(cameraPositionState.position.zoom + 1)
+ .build(),
+ ),
+ )
+ }
+ Logger.d { "Cluster clicked! $cluster" }
+ }
+ true
+ },
+ )
+
+ WaypointMarkers(
+ displayableWaypoints = displayableWaypoints,
+ mapFilterState = mapFilterState,
+ myNodeNum = myNodeNum ?: 0,
+ isConnected = isConnected,
+ onEditWaypointRequest = onEditWaypointRequest,
+ selectedWaypointId = selectedWaypointId,
+ )
+
+ mapLayers.forEach { layerItem -> key(layerItem.id) { MapLayerOverlay(layerItem, mapViewModel) } }
+}
+
+// endregion
+
+// region --- Node Track Overlay ---
+
+/**
+ * Renders the position track polyline segments and markers inside a [GoogleMap] content scope. Each marker fades from
+ * transparent (oldest) to opaque (newest). The newest position shows the node's [NodeChip]; older positions show a
+ * [TripOrigin] dot with an info-window on tap.
+ *
+ * When [selectedPositionTime] matches a marker's `Position.time`, that marker is highlighted with the primary color and
+ * elevated z-index. Tapping a marker invokes [onPositionSelected] for list synchronization.
+ */
+@OptIn(MapsComposeExperimentalApi::class)
+@Composable
+@Suppress("LongMethod")
+private fun NodeTrackOverlay(
+ focusedNode: Node,
+ sortedPositions: List,
+ displayUnits: DisplayUnits,
+ myNodeNum: Int?,
+ selectedPositionTime: Int? = null,
+ onPositionSelected: ((Int) -> Unit)? = null,
+) {
+ val isHighPriority = focusedNode.num == myNodeNum || focusedNode.isFavorite
+ val activeNodeZIndex = if (isHighPriority) 5f else 4f
+ val selectedColor = MaterialTheme.colorScheme.primary
+
+ sortedPositions.forEachIndexed { index, position ->
+ key(position.time) {
+ val markerState = rememberUpdatedMarkerState(position = position.toLatLng())
+ val alpha =
+ if (sortedPositions.size > 1) {
+ index.toFloat() / (sortedPositions.size.toFloat() - 1)
+ } else {
+ 1f
+ }
+ val isSelected = position.time == selectedPositionTime
+ val color =
+ if (isSelected) {
+ selectedColor
+ } else {
+ Color(focusedNode.colors.second).copy(alpha = alpha)
+ }
+
+ if (index == sortedPositions.lastIndex) {
+ MarkerComposable(
+ state = markerState,
+ zIndex = activeNodeZIndex,
+ alpha = if (isHighPriority) 1.0f else 0.9f,
+ onClick = {
+ onPositionSelected?.invoke(position.time)
+ false // Allow default info window behavior
+ },
+ ) {
+ NodeChip(node = focusedNode)
+ }
+ } else {
+ MarkerInfoWindowComposable(
+ state = markerState,
+ title = stringResource(Res.string.position),
+ snippet = formatAgo(position.time),
+ zIndex = if (isSelected) activeNodeZIndex - 0.5f else 1f + alpha,
+ onClick = {
+ onPositionSelected?.invoke(position.time)
+ false // Allow default info window behavior
+ },
+ infoContent = { PositionInfoWindowContent(position = position, displayUnits = displayUnits) },
+ ) {
+ Icon(
+ imageVector = MeshtasticIcons.TripOrigin,
+ contentDescription = stringResource(Res.string.track_point),
+ tint = color,
+ modifier = if (isSelected) Modifier.size(32.dp) else Modifier,
+ )
+ }
+ }
+ }
+ }
+
+ // Gradient polyline segments
+ if (sortedPositions.size > 1) {
+ val segments = sortedPositions.windowed(size = 2, step = 1, partialWindows = false)
+ segments.forEachIndexed { index, segmentPoints ->
+ val alpha = index.toFloat() / (segments.size.toFloat() - 1)
+ Polyline(
+ points = segmentPoints.map { it.toLatLng() },
+ jointType = JointType.ROUND,
+ color = Color(focusedNode.colors.second).copy(alpha = alpha),
+ width = 8f,
+ zIndex = 0.6f,
+ )
+ }
+ }
+}
+
+@Composable
+@Suppress("LongMethod")
+private fun PositionInfoWindowContent(position: Position, displayUnits: DisplayUnits = DisplayUnits.METRIC) {
+ @Composable
+ fun PositionRow(label: String, value: String) {
+ Row(modifier = Modifier.padding(horizontal = 8.dp), verticalAlignment = Alignment.CenterVertically) {
+ Text(label, style = MaterialTheme.typography.labelMedium)
+ Spacer(modifier = Modifier.width(16.dp))
+ Text(value, style = MaterialTheme.typography.labelMedium)
+ }
+ }
+
+ Card {
+ Column(modifier = Modifier.padding(8.dp)) {
+ PositionRow(
+ label = stringResource(Res.string.latitude),
+ value = "%.5f".format((position.latitude_i ?: 0) * DEG_D),
+ )
+ PositionRow(
+ label = stringResource(Res.string.longitude),
+ value = "%.5f".format((position.longitude_i ?: 0) * DEG_D),
+ )
+ PositionRow(label = stringResource(Res.string.sats), value = position.sats_in_view.toString())
+ PositionRow(
+ label = stringResource(Res.string.alt),
+ value = (position.altitude ?: 0).metersIn(displayUnits).toString(displayUnits),
+ )
+ PositionRow(label = stringResource(Res.string.speed), value = speedFromPosition(position, displayUnits))
+ PositionRow(
+ label = stringResource(Res.string.heading),
+ value = "%.0f°".format((position.ground_track ?: 0) * HEADING_DEG),
+ )
+ PositionRow(label = stringResource(Res.string.timestamp), value = position.formatPositionTime())
+ }
+ }
+}
+
+@Composable
+private fun speedFromPosition(position: Position, displayUnits: DisplayUnits): String {
+ val speedInMps = position.ground_speed ?: 0
+ val mpsText = "%d m/s".format(speedInMps)
+ return if (speedInMps > 10) {
+ when (displayUnits) {
+ DisplayUnits.METRIC -> "%.1f Km/h".format(speedInMps.mpsToKmph())
+ DisplayUnits.IMPERIAL -> "%.1f mph".format(speedInMps.mpsToMph())
+ else -> mpsText
+ }
+ } else {
+ mpsText
+ }
+}
+
+// endregion
+
+// region --- Traceroute Map Content ---
+
+@OptIn(MapsComposeExperimentalApi::class)
+@Composable
+private fun TracerouteMapContent(
+ forwardOffsetPoints: List,
+ returnOffsetPoints: List,
+ forwardPointCount: Int,
+ returnPointCount: Int,
+ displayNodes: List,
+) {
+ if (forwardPointCount >= 2) {
+ Polyline(
+ points = forwardOffsetPoints,
+ jointType = JointType.ROUND,
+ color = TracerouteColors.OutgoingRoute,
+ width = 9f,
+ zIndex = 3.0f,
+ )
+ }
+ if (returnPointCount >= 2) {
+ Polyline(
+ points = returnOffsetPoints,
+ jointType = JointType.ROUND,
+ color = TracerouteColors.ReturnRoute,
+ width = 7f,
+ zIndex = 2.5f,
+ )
+ }
+ displayNodes.forEach { node ->
+ val markerState = rememberUpdatedMarkerState(position = node.position.toLatLng())
+ MarkerComposable(state = markerState, zIndex = 4f) { NodeChip(node = node) }
+ }
+}
+
+private fun offsetPolyline(
+ points: List,
+ offsetMeters: Double,
+ headingReferencePoints: List = points,
+ sideMultiplier: Double = 1.0,
+): List {
+ val headingPoints = headingReferencePoints.takeIf { it.size >= 2 } ?: points
+ if (points.size < 2 || headingPoints.size < 2 || offsetMeters == 0.0) return points
+
+ val headings =
+ headingPoints.mapIndexed { index, _ ->
+ when (index) {
+ 0 -> SphericalUtil.computeHeading(headingPoints[0], headingPoints[1])
+ headingPoints.lastIndex ->
+ SphericalUtil.computeHeading(
+ headingPoints[headingPoints.lastIndex - 1],
+ headingPoints[headingPoints.lastIndex],
+ )
+
+ else -> SphericalUtil.computeHeading(headingPoints[index - 1], headingPoints[index + 1])
+ }
+ }
+
+ return points.mapIndexed { index, point ->
+ val heading = headings[index.coerceIn(0, headings.lastIndex)]
+ val perpendicularHeading = heading + (90.0 * sideMultiplier)
+ SphericalUtil.computeOffset(point, abs(offsetMeters), perpendicularHeading)
+ }
+}
+
+// endregion
+
+// region --- Map Layers ---
+
+@Composable
+private fun MapLayerOverlay(layerItem: MapLayerItem, mapViewModel: MapViewModel) {
+ val context = LocalContext.current
+ var currentLayer by remember { mutableStateOf(null) }
+
+ MapEffect(layerItem.id, layerItem.isRefreshing) { map ->
+ currentLayer?.safeRemoveLayerFromMap()
+ currentLayer = null
+ val inputStream = mapViewModel.getInputStreamFromUri(layerItem) ?: return@MapEffect
+ val layer =
+ try {
+ when (layerItem.layerType) {
+ LayerType.KML -> KmlLayer(map, inputStream, context)
+ LayerType.GEOJSON ->
+ GeoJsonLayer(map, JSONObject(inputStream.bufferedReader().use { it.readText() }))
+ }
+ } catch (e: Exception) {
+ Logger.withTag("MapView").e(e) { "Error loading map layer: ${layerItem.name}" }
+ null
+ }
+ layer?.let {
+ if (layerItem.isVisible) it.safeAddLayerToMap()
+ currentLayer = it
+ }
+ }
+
+ DisposableEffect(layerItem.id) {
+ onDispose {
+ currentLayer?.safeRemoveLayerFromMap()
+ currentLayer = null
+ }
+ }
+
+ LaunchedEffect(layerItem.isVisible) {
+ val layer = currentLayer ?: return@LaunchedEffect
+ if (layerItem.isVisible) layer.safeAddLayerToMap() else layer.safeRemoveLayerFromMap()
+ }
+}
+
+private fun Layer.safeRemoveLayerFromMap() {
+ try {
+ removeLayerFromMap()
+ } catch (e: Exception) {
+ Logger.withTag("MapView").e(e) { "Error removing map layer" }
+ }
+}
+
+private fun Layer.safeAddLayerToMap() {
+ try {
+ if (!isLayerOnMap) addLayerToMap()
+ } catch (e: Exception) {
+ Logger.withTag("MapView").e(e) { "Error adding map layer" }
+ }
+}
+
+// endregion
+
+// region --- Utilities ---
+
+internal fun convertIntToEmoji(unicodeCodePoint: Int): String = try {
+ String(Character.toChars(unicodeCodePoint))
+} catch (e: IllegalArgumentException) {
+ Logger.w(e) { "Invalid unicode code point: $unicodeCodePoint" }
+ "\uD83D\uDCCD"
+}
+
+@Suppress("NestedBlockDepth")
+fun Uri.getFileName(context: android.content.Context): String {
+ var name = this.lastPathSegment ?: "layer_$nowMillis"
+ if (this.scheme == "content") {
+ context.contentResolver.query(this, null, null, null, null)?.use { cursor ->
+ if (cursor.moveToFirst()) {
+ val displayNameIndex = cursor.getColumnIndex(android.provider.OpenableColumns.DISPLAY_NAME)
+ if (displayNameIndex != -1) {
+ name = cursor.getString(displayNameIndex)
+ }
+ }
+ }
+ }
+ return name
+}
+
+/** Converts protobuf [Position] integer coordinates to a Google Maps [LatLng]. */
+internal fun Position.toLatLng(): LatLng = LatLng((this.latitude_i ?: 0) * DEG_D, (this.longitude_i ?: 0) * DEG_D)
+
+// endregion
diff --git a/app/src/google/kotlin/org/meshtastic/app/map/MapViewModel.kt b/app/src/google/kotlin/org/meshtastic/app/map/MapViewModel.kt
new file mode 100644
index 000000000..e4eabbb76
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/map/MapViewModel.kt
@@ -0,0 +1,688 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map
+
+import android.app.Application
+import android.net.Uri
+import androidx.core.net.toFile
+import androidx.lifecycle.SavedStateHandle
+import androidx.lifecycle.viewModelScope
+import co.touchlab.kermit.Logger
+import com.google.android.gms.maps.model.CameraPosition
+import com.google.android.gms.maps.model.LatLng
+import com.google.android.gms.maps.model.TileProvider
+import com.google.android.gms.maps.model.UrlTileProvider
+import com.google.maps.android.compose.CameraPositionState
+import com.google.maps.android.compose.MapType
+import io.ktor.client.HttpClient
+import io.ktor.client.request.get
+import io.ktor.client.statement.bodyAsChannel
+import io.ktor.http.isSuccess
+import io.ktor.utils.io.jvm.javaio.toInputStream
+import kotlinx.coroutines.flow.MutableSharedFlow
+import kotlinx.coroutines.flow.MutableStateFlow
+import kotlinx.coroutines.flow.SharedFlow
+import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.asSharedFlow
+import kotlinx.coroutines.flow.asStateFlow
+import kotlinx.coroutines.flow.first
+import kotlinx.coroutines.flow.mapNotNull
+import kotlinx.coroutines.flow.update
+import kotlinx.coroutines.launch
+import kotlinx.coroutines.withContext
+import kotlinx.serialization.Serializable
+import org.koin.core.annotation.KoinViewModel
+import org.meshtastic.app.map.model.CustomTileProviderConfig
+import org.meshtastic.app.map.prefs.map.GoogleMapsPrefs
+import org.meshtastic.app.map.repository.CustomTileProviderRepository
+import org.meshtastic.core.di.CoroutineDispatchers
+import org.meshtastic.core.model.RadioController
+import org.meshtastic.core.repository.MapPrefs
+import org.meshtastic.core.repository.NodeRepository
+import org.meshtastic.core.repository.PacketRepository
+import org.meshtastic.core.repository.RadioConfigRepository
+import org.meshtastic.core.repository.UiPrefs
+import org.meshtastic.core.ui.viewmodel.stateInWhileSubscribed
+import org.meshtastic.feature.map.BaseMapViewModel
+import org.meshtastic.proto.Config
+import java.io.File
+import java.io.FileOutputStream
+import java.io.IOException
+import java.io.InputStream
+import java.net.MalformedURLException
+import java.net.URL
+import kotlin.uuid.Uuid
+
+private const val TILE_SIZE = 256
+
+@Serializable
+data class MapCameraPosition(
+ val targetLat: Double,
+ val targetLng: Double,
+ val zoom: Float,
+ val tilt: Float,
+ val bearing: Float,
+)
+
+@Suppress("TooManyFunctions", "LongParameterList")
+@KoinViewModel
+class MapViewModel(
+ private val application: Application,
+ private val dispatchers: CoroutineDispatchers,
+ private val httpClient: HttpClient,
+ mapPrefs: MapPrefs,
+ private val googleMapsPrefs: GoogleMapsPrefs,
+ nodeRepository: NodeRepository,
+ packetRepository: PacketRepository,
+ radioConfigRepository: RadioConfigRepository,
+ radioController: RadioController,
+ private val customTileProviderRepository: CustomTileProviderRepository,
+ uiPrefs: UiPrefs,
+ savedStateHandle: SavedStateHandle,
+) : BaseMapViewModel(mapPrefs, nodeRepository, packetRepository, radioController) {
+
+ private val _selectedWaypointId = MutableStateFlow(savedStateHandle.get("waypointId"))
+ val selectedWaypointId: StateFlow = _selectedWaypointId.asStateFlow()
+
+ fun setWaypointId(id: Int?) {
+ if (_selectedWaypointId.value != id) {
+ _selectedWaypointId.value = id
+ if (id != null) {
+ viewModelScope.launch {
+ val wpMap = waypoints.first { it.containsKey(id) }
+ wpMap[id]?.let { packet ->
+ val waypoint = packet.waypoint!!
+ val latLng = LatLng((waypoint.latitude_i ?: 0) / 1e7, (waypoint.longitude_i ?: 0) / 1e7)
+ cameraPositionState.position = CameraPosition.fromLatLngZoom(latLng, 15f)
+ }
+ }
+ }
+ }
+ }
+
+ private val targetLatLng =
+ googleMapsPrefs.cameraTargetLat.value
+ .takeIf { it != 0.0 }
+ ?.let { lat -> googleMapsPrefs.cameraTargetLng.value.takeIf { it != 0.0 }?.let { lng -> LatLng(lat, lng) } }
+ ?: ourNodeInfo.value?.position?.toLatLng()
+ ?: LatLng(0.0, 0.0)
+
+ val cameraPositionState =
+ CameraPositionState(
+ position =
+ CameraPosition(
+ targetLatLng,
+ googleMapsPrefs.cameraZoom.value,
+ googleMapsPrefs.cameraTilt.value,
+ googleMapsPrefs.cameraBearing.value,
+ ),
+ )
+
+ val theme: StateFlow = uiPrefs.theme
+
+ private val _errorFlow = MutableSharedFlow()
+ val errorFlow: SharedFlow = _errorFlow.asSharedFlow()
+
+ val customTileProviderConfigs: StateFlow> =
+ customTileProviderRepository.getCustomTileProviders().stateInWhileSubscribed(initialValue = emptyList())
+
+ private val _selectedCustomTileProviderUrl = MutableStateFlow(null)
+ val selectedCustomTileProviderUrl: StateFlow = _selectedCustomTileProviderUrl.asStateFlow()
+
+ private val _selectedGoogleMapType = MutableStateFlow(MapType.NORMAL)
+ val selectedGoogleMapType: StateFlow = _selectedGoogleMapType.asStateFlow()
+
+ val displayUnits =
+ radioConfigRepository.deviceProfileFlow
+ .mapNotNull { it.config?.display?.units }
+ .stateInWhileSubscribed(initialValue = Config.DisplayConfig.DisplayUnits.METRIC)
+
+ fun addCustomTileProvider(name: String, urlTemplate: String, localUri: String? = null) {
+ viewModelScope.launch {
+ if (
+ name.isBlank() ||
+ (urlTemplate.isBlank() && localUri == null) ||
+ (localUri == null && !isValidTileUrlTemplate(urlTemplate))
+ ) {
+ _errorFlow.emit("Invalid name, URL template, or local URI for custom tile provider.")
+ return@launch
+ }
+ if (customTileProviderConfigs.value.any { it.name.equals(name, ignoreCase = true) }) {
+ _errorFlow.emit("Custom tile provider with name '$name' already exists.")
+ return@launch
+ }
+
+ var finalLocalUri = localUri
+ if (localUri != null) {
+ try {
+ val uri = Uri.parse(localUri)
+ val extension = "mbtiles"
+ val finalFileName = "mbtiles_${Uuid.random()}.$extension"
+ val copiedUri = copyFileToInternalStorage(uri, finalFileName)
+ if (copiedUri != null) {
+ finalLocalUri = copiedUri.toString()
+ } else {
+ _errorFlow.emit("Failed to copy MBTiles file to internal storage.")
+ return@launch
+ }
+ } catch (e: Exception) {
+ Logger.withTag("MapViewModel").e(e) { "Error processing local URI" }
+ _errorFlow.emit("Error processing local URI for MBTiles.")
+ return@launch
+ }
+ }
+
+ val newConfig = CustomTileProviderConfig(name = name, urlTemplate = urlTemplate, localUri = finalLocalUri)
+ customTileProviderRepository.addCustomTileProvider(newConfig)
+ }
+ }
+
+ fun updateCustomTileProvider(configToUpdate: CustomTileProviderConfig) {
+ viewModelScope.launch {
+ if (
+ configToUpdate.name.isBlank() ||
+ (configToUpdate.urlTemplate.isBlank() && configToUpdate.localUri == null) ||
+ (configToUpdate.localUri == null && !isValidTileUrlTemplate(configToUpdate.urlTemplate))
+ ) {
+ _errorFlow.emit("Invalid name, URL template, or local URI for updating custom tile provider.")
+ return@launch
+ }
+ val existingConfigs = customTileProviderConfigs.value
+ if (
+ existingConfigs.any {
+ it.id != configToUpdate.id && it.name.equals(configToUpdate.name, ignoreCase = true)
+ }
+ ) {
+ _errorFlow.emit("Another custom tile provider with name '${configToUpdate.name}' already exists.")
+ return@launch
+ }
+
+ customTileProviderRepository.updateCustomTileProvider(configToUpdate)
+
+ val originalConfig = customTileProviderRepository.getCustomTileProviderById(configToUpdate.id)
+ if (
+ _selectedCustomTileProviderUrl.value != null &&
+ originalConfig?.urlTemplate == _selectedCustomTileProviderUrl.value
+ ) {
+ // No change needed if URL didn't change, or handle if it did
+ } else if (originalConfig != null && _selectedCustomTileProviderUrl.value != originalConfig.urlTemplate) {
+ val currentlySelectedConfig =
+ customTileProviderConfigs.value.find { it.urlTemplate == _selectedCustomTileProviderUrl.value }
+ if (currentlySelectedConfig?.id == configToUpdate.id) {
+ _selectedCustomTileProviderUrl.value = configToUpdate.urlTemplate
+ }
+ }
+ }
+ }
+
+ fun removeCustomTileProvider(configId: String) {
+ viewModelScope.launch {
+ val configToRemove = customTileProviderRepository.getCustomTileProviderById(configId)
+ customTileProviderRepository.deleteCustomTileProvider(configId)
+
+ if (configToRemove != null) {
+ if (
+ _selectedCustomTileProviderUrl.value == configToRemove.urlTemplate ||
+ _selectedCustomTileProviderUrl.value == configToRemove.localUri
+ ) {
+ _selectedCustomTileProviderUrl.value = null
+ // Also clear from prefs
+ googleMapsPrefs.setSelectedCustomTileUrl(null)
+ }
+
+ if (configToRemove.localUri != null) {
+ val uri = Uri.parse(configToRemove.localUri)
+ deleteFileToInternalStorage(uri)
+ }
+ }
+ }
+ }
+
+ fun selectCustomTileProvider(config: CustomTileProviderConfig?) {
+ if (config != null) {
+ if (!config.isLocal && !isValidTileUrlTemplate(config.urlTemplate)) {
+ Logger.withTag("MapViewModel").w("Attempted to select invalid URL template: ${config.urlTemplate}")
+ _selectedCustomTileProviderUrl.value = null
+ googleMapsPrefs.setSelectedCustomTileUrl(null)
+ return
+ }
+ // Use localUri if present, otherwise urlTemplate
+ val selectedUrl = config.localUri ?: config.urlTemplate
+ _selectedCustomTileProviderUrl.value = selectedUrl
+ _selectedGoogleMapType.value = MapType.NONE
+ googleMapsPrefs.setSelectedCustomTileUrl(selectedUrl)
+ googleMapsPrefs.setSelectedGoogleMapType(null)
+ } else {
+ _selectedCustomTileProviderUrl.value = null
+ _selectedGoogleMapType.value = MapType.NORMAL
+ googleMapsPrefs.setSelectedCustomTileUrl(null)
+ googleMapsPrefs.setSelectedGoogleMapType(MapType.NORMAL.name)
+ }
+ }
+
+ fun setSelectedGoogleMapType(mapType: MapType) {
+ _selectedGoogleMapType.value = mapType
+ _selectedCustomTileProviderUrl.value = null // Clear custom selection
+ googleMapsPrefs.setSelectedGoogleMapType(mapType.name)
+ googleMapsPrefs.setSelectedCustomTileUrl(null)
+ }
+
+ private var currentTileProvider: TileProvider? = null
+
+ fun getTileProvider(config: CustomTileProviderConfig?): TileProvider? {
+ if (config == null) {
+ (currentTileProvider as? MBTilesProvider)?.close()
+ currentTileProvider = null
+ return null
+ }
+
+ val selectedUrl = config.localUri ?: config.urlTemplate
+ if (currentTileProvider != null && _selectedCustomTileProviderUrl.value == selectedUrl) {
+ return currentTileProvider
+ }
+
+ // Close previous if it was a local provider
+ (currentTileProvider as? MBTilesProvider)?.close()
+
+ val newProvider =
+ if (config.isLocal) {
+ val uri = Uri.parse(config.localUri)
+ val file =
+ try {
+ uri.toFile()
+ } catch (e: Exception) {
+ File(uri.path ?: "")
+ }
+ if (file.exists()) {
+ MBTilesProvider(file)
+ } else {
+ Logger.withTag("MapViewModel").e("Local MBTiles file does not exist: ${config.localUri}")
+ null
+ }
+ } else {
+ val urlString = config.urlTemplate
+ if (!isValidTileUrlTemplate(urlString)) {
+ Logger.withTag("MapViewModel")
+ .e("Tile URL does not contain valid {x}, {y}, and {z} placeholders: $urlString")
+ null
+ } else {
+ object : UrlTileProvider(TILE_SIZE, TILE_SIZE) {
+ override fun getTileUrl(x: Int, y: Int, zoom: Int): URL? {
+ val subdomains = listOf("a", "b", "c")
+ val subdomain = subdomains[(x + y) % subdomains.size]
+ val formattedUrl =
+ urlString
+ .replace("{s}", subdomain, ignoreCase = true)
+ .replace("{z}", zoom.toString(), ignoreCase = true)
+ .replace("{x}", x.toString(), ignoreCase = true)
+ .replace("{y}", y.toString(), ignoreCase = true)
+ return try {
+ URL(formattedUrl)
+ } catch (e: MalformedURLException) {
+ Logger.withTag("MapViewModel").e(e) { "Malformed URL: $formattedUrl" }
+ null
+ }
+ }
+ }
+ }
+ }
+
+ currentTileProvider = newProvider
+ return newProvider
+ }
+
+ private fun isValidTileUrlTemplate(urlTemplate: String): Boolean = urlTemplate.contains("{z}", ignoreCase = true) &&
+ urlTemplate.contains("{x}", ignoreCase = true) &&
+ urlTemplate.contains("{y}", ignoreCase = true)
+
+ private val _mapLayers = MutableStateFlow>(emptyList())
+ val mapLayers: StateFlow> = _mapLayers.asStateFlow()
+
+ init {
+ viewModelScope.launch {
+ customTileProviderRepository.getCustomTileProviders().first()
+ loadPersistedMapType()
+ }
+ loadPersistedLayers()
+
+ selectedWaypointId.value?.let { wpId ->
+ viewModelScope.launch {
+ val wpMap = waypoints.first { it.containsKey(wpId) }
+ wpMap[wpId]?.let { packet ->
+ val waypoint = packet.waypoint!!
+ val latLng = LatLng((waypoint.latitude_i ?: 0) / 1e7, (waypoint.longitude_i ?: 0) / 1e7)
+ cameraPositionState.position = CameraPosition.fromLatLngZoom(latLng, 15f)
+ }
+ }
+ }
+ }
+
+ fun saveCameraPosition(cameraPosition: CameraPosition) {
+ viewModelScope.launch {
+ googleMapsPrefs.setCameraTargetLat(cameraPosition.target.latitude)
+ googleMapsPrefs.setCameraTargetLng(cameraPosition.target.longitude)
+ googleMapsPrefs.setCameraZoom(cameraPosition.zoom)
+ googleMapsPrefs.setCameraTilt(cameraPosition.tilt)
+ googleMapsPrefs.setCameraBearing(cameraPosition.bearing)
+ }
+ }
+
+ private fun loadPersistedMapType() {
+ val savedCustomUrl = googleMapsPrefs.selectedCustomTileUrl.value
+ if (savedCustomUrl != null) {
+ // Check if this custom provider still exists
+ if (
+ customTileProviderConfigs.value.any { it.urlTemplate == savedCustomUrl } &&
+ isValidTileUrlTemplate(savedCustomUrl)
+ ) {
+ _selectedCustomTileProviderUrl.value = savedCustomUrl
+ _selectedGoogleMapType.value =
+ MapType.NONE // MapType.NONE to hide google basemap when using custom provider
+ } else {
+ // The saved custom URL is no longer valid or doesn't exist, remove preference
+ googleMapsPrefs.setSelectedCustomTileUrl(null)
+ // Fallback to default Google Map type
+ _selectedGoogleMapType.value = MapType.NORMAL
+ }
+ } else {
+ val savedGoogleMapTypeName = googleMapsPrefs.selectedGoogleMapType.value
+ try {
+ _selectedGoogleMapType.value = MapType.valueOf(savedGoogleMapTypeName ?: MapType.NORMAL.name)
+ } catch (e: IllegalArgumentException) {
+ Logger.e(e) { "Invalid saved Google Map type: $savedGoogleMapTypeName" }
+ _selectedGoogleMapType.value = MapType.NORMAL // Fallback in case of invalid stored name
+ googleMapsPrefs.setSelectedGoogleMapType(null)
+ }
+ }
+ }
+
+ private fun loadPersistedLayers() {
+ viewModelScope.launch(dispatchers.io) {
+ try {
+ val layersDir = File(application.filesDir, "map_layers")
+ if (layersDir.exists() && layersDir.isDirectory) {
+ val persistedLayerFiles = layersDir.listFiles()
+
+ if (persistedLayerFiles != null) {
+ val hiddenLayerUrls = googleMapsPrefs.hiddenLayerUrls.value
+ val loadedItems =
+ persistedLayerFiles.mapNotNull { file ->
+ if (file.isFile) {
+ val layerType =
+ when (file.extension.lowercase()) {
+ "kml",
+ "kmz",
+ -> LayerType.KML
+ "geojson",
+ "json",
+ -> LayerType.GEOJSON
+ else -> null
+ }
+
+ layerType?.let {
+ val uri = Uri.fromFile(file)
+ MapLayerItem(
+ name = file.nameWithoutExtension,
+ uri = uri,
+ isVisible = !hiddenLayerUrls.contains(uri.toString()),
+ layerType = it,
+ )
+ }
+ } else {
+ null
+ }
+ }
+
+ val networkItems =
+ googleMapsPrefs.networkMapLayers.value.mapNotNull { networkString ->
+ try {
+ val parts = networkString.split("|:|")
+ if (parts.size == 3) {
+ val id = parts[0]
+ val name = parts[1]
+ val uri = Uri.parse(parts[2])
+ MapLayerItem(
+ id = id,
+ name = name,
+ uri = uri,
+ isVisible = !hiddenLayerUrls.contains(uri.toString()),
+ layerType = LayerType.KML,
+ isNetwork = true,
+ )
+ } else {
+ null
+ }
+ } catch (e: Exception) {
+ null
+ }
+ }
+
+ _mapLayers.value = loadedItems + networkItems
+ if (_mapLayers.value.isNotEmpty()) {
+ Logger.withTag("MapViewModel").i("Loaded ${_mapLayers.value.size} persisted map layers.")
+ }
+ }
+ } else {
+ Logger.withTag("MapViewModel").i("Map layers directory does not exist. No layers loaded.")
+ }
+ } catch (e: Exception) {
+ Logger.withTag("MapViewModel").e(e) { "Error loading persisted map layers" }
+ _mapLayers.value = emptyList()
+ }
+ }
+ }
+
+ fun addMapLayer(uri: Uri, fileName: String?) {
+ viewModelScope.launch {
+ val layerName = fileName?.substringBeforeLast('.') ?: "Layer ${mapLayers.value.size + 1}"
+
+ val extension =
+ fileName?.substringAfterLast('.', "")?.lowercase()
+ ?: application.contentResolver.getType(uri)?.split('/')?.last()
+
+ val kmlExtensions = listOf("kml", "kmz", "vnd.google-earth.kml+xml", "vnd.google-earth.kmz")
+ val geoJsonExtensions = listOf("geojson", "json")
+
+ val layerType =
+ when (extension) {
+ in kmlExtensions -> LayerType.KML
+ in geoJsonExtensions -> LayerType.GEOJSON
+ else -> null
+ }
+
+ if (layerType == null) {
+ Logger.withTag("MapViewModel").e("Unsupported map layer file type: $extension")
+ return@launch
+ }
+
+ val finalFileName =
+ if (fileName != null) {
+ "$layerName.$extension"
+ } else {
+ "layer_${Uuid.random()}.$extension"
+ }
+
+ val localFileUri = copyFileToInternalStorage(uri, finalFileName)
+
+ if (localFileUri != null) {
+ val newItem = MapLayerItem(name = layerName, uri = localFileUri, layerType = layerType)
+ _mapLayers.value = _mapLayers.value + newItem
+ } else {
+ Logger.withTag("MapViewModel").e("Failed to copy file to internal storage.")
+ }
+ }
+ }
+
+ fun addNetworkMapLayer(name: String, url: String) {
+ viewModelScope.launch {
+ if (name.isBlank() || url.isBlank()) {
+ _errorFlow.emit("Invalid name or URL for network layer.")
+ return@launch
+ }
+ try {
+ val uri = Uri.parse(url)
+ if (uri.scheme != "http" && uri.scheme != "https") {
+ _errorFlow.emit("URL must be http or https.")
+ return@launch
+ }
+
+ val path = uri.path?.lowercase() ?: ""
+ val layerType =
+ when {
+ path.endsWith(".geojson") || path.endsWith(".json") -> LayerType.GEOJSON
+ else -> LayerType.KML // Default to KML
+ }
+
+ val newItem = MapLayerItem(name = name, uri = uri, layerType = layerType, isNetwork = true)
+ _mapLayers.value = _mapLayers.value + newItem
+
+ val networkLayerString = "${newItem.id}|:|${newItem.name}|:|${newItem.uri}"
+ googleMapsPrefs.setNetworkMapLayers(googleMapsPrefs.networkMapLayers.value + networkLayerString)
+ } catch (e: Exception) {
+ _errorFlow.emit("Invalid URL.")
+ }
+ }
+ }
+
+ private suspend fun copyFileToInternalStorage(uri: Uri, fileName: String): Uri? = withContext(dispatchers.io) {
+ try {
+ val inputStream = application.contentResolver.openInputStream(uri)
+ val directory = File(application.filesDir, "map_layers")
+ if (!directory.exists()) {
+ directory.mkdirs()
+ }
+ val outputFile = File(directory, fileName)
+ val outputStream = FileOutputStream(outputFile)
+
+ inputStream?.use { input -> outputStream.use { output -> input.copyTo(output) } }
+ Uri.fromFile(outputFile)
+ } catch (e: IOException) {
+ Logger.withTag("MapViewModel").e(e) { "Error copying file to internal storage" }
+ null
+ }
+ }
+
+ fun toggleLayerVisibility(layerId: String) {
+ var toggledLayer: MapLayerItem? = null
+ val updatedLayers =
+ _mapLayers.value.map {
+ if (it.id == layerId) {
+ toggledLayer = it.copy(isVisible = !it.isVisible)
+ toggledLayer
+ } else {
+ it
+ }
+ }
+ _mapLayers.value = updatedLayers
+
+ toggledLayer?.let {
+ if (it.isVisible) {
+ googleMapsPrefs.setHiddenLayerUrls(googleMapsPrefs.hiddenLayerUrls.value - it.uri.toString())
+ } else {
+ googleMapsPrefs.setHiddenLayerUrls(googleMapsPrefs.hiddenLayerUrls.value + it.uri.toString())
+ }
+ }
+ }
+
+ fun removeMapLayer(layerId: String) {
+ viewModelScope.launch {
+ val layerToRemove = _mapLayers.value.find { it.id == layerId }
+ layerToRemove?.uri?.let { uri ->
+ if (layerToRemove.isNetwork) {
+ googleMapsPrefs.setNetworkMapLayers(
+ googleMapsPrefs.networkMapLayers.value.filterNot { it.startsWith("$layerId|:|") }.toSet(),
+ )
+ } else {
+ deleteFileToInternalStorage(uri)
+ }
+ googleMapsPrefs.setHiddenLayerUrls(googleMapsPrefs.hiddenLayerUrls.value - uri.toString())
+ }
+ _mapLayers.value = _mapLayers.value.filterNot { it.id == layerId }
+ }
+ }
+
+ fun refreshMapLayer(layerId: String) {
+ viewModelScope.launch {
+ _mapLayers.update { layers -> layers.map { if (it.id == layerId) it.copy(isRefreshing = true) else it } }
+ // By resetting the layer data in the UI (implied by just refreshing),
+ // we trigger a reload in the Composable.
+ _mapLayers.update { layers -> layers.map { if (it.id == layerId) it.copy(isRefreshing = false) else it } }
+ }
+ }
+
+ fun refreshAllVisibleNetworkLayers() {
+ _mapLayers.value.filter { it.isNetwork && it.isVisible }.forEach { refreshMapLayer(it.id) }
+ }
+
+ private suspend fun deleteFileToInternalStorage(uri: Uri) {
+ withContext(dispatchers.io) {
+ try {
+ val file = uri.toFile()
+ if (file.exists()) {
+ file.delete()
+ }
+ } catch (e: Exception) {
+ Logger.withTag("MapViewModel").e(e) { "Error deleting file from internal storage" }
+ }
+ }
+ }
+
+ @Suppress("Recycle")
+ suspend fun getInputStreamFromUri(layerItem: MapLayerItem): InputStream? {
+ val uriToLoad = layerItem.uri ?: return null
+ return withContext(dispatchers.io) {
+ try {
+ if (layerItem.isNetwork && (uriToLoad.scheme == "http" || uriToLoad.scheme == "https")) {
+ val response = httpClient.get(uriToLoad.toString())
+ if (!response.status.isSuccess()) {
+ Logger.withTag("MapViewModel").e { "HTTP ${response.status} fetching layer: $uriToLoad" }
+ return@withContext null
+ }
+ response.bodyAsChannel().toInputStream()
+ } else {
+ application.contentResolver.openInputStream(uriToLoad)
+ }
+ } catch (e: Exception) {
+ Logger.withTag("MapViewModel").e(e) { "Error opening InputStream from URI: $uriToLoad" }
+ null
+ }
+ }
+ }
+
+ override fun onCleared() {
+ super.onCleared()
+ (currentTileProvider as? MBTilesProvider)?.close()
+ }
+
+ override fun getUser(userId: String?) =
+ nodeRepository.getUser(userId ?: org.meshtastic.core.model.DataPacket.ID_BROADCAST)
+}
+
+enum class LayerType {
+ KML,
+ GEOJSON,
+}
+
+data class MapLayerItem(
+ val id: String = Uuid.random().toString(),
+ val name: String,
+ val uri: Uri? = null,
+ val isVisible: Boolean = true,
+ val layerType: LayerType,
+ val isNetwork: Boolean = false,
+ val isRefreshing: Boolean = false,
+)
diff --git a/app/src/google/kotlin/org/meshtastic/app/map/component/ClusterItemsListDialog.kt b/app/src/google/kotlin/org/meshtastic/app/map/component/ClusterItemsListDialog.kt
new file mode 100644
index 000000000..5c5e325ac
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/map/component/ClusterItemsListDialog.kt
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.component
+
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.PaddingValues
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.lazy.LazyColumn
+import androidx.compose.foundation.lazy.items
+import androidx.compose.material3.AlertDialog
+import androidx.compose.material3.ListItem
+import androidx.compose.material3.Text
+import androidx.compose.material3.TextButton
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.unit.dp
+import org.jetbrains.compose.resources.stringResource
+import org.meshtastic.app.map.model.NodeClusterItem
+import org.meshtastic.core.resources.Res
+import org.meshtastic.core.resources.nodes_at_this_location
+import org.meshtastic.core.resources.okay
+import org.meshtastic.core.ui.component.NodeChip
+
+@Composable
+fun ClusterItemsListDialog(
+ items: List,
+ onDismiss: () -> Unit,
+ onItemClick: (NodeClusterItem) -> Unit,
+) {
+ AlertDialog(
+ onDismissRequest = onDismiss,
+ title = { Text(text = stringResource(Res.string.nodes_at_this_location)) },
+ text = {
+ // Use a LazyColumn for potentially long lists of items
+ LazyColumn(contentPadding = PaddingValues(vertical = 8.dp)) {
+ items(items, key = { it.node.num }) { item ->
+ ClusterDialogListItem(item = item, onClick = { onItemClick(item) })
+ }
+ }
+ },
+ confirmButton = { TextButton(onClick = onDismiss) { Text(stringResource(Res.string.okay)) } },
+ )
+}
+
+@Composable
+private fun ClusterDialogListItem(item: NodeClusterItem, onClick: () -> Unit, modifier: Modifier = Modifier) {
+ ListItem(
+ leadingContent = { NodeChip(node = item.node) },
+ headlineContent = { Text(item.nodeTitle) },
+ supportingContent = {
+ if (item.nodeSnippet.isNotBlank()) {
+ Text(item.nodeSnippet)
+ }
+ },
+ modifier =
+ modifier
+ .fillMaxWidth()
+ .clickable(onClick = onClick)
+ .padding(horizontal = 8.dp, vertical = 4.dp), // Add some padding around list items
+ )
+}
diff --git a/app/src/google/kotlin/org/meshtastic/app/map/component/CustomMapLayersSheet.kt b/app/src/google/kotlin/org/meshtastic/app/map/component/CustomMapLayersSheet.kt
new file mode 100644
index 000000000..fd9272579
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/map/component/CustomMapLayersSheet.kt
@@ -0,0 +1,216 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.component
+
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.PaddingValues
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.lazy.LazyColumn
+import androidx.compose.foundation.lazy.items
+import androidx.compose.material3.Button
+import androidx.compose.material3.CircularProgressIndicator
+import androidx.compose.material3.ExperimentalMaterial3Api
+import androidx.compose.material3.HorizontalDivider
+import androidx.compose.material3.Icon
+import androidx.compose.material3.IconButton
+import androidx.compose.material3.IconToggleButton
+import androidx.compose.material3.ListItem
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.OutlinedTextField
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.unit.dp
+import org.jetbrains.compose.resources.stringResource
+import org.meshtastic.app.map.MapLayerItem
+import org.meshtastic.core.resources.Res
+import org.meshtastic.core.resources.add_layer
+import org.meshtastic.core.resources.add_network_layer
+import org.meshtastic.core.resources.cancel
+import org.meshtastic.core.resources.hide_layer
+import org.meshtastic.core.resources.manage_map_layers
+import org.meshtastic.core.resources.map_layer_formats
+import org.meshtastic.core.resources.name
+import org.meshtastic.core.resources.network_layer_url_hint
+import org.meshtastic.core.resources.no_map_layers_loaded
+import org.meshtastic.core.resources.refresh
+import org.meshtastic.core.resources.remove_layer
+import org.meshtastic.core.resources.save
+import org.meshtastic.core.resources.show_layer
+import org.meshtastic.core.resources.url
+import org.meshtastic.core.ui.component.MeshtasticDialog
+import org.meshtastic.core.ui.icon.Delete
+import org.meshtastic.core.ui.icon.MeshtasticIcons
+import org.meshtastic.core.ui.icon.Refresh
+import org.meshtastic.core.ui.icon.Visibility
+import org.meshtastic.core.ui.icon.VisibilityOff
+
+@Suppress("LongMethod")
+@Composable
+@OptIn(ExperimentalMaterial3Api::class)
+fun CustomMapLayersSheet(
+ mapLayers: List,
+ onToggleVisibility: (String) -> Unit,
+ onRemoveLayer: (String) -> Unit,
+ onAddLayerClicked: () -> Unit,
+ onRefreshLayer: (String) -> Unit,
+ onAddNetworkLayer: (String, String) -> Unit,
+) {
+ var showAddNetworkLayerDialog by remember { mutableStateOf(false) }
+ LazyColumn(contentPadding = PaddingValues(bottom = 16.dp)) {
+ item {
+ Text(
+ modifier = Modifier.padding(16.dp),
+ text = stringResource(Res.string.manage_map_layers),
+ style = MaterialTheme.typography.headlineSmall,
+ )
+ HorizontalDivider()
+ }
+ item {
+ Text(
+ modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 8.dp, bottom = 0.dp),
+ text = stringResource(Res.string.map_layer_formats),
+ style = MaterialTheme.typography.bodySmall,
+ )
+ }
+
+ if (mapLayers.isEmpty()) {
+ item {
+ Text(
+ modifier = Modifier.padding(16.dp),
+ text = stringResource(Res.string.no_map_layers_loaded),
+ style = MaterialTheme.typography.bodyMedium,
+ )
+ }
+ } else {
+ items(mapLayers, key = { it.id }) { layer ->
+ ListItem(
+ headlineContent = { Text(layer.name) },
+ trailingContent = {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ if (layer.isNetwork) {
+ if (layer.isRefreshing) {
+ CircularProgressIndicator(
+ modifier = Modifier.size(24.dp).padding(4.dp),
+ strokeWidth = 2.dp,
+ )
+ } else {
+ IconButton(onClick = { onRefreshLayer(layer.id) }) {
+ Icon(
+ imageVector = MeshtasticIcons.Refresh,
+ contentDescription = stringResource(Res.string.refresh),
+ )
+ }
+ }
+ }
+ IconToggleButton(
+ checked = layer.isVisible,
+ onCheckedChange = { onToggleVisibility(layer.id) },
+ ) {
+ Icon(
+ imageVector =
+ if (layer.isVisible) {
+ MeshtasticIcons.Visibility
+ } else {
+ MeshtasticIcons.VisibilityOff
+ },
+ contentDescription =
+ stringResource(
+ if (layer.isVisible) {
+ Res.string.hide_layer
+ } else {
+ Res.string.show_layer
+ },
+ ),
+ )
+ }
+ IconButton(onClick = { onRemoveLayer(layer.id) }) {
+ Icon(
+ imageVector = MeshtasticIcons.Delete,
+ contentDescription = stringResource(Res.string.remove_layer),
+ )
+ }
+ }
+ },
+ )
+ HorizontalDivider()
+ }
+ }
+ item {
+ Column(modifier = Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
+ Button(modifier = Modifier.fillMaxWidth(), onClick = onAddLayerClicked) {
+ Text(stringResource(Res.string.add_layer))
+ }
+ Button(modifier = Modifier.fillMaxWidth(), onClick = { showAddNetworkLayerDialog = true }) {
+ Text(stringResource(Res.string.add_network_layer))
+ }
+ }
+ }
+ }
+
+ if (showAddNetworkLayerDialog) {
+ AddNetworkLayerDialog(
+ onDismiss = { showAddNetworkLayerDialog = false },
+ onConfirm = { name, url ->
+ onAddNetworkLayer(name, url)
+ showAddNetworkLayerDialog = false
+ },
+ )
+ }
+}
+
+@Composable
+fun AddNetworkLayerDialog(onDismiss: () -> Unit, onConfirm: (String, String) -> Unit) {
+ var name by remember { mutableStateOf("") }
+ var url by remember { mutableStateOf("") }
+
+ MeshtasticDialog(
+ onDismiss = onDismiss,
+ title = stringResource(Res.string.add_network_layer),
+ text = {
+ Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
+ OutlinedTextField(
+ value = name,
+ onValueChange = { name = it },
+ label = { Text(stringResource(Res.string.name)) },
+ singleLine = true,
+ modifier = Modifier.fillMaxWidth(),
+ )
+ OutlinedTextField(
+ value = url,
+ onValueChange = { url = it },
+ label = { Text(stringResource(Res.string.url)) },
+ placeholder = { Text(stringResource(Res.string.network_layer_url_hint)) },
+ singleLine = true,
+ modifier = Modifier.fillMaxWidth(),
+ )
+ }
+ },
+ onConfirm = { onConfirm(name, url) },
+ confirmTextRes = Res.string.save,
+ dismissTextRes = Res.string.cancel,
+ )
+}
diff --git a/app/src/google/kotlin/org/meshtastic/app/map/component/CustomTileProviderManagerSheet.kt b/app/src/google/kotlin/org/meshtastic/app/map/component/CustomTileProviderManagerSheet.kt
new file mode 100644
index 000000000..8082e40d1
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/map/component/CustomTileProviderManagerSheet.kt
@@ -0,0 +1,324 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.component
+
+import android.content.Intent
+import androidx.activity.compose.rememberLauncherForActivityResult
+import androidx.activity.result.contract.ActivityResultContracts
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.PaddingValues
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.lazy.LazyColumn
+import androidx.compose.foundation.lazy.items
+import androidx.compose.material3.Button
+import androidx.compose.material3.HorizontalDivider
+import androidx.compose.material3.Icon
+import androidx.compose.material3.IconButton
+import androidx.compose.material3.ListItem
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.OutlinedTextField
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.saveable.rememberSaveable
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.unit.dp
+import androidx.lifecycle.compose.collectAsStateWithLifecycle
+import kotlinx.coroutines.flow.collectLatest
+import org.jetbrains.compose.resources.stringResource
+import org.meshtastic.app.map.MapViewModel
+import org.meshtastic.app.map.model.CustomTileProviderConfig
+import org.meshtastic.core.resources.Res
+import org.meshtastic.core.resources.add_custom_tile_source
+import org.meshtastic.core.resources.add_local_mbtiles_file
+import org.meshtastic.core.resources.cancel
+import org.meshtastic.core.resources.delete_custom_tile_source
+import org.meshtastic.core.resources.edit_custom_tile_source
+import org.meshtastic.core.resources.local_mbtiles_file
+import org.meshtastic.core.resources.manage_custom_tile_sources
+import org.meshtastic.core.resources.name
+import org.meshtastic.core.resources.name_cannot_be_empty
+import org.meshtastic.core.resources.no_custom_tile_sources_found
+import org.meshtastic.core.resources.provider_name_exists
+import org.meshtastic.core.resources.save
+import org.meshtastic.core.resources.url_cannot_be_empty
+import org.meshtastic.core.resources.url_must_contain_placeholders
+import org.meshtastic.core.resources.url_template
+import org.meshtastic.core.resources.url_template_hint
+import org.meshtastic.core.ui.component.MeshtasticDialog
+import org.meshtastic.core.ui.icon.Delete
+import org.meshtastic.core.ui.icon.Edit
+import org.meshtastic.core.ui.icon.MeshtasticIcons
+import org.meshtastic.core.ui.util.showToast
+
+@Suppress("LongMethod")
+@Composable
+fun CustomTileProviderManagerSheet(mapViewModel: MapViewModel) {
+ val customTileProviders by mapViewModel.customTileProviderConfigs.collectAsStateWithLifecycle()
+ var editingConfig by remember { mutableStateOf(null) }
+ var showEditDialog by remember { mutableStateOf(false) }
+ val context = LocalContext.current
+
+ val mbtilesPickerLauncher =
+ rememberLauncherForActivityResult(contract = ActivityResultContracts.StartActivityForResult()) { result ->
+ if (result.resultCode == android.app.Activity.RESULT_OK) {
+ result.data?.data?.let { uri ->
+ val fileName = uri.getFileName(context)
+ val baseName = fileName.substringBeforeLast('.')
+ mapViewModel.addCustomTileProvider(
+ name = baseName,
+ urlTemplate = "", // Empty for local
+ localUri = uri.toString(),
+ )
+ }
+ }
+ }
+
+ LaunchedEffect(Unit) { mapViewModel.errorFlow.collectLatest { errorMessage -> context.showToast(errorMessage) } }
+
+ if (showEditDialog) {
+ AddEditCustomTileProviderDialog(
+ config = editingConfig,
+ onDismiss = { showEditDialog = false },
+ onSave = { name, url ->
+ if (editingConfig == null) { // Adding new
+ mapViewModel.addCustomTileProvider(name, url)
+ } else { // Editing existing
+ mapViewModel.updateCustomTileProvider(editingConfig!!.copy(name = name, urlTemplate = url))
+ }
+ showEditDialog = false
+ },
+ mapViewModel = mapViewModel,
+ )
+ }
+
+ LazyColumn(contentPadding = PaddingValues(bottom = 16.dp)) {
+ item {
+ Text(
+ text = stringResource(Res.string.manage_custom_tile_sources),
+ style = MaterialTheme.typography.headlineSmall,
+ modifier = Modifier.padding(16.dp),
+ )
+ HorizontalDivider()
+ }
+
+ if (customTileProviders.isEmpty()) {
+ item {
+ Text(
+ text = stringResource(Res.string.no_custom_tile_sources_found),
+ modifier = Modifier.padding(16.dp),
+ style = MaterialTheme.typography.bodyMedium,
+ )
+ }
+ } else {
+ items(customTileProviders, key = { it.id }) { config ->
+ ListItem(
+ headlineContent = { Text(config.name) },
+ supportingContent = {
+ if (config.isLocal) {
+ Text(
+ stringResource(Res.string.local_mbtiles_file),
+ style = MaterialTheme.typography.bodySmall,
+ )
+ } else {
+ Text(config.urlTemplate, style = MaterialTheme.typography.bodySmall)
+ }
+ },
+ trailingContent = {
+ Row {
+ IconButton(
+ onClick = {
+ editingConfig = config
+ showEditDialog = true
+ },
+ ) {
+ Icon(
+ MeshtasticIcons.Edit,
+ contentDescription = stringResource(Res.string.edit_custom_tile_source),
+ )
+ }
+ IconButton(onClick = { mapViewModel.removeCustomTileProvider(config.id) }) {
+ Icon(
+ MeshtasticIcons.Delete,
+ contentDescription = stringResource(Res.string.delete_custom_tile_source),
+ )
+ }
+ }
+ },
+ )
+ HorizontalDivider()
+ }
+ }
+
+ item {
+ Column(modifier = Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
+ Button(
+ onClick = {
+ editingConfig = null
+ showEditDialog = true
+ },
+ modifier = Modifier.fillMaxWidth(),
+ ) {
+ Text(stringResource(Res.string.add_custom_tile_source))
+ }
+
+ Button(
+ onClick = {
+ val intent =
+ Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
+ addCategory(Intent.CATEGORY_OPENABLE)
+ type = "*/*"
+ }
+ mbtilesPickerLauncher.launch(intent)
+ },
+ modifier = Modifier.fillMaxWidth(),
+ ) {
+ Text(stringResource(Res.string.add_local_mbtiles_file))
+ }
+ }
+ }
+ }
+}
+
+@Suppress("LongMethod")
+@Composable
+private fun AddEditCustomTileProviderDialog(
+ config: CustomTileProviderConfig?,
+ onDismiss: () -> Unit,
+ onSave: (String, String) -> Unit,
+ mapViewModel: MapViewModel,
+) {
+ var name by rememberSaveable { mutableStateOf(config?.name ?: "") }
+ var url by rememberSaveable { mutableStateOf(config?.urlTemplate ?: "") }
+ var nameError by remember { mutableStateOf(null) }
+ var urlError by remember { mutableStateOf(null) }
+ val customTileProviders by mapViewModel.customTileProviderConfigs.collectAsStateWithLifecycle()
+
+ val emptyNameError = stringResource(Res.string.name_cannot_be_empty)
+ val providerNameExistsError = stringResource(Res.string.provider_name_exists)
+ val urlCannotBeEmptyError = stringResource(Res.string.url_cannot_be_empty)
+ val urlMustContainPlaceholdersError = stringResource(Res.string.url_must_contain_placeholders)
+
+ fun validateAndSave() {
+ val currentNameError =
+ validateName(name, customTileProviders, config?.id, emptyNameError, providerNameExistsError)
+ val currentUrlError = validateUrl(url, urlCannotBeEmptyError, urlMustContainPlaceholdersError)
+
+ nameError = currentNameError
+ urlError = currentUrlError
+
+ if (currentNameError == null && currentUrlError == null) {
+ onSave(name, url)
+ }
+ }
+
+ MeshtasticDialog(
+ onDismiss = onDismiss,
+ title =
+ if (config == null) {
+ stringResource(Res.string.add_custom_tile_source)
+ } else {
+ stringResource(Res.string.edit_custom_tile_source)
+ },
+ text = {
+ Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
+ OutlinedTextField(
+ value = name,
+ onValueChange = {
+ name = it
+ nameError = null
+ },
+ label = { Text(stringResource(Res.string.name)) },
+ isError = nameError != null,
+ supportingText = { nameError?.let { Text(it) } },
+ singleLine = true,
+ )
+ OutlinedTextField(
+ value = url,
+ onValueChange = {
+ url = it
+ urlError = null
+ },
+ label = { Text(stringResource(Res.string.url_template)) },
+ isError = urlError != null,
+ supportingText = {
+ if (urlError != null) {
+ Text(urlError!!)
+ } else {
+ Text(stringResource(Res.string.url_template_hint))
+ }
+ },
+ singleLine = false,
+ maxLines = 2,
+ )
+ }
+ },
+ onConfirm = { validateAndSave() },
+ confirmTextRes = Res.string.save,
+ dismissTextRes = Res.string.cancel,
+ )
+}
+
+private fun validateName(
+ name: String,
+ providers: List,
+ currentId: String?,
+ emptyNameError: String,
+ nameExistsError: String,
+): String? = if (name.isBlank()) {
+ emptyNameError
+} else if (providers.any { it.name.equals(name, ignoreCase = true) && it.id != currentId }) {
+ nameExistsError
+} else {
+ null
+}
+
+private fun validateUrl(url: String, emptyUrlError: String, mustContainPlaceholdersError: String): String? =
+ if (url.isBlank()) {
+ emptyUrlError
+ } else if (
+ !url.contains("{z}", ignoreCase = true) ||
+ !url.contains("{x}", ignoreCase = true) ||
+ !url.contains("{y}", ignoreCase = true)
+ ) {
+ mustContainPlaceholdersError
+ } else {
+ null
+ }
+
+private fun android.net.Uri.getFileName(context: android.content.Context): String {
+ var name = this.lastPathSegment ?: "mbtiles_file"
+ if (this.scheme == "content") {
+ context.contentResolver.query(this, null, null, null, null)?.use { cursor ->
+ if (cursor.moveToFirst()) {
+ val displayNameIndex = cursor.getColumnIndex(android.provider.OpenableColumns.DISPLAY_NAME)
+ if (displayNameIndex != -1) {
+ name = cursor.getString(displayNameIndex)
+ }
+ }
+ }
+ }
+ return name
+}
diff --git a/app/src/google/kotlin/org/meshtastic/app/map/component/EditWaypointDialog.kt b/app/src/google/kotlin/org/meshtastic/app/map/component/EditWaypointDialog.kt
new file mode 100644
index 000000000..18eb0ac83
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/map/component/EditWaypointDialog.kt
@@ -0,0 +1,375 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.component
+
+import android.app.DatePickerDialog
+import android.app.TimePickerDialog
+import android.widget.DatePicker
+import android.widget.TimePicker
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.shape.CircleShape
+import androidx.compose.foundation.text.KeyboardActions
+import androidx.compose.foundation.text.KeyboardOptions
+import androidx.compose.material3.AlertDialog
+import androidx.compose.material3.Button
+import androidx.compose.material3.ExperimentalMaterial3Api
+import androidx.compose.material3.IconButton
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.OutlinedTextField
+import androidx.compose.material3.Switch
+import androidx.compose.material3.Text
+import androidx.compose.material3.TextButton
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.input.ImeAction
+import androidx.compose.ui.text.input.KeyboardType
+import androidx.compose.ui.text.style.TextAlign
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import kotlinx.datetime.LocalDate
+import kotlinx.datetime.Month
+import kotlinx.datetime.atTime
+import kotlinx.datetime.number
+import kotlinx.datetime.toInstant
+import kotlinx.datetime.toLocalDateTime
+import org.jetbrains.compose.resources.stringResource
+import org.meshtastic.core.common.util.systemTimeZone
+import org.meshtastic.core.resources.Res
+import org.meshtastic.core.resources.cancel
+import org.meshtastic.core.resources.date
+import org.meshtastic.core.resources.delete
+import org.meshtastic.core.resources.description
+import org.meshtastic.core.resources.expires
+import org.meshtastic.core.resources.locked
+import org.meshtastic.core.resources.name
+import org.meshtastic.core.resources.send
+import org.meshtastic.core.resources.time
+import org.meshtastic.core.resources.waypoint_edit
+import org.meshtastic.core.resources.waypoint_new
+import org.meshtastic.core.ui.emoji.EmojiPickerDialog
+import org.meshtastic.core.ui.icon.CalendarMonth
+import org.meshtastic.core.ui.icon.Lock
+import org.meshtastic.core.ui.icon.MeshtasticIcons
+import org.meshtastic.proto.Waypoint
+import kotlin.time.Duration.Companion.hours
+
+@OptIn(ExperimentalMaterial3Api::class)
+@Suppress("LongMethod", "CyclomaticComplexMethod", "MagicNumber")
+@Composable
+fun EditWaypointDialog(
+ waypoint: Waypoint,
+ onSendClicked: (Waypoint) -> Unit,
+ onDeleteClicked: (Waypoint) -> Unit,
+ onDismissRequest: () -> Unit,
+ modifier: Modifier = Modifier,
+) {
+ var waypointInput by remember { mutableStateOf(waypoint) }
+ val title = if (waypoint.id == 0) Res.string.waypoint_new else Res.string.waypoint_edit
+ val defaultEmoji = 0x1F4CD // 📍 Round Pushpin
+ val currentEmojiCodepoint = if ((waypointInput.icon ?: 0) == 0) defaultEmoji else waypointInput.icon!!
+ var showEmojiPickerView by remember { mutableStateOf(false) }
+
+ val context = LocalContext.current
+ val tz = systemTimeZone
+
+ // Initialize date and time states from waypointInput.expire
+ var selectedDateString by remember { mutableStateOf("") }
+ var selectedTimeString by remember { mutableStateOf("") }
+ var isExpiryEnabled by remember {
+ mutableStateOf((waypointInput.expire ?: 0) != 0 && waypointInput.expire != Int.MAX_VALUE)
+ }
+
+ val dateFormat = remember { android.text.format.DateFormat.getDateFormat(context) }
+ val timeFormat = remember { android.text.format.DateFormat.getTimeFormat(context) }
+ dateFormat.timeZone = java.util.TimeZone.getDefault()
+ timeFormat.timeZone = java.util.TimeZone.getDefault()
+
+ LaunchedEffect(waypointInput.expire, isExpiryEnabled) {
+ val expireValue = waypointInput.expire ?: 0
+ if (isExpiryEnabled) {
+ if (expireValue != 0 && expireValue != Int.MAX_VALUE) {
+ val instant = kotlin.time.Instant.fromEpochSeconds(expireValue.toLong())
+ val date = java.util.Date(instant.toEpochMilliseconds())
+ selectedDateString = dateFormat.format(date)
+ selectedTimeString = timeFormat.format(date)
+ } else { // If enabled but not set, default to 8 hours from now
+ val futureInstant = kotlin.time.Clock.System.now() + 8.hours
+ val date = java.util.Date(futureInstant.toEpochMilliseconds())
+ selectedDateString = dateFormat.format(date)
+ selectedTimeString = timeFormat.format(date)
+ waypointInput = waypointInput.copy(expire = futureInstant.epochSeconds.toInt())
+ }
+ } else {
+ selectedDateString = ""
+ selectedTimeString = ""
+ }
+ }
+
+ if (!showEmojiPickerView) {
+ AlertDialog(
+ onDismissRequest = onDismissRequest,
+ title = {
+ Text(
+ text = stringResource(title),
+ style = MaterialTheme.typography.titleLarge.copy(fontWeight = FontWeight.Bold),
+ textAlign = TextAlign.Center,
+ modifier = Modifier.fillMaxWidth(),
+ )
+ },
+ text = {
+ Column(modifier = modifier.fillMaxWidth()) {
+ OutlinedTextField(
+ value = waypointInput.name ?: "",
+ onValueChange = { waypointInput = waypointInput.copy(name = it.take(29)) },
+ label = { Text(stringResource(Res.string.name)) },
+ singleLine = true,
+ keyboardOptions =
+ KeyboardOptions.Default.copy(keyboardType = KeyboardType.Text, imeAction = ImeAction.Next),
+ modifier = Modifier.fillMaxWidth(),
+ trailingIcon = {
+ IconButton(onClick = { showEmojiPickerView = true }) {
+ Text(
+ text = String(Character.toChars(currentEmojiCodepoint)),
+ modifier =
+ Modifier.background(MaterialTheme.colorScheme.surfaceVariant, CircleShape)
+ .padding(6.dp),
+ fontSize = 20.sp,
+ )
+ }
+ },
+ )
+ Spacer(modifier = Modifier.size(8.dp))
+ OutlinedTextField(
+ value = waypointInput.description ?: "",
+ onValueChange = { waypointInput = waypointInput.copy(description = it.take(99)) },
+ label = { Text(stringResource(Res.string.description)) },
+ keyboardOptions =
+ KeyboardOptions.Default.copy(keyboardType = KeyboardType.Text, imeAction = ImeAction.Done),
+ keyboardActions = KeyboardActions(onDone = { /* Handle next/done focus */ }),
+ modifier = Modifier.fillMaxWidth(),
+ minLines = 2,
+ maxLines = 3,
+ )
+ Spacer(modifier = Modifier.size(8.dp))
+ Row(
+ modifier = Modifier.fillMaxWidth(),
+ verticalAlignment = Alignment.CenterVertically,
+ horizontalArrangement = Arrangement.SpaceBetween,
+ ) {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Image(
+ imageVector = MeshtasticIcons.Lock,
+ contentDescription = stringResource(Res.string.locked),
+ )
+ Spacer(modifier = Modifier.width(8.dp))
+ Text(stringResource(Res.string.locked))
+ }
+ Switch(
+ checked = (waypointInput.locked_to ?: 0) != 0,
+ onCheckedChange = { waypointInput = waypointInput.copy(locked_to = if (it) 1 else 0) },
+ )
+ }
+ Spacer(modifier = Modifier.size(8.dp))
+ Row(
+ modifier = Modifier.fillMaxWidth(),
+ verticalAlignment = Alignment.CenterVertically,
+ horizontalArrangement = Arrangement.SpaceBetween,
+ ) {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Image(
+ imageVector = MeshtasticIcons.CalendarMonth,
+ contentDescription = stringResource(Res.string.expires),
+ )
+ Spacer(modifier = Modifier.width(8.dp))
+ Text(stringResource(Res.string.expires))
+ }
+ Switch(
+ checked = isExpiryEnabled,
+ onCheckedChange = { checked ->
+ isExpiryEnabled = checked
+ if (checked) {
+ val expireValue = waypointInput.expire ?: 0
+ // Default to 8 hours from now if not already set
+ if (expireValue == 0 || expireValue == Int.MAX_VALUE) {
+ val futureInstant = kotlin.time.Clock.System.now() + 8.hours
+ waypointInput = waypointInput.copy(expire = futureInstant.epochSeconds.toInt())
+ }
+ } else {
+ waypointInput = waypointInput.copy(expire = Int.MAX_VALUE)
+ }
+ },
+ )
+ }
+
+ if (isExpiryEnabled) {
+ val currentInstant =
+ (waypointInput.expire ?: 0).let {
+ if (it != 0 && it != Int.MAX_VALUE) {
+ kotlin.time.Instant.fromEpochSeconds(it.toLong())
+ } else {
+ kotlin.time.Clock.System.now() + 8.hours
+ }
+ }
+ val ldt = currentInstant.toLocalDateTime(tz)
+
+ val datePickerDialog =
+ DatePickerDialog(
+ context,
+ { _: DatePicker, selectedYear: Int, selectedMonth: Int, selectedDay: Int ->
+ val currentLdt =
+ (waypointInput.expire ?: 0)
+ .let {
+ if (it != 0 && it != Int.MAX_VALUE) {
+ kotlin.time.Instant.fromEpochSeconds(it.toLong())
+ } else {
+ kotlin.time.Clock.System.now() + 8.hours
+ }
+ }
+ .toLocalDateTime(tz)
+
+ val newLdt =
+ LocalDate(
+ year = selectedYear,
+ month = Month(selectedMonth + 1),
+ day = selectedDay,
+ )
+ .atTime(
+ hour = currentLdt.hour,
+ minute = currentLdt.minute,
+ second = currentLdt.second,
+ nanosecond = currentLdt.nanosecond,
+ )
+ waypointInput =
+ waypointInput.copy(expire = newLdt.toInstant(tz).epochSeconds.toInt())
+ },
+ ldt.year,
+ ldt.month.number - 1,
+ ldt.day,
+ )
+
+ val timePickerDialog =
+ TimePickerDialog(
+ context,
+ { _: TimePicker, selectedHour: Int, selectedMinute: Int ->
+ val currentLdt =
+ (waypointInput.expire ?: 0)
+ .let {
+ if (it != 0 && it != Int.MAX_VALUE) {
+ kotlin.time.Instant.fromEpochSeconds(it.toLong())
+ } else {
+ kotlin.time.Clock.System.now() + 8.hours
+ }
+ }
+ .toLocalDateTime(tz)
+
+ val newLdt =
+ LocalDate(
+ year = currentLdt.year,
+ month = currentLdt.month,
+ day = currentLdt.day,
+ )
+ .atTime(
+ hour = selectedHour,
+ minute = selectedMinute,
+ second = currentLdt.second,
+ nanosecond = currentLdt.nanosecond,
+ )
+ waypointInput =
+ waypointInput.copy(expire = newLdt.toInstant(tz).epochSeconds.toInt())
+ },
+ ldt.hour,
+ ldt.minute,
+ android.text.format.DateFormat.is24HourFormat(context),
+ )
+ Spacer(modifier = Modifier.size(8.dp))
+ Row(
+ modifier = Modifier.fillMaxWidth(),
+ horizontalArrangement = Arrangement.SpaceEvenly,
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Column(horizontalAlignment = Alignment.CenterHorizontally) {
+ Button(onClick = { datePickerDialog.show() }) { Text(stringResource(Res.string.date)) }
+ Text(
+ modifier = Modifier.padding(top = 4.dp),
+ text = selectedDateString,
+ style = MaterialTheme.typography.bodyMedium,
+ )
+ }
+ Column(horizontalAlignment = Alignment.CenterHorizontally) {
+ Button(onClick = { timePickerDialog.show() }) { Text(stringResource(Res.string.time)) }
+ Text(
+ modifier = Modifier.padding(top = 4.dp),
+ text = selectedTimeString,
+ style = MaterialTheme.typography.bodyMedium,
+ )
+ }
+ }
+ }
+ }
+ },
+ confirmButton = {
+ Row(
+ modifier = Modifier.fillMaxWidth().padding(start = 8.dp, end = 8.dp, bottom = 8.dp),
+ horizontalArrangement = Arrangement.End,
+ ) {
+ if (waypoint.id != 0) {
+ TextButton(
+ onClick = { onDeleteClicked(waypointInput) },
+ modifier = Modifier.padding(end = 8.dp),
+ ) {
+ Text(stringResource(Res.string.delete), color = MaterialTheme.colorScheme.error)
+ }
+ }
+ Spacer(modifier = Modifier.weight(1f)) // Pushes delete to left and cancel/send to right
+ TextButton(onClick = onDismissRequest, modifier = Modifier.padding(end = 8.dp)) {
+ Text(stringResource(Res.string.cancel))
+ }
+ Button(
+ onClick = { onSendClicked(waypointInput) },
+ enabled = (waypointInput.name ?: "").isNotBlank(),
+ ) {
+ Text(stringResource(Res.string.send))
+ }
+ }
+ },
+ dismissButton = null, // Using custom buttons in confirmButton Row
+ modifier = modifier,
+ )
+ } else {
+ EmojiPickerDialog(onDismiss = { showEmojiPickerView = false }) { selectedEmoji ->
+ showEmojiPickerView = false
+ waypointInput = waypointInput.copy(icon = selectedEmoji.codePointAt(0))
+ }
+ }
+}
diff --git a/app/src/google/kotlin/org/meshtastic/app/map/component/MapFilterDropdown.kt b/app/src/google/kotlin/org/meshtastic/app/map/component/MapFilterDropdown.kt
new file mode 100644
index 000000000..d8e29120e
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/map/component/MapFilterDropdown.kt
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.component
+
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.padding
+import androidx.compose.material3.Checkbox
+import androidx.compose.material3.DropdownMenu
+import androidx.compose.material3.DropdownMenuItem
+import androidx.compose.material3.HorizontalDivider
+import androidx.compose.material3.Icon
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Slider
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.unit.dp
+import androidx.lifecycle.compose.collectAsStateWithLifecycle
+import org.jetbrains.compose.resources.stringResource
+import org.meshtastic.app.map.MapViewModel
+import org.meshtastic.core.resources.Res
+import org.meshtastic.core.resources.last_heard_filter_label
+import org.meshtastic.core.resources.only_favorites
+import org.meshtastic.core.resources.show_precision_circle
+import org.meshtastic.core.resources.show_waypoints
+import org.meshtastic.core.ui.icon.Favorite
+import org.meshtastic.core.ui.icon.Lens
+import org.meshtastic.core.ui.icon.MeshtasticIcons
+import org.meshtastic.core.ui.icon.PinDrop
+import org.meshtastic.feature.map.LastHeardFilter
+import kotlin.math.roundToInt
+
+@Composable
+internal fun MapFilterDropdown(expanded: Boolean, onDismissRequest: () -> Unit, mapViewModel: MapViewModel) {
+ val mapFilterState by mapViewModel.mapFilterStateFlow.collectAsStateWithLifecycle()
+ DropdownMenu(expanded = expanded, onDismissRequest = onDismissRequest) {
+ DropdownMenuItem(
+ text = { Text(stringResource(Res.string.only_favorites)) },
+ onClick = { mapViewModel.toggleOnlyFavorites() },
+ leadingIcon = {
+ Icon(
+ imageVector = MeshtasticIcons.Favorite,
+ contentDescription = stringResource(Res.string.only_favorites),
+ )
+ },
+ trailingIcon = {
+ Checkbox(
+ checked = mapFilterState.onlyFavorites,
+ onCheckedChange = { mapViewModel.toggleOnlyFavorites() },
+ )
+ },
+ )
+ DropdownMenuItem(
+ text = { Text(stringResource(Res.string.show_waypoints)) },
+ onClick = { mapViewModel.toggleShowWaypointsOnMap() },
+ leadingIcon = {
+ Icon(
+ imageVector = MeshtasticIcons.PinDrop,
+ contentDescription = stringResource(Res.string.show_waypoints),
+ )
+ },
+ trailingIcon = {
+ Checkbox(
+ checked = mapFilterState.showWaypoints,
+ onCheckedChange = { mapViewModel.toggleShowWaypointsOnMap() },
+ )
+ },
+ )
+ DropdownMenuItem(
+ text = { Text(stringResource(Res.string.show_precision_circle)) },
+ onClick = { mapViewModel.toggleShowPrecisionCircleOnMap() },
+ leadingIcon = {
+ Icon(
+ imageVector = MeshtasticIcons.Lens,
+ contentDescription = stringResource(Res.string.show_precision_circle),
+ )
+ },
+ trailingIcon = {
+ Checkbox(
+ checked = mapFilterState.showPrecisionCircle,
+ onCheckedChange = { mapViewModel.toggleShowPrecisionCircleOnMap() },
+ )
+ },
+ )
+ HorizontalDivider()
+ Column(modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp)) {
+ val filterOptions = LastHeardFilter.entries
+ val selectedIndex = filterOptions.indexOf(mapFilterState.lastHeardFilter)
+ var sliderPosition by remember(selectedIndex) { mutableFloatStateOf(selectedIndex.toFloat()) }
+
+ Text(
+ text =
+ stringResource(
+ Res.string.last_heard_filter_label,
+ stringResource(mapFilterState.lastHeardFilter.label),
+ ),
+ style = MaterialTheme.typography.labelLarge,
+ )
+ Slider(
+ value = sliderPosition,
+ onValueChange = { sliderPosition = it },
+ onValueChangeFinished = {
+ val newIndex = sliderPosition.roundToInt().coerceIn(0, filterOptions.size - 1)
+ mapViewModel.setLastHeardFilter(filterOptions[newIndex])
+ },
+ valueRange = 0f..(filterOptions.size - 1).toFloat(),
+ steps = filterOptions.size - 2,
+ )
+ }
+ }
+}
+
+@Composable
+internal fun NodeMapFilterDropdown(expanded: Boolean, onDismissRequest: () -> Unit, mapViewModel: MapViewModel) {
+ val mapFilterState by mapViewModel.mapFilterStateFlow.collectAsStateWithLifecycle()
+ DropdownMenu(expanded = expanded, onDismissRequest = onDismissRequest) {
+ Column(modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp)) {
+ val filterOptions = LastHeardFilter.entries
+ val selectedIndex = filterOptions.indexOf(mapFilterState.lastHeardTrackFilter)
+ var sliderPosition by remember(selectedIndex) { mutableFloatStateOf(selectedIndex.toFloat()) }
+
+ Text(
+ text =
+ stringResource(
+ Res.string.last_heard_filter_label,
+ stringResource(mapFilterState.lastHeardTrackFilter.label),
+ ),
+ style = MaterialTheme.typography.labelLarge,
+ )
+ Slider(
+ value = sliderPosition,
+ onValueChange = { sliderPosition = it },
+ onValueChangeFinished = {
+ val newIndex = sliderPosition.roundToInt().coerceIn(0, filterOptions.size - 1)
+ mapViewModel.setLastHeardTrackFilter(filterOptions[newIndex])
+ },
+ valueRange = 0f..(filterOptions.size - 1).toFloat(),
+ steps = filterOptions.size - 2,
+ )
+ }
+ }
+}
diff --git a/app/src/google/kotlin/org/meshtastic/app/map/component/MapTypeDropdown.kt b/app/src/google/kotlin/org/meshtastic/app/map/component/MapTypeDropdown.kt
new file mode 100644
index 000000000..ad4bd58bb
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/map/component/MapTypeDropdown.kt
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.component
+
+import androidx.compose.material3.DropdownMenu
+import androidx.compose.material3.DropdownMenuItem
+import androidx.compose.material3.HorizontalDivider
+import androidx.compose.material3.Icon
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.lifecycle.compose.collectAsStateWithLifecycle
+import com.google.maps.android.compose.MapType
+import org.jetbrains.compose.resources.stringResource
+import org.meshtastic.app.map.MapViewModel
+import org.meshtastic.core.resources.Res
+import org.meshtastic.core.resources.manage_custom_tile_sources
+import org.meshtastic.core.resources.map_type_hybrid
+import org.meshtastic.core.resources.map_type_normal
+import org.meshtastic.core.resources.map_type_satellite
+import org.meshtastic.core.resources.map_type_terrain
+import org.meshtastic.core.resources.selected_map_type
+import org.meshtastic.core.ui.icon.Check
+import org.meshtastic.core.ui.icon.MeshtasticIcons
+
+@Suppress("LongMethod")
+@Composable
+internal fun MapTypeDropdown(
+ expanded: Boolean,
+ onDismissRequest: () -> Unit,
+ mapViewModel: MapViewModel,
+ onManageCustomTileProvidersClicked: () -> Unit,
+) {
+ val customTileProviders by mapViewModel.customTileProviderConfigs.collectAsStateWithLifecycle()
+ val selectedCustomUrl by mapViewModel.selectedCustomTileProviderUrl.collectAsStateWithLifecycle()
+ val selectedGoogleMapType by mapViewModel.selectedGoogleMapType.collectAsStateWithLifecycle()
+
+ val googleMapTypes =
+ listOf(
+ stringResource(Res.string.map_type_normal) to MapType.NORMAL,
+ stringResource(Res.string.map_type_satellite) to MapType.SATELLITE,
+ stringResource(Res.string.map_type_terrain) to MapType.TERRAIN,
+ stringResource(Res.string.map_type_hybrid) to MapType.HYBRID,
+ )
+
+ DropdownMenu(expanded = expanded, onDismissRequest = onDismissRequest) {
+ googleMapTypes.forEach { (name, type) ->
+ DropdownMenuItem(
+ text = { Text(name) },
+ onClick = {
+ mapViewModel.setSelectedGoogleMapType(type)
+ onDismissRequest() // Close menu
+ },
+ trailingIcon =
+ if (selectedCustomUrl == null && selectedGoogleMapType == type) {
+ {
+ Icon(
+ MeshtasticIcons.Check,
+ contentDescription = stringResource(Res.string.selected_map_type),
+ )
+ }
+ } else {
+ null
+ },
+ )
+ }
+
+ if (customTileProviders.isNotEmpty()) {
+ HorizontalDivider()
+ customTileProviders.forEach { config ->
+ DropdownMenuItem(
+ text = { Text(config.name) },
+ onClick = {
+ mapViewModel.selectCustomTileProvider(config)
+ onDismissRequest() // Close menu
+ },
+ trailingIcon =
+ if (selectedCustomUrl == config.urlTemplate) {
+ {
+ Icon(
+ MeshtasticIcons.Check,
+ contentDescription = stringResource(Res.string.selected_map_type),
+ )
+ }
+ } else {
+ null
+ },
+ )
+ }
+ }
+ HorizontalDivider()
+ DropdownMenuItem(
+ text = { Text(stringResource(Res.string.manage_custom_tile_sources)) },
+ onClick = {
+ onManageCustomTileProvidersClicked()
+ onDismissRequest()
+ },
+ )
+ }
+}
diff --git a/app/src/google/kotlin/org/meshtastic/app/map/component/NodeClusterMarkers.kt b/app/src/google/kotlin/org/meshtastic/app/map/component/NodeClusterMarkers.kt
new file mode 100644
index 000000000..32e250475
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/map/component/NodeClusterMarkers.kt
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.component
+
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.platform.LocalView
+import androidx.lifecycle.compose.LocalLifecycleOwner
+import androidx.lifecycle.findViewTreeLifecycleOwner
+import androidx.lifecycle.setViewTreeLifecycleOwner
+import androidx.savedstate.compose.LocalSavedStateRegistryOwner
+import androidx.savedstate.findViewTreeSavedStateRegistryOwner
+import androidx.savedstate.setViewTreeSavedStateRegistryOwner
+import com.google.maps.android.clustering.Cluster
+import com.google.maps.android.clustering.view.DefaultClusterRenderer
+import com.google.maps.android.compose.Circle
+import com.google.maps.android.compose.MapsComposeExperimentalApi
+import com.google.maps.android.compose.clustering.Clustering
+import com.google.maps.android.compose.clustering.ClusteringMarkerProperties
+import org.meshtastic.app.map.model.NodeClusterItem
+import org.meshtastic.feature.map.BaseMapViewModel
+
+@OptIn(MapsComposeExperimentalApi::class)
+@Suppress("NestedBlockDepth")
+@Composable
+fun NodeClusterMarkers(
+ nodeClusterItems: List,
+ mapFilterState: BaseMapViewModel.MapFilterState,
+ navigateToNodeDetails: (Int) -> Unit,
+ onClusterClick: (Cluster) -> Boolean,
+) {
+ val view = LocalView.current
+ val lifecycleOwner = LocalLifecycleOwner.current
+ val savedStateRegistryOwner = LocalSavedStateRegistryOwner.current
+
+ // Workaround for https://github.com/googlemaps/android-maps-compose/issues/858
+ // The maps clustering library creates an internal ComposeView to snapshot markers.
+ // If that view is not attached to the hierarchy (which it often isn't during rendering),
+ // it fails to find the Lifecycle and SavedState owners. We propagate them to the root view
+ // so the internal snapshot view can find them when walking up the tree.
+ LaunchedEffect(view, lifecycleOwner, savedStateRegistryOwner) {
+ val root = view.rootView
+ if (root.findViewTreeLifecycleOwner() == null) {
+ root.setViewTreeLifecycleOwner(lifecycleOwner)
+ }
+ if (root.findViewTreeSavedStateRegistryOwner() == null) {
+ root.setViewTreeSavedStateRegistryOwner(savedStateRegistryOwner)
+ }
+ }
+
+ Clustering(
+ items = nodeClusterItems,
+ onClusterClick = onClusterClick,
+ onClusterItemInfoWindowClick = { item ->
+ navigateToNodeDetails(item.node.num)
+ false
+ },
+ clusterItemContent = { clusterItem -> PulsingNodeChip(node = clusterItem.node) },
+ onClusterManager = { clusterManager ->
+ (clusterManager.renderer as DefaultClusterRenderer).minClusterSize = 10
+ },
+ clusterItemDecoration = { clusterItem ->
+ if (mapFilterState.showPrecisionCircle) {
+ clusterItem.getPrecisionMeters()?.let { precisionMeters ->
+ if (precisionMeters > 0) {
+ Circle(
+ center = clusterItem.position,
+ radius = precisionMeters,
+ fillColor = Color(clusterItem.node.colors.second).copy(alpha = 0.2f),
+ strokeColor = Color(clusterItem.node.colors.second),
+ strokeWidth = 2f,
+ zIndex = 0f,
+ )
+ }
+ }
+ }
+ // Use the item's own priority-based zIndex (5f for My Node/Favorites, 4f for others)
+ ClusteringMarkerProperties(zIndex = clusterItem.getZIndex())
+ },
+ )
+}
diff --git a/app/src/google/kotlin/org/meshtastic/app/map/component/PulsingNodeChip.kt b/app/src/google/kotlin/org/meshtastic/app/map/component/PulsingNodeChip.kt
new file mode 100644
index 000000000..5403b8c11
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/map/component/PulsingNodeChip.kt
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.component
+
+import androidx.compose.animation.core.Animatable
+import androidx.compose.animation.core.LinearEasing
+import androidx.compose.animation.core.tween
+import androidx.compose.foundation.layout.Box
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.remember
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.drawWithContent
+import androidx.compose.ui.geometry.CornerRadius
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.unit.dp
+import kotlinx.coroutines.launch
+import org.meshtastic.core.common.util.nowSeconds
+import org.meshtastic.core.model.Node
+import org.meshtastic.core.ui.component.NodeChip
+
+@Composable
+fun PulsingNodeChip(node: Node, modifier: Modifier = Modifier) {
+ val animatedProgress = remember { Animatable(0f) }
+
+ LaunchedEffect(node) {
+ if ((nowSeconds - node.lastHeard) <= 5) {
+ launch {
+ animatedProgress.snapTo(0f)
+ animatedProgress.animateTo(
+ targetValue = 1f,
+ animationSpec = tween(durationMillis = 1000, easing = LinearEasing),
+ )
+ }
+ }
+ }
+
+ Box(
+ modifier =
+ modifier.drawWithContent {
+ drawContent()
+ if (animatedProgress.value > 0 && animatedProgress.value < 1f) {
+ val alpha = (1f - animatedProgress.value) * 0.3f
+ drawRoundRect(
+ size = size,
+ cornerRadius = CornerRadius(8.dp.toPx()),
+ color = Color.White.copy(alpha = alpha),
+ )
+ }
+ },
+ ) {
+ NodeChip(node = node)
+ }
+}
diff --git a/app/src/google/kotlin/org/meshtastic/app/map/component/WaypointMarkers.kt b/app/src/google/kotlin/org/meshtastic/app/map/component/WaypointMarkers.kt
new file mode 100644
index 000000000..61cdab9f1
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/map/component/WaypointMarkers.kt
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.component
+
+import androidx.compose.foundation.layout.padding
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.rememberCoroutineScope
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import com.google.android.gms.maps.model.LatLng
+import com.google.maps.android.compose.MapsComposeExperimentalApi
+import com.google.maps.android.compose.Marker
+import com.google.maps.android.compose.rememberComposeBitmapDescriptor
+import com.google.maps.android.compose.rememberUpdatedMarkerState
+import kotlinx.coroutines.launch
+import org.meshtastic.app.map.convertIntToEmoji
+import org.meshtastic.core.model.util.GeoConstants.DEG_D
+import org.meshtastic.core.resources.Res
+import org.meshtastic.core.resources.locked
+import org.meshtastic.core.ui.util.showToast
+import org.meshtastic.feature.map.BaseMapViewModel
+import org.meshtastic.proto.Waypoint
+
+@OptIn(MapsComposeExperimentalApi::class)
+@Composable
+fun WaypointMarkers(
+ displayableWaypoints: List,
+ mapFilterState: BaseMapViewModel.MapFilterState,
+ myNodeNum: Int,
+ isConnected: Boolean,
+ onEditWaypointRequest: (Waypoint) -> Unit,
+ selectedWaypointId: Int? = null,
+) {
+ val scope = rememberCoroutineScope()
+ val context = LocalContext.current
+ if (mapFilterState.showWaypoints) {
+ displayableWaypoints.forEach { waypoint ->
+ val markerState =
+ rememberUpdatedMarkerState(
+ position = LatLng((waypoint.latitude_i ?: 0) * DEG_D, (waypoint.longitude_i ?: 0) * DEG_D),
+ )
+
+ LaunchedEffect(selectedWaypointId) {
+ if (selectedWaypointId == waypoint.id) {
+ markerState.showInfoWindow()
+ }
+ }
+
+ val iconCodePoint = if ((waypoint.icon ?: 0) == 0) PUSHPIN else waypoint.icon!!
+ val emojiText = convertIntToEmoji(iconCodePoint)
+ val icon =
+ rememberComposeBitmapDescriptor(iconCodePoint) {
+ Text(text = emojiText, fontSize = 32.sp, modifier = Modifier.padding(2.dp))
+ }
+
+ Marker(
+ state = markerState,
+ icon = icon,
+ title = (waypoint.name ?: "").replace('\n', ' ').replace('\b', ' '),
+ snippet = (waypoint.description ?: "").replace('\n', ' ').replace('\b', ' '),
+ visible = true,
+ onInfoWindowClick = {
+ if ((waypoint.locked_to ?: 0) == 0 || waypoint.locked_to == myNodeNum || !isConnected) {
+ onEditWaypointRequest(waypoint)
+ } else {
+ scope.launch { context.showToast(Res.string.locked) }
+ }
+ },
+ )
+ }
+ }
+}
+
+private const val PUSHPIN = 0x1F4CD // Unicode for Round Pushpin
diff --git a/app/src/google/kotlin/org/meshtastic/app/map/model/CustomTileProviderConfig.kt b/app/src/google/kotlin/org/meshtastic/app/map/model/CustomTileProviderConfig.kt
new file mode 100644
index 000000000..a28b3b6c1
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/map/model/CustomTileProviderConfig.kt
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.model
+
+import kotlinx.serialization.Serializable
+import kotlin.uuid.Uuid
+
+@Serializable
+data class CustomTileProviderConfig(
+ val id: String = Uuid.random().toString(),
+ val name: String,
+ val urlTemplate: String,
+ val localUri: String? = null,
+) {
+ val isLocal: Boolean
+ get() = localUri != null
+}
diff --git a/app/src/google/kotlin/org/meshtastic/app/map/model/CustomTileSource.kt b/app/src/google/kotlin/org/meshtastic/app/map/model/CustomTileSource.kt
new file mode 100644
index 000000000..4adb7d97d
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/map/model/CustomTileSource.kt
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.model
+
+class CustomTileSource {
+
+ companion object {
+ fun getTileSource(index: Int) {
+ index
+ }
+ }
+}
diff --git a/app/src/google/kotlin/org/meshtastic/app/map/model/NodeClusterItem.kt b/app/src/google/kotlin/org/meshtastic/app/map/model/NodeClusterItem.kt
new file mode 100644
index 000000000..943d2c826
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/map/model/NodeClusterItem.kt
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.model
+
+import com.google.android.gms.maps.model.LatLng
+import com.google.maps.android.clustering.ClusterItem
+import org.meshtastic.core.model.Node
+
+data class NodeClusterItem(
+ val node: Node,
+ val nodePosition: LatLng,
+ val nodeTitle: String,
+ val nodeSnippet: String,
+ val myNodeNum: Int? = null,
+) : ClusterItem {
+ override fun getPosition(): LatLng = nodePosition
+
+ override fun getTitle(): String = nodeTitle
+
+ override fun getSnippet(): String = nodeSnippet
+
+ override fun getZIndex(): Float = when {
+ node.num == myNodeNum -> 5.0f // My node is always highest
+ node.isFavorite -> 5.0f // Favorites are equally high priority
+ else -> 4.0f
+ }
+
+ fun getPrecisionMeters(): Double? {
+ val precisionMap =
+ mapOf(
+ 10 to 23345.484932,
+ 11 to 11672.7369,
+ 12 to 5836.36288,
+ 13 to 2918.175876,
+ 14 to 1459.0823719999053,
+ 15 to 729.53562,
+ 16 to 364.7622,
+ 17 to 182.375556,
+ 18 to 91.182212,
+ 19 to 45.58554,
+ )
+ return precisionMap[this.node.position.precision_bits ?: 0]
+ }
+}
diff --git a/app/src/google/kotlin/org/meshtastic/app/map/node/NodeMapScreen.kt b/app/src/google/kotlin/org/meshtastic/app/map/node/NodeMapScreen.kt
new file mode 100644
index 000000000..fa17fedbf
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/map/node/NodeMapScreen.kt
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.node
+
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.padding
+import androidx.compose.material3.Scaffold
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.ui.Modifier
+import androidx.lifecycle.compose.collectAsStateWithLifecycle
+import org.meshtastic.app.map.GoogleMapMode
+import org.meshtastic.app.map.MapView
+import org.meshtastic.core.ui.component.MainAppBar
+import org.meshtastic.feature.map.node.NodeMapViewModel
+
+@Composable
+fun NodeMapScreen(nodeMapViewModel: NodeMapViewModel, onNavigateUp: () -> Unit) {
+ val node by nodeMapViewModel.node.collectAsStateWithLifecycle()
+ val positions by nodeMapViewModel.positionLogs.collectAsStateWithLifecycle()
+
+ Scaffold(
+ topBar = {
+ MainAppBar(
+ title = node?.user?.long_name ?: "",
+ ourNode = null,
+ showNodeChip = false,
+ canNavigateUp = true,
+ onNavigateUp = onNavigateUp,
+ actions = {},
+ onClickChip = {},
+ )
+ },
+ ) { paddingValues ->
+ MapView(
+ modifier = Modifier.fillMaxSize().padding(paddingValues),
+ mode = GoogleMapMode.NodeTrack(focusedNode = node, positions = positions),
+ )
+ }
+}
diff --git a/app/src/google/kotlin/org/meshtastic/app/map/node/NodeTrackMap.kt b/app/src/google/kotlin/org/meshtastic/app/map/node/NodeTrackMap.kt
new file mode 100644
index 000000000..2f7244b97
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/map/node/NodeTrackMap.kt
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.node
+
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.ui.Modifier
+import androidx.lifecycle.compose.collectAsStateWithLifecycle
+import org.koin.compose.viewmodel.koinViewModel
+import org.meshtastic.app.map.GoogleMapMode
+import org.meshtastic.app.map.MapView
+import org.meshtastic.feature.map.node.NodeMapViewModel
+import org.meshtastic.proto.Position
+
+/**
+ * Flavor-unified entry point for the embeddable node-track map. Resolves [destNum] to a
+ * [org.meshtastic.core.model.Node] via [NodeMapViewModel] and delegates to [MapView] in [GoogleMapMode.NodeTrack] mode,
+ * which provides the full shared map infrastructure (location tracking, tile providers, controls overlay with track
+ * filter).
+ *
+ * Supports optional synchronized selection via [selectedPositionTime] and [onPositionSelected].
+ */
+@Composable
+fun NodeTrackMap(
+ destNum: Int,
+ positions: List,
+ modifier: Modifier = Modifier,
+ selectedPositionTime: Int? = null,
+ onPositionSelected: ((Int) -> Unit)? = null,
+) {
+ val vm = koinViewModel()
+ vm.setDestNum(destNum)
+ val focusedNode by vm.node.collectAsStateWithLifecycle()
+ MapView(
+ modifier = modifier,
+ mode =
+ GoogleMapMode.NodeTrack(
+ focusedNode = focusedNode,
+ positions = positions,
+ selectedPositionTime = selectedPositionTime,
+ onPositionSelected = onPositionSelected,
+ ),
+ )
+}
diff --git a/app/src/google/kotlin/org/meshtastic/app/map/prefs/di/GoogleMapsKoinModule.kt b/app/src/google/kotlin/org/meshtastic/app/map/prefs/di/GoogleMapsKoinModule.kt
new file mode 100644
index 000000000..668dedbaa
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/map/prefs/di/GoogleMapsKoinModule.kt
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.prefs.di
+
+import android.content.Context
+import androidx.datastore.core.DataStore
+import androidx.datastore.preferences.SharedPreferencesMigration
+import androidx.datastore.preferences.core.PreferenceDataStoreFactory
+import androidx.datastore.preferences.core.Preferences
+import androidx.datastore.preferences.preferencesDataStoreFile
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.SupervisorJob
+import org.koin.core.annotation.ComponentScan
+import org.koin.core.annotation.Module
+import org.koin.core.annotation.Named
+import org.koin.core.annotation.Single
+import org.meshtastic.core.di.CoroutineDispatchers
+
+@Module
+@ComponentScan("org.meshtastic.app.map")
+class GoogleMapsKoinModule {
+
+ @Single
+ @Named("GoogleMapsDataStore")
+ fun provideGoogleMapsDataStore(context: Context, dispatchers: CoroutineDispatchers): DataStore =
+ PreferenceDataStoreFactory.create(
+ migrations = listOf(SharedPreferencesMigration(context, "google_maps_prefs")),
+ scope = CoroutineScope(dispatchers.io + SupervisorJob()),
+ produceFile = { context.preferencesDataStoreFile("google_maps_ds") },
+ )
+}
diff --git a/app/src/google/kotlin/org/meshtastic/app/map/prefs/map/GoogleMapsPrefs.kt b/app/src/google/kotlin/org/meshtastic/app/map/prefs/map/GoogleMapsPrefs.kt
new file mode 100644
index 000000000..6cf6091b1
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/map/prefs/map/GoogleMapsPrefs.kt
@@ -0,0 +1,196 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.prefs.map
+
+import androidx.datastore.core.DataStore
+import androidx.datastore.preferences.core.Preferences
+import androidx.datastore.preferences.core.doublePreferencesKey
+import androidx.datastore.preferences.core.edit
+import androidx.datastore.preferences.core.floatPreferencesKey
+import androidx.datastore.preferences.core.stringPreferencesKey
+import androidx.datastore.preferences.core.stringSetPreferencesKey
+import com.google.maps.android.compose.MapType
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.SupervisorJob
+import kotlinx.coroutines.flow.SharingStarted
+import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.map
+import kotlinx.coroutines.flow.stateIn
+import kotlinx.coroutines.launch
+import org.koin.core.annotation.Named
+import org.koin.core.annotation.Single
+import org.meshtastic.core.di.CoroutineDispatchers
+
+/** Interface for prefs specific to Google Maps. For general map prefs, see MapPrefs. */
+interface GoogleMapsPrefs {
+ val selectedGoogleMapType: StateFlow
+
+ fun setSelectedGoogleMapType(value: String?)
+
+ val selectedCustomTileUrl: StateFlow
+
+ fun setSelectedCustomTileUrl(value: String?)
+
+ val hiddenLayerUrls: StateFlow>
+
+ fun setHiddenLayerUrls(value: Set)
+
+ val cameraTargetLat: StateFlow
+
+ fun setCameraTargetLat(value: Double)
+
+ val cameraTargetLng: StateFlow
+
+ fun setCameraTargetLng(value: Double)
+
+ val cameraZoom: StateFlow
+
+ fun setCameraZoom(value: Float)
+
+ val cameraTilt: StateFlow
+
+ fun setCameraTilt(value: Float)
+
+ val cameraBearing: StateFlow
+
+ fun setCameraBearing(value: Float)
+
+ val networkMapLayers: StateFlow>
+
+ fun setNetworkMapLayers(value: Set)
+}
+
+@Single
+class GoogleMapsPrefsImpl(
+ @Named("GoogleMapsDataStore") private val dataStore: DataStore,
+ dispatchers: CoroutineDispatchers,
+) : GoogleMapsPrefs {
+ private val scope = CoroutineScope(SupervisorJob() + dispatchers.default)
+
+ override val selectedGoogleMapType: StateFlow =
+ dataStore.data
+ .map { it[KEY_SELECTED_GOOGLE_MAP_TYPE_PREF] ?: MapType.NORMAL.name }
+ .stateIn(scope, SharingStarted.Eagerly, MapType.NORMAL.name)
+
+ override fun setSelectedGoogleMapType(value: String?) {
+ scope.launch {
+ dataStore.edit { prefs ->
+ if (value == null) {
+ prefs.remove(KEY_SELECTED_GOOGLE_MAP_TYPE_PREF)
+ } else {
+ prefs[KEY_SELECTED_GOOGLE_MAP_TYPE_PREF] = value
+ }
+ }
+ }
+ }
+
+ override val selectedCustomTileUrl: StateFlow =
+ dataStore.data.map { it[KEY_SELECTED_CUSTOM_TILE_URL_PREF] }.stateIn(scope, SharingStarted.Eagerly, null)
+
+ override fun setSelectedCustomTileUrl(value: String?) {
+ scope.launch {
+ dataStore.edit { prefs ->
+ if (value == null) {
+ prefs.remove(KEY_SELECTED_CUSTOM_TILE_URL_PREF)
+ } else {
+ prefs[KEY_SELECTED_CUSTOM_TILE_URL_PREF] = value
+ }
+ }
+ }
+ }
+
+ override val hiddenLayerUrls: StateFlow> =
+ dataStore.data
+ .map { it[KEY_HIDDEN_LAYER_URLS_PREF] ?: emptySet() }
+ .stateIn(scope, SharingStarted.Eagerly, emptySet())
+
+ override fun setHiddenLayerUrls(value: Set) {
+ scope.launch { dataStore.edit { it[KEY_HIDDEN_LAYER_URLS_PREF] = value } }
+ }
+
+ override val cameraTargetLat: StateFlow =
+ dataStore.data
+ .map {
+ try {
+ it[KEY_CAMERA_TARGET_LAT_PREF] ?: 0.0
+ } catch (_: ClassCastException) {
+ it[floatPreferencesKey(KEY_CAMERA_TARGET_LAT_PREF.name)]?.toDouble() ?: 0.0
+ }
+ }
+ .stateIn(scope, SharingStarted.Eagerly, 0.0)
+
+ override fun setCameraTargetLat(value: Double) {
+ scope.launch { dataStore.edit { it[KEY_CAMERA_TARGET_LAT_PREF] = value } }
+ }
+
+ override val cameraTargetLng: StateFlow =
+ dataStore.data
+ .map {
+ try {
+ it[KEY_CAMERA_TARGET_LNG_PREF] ?: 0.0
+ } catch (_: ClassCastException) {
+ it[floatPreferencesKey(KEY_CAMERA_TARGET_LNG_PREF.name)]?.toDouble() ?: 0.0
+ }
+ }
+ .stateIn(scope, SharingStarted.Eagerly, 0.0)
+
+ override fun setCameraTargetLng(value: Double) {
+ scope.launch { dataStore.edit { it[KEY_CAMERA_TARGET_LNG_PREF] = value } }
+ }
+
+ override val cameraZoom: StateFlow =
+ dataStore.data.map { it[KEY_CAMERA_ZOOM_PREF] ?: 7f }.stateIn(scope, SharingStarted.Eagerly, 7f)
+
+ override fun setCameraZoom(value: Float) {
+ scope.launch { dataStore.edit { it[KEY_CAMERA_ZOOM_PREF] = value } }
+ }
+
+ override val cameraTilt: StateFlow =
+ dataStore.data.map { it[KEY_CAMERA_TILT_PREF] ?: 0f }.stateIn(scope, SharingStarted.Eagerly, 0f)
+
+ override fun setCameraTilt(value: Float) {
+ scope.launch { dataStore.edit { it[KEY_CAMERA_TILT_PREF] = value } }
+ }
+
+ override val cameraBearing: StateFlow =
+ dataStore.data.map { it[KEY_CAMERA_BEARING_PREF] ?: 0f }.stateIn(scope, SharingStarted.Eagerly, 0f)
+
+ override fun setCameraBearing(value: Float) {
+ scope.launch { dataStore.edit { it[KEY_CAMERA_BEARING_PREF] = value } }
+ }
+
+ override val networkMapLayers: StateFlow> =
+ dataStore.data
+ .map { it[KEY_NETWORK_MAP_LAYERS_PREF] ?: emptySet() }
+ .stateIn(scope, SharingStarted.Eagerly, emptySet())
+
+ override fun setNetworkMapLayers(value: Set) {
+ scope.launch { dataStore.edit { it[KEY_NETWORK_MAP_LAYERS_PREF] = value } }
+ }
+
+ companion object {
+ val KEY_SELECTED_GOOGLE_MAP_TYPE_PREF = stringPreferencesKey("selected_google_map_type")
+ val KEY_SELECTED_CUSTOM_TILE_URL_PREF = stringPreferencesKey("selected_custom_tile_url")
+ val KEY_HIDDEN_LAYER_URLS_PREF = stringSetPreferencesKey("hidden_layer_urls")
+ val KEY_CAMERA_TARGET_LAT_PREF = doublePreferencesKey("camera_target_lat")
+ val KEY_CAMERA_TARGET_LNG_PREF = doublePreferencesKey("camera_target_lng")
+ val KEY_CAMERA_ZOOM_PREF = floatPreferencesKey("camera_zoom")
+ val KEY_CAMERA_TILT_PREF = floatPreferencesKey("camera_tilt")
+ val KEY_CAMERA_BEARING_PREF = floatPreferencesKey("camera_bearing")
+ val KEY_NETWORK_MAP_LAYERS_PREF = stringSetPreferencesKey("network_map_layers")
+ }
+}
diff --git a/app/src/google/kotlin/org/meshtastic/app/map/repository/CustomTileProviderRepository.kt b/app/src/google/kotlin/org/meshtastic/app/map/repository/CustomTileProviderRepository.kt
new file mode 100644
index 000000000..6840cb17d
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/map/repository/CustomTileProviderRepository.kt
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.repository
+
+import co.touchlab.kermit.Logger
+import kotlinx.coroutines.flow.Flow
+import kotlinx.coroutines.flow.MutableStateFlow
+import kotlinx.coroutines.flow.asStateFlow
+import kotlinx.coroutines.withContext
+import kotlinx.serialization.SerializationException
+import kotlinx.serialization.json.Json
+import org.koin.core.annotation.Single
+import org.meshtastic.app.map.model.CustomTileProviderConfig
+import org.meshtastic.core.di.CoroutineDispatchers
+import org.meshtastic.core.repository.MapTileProviderPrefs
+
+interface CustomTileProviderRepository {
+ fun getCustomTileProviders(): Flow>
+
+ suspend fun addCustomTileProvider(config: CustomTileProviderConfig)
+
+ suspend fun updateCustomTileProvider(config: CustomTileProviderConfig)
+
+ suspend fun deleteCustomTileProvider(configId: String)
+
+ suspend fun getCustomTileProviderById(configId: String): CustomTileProviderConfig?
+}
+
+@Single
+class CustomTileProviderRepositoryImpl(
+ private val json: Json,
+ private val dispatchers: CoroutineDispatchers,
+ private val mapTileProviderPrefs: MapTileProviderPrefs,
+) : CustomTileProviderRepository {
+
+ private val customTileProvidersStateFlow = MutableStateFlow>(emptyList())
+
+ init {
+ loadDataFromPrefs()
+ }
+
+ override fun getCustomTileProviders(): Flow> =
+ customTileProvidersStateFlow.asStateFlow()
+
+ override suspend fun addCustomTileProvider(config: CustomTileProviderConfig) {
+ val newList = customTileProvidersStateFlow.value + config
+ customTileProvidersStateFlow.value = newList
+ saveDataToPrefs(newList)
+ }
+
+ override suspend fun updateCustomTileProvider(config: CustomTileProviderConfig) {
+ val newList = customTileProvidersStateFlow.value.map { if (it.id == config.id) config else it }
+ customTileProvidersStateFlow.value = newList
+ saveDataToPrefs(newList)
+ }
+
+ override suspend fun deleteCustomTileProvider(configId: String) {
+ val newList = customTileProvidersStateFlow.value.filterNot { it.id == configId }
+ customTileProvidersStateFlow.value = newList
+ saveDataToPrefs(newList)
+ }
+
+ override suspend fun getCustomTileProviderById(configId: String): CustomTileProviderConfig? =
+ customTileProvidersStateFlow.value.find { it.id == configId }
+
+ private fun loadDataFromPrefs() {
+ val jsonString = mapTileProviderPrefs.customTileProviders.value
+ if (jsonString != null) {
+ try {
+ customTileProvidersStateFlow.value = json.decodeFromString>(jsonString)
+ } catch (e: SerializationException) {
+ Logger.e(e) { "Error deserializing tile providers" }
+ customTileProvidersStateFlow.value = emptyList()
+ }
+ } else {
+ customTileProvidersStateFlow.value = emptyList()
+ }
+ }
+
+ private suspend fun saveDataToPrefs(providers: List) {
+ withContext(dispatchers.io) {
+ try {
+ val jsonString = json.encodeToString(providers)
+ mapTileProviderPrefs.setCustomTileProviders(jsonString)
+ } catch (e: SerializationException) {
+ Logger.e(e) { "Error serializing tile providers" }
+ }
+ }
+ }
+}
diff --git a/app/src/google/kotlin/org/meshtastic/app/map/traceroute/TracerouteMap.kt b/app/src/google/kotlin/org/meshtastic/app/map/traceroute/TracerouteMap.kt
new file mode 100644
index 000000000..d725537c8
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/map/traceroute/TracerouteMap.kt
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.map.traceroute
+
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import org.meshtastic.app.map.GoogleMapMode
+import org.meshtastic.app.map.MapView
+import org.meshtastic.core.model.TracerouteOverlay
+import org.meshtastic.proto.Position
+
+/**
+ * Flavor-unified entry point for the embeddable traceroute map. Delegates to [MapView] in [GoogleMapMode.Traceroute]
+ * mode, which provides the full shared map infrastructure (location tracking, tile providers, controls overlay).
+ */
+@Composable
+fun TracerouteMap(
+ tracerouteOverlay: TracerouteOverlay?,
+ tracerouteNodePositions: Map,
+ onMappableCountChanged: (shown: Int, total: Int) -> Unit,
+ modifier: Modifier = Modifier,
+) {
+ MapView(
+ modifier = modifier,
+ mode =
+ GoogleMapMode.Traceroute(
+ overlay = tracerouteOverlay,
+ nodePositions = tracerouteNodePositions,
+ onMappableCountChanged = onMappableCountChanged,
+ ),
+ )
+}
diff --git a/app/src/google/kotlin/org/meshtastic/app/node/component/InlineMap.kt b/app/src/google/kotlin/org/meshtastic/app/node/component/InlineMap.kt
new file mode 100644
index 000000000..c86e7a78c
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/node/component/InlineMap.kt
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.node.component
+
+import androidx.compose.foundation.isSystemInDarkTheme
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.key
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import com.google.android.gms.maps.model.CameraPosition
+import com.google.android.gms.maps.model.LatLng
+import com.google.maps.android.compose.Circle
+import com.google.maps.android.compose.ComposeMapColorScheme
+import com.google.maps.android.compose.GoogleMap
+import com.google.maps.android.compose.MapUiSettings
+import com.google.maps.android.compose.MapsComposeExperimentalApi
+import com.google.maps.android.compose.MarkerComposable
+import com.google.maps.android.compose.rememberCameraPositionState
+import com.google.maps.android.compose.rememberUpdatedMarkerState
+import org.meshtastic.core.model.Node
+import org.meshtastic.core.ui.component.NodeChip
+import org.meshtastic.core.ui.component.precisionBitsToMeters
+
+private const val DEFAULT_ZOOM = 15f
+
+@OptIn(MapsComposeExperimentalApi::class)
+@Composable
+fun InlineMap(node: Node, modifier: Modifier = Modifier) {
+ val dark = isSystemInDarkTheme()
+ val mapColorScheme =
+ when (dark) {
+ true -> ComposeMapColorScheme.DARK
+ else -> ComposeMapColorScheme.LIGHT
+ }
+ key(node.num) {
+ val location = LatLng(node.latitude, node.longitude)
+ val cameraState = rememberCameraPositionState {
+ position = CameraPosition.fromLatLngZoom(location, DEFAULT_ZOOM)
+ }
+
+ GoogleMap(
+ mapColorScheme = mapColorScheme,
+ modifier = modifier,
+ uiSettings =
+ MapUiSettings(
+ zoomControlsEnabled = true,
+ mapToolbarEnabled = false,
+ compassEnabled = false,
+ myLocationButtonEnabled = false,
+ rotationGesturesEnabled = false,
+ scrollGesturesEnabled = false,
+ tiltGesturesEnabled = false,
+ zoomGesturesEnabled = false,
+ ),
+ cameraPositionState = cameraState,
+ ) {
+ val precisionMeters = precisionBitsToMeters(node.position.precision_bits ?: 0)
+ val latLng = LatLng(node.latitude, node.longitude)
+ if (precisionMeters > 0) {
+ Circle(
+ center = latLng,
+ radius = precisionMeters,
+ fillColor = Color(node.colors.second).copy(alpha = 0.2f),
+ strokeColor = Color(node.colors.second),
+ strokeWidth = 2f,
+ )
+ }
+ MarkerComposable(state = rememberUpdatedMarkerState(position = latLng)) { NodeChip(node = node) }
+ }
+ }
+}
diff --git a/app/src/google/kotlin/org/meshtastic/app/node/metrics/TracerouteMapOverlayInsets.kt b/app/src/google/kotlin/org/meshtastic/app/node/metrics/TracerouteMapOverlayInsets.kt
new file mode 100644
index 000000000..992edf588
--- /dev/null
+++ b/app/src/google/kotlin/org/meshtastic/app/node/metrics/TracerouteMapOverlayInsets.kt
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2025-2026 Meshtastic LLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.meshtastic.app.node.metrics
+
+import androidx.compose.foundation.layout.PaddingValues
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.unit.dp
+import org.meshtastic.core.ui.util.TracerouteMapOverlayInsets
+
+fun getTracerouteMapOverlayInsets(): TracerouteMapOverlayInsets = TracerouteMapOverlayInsets(
+ overlayAlignment = Alignment.BottomCenter,
+ overlayPadding = PaddingValues(bottom = 16.dp),
+ contentHorizontalAlignment = Alignment.CenterHorizontally,
+)
diff --git a/app/src/googleDebug/res/drawable-anydpi/ic_launcher_background.xml b/app/src/googleDebug/res/drawable-anydpi/ic_launcher_background.xml
new file mode 100644
index 000000000..1a564c2ab
--- /dev/null
+++ b/app/src/googleDebug/res/drawable-anydpi/ic_launcher_background.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
diff --git a/app/src/googleDebug/res/values/strings.xml b/app/src/googleDebug/res/values/strings.xml
new file mode 100644
index 000000000..dccab15c7
--- /dev/null
+++ b/app/src/googleDebug/res/values/strings.xml
@@ -0,0 +1,19 @@
+
+
+ Google Debug
+
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 341fc536d..f7d2ce900 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,4 +1,21 @@
+
+
@@ -23,13 +40,18 @@
android:usesPermissionFlags="neverForLocation"
tools:targetApi="s" />
+
+
+
-
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
-
@@ -71,18 +96,31 @@
android:name="android.hardware.usb.host"
android:required="false" />
-
+
+
+
+
+
+
+
+
+ android:theme="@style/SplashTheme"
+ android:localeConfig="@xml/locales_config"
+ android:networkSecurityConfig="@xml/network_security_config"
+ android:enableOnBackInvokedCallback="true">
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -119,43 +173,73 @@
android:value="true" />
-
-
-
-
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -168,7 +252,7 @@
android:resource="@xml/device_filter" />
-
@@ -192,9 +276,42 @@
android:path="com.geeksville.mesh" /> -->
+
+
+
+
+
+
+
+
+
+
+
+ android:name="com.atakmap.app.component"
+ android:exported="true"
+ tools:ignore="MissingClass">
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/aidl/com/geeksville/mesh/IMeshService.aidl b/app/src/main/aidl/com/geeksville/mesh/IMeshService.aidl
deleted file mode 100644
index a440b7ef3..000000000
--- a/app/src/main/aidl/com/geeksville/mesh/IMeshService.aidl
+++ /dev/null
@@ -1,142 +0,0 @@
-// com.geeksville.mesh.IMeshService.aidl
-package com.geeksville.mesh;
-
-// Declare any non-default types here with import statements
-parcelable DataPacket;
-parcelable NodeInfo;
-parcelable MyNodeInfo;
-
-/**
-This is the public android API for talking to meshtastic radios.
-
-To connect to meshtastic you should bind to it per https://developer.android.com/guide/components/bound-services
-
-The intent you use to reach the service should look like this:
-
- val intent = Intent().apply {
- setClassName(
- "com.geeksville.mesh",
- "com.geeksville.mesh.service.MeshService"
- )
- }
-
-In Android 11+ you *may* need to add the following to the client app's manifest to allow binding of the mesh service:
-
-
-
-For additional information, see https://developer.android.com/guide/topics/manifest/queries-element
-
-
-Once you have bound to the service you should register your broadcast receivers per https://developer.android.com/guide/components/broadcasts#context-registered-receivers
-
- // com.geeksville.mesh.x broadcast intents, where x is:
-
- // RECEIVED_DATA for data received from other nodes. payload will contain a DataPacket, this action is DEPRECATED (because it sends all received data)
- // far better to instead use RECEIVED.
-
- // RECEIVED. - will **only** deliver packets for the specified port number. If a wellknown portnums.proto name for portnum is known it will be used
- // (i.e. com.geeksville.mesh.RECEIVED.TEXT_MESSAGE_APP) else the numeric portnum will be included as a base 10 integer (com.geeksville.mesh.RECEIVED.4403 etc...)
-
- // NODE_CHANGE for new IDs appearing or disappearing
- // CONNECTION_CHANGED for losing/gaining connection to the packet radio
- // MESSAGE_STATUS_CHANGED for any message status changes (for sent messages only, other messages come via RECEIVED_DATA. payload will contain a message ID and a MessageStatus)
-
-At the very least you will probably want to receive RECEIVED_DATA.
-
-Note - these calls might throw RemoteException to indicate mesh error states
-*/
-interface IMeshService {
- /// Tell the service where to send its broadcasts of received packets
- /// This call is only required for manifest declared receivers. If your receiver is context-registered
- /// you don't need this.
- void subscribeReceiver(String packageName, String receiverName);
-
- /**
- * Set the ID info for this node
-
- If myId is null, then the existing unique node ID is preserved, only the human visible longName/shortName is changed
- */
- void setOwner(String myId, String longName, String shortName, boolean isLicensed);
-
- /// Return my unique user ID string
- String getMyId();
-
- /*
- Send a packet to a specified node name
-
- typ is defined in mesh.proto Data.Type. For now juse use 0 to mean opaque bytes.
-
- destId can be null to indicate "broadcast message"
-
- messageStatus and id of the provided message will be updated by this routine to indicate
- message send status and the ID that can be used to locate the message in the future
- */
- void send(inout DataPacket packet);
-
- /**
- Get the IDs of everyone on the mesh. You should also subscribe for NODE_CHANGE broadcasts.
- */
- List getNodes();
-
- /// This method is only intended for use in our GUI, so the user can set radio options
- /// It returns a DeviceConfig protobuf.
- byte []getConfig();
- /// It sets a Config protobuf via admin packet
- void setConfig(in byte []payload);
-
- /// This method is only intended for use in our GUI, so the user can set radio options
- /// It sets a ModuleConfig protobuf via admin packet
- void setModuleConfig(in byte []payload);
-
- /// This method is only intended for use in our GUI, so the user can set radio options
- /// It sets a Channel protobuf via admin packet
- void setChannel(in byte []payload);
-
- /// Send beginEditSettings admin packet to nodeNum
- void beginEditSettings();
-
- /// Send commitEditSettings admin packet to nodeNum
- void commitEditSettings();
-
- /// Send position packet with wantResponse to nodeNum
- void requestPosition(in int idNum, in double lat, in double lon, in int alt);
-
- /// Send Shutdown admin packet to nodeNum
- void requestShutdown(in int idNum);
-
- /// Send Reboot admin packet to nodeNum
- void requestReboot(in int idNum);
-
- /// Send FactoryReset admin packet to nodeNum
- void requestFactoryReset(in int idNum);
-
- /// Send NodedbReset admin packet to nodeNum
- void requestNodedbReset(in int idNum);
-
- /**
- Is the packet radio currently connected to the phone? Returns a ConnectionState string.
- */
- String connectionState();
-
- /// If a macaddress we will try to talk to our device, if null we will be idle.
- /// Any current connection will be dropped (even if the device address is the same) before reconnecting.
- /// Users should not call this directly, only used internally by the MeshUtil activity
- /// Returns true if the device address actually changed, or false if no change was needed
- boolean setDeviceAddress(String deviceAddr);
-
- /// Get basic device hardware info about our connected radio. Will never return NULL. Will return NULL
- /// if no my node info is available (i.e. it will not throw an exception)
- MyNodeInfo getMyNodeInfo();
-
- /// Start updating the radios firmware
- void startFirmwareUpdate();
-
- /// Return a number 0-100 for firmware update progress. -1 for completed and success, -2 for failure
- int getUpdateStatus();
-
- /// Start providing location (from phone GPS) to mesh
- void startProvideLocation();
-
- /// Stop providing location (from phone GPS) to mesh
- void stopProvideLocation();
-}
diff --git a/app/src/main/assets/device_bootloader_ota_quirks.json b/app/src/main/assets/device_bootloader_ota_quirks.json
new file mode 100644
index 000000000..960c63101
--- /dev/null
+++ b/app/src/main/assets/device_bootloader_ota_quirks.json
@@ -0,0 +1,22 @@
+{
+ "devices": [
+ {
+ "hwModel": 18,
+ "hwModelSlug": "NANO_G2_ULTRA",
+ "requiresBootloaderUpgradeForOta": true,
+ "infoUrl": "https://meshtastic.org/docs/getting-started/flashing-firmware/nrf52/update-nrf52-bootloader/"
+ },
+ {
+ "hwModel": 9,
+ "hwModelSlug": "RAK4631",
+ "requiresBootloaderUpgradeForOta": true,
+ "infoUrl": "https://meshtastic.org/docs/getting-started/flashing-firmware/nrf52/update-nrf52-bootloader/"
+ },
+ {
+ "hwModel": 96,
+ "hwModelSlug": "NOMADSTAR_METEOR_PRO",
+ "requiresBootloaderUpgradeForOta": true,
+ "infoUrl": "https://meshtastic.org/docs/getting-started/flashing-firmware/nrf52/update-nrf52-bootloader/"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/app/src/main/assets/device_hardware.json b/app/src/main/assets/device_hardware.json
new file mode 100644
index 000000000..b4e3550eb
--- /dev/null
+++ b/app/src/main/assets/device_hardware.json
@@ -0,0 +1,1402 @@
+[
+ {
+ "hwModel": 1,
+ "hwModelSlug": "TLORA_V2",
+ "platformioTarget": "tlora-v2",
+ "architecture": "esp32",
+ "activelySupported": false,
+ "displayName": "LILYGO T-LoRa V2",
+ "tags": [
+ "LilyGo"
+ ]
+ },
+ {
+ "hwModel": 2,
+ "hwModelSlug": "TLORA_V1",
+ "platformioTarget": "tlora-v1",
+ "architecture": "esp32",
+ "activelySupported": false,
+ "displayName": "LILYGO T-LoRa V1",
+ "tags": [
+ "LilyGo"
+ ]
+ },
+ {
+ "hwModel": 3,
+ "hwModelSlug": "TLORA_V2_1_1P6",
+ "platformioTarget": "tlora-v2-1-1_6",
+ "architecture": "esp32",
+ "activelySupported": true,
+ "supportLevel": 3,
+ "displayName": "LILYGO T-LoRa V2.1-1.6",
+ "tags": [
+ "LilyGo"
+ ],
+ "images": [
+ "tlora-v2-1-1_6.svg"
+ ]
+ },
+ {
+ "hwModel": 4,
+ "hwModelSlug": "TBEAM",
+ "platformioTarget": "tbeam",
+ "architecture": "esp32",
+ "activelySupported": true,
+ "supportLevel": 3,
+ "displayName": "LILYGO T-Beam",
+ "tags": [
+ "LilyGo"
+ ],
+ "images": [
+ "tbeam.svg"
+ ]
+ },
+ {
+ "hwModel": 5,
+ "hwModelSlug": "HELTEC_V2_0",
+ "platformioTarget": "heltec-v2_0",
+ "architecture": "esp32",
+ "activelySupported": false,
+ "displayName": "Heltec V2.0",
+ "tags": [
+ "Heltec"
+ ]
+ },
+ {
+ "hwModel": 6,
+ "hwModelSlug": "TBEAM_V0P7",
+ "platformioTarget": "tbeam0_7",
+ "architecture": "esp32",
+ "activelySupported": false,
+ "displayName": "LILYGO T-Beam V0.7",
+ "tags": [
+ "LilyGo"
+ ]
+ },
+ {
+ "hwModel": 7,
+ "hwModelSlug": "T_ECHO",
+ "platformioTarget": "t-echo",
+ "architecture": "nrf52840",
+ "supportLevel": 1,
+ "activelySupported": true,
+ "displayName": "LILYGO T-Echo",
+ "tags": [
+ "LilyGo"
+ ],
+ "images": [
+ "t-echo.svg"
+ ],
+ "requiresDfu": true,
+ "hasInkHud": true
+ },
+ {
+ "hwModel": 8,
+ "hwModelSlug": "TLORA_V1_1P3",
+ "platformioTarget": "tlora-v1_3",
+ "architecture": "esp32",
+ "activelySupported": false,
+ "displayName": "LILYGO T-LoRa V1.1-1.3",
+ "tags": [
+ "LilyGo"
+ ]
+ },
+ {
+ "hwModel": 9,
+ "hwModelSlug": "RAK4631",
+ "platformioTarget": "rak4631",
+ "architecture": "nrf52840",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "RAK WisBlock 4631",
+ "tags": [
+ "RAK"
+ ],
+ "images": [
+ "rak4631.svg",
+ "rak4631_case.svg"
+ ],
+ "requiresDfu": true
+ },
+ {
+ "hwModel": 10,
+ "hwModelSlug": "HELTEC_V2_1",
+ "platformioTarget": "heltec-v2_1",
+ "architecture": "esp32",
+ "activelySupported": false,
+ "displayName": "Heltec V2.1",
+ "tags": [
+ "Heltec"
+ ]
+ },
+ {
+ "hwModel": 11,
+ "hwModelSlug": "HELTEC_V1",
+ "platformioTarget": "heltec-v1",
+ "architecture": "esp32",
+ "activelySupported": false,
+ "displayName": "Heltec V1",
+ "tags": [
+ "Heltec"
+ ]
+ },
+ {
+ "hwModel": 12,
+ "hwModelSlug": "LILYGO_TBEAM_S3_CORE",
+ "platformioTarget": "tbeam-s3-core",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "LILYGO T-Beam Supreme",
+ "tags": [
+ "LilyGo"
+ ],
+ "images": [
+ "tbeam-s3-core.svg"
+ ],
+ "requiresDfu": true,
+ "partitionScheme": "8MB"
+ },
+ {
+ "hwModel": 13,
+ "hwModelSlug": "RAK11200",
+ "platformioTarget": "rak11200",
+ "architecture": "esp32",
+ "activelySupported": true,
+ "supportLevel": 3,
+ "displayName": "RAK WisBlock 11200",
+ "tags": [
+ "RAK"
+ ],
+ "images": [
+ "rak11200.svg"
+ ]
+ },
+ {
+ "hwModel": 14,
+ "hwModelSlug": "NANO_G1",
+ "platformioTarget": "nano-g1",
+ "architecture": "esp32",
+ "activelySupported": true,
+ "supportLevel": 3,
+ "displayName": "Nano G1",
+ "tags": [
+ "B&Q"
+ ]
+ },
+ {
+ "hwModel": 15,
+ "hwModelSlug": "TLORA_V2_1_1P8",
+ "platformioTarget": "tlora-v2-1-1_8",
+ "architecture": "esp32",
+ "activelySupported": true,
+ "supportLevel": 3,
+ "displayName": "LILYGO T-LoRa V2.1-1.8",
+ "tags": [
+ "LilyGo",
+ "2.4GHz"
+ ],
+ "images": [
+ "tlora-v2-1-1_8.svg"
+ ]
+ },
+ {
+ "hwModel": 16,
+ "hwModelSlug": "TLORA_T3_S3",
+ "platformioTarget": "tlora-t3s3-v1",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "displayName": "LILYGO T-LoRa T3-S3",
+ "supportLevel": 1,
+ "tags": [
+ "LilyGo"
+ ],
+ "images": [
+ "tlora-t3s3-v1.svg"
+ ],
+ "requiresDfu": true
+ },
+ {
+ "hwModel": 16,
+ "hwModelSlug": "TLORA_T3_S3",
+ "platformioTarget": "tlora-t3s3-epaper",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "LILYGO T-LoRa T3-S3 E-Ink",
+ "tags": [
+ "LilyGo"
+ ],
+ "images": [
+ "tlora-t3s3-epaper.svg"
+ ],
+ "requiresDfu": true,
+ "hasInkHud": true
+ },
+ {
+ "hwModel": 17,
+ "hwModelSlug": "NANO_G1_EXPLORER",
+ "platformioTarget": "nano-g1-explorer",
+ "architecture": "esp32",
+ "activelySupported": true,
+ "supportLevel": 3,
+ "displayName": "Nano G1 Explorer",
+ "tags": [
+ "B&Q"
+ ]
+ },
+ {
+ "hwModel": 18,
+ "hwModelSlug": "NANO_G2_ULTRA",
+ "platformioTarget": "nano-g2-ultra",
+ "architecture": "nrf52840",
+ "activelySupported": true,
+ "supportLevel": 2,
+ "displayName": "Nano G2 Ultra",
+ "tags": [
+ "B&Q"
+ ],
+ "requiresDfu": true,
+ "images": [
+ "nano-g2-ultra.svg"
+ ]
+ },
+ {
+ "hwModel": 21,
+ "hwModelSlug": "WIO_WM1110",
+ "platformioTarget": "wio-tracker-wm1110",
+ "architecture": "nrf52840",
+ "activelySupported": true,
+ "supportLevel": 3,
+ "displayName": "Seeed Wio WM1110 Tracker",
+ "tags": [
+ "Seeed"
+ ],
+ "images": [
+ "wio-tracker-wm1110.svg"
+ ],
+ "requiresDfu": true
+ },
+ {
+ "hwModel": 25,
+ "hwModelSlug": "STATION_G1",
+ "platformioTarget": "station-g1",
+ "architecture": "esp32",
+ "activelySupported": true,
+ "supportLevel": 3,
+ "displayName": "Station G1",
+ "tags": [
+ "B&Q"
+ ]
+ },
+ {
+ "hwModel": 26,
+ "hwModelSlug": "RAK11310",
+ "platformioTarget": "rak11310",
+ "architecture": "rp2040",
+ "activelySupported": true,
+ "supportLevel": 2,
+ "displayName": "RAK WisBlock 11310",
+ "tags": [
+ "RAK"
+ ],
+ "images": [
+ "rak11310.svg"
+ ],
+ "requiresDfu": true
+ },
+ {
+ "hwModel": 29,
+ "hwModelSlug": "CANARYONE",
+ "platformioTarget": "canaryone",
+ "architecture": "nrf52840",
+ "activelySupported": true,
+ "supportLevel": 3,
+ "displayName": "Canary One",
+ "tags": [
+ "Canary"
+ ],
+ "requiresDfu": true
+ },
+ {
+ "hwModel": 30,
+ "hwModelSlug": "RP2040_LORA",
+ "platformioTarget": "rp2040-lora",
+ "architecture": "rp2040",
+ "activelySupported": true,
+ "supportLevel": 2,
+ "displayName": "RP2040 LoRa",
+ "tags": [
+ "Waveshare"
+ ],
+ "requiresDfu": true
+ },
+ {
+ "hwModel": 31,
+ "hwModelSlug": "STATION_G2",
+ "platformioTarget": "station-g2",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 2,
+ "displayName": "Station G2",
+ "tags": [
+ "B&Q"
+ ],
+ "requiresDfu": true,
+ "images": [
+ "station-g2.svg"
+ ],
+ "partitionScheme": "16MB"
+ },
+ {
+ "hwModel": 33,
+ "hwModelSlug": "T_ECHO_PLUS",
+ "platformioTarget": "t-echo-plus",
+ "architecture": "nrf52840",
+ "supportLevel": 1,
+ "activelySupported": true,
+ "displayName": "LILYGO T-Echo Plus",
+ "tags": [
+ "LilyGo"
+ ],
+ "images": [
+ "t-echo_plus.svg"
+ ],
+ "requiresDfu": true,
+ "hasInkHud": true
+ },
+ {
+ "hwModel": 39,
+ "hwModelSlug": "DIY_V1",
+ "platformioTarget": "meshtastic-diy-v1",
+ "architecture": "esp32",
+ "activelySupported": true,
+ "supportLevel": 3,
+ "displayName": "DIY V1",
+ "tags": [
+ "DIY"
+ ],
+ "images": [
+ "diy.svg"
+ ]
+ },
+ {
+ "hwModel": 39,
+ "hwModelSlug": "HYDRA",
+ "platformioTarget": "hydra",
+ "architecture": "esp32",
+ "activelySupported": true,
+ "supportLevel": 3,
+ "displayName": "Hydra",
+ "tags": [
+ "DIY"
+ ]
+ },
+ {
+ "hwModel": 41,
+ "hwModelSlug": "DR_DEV",
+ "platformioTarget": "meshtastic-dr-dev",
+ "architecture": "esp32",
+ "activelySupported": false,
+ "displayName": "DR-DEV",
+ "tags": [
+ "DIY"
+ ]
+ },
+ {
+ "hwModel": 42,
+ "hwModelSlug": "M5STACK",
+ "platformioTarget": "m5stack-core",
+ "architecture": "esp32",
+ "activelySupported": true,
+ "supportLevel": 3,
+ "displayName": "M5 Stack",
+ "tags": [
+ "M5Stack"
+ ]
+ },
+ {
+ "hwModel": 43,
+ "hwModelSlug": "HELTEC_V3",
+ "platformioTarget": "heltec-v3",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "Heltec V3",
+ "tags": [
+ "Heltec"
+ ],
+ "images": [
+ "heltec-v3.svg",
+ "heltec-v3-case.svg"
+ ],
+ "partitionScheme": "8MB"
+ },
+ {
+ "hwModel": 44,
+ "hwModelSlug": "HELTEC_WSL_V3",
+ "platformioTarget": "heltec-wsl-v3",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "Heltec Wireless Stick Lite V3",
+ "tags": [
+ "Heltec"
+ ],
+ "images": [
+ "heltec-wsl-v3.svg"
+ ],
+ "partitionScheme": "8MB"
+ },
+ {
+ "hwModel": 47,
+ "hwModelSlug": "RPI_PICO",
+ "platformioTarget": "pico",
+ "architecture": "rp2040",
+ "activelySupported": true,
+ "supportLevel": 3,
+ "displayName": "Raspberry Pi Pico",
+ "tags": [
+ "RPi",
+ "DIY"
+ ],
+ "requiresDfu": true,
+ "images": [
+ "pico.svg"
+ ]
+ },
+ {
+ "hwModel": 47,
+ "hwModelSlug": "RPI_PICO",
+ "platformioTarget": "picow",
+ "architecture": "rp2040",
+ "activelySupported": true,
+ "supportLevel": 3,
+ "displayName": "Raspberry Pi Pico W",
+ "tags": [
+ "RPi",
+ "DIY"
+ ],
+ "requiresDfu": true,
+ "images": [
+ "rpipicow.svg"
+ ]
+ },
+ {
+ "hwModel": 48,
+ "hwModelSlug": "HELTEC_WIRELESS_TRACKER",
+ "platformioTarget": "heltec-wireless-tracker",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "Heltec Wireless Tracker V1.1",
+ "tags": [
+ "Heltec"
+ ],
+ "images": [
+ "heltec-wireless-tracker.svg"
+ ],
+ "requiresDfu": true,
+ "partitionScheme": "8MB"
+ },
+ {
+ "hwModel": 58,
+ "hwModelSlug": "HELTEC_WIRELESS_TRACKER_V1_0",
+ "platformioTarget": "heltec-wireless-tracker-V1-0",
+ "architecture": "esp32-s3",
+ "activelySupported": false,
+ "supportLevel": 3,
+ "displayName": "Heltec Wireless Tracker V1.0",
+ "images": [
+ "heltec-wireless-tracker.svg"
+ ],
+ "requiresDfu": true,
+ "partitionScheme": "8MB"
+ },
+ {
+ "hwModel": 49,
+ "hwModelSlug": "HELTEC_WIRELESS_PAPER",
+ "platformioTarget": "heltec-wireless-paper",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "Heltec Wireless Paper",
+ "tags": [
+ "Heltec"
+ ],
+ "images": [
+ "heltec-wireless-paper.svg"
+ ],
+ "hasInkHud": true,
+ "partitionScheme": "8MB"
+ },
+ {
+ "hwModel": 50,
+ "hwModelSlug": "T_DECK",
+ "platformioTarget": "t-deck",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "LILYGO T-Deck",
+ "tags": [
+ "LilyGo"
+ ],
+ "images": [
+ "t-deck.svg"
+ ],
+ "requiresDfu": true,
+ "hasMui": true,
+ "partitionScheme": "16MB"
+ },
+ {
+ "hwModel": 51,
+ "hwModelSlug": "T_WATCH_S3",
+ "platformioTarget": "t-watch-s3",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 3,
+ "displayName": "LILYGO T-Watch S3",
+ "tags": [
+ "LilyGo"
+ ],
+ "images": [
+ "t-watch-s3.svg"
+ ],
+ "partitionScheme": "8MB"
+ },
+ {
+ "hwModel": 52,
+ "hwModelSlug": "PICOMPUTER_S3",
+ "platformioTarget": "picomputer-s3",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 3,
+ "displayName": "Pi Computer S3",
+ "hasMui": true,
+ "partitionScheme": "8MB"
+ },
+ {
+ "hwModel": 53,
+ "hwModelSlug": "HELTEC_HT62",
+ "platformioTarget": "heltec-ht62-esp32c3-sx1262",
+ "architecture": "esp32-c3",
+ "supportLevel": 1,
+ "activelySupported": true,
+ "displayName": "Heltec HT62",
+ "tags": [
+ "Heltec"
+ ],
+ "images": [
+ "heltec-ht62-esp32c3-sx1262.svg"
+ ]
+ },
+ {
+ "hwModel": 57,
+ "hwModelSlug": "HELTEC_WIRELESS_PAPER_V1_0",
+ "platformioTarget": "heltec-wireless-paper-v1_0",
+ "architecture": "esp32-s3",
+ "activelySupported": false,
+ "supportLevel": 3,
+ "tags": [
+ "Heltec"
+ ],
+ "displayName": "Heltec Wireless Paper V1.0",
+ "images": [
+ "heltec-wireless-paper-v1_0.svg"
+ ],
+ "partitionScheme": "8MB"
+ },
+ {
+ "hwModel": 59,
+ "hwModelSlug": "UNPHONE",
+ "platformioTarget": "unphone",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 3,
+ "displayName": "unPhone",
+ "requiresDfu": true,
+ "hasMui": true,
+ "partitionScheme": "8MB"
+ },
+ {
+ "hwModel": 48,
+ "hwModelSlug": "HELTEC_WIRELESS_TRACKER",
+ "platformioTarget": "tracksenger",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 3,
+ "displayName": "TrackSenger (small TFT)",
+ "requiresDfu": true,
+ "partitionScheme": "8MB"
+ },
+ {
+ "hwModel": 48,
+ "hwModelSlug": "HELTEC_WIRELESS_TRACKER",
+ "platformioTarget": "tracksenger-lcd",
+ "architecture": "esp32-s3",
+ "activelySupported": false,
+ "supportLevel": 3,
+ "displayName": "TrackSenger (big TFT)",
+ "requiresDfu": true,
+ "partitionScheme": "8MB"
+ },
+ {
+ "hwModel": 48,
+ "hwModelSlug": "HELTEC_WIRELESS_TRACKER",
+ "platformioTarget": "tracksenger-oled",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 3,
+ "displayName": "TrackSenger (big OLED)",
+ "partitionScheme": "8MB"
+ },
+ {
+ "hwModel": 61,
+ "hwModelSlug": "CDEBYTE_EORA_S3",
+ "platformioTarget": "CDEBYTE_EoRa-S3",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 3,
+ "displayName": "EBYTE EoRa-S3",
+ "tags": [
+ "EByte"
+ ],
+ "requiresDfu": true
+ },
+ {
+ "hwModel": 64,
+ "hwModelSlug": "RADIOMASTER_900_BANDIT_NANO",
+ "platformioTarget": "radiomaster_900_bandit_nano",
+ "architecture": "esp32",
+ "activelySupported": true,
+ "supportLevel": 2,
+ "displayName": "RadioMaster 900 Bandit Nano",
+ "tags": [
+ "RadioMaster"
+ ]
+ },
+ {
+ "hwModel": 66,
+ "hwModelSlug": "HELTEC_VISION_MASTER_T190",
+ "platformioTarget": "heltec-vision-master-t190",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "Heltec Vision Master T190",
+ "tags": [
+ "Heltec"
+ ],
+ "images": [
+ "heltec-vision-master-t190.svg"
+ ],
+ "requiresDfu": true,
+ "partitionScheme": "8MB"
+ },
+ {
+ "hwModel": 67,
+ "hwModelSlug": "HELTEC_VISION_MASTER_E213",
+ "platformioTarget": "heltec-vision-master-e213",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "Heltec Vision Master E213",
+ "tags": [
+ "Heltec"
+ ],
+ "images": [
+ "heltec-vision-master-e213.svg"
+ ],
+ "requiresDfu": true,
+ "hasInkHud": true,
+ "partitionScheme": "8MB"
+ },
+ {
+ "hwModel": 68,
+ "hwModelSlug": "HELTEC_VISION_MASTER_E290",
+ "platformioTarget": "heltec-vision-master-e290",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "Heltec Vision Master E290",
+ "tags": [
+ "Heltec"
+ ],
+ "images": [
+ "heltec-vision-master-e290.svg"
+ ],
+ "requiresDfu": true,
+ "hasInkHud": true,
+ "partitionScheme": "8MB"
+ },
+ {
+ "hwModel": 69,
+ "hwModelSlug": "HELTEC_MESH_NODE_T114",
+ "platformioTarget": "heltec-mesh-node-t114",
+ "architecture": "nrf52840",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "Heltec Mesh Node T114",
+ "tags": [
+ "Heltec"
+ ],
+ "images": [
+ "heltec-mesh-node-t114.svg",
+ "heltec-mesh-node-t114-case.svg"
+ ],
+ "requiresDfu": true
+ },
+ {
+ "hwModel": 70,
+ "hwModelSlug": "SENSECAP_INDICATOR",
+ "platformioTarget": "seeed-sensecap-indicator",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "Seeed SenseCAP Indicator",
+ "tags": [
+ "Seeed"
+ ],
+ "images": [
+ "seeed-sensecap-indicator.svg"
+ ],
+ "hasMui": true,
+ "partitionScheme": "8MB"
+ },
+ {
+ "hwModel": 71,
+ "hwModelSlug": "TRACKER_T1000_E",
+ "platformioTarget": "tracker-t1000-e",
+ "architecture": "nrf52840",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "Seeed Card Tracker T1000-E",
+ "tags": [
+ "Seeed"
+ ],
+ "images": [
+ "tracker-t1000-e.svg"
+ ],
+ "requiresDfu": true
+ },
+ {
+ "hwModel": 81,
+ "hwModelSlug": "SEEED_XIAO_S3",
+ "platformioTarget": "seeed-xiao-s3",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 3,
+ "displayName": "Seeed Xiao ESP32-S3",
+ "tags": [
+ "Seeed"
+ ],
+ "images": [
+ "seeed-xiao-s3.svg"
+ ],
+ "requiresDfu": true,
+ "partitionScheme": "8MB"
+ },
+ {
+ "hwModel": 105,
+ "hwModelSlug": "WISMESH_TAG",
+ "platformioTarget": "rak_wismeshtag",
+ "architecture": "nrf52840",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "RAK WisMesh Tag",
+ "tags": [
+ "RAK"
+ ],
+ "images": [
+ "rak_wismesh_tag.svg"
+ ],
+ "requiresDfu": true
+ },
+ {
+ "hwModel": 84,
+ "hwModelSlug": "WISMESH_TAP",
+ "platformioTarget": "rak_wismeshtap",
+ "architecture": "nrf52840",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "RAK WisMesh Tap",
+ "tags": [
+ "RAK"
+ ],
+ "images": [
+ "rak-wismeshtap.svg"
+ ],
+ "requiresDfu": true
+ },
+ {
+ "hwModel": 22,
+ "hwModelSlug": "WISMESH_HUB",
+ "platformioTarget": "rak2560",
+ "architecture": "nrf52840",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "RAK WisMesh Repeater",
+ "tags": [
+ "RAK"
+ ],
+ "images": [
+ "rak2560.svg"
+ ],
+ "requiresDfu": true
+ },
+ {
+ "hwModel": 63,
+ "hwModelSlug": "NRF52_PROMICRO_DIY",
+ "platformioTarget": "nrf52_promicro_diy_tcxo",
+ "architecture": "nrf52840",
+ "activelySupported": true,
+ "supportLevel": 3,
+ "displayName": "NRF52 Pro-micro DIY",
+ "tags": [
+ "DIY"
+ ],
+ "images": [
+ "promicro.svg"
+ ],
+ "requiresDfu": true
+ },
+ {
+ "hwModel": 88,
+ "hwModelSlug": "XIAO_NRF52_KIT",
+ "platformioTarget": "seeed_xiao_nrf52840_kit",
+ "architecture": "nrf52840",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "Seeed Xiao NRF52840 Kit",
+ "tags": [
+ "Seeed"
+ ],
+ "requiresDfu": true,
+ "images": [
+ "seeed_xiao_nrf52_kit.svg"
+ ]
+ },
+ {
+ "hwModel": 89,
+ "hwModelSlug": "THINKNODE_M1",
+ "platformioTarget": "thinknode_m1",
+ "architecture": "nrf52840",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "ThinkNode M1",
+ "tags": [
+ "Elecrow"
+ ],
+ "requiresDfu": true,
+ "images": [
+ "thinknode_m1.svg"
+ ],
+ "hasInkHud": true
+ },
+ {
+ "hwModel": 107,
+ "hwModelSlug": "THINKNODE_M5",
+ "platformioTarget": "thinknode_m5",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "ThinkNode M5",
+ "tags": [
+ "Elecrow"
+ ],
+ "requiresDfu": false,
+ "images": [
+ "thinknode_m1.svg"
+ ],
+ "hasInkHud": true
+ },
+ {
+ "hwModel": 90,
+ "hwModelSlug": "THINKNODE_M2",
+ "platformioTarget": "thinknode_m2",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "ThinkNode M2",
+ "tags": [
+ "Elecrow"
+ ],
+ "requiresDfu": false,
+ "images": [
+ "thinknode_m2.svg"
+ ]
+ },
+ {
+ "hwModel": 93,
+ "hwModelSlug": "MUZI_BASE",
+ "platformioTarget": "muzi-base",
+ "architecture": "nrf52840",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "muzi BASE DUO/UNO",
+ "tags": [
+ "muzi"
+ ],
+ "requiresDfu": true,
+ "images": [
+ "muzi_base.svg"
+ ]
+ },
+ {
+ "hwModel": 94,
+ "hwModelSlug": "HELTEC_MESH_POCKET",
+ "platformioTarget": "heltec-mesh-pocket-10000",
+ "architecture": "nrf52840",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "Heltec MeshPocket",
+ "tags": [
+ "Heltec"
+ ],
+ "images": [
+ "heltec_mesh_pocket.svg"
+ ],
+ "requiresDfu": true,
+ "hasInkHud": true,
+ "key": "HELTEC_MESH_POCKET",
+ "variant": "10000mAh"
+ },
+ {
+ "hwModel": 94,
+ "hwModelSlug": "HELTEC_MESH_POCKET",
+ "platformioTarget": "heltec-mesh-pocket-5000",
+ "architecture": "nrf52840",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "Heltec MeshPocket",
+ "tags": [
+ "Heltec"
+ ],
+ "images": [
+ "heltec_mesh_pocket.svg"
+ ],
+ "requiresDfu": true,
+ "hasInkHud": true,
+ "key": "HELTEC_MESH_POCKET",
+ "variant": "5000mAh"
+ },
+ {
+ "hwModel": 95,
+ "hwModelSlug": "SEEED_SOLAR_NODE",
+ "platformioTarget": "seeed_solar_node",
+ "architecture": "nrf52840",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "Seeed SenseCAP Solar Node",
+ "tags": [
+ "Seeed"
+ ],
+ "images": [
+ "seeed_solar.svg"
+ ],
+ "requiresDfu": true
+ },
+ {
+ "hwModel": 99,
+ "hwModelSlug": "SEEED_WIO_TRACKER_L1",
+ "platformioTarget": "seeed_wio_tracker_L1",
+ "architecture": "nrf52840",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "Seeed Wio Tracker L1",
+ "tags": [
+ "Seeed"
+ ],
+ "images": [
+ "wio_tracker_l1_case.svg"
+ ],
+ "requiresDfu": true
+ },
+ {
+ "hwModel": 100,
+ "hwModelSlug": "SEEED_WIO_TRACKER_L1_EINK",
+ "platformioTarget": "seeed_wio_tracker_L1_eink",
+ "architecture": "nrf52840",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "Seeed Wio Tracker L1 E-Ink",
+ "tags": [
+ "Seeed"
+ ],
+ "requiresDfu": true,
+ "hasInkHud": true,
+ "images": [
+ "wio_tracker_l1_eink.svg"
+ ]
+ },
+ {
+ "hwModel": 96,
+ "hwModelSlug": "NOMADSTAR_METEOR_PRO",
+ "platformioTarget": "rak4631_nomadstar_meteor_pro",
+ "architecture": "nrf52840",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "NomadStar Meteor Pro",
+ "tags": [
+ "NomadStar"
+ ],
+ "requiresDfu": true,
+ "images": [
+ "meteor_pro.svg"
+ ]
+ },
+ {
+ "hwModel": 97,
+ "hwModelSlug": "CROWPANEL",
+ "platformioTarget": "elecrow-adv1-43-50-70-tft",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "Crowpanel Adv 4.3/5.0/7.0 TFT",
+ "tags": [
+ "Elecrow"
+ ],
+ "requiresDfu": true,
+ "images": [
+ "crowpanel_5_0.svg",
+ "crowpanel_7_0.svg"
+ ],
+ "partitionScheme": "16MB",
+ "hasMui": true
+ },
+ {
+ "hwModel": 97,
+ "hwModelSlug": "CROWPANEL",
+ "platformioTarget": "elecrow-adv-24-28-tft",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "Crowpanel Adv 2.4/2.8 TFT",
+ "tags": [
+ "Elecrow"
+ ],
+ "requiresDfu": true,
+ "images": [
+ "crowpanel_2_4.svg",
+ "crowpanel_2_8.svg"
+ ],
+ "partitionScheme": "16MB",
+ "hasMui": true
+ },
+ {
+ "hwModel": 97,
+ "hwModelSlug": "CROWPANEL",
+ "platformioTarget": "elecrow-adv-35-tft",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "Crowpanel Adv 3.5 TFT",
+ "tags": [
+ "Elecrow"
+ ],
+ "requiresDfu": true,
+ "images": [
+ "crowpanel_3_5.svg"
+ ],
+ "partitionScheme": "16MB",
+ "hasMui": true
+ },
+ {
+ "hwModel": 101,
+ "hwModelSlug": "MUZI_R1_NEO",
+ "platformioTarget": "r1-neo",
+ "architecture": "nrf52840",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "muzi R1 Neo",
+ "tags": [
+ "muzi"
+ ],
+ "requiresDfu": true,
+ "images": [
+ "muzi_r1_neo.svg"
+ ]
+ },
+ {
+ "hwModel": 102,
+ "hwModelSlug": "T_DECK_PRO",
+ "platformioTarget": "t-deck-pro",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "LILYGO T-Deck Pro",
+ "tags": [
+ "LilyGo"
+ ],
+ "images": [
+ "tdeck_pro.svg"
+ ],
+ "requiresDfu": true,
+ "hasMui": false,
+ "partitionScheme": "16MB"
+ },
+ {
+ "hwModel": 103,
+ "hwModelSlug": "T_LORA_PAGER",
+ "platformioTarget": "tlora-pager",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "LILYGO T-LoRa Pager",
+ "tags": [
+ "LilyGo"
+ ],
+ "requiresDfu": true,
+ "hasMui": false,
+ "partitionScheme": "16MB",
+ "images": [
+ "lilygo-tlora-pager.svg"
+ ]
+ },
+ {
+ "hwModel": 108,
+ "hwModelSlug": "HELTEC_MESH_SOLAR",
+ "platformioTarget": "heltec-mesh-solar",
+ "architecture": "nrf52840",
+ "activelySupported": false,
+ "supportLevel": 1,
+ "displayName": "Heltec MeshSolar",
+ "tags": [
+ "Heltec"
+ ],
+ "requiresDfu": true,
+ "images": [
+ "heltec-mesh-solar.svg"
+ ]
+ },
+ {
+ "hwModel": 109,
+ "hwModelSlug": "T_ECHO_LITE",
+ "platformioTarget": "t-echo-lite",
+ "architecture": "nrf52840",
+ "activelySupported": false,
+ "supportLevel": 1,
+ "displayName": "LILYGO T-Echo Lite",
+ "tags": [
+ "LilyGo"
+ ],
+ "requiresDfu": true,
+ "hasInkHud": false,
+ "images": [
+ "techo_lite.svg"
+ ]
+ },
+ {
+ "hwModel": 111,
+ "hwModelSlug": "M5STACK_C6L",
+ "platformioTarget": "m5stack-unitc6l",
+ "architecture": "esp32-c6",
+ "supportLevel": 1,
+ "activelySupported": true,
+ "displayName": "M5Stack Unit C6L",
+ "tags": [
+ "M5Stack"
+ ],
+ "images": [
+ "m5_c6l.svg"
+ ]
+ },
+ {
+ "hwModel": 110,
+ "hwModelSlug": "HELTEC_V4",
+ "platformioTarget": "heltec-v4",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "Heltec V4",
+ "tags": [
+ "Heltec"
+ ],
+ "requiresDfu": true,
+ "hasMui": true,
+ "partitionScheme": "16MB",
+ "images": [
+ "heltec_v4.svg"
+ ]
+ },
+ {
+ "hwModel": 106,
+ "hwModelSlug": "RAK3312",
+ "platformioTarget": "rak3312",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "RAK3312",
+ "tags": [
+ "RAK"
+ ],
+ "requiresDfu": false,
+ "hasMui": false,
+ "partitionScheme": "16MB",
+ "images": [
+ "rak_3312.svg"
+ ]
+ },
+ {
+ "hwModel": 112,
+ "hwModelSlug": "M5STACK_CARDPUTER_ADV",
+ "platformioTarget": "m5stack-cardputer-adv",
+ "architecture": "esp32-s3",
+ "activelySupported": false,
+ "supportLevel": 1,
+ "displayName": "Cardputer Mesh Kit",
+ "tags": [
+ "M5Stack"
+ ],
+ "images": [
+ "m5stack_cardputer.svg"
+ ],
+ "partitionScheme": "8MB"
+ },
+ {
+ "hwModel": 113,
+ "hwModelSlug": "HELTEC_WIRELESS_TRACKER_V2",
+ "platformioTarget": "heltec-wireless-tracker-v2",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "Heltec Wireless Tracker V2",
+ "tags": [
+ "Heltec"
+ ],
+ "images": [
+ "heltec_wireless_tracker_v2.svg"
+ ],
+ "partitionScheme": "8MB"
+ },
+ {
+ "hwModel": 115,
+ "hwModelSlug": "THINKNODE_M3",
+ "platformioTarget": "thinknode_m3",
+ "architecture": "nrf52840",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "ThinkNode M3",
+ "tags": [
+ "Elecrow"
+ ],
+ "requiresDfu": true,
+ "images": [
+ "thinknode_m3.svg"
+ ]
+ },
+ {
+ "hwModel": 116,
+ "hwModelSlug": "WISMESH_TAP_V2",
+ "platformioTarget": "rak_wismesh_tap_v2",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "RAK WisMesh Tap V2",
+ "tags": [
+ "RAK"
+ ],
+ "hasMui": true,
+ "partitionScheme": "8MB",
+ "images": [
+ "rak-wismesh-tap-v2.svg"
+ ]
+ },
+ {
+ "hwModel": 117,
+ "hwModelSlug": "RAK3401",
+ "platformioTarget": "rak3401-1watt",
+ "architecture": "nrf52840",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "RAK3401 1W",
+ "tags": [
+ "RAK"
+ ],
+ "requiresDfu": true,
+ "images": [
+ "rak3401.svg"
+ ]
+ },
+ {
+ "hwModel": 119,
+ "hwModelSlug": "THINKNODE_M4",
+ "platformioTarget": "thinknode_m4",
+ "architecture": "nrf52840",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "ThinkNode M4",
+ "tags": [
+ "Elecrow"
+ ],
+ "requiresDfu": true,
+ "images": [
+ "thinknode_m4.svg"
+ ]
+ },
+ {
+ "hwModel": 120,
+ "hwModelSlug": "THINKNODE_M6",
+ "platformioTarget": "thinknode_m6",
+ "architecture": "nrf52840",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "ThinkNode M6",
+ "tags": [
+ "Elecrow"
+ ],
+ "requiresDfu": true,
+ "images": [
+ "thinknode_m6.svg"
+ ]
+ },
+ {
+ "hwModel": 122,
+ "hwModelSlug": "TBEAM_1_WATT",
+ "platformioTarget": "t-beam-1w",
+ "architecture": "esp32-s3",
+ "activelySupported": true,
+ "supportLevel": 1,
+ "displayName": "LilyGo T-Beam 1W",
+ "tags": [
+ "LilyGo"
+ ],
+ "hasMui": false,
+ "partitionScheme": "8MB",
+ "images": [
+ "tbeam-1w.svg"
+ ]
+ },
+ {
+ "hwModel": 123,
+ "hwModelSlug": "T5_S3_EPAPER_PRO",
+ "platformioTarget": "t5-epaper-s3",
+ "architecture": "esp32-s3",
+ "activelySupported": false,
+ "supportLevel": 1,
+ "displayName": "LilyGo T5 E-paper S3 Pro",
+ "tags": [
+ "LilyGo"
+ ],
+ "hasMui": false,
+ "partitionScheme": "8MB",
+ "images": [
+ "t5s3_epaper.svg"
+ ]
+ },
+ {
+ "hwModel": 125,
+ "hwModelSlug": "MINI_EPAPER_S3",
+ "platformioTarget": "mini-epaper-s3",
+ "architecture": "esp32-s3",
+ "activelySupported": false,
+ "supportLevel": 1,
+ "displayName": "LilyGo Mini E-paper S3",
+ "tags": [
+ "LilyGo"
+ ],
+ "hasMui": false,
+ "images": [
+ "mini-epaper-s3.svg"
+ ]
+ }
+]
\ No newline at end of file
diff --git a/app/src/main/assets/firmware b/app/src/main/assets/firmware
deleted file mode 120000
index e52f5091a..000000000
--- a/app/src/main/assets/firmware
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../meshtastic-esp32/release/latest/forandroid
\ No newline at end of file
diff --git a/app/src/main/assets/firmware_releases.json b/app/src/main/assets/firmware_releases.json
new file mode 100644
index 000000000..ffdb465d6
--- /dev/null
+++ b/app/src/main/assets/firmware_releases.json
@@ -0,0 +1,191 @@
+{
+ "releases": {
+ "stable": [
+ {
+ "id": "v2.7.15.567b8ea",
+ "title": "Meshtastic Firmware 2.7.15.567b8ea Beta",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.7.15.567b8ea",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.7.15.567b8ea/firmware-esp32-2.7.15.567b8ea.zip",
+ "release_notes": "> [!WARNING]\r\n> If you experience immediate bluetooth pairing failures or failure to fully boot after updating, this likely indicates that you need to perform a full erase and flash. Consider backing up your settings before updating.\r\n\r\n> [!IMPORTANT]\r\n> This release marks the end of legacy (non-private) DMs. Direct messages will only be allowed using PKI going forward.\r\n> This release also disables device telemetry broadcasts over the mesh by default. If you want to opt back in, you will need to re-enable this in the apps. \r\n\r\n## 🚀 What's Changed\r\n* Clean up GPS toggle logging by @jp-bennett in https://github.com/meshtastic/firmware/pull/8629\r\n* Reset the calibration data back to 0 when doing a compass calibration by @jp-bennett in https://github.com/meshtastic/firmware/pull/8648\r\n* Chore(deps): update dorny/test-reporter action to v2.2.0 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8637\r\n* Fix RPM builds by @vidplace7 in https://github.com/meshtastic/firmware/pull/8659\r\n* Linux: Fix silly EPEL9 mistake by @vidplace7 in https://github.com/meshtastic/firmware/pull/8660\r\n* Fix ble rssi crash by @thebentern in https://github.com/meshtastic/firmware/pull/8661\r\n* Mqtt: do not try to send packets when it disconnected by @omgbebebe in https://github.com/meshtastic/firmware/pull/8658\r\n* Persist favourites on NodeDB reset by @ford-jones in https://github.com/meshtastic/firmware/pull/8292\r\n* Don't ack messages when mqtt client proxy is on but only uplink by @RCGV1 in https://github.com/meshtastic/firmware/pull/8578\r\n* Add API types, state, and log message in Debug screen. Added persistent \"Connected\" icon by @jp-bennett in https://github.com/meshtastic/firmware/pull/8576\r\n* Drop PKI acks if there is no downlink on MQTTClientProxy by @RCGV1 in https://github.com/meshtastic/firmware/pull/8580\r\n* Add the Heltec v4 expansion box. by @Quency-D in https://github.com/meshtastic/firmware/pull/8539\r\n* Update to Pro-micro variants by @NomDeTom in https://github.com/meshtastic/firmware/pull/8600\r\n* Cleanup unnecessary global dereferencing in CryptoEngine by @jasonbcox in https://github.com/meshtastic/firmware/pull/8611\r\n* Fix null pointer dereference in radio chip region check by @Andrik45719 in https://github.com/meshtastic/firmware/pull/8613\r\n* Feat/6704 neighbor info on demand by @DaneEvans in https://github.com/meshtastic/firmware/pull/8523\r\n* Remove fixed scaling in Digital Clock by @Xaositek in https://github.com/meshtastic/firmware/pull/8620\r\n* Allow Preserving Favorites in BaseUI menus by @Xaositek in https://github.com/meshtastic/firmware/pull/8647\r\n* native: Try to look for a config file based on Raspberry Pi HAT vendor by @Stary2001 in https://github.com/meshtastic/firmware/pull/8608\r\n* Remove gating for Display Options by @Xaositek in https://github.com/meshtastic/firmware/pull/8651\r\n* mqtt: do not try to send packets when it disconnected by @omgbebebe in https://github.com/meshtastic/firmware/pull/8658\r\n\r\n## New Contributors\r\n* @weebl2000 made their first contribution in https://github.com/meshtastic/firmware/pull/8560\r\n* @omgbebebe made their first contribution in https://github.com/meshtastic/firmware/pull/8658\r\n* @viric made their first contribution in https://github.com/meshtastic/firmware/pull/7882\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.7.13.597fa0b...v2.7.15.567b8ea"
+ },
+ {
+ "id": "v2.6.11.60ec05e",
+ "title": "Meshtastic Firmware 2.6.11.60ec05e Beta",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.6.11.60ec05e",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.6.11.60ec05e/firmware-esp32-2.6.11.60ec05e.zip",
+ "release_notes": "> [!CAUTION] \r\n> In older firmware, generated public/private keys may have insufficient entropy, resulting in the possibility of key reuse across devices. This release delays key generation until the user sets a LoRa region, and also mixes in additional sources of randomness. Additionally, if one of the known key collisions are detected, the user is notified, and should regenerate keys as soon as possible.\r\n\r\n## 🚀 Enhancements\r\n* Add --1200bps-reset param to device-install/update scripts by @ThatKalle in https://github.com/meshtastic/firmware/pull/6752\r\n* Generate keys when Lora Region is set by @jp-bennett in https://github.com/meshtastic/firmware/pull/6951\r\n* Seeed_xiao_nrf52840_kit improvements by @ndoo in https://github.com/meshtastic/firmware/pull/6930\r\n* Add InkHUD driver for WeAct Studio 2.9\" display module by @todd-herbert in https://github.com/meshtastic/firmware/pull/6963\r\n* [Variant] nomadstar meteor pro by @CypressXt in https://github.com/meshtastic/firmware/pull/6742\r\n\r\n## 🐛 Bug fixes and maintenance\r\n* fix: Respect LED_STATE_ON for power and user LED by @ndoo in https://github.com/meshtastic/firmware/pull/6976\r\n* Chore(deps): update platformio/espressif32 to v6.11.0 by @renovate in https://github.com/meshtastic/firmware/pull/6900\r\n* Update Alpine to 3.22 by @vidplace7 in https://github.com/meshtastic/firmware/pull/6927\r\n* Clean up install & update shell scripts by @roens in https://github.com/meshtastic/firmware/pull/6839\r\n* Addition of Device Role inside of userPrefs.jsonc by @Crank-Git in https://github.com/meshtastic/firmware/pull/6972\r\n* Chore(deps): update platformio/ststm32 to v19.2.0 by @renovate in https://github.com/meshtastic/firmware/pull/6901\r\n* Chore(deps): update meshtastic/device-ui digest to 2fd19f8 by @renovate in https://github.com/meshtastic/firmware/pull/6982\r\n* Add note to hydra to note that the button pin has no pull-up by @NomDeTom in https://github.com/meshtastic/firmware/pull/6979\r\n* Chore(deps): update meshtastic/device-ui digest to 1b520fc by @renovate in https://github.com/meshtastic/firmware/pull/6991\r\n* Update heltec t114 URL by @dieseltravis in https://github.com/meshtastic/firmware/pull/7004\r\n* Update URL for ThinkNode M1 by @dieseltravis in https://github.com/meshtastic/firmware/pull/7005\r\n* Improve support for Heltec Wireless Bridge by @berlincount in https://github.com/meshtastic/firmware/pull/6647\r\n* Warn users about low entropy keys by @jp-bennett in https://github.com/meshtastic/firmware/pull/7003\r\n* T-watch screen misalignment fix by @HarukiToreda in https://github.com/meshtastic/firmware/pull/6996\r\n* Fix for T-Deck Plus: disable touch IRQ / enable custom touch driver by @mverch67 in https://github.com/meshtastic/firmware/pull/6988\r\n* Create lora-piggystick-lr1121.yaml by @markbirss in https://github.com/meshtastic/firmware/pull/7010\r\n\r\n## New Contributors\r\n* @roens made their first contribution in https://github.com/meshtastic/firmware/pull/6839\r\n* @Crank-Git made their first contribution in https://github.com/meshtastic/firmware/pull/6972\r\n* @dieseltravis made their first contribution in https://github.com/meshtastic/firmware/pull/7004\r\n* @berlincount made their first contribution in https://github.com/meshtastic/firmware/pull/6647\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.6.10.9ce4455...v2.6.11.60ec05e"
+ },
+ {
+ "id": "v2.6.10.9ce4455",
+ "title": "Meshtastic Firmware 2.6.10.9ce4455 Beta",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.6.10.9ce4455",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.6.10.9ce4455/firmware-esp32-2.6.10.9ce4455.zip",
+ "release_notes": "## 🚀 Enhancements\r\n* Don't cancel sending ReTx for relayer if we're ROUTER(_LATE)/REPEATER by @GUVWAF in https://github.com/meshtastic/firmware/pull/6904\r\n* Add LINK32 (Lilygo) Board with Light+Environment sensors by @caveman99 in https://github.com/meshtastic/firmware/pull/6899\r\n* Add support for seeed wio tracker L1 by @Dylanliacc in https://github.com/meshtastic/firmware/pull/6907\r\n* Added full support for LTR390UV readings of UV and Lux by @dmarman in https://github.com/meshtastic/firmware/pull/6872\r\n\r\n## 🐛 Bug fixes and maintenance\r\n* Linux: Adjust udev rules for gpio by @vidplace7 in https://github.com/meshtastic/firmware/pull/6891\r\n* Coerce user.id to always be derive from the nodenum by @thebentern in https://github.com/meshtastic/firmware/pull/6906\r\n* Parse own short name on InkHUD shutdown screen by @todd-herbert in https://github.com/meshtastic/firmware/pull/6913\r\n* Don't cancel sending ReTx for relayer if we're ROUTER(_LATE)/REPEATER by @GUVWAF in https://github.com/meshtastic/firmware/pull/6904\r\n* Fix renovate for Adafruit PCT2075 by @vidplace7 in https://github.com/meshtastic/firmware/pull/6919\r\n* Update TSL2591 gain and timing by @ArgoNavi in https://github.com/meshtastic/firmware/pull/6921\r\n\r\n## New Contributors\r\n* @dmarman made their first contribution in https://github.com/meshtastic/firmware/pull/6872\r\n* @ArgoNavi made their first contribution in https://github.com/meshtastic/firmware/pull/6921\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.6.9.f223b8a...v2.6.10.9ce4455"
+ }
+ ],
+ "alpha": [
+ {
+ "id": "v2.7.22.96dd647",
+ "title": "Meshtastic Firmware 2.7.22.96dd647 Alpha",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.7.22.96dd647",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.7.22.96dd647/firmware-2.7.22.96dd647.json",
+ "release_notes": "## 🐛 Bug fixes and maintenance\r\n\r\n- Fix(native): implement BinarySemaphorePosix with proper pthread synchronization by @iannucci in https://github.com/meshtastic/firmware/pull/9895\r\n- Meshtasticd: Add configs for ebyte-ecb41-pge (mPWRD-OS) by @vidplace7 in https://github.com/meshtastic/firmware/pull/10086\r\n- Meshtasticd: Add configs for forlinx-ok3506-s12 (mPWRD-OS) by @vidplace7 in https://github.com/meshtastic/firmware/pull/10087\r\n- Fix Linux Input enable logic by @jp-bennett in https://github.com/meshtastic/firmware/pull/10093\r\n- PPA: Use SFTP method for uploads by @vidplace7 in https://github.com/meshtastic/firmware/pull/10138\r\n- Switch PlatformIO deps from PIO Registry to tagged GitHub zips by @vidplace7 in https://github.com/meshtastic/firmware/pull/10142\r\n- Fix display method to use const qualifier for previousBuffer pointer by @vidplace7 in https://github.com/meshtastic/firmware/pull/10146\r\n- Fix last cppcheck issue by @caveman99 in https://github.com/meshtastic/firmware/pull/10154\r\n- Fix heap blowout on TBeams by @thebentern in https://github.com/meshtastic/firmware/pull/10155\r\n\r\n## ⚙️ Dependencies\r\n\r\n- Update meshtastic-esp32_https_server digest to 0c71f38 by @app/renovate in https://github.com/meshtastic/firmware/pull/10081\r\n- Update meshtastic-st7789 digest to 222554e by @app/renovate in https://github.com/meshtastic/firmware/pull/10121\r\n- Update actions/github-script action to v9 by @app/renovate in https://github.com/meshtastic/firmware/pull/10122\r\n- Update meshtastic-st7789 digest to 7228c49 by @app/renovate in https://github.com/meshtastic/firmware/pull/10131\r\n- Update pnpm/action-setup action to v6 by @app/renovate in https://github.com/meshtastic/firmware/pull/10132\r\n- Update meshtastic-st7789 digest to 4d957e7 by @app/renovate in https://github.com/meshtastic/firmware/pull/10134\r\n- Update meshtastic-st7789 digest to a787bee by @app/renovate in https://github.com/meshtastic/firmware/pull/10147\r\n- Update softprops/action-gh-release action to v3 by @app/renovate in https://github.com/meshtastic/firmware/pull/10150\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.7.21.1370b23...v2.7.22.96dd647"
+ },
+ {
+ "id": "v2.7.21.1370b23",
+ "title": "Meshtastic Firmware 2.7.21.1370b23 Alpha",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.7.21.1370b23",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.7.21.1370b23/firmware-2.7.21.1370b23.json",
+ "release_notes": "> [!WARNING]\r\n> Due to resource constraints, the HTTP server is deprecated on original-generation ESP32 devices and should not be relied on going forward. \r\n> Support continues on ESP32-S3 and other newer ESP32 generations.\r\n\r\n## 🚀 Enhancements\r\n\r\n- Add T5-4.7-S3 Epaper Pro support. #6625\r\n- Apply Thailand NBTC 920-925 MHz limits (27 dBm, 10% duty cycle). #9827\r\n- Switch nRF52840 builds to C++17. #9874\r\n- Clean up SEN5X warnings. #9884\r\n- Refactor BaseUI emotes. #9896\r\n- Add spoof detection in `UdpMulticastHandler`. #9905\r\n- Enable LNA by default on Heltec v4.3. #9906\r\n- Rotate MUI for the Heltec V4 + TFT expansion kit. #9938\r\n- Make `hexDump()` take a `const` buffer. #9944\r\n- Add `meshtasticd` config metadata. #10001\r\n- Add `MESHTASTIC_EXCLUDE_ACCELEROMETER`. #10004\r\n- Adapt MUI WiFi map tile downloads for Heltec V4. #10011\r\n- Fix Mesh-tab WiFi map and exclude-screen behavior. #10038\r\n- Include Thinknode M5 minor fixes. #10049\r\n\r\n## 🐛 Bug fixes and maintenance\r\n\r\n- Remove GPS baudrate locking on the Seeed Xiao S3 kit. #9374\r\n- Fix RAK4631 Ethernet gateway API connection loss after W5100S brownouts. #9754\r\n- Fix W5100S socket exhaustion blocking MQTT and additional TCP clients. #9770\r\n- Fix traceroute over MQTT when the uplink node is encrypted. #9798\r\n- Extend Debian sourcedeb cache expiration. #9858\r\n- Fix T-LoRA Pager SPI bus sharing between SX1262 and the SD card. #9870\r\n- Update `ESP8266Audio` to the Meshtastic fork for compatibility. #9872\r\n- Fix `rak_wismeshtag` low-voltage reboot hangs after app configuration. #9897\r\n- Preserve `pki_encrypted` and `public_key` when relaying UDP multicast packets to radio. #9916\r\n- Add the new RAK 13302 power curve. #9929\r\n- Fix MQTT settings not persisting when the broker is unreachable. #9934\r\n- Fix BMP detection by not returning early during BME address scans. #9935\r\n- Enforce infrastructure-role minimums even when scaling is disabled. #9937\r\n- Fix traceroute hop rendering for `ffff` / unknown-dB hops. #9945\r\n- Fix NodeInfo suppression so it only applies to external requests. #9947\r\n- Enable touch-to-backlight on T-Echo, not just T-Echo Plus. #9953\r\n- Prevent licensed users from rebroadcasting packets to or from unlicensed users. #9958\r\n- Add the `heltec_mesh_node_t096` board. #9960\r\n- Add Cardputer-Adv I2S audio support. #9963\r\n- Fix the Cyrillic OLED double-space issue. #9971\r\n- Add `LED_BUILTIN` for `tlora_v1`. #9973\r\n- Add a timeout for PPA uploads. #9989\r\n- Exclude the web server, Paxcounter, and a few other components on original ESP32 boards to avoid IRAM overflow. #10005\r\n- Rework External Notifications logic. #10006\r\n- Improve STM32WL support. #10015\r\n- Configure NFC pins as GPIO for older bootloaders. #10016\r\n- Fix `TransmitHistory` epoch handling. #10017\r\n- Inherit `build_unflags` for `wio-sdk-wm1110`. #10034\r\n- Remove PSRAM from `tbeam` boards to reclaim IRAM. #10036\r\n- Move `t5s3_epaper_inkhud` to `extra`. #10037\r\n\r\n## ⚙️ Dependencies\r\n\r\n- Update `meshtastic-esp32_https_server` to digest `b78f12c`. #9851\r\n- Update `meshtastic/device-ui` through digests `622b034`, `f36d2a9`, `7b1485b`, and `1897dd1`. #9864 #9940 #10023 #10044 #10050\r\n- Update `GxEPD2` to `v1.6.8`. #9918\r\n- Update `pnpm/action-setup` to `v5`. #9926\r\n- Update `dorny/test-reporter` to `v3`. #9981\r\n- Clean up LewisHe library references and dependency matching, and tighten Renovate scheduling. #10007 #10008 #10039\r\n- Update `Adafruit_BME680` to `v2.0.6`. #10009\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.7.20.6658ec2...v2.7.21.1370b23\r\n"
+ },
+ {
+ "id": "v2.7.20.6658ec2",
+ "title": "Meshtastic Firmware 2.7.20.6658ec2 Alpha",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.7.20.6658ec2",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.7.20.6658ec2/firmware-2.7.20.6658ec2.json",
+ "release_notes": "## 🚀 Enhancements\r\n\r\n- Xiao NRF - define suitable i2c pins for the sub-variants by @NomDeTom in https://github.com/meshtastic/firmware/pull/8866\r\n- Fix(MQTT): Send first MapReport as soon as possible by @ndoo in https://github.com/meshtastic/firmware/pull/8872\r\n- Feat/add sfa30 by @oscgonfer in https://github.com/meshtastic/firmware/pull/9372\r\n- Improved Periodic class by @harry-iii-lord in https://github.com/meshtastic/firmware/pull/9501\r\n- InkHUD: Allow non-system applets to subscribe to input events by @Vortetty in https://github.com/meshtastic/firmware/pull/9514\r\n- Cardputer Kit by @caveman99 in https://github.com/meshtastic/firmware/pull/9540\r\n- Skip header items when enabling the InkHUD menu cursor by @zeropt in https://github.com/meshtastic/firmware/pull/9552\r\n- ExternalNotification and StatusLED now call AmbientLighting to update… by @jp-bennett in https://github.com/meshtastic/firmware/pull/9554\r\n- BaseUI: Favorite Screen Signal Quality improvement by @HarukiToreda in https://github.com/meshtastic/firmware/pull/9566\r\n- Add battery curve for T-Beam 1 watt by @jp-bennett in https://github.com/meshtastic/firmware/pull/9585\r\n- Add sdl libs for native builds by @jp-bennett in https://github.com/meshtastic/firmware/pull/9595\r\n- Log `rxBad` PacketHeaders with more info (`id`, `relay_node`) like `printPacket` by @compumike in https://github.com/meshtastic/firmware/pull/9614\r\n- Develop to master by @thebentern in https://github.com/meshtastic/firmware/pull/9618\r\n- Fix a lot of low level cppcheck warnings by @caveman99 in https://github.com/meshtastic/firmware/pull/9623\r\n- Convert `GPS*` global and some new in gps.cpp to `unique_ptr` by @Jorropo in https://github.com/meshtastic/firmware/pull/9628\r\n- Replace delete in RedirectablePrint.cpp with std::unique_ptr by @Jorropo in https://github.com/meshtastic/firmware/pull/9642\r\n- Replace delete in EInkDynamicDisplay.{cpp,h} with std::unique_ptr by @Jorropo in https://github.com/meshtastic/firmware/pull/9643\r\n- Replace delete in RadioInterface.cpp with std::unique_ptr by @Jorropo in https://github.com/meshtastic/firmware/pull/9645\r\n- Replace delete in CryptoEngine.{cpp,h} with std::unique_ptr by @Jorropo in https://github.com/meshtastic/firmware/pull/9649\r\n- Replace delete in AudioThread.h with std::unique_ptr by @Jorropo in https://github.com/meshtastic/firmware/pull/9651\r\n- Scaling tweaks by @NomDeTom in https://github.com/meshtastic/firmware/pull/9653\r\n- InkHUD: Favorite Map Applet by @HarukiToreda in https://github.com/meshtastic/firmware/pull/9654\r\n- Fake IAQ values on Non-BSEC2 platforms like Platformio and the original ESP32 by @caveman99 in https://github.com/meshtastic/firmware/pull/9663\r\n- #9623 resolved a local shadow of next_key by converting it to int. by @caveman99 in https://github.com/meshtastic/firmware/pull/9665\r\n- Zip a few gitrefs down by @caveman99 in https://github.com/meshtastic/firmware/pull/9672\r\n- Limit http connections and add free heap check before allocating for SSL by @thebentern in https://github.com/meshtastic/firmware/pull/9693\r\n- Split module includes for AQ module by @oscgonfer in https://github.com/meshtastic/firmware/pull/9711\r\n- Align telemetry broadcast want_response behavior with traceroute by @thebentern in https://github.com/meshtastic/firmware/pull/9717\r\n- InkHUD: Nodelist cleanup by @HarukiToreda in https://github.com/meshtastic/firmware/pull/9737\r\n- Add GPIO_DETECT_PA portduino config, and support 13302 detection with it by @jp-bennett in https://github.com/meshtastic/firmware/pull/9741\r\n- Remove unused global rIf that shadows locals and fails cppcheck by @weebl2000 in https://github.com/meshtastic/firmware/pull/9743\r\n- Add Transmit history persistence for respecting traffic intervals between reboots by @thebentern in https://github.com/meshtastic/firmware/pull/9748\r\n- Unlock 0x8B5 register macro guard for SX162 by @thebentern in https://github.com/meshtastic/firmware/pull/9777\r\n- Enhancement(mesh): remove late packets from tx queue when full by @m1nl in https://github.com/meshtastic/firmware/pull/9779\r\n- Add json file rotation option by @jp-bennett in https://github.com/meshtastic/firmware/pull/9783\r\n- PPA: Remove Ubuntu 25.04, Add 26.04 by @vidplace7 in https://github.com/meshtastic/firmware/pull/9789\r\n- Deb: Handle offline builds more gracefully by @vidplace7 in https://github.com/meshtastic/firmware/pull/9791\r\n- Remove \"x\" permission bits from some source files by @ldoolitt in https://github.com/meshtastic/firmware/pull/9794\r\n- Add some lora parameter clamping logic to coalesce to defaults and enforce some bounds by @thebentern in https://github.com/meshtastic/firmware/pull/9808\r\n- Add back FEM LNA mode configuration for LoRa by @thebentern in https://github.com/meshtastic/firmware/pull/9809\r\n- More RAK6421 work by @jp-bennett in https://github.com/meshtastic/firmware/pull/9813\r\n- Add ROUTER_LATE and TAK_TRACKER to congestion scaling exemption by @h3lix1 in https://github.com/meshtastic/firmware/pull/9818\r\n- Add ROUTER_LATE to telemetry impolite role check by @h3lix1 in https://github.com/meshtastic/firmware/pull/9819\r\n- Add ROUTER_LATE to infrastructure init and config preservation by @h3lix1 in https://github.com/meshtastic/firmware/pull/9820\r\n- Update Heltec Tracker v2 to version KCT8103L. by @Quency-D in https://github.com/meshtastic/firmware/pull/9822\r\n- Add APIPort to native config by @pdxlocations in https://github.com/meshtastic/firmware/pull/9840\r\n\r\n## 🐛 Bug fixes and maintenance\r\n\r\n- Add agc reset attempt by @jp-bennett in https://github.com/meshtastic/firmware/pull/8163\r\n- Support mini ePaper S3 Kit by @mverch67 in https://github.com/meshtastic/firmware/pull/9335\r\n- Fix heltec v4 tft dependency by @Quency-D in https://github.com/meshtastic/firmware/pull/9507\r\n- Apply SX1262 register 0x8B5 patch for improved GC1109 RX sensitivity by @weebl2000 in https://github.com/meshtastic/firmware/pull/9571\r\n- Hold GC1109 FEM power during deep sleep for LNA RX wake by @weebl2000 in https://github.com/meshtastic/firmware/pull/9572\r\n- Fix some random compiler warnings by @caveman99 in https://github.com/meshtastic/firmware/pull/9596\r\n- Add missing openocd_target to custom nrf52 boards by @Stary2001 in https://github.com/meshtastic/firmware/pull/9603\r\n- Fixes on SCD4X admin comands by @oscgonfer in https://github.com/meshtastic/firmware/pull/9607\r\n- Feat/add scd30 by @oscgonfer in https://github.com/meshtastic/firmware/pull/9609\r\n- Zero entire public key array instead of only first byte by @weebl2000 in https://github.com/meshtastic/firmware/pull/9619\r\n- Respect DontMqttMeBro flag regardless of channel PSK by @weebl2000 in https://github.com/meshtastic/firmware/pull/9626\r\n- Undefine LED_BUILTIN for Heltec v2 variant by @ericbarch in https://github.com/meshtastic/firmware/pull/9647\r\n- Fix typo in PIN_GPS_SWITCH by @Jorropo in https://github.com/meshtastic/firmware/pull/9648\r\n- Workaround NCP5623 and LP5562 I2C builds by @Jorropo in https://github.com/meshtastic/firmware/pull/9652\r\n- RadioLib edge-triggered interrupts robustness by @compumike in https://github.com/meshtastic/firmware/pull/9658\r\n- Add USB_MODE=1 for Station G2 - Solving all my serial issues. by @h3lix1 in https://github.com/meshtastic/firmware/pull/9660\r\n- Fix detection of SCD30 by checking if the size of the return from a 2 byte register read is correct by @caveman99 in https://github.com/meshtastic/firmware/pull/9664\r\n- Fix/rak3401 button by @LN4CY in https://github.com/meshtastic/firmware/pull/9668\r\n- Undefine LED_BUILTIN for 9m2ibr_aprs_lora_tracker by @mrekin in https://github.com/meshtastic/firmware/pull/9685\r\n- BLE Pairing fix by @HarukiToreda in https://github.com/meshtastic/firmware/pull/9701\r\n- Implement 'agc' reset for SX126x & LR11x0 chip families by @weebl2000 in https://github.com/meshtastic/firmware/pull/9705\r\n- Add explicit dependency on mklittlefs. by @cpatulea in https://github.com/meshtastic/firmware/pull/9708\r\n- Platform: nrf52: Fix typo in BLEDfuSecure filename by @KokoSoft in https://github.com/meshtastic/firmware/pull/9709\r\n- Meshtasticd: Add Luckfox Lyra Hat pinmaps by @vidplace7 in https://github.com/meshtastic/firmware/pull/9730\r\n- Fix WisMesh Tap V2 env mess by @thebentern in https://github.com/meshtastic/firmware/pull/9734\r\n- Hopefully fix remaining cppcheck issues by @caveman99 in https://github.com/meshtastic/firmware/pull/9745\r\n- Add heltec-v4.3 board by @Quency-D in https://github.com/meshtastic/firmware/pull/9753\r\n- Fix Bluetooth on RAK Ethernet Gateway by removing MESHTASTIC_EXCLUDE_… by @thebentern in https://github.com/meshtastic/firmware/pull/9755\r\n- Increase PSRAM malloc threshold from 256 bytes to 2048 bytes by @thebentern in https://github.com/meshtastic/firmware/pull/9758\r\n- Don't launch canned message when waking screen or silencing notification by @jp-bennett in https://github.com/meshtastic/firmware/pull/9762\r\n- Fix nRF52 AsyncUDP multicast TX/RX race on W5100S by @PhilipLykov in https://github.com/meshtastic/firmware/pull/9765\r\n- Avoid memory leak when possibly malformed packet is received by @m1nl in https://github.com/meshtastic/firmware/pull/9781\r\n- Add ADS1115 ADC to recognition as used on RAK6421 Hat by @caveman99 in https://github.com/meshtastic/firmware/pull/9790\r\n- Improve resource cleanup on connection close (and make server API a unique pointer) by @thebentern in https://github.com/meshtastic/firmware/pull/9799\r\n- Spelling fixes by @ldoolitt in https://github.com/meshtastic/firmware/pull/9801\r\n- Spelling fixes in .md files by @ldoolitt in https://github.com/meshtastic/firmware/pull/9810\r\n- Treat ROUTER_LATE like ROUTER for power management and defaults by @h3lix1 in https://github.com/meshtastic/firmware/pull/9815\r\n- Add ROUTER_LATE use the same rebroadcast rules as ROUTER by @h3lix1 in https://github.com/meshtastic/firmware/pull/9816\r\n- Prevent router-like roles from auto-favoriting DM peers by @h3lix1 in https://github.com/meshtastic/firmware/pull/9821\r\n- Fix(t1000e): reclassify P0.04 as sensor power enable GPIO by @weebl2000 in https://github.com/meshtastic/firmware/pull/9826\r\n- Don't double-blink Thinknode-M1 Power LED while charging by @jp-bennett in https://github.com/meshtastic/firmware/pull/9829\r\n\r\n## ⚙️ Dependencies\r\n\r\n- Update adafruit mpu6050 to v2.2.9 by @app/renovate in https://github.com/meshtastic/firmware/pull/9611\r\n- Update Sensirion Core to v0.7.3 by @app/renovate in https://github.com/meshtastic/firmware/pull/9613\r\n- Update neopixel to v1.15.4 by @app/renovate in https://github.com/meshtastic/firmware/pull/9616\r\n- Update actions/stale action to v10.2.0 by @app/renovate in https://github.com/meshtastic/firmware/pull/9669\r\n- Update meshtastic-GxEPD2 digest to c7eb4c3 by @app/renovate in https://github.com/meshtastic/firmware/pull/9694\r\n- Update radiolib to v7.6.0 by @app/renovate in https://github.com/meshtastic/firmware/pull/9695\r\n- Update sensorlib to v0.3.4 by @app/renovate in https://github.com/meshtastic/firmware/pull/9727\r\n- Update meshtastic-st7789 digest to 9ee76d6 by @app/renovate in https://github.com/meshtastic/firmware/pull/9729\r\n- Update adafruit mlx90614 to v2.1.6 by @app/renovate in https://github.com/meshtastic/firmware/pull/9756\r\n- Update adafruit_tsl2561 to v1.1.3 by @app/renovate in https://github.com/meshtastic/firmware/pull/9757\r\n- Update platformio/espressif32 to v6.13.0 by @app/renovate in https://github.com/meshtastic/firmware/pull/9759\r\n- Update platformio/nordicnrf52 to v10.11.0 by @app/renovate in https://github.com/meshtastic/firmware/pull/9760\r\n- Update adafruit dps310 to v1.1.6 by @app/renovate in https://github.com/meshtastic/firmware/pull/9763\r\n- Update platformio/ststm32 to v19.5.0 by @app/renovate in https://github.com/meshtastic/firmware/pull/9764\r\n- Update adafruit ahtx0 to v2.0.6 by @app/renovate in https://github.com/meshtastic/firmware/pull/9766\r\n- Update github artifact actions (major) by @app/renovate in https://github.com/meshtastic/firmware/pull/9767\r\n- Update crazy-max/ghaction-import-gpg action to v7 by @app/renovate in https://github.com/meshtastic/firmware/pull/9787\r\n- Update arduinojson to v6.21.6 by @app/renovate in https://github.com/meshtastic/firmware/pull/9788\r\n- Update dorny/test-reporter action to v2.6.0 by @app/renovate in https://github.com/meshtastic/firmware/pull/9796\r\n- Update docker/login-action action to v4 by @app/renovate in https://github.com/meshtastic/firmware/pull/9806\r\n- Update docker/setup-qemu-action action to v4 by @app/renovate in https://github.com/meshtastic/firmware/pull/9807\r\n- Update docker/setup-buildx-action action to v4 by @app/renovate in https://github.com/meshtastic/firmware/pull/9824\r\n- Update docker/build-push-action action to v7 by @app/renovate in https://github.com/meshtastic/firmware/pull/9832\r\n- Update docker/metadata-action action to v6 by @app/renovate in https://github.com/meshtastic/firmware/pull/9833\r\n- Update neopixel to v1.15.4 by @app/renovate in https://github.com/meshtastic/firmware/pull/9839\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.7.20.6658ec2...v2.7.20.6658ec2"
+ },
+ {
+ "id": "v2.7.19.bb3d6d5",
+ "title": "Meshtastic Firmware 2.7.19.bb3d6d5 Alpha",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.7.19.bb3d6d5",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.7.19.bb3d6d5/firmware-2.7.19.bb3d6d5.json",
+ "release_notes": "## 🚀 Enhancements\r\n\r\n- Feat/add sen5x by @oscgonfer in https://github.com/meshtastic/firmware/pull/7245\r\n- Add initial Nix shell by @agustinmista in https://github.com/meshtastic/firmware/pull/8530\r\n- InkHUD Menu improvements by @HarukiToreda in https://github.com/meshtastic/firmware/pull/8975\r\n- Cut NRF52 bluetooth power usage by @phaseloop in https://github.com/meshtastic/firmware/pull/8992\r\n- Feat(GPS): Support Softsleep with WAKE-UP pin on PA1010D by @ndoo in https://github.com/meshtastic/firmware/pull/9078\r\n- NRF52 - power management improvements by @phaseloop in https://github.com/meshtastic/firmware/pull/9211\r\n- Change canned message recipient's previous page to send page by @scobert969 in https://github.com/meshtastic/firmware/pull/9227\r\n- Make BLE TX power configurable for nRF52 variants by @teizz in https://github.com/meshtastic/firmware/pull/9232\r\n- Add interrupt for external charge detection by @jp-bennett in https://github.com/meshtastic/firmware/pull/9332\r\n- Add a watchdog module to meshsolar. by @Quency-D in https://github.com/meshtastic/firmware/pull/9337\r\n- Add StatusMessage module and config overrides by @jp-bennett in https://github.com/meshtastic/firmware/pull/9351\r\n- Implement graduated scaling for NodeInfo send timeout based on active mesh size by @thebentern in https://github.com/meshtastic/firmware/pull/9364\r\n- BaseUI: Bubbles for messages by @HarukiToreda in https://github.com/meshtastic/firmware/pull/9365\r\n- Enable long interleaving mode for LR11x0 and SX128x by @Jorropo in https://github.com/meshtastic/firmware/pull/9399\r\n- Add portduino_status, assign hardware device IDs... by @jp-bennett in https://github.com/meshtastic/firmware/pull/9441\r\n- Add support for Hackaday Communicator function keys by @jp-bennett in https://github.com/meshtastic/firmware/pull/9444\r\n- Add on-screen keyboard to InkHUD by @scobert969 in https://github.com/meshtastic/firmware/pull/9445\r\n- Move more code out of main-nrf52 into variant.cpp by @jp-bennett in https://github.com/meshtastic/firmware/pull/9450\r\n- BaseUI Message Bubble Improvements by @Xaositek in https://github.com/meshtastic/firmware/pull/9452\r\n- Support fully direct request/responses by @esev in https://github.com/meshtastic/firmware/pull/9455\r\n- Add reply bot module with DM-only responses and rate limiting by @mattatat25 in https://github.com/meshtastic/firmware/pull/9456\r\n- Add model workflows by @thebentern in https://github.com/meshtastic/firmware/pull/9462\r\n- Add custom ringtone definition for RAK4631 and enable buzzer pin by @thebentern in https://github.com/meshtastic/firmware/pull/9481\r\n- Remove unused hmx variable by @EricSesterhennX41 in https://github.com/meshtastic/firmware/pull/9529\r\n- Make LED_POWER blip even in critical battery by @jp-bennett in https://github.com/meshtastic/firmware/pull/9545\r\n- Added toggable config and default for larger screens to enable / hide bubbles on chat messages by @thebentern in https://github.com/meshtastic/firmware/pull/9560\r\n- Add Slash Key to VirtualKeyboard by @Xaositek in https://github.com/meshtastic/firmware/pull/9563\r\n- Add support for CW2015 LiPo battery fuel gauge by @jp-bennett in https://github.com/meshtastic/firmware/pull/9564\r\n\r\n## 🐛 Bug fixes and maintenance\r\n\r\n- Add agc reset attempt by @jp-bennett in https://github.com/meshtastic/firmware/pull/8163\r\n- Just set LED_BUILTIN universally to -1, as we don't use it. by @jp-bennett in https://github.com/meshtastic/firmware/pull/8830\r\n- Device-install: Consistently use write-flash by @tyll in https://github.com/meshtastic/firmware/pull/8868\r\n- Added Minimesh variant by @uguraltinsoy in https://github.com/meshtastic/firmware/pull/9289\r\n- Fix uMesh RF POWER configuration error by @linser233 in https://github.com/meshtastic/firmware/pull/9326\r\n- Delete unused code by @EricSesterhennX41 in https://github.com/meshtastic/firmware/pull/9350\r\n- Feat(stm32): Add Milesight GS301 Bathroom Odor Detector by @ndoo in https://github.com/meshtastic/firmware/pull/9359\r\n- To fix the gps power rail issue on RAK 19007 when RAK12023+RAK12035 is installed by @Justin-Mann in https://github.com/meshtastic/firmware/pull/9409\r\n- Consolidate LoRa params / preset logic and fix display of preset values by @thebentern in https://github.com/meshtastic/firmware/pull/9413\r\n- Fix logic for rak12035 sensor default config and improve messaging by @Justin-Mann in https://github.com/meshtastic/firmware/pull/9414\r\n- Add pin sense to wake M6 on Solar Charge by @jp-bennett in https://github.com/meshtastic/firmware/pull/9416\r\n- Move Lora Init code into LoraInit.cpp/h by @jp-bennett in https://github.com/meshtastic/firmware/pull/9435\r\n- Replace strcpy with strncpy and null termination in `MQTT::publish` for JSON payloads by @k3an3 in https://github.com/meshtastic/firmware/pull/9436\r\n- Move device code from main.cpp to earlyInitVariant by @jp-bennett in https://github.com/meshtastic/firmware/pull/9438\r\n- Trackball revamp by @jp-bennett in https://github.com/meshtastic/firmware/pull/9440\r\n- Remove the unused OCV_ARRAYs and move one to a variant.h by @jp-bennett in https://github.com/meshtastic/firmware/pull/9442\r\n- Fix StoreForwardModule retry_delay multiplier always evaluating to 2x by @rcd in https://github.com/meshtastic/firmware/pull/9443\r\n- Add error handling for SPI command failures in LR11x0, RF95, and SX128x interfaces by @thebentern in https://github.com/meshtastic/firmware/pull/9447\r\n- Add Thinknode M4 variant_shutdown() by @jp-bennett in https://github.com/meshtastic/firmware/pull/9449\r\n- External Notification - handleReceived Rewrite by @Xaositek in https://github.com/meshtastic/firmware/pull/9454\r\n- Move input init to an init function in InputBroker by @jp-bennett in https://github.com/meshtastic/firmware/pull/9463\r\n- Initial serialModule cleanup by @jp-bennett in https://github.com/meshtastic/firmware/pull/9465\r\n- Avoid short-circuit evaluation issues in Telemetry by @oscgonfer in https://github.com/meshtastic/firmware/pull/9467\r\n- Add support for the hardware buttons on Retia.io's Bluetooth Nugget device by @treysis in https://github.com/meshtastic/firmware/pull/9468\r\n- Remove stale variant.h defines by @jp-bennett in https://github.com/meshtastic/firmware/pull/9470\r\n- More variant.h cleanup. LED_NOTIFICATION, remove dead code, etc by @jp-bennett in https://github.com/meshtastic/firmware/pull/9477\r\n- Refuse to send legacy DMs simply because the remote public key is unknown by @jp-bennett in https://github.com/meshtastic/firmware/pull/9485\r\n- Fix esp32 ota bin name in scripts by @thebentern in https://github.com/meshtastic/firmware/pull/9488\r\n- You get an RTC, and you get an RTC! (delete HAS_RTC as it wasn't actually doing much) by @jp-bennett in https://github.com/meshtastic/firmware/pull/9493\r\n- Don't ever define PIN_LED or BLE_LED_INVERTED by @jp-bennett in https://github.com/meshtastic/firmware/pull/9494\r\n- Missed in reviews - fixing send bubble by @Xaositek in https://github.com/meshtastic/firmware/pull/9505\r\n- Power off control pin on Thinknode m5 during deepsleep and add RTC by @jp-bennett in https://github.com/meshtastic/firmware/pull/9510\r\n- Prefer EXT_PWR_DETECT pin over chargingVolt to detect power unplugged by @jp-bennett in https://github.com/meshtastic/firmware/pull/9511\r\n- Rename LED_PIN to LED_POWER, move handling out of main to dedicated module by @jp-bennett in https://github.com/meshtastic/firmware/pull/9512\r\n- Inkhud battery icon improvements. by @Vortetty in https://github.com/meshtastic/firmware/pull/9513\r\n- Make sure we always return a value in NodeDB::restorePreferences() by @EricSesterhennX41 in https://github.com/meshtastic/firmware/pull/9516\r\n- Fix config.display.use_long_node_name not saving by @Xaositek in https://github.com/meshtastic/firmware/pull/9522\r\n- Implement UDP multicast handler start/stop to ensure proper lifecycle by @thebentern in https://github.com/meshtastic/firmware/pull/9524\r\n- Undefine LED_BUILTIN for `tlora-v2-1-1_6-tcxo` by @mrekin in https://github.com/meshtastic/firmware/pull/9531\r\n- HotFix for ReplyBot (PR #9456) by @Xaositek in https://github.com/meshtastic/firmware/pull/9532\r\n- Fix hop_limit upgrade detection by @rcd in https://github.com/meshtastic/firmware/pull/9550\r\n- Meshtasticd: Fix install on Fedora 43 by @vidplace7 in https://github.com/meshtastic/firmware/pull/9556\r\n- RPM: Include meshtasticd-start.sh by @vidplace7 in https://github.com/meshtastic/firmware/pull/9561\r\n- Fix embedded null byte truncation in ATAK strings by @niccellular in https://github.com/meshtastic/firmware/pull/9570\r\n\r\n## ⚙️ Dependencies\r\n\r\n- Update XPowersLib to v0.3.3 by @app/renovate in https://github.com/meshtastic/firmware/pull/9354\r\n- Update meshtastic/device-ui digest to 613c095 by @app/renovate in https://github.com/meshtastic/firmware/pull/9383\r\n- Update meshtastic-esp32_https_server digest to b0f3960 by @app/renovate in https://github.com/meshtastic/firmware/pull/9393\r\n- Update lewisxhe-SensorLib to v0.3.4 by @app/renovate in https://github.com/meshtastic/firmware/pull/9395\r\n- Update SensorLib to v0.3.4 by @app/renovate in https://github.com/meshtastic/firmware/pull/9396\r\n- Update pschatzmann_arduino-audio-driver to v0.2.1 by @app/renovate in https://github.com/meshtastic/firmware/pull/9398\r\n- Update meshtastic/device-ui digest to 37ad715 by @app/renovate in https://github.com/meshtastic/firmware/pull/9403\r\n- Update LovyanGFX to v1.2.19 by @app/renovate in https://github.com/meshtastic/firmware/pull/9405\r\n- Update GxEPD2 to v1.6.6 by @app/renovate in https://github.com/meshtastic/firmware/pull/9412\r\n- Update meshtastic/device-ui digest to 69739b8 by @app/renovate in https://github.com/meshtastic/firmware/pull/9448\r\n- Update libch341-spi-userspace digest to af9bc27 by @app/renovate in https://github.com/meshtastic/firmware/pull/9472\r\n- Update meshtastic/device-ui digest to 63967a4 by @app/renovate in https://github.com/meshtastic/firmware/pull/9475\r\n- Update Adafruit MPU6050 to v2.2.7 by @app/renovate in https://github.com/meshtastic/firmware/pull/9525\r\n- Update NeoPixel to v1.15.3 by @app/renovate in https://github.com/meshtastic/firmware/pull/9530\r\n- Update meshtastic-esp8266-oled-ssd1306 digest to 21e484f by @app/renovate in https://github.com/meshtastic/firmware/pull/9533\r\n- Update Adafruit MPU6050 to v2.2.8 by @app/renovate in https://github.com/meshtastic/firmware/pull/9534\r\n- Update meshtastic/device-ui digest to 6c75195 by @app/renovate in https://github.com/meshtastic/firmware/pull/9553\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.7.18.fb3bf78...v2.7.19.bb3d6d5"
+ },
+ {
+ "id": "v2.7.18.fb3bf78",
+ "title": "Meshtastic Firmware 2.7.18.fb3bf78 Alpha",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.7.18.fb3bf78",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.7.18.fb3bf78/firmware-2.7.18.fb3bf78.json",
+ "release_notes": "## 🚀 Enhancements\r\n\r\n- Move PMSA003I to separate class and update AQ telemetry by @oscgonfer in https://github.com/meshtastic/firmware/pull/7190\r\n- Multi message storage by @HarukiToreda in https://github.com/meshtastic/firmware/pull/8182\r\n- Add support for setting API port from the config file by @tedwardd in https://github.com/meshtastic/firmware/pull/8435\r\n- PIN_PWR_DELAY_MS --> PERIPHERAL_WARMUP_MS by @fifieldt in https://github.com/meshtastic/firmware/pull/8467\r\n- CLIENT_BASE: Act like ROUTER_LATE for fav'd nodes, instead of like ROUTER by @korbinianbauer in https://github.com/meshtastic/firmware/pull/8567\r\n- Rak3112 support by @ford-jones in https://github.com/meshtastic/firmware/pull/8591\r\n- Add systemd wrapper by @tedwardd in https://github.com/meshtastic/firmware/pull/8676\r\n- Adding support for InkHUD joystick navigation for the Seeed Wio Tracker L1 E-ink by @zeropt in https://github.com/meshtastic/firmware/pull/8678\r\n- Gr language specific font by @apo-mak in https://github.com/meshtastic/firmware/pull/8808\r\n- Detect if NTP is active on native by @jp-bennett in https://github.com/meshtastic/firmware/pull/8962\r\n- Add Rebooting to DFU mode notification as a simple pop-up by @Xaositek in https://github.com/meshtastic/firmware/pull/8970\r\n- PIO: Fix ESP32 sub-variant inheritance by @vidplace7 in https://github.com/meshtastic/firmware/pull/8983\r\n- Prep work for better Store and Forward by @jp-bennett in https://github.com/meshtastic/firmware/pull/8999\r\n- Additional Emoji by @Ixitxachitl in https://github.com/meshtastic/firmware/pull/9020\r\n- Add Russell, an STM32WL balloon-optimized node by @ndoo in https://github.com/meshtastic/firmware/pull/9079\r\n- Add menus for Smart Position, Broadcast Interval and Position Interval by @Xaositek in https://github.com/meshtastic/firmware/pull/9080\r\n- Improve sanitizeString function for Node Names by @Xaositek in https://github.com/meshtastic/firmware/pull/9086\r\n- Add Temporary Mute to Home frame and unbury Notification Options by @Xaositek in https://github.com/meshtastic/firmware/pull/9097\r\n- Add a welcome message for new contributors by @fifieldt in https://github.com/meshtastic/firmware/pull/9119\r\n- Calculate hops correctly even when hop_start==0 by @esev in https://github.com/meshtastic/firmware/pull/9120\r\n- Add STORE_FORWARD_PLUSPLUS_APP to core portnum checks by @jp-bennett in https://github.com/meshtastic/firmware/pull/9127\r\n- Faster rotary encoder events by @brad112358 in https://github.com/meshtastic/firmware/pull/9146\r\n- Add support for LilyGo T-Echo Plus by @thebentern in https://github.com/meshtastic/firmware/pull/9149\r\n- Refactored some of the system menus to the new DRY method (Redux) by @Xaositek in https://github.com/meshtastic/firmware/pull/9152\r\n- Add a .clang-format file by @Jorropo in https://github.com/meshtastic/firmware/pull/9154\r\n- Add custom coding rate configuration for LoRa by @jp-bennett in https://github.com/meshtastic/firmware/pull/9155\r\n- Add list of text message packet IDs, and check for dupes by @jp-bennett in https://github.com/meshtastic/firmware/pull/9180\r\n- Add option to Mute/Unmute Channel to BaseUI by @Xaositek in https://github.com/meshtastic/firmware/pull/9194\r\n- Mute: Nodes by @ford-jones in https://github.com/meshtastic/firmware/pull/9209\r\n- Screenless Devices want to mute too! by @Xaositek in https://github.com/meshtastic/firmware/pull/9210\r\n- Migrate all of the Meshtastic API attributes into the ini as a source of truth by @thebentern in https://github.com/meshtastic/firmware/pull/9214\r\n- Pioarduino preparation by @MartinEmrich in https://github.com/meshtastic/firmware/pull/9223\r\n- Meshtastic unified OTA by @thebentern in https://github.com/meshtastic/firmware/pull/9231\r\n- Fix TFT_MESH settings across setting and recalling by @Xaositek in https://github.com/meshtastic/firmware/pull/9234\r\n- Add release notes generation and publishing workflow by @thebentern in https://github.com/meshtastic/firmware/pull/9255\r\n- Unified ESP32 OTA firmware by @vidplace7 in https://github.com/meshtastic/firmware/pull/9258\r\n- Add support for uMesh Modules by @linser233 in https://github.com/meshtastic/firmware/pull/9259\r\n- Extra pins by @jp-bennett in https://github.com/meshtastic/firmware/pull/9260\r\n- BaseUI: Autosave Messages by @HarukiToreda in https://github.com/meshtastic/firmware/pull/9269\r\n- Node Actions Menu Overhaul by @Xaositek in https://github.com/meshtastic/firmware/pull/9287\r\n- Added I2C scanner a check for the QMC6310N. by @lewisxhe in https://github.com/meshtastic/firmware/pull/9305\r\n- Allow ICM20948 IMU to sleep by @HarukiToreda in https://github.com/meshtastic/firmware/pull/9324\r\n- Meshtastic OTA (moar) by @thebentern in https://github.com/meshtastic/firmware/pull/9327\r\n- Add sqlite depdendency (Cherry-picks from sfpp) by @fifieldt in https://github.com/meshtastic/firmware/pull/9328\r\n- Add interrupt for external charge detection by @jp-bennett in https://github.com/meshtastic/firmware/pull/9332\r\n- Improve BaseUI Preset Change Flow by @Xaositek in https://github.com/meshtastic/firmware/pull/9343\r\n- Implement graduated scaling for NodeInfo send timeout based on active mesh size by @thebentern in https://github.com/meshtastic/firmware/pull/9364\r\n\r\n## 🐛 Bug fixes and maintenance\r\n\r\n- RTC: PCF85063 support, port to SensorLib 0.3.1 by @WillyJL in https://github.com/meshtastic/firmware/pull/8061\r\n- Added tcxo definition to mesh-tab by @valzzu in https://github.com/meshtastic/firmware/pull/8604\r\n- Preliminary Thinknode M4 Support by @caveman99 in https://github.com/meshtastic/firmware/pull/8754\r\n- Actions: Compact manifest job output summary by @vidplace7 in https://github.com/meshtastic/firmware/pull/8957\r\n- PlatformIO: Restructure networking_base for re-use by @vidplace7 in https://github.com/meshtastic/firmware/pull/8964\r\n- Add LilyGO T-Beam 1W support by @santosvivos in https://github.com/meshtastic/firmware/pull/8967\r\n- PIO: Remove useless inheritence (references extends env) by @vidplace7 in https://github.com/meshtastic/firmware/pull/8987\r\n- Macro guard heap_caps_malloc_extmem_enable from SENSECAP_INDICATOR by @Xaositek in https://github.com/meshtastic/firmware/pull/9007\r\n- Add Rak 6421 autoconf by @jp-bennett in https://github.com/meshtastic/firmware/pull/9010\r\n- Implement basic github action comment reporting target diffs by @Jorropo in https://github.com/meshtastic/firmware/pull/9022\r\n- In protobuf update, allow develop branch to auto-update by @jp-bennett in https://github.com/meshtastic/firmware/pull/9027\r\n- 🔧 Fix LNA/PA power control for Heltec v4, wireless tracker v2 by @weebl2000 in https://github.com/meshtastic/firmware/pull/9029\r\n- Shame do not complain about missing targets by @Jorropo in https://github.com/meshtastic/firmware/pull/9032\r\n- Action: skip trying to comment binary size change results if it is not a PR by @Jorropo in https://github.com/meshtastic/firmware/pull/9033\r\n- Fix gps pin defs for various NRF variants. by @NomDeTom in https://github.com/meshtastic/firmware/pull/9034\r\n- Fix Rotary enc long press by @brad112358 in https://github.com/meshtastic/firmware/pull/9039\r\n- Add needed support bits for the Meshstick by @jp-bennett in https://github.com/meshtastic/firmware/pull/9042\r\n- In statusLEDModule, also detect isCharging by @jp-bennett in https://github.com/meshtastic/firmware/pull/9050\r\n- PlatformIO: Re-Org ESP32 family shared props by @vidplace7 in https://github.com/meshtastic/firmware/pull/9060\r\n- Cleanup: Remove icarus custom framework-arduinoespressif32 by @vidplace7 in https://github.com/meshtastic/firmware/pull/9064\r\n- M6 shutdown and LEDs work by @jp-bennett in https://github.com/meshtastic/firmware/pull/9065\r\n- Implement HAS_PHYSICAL_KEYBOARD for devices with physical keyboards by @Xaositek in https://github.com/meshtastic/firmware/pull/9071\r\n- KZ_863 is not wide lora by @fifieldt in https://github.com/meshtastic/firmware/pull/9075\r\n- In autoconf, don't probe Wire unless i2c device is set by @jp-bennett in https://github.com/meshtastic/firmware/pull/9081\r\n- Correctly set type for event_mode max() position threshold by @vidplace7 in https://github.com/meshtastic/firmware/pull/9083\r\n- Fix PR#8061 SensorLib nRF ThinkNode M-series by @vidplace7 in https://github.com/meshtastic/firmware/pull/9084\r\n- Pioarduino .gitignore by @vidplace7 in https://github.com/meshtastic/firmware/pull/9085\r\n- Pass GH_TOKEN to shame's gh run download step by @Jorropo in https://github.com/meshtastic/firmware/pull/9087\r\n- GPS Menu Validation Fix - Missed in Reviews by @Xaositek in https://github.com/meshtastic/firmware/pull/9093\r\n- Noop \"download\" portion of #shame by @vidplace7 in https://github.com/meshtastic/firmware/pull/9114\r\n- Syntax fix for first timer welcome bot. by @fifieldt in https://github.com/meshtastic/firmware/pull/9144\r\n- Fix link formatting in welcome message by @fifieldt in https://github.com/meshtastic/firmware/pull/9163\r\n- Fixed shouldFilterReceived function to check prev relay according to the function definition by @strngr in https://github.com/meshtastic/firmware/pull/9168\r\n- Add EByte EoRa-Hub by @vidplace7 in https://github.com/meshtastic/firmware/pull/9169\r\n- Fix zero in sp02 and Heart Rate on screen by @sergeygalkin in https://github.com/meshtastic/firmware/pull/9174\r\n- RadioInterface::getRetransmissionMsec now handles encrypted packets c… by @rbreesems in https://github.com/meshtastic/firmware/pull/9184\r\n- Added support for the new SSD1306 control panel. by @lewisxhe in https://github.com/meshtastic/firmware/pull/9192\r\n- Fix Function + M in code by @Xaositek in https://github.com/meshtastic/firmware/pull/9200\r\n- Fix TSL2591 detection by adding command bit to register read by @heathdutton in https://github.com/meshtastic/firmware/pull/9215\r\n- Fix screen not sleeping due to power status updates by @heathdutton in https://github.com/meshtastic/firmware/pull/9216\r\n- Fix rotary regression and tighten up playBeep by @thebentern in https://github.com/meshtastic/firmware/pull/9221\r\n- Use correct name for ALT_BUTTON_PIN by @jp-bennett in https://github.com/meshtastic/firmware/pull/9225\r\n- CH341 MAC address derivation from serial and product string by @jp-bennett in https://github.com/meshtastic/firmware/pull/9226\r\n- T-Watch S3 Plus GPS support by @mverch67 in https://github.com/meshtastic/firmware/pull/9235\r\n- Update diy_promicro platformio.ini by @mrekin in https://github.com/meshtastic/firmware/pull/9245\r\n- Recover `long_name`, `short_name` from our own NodeDB entry if device.proto is unreadable by @compumike in https://github.com/meshtastic/firmware/pull/9248\r\n- Remove a strlcpy reference by @jp-bennett in https://github.com/meshtastic/firmware/pull/9249\r\n- Add unified OTA to manifest by @thebentern in https://github.com/meshtastic/firmware/pull/9261\r\n- Tiny - include mt-ota in firmware zips by @vidplace7 in https://github.com/meshtastic/firmware/pull/9275\r\n- EXCLUDE_AUDIO on (original) ESP32 by @vidplace7 in https://github.com/meshtastic/firmware/pull/9276\r\n- Partition name in manifest script by @thebentern in https://github.com/meshtastic/firmware/pull/9294\r\n- SafeFile: use atomic rename-with-overwrite, rather than non-atomic delete-then-rename by @compumike in https://github.com/meshtastic/firmware/pull/9296\r\n- Fix OTA partition name matching by @thebentern in https://github.com/meshtastic/firmware/pull/9302\r\n- T-Deck Pro: speed up eink force refresh by @vicliu624 in https://github.com/meshtastic/firmware/pull/9303\r\n- Small fix in register size for SHT4X by @oscgonfer in https://github.com/meshtastic/firmware/pull/9309\r\n- Fix GPS for T-Watch S3 plus by @mverch67 in https://github.com/meshtastic/firmware/pull/9312\r\n- Adds Custom battery curve for thinknode m6 by @jp-bennett in https://github.com/meshtastic/firmware/pull/9313\r\n- /api/v1/fromradio OPTIONS handler: fix sending proper HTTP response. by @cpatulea in https://github.com/meshtastic/firmware/pull/9322\r\n- Heltec V4 TFT metadata by @thebentern in https://github.com/meshtastic/firmware/pull/9325\r\n- Filter BLE updates that don't change pairing status by @jp-bennett in https://github.com/meshtastic/firmware/pull/9333\r\n- Don't Mute DMs just because we mute a channel by @Xaositek in https://github.com/meshtastic/firmware/pull/9348\r\n\r\n## ⚙️ Dependencies\r\n\r\n- Rp2xx0: Update to arduino-pico 5.4.4 by @vidplace7 in https://github.com/meshtastic/firmware/pull/8979\r\n- Replace PIO fuzzy version matches (reproducible builds) by @vidplace7 in https://github.com/meshtastic/firmware/pull/8984\r\n- PIO: Renovate all the things by @vidplace7 in https://github.com/meshtastic/firmware/pull/8994\r\n- Update lewisxhe/SensorLib to 0.3.3 by @vidplace7 in https://github.com/meshtastic/firmware/pull/9061\r\n- Update meshtastic-esp8266-oled-ssd1306 digest to b34c681 by @app/renovate in https://github.com/meshtastic/firmware/pull/9062\r\n- Update meshtastic/device-ui digest to 272defc by @app/renovate in https://github.com/meshtastic/firmware/pull/9166\r\n- Update dorny/test-reporter action to v2.5.0 by @app/renovate in https://github.com/meshtastic/firmware/pull/9167\r\n- Update INA226 to v0.6.6 by @app/renovate in https://github.com/meshtastic/firmware/pull/9247\r\n- Update meshtastic/device-ui digest to 12f8cdd by @app/renovate in https://github.com/meshtastic/firmware/pull/9263\r\n- Update meshtastic-gxepd2 digest to a05c11c by @app/renovate in https://github.com/meshtastic/firmware/pull/9264\r\n- Update ArduinoJson to v6.21.5 by @app/renovate in https://github.com/meshtastic/firmware/pull/9265\r\n- Update GxEPD2 to v1.6.5 by @app/renovate in https://github.com/meshtastic/firmware/pull/9266\r\n- Update ESP8266SAM to v1.1.0 by @app/renovate in https://github.com/meshtastic/firmware/pull/9271\r\n- Update pschatzmann_arduino-audio-driver to v0.2.0 by @app/renovate in https://github.com/meshtastic/firmware/pull/9272\r\n- Renovate: Ignore lovyangfx for elecrow-panel by @vidplace7 in https://github.com/meshtastic/firmware/pull/9279\r\n- Update RadioLib to v7.5.0 by @vidplace7 in https://github.com/meshtastic/firmware/pull/9281\r\n- Update meshtastic/device-ui digest to 5a870c6 by @app/renovate in https://github.com/meshtastic/firmware/pull/9301\r\n- Update Adafruit BMP280 to v3 by @app/renovate in https://github.com/meshtastic/firmware/pull/9307\r\n- Update meshtastic/device-ui digest to 3480b73 by @app/renovate in https://github.com/meshtastic/firmware/pull/9353\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.7.17.9058cce...v2.7.18.fb3bf78"
+ },
+ {
+ "id": "v2.7.17.9058cce",
+ "title": "Meshtastic Firmware 2.7.17.9058cce Alpha",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.7.17.9058cce",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.7.17.9058cce/firmware-2.7.17.9058cce.json",
+ "release_notes": "> [!WARNING]\r\n> If you experience immediate boot-loops after updating, this likely indicates that you need perform a full erase and flash. If you installed the previously revoked 2.7.17 release with the NimBLE 2 upgrade and paired the device with bluetooth, this will occur.\r\n\r\n## 🚀 What's Changed\r\n* Support overriding GPS serial pins on all architectures by @Stary2001 in https://github.com/meshtastic/firmware/pull/8486\r\n* Swap GPS pins for GPS TX/RX only for T114/T-Echo by @Xaositek in https://github.com/meshtastic/firmware/pull/8751\r\n* Remove native from the build, and remove the required permissions by @NomDeTom in https://github.com/meshtastic/firmware/pull/8685\r\n* Swap the GPS serial port pins. by @Quency-D in https://github.com/meshtastic/firmware/pull/8756\r\n* More GPS pin flips for devices by @Xaositek in https://github.com/meshtastic/firmware/pull/8760\r\n* Remove screen activation in powerExit function by @jp-bennett in https://github.com/meshtastic/firmware/pull/8779\r\n* Add LOG_POWERFSM and LOG_INPUT debug macros by @jp-bennett in https://github.com/meshtastic/firmware/pull/8791\r\n* Fix ifdef statement after ST7796 merge to resolve screen color issues by @Xaositek in https://github.com/meshtastic/firmware/pull/8796\r\n* Update dorny/test-reporter action to v2.3.0 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8809\r\n* InkHUD: Replace assert in UTF8 decoder to prevent unexpected reboot by @HarukiToreda in https://github.com/meshtastic/firmware/pull/8807\r\n* Update meshtastic/device-ui digest to 3bf3322 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8814\r\n* tryfix screen.cpp ifdefs by @jp-bennett in https://github.com/meshtastic/firmware/pull/8816\r\n* Add WiFi Toggle to System frame to re-enable by @Xaositek in https://github.com/meshtastic/firmware/pull/8802\r\n* #if defined conditions for WiFi by @jp-bennett in https://github.com/meshtastic/firmware/pull/8815\r\n* Add initial support for Hackaday Communicator by @jp-bennett in https://github.com/meshtastic/firmware/pull/8771\r\n* M5Stack UnitC6L - Enabled MQTT and WEBSERVER by default by @RikerZhu in https://github.com/meshtastic/firmware/pull/8679\r\n* Initial Chatter 2.0 fix for baseUI by @HarukiToreda in https://github.com/meshtastic/firmware/pull/8615\r\n* Make GPS_TX_PIN the serial TX and GPS_RX_PIN the serial RX for all NRF variants by @Stary2001 in https://github.com/meshtastic/firmware/pull/8772\r\n* Update XPowersLib to v0.3.2 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8823\r\n* RPM: Fix broken builds (bad backmerge) by @vidplace7 in https://github.com/meshtastic/firmware/pull/8787\r\n* Flags and scripts for size reduction on NRF52 -> Currently targeting … by @thebentern in https://github.com/meshtastic/firmware/pull/8825\r\n* Plain RAK4631 should not compile EInk and TFT display code by @thebentern in https://github.com/meshtastic/firmware/pull/8811\r\n* Fix for high power drain after shutdown on Heltec T114. by @rbomze in https://github.com/meshtastic/firmware/pull/8800\r\n* Bump release version by @github-actions[bot] in https://github.com/meshtastic/firmware/pull/8786\r\n* Move everything from /arch to /variant by @jp-bennett in https://github.com/meshtastic/firmware/pull/8831\r\n* Move device specific OCV curves to their respective device.h by @jp-bennett in https://github.com/meshtastic/firmware/pull/8834\r\n* Add 'cleanup' to required PR labels by @jp-bennett in https://github.com/meshtastic/firmware/pull/8835\r\n* Don't scale up the frequency of telemetry sending by @RCGV1 in https://github.com/meshtastic/firmware/pull/8664\r\n* Update actions/stale action to v10.1.1 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8848\r\n* Update alpine Docker tag to v3.23 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8853\r\n* Promicro documentation update by @NomDeTom in https://github.com/meshtastic/firmware/pull/8864\r\n* Optimization flags for all NRF52 targets to reduce code size by @Donix212 in https://github.com/meshtastic/firmware/pull/8854\r\n* Update meshtastic/device-ui digest to 4fb5f24 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8862\r\n* Update protobufs and classes by @github-actions[bot] in https://github.com/meshtastic/firmware/pull/8871\r\n* promicro doesn't need limiting by @NomDeTom in https://github.com/meshtastic/firmware/pull/8873\r\n* Enable USB_MODE to acknowledge RTS/DTR reset signal from esptool for heltec-v4 by @h3lix1 in https://github.com/meshtastic/firmware/pull/8881\r\n* Fix #8883 (lora-Pager fter playing the notification, voltage does not disappear from the speaker) by @polarikus in https://github.com/meshtastic/firmware/pull/8884\r\n* Resolve #8887 (T-LoRaPager Vibration on New Message Delivery) by @polarikus in https://github.com/meshtastic/firmware/pull/8888\r\n* OnScreenKeyboard Improvement with Joystick and UpDown Encoder by @whywilson in https://github.com/meshtastic/firmware/pull/8379\r\n* [T-LoraPager]Disable vibration if needed by @polarikus in https://github.com/meshtastic/firmware/pull/8895\r\n* Tryfix: T3S3 ePaper eInk updates by @mverch67 in https://github.com/meshtastic/firmware/pull/8898\r\n* Improved R1 Neo & muzi-base buzzer beeps for GPS on/off by @simon-muzi in https://github.com/meshtastic/firmware/pull/8870\r\n* Meshtastic build manifest by @vidplace7 in https://github.com/meshtastic/firmware/pull/8248\r\n* Fix backwards buttons on Thinknode-M1 by @jp-bennett in https://github.com/meshtastic/firmware/pull/8901\r\n* Update protobuf name of FRIED_CHICKEN by @jp-bennett in https://github.com/meshtastic/firmware/pull/8903\r\n* Guard 2M PHY mode for NimBLE by @thebentern in https://github.com/meshtastic/firmware/pull/8890\r\n* Renovate: fix BH1750_WE by @vidplace7 in https://github.com/meshtastic/firmware/pull/8767\r\n* Fixed the issue where T-Echo did not completely shut down peripherals… by @lewisxhe in https://github.com/meshtastic/firmware/pull/8524\r\n* Fix apply device-install permissions by @vidplace7 in https://github.com/meshtastic/firmware/pull/8911\r\n* Update platformio/espressif32 to v6.12.0 by @vidplace7 in https://github.com/meshtastic/firmware/pull/7697\r\n* Fix #8915 [Bug]: Exception Decoder does not recognize the backtrace by @polarikus in https://github.com/meshtastic/firmware/pull/8917\r\n* Actions: Fix release manifest formating by @vidplace7 in https://github.com/meshtastic/firmware/pull/8918\r\n* ARCtastic runners by @vidplace7 in https://github.com/meshtastic/firmware/pull/8904\r\n* Update peter-evans/create-pull-request action to v8 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8919\r\n* PIO: Fix closedcube lib reference by @vidplace7 in https://github.com/meshtastic/firmware/pull/8920\r\n* Use PSRAM to reduce heap usage percentage on ESP32 with PSRAM by @samm-git in https://github.com/meshtastic/firmware/pull/8891\r\n* Create new screen colors for BaseUI by @Xaositek in https://github.com/meshtastic/firmware/pull/8921\r\n* Enable Muzi-base LED notification by @jp-bennett in https://github.com/meshtastic/firmware/pull/8925\r\n* Update System Frame for improved rendering on devices by @Xaositek in https://github.com/meshtastic/firmware/pull/8923\r\n* Add I2C device check for seesaw device on native by @jp-bennett in https://github.com/meshtastic/firmware/pull/8927\r\n* Use truncated position for smart position by @RCGV1 in https://github.com/meshtastic/firmware/pull/8906\r\n* Properly turn off power pins at shutdown for m3 by @jp-bennett in https://github.com/meshtastic/firmware/pull/8935\r\n* Update meshtastic/device-ui digest to 2746a1c by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8936\r\n* Use 'gh-action-runner' action for \"Check\" jobs. by @vidplace7 in https://github.com/meshtastic/firmware/pull/8938\r\n* Optimize builds to reduce duplicate dependency checks by @vidplace7 in https://github.com/meshtastic/firmware/pull/8943\r\n* Update actions/cache action to v5 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8944\r\n* Fix #8899 [Bug]: [TloraPager] RotaryEncoder crash by @polarikus in https://github.com/meshtastic/firmware/pull/8933\r\n* Mark implicit ACK for MQTT as MQTT transport by @GUVWAF in https://github.com/meshtastic/firmware/pull/8939\r\n* Fix GPS Buffer full issue on NRF52480 (Seeed T1000E) by @fifieldt in https://github.com/meshtastic/firmware/pull/8956\r\n* Actions: Compact manifest job output summary by @vidplace7 in https://github.com/meshtastic/firmware/pull/8957\r\n* Add JSON packet recording option to native by @jp-bennett in https://github.com/meshtastic/firmware/pull/8930\r\n* Implement Long Turbo preset by @thebentern in https://github.com/meshtastic/firmware/pull/8985\r\n* Be more judicious about responding to want_response in existing meshes by @thebentern in https://github.com/meshtastic/firmware/pull/9014\r\n* First position send validation by @thebentern in https://github.com/meshtastic/firmware/pull/9023\r\n* Calculate hops correctly even when hop_start==0 by @esev in https://github.com/meshtastic/firmware/pull/9120\r\n* Revert NimBLE 2.X upgrade by @thebentern in https://github.com/meshtastic/firmware/pull/9125\r\n\r\n## New Contributors\r\n* @RikerZhu made their first contribution in https://github.com/meshtastic/firmware/pull/8679\r\n* @rbomze made their first contribution in https://github.com/meshtastic/firmware/pull/8800\r\n* @Donix212 made their first contribution in https://github.com/meshtastic/firmware/pull/8854\r\n* @polarikus made their first contribution in https://github.com/meshtastic/firmware/pull/8884\r\n* @phaseloop made their first contribution in https://github.com/meshtastic/firmware/pull/8858\r\n* @samm-git made their first contribution in https://github.com/meshtastic/firmware/pull/8891\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.7.16.a597230...v2.7.17.9058cce"
+ },
+ {
+ "id": "v2.7.16.a597230",
+ "title": "Meshtastic Firmware 2.7.16.a597230 Alpha",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.7.16.a597230",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.7.16.a597230/firmware-esp32-2.7.16.a597230.zip",
+ "release_notes": "## 🚀 What's Changed\r\n* Bugfix: Don't toggle BLE when choosing active state by @jp-bennett in https://github.com/meshtastic/firmware/pull/8579\r\n* chore(deps): update meshtastic/device-ui digest to 28167c6 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8583\r\n* Only call stopNow if we're nagging by @thebentern in https://github.com/meshtastic/firmware/pull/8601\r\n* Clean up GPS toggle logging by @jp-bennett in https://github.com/meshtastic/firmware/pull/8629\r\n* Reset the calibration data back to 0 when doing a compass calibration by @jp-bennett in https://github.com/meshtastic/firmware/pull/8648\r\n* chore(deps): update dorny/test-reporter action to v2.2.0 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8637\r\n* Fix RPM builds by @vidplace7 in https://github.com/meshtastic/firmware/pull/8659\r\n* Linux: Fix silly EPEL9 mistake by @vidplace7 in https://github.com/meshtastic/firmware/pull/8660\r\n* Fix ble rssi crash by @thebentern in https://github.com/meshtastic/firmware/pull/8661\r\n* Unify uptime formatting by @jasonbcox in https://github.com/meshtastic/firmware/pull/8677\r\n* chore(deps): update meshtastic-esp8266-oled-ssd1306 digest to 2887bf4 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8688\r\n* Actually respect wake_on_motion setting by @jp-bennett in https://github.com/meshtastic/firmware/pull/8690\r\n* Add a reset pulse signal to the OLED. by @Quency-D in https://github.com/meshtastic/firmware/pull/8691\r\n* Missed one by @thebentern in https://github.com/meshtastic/firmware/pull/8694\r\n* nrf52 watchdog (attempt #2) by @SebKuzminsky in https://github.com/meshtastic/firmware/pull/8670\r\n* Fix build when MESHTASTIC_EXCLUDE_PKI is defined by @jasonbcox in https://github.com/meshtastic/firmware/pull/8698\r\n* Fix MenuHandler when MESHTASTIC_EXCLUDE_PKI is defined by @jasonbcox in https://github.com/meshtastic/firmware/pull/8701\r\n* Update protobufs and classes by @github-actions[bot] in https://github.com/meshtastic/firmware/pull/8707\r\n* Add Thinknode M6 by @caveman99 in https://github.com/meshtastic/firmware/pull/8705\r\n* Update Kongduino-Adafruit_nRFCrypto digest to 8cde718 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8708\r\n* Update actions/checkout action to v6 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8695\r\n* Add WisMesh Tag OCV array by @Avi0n in https://github.com/meshtastic/firmware/pull/8646\r\n* R1 Neo - Added OCV_ARRAY from measured discharge curve testing + update ADC multiplier by @simon-muzi in https://github.com/meshtastic/firmware/pull/8716\r\n* Log error if startReceive fails in LR11x0Interface by @jp-bennett in https://github.com/meshtastic/firmware/pull/8718\r\n* Tweak OCV_ARRAY 100% voltage to take into account charger hysteresis and voltage sag after charge by @simon-muzi in https://github.com/meshtastic/firmware/pull/8720\r\n* Thinknode M3 support against master by @jp-bennett in https://github.com/meshtastic/firmware/pull/8630\r\n* M6 leds by @jp-bennett in https://github.com/meshtastic/firmware/pull/8742\r\n* Further fix compass calibration by @jp-bennett in https://github.com/meshtastic/firmware/pull/8740\r\n* More quickly hide \"Shutting Down\" to prevent it showing on Eink sleep screen by @Xaositek in https://github.com/meshtastic/firmware/pull/8749\r\n* Prevent double-registering of Rotary Encoder on TLora Pager by @thebentern in https://github.com/meshtastic/firmware/pull/8746\r\n* 3401 fix by @caveman99 in https://github.com/meshtastic/firmware/pull/8755\r\n* Add support for muzi-base by @jp-bennett in https://github.com/meshtastic/firmware/pull/8753\r\n* Add requestFocus() in CannedMessages by @jp-bennett in https://github.com/meshtastic/firmware/pull/8770\r\n* Update Sensirion Core to v0.7.2 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8551\r\n* Update INA226 to v0.6.5 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8645\r\n* Update NonBlockingRTTTL to v1.4.0 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8541\r\n* Update platformio/ststm32 to v19.4.0 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8433\r\n* adding support for the ST7796 + creating a new variant of the T-beam by @Nasimovy in https://github.com/meshtastic/firmware/pull/6575\r\n* Correct vertical alignment for Muzi_Base on On Screen Keyboard by @Xaositek in https://github.com/meshtastic/firmware/pull/8774\r\n\r\n## New Contributors\r\n* @Avi0n made their first contribution in https://github.com/meshtastic/firmware/pull/8646\r\n* @simon-muzi made their first contribution in https://github.com/meshtastic/firmware/pull/8716\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.7.15.567b8ea...v2.7.16.a597230"
+ },
+ {
+ "id": "v2.7.14.e959000",
+ "title": "Meshtastic Firmware 2.7.14.e959000 Alpha",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.7.14.e959000",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.7.14.e959000/firmware-esp32-2.7.14.e959000.zip",
+ "release_notes": "## 🚀 What's Changed\r\n* Add the identification code for the DA217 triaxial accelerometer. by @Quency-D in https://github.com/meshtastic/firmware/pull/8526\r\n* fix strlcpy compile error in Ubuntu 22.04 by @mverch67 in https://github.com/meshtastic/firmware/pull/8520\r\n* Packaging: Add libbsd where needed by @vidplace7 in https://github.com/meshtastic/firmware/pull/8533\r\n* Add support for RAK_WISMESH_TAP_V2 and RAK3401 hardware models by @DanielCao0 in https://github.com/meshtastic/firmware/pull/8537\r\n* Fix: missing T-Deck Pro key '0' by @mverch67 in https://github.com/meshtastic/firmware/pull/8564\r\n* Store hop/mqtt/transport mechanism info in S&F by @weebl2000 in https://github.com/meshtastic/firmware/pull/8560\r\n* Reject legacy text message DMs by @jp-bennett in https://github.com/meshtastic/firmware/pull/8562\r\n* AddFromContact: Don't auto-favorite when `CLIENT_BASE`; don't update `last_heard` unless `CLIENT_BASE` by @compumike in https://github.com/meshtastic/firmware/pull/8495\r\n* Persist favourites on NodeDB reset by @ford-jones in https://github.com/meshtastic/firmware/pull/8292\r\n* Don't ack messages when mqtt client proxy is on but only uplink by @RCGV1 in https://github.com/meshtastic/firmware/pull/8578\r\n* Add API types, state, and log message in Debug screen. Added persistent \"Connected\" icon by @jp-bennett in https://github.com/meshtastic/firmware/pull/8576\r\n* Drop PKI acks if there is no downlink on MQTTClientProxy by @RCGV1 in https://github.com/meshtastic/firmware/pull/8580\r\n* Add the Heltec v4 expansion box. by @Quency-D in https://github.com/meshtastic/firmware/pull/8539\r\n* Update platform-native for WIFi lib fix by @jp-bennett in https://github.com/meshtastic/firmware/pull/8544\r\n* Reject legacy text message DMs by @jp-bennett in https://github.com/meshtastic/firmware/pull/8562\r\n* Bugfix: Don't toggle BLE when choosing active state by @jp-bennett in https://github.com/meshtastic/firmware/pull/8579\r\n* Try-fix traceroute panic by @thebentern in https://github.com/meshtastic/firmware/pull/8568\r\n* chore(deps): update meshtastic/device-ui digest to 28167c6 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8583\r\n* Only call stopNow if we're nagging by @thebentern in https://github.com/meshtastic/firmware/pull/8601\r\n\r\n## New Contributors\r\n* @l0g-lab made their first contribution in https://github.com/meshtastic/firmware/pull/7926\r\n* @dirkmueller made their first contribution in https://github.com/meshtastic/firmware/pull/8320\r\n* @steven52880 made their first contribution in https://github.com/meshtastic/firmware/pull/8330\r\n* @miketweaver made their first contribution in https://github.com/meshtastic/firmware/pull/8355\r\n* @Paplewski made their first contribution in https://github.com/meshtastic/firmware/pull/8362\r\n* @igorka48 made their first contribution in https://github.com/meshtastic/firmware/pull/8187\r\n* @korbinianbauer made their first contribution in https://github.com/meshtastic/firmware/pull/8432\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.7.12.45f15b8...v2.7.14.e959000"
+ },
+ {
+ "id": "v2.7.13.597fa0b",
+ "title": "Meshtastic Firmware 2.7.13.597fa0b Alpha",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.7.13.597fa0b",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.7.13.597fa0b/firmware-esp32-2.7.13.597fa0b.zip",
+ "release_notes": "> [!IMPORTANT]\r\n> This release disables device telemetry broadcasts over the mesh by default. If you want to opt back in, you will need to re-enable this in the apps.\r\n\r\n> [!WARNING]\r\n> If you experience immediate bluetooth pairing failures or failure to boot after updating, this likely indicates that you need to do a full erase and flash. Consider backing up your settings before updating.\r\n\r\n## 🚀 What's Changed\r\n* Update python Docker tag to v3.14 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8255\r\n* fix: Move `#include \"variant.h\"` to top of file (fixes #8276) by @ndoo in https://github.com/meshtastic/firmware/pull/8278\r\n* Update meshtastic/device-ui digest to 6d8cc22 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8275\r\n* NimBLE speedup by @thebentern in https://github.com/meshtastic/firmware/pull/8281\r\n* Fix Station G2 Lora Power Settings by @fifieldt in https://github.com/meshtastic/firmware/pull/8273\r\n* chore(deps): update github/codeql-action action to v4 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8250\r\n* Fix BLE stateful issues by @thebentern in https://github.com/meshtastic/firmware/pull/8287\r\n* Attach an interrupt to EXT_PWR_DETECT if present, and force a screen … by @jp-bennett in https://github.com/meshtastic/firmware/pull/8284\r\n* Update XPowersLib to v0.3.1 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8303\r\n* Bump release version by @github-actions[bot] in https://github.com/meshtastic/firmware/pull/8304\r\n* Double the number of bluetooth bonds NimBLE will store (from 3 to 6) by @thebentern in https://github.com/meshtastic/firmware/pull/8296\r\n* mDNS: Advertise pio_env (for OTA scripts) by @vidplace7 in https://github.com/meshtastic/firmware/pull/8298\r\n* Master to develop by @jp-bennett in https://github.com/meshtastic/firmware/pull/8306\r\n* Actions: CI docker with a fancy matrix by @vidplace7 in https://github.com/meshtastic/firmware/pull/8253\r\n* GPS_POWER_TOGGLE no longer has a function, so purge by @jp-bennett in https://github.com/meshtastic/firmware/pull/8312\r\n* Update protobufs and classes by @github-actions[bot] in https://github.com/meshtastic/firmware/pull/8305\r\n* Remove T1000E GPS startup delay sequence by @fifieldt in https://github.com/meshtastic/firmware/pull/8236\r\n* Increase bluetooth 5.0 PHY speed and MTU on esp32_s3 by @h3lix1 in https://github.com/meshtastic/firmware/pull/8261\r\n* More BaseUI Frame Visibility Toggles by @Xaositek in https://github.com/meshtastic/firmware/pull/8252\r\n* Device Telemetry opt in by @thebentern in https://github.com/meshtastic/firmware/pull/8059\r\n* Fix muted protobuf compile errors by @thebentern in https://github.com/meshtastic/firmware/pull/8316\r\n* Master backmerge by @thebentern in https://github.com/meshtastic/firmware/pull/8317\r\n* chore(deps): update meshtastic/device-ui digest to 3fb7c0e by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8291\r\n* Nodelist: choice of long or short name by @l0g-lab in https://github.com/meshtastic/firmware/pull/7926\r\n* Ble reconnect prefetch bug fix, plus some speed enhancements by @h3lix1 in https://github.com/meshtastic/firmware/pull/8324\r\n* Avoid exceeding allocated buffers when doing MQTT proxying by @dirkmueller in https://github.com/meshtastic/firmware/pull/8320\r\n* Fix erroneous limiting of power in Ham Mode by @fifieldt in https://github.com/meshtastic/firmware/pull/8322\r\n* Fix bug: can not detect battery status while using INA226 by @steven52880 in https://github.com/meshtastic/firmware/pull/8330\r\n* rework sensor instantiation to saves memory by removing the static allocation by @Links2004 in https://github.com/meshtastic/firmware/pull/8054\r\n* Fix multitude of warnings during builds on MeshTiny by @Xaositek in https://github.com/meshtastic/firmware/pull/8331\r\n* Fix multitude of warnings during builds on MeshTiny by @Xaositek in https://github.com/meshtastic/firmware/pull/8331\r\n* Revert \"Fix Station G2 Lora Power Settings\" by @thebentern in https://github.com/meshtastic/firmware/pull/8332\r\n* Develop to master merge by @thebentern in https://github.com/meshtastic/firmware/pull/8337\r\n* Update stale_bot.yml by @NomDeTom in https://github.com/meshtastic/firmware/pull/8333\r\n* Update meshtastic/device-ui digest to 19b7855 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8346\r\n* Add a general-purpose packet cache by @erayd in https://github.com/meshtastic/firmware/pull/8341\r\n* Guarding PhoneAPI node-info staging with mutex to prevent BLE future foot-gun by @h3lix1 in https://github.com/meshtastic/firmware/pull/8354\r\n* Fix portduino native builds by @miketweaver in https://github.com/meshtastic/firmware/pull/8355\r\n* Log the lora frequency error when receiving a packet. by @jp-bennett in https://github.com/meshtastic/firmware/pull/8343\r\n* Bind python version to 3.13 by @Paplewski in https://github.com/meshtastic/firmware/pull/8362\r\n* Update actions/setup-node action to v6 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8339\r\n* Upgrade trunk by @github-actions[bot] in https://github.com/meshtastic/firmware/pull/8340\r\n* Ignore MQTT Client Proxy messages while not in sendpackets state by @thebentern in https://github.com/meshtastic/firmware/pull/8358\r\n* Force CannedMessages to another node to be a PKI DM by @jp-bennett in https://github.com/meshtastic/firmware/pull/8373\r\n* Update meshtastic/web to v2.6.7 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8381\r\n* Update DFRobot_RTU to v1.0.6 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8387\r\n* Update mcr.microsoft.com/devcontainers/cpp Docker tag to v2 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8375\r\n* Board support: RAK3401+RAK13302 1-watt by @DanielCao0 in https://github.com/meshtastic/firmware/pull/8140\r\n* Fixed battery voltage to show missing decimals by @HarukiToreda in https://github.com/meshtastic/firmware/pull/8386\r\n* Gating off BaseUI code for Screenless nodes and InkHUD by @HarukiToreda in https://github.com/meshtastic/firmware/pull/8384\r\n* Added support for SugarCube device by @igorka48 in https://github.com/meshtastic/firmware/pull/8187\r\n* Fix NimbleBluetooth reliability and performance by @compumike in https://github.com/meshtastic/firmware/pull/8385\r\n* Add a banner on startup when DEBUG_MUTE is enabled by @Stary2001 in https://github.com/meshtastic/firmware/pull/8402\r\n* Remove \"Phone GPS\" in order to correct GPS reporting by @Xaositek in https://github.com/meshtastic/firmware/pull/8407\r\n* Fix NimbleBluetooth: process fromPhoneQueue (phone->radio) before toPhoneQueue (radio->phone) by @compumike in https://github.com/meshtastic/firmware/pull/8404\r\n* Make packet pool dynamic again on STM32 as a workaround by @Stary2001 in https://github.com/meshtastic/firmware/pull/8400\r\n* InkHUD Map improvements by @HarukiToreda in https://github.com/meshtastic/firmware/pull/8397\r\n* Include RSSI in rangetest csv by @ford-jones in https://github.com/meshtastic/firmware/pull/8395\r\n* Move airtime calculation to when Tx is complete by @GUVWAF in https://github.com/meshtastic/firmware/pull/8427\r\n* Upgrade trunk by @github-actions[bot] in https://github.com/meshtastic/firmware/pull/8369\r\n* Allow vibra or buzzer only notifications to obey cutoff by @Xaositek in https://github.com/meshtastic/firmware/pull/8342\r\n* Don't use unsigned integer type for negative SNR value by @korbinianbauer in https://github.com/meshtastic/firmware/pull/8432\r\n* InkHUD crash fix when nodes get deleted from NodeDB by @HarukiToreda in https://github.com/meshtastic/firmware/pull/8428\r\n* Address longName wrapping by @Xaositek in https://github.com/meshtastic/firmware/pull/8441\r\n* Update node to v24 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8476\r\n* Turn the e-ink backlight on for any brightness value over 0 by @jp-bennett in https://github.com/meshtastic/firmware/pull/8481\r\n* Add missed debug log line in RF95 Interface by @jp-bennett in https://github.com/meshtastic/firmware/pull/8490\r\n* Thinknode M5 ADC_MULTIPLIER to actually hit 100% charge by @jp-bennett in https://github.com/meshtastic/firmware/pull/8489\r\n* Better implementation of ExternalNotificationModule::stopNow by @Xaositek in https://github.com/meshtastic/firmware/pull/8492\r\n* Skip setting up Lora GPIO lines when using a ch341 radio on native by @jp-bennett in https://github.com/meshtastic/firmware/pull/8506\r\n* Fix boot on RP2040 by excluding new FreeRTOS task by @GUVWAF in https://github.com/meshtastic/firmware/pull/8508\r\n* Fix dismiss of ext. notification by @thebentern in https://github.com/meshtastic/firmware/pull/8512\r\n* Update device-install.sh to support heltec-v4 by @Melonbwead in https://github.com/meshtastic/firmware/pull/8509\r\n\r\n## New Contributors\r\n* @l0g-lab made their first contribution in https://github.com/meshtastic/firmware/pull/7926\r\n* @dirkmueller made their first contribution in https://github.com/meshtastic/firmware/pull/8320\r\n* @steven52880 made their first contribution in https://github.com/meshtastic/firmware/pull/8330\r\n* @miketweaver made their first contribution in https://github.com/meshtastic/firmware/pull/8355\r\n* @Paplewski made their first contribution in https://github.com/meshtastic/firmware/pull/8362\r\n* @igorka48 made their first contribution in https://github.com/meshtastic/firmware/pull/8187\r\n* @korbinianbauer made their first contribution in https://github.com/meshtastic/firmware/pull/8432\r\n* @Ixitxachitl made their first contribution in https://github.com/meshtastic/firmware/pull/8493\r\n* @mariusfaber98 made their first contribution in https://github.com/meshtastic/firmware/pull/8349\r\n* @shortwavesurfer2009 made their first contribution in https://github.com/meshtastic/firmware/pull/8137\r\n* @pa0lin082 made their first contribution in https://github.com/meshtastic/firmware/pull/8376\r\n* @Xavierhorwood made their first contribution in https://github.com/meshtastic/firmware/pull/6866\r\n* @Melonbwead made their first contribution in https://github.com/meshtastic/firmware/pull/8509\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.7.12.45f15b8...v2.7.13.597fa0b"
+ },
+ {
+ "id": "v2.7.11.ee68575",
+ "title": "Meshtastic Firmware 2.7.11.ee68575 Alpha",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.7.11.ee68575",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.7.11.ee68575/firmware-esp32-2.7.11.ee68575.zip",
+ "release_notes": "> [!IMPORTANT]\r\nDue to feedback received from users, UDP has been disabled by default and the default PSK decryption bridging logic has been removed for now until channel level controls can be added to a future release.\r\n\r\n> [!WARNING]\r\nRepeater role has been deprecated in this release and going forward.\r\n\r\n## 🚀 What's Changed\r\n* On screen keyboard by @thebentern in https://github.com/meshtastic/firmware/pull/7705\r\n* Update meshtastic/device-ui digest to 0f32b64 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/7723\r\n* Update caveman99-stm32-Crypto digest to 1aa30eb by @renovate[bot] in https://github.com/meshtastic/firmware/pull/7725\r\n* Renovate: Always use `master` as the base. by @vidplace7 in https://github.com/meshtastic/firmware/pull/7726\r\n* Add more text message test cases for meshpacket serializer by @TN666 in https://github.com/meshtastic/firmware/pull/7709\r\n* Reduce power of EU433 to 10dBm by @fifieldt in https://github.com/meshtastic/firmware/pull/7733\r\n* Backmerge to develop by @thebentern in https://github.com/meshtastic/firmware/pull/7744\r\n* Log more information about ignored packet by @notmasteryet in https://github.com/meshtastic/firmware/pull/7718\r\n* Setup ESP32 PM-specific capability flags by @m1nl in https://github.com/meshtastic/firmware/pull/7747\r\n* Add more test case for encrypted packet test by @TN666 in https://github.com/meshtastic/firmware/pull/7745\r\n* Backmerge by @thebentern in https://github.com/meshtastic/firmware/pull/7773\r\n* Bump release version by @github-actions[bot] in https://github.com/meshtastic/firmware/pull/7777\r\n* BaseUI Show/Hide Frame Functionality by @Xaositek in https://github.com/meshtastic/firmware/pull/7382\r\n* We don't gotTime if time is 2019. by @fifieldt in https://github.com/meshtastic/firmware/pull/7772\r\n* Add On-Screen Keyboard for UpDown Encoder and Rotary Encoder. by @whywilson in https://github.com/meshtastic/firmware/pull/7762\r\n* Fix InputEvent variable usage with out initialization (random key events while using rotery encoder) by @Links2004 in https://github.com/meshtastic/firmware/pull/8015\r\n* Allow Left / Right Events for selection and improve encoder responsives by @Links2004 in https://github.com/meshtastic/firmware/pull/8016\r\n* Fix build fail on develop branch by @WillyJL in https://github.com/meshtastic/firmware/pull/8043\r\n* Fix more build failures by @WillyJL in https://github.com/meshtastic/firmware/pull/8044\r\n* Fix build with HAS_TELEMETRY 0 by @Links2004 in https://github.com/meshtastic/firmware/pull/8051\r\n* Move HTTP contentTypes to Flash - saves 768 Bytes of RAM by @Links2004 in https://github.com/meshtastic/firmware/pull/8055\r\n* Fix: use `lora.use_preset` config to get name by @GUVWAF in https://github.com/meshtastic/firmware/pull/8057\r\n* Resolve many warnings for BaseUI during builds by @Xaositek in https://github.com/meshtastic/firmware/pull/8063\r\n* Fix Rotary Encoder Button by @Links2004 in https://github.com/meshtastic/firmware/pull/8001\r\n* Add another seeed_xiao_nrf52840_kit build environment for I2C pinout by @NomDeTom in https://github.com/meshtastic/firmware/pull/8036\r\n* Add heltec_v4 board. by @Quency-D in https://github.com/meshtastic/firmware/pull/7845\r\n* Fix build errors by @Xaositek in https://github.com/meshtastic/firmware/pull/8067\r\n* Introduce Radio Preset elections through BaseUI by @Xaositek in https://github.com/meshtastic/firmware/pull/8071\r\n* Allow label enforcement job to run on self-hosted runners by @fifieldt in https://github.com/meshtastic/firmware/pull/7909\r\n* Bump release version by @github-actions[bot] in https://github.com/meshtastic/firmware/pull/8100\r\n* Upgrade trunk by @github-actions[bot] in https://github.com/meshtastic/firmware/pull/8094\r\n* Add three expansion screens for heltec mesh solar. by @Quency-D in https://github.com/meshtastic/firmware/pull/7995\r\n* Update Adafruit BusIO to v1.17.4 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8098\r\n* Fix 2.4GHz reconfiguration on LR11xx by @Stary2001 in https://github.com/meshtastic/firmware/pull/8102\r\n* Feat/0-cost hops for favorite routers by @h3lix1 in https://github.com/meshtastic/firmware/pull/7992\r\n* If a packet is heard multiple times, rebroadcast using the highest hop limit by @erayd in https://github.com/meshtastic/firmware/pull/5534\r\n* Make sure next-hop is only set when they received us directly by @GUVWAF in https://github.com/meshtastic/firmware/pull/8053\r\n* Reduce cpu load by optimizing OSThread runOnce calls by @Links2004 in https://github.com/meshtastic/firmware/pull/8101\r\n* Correct inverted mute icon by @Xaositek in https://github.com/meshtastic/firmware/pull/8111\r\n* BaseUI - Saving GPS Format changes are required by @Xaositek in https://github.com/meshtastic/firmware/pull/8122\r\n* Properly output the TCXO Voltage in yaml by @jp-bennett in https://github.com/meshtastic/firmware/pull/8128\r\n* I2S: Fix silent RTTTL regression by @WillyJL in https://github.com/meshtastic/firmware/pull/8129\r\n* Revert cross-preset default-key bridging with UDP and disable UDP by default by @thebentern in https://github.com/meshtastic/firmware/pull/8130\r\n* Develop --> Master by @fifieldt in https://github.com/meshtastic/firmware/pull/8110\r\n* Range-test: Clean on reboot by @ford-jones in https://github.com/meshtastic/firmware/pull/7703\r\n* UIRenderer: display \"No GPS present\" only on the first line to avoid duplication by @plashchynski in https://github.com/meshtastic/firmware/pull/8136\r\n* Remove memcpy by @dfsx1 in https://github.com/meshtastic/firmware/pull/8079\r\n* Correct altitudeLine getting clobbered in the great merge by @Xaositek in https://github.com/meshtastic/firmware/pull/8138\r\n* Bug / Send upgraded (duplicate) packets to phone if the queue removal failed. by @h3lix1 in https://github.com/meshtastic/firmware/pull/8148\r\n* Validate CR and SF lora config by @thebentern in https://github.com/meshtastic/firmware/pull/8146\r\n* Finish deprecating the Repeater role behavior by @thebentern in https://github.com/meshtastic/firmware/pull/8144\r\n* Fix Heltec V3 missed button presses by @thebentern in https://github.com/meshtastic/firmware/pull/8167\r\n\r\n## New Contributors\r\n* @h3lix1 made their first contribution in https://github.com/meshtastic/firmware/pull/7992\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.7.10.94d4bdf...v2.7.11.ee68575"
+ },
+ {
+ "id": "v2.7.10.94d4bdf",
+ "title": "Meshtastic Firmware 2.7.10.94d4bdf Alpha",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.7.10.94d4bdf",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.7.10.94d4bdf/firmware-esp32-2.7.10.94d4bdf.zip",
+ "release_notes": "## 🚀 What's Changed\r\n\r\n- BaseUI Show/Hide Frame Functionality by @Xaositek in https://github.com/meshtastic/firmware/pull/7382\r\n- Feature: Seamless Cross-Preset Communication via UDP Multicast Bridging by @ViezeVingertjes in https://github.com/meshtastic/firmware/pull/7753\r\n- Add CLIENT_BASE role: ROUTER for favorites, CLIENT otherwise (for attic/roof nodes!) by @compumike in https://github.com/meshtastic/firmware/pull/7873\r\n- Added Last Coordinate counter to Position screen by @HarukiToreda in https://github.com/meshtastic/firmware/pull/7865\r\n- Phone GPS display on Position Screen for BaseUI by @HarukiToreda in https://github.com/meshtastic/firmware/pull/7875\r\n- Add formatting and menu picking for other GPS format options by @Xaositek in https://github.com/meshtastic/firmware/pull/7974\r\n- Add RAK WisMesh Tap V2 (ESP32S3) Hardware Variant by @DanielCao0 in https://github.com/meshtastic/firmware/pull/7741\r\n- Add support for the Challenger rp2040 lora by @samuel-duffield1 in https://github.com/meshtastic/firmware/pull/7826\r\n- Add support for the RV-3028 on native Linux by @jp-bennett in https://github.com/meshtastic/firmware/pull/7802\r\n- T-Lora Pager: Support LR1121 and SX1280 models by @WillyJL in https://github.com/meshtastic/firmware/pull/7956\r\n- Add another seeed_xiao_nrf52840_kit build environment for I2C pinout by @NomDeTom in https://github.com/meshtastic/firmware/pull/8036\r\n- Add heltec_v4 board. by @Quency-D in https://github.com/meshtastic/firmware/pull/7845\r\n- C6l fixes by @jp-bennett in https://github.com/meshtastic/firmware/pull/8047\r\n- Add TSL2561 sensor by @davide125 in https://github.com/meshtastic/firmware/pull/7675\r\n- Add a new GPS model CM121. by @Quency-D in https://github.com/meshtastic/firmware/pull/7852\r\n- Make ExternalNotification show up in excluded_modules, more STM32 modules by @Stary2001 in https://github.com/meshtastic/firmware/pull/7797\r\n- Enable bmx160 on native by @jp-bennett in https://github.com/meshtastic/firmware/pull/7844\r\n- Fix memory leak in NRF52Bluetooth: allocate BluetoothStatus on stack, not heap by @compumike in https://github.com/meshtastic/firmware/pull/7965\r\n- Fix memory leak in NimbleBluetooth: allocate BluetoothStatus on stack, not heap by @compumike in https://github.com/meshtastic/firmware/pull/7964\r\n- Fix GPS gm_mktime memory leak by @compumike in https://github.com/meshtastic/firmware/pull/7981\r\n- Fix INA3221 higher current wrong readings by @macvenez in https://github.com/meshtastic/firmware/pull/7607\r\n- Fix InputEvent variable usage with out initialization (random key events while using rotery encoder) by @Links2004 in https://github.com/meshtastic/firmware/pull/8015\r\n- Fix Rotary Encoder Button by @Links2004 in https://github.com/meshtastic/firmware/pull/8001\r\n- Fix date display to be upper right bound by @Xaositek in https://github.com/meshtastic/firmware/pull/7876\r\n- Fix excluded modules configuration handling by @capricornusx in https://github.com/meshtastic/firmware/pull/7838\r\n- Fix build error in rak_wismesh_tap_v2 by @fifieldt in https://github.com/meshtastic/firmware/pull/7905\r\n- Fix build fail on develop branch by @WillyJL in https://github.com/meshtastic/firmware/pull/8043\r\n- Fix more build failures by @WillyJL in https://github.com/meshtastic/firmware/pull/8044\r\n- Fix last build issues on develop by @WillyJL in https://github.com/meshtastic/firmware/pull/8046\r\n- Fix build errors by @Xaositek in https://github.com/meshtastic/firmware/pull/8067\r\n- fix build with HAS_TELEMETRY 0 by @Links2004 in https://github.com/meshtastic/firmware/pull/8051\r\n- Fix device-install.bat baud rate by @fifieldt in https://github.com/meshtastic/firmware/pull/7816\r\n- Fix: use lora.use_preset config to get name by @GUVWAF in https://github.com/meshtastic/firmware/pull/8057\r\n- Show GPS Date properly in drawCommonHeader by @Xaositek in https://github.com/meshtastic/firmware/pull/7887\r\n- Make sure to ACK ACKs/replies if next-hop routing is used by @GUVWAF in https://github.com/meshtastic/firmware/pull/8052\r\n- Only stop retransmissions when receiving implicit ACK over LoRa by @GUVWAF in https://github.com/meshtastic/firmware/pull/7872\r\n- Allow Left / Right Events for selection and improve encoder responsives by @Links2004 in https://github.com/meshtastic/firmware/pull/8016\r\n- If usePreset is False, show value as Custom. by @Xaositek in https://github.com/meshtastic/firmware/pull/7812\r\n- (resubmission) Manual GitHub actions to allow building one target or arch by @NomDeTom in https://github.com/meshtastic/firmware/pull/7997\r\n- When DEBUG_HEAP is defined, add free heap bytes to every log line in RedirectablePrint::log_to_serial by @compumike in https://github.com/meshtastic/firmware/pull/8004\r\n- Setup ESP32 PM-specific capability flags by @m1nl in https://github.com/meshtastic/firmware/pull/7747\r\n- move HTTP contentTypes to Flash - saves 768 Bytes of RAM by @Links2004 in https://github.com/meshtastic/firmware/pull/8055\r\n- Portduino config refactor by @jp-bennett in https://github.com/meshtastic/firmware/pull/7796\r\n- Add BUILD_EPOCH to latest setup step. by @fifieldt in https://github.com/meshtastic/firmware/pull/7894\r\n- updated shebang to use a more standard path for bash in flashing scripts. by @vtrenton in https://github.com/meshtastic/firmware/pull/7922\r\n- Update RadioLib to v7.3.0 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/8065\r\n- Update Protobuf usage, add MLS, fix clock by @Xaositek in https://github.com/meshtastic/firmware/pull/8041\r\n- Portduino bump to fix gpiod bug by @jp-bennett in https://github.com/meshtastic/firmware/pull/8083\r\n- Ext notification fix (handle ringtone operations even when module is not enabled) by @thebentern in https://github.com/meshtastic/firmware/pull/8089\r\n- tlora-pager wake on button, and kb backlight toggling by @jp-bennett in https://github.com/meshtastic/firmware/pull/8090\r\n- Try-fix: Unstick that PhoneAPI state by @thebentern in https://github.com/meshtastic/firmware/pull/8091\r\n- Also pull a deviceID from esp32c6 devices by @jp-bennett in https://github.com/meshtastic/firmware/pull/8092\r\n- Clear last toradio on BLE disconnect by @thebentern in https://github.com/meshtastic/firmware/pull/8095\r\n\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.7.9.70724be...v2.7.10.94d4bdf"
+ },
+ {
+ "id": "v2.7.9.70724be",
+ "title": "Meshtastic Firmware 2.7.9.70724be Alpha",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.7.9.70724be",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.7.9.70724be/firmware-esp32-2.7.9.70724be.zip",
+ "release_notes": "## 🚀 What's Changed\r\n* Add support for new ESP32 DIY variant 9m2ibr_aprs_lora_tracker by @ndoo in https://github.com/meshtastic/firmware/pull/7828\r\n* T-Lora Pager: Fix keyboard and improve rotary wheel haptic by @mverch67 in https://github.com/meshtastic/firmware/pull/7869\r\n* Fix esptool detection and baud rate issues in Windows batch scripts by @jeremiah-k in https://github.com/meshtastic/firmware/pull/7856\r\n* Upon receiving ACK/reply directly, only update next-hop if we’re the *sole* relayer by @GUVWAF in https://github.com/meshtastic/firmware/pull/7859\r\n* Fix merge conflict with test changes by @fifieldt in https://github.com/meshtastic/firmware/pull/7902\r\n* Fix: RotaryEncoder uninitialized kbchar by @mverch67 in https://github.com/meshtastic/firmware/pull/7889\r\n* Chore(deps): update meshtastic/device-ui digest to 233d18e by @renovate[bot] in https://github.com/meshtastic/firmware/pull/7890\r\n* Reorganize 8MB partition for MUI devices by @mverch67 in https://github.com/meshtastic/firmware/pull/7860\r\n* Chore(deps): update meshtastic/device-ui digest to 3677476 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/7925\r\n* Disable ATAK Plugin module for non-TAK roles by @thebentern in https://github.com/meshtastic/firmware/pull/7928\r\n* Use char buffer for probeResponse by @thebentern in https://github.com/meshtastic/firmware/pull/7870\r\n* Make phone queues use a static pointer queue by @thebentern in https://github.com/meshtastic/firmware/pull/7919\r\n* Add LOG_HEAP log type, and more heap debug messages by @jp-bennett in https://github.com/meshtastic/firmware/pull/7937\r\n* Unify build epoch to add flag in platformio-custom.py by @thebentern in https://github.com/meshtastic/firmware/pull/7917\r\n* Put guards in place around debug heap operations by @thebentern in https://github.com/meshtastic/firmware/pull/7955\r\n* Static memory pool allocation by @thebentern in https://github.com/meshtastic/firmware/pull/7966\r\n* Update meshtastic-esp8266-oled-ssd1306 digest to 0cbc26b by @renovate[bot] in https://github.com/meshtastic/firmware/pull/7977\r\n* Fix json report crashes on esp32 by @thebentern in https://github.com/meshtastic/firmware/pull/7978\r\n* Scale probe buffer size based on current baud rate by @thebentern in https://github.com/meshtastic/firmware/pull/7975\r\n* Fix overflow of time value by @thebentern in https://github.com/meshtastic/firmware/pull/7984\r\n\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.7.8.a0c0388...v2.7.9.70724be"
+ },
+ {
+ "id": "v2.7.7.5ae4ff9",
+ "title": "Meshtastic Firmware 2.7.7.5ae4ff9 Alpha",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.7.7.5ae4ff9",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.7.7.5ae4ff9/firmware-esp32-2.7.7.5ae4ff9.zip",
+ "release_notes": "## What's Changed\r\n* Only send Neighbours if we have some to send. by @fifieldt in https://github.com/meshtastic/firmware/pull/7493\r\n* Fix freetext hang by @thebentern in https://github.com/meshtastic/firmware/pull/7781\r\n* Update protobufs and classes by @github-actions[bot] in https://github.com/meshtastic/firmware/pull/7784\r\n* We don't gotTime if time is 2019. by @fifieldt in https://github.com/meshtastic/firmware/pull/7772\r\n* Can't trust RTCs to tell the time. by @fifieldt in https://github.com/meshtastic/firmware/pull/7779\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.7.6.834c3c5...v2.7.7.5ae4ff9"
+ },
+ {
+ "id": "v2.7.6.834c3c5",
+ "title": "Meshtastic Firmware 2.7.6.834c3c5 Alpha",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.7.6.834c3c5",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.7.6.834c3c5/firmware-esp32-2.7.6.834c3c5.zip",
+ "release_notes": "## 🚀 Enhancements\r\n* Add onboard message for devices with screens by @jp-bennett in https://github.com/meshtastic/firmware/pull/7655\r\n* Only gate PKC behind the simradio CLI flag by @jp-bennett in https://github.com/meshtastic/firmware/pull/7681\r\n* Add SDL option to BaseUI on Native by @jp-bennett in https://github.com/meshtastic/firmware/pull/7568\r\n* Initial stab at rak6421 autoconf by @jp-bennett in https://github.com/meshtastic/firmware/pull/7691\r\n* Update meshtastic/device-ui digest to 3dc7cf3 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/7698\r\n* Support for T-Echo Lite, credits to @Szetya for doing all the heavy lifting! by @caveman99 in https://github.com/meshtastic/firmware/pull/7636\r\n* Add more text message test cases for meshpacket serializer by @TN666 in https://github.com/meshtastic/firmware/pull/7709\r\n* Initial attempt to get rfswitch working on Portduino by @jp-bennett in https://github.com/meshtastic/firmware/pull/7663\r\n* Don't update the NodeDB if the nodeinfo has a mismatching public key by @jp-bennett in https://github.com/meshtastic/firmware/pull/7652\r\n* Add BaseUI support for L1 EInk by @thebentern in https://github.com/meshtastic/firmware/pull/7751\r\n* Mesh solar integration by @thebentern in https://github.com/meshtastic/firmware/pull/7764\r\n\r\n## 🐛 Bug fixes and maintenance\r\n* Fix 'buildroot' compiles (OpenWRT) by @vidplace7 in https://github.com/meshtastic/firmware/pull/7620\r\n* Fix: apply 180 degree hw rotation for Indicator BaseUI by @mverch67 in https://github.com/meshtastic/firmware/pull/7660\r\n* Update platform-native digest to cd32f4e by @renovate[bot] in https://github.com/meshtastic/firmware/pull/7662\r\n* Move heartbeat response before !available guard. by @jake-b in https://github.com/meshtastic/firmware/pull/7672\r\n* Docker: fix web assets location by @vidplace7 in https://github.com/meshtastic/firmware/pull/7683\r\n* Update meshtastic-esp8266-oled-ssd1306 diges\r\n* Docker: Update Debian images to trixie by @vidplace7 in https://github.com/meshtastic/firmware/pull/7621\r\n* Fix Tracerouter warnings by @thebentern in https://github.com/meshtastic/firmware/pull/7637\r\n* Don't include OLED fonts for international character sets by default by @thebentern in https://github.com/meshtastic/firmware/pull/7639\r\n* Fix marking LoRa transport mechanism by @GUVWAF in https://github.com/meshtastic/firmware/pull/7634\r\n* Thinknode button and backlight fixes by @jp-bennett in https://github.com/meshtastic/firmware/pull/7641\r\n* Update protobufs and classes by @github-actions[bot] in https://github.com/meshtastic/firmware/pull/7647\r\n* Remove JSON serialization from most NRF52 targets by @thebentern in https://github.com/meshtastic/firmware/pull/7640\r\n* Wait for lead up before enable longlong action by @jp-bennett in https://github.com/meshtastic/firmware/pull/7648\r\nt to 9573abb by @renovate[bot] in https://github.com/meshtastic/firmware/pull/7686\r\n* Update meshtastic/device-ui digest to 8f5094b by @renovate[bot] in https://github.com/meshtastic/firmware/pull/7633\r\n* Update caveman99-stm32-Crypto digest to 1aa30eb by @renovate[bot] in https://github.com/meshtastic/firmware/pull/7725\r\n* Renovate: Always use `master` as the base. by @vidplace7 in https://github.com/meshtastic/firmware/pull/7726\r\n* PKC fix by @jp-bennett in https://github.com/meshtastic/firmware/pull/7722\r\n* T-Lora Pager by @mverch67 in https://github.com/meshtastic/firmware/pull/7613\r\n* Fix: enable device telemetry for elecrow advanced series (MUI) by @mverch67 in https://github.com/meshtastic/firmware/pull/7757\r\n* Don't use pin 0 on RAK for input by @jp-bennett in https://github.com/meshtastic/firmware/pull/7755\r\n* Update meshtastic/device-ui digest to a3e0e1b by @renovate[bot] in https://github.com/meshtastic/firmware/pull/7766\r\n\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.7.5.ddd1499...v2.7.6.834c3c5"
+ },
+ {
+ "id": "v2.7.5.ddd1499",
+ "title": "Meshtastic Firmware 2.7.5.ddd1499 Alpha",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.7.5.ddd1499",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.7.5.ddd1499/firmware-esp32-2.7.5.ddd1499.zip",
+ "release_notes": "\r\n## 🚀 What's Changed\r\n* Reorder for correct recognition by @caveman99 in https://github.com/meshtastic/firmware/pull/7604\r\n* Stop the bleeding with malicious NodeDB overwrites by @jp-bennett in https://github.com/meshtastic/firmware/pull/7596\r\n* Chore(deps): update actions/checkout action to v5 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/7605\r\n* Mark meshPackets based on which interface received. by @jp-bennett in https://github.com/meshtastic/firmware/pull/7589\r\n* chore(deps): update actions/download-artifact action to v5 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/7559\r\n* Adding medium and large RU fonts. Fixing RU string width calculation by @mrekin in https://github.com/meshtastic/firmware/pull/7498\r\n* nRF52840 promicro deepsleep fix with some additions by @MagnusKos in https://github.com/meshtastic/firmware/pull/7407\r\n* More spoof remediation by @jp-bennett in https://github.com/meshtastic/firmware/pull/7612\r\n\r\n## New Contributors\r\n* @MagnusKos made their first contribution in https://github.com/meshtastic/firmware/pull/7407\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.7.4.c1f4f79...v2.7.5.ddd1499"
+ },
+ {
+ "id": "v2.7.4.c1f4f79",
+ "title": "Meshtastic Firmware 2.7.4.c1f4f79 Alpha",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.7.4.c1f4f79",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.7.4.c1f4f79/firmware-esp32-2.7.4.c1f4f79.zip",
+ "release_notes": "## 🚀 Enhancements\r\n* Unify the shutdown proceedure by @jp-bennett in https://github.com/meshtastic/firmware/pull/7393\r\n* T-Deck Pro support by @mverch67 in https://github.com/meshtastic/firmware/pull/6936\r\n* Text message rate limiting should return routing error instead by @thebentern in https://github.com/meshtastic/firmware/pull/7365\r\n* WashTastic variant by @valzzu in https://github.com/meshtastic/firmware/pull/7450\r\n* Set canned_message.enabled to true when setting defaults by @jp-bennett in https://github.com/meshtastic/firmware/pull/7414\r\n* Add Trace Route on BaseUI by @whywilson in https://github.com/meshtastic/firmware/pull/7386\r\n* Add BRT3 timezone option to TZPicker menu by @barbabarros in https://github.com/meshtastic/firmware/pull/7438\r\n* Set firmware edition (for events) from userprefs by @thebentern in https://github.com/meshtastic/firmware/pull/7488\r\n* Heartbeat response by @thebentern in https://github.com/meshtastic/firmware/pull/7506\r\n* Airoha GPS - ignore estimated fixes by @fifieldt in https://github.com/meshtastic/firmware/pull/7429\r\n* [7353] Add all telemetry fields to json output by @rradillen in https://github.com/meshtastic/firmware/pull/7363\r\n* Event mode - limit smart position updates to at most every 5m by @powersjcb in https://github.com/meshtastic/firmware/pull/7505\r\n* Move BLE toggle menu option and add confirmation for canned messages in L1 by @thebentern in https://github.com/meshtastic/firmware/pull/7516\r\n* Initial support for the ThinkNode M5 by @jp-bennett in https://github.com/meshtastic/firmware/pull/7502\r\n\r\n## 🐛 Bug fixes and maintenace\r\n* ESP32: Initial sort variants by platform by @vidplace7 in https://github.com/meshtastic/firmware/pull/7340\r\n* ESP32c3: Migrate variants to new structure by @vidplace7 in https://github.com/meshtastic/firmware/pull/7342\r\n* Misc cppcheck fixes by @jp-bennett in https://github.com/meshtastic/firmware/pull/7370\r\n* RP2040/RP2350: Migrate variants to new structure by @vidplace7 in https://github.com/meshtastic/firmware/pull/7345\r\n* STM32: Migrate variants to new structure by @vidplace7 in https://github.com/meshtastic/firmware/pull/7389\r\n* UDP for RAK4631 Eth Gw and the t-eth-elite. Solves #7149 by @caveman99 in https://github.com/meshtastic/firmware/pull/7385\r\n* Restore High Resolution Hour Hand by @Xaositek in https://github.com/meshtastic/firmware/pull/7392\r\n* Fix UDP builds on nRF by @caveman99 in https://github.com/meshtastic/firmware/pull/7394\r\n* ESP32s3: Migrate variants to new structure by @vidplace7 in https://github.com/meshtastic/firmware/pull/7343\r\n* ARCH_STM32*WL* by @vidplace7 in https://github.com/meshtastic/firmware/pull/7397\r\n* Actions: pull_request_target is fun by @vidplace7 in https://github.com/meshtastic/firmware/pull/7398\r\n* Renovate: Use github-tags for XPowersLib updates by @vidplace7 in https://github.com/meshtastic/firmware/pull/7411\r\n* nRF52840: Migrate variants to new structure by @vidplace7 in https://github.com/meshtastic/firmware/pull/7396\r\n* Migrate remaining variants to new dir structure by @vidplace7 in https://github.com/meshtastic/firmware/pull/7412\r\n* Moves the shutdown thread into the Power class, make shutdown and reboot private by @jp-bennett in https://github.com/meshtastic/firmware/pull/7415\r\n* Upgrade trunk by @github-actions[bot] in https://github.com/meshtastic/firmware/pull/7420\r\n* Add a verbose mode flag to meshtasticd by @jp-bennett in https://github.com/meshtastic/firmware/pull/7416\r\n* Update protobufs and classes by @github-actions[bot] in https://github.com/meshtastic/firmware/pull/7422\r\n* AG3335 GPS: Use NAVIC in India/Nepal, L1+L5 elsewhere. by @fifieldt in https://github.com/meshtastic/firmware/pull/7413\r\n* Use platformio-core to build the matrix by @vidplace7 in https://github.com/meshtastic/firmware/pull/7424\r\n* Deprecate disable_triple_click config by @jp-bennett in https://github.com/meshtastic/firmware/pull/7425\r\n* Update meshtastic/device-ui digest to c75d545 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/7435\r\n* Add Nepal 865 MHz to 868 MHz by @WOD-MN in https://github.com/meshtastic/firmware/pull/7380\r\n* Add BR_902, Brazil 902MHz-907.5MHz by @fifieldt in https://github.com/meshtastic/firmware/pull/7399\r\n* Add NP_865 and BR_902 to region picker by @barbabarros in https://github.com/meshtastic/firmware/pull/7434\r\n* Actions: Combine embedded builds // split by variant subdir by @vidplace7 in https://github.com/meshtastic/firmware/pull/7417\r\n* Take control of our PRs! by @vidplace7 in https://github.com/meshtastic/firmware/pull/7445\r\n* Fix timezone definition for UTC in TZPicker function by @barbabarros in https://github.com/meshtastic/firmware/pull/7442\r\n* Fix MHz label by @Xaositek in https://github.com/meshtastic/firmware/pull/7455\r\n* Build RP2350 (Pi Pico 2) by @vidplace7 in https://github.com/meshtastic/firmware/pull/7441\r\n* Actions: Enforce PR labels by @vidplace7 in https://github.com/meshtastic/firmware/pull/7379\r\n* Rename Platformio.ini to platformio.ini | WashTastic by @valzzu in https://github.com/meshtastic/firmware/pull/7468\r\n* Fix MQTT config bugs by @thebentern in https://github.com/meshtastic/firmware/pull/7446\r\n* Clear position on GPS deactivation, unless using fixed position by @fifieldt in https://github.com/meshtastic/firmware/pull/7464\r\n* Validate Serial config console override modes by @thebentern in https://github.com/meshtastic/firmware/pull/7470\r\n* Bugfix Add rssi and snr to the store and forward code. by @mikecarper in https://github.com/meshtastic/firmware/pull/7462\r\n* Santa may be checking his list twice, but we only need this in the platformio.ini by @caveman99 in https://github.com/meshtastic/firmware/pull/7490\r\n* NodeDB count on MyNodeInfo for client progress reporting by @thebentern in https://github.com/meshtastic/firmware/pull/7489\r\n* Core portnums rebroadcast mode whitelist instead of blacklist by @thebentern in https://github.com/meshtastic/firmware/pull/7487\r\n* DEBUG_MUTE correctness by @Stary2001 in https://github.com/meshtastic/firmware/pull/7492\r\n* Workaround Webserver needing to stay up while Wifi is being turned off by @fifieldt in https://github.com/meshtastic/firmware/pull/7484\r\n* Update platformio/ststm32 to v19.3.0 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/7512\r\n* Bugfix Syntax error: \"(\" unexpected in device-update.sh by @mikecarper in https://github.com/meshtastic/firmware/pull/7514\r\n* Remember destination fix by @HarukiToreda in https://github.com/meshtastic/firmware/pull/7427\r\n* Rv3028 rtc fix by @tg-mw in https://github.com/meshtastic/firmware/pull/7524\r\n* Only toggle screen wake, don't break banners by @Xaositek in https://github.com/meshtastic/firmware/pull/7545\r\n* Improve words within logging for onscreen message scroll cache by @Xaositek in https://github.com/meshtastic/firmware/pull/7548\r\n* Fix: ina226 was not calibrated during init by @mrab in https://github.com/meshtastic/firmware/pull/7547\r\n* Rather than mysteriously rebooting, regenerate the keys and inform the user by @jp-bennett in https://github.com/meshtastic/firmware/pull/7558\r\n* Avoid acquiring lock twice by @oscgonfer in https://github.com/meshtastic/firmware/pull/7555\r\n* Chore(deps): update adafruit shtc3 to v1.0.2 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/7557\r\n* Fix a crash on Native reboot by @jp-bennett in https://github.com/meshtastic/firmware/pull/7570\r\n* chore(deps): update meshtastic/device-ui digest to d044c01 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/7578\r\n\r\n## New Contributors\r\n* @WOD-MN made their first contribution in https://github.com/meshtastic/firmware/pull/7380\r\n* @barbabarros made their first contribution in https://github.com/meshtastic/firmware/pull/7434\r\n* @valzzu made their first contribution in https://github.com/meshtastic/firmware/pull/7450\r\n* @mikecarper made their first contribution in https://github.com/meshtastic/firmware/pull/7462\r\n* @rradillen made their first contribution in https://github.com/meshtastic/firmware/pull/7363\r\n* @powersjcb made their first contribution in https://github.com/meshtastic/firmware/pull/7505\r\n* @tg-mw made their first contribution in https://github.com/meshtastic/firmware/pull/7524\r\n* @mrab made their first contribution in https://github.com/meshtastic/firmware/pull/7547\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.7.3.cf574c7...v2.7.4.c1f4f79"
+ },
+ {
+ "id": "v2.7.3.cf574c7",
+ "title": "Meshtastic Firmware 2.7.3.cf574c7 Alpha",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.7.3.cf574c7",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.7.3.cf574c7/firmware-esp32-2.7.3.cf574c7.zip",
+ "release_notes": "## 🚀 Enhancements\r\n* Update Screen Wake Default Behavior by @Xaositek in https://github.com/meshtastic/firmware/pull/7282\r\n* Make the shouldWake function always available, and remove the bool by @jp-bennett in https://github.com/meshtastic/firmware/pull/7300\r\n* Shorter audio feedback for InkHUD buttons by @todd-herbert in https://github.com/meshtastic/firmware/pull/7301\r\n* Support native configuration Waveshare Pico LoRa module on Orange Pi Zero3 by @Mictronics in https://github.com/meshtastic/firmware/pull/7295\r\n* Load ringtone from userPrefs by @vidplace7 in https://github.com/meshtastic/firmware/pull/7298\r\n* Seesaw Rotary by @jp-bennett in https://github.com/meshtastic/firmware/pull/7310\r\n* GPS for STM32WL by @Stary2001 in https://github.com/meshtastic/firmware/pull/7297\r\n* Feat: add support for RAK Wismesh Tag hardware platform by @DanielCao0 in https://github.com/meshtastic/firmware/pull/6853\r\n* Message frame New Message Options and Clock / TDeck / Brightness Refinements by @Xaositek in https://github.com/meshtastic/firmware/pull/7344\r\n* BaseUI Updates by @Xaositek in https://github.com/meshtastic/firmware/pull/7358\r\n\r\n## 🐛 Bug fixes and maintenance\r\n* Update RadioLib to v7.2.1 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/7287\r\n* Update platformio.ini by @Kongduino in https://github.com/meshtastic/firmware/pull/7289\r\n* Update Adafruit BusIO to v1.17.2 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/7277\r\n* Update dorny/test-reporter action to v2.1.1 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/7284\r\n* Update meshtastic/device-ui digest to 404c6e0 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/7302\r\n* Add first config override for Native by @jp-bennett in https://github.com/meshtastic/firmware/pull/7306\r\n* Update meshtastic/device-ui digest to 86a09a7 by @renovate[bot] in https://github.com/meshtastic/firmware/pull/7308\r\n* STM32: Properly ignore OneButton by @vidplace7 in https://github.com/meshtastic/firmware/pull/7311\r\n* Build: Update platformio with `pkg install` by @vidplace7 in https://github.com/meshtastic/firmware/pull/7315\r\n* Bump Framework-native and set version string. by @jp-bennett in https://github.com/meshtastic/firmware/pull/7317\r\n* userPrefs: Set default ringtone nag time by @vidplace7 in https://github.com/meshtastic/firmware/pull/7314\r\n* Remove Ubuntu oracular by @vidplace7 in https://github.com/meshtastic/firmware/pull/7322\r\n* feat: DIY Seeed XIAO nRF52840 + EBYTE E22 variants, pin-compatible with Wio-SX1262 kit by @ndoo in https://github.com/meshtastic/firmware/pull/7105\r\n* feat: New variant esp32c3_super_mini by @ndoo in https://github.com/meshtastic/firmware/pull/7133\r\n* xiao_ble README.md updates by @ndoo in https://github.com/meshtastic/firmware/pull/7283\r\n* fix(device-update.sh): safely filter args without breaking parsing by @NeilHanlon in https://github.com/meshtastic/firmware/pull/7305\r\n* NodeDB.cpp: Fix iOS bluetooth crash by ensuring UINT32_MAX is not used by @Styne13 in https://github.com/meshtastic/firmware/pull/7312\r\n* Improve OLED UI Responsiveness and Force Redraws for Canned message module by @csrutil in https://github.com/meshtastic/firmware/pull/7324\r\n* add pioenv to version string in debug log by @caveman99 in https://github.com/meshtastic/firmware/pull/7328\r\n* PPA: Add Ubuntu Questing (25.10) to daily builds by @vidplace7 in https://github.com/meshtastic/firmware/pull/7329\r\n* get git url part from local repo by @caveman99 in https://github.com/meshtastic/firmware/pull/7331\r\n* Add heap info via standard mallinfo() function for STM32 by @Stary2001 in https://github.com/meshtastic/firmware/pull/7327\r\n* The screen display of the heltec wireless tracker is abnormal. by @Quency-D in https://github.com/meshtastic/firmware/pull/7337\r\n* STM32 PlatformIO cleanup by @vidplace7 in https://github.com/meshtastic/firmware/pull/7339\r\n* Map report should work over devices which do not have network hardware (with client proxy) by @thebentern in https://github.com/meshtastic/firmware/pull/7341\r\n* Fix L1 EInk HWModel by @thebentern in https://github.com/meshtastic/firmware/pull/7346\r\n* Drop NodeInfo packets if the is_licensed bit doesn't match owner by @jp-bennett in https://github.com/meshtastic/firmware/pull/7361\r\n* Clean up double i2c init/scan code by @caveman99 in https://github.com/meshtastic/firmware/pull/7359\r\n* Add additional Epoch check for time set by @fifieldt in https://github.com/meshtastic/firmware/pull/7375\r\n\r\n## New Contributors\r\n* @NeilHanlon made their first contribution in https://github.com/meshtastic/firmware/pull/7305\r\n* @Styne13 made their first contribution in https://github.com/meshtastic/firmware/pull/7312\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.7.2.f6d3782...v2.7.3.cf574c7"
+ },
+ {
+ "id": "v2.7.2.f6d3782",
+ "title": "Meshtastic Firmware 2.7.2.f6d3782 Alpha",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.7.2.f6d3782",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.7.2.f6d3782/firmware-esp32-2.7.2.f6d3782.zip",
+ "release_notes": "## 🚀 Enhancements\r\n* Fast fix, remove saving tx power inside limitPower() by @mrekin in https://github.com/meshtastic/firmware/pull/7255\r\n* Show user which Clock Face option is currently elected by @Xaositek in https://github.com/meshtastic/firmware/pull/7271\r\n* Heltec Wireless Paper, VM-E213 Hardware Revisions by @todd-herbert in https://github.com/meshtastic/firmware/pull/7258\r\n\r\n## 🐛 Bug fixes and maintenance\r\n* Add HWIDs for T1000-E in DFU mode by @thebentern in https://github.com/meshtastic/firmware/pull/7235\r\n* chore(deps): update meshtastic/device-ui digest to 8c7092c by @renovate in https://github.com/meshtastic/firmware/pull/7238\r\n* Automatically bail user out of displaymode_color when not HAS_TFT by @jp-bennett in https://github.com/meshtastic/firmware/pull/7248\r\n* Don't run bluetooth gerFromRadio() unless the phone has requested a packet by @jp-bennett in https://github.com/meshtastic/firmware/pull/7231\r\n* Try-fix: L76K spamming bad times can crash nodes by @thebentern in https://github.com/meshtastic/firmware/pull/7261\r\n* Fix install script by @Pitel in https://github.com/meshtastic/firmware/pull/7259\r\n* Modules and favorite screen fix by @HarukiToreda in https://github.com/meshtastic/firmware/pull/7264\r\n* TFT_MESH Fixes Across Various Devices by @Xaositek in https://github.com/meshtastic/firmware/pull/7247\r\n* Update Bluetooth Toggle to match other variants by @Xaositek in https://github.com/meshtastic/firmware/pull/7269\r\n* Make PacketHistory logging less chatty by @thebentern in https://github.com/meshtastic/firmware/pull/7272\r\n* GitHub Actions faster!! (again) by @vidplace7 in https://github.com/meshtastic/firmware/pull/7268\r\n* Whoops! Re-Add nRF52 OTA zips by @vidplace7 in https://github.com/meshtastic/firmware/pull/7275\r\n* Actions: Re-Add nrf52 hex release (rak4631) by @vidplace7 in https://github.com/meshtastic/firmware/pull/7276\r\n* Update Adafruit INA260 to v1.5.3 by @renovate in https://github.com/meshtastic/firmware/pull/7270\r\n\r\n## New Contributors\r\n* @Pitel made their first contribution in https://github.com/meshtastic/firmware/pull/7259\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.7.1.f35ca81...v2.7.2.f6d3782"
+ },
+ {
+ "id": "v2.7.1.f35ca81",
+ "title": "Meshtastic Firmware 2.7.1.f35ca81 Alpha",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.7.1.f35ca81",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.7.1.f35ca81/firmware-esp32-2.7.1.f35ca81.zip",
+ "release_notes": "## 🚀 Enhancements\r\n* Add detection code for SCD4X by @fifieldt in https://github.com/meshtastic/firmware/pull/7185\r\n* Refactor Calibrate battery curve for TRACKER_T1000-E by @Dylanliacc in https://github.com/meshtastic/firmware/pull/7186\r\n* Add detection framework for multiple AirQuality sensors by @fifieldt in https://github.com/meshtastic/firmware/pull/7187\r\n* Log TX power after limits applyng and store it in config by @mrekin in https://github.com/meshtastic/firmware/pull/7065\r\n* Limited emoji support for InkHUD by @todd-herbert in https://github.com/meshtastic/firmware/pull/7176\r\n* Calibrate battery curve for SEEED_WIO_TRACKER_L1 and SEEED_SOLAR_NODE by @Dylanliacc in https://github.com/meshtastic/firmware/pull/7194\r\n* Enable telemetry and I2C sensors on STM32WL (except accelerometers) by @Stary2001 in https://github.com/meshtastic/firmware/pull/7008\r\n* Update protobufs and classes by @github-actions in https://github.com/meshtastic/firmware/pull/7199\r\n* Feat: add support for RAK3312 (New RAKwireless wiscore ESP32-S3 + SX1262) by @DanielCao0 in https://github.com/meshtastic/firmware/pull/7115\r\n* Added option to invert screen on InkHUD by @razurac in https://github.com/meshtastic/firmware/pull/7075\r\n* mDNS: Remove HTTP/HTTPS. Advertise shortname/id. by @vidplace7 in https://github.com/meshtastic/firmware/pull/7162\r\n* Add customizable boot logo based on resolution by @vidplace7 in https://github.com/meshtastic/firmware/pull/7146\r\n* Additional larger font for InkHUD UI by @todd-herbert in https://github.com/meshtastic/firmware/pull/7201\r\n* Add GPIO edge for Native Trackball/Joystick by @jp-bennett in https://github.com/meshtastic/firmware/pull/7212\r\n* Add ROUTER_LATE to EVENT_MODE rules by @vidplace7 in https://github.com/meshtastic/firmware/pull/7220\r\n* Honor custom userPrefs boot-screens in InkHUD by @todd-herbert in https://github.com/meshtastic/firmware/pull/7217\r\n* Battery Layout Updates and Icons Changes by @Xaositek in https://github.com/meshtastic/firmware/pull/7221\r\n* Add Kazakhstan frequencies by @fifieldt in https://github.com/meshtastic/firmware/pull/7209\r\n* Add Kazakhstan to the BaseUI LoRa chooser by @jp-bennett in https://github.com/meshtastic/firmware/pull/7224\r\n\r\n## 🐛 Bug fixes and maintenance\r\n* Last second fixes by @jp-bennett in https://github.com/meshtastic/firmware/pull/7156\r\n* Add check for theoretically impossible comparison, and drop nodenum by @jp-bennett in https://github.com/meshtastic/firmware/pull/7165\r\n* fix(xiao_ble): Define xiao_ble I2C pins in parent variant (fixes #7163) by @ndoo in https://github.com/meshtastic/firmware/pull/7164\r\n* Bump release version by @github-actions in https://github.com/meshtastic/firmware/pull/7155\r\n* chore(deps): update meshtastic/device-ui digest to 4b7bf36 by @renovate in https://github.com/meshtastic/firmware/pull/7178\r\n* Fix hydra radio by @jankowski-t in https://github.com/meshtastic/firmware/pull/7192\r\n* Fix seeed_tracker_L1_eink bug of cant't switch between two applets side-by-side by @Dylanliacc in https://github.com/meshtastic/firmware/pull/7195\r\n* Fix build when MESHTASTIC_EXCLUDE_GPS is defined by @Mictronics in https://github.com/meshtastic/firmware/pull/7154\r\n* Renovate comment for sensirion/Sensirion I2C SCD4x by @vidplace7 in https://github.com/meshtastic/firmware/pull/7202\r\n* Chore(deps): update sensirion i2c scd4x to v1.1.0 by @renovate in https://github.com/meshtastic/firmware/pull/7207\r\n* 2.7 fixes w2 by @jp-bennett in https://github.com/meshtastic/firmware/pull/7148\r\n* Fix Seeed L1 board to enable consistent PIO flashing by @thebentern in https://github.com/meshtastic/firmware/pull/7211\r\n* Don't set non-existent pin on e290 by @jp-bennett in https://github.com/meshtastic/firmware/pull/7213\r\n* Disable low brightness, as this soft-bricks at least the L1 by @jp-bennett in https://github.com/meshtastic/firmware/pull/7223\r\n* Fixed --change-mode option in device-update.sh by @mattster98 in https://github.com/meshtastic/firmware/pull/7144\r\n* chore(deps): update meshtastic-esp32_https_server digest to 3223704 by @renovate in https://github.com/meshtastic/firmware/pull/7225\r\n* Chore(deps): update xpowerslib to v0.3.0 by @renovate in https://github.com/meshtastic/firmware/pull/7210\r\n* Add a WiFi menu that can toggle back to Bluetooth by @jp-bennett in https://github.com/meshtastic/firmware/pull/7226\r\n\r\n## New Contributors\r\n* @jankowski-t made their first contribution in https://github.com/meshtastic/firmware/pull/7192\r\n* @razurac made their first contribution in https://github.com/meshtastic/firmware/pull/7075\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.7.0.705515a...v2.7.1.f35ca81"
+ },
+ {
+ "id": "v2.6.13.0561f2c",
+ "title": "Meshtastic Firmware 2.6.13.0561f2c Alpha",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.6.13.0561f2c",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.6.13.0561f2c/firmware-esp32-2.6.13.0561f2c.zip",
+ "release_notes": "> [!CAUTION] \r\n> This firmware includes built-in security which automatically removes your public key (for direct messages and remote administration) if it is included in any of the 25 known insecure keys in order to keep your communications private. \r\n\r\n## 🚀 Enhancements \r\n* PacketHistory debloat RAM allocations by @Marek-mk in https://github.com/meshtastic/firmware/pull/7034\r\n* Add recognition for SHT40 with serial number starting with 0xc8d by @notmarek in https://github.com/meshtastic/firmware/pull/7061\r\n* Add rak12035 VB Soil Monitor Tested & Working by @Justin-Mann in https://github.com/meshtastic/firmware/pull/6741\r\n* XIAO BLE cleanup (supporting changes to seeed_xiao_nrf52840_kit too) by @ndoo in https://github.com/meshtastic/firmware/pull/7024\r\n* PacketHistory - option to track entries' aging to log by @Marek-mk in https://github.com/meshtastic/firmware/pull/7067\r\n\r\n## 🐛 Bug fixes and enhancements\r\n* Fix Critical Error #3 for LilyGo T-Echo by @Logicbloke in https://github.com/meshtastic/firmware/pull/6791\r\n* Dismiss ExternalNotification nagging on InkHUD button press by @todd-herbert in https://github.com/meshtastic/firmware/pull/7056\r\n* Fix RCWL9620Sensor for rak11310 support by @Nivek-domo in https://github.com/meshtastic/firmware/pull/6617\r\n* Run daily packaging earlier (PPA) by @vidplace7 in https://github.com/meshtastic/firmware/pull/7057\r\n* Ensure incoming hostMetrics userstring is null terminated by @jp-bennett in https://github.com/meshtastic/firmware/pull/7068\r\n* Update HostMetrics.cpp - don't try to print the user string by @jp-bennett in https://github.com/meshtastic/firmware/pull/7081\r\n* Replace blocking delay for wifi reconnect with non-blocking to keep button/display interactivity by @mattster98 in https://github.com/meshtastic/firmware/pull/6983\r\n* Fix position exchange throttling issue by @jeremiah-k in https://github.com/meshtastic/firmware/pull/7079\r\n* Fix nugget s3 lora variant issues by @hafu in https://github.com/meshtastic/firmware/pull/7070\r\n\r\n## New Contributors\r\n* @Logicbloke made their first contribution in https://github.com/meshtastic/firmware/pull/6791\r\n* @Marek-mk made their first contribution in https://github.com/meshtastic/firmware/pull/7034\r\n* @notmarek made their first contribution in https://github.com/meshtastic/firmware/pull/7061\r\n* @mattster98 made their first contribution in https://github.com/meshtastic/firmware/pull/6983\r\n* @hafu made their first contribution in https://github.com/meshtastic/firmware/pull/7070\r\n* @Justin-Mann made their first contribution in https://github.com/meshtastic/firmware/pull/6741\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.6.12.9861e82...v2.6.13.0561f2c"
+ },
+ {
+ "id": "v2.6.12.9861e82",
+ "title": "Meshtastic Firmware 2.6.12.9861e82 Alpha",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.6.12.9861e82",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.6.12.9861e82/firmware-esp32-2.6.12.9861e82.zip",
+ "release_notes": "> [!CAUTION] \r\n> This firmware includes built-in security which automatically removes your public key (for direct messages and remote administration) if it is included in any of the 25 known insecure keys in order to keep your communications private. \r\n\r\n## 🚀 Enhancements \r\n* Key erase by @jp-bennett in https://github.com/meshtastic/firmware/pull/7018\r\n* Remove GPS Baudrate locking for Seeed Xiao NRF52840 Kit by @fifieldt in https://github.com/meshtastic/firmware/pull/7016\r\n* Validate short and long names so whitespace or empty names cannot be used by @Crank-Git in https://github.com/meshtastic/firmware/pull/6993\r\n* Add InkHUD driver for WeAct Studio 2.13\" display module by @todd-herbert in https://github.com/meshtastic/firmware/pull/7001\r\n* Add InkHUD driver for WeAct Studio 1.54\" display module by @todd-herbert in https://github.com/meshtastic/firmware/pull/7000\r\n* Add support for GAT562 Mesh Trial Tracker by @csrutil in https://github.com/meshtastic/firmware/pull/6984\r\n* Add config for RAK 13300 on RAK6421 by @jp-bennett in https://github.com/meshtastic/firmware/pull/7037\r\n* InkHUD DIY builds for ProMicro & Heltec T114 by @todd-herbert in https://github.com/meshtastic/firmware/pull/7039\r\n* Allow overriding INA3221 channels by @andyshinn in https://github.com/meshtastic/firmware/pull/7035\r\n* Add the ability to share ignored contacts (for blacklisting problematic nodes) by @thebentern in https://github.com/meshtastic/firmware/pull/7044\r\n\r\n## 🐛 Bug fixes and maintenance\r\n* More low-entropy keys, and don't issue a false warning when changing … by @jp-bennett in https://github.com/meshtastic/firmware/pull/7041\r\n* Don't use assert() with side effects in a couple more places by @Stary2001 in https://github.com/meshtastic/firmware/pull/7009\r\n* chore(deps): update platform-native digest to 49634e9 by @renovate in https://github.com/meshtastic/firmware/pull/7020\r\n* chore(deps): update platform-native digest to 681ee02 by @renovate in https://github.com/meshtastic/firmware/pull/7022\r\n* chore(deps): update meshtastic/device-ui digest to 301f11e by @renovate in https://github.com/meshtastic/firmware/pull/7042\r\n* Upgrade trunk by @github-actions in https://github.com/meshtastic/firmware/pull/7030\r\n* Update protobufs and classes by @github-actions in https://github.com/meshtastic/firmware/pull/7043\r\n* Manual bump metainfo version by @vidplace7 in https://github.com/meshtastic/firmware/pull/7049\r\n\r\n## New Contributors\r\n* @csrutil made their first contribution in https://github.com/meshtastic/firmware/pull/6984\r\n* @andyshinn made their first contribution in https://github.com/meshtastic/firmware/pull/7035\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.6.11.60ec05e...v2.6.12.9861e82"
+ },
+ {
+ "id": "v2.6.9.f223b8a",
+ "title": "Meshtastic Firmware 2.6.9.f223b8a Alpha",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.6.9.f223b8a",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.6.9.f223b8a/firmware-esp32-2.6.9.f223b8a.zip",
+ "release_notes": "\r\n## Enhancements\r\n* Stop the madness! Run as a user (not root) by @vidplace7 in https://github.com/meshtastic/firmware/pull/6718\r\n* Host metrics by @jp-bennett in https://github.com/meshtastic/firmware/pull/6817\r\n* Hostmetrics user string by @jp-bennett in https://github.com/meshtastic/firmware/pull/6850\r\n* Add basic handling for is_manually_validated by @jp-bennett in https://github.com/meshtastic/firmware/pull/6856\r\n* If a contact is add from a QR, it's \"verified\" manually by @thebentern in https://github.com/meshtastic/firmware/pull/6858\r\n* InkHUD Extended ASCII by @todd-herbert in https://github.com/meshtastic/firmware/pull/6768\r\n* Added map report precision bounds by @thebentern in https://github.com/meshtastic/firmware/pull/6862\r\n* Update Adafruit PM25 AQI Sensor to v2 by @renovate in https://github.com/meshtastic/firmware/pull/6778\r\n* Add PCT2075 Temperature Sensor by @mich181189 in https://github.com/meshtastic/firmware/pull/6829\r\n* Add heap metrics to Local stats by @thebentern in https://github.com/meshtastic/firmware/pull/6887\r\n* Feat(RadioInterface): Tx power gain calculation rework by @ndoo in https://github.com/meshtastic/firmware/pull/6796\r\n\r\n## Bug fixes and maintenance\r\n* Remove compass boot calibration by @jp-bennett in https://github.com/meshtastic/firmware/pull/6825\r\n* Update dorny/test-reporter action to v2.1.0 by @renovate in https://github.com/meshtastic/firmware/pull/6833\r\n* Fix for ICM-20948 not initializing by @HarukiToreda in https://github.com/meshtastic/firmware/pull/6827\r\n* Graphics: Add GDEY0213B74 E-Ink display driver by @chihosin in https://github.com/meshtastic/firmware/pull/6879\r\n* chore(deps): update meshtastic/device-ui digest to e63b219 by @renovate in https://github.com/meshtastic/firmware/pull/6883\r\n* Fix is_unmessagable plumbing by @thebentern in https://github.com/meshtastic/firmware/pull/6886\r\n* InkHUD: add missing parsing of UTF-8 chars by @todd-herbert in https://github.com/meshtastic/firmware/pull/6889\r\n* Update seeed solar node led pin by @Dylanliacc in https://github.com/meshtastic/firmware/pull/6871\r\n* Bosch bsec2: Switch back to official releases by @vidplace7 in https://github.com/meshtastic/firmware/pull/6870\r\n\r\n## New Contributors\r\n* @chihosin made their first contribution in https://github.com/meshtastic/firmware/pull/6879\r\n* @mich181189 made their first contribution in https://github.com/meshtastic/firmware/pull/6829\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.6.8.ef9d0d7...v2.6.9.f223b8a"
+ },
+ {
+ "id": "v2.6.8.ef9d0d7",
+ "title": "Meshtastic Firmware 2.6.8.ef9d0d7 Alpha",
+ "page_url": "https://github.com/meshtastic/firmware/releases/tag/v2.6.8.ef9d0d7",
+ "zip_url": "https://github.com/meshtastic/firmware/releases/download/v2.6.8.ef9d0d7/firmware-esp32-2.6.8.ef9d0d7.zip",
+ "release_notes": "## 🚀 Enhancements\r\n* 20948 compass support by @jp-bennett in https://github.com/meshtastic/firmware/pull/6707\r\n* Update XIAO_NRF_KIT RXEN Pin definition by @NomDeTom in https://github.com/meshtastic/firmware/pull/6717\r\n* Add client notification before role based power saving (sleep) by @thebentern in https://github.com/meshtastic/firmware/pull/6759\r\n* Actions: Fix end to end tests by @vidplace7 in https://github.com/meshtastic/firmware/pull/6776\r\n* Add clarifying note about AHT20 also being included with AHT10 library by @NomDeTom in https://github.com/meshtastic/firmware/pull/6787\r\n* Only send nodes on want_config of 69421 by @thebentern in https://github.com/meshtastic/firmware/pull/6792\r\n* Add contact admin message (for QR code) by @thebentern in https://github.com/meshtastic/firmware/pull/6806\r\n* Crowpanel 4.3, 5.0, 7.0 support by @caveman99 in https://github.com/meshtastic/firmware/pull/6611\r\n* MQTT userprefs by @vidplace7 in https://github.com/meshtastic/firmware/pull/6802\r\n* Unmessagable implementation and defaults by @thebentern in https://github.com/meshtastic/firmware/pull/6811\r\n* Added new map report opt-in for compliance and limit map report (and default) to one hour by @thebentern in https://github.com/meshtastic/firmware/pull/6813\r\n* chore(deps): update meshtastic/device-ui digest to 35576e1 by @renovate in https://github.com/meshtastic/firmware/pull/6747\r\n\r\n\r\n## 🐛 Bug fixes and maintenance\r\n* Renovate: fix device-ui match (tiny fix) by @vidplace7 in https://github.com/meshtastic/firmware/pull/6748\r\n* Add some no-nonsense coercion for self-reporting node values by @thebentern in https://github.com/meshtastic/firmware/pull/6793\r\n* Device-install.sh: detect t-eth-elite as s3 device by @chri2 in https://github.com/meshtastic/firmware/pull/6767\r\n* Fixes BUG #6243 by @Richard3366 in https://github.com/meshtastic/firmware/pull/6781\r\n* Update Seeed Solar Node by @rcarteraz in https://github.com/meshtastic/firmware/pull/6763\r\n* Protect T-Echo's touch button against phantom presses in OLED UI by @todd-herbert in https://github.com/meshtastic/firmware/pull/6735\r\n* Don't run `test-native` for event firmwares by @vidplace7 in https://github.com/meshtastic/firmware/pull/6749\r\n* Fix EVENT_MODE on mqttless targets by @vidplace7 in https://github.com/meshtastic/firmware/pull/6750\r\n* Fix event templates (names, PSKs) by @vidplace7 in https://github.com/meshtastic/firmware/pull/6753\r\n* Add suppport for Quectel L80 by @fifieldt in https://github.com/meshtastic/firmware/pull/6803\r\n\r\n## New Contributors\r\n* @chri2 made their first contribution in https://github.com/meshtastic/firmware/pull/6767\r\n* @Richard3366 made their first contribution in https://github.com/meshtastic/firmware/pull/6781\r\n\r\n**Full Changelog**: https://github.com/meshtastic/firmware/compare/v2.6.7.2d6181f...v2.6.8.ef9d0d7"
+ }
+ ]
+ },
+ "pullRequests": []
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/AppIntroduction.kt b/app/src/main/java/com/geeksville/mesh/AppIntroduction.kt
deleted file mode 100644
index f15bec7b8..000000000
--- a/app/src/main/java/com/geeksville/mesh/AppIntroduction.kt
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.geeksville.mesh
-
-import android.os.Bundle
-import androidx.core.content.edit
-import androidx.fragment.app.Fragment
-import com.geeksville.mesh.model.UIViewModel
-import com.github.appintro.AppIntro
-import com.github.appintro.AppIntroFragment
-
-class AppIntroduction : AppIntro() {
-
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- // Make sure you don't call setContentView!
-
- // Call addSlide passing your Fragments.
- // You can use AppIntroFragment to use a pre-built fragment
- addSlide(
- AppIntroFragment.createInstance(
- title = resources.getString(R.string.intro_welcome),
- description = resources.getString(R.string.intro_welcome_text),
- imageDrawable = R.mipmap.ic_launcher2_round,
- backgroundColorRes = R.color.colourGrey,
- descriptionColorRes = R.color.colorOnPrimary
- ))
- addSlide(AppIntroFragment.createInstance(
- title = resources.getString(R.string.intro_started),
- description = resources.getString(R.string.intro_started_text),
- imageDrawable = R.drawable.icon_meanings,
- backgroundColorRes = R.color.colourGrey,
- descriptionColorRes = R.color.colorOnPrimary
- ))
- addSlide(AppIntroFragment.createInstance(
- title = resources.getString(R.string.intro_encryption),
- description = resources.getString(R.string.intro_encryption_text),
- imageDrawable = R.drawable.channel_name_image,
- backgroundColorRes = R.color.colourGrey,
- descriptionColorRes = R.color.colorOnPrimary
- ))
- //addSlide(SlideTwoFragment())
- }
-
- private fun done() {
- val prefs = UIViewModel.getPreferences(this)
- prefs.edit { putBoolean("app_intro_completed", true) }
- finish()
- }
-
- override fun onSkipPressed(currentFragment: Fragment?) {
- super.onSkipPressed(currentFragment)
- // Decide what to do when the user clicks on "Skip"
- done()
- }
-
- override fun onDonePressed(currentFragment: Fragment?) {
- super.onDonePressed(currentFragment)
- // Decide what to do when the user clicks on "Done"
- done()
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/ApplicationModule.kt b/app/src/main/java/com/geeksville/mesh/ApplicationModule.kt
deleted file mode 100644
index b84d8b553..000000000
--- a/app/src/main/java/com/geeksville/mesh/ApplicationModule.kt
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.geeksville.mesh
-
-import android.app.Application
-import android.content.Context
-import android.content.SharedPreferences
-import androidx.lifecycle.Lifecycle
-import androidx.lifecycle.LifecycleOwner
-import androidx.lifecycle.ProcessLifecycleOwner
-import dagger.Module
-import dagger.Provides
-import dagger.hilt.InstallIn
-import dagger.hilt.components.SingletonComponent
-
-@InstallIn(SingletonComponent::class)
-@Module
-object ApplicationModule {
- @Provides
- fun provideSharedPreferences(application: Application): SharedPreferences {
- return application.getSharedPreferences("ui-prefs", Context.MODE_PRIVATE)
- }
-
- @Provides
- fun provideProcessLifecycleOwner(): LifecycleOwner {
- return ProcessLifecycleOwner.get()
- }
-
- @Provides
- fun provideProcessLifecycle(processLifecycleOwner: LifecycleOwner): Lifecycle {
- return processLifecycleOwner.lifecycle
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/CoroutineDispatchers.kt b/app/src/main/java/com/geeksville/mesh/CoroutineDispatchers.kt
deleted file mode 100644
index 9922b19eb..000000000
--- a/app/src/main/java/com/geeksville/mesh/CoroutineDispatchers.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.geeksville.mesh
-
-import kotlinx.coroutines.Dispatchers
-import javax.inject.Inject
-
-/**
- * Wrapper around `Dispatchers` to allow for easier testing when using dispatchers
- * in injected classes.
- */
-class CoroutineDispatchers @Inject constructor() {
- val main = Dispatchers.Main
- val mainImmediate = Dispatchers.Main.immediate
- val default = Dispatchers.Default
- val io = Dispatchers.IO
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/DataPacket.kt b/app/src/main/java/com/geeksville/mesh/DataPacket.kt
deleted file mode 100644
index 556987dfc..000000000
--- a/app/src/main/java/com/geeksville/mesh/DataPacket.kt
+++ /dev/null
@@ -1,161 +0,0 @@
-package com.geeksville.mesh
-
-import android.os.Parcel
-import android.os.Parcelable
-import kotlinx.parcelize.Parcelize
-import kotlinx.serialization.Serializable
-
-@Parcelize
-enum class MessageStatus : Parcelable {
- UNKNOWN, // Not set for this message
- RECEIVED, // Came in from the mesh
- QUEUED, // Waiting to send to the mesh as soon as we connect to the device
- ENROUTE, // Delivered to the radio, but no ACK or NAK received
- DELIVERED, // We received an ack
- ERROR // We received back a nak, message not delivered
-}
-
-/**
- * A parcelable version of the protobuf MeshPacket + Data subpacket.
- */
-@Serializable
-data class DataPacket(
- var to: String? = ID_BROADCAST, // a nodeID string, or ID_BROADCAST for broadcast
- val bytes: ByteArray?,
- val dataType: Int, // A port number for this packet (formerly called DataType, see portnums.proto for new usage instructions)
- var from: String? = ID_LOCAL, // a nodeID string, or ID_LOCAL for localhost
- var time: Long = System.currentTimeMillis(), // msecs since 1970
- var id: Int = 0, // 0 means unassigned
- var status: MessageStatus? = MessageStatus.UNKNOWN,
- var hopLimit: Int = 0,
- var channel: Int = 0, // channel index
-) : Parcelable {
-
- /**
- * If there was an error with this message, this string describes what was wrong.
- */
- var errorMessage: String? = null
-
- /**
- * Syntactic sugar to make it easy to create text messages
- */
- constructor(to: String?, channel: Int, text: String) : this(
- to = to,
- bytes = text.encodeToByteArray(),
- dataType = Portnums.PortNum.TEXT_MESSAGE_APP_VALUE,
- channel = channel
- )
-
- /**
- * If this is a text message, return the string, otherwise null
- */
- val text: String?
- get() = if (dataType == Portnums.PortNum.TEXT_MESSAGE_APP_VALUE)
- bytes?.decodeToString()
- else
- null
-
- val waypoint: MeshProtos.Waypoint?
- get() = if (dataType == Portnums.PortNum.WAYPOINT_APP_VALUE)
- MeshProtos.Waypoint.parseFrom(bytes)
- else
- null
-
- // Autogenerated comparision, because we have a byte array
-
- constructor(parcel: Parcel) : this(
- parcel.readString(),
- parcel.createByteArray(),
- parcel.readInt(),
- parcel.readString(),
- parcel.readLong(),
- parcel.readInt(),
- parcel.readParcelable(MessageStatus::class.java.classLoader),
- parcel.readInt(),
- parcel.readInt(),
- )
-
- override fun equals(other: Any?): Boolean {
- if (this === other) return true
- if (javaClass != other?.javaClass) return false
-
- other as DataPacket
-
- if (from != other.from) return false
- if (to != other.to) return false
- if (channel != other.channel) return false
- if (time != other.time) return false
- if (id != other.id) return false
- if (dataType != other.dataType) return false
- if (!bytes!!.contentEquals(other.bytes!!)) return false
- if (status != other.status) return false
- if (hopLimit != other.hopLimit) return false
-
- return true
- }
-
- override fun hashCode(): Int {
- var result = from.hashCode()
- result = 31 * result + to.hashCode()
- result = 31 * result + time.hashCode()
- result = 31 * result + id
- result = 31 * result + dataType
- result = 31 * result + bytes!!.contentHashCode()
- result = 31 * result + status.hashCode()
- result = 31 * result + hopLimit
- result = 31 * result + channel
- return result
- }
-
- override fun writeToParcel(parcel: Parcel, flags: Int) {
- parcel.writeString(to)
- parcel.writeByteArray(bytes)
- parcel.writeInt(dataType)
- parcel.writeString(from)
- parcel.writeLong(time)
- parcel.writeInt(id)
- parcel.writeParcelable(status, flags)
- parcel.writeInt(hopLimit)
- parcel.writeInt(channel)
- }
-
- override fun describeContents(): Int {
- return 0
- }
-
- /// Update our object from our parcel (used for inout parameters
- fun readFromParcel(parcel: Parcel) {
- to = parcel.readString()
- parcel.createByteArray()
- parcel.readInt()
- from = parcel.readString()
- time = parcel.readLong()
- id = parcel.readInt()
- status = parcel.readParcelable(MessageStatus::class.java.classLoader)
- hopLimit = parcel.readInt()
- channel = parcel.readInt()
- }
-
- companion object CREATOR : Parcelable.Creator {
- // Special node IDs that can be used for sending messages
-
- /** the Node ID for broadcast destinations */
- const val ID_BROADCAST = "^all"
-
- /** The Node ID for the local node - used for from when sender doesn't know our local node ID */
- const val ID_LOCAL = "^local"
-
- /// special broadcast address
- const val NODENUM_BROADCAST = (0xffffffff).toInt()
-
- fun nodeNumToDefaultId(n: Int): String = "!%08x".format(n)
-
- override fun createFromParcel(parcel: Parcel): DataPacket {
- return DataPacket(parcel)
- }
-
- override fun newArray(size: Int): Array {
- return arrayOfNulls(size)
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/MainActivity.kt b/app/src/main/java/com/geeksville/mesh/MainActivity.kt
deleted file mode 100644
index 0eba6012a..000000000
--- a/app/src/main/java/com/geeksville/mesh/MainActivity.kt
+++ /dev/null
@@ -1,913 +0,0 @@
-package com.geeksville.mesh
-
-import android.app.Activity
-import android.bluetooth.BluetoothAdapter
-import android.content.*
-import android.content.pm.PackageInfo
-import android.content.pm.PackageManager
-import android.hardware.usb.UsbDevice
-import android.hardware.usb.UsbManager
-import android.net.Uri
-import android.os.Bundle
-import android.os.Handler
-import android.os.Looper
-import android.os.RemoteException
-import android.text.method.LinkMovementMethod
-import android.view.Menu
-import android.view.MenuItem
-import android.view.MotionEvent
-import android.widget.TextView
-import android.widget.Toast
-import androidx.activity.result.contract.ActivityResultContracts
-import androidx.activity.viewModels
-import androidx.appcompat.app.AppCompatActivity
-import androidx.appcompat.app.AppCompatDelegate
-import androidx.appcompat.widget.Toolbar
-import androidx.core.content.ContextCompat
-import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
-import androidx.fragment.app.Fragment
-import androidx.fragment.app.FragmentManager
-import androidx.fragment.app.FragmentTransaction
-import androidx.viewpager2.adapter.FragmentStateAdapter
-import com.geeksville.mesh.android.*
-import com.geeksville.mesh.concurrent.handledLaunch
-import com.geeksville.mesh.databinding.ActivityMainBinding
-import com.geeksville.mesh.model.BTScanModel
-import com.geeksville.mesh.model.BluetoothViewModel
-import com.geeksville.mesh.model.ChannelSet
-import com.geeksville.mesh.model.DeviceVersion
-import com.geeksville.mesh.model.UIViewModel
-import com.geeksville.mesh.repository.radio.BluetoothInterface
-import com.geeksville.mesh.repository.radio.RadioInterfaceService
-import com.geeksville.mesh.repository.radio.SerialInterface
-import com.geeksville.mesh.service.*
-import com.geeksville.mesh.ui.*
-import com.geeksville.mesh.util.Exceptions
-import com.geeksville.mesh.util.LanguageUtils
-import com.geeksville.mesh.util.exceptionReporter
-import com.google.android.material.dialog.MaterialAlertDialogBuilder
-import com.google.android.material.snackbar.Snackbar
-import com.google.android.material.tabs.TabLayoutMediator
-import com.suddenh4x.ratingdialog.AppRating
-import dagger.hilt.android.AndroidEntryPoint
-import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.Job
-import kotlinx.coroutines.cancel
-import java.text.DateFormat
-import java.util.Date
-import javax.inject.Inject
-
-/*
-UI design
-
-material setup instructions: https://material.io/develop/android/docs/getting-started/
-dark theme (or use system eventually) https://material.io/develop/android/theming/dark/
-
-NavDrawer is a standard draw which can be dragged in from the left or the menu icon inside the app
-title.
-
-Fragments:
-
-SettingsFragment shows "Settings"
- username
- shortname
- bluetooth pairing list
- (eventually misc device settings that are not channel related)
-
-Channel fragment "Channel"
- qr code, copy link button
- ch number
- misc other settings
- (eventually a way of choosing between past channels)
-
-ChatFragment "Messages"
- a text box to enter new texts
- a scrolling list of rows. each row is a text and a sender info layout
-
-NodeListFragment "Users"
- a node info row for every node
-
-ViewModels:
-
- BTScanModel starts/stops bt scan and provides list of devices (manages entire scan lifecycle)
-
- MeshModel contains: (manages entire service relationship)
- current received texts
- current radio macaddr
- current node infos (updated dynamically)
-
-eventually use bottom navigation bar to switch between, Members, Chat, Channel, Settings. https://material.io/develop/android/components/bottom-navigation-view/
- use numbers of # chat messages and # of members in the badges.
-
-(per this recommendation to not use top tabs: https://ux.stackexchange.com/questions/102439/android-ux-when-to-use-bottom-navigation-and-when-to-use-tabs )
-
-
-eventually:
- make a custom theme: https://github.com/material-components/material-components-android/tree/master/material-theme-builder
-*/
-
-@AndroidEntryPoint
-class MainActivity : AppCompatActivity(), Logging {
-
- private lateinit var binding: ActivityMainBinding
-
- // Used to schedule a coroutine in the GUI thread
- private val mainScope = CoroutineScope(Dispatchers.Main + Job())
-
- private val bluetoothViewModel: BluetoothViewModel by viewModels()
- private val scanModel: BTScanModel by viewModels()
- val model: UIViewModel by viewModels()
-
- @Inject
- internal lateinit var radioInterfaceService: RadioInterfaceService
-
- private val requestPermissionsLauncher =
- registerForActivityResult(ActivityResultContracts.RequestMultiplePermissions()) { permissions ->
- if (!permissions.entries.all { it.value }) {
- errormsg("User denied permissions")
- showSnackbar(permissionMissing)
- }
- requestedEnable = false
- bluetoothViewModel.permissionsUpdated()
- }
-
- data class TabInfo(val text: String, val icon: Int, val content: Fragment)
-
- // private val tabIndexes = generateSequence(0) { it + 1 } FIXME, instead do withIndex or zip? to get the ids below, also stop duplicating strings
- private val tabInfos = arrayOf(
- TabInfo(
- "Messages",
- R.drawable.ic_twotone_message_24,
- ContactsFragment()
- ),
- TabInfo(
- "Users",
- R.drawable.ic_twotone_people_24,
- UsersFragment()
- ),
- TabInfo(
- "Map",
- R.drawable.ic_twotone_map_24,
- MapFragment()
- ),
- TabInfo(
- "Channel",
- R.drawable.ic_twotone_contactless_24,
- ChannelFragment()
- ),
- TabInfo(
- "Settings",
- R.drawable.ic_twotone_settings_applications_24,
- SettingsFragment()
- )
- )
-
- private val tabsAdapter = object : FragmentStateAdapter(this) {
-
- override fun getItemCount(): Int = tabInfos.size
-
- override fun createFragment(position: Int): Fragment {
- // Return a NEW fragment instance in createFragment(int)
- /*
- fragment.arguments = Bundle().apply {
- // Our object is just an integer :-P
- putInt(ARG_OBJECT, position + 1)
- } */
- return tabInfos[position].content
- }
- }
-
- /// Ask user to rate in play store
- private fun askToRate() {
- exceptionReporter { // we don't want to crash our app because of bugs in this optional feature
- AppRating.Builder(this)
- .setMinimumLaunchTimes(10) // default is 5, 3 means app is launched 3 or more times
- .setMinimumDays(10) // default is 5, 0 means install day, 10 means app is launched 10 or more days later than installation
- .setMinimumLaunchTimesToShowAgain(5) // default is 5, 1 means app is launched 1 or more times after neutral button clicked
- .setMinimumDaysToShowAgain(14) // default is 14, 1 means app is launched 1 or more days after neutral button clicked
- .showIfMeetsConditions()
- }
- }
-
- private val isInTestLab: Boolean by lazy {
- (application as GeeksvilleApplication).isInTestLab
- }
-
- override fun onCreate(savedInstanceState: Bundle?) {
- installSplashScreen()
- super.onCreate(savedInstanceState)
-
- val prefs = UIViewModel.getPreferences(this)
- if (!prefs.getBoolean("app_intro_completed", false)) {
- startActivity(Intent(this, AppIntroduction::class.java))
- }
- // First run: migrate in-app language prefs to appcompat
- if (prefs.getString("lang", LanguageUtils.SYSTEM_DEFAULT) != LanguageUtils.SYSTEM_MANAGED) {
- LanguageUtils.migrateLanguagePrefs(prefs)
- }
- info("in-app language is ${LanguageUtils.getLocale()}")
-
- binding = ActivityMainBinding.inflate(layoutInflater)
-
- /// Set theme
- setUITheme(prefs)
- setContentView(binding.root)
-
- initToolbar()
-
- binding.pager.adapter = tabsAdapter
- binding.pager.isUserInputEnabled =
- false // Gestures for screen switching doesn't work so good with the map view
- // pager.offscreenPageLimit = 0 // Don't keep any offscreen pages around, because we want to make sure our bluetooth scanning stops
- TabLayoutMediator(binding.tabLayout, binding.pager, false, false) { tab, position ->
- // tab.text = tabInfos[position].text // I think it looks better with icons only
- tab.icon = ContextCompat.getDrawable(this, tabInfos[position].icon)
- }.attach()
-
- model.connectionState.observe(this) { connected ->
- updateConnectionStatusImage(connected)
- }
-
- // Handle any intent
- handleIntent(intent)
-
- if (isGooglePlayAvailable(this)) askToRate()
- }
-
- private fun initToolbar() {
- val toolbar = binding.toolbar as Toolbar
- setSupportActionBar(toolbar)
- supportActionBar?.setDisplayShowTitleEnabled(false)
- }
-
- private fun updateConnectionStatusImage(connected: MeshService.ConnectionState) {
-
- if (model.actionBarMenu == null)
- return
-
- val (image, tooltip) = when (connected) {
- MeshService.ConnectionState.CONNECTED -> Pair(R.drawable.cloud_on, R.string.connected)
- MeshService.ConnectionState.DEVICE_SLEEP -> Pair(
- R.drawable.ic_twotone_cloud_upload_24,
- R.string.device_sleeping
- )
- MeshService.ConnectionState.DISCONNECTED -> Pair(
- R.drawable.cloud_off,
- R.string.disconnected
- )
- }
-
- val item = model.actionBarMenu?.findItem(R.id.connectStatusImage)
- if (item != null) {
- item.setIcon(image)
- item.setTitle(tooltip)
- }
- }
-
- override fun onNewIntent(intent: Intent) {
- super.onNewIntent(intent)
- handleIntent(intent)
- }
-
- private var requestedChannelUrl: Uri? = null
-
- /** We keep the usb device here, so later we can give it to our service */
- private var usbDevice: UsbDevice? = null
-
- /// Handle any itents that were passed into us
- private fun handleIntent(intent: Intent) {
- val appLinkAction = intent.action
- val appLinkData: Uri? = intent.data
-
- when (appLinkAction) {
- Intent.ACTION_VIEW -> {
- debug("Asked to open a channel URL - ask user if they want to switch to that channel. If so send the config to the radio")
- requestedChannelUrl = appLinkData
-
- // if the device is connected already, process it now
- perhapsChangeChannel()
-
- // We now wait for the device to connect, once connected, we ask the user if they want to switch to the new channel
- }
-
- UsbManager.ACTION_USB_DEVICE_ATTACHED -> {
- val device: UsbDevice? = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE)
- if (device != null) {
- debug("Handle USB device attached! $device")
- usbDevice = device
- }
- }
-
- Intent.ACTION_MAIN -> {
- }
-
- else -> {
- warn("Unexpected action $appLinkAction")
- }
- }
- }
-
- private var requestedEnable = false
- private val bleRequestEnable = registerForActivityResult(
- ActivityResultContracts.StartActivityForResult()
- ) {
- requestedEnable = false
- }
-
- private val createDocumentLauncher = registerForActivityResult(
- ActivityResultContracts.StartActivityForResult()
- ) {
- if (it.resultCode == Activity.RESULT_OK) {
- it.data?.data?.let { file_uri -> model.saveMessagesCSV(file_uri) }
- }
- }
-
- override fun onDestroy() {
- unregisterMeshReceiver()
- mainScope.cancel("Activity going away")
- super.onDestroy()
- }
-
- private var receiverRegistered = false
-
- private fun registerMeshReceiver() {
- unregisterMeshReceiver()
- val filter = IntentFilter()
- filter.addAction(MeshService.ACTION_MESH_CONNECTED)
- filter.addAction(MeshService.ACTION_NODE_CHANGE)
- registerReceiver(meshServiceReceiver, filter)
- receiverRegistered = true
- }
-
- private fun unregisterMeshReceiver() {
- if (receiverRegistered) {
- receiverRegistered = false
- unregisterReceiver(meshServiceReceiver)
- }
- }
-
- /** Show an alert that may contain HTML */
- private fun showAlert(titleText: Int, messageText: Int) {
-
- // make links clickable per https://stackoverflow.com/a/62642807
- // val messageStr = getText(messageText)
-
- val builder = MaterialAlertDialogBuilder(this)
- .setTitle(titleText)
- .setMessage(messageText)
- .setPositiveButton(R.string.okay) { _, _ ->
- info("User acknowledged")
- }
-
- val dialog = builder.show()
-
- // Make the textview clickable. Must be called after show()
- val view = (dialog.findViewById(android.R.id.message) as TextView?)!!
- // Linkify.addLinks(view, Linkify.ALL) // not needed with this method
- view.movementMethod = LinkMovementMethod.getInstance()
-
- showSettingsPage() // Default to the settings page in this case
- }
-
- /// Called when we gain/lose a connection to our mesh radio
- private fun onMeshConnectionChanged(newConnection: MeshService.ConnectionState) {
- val oldConnection = model.connectionState.value!!
- debug("connchange $oldConnection -> $newConnection")
-
- if (newConnection == MeshService.ConnectionState.CONNECTED) {
- model.meshService?.let { service ->
-
- model.setConnectionState(newConnection)
-
- debug("Getting latest DeviceConfig from service")
- try {
- val info: MyNodeInfo? = service.myNodeInfo // this can be null
- model.setMyNodeInfo(info)
-
- if (info != null) {
- val isOld = info.minAppVersion > BuildConfig.VERSION_CODE
- if (isOld)
- showAlert(R.string.app_too_old, R.string.must_update)
- else {
- // If we are already doing an update don't put up a dialog or try to get device info
- val isUpdating = service.updateStatus >= 0
- if (!isUpdating) {
- val curVer = DeviceVersion(info.firmwareVersion ?: "0.0.0")
-
- if (curVer < MeshService.minDeviceVersion)
- showAlert(R.string.firmware_too_old, R.string.firmware_old)
- else {
- // If our app is too old/new, we probably don't understand the new DeviceConfig messages, so we don't read them until here
-
- // model.setLocalConfig(LocalOnlyProtos.LocalConfig.parseFrom(service.deviceConfig))
- // model.setChannels(ChannelSet(AppOnlyProtos.ChannelSet.parseFrom(service.channels)))
-
- model.updateNodesFromDevice()
-
- // we have a connection to our device now, do the channel change
- perhapsChangeChannel()
- }
- }
- }
- } else if (BluetoothInterface.invalidVersion) {
- showAlert(R.string.firmware_too_old, R.string.firmware_old)
- }
- } catch (ex: RemoteException) {
- warn("Abandoning connect $ex, because we probably just lost device connection")
- model.setConnectionState(oldConnection)
- }
- // if provideLocation enabled: Start providing location (from phone GPS) to mesh
- if (model.provideLocation.value == true)
- service.startProvideLocation()
- }
- } else {
- // For other connection states, just slam them in
- model.setConnectionState(newConnection)
- }
- }
-
- private fun showSnackbar(msgId: Int) {
- try {
- Snackbar.make(binding.root, msgId, Snackbar.LENGTH_LONG).show()
- } catch (ex: IllegalStateException) {
- errormsg("Snackbar couldn't find view for msgId $msgId")
- }
- }
-
- private fun showSnackbar(msg: String) {
- try {
- Snackbar.make(binding.root, msg, Snackbar.LENGTH_INDEFINITE)
- .apply { view.findViewById(R.id.snackbar_text).isSingleLine = false }
- .setAction(R.string.okay) {
- // dismiss
- }
- .show()
- } catch (ex: IllegalStateException) {
- errormsg("Snackbar couldn't find view for msgString $msg")
- }
- }
-
- private fun perhapsChangeChannel(url: Uri? = requestedChannelUrl) {
- // if the device is connected already, process it now
- if (url != null && model.isConnected()) {
- requestedChannelUrl = null
- try {
- val channels = ChannelSet(url)
- val primary = channels.primaryChannel
- if (primary == null)
- showSnackbar(R.string.channel_invalid)
- else {
-
- MaterialAlertDialogBuilder(this)
- .setTitle(R.string.new_channel_rcvd)
- .setMessage(getString(R.string.do_you_want_switch).format(primary.name))
- .setNeutralButton(R.string.cancel) { _, _ ->
- // Do nothing
- }
- .setPositiveButton(R.string.accept) { _, _ ->
- debug("Setting channel from URL")
- try {
- model.setChannels(channels)
- } catch (ex: RemoteException) {
- errormsg("Couldn't change channel ${ex.message}")
- showSnackbar(R.string.cant_change_no_radio)
- }
- }
- .show()
- }
- } catch (ex: Throwable) {
- errormsg("Channel url error: ${ex.message}")
- showSnackbar("${getString(R.string.channel_invalid)}: ${ex.message}")
- }
- }
- }
-
- override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
- return try {
- super.dispatchTouchEvent(ev)
- } catch (ex: Throwable) {
- Exceptions.report(
- ex,
- "dispatchTouchEvent"
- ) // hide this Compose error from the user but report to the mothership
- false
- }
- }
-
- private val meshServiceReceiver = object : BroadcastReceiver() {
-
- override fun onReceive(context: Context, intent: Intent) =
- exceptionReporter {
- debug("Received from mesh service $intent")
-
- when (intent.action) {
- MeshService.ACTION_NODE_CHANGE -> {
- val info: NodeInfo =
- intent.getParcelableExtra(EXTRA_NODEINFO)!!
- debug("UI nodechange $info")
-
- // We only care about nodes that have user info
- info.user?.id?.let {
- val nodes = model.nodeDB.nodes.value!! + Pair(it, info)
- model.nodeDB.setNodes(nodes)
- }
- }
-
- MeshService.ACTION_MESH_CONNECTED -> {
- val extra = intent.getStringExtra(EXTRA_CONNECTED)
- if (extra != null) {
- onMeshConnectionChanged(MeshService.ConnectionState.valueOf(extra))
- }
- }
- else -> TODO()
- }
- }
- }
-
- private var connectionJob: Job? = null
-
- private val mesh = object :
- ServiceClient({
- IMeshService.Stub.asInterface(it)
- }) {
- override fun onConnected(service: IMeshService) {
-
- /*
- Note: we must call this callback in a coroutine. Because apparently there is only a single activity looper thread. and if that onConnected override
- also tries to do a service operation we can deadlock.
-
- Old buggy stack trace:
-
- at sun.misc.Unsafe.park (Unsafe.java)
- - waiting on an unknown object
- at java.util.concurrent.locks.LockSupport.park (LockSupport.java:190)
- at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2067)
- at com.geeksville.mesh.android.ServiceClient.waitConnect (ServiceClient.java:46)
- at com.geeksville.mesh.android.ServiceClient.getService (ServiceClient.java:27)
- at com.geeksville.mesh.service.MeshService$binder$1$setDeviceAddress$1.invoke (MeshService.java:1519)
- at com.geeksville.mesh.service.MeshService$binder$1$setDeviceAddress$1.invoke (MeshService.java:1514)
- at com.geeksville.mesh.util.ExceptionsKt.toRemoteExceptions (ExceptionsKt.java:56)
- at com.geeksville.mesh.service.MeshService$binder$1.setDeviceAddress (MeshService.java:1516)
- at com.geeksville.mesh.MainActivity$mesh$1$onConnected$1.invoke (MainActivity.java:743)
- at com.geeksville.mesh.MainActivity$mesh$1$onConnected$1.invoke (MainActivity.java:734)
- at com.geeksville.mesh.util.ExceptionsKt.exceptionReporter (ExceptionsKt.java:34)
- at com.geeksville.mesh.MainActivity$mesh$1.onConnected (MainActivity.java:738)
- at com.geeksville.mesh.MainActivity$mesh$1.onConnected (MainActivity.java:734)
- at com.geeksville.mesh.android.ServiceClient$connection$1$onServiceConnected$1.invoke (ServiceClient.java:89)
- at com.geeksville.mesh.android.ServiceClient$connection$1$onServiceConnected$1.invoke (ServiceClient.java:84)
- at com.geeksville.mesh.util.ExceptionsKt.exceptionReporter (ExceptionsKt.java:34)
- at com.geeksville.mesh.android.ServiceClient$connection$1.onServiceConnected (ServiceClient.java:85)
- at android.app.LoadedApk$ServiceDispatcher.doConnected (LoadedApk.java:2067)
- at android.app.LoadedApk$ServiceDispatcher$RunConnection.run (LoadedApk.java:2099)
- at android.os.Handler.handleCallback (Handler.java:883)
- at android.os.Handler.dispatchMessage (Handler.java:100)
- at android.os.Looper.loop (Looper.java:237)
- at android.app.ActivityThread.main (ActivityThread.java:8016)
- at java.lang.reflect.Method.invoke (Method.java)
- at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
- at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1076)
- */
- connectionJob = mainScope.handledLaunch {
- model.meshService = service
-
- try {
- usbDevice?.let { usb ->
- debug("Switching to USB radio ${usb.deviceName}")
- service.setDeviceAddress(SerialInterface.toInterfaceName(usb.deviceName))
- usbDevice =
- null // Only switch once - thereafter it should be stored in settings
- }
-
- // We don't start listening for packets until after we are connected to the service
- registerMeshReceiver()
-
- model.setMyNodeInfo(service.myNodeInfo) // Note: this could be NULL!
-
- val connectionState =
- MeshService.ConnectionState.valueOf(service.connectionState())
-
- // if we are not connected, onMeshConnectionChange won't fetch nodes from the service
- // in that case, we do it here - because the service certainly has a better idea of node db that we have
- if (connectionState != MeshService.ConnectionState.CONNECTED)
- model.updateNodesFromDevice()
-
- // We won't receive a notify for the initial state of connection, so we force an update here
- onMeshConnectionChanged(connectionState)
- } catch (ex: RemoteException) {
- // If we get an exception while reading our service config, the device might have gone away, double check to see if we are really connected
- errormsg("Device error during init ${ex.message}")
- model.setConnectionState(MeshService.ConnectionState.valueOf(service.connectionState()))
- } finally {
- connectionJob = null
- }
-
- debug("connected to mesh service, connectionState=${model.connectionState.value}")
- }
- }
-
- override fun onDisconnected() {
- unregisterMeshReceiver()
- model.meshService = null
- }
- }
-
- private fun bindMeshService() {
- debug("Binding to mesh service!")
- // we bind using the well known name, to make sure 3rd party apps could also
- if (model.meshService != null) {
- /* This problem can occur if we unbind, but there is already an onConnected job waiting to run. That job runs and then makes meshService != null again
- I think I've fixed this by cancelling connectionJob. We'll see!
- */
- Exceptions.reportError("meshService was supposed to be null, ignoring (but reporting a bug)")
- }
-
- try {
- MeshService.startService(this) // Start the service so it stays running even after we unbind
- } catch (ex: Exception) {
- // Old samsung phones have a race condition andthis might rarely fail. Which is probably find because the bind will be sufficient most of the time
- errormsg("Failed to start service from activity - but ignoring because bind will work ${ex.message}")
- }
-
- // ALSO bind so we can use the api
- mesh.connect(
- this,
- MeshService.createIntent(),
- Context.BIND_AUTO_CREATE + Context.BIND_ABOVE_CLIENT
- )
- }
-
- private fun unbindMeshService() {
- // If we have received the service, and hence registered with
- // it, then now is the time to unregister.
- // if we never connected, do nothing
- debug("Unbinding from mesh service!")
- connectionJob?.let { job ->
- connectionJob = null
- warn("We had a pending onConnection job, so we are cancelling it")
- job.cancel("unbinding")
- }
- mesh.close()
- model.meshService = null
- }
-
- override fun onStop() {
- unregisterMeshReceiver() // No point in receiving updates while the GUI is gone, we'll get them when the user launches the activity
- unbindMeshService()
-
- super.onStop()
- }
-
- override fun onStart() {
- super.onStart()
-
- bluetoothViewModel.enabled.observe(this) { enabled ->
- if (!enabled && !requestedEnable && scanModel.selectedBluetooth) {
- requestedEnable = true
- if (hasBluetoothPermission()) {
- val enableBtIntent = Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE)
- bleRequestEnable.launch(enableBtIntent)
- } else {
- MaterialAlertDialogBuilder(this)
- .setTitle(getString(R.string.required_permissions))
- .setMessage(permissionMissing)
- .setNeutralButton(R.string.cancel) { _, _ ->
- warn("User bailed due to permissions")
- }
- .setPositiveButton(R.string.accept) { _, _ ->
- info("requesting permissions")
- requestPermissionsLauncher.launch(getBluetoothPermissions()) }
- .show()
- }
- }
- }
-
- // Call perhapsChangeChannel() whenever [changeChannelUrl] updates with a non-null value
- model.requestChannelUrl.observe(this) { url ->
- url?.let {
- requestedChannelUrl = url
- model.clearRequestChannelUrl()
- perhapsChangeChannel()
- }
- }
-
- try {
- bindMeshService()
- } catch (ex: BindFailedException) {
- // App is probably shutting down, ignore
- errormsg("Bind of MeshService failed")
- }
-
- val bonded = radioInterfaceService.getBondedDeviceAddress() != null
- if (!bonded && usbDevice == null) // we will handle USB later
- showSettingsPage()
- }
-
- private fun showSettingsPage() {
- binding.pager.currentItem = 5
- }
-
- override fun onCreateOptionsMenu(menu: Menu): Boolean {
- // Inflate the menu; this adds items to the action bar if it is present.
- menuInflater.inflate(R.menu.menu_main, menu)
- model.actionBarMenu = menu
-
- updateConnectionStatusImage(model.connectionState.value!!)
-
- return true
- }
-
- val handler: Handler by lazy {
- Handler(Looper.getMainLooper())
- }
-
- override fun onPrepareOptionsMenu(menu: Menu): Boolean {
- menu.findItem(R.id.stress_test).isVisible =
- BuildConfig.DEBUG // only show stress test for debug builds (for now)
- return super.onPrepareOptionsMenu(menu)
- }
-
- override fun onOptionsItemSelected(item: MenuItem): Boolean {
- // Handle action bar item clicks here. The action bar will
- // automatically handle clicks on the Home/Up button, so long
- // as you specify a parent activity in AndroidManifest.xml.
- return when (item.itemId) {
- R.id.about -> {
- getVersionInfo()
- return true
- }
- R.id.connectStatusImage -> {
- Toast.makeText(applicationContext, item.title, Toast.LENGTH_SHORT).show()
- return true
- }
- R.id.debug -> {
- val fragmentManager: FragmentManager = supportFragmentManager
- val fragmentTransaction: FragmentTransaction = fragmentManager.beginTransaction()
- val nameFragment = DebugFragment()
- fragmentTransaction.add(R.id.mainActivityLayout, nameFragment)
- fragmentTransaction.addToBackStack(null)
- fragmentTransaction.commit()
- return true
- }
- R.id.stress_test -> {
- fun postPing() {
- // Send ping message and arrange delayed recursion.
- debug("Sending ping")
- val str = "Ping " + DateFormat.getTimeInstance(DateFormat.MEDIUM)
- .format(Date(System.currentTimeMillis()))
- model.sendMessage(str)
- handler.postDelayed({ postPing() }, 30000)
- }
- item.isChecked = !item.isChecked // toggle ping test
- if (item.isChecked)
- postPing()
- else
- handler.removeCallbacksAndMessages(null)
- return true
- }
- R.id.device_settings -> {
- supportFragmentManager.beginTransaction()
- .add(R.id.mainActivityLayout, DeviceSettingsFragment())
- .addToBackStack(null)
- .commit()
- return true
- }
- R.id.module_settings -> {
- supportFragmentManager.beginTransaction()
- .add(R.id.mainActivityLayout, ModuleSettingsFragment())
- .addToBackStack(null)
- .commit()
- return true
- }
- R.id.save_messages_csv -> {
- val intent = Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
- addCategory(Intent.CATEGORY_OPENABLE)
- type = "application/csv"
- putExtra(Intent.EXTRA_TITLE, "rangetest.csv")
- }
- createDocumentLauncher.launch(intent)
- return true
- }
- R.id.theme -> {
- chooseThemeDialog()
- return true
- }
- R.id.preferences_language -> {
- chooseLangDialog()
- return true
- }
- R.id.show_intro -> {
- startActivity(Intent(this, AppIntroduction::class.java))
- return true
- }
- R.id.preferences_quick_chat -> {
- val fragmentManager: FragmentManager = supportFragmentManager
- val fragmentTransaction: FragmentTransaction = fragmentManager.beginTransaction()
- val nameFragment = QuickChatSettingsFragment()
- fragmentTransaction.add(R.id.mainActivityLayout, nameFragment)
- fragmentTransaction.addToBackStack(null)
- fragmentTransaction.commit()
- return true
- }
- else -> super.onOptionsItemSelected(item)
- }
- }
-
- private fun getVersionInfo() {
- try {
- val packageInfo: PackageInfo = packageManager.getPackageInfo(packageName, 0)
- val versionName = packageInfo.versionName
- Toast.makeText(this, versionName, Toast.LENGTH_LONG).show()
- } catch (e: PackageManager.NameNotFoundException) {
- errormsg("Can not find the version: ${e.message}")
- }
- }
-
- /// Theme functions
-
- private fun chooseThemeDialog() {
-
- /// Prepare dialog and its items
- val builder = MaterialAlertDialogBuilder(this)
- builder.setTitle(getString(R.string.choose_theme))
-
- val styles = arrayOf(
- getString(R.string.theme_light),
- getString(R.string.theme_dark),
- getString(R.string.theme_system)
- )
-
- /// Load preferences and its value
- val prefs = UIViewModel.getPreferences(this)
- val editor: SharedPreferences.Editor = prefs.edit()
- val checkedItem = prefs.getInt("theme", 2)
-
- builder.setSingleChoiceItems(styles, checkedItem) { dialog, which ->
-
- when (which) {
- 0 -> {
- AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
- editor.putInt("theme", 0)
- editor.apply()
-
- dialog.dismiss()
- }
- 1 -> {
- AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
- editor.putInt("theme", 1)
- editor.apply()
-
- dialog.dismiss()
- }
- else -> {
- AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
- editor.putInt("theme", 2)
- editor.apply()
-
- dialog.dismiss()
- }
-
- }
- }
-
- val dialog = builder.create()
- dialog.show()
- }
-
- private fun setUITheme(prefs: SharedPreferences) {
- /// Read theme settings from preferences and set it
- /// If nothing is found set FOLLOW SYSTEM option
-
- when (prefs.getInt("theme", 2)) {
- 0 -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
- 1 -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
- else -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
- }
- }
-
- private fun chooseLangDialog() {
- /// Prepare dialog and its items
- val builder = MaterialAlertDialogBuilder(this)
- builder.setTitle(getString(R.string.preferences_language))
-
- val languageTags = LanguageUtils.getLanguageTags(this)
- val languageLabels = languageTags.map { it.first }.toTypedArray()
- val languageValues = languageTags.map { it.second }
-
- /// Load preferences and its value
- val lang = LanguageUtils.getLocale()
- debug("Lang from prefs: $lang")
-
- builder.setSingleChoiceItems(
- languageLabels,
- languageValues.indexOf(lang)
- ) { dialog, which ->
- val selectedLang = languageValues[which]
- debug("Set lang pref to $selectedLang")
- LanguageUtils.setLocale(selectedLang)
- dialog.dismiss()
- }
- val dialog = builder.create()
- dialog.show()
- }
-}
diff --git a/app/src/main/java/com/geeksville/mesh/MeshUtilApplication.kt b/app/src/main/java/com/geeksville/mesh/MeshUtilApplication.kt
deleted file mode 100644
index e7687fcd2..000000000
--- a/app/src/main/java/com/geeksville/mesh/MeshUtilApplication.kt
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.geeksville.mesh
-
-import android.os.Debug
-import com.geeksville.mesh.android.AppPrefs
-import com.geeksville.mesh.android.BuildUtils.isEmulator
-import com.geeksville.mesh.android.GeeksvilleApplication
-import com.geeksville.mesh.android.Logging
-import com.geeksville.mesh.util.Exceptions
-import com.google.firebase.crashlytics.FirebaseCrashlytics
-import dagger.hilt.android.HiltAndroidApp
-
-@HiltAndroidApp
-class MeshUtilApplication : GeeksvilleApplication() {
-
- override fun onCreate() {
- super.onCreate()
-
- Logging.showLogs = BuildConfig.DEBUG
-
- // We default to off in the manifest - we turn on here if the user approves
- // leave off when running in the debugger
- if (!isEmulator && (!BuildConfig.DEBUG || !Debug.isDebuggerConnected())) {
- val crashlytics = FirebaseCrashlytics.getInstance()
- crashlytics.setCrashlyticsCollectionEnabled(isAnalyticsAllowed)
- crashlytics.setCustomKey("debug_build", BuildConfig.DEBUG)
-
- val pref = AppPrefs(this)
- crashlytics.setUserId(pref.getInstallId()) // be able to group all bugs per anonymous user
-
- // We always send our log messages to the crashlytics lib, but they only get sent to the server if we report an exception
- // This makes log messages work properly if someone turns on analytics just before they click report bug.
- // send all log messages through crashyltics, so if we do crash we'll have those in the report
- val standardLogger = Logging.printlog
- Logging.printlog = { level, tag, message ->
- crashlytics.log("$tag: $message")
- standardLogger(level, tag, message)
- }
-
- fun sendCrashReports() {
- if (isAnalyticsAllowed)
- crashlytics.sendUnsentReports()
- }
-
- // Send any old reports if user approves
- sendCrashReports()
-
- // Attach to our exception wrapper
- Exceptions.reporter = { exception, _, _ ->
- crashlytics.recordException(exception)
- sendCrashReports() // Send the new report
- }
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/MyNodeInfo.kt b/app/src/main/java/com/geeksville/mesh/MyNodeInfo.kt
deleted file mode 100644
index 1c1efd218..000000000
--- a/app/src/main/java/com/geeksville/mesh/MyNodeInfo.kt
+++ /dev/null
@@ -1,74 +0,0 @@
-package com.geeksville.mesh
-
-import android.os.Parcel
-import android.os.Parcelable
-import kotlinx.serialization.Serializable
-
-// MyNodeInfo sent via special protobuf from radio
-@Serializable
-data class MyNodeInfo(
- val myNodeNum: Int,
- val hasGPS: Boolean,
- val model: String?,
- val firmwareVersion: String?,
- val couldUpdate: Boolean, // this application contains a software load we _could_ install if you want
- val shouldUpdate: Boolean, // this device has old firmware
- val currentPacketId: Long,
- val messageTimeoutMsec: Int,
- val minAppVersion: Int,
- val maxChannels: Int,
- val hasWifi: Boolean,
- val channelUtilization: Float,
- val airUtilTx: Float
-) : Parcelable {
- /** A human readable description of the software/hardware version */
- val firmwareString: String get() = "$model $firmwareVersion"
-
- constructor(parcel: Parcel) : this(
- parcel.readInt(),
- parcel.readByte() != 0.toByte(),
- parcel.readString(),
- parcel.readString(),
- parcel.readByte() != 0.toByte(),
- parcel.readByte() != 0.toByte(),
- parcel.readLong(),
- parcel.readInt(),
- parcel.readInt(),
- parcel.readInt(),
- parcel.readByte() != 0.toByte(),
- parcel.readFloat(),
- parcel.readFloat()
- )
-
- override fun writeToParcel(parcel: Parcel, flags: Int) {
- parcel.writeInt(myNodeNum)
- parcel.writeByte(if (hasGPS) 1 else 0)
- parcel.writeString(model)
- parcel.writeString(firmwareVersion)
- parcel.writeByte(if (couldUpdate) 1 else 0)
- parcel.writeByte(if (shouldUpdate) 1 else 0)
- parcel.writeLong(currentPacketId)
- parcel.writeInt(messageTimeoutMsec)
- parcel.writeInt(minAppVersion)
- parcel.writeInt(maxChannels)
- parcel.writeByte(if (hasWifi) 1 else 0)
- parcel.writeFloat(channelUtilization)
- parcel.writeFloat(airUtilTx)
- }
-
- override fun describeContents(): Int {
- return 0
- }
-
- companion object CREATOR : Parcelable.Creator {
- override fun createFromParcel(parcel: Parcel): MyNodeInfo {
- return MyNodeInfo(parcel)
- }
-
- override fun newArray(size: Int): Array {
- return arrayOfNulls(size)
- }
- }
-
-
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/NodeInfo.kt b/app/src/main/java/com/geeksville/mesh/NodeInfo.kt
deleted file mode 100644
index 9a8626edf..000000000
--- a/app/src/main/java/com/geeksville/mesh/NodeInfo.kt
+++ /dev/null
@@ -1,214 +0,0 @@
-package com.geeksville.mesh
-
-import android.os.Parcelable
-import com.geeksville.mesh.util.bearing
-import com.geeksville.mesh.util.latLongToMeter
-import com.geeksville.mesh.util.anonymize
-import kotlinx.parcelize.Parcelize
-import kotlinx.serialization.Serializable
-
-
-//
-// model objects that directly map to the corresponding protobufs
-//
-
-@Serializable
-@Parcelize
-data class MeshUser(
- val id: String,
- val longName: String,
- val shortName: String,
- val hwModel: MeshProtos.HardwareModel,
- val isLicensed: Boolean = false,
-) : Parcelable {
-
- override fun toString(): String {
- return "MeshUser(id=${id.anonymize}, longName=${longName.anonymize}, shortName=${shortName.anonymize}, hwModel=${hwModelString}, isLicensed=${isLicensed})"
- }
-
- /** a string version of the hardware model, converted into pretty lowercase and changing _ to -, and p to dot
- * or null if unset
- * */
- val hwModelString: String?
- get() =
- if (hwModel == MeshProtos.HardwareModel.UNSET) null
- else hwModel.name.replace('_', '-').replace('p', '.').lowercase()
-}
-
-@Serializable
-@Parcelize
-data class Position(
- val latitude: Double,
- val longitude: Double,
- val altitude: Int,
- val time: Int = currentTime() // default to current time in secs (NOT MILLISECONDS!)
-) : Parcelable {
- companion object {
- /// Convert to a double representation of degrees
- fun degD(i: Int) = i * 1e-7
- fun degI(d: Double) = (d * 1e7).toInt()
-
- fun currentTime() = (System.currentTimeMillis() / 1000).toInt()
- }
-
- /** Create our model object from a protobuf. If time is unspecified in the protobuf, the provided default time will be used.
- */
- constructor(p: MeshProtos.Position, defaultTime: Int = currentTime()) : this(
- // We prefer the int version of lat/lon but if not available use the depreciated legacy version
- degD(p.latitudeI),
- degD(p.longitudeI),
- p.altitude,
- if (p.time != 0) p.time else defaultTime
- )
-
- /// @return distance in meters to some other node (or null if unknown)
- fun distance(o: Position) = latLongToMeter(latitude, longitude, o.latitude, o.longitude)
-
- /// @return bearing to the other position in degrees
- fun bearing(o: Position) = bearing(latitude, longitude, o.latitude, o.longitude)
-
- // If GPS gives a crap position don't crash our app
- fun isValid(): Boolean {
- return latitude != 0.0 && longitude != 0.0 &&
- (latitude >= -90 && latitude <= 90.0) &&
- (longitude >= -180 && longitude <= 180)
- }
-
- override fun toString(): String {
- return "Position(lat=${latitude.anonymize}, lon=${longitude.anonymize}, alt=${altitude.anonymize}, time=${time})"
- }
-}
-
-
-@Serializable
-@Parcelize
-data class DeviceMetrics(
- val time: Int = currentTime(), // default to current time in secs (NOT MILLISECONDS!)
- val batteryLevel: Int = 0,
- val voltage: Float,
- val channelUtilization: Float,
- val airUtilTx: Float
-) : Parcelable {
- companion object {
- fun currentTime() = (System.currentTimeMillis() / 1000).toInt()
- }
-
- /** Create our model object from a protobuf.
- */
- constructor(p: TelemetryProtos.DeviceMetrics, telemetryTime: Int = currentTime()) : this(
- telemetryTime,
- p.batteryLevel,
- p.voltage,
- p.channelUtilization,
- p.airUtilTx
- )
-
- override fun toString(): String {
- return "DeviceMetrics(time=${time}, batteryLevel=${batteryLevel}, voltage=${voltage}, channelUtilization=${channelUtilization}, airUtilTx=${airUtilTx})"
- }
-}
-
-@Serializable
-@Parcelize
-data class EnvironmentMetrics(
- val time: Int = currentTime(), // default to current time in secs (NOT MILLISECONDS!)
- val temperature: Float,
- val relativeHumidity: Float,
- val barometricPressure: Float,
- val gasResistance: Float,
- val voltage: Float,
- val current: Float,
-) : Parcelable {
- companion object {
- fun currentTime() = (System.currentTimeMillis() / 1000).toInt()
- }
-
- /** Create our model object from a protobuf.
- */
- constructor(t: TelemetryProtos.EnvironmentMetrics, telemetryTime: Int = currentTime()) : this(
- telemetryTime,
- t.temperature,
- t.relativeHumidity,
- t.barometricPressure,
- t.gasResistance,
- t.voltage,
- t.current
- )
-
- override fun toString(): String {
- return "EnvironmentMetrics(time=${time}, temperature=${temperature}, humidity=${relativeHumidity}, pressure=${barometricPressure}), resistance=${gasResistance}, voltage=${voltage}, current=${current}"
- }
-}
-
-@Serializable
-@Parcelize
-data class NodeInfo(
- val num: Int, // This is immutable, and used as a key
- var user: MeshUser? = null,
- var position: Position? = null,
- var snr: Float = Float.MAX_VALUE,
- var rssi: Int = Int.MAX_VALUE,
- var lastHeard: Int = 0, // the last time we've seen this node in secs since 1970
- var deviceMetrics: DeviceMetrics? = null,
- var environmentMetrics: EnvironmentMetrics? = null,
-) : Parcelable {
-
- val batteryLevel get() = deviceMetrics?.batteryLevel
- val voltage get() = deviceMetrics?.voltage
- val batteryStr get() = if (batteryLevel in 1..100) String.format("%d%%", batteryLevel) else ""
-
- private fun envFormat(f: String, unit: String, env: Float?): String =
- if (env != null && env != 0f) String.format(f + unit, env) else ""
-
- val envMetricStr
- get() = envFormat("%.1f", "°C ", environmentMetrics?.temperature) +
- envFormat("%.0f", "%% ", environmentMetrics?.relativeHumidity) +
- envFormat("%.1f", "hPa ", environmentMetrics?.barometricPressure) +
- envFormat("%.0f", "mΩ ", environmentMetrics?.gasResistance) +
- envFormat("%.2f", "V ", environmentMetrics?.voltage) +
- envFormat("%.1f", "mA", environmentMetrics?.current)
-
- /**
- * true if the device was heard from recently
- *
- * Note: if a node has never had its time set, it will have a time of zero. In that
- * case assume it is online - so that we will start sending GPS updates
- */
- val isOnline: Boolean
- get() {
- val now = System.currentTimeMillis() / 1000
- // FIXME - use correct timeout from the device settings
- val timeout =
- 15 * 60 // Don't set this timeout too tight, or otherwise we will stop sending GPS helper positions to our device
- return (now - lastHeard <= timeout) || lastHeard == 0
- }
-
- /// return the position if it is valid, else null
- val validPosition: Position?
- get() {
- return position?.takeIf { it.isValid() }
- }
-
- /// @return distance in meters to some other node (or null if unknown)
- fun distance(o: NodeInfo?): Int? {
- val p = validPosition
- val op = o?.validPosition
- return if (p != null && op != null) p.distance(op).toInt() else null
- }
-
- /// @return bearing to the other position in degrees
- fun bearing(o: NodeInfo?): Int? {
- val p = validPosition
- val op = o?.validPosition
- return if (p != null && op != null) p.bearing(op).toInt() else null
- }
-
- /// @return a nice human readable string for the distance, or null for unknown
- fun distanceStr(o: NodeInfo?) = distance(o)?.let { dist ->
- when {
- dist == 0 -> null // same point
- dist < 1000 -> "%.0f m".format(dist.toDouble())
- else -> "%.1f km".format(dist / 1000.0)
- }
- }
-}
diff --git a/app/src/main/java/com/geeksville/mesh/analytics/AnalyticsClient.kt b/app/src/main/java/com/geeksville/mesh/analytics/AnalyticsClient.kt
deleted file mode 100644
index 9a0cb40f5..000000000
--- a/app/src/main/java/com/geeksville/mesh/analytics/AnalyticsClient.kt
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.geeksville.mesh.analytics
-
-import com.google.firebase.analytics.FirebaseAnalytics
-
-/**
- * Created by kevinh on 12/24/14.
- */
-class DataPair(val name: String, valueIn: Any?) {
- val value = valueIn ?: "null"
-
- /// An accumulating firebase event - only one allowed per event
- constructor(d: Double) : this(FirebaseAnalytics.Param.VALUE, d)
- constructor(d: Int) : this(FirebaseAnalytics.Param.VALUE, d)
-}
-
-public interface AnalyticsProvider {
-
- // Turn analytics logging on/off
- fun setEnabled(on: Boolean)
-
- /**
- * Store an event
- */
- fun track(event: String, vararg properties: DataPair): Unit
-
- /**
- * Only track this event if using a cheap provider (like google)
- */
- fun trackLowValue(event: String, vararg properties: DataPair): Unit
-
- fun endSession(): Unit
- fun startSession(): Unit
-
- /**
- * Set persistent ID info about this user, as a key value pair
- */
- fun setUserInfo(vararg p: DataPair)
-
- /**
- * Increment some sort of anyalytics counter
- */
- fun increment(name: String, amount: Double = 1.0)
-
- fun sendScreenView(name: String)
- fun endScreenView()
-
-}
-
-
diff --git a/app/src/main/java/com/geeksville/mesh/analytics/FirebaseAnalytics.kt b/app/src/main/java/com/geeksville/mesh/analytics/FirebaseAnalytics.kt
deleted file mode 100644
index 983dda0c4..000000000
--- a/app/src/main/java/com/geeksville/mesh/analytics/FirebaseAnalytics.kt
+++ /dev/null
@@ -1,78 +0,0 @@
-package com.geeksville.mesh.analytics
-
-import android.content.Context
-import android.os.Bundle
-import com.geeksville.mesh.android.AppPrefs
-import com.geeksville.mesh.android.GeeksvilleApplication
-import com.geeksville.mesh.android.Logging
-
-/**
- * Implement our analytics API using firebase analtics
- */
-class GoogleAnalytics(context: Context) : AnalyticsProvider, Logging {
-
- val t = com.google.firebase.analytics.FirebaseAnalytics.getInstance(context)
-
- init {
- val pref = AppPrefs(context)
- t.setUserId(pref.getInstallId())
- }
-
- override fun setEnabled(on: Boolean) {
- t.setAnalyticsCollectionEnabled(on)
- }
-
- override fun endSession() {
- track("End Session")
- // Mint.flush() // Send results now
- }
-
- override fun trackLowValue(event: String, vararg properties: DataPair) {
- track(event, *properties)
- }
-
- override fun track(event: String, vararg properties: DataPair) {
- debug("Analytics: track $event")
-
- val bundle = Bundle()
- properties.forEach {
- when (it.value) {
- is Double -> bundle.putDouble(it.name, it.value)
- is Int -> bundle.putLong(it.name, it.value.toLong())
- is Long -> bundle.putLong(it.name, it.value)
- is Float -> bundle.putDouble(it.name, it.value.toDouble())
- else -> bundle.putString(it.name, it.value.toString())
- }
- }
- t.logEvent(event, bundle)
- }
-
- override fun startSession() {
- debug("Analytics: start session")
- // automatic with firebase
- }
-
- override fun setUserInfo(vararg p: DataPair) {
- p.forEach { t.setUserProperty(it.name, it.value.toString()) }
- }
-
- override fun increment(name: String, amount: Double) {
- //Mint.logEvent("$name increment")
- }
-
- /**
- * Send a google analyics screen view event
- */
- override fun sendScreenView(name: String) {
- debug("Analytics: start screen $name")
- GeeksvilleApplication.currentActivity?.let {
- t.setCurrentScreen(
- it, name, null
- )
- }
- }
-
- override fun endScreenView() {
- // debug("Analytics: end screen")
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/android/AppPrefs.kt b/app/src/main/java/com/geeksville/mesh/android/AppPrefs.kt
deleted file mode 100644
index dc147bc60..000000000
--- a/app/src/main/java/com/geeksville/mesh/android/AppPrefs.kt
+++ /dev/null
@@ -1,110 +0,0 @@
-package com.geeksville.mesh.android
-
-import android.content.Context
-import android.content.SharedPreferences
-import java.util.UUID
-import kotlin.reflect.KProperty
-
-/**
- * Created by kevinh on 1/4/15.
- */
-
-
-/**
- * A delegate for "foo by FloatPref"
- */
-class FloatPref {
- fun get(thisRef: AppPrefs, prop: KProperty): Float = thisRef.getPrefs().getFloat(thisRef.makeName(prop.name), java.lang.Float.MIN_VALUE)
-
- fun set(thisRef: AppPrefs, prop: KProperty, value: Float) {
- thisRef.setPrefs { e -> e.putFloat(thisRef.makeName(prop.name), value)}
- }
-}
-
-/**
- * A delegate for "foo by StringPref"
- */
-class StringPref(val default: String) {
- fun get(thisRef: AppPrefs, prop: KProperty): String = thisRef.getPrefs().getString(thisRef.makeName(prop.name), default)!!
-
- fun set(thisRef: AppPrefs, prop: KProperty, value: String) {
- thisRef.setPrefs { e ->
- e.putString(thisRef.makeName(prop.name), value)
- }
- }
-}
-
-/**
- * A mixin for accessing android prefs for the app
- */
-public open class AppPrefs(val context: Context) {
-
- companion object {
- private val baseName = "appPrefs_"
- }
-
- fun makeName(s: String) = baseName + s
-
- fun getPrefs() = context.getSharedPreferences("prefs", Context.MODE_PRIVATE)
-
- fun setPrefs(body: (SharedPreferences.Editor) -> Unit) {
- val e = getPrefs().edit()
- body(e)
- e.commit()
- }
-
- fun incPref(name: String) {
- setPrefs { e ->
- e.putInt(name, 1 + getPrefs().getInt(name, 0))
- }
- }
-
- fun removePref(name: String) {
- setPrefs { e ->
- e.remove(name)
- }
- }
-
- fun putPref(name: String, b: Boolean) {
- setPrefs { e ->
- e.putBoolean(name, b)
- }
- }
-
- fun putPref(name: String, b: Float) {
- setPrefs { e ->
- e.putFloat(name, b)
- }
- }
-
- fun putPref(name: String, b: Int) {
- setPrefs { e ->
- e.putInt(name, b)
- }
- }
-
- fun putPref(name: String, b: Set) {
- setPrefs { e ->
- e.putStringSet(name, b)
- }
- }
-
- fun putPref(name: String, b: String) {
- setPrefs { e ->
- e.putString(name, b)
- }
- }
-
- /**
- * Return a persistent installation ID
- */
- fun getInstallId(): String {
- var r = getPrefs().getString(makeName("installId"), "")!!
- if(r == "") {
- r = UUID.randomUUID().toString()
- putPref(makeName("installId"), r)
- }
-
- return r
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/android/BuildUtils.kt b/app/src/main/java/com/geeksville/mesh/android/BuildUtils.kt
deleted file mode 100644
index 93cb401ba..000000000
--- a/app/src/main/java/com/geeksville/mesh/android/BuildUtils.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.geeksville.mesh.android
-
-import android.os.Build
-
-/**
- * Created by kevinh on 1/14/16.
- */
-object BuildUtils : Logging {
-
- fun is64Bit(): Boolean {
- if (Build.VERSION.SDK_INT < 21)
- return false
- else
- return Build.SUPPORTED_64_BIT_ABIS.size > 0
- }
-
- fun isBuggyMoto(): Boolean {
- debug("Device type is: ${Build.DEVICE}")
- return Build.DEVICE == "osprey_u2" // Moto G
- }
-
- /// Are we running on the emulator?
- val isEmulator get() = Build.MODEL == "Android SDK built for x86" || Build.MODEL == "sdk_gphone_x86" || Build.MODEL == "Android SDK built for x86_64"
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/android/ContextExtensions.kt b/app/src/main/java/com/geeksville/mesh/android/ContextExtensions.kt
deleted file mode 100644
index 219585f3c..000000000
--- a/app/src/main/java/com/geeksville/mesh/android/ContextExtensions.kt
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.geeksville.mesh.android
-
-import android.app.Activity
-import android.content.Context
-import android.view.inputmethod.InputMethodManager
-import android.widget.Toast
-
-/// show a toast
-fun Context.toast(message: CharSequence) =
- Toast.makeText(this, message, Toast.LENGTH_SHORT).show()
-
-/// Utility function to hide the soft keyboard per stack overflow
-fun Activity.hideKeyboard() {
- // Check if no view has focus:
- currentFocus?.let { v ->
- val imm =
- getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager
- imm?.hideSoftInputFromWindow(v.windowToken, 0)
- }
-}
diff --git a/app/src/main/java/com/geeksville/mesh/android/ContextServices.kt b/app/src/main/java/com/geeksville/mesh/android/ContextServices.kt
deleted file mode 100644
index 3f5837dcf..000000000
--- a/app/src/main/java/com/geeksville/mesh/android/ContextServices.kt
+++ /dev/null
@@ -1,130 +0,0 @@
-package com.geeksville.mesh.android
-
-import android.Manifest
-import android.app.NotificationManager
-import android.bluetooth.BluetoothManager
-import android.location.LocationManager
-import android.companion.CompanionDeviceManager
-import android.content.Context
-import android.content.pm.PackageManager
-import android.hardware.usb.UsbManager
-import androidx.core.content.ContextCompat
-import com.geeksville.mesh.MainActivity
-import com.geeksville.mesh.R
-
-/**
- * @return null on platforms without a BlueTooth driver (i.e. the emulator)
- */
-val Context.bluetoothManager: BluetoothManager?
- get() = getSystemService(Context.BLUETOOTH_SERVICE).takeIf { hasBluetoothPermission() } as? BluetoothManager?
-
-val Context.deviceManager: CompanionDeviceManager?
- get() {
- if (GeeksvilleApplication.currentActivity is MainActivity) {
- val activity = GeeksvilleApplication.currentActivity
- if (hasCompanionDeviceApi()) return activity?.getSystemService(Context.COMPANION_DEVICE_SERVICE) as? CompanionDeviceManager?
- }
- return null
- }
-
-val Context.usbManager: UsbManager get() = requireNotNull(getSystemService(Context.USB_SERVICE) as? UsbManager?) { "USB_SERVICE is not available"}
-
-val Context.notificationManager: NotificationManager get() = requireNotNull(getSystemService(Context.NOTIFICATION_SERVICE) as? NotificationManager?)
-
-val Context.locationManager: LocationManager get() = requireNotNull(getSystemService(Context.LOCATION_SERVICE) as? LocationManager?)
-
-/**
- * @return true if CompanionDeviceManager API is present
- */
-fun Context.hasCompanionDeviceApi(): Boolean =
- if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O)
- packageManager.hasSystemFeature(PackageManager.FEATURE_COMPANION_DEVICE_SETUP)
- else false
-
-/**
- * @return true if the device has a GPS receiver
- */
-fun Context.hasGps(): Boolean = locationManager.allProviders.contains(LocationManager.GPS_PROVIDER)
-
-/**
- * @return true if the device has a GPS receiver and it is disabled (location turned off)
- */
-fun Context.gpsDisabled(): Boolean =
- if (hasGps()) !locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER) else false
-
-/**
- * return the text string of the permissions missing
- */
-val Context.permissionMissing: String
- get() = if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.S) {
- getString(R.string.permission_missing)
- } else {
- getString(R.string.permission_missing_31)
- }
-
-/**
- * return a list of the permissions we don't have
- */
-fun Context.getMissingPermissions(perms: List): Array = perms.filter {
- ContextCompat.checkSelfPermission(
- this,
- it
- ) != PackageManager.PERMISSION_GRANTED
-}.toTypedArray()
-
-/**
- * Bluetooth permissions (or empty if we already have what we need)
- */
-fun Context.getBluetoothPermissions(): Array {
- val perms = mutableListOf()
-
- if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
- perms.add(Manifest.permission.BLUETOOTH_SCAN)
- perms.add(Manifest.permission.BLUETOOTH_CONNECT)
- } else if (!hasCompanionDeviceApi()) {
- perms.add(Manifest.permission.ACCESS_FINE_LOCATION)
- }
- return getMissingPermissions(perms)
-}
-
-/** @return true if the user already has Bluetooth connect permission */
-fun Context.hasBluetoothPermission() = getBluetoothPermissions().isEmpty()
-
-/**
- * Camera permission (or empty if we already have what we need)
- */
-fun Context.getCameraPermissions(): Array {
- val perms = mutableListOf(Manifest.permission.CAMERA)
-
- return getMissingPermissions(perms)
-}
-
-/** @return true if the user already has camera permission */
-fun Context.hasCameraPermission() = getCameraPermissions().isEmpty()
-
-/**
- * Location permission (or empty if we already have what we need)
- */
-fun Context.getLocationPermissions(): Array {
- val perms = mutableListOf(Manifest.permission.ACCESS_FINE_LOCATION)
-
- return getMissingPermissions(perms)
-}
-
-/** @return true if the user already has location permission */
-fun Context.hasLocationPermission() = getLocationPermissions().isEmpty()
-
-/**
- * A list of missing background location permissions (or empty if we already have what we need)
- */
-fun Context.getBackgroundPermissions(): Array {
- val perms = mutableListOf(Manifest.permission.ACCESS_FINE_LOCATION)
-
- if (android.os.Build.VERSION.SDK_INT >= 29) // only added later
- perms.add(Manifest.permission.ACCESS_BACKGROUND_LOCATION)
-
- return getMissingPermissions(perms)
-}
-
-/** @return true if the user already has background location permission */
-fun Context.hasBackgroundPermission() = getBackgroundPermissions().isEmpty()
diff --git a/app/src/main/java/com/geeksville/mesh/android/DateUtils.kt b/app/src/main/java/com/geeksville/mesh/android/DateUtils.kt
deleted file mode 100644
index ededfa21b..000000000
--- a/app/src/main/java/com/geeksville/mesh/android/DateUtils.kt
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.geeksville.mesh.android
-
-import java.util.*
-
-/**
- * Created by kevinh on 1/13/16.
- */
-object DateUtils {
- fun dateUTC(year: Int, month: Int, day: Int): Date {
- val cal = GregorianCalendar(TimeZone.getTimeZone("GMT"))
- cal.set(year, month, day, 0, 0, 0);
- return Date(cal.getTime().getTime())
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/android/DebugLogFile.kt b/app/src/main/java/com/geeksville/mesh/android/DebugLogFile.kt
deleted file mode 100644
index c5b68e4b8..000000000
--- a/app/src/main/java/com/geeksville/mesh/android/DebugLogFile.kt
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.geeksville.mesh.android
-
-import android.content.Context
-import java.io.File
-import java.io.FileOutputStream
-import java.io.PrintWriter
-
-/**
- * Create a debug log on the SD card (if needed and allowed and app is configured for debugging (FIXME)
- *
- * write strings to that file
- */
-class DebugLogFile(context: Context, name: String) {
- val stream = FileOutputStream(File(context.getExternalFilesDir(null), name), true)
- val file = PrintWriter(stream)
-
- fun close() {
- file.close()
- }
-
- fun log(s: String) {
- file.println(s) // FIXME, optionally include timestamps
- file.flush() // for debugging
- }
-}
-
-
-/**
- * Create a debug log on the SD card (if needed and allowed and app is configured for debugging (FIXME)
- *
- * write strings to that file
- */
-class BinaryLogFile(context: Context, name: String) :
- FileOutputStream(File(context.getExternalFilesDir(null), name), true) {
-
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/android/ExpireChecker.kt b/app/src/main/java/com/geeksville/mesh/android/ExpireChecker.kt
deleted file mode 100644
index a2ccc482f..000000000
--- a/app/src/main/java/com/geeksville/mesh/android/ExpireChecker.kt
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.geeksville.mesh.android
-
-import android.app.Activity
-import android.content.Intent
-import android.net.Uri
-import android.widget.Toast
-import com.geeksville.mesh.R
-import java.util.*
-
-/**
- * Created by kevinh on 1/13/16.
- */
-class ExpireChecker(val context: Activity) : Logging {
-
- fun check(year: Int, month: Int, day: Int) {
- val expireDate = DateUtils.dateUTC(year, month, day)
- val now = Date()
-
- debug("Expire check $now vs $expireDate")
- if (now.after(expireDate))
- doExpire()
- }
-
- private fun doExpire() {
- val packageName = context.packageName
- errormsg("$packageName is too old and must be updated at the Play store")
-
- Toast.makeText(
- context,
- R.string.app_too_old,
- Toast.LENGTH_LONG
- ).show()
- val i = Intent(Intent.ACTION_VIEW)
- i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
- i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
- i.setData(Uri.parse("market://details?id=$packageName&referrer=utm_source%3Dexpired"))
- context.startActivity(i)
- context.finish()
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/android/GeeksvilleApplication.kt b/app/src/main/java/com/geeksville/mesh/android/GeeksvilleApplication.kt
deleted file mode 100644
index 0b34f9f64..000000000
--- a/app/src/main/java/com/geeksville/mesh/android/GeeksvilleApplication.kt
+++ /dev/null
@@ -1,96 +0,0 @@
-package com.geeksville.mesh.android
-
-import android.app.Activity
-import android.app.Application
-import android.content.Context
-import android.content.SharedPreferences
-import android.os.Bundle
-import android.provider.Settings
-import androidx.core.content.edit
-import com.geeksville.mesh.analytics.AnalyticsProvider
-import com.google.android.gms.common.ConnectionResult
-import com.google.android.gms.common.GoogleApiAvailabilityLight
-
-
-fun isGooglePlayAvailable(context: Context): Boolean {
- val a = GoogleApiAvailabilityLight.getInstance()
- val r = a.isGooglePlayServicesAvailable(context)
- return r != ConnectionResult.SERVICE_MISSING && r != ConnectionResult.SERVICE_INVALID
-}
-
-/**
- * Created by kevinh on 1/4/15.
- */
-
-open class GeeksvilleApplication : Application(), Logging {
-
- companion object {
- lateinit var analytics: AnalyticsProvider
- var currentActivity: Activity? = null
- private val backstack = mutableListOf()
- }
-
- private val lifecycleCallbacks = object : ActivityLifecycleCallbacks {
- override fun onActivityPaused(activity: Activity) {
- }
-
- override fun onActivityStarted(activity: Activity) {
- }
-
- override fun onActivityDestroyed(activity: Activity) {
- if (backstack.contains(activity)) backstack.remove(activity)
- currentActivity = backstack.lastOrNull()
- }
-
- override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {
- }
-
- override fun onActivityStopped(activity: Activity) {
- }
-
- override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
- backstack.add(activity)
- currentActivity = backstack.lastOrNull()
- }
-
- override fun onActivityResumed(activity: Activity) {
- }
- }
-
- /// Are we running inside the testlab?
- val isInTestLab: Boolean
- get() {
- val testLabSetting =
- Settings.System.getString(contentResolver, "firebase.test.lab") ?: null
- if(testLabSetting != null)
- info("Testlab is $testLabSetting")
- return "true" == testLabSetting
- }
-
- private val analyticsPrefs: SharedPreferences by lazy {
- getSharedPreferences("analytics-prefs", Context.MODE_PRIVATE)
- }
-
- var isAnalyticsAllowed: Boolean
- get() = analyticsPrefs.getBoolean("allowed", true)
- set(value) {
- analyticsPrefs.edit {
- putBoolean("allowed", value)
- }
-
- // Change the flag with the providers
- analytics.setEnabled(value && !isInTestLab) // Never do analytics in the test lab
- }
-
- override fun onCreate() {
- super.onCreate()
-
- val googleAnalytics = com.geeksville.mesh.analytics.GoogleAnalytics(this)
- analytics = googleAnalytics
-
- // Set analytics per prefs
- isAnalyticsAllowed = isAnalyticsAllowed
-
- registerActivityLifecycleCallbacks(lifecycleCallbacks)
- }
-}
diff --git a/app/src/main/java/com/geeksville/mesh/android/Logging.kt b/app/src/main/java/com/geeksville/mesh/android/Logging.kt
deleted file mode 100644
index 036afb7aa..000000000
--- a/app/src/main/java/com/geeksville/mesh/android/Logging.kt
+++ /dev/null
@@ -1,83 +0,0 @@
-package com.geeksville.mesh.android
-
-import android.os.Build
-import android.util.Log
-import com.geeksville.mesh.BuildConfig
-import com.geeksville.mesh.util.Exceptions
-
-/**
- * Created by kevinh on 12/24/14.
- */
-
-typealias LogPrinter = (Int, String, String) -> Unit
-
-interface Logging {
-
- companion object {
- /** Some vendors strip log messages unless the severity is super high.
- *
- * alps == Soyes
- * HMD Global == mfg of the Nokia 7.2
- */
- private val badVendors = setOf("OnePlus", "alps", "HMD Global", "Sony")
-
- /// if false NO logs will be shown, set this in the application based on BuildConfig.DEBUG
- var showLogs = true
-
- /** if true, all logs will be printed at error level. Sometimes necessary for buggy ROMs
- * that filter logcat output below this level.
- *
- * Since there are so many bad vendors, we just always lie if we are a release build
- */
- var forceErrorLevel = !BuildConfig.DEBUG || badVendors.contains(Build.MANUFACTURER)
-
- /// If false debug logs will not be shown (but others might)
- var showDebug = true
-
- /**
- * By default all logs are printed using the standard android Log class. But clients
- * can change printlog to a different implementation (for logging to files or via
- * google crashlytics)
- */
- var printlog: LogPrinter = { level, tag, message ->
- if (showLogs) {
- if (showDebug || level > Log.DEBUG) {
- Log.println(if (forceErrorLevel) Log.ERROR else level, tag, message)
- }
- }
- }
- }
-
- private fun tag(): String = this.javaClass.getName()
-
- fun info(msg: String) = printlog(Log.INFO, tag(), msg)
- fun verbose(msg: String) = printlog(Log.VERBOSE, tag(), msg)
- fun debug(msg: String) = printlog(Log.DEBUG, tag(), msg)
- fun warn(msg: String) = printlog(Log.WARN, tag(), msg)
-
- /**
- * Log an error message, note - we call this errormsg rather than error because error() is
- * a stdlib function in kotlin in the global namespace and we don't want users to accidentally call that.
- */
- fun errormsg(msg: String, ex: Throwable? = null) {
- if (ex?.message != null)
- printlog(Log.ERROR, tag(), "$msg (exception ${ex.message})")
- else
- printlog(Log.ERROR, tag(), "$msg")
- }
-
- /// Kotlin assertions are disabled on android, so instead we use this assert helper
- fun logAssert(f: Boolean) {
- if (!f) {
- val ex = AssertionError("Assertion failed")
-
- // if(!Debug.isDebuggerConnected())
- throw ex
- }
- }
-
- /// Report an error (including messaging our crash reporter service if allowed
- fun reportError(s: String) {
- Exceptions.report(Exception("logging reportError: $s"), s)
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/android/ServiceClient.kt b/app/src/main/java/com/geeksville/mesh/android/ServiceClient.kt
deleted file mode 100644
index daebfd5b4..000000000
--- a/app/src/main/java/com/geeksville/mesh/android/ServiceClient.kt
+++ /dev/null
@@ -1,114 +0,0 @@
-package com.geeksville.mesh.android
-
-import android.content.ComponentName
-import android.content.Context
-import android.content.Intent
-import android.content.ServiceConnection
-import android.os.IBinder
-import android.os.IInterface
-import com.geeksville.mesh.util.exceptionReporter
-import java.io.Closeable
-import java.lang.IllegalArgumentException
-import java.util.concurrent.locks.ReentrantLock
-import kotlin.concurrent.withLock
-
-class BindFailedException : Exception("bindService failed")
-
-/**
- * A wrapper that cleans up the service binding process
- */
-open class ServiceClient(private val stubFactory: (IBinder) -> T) : Closeable,
- Logging {
-
- var serviceP: T? = null
-
- /// A getter that returns the bound service or throws if not bound
- val service: T
- get() {
- waitConnect() // Wait for at least the initial connection to happen
- return serviceP ?: throw Exception("Service not bound")
- }
-
- private var context: Context? = null
-
- private var isClosed = true
-
- private val lock = ReentrantLock()
- private val condition = lock.newCondition()
-
- /** Call this if you want to stall until the connection is completed */
- fun waitConnect() {
- // Wait until this service is connected
- lock.withLock {
- if (context == null)
- throw Exception("Haven't called connect")
-
- if (serviceP == null)
- condition.await()
- }
- }
-
- fun connect(c: Context, intent: Intent, flags: Int) {
- context = c
- if (isClosed) {
- isClosed = false
- if (!c.bindService(intent, connection, flags)) {
-
- // Some phones seem to ahve a race where if you unbind and quickly rebind bindService returns false. Try
- // a short sleep to see if that helps
- errormsg("Needed to use the second bind attempt hack")
- Thread.sleep(500) // was 200ms, but received an autobug from a Galaxy Note4, android 6.0.1
- if (!c.bindService(intent, connection, flags)) {
- throw BindFailedException()
- }
- }
- } else {
- warn("Ignoring rebind attempt for service")
- }
- }
-
- override fun close() {
- isClosed = true
- try {
- context?.unbindService(connection)
- }
- catch(ex: IllegalArgumentException) {
- // Autobugs show this can generate an illegal arg exception for "service not registered" during reinstall?
- warn("Ignoring error in ServiceClient.close, probably harmless")
- }
- serviceP = null
- context = null
- }
-
- /// Called when we become connected
- open fun onConnected(service: T) {
- }
-
- /// called on loss of connection
- open fun onDisconnected() {
- }
-
- private val connection = object : ServiceConnection {
- override fun onServiceConnected(name: ComponentName, binder: IBinder) = exceptionReporter {
- if (!isClosed) {
- val s = stubFactory(binder)
- serviceP = s
- onConnected(s)
-
- // after calling our handler, tell anyone who was waiting for this connection to complete
- lock.withLock {
- condition.signalAll()
- }
- } else {
- // If we start to close a service, it seems that there is a possibility a onServiceConnected event is the queue
- // for us. Be careful not to process that stale event
- warn("A service connected while we were closing it, ignoring")
- }
- }
-
- override fun onServiceDisconnected(name: ComponentName?) = exceptionReporter {
- serviceP = null
- onDisconnected()
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/concurrent/Coroutines.kt b/app/src/main/java/com/geeksville/mesh/concurrent/Coroutines.kt
deleted file mode 100644
index 89c652b25..000000000
--- a/app/src/main/java/com/geeksville/mesh/concurrent/Coroutines.kt
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.geeksville.mesh.concurrent
-
-import com.geeksville.mesh.util.Exceptions
-import kotlinx.coroutines.CoroutineExceptionHandler
-import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.CoroutineStart
-import kotlinx.coroutines.launch
-import kotlin.coroutines.CoroutineContext
-import kotlin.coroutines.EmptyCoroutineContext
-
-private val errorHandler =
- CoroutineExceptionHandler { _, exception ->
- Exceptions.report(
- exception,
- "MeshService-coroutine",
- "coroutine-exception"
- )
- }
-
-/// Wrap launch with an exception handler, FIXME, move into a utility lib
-fun CoroutineScope.handledLaunch(
- context: CoroutineContext = EmptyCoroutineContext,
- start: CoroutineStart = CoroutineStart.DEFAULT,
- block: suspend CoroutineScope.() -> Unit
-) = this.launch(
- context = context + com.geeksville.mesh.concurrent.errorHandler,
- start = start,
- block = block
-)
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/concurrent/DeferredExecution.kt b/app/src/main/java/com/geeksville/mesh/concurrent/DeferredExecution.kt
deleted file mode 100644
index d6f061e3c..000000000
--- a/app/src/main/java/com/geeksville/mesh/concurrent/DeferredExecution.kt
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.geeksville.mesh.concurrent
-
-import com.geeksville.mesh.android.Logging
-
-
-/**
- * Sometimes when starting services we face situations where messages come in that require computation
- * but we can't do that computation yet because we are still waiting for some long running init to
- * complete.
- *
- * This class lets you queue up closures to run at a later date and later on you can call run() to
- * run all the previously queued work.
- */
-class DeferredExecution : Logging {
- private val queue = mutableListOf<() -> Unit>()
-
- /// Queue some new work
- fun add(fn: () -> Unit) {
- queue.add(fn)
- }
-
- /// run all work in the queue and clear it to be ready to accept new work
- fun run() {
- debug("Running deferred execution numjobs=${queue.size}")
- queue.forEach {
- it()
- }
- queue.clear()
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/concurrent/SyncContinuation.kt b/app/src/main/java/com/geeksville/mesh/concurrent/SyncContinuation.kt
deleted file mode 100644
index 3e270a5f0..000000000
--- a/app/src/main/java/com/geeksville/mesh/concurrent/SyncContinuation.kt
+++ /dev/null
@@ -1,82 +0,0 @@
-package com.geeksville.mesh.concurrent
-
-import com.geeksville.mesh.android.Logging
-
-
-/**
- * A deferred execution object (with various possible implementations)
- */
-interface Continuation : Logging {
- abstract fun resume(res: Result)
-
- // syntactic sugar
-
- fun resumeSuccess(res: T) = resume(Result.success(res))
- fun resumeWithException(ex: Throwable) = try {
- resume(Result.failure(ex))
- } catch (ex: Throwable) {
- // errormsg("Ignoring $ex while resuming, because we are the ones who threw it")
- throw ex
- }
-}
-
-/**
- * An async continuation that just calls a callback when the result is available
- */
-class CallbackContinuation(private val cb: (Result) -> Unit) : Continuation {
- override fun resume(res: Result) = cb(res)
-}
-
-/**
- * This is a blocking/threaded version of coroutine Continuation
- *
- * A little bit ugly, but the coroutine version has a nasty internal bug that showed up
- * in my SyncBluetoothDevice so I needed a quick workaround.
- */
-class SyncContinuation : Continuation {
-
- private val mbox = java.lang.Object()
- private var result: Result? = null
-
- override fun resume(res: Result) {
- synchronized(mbox) {
- result = res
- mbox.notify()
- }
- }
-
- // Wait for the result (or throw an exception)
- fun await(timeoutMsecs: Long = 0): T {
- synchronized(mbox) {
- val startT = System.currentTimeMillis()
- while (result == null) {
- mbox.wait(timeoutMsecs)
-
- if (timeoutMsecs > 0 && ((System.currentTimeMillis() - startT) >= timeoutMsecs))
- throw Exception("SyncContinuation timeout")
- }
-
- val r = result
- if (r != null)
- return r.getOrThrow()
- else
- throw Exception("This shouldn't happen")
- }
- }
-}
-
-/**
- * Calls an init function which is responsible for saving our continuation so that some
- * other thread can call resume or resume with exception.
- *
- * Essentially this is a blocking version of the (buggy) coroutine suspendCoroutine
- */
-fun suspend(timeoutMsecs: Long = -1, initfn: (SyncContinuation) -> Unit): T {
- val cont = SyncContinuation()
-
- // First call the init funct
- initfn(cont)
-
- // Now wait for the continuation to finish
- return cont.await(timeoutMsecs)
-}
diff --git a/app/src/main/java/com/geeksville/mesh/database/Converters.kt b/app/src/main/java/com/geeksville/mesh/database/Converters.kt
deleted file mode 100644
index 9639bcf3d..000000000
--- a/app/src/main/java/com/geeksville/mesh/database/Converters.kt
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.geeksville.mesh.database
-
-import androidx.room.TypeConverter
-import com.geeksville.mesh.DataPacket
-import com.geeksville.mesh.MeshProtos.MeshPacket
-import com.google.protobuf.TextFormat
-import kotlinx.serialization.json.Json
-
-class Converters {
- @TypeConverter
- fun dataFromString(value: String): DataPacket {
- val json = Json { isLenient = true }
- return json.decodeFromString(DataPacket.serializer(), value)
- }
-
- @TypeConverter
- fun dataToString(value: DataPacket): String {
- val json = Json { isLenient = true }
- return json.encodeToString(DataPacket.serializer(), value)
- }
-
- @TypeConverter
- fun protoFromString(value: String): MeshPacket {
- val builder = MeshPacket.newBuilder()
- TextFormat.getParser().merge(value, builder)
- return builder.build()
- }
-
- @TypeConverter
- fun protoToString(value: MeshPacket): String {
- return value.toString()
- }
-}
diff --git a/app/src/main/java/com/geeksville/mesh/database/DatabaseModule.kt b/app/src/main/java/com/geeksville/mesh/database/DatabaseModule.kt
deleted file mode 100644
index d7412e61c..000000000
--- a/app/src/main/java/com/geeksville/mesh/database/DatabaseModule.kt
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.geeksville.mesh.database
-
-import android.app.Application
-import com.geeksville.mesh.database.dao.MeshLogDao
-import com.geeksville.mesh.database.dao.PacketDao
-import com.geeksville.mesh.database.dao.QuickChatActionDao
-import dagger.Module
-import dagger.Provides
-import dagger.hilt.InstallIn
-import dagger.hilt.components.SingletonComponent
-import javax.inject.Singleton
-
-@InstallIn(SingletonComponent::class)
-@Module
-class DatabaseModule {
- @Provides
- @Singleton
- fun provideDatabase(app: Application): MeshtasticDatabase =
- MeshtasticDatabase.getDatabase(app)
-
- @Provides
- fun providePacketDao(database: MeshtasticDatabase): PacketDao {
- return database.packetDao()
- }
-
- @Provides
- fun provideMeshLogDao(database: MeshtasticDatabase): MeshLogDao {
- return database.meshLogDao()
- }
-
- @Provides
- fun provideQuickChatActionDao(database: MeshtasticDatabase): QuickChatActionDao {
- return database.quickChatActionDao()
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/database/MeshLogRepository.kt b/app/src/main/java/com/geeksville/mesh/database/MeshLogRepository.kt
deleted file mode 100644
index 5a7e7fe18..000000000
--- a/app/src/main/java/com/geeksville/mesh/database/MeshLogRepository.kt
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.geeksville.mesh.database
-
-import com.geeksville.mesh.database.dao.MeshLogDao
-import com.geeksville.mesh.database.entity.MeshLog
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.flow.Flow
-import kotlinx.coroutines.withContext
-import javax.inject.Inject
-
-class MeshLogRepository @Inject constructor(private val meshLogDaoLazy: dagger.Lazy) {
- private val meshLogDao by lazy {
- meshLogDaoLazy.get()
- }
-
- suspend fun getAllLogs(): Flow> = withContext(Dispatchers.IO) {
- meshLogDao.getAllLogs(MAX_ITEMS)
- }
-
- suspend fun getAllLogsInReceiveOrder(maxItems: Int = MAX_ITEMS): Flow> = withContext(Dispatchers.IO) {
- meshLogDao.getAllLogsInReceiveOrder(maxItems)
- }
-
- suspend fun insert(log: MeshLog) = withContext(Dispatchers.IO) {
- meshLogDao.insert(log)
- }
-
- suspend fun deleteAll() = withContext(Dispatchers.IO) {
- meshLogDao.deleteAll()
- }
-
- companion object {
- private const val MAX_ITEMS = 500
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/database/MeshtasticDatabase.kt b/app/src/main/java/com/geeksville/mesh/database/MeshtasticDatabase.kt
deleted file mode 100644
index 8b736f0b9..000000000
--- a/app/src/main/java/com/geeksville/mesh/database/MeshtasticDatabase.kt
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.geeksville.mesh.database
-
-import android.content.Context
-import androidx.room.Database
-import androidx.room.Room
-import androidx.room.RoomDatabase
-import androidx.room.TypeConverters
-import com.geeksville.mesh.database.dao.PacketDao
-import com.geeksville.mesh.database.dao.MeshLogDao
-import com.geeksville.mesh.database.dao.QuickChatActionDao
-import com.geeksville.mesh.database.entity.MeshLog
-import com.geeksville.mesh.database.entity.Packet
-import com.geeksville.mesh.database.entity.QuickChatAction
-
-@Database(entities = [Packet::class, MeshLog::class, QuickChatAction::class], version = 3, exportSchema = false)
-@TypeConverters(Converters::class)
-abstract class MeshtasticDatabase : RoomDatabase() {
- abstract fun packetDao(): PacketDao
- abstract fun meshLogDao(): MeshLogDao
- abstract fun quickChatActionDao(): QuickChatActionDao
-
- companion object {
- fun getDatabase(context: Context): MeshtasticDatabase {
-
- return Room.databaseBuilder(
- context.applicationContext,
- MeshtasticDatabase::class.java,
- "meshtastic_database"
- )
- .fallbackToDestructiveMigration()
- .build()
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/database/PacketRepository.kt b/app/src/main/java/com/geeksville/mesh/database/PacketRepository.kt
deleted file mode 100644
index 56eea3ee8..000000000
--- a/app/src/main/java/com/geeksville/mesh/database/PacketRepository.kt
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.geeksville.mesh.database
-
-import com.geeksville.mesh.DataPacket
-import com.geeksville.mesh.MessageStatus
-import com.geeksville.mesh.database.dao.PacketDao
-import com.geeksville.mesh.database.entity.Packet
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.flow.Flow
-import kotlinx.coroutines.withContext
-import javax.inject.Inject
-
-class PacketRepository @Inject constructor(private val packetDaoLazy: dagger.Lazy) {
- private val packetDao by lazy {
- packetDaoLazy.get()
- }
-
- suspend fun getAllPackets(): Flow> = withContext(Dispatchers.IO) {
- packetDao.getAllPackets()
- }
-
- suspend fun insert(packet: Packet) = withContext(Dispatchers.IO) {
- packetDao.insert(packet)
- }
-
- suspend fun getMessagesFrom(contact: String) = withContext(Dispatchers.IO) {
- packetDao.getMessagesFrom(contact)
- }
-
- suspend fun updateMessageStatus(d: DataPacket, m: MessageStatus) = withContext(Dispatchers.IO) {
- packetDao.updateMessageStatus(d, m)
- }
-
- suspend fun deleteAllMessages() = withContext(Dispatchers.IO) {
- packetDao.deleteAllMessages()
- }
-
- suspend fun deleteMessages(uuidList: List) = withContext(Dispatchers.IO) {
- packetDao.deleteMessages(uuidList)
- }
- suspend fun delete(packet: Packet) = withContext(Dispatchers.IO) {
- packetDao.delete(packet)
- }
-
- suspend fun update(packet: Packet) = withContext(Dispatchers.IO) {
- packetDao.update(packet)
- }
-}
diff --git a/app/src/main/java/com/geeksville/mesh/database/QuickChatActionRepository.kt b/app/src/main/java/com/geeksville/mesh/database/QuickChatActionRepository.kt
deleted file mode 100644
index 0bef1c756..000000000
--- a/app/src/main/java/com/geeksville/mesh/database/QuickChatActionRepository.kt
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.geeksville.mesh.database
-
-import com.geeksville.mesh.database.dao.QuickChatActionDao
-import com.geeksville.mesh.database.entity.QuickChatAction
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.flow.Flow
-import kotlinx.coroutines.withContext
-import javax.inject.Inject
-
-class QuickChatActionRepository @Inject constructor(private val quickChatDaoLazy: dagger.Lazy) {
- private val quickChatActionDao by lazy {
- quickChatDaoLazy.get()
- }
-
- suspend fun getAllActions(): Flow> = withContext(Dispatchers.IO) {
- quickChatActionDao.getAll()
- }
-
- suspend fun insert(action: QuickChatAction) = withContext(Dispatchers.IO) {
- quickChatActionDao.insert(action)
- }
-
- suspend fun deleteAll() = withContext(Dispatchers.IO) {
- quickChatActionDao.deleteAll()
- }
-
- suspend fun delete(action: QuickChatAction) = withContext(Dispatchers.IO) {
- quickChatActionDao.delete(action)
- }
-
- suspend fun update(action: QuickChatAction) = withContext(Dispatchers.IO) {
- quickChatActionDao.update(action)
- }
-
- suspend fun setItemPosition(uuid: Long, newPos: Int) = withContext(Dispatchers.IO) {
- quickChatActionDao.updateActionPosition(uuid, newPos)
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/database/dao/MeshLogDao.kt b/app/src/main/java/com/geeksville/mesh/database/dao/MeshLogDao.kt
deleted file mode 100644
index 72918b0c7..000000000
--- a/app/src/main/java/com/geeksville/mesh/database/dao/MeshLogDao.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.geeksville.mesh.database.dao
-
-import androidx.room.Dao
-import androidx.room.Insert
-import androidx.room.Query
-import com.geeksville.mesh.database.entity.MeshLog
-import kotlinx.coroutines.flow.Flow
-
-@Dao
-interface MeshLogDao {
-
- @Query("Select * from log order by received_date desc limit 0,:maxItem")
- fun getAllLogs(maxItem: Int): Flow>
-
- @Query("Select * from log order by received_date asc limit 0,:maxItem")
- fun getAllLogsInReceiveOrder(maxItem: Int): Flow>
-
- @Insert
- fun insert(log: MeshLog)
-
- @Query("DELETE from log")
- fun deleteAll()
-
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/database/dao/PacketDao.kt b/app/src/main/java/com/geeksville/mesh/database/dao/PacketDao.kt
deleted file mode 100644
index 82f4fbab3..000000000
--- a/app/src/main/java/com/geeksville/mesh/database/dao/PacketDao.kt
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.geeksville.mesh.database.dao
-
-import androidx.room.Dao
-import androidx.room.Insert
-import androidx.room.Update
-import androidx.room.Query
-import androidx.room.Transaction
-import com.geeksville.mesh.DataPacket
-import com.geeksville.mesh.MessageStatus
-import com.geeksville.mesh.database.entity.Packet
-import kotlinx.coroutines.flow.Flow
-
-@Dao
-interface PacketDao {
-
- @Query("Select * from packet order by received_time asc")
- fun getAllPackets(): Flow>
-
- @Insert
- fun insert(packet: Packet)
-
- @Query("Select * from packet where port_num = 1 and contact_key = :contact order by received_time asc")
- fun getMessagesFrom(contact: String): Flow>
-
- @Query("Select * from packet where data = :data")
- fun findDataPacket(data: DataPacket): Packet?
-
- @Query("Delete from packet where port_num = 1")
- fun deleteAllMessages()
-
- @Query("Delete from packet where uuid in (:uuidList)")
- fun deleteMessages(uuidList: List)
-
- @Query("Delete from packet where uuid=:uuid")
- fun _delete(uuid: Long)
-
- @Transaction
- fun delete(packet: Packet) {
- _delete(packet.uuid)
- }
-
- @Update
- fun update(packet: Packet)
-
- @Transaction
- fun updateMessageStatus(data: DataPacket, m: MessageStatus) {
- val new = data.copy(status = m)
- findDataPacket(data)?.let { update(it.copy(data = new)) }
- }
-}
diff --git a/app/src/main/java/com/geeksville/mesh/database/dao/QuickChatActionDao.kt b/app/src/main/java/com/geeksville/mesh/database/dao/QuickChatActionDao.kt
deleted file mode 100644
index 8af931323..000000000
--- a/app/src/main/java/com/geeksville/mesh/database/dao/QuickChatActionDao.kt
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.geeksville.mesh.database.dao
-
-import androidx.room.*
-import com.geeksville.mesh.database.entity.QuickChatAction
-import kotlinx.coroutines.flow.Flow
-
-@Dao
-interface QuickChatActionDao {
-
- @Query("Select * from quick_chat order by position asc")
- fun getAll(): Flow>
-
- @Insert
- fun insert(action: QuickChatAction)
-
- @Query("Delete from quick_chat")
- fun deleteAll()
-
- @Query("Delete from quick_chat where uuid=:uuid")
- fun _delete(uuid: Long)
-
- @Transaction
- fun delete(action: QuickChatAction) {
- _delete(action.uuid)
- decrementPositionsAfter(action.position)
- }
-
- @Update
- fun update(action: QuickChatAction)
-
- @Query("Update quick_chat set position=:position WHERE uuid=:uuid")
- fun updateActionPosition(uuid: Long, position: Int)
-
- @Query("Update quick_chat set position=position-1 where position>=:position")
- fun decrementPositionsAfter(position: Int)
-
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/database/entity/MeshLog.kt b/app/src/main/java/com/geeksville/mesh/database/entity/MeshLog.kt
deleted file mode 100644
index 7b03ff5b1..000000000
--- a/app/src/main/java/com/geeksville/mesh/database/entity/MeshLog.kt
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.geeksville.mesh.database.entity
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-import com.geeksville.mesh.MeshProtos
-import com.geeksville.mesh.Portnums
-import com.google.protobuf.TextFormat
-import java.io.IOException
-
-
-@Entity(tableName = "log")
-data class MeshLog(@PrimaryKey val uuid: String,
- @ColumnInfo(name = "type") val message_type: String,
- @ColumnInfo(name = "received_date") val received_date: Long,
- @ColumnInfo(name = "message") val raw_message: String
-) {
-
- val meshPacket: MeshProtos.MeshPacket?
- get() {
- if (message_type == "Packet") {
- val builder = MeshProtos.MeshPacket.newBuilder()
- try {
- TextFormat.getParser().merge(raw_message, builder)
- return builder.build()
- } catch (e: IOException) {
- }
- }
- return null
- }
-
- val nodeInfo: MeshProtos.NodeInfo?
- get() {
- if (message_type == "NodeInfo") {
- val builder = MeshProtos.NodeInfo.newBuilder()
- try {
- TextFormat.getParser().merge(raw_message, builder)
- return builder.build()
- } catch (e: IOException) {
- }
- }
- return null
- }
-
- val position: MeshProtos.Position?
- get() {
- return meshPacket?.run {
- if (hasDecoded() && decoded.portnumValue == Portnums.PortNum.POSITION_APP_VALUE) {
- return MeshProtos.Position.parseFrom(decoded.payload)
- }
- return null
- } ?: nodeInfo?.position
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/database/entity/Packet.kt b/app/src/main/java/com/geeksville/mesh/database/entity/Packet.kt
deleted file mode 100644
index c9d1b995a..000000000
--- a/app/src/main/java/com/geeksville/mesh/database/entity/Packet.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.geeksville.mesh.database.entity
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-import com.geeksville.mesh.DataPacket
-
-@Entity(tableName = "packet")
-data class Packet(
- @PrimaryKey(autoGenerate = true) val uuid: Long,
- @ColumnInfo(name = "port_num") val port_num: Int,
- @ColumnInfo(name = "contact_key") val contact_key: String,
- @ColumnInfo(name = "received_time") val received_time: Long,
- @ColumnInfo(name = "data") val data: DataPacket
-) {
-}
diff --git a/app/src/main/java/com/geeksville/mesh/database/entity/QuickChatAction.kt b/app/src/main/java/com/geeksville/mesh/database/entity/QuickChatAction.kt
deleted file mode 100644
index f9cc237f6..000000000
--- a/app/src/main/java/com/geeksville/mesh/database/entity/QuickChatAction.kt
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.geeksville.mesh.database.entity
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.Index
-import androidx.room.PrimaryKey
-
-@Entity(tableName = "quick_chat")
-data class QuickChatAction(
- @PrimaryKey(autoGenerate = true) val uuid: Long,
- @ColumnInfo(name="name") val name: String,
- @ColumnInfo(name="message") val message: String,
- @ColumnInfo(name="mode") val mode: Mode,
- @ColumnInfo(name="position") val position: Int) {
- enum class Mode {
- Append,
- Instant,
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/model/BTScanModel.kt b/app/src/main/java/com/geeksville/mesh/model/BTScanModel.kt
deleted file mode 100644
index fd59b8c12..000000000
--- a/app/src/main/java/com/geeksville/mesh/model/BTScanModel.kt
+++ /dev/null
@@ -1,506 +0,0 @@
-package com.geeksville.mesh.model
-
-import android.annotation.SuppressLint
-import android.app.Application
-import android.app.PendingIntent
-import android.bluetooth.BluetoothDevice
-import android.bluetooth.le.*
-import android.companion.AssociationRequest
-import android.companion.BluetoothDeviceFilter
-import android.companion.CompanionDeviceManager
-import android.content.*
-import android.hardware.usb.UsbDevice
-import android.hardware.usb.UsbManager
-import android.net.nsd.NsdServiceInfo
-import android.os.RemoteException
-import androidx.activity.result.IntentSenderRequest
-import androidx.lifecycle.LiveData
-import androidx.lifecycle.MutableLiveData
-import androidx.lifecycle.ViewModel
-import androidx.lifecycle.viewModelScope
-import com.geeksville.mesh.android.GeeksvilleApplication
-import com.geeksville.mesh.android.Logging
-import com.geeksville.mesh.MainActivity
-import com.geeksville.mesh.R
-import com.geeksville.mesh.android.*
-import com.geeksville.mesh.repository.bluetooth.BluetoothRepository
-import com.geeksville.mesh.repository.nsd.NsdRepository
-import com.geeksville.mesh.repository.radio.MockInterface
-import com.geeksville.mesh.repository.radio.RadioInterfaceService
-import com.geeksville.mesh.repository.radio.SerialInterface
-import com.geeksville.mesh.repository.usb.UsbRepository
-import com.geeksville.mesh.ui.SLogging
-import com.geeksville.mesh.ui.changeDeviceSelection
-import com.geeksville.mesh.util.anonymize
-import com.geeksville.mesh.util.exceptionReporter
-import com.hoho.android.usbserial.driver.UsbSerialDriver
-import dagger.hilt.android.lifecycle.HiltViewModel
-import kotlinx.coroutines.Job
-import kotlinx.coroutines.flow.launchIn
-import kotlinx.coroutines.flow.onEach
-import java.util.regex.Pattern
-import javax.inject.Inject
-
-/// Show the UI asking the user to bond with a device, call changeSelection() if/when bonding completes
-@SuppressLint("MissingPermission")
-private fun requestBonding(
- activity: MainActivity,
- device: BluetoothDevice,
- onComplete: (Int) -> Unit
-) {
- SLogging.info("Starting bonding for ${device.anonymize}")
-
- // We need this receiver to get informed when the bond attempt finished
- val bondChangedReceiver = object : BroadcastReceiver() {
-
- override fun onReceive(
- context: Context,
- intent: Intent
- ) = exceptionReporter {
- val state =
- intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE, -1)
- SLogging.debug("Received bond state changed $state")
-
- if (state != BluetoothDevice.BOND_BONDING) {
- context.unregisterReceiver(this) // we stay registered until bonding completes (either with BONDED or NONE)
- SLogging.debug("Bonding completed, state=$state")
- onComplete(state)
- }
- }
- }
-
- val filter = IntentFilter()
- filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED)
- activity.registerReceiver(bondChangedReceiver, filter)
-
- // We ignore missing BT adapters, because it lets us run on the emulator
- try {
- device.createBond()
- } catch (ex: Throwable) {
- SLogging.warn("Failed creating Bluetooth bond: ${ex.message}")
- }
-}
-
-@HiltViewModel
-class BTScanModel @Inject constructor(
- private val application: Application,
- private val bluetoothRepository: BluetoothRepository,
- private val usbRepository: UsbRepository,
- private val nsdRepository: NsdRepository,
- private val radioInterfaceService: RadioInterfaceService,
-) : ViewModel(), Logging {
-
- private val context: Context get() = application.applicationContext
-
- init {
- debug("BTScanModel created")
- }
-
- /** *fullAddress* = interface prefix + address (example: "x7C:9E:BD:F0:BE:BE") */
- open class DeviceListEntry(val name: String, val fullAddress: String, val bonded: Boolean) {
- val prefix get() = fullAddress[0]
- val address get() = fullAddress.substring(1)
-
- override fun toString(): String {
- return "DeviceListEntry(name=${name.anonymize}, addr=${address.anonymize}, bonded=$bonded)"
- }
-
- val isBLE: Boolean get() = prefix == 'x'
- val isUSB: Boolean get() = prefix == 's'
- val isTCP: Boolean get() = prefix == 't'
- }
-
- class USBDeviceListEntry(usbManager: UsbManager, val usb: UsbSerialDriver) : DeviceListEntry(
- usb.device.deviceName,
- SerialInterface.toInterfaceName(usb.device.deviceName),
- SerialInterface.assumePermission || usbManager.hasPermission(usb.device)
- )
-
- class TCPDeviceListEntry(val service: NsdServiceInfo) : DeviceListEntry(
- service.host.toString().substring(1),
- service.host.toString().replace("/", "t"),
- true
- )
-
- override fun onCleared() {
- super.onCleared()
- debug("BTScanModel cleared")
- }
-
- private val deviceManager get() = context.deviceManager
- val hasCompanionDeviceApi get() = application.hasCompanionDeviceApi()
- val hasBluetoothPermission get() = application.hasBluetoothPermission()
- private val usbManager get() = context.usbManager
-
- var selectedAddress: String? = null
- val errorText = object : MutableLiveData(null) {}
-
- private var scanner: BluetoothLeScanner? = null
-
- val selectedBluetooth: Boolean get() = selectedAddress?.get(0) == 'x'
-
- /// Use the string for the NopInterface
- val selectedNotNull: String get() = selectedAddress ?: "n"
-
- private val scanCallback = object : ScanCallback() {
- override fun onScanFailed(errorCode: Int) {
- val msg = "Unexpected bluetooth scan failure: $errorCode"
- errormsg(msg)
- // error code2 seems to be indicate hung bluetooth stack
- errorText.value = msg
- }
-
- // For each device that appears in our scan, ask for its GATT, when the gatt arrives,
- // check if it is an eligible device and store it in our list of candidates
- // if that device later disconnects remove it as a candidate
- @SuppressLint("MissingPermission")
- override fun onScanResult(callbackType: Int, result: ScanResult) {
-
- if (result.device.name.let { it != null && it.matches(Regex(BLE_NAME_PATTERN)) }) {
- val addr = result.device.address
- val fullAddr = "x$addr" // full address with the bluetooth prefix added
- // prevent log spam because we'll get lots of redundant scan results
- val isBonded = result.device.bondState == BluetoothDevice.BOND_BONDED
- val oldDevs = devices.value!!
- val oldEntry = oldDevs[fullAddr]
- if (oldEntry == null || oldEntry.bonded != isBonded) { // Don't spam the GUI with endless updates for non changing nodes
- val entry = DeviceListEntry(
- result.device.name
- ?: "unnamed-$addr", // autobug: some devices might not have a name, if someone is running really old device code?
- fullAddr,
- isBonded
- )
- // If nothing was selected, by default select the first valid thing we see
- val activity: MainActivity? = try {
- GeeksvilleApplication.currentActivity as MainActivity? // Can be null if app is shutting down
- } catch (_: ClassCastException) {
- // Buggy "Z812" phones apparently have the wrong class type for this
- errormsg("Unexpected class for main activity")
- null
- }
-
- if (selectedAddress == null && entry.bonded && activity != null)
- changeScanSelection(activity, fullAddr)
- addDevice(entry) // Add/replace entry
- }
- }
- }
- }
-
- private fun addDevice(entry: DeviceListEntry) {
- val oldDevs = devices.value!!
- oldDevs[entry.fullAddress] = entry // Add/replace entry
- devices.value = oldDevs // trigger gui updates
- }
-
- @SuppressLint("MissingPermission")
- fun stopScan() {
- // Stop Network Service Discovery (for TCP)
- networkDiscovery?.cancel()
-
- if (scanner != null) {
- debug("stopping scan")
- try {
- scanner?.stopScan(scanCallback)
- } catch (ex: Throwable) {
- warn("Ignoring error stopping scan, probably BT adapter was disabled suddenly: ${ex.message}")
- } finally {
- scanner = null
- _spinner.value = false
- }
- } else _spinner.value = false
- }
-
- /**
- * returns true if we could start scanning, false otherwise
- */
- fun setupScan(): Boolean {
- selectedAddress = radioInterfaceService.getDeviceAddress()
-
- return if (MockInterface.addressValid(context, usbRepository, "")) {
- warn("Running under emulator/test lab")
-
- val testnodes = listOf(
- DeviceListEntry("Included simulator", "m", true),
- DeviceListEntry("Complete simulator", "t10.0.2.2", true),
- DeviceListEntry(context.getString(R.string.none), "n", true)
- /* Don't populate fake bluetooth devices, because we don't want testlab inside of google
- to try and use them.
-
- DeviceListEntry("Meshtastic_ab12", "xaa", false),
- DeviceListEntry("Meshtastic_32ac", "xbb", true) */
- )
-
- devices.value = (testnodes.map { it.fullAddress to it }).toMap().toMutableMap()
-
- // If nothing was selected, by default select the first thing we see
- val activity = GeeksvilleApplication.currentActivity
- if (selectedAddress == null && activity is MainActivity)
- changeScanSelection(
- activity,
- testnodes.first().fullAddress
- )
-
- true
- } else {
- if (scanner == null) {
- // Clear the old device list
- devices.value?.clear()
-
- // Include a placeholder for "None"
- addDevice(DeviceListEntry(context.getString(R.string.none), "n", true))
-
- // Include paired Bluetooth devices
- addBluetoothDevices()
-
- // Include Network Service Discovery
- nsdRepository.resolvedList?.forEach { service ->
- addDevice(TCPDeviceListEntry(service))
- }
-
- val serialDevices by lazy { usbRepository.serialDevicesWithDrivers.value }
- serialDevices.forEach { (_, d) ->
- addDevice(USBDeviceListEntry(usbManager, d))
- }
- } else {
- debug("scan already running")
- }
- true
- }
- }
-
- private var networkDiscovery: Job? = null
- fun startScan() {
- _spinner.value = true
-
- // Start Network Service Discovery (find TCP devices)
- networkDiscovery = nsdRepository.networkDiscoveryFlow()
- .onEach { addDevice(TCPDeviceListEntry(it)) }
- .launchIn(viewModelScope)
-
- if (hasBluetoothPermission) {
- if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.S && hasCompanionDeviceApi)
- startCompanionScan() else startClassicScan()
- }
- }
-
- @SuppressLint("MissingPermission")
- private fun startClassicScan() {
- /// The following call might return null if the user doesn't have bluetooth access permissions
- val bluetoothLeScanner = bluetoothRepository.getBluetoothLeScanner()
-
- if (bluetoothLeScanner != null) { // could be null if bluetooth is disabled
- debug("starting classic scan")
-
- // filter and only accept devices that have our service
- val filter =
- ScanFilter.Builder()
- // Samsung doesn't seem to filter properly by service so this can't work
- // see https://stackoverflow.com/questions/57981986/altbeacon-android-beacon-library-not-working-after-device-has-screen-off-for-a-s/57995960#57995960
- // and https://stackoverflow.com/a/45590493
- // .setServiceUuid(ParcelUuid(BluetoothInterface.BTM_SERVICE_UUID))
- .build()
-
- val settings =
- ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY)
- .build()
- bluetoothLeScanner.startScan(listOf(filter), settings, scanCallback)
- scanner = bluetoothLeScanner
- }
- }
-
- /**
- * @return DeviceListEntry from full Address (prefix + address).
- * If Bluetooth is enabled and BLE Address is valid, get remote device information.
- */
- @SuppressLint("MissingPermission")
- fun getDeviceListEntry(fullAddress: String, bonded: Boolean = false): DeviceListEntry {
- val address = fullAddress.substring(1)
- val device = bluetoothRepository.getRemoteDevice(address)
- return if (device != null && device.name != null) {
- DeviceListEntry(device.name, fullAddress, device.bondState != BluetoothDevice.BOND_NONE)
- } else {
- DeviceListEntry(address, fullAddress, bonded)
- }
- }
-
- @SuppressLint("MissingPermission")
- private fun addBluetoothDevices() {
- bluetoothRepository.getBondedDevices()
- ?.filter { it.name != null && it.name.matches(Regex(BLE_NAME_PATTERN)) }
- ?.forEach {
- addDevice(DeviceListEntry(it.name, "x${it.address}", true))
- }
- }
-
- private val _spinner = MutableLiveData(false)
- val spinner: LiveData get() = _spinner
-
- private val _associationRequest = MutableLiveData(null)
- val associationRequest: LiveData get() = _associationRequest
-
- /**
- * Called immediately after fragment observes CompanionDeviceManager activity result
- */
- fun clearAssociationRequest() {
- _associationRequest.value = null
- }
-
- @SuppressLint("NewApi")
- private fun associationRequest(): AssociationRequest {
- // To skip filtering based on name and supported feature flags (UUIDs),
- // don't include calls to setNamePattern() and addServiceUuid(),
- // respectively. This example uses Bluetooth.
- // We only look for Mesh (rather than the full name) because NRF52 uses a very short name
- val deviceFilter: BluetoothDeviceFilter = BluetoothDeviceFilter.Builder()
- .setNamePattern(Pattern.compile(BLE_NAME_PATTERN))
- // .addServiceUuid(ParcelUuid(BluetoothInterface.BTM_SERVICE_UUID), null)
- .build()
-
- // The argument provided in setSingleDevice() determines whether a single
- // device name or a list of device names is presented to the user as
- // pairing options.
- return AssociationRequest.Builder()
- .addDeviceFilter(deviceFilter)
- .setSingleDevice(false)
- .build()
- }
-
- @SuppressLint("NewApi")
- private fun startCompanionScan() {
- debug("starting companion scan")
- deviceManager?.associate(
- associationRequest(),
- @SuppressLint("NewApi")
- object : CompanionDeviceManager.Callback() {
- override fun onDeviceFound(chooserLauncher: IntentSender) {
- debug("CompanionDeviceManager - device found")
- _spinner.value = false
- chooserLauncher.let {
- val request: IntentSenderRequest = IntentSenderRequest.Builder(it).build()
- _associationRequest.value = request
- }
- }
-
- override fun onFailure(error: CharSequence?) {
- warn("BLE selection service failed $error")
- }
- }, null
- )
- }
-
- val devices = object : MutableLiveData>(mutableMapOf()) {
-
- /**
- * Called when the number of active observers change from 1 to 0.
- *
- *
- * This does not mean that there are no observers left, there may still be observers but their
- * lifecycle states aren't [Lifecycle.State.STARTED] or [Lifecycle.State.RESUMED]
- * (like an Activity in the back stack).
- *
- *
- * You can check if there are observers via [.hasObservers].
- */
- override fun onInactive() {
- super.onInactive()
- stopScan()
- }
- }
-
- /// Called by the GUI when a new device has been selected by the user
- /// Returns true if we were able to change to that item
- fun onSelected(activity: MainActivity, it: DeviceListEntry): Boolean {
- // If the device is paired, let user select it, otherwise start the pairing flow
- if (it.bonded) {
- changeScanSelection(activity, it.fullAddress)
- return true
- } else {
- // Handle requesting USB or bluetooth permissions for the device
- debug("Requesting permissions for the device")
-
- exceptionReporter {
- if (it.isBLE) {
- // Request bonding for bluetooth
- // We ignore missing BT adapters, because it lets us run on the emulator
- bluetoothRepository
- .getRemoteDevice(it.address)?.let { device ->
- requestBonding(activity, device) { state ->
- if (state == BluetoothDevice.BOND_BONDED) {
- errorText.value = activity.getString(R.string.pairing_completed)
- changeScanSelection(activity, it.fullAddress)
- } else {
- errorText.value =
- activity.getString(R.string.pairing_failed_try_again)
- }
-
- // Force the GUI to redraw
- devices.value = devices.value
- }
- }
- }
- }
-
- if (it.isUSB) {
- it as USBDeviceListEntry
-
- val usbReceiver = object : BroadcastReceiver() {
-
- override fun onReceive(context: Context, intent: Intent) {
- if (ACTION_USB_PERMISSION == intent.action) {
-
- val device: UsbDevice =
- intent.getParcelableExtra(UsbManager.EXTRA_DEVICE)!!
-
- if (intent.getBooleanExtra(
- UsbManager.EXTRA_PERMISSION_GRANTED,
- false
- )
- ) {
- info("User approved USB access")
- changeScanSelection(activity, it.fullAddress)
-
- // Force the GUI to redraw
- devices.value = devices.value
- } else {
- errormsg("USB permission denied for device $device")
- }
- }
- // We don't need to stay registered
- activity.unregisterReceiver(this)
- }
- }
-
- val permissionIntent =
- if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.S) {
- PendingIntent.getBroadcast(activity, 0, Intent(ACTION_USB_PERMISSION), 0)
- } else {
- PendingIntent.getBroadcast(activity, 0, Intent(ACTION_USB_PERMISSION), PendingIntent.FLAG_IMMUTABLE)
- }
- val filter = IntentFilter(ACTION_USB_PERMISSION)
- activity.registerReceiver(usbReceiver, filter)
- usbManager.requestPermission(it.usb.device, permissionIntent)
- }
-
- return false
- }
- }
-
- /// Change to a new macaddr selection, updating GUI and radio
- fun changeScanSelection(context: MainActivity, newAddr: String) {
- try {
- info("Changing device to ${newAddr.anonymize}")
- changeDeviceSelection(context, newAddr)
- selectedAddress =
- newAddr // do this after changeDeviceSelection, so if it throws the change will be discarded
- devices.value = devices.value // Force a GUI update
- } catch (ex: RemoteException) {
- errormsg("Failed talking to service, probably it is shutting down $ex.message")
- // ignore the failure and the GUI won't be updating anyways
- }
- }
- companion object {
- const val BLE_NAME_PATTERN = "^\\S+\$"
- const val ACTION_USB_PERMISSION = "com.geeksville.mesh.USB_PERMISSION"
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/model/BluetoothViewModel.kt b/app/src/main/java/com/geeksville/mesh/model/BluetoothViewModel.kt
deleted file mode 100644
index 6562f41be..000000000
--- a/app/src/main/java/com/geeksville/mesh/model/BluetoothViewModel.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.geeksville.mesh.model
-
-import androidx.lifecycle.ViewModel
-import androidx.lifecycle.asLiveData
-import com.geeksville.mesh.repository.bluetooth.BluetoothRepository
-import dagger.hilt.android.lifecycle.HiltViewModel
-import kotlinx.coroutines.flow.map
-import javax.inject.Inject
-
-/**
- * Thin view model which adapts the view layer to the `BluetoothRepository`.
- */
-@HiltViewModel
-class BluetoothViewModel @Inject constructor(
- private val bluetoothRepository: BluetoothRepository,
-) : ViewModel() {
- /**
- * Called when permissions have been updated. This causes an explicit refresh of the
- * bluetooth state.
- */
- fun permissionsUpdated() = bluetoothRepository.refreshState()
-
- val enabled = bluetoothRepository.state.map { it.enabled }.asLiveData()
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/model/Channel.kt b/app/src/main/java/com/geeksville/mesh/model/Channel.kt
deleted file mode 100644
index 987491a5f..000000000
--- a/app/src/main/java/com/geeksville/mesh/model/Channel.kt
+++ /dev/null
@@ -1,101 +0,0 @@
-package com.geeksville.mesh.model
-
-import com.geeksville.mesh.ChannelProtos
-import com.geeksville.mesh.ConfigProtos.Config.LoRaConfig.ModemPreset
-import com.geeksville.mesh.ConfigKt.loRaConfig
-import com.geeksville.mesh.ConfigProtos
-import com.geeksville.mesh.channelSettings
-import com.google.protobuf.ByteString
-
-/** Utility function to make it easy to declare byte arrays - FIXME move someplace better */
-fun byteArrayOfInts(vararg ints: Int) = ByteArray(ints.size) { pos -> ints[pos].toByte() }
-fun xorHash(b: ByteArray) = b.fold(0) { acc, x -> acc xor (x.toInt() and 0xff) }
-
-data class Channel(
- val settings: ChannelProtos.ChannelSettings,
- val loraConfig: ConfigProtos.Config.LoRaConfig
-) {
- companion object {
- // These bytes must match the well known and not secret bytes used the default channel AES128 key device code
- private val channelDefaultKey = byteArrayOfInts(
- 0xd4, 0xf1, 0xbb, 0x3a, 0x20, 0x29, 0x07, 0x59,
- 0xf0, 0xbc, 0xff, 0xab, 0xcf, 0x4e, 0x69, 0x01
- )
-
- private val cleartextPSK = ByteString.EMPTY
- private val defaultPSK =
- byteArrayOfInts(1) // a shortstring code to indicate we need our default PSK
-
- // The default channel that devices ship with
- val default = Channel(
- channelSettings { psk = ByteString.copyFrom(defaultPSK) },
- // references: NodeDB::installDefaultConfig / Channels::initDefaultChannel
- loRaConfig {
- usePreset = true
- modemPreset = ModemPreset.LONG_FAST
- hopLimit = 3
- txEnabled = true
- }
- )
- }
-
- /// Return the name of our channel as a human readable string. If empty string, assume "Default" per mesh.proto spec
- val name: String
- get() = settings.name.ifEmpty {
- // We have a new style 'empty' channel name. Use the same logic from the device to convert that to a human readable name
- if (loraConfig.bandwidth != 0)
- "Unset"
- else when (loraConfig.modemPreset) {
- ModemPreset.SHORT_FAST -> "ShortFast"
- ModemPreset.SHORT_SLOW -> "ShortSlow"
- ModemPreset.MEDIUM_FAST -> "MediumFast"
- ModemPreset.MEDIUM_SLOW -> "MediumSlow"
- ModemPreset.LONG_FAST -> "LongFast"
- ModemPreset.LONG_SLOW -> "LongSlow"
- ModemPreset.VERY_LONG_SLOW -> "VLongSlow"
- else -> "Invalid"
- }
- }
-
- val psk: ByteString
- get() = if (settings.psk.size() != 1)
- settings.psk // A standard PSK
- else {
- // One of our special 1 byte PSKs, see mesh.proto for docs.
- val pskIndex = settings.psk.byteAt(0).toInt()
-
- if (pskIndex == 0)
- cleartextPSK
- else {
- // Treat an index of 1 as the old channelDefaultKey and work up from there
- val bytes = channelDefaultKey.clone()
- bytes[bytes.size - 1] = (0xff and (bytes[bytes.size - 1] + pskIndex - 1)).toByte()
- ByteString.copyFrom(bytes)
- }
- }
-
- /**
- * Return a name that is formatted as #channename-suffix
- *
- * Where suffix indicates the hash of the PSK
- */
- val humanName: String
- get() {
- // start with the PSK then xor in the name
- val pskCode = xorHash(psk.toByteArray())
- val nameCode = xorHash(name.toByteArray())
- val suffix = 'A' + ((pskCode xor nameCode) % 26)
-
- return "#${name}-${suffix}"
- }
-
- override fun equals(other: Any?): Boolean = (other is Channel)
- && psk.toByteArray() contentEquals other.psk.toByteArray()
- && name == other.name
-
- override fun hashCode(): Int {
- var result = settings.hashCode()
- result = 31 * result + loraConfig.hashCode()
- return result
- }
-}
diff --git a/app/src/main/java/com/geeksville/mesh/model/ChannelOption.kt b/app/src/main/java/com/geeksville/mesh/model/ChannelOption.kt
deleted file mode 100644
index cd50750b3..000000000
--- a/app/src/main/java/com/geeksville/mesh/model/ChannelOption.kt
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.geeksville.mesh.model
-
-import com.geeksville.mesh.ConfigProtos.Config.LoRaConfig.ModemPreset
-import com.geeksville.mesh.R
-
-enum class ChannelOption(
- val modemPreset: ModemPreset,
- val configRes: Int,
-) {
- SHORT_FAST(ModemPreset.SHORT_FAST, R.string.modem_config_short),
- SHORT_SLOW(ModemPreset.SHORT_SLOW, R.string.modem_config_slow_short),
- MEDIUM_FAST(ModemPreset.MEDIUM_FAST, R.string.modem_config_medium),
- MEDIUM_SLOW(ModemPreset.MEDIUM_SLOW, R.string.modem_config_slow_medium),
- LONG_FAST(ModemPreset.LONG_FAST, R.string.modem_config_long),
- LONG_SLOW(ModemPreset.LONG_SLOW, R.string.modem_config_slow_long),
- VERY_LONG_SLOW(ModemPreset.VERY_LONG_SLOW, R.string.modem_config_very_long);
-
- companion object {
- fun fromConfig(modemPreset: ModemPreset?): ChannelOption? {
- for (option in values()) {
- if (option.modemPreset == modemPreset) return option
- }
- return null
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/model/ChannelSet.kt b/app/src/main/java/com/geeksville/mesh/model/ChannelSet.kt
deleted file mode 100644
index 3d6a6c356..000000000
--- a/app/src/main/java/com/geeksville/mesh/model/ChannelSet.kt
+++ /dev/null
@@ -1,80 +0,0 @@
-package com.geeksville.mesh.model
-
-import android.graphics.Bitmap
-import android.net.Uri
-import android.util.Base64
-import com.geeksville.mesh.android.Logging
-import com.geeksville.mesh.AppOnlyProtos
-import com.google.zxing.BarcodeFormat
-import com.google.zxing.MultiFormatWriter
-import com.journeyapps.barcodescanner.BarcodeEncoder
-import java.net.MalformedURLException
-
-data class ChannelSet(
- val protobuf: AppOnlyProtos.ChannelSet = AppOnlyProtos.ChannelSet.getDefaultInstance()
-) : Logging {
- companion object {
-
- const val prefix = "https://meshtastic.org/e/#"
-
- private const val base64Flags = Base64.URL_SAFE + Base64.NO_WRAP + Base64.NO_PADDING
-
- private fun urlToChannels(url: Uri): AppOnlyProtos.ChannelSet {
- val urlStr = url.toString()
-
- val pathRegex = Regex("$prefix(.*)", RegexOption.IGNORE_CASE)
- val (base64) = pathRegex.find(urlStr)?.destructured
- ?: throw MalformedURLException("Not a meshtastic URL: ${urlStr.take(40)}")
- val bytes = Base64.decode(base64, base64Flags)
-
- return AppOnlyProtos.ChannelSet.parseFrom(bytes)
- }
- }
-
- constructor(url: Uri) : this(urlToChannels(url))
-
- /// Can this channel be changed right now?
- var editable = false
-
- /**
- * Return the primary channel info
- */
- val primaryChannel: Channel?
- get() =
- if (protobuf.settingsCount > 0)
- Channel(protobuf.getSettings(0), protobuf.loraConfig)
- else
- null
-
- /// Return an URL that represents the current channel values
- /// @param upperCasePrefix - portions of the URL can be upper case to make for more efficient QR codes
- fun getChannelUrl(upperCasePrefix: Boolean = false): Uri {
- // If we have a valid radio config use it, otherwise use whatever we have saved in the prefs
-
- val channelBytes = protobuf.toByteArray() ?: ByteArray(0) // if unset just use empty
- val enc = Base64.encodeToString(channelBytes, base64Flags)
-
- val p = if (upperCasePrefix) prefix.uppercase() else prefix
- return Uri.parse("$p$enc")
- }
-
- val qrCode
- get(): Bitmap? = try {
- val multiFormatWriter = MultiFormatWriter()
-
- // We encode as UPPER case for the QR code URL because QR codes are more efficient for that special case
- val bitMatrix =
- multiFormatWriter.encode(
- getChannelUrl(false).toString(),
- BarcodeFormat.QR_CODE,
- 960,
- 960
- )
- val barcodeEncoder = BarcodeEncoder()
- barcodeEncoder.createBitmap(bitMatrix)
- } catch (ex: Throwable) {
- errormsg("URL was too complex to render as barcode")
- null
- }
-}
-
diff --git a/app/src/main/java/com/geeksville/mesh/model/DeviceVersion.kt b/app/src/main/java/com/geeksville/mesh/model/DeviceVersion.kt
deleted file mode 100644
index 09ba6fcf8..000000000
--- a/app/src/main/java/com/geeksville/mesh/model/DeviceVersion.kt
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.geeksville.mesh.model
-
-import com.geeksville.mesh.android.Logging
-
-/**
- * Provide structured access to parse and compare device version strings
- */
-data class DeviceVersion(val asString: String) : Comparable, Logging {
-
- val asInt
- get() = try {
- verStringToInt(asString)
- } catch (e: Exception) {
- warn("Exception while parsing version '$asString', assuming version 0")
- 0
- }
-
- /**
- * Convert a version string of the form 1.23.57 to a comparable integer of
- * the form 12357.
- *
- * Or throw an exception if the string can not be parsed
- */
- private fun verStringToInt(s: String): Int {
- // Allow 1 to two digits per match
- val match =
- Regex("(\\d{1,2}).(\\d{1,2}).(\\d{1,2})").find(s)
- ?: throw Exception("Can't parse version $s")
- val (major, minor, build) = match.destructured
- return major.toInt() * 10000 + minor.toInt() * 100 + build.toInt()
- }
-
- override fun compareTo(other: DeviceVersion): Int = asInt - other.asInt
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/model/NodeDB.kt b/app/src/main/java/com/geeksville/mesh/model/NodeDB.kt
deleted file mode 100644
index 414e0f663..000000000
--- a/app/src/main/java/com/geeksville/mesh/model/NodeDB.kt
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.geeksville.mesh.model
-
-import androidx.lifecycle.LiveData
-import androidx.lifecycle.MediatorLiveData
-import androidx.lifecycle.MutableLiveData
-import com.geeksville.mesh.MeshProtos
-import com.geeksville.mesh.MeshUser
-import com.geeksville.mesh.NodeInfo
-import com.geeksville.mesh.Position
-
-
-/// NodeDB lives inside the UIViewModel, but it needs a backpointer to reach the service
-class NodeDB(private val ui: UIViewModel) {
- private val testPositions = arrayOf(
- Position(32.776665, -96.796989, 35, 123), // dallas
- Position(32.960758, -96.733521, 35, 456), // richardson
- Position(32.912901, -96.781776, 35, 789) // north dallas
- )
-
- val testNodeNoPosition = NodeInfo(
- 8,
- MeshUser(
- "+16508765308".format(8),
- "Kevin MesterNoLoc",
- "KLO",
- MeshProtos.HardwareModel.ANDROID_SIM,
- false
- ),
- null
- )
-
- private val testNodes = testPositions.mapIndexed { index, it ->
- NodeInfo(
- 9 + index,
- MeshUser(
- "+165087653%02d".format(9 + index),
- "Kevin Mester$index",
- "KM$index",
- MeshProtos.HardwareModel.ANDROID_SIM,
- false
- ),
- it
- )
- }
-
- private val seedWithTestNodes = false
-
- /// The unique ID of our node
- private val _myId = MutableLiveData(if (seedWithTestNodes) "+16508765309" else null)
- val myId: LiveData get() = _myId
-
- fun setMyId(myId: String?) {
- _myId.value = myId
- }
-
- /// A map from nodeid to to nodeinfo
- private val _nodes = MutableLiveData>(mapOf(*(if (seedWithTestNodes) testNodes else listOf()).map { it.user!!.id to it }
- .toTypedArray()))
- val nodes: LiveData> get() = _nodes
-
- fun setNodes(nodes: Map) {
- _nodes.value = nodes
- }
-
- /// Could be null if we haven't received our node DB yet
- val ourNodeInfo = MediatorLiveData()
-
- init {
- ourNodeInfo.addSource(_nodes) { updatedValue ->
- ourNodeInfo.value = updatedValue[_myId.value]
- }
- ourNodeInfo.addSource(_myId) { updatedValue ->
- ourNodeInfo.value = _nodes.value?.get(updatedValue)
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/model/UIState.kt b/app/src/main/java/com/geeksville/mesh/model/UIState.kt
deleted file mode 100644
index 17494fb53..000000000
--- a/app/src/main/java/com/geeksville/mesh/model/UIState.kt
+++ /dev/null
@@ -1,653 +0,0 @@
-package com.geeksville.mesh.model
-
-import android.app.Application
-import android.content.Context
-import android.content.SharedPreferences
-import android.net.Uri
-import android.os.RemoteException
-import android.view.Menu
-import androidx.core.content.edit
-import androidx.lifecycle.LiveData
-import androidx.lifecycle.MutableLiveData
-import androidx.lifecycle.ViewModel
-import androidx.lifecycle.asLiveData
-import androidx.lifecycle.viewModelScope
-import com.geeksville.mesh.android.Logging
-import com.geeksville.mesh.*
-import com.geeksville.mesh.ConfigProtos.Config
-import com.geeksville.mesh.ModuleConfigProtos.ModuleConfig
-import com.geeksville.mesh.database.MeshLogRepository
-import com.geeksville.mesh.database.QuickChatActionRepository
-import com.geeksville.mesh.database.entity.Packet
-import com.geeksville.mesh.database.entity.MeshLog
-import com.geeksville.mesh.database.entity.QuickChatAction
-import com.geeksville.mesh.LocalOnlyProtos.LocalConfig
-import com.geeksville.mesh.LocalOnlyProtos.LocalModuleConfig
-import com.geeksville.mesh.database.PacketRepository
-import com.geeksville.mesh.repository.datastore.ChannelSetRepository
-import com.geeksville.mesh.repository.datastore.LocalConfigRepository
-import com.geeksville.mesh.repository.datastore.ModuleConfigRepository
-import com.geeksville.mesh.service.MeshService
-import com.geeksville.mesh.util.GPSFormat
-import com.geeksville.mesh.util.positionToMeter
-import dagger.hilt.android.lifecycle.HiltViewModel
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.ExperimentalCoroutinesApi
-import kotlinx.coroutines.flow.MutableStateFlow
-import kotlinx.coroutines.flow.StateFlow
-import kotlinx.coroutines.flow.first
-import kotlinx.coroutines.flow.flatMapLatest
-import kotlinx.coroutines.flow.launchIn
-import kotlinx.coroutines.flow.mapLatest
-import kotlinx.coroutines.flow.onEach
-import kotlinx.coroutines.launch
-import kotlinx.coroutines.withContext
-import org.osmdroid.bonuspack.kml.KmlDocument
-import org.osmdroid.views.MapView
-import org.osmdroid.views.overlay.FolderOverlay
-import java.io.BufferedWriter
-import java.io.FileNotFoundException
-import java.io.FileWriter
-import java.text.SimpleDateFormat
-import java.util.Locale
-import javax.inject.Inject
-import kotlin.math.max
-import kotlin.math.roundToInt
-
-/// Given a human name, strip out the first letter of the first three words and return that as the initials for
-/// that user. If the original name is only one word, strip vowels from the original name and if the result is
-/// 3 or more characters, use the first three characters. If not, just take the first 3 characters of the
-/// original name.
-fun getInitials(nameIn: String): String {
- val nchars = 4
- val minchars = 2
- val name = nameIn.trim()
- val words = name.split(Regex("\\s+")).filter { it.isNotEmpty() }
-
- val initials = when (words.size) {
- in 0 until minchars -> {
- val nm = if (name.isNotEmpty())
- name.first() + name.drop(1).filterNot { c -> c.lowercase() in "aeiou" }
- else
- ""
- if (nm.length >= nchars) nm else name
- }
- else -> words.map { it.first() }.joinToString("")
- }
- return initials.take(nchars)
-}
-
-@HiltViewModel
-class UIViewModel @Inject constructor(
- private val app: Application,
- private val meshLogRepository: MeshLogRepository,
- private val channelSetRepository: ChannelSetRepository,
- private val packetRepository: PacketRepository,
- private val localConfigRepository: LocalConfigRepository,
- private val moduleConfigRepository: ModuleConfigRepository,
- private val quickChatActionRepository: QuickChatActionRepository,
- private val preferences: SharedPreferences
-) : ViewModel(), Logging {
-
- private val _meshLog = MutableStateFlow>(emptyList())
- val meshLog: StateFlow> = _meshLog
-
- private val _packets = MutableStateFlow>(emptyList())
- val packets: StateFlow> = _packets
-
- private val _localConfig = MutableStateFlow(LocalConfig.getDefaultInstance())
- val localConfig: StateFlow = _localConfig
- val config get() = _localConfig.value
-
- private val _moduleConfig = MutableStateFlow(LocalModuleConfig.getDefaultInstance())
- val moduleConfig: StateFlow = _moduleConfig
- val module get() = _moduleConfig.value
-
- private val _channels = MutableStateFlow(ChannelSet())
- val channels: StateFlow = _channels
-
- private val _quickChatActions = MutableStateFlow>(emptyList())
- val quickChatActions: StateFlow> = _quickChatActions
-
- init {
- viewModelScope.launch {
- meshLogRepository.getAllLogs().collect { logs ->
- _meshLog.value = logs
- }
- }
- viewModelScope.launch {
- packetRepository.getAllPackets().collect { packets ->
- _packets.value = packets
- }
- }
- localConfigRepository.localConfigFlow.onEach { config ->
- _localConfig.value = config
- }.launchIn(viewModelScope)
- moduleConfigRepository.moduleConfigFlow.onEach { config ->
- _moduleConfig.value = config
- }.launchIn(viewModelScope)
- viewModelScope.launch {
- quickChatActionRepository.getAllActions().collect { actions ->
- _quickChatActions.value = actions
- }
- }
- channelSetRepository.channelSetFlow.onEach { channelSet ->
- _channels.value = ChannelSet(channelSet)
- }.launchIn(viewModelScope)
- debug("ViewModel created")
- }
-
- private val contactKey: MutableStateFlow = MutableStateFlow(DataPacket.ID_BROADCAST)
- fun setContactKey(contact: String) {
- contactKey.value = contact
- }
-
- @OptIn(ExperimentalCoroutinesApi::class)
- val messages: LiveData> = contactKey.flatMapLatest { contactKey ->
- packetRepository.getMessagesFrom(contactKey)
- }.asLiveData()
-
- @OptIn(ExperimentalCoroutinesApi::class)
- val contacts: LiveData> = _packets.mapLatest { list ->
- list.associateBy { packet -> packet.contact_key }
- .filter { it.value.port_num == Portnums.PortNum.TEXT_MESSAGE_APP_VALUE }
- }.asLiveData()
-
- @OptIn(ExperimentalCoroutinesApi::class)
- val waypoints: LiveData> = _packets.mapLatest { list ->
- list.associateBy { packet -> packet.data.waypoint?.id }
- .filter { it.value.port_num == Portnums.PortNum.WAYPOINT_APP_VALUE }
- }.asLiveData()
-
- fun sendMessage(str: String, channel: Int = 0, dest: String = DataPacket.ID_BROADCAST) {
- val p = DataPacket(dest, channel, str)
- try {
- meshService?.send(p)
- } catch (ex: RemoteException) {
- errormsg("Send DataPacket error: ${ex.message}")
- }
- }
-
- fun requestPosition(destNum: Int, lat: Double = 0.0, lon: Double = 0.0, alt: Int = 0) {
- try {
- meshService?.requestPosition(destNum, lat, lon, alt)
- } catch (ex: RemoteException) {
- errormsg("Request position error: ${ex.message}")
- }
- }
-
- fun deleteAllLogs() = viewModelScope.launch(Dispatchers.IO) {
- meshLogRepository.deleteAll()
- }
-
- fun deleteAllMessages() = viewModelScope.launch(Dispatchers.IO) {
- packetRepository.deleteAllMessages()
- }
-
- fun deleteMessages(uuidList: List) = viewModelScope.launch(Dispatchers.IO) {
- packetRepository.deleteMessages(uuidList)
- }
-
- companion object {
- fun getPreferences(context: Context): SharedPreferences =
- context.getSharedPreferences("ui-prefs", Context.MODE_PRIVATE)
- }
-
- var actionBarMenu: Menu? = null
-
- var meshService: IMeshService? = null
-
- val nodeDB = NodeDB(this)
-
- /// Connection state to our radio device
- private val _connectionState = MutableLiveData(MeshService.ConnectionState.DISCONNECTED)
- val connectionState: LiveData get() = _connectionState
-
- fun isConnected() = _connectionState.value == MeshService.ConnectionState.CONNECTED
-
- fun setConnectionState(connectionState: MeshService.ConnectionState) {
- _connectionState.value = connectionState
- }
-
- private val _requestChannelUrl = MutableLiveData(null)
- val requestChannelUrl: LiveData get() = _requestChannelUrl
-
- fun setRequestChannelUrl(channelUrl: Uri) {
- _requestChannelUrl.value = channelUrl
- }
-
- /**
- * Called immediately after activity observes requestChannelUrl
- */
- fun clearRequestChannelUrl() {
- _requestChannelUrl.value = null
- }
-
- var txEnabled: Boolean
- get() = config.lora.txEnabled
- set(value) {
- updateLoraConfig { it.copy { txEnabled = value } }
- }
-
- var region: Config.LoRaConfig.RegionCode
- get() = config.lora.region
- set(value) {
- updateLoraConfig { it.copy { region = value } }
- }
-
- fun gpsString(p: Position): String {
- return when (config.display.gpsFormat) {
- Config.DisplayConfig.GpsCoordinateFormat.DEC -> GPSFormat.DEC(p)
- Config.DisplayConfig.GpsCoordinateFormat.DMS -> GPSFormat.DMS(p)
- Config.DisplayConfig.GpsCoordinateFormat.UTM -> GPSFormat.UTM(p)
- Config.DisplayConfig.GpsCoordinateFormat.MGRS -> GPSFormat.MGRS(p)
- else -> GPSFormat.DEC(p)
- }
- }
-
- @Suppress("MemberVisibilityCanBePrivate")
- val isRouter: Boolean = config.device.role == Config.DeviceConfig.Role.ROUTER
-
- // We consider hasWifi = ESP32
- fun hasGPS() = myNodeInfo.value?.hasGPS == true
- fun hasWifi() = myNodeInfo.value?.hasWifi == true
-
- /// hardware info about our local device (can be null)
- private val _myNodeInfo = MutableLiveData()
- val myNodeInfo: LiveData get() = _myNodeInfo
-
- fun setMyNodeInfo(info: MyNodeInfo?) {
- _myNodeInfo.value = info
- }
-
- override fun onCleared() {
- super.onCleared()
- debug("ViewModel cleared")
- }
-
- /// Pull our latest node db from the device
- fun updateNodesFromDevice() {
- meshService?.let { service ->
- // Update our nodeinfos based on data from the device
- val nodes = service.nodes.associateBy { it.user?.id!! }
- nodeDB.setNodes(nodes)
-
- try {
- // Pull down our real node ID - This must be done AFTER reading the nodedb because we need the DB to find our nodeinof object
- nodeDB.setMyId(service.myId)
- val ownerName = nodes[service.myId]?.user?.longName
- _ownerName.value = ownerName
- } catch (ex: Exception) {
- warn("Ignoring failure to get myId, service is probably just uninited... ${ex.message}")
- }
- }
- }
-
- inline fun updateDeviceConfig(crossinline body: (Config.DeviceConfig) -> Config.DeviceConfig) {
- val data = body(config.device)
- setConfig(config { device = data })
- }
-
- inline fun updatePositionConfig(crossinline body: (Config.PositionConfig) -> Config.PositionConfig) {
- val data = body(config.position)
- setConfig(config { position = data })
- }
-
- inline fun updatePowerConfig(crossinline body: (Config.PowerConfig) -> Config.PowerConfig) {
- val data = body(config.power)
- setConfig(config { power = data })
- }
-
- inline fun updateNetworkConfig(crossinline body: (Config.NetworkConfig) -> Config.NetworkConfig) {
- val data = body(config.network)
- setConfig(config { network = data })
- }
-
- inline fun updateDisplayConfig(crossinline body: (Config.DisplayConfig) -> Config.DisplayConfig) {
- val data = body(config.display)
- setConfig(config { display = data })
- }
-
- inline fun updateLoraConfig(crossinline body: (Config.LoRaConfig) -> Config.LoRaConfig) {
- val data = body(config.lora)
- setConfig(config { lora = data })
- }
-
- inline fun updateBluetoothConfig(crossinline body: (Config.BluetoothConfig) -> Config.BluetoothConfig) {
- val data = body(config.bluetooth)
- setConfig(config { bluetooth = data })
- }
-
- // Set the radio config (also updates our saved copy in preferences)
- fun setConfig(config: Config) {
- meshService?.setConfig(config.toByteArray())
- }
-
- inline fun updateMQTTConfig(crossinline body: (ModuleConfig.MQTTConfig) -> ModuleConfig.MQTTConfig) {
- val data = body(module.mqtt)
- setModuleConfig(moduleConfig { mqtt = data })
- }
-
- inline fun updateSerialConfig(crossinline body: (ModuleConfig.SerialConfig) -> ModuleConfig.SerialConfig) {
- val data = body(module.serial)
- setModuleConfig(moduleConfig { serial = data })
- }
-
- inline fun updateExternalNotificationConfig(crossinline body: (ModuleConfig.ExternalNotificationConfig) -> ModuleConfig.ExternalNotificationConfig) {
- val data = body(module.externalNotification)
- setModuleConfig(moduleConfig { externalNotification = data })
- }
-
- inline fun updateStoreForwardConfig(crossinline body: (ModuleConfig.StoreForwardConfig) -> ModuleConfig.StoreForwardConfig) {
- val data = body(module.storeForward)
- setModuleConfig(moduleConfig { storeForward = data })
- }
-
- inline fun updateRangeTestConfig(crossinline body: (ModuleConfig.RangeTestConfig) -> ModuleConfig.RangeTestConfig) {
- val data = body(module.rangeTest)
- setModuleConfig(moduleConfig { rangeTest = data })
- }
-
- inline fun updateTelemetryConfig(crossinline body: (ModuleConfig.TelemetryConfig) -> ModuleConfig.TelemetryConfig) {
- val data = body(module.telemetry)
- setModuleConfig(moduleConfig { telemetry = data })
- }
-
- inline fun updateCannedMessageConfig(crossinline body: (ModuleConfig.CannedMessageConfig) -> ModuleConfig.CannedMessageConfig) {
- val data = body(module.cannedMessage)
- setModuleConfig(moduleConfig { cannedMessage = data })
- }
-
- inline fun updateAudioConfig(crossinline body: (ModuleConfig.AudioConfig) -> ModuleConfig.AudioConfig) {
- val data = body(module.audio)
- setModuleConfig(moduleConfig { audio = data })
- }
-
- fun setModuleConfig(config: ModuleConfig) {
- meshService?.setModuleConfig(config.toByteArray())
- }
-
- /// Convert the channels array to and from [AppOnlyProtos.ChannelSet]
- private var _channelSet: AppOnlyProtos.ChannelSet
- get() = channels.value.protobuf
- set(value) {
- (0 until max(_channelSet.settingsCount, value.settingsCount)).map { i ->
- channel {
- role = when (i) {
- 0 -> ChannelProtos.Channel.Role.PRIMARY
- in 1 until value.settingsCount -> ChannelProtos.Channel.Role.SECONDARY
- else -> ChannelProtos.Channel.Role.DISABLED
- }
- index = i
- settings = value.settingsList.getOrNull(i) ?: channelSettings { }
- }
- }.forEach {
- meshService?.setChannel(it.toByteArray())
- }
-
- viewModelScope.launch {
- channelSetRepository.clearSettings()
- channelSetRepository.addAllSettings(value)
- }
-
- val newConfig = config { lora = value.loraConfig }
- if (config.lora != newConfig.lora) setConfig(newConfig)
- }
- val channelSet get() = _channelSet
-
- /// Set the radio config (also updates our saved copy in preferences)
- fun setChannels(channelSet: ChannelSet) {
- debug("Setting new channels!")
- this._channelSet = channelSet.protobuf
- }
-
- /// our name in hte radio
- /// Note, we generate owner initials automatically for now
- /// our activity will read this from prefs or set it to the empty string
- private val _ownerName = MutableLiveData()
- val ownerName: LiveData get() = _ownerName
-
- val provideLocation = object : MutableLiveData(preferences.getBoolean("provide-location", false)) {
- override fun setValue(value: Boolean) {
- super.setValue(value)
-
- preferences.edit {
- this.putBoolean("provide-location", value)
- }
- }
- }
-
- // clean up all this nasty owner state management FIXME
- fun setOwner(longName: String? = null, shortName: String? = null, isLicensed: Boolean? = null) {
-
- longName?.trim()?.let { ownerName ->
- // note: we allow an empty user string to be written to prefs
- _ownerName.value = ownerName
- preferences.edit { putString("owner", ownerName) }
- }
-
- // Note: we are careful to not set a new unique ID
- if (_ownerName.value!!.isNotEmpty())
- try {
- meshService?.setOwner(
- null,
- _ownerName.value,
- shortName?.trim() ?: getInitials(_ownerName.value!!),
- isLicensed ?: false
- ) // Note: we use ?. here because we might be running in the emulator
- } catch (ex: RemoteException) {
- errormsg("Can't set username on device, is device offline? ${ex.message}")
- }
- }
-
- val adminChannelIndex: Int
- get() = channelSet.settingsList.map { it.name.lowercase() }.indexOf("admin")
-
- fun requestShutdown(idNum: Int) {
- try {
- meshService?.requestShutdown(idNum)
- } catch (ex: RemoteException) {
- errormsg("RemoteException: ${ex.message}")
- }
- }
-
- fun requestReboot(idNum: Int) {
- try {
- meshService?.requestReboot(idNum)
- } catch (ex: RemoteException) {
- errormsg("RemoteException: ${ex.message}")
- }
- }
-
- fun requestFactoryReset(idNum: Int) {
- try {
- meshService?.requestFactoryReset(idNum)
- } catch (ex: RemoteException) {
- errormsg("RemoteException: ${ex.message}")
- }
- }
-
- fun requestNodedbReset(idNum: Int) {
- try {
- meshService?.requestNodedbReset(idNum)
- } catch (ex: RemoteException) {
- errormsg("RemoteException: ${ex.message}")
- }
- }
-
- /**
- * Write the persisted packet data out to a CSV file in the specified location.
- */
- fun saveMessagesCSV(file_uri: Uri) {
- viewModelScope.launch(Dispatchers.Main) {
- // Extract distances to this device from position messages and put (node,SNR,distance) in
- // the file_uri
- val myNodeNum = myNodeInfo.value?.myNodeNum ?: return@launch
-
- // Capture the current node value while we're still on main thread
- val nodes = nodeDB.nodes.value ?: emptyMap()
-
- val positionToPos: (MeshProtos.Position?) -> Position? = { meshPosition ->
- meshPosition?.let { Position(it) }.takeIf {
- it?.isValid() == true
- }
- }
-
- writeToUri(file_uri) { writer ->
- // Create a map of nodes keyed by their ID
- val nodesById = nodes.values.associateBy { it.num }.toMutableMap()
- val nodePositions = mutableMapOf()
-
- writer.appendLine("date,time,from,sender name,sender lat,sender long,rx lat,rx long,rx elevation,rx snr,distance,hop limit,payload")
-
- // Packets are ordered by time, we keep most recent position of
- // our device in localNodePosition.
- val dateFormat = SimpleDateFormat("yyyy-MM-dd,HH:mm:ss", Locale.getDefault())
- meshLogRepository.getAllLogsInReceiveOrder(Int.MAX_VALUE).first().forEach { packet ->
- // If we get a NodeInfo packet, use it to update our position data (if valid)
- packet.nodeInfo?.let { nodeInfo ->
- positionToPos.invoke(nodeInfo.position)?.let { _ ->
- nodePositions[nodeInfo.num] = nodeInfo.position
- }
- }
-
- packet.meshPacket?.let { proto ->
- // If the packet contains position data then use it to update, if valid
- packet.position?.let { position ->
- positionToPos.invoke(position)?.let { _ ->
- nodePositions[proto.from] = position
- }
- }
-
- // Filter out of our results any packet that doesn't report SNR. This
- // is primarily ADMIN_APP.
- if (proto.rxSnr != 0.0f) {
- val rxDateTime = dateFormat.format(packet.received_date)
- val rxFrom = proto.from.toUInt()
- val senderName = nodesById[proto.from]?.user?.longName ?: ""
-
- // sender lat & long
- val senderPosition = nodePositions[proto.from]
- val senderPos = positionToPos.invoke(senderPosition)
- val senderLat = senderPos?.latitude ?: ""
- val senderLong = senderPos?.longitude ?: ""
-
- // rx lat, long, and elevation
- val rxPosition = nodePositions[myNodeNum]
- val rxPos = positionToPos.invoke(rxPosition)
- val rxLat = rxPos?.latitude ?: ""
- val rxLong = rxPos?.longitude ?: ""
- val rxAlt = rxPos?.altitude ?: ""
- val rxSnr = "%f".format(proto.rxSnr)
-
- // Calculate the distance if both positions are valid
-
- val dist = if (senderPos == null || rxPos == null) {
- ""
- } else {
- positionToMeter(
- rxPosition!!, // Use rxPosition but only if rxPos was valid
- senderPosition!! // Use senderPosition but only if senderPos was valid
- ).roundToInt().toString()
- }
-
- val hopLimit = proto.hopLimit
-
- val payload = when {
- proto.decoded.portnumValue != Portnums.PortNum.TEXT_MESSAGE_APP_VALUE -> "<${proto.decoded.portnum}>"
- proto.hasDecoded() -> "\"" + proto.decoded.payload.toStringUtf8()
- .replace("\"", "\\\"") + "\""
- proto.hasEncrypted() -> "${proto.encrypted.size()} encrypted bytes"
- else -> ""
- }
-
- // date,time,from,sender name,sender lat,sender long,rx lat,rx long,rx elevation,rx snr,distance,hop limit,payload
- writer.appendLine("$rxDateTime,$rxFrom,$senderName,$senderLat,$senderLong,$rxLat,$rxLong,$rxAlt,$rxSnr,$dist,$hopLimit,$payload")
- }
- }
- }
- }
- }
- }
-
- private suspend inline fun writeToUri(uri: Uri, crossinline block: suspend (BufferedWriter) -> Unit) {
- withContext(Dispatchers.IO) {
- try {
- app.contentResolver.openFileDescriptor(uri, "wt")?.use { parcelFileDescriptor ->
- FileWriter(parcelFileDescriptor.fileDescriptor).use { fileWriter ->
- BufferedWriter(fileWriter).use { writer ->
- block.invoke(writer)
- }
- }
- }
- } catch (ex: FileNotFoundException) {
- errormsg("Can't write file error: ${ex.message}")
- }
- }
- }
-
-
- fun parseUrl(url: String, map: MapView) {
- viewModelScope.launch(Dispatchers.IO) {
- parseIt(url, map)
- }
- }
-
- // For Future Use
- // model.parseUrl(
- // "https://www.google.com/maps/d/kml?forcekml=1&mid=1FmqWhZG3PG3dY92x9yf2RlREcK7kMZs&lid=-ivSjBCePsM",
- // map
- // )
- private fun parseIt(url: String, map: MapView) {
- val kmlDoc = KmlDocument()
- try {
- kmlDoc.parseKMLUrl(url)
- val kmlOverlay = kmlDoc.mKmlRoot.buildOverlay(map, null, null, kmlDoc) as FolderOverlay
- kmlDoc.mKmlRoot.mItems
- kmlDoc.mKmlRoot.mName
- map.overlayManager.overlays().add(kmlOverlay)
- } catch (ex: Exception) {
- debug("Failed to download .kml $ex")
- }
- }
-
- fun addQuickChatAction(name: String, value: String, mode: QuickChatAction.Mode) {
- viewModelScope.launch(Dispatchers.Main) {
- val action = QuickChatAction(0, name, value, mode, _quickChatActions.value.size)
- quickChatActionRepository.insert(action)
- }
- }
-
- fun deleteQuickChatAction(action: QuickChatAction) {
- viewModelScope.launch(Dispatchers.Main) {
- quickChatActionRepository.delete(action)
- }
- }
-
- fun updateQuickChatAction(
- action: QuickChatAction,
- name: String?,
- message: String?,
- mode: QuickChatAction.Mode?
- ) {
- viewModelScope.launch(Dispatchers.Main) {
- val newAction = QuickChatAction(
- action.uuid,
- name ?: action.name,
- message ?: action.message,
- mode ?: action.mode,
- action.position
- )
- quickChatActionRepository.update(newAction)
- }
- }
-
- fun updateActionPositions(actions: List) {
- viewModelScope.launch(Dispatchers.Main) {
- for (position in actions.indices) {
- quickChatActionRepository.setItemPosition(actions[position].uuid, position)
- }
- }
- }
-}
-
diff --git a/app/src/main/java/com/geeksville/mesh/model/map/CustomOverlayManager.kt b/app/src/main/java/com/geeksville/mesh/model/map/CustomOverlayManager.kt
deleted file mode 100644
index 74a3bb469..000000000
--- a/app/src/main/java/com/geeksville/mesh/model/map/CustomOverlayManager.kt
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.geeksville.mesh.model.map
-
-import android.content.Context
-import android.view.MotionEvent
-import org.osmdroid.tileprovider.MapTileProviderBase
-import org.osmdroid.views.MapView
-import org.osmdroid.views.overlay.DefaultOverlayManager
-import org.osmdroid.views.overlay.TilesOverlay
-
-
-class CustomOverlayManager
-/**
- * Default constructor
- */
- (tilesOverlay: TilesOverlay?) : DefaultOverlayManager(tilesOverlay) {
- /**
- * Override event & do nothing
- */
- override fun onDoubleTap(e: MotionEvent?, pMapView: MapView?): Boolean {
- return true
- }
-
- /**
- * Override event & do nothing
- */
- override fun onDoubleTapEvent(e: MotionEvent?, pMapView: MapView?): Boolean {
- return true
- }
-
- companion object {
- /**
- * Create MyOverlayManager
- */
- fun create(mapView: MapView, context: Context?): CustomOverlayManager {
- val mTileProvider: MapTileProviderBase = mapView.tileProvider
- val tilesOverlay = TilesOverlay(mTileProvider, context)
- mapView.tileProvider
- mapView.overlayManager = CustomOverlayManager(tilesOverlay)
- //mapView.overlayManager.overlays().add(overlay)
- mapView.invalidate()
- return CustomOverlayManager(tilesOverlay)
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/model/map/CustomTileSource.kt b/app/src/main/java/com/geeksville/mesh/model/map/CustomTileSource.kt
deleted file mode 100644
index bcfaecd12..000000000
--- a/app/src/main/java/com/geeksville/mesh/model/map/CustomTileSource.kt
+++ /dev/null
@@ -1,193 +0,0 @@
-package com.geeksville.mesh.model.map
-
-import org.osmdroid.tileprovider.tilesource.ITileSource
-import org.osmdroid.tileprovider.tilesource.OnlineTileSourceBase
-import org.osmdroid.tileprovider.tilesource.TileSourceFactory
-import org.osmdroid.tileprovider.tilesource.TileSourcePolicy
-import org.osmdroid.util.MapTileIndex
-
-
-class CustomTileSource {
-
- companion object {
- val OPENWEATHER_RADAR = OnlineTileSourceAuth(
- "Open Weather Map", 1, 22, 256, ".png", arrayOf(
- "https://tile.openweathermap.org/map/"
- ), "Openweathermap",
- TileSourcePolicy(
- 4,
- TileSourcePolicy.FLAG_NO_BULK
- or TileSourcePolicy.FLAG_NO_PREVENTIVE
- or TileSourcePolicy.FLAG_USER_AGENT_MEANINGFUL
- or TileSourcePolicy.FLAG_USER_AGENT_NORMALIZED
- ),
- "precipitation",
- ""
- )
- //
-// val RAIN_VIEWER = object : OnlineTileSourceBase(
-// "RainViewer", 1, 15, 256, ".png", arrayOf(
-// "https://tilecache.rainviewer.com/v2/coverage/"
-// ), "RainViewer",
-// TileSourcePolicy(
-// 4,
-// TileSourcePolicy.FLAG_NO_BULK
-// or TileSourcePolicy.FLAG_NO_PREVENTIVE
-// or TileSourcePolicy.FLAG_USER_AGENT_MEANINGFUL
-// or TileSourcePolicy.FLAG_USER_AGENT_NORMALIZED
-// )
-// ) {
-// override fun getTileURLString(pMapTileIndex: Long): String {
-// return baseUrl + (MapTileIndex.getZoom(pMapTileIndex)
-// .toString() + "/" + MapTileIndex.getY(pMapTileIndex)
-// + "/" + MapTileIndex.getX(pMapTileIndex)
-// + mImageFilenameEnding)
-// }
-// }
-
-
- private val ESRI_IMAGERY = object : OnlineTileSourceBase(
- "ESRI World Overview", 1, 20, 256, ".jpg", arrayOf(
- "https://clarity.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/MapServer/tile/"
- ), "Esri, Maxar, Earthstar Geographics, and the GIS User Community",
- TileSourcePolicy(
- 4,
- TileSourcePolicy.FLAG_NO_BULK
- or TileSourcePolicy.FLAG_NO_PREVENTIVE
- or TileSourcePolicy.FLAG_USER_AGENT_MEANINGFUL
- or TileSourcePolicy.FLAG_USER_AGENT_NORMALIZED
- )
- ) {
- override fun getTileURLString(pMapTileIndex: Long): String {
- return baseUrl + (MapTileIndex.getZoom(pMapTileIndex)
- .toString() + "/" + MapTileIndex.getY(pMapTileIndex)
- + "/" + MapTileIndex.getX(pMapTileIndex)
- + mImageFilenameEnding)
- }
- }
-
- private val ESRI_WORLD_TOPO = object : OnlineTileSourceBase(
- "ESRI World TOPO",
- 1,
- 20,
- 256,
- ".jpg",
- arrayOf(
- "https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/"
- ),
- "Esri, HERE, Garmin, FAO, NOAA, USGS, © OpenStreetMap contributors, and the GIS User Community ",
- TileSourcePolicy(
- 4,
- TileSourcePolicy.FLAG_NO_BULK
- or TileSourcePolicy.FLAG_NO_PREVENTIVE
- or TileSourcePolicy.FLAG_USER_AGENT_MEANINGFUL
- or TileSourcePolicy.FLAG_USER_AGENT_NORMALIZED
- )
- ) {
- override fun getTileURLString(pMapTileIndex: Long): String {
- return baseUrl + (MapTileIndex.getZoom(pMapTileIndex)
- .toString() + "/" + MapTileIndex.getY(pMapTileIndex)
- + "/" + MapTileIndex.getX(pMapTileIndex)
- + mImageFilenameEnding)
- }
- }
- private val USGS_HYDRO_CACHE = object : OnlineTileSourceBase(
- "USGS Hydro Cache",
- 0,
- 18,
- 256,
- "",
- arrayOf(
- "https://basemap.nationalmap.gov/arcgis/rest/services/USGSHydroCached/MapServer/tile/"
- ),
- "USGS",
- TileSourcePolicy(
- 2,
- TileSourcePolicy.FLAG_NO_PREVENTIVE
- or TileSourcePolicy.FLAG_USER_AGENT_MEANINGFUL
- or TileSourcePolicy.FLAG_USER_AGENT_NORMALIZED
- )
- ) {
- override fun getTileURLString(pMapTileIndex: Long): String {
- return baseUrl + (MapTileIndex.getZoom(pMapTileIndex)
- .toString() + "/" + MapTileIndex.getY(pMapTileIndex)
- + "/" + MapTileIndex.getX(pMapTileIndex)
- + mImageFilenameEnding)
- }
- }
- private val USGS_SHADED_RELIEF = object : OnlineTileSourceBase(
- "USGS Shaded Relief Only",
- 0,
- 18,
- 256,
- "",
- arrayOf(
- "https://basemap.nationalmap.gov/arcgis/rest/services/USGSShadedReliefOnly/MapServer/tile/"
- ),
- "USGS",
- TileSourcePolicy(
- 2,
- TileSourcePolicy.FLAG_NO_PREVENTIVE
- or TileSourcePolicy.FLAG_USER_AGENT_MEANINGFUL
- or TileSourcePolicy.FLAG_USER_AGENT_NORMALIZED
- )
- ) {
- override fun getTileURLString(pMapTileIndex: Long): String {
- return baseUrl + (MapTileIndex.getZoom(pMapTileIndex)
- .toString() + "/" + MapTileIndex.getY(pMapTileIndex)
- + "/" + MapTileIndex.getX(pMapTileIndex)
- + mImageFilenameEnding)
- }
- }
-
- /**
- * WMS TILE SERVER
- * More research is required to get this to function correctly with overlays
- */
- val NOAA_RADAR_WMS = NOAAWmsTileSource(
- "Recent Weather Radar",
- arrayOf("https://new.nowcoast.noaa.gov/arcgis/services/nowcoast/radar_meteo_imagery_nexrad_time/MapServer/WmsServer?"),
- "1",
- "1.1.0",
- "",
- "EPSG%3A3857",
- "",
- "image/png"
- )
-
- /**
- * ===============================================================================================
- */
-
- private val MAPNIK: OnlineTileSourceBase = TileSourceFactory.MAPNIK
- private val USGS_TOPO: OnlineTileSourceBase = TileSourceFactory.USGS_TOPO
- private val OPEN_TOPO: OnlineTileSourceBase = TileSourceFactory.OpenTopo
- private val USGS_SAT: OnlineTileSourceBase = TileSourceFactory.USGS_SAT
- private val SEAMAP: OnlineTileSourceBase = TileSourceFactory.OPEN_SEAMAP
- val DEFAULT_TILE_SOURCE: OnlineTileSourceBase = TileSourceFactory.DEFAULT_TILE_SOURCE
-
- /**
- * The order in this list must match that in the arrays.xml under map_styles
- */
- val mTileSources: List =
- listOf(
- MAPNIK,
- USGS_TOPO,
- OPEN_TOPO,
- ESRI_WORLD_TOPO,
- USGS_SAT,
- ESRI_IMAGERY,
- )
-
-
- fun getTileSource(aName: String): ITileSource {
- for (tileSource: ITileSource in mTileSources) {
- if (tileSource.name().equals(aName)) {
- return tileSource;
- }
- }
- throw IllegalArgumentException("No such tile source: $aName")
- }
- }
-
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/model/map/OnlineTileSourceAuth.kt b/app/src/main/java/com/geeksville/mesh/model/map/OnlineTileSourceAuth.kt
deleted file mode 100644
index 1e4e37a39..000000000
--- a/app/src/main/java/com/geeksville/mesh/model/map/OnlineTileSourceAuth.kt
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.geeksville.mesh.model.map
-
-import org.osmdroid.tileprovider.tilesource.OnlineTileSourceBase
-import org.osmdroid.tileprovider.tilesource.TileSourcePolicy
-import org.osmdroid.util.MapTileIndex
-
-open class OnlineTileSourceAuth(
- aName: String,
- aZoomLevel: Int,
- aZoomMaxLevel: Int,
- aTileSizePixels: Int,
- aImageFileNameEnding: String,
- aBaseUrl: Array,
- pCopyright: String,
- tileSourcePolicy: TileSourcePolicy,
- layerName: String?,
- apiKey: String
-) :
- OnlineTileSourceBase(
- aName,
- aZoomLevel,
- aZoomMaxLevel,
- aTileSizePixels,
- aImageFileNameEnding,
- aBaseUrl,
- pCopyright,
- tileSourcePolicy
-
- ) {
- private var layerName = ""
- private var apiKey = ""
-
- init {
- if (layerName != null) {
- this.layerName = layerName
- }
- this.apiKey = apiKey
-
- }
-
- override fun getTileURLString(pMapTileIndex: Long): String {
- return "$baseUrl$layerName/" + (MapTileIndex.getZoom(pMapTileIndex)
- .toString() + "/" + MapTileIndex.getX(pMapTileIndex)
- .toString() + "/" + MapTileIndex.getY(pMapTileIndex)
- .toString()) + mImageFilenameEnding + "?appId=$apiKey"
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/repository/bluetooth/BluetoothBroadcastReceiver.kt b/app/src/main/java/com/geeksville/mesh/repository/bluetooth/BluetoothBroadcastReceiver.kt
deleted file mode 100644
index 3c6ee25e2..000000000
--- a/app/src/main/java/com/geeksville/mesh/repository/bluetooth/BluetoothBroadcastReceiver.kt
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.geeksville.mesh.repository.bluetooth
-
-import android.bluetooth.BluetoothAdapter
-import android.content.BroadcastReceiver
-import android.content.Context
-import android.content.Intent
-import android.content.IntentFilter
-import com.geeksville.mesh.util.exceptionReporter
-import javax.inject.Inject
-
-/**
- * A helper class to call onChanged when bluetooth is enabled or disabled
- */
-class BluetoothBroadcastReceiver @Inject constructor(
- private val bluetoothRepository: BluetoothRepository
-) : BroadcastReceiver() {
- internal val intentFilter get() = IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED) // Can be used for registering
-
- override fun onReceive(context: Context, intent: Intent) = exceptionReporter {
- if (intent.action == BluetoothAdapter.ACTION_STATE_CHANGED) {
- when (intent.bluetoothAdapterState) {
- // Simulate a disconnection if the user disables bluetooth entirely
- BluetoothAdapter.STATE_OFF -> bluetoothRepository.refreshState()
- BluetoothAdapter.STATE_ON -> bluetoothRepository.refreshState()
- }
- }
- }
-
- private val Intent.bluetoothAdapterState: Int
- get() = getIntExtra(BluetoothAdapter.EXTRA_STATE,-1)
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/geeksville/mesh/repository/bluetooth/BluetoothRepository.kt b/app/src/main/java/com/geeksville/mesh/repository/bluetooth/BluetoothRepository.kt
deleted file mode 100644
index 6d86f6a7a..000000000
--- a/app/src/main/java/com/geeksville/mesh/repository/bluetooth/BluetoothRepository.kt
+++ /dev/null
@@ -1,116 +0,0 @@
-package com.geeksville.mesh.repository.bluetooth
-
-import android.annotation.SuppressLint
-import android.app.Application
-import android.bluetooth.BluetoothAdapter
-import android.bluetooth.BluetoothDevice
-import android.bluetooth.le.BluetoothLeScanner
-import androidx.lifecycle.Lifecycle
-import androidx.lifecycle.coroutineScope
-import com.geeksville.mesh.android.Logging
-import com.geeksville.mesh.CoroutineDispatchers
-import com.geeksville.mesh.android.hasBluetoothPermission
-import kotlinx.coroutines.delay
-import kotlinx.coroutines.flow.*
-import kotlinx.coroutines.launch
-import kotlinx.coroutines.withContext
-import javax.inject.Inject
-import javax.inject.Singleton
-
-/**
- * Repository responsible for maintaining and updating the state of Bluetooth availability.
- */
-@Singleton
-class BluetoothRepository @Inject constructor(
- private val application: Application,
- private val bluetoothAdapterLazy: dagger.Lazy