mirror of
https://github.com/sudosylabs/vnidrop.git
synced 2026-08-05 18:39:55 +02:00
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.
32 lines
1015 B
Swift
32 lines
1015 B
Swift
import Foundation
|
|
|
|
/// Bug-report draft, ported from `diagnostics/BugReportService.kt`.
|
|
struct BugReportDraft {
|
|
let whatHappened: String
|
|
let expected: String
|
|
let steps: String
|
|
let contact: String
|
|
let includeLogs: Bool
|
|
}
|
|
|
|
/// Bug-report submission. The full diagnostics transport (URLSession + build
|
|
/// config) lands in the diagnostics phase; this protocol is the stable seam.
|
|
@MainActor
|
|
protocol BugReportService {
|
|
func submit(_ draft: BugReportDraft, deviceInfo: DeviceInfo?) async -> Result<Void, Error>
|
|
func previewLogBytes() async -> Int
|
|
}
|
|
|
|
/// Offline-safe no-op used until the diagnostics transport is configured.
|
|
struct NoopBugReportService: BugReportService {
|
|
func submit(_ draft: BugReportDraft, deviceInfo: DeviceInfo?) async -> Result<Void, Error> {
|
|
.failure(InvitationError.bugReportingUnavailable)
|
|
}
|
|
func previewLogBytes() async -> Int { 0 }
|
|
}
|
|
|
|
/// Whether the diagnostics stack is compiled in (mirrors DiagnosticsBuildConfig).
|
|
enum DiagnosticsBuildConfig {
|
|
static let included = false
|
|
}
|