Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/
37 changes: 37 additions & 0 deletions CARPLAY_REVIEW.md
Original file line number Diff line number Diff line change
@@ -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.

![CarPlay recent-repeater dashboard](docs/screenshots/carplay-recent-repeaters.jpg)
6 changes: 6 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Binary file added docs/screenshots/carplay-recent-repeaters.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions ios/MeshMapperLiveActivity/MeshMapperLiveActivity.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.application-groups</key>
<array>
<string>group.net.meshmapper.app.shared</string>
</array>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ import WidgetKit
struct MeshMapperLiveActivityBundle: WidgetBundle {
var body: some Widget {
MeshMapperLiveActivity()
MeshMapperStatusWidget()
}
}
154 changes: 154 additions & 0 deletions ios/MeshMapperLiveActivity/MeshMapperStatusWidget.swift
Original file line number Diff line number Diff line change
@@ -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<MeshMapperStatusEntry>) -> 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))
}
}
}
21 changes: 21 additions & 0 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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 = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
D30000000000000000000002 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
D40000000000000000000002 /* CarPlaySceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarPlaySceneDelegate.swift; sourceTree = "<group>"; };
775B3F6C0618B4BD5644B40B /* NodeListView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = NodeListView.swift; sourceTree = "<group>"; };
78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
Expand Down Expand Up @@ -211,6 +218,8 @@
B2000000000000000000000F /* MeshMapperAppIntents.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = MeshMapperAppIntents.entitlements; sourceTree = "<group>"; };
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 = "<group>"; };
D20000000000000000000001 /* MeshMapperStatusWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeshMapperStatusWidget.swift; sourceTree = "<group>"; };
D20000000000000000000002 /* MeshMapperLiveActivity.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = MeshMapperLiveActivity.entitlements; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -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 */,
Expand All @@ -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;
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -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;
};
Expand Down Expand Up @@ -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)";
Expand Down Expand Up @@ -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)";
Expand Down Expand Up @@ -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)";
Expand Down
Loading