Skip to content

Commit a5caede

Browse files
committed
Merge branch 'jens/nfc-issue-ipad'
2 parents d3da6f7 + e2029ea commit a5caede

File tree

4 files changed

+58
-2
lines changed

4 files changed

+58
-2
lines changed

Authenticator/Localizable.xcstrings

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
},
107107
"ja" : {
108108
"stringUnit" : {
109-
"state" : "new",
109+
"state" : "translated",
110110
"value" : "%1$@ (build %2$@)"
111111
}
112112
},
@@ -1858,6 +1858,29 @@
18581858
}
18591859
}
18601860
},
1861+
"Invalid device info received from YubiKey" : {
1862+
"comment" : "Internal error message not to be displayed to the user.",
1863+
"localizations" : {
1864+
"fr" : {
1865+
"stringUnit" : {
1866+
"state" : "translated",
1867+
"value" : "Informations invalides sur le dispositif reçues de YubiKey"
1868+
}
1869+
},
1870+
"ja" : {
1871+
"stringUnit" : {
1872+
"state" : "translated",
1873+
"value" : "YubiKey から無効なデバイス情報を受信しました。"
1874+
}
1875+
},
1876+
"sk" : {
1877+
"stringUnit" : {
1878+
"state" : "new",
1879+
"value" : "Invalid device info received from YubiKey"
1880+
}
1881+
}
1882+
}
1883+
},
18611884
"Invalid signature" : {
18621885
"comment" : "PIV extension NFC invalid signature\nPIV extension invalid signature",
18631886
"localizations" : {
@@ -2129,6 +2152,29 @@
21292152
}
21302153
}
21312154
},
2155+
"NFC not supported on this device" : {
2156+
"comment" : "Internal error message not to be displayed to the user.",
2157+
"localizations" : {
2158+
"fr" : {
2159+
"stringUnit" : {
2160+
"state" : "translated",
2161+
"value" : "La technologie NFC n'est pas prise en charge par cet appareil"
2162+
}
2163+
},
2164+
"ja" : {
2165+
"stringUnit" : {
2166+
"state" : "translated",
2167+
"value" : "このデバイスではNFCはサポートされていません"
2168+
}
2169+
},
2170+
"sk" : {
2171+
"stringUnit" : {
2172+
"state" : "new",
2173+
"value" : "NFC not supported on this device"
2174+
}
2175+
}
2176+
}
2177+
},
21322178
"NFC settings" : {
21332179
"localizations" : {
21342180
"fr" : {

Authenticator/Model/OATHSession.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ enum OATHSessionError: Error, LocalizedError, Equatable {
2222
case otpEnabledError
2323
case connectionCancelled
2424
case invalidDeviceInfo
25+
case nfcNotSupported
2526

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

214217
var nfcContinuation: CheckedContinuation<OATHSession, Error>?
215218
func nfcSession() async throws -> OATHSession {
219+
guard YubiKitDeviceCapabilities.supportsISO7816NFCTags else { throw OATHSessionError.nfcNotSupported }
216220
return try await withTaskCancellationHandler {
217221
return try await withCheckedThrowingContinuation { continuation in
218222
self.nfcContinuation = continuation

Authenticator/UI/MainView.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,12 @@ struct MainView: View {
248248
showAccountDetails = nil
249249
}
250250
}
251+
.onChange(of: model.isKeyPluggedIn) { isKeyPluggedIn in
252+
// If the user removes the YubiKey while adding a new account we dismiss the add account modal.
253+
if showAddAccount && !isKeyPluggedIn {
254+
showAddAccount = false
255+
}
256+
}
251257
.environmentObject(model)
252258
}
253259

Authenticator/UI/mul.lproj/Main.xcstrings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@
578578
"sk" : {
579579
"stringUnit" : {
580580
"state" : "translated",
581-
"value" : "Aktivácia funkcie NFC pri OTP prečítaná"
581+
"value" : "Aktivovať NFC pri načítaní tagu OTP"
582582
}
583583
}
584584
}

0 commit comments

Comments
 (0)