Skip to content

Commit

Permalink
Merge branch 'jens/nfc-issue-ipad'
Browse files Browse the repository at this point in the history
  • Loading branch information
jensutbult committed Dec 4, 2024
2 parents d3da6f7 + e2029ea commit a5caede
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 2 deletions.
48 changes: 47 additions & 1 deletion Authenticator/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
},
"ja" : {
"stringUnit" : {
"state" : "new",
"state" : "translated",
"value" : "%1$@ (build %2$@)"
}
},
Expand Down Expand Up @@ -1858,6 +1858,29 @@
}
}
},
"Invalid device info received from YubiKey" : {
"comment" : "Internal error message not to be displayed to the user.",
"localizations" : {
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Informations invalides sur le dispositif reçues de YubiKey"
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "YubiKey から無効なデバイス情報を受信しました。"
}
},
"sk" : {
"stringUnit" : {
"state" : "new",
"value" : "Invalid device info received from YubiKey"
}
}
}
},
"Invalid signature" : {
"comment" : "PIV extension NFC invalid signature\nPIV extension invalid signature",
"localizations" : {
Expand Down Expand Up @@ -2129,6 +2152,29 @@
}
}
},
"NFC not supported on this device" : {
"comment" : "Internal error message not to be displayed to the user.",
"localizations" : {
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "La technologie NFC n'est pas prise en charge par cet appareil"
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "このデバイスではNFCはサポートされていません"
}
},
"sk" : {
"stringUnit" : {
"state" : "new",
"value" : "NFC not supported on this device"
}
}
}
},
"NFC settings" : {
"localizations" : {
"fr" : {
Expand Down
4 changes: 4 additions & 0 deletions Authenticator/Model/OATHSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ enum OATHSessionError: Error, LocalizedError, Equatable {
case otpEnabledError
case connectionCancelled
case invalidDeviceInfo
case nfcNotSupported

public var errorDescription: String? {
switch self {
Expand All @@ -33,6 +34,8 @@ enum OATHSessionError: Error, LocalizedError, Equatable {
return String(localized: "Connection cancelled by user", comment: "Internal error message not to be displayed to the user.")
case .invalidDeviceInfo:
return String(localized: "Invalid device info received from YubiKey", comment: "Internal error message not to be displayed to the user.")
case .nfcNotSupported:
return String(localized: "NFC not supported on this device", comment: "Internal error message not to be displayed to the user.")
}
}
}
Expand Down Expand Up @@ -213,6 +216,7 @@ class OATHSessionHandler: NSObject, YKFManagerDelegate {

var nfcContinuation: CheckedContinuation<OATHSession, Error>?
func nfcSession() async throws -> OATHSession {
guard YubiKitDeviceCapabilities.supportsISO7816NFCTags else { throw OATHSessionError.nfcNotSupported }
return try await withTaskCancellationHandler {
return try await withCheckedThrowingContinuation { continuation in
self.nfcContinuation = continuation
Expand Down
6 changes: 6 additions & 0 deletions Authenticator/UI/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,12 @@ struct MainView: View {
showAccountDetails = nil
}
}
.onChange(of: model.isKeyPluggedIn) { isKeyPluggedIn in
// If the user removes the YubiKey while adding a new account we dismiss the add account modal.
if showAddAccount && !isKeyPluggedIn {
showAddAccount = false
}
}
.environmentObject(model)
}

Expand Down
2 changes: 1 addition & 1 deletion Authenticator/UI/mul.lproj/Main.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@
"sk" : {
"stringUnit" : {
"state" : "translated",
"value" : "Aktivácia funkcie NFC pri OTP prečítaná"
"value" : "Aktivovať NFC pri načítaní tagu OTP"
}
}
}
Expand Down

0 comments on commit a5caede

Please sign in to comment.