mirror of
https://github.com/sudosylabs/vnidrop.git
synced 2026-08-05 02:29:55 +02:00
refactor(apple): make InvitationError typed and localize NFC prompts
Replace the free-form InvitationError.message(String) case with semantic
cases mapped to L10n keys at the UI boundary (Error.uiText), so user-facing
error text is localized instead of substring-matched from English blobs.
.raw(String) remains only for genuinely dynamic system/core messages.
Localize the CoreNFC alertMessage prompts via existing L10n keys, and add
SwiftLint rules (raw_alert_message, raw_invitation_error) to catch raw
alert strings and literal .raw("…") errors going forward.
This commit is contained in:
@@ -32,3 +32,18 @@ custom_rules:
|
||||
regex: '\b(Text|Label|Button|Toggle|Link|NavigationLink|Section|Picker|Stepper|TextField|SecureField|DisclosureGroup|Menu|GroupBox)\("[^"]'
|
||||
message: "Pass a typed L10n.* accessor (or Text(verbatim:)), not a raw string literal."
|
||||
severity: warning
|
||||
raw_alert_message:
|
||||
name: "Raw NFC/alert message"
|
||||
# User-facing UIKit/CoreNFC prompts (e.g. NFCReaderSession.alertMessage) must
|
||||
# be localized, not hardcoded English.
|
||||
regex: '\balertMessage\s*=\s*"'
|
||||
message: "Assign a localized value (String(localized: L10n.*)), not a raw string literal."
|
||||
severity: warning
|
||||
raw_invitation_error:
|
||||
name: "Raw InvitationError literal"
|
||||
# InvitationError.raw is the escape hatch for genuinely dynamic system/core
|
||||
# messages; a string literal here is a loose user-facing string that belongs
|
||||
# in a typed InvitationError case mapped to L10n in UserFacingError.swift.
|
||||
regex: 'InvitationError\.raw\("'
|
||||
message: "Add a typed InvitationError case + L10n mapping instead of a literal .raw(\"…\")."
|
||||
severity: warning
|
||||
|
||||
Reference in New Issue
Block a user