Meshtastic-Apple/Meshtastic/Views/Connect/SecurityVersionNag.swift
Copilot a5c825aaf0
Complete user onboarding flow: background activity, firmware version enforcement, security nag, and Siri shortcuts (#1654)
* Initial plan

* Add Background Activity onboarding step, firmware version screens, and security nag

Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/449fe2d6-dec9-4509-920e-e6196ca11d65

Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>

* Address code review feedback: use @ObservedObject for LocationsHandler, fix firmware label

Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/449fe2d6-dec9-4509-920e-e6196ca11d65

Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>

* Improve readability of firmware version checks in Connect.swift

Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/449fe2d6-dec9-4509-920e-e6196ca11d65

Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>

* Add Siri onboarding step; fix @State→let in version sheets; fix .denied location flow

Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/654a5abf-8005-4995-974a-5f1f95dfa68a

Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>

* Update protobufs package

* Additional onboarding cleanup

* Catalyst fixes

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-18 10:50:06 -07:00

103 lines
2.8 KiB
Swift

//
// SecurityVersionNag.swift
// Meshtastic
//
// Copyright(c) Garth Vander Houwen 2024.
//
import SwiftUI
struct SecurityVersionNag: View {
@Environment(\.dismiss) private var dismiss
let minimumSecureVersion: String
let version: String
var body: some View {
VStack(spacing: 0) {
ScrollView {
VStack(spacing: 20) {
Image(systemName: "shield.slash.fill")
.font(.system(size: 60))
.foregroundColor(.red)
.padding(.top, 40)
Text("Security Update Recommended")
.font(.largeTitle.bold())
.multilineTextAlignment(.center)
.fixedSize(horizontal: false, vertical: true)
VStack(spacing: 8) {
if !version.isEmpty {
Label {
Text("Connected firmware: **\(version)**")
} icon: {
Image(systemName: "wifi.exclamationmark")
.foregroundColor(.orange)
}
.font(.body)
}
Label {
Text("Recommended secure version: **\(minimumSecureVersion)**")
} icon: {
Image(systemName: "checkmark.shield.fill")
.foregroundColor(.green)
}
.font(.body)
}
.padding()
.background(Color(.secondarySystemBackground))
.cornerRadius(12)
VStack(alignment: .leading, spacing: 12) {
Text("Security Advisory")
.font(.headline)
Text("Your connected device is running firmware older than **\(minimumSecureVersion)**, which contains known security vulnerabilities. Updating your firmware is strongly recommended to protect your device and mesh network.")
.font(.body)
.foregroundColor(.secondary)
.fixedSize(horizontal: false, vertical: true)
}
.padding()
.background(Color(.secondarySystemBackground))
.cornerRadius(12)
.padding(.horizontal)
VStack(alignment: .leading, spacing: 12) {
Text("How to Update")
.font(.headline)
Link(destination: URL(string: "https://flasher.meshtastic.org")!) {
Label("Open Web Flasher", systemImage: "bolt.fill")
.frame(maxWidth: .infinity)
}
.buttonStyle(.borderedProminent)
.controlSize(.regular)
.buttonBorderShape(.capsule)
Link(destination: URL(string: "https://meshtastic.org/docs/getting-started/flashing-firmware/")!) {
Label("Firmware Update Docs", systemImage: "book.fill")
.frame(maxWidth: .infinity)
}
.buttonStyle(.bordered)
.controlSize(.regular)
.buttonBorderShape(.capsule)
}
.padding()
.background(Color(.secondarySystemBackground))
.cornerRadius(12)
.padding(.horizontal)
}
.padding(.bottom, 20)
}
Button {
dismiss()
} label: {
Text("Dismiss")
.frame(maxWidth: .infinity)
}
.buttonStyle(.borderedProminent)
.buttonBorderShape(.capsule)
.controlSize(.large)
.padding()
}
}
}