findfamily-ios: add broken lock icon for non-pqc connections with quantum unprotected info popup
- Commit
ffd0f5824879dab09379ecf8d289a09828129abc- Author
- Vayun Mathur <[email protected]>
- When
- 2026-07-29 17:05 UTC (4 months ago)
- Parents
a18eed0
Diff
FindFamilyiOS/UI/BottomPanels.swift
diff --git a/FindFamilyiOS/UI/BottomPanels.swift b/FindFamilyiOS/UI/BottomPanels.swiftindex ee0461c36e..90d9d4887b 100644--- a/FindFamilyiOS/UI/BottomPanels.swift+++ b/FindFamilyiOS/UI/BottomPanels.swift@@ -60,9 +60,24 @@ struct UserDetailPanel: View { let onChangeContact: (String, String?) -> Void let onToggleSending: (Bool) -> Void + @State private var showPqcInfo = false+ var body: some View { VStack(spacing: 12) { UserCard(user: user, latest: latest, showSupporting: true) {}+ // PQC status banner for unprotected connections (also tappable via lock in card)+ if user.id != Networking.shared.userid && user.pqcEncryptionKey == nil {+ Button { showPqcInfo = true } label: {+ Label(Strings.pqcUnprotectedMessage, systemImage: "lock.open.trianglebadge.exclamationmark")+ .font(.caption)+ .foregroundStyle(.red)+ .frame(maxWidth: .infinity, alignment: .leading)+ .padding(8)+ .background(Color.red.opacity(0.12))+ .clipShape(RoundedRectangle(cornerRadius: 8))+ }+ .buttonStyle(.plain)+ } HStack { Text(Strings.shareYourLocation) Spacer()@@ -73,7 +88,6 @@ struct UserDetailPanel: View { .background(RoundedRectangle(cornerRadius: 12).fill(Color(.secondarySystemBackground))) // Precision Finding entry — pushed onto the MainView's NavigationStack.- // User already conforms to Hashable, so it doubles as the destination value. NavigationLink(value: user) { Label("Find with Precision", systemImage: "location.north.line.fill") .frame(maxWidth: .infinity)@@ -88,6 +102,11 @@ struct UserDetailPanel: View { .buttonStyle(.bordered) } .padding(.horizontal)+ .alert(Strings.pqcUnprotectedTitle, isPresented: $showPqcInfo) {+ Button(Strings.okButton, role: .cancel) {}+ } message: {+ Text(Strings.pqcUnprotectedMessage)+ } } }
FindFamilyiOS/UI/Cards.swift
diff --git a/FindFamilyiOS/UI/Cards.swift b/FindFamilyiOS/UI/Cards.swiftindex b939aa1164..c2115ef4bf 100644--- a/FindFamilyiOS/UI/Cards.swift+++ b/FindFamilyiOS/UI/Cards.swift@@ -72,6 +72,14 @@ struct UserCard: View { let showSupporting: Bool let onTap: () -> Void + @State private var showPqcInfo = false++ var isPqcProtected: Bool {+ // Self and users without RSA key (awaiting) skip badge. PQC present => protected.+ if user.id == Networking.shared.userid { return true }+ return user.pqcEncryptionKey != nil+ }+ var lastUpdatedString: String { if let ts = latest?.timestamp { return TimeFormatting.timestring(ts, future: false) } return Strings.lastUpdatedNever@@ -95,32 +103,71 @@ struct UserCard: View { } var body: some View {- Button(action: showSupporting ? onTap : {}) {- HStack(alignment: .top, spacing: 12) {- VStack(spacing: 4) {- UserPicture(user: user, size: 56)- if let b = latest?.battery {- BatteryBar(percent: b)+ ZStack(alignment: .topTrailing) {+ Button(action: showSupporting ? onTap : {}) {+ HStack(alignment: .top, spacing: 12) {+ VStack(spacing: 4) {+ UserPicture(user: user, size: 56)+ if let b = latest?.battery {+ BatteryBar(percent: b)+ } }- }- VStack(alignment: .leading, spacing: 4) {- Text(user.name).font(.headline)+ VStack(alignment: .leading, spacing: 4) {+ HStack(spacing: 4) {+ Text(user.name).font(.headline).lineLimit(1)+ if showSupporting && user.id != Networking.shared.userid {+ PqcLockIcon(isPqc: isPqcProtected) {+ if !isPqcProtected { showPqcInfo = true }+ }+ }+ }+ if showSupporting {+ Text(Strings.userCardStatus(lastUpdatedString, user.locationName, sinceString))+ .font(.caption)+ .foregroundStyle(.secondary)+ }+ }+ Spacer() if showSupporting {- Text(Strings.userCardStatus(lastUpdatedString, user.locationName, sinceString))- .font(.caption)- .foregroundStyle(.secondary)+ Text(speedString).font(.caption2).foregroundStyle(.secondary) } }- Spacer()- if showSupporting {- Text(speedString).font(.caption2).foregroundStyle(.secondary)- }+ .padding(12)+ .background(RoundedRectangle(cornerRadius: 12).fill(Color(.secondarySystemBackground)))+ }+ .buttonStyle(.plain)+ .disabled(!showSupporting)+ }+ .alert(Strings.pqcUnprotectedTitle, isPresented: $showPqcInfo) {+ Button(Strings.okButton, role: .cancel) {}+ } message: {+ Text(Strings.pqcUnprotectedMessage)+ }+ }+}++// Broken-lock indicator — tappable only when not PQC.+private struct PqcLockIcon: View {+ let isPqc: Bool+ let onTapUnprotected: () -> Void+ var body: some View {+ Group {+ if isPqc {+ Image(systemName: "lock.fill")+ .font(.caption)+ .foregroundStyle(Color.green)+ .accessibilityLabel("Quantum protected")+ } else {+ Image(systemName: "lock.open.trianglebadge.exclamationmark")+ .font(.caption)+ .foregroundStyle(Color.red)+ .contentShape(Rectangle())+ .onTapGesture {+ onTapUnprotected()+ }+ .accessibilityLabel("Not quantum protected") }- .padding(12)- .background(RoundedRectangle(cornerRadius: 12).fill(Color(.secondarySystemBackground))) }- .buttonStyle(.plain)- .disabled(!showSupporting) } }
FindFamilyiOS/Util/Util.swift
diff --git a/FindFamilyiOS/Util/Util.swift b/FindFamilyiOS/Util/Util.swiftindex ff00d89684..5ede7e74e5 100644--- a/FindFamilyiOS/Util/Util.swift+++ b/FindFamilyiOS/Util/Util.swift@@ -95,6 +95,10 @@ enum Strings { static let okButton = "OK" static let cancelButton = "Cancel"++ // PQC broken-lock info box (shown when tapping red lock for non-PQC peers)+ static let pqcUnprotectedTitle = "Quantum protection"+ static let pqcUnprotectedMessage = "Unprotected against quantum computers: this person needs to update their app." } // MARK: - Time formatting