From 49777a2cafb15d0d81fe538c82d5cc0c003ee30b Mon Sep 17 00:00:00 2001 From: Jude Selase Kwashie <64037520+SelaseKay@users.noreply.github.com> Date: Wed, 19 Aug 2026 15:47:49 +0000 Subject: [PATCH 1/5] refactor(auth,apple): migrate iOS/macOS plugin implementation to Swift --- .../firebase_auth/ios/firebase_auth.podspec | 6 +- .../ios/firebase_auth/Package.swift | 2 - .../Sources/firebase_auth/AuthConstants.swift | 24 + .../Sources/firebase_auth/AuthErrors.swift | 87 + .../FLTAuthStateChannelStreamHandler.m | 56 - .../FLTAuthStateChannelStreamHandler.swift | 48 + .../FLTFirebaseAuthPlugin+MultiFactor.swift | 249 ++ .../FLTFirebaseAuthPlugin+User.swift | 355 ++ .../firebase_auth/FLTFirebaseAuthPlugin.m | 2427 ------------- .../firebase_auth/FLTFirebaseAuthPlugin.swift | 1183 +++++++ .../FLTIdTokenChannelStreamHandler.m | 54 - .../FLTIdTokenChannelStreamHandler.swift | 48 + .../FLTPhoneNumberVerificationStreamHandler.m | 98 - ...PhoneNumberVerificationStreamHandler.swift | 86 + .../FirebaseAuthMessages.g.swift | 2278 +++++++++++++ .../Sources/firebase_auth/PigeonParser.m | 171 - .../Sources/firebase_auth/PigeonParser.swift | 142 + .../firebase_auth/firebase_auth_messages.g.m | 3005 ----------------- .../FLTAuthStateChannelStreamHandler.h | 26 - .../Private/FLTIdTokenChannelStreamHandler.h | 27 - .../FLTPhoneNumberVerificationStreamHandler.h | 36 - .../include/Private/PigeonParser.h | 33 - .../include/Public/CustomPigeonHeader.h | 16 - .../include/Public/FLTFirebaseAuthPlugin.h | 45 - .../include/Public/firebase_auth_messages.g.h | 571 ---- .../firebase_auth/macos/firebase_auth.podspec | 5 +- .../macos/firebase_auth/Package.swift | 2 - .../Sources/firebase_auth/AuthConstants.swift | 1 + .../Sources/firebase_auth/AuthErrors.swift | 1 + .../FLTAuthStateChannelStreamHandler.m | 1 - .../FLTAuthStateChannelStreamHandler.swift | 1 + .../FLTFirebaseAuthPlugin+MultiFactor.swift | 1 + .../FLTFirebaseAuthPlugin+User.swift | 1 + .../firebase_auth/FLTFirebaseAuthPlugin.m | 1 - .../firebase_auth/FLTFirebaseAuthPlugin.swift | 1 + .../FLTIdTokenChannelStreamHandler.m | 1 - .../FLTIdTokenChannelStreamHandler.swift | 1 + .../FLTPhoneNumberVerificationStreamHandler.m | 1 - ...PhoneNumberVerificationStreamHandler.swift | 1 + .../FirebaseAuthMessages.g.swift | 1 + .../Sources/firebase_auth/PigeonParser.m | 1 - .../Sources/firebase_auth/PigeonParser.swift | 1 + .../Sources/firebase_auth/Resource/.gitkeep | 0 .../Sources/firebase_auth/Resources/.gitkeep | 1 + .../firebase_auth/firebase_auth_messages.g.m | 1 - .../FLTAuthStateChannelStreamHandler.h | 1 - .../Private/FLTIdTokenChannelStreamHandler.h | 1 - .../FLTPhoneNumberVerificationStreamHandler.h | 1 - .../include/Private/PigeonParser.h | 1 - .../include/Public/CustomPigeonHeader.h | 1 - .../include/Public/FLTFirebaseAuthPlugin.h | 1 - .../include/Public/firebase_auth_messages.g.h | 1 - .../pigeons/messages.dart | 6 +- 53 files changed, 4518 insertions(+), 6592 deletions(-) create mode 100644 packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/AuthConstants.swift create mode 100644 packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/AuthErrors.swift delete mode 100644 packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTAuthStateChannelStreamHandler.m create mode 100644 packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTAuthStateChannelStreamHandler.swift create mode 100644 packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+MultiFactor.swift create mode 100644 packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+User.swift delete mode 100644 packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.m create mode 100644 packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.swift delete mode 100644 packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTIdTokenChannelStreamHandler.m create mode 100644 packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTIdTokenChannelStreamHandler.swift delete mode 100644 packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTPhoneNumberVerificationStreamHandler.m create mode 100644 packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTPhoneNumberVerificationStreamHandler.swift create mode 100644 packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FirebaseAuthMessages.g.swift delete mode 100644 packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/PigeonParser.m create mode 100644 packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/PigeonParser.swift delete mode 100644 packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/firebase_auth_messages.g.m delete mode 100644 packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Private/FLTAuthStateChannelStreamHandler.h delete mode 100644 packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Private/FLTIdTokenChannelStreamHandler.h delete mode 100644 packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Private/FLTPhoneNumberVerificationStreamHandler.h delete mode 100644 packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Private/PigeonParser.h delete mode 100644 packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Public/CustomPigeonHeader.h delete mode 100644 packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Public/FLTFirebaseAuthPlugin.h delete mode 100644 packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Public/firebase_auth_messages.g.h create mode 120000 packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/AuthConstants.swift create mode 120000 packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/AuthErrors.swift delete mode 120000 packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTAuthStateChannelStreamHandler.m create mode 120000 packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTAuthStateChannelStreamHandler.swift create mode 120000 packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+MultiFactor.swift create mode 120000 packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+User.swift delete mode 120000 packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.m create mode 120000 packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.swift delete mode 120000 packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTIdTokenChannelStreamHandler.m create mode 120000 packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTIdTokenChannelStreamHandler.swift delete mode 120000 packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTPhoneNumberVerificationStreamHandler.m create mode 120000 packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTPhoneNumberVerificationStreamHandler.swift create mode 120000 packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FirebaseAuthMessages.g.swift delete mode 120000 packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/PigeonParser.m create mode 120000 packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/PigeonParser.swift delete mode 100644 packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/Resource/.gitkeep create mode 120000 packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/Resources/.gitkeep delete mode 120000 packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/firebase_auth_messages.g.m delete mode 120000 packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Private/FLTAuthStateChannelStreamHandler.h delete mode 120000 packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Private/FLTIdTokenChannelStreamHandler.h delete mode 120000 packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Private/FLTPhoneNumberVerificationStreamHandler.h delete mode 120000 packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Private/PigeonParser.h delete mode 120000 packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Public/CustomPigeonHeader.h delete mode 120000 packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Public/FLTFirebaseAuthPlugin.h delete mode 120000 packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Public/firebase_auth_messages.g.h diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth.podspec b/packages/firebase_auth/firebase_auth/ios/firebase_auth.podspec index eba26315bbc4..f3115e13753a 100755 --- a/packages/firebase_auth/firebase_auth/ios/firebase_auth.podspec +++ b/packages/firebase_auth/firebase_auth/ios/firebase_auth.podspec @@ -25,9 +25,9 @@ Pod::Spec.new do |s| s.authors = 'The Chromium Authors' s.source = { :path => '.' } - s.source_files = 'firebase_auth/Sources/firebase_auth/**/*.{h,m}' - s.public_header_files = 'firebase_auth/Sources/firebase_auth/include/Public/**/*.h' - s.private_header_files = 'firebase_auth/Sources/firebase_auth/include/Private/**/*.h' + s.source_files = 'firebase_auth/Sources/firebase_auth/**/*.swift' + + s.swift_version = '5.0' s.ios.deployment_target = '15.0' s.dependency 'Flutter' diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Package.swift b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Package.swift index 7bafe8d68e39..0a812cbfd3fe 100644 --- a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Package.swift +++ b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Package.swift @@ -35,8 +35,6 @@ let package = Package( .process("Resources") ], cSettings: [ - .headerSearchPath("include/Private"), - .headerSearchPath("include/Public"), .define("LIBRARY_VERSION", to: "\"\(libraryVersion)\""), .define("LIBRARY_NAME", to: "\"flutter-fire-auth\""), ] diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/AuthConstants.swift b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/AuthConstants.swift new file mode 100644 index 000000000000..404cc6898ed4 --- /dev/null +++ b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/AuthConstants.swift @@ -0,0 +1,24 @@ +// Copyright 2025 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let kFLTFirebaseAuthChannelName = "plugins.flutter.io/firebase_auth" +let kFirebaseAuthLibraryName = "flutter-fire-auth" +let kFirebaseAuthLibraryVersion = "6.5.7" + +let kSignInMethodPassword = "password" +let kSignInMethodEmailLink = "emailLink" +let kSignInMethodFacebook = "facebook.com" +let kSignInMethodGoogle = "google.com" +let kSignInMethodGameCenter = "gc.apple.com" +let kSignInMethodTwitter = "twitter.com" +let kSignInMethodGithub = "github.com" +let kSignInMethodApple = "apple.com" +let kSignInMethodPhone = "phone" +let kSignInMethodOAuth = "oauth" + +let kErrCodeNoCurrentUser = "no-current-user" +let kErrMsgNoCurrentUser = "No user currently signed in." +let kErrCodeInvalidCredential = "invalid-credential" +let kErrMsgInvalidCredential = + "The supplied auth credential is malformed, has expired or is not currently supported." diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/AuthErrors.swift b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/AuthErrors.swift new file mode 100644 index 000000000000..af8f69dfdfb0 --- /dev/null +++ b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/AuthErrors.swift @@ -0,0 +1,87 @@ +// Copyright 2025 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import FirebaseAuth +import Foundation + +#if os(iOS) + import Flutter +#elseif os(macOS) + import FlutterMacOS +#endif + +enum AuthErrors { + static func convertToFlutterError(_ error: Error?) -> FlutterError { + var code = "unknown" + var message = "An unknown error has occurred." + + guard let error = error as NSError? else { + return FlutterError(code: code, message: message, details: [:]) + } + + if let firebaseErrorCode = error.userInfo[AuthErrorUserInfoNameKey] as? String { + code = firebaseErrorCode.replacingOccurrences(of: "ERROR_", with: "") + .replacingOccurrences(of: "_", with: "-") + .lowercased() + } + + if let localized = error.userInfo[NSLocalizedDescriptionKey] as? String { + message = localized + } + + var additionalData: [String: Any] = [:] + if let email = error.userInfo[AuthErrorUserInfoEmailKey] as? String { + additionalData["email"] = email + } + + let token = FLTFirebaseAuthPlugin.storeAuthCredentialIfPresent(error) + if let authCredential = error.userInfo[AuthErrorUserInfoUpdatedCredentialKey] as? AuthCredential + { + additionalData["authCredential"] = PigeonParser.getPigeonAuthCredential( + authCredential, token: token) + } + + if message == "The password must be 6 characters long or more." { + message = "Password should be at least 6 characters" + } + + return FlutterError(code: code, message: message, details: additionalData) + } + + static func convertAppleAuthorizationErrorToFlutterError(_ error: Error) -> FlutterError { + let nsError = error as NSError + var message = "An unknown error has occurred." + if !nsError.localizedDescription.isEmpty { + message = nsError.localizedDescription + } + + var additionalData: [String: Any] = [:] + let nativeErrorDomain = nsError.domain.isEmpty ? "unknown" : nsError.domain + additionalData["nativeErrorDomain"] = nativeErrorDomain + additionalData["nativeErrorCode"] = nsError.code + + var underlyingMessage = "" + if let underlyingError = nsError.userInfo[NSUnderlyingErrorKey] as? NSError { + let underlyingErrorDomain = + underlyingError.domain.isEmpty ? "unknown" : underlyingError.domain + additionalData["underlyingNativeErrorDomain"] = underlyingErrorDomain + additionalData["underlyingNativeErrorCode"] = underlyingError.code + underlyingMessage = + ", Underlying Domain=\(underlyingErrorDomain) Code=\(underlyingError.code)" + } + + let detailMessage = + "\(message) (Domain=\(nativeErrorDomain) Code=\(nsError.code)\(underlyingMessage))" + return FlutterError(code: "unknown", message: detailMessage, details: additionalData) + } + + static func noCurrentUser() -> FlutterError { + FlutterError(code: kErrCodeNoCurrentUser, message: kErrMsgNoCurrentUser, details: nil) + } + + static func invalidCredential() -> FlutterError { + FlutterError( + code: kErrCodeInvalidCredential, message: kErrMsgInvalidCredential, details: nil) + } +} diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTAuthStateChannelStreamHandler.m b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTAuthStateChannelStreamHandler.m deleted file mode 100644 index 5ef9adaf9dd1..000000000000 --- a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTAuthStateChannelStreamHandler.m +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -@import FirebaseAuth; -#import "include/Private/FLTAuthStateChannelStreamHandler.h" -#import -#import "include/Private/PigeonParser.h" -#import "include/Public/FLTFirebaseAuthPlugin.h" - -@implementation FLTAuthStateChannelStreamHandler { - FIRAuth *_auth; - FIRAuthStateDidChangeListenerHandle _listener; -} - -- (instancetype)initWithAuth:(FIRAuth *)auth { - self = [super init]; - if (self) { - _auth = auth; - } - return self; -} - -- (FlutterError *)onListenWithArguments:(id)arguments eventSink:(FlutterEventSink)events { - bool __block initialAuthState = YES; - - _listener = [_auth addAuthStateDidChangeListener:^(FIRAuth *_Nonnull auth, - FIRUser *_Nullable user) { - if (initialAuthState) { - initialAuthState = NO; - return; - } - - if (user) { - events(@{ - @"user" : [PigeonParser getManualList:[PigeonParser getPigeonDetails:[auth currentUser]]] - }); - } else { - events(@{ - @"user" : [NSNull null], - }); - } - }]; - - return nil; -} - -- (FlutterError *)onCancelWithArguments:(id)arguments { - if (_listener) { - [_auth removeAuthStateDidChangeListener:_listener]; - } - _listener = nil; - - return nil; -} - -@end diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTAuthStateChannelStreamHandler.swift b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTAuthStateChannelStreamHandler.swift new file mode 100644 index 000000000000..040e9551dbb1 --- /dev/null +++ b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTAuthStateChannelStreamHandler.swift @@ -0,0 +1,48 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import FirebaseAuth +import Foundation + +#if os(iOS) + import Flutter +#elseif os(macOS) + import FlutterMacOS +#endif + +final class FLTAuthStateChannelStreamHandler: NSObject, FlutterStreamHandler { + private let auth: Auth + private var handle: AuthStateDidChangeListenerHandle? + + init(auth: Auth) { + self.auth = auth + } + + func onListen(withArguments arguments: Any?, eventSink events: @escaping FlutterEventSink) + -> FlutterError? + { + var initialAuthState = true + handle = auth.addStateDidChangeListener { auth, user in + if initialAuthState { + initialAuthState = false + return + } + + if user != nil, let currentUser = auth.currentUser { + events(["user": PigeonParser.getManualList(PigeonParser.getPigeonDetails(currentUser))]) + } else { + events(["user": NSNull()]) + } + } + return nil + } + + func onCancel(withArguments arguments: Any?) -> FlutterError? { + if let handle { + auth.removeStateDidChangeListener(handle) + } + handle = nil + return nil + } +} diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+MultiFactor.swift b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+MultiFactor.swift new file mode 100644 index 000000000000..ca780f2dda3f --- /dev/null +++ b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+MultiFactor.swift @@ -0,0 +1,249 @@ +// Copyright 2025 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import FirebaseAuth +import Foundation + +#if os(iOS) + import Flutter +#elseif os(macOS) + import FlutterMacOS +#endif + +extension FLTFirebaseAuthPlugin: MultiFactorUserHostApi, MultiFactoResolverHostApi, + MultiFactorTotpHostApi, MultiFactorTotpSecretHostApi +{ + func enrollPhone( + app: AuthPigeonFirebaseApp, assertion: InternalPhoneMultiFactorAssertion, + displayName: String?, completion: @escaping (Result) -> Void + ) { + #if os(macOS) + completion( + .failure( + FlutterError( + code: "unsupported-platform", + message: "Phone authentication is not supported on macOS", details: nil))) + #else + guard let multiFactor = getAppMultiFactorFromPigeon(app) else { + completion(.failure(AuthErrors.noCurrentUser())) + return + } + let credential = PhoneAuthProvider.provider(auth: getFIRAuthFromPigeon(app)).credential( + withVerificationID: assertion.verificationId, verificationCode: assertion.verificationCode) + let multiFactorAssertion = PhoneMultiFactorGenerator.assertion(with: credential) + multiFactor.enroll(with: multiFactorAssertion, displayName: displayName) { error in + if let error { + completion( + .failure( + FlutterError( + code: "enroll-failed", message: error.localizedDescription, details: nil))) + } else { + completion(.success(())) + } + } + #endif + } + + func getEnrolledFactors( + app: AuthPigeonFirebaseApp, + completion: @escaping (Result<[InternalMultiFactorInfo], Error>) -> Void + ) { + guard let multiFactor = getAppMultiFactorFromPigeon(app) else { + completion(.failure(AuthErrors.noCurrentUser())) + return + } + let results: [InternalMultiFactorInfo] = multiFactor.enrolledFactors.map { info in + var phoneNumber: String? + if let phoneInfo = info as? PhoneMultiFactorInfo { + phoneNumber = phoneInfo.phoneNumber + } + return InternalMultiFactorInfo( + displayName: info.displayName, + enrollmentTimestamp: info.enrollmentDate.timeIntervalSince1970, + factorId: info.factorID, + uid: info.uid, + phoneNumber: phoneNumber) + } + completion(.success(results)) + } + + func getSession( + app: AuthPigeonFirebaseApp, + completion: @escaping (Result) -> Void + ) { + guard let multiFactor = getAppMultiFactorFromPigeon(app) else { + completion(.failure(AuthErrors.noCurrentUser())) + return + } + multiFactor.getSession { session, _ in + let id = UUID().uuidString + self.multiFactorSessionMap[id] = session + completion(.success(InternalMultiFactorSession(id: id))) + } + } + + func unenroll( + app: AuthPigeonFirebaseApp, factorUid: String, completion: @escaping (Result) -> Void + ) { + guard let multiFactor = getAppMultiFactorFromPigeon(app) else { + completion(.failure(AuthErrors.noCurrentUser())) + return + } + multiFactor.unenroll(withFactorUID: factorUid) { error in + if let error { + completion( + .failure( + FlutterError( + code: "unenroll-failed", message: error.localizedDescription, details: nil))) + } else { + completion(.success(())) + } + } + } + + func enrollTotp( + app: AuthPigeonFirebaseApp, assertionId: String, displayName: String?, + completion: @escaping (Result) -> Void + ) { + guard let multiFactor = getAppMultiFactorFromPigeon(app) else { + completion(.failure(AuthErrors.noCurrentUser())) + return + } + guard let assertion = multiFactorAssertionMap[assertionId] else { + completion( + .failure( + FlutterError(code: "enroll-failed", message: "Assertion not found", details: nil))) + return + } + multiFactor.enroll(with: assertion, displayName: displayName) { error in + if let error { + completion( + .failure( + FlutterError( + code: "enroll-failed", message: error.localizedDescription, details: nil))) + } else { + completion(.success(())) + } + } + } + + func resolveSignIn( + resolverId: String, assertion: InternalPhoneMultiFactorAssertion?, totpAssertionId: String?, + completion: @escaping (Result) -> Void + ) { + guard let resolver = multiFactorResolverMap[resolverId] else { + completion( + .failure( + FlutterError( + code: "resolve-signin-failed", message: "Resolver not found", details: nil))) + return + } + + var multiFactorAssertion: MultiFactorAssertion? + if let assertion { + #if os(iOS) + let credential = PhoneAuthProvider.provider().credential( + withVerificationID: assertion.verificationId, + verificationCode: assertion.verificationCode) + multiFactorAssertion = PhoneMultiFactorGenerator.assertion(with: credential) + #endif + } else if let totpAssertionId { + multiFactorAssertion = multiFactorAssertionMap[totpAssertionId] + } else { + completion( + .failure( + FlutterError( + code: "resolve-signin-failed", + message: "Neither assertion nor totpAssertionId were provided", details: nil))) + return + } + + guard let multiFactorAssertion else { + completion( + .failure( + FlutterError( + code: "resolve-signin-failed", message: "Assertion could not be created", details: nil) + )) + return + } + + resolver.resolveSignIn(with: multiFactorAssertion) { authResult, error in + if let error { + completion( + .failure( + FlutterError( + code: "resolve-signin-failed", message: error.localizedDescription, details: nil))) + } else if let authResult { + completion( + .success( + PigeonParser.getPigeonUserCredentialFromAuthResult( + authResult, authorizationCode: nil))) + } + } + } + + func generateSecret( + sessionId: String, completion: @escaping (Result) -> Void + ) { + guard let multiFactorSession = multiFactorSessionMap[sessionId] else { + completion( + .failure( + FlutterError( + code: "generate-secret-failed", message: "Session not found", details: nil))) + return + } + TOTPMultiFactorGenerator.generateSecret(with: multiFactorSession) { secret, error in + if let error { + completion( + .failure( + FlutterError( + code: "generate-secret-failed", message: error.localizedDescription, details: nil))) + } else if let secret { + self.multiFactorTotpSecretMap[secret.sharedSecretKey()] = secret + completion(.success(PigeonParser.getPigeonTotpSecret(secret))) + } + } + } + + func getAssertionForEnrollment( + secretKey: String, oneTimePassword: String, + completion: @escaping (Result) -> Void + ) { + let totpSecret = multiFactorTotpSecretMap[secretKey] + let assertion = TOTPMultiFactorGenerator.assertionForEnrollment( + with: totpSecret!, oneTimePassword: oneTimePassword) + let id = UUID().uuidString + multiFactorAssertionMap[id] = assertion + completion(.success(id)) + } + + func getAssertionForSignIn( + enrollmentId: String, oneTimePassword: String, + completion: @escaping (Result) -> Void + ) { + let assertion = TOTPMultiFactorGenerator.assertionForSignIn( + withEnrollmentID: enrollmentId, oneTimePassword: oneTimePassword) + let id = UUID().uuidString + multiFactorAssertionMap[id] = assertion + completion(.success(id)) + } + + func generateQrCodeUrl( + secretKey: String, accountName: String?, issuer: String?, + completion: @escaping (Result) -> Void + ) { + let totpSecret = multiFactorTotpSecretMap[secretKey] + completion( + .success( + totpSecret?.generateQRCodeURL( + withAccountName: accountName ?? "", issuer: issuer ?? "") ?? "")) + } + + func openInOtpApp( + secretKey: String, qrCodeUrl: String, completion: @escaping (Result) -> Void + ) { + multiFactorTotpSecretMap[secretKey]?.openInOTPApp(withQRCodeURL: qrCodeUrl) + completion(.success(())) + } +} diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+User.swift b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+User.swift new file mode 100644 index 000000000000..54f63da4fbc1 --- /dev/null +++ b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+User.swift @@ -0,0 +1,355 @@ +// Copyright 2025 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import FirebaseAuth +import Foundation + +#if os(iOS) + import Flutter +#elseif os(macOS) + import FlutterMacOS +#endif + +extension FLTFirebaseAuthPlugin: FirebaseAuthUserHostApi { + func delete(app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void) { + guard let currentUser = getFIRAuthFromPigeon(app).currentUser else { + completion(.failure(AuthErrors.noCurrentUser())) + return + } + currentUser.delete { error in + self.completeVoid(error, completion: completion) + } + } + + func getIdToken( + app: AuthPigeonFirebaseApp, forceRefresh: Bool, + completion: @escaping (Result) -> Void + ) { + guard let currentUser = getFIRAuthFromPigeon(app).currentUser else { + completion(.failure(AuthErrors.noCurrentUser())) + return + } + currentUser.getIDTokenResult(forcingRefresh: forceRefresh) { tokenResult, error in + if let error { + completion(.failure(AuthErrors.convertToFlutterError(error))) + } else if let tokenResult { + completion(.success(PigeonParser.parseIdTokenResult(tokenResult))) + } + } + } + + func linkWithCredential( + app: AuthPigeonFirebaseApp, input: [String?: Any?], + completion: @escaping (Result) -> Void + ) { + guard let currentUser = getFIRAuthFromPigeon(app).currentUser else { + completion(.failure(AuthErrors.noCurrentUser())) + return + } + getFIRAuthCredentialFromArguments(input, app: app) { credential, error in + if credential == nil { + completion(.failure(AuthErrors.invalidCredential())) + return + } + if let error { + completion(.failure(AuthErrors.convertToFlutterError(error))) + } + guard let credential else { return } + currentUser.link(with: credential) { authResult, error in + self.completeUserCredential( + app: app, authResult: authResult, error: error, completion: completion) + } + } + } + + func linkWithProvider( + app: AuthPigeonFirebaseApp, signInProvider: InternalSignInProvider, + completion: @escaping (Result) -> Void + ) { + let auth = getFIRAuthFromPigeon(app) + if signInProvider.providerId == kSignInMethodGameCenter { + completion( + .failure( + FlutterError( + code: "provider-link-failure", + message: "Game Center provider requires linking with 'linkWithCredential()' API.", + details: [:]))) + return + } + guard let currentUser = auth.currentUser else { + completion(.failure(AuthErrors.noCurrentUser())) + return + } + if signInProvider.providerId == kSignInMethodApple { + linkWithAppleUser = currentUser + launchAppleSignInRequest(app: app, signInProvider: signInProvider, completion: completion) + return + } + #if os(macOS) + print("linkWithProvider is not supported on the MacOS platform.") + completion( + .failure( + FlutterError( + code: "unsupported-platform", message: "linkWithProvider is not supported on macOS", + details: nil))) + #else + authProvider = OAuthProvider(providerID: signInProvider.providerId) + if let scopes = signInProvider.scopes { + authProvider?.scopes = scopes.compactMap { $0 } + } + if let customParameters = signInProvider.customParameters { + var converted: [String: String] = [:] + for (key, value) in customParameters { + if let key, let value { converted[key] = value } + } + authProvider?.customParameters = converted + } + currentUser.link(with: authProvider!, uiDelegate: nil) { authResult, error in + self.handleAppleAuthResult( + app: app, auth: auth, credentials: authResult?.credential, error: error, + completion: completion) + } + #endif + } + + func reauthenticateWithCredential( + app: AuthPigeonFirebaseApp, input: [String?: Any?], + completion: @escaping (Result) -> Void + ) { + guard let currentUser = getFIRAuthFromPigeon(app).currentUser else { + completion(.failure(AuthErrors.noCurrentUser())) + return + } + getFIRAuthCredentialFromArguments(input, app: app) { credential, error in + if credential == nil { + completion(.failure(AuthErrors.invalidCredential())) + return + } + if let error { + completion(.failure(AuthErrors.convertToFlutterError(error))) + } + guard let credential else { return } + currentUser.reauthenticate(with: credential) { authResult, error in + self.completeUserCredential( + app: app, authResult: authResult, error: error, completion: completion) + } + } + } + + func reauthenticateWithProvider( + app: AuthPigeonFirebaseApp, signInProvider: InternalSignInProvider, + completion: @escaping (Result) -> Void + ) { + let auth = getFIRAuthFromPigeon(app) + guard let currentUser = auth.currentUser else { + completion(.failure(AuthErrors.noCurrentUser())) + return + } + if signInProvider.providerId == kSignInMethodApple { + isReauthenticatingWithApple = true + launchAppleSignInRequest(app: app, signInProvider: signInProvider, completion: completion) + return + } + #if os(macOS) + print("reauthenticateWithProvider is not supported on the MacOS platform.") + completion( + .failure( + FlutterError( + code: "unsupported-platform", + message: "reauthenticateWithProvider is not supported on macOS", details: nil))) + #else + authProvider = OAuthProvider(providerID: signInProvider.providerId) + if let scopes = signInProvider.scopes { + authProvider?.scopes = scopes.compactMap { $0 } + } + if let customParameters = signInProvider.customParameters { + var converted: [String: String] = [:] + for (key, value) in customParameters { + if let key, let value { converted[key] = value } + } + authProvider?.customParameters = converted + } + currentUser.reauthenticate(with: authProvider!, uiDelegate: nil) { authResult, error in + self.handleAppleAuthResult( + app: app, auth: auth, credentials: authResult?.credential, error: error, + completion: completion) + } + #endif + } + + func reload( + app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void + ) { + guard let currentUser = getFIRAuthFromPigeon(app).currentUser else { + completion(.failure(AuthErrors.noCurrentUser())) + return + } + currentUser.reload { error in + if let error { + completion(.failure(AuthErrors.convertToFlutterError(error))) + } else { + completion(.success(PigeonParser.getPigeonDetails(currentUser))) + } + } + } + + func sendEmailVerification( + app: AuthPigeonFirebaseApp, actionCodeSettings: InternalActionCodeSettings?, + completion: @escaping (Result) -> Void + ) { + guard let currentUser = getFIRAuthFromPigeon(app).currentUser else { + completion(.failure(AuthErrors.noCurrentUser())) + return + } + let settings = PigeonParser.parseActionCodeSettings(actionCodeSettings) + if let settings { + currentUser.sendEmailVerification(with: settings) { error in + self.completeVoid(error, completion: completion) + } + } else { + currentUser.sendEmailVerification { error in + self.completeVoid(error, completion: completion) + } + } + } + + func unlink( + app: AuthPigeonFirebaseApp, providerId: String, + completion: @escaping (Result) -> Void + ) { + guard let currentUser = getFIRAuthFromPigeon(app).currentUser else { + completion(.failure(AuthErrors.noCurrentUser())) + return + } + currentUser.unlink(fromProvider: providerId) { user, error in + if let error { + completion(.failure(AuthErrors.convertToFlutterError(error))) + } else if let user { + completion(.success(PigeonParser.getPigeonUserCredentialFromFIRUser(user))) + } + } + } + + func updateEmail( + app: AuthPigeonFirebaseApp, newEmail: String, + completion: @escaping (Result) -> Void + ) { + guard let currentUser = getFIRAuthFromPigeon(app).currentUser else { + completion(.failure(AuthErrors.noCurrentUser())) + return + } + currentUser.updateEmail(to: newEmail) { error in + self.reloadAfterUpdate(user: currentUser, error: error, completion: completion) + } + } + + func updatePassword( + app: AuthPigeonFirebaseApp, newPassword: String, + completion: @escaping (Result) -> Void + ) { + guard let currentUser = getFIRAuthFromPigeon(app).currentUser else { + completion(.failure(AuthErrors.noCurrentUser())) + return + } + currentUser.updatePassword(to: newPassword) { error in + self.reloadAfterUpdate(user: currentUser, error: error, completion: completion) + } + } + + func updatePhoneNumber( + app: AuthPigeonFirebaseApp, input: [String?: Any?], + completion: @escaping (Result) -> Void + ) { + #if os(iOS) + guard let currentUser = getFIRAuthFromPigeon(app).currentUser else { + completion(.failure(AuthErrors.noCurrentUser())) + return + } + getFIRAuthCredentialFromArguments(input, app: app) { credential, error in + if credential == nil { + completion(.failure(AuthErrors.invalidCredential())) + return + } + if let error { + completion(.failure(AuthErrors.convertToFlutterError(error))) + } + guard let phoneCredential = credential as? PhoneAuthCredential else { return } + currentUser.updatePhoneNumber(phoneCredential) { error in + self.reloadAfterUpdate(user: currentUser, error: error, completion: completion) + } + } + #else + print( + "Updating a users phone number via Firebase Authentication is only supported on the iOS platform." + ) + completion( + .failure( + FlutterError( + code: "unsupported-platform", + message: "Updating a user's phone number is only supported on iOS", details: nil))) + #endif + } + + func updateProfile( + app: AuthPigeonFirebaseApp, profile: InternalUserProfile, + completion: @escaping (Result) -> Void + ) { + guard let currentUser = getFIRAuthFromPigeon(app).currentUser else { + completion(.failure(AuthErrors.noCurrentUser())) + return + } + let changeRequest = currentUser.createProfileChangeRequest() + if profile.displayNameChanged { + changeRequest.displayName = profile.displayName + } + if profile.photoUrlChanged { + if let photoUrl = profile.photoUrl { + changeRequest.photoURL = URL(string: photoUrl) + } else { + changeRequest.photoURL = URL(string: "") + } + } + changeRequest.commitChanges { error in + self.reloadAfterUpdate(user: currentUser, error: error, completion: completion) + } + } + + func verifyBeforeUpdateEmail( + app: AuthPigeonFirebaseApp, newEmail: String, + actionCodeSettings: InternalActionCodeSettings?, + completion: @escaping (Result) -> Void + ) { + guard let currentUser = getFIRAuthFromPigeon(app).currentUser else { + completion(.failure(AuthErrors.noCurrentUser())) + return + } + if let settings = PigeonParser.parseActionCodeSettings(actionCodeSettings) { + currentUser.sendEmailVerification(beforeUpdatingEmail: newEmail, actionCodeSettings: settings) + { error in + self.completeVoid(error, completion: completion) + } + } else { + currentUser.sendEmailVerification(beforeUpdatingEmail: newEmail) { error in + self.completeVoid(error, completion: completion) + } + } + } + + func reloadAfterUpdate( + user: User, error: Error?, + completion: @escaping (Result) -> Void + ) { + if let error { + completion(.failure(AuthErrors.convertToFlutterError(error))) + return + } + user.reload { reloadError in + if let reloadError { + completion(.failure(AuthErrors.convertToFlutterError(reloadError))) + } else { + completion(.success(PigeonParser.getPigeonDetails(user))) + } + } + } +} diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.m b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.m deleted file mode 100644 index eed42a082d5c..000000000000 --- a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.m +++ /dev/null @@ -1,2427 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -@import FirebaseAuth; -#import -#import -#if __has_include() -#import -#else -#import -#endif - -#import "include/Private/FLTAuthStateChannelStreamHandler.h" -#import "include/Private/FLTIdTokenChannelStreamHandler.h" -#import "include/Private/FLTPhoneNumberVerificationStreamHandler.h" -#import "include/Private/PigeonParser.h" - -#import "include/Public/CustomPigeonHeader.h" -#import "include/Public/FLTFirebaseAuthPlugin.h" -@import CommonCrypto; -#import - -NSString *const kFLTFirebaseAuthChannelName = @"plugins.flutter.io/firebase_auth"; - -// Argument Keys -NSString *const kAppName = @"appName"; - -// Provider type keys. -NSString *const kSignInMethodPassword = @"password"; -NSString *const kSignInMethodEmailLink = @"emailLink"; -NSString *const kSignInMethodFacebook = @"facebook.com"; -NSString *const kSignInMethodGoogle = @"google.com"; -NSString *const kSignInMethodGameCenter = @"gc.apple.com"; -NSString *const kSignInMethodTwitter = @"twitter.com"; -NSString *const kSignInMethodGithub = @"github.com"; -NSString *const kSignInMethodApple = @"apple.com"; -NSString *const kSignInMethodPhone = @"phone"; -NSString *const kSignInMethodOAuth = @"oauth"; - -// Credential argument keys. -NSString *const kArgumentCredential = @"credential"; -NSString *const kArgumentProviderId = @"providerId"; -NSString *const kArgumentProviderScope = @"scopes"; -NSString *const kArgumentProviderCustomParameters = @"customParameters"; -NSString *const kArgumentSignInMethod = @"signInMethod"; -NSString *const kArgumentSecret = @"secret"; -NSString *const kArgumentIdToken = @"idToken"; -NSString *const kArgumentAccessToken = @"accessToken"; -NSString *const kArgumentRawNonce = @"rawNonce"; -NSString *const kArgumentEmail = @"email"; -NSString *const kArgumentCode = @"code"; -NSString *const kArgumentNewEmail = @"newEmail"; -NSString *const kArgumentEmailLink = kSignInMethodEmailLink; -NSString *const kArgumentToken = @"token"; -NSString *const kArgumentVerificationId = @"verificationId"; -NSString *const kArgumentSmsCode = @"smsCode"; -NSString *const kArgumentActionCodeSettings = @"actionCodeSettings"; -NSString *const kArgumentFamilyName = @"familyName"; -NSString *const kArgumentGivenName = @"givenName"; -NSString *const kArgumentMiddleName = @"middleName"; -NSString *const kArgumentNickname = @"nickname"; -NSString *const kArgumentNamePrefix = @"namePrefix"; -NSString *const kArgumentNameSuffix = @"nameSuffix"; - -// MultiFactor -NSString *const kArgumentMultiFactorHints = @"multiFactorHints"; -NSString *const kArgumentMultiFactorSessionId = @"multiFactorSessionId"; -NSString *const kArgumentMultiFactorResolverId = @"multiFactorResolverId"; -NSString *const kArgumentMultiFactorInfo = @"multiFactorInfo"; - -// Manual error codes & messages. -NSString *const kErrCodeNoCurrentUser = @"no-current-user"; -NSString *const kErrMsgNoCurrentUser = @"No user currently signed in."; -NSString *const kErrCodeInvalidCredential = @"invalid-credential"; -NSString *const kErrMsgInvalidCredential = - @"The supplied auth credential is malformed, has expired or is not " - @"currently supported."; -NSString *const kErrCodeUnsupportedPlatform = @"unsupported-platform"; - -#if TARGET_OS_OSX -// The Firebase Apple SDK only builds the OAuth web sign-in flow -// (`FIROAuthProvider getCredentialWithUIDelegate:completion:`) for iOS, so the -// `*WithProvider()` APIs cannot be served on macOS. Sign in with Apple is -// handled separately, before this error is built. -static FlutterError *ProviderFlowUnsupportedOnMacOSError(NSString *methodName, - NSString *providerId) { - return [FlutterError - errorWithCode:kErrCodeUnsupportedPlatform - message:[NSString stringWithFormat:@"%@ is not supported on macOS for the '%@' " - @"provider. The Firebase Apple SDK only implements " - @"the OAuth web sign-in flow on iOS. On macOS, only " - @"the '%@' provider is supported.", - methodName, providerId, kSignInMethodApple] - details:nil]; -} -#endif - -// Used for caching credentials between Method Channel method calls. -static NSMutableDictionary *credentialsMap; - -@interface FLTFirebaseAuthPlugin () -@property(nonatomic, retain) NSObject *messenger; -@property(strong, nonatomic) FIROAuthProvider *authProvider; -// Used to keep the user who wants to link with Apple Sign In -@property(strong, nonatomic) FIRUser *linkWithAppleUser; -@property(strong, nonatomic) FIRAuth *signInWithAppleAuth; -@property BOOL isReauthenticatingWithApple; -@property(strong, nonatomic) NSString *currentNonce; -@property(strong, nonatomic) void (^appleCompletion) - (InternalUserCredential *_Nullable, FlutterError *_Nullable); -@property(strong, nonatomic) AuthPigeonFirebaseApp *appleArguments; -/// YES while an `ASAuthorizationController` Sign in with Apple flow is active. -@property(nonatomic, assign) BOOL appleSignInRequestInFlight; - -@end - -@implementation FLTFirebaseAuthPlugin { - // Map an id to a MultiFactorSession object. - NSMutableDictionary *_multiFactorSessionMap; - - // Map an id to a MultiFactorResolver object. - NSMutableDictionary *_multiFactorResolverMap; - - // Map an id to a MultiFactorResolver object. - NSMutableDictionary *_multiFactorAssertionMap; - - // Map an id to a MultiFactorResolver object. - NSMutableDictionary *_multiFactorTotpSecretMap; - - // Emulator host/port per app, used to build REST URLs for workarounds. - NSMutableDictionary *_emulatorConfigs; - - NSObject *_binaryMessenger; - NSMutableDictionary *_eventChannels; - NSMutableDictionary *> *_streamHandlers; - NSData *_apnsToken; -} - -#pragma mark - FlutterPlugin - -- (instancetype)init:(NSObject *)messenger { - self = [super init]; - if (self) { - [[FLTFirebasePluginRegistry sharedInstance] registerFirebasePlugin:self]; - credentialsMap = [NSMutableDictionary dictionary]; - _binaryMessenger = messenger; - _eventChannels = [NSMutableDictionary dictionary]; - _streamHandlers = [NSMutableDictionary dictionary]; - - _multiFactorSessionMap = [NSMutableDictionary dictionary]; - _multiFactorResolverMap = [NSMutableDictionary dictionary]; - _multiFactorAssertionMap = [NSMutableDictionary dictionary]; - _multiFactorTotpSecretMap = [NSMutableDictionary dictionary]; - _emulatorConfigs = [NSMutableDictionary dictionary]; - } - return self; -} - -+ (void)registerWithRegistrar:(NSObject *)registrar { - FlutterMethodChannel *channel = - [FlutterMethodChannel methodChannelWithName:kFLTFirebaseAuthChannelName - binaryMessenger:[registrar messenger]]; - FLTFirebaseAuthPlugin *instance = [[FLTFirebaseAuthPlugin alloc] init:registrar.messenger]; - - [registrar addMethodCallDelegate:instance channel:channel]; - - [registrar publish:instance]; - [registrar addApplicationDelegate:instance]; -#if !TARGET_OS_OSX - if (@available(iOS 13.0, *)) { - if ([registrar respondsToSelector:@selector(addSceneDelegate:)]) { - [registrar performSelector:@selector(addSceneDelegate:) withObject:instance]; - } - } -#endif - SetUpFirebaseAuthHostApi(registrar.messenger, instance); - SetUpFirebaseAuthUserHostApi(registrar.messenger, instance); - SetUpMultiFactorUserHostApi(registrar.messenger, instance); - SetUpMultiFactoResolverHostApi(registrar.messenger, instance); - SetUpMultiFactorTotpHostApi(registrar.messenger, instance); - SetUpMultiFactorTotpSecretHostApi(registrar.messenger, instance); -} - -+ (FlutterError *)convertToFlutterError:(NSError *)error { - NSString *code = @"unknown"; - NSString *message = @"An unknown error has occurred."; - - if (error == nil) { - return [FlutterError errorWithCode:code message:message details:@{}]; - } - - // code - if ([error userInfo][FIRAuthErrorUserInfoNameKey] != nil) { - // See [FIRAuthErrorCodeString] for list of codes. - // Codes are in the format "ERROR_SOME_NAME", converting below to the format - // required in Dart. ERROR_SOME_NAME -> SOME_NAME - NSString *firebaseErrorCode = [error userInfo][FIRAuthErrorUserInfoNameKey]; - code = [firebaseErrorCode stringByReplacingOccurrencesOfString:@"ERROR_" withString:@""]; - // SOME_NAME -> SOME-NAME - code = [code stringByReplacingOccurrencesOfString:@"_" withString:@"-"]; - // SOME-NAME -> some-name - code = [code lowercaseString]; - } - - // message - if ([error userInfo][NSLocalizedDescriptionKey] != nil) { - message = [error userInfo][NSLocalizedDescriptionKey]; - } - - NSMutableDictionary *additionalData = [NSMutableDictionary dictionary]; - // additionalData.email - if ([error userInfo][FIRAuthErrorUserInfoEmailKey] != nil) { - additionalData[kArgumentEmail] = [error userInfo][FIRAuthErrorUserInfoEmailKey]; - } - // We want to store the credential if present for future sign in if the exception contains a - // credential, we pass a token back to Flutter to allow retrieval of the credential. - NSNumber *token = [FLTFirebaseAuthPlugin storeAuthCredentialIfPresent:error]; - - // additionalData.authCredential - if ([error userInfo][FIRAuthErrorUserInfoUpdatedCredentialKey] != nil) { - FIRAuthCredential *authCredential = [error userInfo][FIRAuthErrorUserInfoUpdatedCredentialKey]; - additionalData[@"authCredential"] = [PigeonParser getPigeonAuthCredential:authCredential - token:token]; - } - - // Manual message overrides to ensure messages/codes matches other platforms. - if ([message isEqual:@"The password must be 6 characters long or more."]) { - message = @"Password should be at least 6 characters"; - } - - return [FlutterError errorWithCode:code message:message details:additionalData]; -} - -+ (FlutterError *)convertAppleAuthorizationErrorToFlutterError:(NSError *)error { - NSString *message = @"An unknown error has occurred."; - if (error.localizedDescription.length > 0) { - message = error.localizedDescription; - } - - NSMutableDictionary *additionalData = [NSMutableDictionary dictionary]; - NSString *nativeErrorDomain = error.domain ?: @"unknown"; - NSNumber *nativeErrorCode = @((long)error.code); - - additionalData[@"nativeErrorDomain"] = nativeErrorDomain; - additionalData[@"nativeErrorCode"] = nativeErrorCode; - - NSError *underlyingError = error.userInfo[NSUnderlyingErrorKey]; - NSString *underlyingMessage = @""; - if (underlyingError != nil) { - NSString *underlyingErrorDomain = underlyingError.domain ?: @"unknown"; - NSNumber *underlyingErrorCode = @((long)underlyingError.code); - - additionalData[@"underlyingNativeErrorDomain"] = underlyingErrorDomain; - additionalData[@"underlyingNativeErrorCode"] = underlyingErrorCode; - - underlyingMessage = - [NSString stringWithFormat:@", Underlying Domain=%@ Code=%ld", underlyingErrorDomain, - (long)underlyingError.code]; - } - - NSString *detailMessage = - [NSString stringWithFormat:@"%@ (Domain=%@ Code=%ld%@)", message, nativeErrorDomain, - (long)error.code, underlyingMessage]; - - return [FlutterError errorWithCode:@"unknown" message:detailMessage details:additionalData]; -} - -+ (id)getNSDictionaryFromAuthCredential:(FIRAuthCredential *)authCredential { - if (authCredential == nil) { - return [NSNull null]; - } - - NSString *accessToken = nil; - if ([authCredential isKindOfClass:[FIROAuthCredential class]]) { - if (((FIROAuthCredential *)authCredential).accessToken != nil) { - accessToken = ((FIROAuthCredential *)authCredential).accessToken; - } else if (((FIROAuthCredential *)authCredential).IDToken != nil) { - // For Sign In With Apple, the token is stored in IDToken - accessToken = ((FIROAuthCredential *)authCredential).IDToken; - } - } - - return @{ - kArgumentProviderId : authCredential.provider, - // Note: "signInMethod" does not exist on iOS SDK, so using provider - // instead. - kArgumentSignInMethod : authCredential.provider, - kArgumentToken : @([authCredential hash]), - kArgumentAccessToken : accessToken ?: [NSNull null], - }; -} - -- (void)cleanupWithCompletion:(void (^)(void))completion { - // Cleanup credentials. - [credentialsMap removeAllObjects]; - - for (FlutterEventChannel *channel in self->_eventChannels.allValues) { - [channel setStreamHandler:nil]; - } - [self->_eventChannels removeAllObjects]; - for (NSObject *handler in self->_streamHandlers.allValues) { - [handler onCancelWithArguments:nil]; - } - [self->_streamHandlers removeAllObjects]; - - if (completion != nil) completion(); -} - -- (void)detachFromEngineForRegistrar:(NSObject *)registrar { - [self cleanupWithCompletion:nil]; -} - -#pragma mark - AppDelegate - -#if TARGET_OS_IPHONE -#if !__has_include() -- (BOOL)application:(UIApplication *)application - didReceiveRemoteNotification:(NSDictionary *)notification - fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler { - if ([[FIRAuth auth] canHandleNotification:notification]) { - completionHandler(UIBackgroundFetchResultNoData); - return YES; - } - return NO; -} -#endif - -- (void)application:(UIApplication *)application - didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { - _apnsToken = deviceToken; -} - -- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options { - return [[FIRAuth auth] canHandleURL:url]; -} - -#pragma mark - SceneDelegate - -- (BOOL)scene:(UIScene *)scene - openURLContexts:(NSSet *)URLContexts API_AVAILABLE(ios(13.0)) { - for (UIOpenURLContext *urlContext in URLContexts) { - if ([[FIRAuth auth] canHandleURL:urlContext.URL]) { - return YES; - } - } - return NO; -} -#endif - -#pragma mark - FLTFirebasePlugin - -- (void)didReinitializeFirebaseCore:(void (^_Nonnull)(void))completion { - [self cleanupWithCompletion:completion]; -} - -- (NSString *_Nonnull)firebaseLibraryName { - return @LIBRARY_NAME; -} - -- (NSString *_Nonnull)firebaseLibraryVersion { - return @LIBRARY_VERSION; -} - -- (NSString *_Nonnull)flutterChannelName { - return kFLTFirebaseAuthChannelName; -} - -- (NSDictionary *_Nonnull)pluginConstantsForFIRApp:(FIRApp *_Nonnull)firebaseApp { - FIRAuth *auth = [FIRAuth authWithApp:firebaseApp]; - return @{ - @"APP_LANGUAGE_CODE" : (id)[auth languageCode] ?: [NSNull null], - @"APP_CURRENT_USER" : [auth currentUser] - ? [PigeonParser getManualList:[PigeonParser getPigeonDetails:[auth currentUser]]] - : [NSNull null], - }; -} - -#pragma mark - Firebase Auth API - -// Adapted from -// https://auth0.com/docs/api-auth/tutorials/nonce#generate-a-cryptographically-random-nonce Used -// for Apple Sign In -- (NSString *)randomNonce:(NSInteger)length { - NSAssert(length > 0, @"Expected nonce to have positive length"); - NSString *characterSet = @"0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-._"; - NSMutableString *result = [NSMutableString string]; - NSInteger remainingLength = length; - - while (remainingLength > 0) { - NSMutableArray *randoms = [NSMutableArray arrayWithCapacity:16]; - for (NSInteger i = 0; i < 16; i++) { - uint8_t random = 0; - int errorCode = SecRandomCopyBytes(kSecRandomDefault, 1, &random); - NSAssert(errorCode == errSecSuccess, @"Unable to generate nonce: OSStatus %i", errorCode); - - [randoms addObject:@(random)]; - } - - for (NSNumber *random in randoms) { - if (remainingLength == 0) { - break; - } - - if (random.unsignedIntValue < characterSet.length) { - unichar character = [characterSet characterAtIndex:random.unsignedIntValue]; - [result appendFormat:@"%C", character]; - remainingLength--; - } - } - } - - return [result copy]; -} - -- (NSString *)stringBySha256HashingString:(NSString *)input { - const char *string = [input UTF8String]; - unsigned char result[CC_SHA256_DIGEST_LENGTH]; - CC_SHA256(string, (CC_LONG)strlen(string), result); - - NSMutableString *hashed = [NSMutableString stringWithCapacity:CC_SHA256_DIGEST_LENGTH * 2]; - for (NSInteger i = 0; i < CC_SHA256_DIGEST_LENGTH; i++) { - [hashed appendFormat:@"%02x", result[i]]; - } - return hashed; -} - -static void handleSignInWithApple(FLTFirebaseAuthPlugin *object, FIRAuthDataResult *authResult, - NSString *authorizationCode, NSError *error) { - void (^completion)(InternalUserCredential *_Nullable, FlutterError *_Nullable) = - object.appleCompletion; - if (completion == nil) { - object.appleSignInRequestInFlight = NO; - return; - } - - if (error != nil) { - if (error.code == FIRAuthErrorCodeSecondFactorRequired) { - object.appleCompletion = nil; - object.appleSignInRequestInFlight = NO; - [object handleMultiFactorError:object.appleArguments completion:completion withError:error]; - } else { - object.appleCompletion = nil; - object.appleSignInRequestInFlight = NO; - completion(nil, [FLTFirebaseAuthPlugin convertToFlutterError:error]); - } - return; - } - object.appleCompletion = nil; - object.appleSignInRequestInFlight = NO; - completion([PigeonParser getPigeonUserCredentialFromAuthResult:authResult - authorizationCode:authorizationCode], - nil); -} - -- (void)authorizationController:(ASAuthorizationController *)controller - didCompleteWithAuthorization:(ASAuthorization *)authorization - API_AVAILABLE(macos(10.15), ios(13.0)) { - if ([authorization.credential isKindOfClass:[ASAuthorizationAppleIDCredential class]]) { - ASAuthorizationAppleIDCredential *appleIDCredential = authorization.credential; - NSString *rawNonce = self.currentNonce; - NSAssert(rawNonce != nil, - @"Invalid state: A login callback was received, but no login request was sent."); - - if (appleIDCredential.identityToken == nil) { - NSLog(@"Unable to fetch identity token."); - void (^completion)(InternalUserCredential *_Nullable, FlutterError *_Nullable) = - self.appleCompletion; - self.appleCompletion = nil; - self.appleSignInRequestInFlight = NO; - if (completion != nil) { - completion(nil, [FlutterError errorWithCode:kErrCodeInvalidCredential - message:kErrMsgInvalidCredential - details:nil]); - } - return; - } - - NSString *idToken = [[NSString alloc] initWithData:appleIDCredential.identityToken - encoding:NSUTF8StringEncoding]; - if (idToken == nil) { - NSLog(@"Unable to serialize id token from data: %@", appleIDCredential.identityToken); - } - - NSString *authorizationCode = nil; - if (appleIDCredential.authorizationCode != nil) { - authorizationCode = [[NSString alloc] initWithData:appleIDCredential.authorizationCode - encoding:NSUTF8StringEncoding]; - } - - FIROAuthCredential *credential = - [FIROAuthProvider appleCredentialWithIDToken:idToken - rawNonce:rawNonce - fullName:appleIDCredential.fullName]; - - if (self.isReauthenticatingWithApple == YES) { - self.isReauthenticatingWithApple = NO; - void (^capturedCompletion)(InternalUserCredential *_Nullable, FlutterError *_Nullable) = - self.appleCompletion; - [[FIRAuth.auth currentUser] - reauthenticateWithCredential:credential - completion:^(FIRAuthDataResult *_Nullable authResult, - NSError *_Nullable error) { - handleSignInWithApple(self, authResult, authorizationCode, error); - }]; - - } else if (self.linkWithAppleUser != nil) { - FIRUser *userToLink = self.linkWithAppleUser; - void (^capturedCompletion)(InternalUserCredential *_Nullable, FlutterError *_Nullable) = - self.appleCompletion; - [userToLink linkWithCredential:credential - completion:^(FIRAuthDataResult *authResult, NSError *error) { - self.linkWithAppleUser = nil; - handleSignInWithApple(self, authResult, authorizationCode, error); - }]; - - } else { - FIRAuth *signInAuth = - self.signInWithAppleAuth != nil ? self.signInWithAppleAuth : FIRAuth.auth; - void (^capturedCompletion)(InternalUserCredential *_Nullable, FlutterError *_Nullable) = - self.appleCompletion; - [signInAuth signInWithCredential:credential - completion:^(FIRAuthDataResult *_Nullable authResult, - NSError *_Nullable error) { - self.signInWithAppleAuth = nil; - handleSignInWithApple(self, authResult, authorizationCode, error); - }]; - } - } else { - void (^completion)(InternalUserCredential *_Nullable, FlutterError *_Nullable) = - self.appleCompletion; - self.appleCompletion = nil; - self.appleSignInRequestInFlight = NO; - if (completion != nil) { - completion(nil, [FlutterError errorWithCode:kErrCodeInvalidCredential - message:kErrMsgInvalidCredential - details:nil]); - } - } -} - -- (void)authorizationController:(ASAuthorizationController *)controller - didCompleteWithError:(NSError *)error API_AVAILABLE(macos(10.15), ios(13.0)) { - void (^completion)(InternalUserCredential *_Nullable, FlutterError *_Nullable) = - self.appleCompletion; - self.appleCompletion = nil; - self.appleSignInRequestInFlight = NO; - - NSLog(@"Sign in with Apple errored: %@", error); - if (completion == nil) { - return; - } - - switch (error.code) { - case ASAuthorizationErrorCanceled: - completion(nil, [FlutterError errorWithCode:@"canceled" - message:@"The user canceled the authorization attempt." - details:nil]); - break; - - case ASAuthorizationErrorInvalidResponse: - completion(nil, [FlutterError - errorWithCode:@"invalid-response" - message:@"The authorization request received an invalid response." - details:nil]); - break; - - case ASAuthorizationErrorNotHandled: - completion(nil, [FlutterError errorWithCode:@"not-handled" - message:@"The authorization request wasn’t handled." - details:nil]); - break; - - case ASAuthorizationErrorFailed: - completion(nil, [FlutterError errorWithCode:@"failed" - message:@"The authorization attempt failed." - details:nil]); - break; - - case ASAuthorizationErrorUnknown: - default: - completion(nil, [FLTFirebaseAuthPlugin convertAppleAuthorizationErrorToFlutterError:error]); - break; - } -} - -- (void)handleInternalError:(nonnull void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion - withError:(NSError *)error { - const NSError *underlyingError = error.userInfo[@"NSUnderlyingError"]; - if (underlyingError != nil) { - const NSDictionary *details = - underlyingError.userInfo[@"FIRAuthErrorUserInfoDeserializedResponseKey"]; - completion(nil, [FlutterError errorWithCode:@"internal-error" - message:error.description - details:details]); - return; - } - completion(nil, [FlutterError errorWithCode:@"internal-error" - message:error.description - details:nil]); -} - -- (void)handleMultiFactorError:(AuthPigeonFirebaseApp *)app - completion:(nonnull void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion - withError:(NSError *_Nullable)error { - FIRMultiFactorResolver *resolver = - (FIRMultiFactorResolver *)error.userInfo[FIRAuthErrorUserInfoMultiFactorResolverKey]; - - NSArray *hints = resolver.hints; - FIRMultiFactorSession *session = resolver.session; - - NSString *sessionId = [[NSUUID UUID] UUIDString]; - self->_multiFactorSessionMap[sessionId] = session; - - NSString *resolverId = [[NSUUID UUID] UUIDString]; - self->_multiFactorResolverMap[resolverId] = resolver; - - NSMutableArray *pigeonHints = [NSMutableArray array]; - - for (FIRMultiFactorInfo *multiFactorInfo in hints) { - NSString *phoneNumber; - if ([multiFactorInfo class] == [FIRPhoneMultiFactorInfo class]) { - FIRPhoneMultiFactorInfo *phoneFactorInfo = (FIRPhoneMultiFactorInfo *)multiFactorInfo; - phoneNumber = phoneFactorInfo.phoneNumber; - } - - InternalMultiFactorInfo *object = [InternalMultiFactorInfo - makeWithDisplayName:multiFactorInfo.displayName - enrollmentTimestamp:multiFactorInfo.enrollmentDate.timeIntervalSince1970 - factorId:multiFactorInfo.factorID - uid:multiFactorInfo.UID - phoneNumber:phoneNumber]; - - [pigeonHints addObject:object.toList]; - } - - NSDictionary *output = @{ - kAppName : app.appName, - kArgumentMultiFactorHints : pigeonHints, - kArgumentMultiFactorSessionId : sessionId, - kArgumentMultiFactorResolverId : resolverId, - }; - completion(nil, [FlutterError errorWithCode:@"second-factor-required" - message:error.description - details:output]); -} - -static void launchAppleSignInRequest(FLTFirebaseAuthPlugin *object, AuthPigeonFirebaseApp *app, - InternalSignInProvider *signInProvider, - void (^_Nonnull completion)(InternalUserCredential *_Nullable, - FlutterError *_Nullable)) { - if (@available(iOS 13.0, macOS 10.15, *)) { - if (object.appleSignInRequestInFlight) { - completion(nil, - [FlutterError errorWithCode:@"operation-not-allowed" - message:@"A Sign in with Apple request is already in progress." - details:nil]); - return; - } - - NSString *nonce = [object randomNonce:32]; - object.currentNonce = nonce; - object.appleCompletion = completion; - object.appleArguments = app; - object.appleSignInRequestInFlight = YES; - - ASAuthorizationAppleIDProvider *appleIDProvider = [[ASAuthorizationAppleIDProvider alloc] init]; - - ASAuthorizationAppleIDRequest *request = [appleIDProvider createRequest]; - NSMutableArray *requestedScopes = [NSMutableArray arrayWithCapacity:2]; - if ([signInProvider.scopes containsObject:@"name"]) { - [requestedScopes addObject:ASAuthorizationScopeFullName]; - } - if ([signInProvider.scopes containsObject:@"email"]) { - [requestedScopes addObject:ASAuthorizationScopeEmail]; - } - request.requestedScopes = [requestedScopes copy]; - request.nonce = [object stringBySha256HashingString:nonce]; - - ASAuthorizationController *authorizationController = - [[ASAuthorizationController alloc] initWithAuthorizationRequests:@[ request ]]; - authorizationController.delegate = object; - authorizationController.presentationContextProvider = object; - [authorizationController performRequests]; - } else { - NSLog(@"Sign in with Apple was introduced in iOS 13, update your Podfile with platform :ios, " - @"'13.0'"); - } -} - -static void handleAppleAuthResult(FLTFirebaseAuthPlugin *object, AuthPigeonFirebaseApp *app, - FIRAuth *auth, FIRAuthCredential *credentials, NSError *error, - void (^_Nonnull completion)(InternalUserCredential *_Nullable, - FlutterError *_Nullable)) { - if (error) { - if (error.code == FIRAuthErrorCodeSecondFactorRequired) { - [object handleMultiFactorError:app completion:completion withError:error]; - } else { - completion(nil, [FLTFirebaseAuthPlugin convertToFlutterError:error]); - } - return; - } - if (credentials) { - [auth - signInWithCredential:credentials - completion:^(FIRAuthDataResult *authResult, NSError *error) { - if (error != nil) { - NSDictionary *userInfo = [error userInfo]; - NSError *underlyingError = [userInfo objectForKey:NSUnderlyingErrorKey]; - - NSDictionary *firebaseDictionary = - underlyingError.userInfo[@"FIRAuthErrorUserInfoDes" - @"erializedResponseKey"]; - - NSString *errorCode = userInfo[@"FIRAuthErrorUserInfoNameKey"]; - - if (firebaseDictionary == nil && errorCode != nil) { - if ([errorCode isEqual:@"ERROR_ACCOUNT_EXISTS_WITH_DIFFERENT_CREDENTIAL"]) { - completion(nil, [FLTFirebaseAuthPlugin convertToFlutterError:error]); - return; - } - - // Removing since it's not parsed and causing issue when sending back the - // object to Flutter - NSMutableDictionary *mutableUserInfo = [userInfo mutableCopy]; - [mutableUserInfo - removeObjectForKey:@"FIRAuthErrorUserInfoUpdatedCredentialKey"]; - NSError *modifiedError = [NSError errorWithDomain:error.domain - code:error.code - userInfo:mutableUserInfo]; - - completion(nil, - [FlutterError errorWithCode:@"sign-in-failed" - message:userInfo[@"NSLocalizedDescription"] - details:modifiedError.userInfo]); - - } else if (firebaseDictionary != nil && - firebaseDictionary[@"message"] != nil) { - // error from firebase-ios-sdk is - // buried in underlying error. - completion(nil, - [FlutterError errorWithCode:@"sign-in-failed" - message:error.localizedDescription - details:firebaseDictionary[@"message"]]); - } else { - completion(nil, [FlutterError errorWithCode:@"sign-in-failed" - message:error.localizedDescription - details:error.userInfo]); - } - } else { - completion([PigeonParser getPigeonUserCredentialFromAuthResult:authResult - authorizationCode:nil], - nil); - } - }]; - } -} - -#pragma mark - Utilities - -+ (NSNumber *_Nullable)storeAuthCredentialIfPresent:(NSError *)error { - if ([error userInfo][FIRAuthErrorUserInfoUpdatedCredentialKey] != nil) { - FIRAuthCredential *authCredential = [error userInfo][FIRAuthErrorUserInfoUpdatedCredentialKey]; - // We temporarily store the non-serializable credential so the - // Dart API can consume these at a later time. - NSNumber *authCredentialHash = @([authCredential hash]); - credentialsMap[authCredentialHash] = authCredential; - return authCredentialHash; - } - return nil; -} - -- (FIRAuth *_Nullable)getFIRAuthFromAppNameFromPigeon:(AuthPigeonFirebaseApp *)pigeonApp { - FIRApp *app = [FLTFirebasePlugin firebaseAppNamed:pigeonApp.appName]; - FIRAuth *auth = [FIRAuth authWithApp:app]; - - auth.tenantID = pigeonApp.tenantId; - auth.customAuthDomain = [FLTFirebasePlugin getCustomDomain:app.name]; - // Auth's `customAuthDomain` supersedes value from `getCustomDomain` set by `initializeApp` - if (pigeonApp.customAuthDomain != nil) { - auth.customAuthDomain = pigeonApp.customAuthDomain; - } - - return auth; -} - -- (void)getFIRAuthCredentialFromArguments:(NSDictionary *)arguments - app:(AuthPigeonFirebaseApp *)app - completion:(void (^)(FIRAuthCredential *credential, - NSError *error))completion { - // If the credential dictionary contains a token, it means a native one has - // been stored for later usage, so we'll attempt to retrieve it here. - if (arguments[kArgumentToken] != nil && ![arguments[kArgumentToken] isEqual:[NSNull null]]) { - NSNumber *credentialHashCode = arguments[kArgumentToken]; - if (credentialsMap[credentialHashCode] != nil) { - completion(credentialsMap[credentialHashCode], nil); - return; - } - } - - NSString *signInMethod = arguments[kArgumentSignInMethod]; - - if ([signInMethod isEqualToString:kSignInMethodGameCenter]) { - // Game Center Games is different to other providers, it requires below callback to get a - // credential. This is why getFIRAuthCredentialFromArguments now requires a completion() - // callback - [FIRGameCenterAuthProvider - getCredentialWithCompletion:^(FIRAuthCredential *credential, NSError *error) { - if (error) { - completion(nil, error); - } else { - completion(credential, nil); - } - }]; - return; - } - - NSString *secret = arguments[kArgumentSecret] == [NSNull null] ? nil : arguments[kArgumentSecret]; - NSString *idToken = - arguments[kArgumentIdToken] == [NSNull null] ? nil : arguments[kArgumentIdToken]; - NSString *accessToken = - arguments[kArgumentAccessToken] == [NSNull null] ? nil : arguments[kArgumentAccessToken]; - NSString *rawNonce = - arguments[kArgumentRawNonce] == [NSNull null] ? nil : arguments[kArgumentRawNonce]; - - // Password Auth - if ([signInMethod isEqualToString:kSignInMethodPassword]) { - NSString *email = arguments[kArgumentEmail]; - completion([FIREmailAuthProvider credentialWithEmail:email password:secret], nil); - return; - } - - // Email Link Auth - if ([signInMethod isEqualToString:kSignInMethodEmailLink]) { - NSString *email = arguments[kArgumentEmail]; - NSString *emailLink = arguments[kArgumentEmailLink]; - completion([FIREmailAuthProvider credentialWithEmail:email link:emailLink], nil); - return; - } - - // Facebook Auth - if ([signInMethod isEqualToString:kSignInMethodFacebook]) { - completion([FIRFacebookAuthProvider credentialWithAccessToken:accessToken], nil); - return; - } - - // Google Auth - if ([signInMethod isEqualToString:kSignInMethodGoogle]) { - completion([FIRGoogleAuthProvider credentialWithIDToken:idToken accessToken:accessToken], nil); - return; - } - - // Twitter Auth - if ([signInMethod isEqualToString:kSignInMethodTwitter]) { - completion([FIRTwitterAuthProvider credentialWithToken:accessToken secret:secret], nil); - return; - } - - // GitHub Auth - if ([signInMethod isEqualToString:kSignInMethodGithub]) { - completion([FIRGitHubAuthProvider credentialWithToken:accessToken], nil); - return; - } - - // Phone Auth - Only supported on iOS - if ([signInMethod isEqualToString:kSignInMethodPhone]) { -#if TARGET_OS_IPHONE - NSString *verificationId = arguments[kArgumentVerificationId]; - NSString *smsCode = arguments[kArgumentSmsCode]; - completion([[FIRPhoneAuthProvider providerWithAuth:[self getFIRAuthFromAppNameFromPigeon:app]] - credentialWithVerificationID:verificationId - verificationCode:smsCode], - nil); - return; -#else - NSLog(@"The Firebase Phone Authentication provider is not supported on the " - @"MacOS platform."); - completion(nil, nil); - return; -#endif - } - // Apple Auth - if ([signInMethod isEqualToString:kSignInMethodApple]) { - if (idToken && rawNonce) { - // Credential with idToken, rawNonce and fullName - NSPersonNameComponents *fullName = [[NSPersonNameComponents alloc] init]; - fullName.givenName = - arguments[kArgumentGivenName] == [NSNull null] ? nil : arguments[kArgumentGivenName]; - fullName.familyName = - arguments[kArgumentFamilyName] == [NSNull null] ? nil : arguments[kArgumentFamilyName]; - fullName.nickname = - arguments[kArgumentNickname] == [NSNull null] ? nil : arguments[kArgumentNickname]; - fullName.namePrefix = - arguments[kArgumentNamePrefix] == [NSNull null] ? nil : arguments[kArgumentNamePrefix]; - fullName.nameSuffix = - arguments[kArgumentNameSuffix] == [NSNull null] ? nil : arguments[kArgumentNameSuffix]; - fullName.middleName = - arguments[kArgumentMiddleName] == [NSNull null] ? nil : arguments[kArgumentMiddleName]; - - completion([FIROAuthProvider appleCredentialWithIDToken:idToken - rawNonce:rawNonce - fullName:fullName], - nil); - return; - } - } - // OAuth - if ([signInMethod isEqualToString:kSignInMethodOAuth]) { - NSString *providerId = arguments[kArgumentProviderId]; - FIRAuthCredential *credential; - if (accessToken == nil) { - credential = [FIROAuthProvider credentialWithProviderID:providerId - IDToken:idToken - rawNonce:rawNonce]; - } else { - credential = [FIROAuthProvider credentialWithProviderID:providerId - IDToken:idToken - rawNonce:rawNonce - accessToken:accessToken]; - } - completion(credential, nil); - return; - } - - NSLog(@"Support for an auth provider with identifier '%@' is not implemented.", signInMethod); - completion(nil, nil); - return; -} - -- (void)ensureAPNSTokenSetting { -#if !TARGET_OS_OSX - FIRApp *defaultApp = [FIRApp defaultApp]; - if (defaultApp) { - if ([FIRAuth auth].APNSToken == nil && _apnsToken != nil) { - [[FIRAuth auth] setAPNSToken:_apnsToken type:FIRAuthAPNSTokenTypeUnknown]; - _apnsToken = nil; - } - } -#endif -} - -- (FIRMultiFactor *)getAppMultiFactorFromPigeon:(nonnull AuthPigeonFirebaseApp *)app { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - FIRUser *currentUser = auth.currentUser; - return currentUser.multiFactor; -} - -- (nonnull ASPresentationAnchor)presentationAnchorForAuthorizationController: - (nonnull ASAuthorizationController *)controller API_AVAILABLE(macos(10.15), ios(13.0)) { -#if TARGET_OS_OSX - return [[NSApplication sharedApplication] keyWindow]; -#else - // UIApplication.keyWindow is deprecated in iOS 13+ with UIScene lifecycle. - // Walk the connected scenes to find the foreground active window. - if (@available(iOS 15.0, *)) { - for (UIScene *scene in [UIApplication sharedApplication].connectedScenes) { - if (scene.activationState == UISceneActivationStateForegroundActive && - [scene isKindOfClass:[UIWindowScene class]]) { - UIWindowScene *windowScene = (UIWindowScene *)scene; - if (windowScene.keyWindow) { - return windowScene.keyWindow; - } - } - } - } else if (@available(iOS 13.0, *)) { - for (UIScene *scene in [UIApplication sharedApplication].connectedScenes) { - if (scene.activationState == UISceneActivationStateForegroundActive && - [scene isKindOfClass:[UIWindowScene class]]) { - UIWindowScene *windowScene = (UIWindowScene *)scene; - for (UIWindow *window in windowScene.windows) { - if (window.isKeyWindow) { - return window; - } - } - } - } - } - return [[UIApplication sharedApplication] keyWindow]; -#endif -} - -- (void)enrollPhoneApp:(nonnull AuthPigeonFirebaseApp *)app - assertion:(nonnull InternalPhoneMultiFactorAssertion *)assertion - displayName:(nullable NSString *)displayName - completion:(nonnull void (^)(FlutterError *_Nullable))completion { -#if TARGET_OS_OSX - completion([FlutterError errorWithCode:kErrCodeUnsupportedPlatform - message:@"Phone authentication is not supported on macOS." - details:nil]); -#else - - FIRMultiFactor *multiFactor = [self getAppMultiFactorFromPigeon:app]; - - FIRPhoneAuthCredential *credential = - [[FIRPhoneAuthProvider providerWithAuth:[self getFIRAuthFromAppNameFromPigeon:app]] - credentialWithVerificationID:[assertion verificationId] - verificationCode:[assertion verificationCode]]; - - FIRMultiFactorAssertion *multiFactorAssertion = - [FIRPhoneMultiFactorGenerator assertionWithCredential:credential]; - - [multiFactor enrollWithAssertion:multiFactorAssertion - displayName:displayName - completion:^(NSError *_Nullable error) { - if (error == nil) { - completion(nil); - } else { - completion([FlutterError errorWithCode:@"enroll-failed" - message:error.localizedDescription - details:nil]); - } - }]; -#endif -} - -- (void)getEnrolledFactorsApp:(nonnull AuthPigeonFirebaseApp *)app - completion:(nonnull void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion { - FIRMultiFactor *multiFactor = [self getAppMultiFactorFromPigeon:app]; - - NSArray *enrolledFactors = [multiFactor enrolledFactors]; - - NSMutableArray *results = [NSMutableArray array]; - - for (FIRMultiFactorInfo *multiFactorInfo in enrolledFactors) { - NSString *phoneNumber; - if ([multiFactorInfo class] == [FIRPhoneMultiFactorInfo class]) { - FIRPhoneMultiFactorInfo *phoneFactorInfo = (FIRPhoneMultiFactorInfo *)multiFactorInfo; - phoneNumber = phoneFactorInfo.phoneNumber; - } - - [results addObject:[InternalMultiFactorInfo - makeWithDisplayName:multiFactorInfo.displayName - enrollmentTimestamp:multiFactorInfo.enrollmentDate.timeIntervalSince1970 - factorId:multiFactorInfo.factorID - uid:multiFactorInfo.UID - phoneNumber:phoneNumber]]; - } - - completion(results, nil); -} - -- (void)getSessionApp:(nonnull AuthPigeonFirebaseApp *)app - completion:(nonnull void (^)(InternalMultiFactorSession *_Nullable, - FlutterError *_Nullable))completion { - FIRMultiFactor *multiFactor = [self getAppMultiFactorFromPigeon:app]; - [multiFactor getSessionWithCompletion:^(FIRMultiFactorSession *_Nullable session, - NSError *_Nullable error) { - NSString *UUID = [[NSUUID UUID] UUIDString]; - self->_multiFactorSessionMap[UUID] = session; - - InternalMultiFactorSession *pigeonSession = [InternalMultiFactorSession makeWithId:UUID]; - completion(pigeonSession, nil); - }]; -} - -- (void)unenrollApp:(nonnull AuthPigeonFirebaseApp *)app - factorUid:(nonnull NSString *)factorUid - completion:(nonnull void (^)(FlutterError *_Nullable))completion { - FIRMultiFactor *multiFactor = [self getAppMultiFactorFromPigeon:app]; - [multiFactor unenrollWithFactorUID:factorUid - completion:^(NSError *_Nullable error) { - if (error == nil) { - completion(nil); - } else { - completion([FlutterError errorWithCode:@"unenroll-failed" - message:error.localizedDescription - details:nil]); - } - }]; -} - -- (void)enrollTotpApp:(nonnull AuthPigeonFirebaseApp *)app - assertionId:(nonnull NSString *)assertionId - displayName:(nullable NSString *)displayName - completion:(nonnull void (^)(FlutterError *_Nullable))completion { - FIRMultiFactor *multiFactor = [self getAppMultiFactorFromPigeon:app]; - - FIRMultiFactorAssertion *assertion = _multiFactorAssertionMap[assertionId]; - - [multiFactor enrollWithAssertion:assertion - displayName:displayName - completion:^(NSError *_Nullable error) { - if (error == nil) { - completion(nil); - } else { - completion([FlutterError errorWithCode:@"enroll-failed" - message:error.localizedDescription - details:nil]); - } - }]; -} - -- (void)resolveSignInResolverId:(nonnull NSString *)resolverId - assertion:(nullable InternalPhoneMultiFactorAssertion *)assertion - totpAssertionId:(nullable NSString *)totpAssertionId - completion:(nonnull void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion { - FIRMultiFactorResolver *resolver = _multiFactorResolverMap[resolverId]; - - FIRMultiFactorAssertion *multiFactorAssertion; - - if (assertion != nil) { -#if TARGET_OS_IPHONE - FIRPhoneAuthCredential *credential = - [[FIRPhoneAuthProvider provider] credentialWithVerificationID:[assertion verificationId] - verificationCode:[assertion verificationCode]]; - multiFactorAssertion = [FIRPhoneMultiFactorGenerator assertionWithCredential:credential]; -#endif - } else if (totpAssertionId != nil) { - multiFactorAssertion = _multiFactorAssertionMap[totpAssertionId]; - } else { - completion(nil, - [FlutterError errorWithCode:@"resolve-signin-failed" - message:@"Neither assertion nor totpAssertionId were provided" - details:nil]); - return; - } - - [resolver - resolveSignInWithAssertion:multiFactorAssertion - completion:^(FIRAuthDataResult *_Nullable authResult, - NSError *_Nullable error) { - if (error == nil) { - completion([PigeonParser getPigeonUserCredentialFromAuthResult:authResult - authorizationCode:nil], - nil); - } else { - completion(nil, [FlutterError errorWithCode:@"resolve-signin-failed" - message:error.localizedDescription - details:nil]); - } - }]; -} - -- (void)generateSecretSessionId:(nonnull NSString *)sessionId - completion:(nonnull void (^)(InternalTotpSecret *_Nullable, - FlutterError *_Nullable))completion { - FIRMultiFactorSession *multiFactorSession = _multiFactorSessionMap[sessionId]; - - [FIRTOTPMultiFactorGenerator - generateSecretWithMultiFactorSession:multiFactorSession - completion:^(FIRTOTPSecret *_Nullable secret, - NSError *_Nullable error) { - if (error == nil) { - self->_multiFactorTotpSecretMap[secret.sharedSecretKey] = - secret; - completion([PigeonParser getPigeonTotpSecret:secret], nil); - } else { - completion( - nil, [FlutterError errorWithCode:@"generate-secret-failed" - message:error.localizedDescription - details:nil]); - } - }]; -} - -- (void)getAssertionForEnrollmentSecretKey:(nonnull NSString *)secretKey - oneTimePassword:(nonnull NSString *)oneTimePassword - completion:(nonnull void (^)(NSString *_Nullable, - FlutterError *_Nullable))completion { - FIRTOTPSecret *totpSecret = _multiFactorTotpSecretMap[secretKey]; - - FIRTOTPMultiFactorAssertion *assertion = - [FIRTOTPMultiFactorGenerator assertionForEnrollmentWithSecret:totpSecret - oneTimePassword:oneTimePassword]; - - NSString *UUID = [[NSUUID UUID] UUIDString]; - self->_multiFactorAssertionMap[UUID] = assertion; - completion(UUID, nil); -} - -- (void)getAssertionForSignInEnrollmentId:(nonnull NSString *)enrollmentId - oneTimePassword:(nonnull NSString *)oneTimePassword - completion:(nonnull void (^)(NSString *_Nullable, - FlutterError *_Nullable))completion { - FIRTOTPMultiFactorAssertion *assertion = - [FIRTOTPMultiFactorGenerator assertionForSignInWithEnrollmentID:enrollmentId - oneTimePassword:oneTimePassword]; - NSString *UUID = [[NSUUID UUID] UUIDString]; - self->_multiFactorAssertionMap[UUID] = assertion; - completion(UUID, nil); -} - -- (void)generateQrCodeUrlSecretKey:(nonnull NSString *)secretKey - accountName:(nullable NSString *)accountName - issuer:(nullable NSString *)issuer - completion:(nonnull void (^)(NSString *_Nullable, - FlutterError *_Nullable))completion { - FIRTOTPSecret *totpSecret = _multiFactorTotpSecretMap[secretKey]; - completion([totpSecret generateQRCodeURLWithAccountName:accountName issuer:issuer], nil); -} - -- (void)openInOtpAppSecretKey:(nonnull NSString *)secretKey - qrCodeUrl:(nonnull NSString *)qrCodeUrl - completion:(nonnull void (^)(FlutterError *_Nullable))completion { - FIRTOTPSecret *totpSecret = _multiFactorTotpSecretMap[secretKey]; - [totpSecret openInOTPAppWithQRCodeURL:qrCodeUrl]; - completion(nil); -} - -- (void)applyActionCodeApp:(nonnull AuthPigeonFirebaseApp *)app - code:(nonnull NSString *)code - completion:(nonnull void (^)(FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - [auth applyActionCode:code - completion:^(NSError *_Nullable error) { - if (error != nil) { - completion([FLTFirebaseAuthPlugin convertToFlutterError:error]); - } else { - completion(nil); - } - }]; -} - -- (void)revokeTokenWithAuthorizationCodeApp:(nonnull AuthPigeonFirebaseApp *)app - authorizationCode:(nonnull NSString *)authorizationCode - completion:(nonnull void (^)(FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - [auth revokeTokenWithAuthorizationCode:authorizationCode - completion:^(NSError *_Nullable error) { - if (error != nil) { - completion([FLTFirebaseAuthPlugin convertToFlutterError:error]); - } else { - completion(nil); - } - }]; -} - -- (void)revokeAccessTokenApp:(nonnull AuthPigeonFirebaseApp *)app - accessToken:(nonnull NSString *)accessToken - completion:(nonnull void (^)(FlutterError *_Nullable))completion { - // `revokeAccessToken(_:)` is currently Android-only on the Firebase SDK. - // On Apple platforms use `revokeTokenWithAuthorizationCode:` instead. - completion([FlutterError errorWithCode:@"unsupported-platform-operation" - message:@"revokeAccessToken is not supported on iOS/macOS. " - @"Use revokeTokenWithAuthorizationCode instead." - details:nil]); -} - -- (void)checkActionCodeApp:(nonnull AuthPigeonFirebaseApp *)app - code:(nonnull NSString *)code - completion:(nonnull void (^)(InternalActionCodeInfo *_Nullable, - FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - [auth checkActionCode:code - completion:^(FIRActionCodeInfo *_Nullable info, NSError *_Nullable error) { - if (error != nil) { - completion(nil, [FLTFirebaseAuthPlugin convertToFlutterError:error]); - } else { - InternalActionCodeInfo *result = [self parseActionCode:info]; - if (result.operation == ActionCodeInfoOperationUnknown) { - // Workaround: Firebase iOS SDK >=11.12.0 returns .unknown because - // actionCodeOperation(forRequestType:) only matches camelCase but the - // REST API returns SCREAMING_SNAKE_CASE (e.g. "VERIFY_EMAIL"). - // Re-fetch the raw requestType via REST to resolve the operation. - // See: https://github.com/firebase/flutterfire/issues/17452 - [self resolveActionCodeOperationForApp:app - code:code - fallbackInfo:result - completion:completion]; - } else { - completion(result, nil); - } - } - }]; -} - -- (InternalActionCodeInfo *_Nullable)parseActionCode:(nonnull FIRActionCodeInfo *)info { - InternalActionCodeInfoData *data = [InternalActionCodeInfoData makeWithEmail:info.email - previousEmail:info.previousEmail]; - - ActionCodeInfoOperation operation; - - if (info.operation == FIRActionCodeOperationPasswordReset) { - operation = ActionCodeInfoOperationPasswordReset; - } else if (info.operation == FIRActionCodeOperationVerifyEmail) { - operation = ActionCodeInfoOperationVerifyEmail; - } else if (info.operation == FIRActionCodeOperationRecoverEmail) { - operation = ActionCodeInfoOperationRecoverEmail; - } else if (info.operation == FIRActionCodeOperationEmailLink) { - operation = ActionCodeInfoOperationEmailSignIn; - } else if (info.operation == FIRActionCodeOperationVerifyAndChangeEmail) { - operation = ActionCodeInfoOperationVerifyAndChangeEmail; - } else if (info.operation == FIRActionCodeOperationRevertSecondFactorAddition) { - operation = ActionCodeInfoOperationRevertSecondFactorAddition; - } else { - operation = ActionCodeInfoOperationUnknown; - } - - return [InternalActionCodeInfo makeWithOperation:operation data:data]; -} - -/// Maps a raw requestType string (either camelCase or SCREAMING_SNAKE_CASE) to -/// the corresponding Pigeon enum value. -+ (ActionCodeInfoOperation)operationFromRequestType:(nullable NSString *)requestType { - static NSDictionary *mapping; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - mapping = @{ - @"PASSWORD_RESET" : @(ActionCodeInfoOperationPasswordReset), - @"resetPassword" : @(ActionCodeInfoOperationPasswordReset), - @"VERIFY_EMAIL" : @(ActionCodeInfoOperationVerifyEmail), - @"verifyEmail" : @(ActionCodeInfoOperationVerifyEmail), - @"RECOVER_EMAIL" : @(ActionCodeInfoOperationRecoverEmail), - @"recoverEmail" : @(ActionCodeInfoOperationRecoverEmail), - @"EMAIL_SIGNIN" : @(ActionCodeInfoOperationEmailSignIn), - @"signIn" : @(ActionCodeInfoOperationEmailSignIn), - @"VERIFY_AND_CHANGE_EMAIL" : @(ActionCodeInfoOperationVerifyAndChangeEmail), - @"verifyAndChangeEmail" : @(ActionCodeInfoOperationVerifyAndChangeEmail), - @"REVERT_SECOND_FACTOR_ADDITION" : @(ActionCodeInfoOperationRevertSecondFactorAddition), - @"revertSecondFactorAddition" : @(ActionCodeInfoOperationRevertSecondFactorAddition), - }; - }); - - NSNumber *value = mapping[requestType]; - return value ? (ActionCodeInfoOperation)value.integerValue : ActionCodeInfoOperationUnknown; -} - -/// Calls the Identity Toolkit REST API directly to retrieve the raw requestType -/// string, which the iOS SDK fails to parse correctly. Falls back to the original -/// result if the REST call fails for any reason. -- (void)resolveActionCodeOperationForApp:(nonnull AuthPigeonFirebaseApp *)app - code:(nonnull NSString *)code - fallbackInfo:(nonnull InternalActionCodeInfo *)fallbackInfo - completion:(nonnull void (^)(InternalActionCodeInfo *_Nullable, - FlutterError *_Nullable))completion { - FIRApp *firebaseApp = [FLTFirebasePlugin firebaseAppNamed:app.appName]; - NSString *apiKey = firebaseApp.options.APIKey; - - NSString *baseURL; - NSDictionary *emulatorConfig = _emulatorConfigs[app.appName]; - if (emulatorConfig) { - baseURL = [NSString stringWithFormat:@"http://%@:%@/identitytoolkit.googleapis.com", - emulatorConfig[@"host"], emulatorConfig[@"port"]]; - } else { - baseURL = @"https://identitytoolkit.googleapis.com"; - } - - NSString *urlString = - [NSString stringWithFormat:@"%@/v1/accounts:resetPassword?key=%@", baseURL, apiKey]; - NSURL *url = [NSURL URLWithString:urlString]; - - NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; - request.HTTPMethod = @"POST"; - [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; - request.HTTPBody = [NSJSONSerialization dataWithJSONObject:@{@"oobCode" : code} - options:0 - error:nil]; - - NSURLSessionDataTask *task = [[NSURLSession sharedSession] - dataTaskWithRequest:request - completionHandler:^(NSData *_Nullable data, NSURLResponse *_Nullable response, - NSError *_Nullable error) { - if (error || !data) { - completion(fallbackInfo, nil); - return; - } - - NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; - if (!json || json[@"error"]) { - completion(fallbackInfo, nil); - return; - } - - ActionCodeInfoOperation operation = - [FLTFirebaseAuthPlugin operationFromRequestType:json[@"requestType"]]; - - if (operation != ActionCodeInfoOperationUnknown) { - completion([InternalActionCodeInfo makeWithOperation:operation data:fallbackInfo.data], - nil); - } else { - completion(fallbackInfo, nil); - } - }]; - [task resume]; -} - -- (void)confirmPasswordResetApp:(nonnull AuthPigeonFirebaseApp *)app - code:(nonnull NSString *)code - newPassword:(nonnull NSString *)newPassword - completion:(nonnull void (^)(FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - [auth confirmPasswordResetWithCode:code - newPassword:newPassword - completion:^(NSError *_Nullable error) { - if (error != nil) { - completion([FLTFirebaseAuthPlugin convertToFlutterError:error]); - } else { - completion(nil); - } - }]; -} - -- (void)createUserWithEmailAndPasswordApp:(nonnull AuthPigeonFirebaseApp *)app - email:(nonnull NSString *)email - password:(nonnull NSString *)password - completion:(nonnull void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - [auth createUserWithEmail:email - password:password - completion:^(FIRAuthDataResult *_Nullable authResult, NSError *_Nullable error) { - if (error != nil) { - completion(nil, [FLTFirebaseAuthPlugin convertToFlutterError:error]); - } else { - completion([PigeonParser getPigeonUserCredentialFromAuthResult:authResult - authorizationCode:nil], - nil); - } - }]; -} - -- (void)fetchSignInMethodsForEmailApp:(nonnull AuthPigeonFirebaseApp *)app - email:(nonnull NSString *)email - completion:(nonnull void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - [auth fetchSignInMethodsForEmail:email - completion:^(NSArray *_Nullable providers, - NSError *_Nullable error) { - if (error != nil) { - completion(nil, [FLTFirebaseAuthPlugin convertToFlutterError:error]); - } else { - if (providers == nil) { - completion(@[], nil); - } else { - completion(providers, nil); - } - } - }]; -} - -- (void)registerAuthStateListenerApp:(nonnull AuthPigeonFirebaseApp *)app - completion:(nonnull void (^)(NSString *_Nullable, - FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - - NSString *name = - [NSString stringWithFormat:@"%@/auth-state/%@", kFLTFirebaseAuthChannelName, auth.app.name]; - FlutterEventChannel *channel = [FlutterEventChannel eventChannelWithName:name - binaryMessenger:_binaryMessenger]; - - FLTAuthStateChannelStreamHandler *handler = - [[FLTAuthStateChannelStreamHandler alloc] initWithAuth:auth]; - [channel setStreamHandler:handler]; - - [_eventChannels setObject:channel forKey:name]; - [_streamHandlers setObject:handler forKey:name]; - - completion(name, nil); -} - -- (void)registerIdTokenListenerApp:(nonnull AuthPigeonFirebaseApp *)app - completion:(nonnull void (^)(NSString *_Nullable, - FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - - NSString *name = - [NSString stringWithFormat:@"%@/id-token/%@", kFLTFirebaseAuthChannelName, auth.app.name]; - - FlutterEventChannel *channel = [FlutterEventChannel eventChannelWithName:name - binaryMessenger:_binaryMessenger]; - - FLTIdTokenChannelStreamHandler *handler = - [[FLTIdTokenChannelStreamHandler alloc] initWithAuth:auth]; - [channel setStreamHandler:handler]; - - [_eventChannels setObject:channel forKey:name]; - [_streamHandlers setObject:handler forKey:name]; - - completion(name, nil); -} - -- (void)sendPasswordResetEmailApp:(nonnull AuthPigeonFirebaseApp *)app - email:(nonnull NSString *)email - actionCodeSettings:(nullable InternalActionCodeSettings *)actionCodeSettings - completion:(nonnull void (^)(FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - if (actionCodeSettings != nil) { - FIRActionCodeSettings *settings = [PigeonParser parseActionCodeSettings:actionCodeSettings]; - [auth sendPasswordResetWithEmail:email - actionCodeSettings:settings - completion:^(NSError *_Nullable error) { - if (error != nil) { - completion([FLTFirebaseAuthPlugin convertToFlutterError:error]); - } else { - completion(nil); - } - }]; - } else { - [auth sendPasswordResetWithEmail:email - completion:^(NSError *_Nullable error) { - if (error != nil) { - completion([FLTFirebaseAuthPlugin convertToFlutterError:error]); - } else { - completion(nil); - } - }]; - } -} - -- (void)sendSignInLinkToEmailApp:(nonnull AuthPigeonFirebaseApp *)app - email:(nonnull NSString *)email - actionCodeSettings:(nonnull InternalActionCodeSettings *)actionCodeSettings - completion:(nonnull void (^)(FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - [auth sendSignInLinkToEmail:email - actionCodeSettings:[PigeonParser parseActionCodeSettings:actionCodeSettings] - completion:^(NSError *_Nullable error) { - if (error != nil) { - if (error.code == FIRAuthErrorCodeInternalError) { - [self - handleInternalError:^(InternalUserCredential *_Nullable creds, - FlutterError *_Nullable internalError) { - completion(internalError); - } - withError:error]; - } else { - completion([FLTFirebaseAuthPlugin convertToFlutterError:error]); - } - } else { - completion(nil); - } - }]; -} - -- (void)setLanguageCodeApp:(nonnull AuthPigeonFirebaseApp *)app - languageCode:(nullable NSString *)languageCode - completion: - (nonnull void (^)(NSString *_Nullable, FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - - if (languageCode != nil && ![languageCode isEqual:[NSNull null]]) { - auth.languageCode = languageCode; - } else { - [auth useAppLanguage]; - } - - completion(auth.languageCode, nil); -} - -- (void)setSettingsApp:(nonnull AuthPigeonFirebaseApp *)app - settings:(nonnull InternalFirebaseAuthSettings *)settings - completion:(nonnull void (^)(FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - - if (settings.userAccessGroup != nil) { - BOOL useUserAccessGroupSuccessful; - NSError *useUserAccessGroupErrorPtr; - useUserAccessGroupSuccessful = [auth useUserAccessGroup:settings.userAccessGroup - error:&useUserAccessGroupErrorPtr]; - if (!useUserAccessGroupSuccessful) { - completion([FLTFirebaseAuthPlugin convertToFlutterError:useUserAccessGroupErrorPtr]); - return; - } - } - -#if TARGET_OS_IPHONE - if (settings.appVerificationDisabledForTesting) { - auth.settings.appVerificationDisabledForTesting = settings.appVerificationDisabledForTesting; - } -#else - NSLog(@"FIRAuthSettings.appVerificationDisabledForTesting is not supported " - @"on MacOS."); -#endif - - completion(nil); -} - -- (void)signInAnonymouslyApp:(nonnull AuthPigeonFirebaseApp *)app - completion:(nonnull void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - [auth signInAnonymouslyWithCompletion:^(FIRAuthDataResult *authResult, NSError *error) { - if (error != nil) { - completion(nil, [FLTFirebaseAuthPlugin convertToFlutterError:error]); - } else { - completion([PigeonParser getPigeonUserCredentialFromAuthResult:authResult - authorizationCode:nil], - nil); - } - }]; -} - -- (void)signInWithCredentialApp:(nonnull AuthPigeonFirebaseApp *)app - input:(nonnull NSDictionary *)input - completion:(nonnull void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - [self - getFIRAuthCredentialFromArguments:input - app:app - completion:^(FIRAuthCredential *credential, NSError *error) { - if (credential == nil) { - completion(nil, - [FlutterError errorWithCode:kErrCodeInvalidCredential - message:kErrMsgInvalidCredential - details:nil]); - return; - } - - if (error) { - completion(nil, - [FLTFirebaseAuthPlugin convertToFlutterError:error]); - } - - [auth - signInWithCredential:credential - completion:^(FIRAuthDataResult *authResult, - NSError *error) { - if (error != nil) { - NSDictionary *userInfo = [error userInfo]; - NSError *underlyingError = - [userInfo objectForKey:NSUnderlyingErrorKey]; - - NSDictionary *firebaseDictionary = - underlyingError - .userInfo[@"FIRAuthErrorUserInfoDeserializ" - @"edResponseKey"]; - - if (firebaseDictionary != nil && - firebaseDictionary[@"message"] != nil) { - // error from firebase-ios-sdk is buried in - // underlying error. - if ([firebaseDictionary[@"code"] - isKindOfClass:[NSNumber class]]) { - [self handleInternalError:completion - withError:error]; - } else { - completion(nil, - [FlutterError - errorWithCode:firebaseDictionary - [@"code"] - message:firebaseDictionary - [@"message"] - details:nil]); - } - } else { - if (error.code == - FIRAuthErrorCodeSecondFactorRequired) { - [self handleMultiFactorError:app - completion:completion - withError:error]; - } else if (error.code == - FIRAuthErrorCodeInternalError) { - [self handleInternalError:completion - withError:error]; - } else { - completion(nil, - [FLTFirebaseAuthPlugin - convertToFlutterError:error]); - } - } - } else { - completion( - [PigeonParser - getPigeonUserCredentialFromAuthResult: - authResult - authorizationCode:nil], - nil); - } - }]; - }]; -} - -- (void)signInWithCustomTokenApp:(nonnull AuthPigeonFirebaseApp *)app - token:(nonnull NSString *)token - completion:(nonnull void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - - [auth signInWithCustomToken:token - completion:^(FIRAuthDataResult *_Nullable authResult, NSError *_Nullable error) { - if (error != nil) { - if (error.code == FIRAuthErrorCodeSecondFactorRequired) { - [self handleMultiFactorError:app completion:completion withError:error]; - } else if (error.code == FIRAuthErrorCodeInternalError) { - [self handleInternalError:completion withError:error]; - } else { - completion(nil, [FLTFirebaseAuthPlugin convertToFlutterError:error]); - } - } else { - completion([PigeonParser getPigeonUserCredentialFromAuthResult:authResult - authorizationCode:nil], - nil); - } - }]; -} - -- (void)signInWithEmailAndPasswordApp:(nonnull AuthPigeonFirebaseApp *)app - email:(nonnull NSString *)email - password:(nonnull NSString *)password - completion:(nonnull void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - [auth signInWithEmail:email - password:password - completion:^(FIRAuthDataResult *_Nullable authResult, NSError *_Nullable error) { - if (error != nil) { - if (error.code == FIRAuthErrorCodeSecondFactorRequired) { - [self handleMultiFactorError:app completion:completion withError:error]; - } else if (error.code == FIRAuthErrorCodeInternalError) { - [self handleInternalError:completion withError:error]; - } else { - completion(nil, [FLTFirebaseAuthPlugin convertToFlutterError:error]); - } - } else { - completion([PigeonParser getPigeonUserCredentialFromAuthResult:authResult - authorizationCode:nil], - nil); - } - }]; -} - -- (void)signInWithEmailLinkApp:(nonnull AuthPigeonFirebaseApp *)app - email:(nonnull NSString *)email - emailLink:(nonnull NSString *)emailLink - completion:(nonnull void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - [auth signInWithEmail:email - link:emailLink - completion:^(FIRAuthDataResult *_Nullable authResult, NSError *_Nullable error) { - if (error != nil) { - if (error.code == FIRAuthErrorCodeSecondFactorRequired) { - [self handleMultiFactorError:app completion:completion withError:error]; - } else if (error.code == FIRAuthErrorCodeInternalError) { - [self handleInternalError:completion withError:error]; - } else { - completion(nil, [FLTFirebaseAuthPlugin convertToFlutterError:error]); - } - } else { - completion([PigeonParser getPigeonUserCredentialFromAuthResult:authResult - authorizationCode:nil], - nil); - } - }]; -} - -- (void)signInWithProviderApp:(nonnull AuthPigeonFirebaseApp *)app - signInProvider:(nonnull InternalSignInProvider *)signInProvider - completion:(nonnull void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - - if ([signInProvider.providerId isEqualToString:kSignInMethodGameCenter]) { - completion( - nil, - [FlutterError - errorWithCode:@"sign-in-failure" - message: - @"Game Center sign-in requires signing in with 'signInWithCredential()' API." - details:@{}]); - return; - } - - if ([signInProvider.providerId isEqualToString:kSignInMethodApple]) { - self.signInWithAppleAuth = auth; - launchAppleSignInRequest(self, app, signInProvider, completion); - return; - } -#if TARGET_OS_OSX - completion(nil, - ProviderFlowUnsupportedOnMacOSError(@"signInWithProvider", signInProvider.providerId)); -#else - self.authProvider = [FIROAuthProvider providerWithProviderID:signInProvider.providerId auth:auth]; - NSArray *scopes = signInProvider.scopes; - if (scopes != nil) { - [self.authProvider setScopes:scopes]; - } - NSDictionary *customParameters = signInProvider.customParameters; - if (customParameters != nil) { - [self.authProvider setCustomParameters:customParameters]; - } - - [self.authProvider - getCredentialWithUIDelegate:nil - completion:^(FIRAuthCredential *_Nullable credential, - NSError *_Nullable error) { - handleAppleAuthResult(self, app, auth, credential, error, completion); - }]; -#endif -} - -- (void)signOutApp:(nonnull AuthPigeonFirebaseApp *)app - completion:(nonnull void (^)(FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - - if (auth.currentUser == nil) { - completion(nil); - return; - } - - NSError *signOutErrorPtr; - BOOL signOutSuccessful = [auth signOut:&signOutErrorPtr]; - - if (!signOutSuccessful) { - completion([FLTFirebaseAuthPlugin convertToFlutterError:signOutErrorPtr]); - } else { - completion(nil); - } -} - -- (void)useEmulatorApp:(nonnull AuthPigeonFirebaseApp *)app - host:(nonnull NSString *)host - port:(long)port - completion:(nonnull void (^)(FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - [auth useEmulatorWithHost:host port:port]; - _emulatorConfigs[app.appName] = @{@"host" : host, @"port" : @(port)}; - completion(nil); -} - -- (void)verifyPasswordResetCodeApp:(nonnull AuthPigeonFirebaseApp *)app - code:(nonnull NSString *)code - completion:(nonnull void (^)(NSString *_Nullable, - FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - - [auth verifyPasswordResetCode:code - completion:^(NSString *_Nullable email, NSError *_Nullable error) { - if (error != nil) { - completion(nil, [FLTFirebaseAuthPlugin convertToFlutterError:error]); - } else { - completion(email, nil); - } - }]; -} - -- (void)verifyPhoneNumberApp:(nonnull AuthPigeonFirebaseApp *)app - request:(nonnull InternalVerifyPhoneNumberRequest *)request - completion: - (nonnull void (^)(NSString *_Nullable, FlutterError *_Nullable))completion { -#if TARGET_OS_OSX - completion(nil, [FlutterError errorWithCode:kErrCodeUnsupportedPlatform - message:@"Phone authentication is not supported on macOS." - details:nil]); -#else - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - - NSString *name = [NSString - stringWithFormat:@"%@/phone/%@", kFLTFirebaseAuthChannelName, [NSUUID UUID].UUIDString]; - FlutterEventChannel *channel = [FlutterEventChannel eventChannelWithName:name - binaryMessenger:_binaryMessenger]; - - NSString *multiFactorSessionId = request.multiFactorSessionId; - FIRMultiFactorSession *multiFactorSession = nil; - - if (multiFactorSessionId != nil) { - multiFactorSession = _multiFactorSessionMap[multiFactorSessionId]; - } - - NSString *multiFactorInfoId = request.multiFactorInfoId; - - FIRPhoneMultiFactorInfo *multiFactorInfo = nil; - if (multiFactorInfoId != nil) { - for (NSString *resolverId in _multiFactorResolverMap) { - for (FIRMultiFactorInfo *info in _multiFactorResolverMap[resolverId].hints) { - if ([info.UID isEqualToString:multiFactorInfoId] && - [info class] == [FIRPhoneMultiFactorInfo class]) { - multiFactorInfo = (FIRPhoneMultiFactorInfo *)info; - break; - } - } - } - } - -#if TARGET_OS_OSX - FLTPhoneNumberVerificationStreamHandler *handler = - [[FLTPhoneNumberVerificationStreamHandler alloc] initWithAuth:auth]; -#else - FLTPhoneNumberVerificationStreamHandler *handler = - [[FLTPhoneNumberVerificationStreamHandler alloc] initWithAuth:auth - request:request - session:multiFactorSession - factorInfo:multiFactorInfo]; -#endif - - [channel setStreamHandler:handler]; - - [_eventChannels setObject:channel forKey:name]; - [_streamHandlers setObject:handler forKey:name]; - - completion(name, nil); -#endif -} - -- (void)deleteApp:(nonnull AuthPigeonFirebaseApp *)app - completion:(nonnull void (^)(FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - FIRUser *currentUser = auth.currentUser; - if (currentUser == nil) { - completion([FlutterError errorWithCode:kErrCodeNoCurrentUser - message:kErrMsgNoCurrentUser - details:nil]); - return; - } - - [currentUser deleteWithCompletion:^(NSError *_Nullable error) { - if (error != nil) { - completion([FLTFirebaseAuthPlugin convertToFlutterError:error]); - } else { - completion(nil); - } - }]; -} - -- (void)getIdTokenApp:(nonnull AuthPigeonFirebaseApp *)app - forceRefresh:(BOOL)forceRefresh - completion:(nonnull void (^)(InternalIdTokenResult *_Nullable, - FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - FIRUser *currentUser = auth.currentUser; - if (currentUser == nil) { - completion(nil, [FlutterError errorWithCode:kErrCodeNoCurrentUser - message:kErrMsgNoCurrentUser - details:nil]); - return; - } - - [currentUser - getIDTokenResultForcingRefresh:forceRefresh - completion:^(FIRAuthTokenResult *tokenResult, NSError *error) { - if (error != nil) { - completion(nil, [FLTFirebaseAuthPlugin convertToFlutterError:error]); - return; - } - - completion([PigeonParser parseIdTokenResult:tokenResult], nil); - }]; -} - -- (void)linkWithCredentialApp:(nonnull AuthPigeonFirebaseApp *)app - input:(nonnull NSDictionary *)input - completion:(nonnull void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - FIRUser *currentUser = auth.currentUser; - if (currentUser == nil) { - completion(nil, [FlutterError errorWithCode:kErrCodeNoCurrentUser - message:kErrMsgNoCurrentUser - details:nil]); - return; - } - - [self - getFIRAuthCredentialFromArguments:input - app:app - completion:^(FIRAuthCredential *credential, NSError *error) { - if (credential == nil) { - completion(nil, - [FlutterError errorWithCode:kErrCodeInvalidCredential - message:kErrMsgInvalidCredential - details:nil]); - return; - } - - if (error) { - completion(nil, - [FLTFirebaseAuthPlugin convertToFlutterError:error]); - } - - [currentUser - linkWithCredential:credential - completion:^(FIRAuthDataResult *authResult, - NSError *error) { - if (error != nil) { - if (error.code == - FIRAuthErrorCodeSecondFactorRequired) { - [self handleMultiFactorError:app - completion:completion - withError:error]; - } else { - completion(nil, [FLTFirebaseAuthPlugin - convertToFlutterError:error]); - } - } else { - completion( - [PigeonParser - getPigeonUserCredentialFromAuthResult: - authResult - authorizationCode:nil], - nil); - } - }]; - }]; -} - -- (void)linkWithProviderApp:(nonnull AuthPigeonFirebaseApp *)app - signInProvider:(nonnull InternalSignInProvider *)signInProvider - completion:(nonnull void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - FIRUser *currentUser = auth.currentUser; - if ([signInProvider.providerId isEqualToString:kSignInMethodGameCenter]) { - completion( - nil, - [FlutterError - errorWithCode:@"provider-link-failure" - message:@"Game Center provider requires linking with 'linkWithCredential()' API." - details:@{}]); - return; - } - - if (currentUser == nil) { - completion(nil, [FlutterError errorWithCode:kErrCodeNoCurrentUser - message:kErrMsgNoCurrentUser - details:nil]); - return; - } - - if ([signInProvider.providerId isEqualToString:kSignInMethodApple]) { - self.linkWithAppleUser = currentUser; - launchAppleSignInRequest(self, app, signInProvider, completion); - return; - } -#if TARGET_OS_OSX - completion(nil, - ProviderFlowUnsupportedOnMacOSError(@"linkWithProvider", signInProvider.providerId)); -#else - self.authProvider = [FIROAuthProvider providerWithProviderID:signInProvider.providerId]; - NSArray *scopes = signInProvider.scopes; - if (scopes != nil) { - [self.authProvider setScopes:scopes]; - } - NSDictionary *customParameters = signInProvider.customParameters; - if (customParameters != nil) { - [self.authProvider setCustomParameters:customParameters]; - } - - [currentUser - linkWithProvider:self.authProvider - UIDelegate:nil - completion:^(FIRAuthDataResult *authResult, NSError *error) { - handleAppleAuthResult(self, app, auth, authResult.credential, error, completion); - }]; -#endif -} - -- (void)reauthenticateWithCredentialApp:(nonnull AuthPigeonFirebaseApp *)app - input:(nonnull NSDictionary *)input - completion:(nonnull void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - FIRUser *currentUser = auth.currentUser; - if (currentUser == nil) { - completion(nil, [FlutterError errorWithCode:kErrCodeNoCurrentUser - message:kErrMsgNoCurrentUser - details:nil]); - return; - } - - [self - getFIRAuthCredentialFromArguments:input - app:app - completion:^(FIRAuthCredential *credential, NSError *error) { - if (credential == nil) { - completion(nil, - [FlutterError errorWithCode:kErrCodeInvalidCredential - message:kErrMsgInvalidCredential - details:nil]); - return; - } - - if (error) { - completion(nil, - [FLTFirebaseAuthPlugin convertToFlutterError:error]); - } - - [currentUser - reauthenticateWithCredential:credential - completion:^(FIRAuthDataResult *authResult, - NSError *error) { - if (error != nil) { - if (error.code == - FIRAuthErrorCodeSecondFactorRequired) { - [self handleMultiFactorError:app - completion:completion - withError:error]; - } else { - completion( - nil, - [FLTFirebaseAuthPlugin - convertToFlutterError:error]); - } - } else { - completion( - [PigeonParser - getPigeonUserCredentialFromAuthResult: - authResult - authorizationCode: - nil], - nil); - } - }]; - }]; -} - -- (void)reauthenticateWithProviderApp:(nonnull AuthPigeonFirebaseApp *)app - signInProvider:(nonnull InternalSignInProvider *)signInProvider - completion:(nonnull void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - FIRUser *currentUser = auth.currentUser; - if (currentUser == nil) { - completion(nil, [FlutterError errorWithCode:kErrCodeNoCurrentUser - message:kErrMsgNoCurrentUser - details:nil]); - return; - } - - if ([signInProvider.providerId isEqualToString:kSignInMethodApple]) { - self.isReauthenticatingWithApple = YES; - launchAppleSignInRequest(self, app, signInProvider, completion); - return; - } -#if TARGET_OS_OSX - completion(nil, ProviderFlowUnsupportedOnMacOSError(@"reauthenticateWithProvider", - signInProvider.providerId)); -#else - self.authProvider = [FIROAuthProvider providerWithProviderID:signInProvider.providerId]; - NSArray *scopes = signInProvider.scopes; - if (scopes != nil) { - [self.authProvider setScopes:scopes]; - } - NSDictionary *customParameters = signInProvider.customParameters; - if (customParameters != nil) { - [self.authProvider setCustomParameters:customParameters]; - } - - [currentUser reauthenticateWithProvider:self.authProvider - UIDelegate:nil - completion:^(FIRAuthDataResult *authResult, NSError *error) { - handleAppleAuthResult(self, app, auth, authResult.credential, - error, completion); - }]; -#endif -} - -- (void)reloadApp:(nonnull AuthPigeonFirebaseApp *)app - completion: - (nonnull void (^)(InternalUserDetails *_Nullable, FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - FIRUser *currentUser = auth.currentUser; - if (currentUser == nil) { - completion(nil, [FlutterError errorWithCode:kErrCodeNoCurrentUser - message:kErrMsgNoCurrentUser - details:nil]); - return; - } - - [currentUser reloadWithCompletion:^(NSError *_Nullable error) { - if (error != nil) { - completion(nil, [FLTFirebaseAuthPlugin convertToFlutterError:error]); - } else { - completion([PigeonParser getPigeonDetails:currentUser], nil); - } - }]; -} - -- (void)sendEmailVerificationApp:(nonnull AuthPigeonFirebaseApp *)app - actionCodeSettings:(nullable InternalActionCodeSettings *)actionCodeSettings - completion:(nonnull void (^)(FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - FIRUser *currentUser = auth.currentUser; - if (currentUser == nil) { - completion([FlutterError errorWithCode:kErrCodeNoCurrentUser - message:kErrMsgNoCurrentUser - details:nil]); - return; - } - - [currentUser - sendEmailVerificationWithActionCodeSettings:[PigeonParser - parseActionCodeSettings:actionCodeSettings] - - completion:^(NSError *_Nullable error) { - if (error != nil) { - completion( - [FLTFirebaseAuthPlugin convertToFlutterError:error]); - } else { - completion(nil); - } - }]; -} - -- (void)unlinkApp:(nonnull AuthPigeonFirebaseApp *)app - providerId:(nonnull NSString *)providerId - completion:(nonnull void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - FIRUser *currentUser = auth.currentUser; - if (currentUser == nil) { - completion(nil, [FlutterError errorWithCode:kErrCodeNoCurrentUser - message:kErrMsgNoCurrentUser - details:nil]); - return; - } - - [currentUser unlinkFromProvider:providerId - completion:^(FIRUser *_Nullable user, NSError *_Nullable error) { - if (error != nil) { - completion(nil, [FLTFirebaseAuthPlugin convertToFlutterError:error]); - } else { - completion([PigeonParser getPigeonUserCredentialFromFIRUser:user], nil); - } - }]; -} - -- (void)updateEmailApp:(nonnull AuthPigeonFirebaseApp *)app - newEmail:(nonnull NSString *)newEmail - completion:(nonnull void (^)(InternalUserDetails *_Nullable, - FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - FIRUser *currentUser = auth.currentUser; - if (currentUser == nil) { - completion(nil, [FlutterError errorWithCode:kErrCodeNoCurrentUser - message:kErrMsgNoCurrentUser - details:nil]); - return; - } - - [currentUser updateEmail:newEmail - completion:^(NSError *_Nullable error) { - if (error != nil) { - completion(nil, [FLTFirebaseAuthPlugin convertToFlutterError:error]); - } else { - [currentUser reloadWithCompletion:^(NSError *_Nullable reloadError) { - if (reloadError != nil) { - completion(nil, [FLTFirebaseAuthPlugin convertToFlutterError:reloadError]); - } else { - completion([PigeonParser getPigeonDetails:currentUser], nil); - } - }]; - } - }]; -} - -- (void)updatePasswordApp:(nonnull AuthPigeonFirebaseApp *)app - newPassword:(nonnull NSString *)newPassword - completion:(nonnull void (^)(InternalUserDetails *_Nullable, - FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - FIRUser *currentUser = auth.currentUser; - if (currentUser == nil) { - completion(nil, [FlutterError errorWithCode:kErrCodeNoCurrentUser - message:kErrMsgNoCurrentUser - details:nil]); - return; - } - - [currentUser - updatePassword:newPassword - completion:^(NSError *_Nullable error) { - if (error != nil) { - completion(nil, [FLTFirebaseAuthPlugin convertToFlutterError:error]); - } else { - [currentUser reloadWithCompletion:^(NSError *_Nullable reloadError) { - if (reloadError != nil) { - completion(nil, [FLTFirebaseAuthPlugin convertToFlutterError:reloadError]); - } else { - completion([PigeonParser getPigeonDetails:currentUser], nil); - } - }]; - } - }]; -} - -- (void)updatePhoneNumberApp:(nonnull AuthPigeonFirebaseApp *)app - input:(nonnull NSDictionary *)input - completion:(nonnull void (^)(InternalUserDetails *_Nullable, - FlutterError *_Nullable))completion { -#if TARGET_OS_IPHONE - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - FIRUser *currentUser = auth.currentUser; - if (currentUser == nil) { - completion(nil, [FlutterError errorWithCode:kErrCodeNoCurrentUser - message:kErrMsgNoCurrentUser - details:nil]); - return; - } - - [self - getFIRAuthCredentialFromArguments:input - app:app - completion:^(FIRAuthCredential *credential, NSError *error) { - if (credential == nil) { - completion(nil, - [FlutterError errorWithCode:kErrCodeInvalidCredential - message:kErrMsgInvalidCredential - details:nil]); - return; - } - - if (error) { - completion(nil, - [FLTFirebaseAuthPlugin convertToFlutterError:error]); - } - - [currentUser - updatePhoneNumberCredential:(FIRPhoneAuthCredential *)credential - completion:^(NSError *_Nullable error) { - if (error != nil) { - completion( - nil, [FLTFirebaseAuthPlugin - convertToFlutterError:error]); - } else { - [currentUser - reloadWithCompletion:^( - NSError *_Nullable reloadError) { - if (reloadError != nil) { - completion( - nil, [FLTFirebaseAuthPlugin - convertToFlutterError: - reloadError]); - } else { - completion( - [PigeonParser getPigeonDetails: - currentUser], - nil); - } - }]; - } - }]; - }]; -#else - NSLog(@"Updating a users phone number via Firebase Authentication is only " - @"supported on the iOS " - @"platform."); - completion(nil, nil); -#endif -} - -- (void)updateProfileApp:(nonnull AuthPigeonFirebaseApp *)app - profile:(nonnull InternalUserProfile *)profile - completion:(nonnull void (^)(InternalUserDetails *_Nullable, - FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - FIRUser *currentUser = auth.currentUser; - if (currentUser == nil) { - completion(nil, [FlutterError errorWithCode:kErrCodeNoCurrentUser - message:kErrMsgNoCurrentUser - details:nil]); - return; - } - - FIRUserProfileChangeRequest *changeRequest = [currentUser profileChangeRequest]; - - if (profile.displayNameChanged) { - changeRequest.displayName = profile.displayName; - } - - if (profile.photoUrlChanged) { - if (profile.photoUrl == nil) { - // We apparently cannot set photoURL to nil/NULL to remove it. - // Instead, setting it to empty string appears to work. - // When doing so, Dart will properly receive `null` anyway. - changeRequest.photoURL = [NSURL URLWithString:@""]; - } else { - changeRequest.photoURL = [NSURL URLWithString:profile.photoUrl]; - } - } - - [changeRequest commitChangesWithCompletion:^(NSError *error) { - if (error != nil) { - completion(nil, [FLTFirebaseAuthPlugin convertToFlutterError:error]); - } else { - [currentUser reloadWithCompletion:^(NSError *_Nullable reloadError) { - if (reloadError != nil) { - completion(nil, [FLTFirebaseAuthPlugin convertToFlutterError:reloadError]); - } else { - completion([PigeonParser getPigeonDetails:currentUser], nil); - } - }]; - } - }]; -} - -- (void)verifyBeforeUpdateEmailApp:(nonnull AuthPigeonFirebaseApp *)app - newEmail:(nonnull NSString *)newEmail - actionCodeSettings:(nullable InternalActionCodeSettings *)actionCodeSettings - completion:(nonnull void (^)(FlutterError *_Nullable))completion { - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - FIRUser *currentUser = auth.currentUser; - if (currentUser == nil) { - completion([FlutterError errorWithCode:kErrCodeNoCurrentUser - message:kErrMsgNoCurrentUser - details:nil]); - return; - } - - [currentUser - sendEmailVerificationBeforeUpdatingEmail:newEmail - actionCodeSettings:[PigeonParser - parseActionCodeSettings:actionCodeSettings] - completion:^(NSError *error) { - if (error != nil) { - completion( - [FLTFirebaseAuthPlugin convertToFlutterError:error]); - } else { - completion(nil); - } - }]; -} - -- (void)initializeRecaptchaConfigApp:(AuthPigeonFirebaseApp *)app - completion:(void (^)(FlutterError *_Nullable))completion { -#if TARGET_OS_OSX - NSLog(@"initializeRecaptchaConfigWithCompletion is not supported on the " - @"MacOS platform."); - completion(nil); -#else - FIRAuth *auth = [self getFIRAuthFromAppNameFromPigeon:app]; - [auth initializeRecaptchaConfigWithCompletion:^(NSError *_Nullable error) { - if (error != nil) { - completion([FLTFirebaseAuthPlugin convertToFlutterError:error]); - } else { - completion(nil); - } - }]; -#endif -} - -@end diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.swift b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.swift new file mode 100644 index 000000000000..5ca98110ecca --- /dev/null +++ b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.swift @@ -0,0 +1,1183 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import AuthenticationServices +import CommonCrypto +import FirebaseAuth +import FirebaseCore +import Foundation +import Security + +#if canImport(firebase_core) + import firebase_core +#else + import firebase_core_shared +#endif + +#if os(iOS) + import Flutter + import UIKit +#elseif os(macOS) + import AppKit + import FlutterMacOS +#endif + +extension FlutterError: Error {} + +@objc(FLTFirebaseAuthPlugin) +public class FLTFirebaseAuthPlugin: NSObject, FlutterPlugin, FLTFirebasePluginProtocol, + FirebaseAuthHostApi, ASAuthorizationControllerDelegate, + ASAuthorizationControllerPresentationContextProviding +{ + var messenger: FlutterBinaryMessenger + var authProvider: OAuthProvider? + var linkWithAppleUser: User? + var signInWithAppleAuth: Auth? + var isReauthenticatingWithApple = false + var currentNonce: String? + var appleCompletion: ((Result) -> Void)? + var appleArguments: AuthPigeonFirebaseApp? + var appleSignInRequestInFlight = false + + var multiFactorSessionMap: [String: MultiFactorSession] = [:] + var multiFactorResolverMap: [String: MultiFactorResolver] = [:] + var multiFactorAssertionMap: [String: MultiFactorAssertion] = [:] + var multiFactorTotpSecretMap: [String: TOTPSecret] = [:] + var emulatorConfigs: [String: [String: Any]] = [:] + var eventChannels: [String: FlutterEventChannel] = [:] + var streamHandlers: [String: any FlutterStreamHandler] = [:] + var apnsToken: Data? + + static var credentialsMap: [NSNumber: AuthCredential] = [:] + + init(messenger: FlutterBinaryMessenger) { + self.messenger = messenger + super.init() + FLTFirebasePluginRegistry.sharedInstance().register(self) + } + + @objc + public static func register(with registrar: FlutterPluginRegistrar) { + #if os(macOS) + let binaryMessenger = registrar.messenger + #else + let binaryMessenger = registrar.messenger() + #endif + + let channel = FlutterMethodChannel( + name: kFLTFirebaseAuthChannelName, binaryMessenger: binaryMessenger) + let instance = FLTFirebaseAuthPlugin(messenger: binaryMessenger) + registrar.addMethodCallDelegate(instance, channel: channel) + registrar.publish(instance) + registrar.addApplicationDelegate(instance) + #if os(iOS) + if registrar.responds(to: Selector(("addSceneDelegate:"))) { + registrar.perform(Selector(("addSceneDelegate:")), with: instance) + } + #endif + + FirebaseAuthHostApiSetup.setUp(binaryMessenger: binaryMessenger, api: instance) + FirebaseAuthUserHostApiSetup.setUp(binaryMessenger: binaryMessenger, api: instance) + MultiFactorUserHostApiSetup.setUp(binaryMessenger: binaryMessenger, api: instance) + MultiFactoResolverHostApiSetup.setUp(binaryMessenger: binaryMessenger, api: instance) + MultiFactorTotpHostApiSetup.setUp(binaryMessenger: binaryMessenger, api: instance) + MultiFactorTotpSecretHostApiSetup.setUp(binaryMessenger: binaryMessenger, api: instance) + } + + public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { + result(FlutterMethodNotImplemented) + } + + static func storeAuthCredentialIfPresent(_ error: NSError) -> NSNumber? { + if let authCredential = error.userInfo[AuthErrorUserInfoUpdatedCredentialKey] as? AuthCredential + { + let authCredentialHash = NSNumber(value: authCredential.hash) + credentialsMap[authCredentialHash] = authCredential + return authCredentialHash + } + return nil + } + + func cleanup(completion: (() -> Void)?) { + Self.credentialsMap.removeAll() + for channel in eventChannels.values { + channel.setStreamHandler(nil) + } + eventChannels.removeAll() + for handler in streamHandlers.values { + _ = handler.onCancel(withArguments: nil) + } + streamHandlers.removeAll() + completion?() + } + + public func detachFromEngine(for registrar: FlutterPluginRegistrar) { + cleanup(completion: nil) + } + + public func didReinitializeFirebaseCore(_ completion: @escaping () -> Void) { + cleanup(completion: completion) + } + + public func firebaseLibraryName() -> String { + kFirebaseAuthLibraryName + } + + public func firebaseLibraryVersion() -> String { + kFirebaseAuthLibraryVersion + } + + public func flutterChannelName() -> String { + kFLTFirebaseAuthChannelName + } + + public func pluginConstants(for firebaseApp: FirebaseApp) -> [AnyHashable: Any] { + let auth = Auth.auth(app: firebaseApp) + var constants: [AnyHashable: Any] = [ + "APP_LANGUAGE_CODE": auth.languageCode as Any + ] + if let currentUser = auth.currentUser { + constants["APP_CURRENT_USER"] = PigeonParser.getManualList( + PigeonParser.getPigeonDetails(currentUser)) + } else { + constants["APP_CURRENT_USER"] = NSNull() + } + return constants + } + + func getFIRAuthFromPigeon(_ pigeonApp: AuthPigeonFirebaseApp) -> Auth { + let app = FLTFirebasePlugin.firebaseAppNamed(pigeonApp.appName)! + let auth = Auth.auth(app: app) + auth.tenantID = pigeonApp.tenantId + auth.customAuthDomain = FLTFirebaseCorePlugin.getCustomDomain(app.name) + if let customAuthDomain = pigeonApp.customAuthDomain { + auth.customAuthDomain = customAuthDomain + } + return auth + } + + func getAppMultiFactorFromPigeon(_ app: AuthPigeonFirebaseApp) -> MultiFactor? { + getFIRAuthFromPigeon(app).currentUser?.multiFactor + } + + #if os(iOS) + #if !canImport(FirebaseMessaging) + public func application( + _ application: UIApplication, + didReceiveRemoteNotification notification: [AnyHashable: Any], + fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void + ) -> Bool { + if Auth.auth().canHandleNotification(notification) { + completionHandler(.noData) + return true + } + return false + } + #endif + + public func application( + _ application: UIApplication, + didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data + ) { + apnsToken = deviceToken + } + + public func application( + _ application: UIApplication, + open url: URL, + options: [UIApplication.OpenURLOptionsKey: Any] = [:] + ) -> Bool { + Auth.auth().canHandle(url) + } + + public func scene(_ scene: UIScene, openURLContexts URLContexts: Set) -> Bool { + for urlContext in URLContexts where Auth.auth().canHandle(urlContext.url) { + return true + } + return false + } + #endif + + func ensureAPNSTokenSetting() { + #if os(iOS) + if FirebaseApp.defaultApp() != nil { + if Auth.auth().apnsToken == nil, let apnsToken { + Auth.auth().setAPNSToken(apnsToken, type: .unknown) + self.apnsToken = nil + } + } + #endif + } + + func randomNonce(_ length: Int) -> String { + precondition(length > 0) + let characterSet = Array("0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-._") + var result = "" + var remainingLength = length + while remainingLength > 0 { + var randoms = [UInt8](repeating: 0, count: 16) + let errorCode = SecRandomCopyBytes(kSecRandomDefault, randoms.count, &randoms) + precondition(errorCode == errSecSuccess, "Unable to generate nonce: OSStatus \(errorCode)") + for random in randoms { + if remainingLength == 0 { break } + if Int(random) < characterSet.count { + result.append(characterSet[Int(random)]) + remainingLength -= 1 + } + } + } + return result + } + + func stringBySha256HashingString(_ input: String) -> String { + let data = Data(input.utf8) + var hash = [UInt8](repeating: 0, count: Int(CC_SHA256_DIGEST_LENGTH)) + data.withUnsafeBytes { buffer in + _ = CC_SHA256(buffer.baseAddress, CC_LONG(data.count), &hash) + } + return hash.map { String(format: "%02x", $0) }.joined() + } + + func handleMultiFactorError( + app: AuthPigeonFirebaseApp, + error: Error, + completion: @escaping (Result) -> Void + ) { + let nsError = error as NSError + guard + let resolver = nsError.userInfo[AuthErrorUserInfoMultiFactorResolverKey] as? MultiFactorResolver + else { + completion(.failure(AuthErrors.convertToFlutterError(error))) + return + } + + let sessionId = UUID().uuidString + multiFactorSessionMap[sessionId] = resolver.session + let resolverId = UUID().uuidString + multiFactorResolverMap[resolverId] = resolver + + let pigeonHints: [[Any?]] = resolver.hints.map { info in + var phoneNumber: String? + if let phoneInfo = info as? PhoneMultiFactorInfo { + phoneNumber = phoneInfo.phoneNumber + } + return InternalMultiFactorInfo( + displayName: info.displayName, + enrollmentTimestamp: info.enrollmentDate.timeIntervalSince1970, + factorId: info.factorID, + uid: info.uid, + phoneNumber: phoneNumber + ).toList() + } + + let output: [String: Any] = [ + "appName": app.appName, + "multiFactorHints": pigeonHints, + "multiFactorSessionId": sessionId, + "multiFactorResolverId": resolverId, + ] + completion( + .failure( + FlutterError( + code: "second-factor-required", message: nsError.description, details: output))) + } + + func handleInternalError( + error: Error, + completion: @escaping (Result) -> Void + ) { + let nsError = error as NSError + if let underlyingError = nsError.userInfo[NSUnderlyingErrorKey] as? NSError, + let details = underlyingError.userInfo["FIRAuthErrorUserInfoDeserializedResponseKey"] + { + completion( + .failure( + FlutterError(code: "internal-error", message: nsError.description, details: details))) + return + } + completion( + .failure(FlutterError(code: "internal-error", message: nsError.description, details: nil))) + } + + func handleAppleAuthResult( + app: AuthPigeonFirebaseApp, + auth: Auth, + credentials: AuthCredential?, + error: Error?, + completion: @escaping (Result) -> Void + ) { + if let error { + let nsError = error as NSError + if nsError.code == AuthErrorCode.secondFactorRequired.rawValue { + handleMultiFactorError(app: app, error: error, completion: completion) + } else { + completion(.failure(AuthErrors.convertToFlutterError(error))) + } + return + } + guard let credentials else { return } + auth.signIn(with: credentials) { authResult, error in + if let error { + let nsError = error as NSError + let userInfo = nsError.userInfo + let underlyingError = userInfo[NSUnderlyingErrorKey] as? NSError + let firebaseDictionary = + underlyingError?.userInfo["FIRAuthErrorUserInfoDeserializedResponseKey"] as? [String: Any] + let errorCode = userInfo[AuthErrorUserInfoNameKey] as? String + + if firebaseDictionary == nil, let errorCode { + if errorCode == "ERROR_ACCOUNT_EXISTS_WITH_DIFFERENT_CREDENTIAL" { + completion(.failure(AuthErrors.convertToFlutterError(error))) + return + } + var mutableUserInfo = userInfo + mutableUserInfo.removeValue(forKey: AuthErrorUserInfoUpdatedCredentialKey) + completion( + .failure( + FlutterError( + code: "sign-in-failed", + message: userInfo[NSLocalizedDescriptionKey] as? String, + details: mutableUserInfo + ))) + } else if let message = firebaseDictionary?["message"] { + completion( + .failure( + FlutterError( + code: "sign-in-failed", + message: nsError.localizedDescription, + details: message + ))) + } else { + completion( + .failure( + FlutterError( + code: "sign-in-failed", + message: nsError.localizedDescription, + details: userInfo + ))) + } + } else if let authResult { + completion( + .success( + PigeonParser.getPigeonUserCredentialFromAuthResult( + authResult, authorizationCode: nil))) + } + } + } + + func launchAppleSignInRequest( + app: AuthPigeonFirebaseApp, + signInProvider: InternalSignInProvider, + completion: @escaping (Result) -> Void + ) { + if appleSignInRequestInFlight { + completion( + .failure( + FlutterError( + code: "operation-not-allowed", + message: "A Sign in with Apple request is already in progress.", + details: nil))) + return + } + + let nonce = randomNonce(32) + currentNonce = nonce + appleCompletion = completion + appleArguments = app + appleSignInRequestInFlight = true + + let appleIDProvider = ASAuthorizationAppleIDProvider() + let request = appleIDProvider.createRequest() + var requestedScopes: [ASAuthorization.Scope] = [] + if signInProvider.scopes?.contains("name") == true { + requestedScopes.append(.fullName) + } + if signInProvider.scopes?.contains("email") == true { + requestedScopes.append(.email) + } + request.requestedScopes = requestedScopes + request.nonce = stringBySha256HashingString(nonce) + + let authorizationController = ASAuthorizationController(authorizationRequests: [request]) + authorizationController.delegate = self + authorizationController.presentationContextProvider = self + authorizationController.performRequests() + } + + public func presentationAnchor(for controller: ASAuthorizationController) -> ASPresentationAnchor { + #if os(macOS) + return NSApplication.shared.keyWindow ?? ASPresentationAnchor() + #else + if #available(iOS 15.0, *) { + for scene in UIApplication.shared.connectedScenes { + if scene.activationState == .foregroundActive, let windowScene = scene as? UIWindowScene, + let keyWindow = windowScene.keyWindow + { + return keyWindow + } + } + } else if #available(iOS 13.0, *) { + for scene in UIApplication.shared.connectedScenes { + if scene.activationState == .foregroundActive, let windowScene = scene as? UIWindowScene { + if let keyWindow = windowScene.windows.first(where: { $0.isKeyWindow }) { + return keyWindow + } + } + } + } + return UIApplication.shared.keyWindow ?? ASPresentationAnchor() + #endif + } + + public func authorizationController( + controller: ASAuthorizationController, + didCompleteWithAuthorization authorization: ASAuthorization + ) { + guard let appleIDCredential = authorization.credential as? ASAuthorizationAppleIDCredential + else { + let completion = appleCompletion + appleCompletion = nil + appleSignInRequestInFlight = false + completion?(.failure(AuthErrors.invalidCredential())) + return + } + + guard let rawNonce = currentNonce else { + return + } + + guard let identityToken = appleIDCredential.identityToken else { + let completion = appleCompletion + appleCompletion = nil + appleSignInRequestInFlight = false + completion?(.failure(AuthErrors.invalidCredential())) + return + } + + let idToken = String(data: identityToken, encoding: .utf8) + var authorizationCode: String? + if let code = appleIDCredential.authorizationCode { + authorizationCode = String(data: code, encoding: .utf8) + } + + guard let idToken else { return } + let credential = OAuthProvider.appleCredential( + withIDToken: idToken, rawNonce: rawNonce, fullName: appleIDCredential.fullName) + + if isReauthenticatingWithApple { + isReauthenticatingWithApple = false + Auth.auth().currentUser?.reauthenticate(with: credential) { authResult, error in + self.handleSignInWithApple(authResult: authResult, authorizationCode: authorizationCode, error: error) + } + } else if let userToLink = linkWithAppleUser { + userToLink.link(with: credential) { authResult, error in + self.linkWithAppleUser = nil + self.handleSignInWithApple(authResult: authResult, authorizationCode: authorizationCode, error: error) + } + } else { + let signInAuth = signInWithAppleAuth ?? Auth.auth() + signInAuth.signIn(with: credential) { authResult, error in + self.signInWithAppleAuth = nil + self.handleSignInWithApple(authResult: authResult, authorizationCode: authorizationCode, error: error) + } + } + } + + public func authorizationController( + controller: ASAuthorizationController, didCompleteWithError error: Error + ) { + let completion = appleCompletion + appleCompletion = nil + appleSignInRequestInFlight = false + guard let completion else { return } + + let nsError = error as NSError + switch nsError.code { + case ASAuthorizationError.canceled.rawValue: + completion( + .failure( + FlutterError( + code: "canceled", message: "The user canceled the authorization attempt.", details: nil) + )) + case ASAuthorizationError.invalidResponse.rawValue: + completion( + .failure( + FlutterError( + code: "invalid-response", + message: "The authorization request received an invalid response.", details: nil))) + case ASAuthorizationError.notHandled.rawValue: + completion( + .failure( + FlutterError( + code: "not-handled", message: "The authorization request wasn’t handled.", details: nil) + )) + case ASAuthorizationError.failed.rawValue: + completion( + .failure( + FlutterError( + code: "failed", message: "The authorization attempt failed.", details: nil))) + default: + completion(.failure(AuthErrors.convertAppleAuthorizationErrorToFlutterError(error))) + } + } + + func handleSignInWithApple( + authResult: AuthDataResult?, authorizationCode: String?, error: Error? + ) { + guard let completion = appleCompletion else { + appleSignInRequestInFlight = false + return + } + if let error { + if (error as NSError).code == AuthErrorCode.secondFactorRequired.rawValue, + let appleArguments + { + appleCompletion = nil + appleSignInRequestInFlight = false + handleMultiFactorError(app: appleArguments, error: error, completion: completion) + } else { + appleCompletion = nil + appleSignInRequestInFlight = false + completion(.failure(AuthErrors.convertToFlutterError(error))) + } + return + } + appleCompletion = nil + appleSignInRequestInFlight = false + if let authResult { + completion( + .success( + PigeonParser.getPigeonUserCredentialFromAuthResult( + authResult, authorizationCode: authorizationCode))) + } + } + + func getFIRAuthCredentialFromArguments( + _ arguments: [String?: Any?], + app: AuthPigeonFirebaseApp, + completion: @escaping (AuthCredential?, Error?) -> Void + ) { + if let token = arguments["token"], !(token is NSNull) { + let credentialHashCode = token as? NSNumber ?? NSNumber(value: (token as? Int) ?? 0) + if let stored = Self.credentialsMap[credentialHashCode] { + completion(stored, nil) + return + } + } + + let signInMethod = arguments["signInMethod"] as? String + if signInMethod == kSignInMethodGameCenter { + GameCenterAuthProvider.getCredential { credential, error in + completion(credential, error) + } + return + } + + func str(_ key: String) -> String? { + guard let value = arguments[key], !(value is NSNull) else { return nil } + return value as? String + } + + let secret = str("secret") + let idToken = str("idToken") + let accessToken = str("accessToken") + let rawNonce = str("rawNonce") + + switch signInMethod { + case kSignInMethodPassword: + completion(EmailAuthProvider.credential(withEmail: str("email") ?? "", password: secret ?? ""), nil) + case kSignInMethodEmailLink: + completion( + EmailAuthProvider.credential(withEmail: str("email") ?? "", link: str("emailLink") ?? ""), + nil) + case kSignInMethodFacebook: + completion(FacebookAuthProvider.credential(withAccessToken: accessToken ?? ""), nil) + case kSignInMethodGoogle: + completion( + GoogleAuthProvider.credential(withIDToken: idToken ?? "", accessToken: accessToken ?? ""), + nil) + case kSignInMethodTwitter: + completion( + TwitterAuthProvider.credential(withToken: accessToken ?? "", secret: secret ?? ""), nil) + case kSignInMethodGithub: + completion(GitHubAuthProvider.credential(withToken: accessToken ?? ""), nil) + case kSignInMethodPhone: + #if os(iOS) + completion( + PhoneAuthProvider.provider(auth: getFIRAuthFromPigeon(app)).credential( + withVerificationID: str("verificationId") ?? "", + verificationCode: str("smsCode") ?? ""), nil) + #else + print( + "The Firebase Phone Authentication provider is not supported on the MacOS platform.") + completion(nil, nil) + #endif + if signInMethod == kSignInMethodApple { + if let idToken, let rawNonce { + var fullName = PersonNameComponents() + fullName.givenName = str("givenName") + fullName.familyName = str("familyName") + fullName.nickname = str("nickname") + fullName.namePrefix = str("namePrefix") + fullName.nameSuffix = str("nameSuffix") + fullName.middleName = str("middleName") + completion( + OAuthProvider.appleCredential( + withIDToken: idToken, rawNonce: rawNonce, fullName: fullName), nil) + } else { + completion(nil, nil) + } + case kSignInMethodOAuth: + let providerId = str("providerId") ?? "" + let token = idToken ?? "" + // Keep the nil-accessToken path off the non-null 4-arg selector (#18450). + if let accessToken { + if let rawNonce { + completion( + OAuthProvider.credential( + withProviderID: providerId, idToken: token, rawNonce: rawNonce, + accessToken: accessToken), + nil) + } else { + completion( + OAuthProvider.credential( + withProviderID: providerId, idToken: token, accessToken: accessToken), + nil) + } + } else if let rawNonce { + completion( + OAuthProvider.credential(withProviderID: providerId, idToken: token, rawNonce: rawNonce), + nil) + } else { + completion( + OAuthProvider.credential(withProviderID: providerId, idToken: token, accessToken: nil), + nil) + } + default: + print("Support for an auth provider with identifier '\(signInMethod ?? "")' is not implemented.") + completion(nil, nil) + } + } + + func completeUserCredential( + app: AuthPigeonFirebaseApp, + authResult: AuthDataResult?, + error: Error?, + completion: @escaping (Result) -> Void + ) { + if let error { + let nsError = error as NSError + if nsError.code == AuthErrorCode.secondFactorRequired.rawValue { + handleMultiFactorError(app: app, error: error, completion: completion) + } else if nsError.code == AuthErrorCode.internalError.rawValue { + handleInternalError(error: error, completion: completion) + } else { + completion(.failure(AuthErrors.convertToFlutterError(error))) + } + } else if let authResult { + completion( + .success( + PigeonParser.getPigeonUserCredentialFromAuthResult(authResult, authorizationCode: nil))) + } + } + + func completeVoid(_ error: Error?, completion: @escaping (Result) -> Void) { + if let error { + completion(.failure(AuthErrors.convertToFlutterError(error))) + } else { + completion(.success(())) + } + } + + // MARK: - FirebaseAuthHostApi + + func registerIdTokenListener( + app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void + ) { + let auth = getFIRAuthFromPigeon(app) + let name = "\(kFLTFirebaseAuthChannelName)/id-token/\(auth.app!.name)" + let channel = FlutterEventChannel(name: name, binaryMessenger: messenger) + let handler = FLTIdTokenChannelStreamHandler(auth: auth) + channel.setStreamHandler(handler) + eventChannels[name] = channel + streamHandlers[name] = handler + completion(.success(name)) + } + + func registerAuthStateListener( + app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void + ) { + let auth = getFIRAuthFromPigeon(app) + let name = "\(kFLTFirebaseAuthChannelName)/auth-state/\(auth.app!.name)" + let channel = FlutterEventChannel(name: name, binaryMessenger: messenger) + let handler = FLTAuthStateChannelStreamHandler(auth: auth) + channel.setStreamHandler(handler) + eventChannels[name] = channel + streamHandlers[name] = handler + completion(.success(name)) + } + + func useEmulator( + app: AuthPigeonFirebaseApp, host: String, port: Int64, + completion: @escaping (Result) -> Void + ) { + let auth = getFIRAuthFromPigeon(app) + auth.useEmulator(withHost: host, port: Int(port)) + emulatorConfigs[app.appName] = ["host": host, "port": Int(port)] + completion(.success(())) + } + + func applyActionCode( + app: AuthPigeonFirebaseApp, code: String, completion: @escaping (Result) -> Void + ) { + getFIRAuthFromPigeon(app).applyActionCode(code) { error in + self.completeVoid(error, completion: completion) + } + } + + func checkActionCode( + app: AuthPigeonFirebaseApp, code: String, + completion: @escaping (Result) -> Void + ) { + getFIRAuthFromPigeon(app).checkActionCode(code) { info, error in + if let error { + completion(.failure(AuthErrors.convertToFlutterError(error))) + } else if let info { + let result = self.parseActionCode(info) + if result.operation == .unknown { + self.resolveActionCodeOperation( + app: app, code: code, fallbackInfo: result, completion: completion) + } else { + completion(.success(result)) + } + } + } + } + + func parseActionCode(_ info: ActionCodeInfo) -> InternalActionCodeInfo { + let data = InternalActionCodeInfoData(email: info.email, previousEmail: info.previousEmail) + let operation: ActionCodeInfoOperation + switch info.operation { + case .passwordReset: operation = .passwordReset + case .verifyEmail: operation = .verifyEmail + case .recoverEmail: operation = .recoverEmail + case .emailLink: operation = .emailSignIn + case .verifyAndChangeEmail: operation = .verifyAndChangeEmail + case .revertSecondFactorAddition: operation = .revertSecondFactorAddition + default: operation = .unknown + } + return InternalActionCodeInfo(operation: operation, data: data) + } + + func operationFromRequestType(_ requestType: String?) -> ActionCodeInfoOperation { + switch requestType { + case "PASSWORD_RESET", "resetPassword": return .passwordReset + case "VERIFY_EMAIL", "verifyEmail": return .verifyEmail + case "RECOVER_EMAIL", "recoverEmail": return .recoverEmail + case "EMAIL_SIGNIN", "signIn": return .emailSignIn + case "VERIFY_AND_CHANGE_EMAIL", "verifyAndChangeEmail": return .verifyAndChangeEmail + case "REVERT_SECOND_FACTOR_ADDITION", "revertSecondFactorAddition": + return .revertSecondFactorAddition + default: return .unknown + } + } + + func resolveActionCodeOperation( + app: AuthPigeonFirebaseApp, code: String, fallbackInfo: InternalActionCodeInfo, + completion: @escaping (Result) -> Void + ) { + guard let firebaseApp = FLTFirebasePlugin.firebaseAppNamed(app.appName), + let apiKey = firebaseApp.options.apiKey + else { + completion(.success(fallbackInfo)) + return + } + + let baseURL: String + if let emulatorConfig = emulatorConfigs[app.appName], + let host = emulatorConfig["host"], let port = emulatorConfig["port"] + { + baseURL = "http://\(host):\(port)/identitytoolkit.googleapis.com" + } else { + baseURL = "https://identitytoolkit.googleapis.com" + } + + guard let url = URL(string: "\(baseURL)/v1/accounts:resetPassword?key=\(apiKey)") else { + completion(.success(fallbackInfo)) + return + } + var request = URLRequest(url: url) + request.httpMethod = "POST" + request.setValue("application/json", forHTTPHeaderField: "Content-Type") + request.httpBody = try? JSONSerialization.data(withJSONObject: ["oobCode": code]) + + URLSession.shared.dataTask(with: request) { data, _, error in + guard error == nil, let data, + let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any], + json["error"] == nil + else { + completion(.success(fallbackInfo)) + return + } + let operation = self.operationFromRequestType(json["requestType"] as? String) + if operation != .unknown { + completion(.success(InternalActionCodeInfo(operation: operation, data: fallbackInfo.data))) + } else { + completion(.success(fallbackInfo)) + } + }.resume() + } + + func confirmPasswordReset( + app: AuthPigeonFirebaseApp, code: String, newPassword: String, + completion: @escaping (Result) -> Void + ) { + getFIRAuthFromPigeon(app).confirmPasswordReset(withCode: code, newPassword: newPassword) { + error in + self.completeVoid(error, completion: completion) + } + } + + func createUserWithEmailAndPassword( + app: AuthPigeonFirebaseApp, email: String, password: String, + completion: @escaping (Result) -> Void + ) { + getFIRAuthFromPigeon(app).createUser(withEmail: email, password: password) { + authResult, error in + self.completeUserCredential( + app: app, authResult: authResult, error: error, completion: completion) + } + } + + func signInAnonymously( + app: AuthPigeonFirebaseApp, + completion: @escaping (Result) -> Void + ) { + getFIRAuthFromPigeon(app).signInAnonymously { authResult, error in + self.completeUserCredential( + app: app, authResult: authResult, error: error, completion: completion) + } + } + + func signInWithCredential( + app: AuthPigeonFirebaseApp, input: [String?: Any?], + completion: @escaping (Result) -> Void + ) { + let auth = getFIRAuthFromPigeon(app) + getFIRAuthCredentialFromArguments(input, app: app) { credential, error in + if credential == nil { + completion(.failure(AuthErrors.invalidCredential())) + return + } + if let error { + completion(.failure(AuthErrors.convertToFlutterError(error))) + } + guard let credential else { return } + auth.signIn(with: credential) { authResult, error in + if let error { + let nsError = error as NSError + let underlyingError = nsError.userInfo[NSUnderlyingErrorKey] as? NSError + let firebaseDictionary = + underlyingError?.userInfo["FIRAuthErrorUserInfoDeserializedResponseKey"] + as? [String: Any] + if let firebaseDictionary, firebaseDictionary["message"] != nil { + if firebaseDictionary["code"] is NSNumber { + self.handleInternalError(error: error, completion: completion) + } else { + completion( + .failure( + FlutterError( + code: firebaseDictionary["code"] as? String ?? "sign-in-failed", + message: firebaseDictionary["message"] as? String, + details: nil))) + } + } else if nsError.code == AuthErrorCode.secondFactorRequired.rawValue { + self.handleMultiFactorError(app: app, error: error, completion: completion) + } else if nsError.code == AuthErrorCode.internalError.rawValue { + self.handleInternalError(error: error, completion: completion) + } else { + completion(.failure(AuthErrors.convertToFlutterError(error))) + } + } else if let authResult { + completion( + .success( + PigeonParser.getPigeonUserCredentialFromAuthResult( + authResult, authorizationCode: nil))) + } + } + } + } + + func signInWithCustomToken( + app: AuthPigeonFirebaseApp, token: String, + completion: @escaping (Result) -> Void + ) { + getFIRAuthFromPigeon(app).signIn(withCustomToken: token) { authResult, error in + self.completeUserCredential( + app: app, authResult: authResult, error: error, completion: completion) + } + } + + func signInWithEmailAndPassword( + app: AuthPigeonFirebaseApp, email: String, password: String, + completion: @escaping (Result) -> Void + ) { + getFIRAuthFromPigeon(app).signIn(withEmail: email, password: password) { authResult, error in + self.completeUserCredential( + app: app, authResult: authResult, error: error, completion: completion) + } + } + + func signInWithEmailLink( + app: AuthPigeonFirebaseApp, email: String, emailLink: String, + completion: @escaping (Result) -> Void + ) { + getFIRAuthFromPigeon(app).signIn(withEmail: email, link: emailLink) { authResult, error in + self.completeUserCredential( + app: app, authResult: authResult, error: error, completion: completion) + } + } + + func signInWithProvider( + app: AuthPigeonFirebaseApp, signInProvider: InternalSignInProvider, + completion: @escaping (Result) -> Void + ) { + let auth = getFIRAuthFromPigeon(app) + if signInProvider.providerId == kSignInMethodGameCenter { + completion( + .failure( + FlutterError( + code: "sign-in-failure", + message: + "Game Center sign-in requires signing in with 'signInWithCredential()' API.", + details: [:]))) + return + } + if signInProvider.providerId == kSignInMethodApple { + signInWithAppleAuth = auth + launchAppleSignInRequest(app: app, signInProvider: signInProvider, completion: completion) + return + } + #if os(macOS) + print("signInWithProvider is not supported on the MacOS platform.") + completion( + .failure( + FlutterError( + code: "unsupported-platform", message: "signInWithProvider is not supported on macOS", + details: nil))) + #else + authProvider = OAuthProvider(providerID: signInProvider.providerId, auth: auth) + if let scopes = signInProvider.scopes { + authProvider?.scopes = scopes.compactMap { $0 } + } + if let customParameters = signInProvider.customParameters { + var converted: [String: String] = [:] + for (key, value) in customParameters { + if let key, let value { converted[key] = value } + } + authProvider?.customParameters = converted + } + authProvider?.getCredentialWith(nil) { credential, error in + self.handleAppleAuthResult( + app: app, auth: auth, credentials: credential, error: error, completion: completion) + } + #endif + } + + func signOut(app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void) { + let auth = getFIRAuthFromPigeon(app) + if auth.currentUser == nil { + completion(.success(())) + return + } + do { + try auth.signOut() + completion(.success(())) + } catch { + completion(.failure(AuthErrors.convertToFlutterError(error))) + } + } + + func fetchSignInMethodsForEmail( + app: AuthPigeonFirebaseApp, email: String, + completion: @escaping (Result<[String], Error>) -> Void + ) { + getFIRAuthFromPigeon(app).fetchSignInMethods(forEmail: email) { providers, error in + if let error { + completion(.failure(AuthErrors.convertToFlutterError(error))) + } else { + completion(.success(providers ?? [])) + } + } + } + + func sendPasswordResetEmail( + app: AuthPigeonFirebaseApp, email: String, actionCodeSettings: InternalActionCodeSettings?, + completion: @escaping (Result) -> Void + ) { + let auth = getFIRAuthFromPigeon(app) + if let actionCodeSettings, let settings = PigeonParser.parseActionCodeSettings(actionCodeSettings) + { + auth.sendPasswordReset(withEmail: email, actionCodeSettings: settings) { error in + self.completeVoid(error, completion: completion) + } + } else { + auth.sendPasswordReset(withEmail: email) { error in + self.completeVoid(error, completion: completion) + } + } + } + + func sendSignInLinkToEmail( + app: AuthPigeonFirebaseApp, email: String, actionCodeSettings: InternalActionCodeSettings, + completion: @escaping (Result) -> Void + ) { + guard let settings = PigeonParser.parseActionCodeSettings(actionCodeSettings) else { + completion(.success(())) + return + } + getFIRAuthFromPigeon(app).sendSignInLink(toEmail: email, actionCodeSettings: settings) { + error in + if let error { + if (error as NSError).code == AuthErrorCode.internalError.rawValue { + self.handleInternalError(error: error) { result in + if case .failure(let internalError) = result { + completion(.failure(internalError)) + } + } + } else { + completion(.failure(AuthErrors.convertToFlutterError(error))) + } + } else { + completion(.success(())) + } + } + } + + func setLanguageCode( + app: AuthPigeonFirebaseApp, languageCode: String?, + completion: @escaping (Result) -> Void + ) { + let auth = getFIRAuthFromPigeon(app) + if let languageCode { + auth.languageCode = languageCode + } else { + auth.useAppLanguage() + } + completion(.success(auth.languageCode ?? "")) + } + + func setSettings( + app: AuthPigeonFirebaseApp, settings: InternalFirebaseAuthSettings, + completion: @escaping (Result) -> Void + ) { + let auth = getFIRAuthFromPigeon(app) + if let userAccessGroup = settings.userAccessGroup { + do { + try auth.useUserAccessGroup(userAccessGroup) + } catch { + completion(.failure(AuthErrors.convertToFlutterError(error))) + return + } + } + #if os(iOS) + if settings.appVerificationDisabledForTesting { + auth.settings?.isAppVerificationDisabledForTesting = settings.appVerificationDisabledForTesting + } + #else + print("FIRAuthSettings.appVerificationDisabledForTesting is not supported on MacOS.") + #endif + completion(.success(())) + } + + func verifyPasswordResetCode( + app: AuthPigeonFirebaseApp, code: String, completion: @escaping (Result) -> Void + ) { + getFIRAuthFromPigeon(app).verifyPasswordResetCode(code) { email, error in + if let error { + completion(.failure(AuthErrors.convertToFlutterError(error))) + } else { + completion(.success(email ?? "")) + } + } + } + + func verifyPhoneNumber( + app: AuthPigeonFirebaseApp, request: InternalVerifyPhoneNumberRequest, + completion: @escaping (Result) -> Void + ) { + #if os(macOS) + print("The Firebase Phone Authentication provider is not supported on the MacOS platform.") + completion( + .failure( + FlutterError( + code: "unsupported-platform", + message: "Phone authentication is not supported on macOS", details: nil))) + #else + let auth = getFIRAuthFromPigeon(app) + let name = "\(kFLTFirebaseAuthChannelName)/phone/\(UUID().uuidString)" + let channel = FlutterEventChannel(name: name, binaryMessenger: messenger) + var multiFactorSession: MultiFactorSession? + if let multiFactorSessionId = request.multiFactorSessionId { + multiFactorSession = multiFactorSessionMap[multiFactorSessionId] + } + var multiFactorInfo: PhoneMultiFactorInfo? + if let multiFactorInfoId = request.multiFactorInfoId { + for resolver in multiFactorResolverMap.values { + for info in resolver.hints { + if info.uid == multiFactorInfoId, let phoneInfo = info as? PhoneMultiFactorInfo { + multiFactorInfo = phoneInfo + break + } + } + } + } + let handler = FLTPhoneNumberVerificationStreamHandler( + auth: auth, request: request, session: multiFactorSession, factorInfo: multiFactorInfo) + channel.setStreamHandler(handler) + eventChannels[name] = channel + streamHandlers[name] = handler + completion(.success(name)) + #endif + } + + func revokeTokenWithAuthorizationCode( + app: AuthPigeonFirebaseApp, authorizationCode: String, + completion: @escaping (Result) -> Void + ) { + getFIRAuthFromPigeon(app).revokeToken(withAuthorizationCode: authorizationCode) { error in + self.completeVoid(error, completion: completion) + } + } + + func revokeAccessToken( + app: AuthPigeonFirebaseApp, accessToken: String, + completion: @escaping (Result) -> Void + ) { + completion( + .failure( + FlutterError( + code: "unsupported-platform-operation", + message: + "revokeAccessToken is not supported on iOS/macOS. Use revokeTokenWithAuthorizationCode instead.", + details: nil))) + } + + func initializeRecaptchaConfig( + app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void + ) { + #if os(macOS) + print("initializeRecaptchaConfigWithCompletion is not supported on the MacOS platform.") + completion(.success(())) + #else + getFIRAuthFromPigeon(app).initializeRecaptchaConfig { error in + self.completeVoid(error, completion: completion) + } + #endif + } +} + +#if os(iOS) + extension FLTFirebaseAuthPlugin: FlutterSceneLifeCycleDelegate {} +#endif diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTIdTokenChannelStreamHandler.m b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTIdTokenChannelStreamHandler.m deleted file mode 100644 index 315bc5ecd660..000000000000 --- a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTIdTokenChannelStreamHandler.m +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -@import FirebaseAuth; -#import "include/Private/FLTIdTokenChannelStreamHandler.h" -#import -#import "include/Private/PigeonParser.h" -#import "include/Public/FLTFirebaseAuthPlugin.h" - -@implementation FLTIdTokenChannelStreamHandler { - FIRAuth *_auth; - FIRIDTokenDidChangeListenerHandle _listener; -} - -- (instancetype)initWithAuth:(FIRAuth *)auth { - self = [super init]; - if (self) { - _auth = auth; - } - return self; -} - -- (FlutterError *)onListenWithArguments:(id)arguments eventSink:(FlutterEventSink)events { - bool __block initialAuthState = YES; - - _listener = [_auth addIDTokenDidChangeListener:^(FIRAuth *_Nonnull auth, - FIRUser *_Nullable user) { - if (initialAuthState) { - initialAuthState = NO; - return; - } - - if (user) { - events(@{ - @"user" : [PigeonParser getManualList:[PigeonParser getPigeonDetails:[auth currentUser]]] - }); - } else { - events(@{@"user" : [NSNull null]}); - } - }]; - - return nil; -} - -- (FlutterError *)onCancelWithArguments:(id)arguments { - if (_listener) { - [_auth removeIDTokenDidChangeListener:_listener]; - } - _listener = nil; - - return nil; -} - -@end diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTIdTokenChannelStreamHandler.swift b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTIdTokenChannelStreamHandler.swift new file mode 100644 index 000000000000..455e7699c37b --- /dev/null +++ b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTIdTokenChannelStreamHandler.swift @@ -0,0 +1,48 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import FirebaseAuth +import Foundation + +#if os(iOS) + import Flutter +#elseif os(macOS) + import FlutterMacOS +#endif + +final class FLTIdTokenChannelStreamHandler: NSObject, FlutterStreamHandler { + private let auth: Auth + private var handle: IDTokenDidChangeListenerHandle? + + init(auth: Auth) { + self.auth = auth + } + + func onListen(withArguments arguments: Any?, eventSink events: @escaping FlutterEventSink) + -> FlutterError? + { + var initialAuthState = true + handle = auth.addIDTokenDidChangeListener { auth, user in + if initialAuthState { + initialAuthState = false + return + } + + if user != nil, let currentUser = auth.currentUser { + events(["user": PigeonParser.getManualList(PigeonParser.getPigeonDetails(currentUser))]) + } else { + events(["user": NSNull()]) + } + } + return nil + } + + func onCancel(withArguments arguments: Any?) -> FlutterError? { + if let handle { + auth.removeIDTokenDidChangeListener(handle) + } + handle = nil + return nil + } +} diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTPhoneNumberVerificationStreamHandler.m b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTPhoneNumberVerificationStreamHandler.m deleted file mode 100644 index 511d2caa8841..000000000000 --- a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTPhoneNumberVerificationStreamHandler.m +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -@import FirebaseAuth; - -#import "include/Private/FLTPhoneNumberVerificationStreamHandler.h" -#import "include/Public/FLTFirebaseAuthPlugin.h" - -@implementation FLTPhoneNumberVerificationStreamHandler { - FIRAuth *_auth; - NSString *_phoneNumber; -#if TARGET_OS_OSX -#else - FIRMultiFactorSession *_session; - FIRPhoneMultiFactorInfo *_factorInfo; -#endif -} - -#if TARGET_OS_OSX -- (instancetype)initWithAuth:(id)auth request:(InternalVerifyPhoneNumberRequest *)request { - self = [super init]; - if (self) { - _auth = auth; - _phoneNumber = request.phoneNumber; - } - return self; -} -#else -- (instancetype)initWithAuth:(id)auth - request:(InternalVerifyPhoneNumberRequest *)request - session:(FIRMultiFactorSession *)session - factorInfo:(FIRPhoneMultiFactorInfo *)factorInfo { - self = [super init]; - if (self) { - _auth = auth; - _phoneNumber = request.phoneNumber; - _session = session; - _factorInfo = factorInfo; - } - return self; -} -#endif - -- (FlutterError *)onListenWithArguments:(id)arguments eventSink:(FlutterEventSink)events { -#if TARGET_OS_IPHONE - id completer = ^(NSString *verificationID, NSError *error) { - if (error != nil) { - FlutterError *errorDetails = [FLTFirebaseAuthPlugin convertToFlutterError:error]; - events(@{ - @"name" : @"Auth#phoneVerificationFailed", - @"error" : @{ - @"code" : errorDetails.code, - @"message" : errorDetails.message, - @"details" : errorDetails.details, - } - }); - } else { - events(@{ - @"name" : @"Auth#phoneCodeSent", - @"verificationId" : verificationID, - }); - } - }; - - // Try catch to capture 'missing URL scheme' error. - @try { - if (_factorInfo != nil) { - [[FIRPhoneAuthProvider providerWithAuth:_auth] - verifyPhoneNumberWithMultiFactorInfo:_factorInfo - UIDelegate:nil - multiFactorSession:_session - completion:completer]; - - } else { - [[FIRPhoneAuthProvider providerWithAuth:_auth] verifyPhoneNumber:_phoneNumber - UIDelegate:nil - multiFactorSession:_session - completion:completer]; - } - } @catch (NSException *exception) { - events(@{ - @"name" : @"Auth#phoneVerificationFailed", - @"error" : @{ - @"message" : exception.reason, - } - }); - } -#endif - - return nil; -} - -- (FlutterError *)onCancelWithArguments:(id)arguments { - return nil; -} - -@end diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTPhoneNumberVerificationStreamHandler.swift b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTPhoneNumberVerificationStreamHandler.swift new file mode 100644 index 000000000000..12545a6ddb68 --- /dev/null +++ b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTPhoneNumberVerificationStreamHandler.swift @@ -0,0 +1,86 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import FirebaseAuth +import Foundation + +#if os(iOS) + import Flutter +#elseif os(macOS) + import FlutterMacOS +#endif + +final class FLTPhoneNumberVerificationStreamHandler: NSObject, FlutterStreamHandler { + private let auth: Auth + private let phoneNumber: String? + #if os(iOS) + private let session: MultiFactorSession? + private let factorInfo: PhoneMultiFactorInfo? + #endif + + #if os(iOS) + init( + auth: Auth, + request: InternalVerifyPhoneNumberRequest, + session: MultiFactorSession?, + factorInfo: PhoneMultiFactorInfo? + ) { + self.auth = auth + self.phoneNumber = request.phoneNumber + self.session = session + self.factorInfo = factorInfo + } + #else + init(auth: Auth, request: InternalVerifyPhoneNumberRequest) { + self.auth = auth + self.phoneNumber = request.phoneNumber + } + #endif + + func onListen(withArguments arguments: Any?, eventSink events: @escaping FlutterEventSink) + -> FlutterError? + { + #if os(iOS) + let completer: (String?, Error?) -> Void = { verificationID, error in + if let error { + let errorDetails = AuthErrors.convertToFlutterError(error) + events([ + "name": "Auth#phoneVerificationFailed", + "error": [ + "code": errorDetails.code as Any, + "message": errorDetails.message as Any, + "details": errorDetails.details as Any, + ], + ]) + } else { + events([ + "name": "Auth#phoneCodeSent", + "verificationId": verificationID as Any, + ]) + } + } + + if let factorInfo { + PhoneAuthProvider.provider(auth: auth).verifyPhoneNumber( + with: factorInfo, + uiDelegate: nil, + multiFactorSession: session, + completion: completer + ) + } else if let phoneNumber { + PhoneAuthProvider.provider(auth: auth).verifyPhoneNumber( + phoneNumber, + uiDelegate: nil, + multiFactorSession: session, + completion: completer + ) + } + #endif + return nil + } + + func onCancel(withArguments arguments: Any?) -> FlutterError? { + nil + } +} diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FirebaseAuthMessages.g.swift b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FirebaseAuthMessages.g.swift new file mode 100644 index 000000000000..823ea1a3bdfa --- /dev/null +++ b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FirebaseAuthMessages.g.swift @@ -0,0 +1,2278 @@ +// Copyright 2023, the Chromium project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// Autogenerated from Pigeon (v26.3.4), do not edit directly. +// See also: https://pub.dev/packages/pigeon + +import Foundation + +#if os(iOS) + import Flutter +#elseif os(macOS) + import FlutterMacOS +#else + #error("Unsupported platform.") +#endif + +/// Error class for passing custom error details to Dart side. +final class PigeonError: Error { + let code: String + let message: String? + let details: Sendable? + + init(code: String, message: String?, details: Sendable?) { + self.code = code + self.message = message + self.details = details + } + + var localizedDescription: String { + return + "PigeonError(code: \(code), message: \(message ?? ""), details: \(details ?? "")" + } +} + +private func wrapResult(_ result: Any?) -> [Any?] { + return [result] +} + +private func wrapError(_ error: Any) -> [Any?] { + if let pigeonError = error as? PigeonError { + return [ + pigeonError.code, + pigeonError.message, + pigeonError.details, + ] + } + if let flutterError = error as? FlutterError { + return [ + flutterError.code, + flutterError.message, + flutterError.details, + ] + } + return [ + "\(error)", + "\(Swift.type(of: error))", + "Stacktrace: \(Thread.callStackSymbols)", + ] +} + +private func isNullish(_ value: Any?) -> Bool { + return value is NSNull || value == nil +} + +private func nilOrValue(_ value: Any?) -> T? { + if value is NSNull { return nil } + return value as! T? +} + +private func doubleEqualsFirebaseAuthMessages(_ lhs: Double, _ rhs: Double) -> Bool { + return (lhs.isNaN && rhs.isNaN) || lhs == rhs +} + +private func doubleHashFirebaseAuthMessages(_ value: Double, _ hasher: inout Hasher) { + if value.isNaN { + hasher.combine(0x7FF8000000000000) + } else { + // Normalize -0.0 to 0.0 + hasher.combine(value == 0 ? 0 : value) + } +} + +func deepEqualsFirebaseAuthMessages(_ lhs: Any?, _ rhs: Any?) -> Bool { + let cleanLhs = nilOrValue(lhs) as Any? + let cleanRhs = nilOrValue(rhs) as Any? + switch (cleanLhs, cleanRhs) { + case (nil, nil): + return true + + case (nil, _), (_, nil): + return false + + case (let lhs as AnyObject, let rhs as AnyObject) where lhs === rhs: + return true + + case is (Void, Void): + return true + + case (let lhsArray, let rhsArray) as ([Any?], [Any?]): + guard lhsArray.count == rhsArray.count else { return false } + for (index, element) in lhsArray.enumerated() { + if !deepEqualsFirebaseAuthMessages(element, rhsArray[index]) { + return false + } + } + return true + + case (let lhsArray, let rhsArray) as ([Double], [Double]): + guard lhsArray.count == rhsArray.count else { return false } + for (index, element) in lhsArray.enumerated() { + if !doubleEqualsFirebaseAuthMessages(element, rhsArray[index]) { + return false + } + } + return true + + case (let lhsDictionary, let rhsDictionary) as ([AnyHashable: Any?], [AnyHashable: Any?]): + guard lhsDictionary.count == rhsDictionary.count else { return false } + for (lhsKey, lhsValue) in lhsDictionary { + var found = false + for (rhsKey, rhsValue) in rhsDictionary { + if deepEqualsFirebaseAuthMessages(lhsKey, rhsKey) { + if deepEqualsFirebaseAuthMessages(lhsValue, rhsValue) { + found = true + break + } else { + return false + } + } + } + if !found { return false } + } + return true + + case (let lhs as Double, let rhs as Double): + return doubleEqualsFirebaseAuthMessages(lhs, rhs) + + case (let lhsHashable, let rhsHashable) as (AnyHashable, AnyHashable): + return lhsHashable == rhsHashable + + default: + return false + } +} + +func deepHashFirebaseAuthMessages(value: Any?, hasher: inout Hasher) { + let cleanValue = nilOrValue(value) as Any? + if let cleanValue = cleanValue { + if let doubleValue = cleanValue as? Double { + doubleHashFirebaseAuthMessages(doubleValue, &hasher) + } else if let valueList = cleanValue as? [Any?] { + for item in valueList { + deepHashFirebaseAuthMessages(value: item, hasher: &hasher) + } + } else if let valueList = cleanValue as? [Double] { + for item in valueList { + doubleHashFirebaseAuthMessages(item, &hasher) + } + } else if let valueDict = cleanValue as? [AnyHashable: Any?] { + var result = 0 + for (key, value) in valueDict { + var entryKeyHasher = Hasher() + deepHashFirebaseAuthMessages(value: key, hasher: &entryKeyHasher) + var entryValueHasher = Hasher() + deepHashFirebaseAuthMessages(value: value, hasher: &entryValueHasher) + result = result &+ ((entryKeyHasher.finalize() &* 31) ^ entryValueHasher.finalize()) + } + hasher.combine(result) + } else if let hashableValue = cleanValue as? AnyHashable { + hasher.combine(hashableValue) + } else { + hasher.combine(String(describing: cleanValue)) + } + } else { + hasher.combine(0) + } +} + + +/// The type of operation that generated the action code from calling +/// [checkActionCode]. +enum ActionCodeInfoOperation: Int { + /// Unknown operation. + case unknown = 0 + /// Password reset code generated via [sendPasswordResetEmail]. + case passwordReset = 1 + /// Email verification code generated via [User.sendEmailVerification]. + case verifyEmail = 2 + /// Email change revocation code generated via [User.updateEmail]. + case recoverEmail = 3 + /// Email sign in code generated via [sendSignInLinkToEmail]. + case emailSignIn = 4 + /// Verify and change email code generated via [User.verifyBeforeUpdateEmail]. + case verifyAndChangeEmail = 5 + /// Action code for reverting second factor addition. + case revertSecondFactorAddition = 6 +} + +/// Generated class from Pigeon that represents data sent in messages. +struct InternalMultiFactorSession: Hashable { + var id: String + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> InternalMultiFactorSession? { + let id = pigeonVar_list[0] as! String + + return InternalMultiFactorSession( + id: id + ) + } + func toList() -> [Any?] { + return [ + id + ] + } + static func == (lhs: InternalMultiFactorSession, rhs: InternalMultiFactorSession) -> Bool { + if Swift.type(of: lhs) != Swift.type(of: rhs) { + return false + } + return deepEqualsFirebaseAuthMessages(lhs.id, rhs.id) + } + + func hash(into hasher: inout Hasher) { + hasher.combine("InternalMultiFactorSession") + deepHashFirebaseAuthMessages(value: id, hasher: &hasher) + } +} + +/// Generated class from Pigeon that represents data sent in messages. +struct InternalPhoneMultiFactorAssertion: Hashable { + var verificationId: String + var verificationCode: String + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> InternalPhoneMultiFactorAssertion? { + let verificationId = pigeonVar_list[0] as! String + let verificationCode = pigeonVar_list[1] as! String + + return InternalPhoneMultiFactorAssertion( + verificationId: verificationId, + verificationCode: verificationCode + ) + } + func toList() -> [Any?] { + return [ + verificationId, + verificationCode, + ] + } + static func == (lhs: InternalPhoneMultiFactorAssertion, rhs: InternalPhoneMultiFactorAssertion) -> Bool { + if Swift.type(of: lhs) != Swift.type(of: rhs) { + return false + } + return deepEqualsFirebaseAuthMessages(lhs.verificationId, rhs.verificationId) && deepEqualsFirebaseAuthMessages(lhs.verificationCode, rhs.verificationCode) + } + + func hash(into hasher: inout Hasher) { + hasher.combine("InternalPhoneMultiFactorAssertion") + deepHashFirebaseAuthMessages(value: verificationId, hasher: &hasher) + deepHashFirebaseAuthMessages(value: verificationCode, hasher: &hasher) + } +} + +/// Generated class from Pigeon that represents data sent in messages. +struct InternalMultiFactorInfo: Hashable { + var displayName: String? = nil + var enrollmentTimestamp: Double + var factorId: String? = nil + var uid: String + var phoneNumber: String? = nil + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> InternalMultiFactorInfo? { + let displayName: String? = nilOrValue(pigeonVar_list[0]) + let enrollmentTimestamp = pigeonVar_list[1] as! Double + let factorId: String? = nilOrValue(pigeonVar_list[2]) + let uid = pigeonVar_list[3] as! String + let phoneNumber: String? = nilOrValue(pigeonVar_list[4]) + + return InternalMultiFactorInfo( + displayName: displayName, + enrollmentTimestamp: enrollmentTimestamp, + factorId: factorId, + uid: uid, + phoneNumber: phoneNumber + ) + } + func toList() -> [Any?] { + return [ + displayName, + enrollmentTimestamp, + factorId, + uid, + phoneNumber, + ] + } + static func == (lhs: InternalMultiFactorInfo, rhs: InternalMultiFactorInfo) -> Bool { + if Swift.type(of: lhs) != Swift.type(of: rhs) { + return false + } + return deepEqualsFirebaseAuthMessages(lhs.displayName, rhs.displayName) && deepEqualsFirebaseAuthMessages(lhs.enrollmentTimestamp, rhs.enrollmentTimestamp) && deepEqualsFirebaseAuthMessages(lhs.factorId, rhs.factorId) && deepEqualsFirebaseAuthMessages(lhs.uid, rhs.uid) && deepEqualsFirebaseAuthMessages(lhs.phoneNumber, rhs.phoneNumber) + } + + func hash(into hasher: inout Hasher) { + hasher.combine("InternalMultiFactorInfo") + deepHashFirebaseAuthMessages(value: displayName, hasher: &hasher) + deepHashFirebaseAuthMessages(value: enrollmentTimestamp, hasher: &hasher) + deepHashFirebaseAuthMessages(value: factorId, hasher: &hasher) + deepHashFirebaseAuthMessages(value: uid, hasher: &hasher) + deepHashFirebaseAuthMessages(value: phoneNumber, hasher: &hasher) + } +} + +/// Generated class from Pigeon that represents data sent in messages. +struct AuthPigeonFirebaseApp: Hashable { + var appName: String + var tenantId: String? = nil + var customAuthDomain: String? = nil + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> AuthPigeonFirebaseApp? { + let appName = pigeonVar_list[0] as! String + let tenantId: String? = nilOrValue(pigeonVar_list[1]) + let customAuthDomain: String? = nilOrValue(pigeonVar_list[2]) + + return AuthPigeonFirebaseApp( + appName: appName, + tenantId: tenantId, + customAuthDomain: customAuthDomain + ) + } + func toList() -> [Any?] { + return [ + appName, + tenantId, + customAuthDomain, + ] + } + static func == (lhs: AuthPigeonFirebaseApp, rhs: AuthPigeonFirebaseApp) -> Bool { + if Swift.type(of: lhs) != Swift.type(of: rhs) { + return false + } + return deepEqualsFirebaseAuthMessages(lhs.appName, rhs.appName) && deepEqualsFirebaseAuthMessages(lhs.tenantId, rhs.tenantId) && deepEqualsFirebaseAuthMessages(lhs.customAuthDomain, rhs.customAuthDomain) + } + + func hash(into hasher: inout Hasher) { + hasher.combine("AuthPigeonFirebaseApp") + deepHashFirebaseAuthMessages(value: appName, hasher: &hasher) + deepHashFirebaseAuthMessages(value: tenantId, hasher: &hasher) + deepHashFirebaseAuthMessages(value: customAuthDomain, hasher: &hasher) + } +} + +/// Generated class from Pigeon that represents data sent in messages. +struct InternalActionCodeInfoData: Hashable { + var email: String? = nil + var previousEmail: String? = nil + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> InternalActionCodeInfoData? { + let email: String? = nilOrValue(pigeonVar_list[0]) + let previousEmail: String? = nilOrValue(pigeonVar_list[1]) + + return InternalActionCodeInfoData( + email: email, + previousEmail: previousEmail + ) + } + func toList() -> [Any?] { + return [ + email, + previousEmail, + ] + } + static func == (lhs: InternalActionCodeInfoData, rhs: InternalActionCodeInfoData) -> Bool { + if Swift.type(of: lhs) != Swift.type(of: rhs) { + return false + } + return deepEqualsFirebaseAuthMessages(lhs.email, rhs.email) && deepEqualsFirebaseAuthMessages(lhs.previousEmail, rhs.previousEmail) + } + + func hash(into hasher: inout Hasher) { + hasher.combine("InternalActionCodeInfoData") + deepHashFirebaseAuthMessages(value: email, hasher: &hasher) + deepHashFirebaseAuthMessages(value: previousEmail, hasher: &hasher) + } +} + +/// Generated class from Pigeon that represents data sent in messages. +struct InternalActionCodeInfo: Hashable { + var operation: ActionCodeInfoOperation + var data: InternalActionCodeInfoData + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> InternalActionCodeInfo? { + let operation = pigeonVar_list[0] as! ActionCodeInfoOperation + let data = pigeonVar_list[1] as! InternalActionCodeInfoData + + return InternalActionCodeInfo( + operation: operation, + data: data + ) + } + func toList() -> [Any?] { + return [ + operation, + data, + ] + } + static func == (lhs: InternalActionCodeInfo, rhs: InternalActionCodeInfo) -> Bool { + if Swift.type(of: lhs) != Swift.type(of: rhs) { + return false + } + return deepEqualsFirebaseAuthMessages(lhs.operation, rhs.operation) && deepEqualsFirebaseAuthMessages(lhs.data, rhs.data) + } + + func hash(into hasher: inout Hasher) { + hasher.combine("InternalActionCodeInfo") + deepHashFirebaseAuthMessages(value: operation, hasher: &hasher) + deepHashFirebaseAuthMessages(value: data, hasher: &hasher) + } +} + +/// Generated class from Pigeon that represents data sent in messages. +struct InternalAdditionalUserInfo: Hashable { + var isNewUser: Bool + var providerId: String? = nil + var username: String? = nil + var authorizationCode: String? = nil + var profile: [String?: Any?]? = nil + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> InternalAdditionalUserInfo? { + let isNewUser = pigeonVar_list[0] as! Bool + let providerId: String? = nilOrValue(pigeonVar_list[1]) + let username: String? = nilOrValue(pigeonVar_list[2]) + let authorizationCode: String? = nilOrValue(pigeonVar_list[3]) + let profile: [String?: Any?]? = nilOrValue(pigeonVar_list[4]) + + return InternalAdditionalUserInfo( + isNewUser: isNewUser, + providerId: providerId, + username: username, + authorizationCode: authorizationCode, + profile: profile + ) + } + func toList() -> [Any?] { + return [ + isNewUser, + providerId, + username, + authorizationCode, + profile, + ] + } + static func == (lhs: InternalAdditionalUserInfo, rhs: InternalAdditionalUserInfo) -> Bool { + if Swift.type(of: lhs) != Swift.type(of: rhs) { + return false + } + return deepEqualsFirebaseAuthMessages(lhs.isNewUser, rhs.isNewUser) && deepEqualsFirebaseAuthMessages(lhs.providerId, rhs.providerId) && deepEqualsFirebaseAuthMessages(lhs.username, rhs.username) && deepEqualsFirebaseAuthMessages(lhs.authorizationCode, rhs.authorizationCode) && deepEqualsFirebaseAuthMessages(lhs.profile, rhs.profile) + } + + func hash(into hasher: inout Hasher) { + hasher.combine("InternalAdditionalUserInfo") + deepHashFirebaseAuthMessages(value: isNewUser, hasher: &hasher) + deepHashFirebaseAuthMessages(value: providerId, hasher: &hasher) + deepHashFirebaseAuthMessages(value: username, hasher: &hasher) + deepHashFirebaseAuthMessages(value: authorizationCode, hasher: &hasher) + deepHashFirebaseAuthMessages(value: profile, hasher: &hasher) + } +} + +/// Generated class from Pigeon that represents data sent in messages. +struct InternalAuthCredential: Hashable { + var providerId: String + var signInMethod: String + var nativeId: Int64 + var accessToken: String? = nil + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> InternalAuthCredential? { + let providerId = pigeonVar_list[0] as! String + let signInMethod = pigeonVar_list[1] as! String + let nativeId = pigeonVar_list[2] as! Int64 + let accessToken: String? = nilOrValue(pigeonVar_list[3]) + + return InternalAuthCredential( + providerId: providerId, + signInMethod: signInMethod, + nativeId: nativeId, + accessToken: accessToken + ) + } + func toList() -> [Any?] { + return [ + providerId, + signInMethod, + nativeId, + accessToken, + ] + } + static func == (lhs: InternalAuthCredential, rhs: InternalAuthCredential) -> Bool { + if Swift.type(of: lhs) != Swift.type(of: rhs) { + return false + } + return deepEqualsFirebaseAuthMessages(lhs.providerId, rhs.providerId) && deepEqualsFirebaseAuthMessages(lhs.signInMethod, rhs.signInMethod) && deepEqualsFirebaseAuthMessages(lhs.nativeId, rhs.nativeId) && deepEqualsFirebaseAuthMessages(lhs.accessToken, rhs.accessToken) + } + + func hash(into hasher: inout Hasher) { + hasher.combine("InternalAuthCredential") + deepHashFirebaseAuthMessages(value: providerId, hasher: &hasher) + deepHashFirebaseAuthMessages(value: signInMethod, hasher: &hasher) + deepHashFirebaseAuthMessages(value: nativeId, hasher: &hasher) + deepHashFirebaseAuthMessages(value: accessToken, hasher: &hasher) + } +} + +/// Generated class from Pigeon that represents data sent in messages. +struct InternalUserInfo: Hashable { + var uid: String + var email: String? = nil + var displayName: String? = nil + var photoUrl: String? = nil + var phoneNumber: String? = nil + var isAnonymous: Bool + var isEmailVerified: Bool + var providerId: String? = nil + var tenantId: String? = nil + var refreshToken: String? = nil + var creationTimestamp: Int64? = nil + var lastSignInTimestamp: Int64? = nil + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> InternalUserInfo? { + let uid = pigeonVar_list[0] as! String + let email: String? = nilOrValue(pigeonVar_list[1]) + let displayName: String? = nilOrValue(pigeonVar_list[2]) + let photoUrl: String? = nilOrValue(pigeonVar_list[3]) + let phoneNumber: String? = nilOrValue(pigeonVar_list[4]) + let isAnonymous = pigeonVar_list[5] as! Bool + let isEmailVerified = pigeonVar_list[6] as! Bool + let providerId: String? = nilOrValue(pigeonVar_list[7]) + let tenantId: String? = nilOrValue(pigeonVar_list[8]) + let refreshToken: String? = nilOrValue(pigeonVar_list[9]) + let creationTimestamp: Int64? = nilOrValue(pigeonVar_list[10]) + let lastSignInTimestamp: Int64? = nilOrValue(pigeonVar_list[11]) + + return InternalUserInfo( + uid: uid, + email: email, + displayName: displayName, + photoUrl: photoUrl, + phoneNumber: phoneNumber, + isAnonymous: isAnonymous, + isEmailVerified: isEmailVerified, + providerId: providerId, + tenantId: tenantId, + refreshToken: refreshToken, + creationTimestamp: creationTimestamp, + lastSignInTimestamp: lastSignInTimestamp + ) + } + func toList() -> [Any?] { + return [ + uid, + email, + displayName, + photoUrl, + phoneNumber, + isAnonymous, + isEmailVerified, + providerId, + tenantId, + refreshToken, + creationTimestamp, + lastSignInTimestamp, + ] + } + static func == (lhs: InternalUserInfo, rhs: InternalUserInfo) -> Bool { + if Swift.type(of: lhs) != Swift.type(of: rhs) { + return false + } + return deepEqualsFirebaseAuthMessages(lhs.uid, rhs.uid) && deepEqualsFirebaseAuthMessages(lhs.email, rhs.email) && deepEqualsFirebaseAuthMessages(lhs.displayName, rhs.displayName) && deepEqualsFirebaseAuthMessages(lhs.photoUrl, rhs.photoUrl) && deepEqualsFirebaseAuthMessages(lhs.phoneNumber, rhs.phoneNumber) && deepEqualsFirebaseAuthMessages(lhs.isAnonymous, rhs.isAnonymous) && deepEqualsFirebaseAuthMessages(lhs.isEmailVerified, rhs.isEmailVerified) && deepEqualsFirebaseAuthMessages(lhs.providerId, rhs.providerId) && deepEqualsFirebaseAuthMessages(lhs.tenantId, rhs.tenantId) && deepEqualsFirebaseAuthMessages(lhs.refreshToken, rhs.refreshToken) && deepEqualsFirebaseAuthMessages(lhs.creationTimestamp, rhs.creationTimestamp) && deepEqualsFirebaseAuthMessages(lhs.lastSignInTimestamp, rhs.lastSignInTimestamp) + } + + func hash(into hasher: inout Hasher) { + hasher.combine("InternalUserInfo") + deepHashFirebaseAuthMessages(value: uid, hasher: &hasher) + deepHashFirebaseAuthMessages(value: email, hasher: &hasher) + deepHashFirebaseAuthMessages(value: displayName, hasher: &hasher) + deepHashFirebaseAuthMessages(value: photoUrl, hasher: &hasher) + deepHashFirebaseAuthMessages(value: phoneNumber, hasher: &hasher) + deepHashFirebaseAuthMessages(value: isAnonymous, hasher: &hasher) + deepHashFirebaseAuthMessages(value: isEmailVerified, hasher: &hasher) + deepHashFirebaseAuthMessages(value: providerId, hasher: &hasher) + deepHashFirebaseAuthMessages(value: tenantId, hasher: &hasher) + deepHashFirebaseAuthMessages(value: refreshToken, hasher: &hasher) + deepHashFirebaseAuthMessages(value: creationTimestamp, hasher: &hasher) + deepHashFirebaseAuthMessages(value: lastSignInTimestamp, hasher: &hasher) + } +} + +/// Generated class from Pigeon that represents data sent in messages. +struct InternalUserDetails: Hashable { + var userInfo: InternalUserInfo + var providerData: [[AnyHashable?: Any?]?] + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> InternalUserDetails? { + let userInfo = pigeonVar_list[0] as! InternalUserInfo + let providerData = pigeonVar_list[1] as! [[AnyHashable?: Any?]?] + + return InternalUserDetails( + userInfo: userInfo, + providerData: providerData + ) + } + func toList() -> [Any?] { + return [ + userInfo, + providerData, + ] + } + static func == (lhs: InternalUserDetails, rhs: InternalUserDetails) -> Bool { + if Swift.type(of: lhs) != Swift.type(of: rhs) { + return false + } + return deepEqualsFirebaseAuthMessages(lhs.userInfo, rhs.userInfo) && deepEqualsFirebaseAuthMessages(lhs.providerData, rhs.providerData) + } + + func hash(into hasher: inout Hasher) { + hasher.combine("InternalUserDetails") + deepHashFirebaseAuthMessages(value: userInfo, hasher: &hasher) + deepHashFirebaseAuthMessages(value: providerData, hasher: &hasher) + } +} + +/// Generated class from Pigeon that represents data sent in messages. +struct InternalUserCredential: Hashable { + var user: InternalUserDetails? = nil + var additionalUserInfo: InternalAdditionalUserInfo? = nil + var credential: InternalAuthCredential? = nil + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> InternalUserCredential? { + let user: InternalUserDetails? = nilOrValue(pigeonVar_list[0]) + let additionalUserInfo: InternalAdditionalUserInfo? = nilOrValue(pigeonVar_list[1]) + let credential: InternalAuthCredential? = nilOrValue(pigeonVar_list[2]) + + return InternalUserCredential( + user: user, + additionalUserInfo: additionalUserInfo, + credential: credential + ) + } + func toList() -> [Any?] { + return [ + user, + additionalUserInfo, + credential, + ] + } + static func == (lhs: InternalUserCredential, rhs: InternalUserCredential) -> Bool { + if Swift.type(of: lhs) != Swift.type(of: rhs) { + return false + } + return deepEqualsFirebaseAuthMessages(lhs.user, rhs.user) && deepEqualsFirebaseAuthMessages(lhs.additionalUserInfo, rhs.additionalUserInfo) && deepEqualsFirebaseAuthMessages(lhs.credential, rhs.credential) + } + + func hash(into hasher: inout Hasher) { + hasher.combine("InternalUserCredential") + deepHashFirebaseAuthMessages(value: user, hasher: &hasher) + deepHashFirebaseAuthMessages(value: additionalUserInfo, hasher: &hasher) + deepHashFirebaseAuthMessages(value: credential, hasher: &hasher) + } +} + +/// Generated class from Pigeon that represents data sent in messages. +struct InternalAuthCredentialInput: Hashable { + var providerId: String + var signInMethod: String + var token: String? = nil + var accessToken: String? = nil + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> InternalAuthCredentialInput? { + let providerId = pigeonVar_list[0] as! String + let signInMethod = pigeonVar_list[1] as! String + let token: String? = nilOrValue(pigeonVar_list[2]) + let accessToken: String? = nilOrValue(pigeonVar_list[3]) + + return InternalAuthCredentialInput( + providerId: providerId, + signInMethod: signInMethod, + token: token, + accessToken: accessToken + ) + } + func toList() -> [Any?] { + return [ + providerId, + signInMethod, + token, + accessToken, + ] + } + static func == (lhs: InternalAuthCredentialInput, rhs: InternalAuthCredentialInput) -> Bool { + if Swift.type(of: lhs) != Swift.type(of: rhs) { + return false + } + return deepEqualsFirebaseAuthMessages(lhs.providerId, rhs.providerId) && deepEqualsFirebaseAuthMessages(lhs.signInMethod, rhs.signInMethod) && deepEqualsFirebaseAuthMessages(lhs.token, rhs.token) && deepEqualsFirebaseAuthMessages(lhs.accessToken, rhs.accessToken) + } + + func hash(into hasher: inout Hasher) { + hasher.combine("InternalAuthCredentialInput") + deepHashFirebaseAuthMessages(value: providerId, hasher: &hasher) + deepHashFirebaseAuthMessages(value: signInMethod, hasher: &hasher) + deepHashFirebaseAuthMessages(value: token, hasher: &hasher) + deepHashFirebaseAuthMessages(value: accessToken, hasher: &hasher) + } +} + +/// Generated class from Pigeon that represents data sent in messages. +struct InternalActionCodeSettings: Hashable { + var url: String + var dynamicLinkDomain: String? = nil + var handleCodeInApp: Bool + var iOSBundleId: String? = nil + var androidPackageName: String? = nil + var androidInstallApp: Bool + var androidMinimumVersion: String? = nil + var linkDomain: String? = nil + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> InternalActionCodeSettings? { + let url = pigeonVar_list[0] as! String + let dynamicLinkDomain: String? = nilOrValue(pigeonVar_list[1]) + let handleCodeInApp = pigeonVar_list[2] as! Bool + let iOSBundleId: String? = nilOrValue(pigeonVar_list[3]) + let androidPackageName: String? = nilOrValue(pigeonVar_list[4]) + let androidInstallApp = pigeonVar_list[5] as! Bool + let androidMinimumVersion: String? = nilOrValue(pigeonVar_list[6]) + let linkDomain: String? = nilOrValue(pigeonVar_list[7]) + + return InternalActionCodeSettings( + url: url, + dynamicLinkDomain: dynamicLinkDomain, + handleCodeInApp: handleCodeInApp, + iOSBundleId: iOSBundleId, + androidPackageName: androidPackageName, + androidInstallApp: androidInstallApp, + androidMinimumVersion: androidMinimumVersion, + linkDomain: linkDomain + ) + } + func toList() -> [Any?] { + return [ + url, + dynamicLinkDomain, + handleCodeInApp, + iOSBundleId, + androidPackageName, + androidInstallApp, + androidMinimumVersion, + linkDomain, + ] + } + static func == (lhs: InternalActionCodeSettings, rhs: InternalActionCodeSettings) -> Bool { + if Swift.type(of: lhs) != Swift.type(of: rhs) { + return false + } + return deepEqualsFirebaseAuthMessages(lhs.url, rhs.url) && deepEqualsFirebaseAuthMessages(lhs.dynamicLinkDomain, rhs.dynamicLinkDomain) && deepEqualsFirebaseAuthMessages(lhs.handleCodeInApp, rhs.handleCodeInApp) && deepEqualsFirebaseAuthMessages(lhs.iOSBundleId, rhs.iOSBundleId) && deepEqualsFirebaseAuthMessages(lhs.androidPackageName, rhs.androidPackageName) && deepEqualsFirebaseAuthMessages(lhs.androidInstallApp, rhs.androidInstallApp) && deepEqualsFirebaseAuthMessages(lhs.androidMinimumVersion, rhs.androidMinimumVersion) && deepEqualsFirebaseAuthMessages(lhs.linkDomain, rhs.linkDomain) + } + + func hash(into hasher: inout Hasher) { + hasher.combine("InternalActionCodeSettings") + deepHashFirebaseAuthMessages(value: url, hasher: &hasher) + deepHashFirebaseAuthMessages(value: dynamicLinkDomain, hasher: &hasher) + deepHashFirebaseAuthMessages(value: handleCodeInApp, hasher: &hasher) + deepHashFirebaseAuthMessages(value: iOSBundleId, hasher: &hasher) + deepHashFirebaseAuthMessages(value: androidPackageName, hasher: &hasher) + deepHashFirebaseAuthMessages(value: androidInstallApp, hasher: &hasher) + deepHashFirebaseAuthMessages(value: androidMinimumVersion, hasher: &hasher) + deepHashFirebaseAuthMessages(value: linkDomain, hasher: &hasher) + } +} + +/// Generated class from Pigeon that represents data sent in messages. +struct InternalFirebaseAuthSettings: Hashable { + var appVerificationDisabledForTesting: Bool + var userAccessGroup: String? = nil + var phoneNumber: String? = nil + var smsCode: String? = nil + var forceRecaptchaFlow: Bool? = nil + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> InternalFirebaseAuthSettings? { + let appVerificationDisabledForTesting = pigeonVar_list[0] as! Bool + let userAccessGroup: String? = nilOrValue(pigeonVar_list[1]) + let phoneNumber: String? = nilOrValue(pigeonVar_list[2]) + let smsCode: String? = nilOrValue(pigeonVar_list[3]) + let forceRecaptchaFlow: Bool? = nilOrValue(pigeonVar_list[4]) + + return InternalFirebaseAuthSettings( + appVerificationDisabledForTesting: appVerificationDisabledForTesting, + userAccessGroup: userAccessGroup, + phoneNumber: phoneNumber, + smsCode: smsCode, + forceRecaptchaFlow: forceRecaptchaFlow + ) + } + func toList() -> [Any?] { + return [ + appVerificationDisabledForTesting, + userAccessGroup, + phoneNumber, + smsCode, + forceRecaptchaFlow, + ] + } + static func == (lhs: InternalFirebaseAuthSettings, rhs: InternalFirebaseAuthSettings) -> Bool { + if Swift.type(of: lhs) != Swift.type(of: rhs) { + return false + } + return deepEqualsFirebaseAuthMessages(lhs.appVerificationDisabledForTesting, rhs.appVerificationDisabledForTesting) && deepEqualsFirebaseAuthMessages(lhs.userAccessGroup, rhs.userAccessGroup) && deepEqualsFirebaseAuthMessages(lhs.phoneNumber, rhs.phoneNumber) && deepEqualsFirebaseAuthMessages(lhs.smsCode, rhs.smsCode) && deepEqualsFirebaseAuthMessages(lhs.forceRecaptchaFlow, rhs.forceRecaptchaFlow) + } + + func hash(into hasher: inout Hasher) { + hasher.combine("InternalFirebaseAuthSettings") + deepHashFirebaseAuthMessages(value: appVerificationDisabledForTesting, hasher: &hasher) + deepHashFirebaseAuthMessages(value: userAccessGroup, hasher: &hasher) + deepHashFirebaseAuthMessages(value: phoneNumber, hasher: &hasher) + deepHashFirebaseAuthMessages(value: smsCode, hasher: &hasher) + deepHashFirebaseAuthMessages(value: forceRecaptchaFlow, hasher: &hasher) + } +} + +/// Generated class from Pigeon that represents data sent in messages. +struct InternalSignInProvider: Hashable { + var providerId: String + var scopes: [String?]? = nil + var customParameters: [String?: String?]? = nil + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> InternalSignInProvider? { + let providerId = pigeonVar_list[0] as! String + let scopes: [String?]? = nilOrValue(pigeonVar_list[1]) + let customParameters: [String?: String?]? = nilOrValue(pigeonVar_list[2]) + + return InternalSignInProvider( + providerId: providerId, + scopes: scopes, + customParameters: customParameters + ) + } + func toList() -> [Any?] { + return [ + providerId, + scopes, + customParameters, + ] + } + static func == (lhs: InternalSignInProvider, rhs: InternalSignInProvider) -> Bool { + if Swift.type(of: lhs) != Swift.type(of: rhs) { + return false + } + return deepEqualsFirebaseAuthMessages(lhs.providerId, rhs.providerId) && deepEqualsFirebaseAuthMessages(lhs.scopes, rhs.scopes) && deepEqualsFirebaseAuthMessages(lhs.customParameters, rhs.customParameters) + } + + func hash(into hasher: inout Hasher) { + hasher.combine("InternalSignInProvider") + deepHashFirebaseAuthMessages(value: providerId, hasher: &hasher) + deepHashFirebaseAuthMessages(value: scopes, hasher: &hasher) + deepHashFirebaseAuthMessages(value: customParameters, hasher: &hasher) + } +} + +/// Generated class from Pigeon that represents data sent in messages. +struct InternalVerifyPhoneNumberRequest: Hashable { + var phoneNumber: String? = nil + var timeout: Int64 + var forceResendingToken: Int64? = nil + var autoRetrievedSmsCodeForTesting: String? = nil + var multiFactorInfoId: String? = nil + var multiFactorSessionId: String? = nil + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> InternalVerifyPhoneNumberRequest? { + let phoneNumber: String? = nilOrValue(pigeonVar_list[0]) + let timeout = pigeonVar_list[1] as! Int64 + let forceResendingToken: Int64? = nilOrValue(pigeonVar_list[2]) + let autoRetrievedSmsCodeForTesting: String? = nilOrValue(pigeonVar_list[3]) + let multiFactorInfoId: String? = nilOrValue(pigeonVar_list[4]) + let multiFactorSessionId: String? = nilOrValue(pigeonVar_list[5]) + + return InternalVerifyPhoneNumberRequest( + phoneNumber: phoneNumber, + timeout: timeout, + forceResendingToken: forceResendingToken, + autoRetrievedSmsCodeForTesting: autoRetrievedSmsCodeForTesting, + multiFactorInfoId: multiFactorInfoId, + multiFactorSessionId: multiFactorSessionId + ) + } + func toList() -> [Any?] { + return [ + phoneNumber, + timeout, + forceResendingToken, + autoRetrievedSmsCodeForTesting, + multiFactorInfoId, + multiFactorSessionId, + ] + } + static func == (lhs: InternalVerifyPhoneNumberRequest, rhs: InternalVerifyPhoneNumberRequest) -> Bool { + if Swift.type(of: lhs) != Swift.type(of: rhs) { + return false + } + return deepEqualsFirebaseAuthMessages(lhs.phoneNumber, rhs.phoneNumber) && deepEqualsFirebaseAuthMessages(lhs.timeout, rhs.timeout) && deepEqualsFirebaseAuthMessages(lhs.forceResendingToken, rhs.forceResendingToken) && deepEqualsFirebaseAuthMessages(lhs.autoRetrievedSmsCodeForTesting, rhs.autoRetrievedSmsCodeForTesting) && deepEqualsFirebaseAuthMessages(lhs.multiFactorInfoId, rhs.multiFactorInfoId) && deepEqualsFirebaseAuthMessages(lhs.multiFactorSessionId, rhs.multiFactorSessionId) + } + + func hash(into hasher: inout Hasher) { + hasher.combine("InternalVerifyPhoneNumberRequest") + deepHashFirebaseAuthMessages(value: phoneNumber, hasher: &hasher) + deepHashFirebaseAuthMessages(value: timeout, hasher: &hasher) + deepHashFirebaseAuthMessages(value: forceResendingToken, hasher: &hasher) + deepHashFirebaseAuthMessages(value: autoRetrievedSmsCodeForTesting, hasher: &hasher) + deepHashFirebaseAuthMessages(value: multiFactorInfoId, hasher: &hasher) + deepHashFirebaseAuthMessages(value: multiFactorSessionId, hasher: &hasher) + } +} + +/// Generated class from Pigeon that represents data sent in messages. +struct InternalIdTokenResult: Hashable { + var token: String? = nil + var expirationTimestamp: Int64? = nil + var authTimestamp: Int64? = nil + var issuedAtTimestamp: Int64? = nil + var signInProvider: String? = nil + var claims: [String?: Any?]? = nil + var signInSecondFactor: String? = nil + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> InternalIdTokenResult? { + let token: String? = nilOrValue(pigeonVar_list[0]) + let expirationTimestamp: Int64? = nilOrValue(pigeonVar_list[1]) + let authTimestamp: Int64? = nilOrValue(pigeonVar_list[2]) + let issuedAtTimestamp: Int64? = nilOrValue(pigeonVar_list[3]) + let signInProvider: String? = nilOrValue(pigeonVar_list[4]) + let claims: [String?: Any?]? = nilOrValue(pigeonVar_list[5]) + let signInSecondFactor: String? = nilOrValue(pigeonVar_list[6]) + + return InternalIdTokenResult( + token: token, + expirationTimestamp: expirationTimestamp, + authTimestamp: authTimestamp, + issuedAtTimestamp: issuedAtTimestamp, + signInProvider: signInProvider, + claims: claims, + signInSecondFactor: signInSecondFactor + ) + } + func toList() -> [Any?] { + return [ + token, + expirationTimestamp, + authTimestamp, + issuedAtTimestamp, + signInProvider, + claims, + signInSecondFactor, + ] + } + static func == (lhs: InternalIdTokenResult, rhs: InternalIdTokenResult) -> Bool { + if Swift.type(of: lhs) != Swift.type(of: rhs) { + return false + } + return deepEqualsFirebaseAuthMessages(lhs.token, rhs.token) && deepEqualsFirebaseAuthMessages(lhs.expirationTimestamp, rhs.expirationTimestamp) && deepEqualsFirebaseAuthMessages(lhs.authTimestamp, rhs.authTimestamp) && deepEqualsFirebaseAuthMessages(lhs.issuedAtTimestamp, rhs.issuedAtTimestamp) && deepEqualsFirebaseAuthMessages(lhs.signInProvider, rhs.signInProvider) && deepEqualsFirebaseAuthMessages(lhs.claims, rhs.claims) && deepEqualsFirebaseAuthMessages(lhs.signInSecondFactor, rhs.signInSecondFactor) + } + + func hash(into hasher: inout Hasher) { + hasher.combine("InternalIdTokenResult") + deepHashFirebaseAuthMessages(value: token, hasher: &hasher) + deepHashFirebaseAuthMessages(value: expirationTimestamp, hasher: &hasher) + deepHashFirebaseAuthMessages(value: authTimestamp, hasher: &hasher) + deepHashFirebaseAuthMessages(value: issuedAtTimestamp, hasher: &hasher) + deepHashFirebaseAuthMessages(value: signInProvider, hasher: &hasher) + deepHashFirebaseAuthMessages(value: claims, hasher: &hasher) + deepHashFirebaseAuthMessages(value: signInSecondFactor, hasher: &hasher) + } +} + +/// Generated class from Pigeon that represents data sent in messages. +struct InternalUserProfile: Hashable { + var displayName: String? = nil + var photoUrl: String? = nil + var displayNameChanged: Bool + var photoUrlChanged: Bool + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> InternalUserProfile? { + let displayName: String? = nilOrValue(pigeonVar_list[0]) + let photoUrl: String? = nilOrValue(pigeonVar_list[1]) + let displayNameChanged = pigeonVar_list[2] as! Bool + let photoUrlChanged = pigeonVar_list[3] as! Bool + + return InternalUserProfile( + displayName: displayName, + photoUrl: photoUrl, + displayNameChanged: displayNameChanged, + photoUrlChanged: photoUrlChanged + ) + } + func toList() -> [Any?] { + return [ + displayName, + photoUrl, + displayNameChanged, + photoUrlChanged, + ] + } + static func == (lhs: InternalUserProfile, rhs: InternalUserProfile) -> Bool { + if Swift.type(of: lhs) != Swift.type(of: rhs) { + return false + } + return deepEqualsFirebaseAuthMessages(lhs.displayName, rhs.displayName) && deepEqualsFirebaseAuthMessages(lhs.photoUrl, rhs.photoUrl) && deepEqualsFirebaseAuthMessages(lhs.displayNameChanged, rhs.displayNameChanged) && deepEqualsFirebaseAuthMessages(lhs.photoUrlChanged, rhs.photoUrlChanged) + } + + func hash(into hasher: inout Hasher) { + hasher.combine("InternalUserProfile") + deepHashFirebaseAuthMessages(value: displayName, hasher: &hasher) + deepHashFirebaseAuthMessages(value: photoUrl, hasher: &hasher) + deepHashFirebaseAuthMessages(value: displayNameChanged, hasher: &hasher) + deepHashFirebaseAuthMessages(value: photoUrlChanged, hasher: &hasher) + } +} + +/// Generated class from Pigeon that represents data sent in messages. +struct InternalTotpSecret: Hashable { + var codeIntervalSeconds: Int64? = nil + var codeLength: Int64? = nil + var enrollmentCompletionDeadline: Int64? = nil + var hashingAlgorithm: String? = nil + var secretKey: String + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> InternalTotpSecret? { + let codeIntervalSeconds: Int64? = nilOrValue(pigeonVar_list[0]) + let codeLength: Int64? = nilOrValue(pigeonVar_list[1]) + let enrollmentCompletionDeadline: Int64? = nilOrValue(pigeonVar_list[2]) + let hashingAlgorithm: String? = nilOrValue(pigeonVar_list[3]) + let secretKey = pigeonVar_list[4] as! String + + return InternalTotpSecret( + codeIntervalSeconds: codeIntervalSeconds, + codeLength: codeLength, + enrollmentCompletionDeadline: enrollmentCompletionDeadline, + hashingAlgorithm: hashingAlgorithm, + secretKey: secretKey + ) + } + func toList() -> [Any?] { + return [ + codeIntervalSeconds, + codeLength, + enrollmentCompletionDeadline, + hashingAlgorithm, + secretKey, + ] + } + static func == (lhs: InternalTotpSecret, rhs: InternalTotpSecret) -> Bool { + if Swift.type(of: lhs) != Swift.type(of: rhs) { + return false + } + return deepEqualsFirebaseAuthMessages(lhs.codeIntervalSeconds, rhs.codeIntervalSeconds) && deepEqualsFirebaseAuthMessages(lhs.codeLength, rhs.codeLength) && deepEqualsFirebaseAuthMessages(lhs.enrollmentCompletionDeadline, rhs.enrollmentCompletionDeadline) && deepEqualsFirebaseAuthMessages(lhs.hashingAlgorithm, rhs.hashingAlgorithm) && deepEqualsFirebaseAuthMessages(lhs.secretKey, rhs.secretKey) + } + + func hash(into hasher: inout Hasher) { + hasher.combine("InternalTotpSecret") + deepHashFirebaseAuthMessages(value: codeIntervalSeconds, hasher: &hasher) + deepHashFirebaseAuthMessages(value: codeLength, hasher: &hasher) + deepHashFirebaseAuthMessages(value: enrollmentCompletionDeadline, hasher: &hasher) + deepHashFirebaseAuthMessages(value: hashingAlgorithm, hasher: &hasher) + deepHashFirebaseAuthMessages(value: secretKey, hasher: &hasher) + } +} + +private class FirebaseAuthMessagesPigeonCodecReader: FlutterStandardReader { + override func readValue(ofType type: UInt8) -> Any? { + switch type { + case 129: + let enumResultAsInt: Int? = nilOrValue(self.readValue() as! Int?) + if let enumResultAsInt = enumResultAsInt { + return ActionCodeInfoOperation(rawValue: enumResultAsInt) + } + return nil + case 130: + return InternalMultiFactorSession.fromList(self.readValue() as! [Any?]) + case 131: + return InternalPhoneMultiFactorAssertion.fromList(self.readValue() as! [Any?]) + case 132: + return InternalMultiFactorInfo.fromList(self.readValue() as! [Any?]) + case 133: + return AuthPigeonFirebaseApp.fromList(self.readValue() as! [Any?]) + case 134: + return InternalActionCodeInfoData.fromList(self.readValue() as! [Any?]) + case 135: + return InternalActionCodeInfo.fromList(self.readValue() as! [Any?]) + case 136: + return InternalAdditionalUserInfo.fromList(self.readValue() as! [Any?]) + case 137: + return InternalAuthCredential.fromList(self.readValue() as! [Any?]) + case 138: + return InternalUserInfo.fromList(self.readValue() as! [Any?]) + case 139: + return InternalUserDetails.fromList(self.readValue() as! [Any?]) + case 140: + return InternalUserCredential.fromList(self.readValue() as! [Any?]) + case 141: + return InternalAuthCredentialInput.fromList(self.readValue() as! [Any?]) + case 142: + return InternalActionCodeSettings.fromList(self.readValue() as! [Any?]) + case 143: + return InternalFirebaseAuthSettings.fromList(self.readValue() as! [Any?]) + case 144: + return InternalSignInProvider.fromList(self.readValue() as! [Any?]) + case 145: + return InternalVerifyPhoneNumberRequest.fromList(self.readValue() as! [Any?]) + case 146: + return InternalIdTokenResult.fromList(self.readValue() as! [Any?]) + case 147: + return InternalUserProfile.fromList(self.readValue() as! [Any?]) + case 148: + return InternalTotpSecret.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) + } + } +} + +private class FirebaseAuthMessagesPigeonCodecWriter: FlutterStandardWriter { + override func writeValue(_ value: Any) { + if let value = value as? ActionCodeInfoOperation { + super.writeByte(129) + super.writeValue(value.rawValue) + } else if let value = value as? InternalMultiFactorSession { + super.writeByte(130) + super.writeValue(value.toList()) + } else if let value = value as? InternalPhoneMultiFactorAssertion { + super.writeByte(131) + super.writeValue(value.toList()) + } else if let value = value as? InternalMultiFactorInfo { + super.writeByte(132) + super.writeValue(value.toList()) + } else if let value = value as? AuthPigeonFirebaseApp { + super.writeByte(133) + super.writeValue(value.toList()) + } else if let value = value as? InternalActionCodeInfoData { + super.writeByte(134) + super.writeValue(value.toList()) + } else if let value = value as? InternalActionCodeInfo { + super.writeByte(135) + super.writeValue(value.toList()) + } else if let value = value as? InternalAdditionalUserInfo { + super.writeByte(136) + super.writeValue(value.toList()) + } else if let value = value as? InternalAuthCredential { + super.writeByte(137) + super.writeValue(value.toList()) + } else if let value = value as? InternalUserInfo { + super.writeByte(138) + super.writeValue(value.toList()) + } else if let value = value as? InternalUserDetails { + super.writeByte(139) + super.writeValue(value.toList()) + } else if let value = value as? InternalUserCredential { + super.writeByte(140) + super.writeValue(value.toList()) + } else if let value = value as? InternalAuthCredentialInput { + super.writeByte(141) + super.writeValue(value.toList()) + } else if let value = value as? InternalActionCodeSettings { + super.writeByte(142) + super.writeValue(value.toList()) + } else if let value = value as? InternalFirebaseAuthSettings { + super.writeByte(143) + super.writeValue(value.toList()) + } else if let value = value as? InternalSignInProvider { + super.writeByte(144) + super.writeValue(value.toList()) + } else if let value = value as? InternalVerifyPhoneNumberRequest { + super.writeByte(145) + super.writeValue(value.toList()) + } else if let value = value as? InternalIdTokenResult { + super.writeByte(146) + super.writeValue(value.toList()) + } else if let value = value as? InternalUserProfile { + super.writeByte(147) + super.writeValue(value.toList()) + } else if let value = value as? InternalTotpSecret { + super.writeByte(148) + super.writeValue(value.toList()) + } else { + super.writeValue(value) + } + } +} + +private class FirebaseAuthMessagesPigeonCodecReaderWriter: FlutterStandardReaderWriter { + override func reader(with data: Data) -> FlutterStandardReader { + return FirebaseAuthMessagesPigeonCodecReader(data: data) + } + + override func writer(with data: NSMutableData) -> FlutterStandardWriter { + return FirebaseAuthMessagesPigeonCodecWriter(data: data) + } +} + +class FirebaseAuthMessagesPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { + static let shared = FirebaseAuthMessagesPigeonCodec(readerWriter: FirebaseAuthMessagesPigeonCodecReaderWriter()) +} + + +/// Generated protocol from Pigeon that represents a handler of messages from Flutter. +protocol FirebaseAuthHostApi { + func registerIdTokenListener(app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void) + func registerAuthStateListener(app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void) + func useEmulator(app: AuthPigeonFirebaseApp, host: String, port: Int64, completion: @escaping (Result) -> Void) + func applyActionCode(app: AuthPigeonFirebaseApp, code: String, completion: @escaping (Result) -> Void) + func checkActionCode(app: AuthPigeonFirebaseApp, code: String, completion: @escaping (Result) -> Void) + func confirmPasswordReset(app: AuthPigeonFirebaseApp, code: String, newPassword: String, completion: @escaping (Result) -> Void) + func createUserWithEmailAndPassword(app: AuthPigeonFirebaseApp, email: String, password: String, completion: @escaping (Result) -> Void) + func signInAnonymously(app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void) + func signInWithCredential(app: AuthPigeonFirebaseApp, input: [String?: Any?], completion: @escaping (Result) -> Void) + func signInWithCustomToken(app: AuthPigeonFirebaseApp, token: String, completion: @escaping (Result) -> Void) + func signInWithEmailAndPassword(app: AuthPigeonFirebaseApp, email: String, password: String, completion: @escaping (Result) -> Void) + func signInWithEmailLink(app: AuthPigeonFirebaseApp, email: String, emailLink: String, completion: @escaping (Result) -> Void) + func signInWithProvider(app: AuthPigeonFirebaseApp, signInProvider: InternalSignInProvider, completion: @escaping (Result) -> Void) + func signOut(app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void) + func fetchSignInMethodsForEmail(app: AuthPigeonFirebaseApp, email: String, completion: @escaping (Result<[String], Error>) -> Void) + func sendPasswordResetEmail(app: AuthPigeonFirebaseApp, email: String, actionCodeSettings: InternalActionCodeSettings?, completion: @escaping (Result) -> Void) + func sendSignInLinkToEmail(app: AuthPigeonFirebaseApp, email: String, actionCodeSettings: InternalActionCodeSettings, completion: @escaping (Result) -> Void) + func setLanguageCode(app: AuthPigeonFirebaseApp, languageCode: String?, completion: @escaping (Result) -> Void) + func setSettings(app: AuthPigeonFirebaseApp, settings: InternalFirebaseAuthSettings, completion: @escaping (Result) -> Void) + func verifyPasswordResetCode(app: AuthPigeonFirebaseApp, code: String, completion: @escaping (Result) -> Void) + func verifyPhoneNumber(app: AuthPigeonFirebaseApp, request: InternalVerifyPhoneNumberRequest, completion: @escaping (Result) -> Void) + func revokeTokenWithAuthorizationCode(app: AuthPigeonFirebaseApp, authorizationCode: String, completion: @escaping (Result) -> Void) + func revokeAccessToken(app: AuthPigeonFirebaseApp, accessToken: String, completion: @escaping (Result) -> Void) + func initializeRecaptchaConfig(app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void) +} + +/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. +class FirebaseAuthHostApiSetup { + static var codec: FlutterStandardMessageCodec { FirebaseAuthMessagesPigeonCodec.shared } + /// Sets up an instance of `FirebaseAuthHostApi` to handle messages through the `binaryMessenger`. + static func setUp(binaryMessenger: FlutterBinaryMessenger, api: FirebaseAuthHostApi?, messageChannelSuffix: String = "") { + let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" + let registerIdTokenListenerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.registerIdTokenListener\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + registerIdTokenListenerChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + api.registerIdTokenListener(app: appArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + registerIdTokenListenerChannel.setMessageHandler(nil) + } + let registerAuthStateListenerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.registerAuthStateListener\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + registerAuthStateListenerChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + api.registerAuthStateListener(app: appArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + registerAuthStateListenerChannel.setMessageHandler(nil) + } + let useEmulatorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.useEmulator\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + useEmulatorChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let hostArg = args[1] as! String + let portArg = args[2] as! Int64 + api.useEmulator(app: appArg, host: hostArg, port: portArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + useEmulatorChannel.setMessageHandler(nil) + } + let applyActionCodeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.applyActionCode\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + applyActionCodeChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let codeArg = args[1] as! String + api.applyActionCode(app: appArg, code: codeArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + applyActionCodeChannel.setMessageHandler(nil) + } + let checkActionCodeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.checkActionCode\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + checkActionCodeChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let codeArg = args[1] as! String + api.checkActionCode(app: appArg, code: codeArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + checkActionCodeChannel.setMessageHandler(nil) + } + let confirmPasswordResetChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.confirmPasswordReset\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + confirmPasswordResetChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let codeArg = args[1] as! String + let newPasswordArg = args[2] as! String + api.confirmPasswordReset(app: appArg, code: codeArg, newPassword: newPasswordArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + confirmPasswordResetChannel.setMessageHandler(nil) + } + let createUserWithEmailAndPasswordChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.createUserWithEmailAndPassword\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + createUserWithEmailAndPasswordChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let emailArg = args[1] as! String + let passwordArg = args[2] as! String + api.createUserWithEmailAndPassword(app: appArg, email: emailArg, password: passwordArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + createUserWithEmailAndPasswordChannel.setMessageHandler(nil) + } + let signInAnonymouslyChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInAnonymously\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + signInAnonymouslyChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + api.signInAnonymously(app: appArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + signInAnonymouslyChannel.setMessageHandler(nil) + } + let signInWithCredentialChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithCredential\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + signInWithCredentialChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let inputArg = args[1] as! [String?: Any?] + api.signInWithCredential(app: appArg, input: inputArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + signInWithCredentialChannel.setMessageHandler(nil) + } + let signInWithCustomTokenChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithCustomToken\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + signInWithCustomTokenChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let tokenArg = args[1] as! String + api.signInWithCustomToken(app: appArg, token: tokenArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + signInWithCustomTokenChannel.setMessageHandler(nil) + } + let signInWithEmailAndPasswordChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithEmailAndPassword\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + signInWithEmailAndPasswordChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let emailArg = args[1] as! String + let passwordArg = args[2] as! String + api.signInWithEmailAndPassword(app: appArg, email: emailArg, password: passwordArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + signInWithEmailAndPasswordChannel.setMessageHandler(nil) + } + let signInWithEmailLinkChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithEmailLink\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + signInWithEmailLinkChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let emailArg = args[1] as! String + let emailLinkArg = args[2] as! String + api.signInWithEmailLink(app: appArg, email: emailArg, emailLink: emailLinkArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + signInWithEmailLinkChannel.setMessageHandler(nil) + } + let signInWithProviderChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithProvider\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + signInWithProviderChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let signInProviderArg = args[1] as! InternalSignInProvider + api.signInWithProvider(app: appArg, signInProvider: signInProviderArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + signInWithProviderChannel.setMessageHandler(nil) + } + let signOutChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signOut\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + signOutChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + api.signOut(app: appArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + signOutChannel.setMessageHandler(nil) + } + let fetchSignInMethodsForEmailChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.fetchSignInMethodsForEmail\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + fetchSignInMethodsForEmailChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let emailArg = args[1] as! String + api.fetchSignInMethodsForEmail(app: appArg, email: emailArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + fetchSignInMethodsForEmailChannel.setMessageHandler(nil) + } + let sendPasswordResetEmailChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.sendPasswordResetEmail\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + sendPasswordResetEmailChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let emailArg = args[1] as! String + let actionCodeSettingsArg: InternalActionCodeSettings? = nilOrValue(args[2]) + api.sendPasswordResetEmail(app: appArg, email: emailArg, actionCodeSettings: actionCodeSettingsArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + sendPasswordResetEmailChannel.setMessageHandler(nil) + } + let sendSignInLinkToEmailChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.sendSignInLinkToEmail\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + sendSignInLinkToEmailChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let emailArg = args[1] as! String + let actionCodeSettingsArg = args[2] as! InternalActionCodeSettings + api.sendSignInLinkToEmail(app: appArg, email: emailArg, actionCodeSettings: actionCodeSettingsArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + sendSignInLinkToEmailChannel.setMessageHandler(nil) + } + let setLanguageCodeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.setLanguageCode\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setLanguageCodeChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let languageCodeArg: String? = nilOrValue(args[1]) + api.setLanguageCode(app: appArg, languageCode: languageCodeArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + setLanguageCodeChannel.setMessageHandler(nil) + } + let setSettingsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.setSettings\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setSettingsChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let settingsArg = args[1] as! InternalFirebaseAuthSettings + api.setSettings(app: appArg, settings: settingsArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + setSettingsChannel.setMessageHandler(nil) + } + let verifyPasswordResetCodeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.verifyPasswordResetCode\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + verifyPasswordResetCodeChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let codeArg = args[1] as! String + api.verifyPasswordResetCode(app: appArg, code: codeArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + verifyPasswordResetCodeChannel.setMessageHandler(nil) + } + let verifyPhoneNumberChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.verifyPhoneNumber\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + verifyPhoneNumberChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let requestArg = args[1] as! InternalVerifyPhoneNumberRequest + api.verifyPhoneNumber(app: appArg, request: requestArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + verifyPhoneNumberChannel.setMessageHandler(nil) + } + let revokeTokenWithAuthorizationCodeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.revokeTokenWithAuthorizationCode\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + revokeTokenWithAuthorizationCodeChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let authorizationCodeArg = args[1] as! String + api.revokeTokenWithAuthorizationCode(app: appArg, authorizationCode: authorizationCodeArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + revokeTokenWithAuthorizationCodeChannel.setMessageHandler(nil) + } + let revokeAccessTokenChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.revokeAccessToken\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + revokeAccessTokenChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let accessTokenArg = args[1] as! String + api.revokeAccessToken(app: appArg, accessToken: accessTokenArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + revokeAccessTokenChannel.setMessageHandler(nil) + } + let initializeRecaptchaConfigChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.initializeRecaptchaConfig\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + initializeRecaptchaConfigChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + api.initializeRecaptchaConfig(app: appArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + initializeRecaptchaConfigChannel.setMessageHandler(nil) + } + } +} +/// Generated protocol from Pigeon that represents a handler of messages from Flutter. +protocol FirebaseAuthUserHostApi { + func delete(app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void) + func getIdToken(app: AuthPigeonFirebaseApp, forceRefresh: Bool, completion: @escaping (Result) -> Void) + func linkWithCredential(app: AuthPigeonFirebaseApp, input: [String?: Any?], completion: @escaping (Result) -> Void) + func linkWithProvider(app: AuthPigeonFirebaseApp, signInProvider: InternalSignInProvider, completion: @escaping (Result) -> Void) + func reauthenticateWithCredential(app: AuthPigeonFirebaseApp, input: [String?: Any?], completion: @escaping (Result) -> Void) + func reauthenticateWithProvider(app: AuthPigeonFirebaseApp, signInProvider: InternalSignInProvider, completion: @escaping (Result) -> Void) + func reload(app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void) + func sendEmailVerification(app: AuthPigeonFirebaseApp, actionCodeSettings: InternalActionCodeSettings?, completion: @escaping (Result) -> Void) + func unlink(app: AuthPigeonFirebaseApp, providerId: String, completion: @escaping (Result) -> Void) + func updateEmail(app: AuthPigeonFirebaseApp, newEmail: String, completion: @escaping (Result) -> Void) + func updatePassword(app: AuthPigeonFirebaseApp, newPassword: String, completion: @escaping (Result) -> Void) + func updatePhoneNumber(app: AuthPigeonFirebaseApp, input: [String?: Any?], completion: @escaping (Result) -> Void) + func updateProfile(app: AuthPigeonFirebaseApp, profile: InternalUserProfile, completion: @escaping (Result) -> Void) + func verifyBeforeUpdateEmail(app: AuthPigeonFirebaseApp, newEmail: String, actionCodeSettings: InternalActionCodeSettings?, completion: @escaping (Result) -> Void) +} + +/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. +class FirebaseAuthUserHostApiSetup { + static var codec: FlutterStandardMessageCodec { FirebaseAuthMessagesPigeonCodec.shared } + /// Sets up an instance of `FirebaseAuthUserHostApi` to handle messages through the `binaryMessenger`. + static func setUp(binaryMessenger: FlutterBinaryMessenger, api: FirebaseAuthUserHostApi?, messageChannelSuffix: String = "") { + let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" + let deleteChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.delete\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + deleteChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + api.delete(app: appArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + deleteChannel.setMessageHandler(nil) + } + let getIdTokenChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.getIdToken\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getIdTokenChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let forceRefreshArg = args[1] as! Bool + api.getIdToken(app: appArg, forceRefresh: forceRefreshArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + getIdTokenChannel.setMessageHandler(nil) + } + let linkWithCredentialChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.linkWithCredential\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + linkWithCredentialChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let inputArg = args[1] as! [String?: Any?] + api.linkWithCredential(app: appArg, input: inputArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + linkWithCredentialChannel.setMessageHandler(nil) + } + let linkWithProviderChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.linkWithProvider\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + linkWithProviderChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let signInProviderArg = args[1] as! InternalSignInProvider + api.linkWithProvider(app: appArg, signInProvider: signInProviderArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + linkWithProviderChannel.setMessageHandler(nil) + } + let reauthenticateWithCredentialChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.reauthenticateWithCredential\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + reauthenticateWithCredentialChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let inputArg = args[1] as! [String?: Any?] + api.reauthenticateWithCredential(app: appArg, input: inputArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + reauthenticateWithCredentialChannel.setMessageHandler(nil) + } + let reauthenticateWithProviderChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.reauthenticateWithProvider\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + reauthenticateWithProviderChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let signInProviderArg = args[1] as! InternalSignInProvider + api.reauthenticateWithProvider(app: appArg, signInProvider: signInProviderArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + reauthenticateWithProviderChannel.setMessageHandler(nil) + } + let reloadChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.reload\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + reloadChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + api.reload(app: appArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + reloadChannel.setMessageHandler(nil) + } + let sendEmailVerificationChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.sendEmailVerification\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + sendEmailVerificationChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let actionCodeSettingsArg: InternalActionCodeSettings? = nilOrValue(args[1]) + api.sendEmailVerification(app: appArg, actionCodeSettings: actionCodeSettingsArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + sendEmailVerificationChannel.setMessageHandler(nil) + } + let unlinkChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.unlink\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + unlinkChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let providerIdArg = args[1] as! String + api.unlink(app: appArg, providerId: providerIdArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + unlinkChannel.setMessageHandler(nil) + } + let updateEmailChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updateEmail\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + updateEmailChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let newEmailArg = args[1] as! String + api.updateEmail(app: appArg, newEmail: newEmailArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + updateEmailChannel.setMessageHandler(nil) + } + let updatePasswordChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updatePassword\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + updatePasswordChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let newPasswordArg = args[1] as! String + api.updatePassword(app: appArg, newPassword: newPasswordArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + updatePasswordChannel.setMessageHandler(nil) + } + let updatePhoneNumberChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updatePhoneNumber\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + updatePhoneNumberChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let inputArg = args[1] as! [String?: Any?] + api.updatePhoneNumber(app: appArg, input: inputArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + updatePhoneNumberChannel.setMessageHandler(nil) + } + let updateProfileChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updateProfile\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + updateProfileChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let profileArg = args[1] as! InternalUserProfile + api.updateProfile(app: appArg, profile: profileArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + updateProfileChannel.setMessageHandler(nil) + } + let verifyBeforeUpdateEmailChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.verifyBeforeUpdateEmail\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + verifyBeforeUpdateEmailChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let newEmailArg = args[1] as! String + let actionCodeSettingsArg: InternalActionCodeSettings? = nilOrValue(args[2]) + api.verifyBeforeUpdateEmail(app: appArg, newEmail: newEmailArg, actionCodeSettings: actionCodeSettingsArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + verifyBeforeUpdateEmailChannel.setMessageHandler(nil) + } + } +} +/// Generated protocol from Pigeon that represents a handler of messages from Flutter. +protocol MultiFactorUserHostApi { + func enrollPhone(app: AuthPigeonFirebaseApp, assertion: InternalPhoneMultiFactorAssertion, displayName: String?, completion: @escaping (Result) -> Void) + func enrollTotp(app: AuthPigeonFirebaseApp, assertionId: String, displayName: String?, completion: @escaping (Result) -> Void) + func getSession(app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void) + func unenroll(app: AuthPigeonFirebaseApp, factorUid: String, completion: @escaping (Result) -> Void) + func getEnrolledFactors(app: AuthPigeonFirebaseApp, completion: @escaping (Result<[InternalMultiFactorInfo], Error>) -> Void) +} + +/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. +class MultiFactorUserHostApiSetup { + static var codec: FlutterStandardMessageCodec { FirebaseAuthMessagesPigeonCodec.shared } + /// Sets up an instance of `MultiFactorUserHostApi` to handle messages through the `binaryMessenger`. + static func setUp(binaryMessenger: FlutterBinaryMessenger, api: MultiFactorUserHostApi?, messageChannelSuffix: String = "") { + let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" + let enrollPhoneChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.enrollPhone\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + enrollPhoneChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let assertionArg = args[1] as! InternalPhoneMultiFactorAssertion + let displayNameArg: String? = nilOrValue(args[2]) + api.enrollPhone(app: appArg, assertion: assertionArg, displayName: displayNameArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + enrollPhoneChannel.setMessageHandler(nil) + } + let enrollTotpChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.enrollTotp\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + enrollTotpChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let assertionIdArg = args[1] as! String + let displayNameArg: String? = nilOrValue(args[2]) + api.enrollTotp(app: appArg, assertionId: assertionIdArg, displayName: displayNameArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + enrollTotpChannel.setMessageHandler(nil) + } + let getSessionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.getSession\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getSessionChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + api.getSession(app: appArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + getSessionChannel.setMessageHandler(nil) + } + let unenrollChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.unenroll\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + unenrollChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + let factorUidArg = args[1] as! String + api.unenroll(app: appArg, factorUid: factorUidArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + unenrollChannel.setMessageHandler(nil) + } + let getEnrolledFactorsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.getEnrolledFactors\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getEnrolledFactorsChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let appArg = args[0] as! AuthPigeonFirebaseApp + api.getEnrolledFactors(app: appArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + getEnrolledFactorsChannel.setMessageHandler(nil) + } + } +} +/// Generated protocol from Pigeon that represents a handler of messages from Flutter. +protocol MultiFactoResolverHostApi { + func resolveSignIn(resolverId: String, assertion: InternalPhoneMultiFactorAssertion?, totpAssertionId: String?, completion: @escaping (Result) -> Void) +} + +/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. +class MultiFactoResolverHostApiSetup { + static var codec: FlutterStandardMessageCodec { FirebaseAuthMessagesPigeonCodec.shared } + /// Sets up an instance of `MultiFactoResolverHostApi` to handle messages through the `binaryMessenger`. + static func setUp(binaryMessenger: FlutterBinaryMessenger, api: MultiFactoResolverHostApi?, messageChannelSuffix: String = "") { + let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" + let resolveSignInChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactoResolverHostApi.resolveSignIn\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + resolveSignInChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let resolverIdArg = args[0] as! String + let assertionArg: InternalPhoneMultiFactorAssertion? = nilOrValue(args[1]) + let totpAssertionIdArg: String? = nilOrValue(args[2]) + api.resolveSignIn(resolverId: resolverIdArg, assertion: assertionArg, totpAssertionId: totpAssertionIdArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + resolveSignInChannel.setMessageHandler(nil) + } + } +} +/// Generated protocol from Pigeon that represents a handler of messages from Flutter. +protocol MultiFactorTotpHostApi { + func generateSecret(sessionId: String, completion: @escaping (Result) -> Void) + func getAssertionForEnrollment(secretKey: String, oneTimePassword: String, completion: @escaping (Result) -> Void) + func getAssertionForSignIn(enrollmentId: String, oneTimePassword: String, completion: @escaping (Result) -> Void) +} + +/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. +class MultiFactorTotpHostApiSetup { + static var codec: FlutterStandardMessageCodec { FirebaseAuthMessagesPigeonCodec.shared } + /// Sets up an instance of `MultiFactorTotpHostApi` to handle messages through the `binaryMessenger`. + static func setUp(binaryMessenger: FlutterBinaryMessenger, api: MultiFactorTotpHostApi?, messageChannelSuffix: String = "") { + let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" + let generateSecretChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpHostApi.generateSecret\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + generateSecretChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let sessionIdArg = args[0] as! String + api.generateSecret(sessionId: sessionIdArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + generateSecretChannel.setMessageHandler(nil) + } + let getAssertionForEnrollmentChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpHostApi.getAssertionForEnrollment\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getAssertionForEnrollmentChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let secretKeyArg = args[0] as! String + let oneTimePasswordArg = args[1] as! String + api.getAssertionForEnrollment(secretKey: secretKeyArg, oneTimePassword: oneTimePasswordArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + getAssertionForEnrollmentChannel.setMessageHandler(nil) + } + let getAssertionForSignInChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpHostApi.getAssertionForSignIn\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getAssertionForSignInChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let enrollmentIdArg = args[0] as! String + let oneTimePasswordArg = args[1] as! String + api.getAssertionForSignIn(enrollmentId: enrollmentIdArg, oneTimePassword: oneTimePasswordArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + getAssertionForSignInChannel.setMessageHandler(nil) + } + } +} +/// Generated protocol from Pigeon that represents a handler of messages from Flutter. +protocol MultiFactorTotpSecretHostApi { + func generateQrCodeUrl(secretKey: String, accountName: String?, issuer: String?, completion: @escaping (Result) -> Void) + func openInOtpApp(secretKey: String, qrCodeUrl: String, completion: @escaping (Result) -> Void) +} + +/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. +class MultiFactorTotpSecretHostApiSetup { + static var codec: FlutterStandardMessageCodec { FirebaseAuthMessagesPigeonCodec.shared } + /// Sets up an instance of `MultiFactorTotpSecretHostApi` to handle messages through the `binaryMessenger`. + static func setUp(binaryMessenger: FlutterBinaryMessenger, api: MultiFactorTotpSecretHostApi?, messageChannelSuffix: String = "") { + let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" + let generateQrCodeUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpSecretHostApi.generateQrCodeUrl\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + generateQrCodeUrlChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let secretKeyArg = args[0] as! String + let accountNameArg: String? = nilOrValue(args[1]) + let issuerArg: String? = nilOrValue(args[2]) + api.generateQrCodeUrl(secretKey: secretKeyArg, accountName: accountNameArg, issuer: issuerArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + generateQrCodeUrlChannel.setMessageHandler(nil) + } + let openInOtpAppChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpSecretHostApi.openInOtpApp\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + openInOtpAppChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let secretKeyArg = args[0] as! String + let qrCodeUrlArg = args[1] as! String + api.openInOtpApp(secretKey: secretKeyArg, qrCodeUrl: qrCodeUrlArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + openInOtpAppChannel.setMessageHandler(nil) + } + } +} +/// Only used to generate the object interface that are use outside of the Pigeon interface +/// +/// Generated protocol from Pigeon that represents a handler of messages from Flutter. +protocol GenerateInterfaces { + func pigeonInterface(info: InternalMultiFactorInfo) throws +} + +/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. +class GenerateInterfacesSetup { + static var codec: FlutterStandardMessageCodec { FirebaseAuthMessagesPigeonCodec.shared } + /// Sets up an instance of `GenerateInterfaces` to handle messages through the `binaryMessenger`. + static func setUp(binaryMessenger: FlutterBinaryMessenger, api: GenerateInterfaces?, messageChannelSuffix: String = "") { + let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" + let pigeonInterfaceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.GenerateInterfaces.pigeonInterface\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + pigeonInterfaceChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let infoArg = args[0] as! InternalMultiFactorInfo + do { + try api.pigeonInterface(info: infoArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } + } + } else { + pigeonInterfaceChannel.setMessageHandler(nil) + } + } +} diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/PigeonParser.m b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/PigeonParser.m deleted file mode 100644 index 8d7a7b1c2f0e..000000000000 --- a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/PigeonParser.m +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright 2023, the Chromium project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -@import FirebaseAuth; - -#import "include/Private/PigeonParser.h" -#import -#import "include/Public/CustomPigeonHeader.h" - -@implementation PigeonParser - -+ (InternalUserCredential *) - getPigeonUserCredentialFromAuthResult:(nonnull FIRAuthDataResult *)authResult - authorizationCode:(nullable NSString *)authorizationCode { - return [InternalUserCredential - makeWithUser:[self getPigeonDetails:authResult.user] - additionalUserInfo:[self getPigeonAdditionalUserInfo:authResult.additionalUserInfo - authorizationCode:authorizationCode] - credential:[self getPigeonAuthCredential:authResult.credential token:nil]]; -} - -+ (InternalUserCredential *)getPigeonUserCredentialFromFIRUser:(nonnull FIRUser *)user { - return [InternalUserCredential makeWithUser:[self getPigeonDetails:user] - additionalUserInfo:nil - credential:nil]; -} - -+ (InternalUserDetails *)getPigeonDetails:(nonnull FIRUser *)user { - return [InternalUserDetails makeWithUserInfo:[self getPigeonUserInfo:user] - providerData:[self getProviderData:user.providerData]]; -} - -+ (InternalUserInfo *)getPigeonUserInfo:(nonnull FIRUser *)user { - NSString *photoUrlString = user.photoURL.absoluteString; - return [InternalUserInfo - makeWithUid:user.uid - email:user.email - displayName:user.displayName - photoUrl:(photoUrlString.length > 0) ? photoUrlString : nil - phoneNumber:user.phoneNumber - isAnonymous:user.isAnonymous - isEmailVerified:user.emailVerified - providerId:user.providerID - tenantId:user.tenantID - refreshToken:user.refreshToken - creationTimestamp:@((long)([user.metadata.creationDate timeIntervalSince1970] * 1000)) - lastSignInTimestamp:@((long)([user.metadata.lastSignInDate timeIntervalSince1970] * 1000))]; -} - -+ (NSArray *> *)getProviderData: - (nonnull NSArray> *)providerData { - NSMutableArray *> *dataArray = - [NSMutableArray arrayWithCapacity:providerData.count]; - - for (id userInfo in providerData) { - NSString *photoUrlStr = userInfo.photoURL.absoluteString; - NSDictionary *dataDict = @{ - @"providerId" : userInfo.providerID, - // Can be null on emulator - @"uid" : userInfo.uid ?: @"", - @"displayName" : userInfo.displayName ?: [NSNull null], - @"email" : userInfo.email ?: [NSNull null], - @"phoneNumber" : userInfo.phoneNumber ?: [NSNull null], - @"photoURL" : photoUrlStr ?: [NSNull null], - // isAnonymous is always false on in a providerData object (the user is not anonymous) - @"isAnonymous" : @NO, - // isEmailVerified is always true on in a providerData object (the email is verified by the - // provider) - @"isEmailVerified" : @YES, - }; - [dataArray addObject:dataDict]; - } - return [dataArray copy]; -} - -+ (InternalAdditionalUserInfo *)getPigeonAdditionalUserInfo: - (nonnull FIRAdditionalUserInfo *)userInfo - authorizationCode:(nullable NSString *)authorizationCode { - return [InternalAdditionalUserInfo makeWithIsNewUser:userInfo.isNewUser - providerId:userInfo.providerID - username:userInfo.username - authorizationCode:authorizationCode - profile:userInfo.profile]; -} - -+ (InternalTotpSecret *)getPigeonTotpSecret:(FIRTOTPSecret *)secret { - return [InternalTotpSecret makeWithCodeIntervalSeconds:nil - codeLength:nil - enrollmentCompletionDeadline:nil - hashingAlgorithm:nil - secretKey:secret.sharedSecretKey]; -} - -+ (InternalAuthCredential *)getPigeonAuthCredential:(FIRAuthCredential *)authCredential - token:(NSNumber *_Nullable)token { - if (authCredential == nil) { - return nil; - } - - NSString *accessToken = nil; - if ([authCredential isKindOfClass:[FIROAuthCredential class]]) { - if (((FIROAuthCredential *)authCredential).accessToken != nil) { - accessToken = ((FIROAuthCredential *)authCredential).accessToken; - } else if (((FIROAuthCredential *)authCredential).IDToken != nil) { - // For Sign In With Apple, the token is stored in IDToken - accessToken = ((FIROAuthCredential *)authCredential).IDToken; - } - } - - NSUInteger nativeId = - token != nil ? [token unsignedLongValue] : (NSUInteger)[authCredential hash]; - - return [InternalAuthCredential makeWithProviderId:authCredential.provider - signInMethod:authCredential.provider - nativeId:nativeId - accessToken:accessToken ?: nil]; -} - -+ (FIRActionCodeSettings *_Nullable)parseActionCodeSettings: - (nullable InternalActionCodeSettings *)settings { - if (settings == nil) { - return nil; - } - - FIRActionCodeSettings *codeSettings = [[FIRActionCodeSettings alloc] init]; - - if (settings.url != nil) { - codeSettings.URL = [NSURL URLWithString:settings.url]; - } - - if (settings.linkDomain != nil) { - codeSettings.linkDomain = settings.linkDomain; - } - - codeSettings.handleCodeInApp = settings.handleCodeInApp; - - if (settings.iOSBundleId != nil) { - codeSettings.iOSBundleID = settings.iOSBundleId; - } - - return codeSettings; -} - -+ (InternalIdTokenResult *)parseIdTokenResult:(FIRAuthTokenResult *)tokenResult { - long expirationTimestamp = (long)[tokenResult.expirationDate timeIntervalSince1970] * 1000; - long authTimestamp = (long)[tokenResult.authDate timeIntervalSince1970] * 1000; - long issuedAtTimestamp = (long)[tokenResult.issuedAtDate timeIntervalSince1970] * 1000; - - return [InternalIdTokenResult makeWithToken:tokenResult.token - expirationTimestamp:@(expirationTimestamp) - authTimestamp:@(authTimestamp) - issuedAtTimestamp:@(issuedAtTimestamp) - signInProvider:tokenResult.signInProvider - claims:tokenResult.claims - signInSecondFactor:tokenResult.signInSecondFactor]; -} - -+ (NSArray *_Nonnull)getManualList:(nonnull InternalUserDetails *)userDetails { - NSMutableArray *output = [NSMutableArray array]; - - id userInfoList = [[userDetails userInfo] toList]; - [output addObject:userInfoList]; - - id providerData = [userDetails providerData]; - [output addObject:providerData]; - - return [output copy]; -} - -@end diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/PigeonParser.swift b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/PigeonParser.swift new file mode 100644 index 000000000000..c6939027271f --- /dev/null +++ b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/PigeonParser.swift @@ -0,0 +1,142 @@ +// Copyright 2023, the Chromium project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import FirebaseAuth +import Foundation + +enum PigeonParser { + static func getPigeonUserCredentialFromAuthResult( + _ authResult: AuthDataResult, + authorizationCode: String? + ) -> InternalUserCredential { + InternalUserCredential( + user: getPigeonDetails(authResult.user), + additionalUserInfo: getPigeonAdditionalUserInfo( + authResult.additionalUserInfo, authorizationCode: authorizationCode), + credential: getPigeonAuthCredential(authResult.credential, token: nil) + ) + } + + static func getPigeonUserCredentialFromFIRUser(_ user: User) -> InternalUserCredential { + InternalUserCredential(user: getPigeonDetails(user), additionalUserInfo: nil, credential: nil) + } + + static func getPigeonDetails(_ user: User) -> InternalUserDetails { + InternalUserDetails( + userInfo: getPigeonUserInfo(user), + providerData: getProviderData(user.providerData) + ) + } + + static func getPigeonUserInfo(_ user: User) -> InternalUserInfo { + let photoUrlString = user.photoURL?.absoluteString + return InternalUserInfo( + uid: user.uid, + email: user.email, + displayName: user.displayName, + photoUrl: (photoUrlString?.isEmpty == false) ? photoUrlString : nil, + phoneNumber: user.phoneNumber, + isAnonymous: user.isAnonymous, + isEmailVerified: user.isEmailVerified, + providerId: user.providerID, + tenantId: user.tenantID, + refreshToken: user.refreshToken, + creationTimestamp: Int64((user.metadata.creationDate?.timeIntervalSince1970 ?? 0) * 1000), + lastSignInTimestamp: Int64((user.metadata.lastSignInDate?.timeIntervalSince1970 ?? 0) * 1000) + ) + } + + static func getProviderData(_ providerData: [UserInfo]) -> [[AnyHashable?: Any?]?] { + providerData.map { userInfo in + let photoUrlStr = userInfo.photoURL?.absoluteString + return [ + "providerId": userInfo.providerID, + "uid": userInfo.uid.isEmpty ? "" : userInfo.uid, + "displayName": userInfo.displayName as Any, + "email": userInfo.email as Any, + "phoneNumber": userInfo.phoneNumber as Any, + "photoURL": photoUrlStr as Any, + "isAnonymous": false, + "isEmailVerified": true, + ] + } + } + + static func getPigeonAdditionalUserInfo( + _ userInfo: AdditionalUserInfo?, + authorizationCode: String? + ) -> InternalAdditionalUserInfo? { + guard let userInfo else { return nil } + return InternalAdditionalUserInfo( + isNewUser: userInfo.isNewUser, + providerId: userInfo.providerID, + username: userInfo.username, + authorizationCode: authorizationCode, + profile: pigeonMap(userInfo.profile) + ) + } + + static func getPigeonTotpSecret(_ secret: TOTPSecret) -> InternalTotpSecret { + InternalTotpSecret(secretKey: secret.sharedSecretKey()) + } + + static func getPigeonAuthCredential(_ authCredential: AuthCredential?, token: NSNumber?) + -> InternalAuthCredential? + { + guard let authCredential else { return nil } + + var accessToken: String? + if let oauth = authCredential as? OAuthCredential { + accessToken = oauth.accessToken ?? oauth.idToken + } + + let hashId = token?.int64Value ?? Int64(authCredential.hash) + + return InternalAuthCredential( + providerId: authCredential.provider, + signInMethod: authCredential.provider, + nativeId: hashId, + accessToken: accessToken + ) + } + + static func parseActionCodeSettings(_ settings: InternalActionCodeSettings?) -> ActionCodeSettings? { + guard let settings else { return nil } + let codeSettings = ActionCodeSettings() + codeSettings.url = URL(string: settings.url) + if let linkDomain = settings.linkDomain { + codeSettings.linkDomain = linkDomain + } + codeSettings.handleCodeInApp = settings.handleCodeInApp + if let iOSBundleId = settings.iOSBundleId { + codeSettings.iOSBundleID = iOSBundleId + } + return codeSettings + } + + static func parseIdTokenResult(_ tokenResult: AuthTokenResult) -> InternalIdTokenResult { + InternalIdTokenResult( + token: tokenResult.token, + expirationTimestamp: Int64(tokenResult.expirationDate.timeIntervalSince1970 * 1000), + authTimestamp: Int64(tokenResult.authDate.timeIntervalSince1970 * 1000), + issuedAtTimestamp: Int64(tokenResult.issuedAtDate.timeIntervalSince1970 * 1000), + signInProvider: tokenResult.signInProvider, + claims: pigeonMap(tokenResult.claims), + signInSecondFactor: tokenResult.signInSecondFactor + ) + } + + static func getManualList(_ userDetails: InternalUserDetails) -> [Any] { + [userDetails.userInfo.toList(), userDetails.providerData] + } + + static func pigeonMap(_ map: [String: Any]?) -> [String?: Any?]? { + guard let map else { return nil } + var result: [String?: Any?] = [:] + for (key, value) in map { + result[key] = value + } + return result + } +} diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/firebase_auth_messages.g.m b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/firebase_auth_messages.g.m deleted file mode 100644 index 82ae8cfcccc7..000000000000 --- a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/firebase_auth_messages.g.m +++ /dev/null @@ -1,3005 +0,0 @@ -// Copyright 2023, the Chromium project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. -// Autogenerated from Pigeon (v26.3.4), do not edit directly. -// See also: https://pub.dev/packages/pigeon - -#import "include/Public/firebase_auth_messages.g.h" - -#if TARGET_OS_OSX -@import FlutterMacOS; -#else -@import Flutter; -#endif - -static BOOL __attribute__((unused)) FLTPigeonDeepEquals(id _Nullable a, id _Nullable b) { - if (a == b) { - return YES; - } - if (a == nil) { - return b == [NSNull null]; - } - if (b == nil) { - return a == [NSNull null]; - } - if ([a isKindOfClass:[NSNumber class]] && [b isKindOfClass:[NSNumber class]]) { - return - [a isEqual:b] || (isnan([(NSNumber *)a doubleValue]) && isnan([(NSNumber *)b doubleValue])); - } - if ([a isKindOfClass:[NSArray class]] && [b isKindOfClass:[NSArray class]]) { - NSArray *arrayA = (NSArray *)a; - NSArray *arrayB = (NSArray *)b; - if (arrayA.count != arrayB.count) { - return NO; - } - for (NSUInteger i = 0; i < arrayA.count; i++) { - if (!FLTPigeonDeepEquals(arrayA[i], arrayB[i])) { - return NO; - } - } - return YES; - } - if ([a isKindOfClass:[NSDictionary class]] && [b isKindOfClass:[NSDictionary class]]) { - NSDictionary *dictA = (NSDictionary *)a; - NSDictionary *dictB = (NSDictionary *)b; - if (dictA.count != dictB.count) { - return NO; - } - for (id keyA in dictA) { - id valueA = dictA[keyA]; - BOOL found = NO; - for (id keyB in dictB) { - if (FLTPigeonDeepEquals(keyA, keyB)) { - id valueB = dictB[keyB]; - if (FLTPigeonDeepEquals(valueA, valueB)) { - found = YES; - break; - } else { - return NO; - } - } - } - if (!found) { - return NO; - } - } - return YES; - } - return [a isEqual:b]; -} - -static NSUInteger __attribute__((unused)) FLTPigeonDeepHash(id _Nullable value) { - if (value == nil || value == (id)[NSNull null]) { - return 0; - } - if ([value isKindOfClass:[NSNumber class]]) { - NSNumber *n = (NSNumber *)value; - double d = n.doubleValue; - if (isnan(d)) { - // Normalize NaN to a consistent hash. - return (NSUInteger)0x7FF8000000000000; - } - if (d == 0.0) { - // Normalize -0.0 to 0.0 so they have the same hash code. - d = 0.0; - } - return @(d).hash; - } - if ([value isKindOfClass:[NSArray class]]) { - NSUInteger result = 1; - for (id item in (NSArray *)value) { - result = result * 31 + FLTPigeonDeepHash(item); - } - return result; - } - if ([value isKindOfClass:[NSDictionary class]]) { - NSUInteger result = 0; - NSDictionary *dict = (NSDictionary *)value; - for (id key in dict) { - result += ((FLTPigeonDeepHash(key) * 31) ^ FLTPigeonDeepHash(dict[key])); - } - return result; - } - return [value hash]; -} - -static NSArray *wrapResult(id result, FlutterError *error) { - if (error) { - return @[ - error.code ?: [NSNull null], error.message ?: [NSNull null], error.details ?: [NSNull null] - ]; - } - return @[ result ?: [NSNull null] ]; -} - -static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { - id result = array[key]; - return (result == [NSNull null]) ? nil : result; -} - -/// The type of operation that generated the action code from calling -/// [checkActionCode]. -@implementation ActionCodeInfoOperationBox -- (instancetype)initWithValue:(ActionCodeInfoOperation)value { - self = [super init]; - if (self) { - _value = value; - } - return self; -} -@end - -@interface InternalMultiFactorSession () -+ (InternalMultiFactorSession *)fromList:(NSArray *)list; -+ (nullable InternalMultiFactorSession *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - -@interface InternalPhoneMultiFactorAssertion () -+ (InternalPhoneMultiFactorAssertion *)fromList:(NSArray *)list; -+ (nullable InternalPhoneMultiFactorAssertion *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - -@interface InternalMultiFactorInfo () -+ (InternalMultiFactorInfo *)fromList:(NSArray *)list; -+ (nullable InternalMultiFactorInfo *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - -@interface AuthPigeonFirebaseApp () -+ (AuthPigeonFirebaseApp *)fromList:(NSArray *)list; -+ (nullable AuthPigeonFirebaseApp *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - -@interface InternalActionCodeInfoData () -+ (InternalActionCodeInfoData *)fromList:(NSArray *)list; -+ (nullable InternalActionCodeInfoData *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - -@interface InternalActionCodeInfo () -+ (InternalActionCodeInfo *)fromList:(NSArray *)list; -+ (nullable InternalActionCodeInfo *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - -@interface InternalAdditionalUserInfo () -+ (InternalAdditionalUserInfo *)fromList:(NSArray *)list; -+ (nullable InternalAdditionalUserInfo *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - -@interface InternalAuthCredential () -+ (InternalAuthCredential *)fromList:(NSArray *)list; -+ (nullable InternalAuthCredential *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - -@interface InternalUserInfo () -+ (InternalUserInfo *)fromList:(NSArray *)list; -+ (nullable InternalUserInfo *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - -@interface InternalUserDetails () -+ (InternalUserDetails *)fromList:(NSArray *)list; -+ (nullable InternalUserDetails *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - -@interface InternalUserCredential () -+ (InternalUserCredential *)fromList:(NSArray *)list; -+ (nullable InternalUserCredential *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - -@interface InternalAuthCredentialInput () -+ (InternalAuthCredentialInput *)fromList:(NSArray *)list; -+ (nullable InternalAuthCredentialInput *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - -@interface InternalActionCodeSettings () -+ (InternalActionCodeSettings *)fromList:(NSArray *)list; -+ (nullable InternalActionCodeSettings *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - -@interface InternalFirebaseAuthSettings () -+ (InternalFirebaseAuthSettings *)fromList:(NSArray *)list; -+ (nullable InternalFirebaseAuthSettings *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - -@interface InternalSignInProvider () -+ (InternalSignInProvider *)fromList:(NSArray *)list; -+ (nullable InternalSignInProvider *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - -@interface InternalVerifyPhoneNumberRequest () -+ (InternalVerifyPhoneNumberRequest *)fromList:(NSArray *)list; -+ (nullable InternalVerifyPhoneNumberRequest *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - -@interface InternalIdTokenResult () -+ (InternalIdTokenResult *)fromList:(NSArray *)list; -+ (nullable InternalIdTokenResult *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - -@interface InternalUserProfile () -+ (InternalUserProfile *)fromList:(NSArray *)list; -+ (nullable InternalUserProfile *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - -@interface InternalTotpSecret () -+ (InternalTotpSecret *)fromList:(NSArray *)list; -+ (nullable InternalTotpSecret *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - -@implementation InternalMultiFactorSession -+ (instancetype)makeWithId:(NSString *)id { - InternalMultiFactorSession *pigeonResult = [[InternalMultiFactorSession alloc] init]; - pigeonResult.id = id; - return pigeonResult; -} -+ (InternalMultiFactorSession *)fromList:(NSArray *)list { - InternalMultiFactorSession *pigeonResult = [[InternalMultiFactorSession alloc] init]; - pigeonResult.id = GetNullableObjectAtIndex(list, 0); - return pigeonResult; -} -+ (nullable InternalMultiFactorSession *)nullableFromList:(NSArray *)list { - return (list) ? [InternalMultiFactorSession fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - self.id ?: [NSNull null], - ]; -} -- (BOOL)isEqual:(id)object { - if (self == object) { - return YES; - } - if (![object isKindOfClass:[self class]]) { - return NO; - } - InternalMultiFactorSession *other = (InternalMultiFactorSession *)object; - return FLTPigeonDeepEquals(self.id, other.id); -} - -- (NSUInteger)hash { - NSUInteger result = [self class].hash; - result = result * 31 + FLTPigeonDeepHash(self.id); - return result; -} -@end - -@implementation InternalPhoneMultiFactorAssertion -+ (instancetype)makeWithVerificationId:(NSString *)verificationId - verificationCode:(NSString *)verificationCode { - InternalPhoneMultiFactorAssertion *pigeonResult = - [[InternalPhoneMultiFactorAssertion alloc] init]; - pigeonResult.verificationId = verificationId; - pigeonResult.verificationCode = verificationCode; - return pigeonResult; -} -+ (InternalPhoneMultiFactorAssertion *)fromList:(NSArray *)list { - InternalPhoneMultiFactorAssertion *pigeonResult = - [[InternalPhoneMultiFactorAssertion alloc] init]; - pigeonResult.verificationId = GetNullableObjectAtIndex(list, 0); - pigeonResult.verificationCode = GetNullableObjectAtIndex(list, 1); - return pigeonResult; -} -+ (nullable InternalPhoneMultiFactorAssertion *)nullableFromList:(NSArray *)list { - return (list) ? [InternalPhoneMultiFactorAssertion fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - self.verificationId ?: [NSNull null], - self.verificationCode ?: [NSNull null], - ]; -} -- (BOOL)isEqual:(id)object { - if (self == object) { - return YES; - } - if (![object isKindOfClass:[self class]]) { - return NO; - } - InternalPhoneMultiFactorAssertion *other = (InternalPhoneMultiFactorAssertion *)object; - return FLTPigeonDeepEquals(self.verificationId, other.verificationId) && - FLTPigeonDeepEquals(self.verificationCode, other.verificationCode); -} - -- (NSUInteger)hash { - NSUInteger result = [self class].hash; - result = result * 31 + FLTPigeonDeepHash(self.verificationId); - result = result * 31 + FLTPigeonDeepHash(self.verificationCode); - return result; -} -@end - -@implementation InternalMultiFactorInfo -+ (instancetype)makeWithDisplayName:(nullable NSString *)displayName - enrollmentTimestamp:(double)enrollmentTimestamp - factorId:(nullable NSString *)factorId - uid:(NSString *)uid - phoneNumber:(nullable NSString *)phoneNumber { - InternalMultiFactorInfo *pigeonResult = [[InternalMultiFactorInfo alloc] init]; - pigeonResult.displayName = displayName; - pigeonResult.enrollmentTimestamp = enrollmentTimestamp; - pigeonResult.factorId = factorId; - pigeonResult.uid = uid; - pigeonResult.phoneNumber = phoneNumber; - return pigeonResult; -} -+ (InternalMultiFactorInfo *)fromList:(NSArray *)list { - InternalMultiFactorInfo *pigeonResult = [[InternalMultiFactorInfo alloc] init]; - pigeonResult.displayName = GetNullableObjectAtIndex(list, 0); - pigeonResult.enrollmentTimestamp = [GetNullableObjectAtIndex(list, 1) doubleValue]; - pigeonResult.factorId = GetNullableObjectAtIndex(list, 2); - pigeonResult.uid = GetNullableObjectAtIndex(list, 3); - pigeonResult.phoneNumber = GetNullableObjectAtIndex(list, 4); - return pigeonResult; -} -+ (nullable InternalMultiFactorInfo *)nullableFromList:(NSArray *)list { - return (list) ? [InternalMultiFactorInfo fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - self.displayName ?: [NSNull null], - @(self.enrollmentTimestamp), - self.factorId ?: [NSNull null], - self.uid ?: [NSNull null], - self.phoneNumber ?: [NSNull null], - ]; -} -- (BOOL)isEqual:(id)object { - if (self == object) { - return YES; - } - if (![object isKindOfClass:[self class]]) { - return NO; - } - InternalMultiFactorInfo *other = (InternalMultiFactorInfo *)object; - return FLTPigeonDeepEquals(self.displayName, other.displayName) && - (self.enrollmentTimestamp == other.enrollmentTimestamp || - (isnan(self.enrollmentTimestamp) && isnan(other.enrollmentTimestamp))) && - FLTPigeonDeepEquals(self.factorId, other.factorId) && - FLTPigeonDeepEquals(self.uid, other.uid) && - FLTPigeonDeepEquals(self.phoneNumber, other.phoneNumber); -} - -- (NSUInteger)hash { - NSUInteger result = [self class].hash; - result = result * 31 + FLTPigeonDeepHash(self.displayName); - result = result * 31 + (isnan(self.enrollmentTimestamp) ? (NSUInteger)0x7FF8000000000000 - : @(self.enrollmentTimestamp).hash); - result = result * 31 + FLTPigeonDeepHash(self.factorId); - result = result * 31 + FLTPigeonDeepHash(self.uid); - result = result * 31 + FLTPigeonDeepHash(self.phoneNumber); - return result; -} -@end - -@implementation AuthPigeonFirebaseApp -+ (instancetype)makeWithAppName:(NSString *)appName - tenantId:(nullable NSString *)tenantId - customAuthDomain:(nullable NSString *)customAuthDomain { - AuthPigeonFirebaseApp *pigeonResult = [[AuthPigeonFirebaseApp alloc] init]; - pigeonResult.appName = appName; - pigeonResult.tenantId = tenantId; - pigeonResult.customAuthDomain = customAuthDomain; - return pigeonResult; -} -+ (AuthPigeonFirebaseApp *)fromList:(NSArray *)list { - AuthPigeonFirebaseApp *pigeonResult = [[AuthPigeonFirebaseApp alloc] init]; - pigeonResult.appName = GetNullableObjectAtIndex(list, 0); - pigeonResult.tenantId = GetNullableObjectAtIndex(list, 1); - pigeonResult.customAuthDomain = GetNullableObjectAtIndex(list, 2); - return pigeonResult; -} -+ (nullable AuthPigeonFirebaseApp *)nullableFromList:(NSArray *)list { - return (list) ? [AuthPigeonFirebaseApp fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - self.appName ?: [NSNull null], - self.tenantId ?: [NSNull null], - self.customAuthDomain ?: [NSNull null], - ]; -} -- (BOOL)isEqual:(id)object { - if (self == object) { - return YES; - } - if (![object isKindOfClass:[self class]]) { - return NO; - } - AuthPigeonFirebaseApp *other = (AuthPigeonFirebaseApp *)object; - return FLTPigeonDeepEquals(self.appName, other.appName) && - FLTPigeonDeepEquals(self.tenantId, other.tenantId) && - FLTPigeonDeepEquals(self.customAuthDomain, other.customAuthDomain); -} - -- (NSUInteger)hash { - NSUInteger result = [self class].hash; - result = result * 31 + FLTPigeonDeepHash(self.appName); - result = result * 31 + FLTPigeonDeepHash(self.tenantId); - result = result * 31 + FLTPigeonDeepHash(self.customAuthDomain); - return result; -} -@end - -@implementation InternalActionCodeInfoData -+ (instancetype)makeWithEmail:(nullable NSString *)email - previousEmail:(nullable NSString *)previousEmail { - InternalActionCodeInfoData *pigeonResult = [[InternalActionCodeInfoData alloc] init]; - pigeonResult.email = email; - pigeonResult.previousEmail = previousEmail; - return pigeonResult; -} -+ (InternalActionCodeInfoData *)fromList:(NSArray *)list { - InternalActionCodeInfoData *pigeonResult = [[InternalActionCodeInfoData alloc] init]; - pigeonResult.email = GetNullableObjectAtIndex(list, 0); - pigeonResult.previousEmail = GetNullableObjectAtIndex(list, 1); - return pigeonResult; -} -+ (nullable InternalActionCodeInfoData *)nullableFromList:(NSArray *)list { - return (list) ? [InternalActionCodeInfoData fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - self.email ?: [NSNull null], - self.previousEmail ?: [NSNull null], - ]; -} -- (BOOL)isEqual:(id)object { - if (self == object) { - return YES; - } - if (![object isKindOfClass:[self class]]) { - return NO; - } - InternalActionCodeInfoData *other = (InternalActionCodeInfoData *)object; - return FLTPigeonDeepEquals(self.email, other.email) && - FLTPigeonDeepEquals(self.previousEmail, other.previousEmail); -} - -- (NSUInteger)hash { - NSUInteger result = [self class].hash; - result = result * 31 + FLTPigeonDeepHash(self.email); - result = result * 31 + FLTPigeonDeepHash(self.previousEmail); - return result; -} -@end - -@implementation InternalActionCodeInfo -+ (instancetype)makeWithOperation:(ActionCodeInfoOperation)operation - data:(InternalActionCodeInfoData *)data { - InternalActionCodeInfo *pigeonResult = [[InternalActionCodeInfo alloc] init]; - pigeonResult.operation = operation; - pigeonResult.data = data; - return pigeonResult; -} -+ (InternalActionCodeInfo *)fromList:(NSArray *)list { - InternalActionCodeInfo *pigeonResult = [[InternalActionCodeInfo alloc] init]; - ActionCodeInfoOperationBox *boxedActionCodeInfoOperation = GetNullableObjectAtIndex(list, 0); - pigeonResult.operation = boxedActionCodeInfoOperation.value; - pigeonResult.data = GetNullableObjectAtIndex(list, 1); - return pigeonResult; -} -+ (nullable InternalActionCodeInfo *)nullableFromList:(NSArray *)list { - return (list) ? [InternalActionCodeInfo fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - [[ActionCodeInfoOperationBox alloc] initWithValue:self.operation], - self.data ?: [NSNull null], - ]; -} -- (BOOL)isEqual:(id)object { - if (self == object) { - return YES; - } - if (![object isKindOfClass:[self class]]) { - return NO; - } - InternalActionCodeInfo *other = (InternalActionCodeInfo *)object; - return self.operation == other.operation && FLTPigeonDeepEquals(self.data, other.data); -} - -- (NSUInteger)hash { - NSUInteger result = [self class].hash; - result = result * 31 + @(self.operation).hash; - result = result * 31 + FLTPigeonDeepHash(self.data); - return result; -} -@end - -@implementation InternalAdditionalUserInfo -+ (instancetype)makeWithIsNewUser:(BOOL)isNewUser - providerId:(nullable NSString *)providerId - username:(nullable NSString *)username - authorizationCode:(nullable NSString *)authorizationCode - profile:(nullable NSDictionary *)profile { - InternalAdditionalUserInfo *pigeonResult = [[InternalAdditionalUserInfo alloc] init]; - pigeonResult.isNewUser = isNewUser; - pigeonResult.providerId = providerId; - pigeonResult.username = username; - pigeonResult.authorizationCode = authorizationCode; - pigeonResult.profile = profile; - return pigeonResult; -} -+ (InternalAdditionalUserInfo *)fromList:(NSArray *)list { - InternalAdditionalUserInfo *pigeonResult = [[InternalAdditionalUserInfo alloc] init]; - pigeonResult.isNewUser = [GetNullableObjectAtIndex(list, 0) boolValue]; - pigeonResult.providerId = GetNullableObjectAtIndex(list, 1); - pigeonResult.username = GetNullableObjectAtIndex(list, 2); - pigeonResult.authorizationCode = GetNullableObjectAtIndex(list, 3); - pigeonResult.profile = GetNullableObjectAtIndex(list, 4); - return pigeonResult; -} -+ (nullable InternalAdditionalUserInfo *)nullableFromList:(NSArray *)list { - return (list) ? [InternalAdditionalUserInfo fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - @(self.isNewUser), - self.providerId ?: [NSNull null], - self.username ?: [NSNull null], - self.authorizationCode ?: [NSNull null], - self.profile ?: [NSNull null], - ]; -} -- (BOOL)isEqual:(id)object { - if (self == object) { - return YES; - } - if (![object isKindOfClass:[self class]]) { - return NO; - } - InternalAdditionalUserInfo *other = (InternalAdditionalUserInfo *)object; - return self.isNewUser == other.isNewUser && - FLTPigeonDeepEquals(self.providerId, other.providerId) && - FLTPigeonDeepEquals(self.username, other.username) && - FLTPigeonDeepEquals(self.authorizationCode, other.authorizationCode) && - FLTPigeonDeepEquals(self.profile, other.profile); -} - -- (NSUInteger)hash { - NSUInteger result = [self class].hash; - result = result * 31 + @(self.isNewUser).hash; - result = result * 31 + FLTPigeonDeepHash(self.providerId); - result = result * 31 + FLTPigeonDeepHash(self.username); - result = result * 31 + FLTPigeonDeepHash(self.authorizationCode); - result = result * 31 + FLTPigeonDeepHash(self.profile); - return result; -} -@end - -@implementation InternalAuthCredential -+ (instancetype)makeWithProviderId:(NSString *)providerId - signInMethod:(NSString *)signInMethod - nativeId:(NSInteger)nativeId - accessToken:(nullable NSString *)accessToken { - InternalAuthCredential *pigeonResult = [[InternalAuthCredential alloc] init]; - pigeonResult.providerId = providerId; - pigeonResult.signInMethod = signInMethod; - pigeonResult.nativeId = nativeId; - pigeonResult.accessToken = accessToken; - return pigeonResult; -} -+ (InternalAuthCredential *)fromList:(NSArray *)list { - InternalAuthCredential *pigeonResult = [[InternalAuthCredential alloc] init]; - pigeonResult.providerId = GetNullableObjectAtIndex(list, 0); - pigeonResult.signInMethod = GetNullableObjectAtIndex(list, 1); - pigeonResult.nativeId = [GetNullableObjectAtIndex(list, 2) integerValue]; - pigeonResult.accessToken = GetNullableObjectAtIndex(list, 3); - return pigeonResult; -} -+ (nullable InternalAuthCredential *)nullableFromList:(NSArray *)list { - return (list) ? [InternalAuthCredential fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - self.providerId ?: [NSNull null], - self.signInMethod ?: [NSNull null], - @(self.nativeId), - self.accessToken ?: [NSNull null], - ]; -} -- (BOOL)isEqual:(id)object { - if (self == object) { - return YES; - } - if (![object isKindOfClass:[self class]]) { - return NO; - } - InternalAuthCredential *other = (InternalAuthCredential *)object; - return FLTPigeonDeepEquals(self.providerId, other.providerId) && - FLTPigeonDeepEquals(self.signInMethod, other.signInMethod) && - self.nativeId == other.nativeId && - FLTPigeonDeepEquals(self.accessToken, other.accessToken); -} - -- (NSUInteger)hash { - NSUInteger result = [self class].hash; - result = result * 31 + FLTPigeonDeepHash(self.providerId); - result = result * 31 + FLTPigeonDeepHash(self.signInMethod); - result = result * 31 + @(self.nativeId).hash; - result = result * 31 + FLTPigeonDeepHash(self.accessToken); - return result; -} -@end - -@implementation InternalUserInfo -+ (instancetype)makeWithUid:(NSString *)uid - email:(nullable NSString *)email - displayName:(nullable NSString *)displayName - photoUrl:(nullable NSString *)photoUrl - phoneNumber:(nullable NSString *)phoneNumber - isAnonymous:(BOOL)isAnonymous - isEmailVerified:(BOOL)isEmailVerified - providerId:(nullable NSString *)providerId - tenantId:(nullable NSString *)tenantId - refreshToken:(nullable NSString *)refreshToken - creationTimestamp:(nullable NSNumber *)creationTimestamp - lastSignInTimestamp:(nullable NSNumber *)lastSignInTimestamp { - InternalUserInfo *pigeonResult = [[InternalUserInfo alloc] init]; - pigeonResult.uid = uid; - pigeonResult.email = email; - pigeonResult.displayName = displayName; - pigeonResult.photoUrl = photoUrl; - pigeonResult.phoneNumber = phoneNumber; - pigeonResult.isAnonymous = isAnonymous; - pigeonResult.isEmailVerified = isEmailVerified; - pigeonResult.providerId = providerId; - pigeonResult.tenantId = tenantId; - pigeonResult.refreshToken = refreshToken; - pigeonResult.creationTimestamp = creationTimestamp; - pigeonResult.lastSignInTimestamp = lastSignInTimestamp; - return pigeonResult; -} -+ (InternalUserInfo *)fromList:(NSArray *)list { - InternalUserInfo *pigeonResult = [[InternalUserInfo alloc] init]; - pigeonResult.uid = GetNullableObjectAtIndex(list, 0); - pigeonResult.email = GetNullableObjectAtIndex(list, 1); - pigeonResult.displayName = GetNullableObjectAtIndex(list, 2); - pigeonResult.photoUrl = GetNullableObjectAtIndex(list, 3); - pigeonResult.phoneNumber = GetNullableObjectAtIndex(list, 4); - pigeonResult.isAnonymous = [GetNullableObjectAtIndex(list, 5) boolValue]; - pigeonResult.isEmailVerified = [GetNullableObjectAtIndex(list, 6) boolValue]; - pigeonResult.providerId = GetNullableObjectAtIndex(list, 7); - pigeonResult.tenantId = GetNullableObjectAtIndex(list, 8); - pigeonResult.refreshToken = GetNullableObjectAtIndex(list, 9); - pigeonResult.creationTimestamp = GetNullableObjectAtIndex(list, 10); - pigeonResult.lastSignInTimestamp = GetNullableObjectAtIndex(list, 11); - return pigeonResult; -} -+ (nullable InternalUserInfo *)nullableFromList:(NSArray *)list { - return (list) ? [InternalUserInfo fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - self.uid ?: [NSNull null], - self.email ?: [NSNull null], - self.displayName ?: [NSNull null], - self.photoUrl ?: [NSNull null], - self.phoneNumber ?: [NSNull null], - @(self.isAnonymous), - @(self.isEmailVerified), - self.providerId ?: [NSNull null], - self.tenantId ?: [NSNull null], - self.refreshToken ?: [NSNull null], - self.creationTimestamp ?: [NSNull null], - self.lastSignInTimestamp ?: [NSNull null], - ]; -} -- (BOOL)isEqual:(id)object { - if (self == object) { - return YES; - } - if (![object isKindOfClass:[self class]]) { - return NO; - } - InternalUserInfo *other = (InternalUserInfo *)object; - return FLTPigeonDeepEquals(self.uid, other.uid) && FLTPigeonDeepEquals(self.email, other.email) && - FLTPigeonDeepEquals(self.displayName, other.displayName) && - FLTPigeonDeepEquals(self.photoUrl, other.photoUrl) && - FLTPigeonDeepEquals(self.phoneNumber, other.phoneNumber) && - self.isAnonymous == other.isAnonymous && self.isEmailVerified == other.isEmailVerified && - FLTPigeonDeepEquals(self.providerId, other.providerId) && - FLTPigeonDeepEquals(self.tenantId, other.tenantId) && - FLTPigeonDeepEquals(self.refreshToken, other.refreshToken) && - FLTPigeonDeepEquals(self.creationTimestamp, other.creationTimestamp) && - FLTPigeonDeepEquals(self.lastSignInTimestamp, other.lastSignInTimestamp); -} - -- (NSUInteger)hash { - NSUInteger result = [self class].hash; - result = result * 31 + FLTPigeonDeepHash(self.uid); - result = result * 31 + FLTPigeonDeepHash(self.email); - result = result * 31 + FLTPigeonDeepHash(self.displayName); - result = result * 31 + FLTPigeonDeepHash(self.photoUrl); - result = result * 31 + FLTPigeonDeepHash(self.phoneNumber); - result = result * 31 + @(self.isAnonymous).hash; - result = result * 31 + @(self.isEmailVerified).hash; - result = result * 31 + FLTPigeonDeepHash(self.providerId); - result = result * 31 + FLTPigeonDeepHash(self.tenantId); - result = result * 31 + FLTPigeonDeepHash(self.refreshToken); - result = result * 31 + FLTPigeonDeepHash(self.creationTimestamp); - result = result * 31 + FLTPigeonDeepHash(self.lastSignInTimestamp); - return result; -} -@end - -@implementation InternalUserDetails -+ (instancetype)makeWithUserInfo:(InternalUserInfo *)userInfo - providerData:(NSArray *> *)providerData { - InternalUserDetails *pigeonResult = [[InternalUserDetails alloc] init]; - pigeonResult.userInfo = userInfo; - pigeonResult.providerData = providerData; - return pigeonResult; -} -+ (InternalUserDetails *)fromList:(NSArray *)list { - InternalUserDetails *pigeonResult = [[InternalUserDetails alloc] init]; - pigeonResult.userInfo = GetNullableObjectAtIndex(list, 0); - pigeonResult.providerData = GetNullableObjectAtIndex(list, 1); - return pigeonResult; -} -+ (nullable InternalUserDetails *)nullableFromList:(NSArray *)list { - return (list) ? [InternalUserDetails fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - self.userInfo ?: [NSNull null], - self.providerData ?: [NSNull null], - ]; -} -- (BOOL)isEqual:(id)object { - if (self == object) { - return YES; - } - if (![object isKindOfClass:[self class]]) { - return NO; - } - InternalUserDetails *other = (InternalUserDetails *)object; - return FLTPigeonDeepEquals(self.userInfo, other.userInfo) && - FLTPigeonDeepEquals(self.providerData, other.providerData); -} - -- (NSUInteger)hash { - NSUInteger result = [self class].hash; - result = result * 31 + FLTPigeonDeepHash(self.userInfo); - result = result * 31 + FLTPigeonDeepHash(self.providerData); - return result; -} -@end - -@implementation InternalUserCredential -+ (instancetype)makeWithUser:(nullable InternalUserDetails *)user - additionalUserInfo:(nullable InternalAdditionalUserInfo *)additionalUserInfo - credential:(nullable InternalAuthCredential *)credential { - InternalUserCredential *pigeonResult = [[InternalUserCredential alloc] init]; - pigeonResult.user = user; - pigeonResult.additionalUserInfo = additionalUserInfo; - pigeonResult.credential = credential; - return pigeonResult; -} -+ (InternalUserCredential *)fromList:(NSArray *)list { - InternalUserCredential *pigeonResult = [[InternalUserCredential alloc] init]; - pigeonResult.user = GetNullableObjectAtIndex(list, 0); - pigeonResult.additionalUserInfo = GetNullableObjectAtIndex(list, 1); - pigeonResult.credential = GetNullableObjectAtIndex(list, 2); - return pigeonResult; -} -+ (nullable InternalUserCredential *)nullableFromList:(NSArray *)list { - return (list) ? [InternalUserCredential fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - self.user ?: [NSNull null], - self.additionalUserInfo ?: [NSNull null], - self.credential ?: [NSNull null], - ]; -} -- (BOOL)isEqual:(id)object { - if (self == object) { - return YES; - } - if (![object isKindOfClass:[self class]]) { - return NO; - } - InternalUserCredential *other = (InternalUserCredential *)object; - return FLTPigeonDeepEquals(self.user, other.user) && - FLTPigeonDeepEquals(self.additionalUserInfo, other.additionalUserInfo) && - FLTPigeonDeepEquals(self.credential, other.credential); -} - -- (NSUInteger)hash { - NSUInteger result = [self class].hash; - result = result * 31 + FLTPigeonDeepHash(self.user); - result = result * 31 + FLTPigeonDeepHash(self.additionalUserInfo); - result = result * 31 + FLTPigeonDeepHash(self.credential); - return result; -} -@end - -@implementation InternalAuthCredentialInput -+ (instancetype)makeWithProviderId:(NSString *)providerId - signInMethod:(NSString *)signInMethod - token:(nullable NSString *)token - accessToken:(nullable NSString *)accessToken { - InternalAuthCredentialInput *pigeonResult = [[InternalAuthCredentialInput alloc] init]; - pigeonResult.providerId = providerId; - pigeonResult.signInMethod = signInMethod; - pigeonResult.token = token; - pigeonResult.accessToken = accessToken; - return pigeonResult; -} -+ (InternalAuthCredentialInput *)fromList:(NSArray *)list { - InternalAuthCredentialInput *pigeonResult = [[InternalAuthCredentialInput alloc] init]; - pigeonResult.providerId = GetNullableObjectAtIndex(list, 0); - pigeonResult.signInMethod = GetNullableObjectAtIndex(list, 1); - pigeonResult.token = GetNullableObjectAtIndex(list, 2); - pigeonResult.accessToken = GetNullableObjectAtIndex(list, 3); - return pigeonResult; -} -+ (nullable InternalAuthCredentialInput *)nullableFromList:(NSArray *)list { - return (list) ? [InternalAuthCredentialInput fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - self.providerId ?: [NSNull null], - self.signInMethod ?: [NSNull null], - self.token ?: [NSNull null], - self.accessToken ?: [NSNull null], - ]; -} -- (BOOL)isEqual:(id)object { - if (self == object) { - return YES; - } - if (![object isKindOfClass:[self class]]) { - return NO; - } - InternalAuthCredentialInput *other = (InternalAuthCredentialInput *)object; - return FLTPigeonDeepEquals(self.providerId, other.providerId) && - FLTPigeonDeepEquals(self.signInMethod, other.signInMethod) && - FLTPigeonDeepEquals(self.token, other.token) && - FLTPigeonDeepEquals(self.accessToken, other.accessToken); -} - -- (NSUInteger)hash { - NSUInteger result = [self class].hash; - result = result * 31 + FLTPigeonDeepHash(self.providerId); - result = result * 31 + FLTPigeonDeepHash(self.signInMethod); - result = result * 31 + FLTPigeonDeepHash(self.token); - result = result * 31 + FLTPigeonDeepHash(self.accessToken); - return result; -} -@end - -@implementation InternalActionCodeSettings -+ (instancetype)makeWithUrl:(NSString *)url - dynamicLinkDomain:(nullable NSString *)dynamicLinkDomain - handleCodeInApp:(BOOL)handleCodeInApp - iOSBundleId:(nullable NSString *)iOSBundleId - androidPackageName:(nullable NSString *)androidPackageName - androidInstallApp:(BOOL)androidInstallApp - androidMinimumVersion:(nullable NSString *)androidMinimumVersion - linkDomain:(nullable NSString *)linkDomain { - InternalActionCodeSettings *pigeonResult = [[InternalActionCodeSettings alloc] init]; - pigeonResult.url = url; - pigeonResult.dynamicLinkDomain = dynamicLinkDomain; - pigeonResult.handleCodeInApp = handleCodeInApp; - pigeonResult.iOSBundleId = iOSBundleId; - pigeonResult.androidPackageName = androidPackageName; - pigeonResult.androidInstallApp = androidInstallApp; - pigeonResult.androidMinimumVersion = androidMinimumVersion; - pigeonResult.linkDomain = linkDomain; - return pigeonResult; -} -+ (InternalActionCodeSettings *)fromList:(NSArray *)list { - InternalActionCodeSettings *pigeonResult = [[InternalActionCodeSettings alloc] init]; - pigeonResult.url = GetNullableObjectAtIndex(list, 0); - pigeonResult.dynamicLinkDomain = GetNullableObjectAtIndex(list, 1); - pigeonResult.handleCodeInApp = [GetNullableObjectAtIndex(list, 2) boolValue]; - pigeonResult.iOSBundleId = GetNullableObjectAtIndex(list, 3); - pigeonResult.androidPackageName = GetNullableObjectAtIndex(list, 4); - pigeonResult.androidInstallApp = [GetNullableObjectAtIndex(list, 5) boolValue]; - pigeonResult.androidMinimumVersion = GetNullableObjectAtIndex(list, 6); - pigeonResult.linkDomain = GetNullableObjectAtIndex(list, 7); - return pigeonResult; -} -+ (nullable InternalActionCodeSettings *)nullableFromList:(NSArray *)list { - return (list) ? [InternalActionCodeSettings fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - self.url ?: [NSNull null], - self.dynamicLinkDomain ?: [NSNull null], - @(self.handleCodeInApp), - self.iOSBundleId ?: [NSNull null], - self.androidPackageName ?: [NSNull null], - @(self.androidInstallApp), - self.androidMinimumVersion ?: [NSNull null], - self.linkDomain ?: [NSNull null], - ]; -} -- (BOOL)isEqual:(id)object { - if (self == object) { - return YES; - } - if (![object isKindOfClass:[self class]]) { - return NO; - } - InternalActionCodeSettings *other = (InternalActionCodeSettings *)object; - return FLTPigeonDeepEquals(self.url, other.url) && - FLTPigeonDeepEquals(self.dynamicLinkDomain, other.dynamicLinkDomain) && - self.handleCodeInApp == other.handleCodeInApp && - FLTPigeonDeepEquals(self.iOSBundleId, other.iOSBundleId) && - FLTPigeonDeepEquals(self.androidPackageName, other.androidPackageName) && - self.androidInstallApp == other.androidInstallApp && - FLTPigeonDeepEquals(self.androidMinimumVersion, other.androidMinimumVersion) && - FLTPigeonDeepEquals(self.linkDomain, other.linkDomain); -} - -- (NSUInteger)hash { - NSUInteger result = [self class].hash; - result = result * 31 + FLTPigeonDeepHash(self.url); - result = result * 31 + FLTPigeonDeepHash(self.dynamicLinkDomain); - result = result * 31 + @(self.handleCodeInApp).hash; - result = result * 31 + FLTPigeonDeepHash(self.iOSBundleId); - result = result * 31 + FLTPigeonDeepHash(self.androidPackageName); - result = result * 31 + @(self.androidInstallApp).hash; - result = result * 31 + FLTPigeonDeepHash(self.androidMinimumVersion); - result = result * 31 + FLTPigeonDeepHash(self.linkDomain); - return result; -} -@end - -@implementation InternalFirebaseAuthSettings -+ (instancetype)makeWithAppVerificationDisabledForTesting:(BOOL)appVerificationDisabledForTesting - userAccessGroup:(nullable NSString *)userAccessGroup - phoneNumber:(nullable NSString *)phoneNumber - smsCode:(nullable NSString *)smsCode - forceRecaptchaFlow:(nullable NSNumber *)forceRecaptchaFlow { - InternalFirebaseAuthSettings *pigeonResult = [[InternalFirebaseAuthSettings alloc] init]; - pigeonResult.appVerificationDisabledForTesting = appVerificationDisabledForTesting; - pigeonResult.userAccessGroup = userAccessGroup; - pigeonResult.phoneNumber = phoneNumber; - pigeonResult.smsCode = smsCode; - pigeonResult.forceRecaptchaFlow = forceRecaptchaFlow; - return pigeonResult; -} -+ (InternalFirebaseAuthSettings *)fromList:(NSArray *)list { - InternalFirebaseAuthSettings *pigeonResult = [[InternalFirebaseAuthSettings alloc] init]; - pigeonResult.appVerificationDisabledForTesting = [GetNullableObjectAtIndex(list, 0) boolValue]; - pigeonResult.userAccessGroup = GetNullableObjectAtIndex(list, 1); - pigeonResult.phoneNumber = GetNullableObjectAtIndex(list, 2); - pigeonResult.smsCode = GetNullableObjectAtIndex(list, 3); - pigeonResult.forceRecaptchaFlow = GetNullableObjectAtIndex(list, 4); - return pigeonResult; -} -+ (nullable InternalFirebaseAuthSettings *)nullableFromList:(NSArray *)list { - return (list) ? [InternalFirebaseAuthSettings fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - @(self.appVerificationDisabledForTesting), - self.userAccessGroup ?: [NSNull null], - self.phoneNumber ?: [NSNull null], - self.smsCode ?: [NSNull null], - self.forceRecaptchaFlow ?: [NSNull null], - ]; -} -- (BOOL)isEqual:(id)object { - if (self == object) { - return YES; - } - if (![object isKindOfClass:[self class]]) { - return NO; - } - InternalFirebaseAuthSettings *other = (InternalFirebaseAuthSettings *)object; - return self.appVerificationDisabledForTesting == other.appVerificationDisabledForTesting && - FLTPigeonDeepEquals(self.userAccessGroup, other.userAccessGroup) && - FLTPigeonDeepEquals(self.phoneNumber, other.phoneNumber) && - FLTPigeonDeepEquals(self.smsCode, other.smsCode) && - FLTPigeonDeepEquals(self.forceRecaptchaFlow, other.forceRecaptchaFlow); -} - -- (NSUInteger)hash { - NSUInteger result = [self class].hash; - result = result * 31 + @(self.appVerificationDisabledForTesting).hash; - result = result * 31 + FLTPigeonDeepHash(self.userAccessGroup); - result = result * 31 + FLTPigeonDeepHash(self.phoneNumber); - result = result * 31 + FLTPigeonDeepHash(self.smsCode); - result = result * 31 + FLTPigeonDeepHash(self.forceRecaptchaFlow); - return result; -} -@end - -@implementation InternalSignInProvider -+ (instancetype)makeWithProviderId:(NSString *)providerId - scopes:(nullable NSArray *)scopes - customParameters: - (nullable NSDictionary *)customParameters { - InternalSignInProvider *pigeonResult = [[InternalSignInProvider alloc] init]; - pigeonResult.providerId = providerId; - pigeonResult.scopes = scopes; - pigeonResult.customParameters = customParameters; - return pigeonResult; -} -+ (InternalSignInProvider *)fromList:(NSArray *)list { - InternalSignInProvider *pigeonResult = [[InternalSignInProvider alloc] init]; - pigeonResult.providerId = GetNullableObjectAtIndex(list, 0); - pigeonResult.scopes = GetNullableObjectAtIndex(list, 1); - pigeonResult.customParameters = GetNullableObjectAtIndex(list, 2); - return pigeonResult; -} -+ (nullable InternalSignInProvider *)nullableFromList:(NSArray *)list { - return (list) ? [InternalSignInProvider fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - self.providerId ?: [NSNull null], - self.scopes ?: [NSNull null], - self.customParameters ?: [NSNull null], - ]; -} -- (BOOL)isEqual:(id)object { - if (self == object) { - return YES; - } - if (![object isKindOfClass:[self class]]) { - return NO; - } - InternalSignInProvider *other = (InternalSignInProvider *)object; - return FLTPigeonDeepEquals(self.providerId, other.providerId) && - FLTPigeonDeepEquals(self.scopes, other.scopes) && - FLTPigeonDeepEquals(self.customParameters, other.customParameters); -} - -- (NSUInteger)hash { - NSUInteger result = [self class].hash; - result = result * 31 + FLTPigeonDeepHash(self.providerId); - result = result * 31 + FLTPigeonDeepHash(self.scopes); - result = result * 31 + FLTPigeonDeepHash(self.customParameters); - return result; -} -@end - -@implementation InternalVerifyPhoneNumberRequest -+ (instancetype)makeWithPhoneNumber:(nullable NSString *)phoneNumber - timeout:(NSInteger)timeout - forceResendingToken:(nullable NSNumber *)forceResendingToken - autoRetrievedSmsCodeForTesting:(nullable NSString *)autoRetrievedSmsCodeForTesting - multiFactorInfoId:(nullable NSString *)multiFactorInfoId - multiFactorSessionId:(nullable NSString *)multiFactorSessionId { - InternalVerifyPhoneNumberRequest *pigeonResult = [[InternalVerifyPhoneNumberRequest alloc] init]; - pigeonResult.phoneNumber = phoneNumber; - pigeonResult.timeout = timeout; - pigeonResult.forceResendingToken = forceResendingToken; - pigeonResult.autoRetrievedSmsCodeForTesting = autoRetrievedSmsCodeForTesting; - pigeonResult.multiFactorInfoId = multiFactorInfoId; - pigeonResult.multiFactorSessionId = multiFactorSessionId; - return pigeonResult; -} -+ (InternalVerifyPhoneNumberRequest *)fromList:(NSArray *)list { - InternalVerifyPhoneNumberRequest *pigeonResult = [[InternalVerifyPhoneNumberRequest alloc] init]; - pigeonResult.phoneNumber = GetNullableObjectAtIndex(list, 0); - pigeonResult.timeout = [GetNullableObjectAtIndex(list, 1) integerValue]; - pigeonResult.forceResendingToken = GetNullableObjectAtIndex(list, 2); - pigeonResult.autoRetrievedSmsCodeForTesting = GetNullableObjectAtIndex(list, 3); - pigeonResult.multiFactorInfoId = GetNullableObjectAtIndex(list, 4); - pigeonResult.multiFactorSessionId = GetNullableObjectAtIndex(list, 5); - return pigeonResult; -} -+ (nullable InternalVerifyPhoneNumberRequest *)nullableFromList:(NSArray *)list { - return (list) ? [InternalVerifyPhoneNumberRequest fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - self.phoneNumber ?: [NSNull null], - @(self.timeout), - self.forceResendingToken ?: [NSNull null], - self.autoRetrievedSmsCodeForTesting ?: [NSNull null], - self.multiFactorInfoId ?: [NSNull null], - self.multiFactorSessionId ?: [NSNull null], - ]; -} -- (BOOL)isEqual:(id)object { - if (self == object) { - return YES; - } - if (![object isKindOfClass:[self class]]) { - return NO; - } - InternalVerifyPhoneNumberRequest *other = (InternalVerifyPhoneNumberRequest *)object; - return FLTPigeonDeepEquals(self.phoneNumber, other.phoneNumber) && - self.timeout == other.timeout && - FLTPigeonDeepEquals(self.forceResendingToken, other.forceResendingToken) && - FLTPigeonDeepEquals(self.autoRetrievedSmsCodeForTesting, - other.autoRetrievedSmsCodeForTesting) && - FLTPigeonDeepEquals(self.multiFactorInfoId, other.multiFactorInfoId) && - FLTPigeonDeepEquals(self.multiFactorSessionId, other.multiFactorSessionId); -} - -- (NSUInteger)hash { - NSUInteger result = [self class].hash; - result = result * 31 + FLTPigeonDeepHash(self.phoneNumber); - result = result * 31 + @(self.timeout).hash; - result = result * 31 + FLTPigeonDeepHash(self.forceResendingToken); - result = result * 31 + FLTPigeonDeepHash(self.autoRetrievedSmsCodeForTesting); - result = result * 31 + FLTPigeonDeepHash(self.multiFactorInfoId); - result = result * 31 + FLTPigeonDeepHash(self.multiFactorSessionId); - return result; -} -@end - -@implementation InternalIdTokenResult -+ (instancetype)makeWithToken:(nullable NSString *)token - expirationTimestamp:(nullable NSNumber *)expirationTimestamp - authTimestamp:(nullable NSNumber *)authTimestamp - issuedAtTimestamp:(nullable NSNumber *)issuedAtTimestamp - signInProvider:(nullable NSString *)signInProvider - claims:(nullable NSDictionary *)claims - signInSecondFactor:(nullable NSString *)signInSecondFactor { - InternalIdTokenResult *pigeonResult = [[InternalIdTokenResult alloc] init]; - pigeonResult.token = token; - pigeonResult.expirationTimestamp = expirationTimestamp; - pigeonResult.authTimestamp = authTimestamp; - pigeonResult.issuedAtTimestamp = issuedAtTimestamp; - pigeonResult.signInProvider = signInProvider; - pigeonResult.claims = claims; - pigeonResult.signInSecondFactor = signInSecondFactor; - return pigeonResult; -} -+ (InternalIdTokenResult *)fromList:(NSArray *)list { - InternalIdTokenResult *pigeonResult = [[InternalIdTokenResult alloc] init]; - pigeonResult.token = GetNullableObjectAtIndex(list, 0); - pigeonResult.expirationTimestamp = GetNullableObjectAtIndex(list, 1); - pigeonResult.authTimestamp = GetNullableObjectAtIndex(list, 2); - pigeonResult.issuedAtTimestamp = GetNullableObjectAtIndex(list, 3); - pigeonResult.signInProvider = GetNullableObjectAtIndex(list, 4); - pigeonResult.claims = GetNullableObjectAtIndex(list, 5); - pigeonResult.signInSecondFactor = GetNullableObjectAtIndex(list, 6); - return pigeonResult; -} -+ (nullable InternalIdTokenResult *)nullableFromList:(NSArray *)list { - return (list) ? [InternalIdTokenResult fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - self.token ?: [NSNull null], - self.expirationTimestamp ?: [NSNull null], - self.authTimestamp ?: [NSNull null], - self.issuedAtTimestamp ?: [NSNull null], - self.signInProvider ?: [NSNull null], - self.claims ?: [NSNull null], - self.signInSecondFactor ?: [NSNull null], - ]; -} -- (BOOL)isEqual:(id)object { - if (self == object) { - return YES; - } - if (![object isKindOfClass:[self class]]) { - return NO; - } - InternalIdTokenResult *other = (InternalIdTokenResult *)object; - return FLTPigeonDeepEquals(self.token, other.token) && - FLTPigeonDeepEquals(self.expirationTimestamp, other.expirationTimestamp) && - FLTPigeonDeepEquals(self.authTimestamp, other.authTimestamp) && - FLTPigeonDeepEquals(self.issuedAtTimestamp, other.issuedAtTimestamp) && - FLTPigeonDeepEquals(self.signInProvider, other.signInProvider) && - FLTPigeonDeepEquals(self.claims, other.claims) && - FLTPigeonDeepEquals(self.signInSecondFactor, other.signInSecondFactor); -} - -- (NSUInteger)hash { - NSUInteger result = [self class].hash; - result = result * 31 + FLTPigeonDeepHash(self.token); - result = result * 31 + FLTPigeonDeepHash(self.expirationTimestamp); - result = result * 31 + FLTPigeonDeepHash(self.authTimestamp); - result = result * 31 + FLTPigeonDeepHash(self.issuedAtTimestamp); - result = result * 31 + FLTPigeonDeepHash(self.signInProvider); - result = result * 31 + FLTPigeonDeepHash(self.claims); - result = result * 31 + FLTPigeonDeepHash(self.signInSecondFactor); - return result; -} -@end - -@implementation InternalUserProfile -+ (instancetype)makeWithDisplayName:(nullable NSString *)displayName - photoUrl:(nullable NSString *)photoUrl - displayNameChanged:(BOOL)displayNameChanged - photoUrlChanged:(BOOL)photoUrlChanged { - InternalUserProfile *pigeonResult = [[InternalUserProfile alloc] init]; - pigeonResult.displayName = displayName; - pigeonResult.photoUrl = photoUrl; - pigeonResult.displayNameChanged = displayNameChanged; - pigeonResult.photoUrlChanged = photoUrlChanged; - return pigeonResult; -} -+ (InternalUserProfile *)fromList:(NSArray *)list { - InternalUserProfile *pigeonResult = [[InternalUserProfile alloc] init]; - pigeonResult.displayName = GetNullableObjectAtIndex(list, 0); - pigeonResult.photoUrl = GetNullableObjectAtIndex(list, 1); - pigeonResult.displayNameChanged = [GetNullableObjectAtIndex(list, 2) boolValue]; - pigeonResult.photoUrlChanged = [GetNullableObjectAtIndex(list, 3) boolValue]; - return pigeonResult; -} -+ (nullable InternalUserProfile *)nullableFromList:(NSArray *)list { - return (list) ? [InternalUserProfile fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - self.displayName ?: [NSNull null], - self.photoUrl ?: [NSNull null], - @(self.displayNameChanged), - @(self.photoUrlChanged), - ]; -} -- (BOOL)isEqual:(id)object { - if (self == object) { - return YES; - } - if (![object isKindOfClass:[self class]]) { - return NO; - } - InternalUserProfile *other = (InternalUserProfile *)object; - return FLTPigeonDeepEquals(self.displayName, other.displayName) && - FLTPigeonDeepEquals(self.photoUrl, other.photoUrl) && - self.displayNameChanged == other.displayNameChanged && - self.photoUrlChanged == other.photoUrlChanged; -} - -- (NSUInteger)hash { - NSUInteger result = [self class].hash; - result = result * 31 + FLTPigeonDeepHash(self.displayName); - result = result * 31 + FLTPigeonDeepHash(self.photoUrl); - result = result * 31 + @(self.displayNameChanged).hash; - result = result * 31 + @(self.photoUrlChanged).hash; - return result; -} -@end - -@implementation InternalTotpSecret -+ (instancetype)makeWithCodeIntervalSeconds:(nullable NSNumber *)codeIntervalSeconds - codeLength:(nullable NSNumber *)codeLength - enrollmentCompletionDeadline:(nullable NSNumber *)enrollmentCompletionDeadline - hashingAlgorithm:(nullable NSString *)hashingAlgorithm - secretKey:(NSString *)secretKey { - InternalTotpSecret *pigeonResult = [[InternalTotpSecret alloc] init]; - pigeonResult.codeIntervalSeconds = codeIntervalSeconds; - pigeonResult.codeLength = codeLength; - pigeonResult.enrollmentCompletionDeadline = enrollmentCompletionDeadline; - pigeonResult.hashingAlgorithm = hashingAlgorithm; - pigeonResult.secretKey = secretKey; - return pigeonResult; -} -+ (InternalTotpSecret *)fromList:(NSArray *)list { - InternalTotpSecret *pigeonResult = [[InternalTotpSecret alloc] init]; - pigeonResult.codeIntervalSeconds = GetNullableObjectAtIndex(list, 0); - pigeonResult.codeLength = GetNullableObjectAtIndex(list, 1); - pigeonResult.enrollmentCompletionDeadline = GetNullableObjectAtIndex(list, 2); - pigeonResult.hashingAlgorithm = GetNullableObjectAtIndex(list, 3); - pigeonResult.secretKey = GetNullableObjectAtIndex(list, 4); - return pigeonResult; -} -+ (nullable InternalTotpSecret *)nullableFromList:(NSArray *)list { - return (list) ? [InternalTotpSecret fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - self.codeIntervalSeconds ?: [NSNull null], - self.codeLength ?: [NSNull null], - self.enrollmentCompletionDeadline ?: [NSNull null], - self.hashingAlgorithm ?: [NSNull null], - self.secretKey ?: [NSNull null], - ]; -} -- (BOOL)isEqual:(id)object { - if (self == object) { - return YES; - } - if (![object isKindOfClass:[self class]]) { - return NO; - } - InternalTotpSecret *other = (InternalTotpSecret *)object; - return FLTPigeonDeepEquals(self.codeIntervalSeconds, other.codeIntervalSeconds) && - FLTPigeonDeepEquals(self.codeLength, other.codeLength) && - FLTPigeonDeepEquals(self.enrollmentCompletionDeadline, - other.enrollmentCompletionDeadline) && - FLTPigeonDeepEquals(self.hashingAlgorithm, other.hashingAlgorithm) && - FLTPigeonDeepEquals(self.secretKey, other.secretKey); -} - -- (NSUInteger)hash { - NSUInteger result = [self class].hash; - result = result * 31 + FLTPigeonDeepHash(self.codeIntervalSeconds); - result = result * 31 + FLTPigeonDeepHash(self.codeLength); - result = result * 31 + FLTPigeonDeepHash(self.enrollmentCompletionDeadline); - result = result * 31 + FLTPigeonDeepHash(self.hashingAlgorithm); - result = result * 31 + FLTPigeonDeepHash(self.secretKey); - return result; -} -@end - -@interface nullFirebaseAuthMessagesPigeonCodecReader : FlutterStandardReader -@end -@implementation nullFirebaseAuthMessagesPigeonCodecReader -- (nullable id)readValueOfType:(UInt8)type { - switch (type) { - case 129: { - NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil - ? nil - : [[ActionCodeInfoOperationBox alloc] initWithValue:[enumAsNumber integerValue]]; - } - case 130: - return [InternalMultiFactorSession fromList:[self readValue]]; - case 131: - return [InternalPhoneMultiFactorAssertion fromList:[self readValue]]; - case 132: - return [InternalMultiFactorInfo fromList:[self readValue]]; - case 133: - return [AuthPigeonFirebaseApp fromList:[self readValue]]; - case 134: - return [InternalActionCodeInfoData fromList:[self readValue]]; - case 135: - return [InternalActionCodeInfo fromList:[self readValue]]; - case 136: - return [InternalAdditionalUserInfo fromList:[self readValue]]; - case 137: - return [InternalAuthCredential fromList:[self readValue]]; - case 138: - return [InternalUserInfo fromList:[self readValue]]; - case 139: - return [InternalUserDetails fromList:[self readValue]]; - case 140: - return [InternalUserCredential fromList:[self readValue]]; - case 141: - return [InternalAuthCredentialInput fromList:[self readValue]]; - case 142: - return [InternalActionCodeSettings fromList:[self readValue]]; - case 143: - return [InternalFirebaseAuthSettings fromList:[self readValue]]; - case 144: - return [InternalSignInProvider fromList:[self readValue]]; - case 145: - return [InternalVerifyPhoneNumberRequest fromList:[self readValue]]; - case 146: - return [InternalIdTokenResult fromList:[self readValue]]; - case 147: - return [InternalUserProfile fromList:[self readValue]]; - case 148: - return [InternalTotpSecret fromList:[self readValue]]; - default: - return [super readValueOfType:type]; - } -} -@end - -@interface nullFirebaseAuthMessagesPigeonCodecWriter : FlutterStandardWriter -@end -@implementation nullFirebaseAuthMessagesPigeonCodecWriter -- (void)writeValue:(id)value { - if ([value isKindOfClass:[ActionCodeInfoOperationBox class]]) { - ActionCodeInfoOperationBox *box = (ActionCodeInfoOperationBox *)value; - [self writeByte:129]; - [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; - } else if ([value isKindOfClass:[InternalMultiFactorSession class]]) { - [self writeByte:130]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[InternalPhoneMultiFactorAssertion class]]) { - [self writeByte:131]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[InternalMultiFactorInfo class]]) { - [self writeByte:132]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[AuthPigeonFirebaseApp class]]) { - [self writeByte:133]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[InternalActionCodeInfoData class]]) { - [self writeByte:134]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[InternalActionCodeInfo class]]) { - [self writeByte:135]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[InternalAdditionalUserInfo class]]) { - [self writeByte:136]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[InternalAuthCredential class]]) { - [self writeByte:137]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[InternalUserInfo class]]) { - [self writeByte:138]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[InternalUserDetails class]]) { - [self writeByte:139]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[InternalUserCredential class]]) { - [self writeByte:140]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[InternalAuthCredentialInput class]]) { - [self writeByte:141]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[InternalActionCodeSettings class]]) { - [self writeByte:142]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[InternalFirebaseAuthSettings class]]) { - [self writeByte:143]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[InternalSignInProvider class]]) { - [self writeByte:144]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[InternalVerifyPhoneNumberRequest class]]) { - [self writeByte:145]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[InternalIdTokenResult class]]) { - [self writeByte:146]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[InternalUserProfile class]]) { - [self writeByte:147]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[InternalTotpSecret class]]) { - [self writeByte:148]; - [self writeValue:[value toList]]; - } else { - [super writeValue:value]; - } -} -@end - -@interface nullFirebaseAuthMessagesPigeonCodecReaderWriter : FlutterStandardReaderWriter -@end -@implementation nullFirebaseAuthMessagesPigeonCodecReaderWriter -- (FlutterStandardWriter *)writerWithData:(NSMutableData *)data { - return [[nullFirebaseAuthMessagesPigeonCodecWriter alloc] initWithData:data]; -} -- (FlutterStandardReader *)readerWithData:(NSData *)data { - return [[nullFirebaseAuthMessagesPigeonCodecReader alloc] initWithData:data]; -} -@end - -NSObject *nullGetFirebaseAuthMessagesCodec(void) { - static FlutterStandardMessageCodec *sSharedObject = nil; - static dispatch_once_t sPred = 0; - dispatch_once(&sPred, ^{ - nullFirebaseAuthMessagesPigeonCodecReaderWriter *readerWriter = - [[nullFirebaseAuthMessagesPigeonCodecReaderWriter alloc] init]; - sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; - }); - return sSharedObject; -} -void SetUpFirebaseAuthHostApi(id binaryMessenger, - NSObject *api) { - SetUpFirebaseAuthHostApiWithSuffix(binaryMessenger, api, @""); -} - -void SetUpFirebaseAuthHostApiWithSuffix(id binaryMessenger, - NSObject *api, - NSString *messageChannelSuffix) { - messageChannelSuffix = messageChannelSuffix.length > 0 - ? [NSString stringWithFormat:@".%@", messageChannelSuffix] - : @""; - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthHostApi.registerIdTokenListener", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(registerIdTokenListenerApp:completion:)], - @"FirebaseAuthHostApi api (%@) doesn't respond to " - @"@selector(registerIdTokenListenerApp:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - [api registerIdTokenListenerApp:arg_app - completion:^(NSString *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthHostApi.registerAuthStateListener", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(registerAuthStateListenerApp:completion:)], - @"FirebaseAuthHostApi api (%@) doesn't respond to " - @"@selector(registerAuthStateListenerApp:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - [api registerAuthStateListenerApp:arg_app - completion:^(NSString *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_" - @"interface.FirebaseAuthHostApi.useEmulator", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(useEmulatorApp:host:port:completion:)], - @"FirebaseAuthHostApi api (%@) doesn't respond to " - @"@selector(useEmulatorApp:host:port:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - NSString *arg_host = GetNullableObjectAtIndex(args, 1); - NSInteger arg_port = [GetNullableObjectAtIndex(args, 2) integerValue]; - [api useEmulatorApp:arg_app - host:arg_host - port:arg_port - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_" - @"interface.FirebaseAuthHostApi.applyActionCode", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(applyActionCodeApp:code:completion:)], - @"FirebaseAuthHostApi api (%@) doesn't respond to " - @"@selector(applyActionCodeApp:code:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - NSString *arg_code = GetNullableObjectAtIndex(args, 1); - [api applyActionCodeApp:arg_app - code:arg_code - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_" - @"interface.FirebaseAuthHostApi.checkActionCode", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(checkActionCodeApp:code:completion:)], - @"FirebaseAuthHostApi api (%@) doesn't respond to " - @"@selector(checkActionCodeApp:code:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - NSString *arg_code = GetNullableObjectAtIndex(args, 1); - [api checkActionCodeApp:arg_app - code:arg_code - completion:^(InternalActionCodeInfo *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthHostApi.confirmPasswordReset", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector(confirmPasswordResetApp:code:newPassword:completion:)], - @"FirebaseAuthHostApi api (%@) doesn't respond to " - @"@selector(confirmPasswordResetApp:code:newPassword:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - NSString *arg_code = GetNullableObjectAtIndex(args, 1); - NSString *arg_newPassword = GetNullableObjectAtIndex(args, 2); - [api confirmPasswordResetApp:arg_app - code:arg_code - newPassword:arg_newPassword - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthHostApi.createUserWithEmailAndPassword", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert( - [api - respondsToSelector:@selector( - createUserWithEmailAndPasswordApp:email:password:completion:)], - @"FirebaseAuthHostApi api (%@) doesn't respond to " - @"@selector(createUserWithEmailAndPasswordApp:email:password:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - NSString *arg_email = GetNullableObjectAtIndex(args, 1); - NSString *arg_password = GetNullableObjectAtIndex(args, 2); - [api createUserWithEmailAndPasswordApp:arg_app - email:arg_email - password:arg_password - completion:^(InternalUserCredential *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthHostApi.signInAnonymously", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(signInAnonymouslyApp:completion:)], - @"FirebaseAuthHostApi api (%@) doesn't respond to " - @"@selector(signInAnonymouslyApp:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - [api signInAnonymouslyApp:arg_app - completion:^(InternalUserCredential *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthHostApi.signInWithCredential", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(signInWithCredentialApp:input:completion:)], - @"FirebaseAuthHostApi api (%@) doesn't respond to " - @"@selector(signInWithCredentialApp:input:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - NSDictionary *arg_input = GetNullableObjectAtIndex(args, 1); - [api signInWithCredentialApp:arg_app - input:arg_input - completion:^(InternalUserCredential *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthHostApi.signInWithCustomToken", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(signInWithCustomTokenApp:token:completion:)], - @"FirebaseAuthHostApi api (%@) doesn't respond to " - @"@selector(signInWithCustomTokenApp:token:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - NSString *arg_token = GetNullableObjectAtIndex(args, 1); - [api signInWithCustomTokenApp:arg_app - token:arg_token - completion:^(InternalUserCredential *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthHostApi.signInWithEmailAndPassword", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector( - signInWithEmailAndPasswordApp:email:password:completion:)], - @"FirebaseAuthHostApi api (%@) doesn't respond to " - @"@selector(signInWithEmailAndPasswordApp:email:password:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - NSString *arg_email = GetNullableObjectAtIndex(args, 1); - NSString *arg_password = GetNullableObjectAtIndex(args, 2); - [api signInWithEmailAndPasswordApp:arg_app - email:arg_email - password:arg_password - completion:^(InternalUserCredential *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthHostApi.signInWithEmailLink", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector(signInWithEmailLinkApp:email:emailLink:completion:)], - @"FirebaseAuthHostApi api (%@) doesn't respond to " - @"@selector(signInWithEmailLinkApp:email:emailLink:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - NSString *arg_email = GetNullableObjectAtIndex(args, 1); - NSString *arg_emailLink = GetNullableObjectAtIndex(args, 2); - [api signInWithEmailLinkApp:arg_app - email:arg_email - emailLink:arg_emailLink - completion:^(InternalUserCredential *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthHostApi.signInWithProvider", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector(signInWithProviderApp:signInProvider:completion:)], - @"FirebaseAuthHostApi api (%@) doesn't respond to " - @"@selector(signInWithProviderApp:signInProvider:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - InternalSignInProvider *arg_signInProvider = GetNullableObjectAtIndex(args, 1); - [api signInWithProviderApp:arg_app - signInProvider:arg_signInProvider - completion:^(InternalUserCredential *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_" - @"interface.FirebaseAuthHostApi.signOut", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector(signOutApp:completion:)], - @"FirebaseAuthHostApi api (%@) doesn't respond to @selector(signOutApp:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - [api signOutApp:arg_app - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthHostApi.fetchSignInMethodsForEmail", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(fetchSignInMethodsForEmailApp:email:completion:)], - @"FirebaseAuthHostApi api (%@) doesn't respond to " - @"@selector(fetchSignInMethodsForEmailApp:email:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - NSString *arg_email = GetNullableObjectAtIndex(args, 1); - [api fetchSignInMethodsForEmailApp:arg_app - email:arg_email - completion:^(NSArray *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthHostApi.sendPasswordResetEmail", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector: - @selector(sendPasswordResetEmailApp:email:actionCodeSettings:completion:)], - @"FirebaseAuthHostApi api (%@) doesn't respond to " - @"@selector(sendPasswordResetEmailApp:email:actionCodeSettings:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - NSString *arg_email = GetNullableObjectAtIndex(args, 1); - InternalActionCodeSettings *arg_actionCodeSettings = GetNullableObjectAtIndex(args, 2); - [api sendPasswordResetEmailApp:arg_app - email:arg_email - actionCodeSettings:arg_actionCodeSettings - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthHostApi.sendSignInLinkToEmail", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector: - @selector(sendSignInLinkToEmailApp:email:actionCodeSettings:completion:)], - @"FirebaseAuthHostApi api (%@) doesn't respond to " - @"@selector(sendSignInLinkToEmailApp:email:actionCodeSettings:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - NSString *arg_email = GetNullableObjectAtIndex(args, 1); - InternalActionCodeSettings *arg_actionCodeSettings = GetNullableObjectAtIndex(args, 2); - [api sendSignInLinkToEmailApp:arg_app - email:arg_email - actionCodeSettings:arg_actionCodeSettings - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_" - @"interface.FirebaseAuthHostApi.setLanguageCode", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(setLanguageCodeApp:languageCode:completion:)], - @"FirebaseAuthHostApi api (%@) doesn't respond to " - @"@selector(setLanguageCodeApp:languageCode:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - NSString *arg_languageCode = GetNullableObjectAtIndex(args, 1); - [api setLanguageCodeApp:arg_app - languageCode:arg_languageCode - completion:^(NSString *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_" - @"interface.FirebaseAuthHostApi.setSettings", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(setSettingsApp:settings:completion:)], - @"FirebaseAuthHostApi api (%@) doesn't respond to " - @"@selector(setSettingsApp:settings:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - InternalFirebaseAuthSettings *arg_settings = GetNullableObjectAtIndex(args, 1); - [api setSettingsApp:arg_app - settings:arg_settings - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthHostApi.verifyPasswordResetCode", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(verifyPasswordResetCodeApp:code:completion:)], - @"FirebaseAuthHostApi api (%@) doesn't respond to " - @"@selector(verifyPasswordResetCodeApp:code:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - NSString *arg_code = GetNullableObjectAtIndex(args, 1); - [api verifyPasswordResetCodeApp:arg_app - code:arg_code - completion:^(NSString *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthHostApi.verifyPhoneNumber", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(verifyPhoneNumberApp:request:completion:)], - @"FirebaseAuthHostApi api (%@) doesn't respond to " - @"@selector(verifyPhoneNumberApp:request:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - InternalVerifyPhoneNumberRequest *arg_request = GetNullableObjectAtIndex(args, 1); - [api verifyPhoneNumberApp:arg_app - request:arg_request - completion:^(NSString *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthHostApi.revokeTokenWithAuthorizationCode", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(revokeTokenWithAuthorizationCodeApp: - authorizationCode:completion:)], - @"FirebaseAuthHostApi api (%@) doesn't respond to " - @"@selector(revokeTokenWithAuthorizationCodeApp:authorizationCode:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - NSString *arg_authorizationCode = GetNullableObjectAtIndex(args, 1); - [api revokeTokenWithAuthorizationCodeApp:arg_app - authorizationCode:arg_authorizationCode - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthHostApi.revokeAccessToken", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(revokeAccessTokenApp:accessToken:completion:)], - @"FirebaseAuthHostApi api (%@) doesn't respond to " - @"@selector(revokeAccessTokenApp:accessToken:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - NSString *arg_accessToken = GetNullableObjectAtIndex(args, 1); - [api revokeAccessTokenApp:arg_app - accessToken:arg_accessToken - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthHostApi.initializeRecaptchaConfig", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(initializeRecaptchaConfigApp:completion:)], - @"FirebaseAuthHostApi api (%@) doesn't respond to " - @"@selector(initializeRecaptchaConfigApp:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - [api initializeRecaptchaConfigApp:arg_app - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } -} -void SetUpFirebaseAuthUserHostApi(id binaryMessenger, - NSObject *api) { - SetUpFirebaseAuthUserHostApiWithSuffix(binaryMessenger, api, @""); -} - -void SetUpFirebaseAuthUserHostApiWithSuffix(id binaryMessenger, - NSObject *api, - NSString *messageChannelSuffix) { - messageChannelSuffix = messageChannelSuffix.length > 0 - ? [NSString stringWithFormat:@".%@", messageChannelSuffix] - : @""; - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_" - @"interface.FirebaseAuthUserHostApi.delete", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector(deleteApp:completion:)], - @"FirebaseAuthUserHostApi api (%@) doesn't respond to @selector(deleteApp:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - [api deleteApp:arg_app - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_" - @"interface.FirebaseAuthUserHostApi.getIdToken", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(getIdTokenApp:forceRefresh:completion:)], - @"FirebaseAuthUserHostApi api (%@) doesn't respond to " - @"@selector(getIdTokenApp:forceRefresh:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - BOOL arg_forceRefresh = [GetNullableObjectAtIndex(args, 1) boolValue]; - [api getIdTokenApp:arg_app - forceRefresh:arg_forceRefresh - completion:^(InternalIdTokenResult *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthUserHostApi.linkWithCredential", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(linkWithCredentialApp:input:completion:)], - @"FirebaseAuthUserHostApi api (%@) doesn't respond to " - @"@selector(linkWithCredentialApp:input:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - NSDictionary *arg_input = GetNullableObjectAtIndex(args, 1); - [api linkWithCredentialApp:arg_app - input:arg_input - completion:^(InternalUserCredential *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthUserHostApi.linkWithProvider", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(linkWithProviderApp:signInProvider:completion:)], - @"FirebaseAuthUserHostApi api (%@) doesn't respond to " - @"@selector(linkWithProviderApp:signInProvider:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - InternalSignInProvider *arg_signInProvider = GetNullableObjectAtIndex(args, 1); - [api linkWithProviderApp:arg_app - signInProvider:arg_signInProvider - completion:^(InternalUserCredential *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthUserHostApi.reauthenticateWithCredential", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector(reauthenticateWithCredentialApp:input:completion:)], - @"FirebaseAuthUserHostApi api (%@) doesn't respond to " - @"@selector(reauthenticateWithCredentialApp:input:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - NSDictionary *arg_input = GetNullableObjectAtIndex(args, 1); - [api reauthenticateWithCredentialApp:arg_app - input:arg_input - completion:^(InternalUserCredential *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthUserHostApi.reauthenticateWithProvider", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector( - reauthenticateWithProviderApp:signInProvider:completion:)], - @"FirebaseAuthUserHostApi api (%@) doesn't respond to " - @"@selector(reauthenticateWithProviderApp:signInProvider:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - InternalSignInProvider *arg_signInProvider = GetNullableObjectAtIndex(args, 1); - [api reauthenticateWithProviderApp:arg_app - signInProvider:arg_signInProvider - completion:^(InternalUserCredential *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_" - @"interface.FirebaseAuthUserHostApi.reload", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector(reloadApp:completion:)], - @"FirebaseAuthUserHostApi api (%@) doesn't respond to @selector(reloadApp:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - [api reloadApp:arg_app - completion:^(InternalUserDetails *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthUserHostApi.sendEmailVerification", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector( - sendEmailVerificationApp:actionCodeSettings:completion:)], - @"FirebaseAuthUserHostApi api (%@) doesn't respond to " - @"@selector(sendEmailVerificationApp:actionCodeSettings:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - InternalActionCodeSettings *arg_actionCodeSettings = GetNullableObjectAtIndex(args, 1); - [api sendEmailVerificationApp:arg_app - actionCodeSettings:arg_actionCodeSettings - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_" - @"interface.FirebaseAuthUserHostApi.unlink", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(unlinkApp:providerId:completion:)], - @"FirebaseAuthUserHostApi api (%@) doesn't respond to " - @"@selector(unlinkApp:providerId:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - NSString *arg_providerId = GetNullableObjectAtIndex(args, 1); - [api unlinkApp:arg_app - providerId:arg_providerId - completion:^(InternalUserCredential *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_" - @"interface.FirebaseAuthUserHostApi.updateEmail", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(updateEmailApp:newEmail:completion:)], - @"FirebaseAuthUserHostApi api (%@) doesn't respond to " - @"@selector(updateEmailApp:newEmail:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - NSString *arg_newEmail = GetNullableObjectAtIndex(args, 1); - [api - updateEmailApp:arg_app - newEmail:arg_newEmail - completion:^(InternalUserDetails *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthUserHostApi.updatePassword", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(updatePasswordApp:newPassword:completion:)], - @"FirebaseAuthUserHostApi api (%@) doesn't respond to " - @"@selector(updatePasswordApp:newPassword:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - NSString *arg_newPassword = GetNullableObjectAtIndex(args, 1); - [api updatePasswordApp:arg_app - newPassword:arg_newPassword - completion:^(InternalUserDetails *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthUserHostApi.updatePhoneNumber", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(updatePhoneNumberApp:input:completion:)], - @"FirebaseAuthUserHostApi api (%@) doesn't respond to " - @"@selector(updatePhoneNumberApp:input:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - NSDictionary *arg_input = GetNullableObjectAtIndex(args, 1); - [api updatePhoneNumberApp:arg_app - input:arg_input - completion:^(InternalUserDetails *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthUserHostApi.updateProfile", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(updateProfileApp:profile:completion:)], - @"FirebaseAuthUserHostApi api (%@) doesn't respond to " - @"@selector(updateProfileApp:profile:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - InternalUserProfile *arg_profile = GetNullableObjectAtIndex(args, 1); - [api updateProfileApp:arg_app - profile:arg_profile - completion:^(InternalUserDetails *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"FirebaseAuthUserHostApi.verifyBeforeUpdateEmail", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(verifyBeforeUpdateEmailApp:newEmail: - actionCodeSettings:completion:)], - @"FirebaseAuthUserHostApi api (%@) doesn't respond to " - @"@selector(verifyBeforeUpdateEmailApp:newEmail:actionCodeSettings:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - NSString *arg_newEmail = GetNullableObjectAtIndex(args, 1); - InternalActionCodeSettings *arg_actionCodeSettings = GetNullableObjectAtIndex(args, 2); - [api verifyBeforeUpdateEmailApp:arg_app - newEmail:arg_newEmail - actionCodeSettings:arg_actionCodeSettings - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } -} -void SetUpMultiFactorUserHostApi(id binaryMessenger, - NSObject *api) { - SetUpMultiFactorUserHostApiWithSuffix(binaryMessenger, api, @""); -} - -void SetUpMultiFactorUserHostApiWithSuffix(id binaryMessenger, - NSObject *api, - NSString *messageChannelSuffix) { - messageChannelSuffix = messageChannelSuffix.length > 0 - ? [NSString stringWithFormat:@".%@", messageChannelSuffix] - : @""; - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_" - @"interface.MultiFactorUserHostApi.enrollPhone", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector(enrollPhoneApp:assertion:displayName:completion:)], - @"MultiFactorUserHostApi api (%@) doesn't respond to " - @"@selector(enrollPhoneApp:assertion:displayName:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - InternalPhoneMultiFactorAssertion *arg_assertion = GetNullableObjectAtIndex(args, 1); - NSString *arg_displayName = GetNullableObjectAtIndex(args, 2); - [api enrollPhoneApp:arg_app - assertion:arg_assertion - displayName:arg_displayName - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_" - @"interface.MultiFactorUserHostApi.enrollTotp", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector(enrollTotpApp:assertionId:displayName:completion:)], - @"MultiFactorUserHostApi api (%@) doesn't respond to " - @"@selector(enrollTotpApp:assertionId:displayName:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - NSString *arg_assertionId = GetNullableObjectAtIndex(args, 1); - NSString *arg_displayName = GetNullableObjectAtIndex(args, 2); - [api enrollTotpApp:arg_app - assertionId:arg_assertionId - displayName:arg_displayName - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_" - @"interface.MultiFactorUserHostApi.getSession", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(getSessionApp:completion:)], - @"MultiFactorUserHostApi api (%@) doesn't respond to " - @"@selector(getSessionApp:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - [api getSessionApp:arg_app - completion:^(InternalMultiFactorSession *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_" - @"interface.MultiFactorUserHostApi.unenroll", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(unenrollApp:factorUid:completion:)], - @"MultiFactorUserHostApi api (%@) doesn't respond to " - @"@selector(unenrollApp:factorUid:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - NSString *arg_factorUid = GetNullableObjectAtIndex(args, 1); - [api unenrollApp:arg_app - factorUid:arg_factorUid - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"MultiFactorUserHostApi.getEnrolledFactors", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(getEnrolledFactorsApp:completion:)], - @"MultiFactorUserHostApi api (%@) doesn't respond to " - @"@selector(getEnrolledFactorsApp:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - AuthPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0); - [api getEnrolledFactorsApp:arg_app - completion:^(NSArray *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } -} -void SetUpMultiFactoResolverHostApi(id binaryMessenger, - NSObject *api) { - SetUpMultiFactoResolverHostApiWithSuffix(binaryMessenger, api, @""); -} - -void SetUpMultiFactoResolverHostApiWithSuffix(id binaryMessenger, - NSObject *api, - NSString *messageChannelSuffix) { - messageChannelSuffix = messageChannelSuffix.length > 0 - ? [NSString stringWithFormat:@".%@", messageChannelSuffix] - : @""; - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"MultiFactoResolverHostApi.resolveSignIn", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector: - @selector(resolveSignInResolverId:assertion:totpAssertionId:completion:)], - @"MultiFactoResolverHostApi api (%@) doesn't respond to " - @"@selector(resolveSignInResolverId:assertion:totpAssertionId:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSString *arg_resolverId = GetNullableObjectAtIndex(args, 0); - InternalPhoneMultiFactorAssertion *arg_assertion = GetNullableObjectAtIndex(args, 1); - NSString *arg_totpAssertionId = GetNullableObjectAtIndex(args, 2); - [api resolveSignInResolverId:arg_resolverId - assertion:arg_assertion - totpAssertionId:arg_totpAssertionId - completion:^(InternalUserCredential *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } -} -void SetUpMultiFactorTotpHostApi(id binaryMessenger, - NSObject *api) { - SetUpMultiFactorTotpHostApiWithSuffix(binaryMessenger, api, @""); -} - -void SetUpMultiFactorTotpHostApiWithSuffix(id binaryMessenger, - NSObject *api, - NSString *messageChannelSuffix) { - messageChannelSuffix = messageChannelSuffix.length > 0 - ? [NSString stringWithFormat:@".%@", messageChannelSuffix] - : @""; - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"MultiFactorTotpHostApi.generateSecret", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(generateSecretSessionId:completion:)], - @"MultiFactorTotpHostApi api (%@) doesn't respond to " - @"@selector(generateSecretSessionId:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSString *arg_sessionId = GetNullableObjectAtIndex(args, 0); - [api generateSecretSessionId:arg_sessionId - completion:^(InternalTotpSecret *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"MultiFactorTotpHostApi.getAssertionForEnrollment", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector: - @selector(getAssertionForEnrollmentSecretKey:oneTimePassword:completion:)], - @"MultiFactorTotpHostApi api (%@) doesn't respond to " - @"@selector(getAssertionForEnrollmentSecretKey:oneTimePassword:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSString *arg_secretKey = GetNullableObjectAtIndex(args, 0); - NSString *arg_oneTimePassword = GetNullableObjectAtIndex(args, 1); - [api getAssertionForEnrollmentSecretKey:arg_secretKey - oneTimePassword:arg_oneTimePassword - completion:^(NSString *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"MultiFactorTotpHostApi.getAssertionForSignIn", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector: - @selector(getAssertionForSignInEnrollmentId:oneTimePassword:completion:)], - @"MultiFactorTotpHostApi api (%@) doesn't respond to " - @"@selector(getAssertionForSignInEnrollmentId:oneTimePassword:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSString *arg_enrollmentId = GetNullableObjectAtIndex(args, 0); - NSString *arg_oneTimePassword = GetNullableObjectAtIndex(args, 1); - [api getAssertionForSignInEnrollmentId:arg_enrollmentId - oneTimePassword:arg_oneTimePassword - completion:^(NSString *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } -} -void SetUpMultiFactorTotpSecretHostApi(id binaryMessenger, - NSObject *api) { - SetUpMultiFactorTotpSecretHostApiWithSuffix(binaryMessenger, api, @""); -} - -void SetUpMultiFactorTotpSecretHostApiWithSuffix(id binaryMessenger, - NSObject *api, - NSString *messageChannelSuffix) { - messageChannelSuffix = messageChannelSuffix.length > 0 - ? [NSString stringWithFormat:@".%@", messageChannelSuffix] - : @""; - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"MultiFactorTotpSecretHostApi.generateQrCodeUrl", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector( - generateQrCodeUrlSecretKey:accountName:issuer:completion:)], - @"MultiFactorTotpSecretHostApi api (%@) doesn't respond to " - @"@selector(generateQrCodeUrlSecretKey:accountName:issuer:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSString *arg_secretKey = GetNullableObjectAtIndex(args, 0); - NSString *arg_accountName = GetNullableObjectAtIndex(args, 1); - NSString *arg_issuer = GetNullableObjectAtIndex(args, 2); - [api generateQrCodeUrlSecretKey:arg_secretKey - accountName:arg_accountName - issuer:arg_issuer - completion:^(NSString *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_interface." - @"MultiFactorTotpSecretHostApi.openInOtpApp", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(openInOtpAppSecretKey:qrCodeUrl:completion:)], - @"MultiFactorTotpSecretHostApi api (%@) doesn't respond to " - @"@selector(openInOtpAppSecretKey:qrCodeUrl:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSString *arg_secretKey = GetNullableObjectAtIndex(args, 0); - NSString *arg_qrCodeUrl = GetNullableObjectAtIndex(args, 1); - [api openInOtpAppSecretKey:arg_secretKey - qrCodeUrl:arg_qrCodeUrl - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } -} -void SetUpGenerateInterfaces(id binaryMessenger, - NSObject *api) { - SetUpGenerateInterfacesWithSuffix(binaryMessenger, api, @""); -} - -void SetUpGenerateInterfacesWithSuffix(id binaryMessenger, - NSObject *api, - NSString *messageChannelSuffix) { - messageChannelSuffix = messageChannelSuffix.length > 0 - ? [NSString stringWithFormat:@".%@", messageChannelSuffix] - : @""; - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_auth_platform_" - @"interface.GenerateInterfaces.pigeonInterface", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:nullGetFirebaseAuthMessagesCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector(pigeonInterfaceInfo:error:)], - @"GenerateInterfaces api (%@) doesn't respond to @selector(pigeonInterfaceInfo:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - InternalMultiFactorInfo *arg_info = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - [api pigeonInterfaceInfo:arg_info error:&error]; - callback(wrapResult(nil, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } -} diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Private/FLTAuthStateChannelStreamHandler.h b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Private/FLTAuthStateChannelStreamHandler.h deleted file mode 100644 index 7b7efae71920..000000000000 --- a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Private/FLTAuthStateChannelStreamHandler.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import - -#if TARGET_OS_OSX -#import -#else -#import -#endif - -#import -#import "../Public/CustomPigeonHeader.h" - -@class FIRAuth; - -NS_ASSUME_NONNULL_BEGIN - -@interface FLTAuthStateChannelStreamHandler : NSObject - -- (instancetype)initWithAuth:(FIRAuth *)auth; - -@end - -NS_ASSUME_NONNULL_END diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Private/FLTIdTokenChannelStreamHandler.h b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Private/FLTIdTokenChannelStreamHandler.h deleted file mode 100644 index c16604992f04..000000000000 --- a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Private/FLTIdTokenChannelStreamHandler.h +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import - -#if TARGET_OS_OSX -#import -#else -#import -#endif - -#import "../Public/CustomPigeonHeader.h" - -#import - -@class FIRAuth; - -NS_ASSUME_NONNULL_BEGIN - -@interface FLTIdTokenChannelStreamHandler : NSObject - -- (instancetype)initWithAuth:(FIRAuth *)auth; - -@end - -NS_ASSUME_NONNULL_END diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Private/FLTPhoneNumberVerificationStreamHandler.h b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Private/FLTPhoneNumberVerificationStreamHandler.h deleted file mode 100644 index 53e5f28cea90..000000000000 --- a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Private/FLTPhoneNumberVerificationStreamHandler.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import - -#if TARGET_OS_OSX -#import -#else -#import -#endif - -#import "../Public/firebase_auth_messages.g.h" - -#import - -@class FIRAuth; -@class FIRMultiFactorSession; -@class FIRPhoneMultiFactorInfo; - -NS_ASSUME_NONNULL_BEGIN - -@interface FLTPhoneNumberVerificationStreamHandler : NSObject - -#if TARGET_OS_OSX -- (instancetype)initWithAuth:(FIRAuth *)auth arguments:(NSDictionary *)arguments; -#else -- (instancetype)initWithAuth:(FIRAuth *)auth - request:(InternalVerifyPhoneNumberRequest *)request - session:(FIRMultiFactorSession *)session - factorInfo:(FIRPhoneMultiFactorInfo *)factorInfo; -#endif - -@end - -NS_ASSUME_NONNULL_END diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Private/PigeonParser.h b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Private/PigeonParser.h deleted file mode 100644 index b500fd2c878e..000000000000 --- a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Private/PigeonParser.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2023, the Chromium project authors. Please see the AUTHORS file - * for details. All rights reserved. Use of this source code is governed by a - * BSD-style license that can be found in the LICENSE file. - */ - -#import -#import "../Public/firebase_auth_messages.g.h" - -@class FIRAuthDataResult; -@class FIRUser; -@class FIRActionCodeSettings; -@class FIRAuthTokenResult; -@class FIRTOTPSecret; -@class FIRAuthCredential; - -@interface PigeonParser : NSObject - -+ (NSArray *_Nonnull)getManualList:(nonnull InternalUserDetails *)userDetails; -+ (InternalUserCredential *_Nullable) - getPigeonUserCredentialFromAuthResult:(nonnull FIRAuthDataResult *)authResult - authorizationCode:(nullable NSString *)authorizationCode; -+ (InternalUserDetails *_Nullable)getPigeonDetails:(nonnull FIRUser *)user; -+ (InternalUserInfo *_Nullable)getPigeonUserInfo:(nonnull FIRUser *)user; -+ (FIRActionCodeSettings *_Nullable)parseActionCodeSettings: - (nullable InternalActionCodeSettings *)settings; -+ (InternalUserCredential *_Nullable)getPigeonUserCredentialFromFIRUser:(nonnull FIRUser *)user; -+ (InternalIdTokenResult *_Nonnull)parseIdTokenResult:(nonnull FIRAuthTokenResult *)tokenResult; -+ (InternalTotpSecret *_Nonnull)getPigeonTotpSecret:(nonnull FIRTOTPSecret *)secret; -+ (InternalAuthCredential *_Nullable)getPigeonAuthCredential: - (FIRAuthCredential *_Nullable)authCredentialToken - token:(NSNumber *_Nullable)token; -@end diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Public/CustomPigeonHeader.h b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Public/CustomPigeonHeader.h deleted file mode 100644 index d32a6b451629..000000000000 --- a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Public/CustomPigeonHeader.h +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -#import "firebase_auth_messages.g.h" - -@interface InternalMultiFactorInfo (Map) -- (NSDictionary *)toList; -@end - -@interface InternalUserDetails (Map) -- (NSDictionary *)toList; -@end - -@interface InternalUserInfo (Map) -- (NSDictionary *)toList; -@end diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Public/FLTFirebaseAuthPlugin.h b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Public/FLTFirebaseAuthPlugin.h deleted file mode 100644 index 53e20eca48b6..000000000000 --- a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Public/FLTFirebaseAuthPlugin.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import - -#if TARGET_OS_OSX -#import -#else -#import -#endif - -#import -#import -#if __has_include() -#import -#else -#import -#endif -#import "firebase_auth_messages.g.h" - -#if !TARGET_OS_OSX -@protocol FlutterSceneLifeCycleDelegate; -#endif - -@interface FLTFirebaseAuthPlugin - : FLTFirebasePlugin ) - , - FlutterSceneLifeCycleDelegate -#endif -#endif - > - -+ (FlutterError *)convertToFlutterError:(NSError *)error; -@end diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Public/firebase_auth_messages.g.h b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Public/firebase_auth_messages.g.h deleted file mode 100644 index f83da7e34a3b..000000000000 --- a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Public/firebase_auth_messages.g.h +++ /dev/null @@ -1,571 +0,0 @@ -// Copyright 2023, the Chromium project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. -// Autogenerated from Pigeon (v26.3.4), do not edit directly. -// See also: https://pub.dev/packages/pigeon - -@import Foundation; - -@protocol FlutterBinaryMessenger; -@protocol FlutterMessageCodec; -@class FlutterError; -@class FlutterStandardTypedData; - -NS_ASSUME_NONNULL_BEGIN - -/// The type of operation that generated the action code from calling -/// [checkActionCode]. -typedef NS_ENUM(NSUInteger, ActionCodeInfoOperation) { - /// Unknown operation. - ActionCodeInfoOperationUnknown = 0, - /// Password reset code generated via [sendPasswordResetEmail]. - ActionCodeInfoOperationPasswordReset = 1, - /// Email verification code generated via [User.sendEmailVerification]. - ActionCodeInfoOperationVerifyEmail = 2, - /// Email change revocation code generated via [User.updateEmail]. - ActionCodeInfoOperationRecoverEmail = 3, - /// Email sign in code generated via [sendSignInLinkToEmail]. - ActionCodeInfoOperationEmailSignIn = 4, - /// Verify and change email code generated via [User.verifyBeforeUpdateEmail]. - ActionCodeInfoOperationVerifyAndChangeEmail = 5, - /// Action code for reverting second factor addition. - ActionCodeInfoOperationRevertSecondFactorAddition = 6, -}; - -/// Wrapper for ActionCodeInfoOperation to allow for nullability. -@interface ActionCodeInfoOperationBox : NSObject -@property(nonatomic, assign) ActionCodeInfoOperation value; -- (instancetype)initWithValue:(ActionCodeInfoOperation)value; -@end - -@class InternalMultiFactorSession; -@class InternalPhoneMultiFactorAssertion; -@class InternalMultiFactorInfo; -@class AuthPigeonFirebaseApp; -@class InternalActionCodeInfoData; -@class InternalActionCodeInfo; -@class InternalAdditionalUserInfo; -@class InternalAuthCredential; -@class InternalUserInfo; -@class InternalUserDetails; -@class InternalUserCredential; -@class InternalAuthCredentialInput; -@class InternalActionCodeSettings; -@class InternalFirebaseAuthSettings; -@class InternalSignInProvider; -@class InternalVerifyPhoneNumberRequest; -@class InternalIdTokenResult; -@class InternalUserProfile; -@class InternalTotpSecret; - -@interface InternalMultiFactorSession : NSObject -/// `init` unavailable to enforce nonnull fields, see the `make` class method. -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithId:(NSString *)id; -@property(nonatomic, copy) NSString *id; -@end - -@interface InternalPhoneMultiFactorAssertion : NSObject -/// `init` unavailable to enforce nonnull fields, see the `make` class method. -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithVerificationId:(NSString *)verificationId - verificationCode:(NSString *)verificationCode; -@property(nonatomic, copy) NSString *verificationId; -@property(nonatomic, copy) NSString *verificationCode; -@end - -@interface InternalMultiFactorInfo : NSObject -/// `init` unavailable to enforce nonnull fields, see the `make` class method. -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithDisplayName:(nullable NSString *)displayName - enrollmentTimestamp:(double)enrollmentTimestamp - factorId:(nullable NSString *)factorId - uid:(NSString *)uid - phoneNumber:(nullable NSString *)phoneNumber; -@property(nonatomic, copy, nullable) NSString *displayName; -@property(nonatomic, assign) double enrollmentTimestamp; -@property(nonatomic, copy, nullable) NSString *factorId; -@property(nonatomic, copy) NSString *uid; -@property(nonatomic, copy, nullable) NSString *phoneNumber; -@end - -@interface AuthPigeonFirebaseApp : NSObject -/// `init` unavailable to enforce nonnull fields, see the `make` class method. -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithAppName:(NSString *)appName - tenantId:(nullable NSString *)tenantId - customAuthDomain:(nullable NSString *)customAuthDomain; -@property(nonatomic, copy) NSString *appName; -@property(nonatomic, copy, nullable) NSString *tenantId; -@property(nonatomic, copy, nullable) NSString *customAuthDomain; -@end - -@interface InternalActionCodeInfoData : NSObject -+ (instancetype)makeWithEmail:(nullable NSString *)email - previousEmail:(nullable NSString *)previousEmail; -@property(nonatomic, copy, nullable) NSString *email; -@property(nonatomic, copy, nullable) NSString *previousEmail; -@end - -@interface InternalActionCodeInfo : NSObject -/// `init` unavailable to enforce nonnull fields, see the `make` class method. -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithOperation:(ActionCodeInfoOperation)operation - data:(InternalActionCodeInfoData *)data; -@property(nonatomic, assign) ActionCodeInfoOperation operation; -@property(nonatomic, strong) InternalActionCodeInfoData *data; -@end - -@interface InternalAdditionalUserInfo : NSObject -/// `init` unavailable to enforce nonnull fields, see the `make` class method. -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithIsNewUser:(BOOL)isNewUser - providerId:(nullable NSString *)providerId - username:(nullable NSString *)username - authorizationCode:(nullable NSString *)authorizationCode - profile:(nullable NSDictionary *)profile; -@property(nonatomic, assign) BOOL isNewUser; -@property(nonatomic, copy, nullable) NSString *providerId; -@property(nonatomic, copy, nullable) NSString *username; -@property(nonatomic, copy, nullable) NSString *authorizationCode; -@property(nonatomic, copy, nullable) NSDictionary *profile; -@end - -@interface InternalAuthCredential : NSObject -/// `init` unavailable to enforce nonnull fields, see the `make` class method. -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithProviderId:(NSString *)providerId - signInMethod:(NSString *)signInMethod - nativeId:(NSInteger)nativeId - accessToken:(nullable NSString *)accessToken; -@property(nonatomic, copy) NSString *providerId; -@property(nonatomic, copy) NSString *signInMethod; -@property(nonatomic, assign) NSInteger nativeId; -@property(nonatomic, copy, nullable) NSString *accessToken; -@end - -@interface InternalUserInfo : NSObject -/// `init` unavailable to enforce nonnull fields, see the `make` class method. -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithUid:(NSString *)uid - email:(nullable NSString *)email - displayName:(nullable NSString *)displayName - photoUrl:(nullable NSString *)photoUrl - phoneNumber:(nullable NSString *)phoneNumber - isAnonymous:(BOOL)isAnonymous - isEmailVerified:(BOOL)isEmailVerified - providerId:(nullable NSString *)providerId - tenantId:(nullable NSString *)tenantId - refreshToken:(nullable NSString *)refreshToken - creationTimestamp:(nullable NSNumber *)creationTimestamp - lastSignInTimestamp:(nullable NSNumber *)lastSignInTimestamp; -@property(nonatomic, copy) NSString *uid; -@property(nonatomic, copy, nullable) NSString *email; -@property(nonatomic, copy, nullable) NSString *displayName; -@property(nonatomic, copy, nullable) NSString *photoUrl; -@property(nonatomic, copy, nullable) NSString *phoneNumber; -@property(nonatomic, assign) BOOL isAnonymous; -@property(nonatomic, assign) BOOL isEmailVerified; -@property(nonatomic, copy, nullable) NSString *providerId; -@property(nonatomic, copy, nullable) NSString *tenantId; -@property(nonatomic, copy, nullable) NSString *refreshToken; -@property(nonatomic, strong, nullable) NSNumber *creationTimestamp; -@property(nonatomic, strong, nullable) NSNumber *lastSignInTimestamp; -@end - -@interface InternalUserDetails : NSObject -/// `init` unavailable to enforce nonnull fields, see the `make` class method. -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithUserInfo:(InternalUserInfo *)userInfo - providerData:(NSArray *> *)providerData; -@property(nonatomic, strong) InternalUserInfo *userInfo; -@property(nonatomic, copy) NSArray *> *providerData; -@end - -@interface InternalUserCredential : NSObject -+ (instancetype)makeWithUser:(nullable InternalUserDetails *)user - additionalUserInfo:(nullable InternalAdditionalUserInfo *)additionalUserInfo - credential:(nullable InternalAuthCredential *)credential; -@property(nonatomic, strong, nullable) InternalUserDetails *user; -@property(nonatomic, strong, nullable) InternalAdditionalUserInfo *additionalUserInfo; -@property(nonatomic, strong, nullable) InternalAuthCredential *credential; -@end - -@interface InternalAuthCredentialInput : NSObject -/// `init` unavailable to enforce nonnull fields, see the `make` class method. -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithProviderId:(NSString *)providerId - signInMethod:(NSString *)signInMethod - token:(nullable NSString *)token - accessToken:(nullable NSString *)accessToken; -@property(nonatomic, copy) NSString *providerId; -@property(nonatomic, copy) NSString *signInMethod; -@property(nonatomic, copy, nullable) NSString *token; -@property(nonatomic, copy, nullable) NSString *accessToken; -@end - -@interface InternalActionCodeSettings : NSObject -/// `init` unavailable to enforce nonnull fields, see the `make` class method. -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithUrl:(NSString *)url - dynamicLinkDomain:(nullable NSString *)dynamicLinkDomain - handleCodeInApp:(BOOL)handleCodeInApp - iOSBundleId:(nullable NSString *)iOSBundleId - androidPackageName:(nullable NSString *)androidPackageName - androidInstallApp:(BOOL)androidInstallApp - androidMinimumVersion:(nullable NSString *)androidMinimumVersion - linkDomain:(nullable NSString *)linkDomain; -@property(nonatomic, copy) NSString *url; -@property(nonatomic, copy, nullable) NSString *dynamicLinkDomain; -@property(nonatomic, assign) BOOL handleCodeInApp; -@property(nonatomic, copy, nullable) NSString *iOSBundleId; -@property(nonatomic, copy, nullable) NSString *androidPackageName; -@property(nonatomic, assign) BOOL androidInstallApp; -@property(nonatomic, copy, nullable) NSString *androidMinimumVersion; -@property(nonatomic, copy, nullable) NSString *linkDomain; -@end - -@interface InternalFirebaseAuthSettings : NSObject -/// `init` unavailable to enforce nonnull fields, see the `make` class method. -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithAppVerificationDisabledForTesting:(BOOL)appVerificationDisabledForTesting - userAccessGroup:(nullable NSString *)userAccessGroup - phoneNumber:(nullable NSString *)phoneNumber - smsCode:(nullable NSString *)smsCode - forceRecaptchaFlow:(nullable NSNumber *)forceRecaptchaFlow; -@property(nonatomic, assign) BOOL appVerificationDisabledForTesting; -@property(nonatomic, copy, nullable) NSString *userAccessGroup; -@property(nonatomic, copy, nullable) NSString *phoneNumber; -@property(nonatomic, copy, nullable) NSString *smsCode; -@property(nonatomic, strong, nullable) NSNumber *forceRecaptchaFlow; -@end - -@interface InternalSignInProvider : NSObject -/// `init` unavailable to enforce nonnull fields, see the `make` class method. -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithProviderId:(NSString *)providerId - scopes:(nullable NSArray *)scopes - customParameters: - (nullable NSDictionary *)customParameters; -@property(nonatomic, copy) NSString *providerId; -@property(nonatomic, copy, nullable) NSArray *scopes; -@property(nonatomic, copy, nullable) NSDictionary *customParameters; -@end - -@interface InternalVerifyPhoneNumberRequest : NSObject -/// `init` unavailable to enforce nonnull fields, see the `make` class method. -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithPhoneNumber:(nullable NSString *)phoneNumber - timeout:(NSInteger)timeout - forceResendingToken:(nullable NSNumber *)forceResendingToken - autoRetrievedSmsCodeForTesting:(nullable NSString *)autoRetrievedSmsCodeForTesting - multiFactorInfoId:(nullable NSString *)multiFactorInfoId - multiFactorSessionId:(nullable NSString *)multiFactorSessionId; -@property(nonatomic, copy, nullable) NSString *phoneNumber; -@property(nonatomic, assign) NSInteger timeout; -@property(nonatomic, strong, nullable) NSNumber *forceResendingToken; -@property(nonatomic, copy, nullable) NSString *autoRetrievedSmsCodeForTesting; -@property(nonatomic, copy, nullable) NSString *multiFactorInfoId; -@property(nonatomic, copy, nullable) NSString *multiFactorSessionId; -@end - -@interface InternalIdTokenResult : NSObject -+ (instancetype)makeWithToken:(nullable NSString *)token - expirationTimestamp:(nullable NSNumber *)expirationTimestamp - authTimestamp:(nullable NSNumber *)authTimestamp - issuedAtTimestamp:(nullable NSNumber *)issuedAtTimestamp - signInProvider:(nullable NSString *)signInProvider - claims:(nullable NSDictionary *)claims - signInSecondFactor:(nullable NSString *)signInSecondFactor; -@property(nonatomic, copy, nullable) NSString *token; -@property(nonatomic, strong, nullable) NSNumber *expirationTimestamp; -@property(nonatomic, strong, nullable) NSNumber *authTimestamp; -@property(nonatomic, strong, nullable) NSNumber *issuedAtTimestamp; -@property(nonatomic, copy, nullable) NSString *signInProvider; -@property(nonatomic, copy, nullable) NSDictionary *claims; -@property(nonatomic, copy, nullable) NSString *signInSecondFactor; -@end - -@interface InternalUserProfile : NSObject -/// `init` unavailable to enforce nonnull fields, see the `make` class method. -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithDisplayName:(nullable NSString *)displayName - photoUrl:(nullable NSString *)photoUrl - displayNameChanged:(BOOL)displayNameChanged - photoUrlChanged:(BOOL)photoUrlChanged; -@property(nonatomic, copy, nullable) NSString *displayName; -@property(nonatomic, copy, nullable) NSString *photoUrl; -@property(nonatomic, assign) BOOL displayNameChanged; -@property(nonatomic, assign) BOOL photoUrlChanged; -@end - -@interface InternalTotpSecret : NSObject -/// `init` unavailable to enforce nonnull fields, see the `make` class method. -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithCodeIntervalSeconds:(nullable NSNumber *)codeIntervalSeconds - codeLength:(nullable NSNumber *)codeLength - enrollmentCompletionDeadline:(nullable NSNumber *)enrollmentCompletionDeadline - hashingAlgorithm:(nullable NSString *)hashingAlgorithm - secretKey:(NSString *)secretKey; -@property(nonatomic, strong, nullable) NSNumber *codeIntervalSeconds; -@property(nonatomic, strong, nullable) NSNumber *codeLength; -@property(nonatomic, strong, nullable) NSNumber *enrollmentCompletionDeadline; -@property(nonatomic, copy, nullable) NSString *hashingAlgorithm; -@property(nonatomic, copy) NSString *secretKey; -@end - -/// The codec used by all APIs. -NSObject *nullGetFirebaseAuthMessagesCodec(void); - -@protocol FirebaseAuthHostApi -- (void)registerIdTokenListenerApp:(AuthPigeonFirebaseApp *)app - completion: - (void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; -- (void)registerAuthStateListenerApp:(AuthPigeonFirebaseApp *)app - completion: - (void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; -- (void)useEmulatorApp:(AuthPigeonFirebaseApp *)app - host:(NSString *)host - port:(NSInteger)port - completion:(void (^)(FlutterError *_Nullable))completion; -- (void)applyActionCodeApp:(AuthPigeonFirebaseApp *)app - code:(NSString *)code - completion:(void (^)(FlutterError *_Nullable))completion; -- (void)checkActionCodeApp:(AuthPigeonFirebaseApp *)app - code:(NSString *)code - completion:(void (^)(InternalActionCodeInfo *_Nullable, - FlutterError *_Nullable))completion; -- (void)confirmPasswordResetApp:(AuthPigeonFirebaseApp *)app - code:(NSString *)code - newPassword:(NSString *)newPassword - completion:(void (^)(FlutterError *_Nullable))completion; -- (void)createUserWithEmailAndPasswordApp:(AuthPigeonFirebaseApp *)app - email:(NSString *)email - password:(NSString *)password - completion:(void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion; -- (void)signInAnonymouslyApp:(AuthPigeonFirebaseApp *)app - completion:(void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion; -- (void)signInWithCredentialApp:(AuthPigeonFirebaseApp *)app - input:(NSDictionary *)input - completion:(void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion; -- (void)signInWithCustomTokenApp:(AuthPigeonFirebaseApp *)app - token:(NSString *)token - completion:(void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion; -- (void)signInWithEmailAndPasswordApp:(AuthPigeonFirebaseApp *)app - email:(NSString *)email - password:(NSString *)password - completion:(void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion; -- (void)signInWithEmailLinkApp:(AuthPigeonFirebaseApp *)app - email:(NSString *)email - emailLink:(NSString *)emailLink - completion:(void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion; -- (void)signInWithProviderApp:(AuthPigeonFirebaseApp *)app - signInProvider:(InternalSignInProvider *)signInProvider - completion:(void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion; -- (void)signOutApp:(AuthPigeonFirebaseApp *)app - completion:(void (^)(FlutterError *_Nullable))completion; -- (void)fetchSignInMethodsForEmailApp:(AuthPigeonFirebaseApp *)app - email:(NSString *)email - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; -- (void)sendPasswordResetEmailApp:(AuthPigeonFirebaseApp *)app - email:(NSString *)email - actionCodeSettings:(nullable InternalActionCodeSettings *)actionCodeSettings - completion:(void (^)(FlutterError *_Nullable))completion; -- (void)sendSignInLinkToEmailApp:(AuthPigeonFirebaseApp *)app - email:(NSString *)email - actionCodeSettings:(InternalActionCodeSettings *)actionCodeSettings - completion:(void (^)(FlutterError *_Nullable))completion; -- (void)setLanguageCodeApp:(AuthPigeonFirebaseApp *)app - languageCode:(nullable NSString *)languageCode - completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; -- (void)setSettingsApp:(AuthPigeonFirebaseApp *)app - settings:(InternalFirebaseAuthSettings *)settings - completion:(void (^)(FlutterError *_Nullable))completion; -- (void)verifyPasswordResetCodeApp:(AuthPigeonFirebaseApp *)app - code:(NSString *)code - completion: - (void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; -- (void)verifyPhoneNumberApp:(AuthPigeonFirebaseApp *)app - request:(InternalVerifyPhoneNumberRequest *)request - completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; -- (void)revokeTokenWithAuthorizationCodeApp:(AuthPigeonFirebaseApp *)app - authorizationCode:(NSString *)authorizationCode - completion:(void (^)(FlutterError *_Nullable))completion; -- (void)revokeAccessTokenApp:(AuthPigeonFirebaseApp *)app - accessToken:(NSString *)accessToken - completion:(void (^)(FlutterError *_Nullable))completion; -- (void)initializeRecaptchaConfigApp:(AuthPigeonFirebaseApp *)app - completion:(void (^)(FlutterError *_Nullable))completion; -@end - -extern void SetUpFirebaseAuthHostApi(id binaryMessenger, - NSObject *_Nullable api); - -extern void SetUpFirebaseAuthHostApiWithSuffix(id binaryMessenger, - NSObject *_Nullable api, - NSString *messageChannelSuffix); - -@protocol FirebaseAuthUserHostApi -- (void)deleteApp:(AuthPigeonFirebaseApp *)app - completion:(void (^)(FlutterError *_Nullable))completion; -- (void)getIdTokenApp:(AuthPigeonFirebaseApp *)app - forceRefresh:(BOOL)forceRefresh - completion: - (void (^)(InternalIdTokenResult *_Nullable, FlutterError *_Nullable))completion; -- (void)linkWithCredentialApp:(AuthPigeonFirebaseApp *)app - input:(NSDictionary *)input - completion:(void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion; -- (void)linkWithProviderApp:(AuthPigeonFirebaseApp *)app - signInProvider:(InternalSignInProvider *)signInProvider - completion:(void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion; -- (void)reauthenticateWithCredentialApp:(AuthPigeonFirebaseApp *)app - input:(NSDictionary *)input - completion:(void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion; -- (void)reauthenticateWithProviderApp:(AuthPigeonFirebaseApp *)app - signInProvider:(InternalSignInProvider *)signInProvider - completion:(void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion; -- (void)reloadApp:(AuthPigeonFirebaseApp *)app - completion:(void (^)(InternalUserDetails *_Nullable, FlutterError *_Nullable))completion; -- (void)sendEmailVerificationApp:(AuthPigeonFirebaseApp *)app - actionCodeSettings:(nullable InternalActionCodeSettings *)actionCodeSettings - completion:(void (^)(FlutterError *_Nullable))completion; -- (void)unlinkApp:(AuthPigeonFirebaseApp *)app - providerId:(NSString *)providerId - completion:(void (^)(InternalUserCredential *_Nullable, FlutterError *_Nullable))completion; -- (void)updateEmailApp:(AuthPigeonFirebaseApp *)app - newEmail:(NSString *)newEmail - completion: - (void (^)(InternalUserDetails *_Nullable, FlutterError *_Nullable))completion; -- (void)updatePasswordApp:(AuthPigeonFirebaseApp *)app - newPassword:(NSString *)newPassword - completion: - (void (^)(InternalUserDetails *_Nullable, FlutterError *_Nullable))completion; -- (void)updatePhoneNumberApp:(AuthPigeonFirebaseApp *)app - input:(NSDictionary *)input - completion: - (void (^)(InternalUserDetails *_Nullable, FlutterError *_Nullable))completion; -- (void)updateProfileApp:(AuthPigeonFirebaseApp *)app - profile:(InternalUserProfile *)profile - completion: - (void (^)(InternalUserDetails *_Nullable, FlutterError *_Nullable))completion; -- (void)verifyBeforeUpdateEmailApp:(AuthPigeonFirebaseApp *)app - newEmail:(NSString *)newEmail - actionCodeSettings:(nullable InternalActionCodeSettings *)actionCodeSettings - completion:(void (^)(FlutterError *_Nullable))completion; -@end - -extern void SetUpFirebaseAuthUserHostApi(id binaryMessenger, - NSObject *_Nullable api); - -extern void SetUpFirebaseAuthUserHostApiWithSuffix(id binaryMessenger, - NSObject *_Nullable api, - NSString *messageChannelSuffix); - -@protocol MultiFactorUserHostApi -- (void)enrollPhoneApp:(AuthPigeonFirebaseApp *)app - assertion:(InternalPhoneMultiFactorAssertion *)assertion - displayName:(nullable NSString *)displayName - completion:(void (^)(FlutterError *_Nullable))completion; -- (void)enrollTotpApp:(AuthPigeonFirebaseApp *)app - assertionId:(NSString *)assertionId - displayName:(nullable NSString *)displayName - completion:(void (^)(FlutterError *_Nullable))completion; -- (void)getSessionApp:(AuthPigeonFirebaseApp *)app - completion: - (void (^)(InternalMultiFactorSession *_Nullable, FlutterError *_Nullable))completion; -- (void)unenrollApp:(AuthPigeonFirebaseApp *)app - factorUid:(NSString *)factorUid - completion:(void (^)(FlutterError *_Nullable))completion; -- (void)getEnrolledFactorsApp:(AuthPigeonFirebaseApp *)app - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; -@end - -extern void SetUpMultiFactorUserHostApi(id binaryMessenger, - NSObject *_Nullable api); - -extern void SetUpMultiFactorUserHostApiWithSuffix(id binaryMessenger, - NSObject *_Nullable api, - NSString *messageChannelSuffix); - -@protocol MultiFactoResolverHostApi -- (void)resolveSignInResolverId:(NSString *)resolverId - assertion:(nullable InternalPhoneMultiFactorAssertion *)assertion - totpAssertionId:(nullable NSString *)totpAssertionId - completion:(void (^)(InternalUserCredential *_Nullable, - FlutterError *_Nullable))completion; -@end - -extern void SetUpMultiFactoResolverHostApi(id binaryMessenger, - NSObject *_Nullable api); - -extern void SetUpMultiFactoResolverHostApiWithSuffix( - id binaryMessenger, NSObject *_Nullable api, - NSString *messageChannelSuffix); - -@protocol MultiFactorTotpHostApi -- (void)generateSecretSessionId:(NSString *)sessionId - completion:(void (^)(InternalTotpSecret *_Nullable, - FlutterError *_Nullable))completion; -- (void)getAssertionForEnrollmentSecretKey:(NSString *)secretKey - oneTimePassword:(NSString *)oneTimePassword - completion:(void (^)(NSString *_Nullable, - FlutterError *_Nullable))completion; -- (void)getAssertionForSignInEnrollmentId:(NSString *)enrollmentId - oneTimePassword:(NSString *)oneTimePassword - completion:(void (^)(NSString *_Nullable, - FlutterError *_Nullable))completion; -@end - -extern void SetUpMultiFactorTotpHostApi(id binaryMessenger, - NSObject *_Nullable api); - -extern void SetUpMultiFactorTotpHostApiWithSuffix(id binaryMessenger, - NSObject *_Nullable api, - NSString *messageChannelSuffix); - -@protocol MultiFactorTotpSecretHostApi -- (void)generateQrCodeUrlSecretKey:(NSString *)secretKey - accountName:(nullable NSString *)accountName - issuer:(nullable NSString *)issuer - completion: - (void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; -- (void)openInOtpAppSecretKey:(NSString *)secretKey - qrCodeUrl:(NSString *)qrCodeUrl - completion:(void (^)(FlutterError *_Nullable))completion; -@end - -extern void SetUpMultiFactorTotpSecretHostApi( - id binaryMessenger, - NSObject *_Nullable api); - -extern void SetUpMultiFactorTotpSecretHostApiWithSuffix( - id binaryMessenger, - NSObject *_Nullable api, NSString *messageChannelSuffix); - -/// Only used to generate the object interface that are use outside of the Pigeon interface -@protocol GenerateInterfaces -- (void)pigeonInterfaceInfo:(InternalMultiFactorInfo *)info - error:(FlutterError *_Nullable *_Nonnull)error; -@end - -extern void SetUpGenerateInterfaces(id binaryMessenger, - NSObject *_Nullable api); - -extern void SetUpGenerateInterfacesWithSuffix(id binaryMessenger, - NSObject *_Nullable api, - NSString *messageChannelSuffix); - -NS_ASSUME_NONNULL_END diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth.podspec b/packages/firebase_auth/firebase_auth/macos/firebase_auth.podspec index 4e5be544fa68..069e6deed9df 100755 --- a/packages/firebase_auth/firebase_auth/macos/firebase_auth.podspec +++ b/packages/firebase_auth/firebase_auth/macos/firebase_auth.podspec @@ -43,11 +43,10 @@ Pod::Spec.new do |s| s.authors = 'The Chromium Authors' s.source = { :path => '.' } - s.source_files = 'firebase_auth/Sources/firebase_auth/**/*.{h,m}' - s.public_header_files = 'firebase_auth/Sources/firebase_auth/include/Public/**/*.h' - s.private_header_files = 'firebase_auth/Sources/firebase_auth/include/Private/**/*.h' + s.source_files = 'firebase_auth/Sources/firebase_auth/**/*.swift' s.platform = :osx, '10.13' + s.swift_version = '5.0' # Flutter dependencies s.dependency 'FlutterMacOS' diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Package.swift b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Package.swift index a2403ef8aec9..92b29c846880 100644 --- a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Package.swift +++ b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Package.swift @@ -35,8 +35,6 @@ let package = Package( .process("Resources") ], cSettings: [ - .headerSearchPath("include/Private"), - .headerSearchPath("include/Public"), .define("LIBRARY_VERSION", to: "\"\(libraryVersion)\""), .define("LIBRARY_NAME", to: "\"flutter-fire-auth\""), ] diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/AuthConstants.swift b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/AuthConstants.swift new file mode 120000 index 000000000000..338a75a696eb --- /dev/null +++ b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/AuthConstants.swift @@ -0,0 +1 @@ +../../../../ios/firebase_auth/Sources/firebase_auth/AuthConstants.swift \ No newline at end of file diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/AuthErrors.swift b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/AuthErrors.swift new file mode 120000 index 000000000000..9490acf2dcf4 --- /dev/null +++ b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/AuthErrors.swift @@ -0,0 +1 @@ +../../../../ios/firebase_auth/Sources/firebase_auth/AuthErrors.swift \ No newline at end of file diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTAuthStateChannelStreamHandler.m b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTAuthStateChannelStreamHandler.m deleted file mode 120000 index 0e16058ab48f..000000000000 --- a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTAuthStateChannelStreamHandler.m +++ /dev/null @@ -1 +0,0 @@ -../../../../ios/firebase_auth/Sources/firebase_auth/FLTAuthStateChannelStreamHandler.m \ No newline at end of file diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTAuthStateChannelStreamHandler.swift b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTAuthStateChannelStreamHandler.swift new file mode 120000 index 000000000000..a1f23233f58b --- /dev/null +++ b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTAuthStateChannelStreamHandler.swift @@ -0,0 +1 @@ +../../../../ios/firebase_auth/Sources/firebase_auth/FLTAuthStateChannelStreamHandler.swift \ No newline at end of file diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+MultiFactor.swift b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+MultiFactor.swift new file mode 120000 index 000000000000..90392e71be6e --- /dev/null +++ b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+MultiFactor.swift @@ -0,0 +1 @@ +../../../../ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+MultiFactor.swift \ No newline at end of file diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+User.swift b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+User.swift new file mode 120000 index 000000000000..c82c67cb12d3 --- /dev/null +++ b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+User.swift @@ -0,0 +1 @@ +../../../../ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+User.swift \ No newline at end of file diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.m b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.m deleted file mode 120000 index 8e7639c57655..000000000000 --- a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.m +++ /dev/null @@ -1 +0,0 @@ -../../../../ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.m \ No newline at end of file diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.swift b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.swift new file mode 120000 index 000000000000..55e834509787 --- /dev/null +++ b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.swift @@ -0,0 +1 @@ +../../../../ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.swift \ No newline at end of file diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTIdTokenChannelStreamHandler.m b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTIdTokenChannelStreamHandler.m deleted file mode 120000 index 315065000d14..000000000000 --- a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTIdTokenChannelStreamHandler.m +++ /dev/null @@ -1 +0,0 @@ -../../../../ios/firebase_auth/Sources/firebase_auth/FLTIdTokenChannelStreamHandler.m \ No newline at end of file diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTIdTokenChannelStreamHandler.swift b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTIdTokenChannelStreamHandler.swift new file mode 120000 index 000000000000..06a93b30200f --- /dev/null +++ b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTIdTokenChannelStreamHandler.swift @@ -0,0 +1 @@ +../../../../ios/firebase_auth/Sources/firebase_auth/FLTIdTokenChannelStreamHandler.swift \ No newline at end of file diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTPhoneNumberVerificationStreamHandler.m b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTPhoneNumberVerificationStreamHandler.m deleted file mode 120000 index e6a936a53ddb..000000000000 --- a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTPhoneNumberVerificationStreamHandler.m +++ /dev/null @@ -1 +0,0 @@ -../../../../ios/firebase_auth/Sources/firebase_auth/FLTPhoneNumberVerificationStreamHandler.m \ No newline at end of file diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTPhoneNumberVerificationStreamHandler.swift b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTPhoneNumberVerificationStreamHandler.swift new file mode 120000 index 000000000000..d739b431f5eb --- /dev/null +++ b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTPhoneNumberVerificationStreamHandler.swift @@ -0,0 +1 @@ +../../../../ios/firebase_auth/Sources/firebase_auth/FLTPhoneNumberVerificationStreamHandler.swift \ No newline at end of file diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FirebaseAuthMessages.g.swift b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FirebaseAuthMessages.g.swift new file mode 120000 index 000000000000..49716a4b262c --- /dev/null +++ b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FirebaseAuthMessages.g.swift @@ -0,0 +1 @@ +../../../../ios/firebase_auth/Sources/firebase_auth/FirebaseAuthMessages.g.swift \ No newline at end of file diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/PigeonParser.m b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/PigeonParser.m deleted file mode 120000 index 0104023e896a..000000000000 --- a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/PigeonParser.m +++ /dev/null @@ -1 +0,0 @@ -../../../../ios/firebase_auth/Sources/firebase_auth/PigeonParser.m \ No newline at end of file diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/PigeonParser.swift b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/PigeonParser.swift new file mode 120000 index 000000000000..7a86fa52f782 --- /dev/null +++ b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/PigeonParser.swift @@ -0,0 +1 @@ +../../../../ios/firebase_auth/Sources/firebase_auth/PigeonParser.swift \ No newline at end of file diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/Resource/.gitkeep b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/Resource/.gitkeep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/Resources/.gitkeep b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/Resources/.gitkeep new file mode 120000 index 000000000000..1b1fa9c77051 --- /dev/null +++ b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/Resources/.gitkeep @@ -0,0 +1 @@ +../../../../ios/firebase_auth/Sources/firebase_auth/Resources/.gitkeep \ No newline at end of file diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/firebase_auth_messages.g.m b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/firebase_auth_messages.g.m deleted file mode 120000 index 0f42a371a776..000000000000 --- a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/firebase_auth_messages.g.m +++ /dev/null @@ -1 +0,0 @@ -../../../../ios/firebase_auth/Sources/firebase_auth/firebase_auth_messages.g.m \ No newline at end of file diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Private/FLTAuthStateChannelStreamHandler.h b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Private/FLTAuthStateChannelStreamHandler.h deleted file mode 120000 index 49a6bf1eed29..000000000000 --- a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Private/FLTAuthStateChannelStreamHandler.h +++ /dev/null @@ -1 +0,0 @@ -../../../../../../ios/firebase_auth/Sources/firebase_auth/include/Private/FLTAuthStateChannelStreamHandler.h \ No newline at end of file diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Private/FLTIdTokenChannelStreamHandler.h b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Private/FLTIdTokenChannelStreamHandler.h deleted file mode 120000 index fbad39c06b11..000000000000 --- a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Private/FLTIdTokenChannelStreamHandler.h +++ /dev/null @@ -1 +0,0 @@ -../../../../../../ios/firebase_auth/Sources/firebase_auth/include/Private/FLTIdTokenChannelStreamHandler.h \ No newline at end of file diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Private/FLTPhoneNumberVerificationStreamHandler.h b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Private/FLTPhoneNumberVerificationStreamHandler.h deleted file mode 120000 index 56d8a919bda0..000000000000 --- a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Private/FLTPhoneNumberVerificationStreamHandler.h +++ /dev/null @@ -1 +0,0 @@ -../../../../../../ios/firebase_auth/Sources/firebase_auth/include/Private/FLTPhoneNumberVerificationStreamHandler.h \ No newline at end of file diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Private/PigeonParser.h b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Private/PigeonParser.h deleted file mode 120000 index e11e71559a5c..000000000000 --- a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Private/PigeonParser.h +++ /dev/null @@ -1 +0,0 @@ -../../../../../../ios/firebase_auth/Sources/firebase_auth/include/Private/PigeonParser.h \ No newline at end of file diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Public/CustomPigeonHeader.h b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Public/CustomPigeonHeader.h deleted file mode 120000 index f7b16628cc9b..000000000000 --- a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Public/CustomPigeonHeader.h +++ /dev/null @@ -1 +0,0 @@ -../../../../../../ios/firebase_auth/Sources/firebase_auth/include/Public/CustomPigeonHeader.h \ No newline at end of file diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Public/FLTFirebaseAuthPlugin.h b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Public/FLTFirebaseAuthPlugin.h deleted file mode 120000 index 67a100f304cd..000000000000 --- a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Public/FLTFirebaseAuthPlugin.h +++ /dev/null @@ -1 +0,0 @@ -../../../../../../ios/firebase_auth/Sources/firebase_auth/include/Public/FLTFirebaseAuthPlugin.h \ No newline at end of file diff --git a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Public/firebase_auth_messages.g.h b/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Public/firebase_auth_messages.g.h deleted file mode 120000 index 39352574d844..000000000000 --- a/packages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/include/Public/firebase_auth_messages.g.h +++ /dev/null @@ -1 +0,0 @@ -../../../../../../ios/firebase_auth/Sources/firebase_auth/include/Public/firebase_auth_messages.g.h \ No newline at end of file diff --git a/packages/firebase_auth/firebase_auth_platform_interface/pigeons/messages.dart b/packages/firebase_auth/firebase_auth_platform_interface/pigeons/messages.dart index 943fa1693b87..9c6cfd4a3c0b 100644 --- a/packages/firebase_auth/firebase_auth_platform_interface/pigeons/messages.dart +++ b/packages/firebase_auth/firebase_auth_platform_interface/pigeons/messages.dart @@ -17,10 +17,8 @@ import 'package:pigeon/pigeon.dart'; package: 'io.flutter.plugins.firebase.auth', className: 'GeneratedAndroidFirebaseAuth', ), - objcHeaderOut: - '../firebase_auth/ios/firebase_auth/Sources/firebase_auth/include/Public/firebase_auth_messages.g.h', - objcSourceOut: - '../firebase_auth/ios/firebase_auth/Sources/firebase_auth/firebase_auth_messages.g.m', + swiftOut: + '../firebase_auth/ios/firebase_auth/Sources/firebase_auth/FirebaseAuthMessages.g.swift', cppHeaderOut: '../firebase_auth/windows/messages.g.h', cppSourceOut: '../firebase_auth/windows/messages.g.cpp', cppOptions: CppOptions(namespace: 'firebase_auth_windows'), From 5806b978c8a3ae0f9295ed586f03e16de3fa7353 Mon Sep 17 00:00:00 2001 From: Jude Selase Kwashie <64037520+SelaseKay@users.noreply.github.com> Date: Wed, 19 Aug 2026 16:04:15 +0000 Subject: [PATCH 2/5] fix(auth,apple): restore Apple credential switch case and format Swift --- .../FLTFirebaseAuthPlugin+MultiFactor.swift | 3 +- .../firebase_auth/FLTFirebaseAuthPlugin.swift | 34 +- .../FirebaseAuthMessages.g.swift | 650 +++++++++++++----- .../Sources/firebase_auth/PigeonParser.swift | 4 +- 4 files changed, 515 insertions(+), 176 deletions(-) diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+MultiFactor.swift b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+MultiFactor.swift index ca780f2dda3f..9cf6deac6c1d 100644 --- a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+MultiFactor.swift +++ b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+MultiFactor.swift @@ -84,7 +84,8 @@ extension FLTFirebaseAuthPlugin: MultiFactorUserHostApi, MultiFactoResolverHostA } func unenroll( - app: AuthPigeonFirebaseApp, factorUid: String, completion: @escaping (Result) -> Void + app: AuthPigeonFirebaseApp, factorUid: String, + completion: @escaping (Result) -> Void ) { guard let multiFactor = getAppMultiFactorFromPigeon(app) else { completion(.failure(AuthErrors.noCurrentUser())) diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.swift b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.swift index 5ca98110ecca..b849e720e436 100644 --- a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.swift +++ b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.swift @@ -23,8 +23,6 @@ import Security import FlutterMacOS #endif -extension FlutterError: Error {} - @objc(FLTFirebaseAuthPlugin) public class FLTFirebaseAuthPlugin: NSObject, FlutterPlugin, FLTFirebasePluginProtocol, FirebaseAuthHostApi, ASAuthorizationControllerDelegate, @@ -191,7 +189,8 @@ public class FLTFirebaseAuthPlugin: NSObject, FlutterPlugin, FLTFirebasePluginPr Auth.auth().canHandle(url) } - public func scene(_ scene: UIScene, openURLContexts URLContexts: Set) -> Bool { + public func scene(_ scene: UIScene, openURLContexts URLContexts: Set) -> Bool + { for urlContext in URLContexts where Auth.auth().canHandle(urlContext.url) { return true } @@ -246,7 +245,8 @@ public class FLTFirebaseAuthPlugin: NSObject, FlutterPlugin, FLTFirebasePluginPr ) { let nsError = error as NSError guard - let resolver = nsError.userInfo[AuthErrorUserInfoMultiFactorResolverKey] as? MultiFactorResolver + let resolver = nsError.userInfo[AuthErrorUserInfoMultiFactorResolverKey] + as? MultiFactorResolver else { completion(.failure(AuthErrors.convertToFlutterError(error))) return @@ -405,7 +405,8 @@ public class FLTFirebaseAuthPlugin: NSObject, FlutterPlugin, FLTFirebasePluginPr authorizationController.performRequests() } - public func presentationAnchor(for controller: ASAuthorizationController) -> ASPresentationAnchor { + public func presentationAnchor(for controller: ASAuthorizationController) -> ASPresentationAnchor + { #if os(macOS) return NSApplication.shared.keyWindow ?? ASPresentationAnchor() #else @@ -468,18 +469,21 @@ public class FLTFirebaseAuthPlugin: NSObject, FlutterPlugin, FLTFirebasePluginPr if isReauthenticatingWithApple { isReauthenticatingWithApple = false Auth.auth().currentUser?.reauthenticate(with: credential) { authResult, error in - self.handleSignInWithApple(authResult: authResult, authorizationCode: authorizationCode, error: error) + self.handleSignInWithApple( + authResult: authResult, authorizationCode: authorizationCode, error: error) } } else if let userToLink = linkWithAppleUser { userToLink.link(with: credential) { authResult, error in self.linkWithAppleUser = nil - self.handleSignInWithApple(authResult: authResult, authorizationCode: authorizationCode, error: error) + self.handleSignInWithApple( + authResult: authResult, authorizationCode: authorizationCode, error: error) } } else { let signInAuth = signInWithAppleAuth ?? Auth.auth() signInAuth.signIn(with: credential) { authResult, error in self.signInWithAppleAuth = nil - self.handleSignInWithApple(authResult: authResult, authorizationCode: authorizationCode, error: error) + self.handleSignInWithApple( + authResult: authResult, authorizationCode: authorizationCode, error: error) } } } @@ -586,7 +590,8 @@ public class FLTFirebaseAuthPlugin: NSObject, FlutterPlugin, FLTFirebasePluginPr switch signInMethod { case kSignInMethodPassword: - completion(EmailAuthProvider.credential(withEmail: str("email") ?? "", password: secret ?? ""), nil) + completion( + EmailAuthProvider.credential(withEmail: str("email") ?? "", password: secret ?? ""), nil) case kSignInMethodEmailLink: completion( EmailAuthProvider.credential(withEmail: str("email") ?? "", link: str("emailLink") ?? ""), @@ -613,7 +618,7 @@ public class FLTFirebaseAuthPlugin: NSObject, FlutterPlugin, FLTFirebasePluginPr "The Firebase Phone Authentication provider is not supported on the MacOS platform.") completion(nil, nil) #endif - if signInMethod == kSignInMethodApple { + case kSignInMethodApple: if let idToken, let rawNonce { var fullName = PersonNameComponents() fullName.givenName = str("givenName") @@ -655,7 +660,8 @@ public class FLTFirebaseAuthPlugin: NSObject, FlutterPlugin, FLTFirebasePluginPr nil) } default: - print("Support for an auth provider with identifier '\(signInMethod ?? "")' is not implemented.") + print( + "Support for an auth provider with identifier '\(signInMethod ?? "")' is not implemented.") completion(nil, nil) } } @@ -1017,7 +1023,8 @@ public class FLTFirebaseAuthPlugin: NSObject, FlutterPlugin, FLTFirebasePluginPr completion: @escaping (Result) -> Void ) { let auth = getFIRAuthFromPigeon(app) - if let actionCodeSettings, let settings = PigeonParser.parseActionCodeSettings(actionCodeSettings) + if let actionCodeSettings, + let settings = PigeonParser.parseActionCodeSettings(actionCodeSettings) { auth.sendPasswordReset(withEmail: email, actionCodeSettings: settings) { error in self.completeVoid(error, completion: completion) @@ -1083,7 +1090,8 @@ public class FLTFirebaseAuthPlugin: NSObject, FlutterPlugin, FLTFirebasePluginPr } #if os(iOS) if settings.appVerificationDisabledForTesting { - auth.settings?.isAppVerificationDisabledForTesting = settings.appVerificationDisabledForTesting + auth.settings?.isAppVerificationDisabledForTesting = + settings.appVerificationDisabledForTesting } #else print("FIRAuthSettings.appVerificationDisabledForTesting is not supported on MacOS.") diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FirebaseAuthMessages.g.swift b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FirebaseAuthMessages.g.swift index 823ea1a3bdfa..69ce5f6d9753 100644 --- a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FirebaseAuthMessages.g.swift +++ b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FirebaseAuthMessages.g.swift @@ -73,7 +73,7 @@ private func doubleEqualsFirebaseAuthMessages(_ lhs: Double, _ rhs: Double) -> B private func doubleHashFirebaseAuthMessages(_ value: Double, _ hasher: inout Hasher) { if value.isNaN { - hasher.combine(0x7FF8000000000000) + hasher.combine(0x7FF8_0000_0000_0000) } else { // Normalize -0.0 to 0.0 hasher.combine(value == 0 ? 0 : value) @@ -176,7 +176,6 @@ func deepHashFirebaseAuthMessages(value: Any?, hasher: inout Hasher) { } } - /// The type of operation that generated the action code from calling /// [checkActionCode]. enum ActionCodeInfoOperation: Int { @@ -200,7 +199,6 @@ enum ActionCodeInfoOperation: Int { struct InternalMultiFactorSession: Hashable { var id: String - // swift-format-ignore: AlwaysUseLowerCamelCase static func fromList(_ pigeonVar_list: [Any?]) -> InternalMultiFactorSession? { let id = pigeonVar_list[0] as! String @@ -232,7 +230,6 @@ struct InternalPhoneMultiFactorAssertion: Hashable { var verificationId: String var verificationCode: String - // swift-format-ignore: AlwaysUseLowerCamelCase static func fromList(_ pigeonVar_list: [Any?]) -> InternalPhoneMultiFactorAssertion? { let verificationId = pigeonVar_list[0] as! String @@ -249,11 +246,14 @@ struct InternalPhoneMultiFactorAssertion: Hashable { verificationCode, ] } - static func == (lhs: InternalPhoneMultiFactorAssertion, rhs: InternalPhoneMultiFactorAssertion) -> Bool { + static func == (lhs: InternalPhoneMultiFactorAssertion, rhs: InternalPhoneMultiFactorAssertion) + -> Bool + { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsFirebaseAuthMessages(lhs.verificationId, rhs.verificationId) && deepEqualsFirebaseAuthMessages(lhs.verificationCode, rhs.verificationCode) + return deepEqualsFirebaseAuthMessages(lhs.verificationId, rhs.verificationId) + && deepEqualsFirebaseAuthMessages(lhs.verificationCode, rhs.verificationCode) } func hash(into hasher: inout Hasher) { @@ -271,7 +271,6 @@ struct InternalMultiFactorInfo: Hashable { var uid: String var phoneNumber: String? = nil - // swift-format-ignore: AlwaysUseLowerCamelCase static func fromList(_ pigeonVar_list: [Any?]) -> InternalMultiFactorInfo? { let displayName: String? = nilOrValue(pigeonVar_list[0]) @@ -301,7 +300,11 @@ struct InternalMultiFactorInfo: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsFirebaseAuthMessages(lhs.displayName, rhs.displayName) && deepEqualsFirebaseAuthMessages(lhs.enrollmentTimestamp, rhs.enrollmentTimestamp) && deepEqualsFirebaseAuthMessages(lhs.factorId, rhs.factorId) && deepEqualsFirebaseAuthMessages(lhs.uid, rhs.uid) && deepEqualsFirebaseAuthMessages(lhs.phoneNumber, rhs.phoneNumber) + return deepEqualsFirebaseAuthMessages(lhs.displayName, rhs.displayName) + && deepEqualsFirebaseAuthMessages(lhs.enrollmentTimestamp, rhs.enrollmentTimestamp) + && deepEqualsFirebaseAuthMessages(lhs.factorId, rhs.factorId) + && deepEqualsFirebaseAuthMessages(lhs.uid, rhs.uid) + && deepEqualsFirebaseAuthMessages(lhs.phoneNumber, rhs.phoneNumber) } func hash(into hasher: inout Hasher) { @@ -320,7 +323,6 @@ struct AuthPigeonFirebaseApp: Hashable { var tenantId: String? = nil var customAuthDomain: String? = nil - // swift-format-ignore: AlwaysUseLowerCamelCase static func fromList(_ pigeonVar_list: [Any?]) -> AuthPigeonFirebaseApp? { let appName = pigeonVar_list[0] as! String @@ -344,7 +346,9 @@ struct AuthPigeonFirebaseApp: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsFirebaseAuthMessages(lhs.appName, rhs.appName) && deepEqualsFirebaseAuthMessages(lhs.tenantId, rhs.tenantId) && deepEqualsFirebaseAuthMessages(lhs.customAuthDomain, rhs.customAuthDomain) + return deepEqualsFirebaseAuthMessages(lhs.appName, rhs.appName) + && deepEqualsFirebaseAuthMessages(lhs.tenantId, rhs.tenantId) + && deepEqualsFirebaseAuthMessages(lhs.customAuthDomain, rhs.customAuthDomain) } func hash(into hasher: inout Hasher) { @@ -360,7 +364,6 @@ struct InternalActionCodeInfoData: Hashable { var email: String? = nil var previousEmail: String? = nil - // swift-format-ignore: AlwaysUseLowerCamelCase static func fromList(_ pigeonVar_list: [Any?]) -> InternalActionCodeInfoData? { let email: String? = nilOrValue(pigeonVar_list[0]) @@ -381,7 +384,8 @@ struct InternalActionCodeInfoData: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsFirebaseAuthMessages(lhs.email, rhs.email) && deepEqualsFirebaseAuthMessages(lhs.previousEmail, rhs.previousEmail) + return deepEqualsFirebaseAuthMessages(lhs.email, rhs.email) + && deepEqualsFirebaseAuthMessages(lhs.previousEmail, rhs.previousEmail) } func hash(into hasher: inout Hasher) { @@ -396,7 +400,6 @@ struct InternalActionCodeInfo: Hashable { var operation: ActionCodeInfoOperation var data: InternalActionCodeInfoData - // swift-format-ignore: AlwaysUseLowerCamelCase static func fromList(_ pigeonVar_list: [Any?]) -> InternalActionCodeInfo? { let operation = pigeonVar_list[0] as! ActionCodeInfoOperation @@ -417,7 +420,8 @@ struct InternalActionCodeInfo: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsFirebaseAuthMessages(lhs.operation, rhs.operation) && deepEqualsFirebaseAuthMessages(lhs.data, rhs.data) + return deepEqualsFirebaseAuthMessages(lhs.operation, rhs.operation) + && deepEqualsFirebaseAuthMessages(lhs.data, rhs.data) } func hash(into hasher: inout Hasher) { @@ -435,7 +439,6 @@ struct InternalAdditionalUserInfo: Hashable { var authorizationCode: String? = nil var profile: [String?: Any?]? = nil - // swift-format-ignore: AlwaysUseLowerCamelCase static func fromList(_ pigeonVar_list: [Any?]) -> InternalAdditionalUserInfo? { let isNewUser = pigeonVar_list[0] as! Bool @@ -465,7 +468,11 @@ struct InternalAdditionalUserInfo: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsFirebaseAuthMessages(lhs.isNewUser, rhs.isNewUser) && deepEqualsFirebaseAuthMessages(lhs.providerId, rhs.providerId) && deepEqualsFirebaseAuthMessages(lhs.username, rhs.username) && deepEqualsFirebaseAuthMessages(lhs.authorizationCode, rhs.authorizationCode) && deepEqualsFirebaseAuthMessages(lhs.profile, rhs.profile) + return deepEqualsFirebaseAuthMessages(lhs.isNewUser, rhs.isNewUser) + && deepEqualsFirebaseAuthMessages(lhs.providerId, rhs.providerId) + && deepEqualsFirebaseAuthMessages(lhs.username, rhs.username) + && deepEqualsFirebaseAuthMessages(lhs.authorizationCode, rhs.authorizationCode) + && deepEqualsFirebaseAuthMessages(lhs.profile, rhs.profile) } func hash(into hasher: inout Hasher) { @@ -485,7 +492,6 @@ struct InternalAuthCredential: Hashable { var nativeId: Int64 var accessToken: String? = nil - // swift-format-ignore: AlwaysUseLowerCamelCase static func fromList(_ pigeonVar_list: [Any?]) -> InternalAuthCredential? { let providerId = pigeonVar_list[0] as! String @@ -512,7 +518,10 @@ struct InternalAuthCredential: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsFirebaseAuthMessages(lhs.providerId, rhs.providerId) && deepEqualsFirebaseAuthMessages(lhs.signInMethod, rhs.signInMethod) && deepEqualsFirebaseAuthMessages(lhs.nativeId, rhs.nativeId) && deepEqualsFirebaseAuthMessages(lhs.accessToken, rhs.accessToken) + return deepEqualsFirebaseAuthMessages(lhs.providerId, rhs.providerId) + && deepEqualsFirebaseAuthMessages(lhs.signInMethod, rhs.signInMethod) + && deepEqualsFirebaseAuthMessages(lhs.nativeId, rhs.nativeId) + && deepEqualsFirebaseAuthMessages(lhs.accessToken, rhs.accessToken) } func hash(into hasher: inout Hasher) { @@ -539,7 +548,6 @@ struct InternalUserInfo: Hashable { var creationTimestamp: Int64? = nil var lastSignInTimestamp: Int64? = nil - // swift-format-ignore: AlwaysUseLowerCamelCase static func fromList(_ pigeonVar_list: [Any?]) -> InternalUserInfo? { let uid = pigeonVar_list[0] as! String @@ -590,7 +598,18 @@ struct InternalUserInfo: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsFirebaseAuthMessages(lhs.uid, rhs.uid) && deepEqualsFirebaseAuthMessages(lhs.email, rhs.email) && deepEqualsFirebaseAuthMessages(lhs.displayName, rhs.displayName) && deepEqualsFirebaseAuthMessages(lhs.photoUrl, rhs.photoUrl) && deepEqualsFirebaseAuthMessages(lhs.phoneNumber, rhs.phoneNumber) && deepEqualsFirebaseAuthMessages(lhs.isAnonymous, rhs.isAnonymous) && deepEqualsFirebaseAuthMessages(lhs.isEmailVerified, rhs.isEmailVerified) && deepEqualsFirebaseAuthMessages(lhs.providerId, rhs.providerId) && deepEqualsFirebaseAuthMessages(lhs.tenantId, rhs.tenantId) && deepEqualsFirebaseAuthMessages(lhs.refreshToken, rhs.refreshToken) && deepEqualsFirebaseAuthMessages(lhs.creationTimestamp, rhs.creationTimestamp) && deepEqualsFirebaseAuthMessages(lhs.lastSignInTimestamp, rhs.lastSignInTimestamp) + return deepEqualsFirebaseAuthMessages(lhs.uid, rhs.uid) + && deepEqualsFirebaseAuthMessages(lhs.email, rhs.email) + && deepEqualsFirebaseAuthMessages(lhs.displayName, rhs.displayName) + && deepEqualsFirebaseAuthMessages(lhs.photoUrl, rhs.photoUrl) + && deepEqualsFirebaseAuthMessages(lhs.phoneNumber, rhs.phoneNumber) + && deepEqualsFirebaseAuthMessages(lhs.isAnonymous, rhs.isAnonymous) + && deepEqualsFirebaseAuthMessages(lhs.isEmailVerified, rhs.isEmailVerified) + && deepEqualsFirebaseAuthMessages(lhs.providerId, rhs.providerId) + && deepEqualsFirebaseAuthMessages(lhs.tenantId, rhs.tenantId) + && deepEqualsFirebaseAuthMessages(lhs.refreshToken, rhs.refreshToken) + && deepEqualsFirebaseAuthMessages(lhs.creationTimestamp, rhs.creationTimestamp) + && deepEqualsFirebaseAuthMessages(lhs.lastSignInTimestamp, rhs.lastSignInTimestamp) } func hash(into hasher: inout Hasher) { @@ -615,7 +634,6 @@ struct InternalUserDetails: Hashable { var userInfo: InternalUserInfo var providerData: [[AnyHashable?: Any?]?] - // swift-format-ignore: AlwaysUseLowerCamelCase static func fromList(_ pigeonVar_list: [Any?]) -> InternalUserDetails? { let userInfo = pigeonVar_list[0] as! InternalUserInfo @@ -636,7 +654,8 @@ struct InternalUserDetails: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsFirebaseAuthMessages(lhs.userInfo, rhs.userInfo) && deepEqualsFirebaseAuthMessages(lhs.providerData, rhs.providerData) + return deepEqualsFirebaseAuthMessages(lhs.userInfo, rhs.userInfo) + && deepEqualsFirebaseAuthMessages(lhs.providerData, rhs.providerData) } func hash(into hasher: inout Hasher) { @@ -652,7 +671,6 @@ struct InternalUserCredential: Hashable { var additionalUserInfo: InternalAdditionalUserInfo? = nil var credential: InternalAuthCredential? = nil - // swift-format-ignore: AlwaysUseLowerCamelCase static func fromList(_ pigeonVar_list: [Any?]) -> InternalUserCredential? { let user: InternalUserDetails? = nilOrValue(pigeonVar_list[0]) @@ -676,7 +694,9 @@ struct InternalUserCredential: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsFirebaseAuthMessages(lhs.user, rhs.user) && deepEqualsFirebaseAuthMessages(lhs.additionalUserInfo, rhs.additionalUserInfo) && deepEqualsFirebaseAuthMessages(lhs.credential, rhs.credential) + return deepEqualsFirebaseAuthMessages(lhs.user, rhs.user) + && deepEqualsFirebaseAuthMessages(lhs.additionalUserInfo, rhs.additionalUserInfo) + && deepEqualsFirebaseAuthMessages(lhs.credential, rhs.credential) } func hash(into hasher: inout Hasher) { @@ -694,7 +714,6 @@ struct InternalAuthCredentialInput: Hashable { var token: String? = nil var accessToken: String? = nil - // swift-format-ignore: AlwaysUseLowerCamelCase static func fromList(_ pigeonVar_list: [Any?]) -> InternalAuthCredentialInput? { let providerId = pigeonVar_list[0] as! String @@ -721,7 +740,10 @@ struct InternalAuthCredentialInput: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsFirebaseAuthMessages(lhs.providerId, rhs.providerId) && deepEqualsFirebaseAuthMessages(lhs.signInMethod, rhs.signInMethod) && deepEqualsFirebaseAuthMessages(lhs.token, rhs.token) && deepEqualsFirebaseAuthMessages(lhs.accessToken, rhs.accessToken) + return deepEqualsFirebaseAuthMessages(lhs.providerId, rhs.providerId) + && deepEqualsFirebaseAuthMessages(lhs.signInMethod, rhs.signInMethod) + && deepEqualsFirebaseAuthMessages(lhs.token, rhs.token) + && deepEqualsFirebaseAuthMessages(lhs.accessToken, rhs.accessToken) } func hash(into hasher: inout Hasher) { @@ -744,7 +766,6 @@ struct InternalActionCodeSettings: Hashable { var androidMinimumVersion: String? = nil var linkDomain: String? = nil - // swift-format-ignore: AlwaysUseLowerCamelCase static func fromList(_ pigeonVar_list: [Any?]) -> InternalActionCodeSettings? { let url = pigeonVar_list[0] as! String @@ -783,7 +804,14 @@ struct InternalActionCodeSettings: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsFirebaseAuthMessages(lhs.url, rhs.url) && deepEqualsFirebaseAuthMessages(lhs.dynamicLinkDomain, rhs.dynamicLinkDomain) && deepEqualsFirebaseAuthMessages(lhs.handleCodeInApp, rhs.handleCodeInApp) && deepEqualsFirebaseAuthMessages(lhs.iOSBundleId, rhs.iOSBundleId) && deepEqualsFirebaseAuthMessages(lhs.androidPackageName, rhs.androidPackageName) && deepEqualsFirebaseAuthMessages(lhs.androidInstallApp, rhs.androidInstallApp) && deepEqualsFirebaseAuthMessages(lhs.androidMinimumVersion, rhs.androidMinimumVersion) && deepEqualsFirebaseAuthMessages(lhs.linkDomain, rhs.linkDomain) + return deepEqualsFirebaseAuthMessages(lhs.url, rhs.url) + && deepEqualsFirebaseAuthMessages(lhs.dynamicLinkDomain, rhs.dynamicLinkDomain) + && deepEqualsFirebaseAuthMessages(lhs.handleCodeInApp, rhs.handleCodeInApp) + && deepEqualsFirebaseAuthMessages(lhs.iOSBundleId, rhs.iOSBundleId) + && deepEqualsFirebaseAuthMessages(lhs.androidPackageName, rhs.androidPackageName) + && deepEqualsFirebaseAuthMessages(lhs.androidInstallApp, rhs.androidInstallApp) + && deepEqualsFirebaseAuthMessages(lhs.androidMinimumVersion, rhs.androidMinimumVersion) + && deepEqualsFirebaseAuthMessages(lhs.linkDomain, rhs.linkDomain) } func hash(into hasher: inout Hasher) { @@ -807,7 +835,6 @@ struct InternalFirebaseAuthSettings: Hashable { var smsCode: String? = nil var forceRecaptchaFlow: Bool? = nil - // swift-format-ignore: AlwaysUseLowerCamelCase static func fromList(_ pigeonVar_list: [Any?]) -> InternalFirebaseAuthSettings? { let appVerificationDisabledForTesting = pigeonVar_list[0] as! Bool @@ -837,7 +864,12 @@ struct InternalFirebaseAuthSettings: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsFirebaseAuthMessages(lhs.appVerificationDisabledForTesting, rhs.appVerificationDisabledForTesting) && deepEqualsFirebaseAuthMessages(lhs.userAccessGroup, rhs.userAccessGroup) && deepEqualsFirebaseAuthMessages(lhs.phoneNumber, rhs.phoneNumber) && deepEqualsFirebaseAuthMessages(lhs.smsCode, rhs.smsCode) && deepEqualsFirebaseAuthMessages(lhs.forceRecaptchaFlow, rhs.forceRecaptchaFlow) + return deepEqualsFirebaseAuthMessages( + lhs.appVerificationDisabledForTesting, rhs.appVerificationDisabledForTesting) + && deepEqualsFirebaseAuthMessages(lhs.userAccessGroup, rhs.userAccessGroup) + && deepEqualsFirebaseAuthMessages(lhs.phoneNumber, rhs.phoneNumber) + && deepEqualsFirebaseAuthMessages(lhs.smsCode, rhs.smsCode) + && deepEqualsFirebaseAuthMessages(lhs.forceRecaptchaFlow, rhs.forceRecaptchaFlow) } func hash(into hasher: inout Hasher) { @@ -856,7 +888,6 @@ struct InternalSignInProvider: Hashable { var scopes: [String?]? = nil var customParameters: [String?: String?]? = nil - // swift-format-ignore: AlwaysUseLowerCamelCase static func fromList(_ pigeonVar_list: [Any?]) -> InternalSignInProvider? { let providerId = pigeonVar_list[0] as! String @@ -880,7 +911,9 @@ struct InternalSignInProvider: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsFirebaseAuthMessages(lhs.providerId, rhs.providerId) && deepEqualsFirebaseAuthMessages(lhs.scopes, rhs.scopes) && deepEqualsFirebaseAuthMessages(lhs.customParameters, rhs.customParameters) + return deepEqualsFirebaseAuthMessages(lhs.providerId, rhs.providerId) + && deepEqualsFirebaseAuthMessages(lhs.scopes, rhs.scopes) + && deepEqualsFirebaseAuthMessages(lhs.customParameters, rhs.customParameters) } func hash(into hasher: inout Hasher) { @@ -900,7 +933,6 @@ struct InternalVerifyPhoneNumberRequest: Hashable { var multiFactorInfoId: String? = nil var multiFactorSessionId: String? = nil - // swift-format-ignore: AlwaysUseLowerCamelCase static func fromList(_ pigeonVar_list: [Any?]) -> InternalVerifyPhoneNumberRequest? { let phoneNumber: String? = nilOrValue(pigeonVar_list[0]) @@ -929,11 +961,19 @@ struct InternalVerifyPhoneNumberRequest: Hashable { multiFactorSessionId, ] } - static func == (lhs: InternalVerifyPhoneNumberRequest, rhs: InternalVerifyPhoneNumberRequest) -> Bool { + static func == (lhs: InternalVerifyPhoneNumberRequest, rhs: InternalVerifyPhoneNumberRequest) + -> Bool + { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsFirebaseAuthMessages(lhs.phoneNumber, rhs.phoneNumber) && deepEqualsFirebaseAuthMessages(lhs.timeout, rhs.timeout) && deepEqualsFirebaseAuthMessages(lhs.forceResendingToken, rhs.forceResendingToken) && deepEqualsFirebaseAuthMessages(lhs.autoRetrievedSmsCodeForTesting, rhs.autoRetrievedSmsCodeForTesting) && deepEqualsFirebaseAuthMessages(lhs.multiFactorInfoId, rhs.multiFactorInfoId) && deepEqualsFirebaseAuthMessages(lhs.multiFactorSessionId, rhs.multiFactorSessionId) + return deepEqualsFirebaseAuthMessages(lhs.phoneNumber, rhs.phoneNumber) + && deepEqualsFirebaseAuthMessages(lhs.timeout, rhs.timeout) + && deepEqualsFirebaseAuthMessages(lhs.forceResendingToken, rhs.forceResendingToken) + && deepEqualsFirebaseAuthMessages( + lhs.autoRetrievedSmsCodeForTesting, rhs.autoRetrievedSmsCodeForTesting) + && deepEqualsFirebaseAuthMessages(lhs.multiFactorInfoId, rhs.multiFactorInfoId) + && deepEqualsFirebaseAuthMessages(lhs.multiFactorSessionId, rhs.multiFactorSessionId) } func hash(into hasher: inout Hasher) { @@ -957,7 +997,6 @@ struct InternalIdTokenResult: Hashable { var claims: [String?: Any?]? = nil var signInSecondFactor: String? = nil - // swift-format-ignore: AlwaysUseLowerCamelCase static func fromList(_ pigeonVar_list: [Any?]) -> InternalIdTokenResult? { let token: String? = nilOrValue(pigeonVar_list[0]) @@ -993,7 +1032,13 @@ struct InternalIdTokenResult: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsFirebaseAuthMessages(lhs.token, rhs.token) && deepEqualsFirebaseAuthMessages(lhs.expirationTimestamp, rhs.expirationTimestamp) && deepEqualsFirebaseAuthMessages(lhs.authTimestamp, rhs.authTimestamp) && deepEqualsFirebaseAuthMessages(lhs.issuedAtTimestamp, rhs.issuedAtTimestamp) && deepEqualsFirebaseAuthMessages(lhs.signInProvider, rhs.signInProvider) && deepEqualsFirebaseAuthMessages(lhs.claims, rhs.claims) && deepEqualsFirebaseAuthMessages(lhs.signInSecondFactor, rhs.signInSecondFactor) + return deepEqualsFirebaseAuthMessages(lhs.token, rhs.token) + && deepEqualsFirebaseAuthMessages(lhs.expirationTimestamp, rhs.expirationTimestamp) + && deepEqualsFirebaseAuthMessages(lhs.authTimestamp, rhs.authTimestamp) + && deepEqualsFirebaseAuthMessages(lhs.issuedAtTimestamp, rhs.issuedAtTimestamp) + && deepEqualsFirebaseAuthMessages(lhs.signInProvider, rhs.signInProvider) + && deepEqualsFirebaseAuthMessages(lhs.claims, rhs.claims) + && deepEqualsFirebaseAuthMessages(lhs.signInSecondFactor, rhs.signInSecondFactor) } func hash(into hasher: inout Hasher) { @@ -1015,7 +1060,6 @@ struct InternalUserProfile: Hashable { var displayNameChanged: Bool var photoUrlChanged: Bool - // swift-format-ignore: AlwaysUseLowerCamelCase static func fromList(_ pigeonVar_list: [Any?]) -> InternalUserProfile? { let displayName: String? = nilOrValue(pigeonVar_list[0]) @@ -1042,7 +1086,10 @@ struct InternalUserProfile: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsFirebaseAuthMessages(lhs.displayName, rhs.displayName) && deepEqualsFirebaseAuthMessages(lhs.photoUrl, rhs.photoUrl) && deepEqualsFirebaseAuthMessages(lhs.displayNameChanged, rhs.displayNameChanged) && deepEqualsFirebaseAuthMessages(lhs.photoUrlChanged, rhs.photoUrlChanged) + return deepEqualsFirebaseAuthMessages(lhs.displayName, rhs.displayName) + && deepEqualsFirebaseAuthMessages(lhs.photoUrl, rhs.photoUrl) + && deepEqualsFirebaseAuthMessages(lhs.displayNameChanged, rhs.displayNameChanged) + && deepEqualsFirebaseAuthMessages(lhs.photoUrlChanged, rhs.photoUrlChanged) } func hash(into hasher: inout Hasher) { @@ -1062,7 +1109,6 @@ struct InternalTotpSecret: Hashable { var hashingAlgorithm: String? = nil var secretKey: String - // swift-format-ignore: AlwaysUseLowerCamelCase static func fromList(_ pigeonVar_list: [Any?]) -> InternalTotpSecret? { let codeIntervalSeconds: Int64? = nilOrValue(pigeonVar_list[0]) @@ -1092,7 +1138,12 @@ struct InternalTotpSecret: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsFirebaseAuthMessages(lhs.codeIntervalSeconds, rhs.codeIntervalSeconds) && deepEqualsFirebaseAuthMessages(lhs.codeLength, rhs.codeLength) && deepEqualsFirebaseAuthMessages(lhs.enrollmentCompletionDeadline, rhs.enrollmentCompletionDeadline) && deepEqualsFirebaseAuthMessages(lhs.hashingAlgorithm, rhs.hashingAlgorithm) && deepEqualsFirebaseAuthMessages(lhs.secretKey, rhs.secretKey) + return deepEqualsFirebaseAuthMessages(lhs.codeIntervalSeconds, rhs.codeIntervalSeconds) + && deepEqualsFirebaseAuthMessages(lhs.codeLength, rhs.codeLength) + && deepEqualsFirebaseAuthMessages( + lhs.enrollmentCompletionDeadline, rhs.enrollmentCompletionDeadline) + && deepEqualsFirebaseAuthMessages(lhs.hashingAlgorithm, rhs.hashingAlgorithm) + && deepEqualsFirebaseAuthMessages(lhs.secretKey, rhs.secretKey) } func hash(into hasher: inout Hasher) { @@ -1237,45 +1288,92 @@ private class FirebaseAuthMessagesPigeonCodecReaderWriter: FlutterStandardReader } class FirebaseAuthMessagesPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { - static let shared = FirebaseAuthMessagesPigeonCodec(readerWriter: FirebaseAuthMessagesPigeonCodecReaderWriter()) + static let shared = FirebaseAuthMessagesPigeonCodec( + readerWriter: FirebaseAuthMessagesPigeonCodecReaderWriter()) } - /// Generated protocol from Pigeon that represents a handler of messages from Flutter. protocol FirebaseAuthHostApi { - func registerIdTokenListener(app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void) - func registerAuthStateListener(app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void) - func useEmulator(app: AuthPigeonFirebaseApp, host: String, port: Int64, completion: @escaping (Result) -> Void) - func applyActionCode(app: AuthPigeonFirebaseApp, code: String, completion: @escaping (Result) -> Void) - func checkActionCode(app: AuthPigeonFirebaseApp, code: String, completion: @escaping (Result) -> Void) - func confirmPasswordReset(app: AuthPigeonFirebaseApp, code: String, newPassword: String, completion: @escaping (Result) -> Void) - func createUserWithEmailAndPassword(app: AuthPigeonFirebaseApp, email: String, password: String, completion: @escaping (Result) -> Void) - func signInAnonymously(app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void) - func signInWithCredential(app: AuthPigeonFirebaseApp, input: [String?: Any?], completion: @escaping (Result) -> Void) - func signInWithCustomToken(app: AuthPigeonFirebaseApp, token: String, completion: @escaping (Result) -> Void) - func signInWithEmailAndPassword(app: AuthPigeonFirebaseApp, email: String, password: String, completion: @escaping (Result) -> Void) - func signInWithEmailLink(app: AuthPigeonFirebaseApp, email: String, emailLink: String, completion: @escaping (Result) -> Void) - func signInWithProvider(app: AuthPigeonFirebaseApp, signInProvider: InternalSignInProvider, completion: @escaping (Result) -> Void) + func registerIdTokenListener( + app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void) + func registerAuthStateListener( + app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void) + func useEmulator( + app: AuthPigeonFirebaseApp, host: String, port: Int64, + completion: @escaping (Result) -> Void) + func applyActionCode( + app: AuthPigeonFirebaseApp, code: String, completion: @escaping (Result) -> Void) + func checkActionCode( + app: AuthPigeonFirebaseApp, code: String, + completion: @escaping (Result) -> Void) + func confirmPasswordReset( + app: AuthPigeonFirebaseApp, code: String, newPassword: String, + completion: @escaping (Result) -> Void) + func createUserWithEmailAndPassword( + app: AuthPigeonFirebaseApp, email: String, password: String, + completion: @escaping (Result) -> Void) + func signInAnonymously( + app: AuthPigeonFirebaseApp, + completion: @escaping (Result) -> Void) + func signInWithCredential( + app: AuthPigeonFirebaseApp, input: [String?: Any?], + completion: @escaping (Result) -> Void) + func signInWithCustomToken( + app: AuthPigeonFirebaseApp, token: String, + completion: @escaping (Result) -> Void) + func signInWithEmailAndPassword( + app: AuthPigeonFirebaseApp, email: String, password: String, + completion: @escaping (Result) -> Void) + func signInWithEmailLink( + app: AuthPigeonFirebaseApp, email: String, emailLink: String, + completion: @escaping (Result) -> Void) + func signInWithProvider( + app: AuthPigeonFirebaseApp, signInProvider: InternalSignInProvider, + completion: @escaping (Result) -> Void) func signOut(app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void) - func fetchSignInMethodsForEmail(app: AuthPigeonFirebaseApp, email: String, completion: @escaping (Result<[String], Error>) -> Void) - func sendPasswordResetEmail(app: AuthPigeonFirebaseApp, email: String, actionCodeSettings: InternalActionCodeSettings?, completion: @escaping (Result) -> Void) - func sendSignInLinkToEmail(app: AuthPigeonFirebaseApp, email: String, actionCodeSettings: InternalActionCodeSettings, completion: @escaping (Result) -> Void) - func setLanguageCode(app: AuthPigeonFirebaseApp, languageCode: String?, completion: @escaping (Result) -> Void) - func setSettings(app: AuthPigeonFirebaseApp, settings: InternalFirebaseAuthSettings, completion: @escaping (Result) -> Void) - func verifyPasswordResetCode(app: AuthPigeonFirebaseApp, code: String, completion: @escaping (Result) -> Void) - func verifyPhoneNumber(app: AuthPigeonFirebaseApp, request: InternalVerifyPhoneNumberRequest, completion: @escaping (Result) -> Void) - func revokeTokenWithAuthorizationCode(app: AuthPigeonFirebaseApp, authorizationCode: String, completion: @escaping (Result) -> Void) - func revokeAccessToken(app: AuthPigeonFirebaseApp, accessToken: String, completion: @escaping (Result) -> Void) - func initializeRecaptchaConfig(app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void) + func fetchSignInMethodsForEmail( + app: AuthPigeonFirebaseApp, email: String, + completion: @escaping (Result<[String], Error>) -> Void) + func sendPasswordResetEmail( + app: AuthPigeonFirebaseApp, email: String, actionCodeSettings: InternalActionCodeSettings?, + completion: @escaping (Result) -> Void) + func sendSignInLinkToEmail( + app: AuthPigeonFirebaseApp, email: String, actionCodeSettings: InternalActionCodeSettings, + completion: @escaping (Result) -> Void) + func setLanguageCode( + app: AuthPigeonFirebaseApp, languageCode: String?, + completion: @escaping (Result) -> Void) + func setSettings( + app: AuthPigeonFirebaseApp, settings: InternalFirebaseAuthSettings, + completion: @escaping (Result) -> Void) + func verifyPasswordResetCode( + app: AuthPigeonFirebaseApp, code: String, completion: @escaping (Result) -> Void) + func verifyPhoneNumber( + app: AuthPigeonFirebaseApp, request: InternalVerifyPhoneNumberRequest, + completion: @escaping (Result) -> Void) + func revokeTokenWithAuthorizationCode( + app: AuthPigeonFirebaseApp, authorizationCode: String, + completion: @escaping (Result) -> Void) + func revokeAccessToken( + app: AuthPigeonFirebaseApp, accessToken: String, + completion: @escaping (Result) -> Void) + func initializeRecaptchaConfig( + app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void) } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class FirebaseAuthHostApiSetup { static var codec: FlutterStandardMessageCodec { FirebaseAuthMessagesPigeonCodec.shared } /// Sets up an instance of `FirebaseAuthHostApi` to handle messages through the `binaryMessenger`. - static func setUp(binaryMessenger: FlutterBinaryMessenger, api: FirebaseAuthHostApi?, messageChannelSuffix: String = "") { + static func setUp( + binaryMessenger: FlutterBinaryMessenger, api: FirebaseAuthHostApi?, + messageChannelSuffix: String = "" + ) { let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" - let registerIdTokenListenerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.registerIdTokenListener\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let registerIdTokenListenerChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.registerIdTokenListener\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { registerIdTokenListenerChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1292,7 +1390,10 @@ class FirebaseAuthHostApiSetup { } else { registerIdTokenListenerChannel.setMessageHandler(nil) } - let registerAuthStateListenerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.registerAuthStateListener\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let registerAuthStateListenerChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.registerAuthStateListener\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { registerAuthStateListenerChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1309,7 +1410,10 @@ class FirebaseAuthHostApiSetup { } else { registerAuthStateListenerChannel.setMessageHandler(nil) } - let useEmulatorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.useEmulator\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let useEmulatorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.useEmulator\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { useEmulatorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1328,7 +1432,10 @@ class FirebaseAuthHostApiSetup { } else { useEmulatorChannel.setMessageHandler(nil) } - let applyActionCodeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.applyActionCode\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let applyActionCodeChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.applyActionCode\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { applyActionCodeChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1346,7 +1453,10 @@ class FirebaseAuthHostApiSetup { } else { applyActionCodeChannel.setMessageHandler(nil) } - let checkActionCodeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.checkActionCode\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let checkActionCodeChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.checkActionCode\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { checkActionCodeChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1364,14 +1474,18 @@ class FirebaseAuthHostApiSetup { } else { checkActionCodeChannel.setMessageHandler(nil) } - let confirmPasswordResetChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.confirmPasswordReset\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let confirmPasswordResetChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.confirmPasswordReset\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { confirmPasswordResetChannel.setMessageHandler { message, reply in let args = message as! [Any?] let appArg = args[0] as! AuthPigeonFirebaseApp let codeArg = args[1] as! String let newPasswordArg = args[2] as! String - api.confirmPasswordReset(app: appArg, code: codeArg, newPassword: newPasswordArg) { result in + api.confirmPasswordReset(app: appArg, code: codeArg, newPassword: newPasswordArg) { + result in switch result { case .success: reply(wrapResult(nil)) @@ -1383,14 +1497,18 @@ class FirebaseAuthHostApiSetup { } else { confirmPasswordResetChannel.setMessageHandler(nil) } - let createUserWithEmailAndPasswordChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.createUserWithEmailAndPassword\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let createUserWithEmailAndPasswordChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.createUserWithEmailAndPassword\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { createUserWithEmailAndPasswordChannel.setMessageHandler { message, reply in let args = message as! [Any?] let appArg = args[0] as! AuthPigeonFirebaseApp let emailArg = args[1] as! String let passwordArg = args[2] as! String - api.createUserWithEmailAndPassword(app: appArg, email: emailArg, password: passwordArg) { result in + api.createUserWithEmailAndPassword(app: appArg, email: emailArg, password: passwordArg) { + result in switch result { case .success(let res): reply(wrapResult(res)) @@ -1402,7 +1520,10 @@ class FirebaseAuthHostApiSetup { } else { createUserWithEmailAndPasswordChannel.setMessageHandler(nil) } - let signInAnonymouslyChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInAnonymously\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let signInAnonymouslyChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInAnonymously\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { signInAnonymouslyChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1419,7 +1540,10 @@ class FirebaseAuthHostApiSetup { } else { signInAnonymouslyChannel.setMessageHandler(nil) } - let signInWithCredentialChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithCredential\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let signInWithCredentialChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithCredential\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { signInWithCredentialChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1437,7 +1561,10 @@ class FirebaseAuthHostApiSetup { } else { signInWithCredentialChannel.setMessageHandler(nil) } - let signInWithCustomTokenChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithCustomToken\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let signInWithCustomTokenChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithCustomToken\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { signInWithCustomTokenChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1455,14 +1582,18 @@ class FirebaseAuthHostApiSetup { } else { signInWithCustomTokenChannel.setMessageHandler(nil) } - let signInWithEmailAndPasswordChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithEmailAndPassword\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let signInWithEmailAndPasswordChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithEmailAndPassword\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { signInWithEmailAndPasswordChannel.setMessageHandler { message, reply in let args = message as! [Any?] let appArg = args[0] as! AuthPigeonFirebaseApp let emailArg = args[1] as! String let passwordArg = args[2] as! String - api.signInWithEmailAndPassword(app: appArg, email: emailArg, password: passwordArg) { result in + api.signInWithEmailAndPassword(app: appArg, email: emailArg, password: passwordArg) { + result in switch result { case .success(let res): reply(wrapResult(res)) @@ -1474,7 +1605,10 @@ class FirebaseAuthHostApiSetup { } else { signInWithEmailAndPasswordChannel.setMessageHandler(nil) } - let signInWithEmailLinkChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithEmailLink\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let signInWithEmailLinkChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithEmailLink\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { signInWithEmailLinkChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1493,7 +1627,10 @@ class FirebaseAuthHostApiSetup { } else { signInWithEmailLinkChannel.setMessageHandler(nil) } - let signInWithProviderChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithProvider\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let signInWithProviderChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithProvider\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { signInWithProviderChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1511,7 +1648,10 @@ class FirebaseAuthHostApiSetup { } else { signInWithProviderChannel.setMessageHandler(nil) } - let signOutChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signOut\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let signOutChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signOut\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { signOutChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1528,7 +1668,10 @@ class FirebaseAuthHostApiSetup { } else { signOutChannel.setMessageHandler(nil) } - let fetchSignInMethodsForEmailChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.fetchSignInMethodsForEmail\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let fetchSignInMethodsForEmailChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.fetchSignInMethodsForEmail\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { fetchSignInMethodsForEmailChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1546,14 +1689,19 @@ class FirebaseAuthHostApiSetup { } else { fetchSignInMethodsForEmailChannel.setMessageHandler(nil) } - let sendPasswordResetEmailChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.sendPasswordResetEmail\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let sendPasswordResetEmailChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.sendPasswordResetEmail\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { sendPasswordResetEmailChannel.setMessageHandler { message, reply in let args = message as! [Any?] let appArg = args[0] as! AuthPigeonFirebaseApp let emailArg = args[1] as! String let actionCodeSettingsArg: InternalActionCodeSettings? = nilOrValue(args[2]) - api.sendPasswordResetEmail(app: appArg, email: emailArg, actionCodeSettings: actionCodeSettingsArg) { result in + api.sendPasswordResetEmail( + app: appArg, email: emailArg, actionCodeSettings: actionCodeSettingsArg + ) { result in switch result { case .success: reply(wrapResult(nil)) @@ -1565,14 +1713,19 @@ class FirebaseAuthHostApiSetup { } else { sendPasswordResetEmailChannel.setMessageHandler(nil) } - let sendSignInLinkToEmailChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.sendSignInLinkToEmail\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let sendSignInLinkToEmailChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.sendSignInLinkToEmail\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { sendSignInLinkToEmailChannel.setMessageHandler { message, reply in let args = message as! [Any?] let appArg = args[0] as! AuthPigeonFirebaseApp let emailArg = args[1] as! String let actionCodeSettingsArg = args[2] as! InternalActionCodeSettings - api.sendSignInLinkToEmail(app: appArg, email: emailArg, actionCodeSettings: actionCodeSettingsArg) { result in + api.sendSignInLinkToEmail( + app: appArg, email: emailArg, actionCodeSettings: actionCodeSettingsArg + ) { result in switch result { case .success: reply(wrapResult(nil)) @@ -1584,7 +1737,10 @@ class FirebaseAuthHostApiSetup { } else { sendSignInLinkToEmailChannel.setMessageHandler(nil) } - let setLanguageCodeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.setLanguageCode\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let setLanguageCodeChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.setLanguageCode\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setLanguageCodeChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1602,7 +1758,10 @@ class FirebaseAuthHostApiSetup { } else { setLanguageCodeChannel.setMessageHandler(nil) } - let setSettingsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.setSettings\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let setSettingsChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.setSettings\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setSettingsChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1620,7 +1779,10 @@ class FirebaseAuthHostApiSetup { } else { setSettingsChannel.setMessageHandler(nil) } - let verifyPasswordResetCodeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.verifyPasswordResetCode\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let verifyPasswordResetCodeChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.verifyPasswordResetCode\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { verifyPasswordResetCodeChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1638,7 +1800,10 @@ class FirebaseAuthHostApiSetup { } else { verifyPasswordResetCodeChannel.setMessageHandler(nil) } - let verifyPhoneNumberChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.verifyPhoneNumber\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let verifyPhoneNumberChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.verifyPhoneNumber\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { verifyPhoneNumberChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1656,13 +1821,17 @@ class FirebaseAuthHostApiSetup { } else { verifyPhoneNumberChannel.setMessageHandler(nil) } - let revokeTokenWithAuthorizationCodeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.revokeTokenWithAuthorizationCode\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let revokeTokenWithAuthorizationCodeChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.revokeTokenWithAuthorizationCode\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { revokeTokenWithAuthorizationCodeChannel.setMessageHandler { message, reply in let args = message as! [Any?] let appArg = args[0] as! AuthPigeonFirebaseApp let authorizationCodeArg = args[1] as! String - api.revokeTokenWithAuthorizationCode(app: appArg, authorizationCode: authorizationCodeArg) { result in + api.revokeTokenWithAuthorizationCode(app: appArg, authorizationCode: authorizationCodeArg) { + result in switch result { case .success: reply(wrapResult(nil)) @@ -1674,7 +1843,10 @@ class FirebaseAuthHostApiSetup { } else { revokeTokenWithAuthorizationCodeChannel.setMessageHandler(nil) } - let revokeAccessTokenChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.revokeAccessToken\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let revokeAccessTokenChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.revokeAccessToken\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { revokeAccessTokenChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1692,7 +1864,10 @@ class FirebaseAuthHostApiSetup { } else { revokeAccessTokenChannel.setMessageHandler(nil) } - let initializeRecaptchaConfigChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.initializeRecaptchaConfig\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let initializeRecaptchaConfigChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.initializeRecaptchaConfig\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { initializeRecaptchaConfigChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1714,28 +1889,59 @@ class FirebaseAuthHostApiSetup { /// Generated protocol from Pigeon that represents a handler of messages from Flutter. protocol FirebaseAuthUserHostApi { func delete(app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void) - func getIdToken(app: AuthPigeonFirebaseApp, forceRefresh: Bool, completion: @escaping (Result) -> Void) - func linkWithCredential(app: AuthPigeonFirebaseApp, input: [String?: Any?], completion: @escaping (Result) -> Void) - func linkWithProvider(app: AuthPigeonFirebaseApp, signInProvider: InternalSignInProvider, completion: @escaping (Result) -> Void) - func reauthenticateWithCredential(app: AuthPigeonFirebaseApp, input: [String?: Any?], completion: @escaping (Result) -> Void) - func reauthenticateWithProvider(app: AuthPigeonFirebaseApp, signInProvider: InternalSignInProvider, completion: @escaping (Result) -> Void) - func reload(app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void) - func sendEmailVerification(app: AuthPigeonFirebaseApp, actionCodeSettings: InternalActionCodeSettings?, completion: @escaping (Result) -> Void) - func unlink(app: AuthPigeonFirebaseApp, providerId: String, completion: @escaping (Result) -> Void) - func updateEmail(app: AuthPigeonFirebaseApp, newEmail: String, completion: @escaping (Result) -> Void) - func updatePassword(app: AuthPigeonFirebaseApp, newPassword: String, completion: @escaping (Result) -> Void) - func updatePhoneNumber(app: AuthPigeonFirebaseApp, input: [String?: Any?], completion: @escaping (Result) -> Void) - func updateProfile(app: AuthPigeonFirebaseApp, profile: InternalUserProfile, completion: @escaping (Result) -> Void) - func verifyBeforeUpdateEmail(app: AuthPigeonFirebaseApp, newEmail: String, actionCodeSettings: InternalActionCodeSettings?, completion: @escaping (Result) -> Void) + func getIdToken( + app: AuthPigeonFirebaseApp, forceRefresh: Bool, + completion: @escaping (Result) -> Void) + func linkWithCredential( + app: AuthPigeonFirebaseApp, input: [String?: Any?], + completion: @escaping (Result) -> Void) + func linkWithProvider( + app: AuthPigeonFirebaseApp, signInProvider: InternalSignInProvider, + completion: @escaping (Result) -> Void) + func reauthenticateWithCredential( + app: AuthPigeonFirebaseApp, input: [String?: Any?], + completion: @escaping (Result) -> Void) + func reauthenticateWithProvider( + app: AuthPigeonFirebaseApp, signInProvider: InternalSignInProvider, + completion: @escaping (Result) -> Void) + func reload( + app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void) + func sendEmailVerification( + app: AuthPigeonFirebaseApp, actionCodeSettings: InternalActionCodeSettings?, + completion: @escaping (Result) -> Void) + func unlink( + app: AuthPigeonFirebaseApp, providerId: String, + completion: @escaping (Result) -> Void) + func updateEmail( + app: AuthPigeonFirebaseApp, newEmail: String, + completion: @escaping (Result) -> Void) + func updatePassword( + app: AuthPigeonFirebaseApp, newPassword: String, + completion: @escaping (Result) -> Void) + func updatePhoneNumber( + app: AuthPigeonFirebaseApp, input: [String?: Any?], + completion: @escaping (Result) -> Void) + func updateProfile( + app: AuthPigeonFirebaseApp, profile: InternalUserProfile, + completion: @escaping (Result) -> Void) + func verifyBeforeUpdateEmail( + app: AuthPigeonFirebaseApp, newEmail: String, actionCodeSettings: InternalActionCodeSettings?, + completion: @escaping (Result) -> Void) } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class FirebaseAuthUserHostApiSetup { static var codec: FlutterStandardMessageCodec { FirebaseAuthMessagesPigeonCodec.shared } /// Sets up an instance of `FirebaseAuthUserHostApi` to handle messages through the `binaryMessenger`. - static func setUp(binaryMessenger: FlutterBinaryMessenger, api: FirebaseAuthUserHostApi?, messageChannelSuffix: String = "") { + static func setUp( + binaryMessenger: FlutterBinaryMessenger, api: FirebaseAuthUserHostApi?, + messageChannelSuffix: String = "" + ) { let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" - let deleteChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.delete\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let deleteChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.delete\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { deleteChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1752,7 +1958,10 @@ class FirebaseAuthUserHostApiSetup { } else { deleteChannel.setMessageHandler(nil) } - let getIdTokenChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.getIdToken\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let getIdTokenChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.getIdToken\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getIdTokenChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1770,7 +1979,10 @@ class FirebaseAuthUserHostApiSetup { } else { getIdTokenChannel.setMessageHandler(nil) } - let linkWithCredentialChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.linkWithCredential\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let linkWithCredentialChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.linkWithCredential\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { linkWithCredentialChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1788,7 +2000,10 @@ class FirebaseAuthUserHostApiSetup { } else { linkWithCredentialChannel.setMessageHandler(nil) } - let linkWithProviderChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.linkWithProvider\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let linkWithProviderChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.linkWithProvider\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { linkWithProviderChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1806,7 +2021,10 @@ class FirebaseAuthUserHostApiSetup { } else { linkWithProviderChannel.setMessageHandler(nil) } - let reauthenticateWithCredentialChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.reauthenticateWithCredential\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let reauthenticateWithCredentialChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.reauthenticateWithCredential\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { reauthenticateWithCredentialChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1824,7 +2042,10 @@ class FirebaseAuthUserHostApiSetup { } else { reauthenticateWithCredentialChannel.setMessageHandler(nil) } - let reauthenticateWithProviderChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.reauthenticateWithProvider\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let reauthenticateWithProviderChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.reauthenticateWithProvider\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { reauthenticateWithProviderChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1842,7 +2063,10 @@ class FirebaseAuthUserHostApiSetup { } else { reauthenticateWithProviderChannel.setMessageHandler(nil) } - let reloadChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.reload\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let reloadChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.reload\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { reloadChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1859,13 +2083,17 @@ class FirebaseAuthUserHostApiSetup { } else { reloadChannel.setMessageHandler(nil) } - let sendEmailVerificationChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.sendEmailVerification\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let sendEmailVerificationChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.sendEmailVerification\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { sendEmailVerificationChannel.setMessageHandler { message, reply in let args = message as! [Any?] let appArg = args[0] as! AuthPigeonFirebaseApp let actionCodeSettingsArg: InternalActionCodeSettings? = nilOrValue(args[1]) - api.sendEmailVerification(app: appArg, actionCodeSettings: actionCodeSettingsArg) { result in + api.sendEmailVerification(app: appArg, actionCodeSettings: actionCodeSettingsArg) { + result in switch result { case .success: reply(wrapResult(nil)) @@ -1877,7 +2105,10 @@ class FirebaseAuthUserHostApiSetup { } else { sendEmailVerificationChannel.setMessageHandler(nil) } - let unlinkChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.unlink\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let unlinkChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.unlink\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { unlinkChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1895,7 +2126,10 @@ class FirebaseAuthUserHostApiSetup { } else { unlinkChannel.setMessageHandler(nil) } - let updateEmailChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updateEmail\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let updateEmailChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updateEmail\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { updateEmailChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1913,7 +2147,10 @@ class FirebaseAuthUserHostApiSetup { } else { updateEmailChannel.setMessageHandler(nil) } - let updatePasswordChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updatePassword\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let updatePasswordChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updatePassword\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { updatePasswordChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1931,7 +2168,10 @@ class FirebaseAuthUserHostApiSetup { } else { updatePasswordChannel.setMessageHandler(nil) } - let updatePhoneNumberChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updatePhoneNumber\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let updatePhoneNumberChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updatePhoneNumber\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { updatePhoneNumberChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1949,7 +2189,10 @@ class FirebaseAuthUserHostApiSetup { } else { updatePhoneNumberChannel.setMessageHandler(nil) } - let updateProfileChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updateProfile\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let updateProfileChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updateProfile\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { updateProfileChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1967,14 +2210,19 @@ class FirebaseAuthUserHostApiSetup { } else { updateProfileChannel.setMessageHandler(nil) } - let verifyBeforeUpdateEmailChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.verifyBeforeUpdateEmail\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let verifyBeforeUpdateEmailChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.verifyBeforeUpdateEmail\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { verifyBeforeUpdateEmailChannel.setMessageHandler { message, reply in let args = message as! [Any?] let appArg = args[0] as! AuthPigeonFirebaseApp let newEmailArg = args[1] as! String let actionCodeSettingsArg: InternalActionCodeSettings? = nilOrValue(args[2]) - api.verifyBeforeUpdateEmail(app: appArg, newEmail: newEmailArg, actionCodeSettings: actionCodeSettingsArg) { result in + api.verifyBeforeUpdateEmail( + app: appArg, newEmail: newEmailArg, actionCodeSettings: actionCodeSettingsArg + ) { result in switch result { case .success: reply(wrapResult(nil)) @@ -1990,27 +2238,44 @@ class FirebaseAuthUserHostApiSetup { } /// Generated protocol from Pigeon that represents a handler of messages from Flutter. protocol MultiFactorUserHostApi { - func enrollPhone(app: AuthPigeonFirebaseApp, assertion: InternalPhoneMultiFactorAssertion, displayName: String?, completion: @escaping (Result) -> Void) - func enrollTotp(app: AuthPigeonFirebaseApp, assertionId: String, displayName: String?, completion: @escaping (Result) -> Void) - func getSession(app: AuthPigeonFirebaseApp, completion: @escaping (Result) -> Void) - func unenroll(app: AuthPigeonFirebaseApp, factorUid: String, completion: @escaping (Result) -> Void) - func getEnrolledFactors(app: AuthPigeonFirebaseApp, completion: @escaping (Result<[InternalMultiFactorInfo], Error>) -> Void) + func enrollPhone( + app: AuthPigeonFirebaseApp, assertion: InternalPhoneMultiFactorAssertion, displayName: String?, + completion: @escaping (Result) -> Void) + func enrollTotp( + app: AuthPigeonFirebaseApp, assertionId: String, displayName: String?, + completion: @escaping (Result) -> Void) + func getSession( + app: AuthPigeonFirebaseApp, + completion: @escaping (Result) -> Void) + func unenroll( + app: AuthPigeonFirebaseApp, factorUid: String, + completion: @escaping (Result) -> Void) + func getEnrolledFactors( + app: AuthPigeonFirebaseApp, + completion: @escaping (Result<[InternalMultiFactorInfo], Error>) -> Void) } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class MultiFactorUserHostApiSetup { static var codec: FlutterStandardMessageCodec { FirebaseAuthMessagesPigeonCodec.shared } /// Sets up an instance of `MultiFactorUserHostApi` to handle messages through the `binaryMessenger`. - static func setUp(binaryMessenger: FlutterBinaryMessenger, api: MultiFactorUserHostApi?, messageChannelSuffix: String = "") { + static func setUp( + binaryMessenger: FlutterBinaryMessenger, api: MultiFactorUserHostApi?, + messageChannelSuffix: String = "" + ) { let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" - let enrollPhoneChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.enrollPhone\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let enrollPhoneChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.enrollPhone\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { enrollPhoneChannel.setMessageHandler { message, reply in let args = message as! [Any?] let appArg = args[0] as! AuthPigeonFirebaseApp let assertionArg = args[1] as! InternalPhoneMultiFactorAssertion let displayNameArg: String? = nilOrValue(args[2]) - api.enrollPhone(app: appArg, assertion: assertionArg, displayName: displayNameArg) { result in + api.enrollPhone(app: appArg, assertion: assertionArg, displayName: displayNameArg) { + result in switch result { case .success: reply(wrapResult(nil)) @@ -2022,14 +2287,18 @@ class MultiFactorUserHostApiSetup { } else { enrollPhoneChannel.setMessageHandler(nil) } - let enrollTotpChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.enrollTotp\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let enrollTotpChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.enrollTotp\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { enrollTotpChannel.setMessageHandler { message, reply in let args = message as! [Any?] let appArg = args[0] as! AuthPigeonFirebaseApp let assertionIdArg = args[1] as! String let displayNameArg: String? = nilOrValue(args[2]) - api.enrollTotp(app: appArg, assertionId: assertionIdArg, displayName: displayNameArg) { result in + api.enrollTotp(app: appArg, assertionId: assertionIdArg, displayName: displayNameArg) { + result in switch result { case .success: reply(wrapResult(nil)) @@ -2041,7 +2310,10 @@ class MultiFactorUserHostApiSetup { } else { enrollTotpChannel.setMessageHandler(nil) } - let getSessionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.getSession\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let getSessionChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.getSession\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getSessionChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2058,7 +2330,10 @@ class MultiFactorUserHostApiSetup { } else { getSessionChannel.setMessageHandler(nil) } - let unenrollChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.unenroll\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let unenrollChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.unenroll\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { unenrollChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2076,7 +2351,10 @@ class MultiFactorUserHostApiSetup { } else { unenrollChannel.setMessageHandler(nil) } - let getEnrolledFactorsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.getEnrolledFactors\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let getEnrolledFactorsChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.getEnrolledFactors\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getEnrolledFactorsChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2097,23 +2375,33 @@ class MultiFactorUserHostApiSetup { } /// Generated protocol from Pigeon that represents a handler of messages from Flutter. protocol MultiFactoResolverHostApi { - func resolveSignIn(resolverId: String, assertion: InternalPhoneMultiFactorAssertion?, totpAssertionId: String?, completion: @escaping (Result) -> Void) + func resolveSignIn( + resolverId: String, assertion: InternalPhoneMultiFactorAssertion?, totpAssertionId: String?, + completion: @escaping (Result) -> Void) } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class MultiFactoResolverHostApiSetup { static var codec: FlutterStandardMessageCodec { FirebaseAuthMessagesPigeonCodec.shared } /// Sets up an instance of `MultiFactoResolverHostApi` to handle messages through the `binaryMessenger`. - static func setUp(binaryMessenger: FlutterBinaryMessenger, api: MultiFactoResolverHostApi?, messageChannelSuffix: String = "") { + static func setUp( + binaryMessenger: FlutterBinaryMessenger, api: MultiFactoResolverHostApi?, + messageChannelSuffix: String = "" + ) { let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" - let resolveSignInChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactoResolverHostApi.resolveSignIn\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let resolveSignInChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactoResolverHostApi.resolveSignIn\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { resolveSignInChannel.setMessageHandler { message, reply in let args = message as! [Any?] let resolverIdArg = args[0] as! String let assertionArg: InternalPhoneMultiFactorAssertion? = nilOrValue(args[1]) let totpAssertionIdArg: String? = nilOrValue(args[2]) - api.resolveSignIn(resolverId: resolverIdArg, assertion: assertionArg, totpAssertionId: totpAssertionIdArg) { result in + api.resolveSignIn( + resolverId: resolverIdArg, assertion: assertionArg, totpAssertionId: totpAssertionIdArg + ) { result in switch result { case .success(let res): reply(wrapResult(res)) @@ -2129,18 +2417,29 @@ class MultiFactoResolverHostApiSetup { } /// Generated protocol from Pigeon that represents a handler of messages from Flutter. protocol MultiFactorTotpHostApi { - func generateSecret(sessionId: String, completion: @escaping (Result) -> Void) - func getAssertionForEnrollment(secretKey: String, oneTimePassword: String, completion: @escaping (Result) -> Void) - func getAssertionForSignIn(enrollmentId: String, oneTimePassword: String, completion: @escaping (Result) -> Void) + func generateSecret( + sessionId: String, completion: @escaping (Result) -> Void) + func getAssertionForEnrollment( + secretKey: String, oneTimePassword: String, + completion: @escaping (Result) -> Void) + func getAssertionForSignIn( + enrollmentId: String, oneTimePassword: String, + completion: @escaping (Result) -> Void) } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class MultiFactorTotpHostApiSetup { static var codec: FlutterStandardMessageCodec { FirebaseAuthMessagesPigeonCodec.shared } /// Sets up an instance of `MultiFactorTotpHostApi` to handle messages through the `binaryMessenger`. - static func setUp(binaryMessenger: FlutterBinaryMessenger, api: MultiFactorTotpHostApi?, messageChannelSuffix: String = "") { + static func setUp( + binaryMessenger: FlutterBinaryMessenger, api: MultiFactorTotpHostApi?, + messageChannelSuffix: String = "" + ) { let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" - let generateSecretChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpHostApi.generateSecret\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let generateSecretChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpHostApi.generateSecret\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { generateSecretChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2157,13 +2456,17 @@ class MultiFactorTotpHostApiSetup { } else { generateSecretChannel.setMessageHandler(nil) } - let getAssertionForEnrollmentChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpHostApi.getAssertionForEnrollment\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let getAssertionForEnrollmentChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpHostApi.getAssertionForEnrollment\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getAssertionForEnrollmentChannel.setMessageHandler { message, reply in let args = message as! [Any?] let secretKeyArg = args[0] as! String let oneTimePasswordArg = args[1] as! String - api.getAssertionForEnrollment(secretKey: secretKeyArg, oneTimePassword: oneTimePasswordArg) { result in + api.getAssertionForEnrollment(secretKey: secretKeyArg, oneTimePassword: oneTimePasswordArg) + { result in switch result { case .success(let res): reply(wrapResult(res)) @@ -2175,13 +2478,18 @@ class MultiFactorTotpHostApiSetup { } else { getAssertionForEnrollmentChannel.setMessageHandler(nil) } - let getAssertionForSignInChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpHostApi.getAssertionForSignIn\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let getAssertionForSignInChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpHostApi.getAssertionForSignIn\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getAssertionForSignInChannel.setMessageHandler { message, reply in let args = message as! [Any?] let enrollmentIdArg = args[0] as! String let oneTimePasswordArg = args[1] as! String - api.getAssertionForSignIn(enrollmentId: enrollmentIdArg, oneTimePassword: oneTimePasswordArg) { result in + api.getAssertionForSignIn( + enrollmentId: enrollmentIdArg, oneTimePassword: oneTimePasswordArg + ) { result in switch result { case .success(let res): reply(wrapResult(res)) @@ -2197,24 +2505,35 @@ class MultiFactorTotpHostApiSetup { } /// Generated protocol from Pigeon that represents a handler of messages from Flutter. protocol MultiFactorTotpSecretHostApi { - func generateQrCodeUrl(secretKey: String, accountName: String?, issuer: String?, completion: @escaping (Result) -> Void) - func openInOtpApp(secretKey: String, qrCodeUrl: String, completion: @escaping (Result) -> Void) + func generateQrCodeUrl( + secretKey: String, accountName: String?, issuer: String?, + completion: @escaping (Result) -> Void) + func openInOtpApp( + secretKey: String, qrCodeUrl: String, completion: @escaping (Result) -> Void) } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class MultiFactorTotpSecretHostApiSetup { static var codec: FlutterStandardMessageCodec { FirebaseAuthMessagesPigeonCodec.shared } /// Sets up an instance of `MultiFactorTotpSecretHostApi` to handle messages through the `binaryMessenger`. - static func setUp(binaryMessenger: FlutterBinaryMessenger, api: MultiFactorTotpSecretHostApi?, messageChannelSuffix: String = "") { + static func setUp( + binaryMessenger: FlutterBinaryMessenger, api: MultiFactorTotpSecretHostApi?, + messageChannelSuffix: String = "" + ) { let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" - let generateQrCodeUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpSecretHostApi.generateQrCodeUrl\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let generateQrCodeUrlChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpSecretHostApi.generateQrCodeUrl\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { generateQrCodeUrlChannel.setMessageHandler { message, reply in let args = message as! [Any?] let secretKeyArg = args[0] as! String let accountNameArg: String? = nilOrValue(args[1]) let issuerArg: String? = nilOrValue(args[2]) - api.generateQrCodeUrl(secretKey: secretKeyArg, accountName: accountNameArg, issuer: issuerArg) { result in + api.generateQrCodeUrl( + secretKey: secretKeyArg, accountName: accountNameArg, issuer: issuerArg + ) { result in switch result { case .success(let res): reply(wrapResult(res)) @@ -2226,7 +2545,10 @@ class MultiFactorTotpSecretHostApiSetup { } else { generateQrCodeUrlChannel.setMessageHandler(nil) } - let openInOtpAppChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpSecretHostApi.openInOtpApp\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let openInOtpAppChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpSecretHostApi.openInOtpApp\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { openInOtpAppChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2257,9 +2579,15 @@ protocol GenerateInterfaces { class GenerateInterfacesSetup { static var codec: FlutterStandardMessageCodec { FirebaseAuthMessagesPigeonCodec.shared } /// Sets up an instance of `GenerateInterfaces` to handle messages through the `binaryMessenger`. - static func setUp(binaryMessenger: FlutterBinaryMessenger, api: GenerateInterfaces?, messageChannelSuffix: String = "") { + static func setUp( + binaryMessenger: FlutterBinaryMessenger, api: GenerateInterfaces?, + messageChannelSuffix: String = "" + ) { let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" - let pigeonInterfaceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_auth_platform_interface.GenerateInterfaces.pigeonInterface\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let pigeonInterfaceChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_auth_platform_interface.GenerateInterfaces.pigeonInterface\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonInterfaceChannel.setMessageHandler { message, reply in let args = message as! [Any?] diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/PigeonParser.swift b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/PigeonParser.swift index c6939027271f..aa2835f844a6 100644 --- a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/PigeonParser.swift +++ b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/PigeonParser.swift @@ -101,7 +101,9 @@ enum PigeonParser { ) } - static func parseActionCodeSettings(_ settings: InternalActionCodeSettings?) -> ActionCodeSettings? { + static func parseActionCodeSettings(_ settings: InternalActionCodeSettings?) + -> ActionCodeSettings? + { guard let settings else { return nil } let codeSettings = ActionCodeSettings() codeSettings.url = URL(string: settings.url) From a8439ee6448e3edde7ee0aa522b8b6b096ee7d64 Mon Sep 17 00:00:00 2001 From: Jude Selase Kwashie <64037520+SelaseKay@users.noreply.github.com> Date: Wed, 19 Aug 2026 16:15:03 +0000 Subject: [PATCH 3/5] fix(auth,apple): ignore camelCase lint on UIKit URLContexts parameter --- .../Sources/firebase_auth/FLTFirebaseAuthPlugin.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.swift b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.swift index b849e720e436..4a10f1248d50 100644 --- a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.swift +++ b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.swift @@ -189,6 +189,8 @@ public class FLTFirebaseAuthPlugin: NSObject, FlutterPlugin, FLTFirebasePluginPr Auth.auth().canHandle(url) } + // UIKit's scene(_:openURLContexts:) uses this parameter name. + // swift-format-ignore: AlwaysUseLowerCamelCase public func scene(_ scene: UIScene, openURLContexts URLContexts: Set) -> Bool { for urlContext in URLContexts where Auth.auth().canHandle(urlContext.url) { From 9ba10ff5f1c1d63dd9de7251f6ce4a33e727ba88 Mon Sep 17 00:00:00 2001 From: Jude Selase Kwashie <64037520+SelaseKay@users.noreply.github.com> Date: Wed, 19 Aug 2026 16:28:54 +0000 Subject: [PATCH 4/5] fix(auth,apple): use lowerCamelCase for openURLContexts internal parameter --- .../Sources/firebase_auth/FLTFirebaseAuthPlugin.swift | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.swift b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.swift index 4a10f1248d50..0370dfc02d9e 100644 --- a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.swift +++ b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.swift @@ -189,11 +189,9 @@ public class FLTFirebaseAuthPlugin: NSObject, FlutterPlugin, FLTFirebasePluginPr Auth.auth().canHandle(url) } - // UIKit's scene(_:openURLContexts:) uses this parameter name. - // swift-format-ignore: AlwaysUseLowerCamelCase - public func scene(_ scene: UIScene, openURLContexts URLContexts: Set) -> Bool + public func scene(_ scene: UIScene, openURLContexts urlContexts: Set) -> Bool { - for urlContext in URLContexts where Auth.auth().canHandle(urlContext.url) { + for urlContext in urlContexts where Auth.auth().canHandle(urlContext.url) { return true } return false From 09278f8088d26b07c279dd9d6b6bda964bbfd86f Mon Sep 17 00:00:00 2001 From: Jude Selase Kwashie <64037520+SelaseKay@users.noreply.github.com> Date: Thu, 20 Aug 2026 07:48:04 +0000 Subject: [PATCH 5/5] fix(auth,apple): use current Firebase Auth Swift APIs --- .../FLTFirebaseAuthPlugin+MultiFactor.swift | 2 +- .../firebase_auth/FLTFirebaseAuthPlugin.swift | 27 +++++-------------- 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+MultiFactor.swift b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+MultiFactor.swift index 9cf6deac6c1d..0cf8b5056585 100644 --- a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+MultiFactor.swift +++ b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin+MultiFactor.swift @@ -76,7 +76,7 @@ extension FLTFirebaseAuthPlugin: MultiFactorUserHostApi, MultiFactoResolverHostA completion(.failure(AuthErrors.noCurrentUser())) return } - multiFactor.getSession { session, _ in + multiFactor.getSessionWithCompletion { session, _ in let id = UUID().uuidString self.multiFactorSessionMap[id] = session completion(.success(InternalMultiFactorSession(id: id))) diff --git a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.swift b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.swift index 0370dfc02d9e..d76fc58d2cbb 100644 --- a/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.swift +++ b/packages/firebase_auth/firebase_auth/ios/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.swift @@ -148,7 +148,7 @@ public class FLTFirebaseAuthPlugin: NSObject, FlutterPlugin, FLTFirebasePluginPr let app = FLTFirebasePlugin.firebaseAppNamed(pigeonApp.appName)! let auth = Auth.auth(app: app) auth.tenantID = pigeonApp.tenantId - auth.customAuthDomain = FLTFirebaseCorePlugin.getCustomDomain(app.name) + auth.customAuthDomain = FLTFirebasePlugin.getCustomDomain(app.name) if let customAuthDomain = pigeonApp.customAuthDomain { auth.customAuthDomain = customAuthDomain } @@ -200,7 +200,7 @@ public class FLTFirebaseAuthPlugin: NSObject, FlutterPlugin, FLTFirebasePluginPr func ensureAPNSTokenSetting() { #if os(iOS) - if FirebaseApp.defaultApp() != nil { + if FirebaseApp.app() != nil { if Auth.auth().apnsToken == nil, let apnsToken { Auth.auth().setAPNSToken(apnsToken, type: .unknown) self.apnsToken = nil @@ -634,29 +634,16 @@ public class FLTFirebaseAuthPlugin: NSObject, FlutterPlugin, FLTFirebasePluginPr completion(nil, nil) } case kSignInMethodOAuth: - let providerId = str("providerId") ?? "" + let provider = AuthProviderID.custom(str("providerId") ?? "") let token = idToken ?? "" - // Keep the nil-accessToken path off the non-null 4-arg selector (#18450). - if let accessToken { - if let rawNonce { - completion( - OAuthProvider.credential( - withProviderID: providerId, idToken: token, rawNonce: rawNonce, - accessToken: accessToken), - nil) - } else { - completion( - OAuthProvider.credential( - withProviderID: providerId, idToken: token, accessToken: accessToken), - nil) - } - } else if let rawNonce { + if let rawNonce { completion( - OAuthProvider.credential(withProviderID: providerId, idToken: token, rawNonce: rawNonce), + OAuthProvider.credential( + providerID: provider, idToken: token, rawNonce: rawNonce, accessToken: accessToken), nil) } else { completion( - OAuthProvider.credential(withProviderID: providerId, idToken: token, accessToken: nil), + OAuthProvider.credential(providerID: provider, idToken: token, accessToken: accessToken), nil) } default: