Merge f4ff92dbf996638bfc48880216ff9b48051f6e15 into 04995f68e470a18d1fc99f86fa326c2a87bab4f2

This commit is contained in:
Felix-Ayush 2026-11-05 13:05:11 +00:00 committed by GitHub
commit c37ff8f102
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 1351 additions and 10 deletions

File diff suppressed because it is too large Load Diff

View File

@ -333,7 +333,11 @@ final class ChatVerificationCoordinator {
maybeSendMutualVerificationNotification(
fingerprint: fingerprint,
peerID: peerID,
title: "Mutual verification",
title: String(
localized: "verification.notification.mutual.title",
defaultValue: "Mutual verification",
comment: "Notification title when both peers have verified each other"
),
bodyName: context.unifiedPeer(for: peerID)?.nickname
?? context.resolveNickname(for: peerID),
notificationPrefix: "verify-mutual"
@ -375,8 +379,20 @@ final class ChatVerificationCoordinator {
let peerName = context.unifiedPeer(for: peerID)?.nickname
?? context.resolveNickname(for: peerID)
context.postLocalNotification(
title: "Verified",
body: "You verified \(peerName)",
title: String(
localized: "verification.notification.success.title",
defaultValue: "Verified",
comment: "Notification title after the user successfully verifies a peer"
),
body: String(
format: String(
localized: "verification.notification.success.body",
defaultValue: "You verified %@",
comment: "Notification body after verifying a peer; %@ is the peer nickname"
),
locale: .current,
peerName
),
identifier: "verify-success-\(peerID)-\(UUID().uuidString)"
)
@ -385,7 +401,11 @@ final class ChatVerificationCoordinator {
maybeSendMutualVerificationNotification(
fingerprint: fingerprint,
peerID: peerID,
title: "Mutual verification",
title: String(
localized: "verification.notification.mutual.title",
defaultValue: "Mutual verification",
comment: "Notification title when both peers have verified each other"
),
bodyName: peerName,
notificationPrefix: "verify-mutual"
)
@ -412,7 +432,15 @@ private extension ChatVerificationCoordinator {
lastMutualToastAt[fingerprint] = now
context.postLocalNotification(
title: title,
body: "You and \(bodyName) verified each other",
body: String(
format: String(
localized: "verification.notification.mutual.body",
defaultValue: "You and %@ verified each other",
comment: "Notification body when mutual verification completes; %@ is the peer nickname"
),
locale: .current,
bodyName
),
identifier: "\(notificationPrefix)-\(peerID)-\(UUID().uuidString)"
)
}

View File

@ -8,7 +8,7 @@ import UIKit
import AppKit
#endif
/// Placeholder view to display the user's verification QR payload as text.
/// Displays the user's verification QR payload as an image and selectable text.
struct MyQRView: View {
let qrString: String
@Environment(\.colorScheme) var colorScheme
@ -462,13 +462,13 @@ struct VerificationSheetView: View {
VStack(spacing: 10) {
if showingScanner {
Button(action: { showingScanner = false }) {
Label("show my qr", systemImage: "qrcode")
Label("verification.sheet.show_my_qr", systemImage: "qrcode")
.bitchatFont(size: 13)
}
.buttonStyle(.bordered)
} else {
Button(action: { showingScanner = true }) {
Label("scan someone else's qr", systemImage: "camera.viewfinder")
Label("verification.sheet.scan_other_qr", systemImage: "camera.viewfinder")
.bitchatFont(size: 13, weight: .medium)
}
.buttonStyle(.bordered)
@ -479,7 +479,7 @@ struct VerificationSheetView: View {
if let peerID = verificationModel.selectedPeerID,
verificationModel.isVerified(peerID: peerID) {
Button(action: { verificationModel.unverifyFingerprint(for: peerID) }) {
Label("remove verification", systemImage: "minus.circle")
Label("verification.sheet.remove_verification", systemImage: "minus.circle")
.bitchatFont(size: 12)
}
.buttonStyle(.bordered)

View File

@ -316,7 +316,11 @@ struct ChatVerificationCoordinatorContextTests {
// Already-verified peer challenging us: mutual-verification toast.
#expect(context.postedLocalNotifications.count == 1)
#expect(context.postedLocalNotifications.first?.title == "Mutual verification")
#expect(context.postedLocalNotifications.first?.title == String(
localized: "verification.notification.mutual.title",
defaultValue: "Mutual verification",
comment: "Notification title when both peers have verified each other"
))
#expect(context.postedLocalNotifications.first?.body.hasSuffix("verified each other") == true)
#expect(context.postedLocalNotifications.first?.identifier.hasPrefix("verify-mutual-") == true)