diff --git a/.gitignore b/.gitignore
index c662f637..ae47ecf4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -106,3 +106,6 @@ WhatToTest.txt
# SwiftPM build products for the watch wire-rule tests
ios/WatchLogicTests/.build/
+
+# Local phone build and test artifacts
+/.phone-build/
diff --git a/CARPLAY_REVIEW.md b/CARPLAY_REVIEW.md
new file mode 100644
index 00000000..797bae07
--- /dev/null
+++ b/CARPLAY_REVIEW.md
@@ -0,0 +1,37 @@
+# CarPlay dashboard and status widget — draft review
+
+This contribution adds a compact recent-repeater dashboard, a WidgetKit status widget using the existing Siri snapshot, and Flutter scene lifecycle integration. It preserves upstream's app identity and signing configuration.
+
+## Release blocker
+
+The custom UIKit dashboard sits beneath an empty CPMapTemplate and is not a map. Apple's approval message supplied to the contributor requires that layer to contain map content only. This prototype is not represented as App Store compliant. The owner must resolve the appropriate category/presentation with Apple, redesign the dashboard, or exclude it before release. A capability checkbox alone does not resolve this issue.
+
+## Owner checklist
+
+- Confirm acceptable CarPlay UI/category and obtain any required approval for the owner's account and App ID. The contributor's approval does not transfer.
+- Verify the shared group `group.net.meshmapper.app.shared` is assigned to Runner, App Intents, and the Live Activity extension (which now also hosts the widget).
+- Refresh provisioning profiles for the approved capabilities and extension App Group; update release/CI signing as needed. Keep the existing production IDs and private API-key workflow.
+- Verify minimum Flutter/iOS support for the scene lifecycle APIs and the iOS-16-gated CarPlay delegate, including behavior on the iOS 15 deployment floor.
+- Run full analysis/tests and a signed production archive. Validate app launch, background/foreground, lock/unlock, incoming calls, Bluetooth reconnect and CarPlay reconnect on devices. Disabling scene restoration fixed an observed crash but needs wider regression coverage.
+- Verify battery/status updates, stale snapshots, Deferred/Skipped transitions, 60-second column migration, five-minute expiry, long names, signal colors and overflow counts on supported head units.
+- Scrolling is a known limitation on the contributor's head unit and is out of scope; do not advertise scrollable history.
+- Test WidgetKit separately: refresh timing and relevance are system-controlled, not guaranteed real-time or guaranteed Siri placement. Review reload frequency and extended-drive battery use.
+- Add consented/sample-data screenshots and release notes for approved features. Keep this PR draft until release blockers are resolved; consider splitting the widget/lifecycle work from CarPlay.
+
+## Integration notes
+
+Integrated with upstream dev `65fc255` on November 20, 2026. The provider overlap is limited to two optional power snapshot fields; upstream logic and formatting are preserved. Personal signing, app-name, authentication/background identifiers, release notes and local dependency-lock changes are excluded. The personal phone-build checkout is unchanged.
+
+Prior personal-build testing does not establish that this upstream integration passes production signing or App Store review. The integrated branch still needs a signed iOS build and device testing.
+
+Historical validation before the November upstream merge: all 263 tests in `test/services/app_intents` and `test/services/status` passed. Dependencies were resolved from the local cache; the local SDK resolved four test-library versions differently, but that lockfile churn was not retained in the contribution. Repeat tests with the upstream CI toolchain before merge.
+
+The contributor successfully installed a signed personal build based on upstream `4d690c5` on November 18 and reported successful use on November 20. This is manual evidence for the dashboard, not a signed archive or full regression pass for this contribution branch. The two newer upstream commits change donation links. Plist/project syntax and diff whitespace checks passed after integration.
+
+## Device screenshot
+
+Current post-merge validation on November 20: **266 tests passed** with `flutter test --no-pub test/services/app_intents test/services/status`.
+
+User-supplied dashboard screenshot from the tested personal build (real companion/repeater names, shared with permission). The phone map screenshot is omitted because it includes location information.
+
+
diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md
index 50d03346..20a0e2b8 100644
--- a/DEVELOPMENT.md
+++ b/DEVELOPMENT.md
@@ -3237,3 +3237,9 @@ All API endpoints may return maintenance mode:
- `lib/screens/settings/repeater_nicknames_page.dart` - Settings > Map > Repeater Nicknames: the list with add, edit, remove and Undo
- `lib/models/noise_floor_session.dart` - Noise floor session data models
- `lib/widgets/noise_floor_chart.dart` - Noise floor graph visualization
+
+### Draft CarPlay dashboard and status widget
+
+The iOS scene integration in `AppDelegate.swift` and `SceneDelegate.swift` separates Flutter's phone scene from `CarPlaySceneDelegate.swift`. The dashboard consumes the existing shared Siri snapshot and refreshes displayed ages on a one-second timer; it does not run a second radio session. The existing Live Activity extension also hosts `MeshMapperStatusWidget`, whose refresh and relevance remain system-controlled. The optional `powerWatts` snapshot field is backward-compatible.
+
+The custom dashboard beneath `CPMapTemplate` is a prototype with an unresolved Apple map-layer restriction, not an approved production presentation. See [CARPLAY_REVIEW.md](CARPLAY_REVIEW.md) for owner provisioning steps, lifecycle regression checks, device evidence, and known limitations (including head-unit scrolling). Review or split this work before release.
diff --git a/docs/screenshots/carplay-recent-repeaters.jpg b/docs/screenshots/carplay-recent-repeaters.jpg
new file mode 100644
index 00000000..c085245b
Binary files /dev/null and b/docs/screenshots/carplay-recent-repeaters.jpg differ
diff --git a/ios/MeshMapperLiveActivity/MeshMapperLiveActivity.entitlements b/ios/MeshMapperLiveActivity/MeshMapperLiveActivity.entitlements
new file mode 100644
index 00000000..7037779d
--- /dev/null
+++ b/ios/MeshMapperLiveActivity/MeshMapperLiveActivity.entitlements
@@ -0,0 +1,10 @@
+
+
+
+
+ com.apple.security.application-groups
+
+ group.net.meshmapper.app.shared
+
+
+
diff --git a/ios/MeshMapperLiveActivity/MeshMapperLiveActivityBundle.swift b/ios/MeshMapperLiveActivity/MeshMapperLiveActivityBundle.swift
index 08195fee..43111f36 100644
--- a/ios/MeshMapperLiveActivity/MeshMapperLiveActivityBundle.swift
+++ b/ios/MeshMapperLiveActivity/MeshMapperLiveActivityBundle.swift
@@ -5,5 +5,6 @@ import WidgetKit
struct MeshMapperLiveActivityBundle: WidgetBundle {
var body: some Widget {
MeshMapperLiveActivity()
+ MeshMapperStatusWidget()
}
}
diff --git a/ios/MeshMapperLiveActivity/MeshMapperStatusWidget.swift b/ios/MeshMapperLiveActivity/MeshMapperStatusWidget.swift
new file mode 100644
index 00000000..3d296d2c
--- /dev/null
+++ b/ios/MeshMapperLiveActivity/MeshMapperStatusWidget.swift
@@ -0,0 +1,154 @@
+import SwiftUI
+import WidgetKit
+
+private enum MeshMapperStatusWidgetConstants {
+ static let kind = "MeshMapperStatusWidget"
+ static let suggestionWindow: TimeInterval = 5 * 60
+}
+
+private struct MeshMapperStatusEntry: TimelineEntry {
+ let date: Date
+ let snapshot: MeshMapperSiriSnapshot?
+
+ /// A recent heard event makes this card timely. WidgetKit uses this clue,
+ /// together with on-device behavior, when it decides whether to promote or
+ /// suggest the widget. The app cannot force a suggestion in CarPlay.
+ var relevance: TimelineEntryRelevance? {
+ guard let latest = snapshot?.recentHeard.map(\.observedAtMs).max() else {
+ return nil
+ }
+ let heardAt = Date(timeIntervalSince1970: Double(latest) / 1000)
+ let age = max(0, date.timeIntervalSince(heardAt))
+ let remaining = MeshMapperStatusWidgetConstants.suggestionWindow - age
+ guard remaining > 0 else { return nil }
+ return TimelineEntryRelevance(score: 100, duration: remaining)
+ }
+}
+
+private struct MeshMapperStatusProvider: TimelineProvider {
+ func placeholder(in context: Context) -> MeshMapperStatusEntry {
+ MeshMapperStatusEntry(date: Date(), snapshot: nil)
+ }
+
+ func getSnapshot(
+ in context: Context,
+ completion: @escaping (MeshMapperStatusEntry) -> Void
+ ) {
+ completion(MeshMapperStatusEntry(date: Date(), snapshot: loadSnapshot()))
+ }
+
+ func getTimeline(
+ in context: Context,
+ completion: @escaping (Timeline) -> Void
+ ) {
+ let now = Date()
+ completion(Timeline(
+ entries: [MeshMapperStatusEntry(date: now, snapshot: loadSnapshot())],
+ policy: .after(now.addingTimeInterval(15 * 60))
+ ))
+ }
+
+ private func loadSnapshot() -> MeshMapperSiriSnapshot? {
+ try? MeshMapperSiriSnapshotStore.shared.read()
+ }
+}
+
+/// The iPhone system-small widget family is also the widget family CarPlay
+/// presents on its widgets screen. Keep this card sparse and driver-glanceable.
+struct MeshMapperStatusWidget: Widget {
+ static let kind = MeshMapperStatusWidgetConstants.kind
+
+ var body: some WidgetConfiguration {
+ StaticConfiguration(kind: Self.kind, provider: MeshMapperStatusProvider()) {
+ MeshMapperStatusWidgetView(entry: $0)
+ }
+ .configurationDisplayName("Recently Heard")
+ .description("Shows recently heard MeshCore repeaters when the information is timely.")
+ .supportedFamilies([.systemSmall])
+ }
+}
+
+private struct MeshMapperStatusWidgetView: View {
+ let entry: MeshMapperStatusEntry
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 8) {
+ HStack(spacing: 6) {
+ Image(systemName: "antenna.radiowaves.left.and.right")
+ .foregroundStyle(Color.cyan)
+ Text("RECENTLY HEARD")
+ .font(.caption2.weight(.bold))
+ .tracking(0.4)
+ .lineLimit(1)
+ Spacer(minLength: 0)
+ }
+
+ if let snapshot = entry.snapshot {
+ let rows = Array(recentObservations(snapshot).prefix(3))
+ if rows.isEmpty {
+ emptyState(snapshot.connection.isConnected ? "Listening…" : "Disconnected")
+ } else {
+ VStack(spacing: 7) {
+ ForEach(rows, id: \.stableEntityIdentifier) { observation in
+ repeaterRow(observation)
+ }
+ }
+ }
+ } else {
+ emptyState("Open MeshMapper")
+ }
+
+ Spacer(minLength: 0)
+ }
+ .padding(12)
+ .meshMapperWidgetBackground()
+ }
+
+ private func repeaterRow(_ observation: MeshMapperSiriObservation) -> some View {
+ HStack(spacing: 6) {
+ Circle()
+ .fill(observation.direct ? Color.cyan : Color.purple)
+ .frame(width: 6, height: 6)
+ Text(observation.name ?? observation.displayHexId.uppercased())
+ .font(.caption.monospaced().weight(.semibold))
+ .lineLimit(1)
+ Spacer(minLength: 3)
+ if let snr = observation.snr {
+ Text(String(format: "%+.1f", snr))
+ .font(.caption.monospacedDigit().weight(.semibold))
+ .foregroundStyle(snr >= 0 ? Color.green : Color.orange)
+ }
+ }
+ }
+
+ private func emptyState(_ text: String) -> some View {
+ Text(text)
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)
+ }
+
+ private func recentObservations(
+ _ snapshot: MeshMapperSiriSnapshot
+ ) -> [MeshMapperSiriObservation] {
+ let cutoff = entry.date.addingTimeInterval(
+ -MeshMapperStatusWidgetConstants.suggestionWindow
+ ).timeIntervalSince1970 * 1000
+ return snapshot.recentHeard
+ .filter { Double($0.observedAtMs) >= cutoff }
+ .sorted { $0.observedAtMs > $1.observedAtMs }
+ }
+}
+
+private extension View {
+ @ViewBuilder
+ func meshMapperWidgetBackground() -> some View {
+ if #available(iOSApplicationExtension 17.0, *) {
+ containerBackground(for: .widget) {
+ Color(uiColor: .secondarySystemBackground)
+ }
+ } else {
+ background(Color(uiColor: .secondarySystemBackground))
+ }
+ }
+}
diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj
index 95459910..09933301 100644
--- a/ios/Runner.xcodeproj/project.pbxproj
+++ b/ios/Runner.xcodeproj/project.pbxproj
@@ -25,6 +25,8 @@
7288D34A9BC1C140A95C5ED9 /* SampleSnapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10A44B241BC20153F36C053D /* SampleSnapshot.swift */; };
73F9D344DD4B7EC7AC29CD86 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F799CC3DB45F3F5C30B5907D /* Pods_RunnerTests.framework */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
+ D30000000000000000000001 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D30000000000000000000002 /* SceneDelegate.swift */; };
+ D40000000000000000000001 /* CarPlaySceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D40000000000000000000002 /* CarPlaySceneDelegate.swift */; };
75D889865C3C829654189002 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8CAA1E3000FEC19EE9ED5CFE /* Pods_Runner.framework */; };
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; };
91E86E700B648483F172FAA5 /* ControlsPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD851ABE7C5AD5DBCEBDE26 /* ControlsPage.swift */; };
@@ -62,6 +64,9 @@
B1000000000000000000001B /* RepeaterEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20000000000000000000009 /* RepeaterEntity.swift */; };
B1000000000000000000001C /* HeardRepeaterEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = B2000000000000000000000A /* HeardRepeaterEntity.swift */; };
B1000000000000000000000F /* MeshMapperAppIntents.appex in Embed ExtensionKit Extensions */ = {isa = PBXBuildFile; fileRef = B20000000000000000000010 /* MeshMapperAppIntents.appex */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
+ D10000000000000000000001 /* MeshMapperStatusWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20000000000000000000001 /* MeshMapperStatusWidget.swift */; };
+ D10000000000000000000002 /* MeshMapperSiriSnapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20000000000000000000007 /* MeshMapperSiriSnapshot.swift */; };
+ D10000000000000000000003 /* MeshMapperSiriSnapshotStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20000000000000000000008 /* MeshMapperSiriSnapshotStore.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -164,6 +169,8 @@
74331FACF5FD72D49FF952AD /* MeshMapperWatch.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MeshMapperWatch.app; sourceTree = BUILT_PRODUCTS_DIR; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
+ D30000000000000000000002 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; };
+ D40000000000000000000002 /* CarPlaySceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarPlaySceneDelegate.swift; sourceTree = ""; };
775B3F6C0618B4BD5644B40B /* NodeListView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = NodeListView.swift; sourceTree = ""; };
78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = ""; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
@@ -211,6 +218,8 @@
B2000000000000000000000F /* MeshMapperAppIntents.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = MeshMapperAppIntents.entitlements; sourceTree = ""; };
B20000000000000000000010 /* MeshMapperAppIntents.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.extensionkit-extension"; includeInIndex = 0; path = MeshMapperAppIntents.appex; sourceTree = BUILT_PRODUCTS_DIR; };
B20000000000000000000011 /* ConnectLastMeshMapperCompanionIntent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectLastMeshMapperCompanionIntent.swift; sourceTree = ""; };
+ D20000000000000000000001 /* MeshMapperStatusWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeshMapperStatusWidget.swift; sourceTree = ""; };
+ D20000000000000000000002 /* MeshMapperLiveActivity.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = MeshMapperLiveActivity.entitlements; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -370,6 +379,8 @@
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
+ D30000000000000000000002 /* SceneDelegate.swift */,
+ D40000000000000000000002 /* CarPlaySceneDelegate.swift */,
A20000000000000000000001 /* LiveActivityManager.swift */,
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
4DB902C46F9528E4D932613C /* WatchSessionManager.swift */,
@@ -392,8 +403,10 @@
isa = PBXGroup;
children = (
A20000000000000000000003 /* MeshMapperLiveActivity.swift */,
+ D20000000000000000000001 /* MeshMapperStatusWidget.swift */,
A20000000000000000000009 /* Assets.xcassets */,
A20000000000000000000004 /* MeshMapperLiveActivityBundle.swift */,
+ D20000000000000000000002 /* MeshMapperLiveActivity.entitlements */,
A20000000000000000000005 /* Info.plist */,
);
path = MeshMapperLiveActivity;
@@ -765,6 +778,8 @@
buildActionMask = 2147483647;
files = (
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
+ D30000000000000000000001 /* SceneDelegate.swift in Sources */,
+ D40000000000000000000001 /* CarPlaySceneDelegate.swift in Sources */,
A10000000000000000000001 /* LiveActivityManager.swift in Sources */,
A10000000000000000000002 /* MeshMapperActivityAttributes.swift in Sources */,
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
@@ -792,6 +807,9 @@
A10000000000000000000003 /* MeshMapperActivityAttributes.swift in Sources */,
A10000000000000000000004 /* MeshMapperLiveActivity.swift in Sources */,
A10000000000000000000005 /* MeshMapperLiveActivityBundle.swift in Sources */,
+ D10000000000000000000001 /* MeshMapperStatusWidget.swift in Sources */,
+ D10000000000000000000002 /* MeshMapperSiriSnapshot.swift in Sources */,
+ D10000000000000000000003 /* MeshMapperSiriSnapshotStore.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1236,6 +1254,7 @@
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ENABLE_MODULES = YES;
+ CODE_SIGN_ENTITLEMENTS = MeshMapperLiveActivity/MeshMapperLiveActivity.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = "$(MESHMAPPER_DEVELOPMENT_TEAM)";
@@ -1265,6 +1284,7 @@
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ENABLE_MODULES = YES;
+ CODE_SIGN_ENTITLEMENTS = MeshMapperLiveActivity/MeshMapperLiveActivity.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = "$(MESHMAPPER_DEVELOPMENT_TEAM)";
@@ -1293,6 +1313,7 @@
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ENABLE_MODULES = YES;
+ CODE_SIGN_ENTITLEMENTS = MeshMapperLiveActivity/MeshMapperLiveActivity.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = "$(MESHMAPPER_DEVELOPMENT_TEAM)";
diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift
index dd4d52a6..3407ab05 100644
--- a/ios/Runner/AppDelegate.swift
+++ b/ios/Runner/AppDelegate.swift
@@ -1,8 +1,10 @@
import AppIntents
+import CarPlay
import Flutter
import MapLibre
import UIKit
import UserNotifications
+import WidgetKit
import flutter_background_service_ios
/// URLProtocol that fails fast for MapLibre tile/style/glyph/sprite requests
@@ -67,7 +69,7 @@ class IOSMapOfflineBridge {
}
@main
-@objc class AppDelegate: FlutterAppDelegate {
+@objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate {
private let mapOfflineBridge = IOSMapOfflineBridge()
private let liveActivityManager = LiveActivityManager()
private let watchSessionManager = WatchSessionManager()
@@ -84,7 +86,6 @@ class IOSMapOfflineBridge {
// The package registers its own background tasks
}
- GeneratedPluginRegistrant.register(with: self)
UNUserNotificationCenter.current().delegate = self
// App Shortcut metadata is extracted at build time, but asking the system
@@ -97,14 +98,57 @@ class IOSMapOfflineBridge {
// Register background service
SwiftFlutterBackgroundServicePlugin.taskIdentifier = "net.meshmapper.app.background"
- if let controller = window?.rootViewController as? FlutterViewController {
+ return super.application(application, didFinishLaunchingWithOptions: launchOptions)
+ }
+
+ override func application(
+ _ application: UIApplication,
+ configurationForConnecting connectingSceneSession: UISceneSession,
+ options: UIScene.ConnectionOptions
+ ) -> UISceneConfiguration {
+ if connectingSceneSession.role == .windowApplication {
+ let configuration = UISceneConfiguration(
+ name: "flutter",
+ sessionRole: connectingSceneSession.role
+ )
+ configuration.sceneClass = UIWindowScene.self
+ configuration.delegateClass = SceneDelegate.self
+ configuration.storyboard = UIStoryboard(name: "Main", bundle: nil)
+ return configuration
+ }
+
+ if connectingSceneSession.role == .carTemplateApplication {
+ let configuration = UISceneConfiguration(
+ name: "CarPlay",
+ sessionRole: connectingSceneSession.role
+ )
+ configuration.sceneClass = CPTemplateApplicationScene.self
+ if #available(iOS 16.0, *) {
+ configuration.delegateClass = CarPlaySceneDelegate.self
+ }
+ return configuration
+ }
+
+ return UISceneConfiguration(name: nil, sessionRole: connectingSceneSession.role)
+ }
+
+ /// Flutter creates the engine from the scene's storyboard on iOS 13 and
+ /// later. Register plugins and application channels only after that engine
+ /// exists; accessing AppDelegate.window during launch is invalid with the
+ /// UIScene lifecycle and is a fatal error on iOS 27.
+ func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) {
+ GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry)
+ configureFlutterChannels(messenger: engineBridge.applicationRegistrar.messenger())
+ }
+
+ private func configureFlutterChannels(messenger: FlutterBinaryMessenger) {
// Method channel: iOS map offline mode bridge. Dart calls
// `setOffline` from map_widget.dart to toggle the URLProtocol
// interceptor that forces tile requests to fail fast, letting
// MapLibre-iOS serve only cached/downloaded tiles.
let offlineChannel = FlutterMethodChannel(
name: "meshmapper/ios_map_offline",
- binaryMessenger: controller.binaryMessenger
+ binaryMessenger: messenger
)
offlineChannel.setMethodCallHandler { [weak self] call, result in
guard let self = self else {
@@ -127,7 +171,7 @@ class IOSMapOfflineBridge {
// and compact system/CarPlay presentations from these snapshots.
let liveActivityChannel = FlutterMethodChannel(
name: "meshmapper/live_activity",
- binaryMessenger: controller.binaryMessenger
+ binaryMessenger: messenger
)
liveActivityChannel.setMethodCallHandler { [weak self] call, result in
guard let self = self else {
@@ -142,7 +186,7 @@ class IOSMapOfflineBridge {
// channel. Unlike the Live Activity, this needs no entitlement.
let watchChannel = FlutterMethodChannel(
name: "meshmapper/watch",
- binaryMessenger: controller.binaryMessenger
+ binaryMessenger: messenger
)
watchChannel.setMethodCallHandler { [weak self] call, result in
guard let self = self else {
@@ -158,7 +202,7 @@ class IOSMapOfflineBridge {
// intents that must not launch Flutter.
let appIntentChannel = FlutterMethodChannel(
name: "meshmapper/app_intents",
- binaryMessenger: controller.binaryMessenger
+ binaryMessenger: messenger
)
appIntentChannel.setMethodCallHandler { [weak self] call, result in
guard let self = self else {
@@ -169,6 +213,13 @@ class IOSMapOfflineBridge {
case "publishSnapshot":
do {
try self.siriSnapshotStore.writeFlutterPayload(call.arguments)
+ WidgetCenter.shared.reloadTimelines(
+ ofKind: "MeshMapperStatusWidget"
+ )
+ NotificationCenter.default.post(
+ name: .meshMapperSnapshotDidChange,
+ object: nil
+ )
result(nil)
} catch {
result(FlutterError(
@@ -188,7 +239,7 @@ class IOSMapOfflineBridge {
// from the Offline Maps screen's Tile Cache card.
let tileCacheChannel = FlutterMethodChannel(
name: "meshmapper/tile_cache",
- binaryMessenger: controller.binaryMessenger
+ binaryMessenger: messenger
)
tileCacheChannel.setMethodCallHandler { call, result in
switch call.method {
@@ -222,9 +273,6 @@ class IOSMapOfflineBridge {
result(FlutterMethodNotImplemented)
}
}
- }
-
- return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
/// Per-region downloaded byte counts, keyed by the Dart-side region ID that
diff --git a/ios/Runner/CarPlaySceneDelegate.swift b/ios/Runner/CarPlaySceneDelegate.swift
new file mode 100644
index 00000000..af84b1fb
--- /dev/null
+++ b/ios/Runner/CarPlaySceneDelegate.swift
@@ -0,0 +1,275 @@
+import CarPlay
+import UIKit
+
+extension Notification.Name {
+ static let meshMapperSnapshotDidChange = Notification.Name("MeshMapperSnapshotDidChange")
+}
+
+// Personal-build custom dashboard. This is deliberately outside the map-only
+// presentation supported by the maps entitlement; do not submit as a map UI.
+@available(iOS 16.0, *)
+final class CarPlaySceneDelegate: UIResponder, CPTemplateApplicationSceneDelegate {
+ private var dashboard: HeardDashboardController?
+ private var observer: NSObjectProtocol?
+ private var timer: Timer?
+
+ func templateApplicationScene(_ scene: CPTemplateApplicationScene,
+ didConnect controller: CPInterfaceController, to window: CPWindow) {
+ stopUpdates()
+ let dashboard = HeardDashboardController()
+ self.dashboard = dashboard
+ window.rootViewController = dashboard
+ let template = CPMapTemplate()
+ template.automaticallyHidesNavigationBar = true
+ template.hidesButtonsWithNavigationBar = true
+ controller.setRootTemplate(template, animated: false, completion: nil)
+ observer = NotificationCenter.default.addObserver(forName: .meshMapperSnapshotDidChange,
+ object: nil, queue: .main) { [weak self] _ in self?.refresh() }
+ timer = Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { [weak self] _ in
+ self?.refresh()
+ }
+ refresh()
+ }
+
+ func templateApplicationScene(_ scene: CPTemplateApplicationScene,
+ didDisconnect controller: CPInterfaceController, from window: CPWindow) {
+ stopUpdates()
+ dashboard = nil
+ window.rootViewController = nil
+ }
+
+ private func stopUpdates() {
+ timer?.invalidate()
+ timer = nil
+ if let observer { NotificationCenter.default.removeObserver(observer) }
+ observer = nil
+ }
+
+ private func refresh() {
+ dashboard?.render(try? MeshMapperSiriSnapshotStore.shared.read())
+ }
+}
+
+private final class HeardDashboardController: UIViewController, UIScrollViewDelegate {
+ private let companion = UILabel()
+ private let status = UILabel()
+ private let fresh = UIStackView()
+ private let previous = UIStackView()
+ private var columnViews: [(rows: UIStackView, scroll: UIScrollView, footer: UILabel)] = []
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ view.backgroundColor = UIColor(red: 0.05, green: 0.07, blue: 0.11, alpha: 1)
+ let title = label("MeshMapper", size: 23, weight: .bold)
+ for line in [companion, status] {
+ line.font = .systemFont(ofSize: 9)
+ line.textColor = .lightGray
+ line.textAlignment = .right
+ line.adjustsFontSizeToFitWidth = true
+ line.minimumScaleFactor = 0.75
+ }
+ let radio = UIStackView(arrangedSubviews: [companion, status])
+ radio.axis = .vertical
+ radio.spacing = 2
+ let header = UIStackView(arrangedSubviews: [title, UIView(), radio])
+ header.alignment = .center
+ header.spacing = 8
+ radio.widthAnchor.constraint(lessThanOrEqualTo: header.widthAnchor, multiplier: 0.48).isActive = true
+ let columns = UIStackView(arrangedSubviews: [column("This scan · last 60s", rows: fresh),
+ column("Previous scans", rows: previous)])
+ columns.axis = .horizontal
+ columns.distribution = .fillEqually
+ columns.spacing = 16
+ let content = UIStackView(arrangedSubviews: [header, columns])
+ content.axis = .vertical
+ content.spacing = 6
+ content.translatesAutoresizingMaskIntoConstraints = false
+ view.addSubview(content)
+ NSLayoutConstraint.activate([
+ content.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: 12),
+ content.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -12),
+ content.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 8),
+ content.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -8),
+ ])
+ }
+
+ private func label(_ text: String, size: CGFloat, weight: UIFont.Weight) -> UILabel {
+ let label = UILabel()
+ label.text = text
+ label.font = .systemFont(ofSize: size, weight: weight)
+ label.textColor = .white
+ return label
+ }
+
+ private func column(_ title: String, rows: UIStackView) -> UIView {
+ rows.axis = .vertical
+ rows.spacing = 3
+ let scroll = UIScrollView()
+ scroll.delegate = self
+ rows.translatesAutoresizingMaskIntoConstraints = false
+ scroll.addSubview(rows)
+ NSLayoutConstraint.activate([
+ rows.leadingAnchor.constraint(equalTo: scroll.contentLayoutGuide.leadingAnchor),
+ rows.trailingAnchor.constraint(equalTo: scroll.contentLayoutGuide.trailingAnchor),
+ rows.topAnchor.constraint(equalTo: scroll.contentLayoutGuide.topAnchor),
+ rows.bottomAnchor.constraint(equalTo: scroll.contentLayoutGuide.bottomAnchor),
+ rows.widthAnchor.constraint(equalTo: scroll.frameLayoutGuide.widthAnchor),
+ ])
+ let footer = label("", size: 9, weight: .regular)
+ footer.textColor = .lightGray
+ footer.heightAnchor.constraint(equalToConstant: 12).isActive = true
+ columnViews.append((rows, scroll, footer))
+ let stack = UIStackView(arrangedSubviews: [label(title, size: 12, weight: .semibold), scroll, footer])
+ stack.axis = .vertical
+ stack.spacing = 6
+ return stack
+ }
+
+ override func viewDidLayoutSubviews() {
+ super.viewDidLayoutSubviews()
+ updateOverflow()
+ }
+
+ func scrollViewDidScroll(_ scrollView: UIScrollView) { updateOverflow() }
+
+ private func updateOverflow() {
+ for column in columnViews {
+ let top = column.scroll.bounds.minY + column.scroll.adjustedContentInset.top
+ let bottom = column.scroll.bounds.maxY - column.scroll.adjustedContentInset.bottom
+ var remaining = 0
+ for row in column.rows.arrangedSubviews where row.tag == 1 {
+ let frame = row.convert(row.bounds, to: column.scroll)
+ let below = frame.maxY > bottom + 0.5
+ // Preserve layout and scrolling extent; hiding arranged subviews would
+ // collapse them and make the overflow rows impossible to scroll to.
+ row.alpha = frame.minY >= top - 0.5 && !below ? 1 : 0
+ row.accessibilityElementsHidden = row.alpha == 0
+ if below { remaining += 1 }
+ }
+ column.footer.text = remaining > 0 ? "+\(remaining) more" : ""
+ }
+ }
+
+ func render(_ snapshot: MeshMapperSiriSnapshot?) {
+ loadViewIfNeeded()
+ // The next one-second tick catches up after scrolling. Rebuilding the
+ // stacks during a gesture can clamp the offset and interrupt the swipe.
+ guard !columnViews.contains(where: { $0.scroll.isTracking || $0.scroll.isDragging || $0.scroll.isDecelerating }) else { return }
+ defer {
+ view.setNeedsLayout()
+ view.layoutIfNeeded()
+ updateOverflow()
+ }
+ for stack in [fresh, previous] {
+ stack.arrangedSubviews.forEach { stack.removeArrangedSubview($0); $0.removeFromSuperview() }
+ }
+ guard let snapshot else {
+ companion.text = "Companion"
+ status.text = "Open MeshMapper on your phone"
+ return
+ }
+ let connection = snapshot.connection
+ let stale = Date().timeIntervalSince(snapshot.updatedAt) > 30
+ companion.text = connection.deviceName ?? "Companion"
+ var parts = [String]()
+ parts.append(connection.batteryPercent.map { "Battery \($0)%" } ?? "Battery —")
+ parts.append(stale ? "Waiting for phone" : (connection.isConnected ? "Connected" : "Disconnected"))
+ status.text = parts.joined(separator: " · ")
+ let held = snapshot.session.phase == "deferred" || snapshot.session.phase == "skipped"
+ let showHeld = !stale && connection.isConnected && held
+ if showHeld {
+ fresh.addArrangedSubview(scanStatus(shortStatus(snapshot.session.phase, fallback: snapshot.session.phaseTitle),
+ detail: nil,
+ color: .systemOrange))
+ }
+ var seen = Set()
+ for item in snapshot.recentHeard.sorted(by: { $0.observedAtMs > $1.observedAtMs }) {
+ guard seen.insert(item.entityId ?? item.displayHexId.uppercased()).inserted else { continue }
+ let age = max(0, Date().timeIntervalSince(item.observedAt))
+ guard age <= 300 else { continue }
+ let target = age < 60 ? fresh : previous
+ target.addArrangedSubview(row(item, age: age))
+ }
+ if fresh.arrangedSubviews.isEmpty {
+ let title = stale ? "Waiting for phone" :
+ (!connection.isConnected ? "Disconnected" : shortStatus(snapshot.session.phase, fallback: snapshot.session.phaseTitle))
+ fresh.addArrangedSubview(scanStatus(title,
+ detail: nil,
+ color: .lightGray))
+ }
+ if previous.arrangedSubviews.isEmpty { previous.addArrangedSubview(label("No older results", size: 14, weight: .regular)) }
+ }
+
+ private func shortStatus(_ phase: String, fallback: String) -> String {
+ switch phase {
+ case "sending": return "Pinging"
+ case "listening", "listening_discovery", "listening_trace": return "Listening"
+ case "deferred": return "Deferred"
+ case "skipped": return "Skipped"
+ case "waiting", "waiting_discovery", "waiting_trace": return "Waiting"
+ default: return fallback
+ }
+ }
+
+ private func scanStatus(_ title: String, detail: String?, color: UIColor) -> UIView {
+ let heading = label(title, size: 12, weight: .semibold)
+ heading.textColor = color
+ let stack = UIStackView(arrangedSubviews: [heading])
+ stack.axis = .vertical
+ stack.spacing = 2
+ if let detail, !detail.isEmpty {
+ let explanation = label(detail, size: 10, weight: .regular)
+ explanation.textColor = .lightGray
+ explanation.numberOfLines = 0
+ stack.addArrangedSubview(explanation)
+ }
+ return stack
+ }
+
+ private func row(_ item: MeshMapperSiriObservation, age: TimeInterval) -> UIView {
+ let progress = min(1, max(0, (age - 60) / 240))
+ let ageColor = UIColor(hue: CGFloat((1 - progress) / 3), saturation: 0.75, brightness: 0.95, alpha: 1)
+ let color = signalColor(item.snr)
+ let dot = label("●", size: 8, weight: .regular)
+ dot.textColor = color
+ let name = label(item.name ?? item.displayHexId.uppercased(), size: 11, weight: .medium)
+ name.lineBreakMode = .byTruncatingTail
+ name.adjustsFontSizeToFitWidth = true
+ name.minimumScaleFactor = 0.75
+ name.textAlignment = .left
+ name.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
+ let signal = item.snr.map { String(format: "%+.1f", $0) } ?? "—"
+ let ageText = age < 60 ? "\(Int(age))s" : "\(Int(age / 60))m \(Int(age) % 60)s"
+ let value = label("\(signal) dB · \(ageText)", size: 9, weight: .regular)
+ let telemetry = NSMutableAttributedString(string: "\(signal) dB", attributes: [.foregroundColor: color])
+ telemetry.append(NSAttributedString(string: " · \(ageText)", attributes: [.foregroundColor: ageColor]))
+ value.attributedText = telemetry
+ value.setContentCompressionResistancePriority(.required, for: .horizontal)
+ // Keep telemetry below the name so long repeater names get the entire
+ // column width rather than competing with the signal and age labels.
+ let text = UIStackView(arrangedSubviews: [name, value])
+ text.axis = .vertical
+ text.alignment = .fill
+ text.spacing = 1
+ dot.setContentHuggingPriority(.required, for: .horizontal)
+ let row = UIStackView(arrangedSubviews: [dot, text])
+ row.spacing = 4
+ row.alignment = .center
+ row.isLayoutMarginsRelativeArrangement = true
+ row.layoutMargins = UIEdgeInsets(top: 3, left: 5, bottom: 3, right: 5)
+ row.backgroundColor = ageColor.withAlphaComponent(0.08)
+ row.layer.cornerRadius = 5
+ row.heightAnchor.constraint(equalToConstant: 32).isActive = true
+ row.tag = 1 // Only repeater rows count toward the overflow indicator.
+ row.accessibilityLabel = "\(name.text ?? "Repeater"), \(signal) decibels, \(Int(age)) seconds ago"
+ return row
+ }
+
+ private func signalColor(_ snr: Double?) -> UIColor {
+ guard let snr, snr.isFinite else { return .systemGray }
+ if snr >= 5 { return .systemGreen }
+ if snr >= 0 { return .systemYellow }
+ if snr >= -5 { return .systemOrange }
+ return .systemRed
+ }
+}
diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index d7dc90b3..0891331a 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -137,6 +137,38 @@
UIApplicationSupportsIndirectInputEvents
+ UIApplicationSceneManifest
+
+ UIApplicationSupportsMultipleScenes
+
+ UISceneConfigurations
+
+ UIWindowSceneSessionRoleApplication
+
+
+ UISceneClassName
+ UIWindowScene
+ UISceneConfigurationName
+ flutter
+ UISceneDelegateClassName
+ $(PRODUCT_MODULE_NAME).SceneDelegate
+ UISceneStoryboardFile
+ Main
+
+
+ CPTemplateApplicationSceneSessionRoleApplication
+
+
+ UISceneClassName
+ CPTemplateApplicationScene
+ UISceneConfigurationName
+ CarPlay
+ UISceneDelegateClassName
+ $(PRODUCT_MODULE_NAME).CarPlaySceneDelegate
+
+
+
+
UIBackgroundModes
bluetooth-central
diff --git a/ios/Runner/Runner.entitlements b/ios/Runner/Runner.entitlements
index 7037779d..f7b8fa3c 100644
--- a/ios/Runner/Runner.entitlements
+++ b/ios/Runner/Runner.entitlements
@@ -2,6 +2,8 @@
+ com.apple.developer.carplay-maps
+
com.apple.security.application-groups
group.net.meshmapper.app.shared
diff --git a/ios/Runner/SceneDelegate.swift b/ios/Runner/SceneDelegate.swift
new file mode 100644
index 00000000..e7f7294f
--- /dev/null
+++ b/ios/Runner/SceneDelegate.swift
@@ -0,0 +1,12 @@
+import Flutter
+import UIKit
+
+/// Flutter's UIScene host. Required by iOS 27, which no longer permits apps
+/// linked against the current SDK to rely on the legacy AppDelegate window.
+class SceneDelegate: FlutterSceneDelegate {
+ // This app restores its session from its own stores. Avoid Flutter's scene
+ // restoration NSUserActivity, which aborts on this iOS build when backgrounded.
+ override func stateRestorationActivity(for scene: UIScene) -> NSUserActivity? {
+ return nil
+ }
+}
diff --git a/ios/Shared/AppIntents/MeshMapperSiriSnapshot.swift b/ios/Shared/AppIntents/MeshMapperSiriSnapshot.swift
index 4fb3ffe4..82222acb 100644
--- a/ios/Shared/AppIntents/MeshMapperSiriSnapshot.swift
+++ b/ios/Shared/AppIntents/MeshMapperSiriSnapshot.swift
@@ -18,6 +18,9 @@ struct MeshMapperSiriConnection: Codable, Sendable {
let isConnected: Bool
let deviceName: String?
let batteryPercent: Int?
+ /// User-selected or radio-detected transmit power. Optional for v1 snapshots
+ /// written by an older app build.
+ let powerWatts: Double?
let gpsStatus: String
}
diff --git a/lib/providers/app_state_provider.dart b/lib/providers/app_state_provider.dart
index f0e08ee1..975311ef 100644
--- a/lib/providers/app_state_provider.dart
+++ b/lib/providers/app_state_provider.dart
@@ -3299,6 +3299,7 @@ class AppStateProvider extends ChangeNotifier with WidgetsBindingObserver {
isConnected: isConnected,
deviceName: displayDeviceName,
batteryPercent: _currentBatteryPercent,
+ powerWatts: isConnected ? _preferences.powerLevel : null,
gpsStatus: _gpsStatus.name,
),
session: SiriSessionSnapshot(
@@ -3360,6 +3361,7 @@ class AppStateProvider extends ChangeNotifier with WidgetsBindingObserver {
isConnected,
displayDeviceName,
_currentBatteryPercent,
+ isConnected ? _preferences.powerLevel : null,
_gpsStatus.name,
_liveActivitySessionId,
_autoPingEnabled,
diff --git a/lib/services/app_intents/siri_snapshot_models.dart b/lib/services/app_intents/siri_snapshot_models.dart
index 01844612..e464c449 100644
--- a/lib/services/app_intents/siri_snapshot_models.dart
+++ b/lib/services/app_intents/siri_snapshot_models.dart
@@ -10,18 +10,21 @@ class SiriConnectionSnapshot {
required this.isConnected,
this.deviceName,
this.batteryPercent,
+ this.powerWatts,
required this.gpsStatus,
});
final bool isConnected;
final String? deviceName;
final int? batteryPercent;
+ final double? powerWatts;
final String gpsStatus;
Map toMap() => {
'isConnected': isConnected,
'deviceName': deviceName,
'batteryPercent': batteryPercent,
+ 'powerWatts': powerWatts,
'gpsStatus': gpsStatus,
};
}
diff --git a/test/services/app_intents/siri_snapshot_wire_contract_test.dart b/test/services/app_intents/siri_snapshot_wire_contract_test.dart
index 0b4308d3..8c61a4c7 100644
--- a/test/services/app_intents/siri_snapshot_wire_contract_test.dart
+++ b/test/services/app_intents/siri_snapshot_wire_contract_test.dart
@@ -10,6 +10,7 @@ void main() {
isConnected: true,
deviceName: 'MrAlders0n',
batteryPercent: 76,
+ powerWatts: 0.3,
gpsStatus: 'locked',
),
session: SiriSessionSnapshot(
@@ -84,8 +85,10 @@ void main() {
'isConnected',
'deviceName',
'batteryPercent',
+ 'powerWatts',
'gpsStatus',
});
+ expect((snapshot['connection']! as Map)['powerWatts'], 0.3);
expect((snapshot['session']! as Map).keys.toSet(), {
'id',
'startedAtMs',