Skip to content

Commit 0fe0a98

Browse files
committed
Fix Swift compiler warnings
- ConnectButton: activate the orphaned lessThanOrEqualTo bottom constraint so its return value is not ignored. - AuthenticationError: add .notInteractive, .matchedExcludedCredential, .credentialImport, .credentialExport to mirror the new ASAuthorizationError.Code cases Apple added in iOS 15.4 / 18 / 18.2. - SignInWithAppleAuthentication: handle those new codes behind availability checks and map each 1:1 to the corresponding AuthenticationError so callers see the actual Apple-side reason rather than a generic .failed / .unknown bucket.
1 parent 20c0fbc commit 0fe0a98

3 files changed

Lines changed: 38 additions & 1 deletion

File tree

IFTTT SDK/ConnectButton.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,10 @@ public class ConnectButton: UIView {
345345
footerLabel.constrain.edges(to: footerLabelContainer, edges: [.left, .top, .right])
346346

347347
// But allow it to be shorter than its container
348-
footerLabel.bottomAnchor.constraint(lessThanOrEqualTo: footerLabelContainer.bottomAnchor)
348+
footerLabel.bottomAnchor.constraint(lessThanOrEqualTo: footerLabelContainer.bottomAnchor).isActive = true
349349
let breakableBottomConstraint = footerLabel.bottomAnchor.constraint(equalTo: footerLabelContainer.bottomAnchor)
350350
breakableBottomConstraint.priority = .defaultHigh
351+
breakableBottomConstraint.isActive = true
351352

352353
// Ask the label to keep its intrinsic height
353354
footerLabel.setContentHuggingPriority(.required, for: .vertical)

IFTTT SDK/SignInWithAppleAuthentication.swift

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,27 @@ final class AppleSignInWebService: ServiceAuthentication {
4141
@available(iOS 13.0, *)
4242
func authorizationController(controller: ASAuthorizationController, didCompleteWithError error: Error) {
4343
let authorizationError = ASAuthorizationError(_nsError: error as NSError)
44+
// Cases added after the SDK's iOS 14.2 deployment target.
45+
// Each is referenced behind an availability check and mapped
46+
// to the matching AuthenticationError case so callers can
47+
// distinguish it from the generic .failed / .unknown bucket.
48+
if #available(iOS 15.4, *), authorizationError.code == .notInteractive {
49+
completion(.failure(.notInteractive))
50+
return
51+
}
52+
if #available(iOS 18.0, *), authorizationError.code == .matchedExcludedCredential {
53+
completion(.failure(.matchedExcludedCredential))
54+
return
55+
}
56+
if #available(iOS 18.2, *), authorizationError.code == .credentialImport {
57+
completion(.failure(.credentialImport))
58+
return
59+
}
60+
if #available(iOS 18.2, *), authorizationError.code == .credentialExport {
61+
completion(.failure(.credentialExport))
62+
return
63+
}
64+
4465
switch authorizationError.code {
4566
case .canceled:
4667
completion(.failure(.userCanceled))
@@ -50,6 +71,8 @@ final class AppleSignInWebService: ServiceAuthentication {
5071
completion(.failure(.invalidResponse))
5172
case .notHandled:
5273
completion(.failure(.notHandled))
74+
case .presentationContextInvalid:
75+
completion(.failure(.presentationContextInvalid))
5376
case .unknown:
5477
completion(.failure(.unknown))
5578
@unknown default:

IFTTT SDK/WebServiceAuthentication.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,26 @@ import AuthenticationServices
1414
/// - invalidResponse: The response returned by the web service was invalid.
1515
/// - notHandled: The error wasn't handled by the web service.
1616
/// - presentationContextInvalid: The presentation content provided was invalid.
17+
/// - notInteractive: The authorization request was performed in a
18+
/// non-interactive context. Mirrors `ASAuthorizationError.Code.notInteractive`
19+
/// (iOS 15.4+).
20+
/// - matchedExcludedCredential: A matched credential was excluded from use.
21+
/// Mirrors `ASAuthorizationError.Code.matchedExcludedCredential` (iOS 18+).
22+
/// - credentialImport: An error occurred importing a credential. Mirrors
23+
/// `ASAuthorizationError.Code.credentialImport` (iOS 18.2+).
24+
/// - credentialExport: An error occurred exporting a credential. Mirrors
25+
/// `ASAuthorizationError.Code.credentialExport` (iOS 18.2+).
1726
/// - unknown: Some unknown error ocurred when authenticating with the web service.
1827
enum AuthenticationError: Error {
1928
case userCanceled
2029
case failed
2130
case invalidResponse
2231
case notHandled
2332
case presentationContextInvalid
33+
case notInteractive
34+
case matchedExcludedCredential
35+
case credentialImport
36+
case credentialExport
2437
case unknown
2538
}
2639

0 commit comments

Comments
 (0)