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/4] 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 ecfa0fb01912fdceecea9f29185c0c40e27bdc30 Mon Sep 17 00:00:00 2001 From: Jude Selase Kwashie <64037520+SelaseKay@users.noreply.github.com> Date: Wed, 19 Aug 2026 15:48:39 +0000 Subject: [PATCH 2/4] refactor(auth,android): migrate native implementation to Kotlin --- .../firebase_auth/android/build.gradle | 34 +- .../firebase_auth/android/local-config.gradle | 7 + .../auth/AuthStateChannelStreamHandler.java | 63 - .../plugins/firebase/auth/Constants.java | 46 - .../auth/FlutterFirebaseAuthPlugin.java | 781 --- .../FlutterFirebaseAuthPluginException.java | 157 - .../auth/FlutterFirebaseAuthRegistrar.java | 21 - .../auth/FlutterFirebaseAuthUser.java | 548 -- .../auth/FlutterFirebaseMultiFactor.java | 252 - .../auth/FlutterFirebaseTotpMultiFactor.java | 82 - .../auth/FlutterFirebaseTotpSecret.java | 42 - .../auth/GeneratedAndroidFirebaseAuth.java | 5308 ----------------- .../auth/IdTokenChannelStreamHandler.java | 63 - .../PhoneNumberVerificationStreamHandler.java | 197 - .../plugins/firebase/auth/PigeonParser.java | 382 -- .../auth/AuthStateChannelStreamHandler.kt | 48 + .../plugins/firebase/auth/Constants.kt | 42 + .../auth/FlutterFirebaseAuthPlugin.kt | 551 ++ .../FlutterFirebaseAuthPluginException.kt | 125 + .../auth/FlutterFirebaseAuthRegistrar.kt | 17 + .../firebase/auth/FlutterFirebaseAuthUser.kt | 380 ++ .../auth/FlutterFirebaseMultiFactor.kt | 188 + .../auth/FlutterFirebaseTotpMultiFactor.kt | 63 + .../auth/FlutterFirebaseTotpSecret.kt | 32 + .../auth/GeneratedAndroidFirebaseAuth.g.kt | 2510 ++++++++ .../auth/IdTokenChannelStreamHandler.kt | 48 + .../PhoneNumberVerificationStreamHandler.kt | 145 + .../plugins/firebase/auth/PigeonParser.kt | 281 + .../example/android/settings.gradle | 2 +- .../pigeons/messages.dart | 7 +- 30 files changed, 4470 insertions(+), 7952 deletions(-) create mode 100644 packages/firebase_auth/firebase_auth/android/local-config.gradle delete mode 100644 packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/AuthStateChannelStreamHandler.java delete mode 100644 packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/Constants.java delete mode 100755 packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPlugin.java delete mode 100644 packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPluginException.java delete mode 100644 packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthRegistrar.java delete mode 100644 packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthUser.java delete mode 100644 packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseMultiFactor.java delete mode 100644 packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseTotpMultiFactor.java delete mode 100644 packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseTotpSecret.java delete mode 100644 packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/GeneratedAndroidFirebaseAuth.java delete mode 100644 packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/IdTokenChannelStreamHandler.java delete mode 100644 packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/PhoneNumberVerificationStreamHandler.java delete mode 100644 packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/PigeonParser.java create mode 100644 packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/AuthStateChannelStreamHandler.kt create mode 100644 packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/Constants.kt create mode 100644 packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPlugin.kt create mode 100644 packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPluginException.kt create mode 100644 packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthRegistrar.kt create mode 100644 packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthUser.kt create mode 100644 packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseMultiFactor.kt create mode 100644 packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseTotpMultiFactor.kt create mode 100644 packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseTotpSecret.kt create mode 100644 packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/GeneratedAndroidFirebaseAuth.g.kt create mode 100644 packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/IdTokenChannelStreamHandler.kt create mode 100644 packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/PhoneNumberVerificationStreamHandler.kt create mode 100644 packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/PigeonParser.kt diff --git a/packages/firebase_auth/firebase_auth/android/build.gradle b/packages/firebase_auth/firebase_auth/android/build.gradle index 1004a0e70463..9abc51732b95 100755 --- a/packages/firebase_auth/firebase_auth/android/build.gradle +++ b/packages/firebase_auth/firebase_auth/android/build.gradle @@ -2,6 +2,7 @@ group 'io.flutter.plugins.firebase.auth' version '1.0-SNAPSHOT' apply plugin: 'com.android.library' +apply from: file("local-config.gradle") buildscript { repositories { @@ -10,13 +11,23 @@ buildscript { } } -allprojects { +rootProject.allprojects { repositories { google() mavenCentral() } } +// AGP 9+ has built-in Kotlin support unless Flutter opts out via android.builtInKotlin=false. +def agpMajor = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0] as int +def builtInKotlin = providers.gradleProperty("android.builtInKotlin") + .map { it.toBoolean() } + .orElse(agpMajor >= 9) + .get() +if (agpMajor < 9 || !builtInKotlin) { + apply plugin: 'kotlin-android' +} + def firebaseCoreProject = findProject(':firebase_core') if (firebaseCoreProject == null) { throw new GradleException('Could not find the firebase_core FlutterFire plugin, have you added it as a dependency in your pubspec?') @@ -36,16 +47,21 @@ android { namespace 'io.flutter.plugins.firebase.auth' } - compileSdkVersion 34 + compileSdkVersion project.ext.compileSdk defaultConfig { - minSdkVersion 23 + minSdkVersion project.ext.minSdk testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } compileOptions { - sourceCompatibility JavaVersion.toVersion(17) - targetCompatibility JavaVersion.toVersion(17) + sourceCompatibility project.ext.javaVersion + targetCompatibility project.ext.javaVersion + } + + sourceSets { + main.java.srcDirs += "src/main/kotlin" + test.java.srcDirs += "src/test/kotlin" } buildFeatures { @@ -63,4 +79,12 @@ android { } } +plugins.withId("org.jetbrains.kotlin.android") { + kotlin { + compilerOptions { + jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.fromTarget(project.ext.javaVersion.toString()) + } + } +} + apply from: file("./user-agent.gradle") diff --git a/packages/firebase_auth/firebase_auth/android/local-config.gradle b/packages/firebase_auth/firebase_auth/android/local-config.gradle new file mode 100644 index 000000000000..2adcdf5c1729 --- /dev/null +++ b/packages/firebase_auth/firebase_auth/android/local-config.gradle @@ -0,0 +1,7 @@ +ext { + compileSdk=34 + minSdk=23 + targetSdk=34 + javaVersion = JavaVersion.toVersion(17) + androidGradlePluginVersion = '8.3.0' +} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/AuthStateChannelStreamHandler.java b/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/AuthStateChannelStreamHandler.java deleted file mode 100644 index e4147bee6756..000000000000 --- a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/AuthStateChannelStreamHandler.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2022, 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. - */ - -package io.flutter.plugins.firebase.auth; - -import com.google.firebase.auth.FirebaseAuth; -import com.google.firebase.auth.FirebaseAuth.AuthStateListener; -import com.google.firebase.auth.FirebaseUser; -import io.flutter.plugin.common.EventChannel.EventSink; -import io.flutter.plugin.common.EventChannel.StreamHandler; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; - -public class AuthStateChannelStreamHandler implements StreamHandler { - - private final FirebaseAuth firebaseAuth; - private AuthStateListener authStateListener; - - public AuthStateChannelStreamHandler(FirebaseAuth firebaseAuth) { - this.firebaseAuth = firebaseAuth; - } - - @Override - public void onListen(Object arguments, EventSink events) { - Map event = new HashMap<>(); - event.put(Constants.APP_NAME, firebaseAuth.getApp().getName()); - - final AtomicBoolean initialAuthState = new AtomicBoolean(true); - - authStateListener = - auth -> { - if (initialAuthState.get()) { - initialAuthState.set(false); - return; - } - - FirebaseUser user = auth.getCurrentUser(); - - if (user == null) { - event.put(Constants.USER, null); - } else { - event.put( - Constants.USER, PigeonParser.manuallyToList(PigeonParser.parseFirebaseUser(user))); - } - - events.success(event); - }; - - firebaseAuth.addAuthStateListener(authStateListener); - } - - @Override - public void onCancel(Object arguments) { - if (authStateListener != null) { - firebaseAuth.removeAuthStateListener(authStateListener); - authStateListener = null; - } - } -} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/Constants.java b/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/Constants.java deleted file mode 100644 index 2dd8df20fe17..000000000000 --- a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/Constants.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2022, 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. - */ - -package io.flutter.plugins.firebase.auth; - -public class Constants { - - public static final String APP_NAME = "appName"; - - // Providers - public static final String SIGN_IN_METHOD_PASSWORD = "password"; - public static final String SIGN_IN_METHOD_EMAIL_LINK = "emailLink"; - public static final String SIGN_IN_METHOD_FACEBOOK = "facebook.com"; - public static final String SIGN_IN_METHOD_GOOGLE = "google.com"; - public static final String SIGN_IN_METHOD_TWITTER = "twitter.com"; - public static final String SIGN_IN_METHOD_GITHUB = "github.com"; - public static final String SIGN_IN_METHOD_PHONE = "phone"; - public static final String SIGN_IN_METHOD_OAUTH = "oauth"; - public static final String SIGN_IN_METHOD_PLAY_GAMES = "playgames.google.com"; - // User - public static final String USER = "user"; - public static final String EMAIL = "email"; - - public static final String PROVIDER_ID = "providerId"; - public static final String CREDENTIAL = "credential"; - public static final String SECRET = "secret"; - public static final String ID_TOKEN = "idToken"; - public static final String TOKEN = "token"; - public static final String ACCESS_TOKEN = "accessToken"; - public static final String RAW_NONCE = "rawNonce"; - public static final String EMAIL_LINK = "emailLink"; - public static final String VERIFICATION_ID = "verificationId"; - public static final String SMS_CODE = "smsCode"; - public static final String SIGN_IN_METHOD = "signInMethod"; - public static final String FORCE_RESENDING_TOKEN = "forceResendingToken"; - public static final String NAME = "name"; - public static final String SERVER_AUTH_CODE = "serverAuthCode"; - - // MultiFactor - public static final String MULTI_FACTOR_HINTS = "multiFactorHints"; - public static final String MULTI_FACTOR_SESSION_ID = "multiFactorSessionId"; - public static final String MULTI_FACTOR_RESOLVER_ID = "multiFactorResolverId"; -} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPlugin.java b/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPlugin.java deleted file mode 100755 index ff6da9230b64..000000000000 --- a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPlugin.java +++ /dev/null @@ -1,781 +0,0 @@ -// Copyright 2017 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. - -package io.flutter.plugins.firebase.auth; - -import static io.flutter.plugins.firebase.auth.FlutterFirebaseMultiFactor.multiFactorUserMap; -import static io.flutter.plugins.firebase.core.FlutterFirebasePluginRegistry.registerPlugin; - -import android.app.Activity; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.gms.tasks.Task; -import com.google.android.gms.tasks.TaskCompletionSource; -import com.google.firebase.FirebaseApp; -import com.google.firebase.auth.ActionCodeResult; -import com.google.firebase.auth.AuthCredential; -import com.google.firebase.auth.AuthResult; -import com.google.firebase.auth.FirebaseAuth; -import com.google.firebase.auth.FirebaseUser; -import com.google.firebase.auth.MultiFactor; -import com.google.firebase.auth.MultiFactorInfo; -import com.google.firebase.auth.MultiFactorSession; -import com.google.firebase.auth.OAuthProvider; -import com.google.firebase.auth.PhoneMultiFactorInfo; -import com.google.firebase.auth.SignInMethodQueryResult; -import io.flutter.embedding.engine.plugins.FlutterPlugin; -import io.flutter.embedding.engine.plugins.activity.ActivityAware; -import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding; -import io.flutter.plugin.common.BinaryMessenger; -import io.flutter.plugin.common.EventChannel; -import io.flutter.plugin.common.EventChannel.StreamHandler; -import io.flutter.plugin.common.MethodChannel; -import io.flutter.plugins.firebase.core.FlutterFirebasePlugin; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -/** Flutter plugin for Firebase Auth. */ -public class FlutterFirebaseAuthPlugin - implements FlutterFirebasePlugin, - FlutterPlugin, - ActivityAware, - GeneratedAndroidFirebaseAuth.FirebaseAuthHostApi { - - private static final String METHOD_CHANNEL_NAME = "plugins.flutter.io/firebase_auth"; - - // Stores the instances of native AuthCredentials by their hashCode - static final HashMap authCredentials = new HashMap<>(); - - @Nullable private BinaryMessenger messenger; - - private MethodChannel channel; - private Activity activity; - - private final Map streamHandlers = new HashMap<>(); - - private final FlutterFirebaseAuthUser firebaseAuthUser = new FlutterFirebaseAuthUser(); - private final FlutterFirebaseMultiFactor firebaseMultiFactor = new FlutterFirebaseMultiFactor(); - - private final FlutterFirebaseTotpMultiFactor firebaseTotpMultiFactor = - new FlutterFirebaseTotpMultiFactor(); - private final FlutterFirebaseTotpSecret firebaseTotpSecret = new FlutterFirebaseTotpSecret(); - - private void initInstance(BinaryMessenger messenger) { - registerPlugin(METHOD_CHANNEL_NAME, this); - channel = new MethodChannel(messenger, METHOD_CHANNEL_NAME); - GeneratedAndroidFirebaseAuth.FirebaseAuthHostApi.setUp(messenger, this); - GeneratedAndroidFirebaseAuth.FirebaseAuthUserHostApi.setUp(messenger, firebaseAuthUser); - GeneratedAndroidFirebaseAuth.MultiFactorUserHostApi.setUp(messenger, firebaseMultiFactor); - GeneratedAndroidFirebaseAuth.MultiFactoResolverHostApi.setUp(messenger, firebaseMultiFactor); - GeneratedAndroidFirebaseAuth.MultiFactorTotpHostApi.setUp(messenger, firebaseTotpMultiFactor); - GeneratedAndroidFirebaseAuth.MultiFactorTotpSecretHostApi.setUp(messenger, firebaseTotpSecret); - - this.messenger = messenger; - } - - @Override - public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) { - initInstance(binding.getBinaryMessenger()); - } - - @Override - public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) { - channel.setMethodCallHandler(null); - - assert messenger != null; - GeneratedAndroidFirebaseAuth.FirebaseAuthHostApi.setUp(messenger, null); - GeneratedAndroidFirebaseAuth.FirebaseAuthUserHostApi.setUp(messenger, null); - GeneratedAndroidFirebaseAuth.MultiFactorUserHostApi.setUp(messenger, null); - GeneratedAndroidFirebaseAuth.MultiFactoResolverHostApi.setUp(messenger, null); - GeneratedAndroidFirebaseAuth.MultiFactorTotpHostApi.setUp(messenger, null); - GeneratedAndroidFirebaseAuth.MultiFactorTotpSecretHostApi.setUp(messenger, null); - - channel = null; - messenger = null; - - removeEventListeners(); - } - - @Override - public void onAttachedToActivity(ActivityPluginBinding activityPluginBinding) { - activity = activityPluginBinding.getActivity(); - firebaseAuthUser.setActivity(activity); - } - - @Override - public void onDetachedFromActivityForConfigChanges() { - activity = null; - firebaseAuthUser.setActivity(null); - } - - @Override - public void onReattachedToActivityForConfigChanges(ActivityPluginBinding activityPluginBinding) { - activity = activityPluginBinding.getActivity(); - firebaseAuthUser.setActivity(activity); - } - - @Override - public void onDetachedFromActivity() { - activity = null; - firebaseAuthUser.setActivity(null); - } - - // Only access activity with this method. - @Nullable - private Activity getActivity() { - return activity; - } - - static FirebaseAuth getAuthFromPigeon( - GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp pigeonApp) { - FirebaseApp app = FirebaseApp.getInstance(pigeonApp.getAppName()); - FirebaseAuth auth = FirebaseAuth.getInstance(app); - if (pigeonApp.getTenantId() != null) { - auth.setTenantId(pigeonApp.getTenantId()); - } - String customDomain = FlutterFirebasePlugin.customAuthDomain.get(pigeonApp.getAppName()); - if (customDomain != null) { - auth.setCustomAuthDomain(customDomain); - } - - // Auth's `getCustomAuthDomain` supersedes value from `customAuthDomain` map set by - // `initializeApp` - if (pigeonApp.getCustomAuthDomain() != null) { - auth.setCustomAuthDomain(pigeonApp.getCustomAuthDomain()); - } - - return auth; - } - - @Override - public void registerIdTokenListener( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull GeneratedAndroidFirebaseAuth.Result result) { - try { - final FirebaseAuth auth = getAuthFromPigeon(app); - final IdTokenChannelStreamHandler handler = new IdTokenChannelStreamHandler(auth); - final String name = METHOD_CHANNEL_NAME + "/id-token/" + auth.getApp().getName(); - final EventChannel channel = new EventChannel(messenger, name); - channel.setStreamHandler(handler); - streamHandlers.put(channel, handler); - result.success(name); - } catch (Exception e) { - result.error(e); - } - } - - @Override - public void registerAuthStateListener( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull GeneratedAndroidFirebaseAuth.Result result) { - try { - final FirebaseAuth auth = getAuthFromPigeon(app); - final AuthStateChannelStreamHandler handler = new AuthStateChannelStreamHandler(auth); - final String name = METHOD_CHANNEL_NAME + "/auth-state/" + auth.getApp().getName(); - final EventChannel channel = new EventChannel(messenger, name); - channel.setStreamHandler(handler); - streamHandlers.put(channel, handler); - result.success(name); - } catch (Exception e) { - result.error(e); - } - } - - @Override - public void useEmulator( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull String host, - @NonNull Long port, - @NonNull GeneratedAndroidFirebaseAuth.VoidResult result) { - try { - FirebaseAuth firebaseAuth = getAuthFromPigeon(app); - firebaseAuth.useEmulator(host, port.intValue()); - result.success(); - } catch (Exception e) { - result.error(e); - } - } - - @Override - public void applyActionCode( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull String code, - @NonNull GeneratedAndroidFirebaseAuth.VoidResult result) { - FirebaseAuth firebaseAuth = getAuthFromPigeon(app); - firebaseAuth - .applyActionCode(code) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - result.success(); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void checkActionCode( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull String code, - @NonNull - GeneratedAndroidFirebaseAuth.Result - result) { - FirebaseAuth firebaseAuth = getAuthFromPigeon(app); - firebaseAuth - .checkActionCode(code) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - ActionCodeResult actionCodeInfo = task.getResult(); - result.success(PigeonParser.parseActionCodeResult(actionCodeInfo)); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void confirmPasswordReset( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull String code, - @NonNull String newPassword, - @NonNull GeneratedAndroidFirebaseAuth.VoidResult result) { - FirebaseAuth firebaseAuth = getAuthFromPigeon(app); - - firebaseAuth - .confirmPasswordReset(code, newPassword) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - result.success(); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void createUserWithEmailAndPassword( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull String email, - @NonNull String password, - @NonNull - GeneratedAndroidFirebaseAuth.Result - result) { - FirebaseAuth firebaseAuth = getAuthFromPigeon(app); - - firebaseAuth - .createUserWithEmailAndPassword(email, password) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - AuthResult authResult = task.getResult(); - result.success(PigeonParser.parseAuthResult(authResult)); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void signInAnonymously( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull - GeneratedAndroidFirebaseAuth.Result - result) { - FirebaseAuth firebaseAuth = getAuthFromPigeon(app); - firebaseAuth - .signInAnonymously() - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - AuthResult authResult = task.getResult(); - result.success(PigeonParser.parseAuthResult(authResult)); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void signInWithCredential( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull Map input, - @NonNull - GeneratedAndroidFirebaseAuth.Result - result) { - FirebaseAuth firebaseAuth = getAuthFromPigeon(app); - AuthCredential credential = PigeonParser.getCredential(input); - - if (credential == null) { - throw FlutterFirebaseAuthPluginException.invalidCredential(); - } - firebaseAuth - .signInWithCredential(credential) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - AuthResult authResult = task.getResult(); - result.success(PigeonParser.parseAuthResult(authResult)); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void signInWithCustomToken( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull String token, - @NonNull - GeneratedAndroidFirebaseAuth.Result - result) { - FirebaseAuth firebaseAuth = getAuthFromPigeon(app); - - firebaseAuth - .signInWithCustomToken(token) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - AuthResult authResult = task.getResult(); - result.success(PigeonParser.parseAuthResult(authResult)); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void signInWithEmailAndPassword( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull String email, - @NonNull String password, - @NonNull - GeneratedAndroidFirebaseAuth.Result - result) { - FirebaseAuth firebaseAuth = getAuthFromPigeon(app); - firebaseAuth - .signInWithEmailAndPassword(email, password) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - result.success(PigeonParser.parseAuthResult(task.getResult())); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void signInWithEmailLink( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull String email, - @NonNull String emailLink, - @NonNull - GeneratedAndroidFirebaseAuth.Result - result) { - FirebaseAuth firebaseAuth = getAuthFromPigeon(app); - firebaseAuth - .signInWithEmailLink(email, emailLink) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - AuthResult authResult = task.getResult(); - result.success(PigeonParser.parseAuthResult(authResult)); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void signInWithProvider( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull GeneratedAndroidFirebaseAuth.InternalSignInProvider signInProvider, - @NonNull - GeneratedAndroidFirebaseAuth.Result - result) { - FirebaseAuth firebaseAuth = getAuthFromPigeon(app); - - OAuthProvider.Builder provider = - OAuthProvider.newBuilder(signInProvider.getProviderId(), firebaseAuth); - if (signInProvider.getScopes() != null) { - provider.setScopes(signInProvider.getScopes()); - } - if (signInProvider.getCustomParameters() != null) { - provider.addCustomParameters(signInProvider.getCustomParameters()); - } - - firebaseAuth - .startActivityForSignInWithProvider(getActivity(), provider.build()) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - AuthResult authResult = task.getResult(); - result.success(PigeonParser.parseAuthResult(authResult)); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void signOut( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull GeneratedAndroidFirebaseAuth.VoidResult result) { - try { - FirebaseAuth firebaseAuth = getAuthFromPigeon(app); - if (firebaseAuth.getCurrentUser() != null) { - final Map appMultiFactorUser = - multiFactorUserMap.get(app.getAppName()); - if (appMultiFactorUser != null) { - appMultiFactorUser.remove(firebaseAuth.getCurrentUser().getUid()); - } - } - firebaseAuth.signOut(); - result.success(); - } catch (Exception e) { - result.error(e); - } - } - - @Override - public void fetchSignInMethodsForEmail( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull String email, - @NonNull GeneratedAndroidFirebaseAuth.Result> result) { - FirebaseAuth firebaseAuth = getAuthFromPigeon(app); - - firebaseAuth - .fetchSignInMethodsForEmail(email) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - SignInMethodQueryResult signInMethodQueryResult = task.getResult(); - result.success(signInMethodQueryResult.getSignInMethods()); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void sendPasswordResetEmail( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull String email, - @Nullable GeneratedAndroidFirebaseAuth.InternalActionCodeSettings actionCodeSettings, - @NonNull GeneratedAndroidFirebaseAuth.VoidResult result) { - FirebaseAuth firebaseAuth = getAuthFromPigeon(app); - - if (actionCodeSettings == null) { - firebaseAuth - .sendPasswordResetEmail(email) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - result.success(); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - return; - } - - firebaseAuth - .sendPasswordResetEmail(email, PigeonParser.getActionCodeSettings(actionCodeSettings)) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - result.success(); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void sendSignInLinkToEmail( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull String email, - @NonNull GeneratedAndroidFirebaseAuth.InternalActionCodeSettings actionCodeSettings, - @NonNull GeneratedAndroidFirebaseAuth.VoidResult result) { - FirebaseAuth firebaseAuth = getAuthFromPigeon(app); - - firebaseAuth - .sendSignInLinkToEmail(email, PigeonParser.getActionCodeSettings(actionCodeSettings)) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - result.success(); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void setLanguageCode( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @Nullable String languageCode, - @NonNull GeneratedAndroidFirebaseAuth.Result result) { - try { - FirebaseAuth firebaseAuth = getAuthFromPigeon(app); - - if (languageCode == null) { - firebaseAuth.useAppLanguage(); - } else { - firebaseAuth.setLanguageCode(languageCode); - } - - result.success(firebaseAuth.getLanguageCode()); - } catch (Exception e) { - result.error(e); - } - } - - @Override - public void setSettings( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull GeneratedAndroidFirebaseAuth.InternalFirebaseAuthSettings settings, - @NonNull GeneratedAndroidFirebaseAuth.VoidResult result) { - try { - FirebaseAuth firebaseAuth = getAuthFromPigeon(app); - - firebaseAuth - .getFirebaseAuthSettings() - .setAppVerificationDisabledForTesting(settings.getAppVerificationDisabledForTesting()); - - if (settings.getForceRecaptchaFlow() != null) { - firebaseAuth - .getFirebaseAuthSettings() - .forceRecaptchaFlowForTesting(settings.getForceRecaptchaFlow()); - } - - if (settings.getPhoneNumber() != null && settings.getSmsCode() != null) { - firebaseAuth - .getFirebaseAuthSettings() - .setAutoRetrievedSmsCodeForPhoneNumber( - settings.getPhoneNumber(), settings.getSmsCode()); - } - - result.success(); - } catch (Exception e) { - result.error(e); - } - } - - @Override - public void verifyPasswordResetCode( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull String code, - @NonNull GeneratedAndroidFirebaseAuth.Result result) { - FirebaseAuth firebaseAuth = getAuthFromPigeon(app); - - firebaseAuth - .verifyPasswordResetCode(code) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - result.success(task.getResult()); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void verifyPhoneNumber( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull GeneratedAndroidFirebaseAuth.InternalVerifyPhoneNumberRequest request, - @NonNull GeneratedAndroidFirebaseAuth.Result result) { - try { - String eventChannelName = METHOD_CHANNEL_NAME + "/phone/" + UUID.randomUUID().toString(); - EventChannel channel = new EventChannel(messenger, eventChannelName); - - MultiFactorSession multiFactorSession = null; - - if (request.getMultiFactorSessionId() != null) { - multiFactorSession = - FlutterFirebaseMultiFactor.multiFactorSessionMap.get(request.getMultiFactorSessionId()); - } - - final String multiFactorInfoId = request.getMultiFactorInfoId(); - PhoneMultiFactorInfo multiFactorInfo = null; - - if (multiFactorInfoId != null) { - for (String resolverId : FlutterFirebaseMultiFactor.multiFactorResolverMap.keySet()) { - for (MultiFactorInfo info : - FlutterFirebaseMultiFactor.multiFactorResolverMap.get(resolverId).getHints()) { - if (info.getUid().equals(multiFactorInfoId) && info instanceof PhoneMultiFactorInfo) { - multiFactorInfo = (PhoneMultiFactorInfo) info; - break; - } - } - } - } - - PhoneNumberVerificationStreamHandler handler = - new PhoneNumberVerificationStreamHandler( - getActivity(), - app, - request, - multiFactorSession, - multiFactorInfo, - credential -> { - int hashCode = credential.hashCode(); - authCredentials.put(hashCode, credential); - }); - - channel.setStreamHandler(handler); - streamHandlers.put(channel, handler); - - result.success(eventChannelName); - } catch (Exception e) { - result.error(e); - } - } - - @Override - public void revokeTokenWithAuthorizationCode( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull String authorizationCode, - @NonNull GeneratedAndroidFirebaseAuth.VoidResult result) { - // Should never get here as we throw Exception on Dart side. - result.success(); - } - - @Override - public void revokeAccessToken( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull String accessToken, - @NonNull GeneratedAndroidFirebaseAuth.VoidResult result) { - FirebaseAuth firebaseAuth = getAuthFromPigeon(app); - - firebaseAuth - .revokeAccessToken(accessToken) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - result.success(); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void initializeRecaptchaConfig( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull GeneratedAndroidFirebaseAuth.VoidResult result) { - FirebaseAuth firebaseAuth = getAuthFromPigeon(app); - firebaseAuth - .initializeRecaptchaConfig() - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - result.success(); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public Task> getPluginConstantsForFirebaseApp(FirebaseApp firebaseApp) { - TaskCompletionSource> taskCompletionSource = new TaskCompletionSource<>(); - - cachedThreadPool.execute( - () -> { - try { - Map constants = new HashMap<>(); - FirebaseAuth firebaseAuth = FirebaseAuth.getInstance(firebaseApp); - FirebaseUser firebaseUser = firebaseAuth.getCurrentUser(); - String languageCode = firebaseAuth.getLanguageCode(); - - GeneratedAndroidFirebaseAuth.InternalUserDetails user = - firebaseUser == null ? null : PigeonParser.parseFirebaseUser(firebaseUser); - - if (languageCode != null) { - constants.put("APP_LANGUAGE_CODE", languageCode); - } - - if (user != null) { - constants.put("APP_CURRENT_USER", PigeonParser.manuallyToList(user)); - } - - taskCompletionSource.setResult(constants); - } catch (Exception e) { - taskCompletionSource.setException(e); - } - }); - - return taskCompletionSource.getTask(); - } - - @Override - public Task didReinitializeFirebaseCore() { - TaskCompletionSource taskCompletionSource = new TaskCompletionSource<>(); - - cachedThreadPool.execute( - () -> { - try { - removeEventListeners(); - authCredentials.clear(); - taskCompletionSource.setResult(null); - } catch (Exception e) { - taskCompletionSource.setException(e); - } - }); - - return taskCompletionSource.getTask(); - } - - private void removeEventListeners() { - for (EventChannel eventChannel : streamHandlers.keySet()) { - StreamHandler streamHandler = streamHandlers.get(eventChannel); - if (streamHandler != null) { - streamHandler.onCancel(null); - } - eventChannel.setStreamHandler(null); - } - streamHandlers.clear(); - } -} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPluginException.java b/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPluginException.java deleted file mode 100644 index a42bcb56956d..000000000000 --- a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPluginException.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright 2022, 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. - */ - -package io.flutter.plugins.firebase.auth; - -import androidx.annotation.Nullable; -import com.google.firebase.FirebaseApiNotAvailableException; -import com.google.firebase.FirebaseNetworkException; -import com.google.firebase.FirebaseTooManyRequestsException; -import com.google.firebase.auth.AuthCredential; -import com.google.firebase.auth.FirebaseAuthException; -import com.google.firebase.auth.FirebaseAuthMultiFactorException; -import com.google.firebase.auth.FirebaseAuthUserCollisionException; -import com.google.firebase.auth.FirebaseAuthWeakPasswordException; -import com.google.firebase.auth.MultiFactorInfo; -import com.google.firebase.auth.MultiFactorResolver; -import com.google.firebase.auth.MultiFactorSession; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -public class FlutterFirebaseAuthPluginException { - - static GeneratedAndroidFirebaseAuth.FlutterError parserExceptionToFlutter( - @Nullable Exception nativeException) { - if (nativeException == null) { - return new GeneratedAndroidFirebaseAuth.FlutterError("UNKNOWN", null, null); - } - String code = "UNKNOWN"; - - String message = nativeException.getMessage(); - Map additionalData = new HashMap<>(); - - if (nativeException instanceof FirebaseAuthMultiFactorException) { - final FirebaseAuthMultiFactorException multiFactorException = - (FirebaseAuthMultiFactorException) nativeException; - Map output = new HashMap<>(); - - MultiFactorResolver multiFactorResolver = multiFactorException.getResolver(); - final List hints = multiFactorResolver.getHints(); - - final MultiFactorSession session = multiFactorResolver.getSession(); - final String sessionId = UUID.randomUUID().toString(); - FlutterFirebaseMultiFactor.multiFactorSessionMap.put(sessionId, session); - - final String resolverId = UUID.randomUUID().toString(); - FlutterFirebaseMultiFactor.multiFactorResolverMap.put(resolverId, multiFactorResolver); - - final List> pigeonHints = PigeonParser.multiFactorInfoToMap(hints); - - output.put( - Constants.APP_NAME, - multiFactorException.getResolver().getFirebaseAuth().getApp().getName()); - - output.put(Constants.MULTI_FACTOR_HINTS, pigeonHints); - - output.put(Constants.MULTI_FACTOR_SESSION_ID, sessionId); - output.put(Constants.MULTI_FACTOR_RESOLVER_ID, resolverId); - - return new GeneratedAndroidFirebaseAuth.FlutterError( - multiFactorException.getErrorCode(), multiFactorException.getLocalizedMessage(), output); - } - - if (nativeException instanceof FirebaseNetworkException - || (nativeException.getCause() != null - && nativeException.getCause() instanceof FirebaseNetworkException)) { - return new GeneratedAndroidFirebaseAuth.FlutterError( - "network-request-failed", - "A network error (such as timeout, interrupted connection or unreachable host) has" - + " occurred.", - null); - } - - if (nativeException instanceof FirebaseApiNotAvailableException - || (nativeException.getCause() != null - && nativeException.getCause() instanceof FirebaseApiNotAvailableException)) { - return new GeneratedAndroidFirebaseAuth.FlutterError( - "api-not-available", "The requested API is not available.", null); - } - - if (nativeException instanceof FirebaseTooManyRequestsException - || (nativeException.getCause() != null - && nativeException.getCause() instanceof FirebaseTooManyRequestsException)) { - return new GeneratedAndroidFirebaseAuth.FlutterError( - "too-many-requests", - "We have blocked all requests from this device due to unusual activity. Try again later.", - null); - } - - // Manual message overrides to match other platforms. - if (nativeException.getMessage() != null - && nativeException - .getMessage() - .startsWith("Cannot create PhoneAuthCredential without either verificationProof")) { - return new GeneratedAndroidFirebaseAuth.FlutterError( - "invalid-verification-code", - "The verification ID used to create the phone auth credential is invalid.", - null); - } - - if (message != null - && message.contains("User has already been linked to the given provider.")) { - return FlutterFirebaseAuthPluginException.alreadyLinkedProvider(); - } - - if (nativeException instanceof FirebaseAuthException) { - code = ((FirebaseAuthException) nativeException).getErrorCode(); - } - - if (nativeException instanceof FirebaseAuthWeakPasswordException) { - message = ((FirebaseAuthWeakPasswordException) nativeException).getReason(); - } - - if (nativeException instanceof FirebaseAuthUserCollisionException) { - String email = ((FirebaseAuthUserCollisionException) nativeException).getEmail(); - - if (email != null) { - additionalData.put("email", email); - } - - AuthCredential authCredential = - ((FirebaseAuthUserCollisionException) nativeException).getUpdatedCredential(); - - if (authCredential != null) { - additionalData.put("authCredential", PigeonParser.parseAuthCredential(authCredential)); - } - } - - return new GeneratedAndroidFirebaseAuth.FlutterError(code, message, additionalData); - } - - static GeneratedAndroidFirebaseAuth.FlutterError noUser() { - return new GeneratedAndroidFirebaseAuth.FlutterError( - "NO_CURRENT_USER", "No user currently signed in.", null); - } - - static GeneratedAndroidFirebaseAuth.FlutterError invalidCredential() { - return new GeneratedAndroidFirebaseAuth.FlutterError( - "INVALID_CREDENTIAL", - "The supplied auth credential is malformed, has expired or is not currently supported.", - null); - } - - static GeneratedAndroidFirebaseAuth.FlutterError noSuchProvider() { - return new GeneratedAndroidFirebaseAuth.FlutterError( - "NO_SUCH_PROVIDER", "User was not linked to an account with the given provider.", null); - } - - static GeneratedAndroidFirebaseAuth.FlutterError alreadyLinkedProvider() { - return new GeneratedAndroidFirebaseAuth.FlutterError( - "PROVIDER_ALREADY_LINKED", "User has already been linked to the given provider.", null); - } -} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthRegistrar.java b/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthRegistrar.java deleted file mode 100644 index 1476a9bd0653..000000000000 --- a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthRegistrar.java +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2019 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. - -package io.flutter.plugins.firebase.auth; - -import androidx.annotation.Keep; -import com.google.firebase.components.Component; -import com.google.firebase.components.ComponentRegistrar; -import com.google.firebase.platforminfo.LibraryVersionComponent; -import java.util.Collections; -import java.util.List; - -@Keep -public class FlutterFirebaseAuthRegistrar implements ComponentRegistrar { - @Override - public List> getComponents() { - return Collections.>singletonList( - LibraryVersionComponent.create(BuildConfig.LIBRARY_NAME, BuildConfig.LIBRARY_VERSION)); - } -} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthUser.java b/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthUser.java deleted file mode 100644 index 7039a38f18e8..000000000000 --- a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthUser.java +++ /dev/null @@ -1,548 +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. - */ - -package io.flutter.plugins.firebase.auth; - -import static io.flutter.plugins.firebase.core.FlutterFirebasePlugin.cachedThreadPool; - -import android.app.Activity; -import android.net.Uri; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.gms.tasks.Tasks; -import com.google.firebase.FirebaseApp; -import com.google.firebase.auth.AuthCredential; -import com.google.firebase.auth.FirebaseAuth; -import com.google.firebase.auth.FirebaseUser; -import com.google.firebase.auth.GetTokenResult; -import com.google.firebase.auth.OAuthProvider; -import com.google.firebase.auth.PhoneAuthCredential; -import com.google.firebase.auth.UserProfileChangeRequest; -import java.util.Map; - -public class FlutterFirebaseAuthUser - implements GeneratedAndroidFirebaseAuth.FirebaseAuthUserHostApi { - - private Activity activity; - - public void setActivity(Activity activity) { - this.activity = activity; - } - - public static FirebaseUser getCurrentUserFromPigeon( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp pigeonApp) { - FirebaseApp app = FirebaseApp.getInstance(pigeonApp.getAppName()); - FirebaseAuth auth = FirebaseAuth.getInstance(app); - if (pigeonApp.getTenantId() != null) { - auth.setTenantId(pigeonApp.getTenantId()); - } - - return auth.getCurrentUser(); - } - - @Override - public void delete( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull GeneratedAndroidFirebaseAuth.VoidResult result) { - FirebaseUser firebaseUser = getCurrentUserFromPigeon(app); - - if (firebaseUser == null) { - result.error(FlutterFirebaseAuthPluginException.noUser()); - return; - } - - firebaseUser - .delete() - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - result.success(); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void getIdToken( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull Boolean forceRefresh, - @NonNull - GeneratedAndroidFirebaseAuth.Result - result) { - cachedThreadPool.execute( - () -> { - FirebaseUser firebaseUser = getCurrentUserFromPigeon(app); - - if (firebaseUser == null) { - result.error(FlutterFirebaseAuthPluginException.noUser()); - return; - } - try { - GetTokenResult response = Tasks.await(firebaseUser.getIdToken(forceRefresh)); - result.success(PigeonParser.parseTokenResult(response)); - } catch (Exception exception) { - result.error(FlutterFirebaseAuthPluginException.parserExceptionToFlutter(exception)); - } - }); - } - - @Override - public void linkWithCredential( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull Map input, - @NonNull - GeneratedAndroidFirebaseAuth.Result - result) { - FirebaseUser firebaseUser = getCurrentUserFromPigeon(app); - AuthCredential credential = PigeonParser.getCredential(input); - - if (firebaseUser == null) { - result.error(FlutterFirebaseAuthPluginException.noUser()); - return; - } - - if (credential == null) { - result.error(FlutterFirebaseAuthPluginException.invalidCredential()); - return; - } - - firebaseUser - .linkWithCredential(credential) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - result.success(PigeonParser.parseAuthResult(task.getResult())); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void linkWithProvider( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull GeneratedAndroidFirebaseAuth.InternalSignInProvider signInProvider, - @NonNull - GeneratedAndroidFirebaseAuth.Result - result) { - FirebaseUser firebaseUser = getCurrentUserFromPigeon(app); - - OAuthProvider.Builder provider = OAuthProvider.newBuilder(signInProvider.getProviderId()); - if (signInProvider.getScopes() != null) { - provider.setScopes(signInProvider.getScopes()); - } - if (signInProvider.getCustomParameters() != null) { - provider.addCustomParameters(signInProvider.getCustomParameters()); - } - - firebaseUser - .startActivityForLinkWithProvider(activity, provider.build()) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - result.success(PigeonParser.parseAuthResult(task.getResult())); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void reauthenticateWithCredential( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull Map input, - @NonNull - GeneratedAndroidFirebaseAuth.Result - result) { - FirebaseUser firebaseUser = getCurrentUserFromPigeon(app); - AuthCredential credential = PigeonParser.getCredential(input); - - if (firebaseUser == null) { - result.error(FlutterFirebaseAuthPluginException.noUser()); - return; - } - - if (credential == null) { - result.error(FlutterFirebaseAuthPluginException.invalidCredential()); - return; - } - - firebaseUser - .reauthenticateAndRetrieveData(credential) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - result.success(PigeonParser.parseAuthResult(task.getResult())); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void reauthenticateWithProvider( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull GeneratedAndroidFirebaseAuth.InternalSignInProvider signInProvider, - @NonNull - GeneratedAndroidFirebaseAuth.Result - result) { - FirebaseUser firebaseUser = getCurrentUserFromPigeon(app); - - OAuthProvider.Builder provider = OAuthProvider.newBuilder(signInProvider.getProviderId()); - if (signInProvider.getScopes() != null) { - provider.setScopes(signInProvider.getScopes()); - } - if (signInProvider.getCustomParameters() != null) { - provider.addCustomParameters(signInProvider.getCustomParameters()); - } - - firebaseUser - .startActivityForReauthenticateWithProvider(activity, provider.build()) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - result.success(PigeonParser.parseAuthResult(task.getResult())); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void reload( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull - GeneratedAndroidFirebaseAuth.Result - result) { - FirebaseUser firebaseUser = getCurrentUserFromPigeon(app); - - if (firebaseUser == null) { - result.error(FlutterFirebaseAuthPluginException.noUser()); - return; - } - - firebaseUser - .reload() - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - result.success(PigeonParser.parseFirebaseUser(firebaseUser)); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void sendEmailVerification( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @Nullable GeneratedAndroidFirebaseAuth.InternalActionCodeSettings actionCodeSettings, - @NonNull GeneratedAndroidFirebaseAuth.VoidResult result) { - FirebaseUser firebaseUser = getCurrentUserFromPigeon(app); - - if (firebaseUser == null) { - result.error(FlutterFirebaseAuthPluginException.noUser()); - return; - } - - if (actionCodeSettings == null) { - firebaseUser - .sendEmailVerification() - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - result.success(); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - return; - } - - firebaseUser - .sendEmailVerification(PigeonParser.getActionCodeSettings(actionCodeSettings)) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - result.success(); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void unlink( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull String providerId, - @NonNull - GeneratedAndroidFirebaseAuth.Result - result) { - FirebaseUser firebaseUser = getCurrentUserFromPigeon(app); - - if (firebaseUser == null) { - result.error(FlutterFirebaseAuthPluginException.noUser()); - return; - } - - firebaseUser - .unlink(providerId) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - result.success(PigeonParser.parseAuthResult(task.getResult())); - } else { - Exception exception = task.getException(); - if (exception - .getMessage() - .contains("User was not linked to an account with the given provider.")) { - result.error(FlutterFirebaseAuthPluginException.noSuchProvider()); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter(exception)); - } - } - }); - } - - @Override - public void updateEmail( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull String newEmail, - @NonNull - GeneratedAndroidFirebaseAuth.Result - result) { - FirebaseUser firebaseUser = getCurrentUserFromPigeon(app); - - if (firebaseUser == null) { - result.error(FlutterFirebaseAuthPluginException.noUser()); - return; - } - - firebaseUser - .updateEmail(newEmail) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - firebaseUser - .reload() - .addOnCompleteListener( - reloadTask -> { - if (reloadTask.isSuccessful()) { - result.success(PigeonParser.parseFirebaseUser(firebaseUser)); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - reloadTask.getException())); - } - }); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void updatePassword( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull String newPassword, - @NonNull - GeneratedAndroidFirebaseAuth.Result - result) { - FirebaseUser firebaseUser = getCurrentUserFromPigeon(app); - - if (firebaseUser == null) { - result.error(FlutterFirebaseAuthPluginException.noUser()); - return; - } - - firebaseUser - .updatePassword(newPassword) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - firebaseUser - .reload() - .addOnCompleteListener( - reloadTask -> { - if (reloadTask.isSuccessful()) { - result.success(PigeonParser.parseFirebaseUser(firebaseUser)); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - reloadTask.getException())); - } - }); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void updatePhoneNumber( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull Map input, - @NonNull - GeneratedAndroidFirebaseAuth.Result - result) { - FirebaseUser firebaseUser = getCurrentUserFromPigeon(app); - - if (firebaseUser == null) { - result.error(FlutterFirebaseAuthPluginException.noUser()); - return; - } - - PhoneAuthCredential phoneAuthCredential = - (PhoneAuthCredential) PigeonParser.getCredential(input); - - if (phoneAuthCredential == null) { - result.error(FlutterFirebaseAuthPluginException.invalidCredential()); - return; - } - - firebaseUser - .updatePhoneNumber(phoneAuthCredential) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - firebaseUser - .reload() - .addOnCompleteListener( - reloadTask -> { - if (reloadTask.isSuccessful()) { - result.success(PigeonParser.parseFirebaseUser(firebaseUser)); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - reloadTask.getException())); - } - }); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void updateProfile( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull GeneratedAndroidFirebaseAuth.InternalUserProfile profile, - @NonNull - GeneratedAndroidFirebaseAuth.Result - result) { - FirebaseUser firebaseUser = getCurrentUserFromPigeon(app); - - if (firebaseUser == null) { - result.error(FlutterFirebaseAuthPluginException.noUser()); - return; - } - - UserProfileChangeRequest.Builder builder = new UserProfileChangeRequest.Builder(); - - if (profile.getDisplayNameChanged()) { - builder.setDisplayName(profile.getDisplayName()); - } - - if (profile.getPhotoUrlChanged()) { - if (profile.getPhotoUrl() != null) { - builder.setPhotoUri(Uri.parse(profile.getPhotoUrl())); - } else { - builder.setPhotoUri(null); - } - } - - firebaseUser - .updateProfile(builder.build()) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - firebaseUser - .reload() - .addOnCompleteListener( - reloadTask -> { - if (reloadTask.isSuccessful()) { - result.success(PigeonParser.parseFirebaseUser(firebaseUser)); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - reloadTask.getException())); - } - }); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void verifyBeforeUpdateEmail( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull String newEmail, - @Nullable GeneratedAndroidFirebaseAuth.InternalActionCodeSettings actionCodeSettings, - @NonNull GeneratedAndroidFirebaseAuth.VoidResult result) { - FirebaseUser firebaseUser = getCurrentUserFromPigeon(app); - - if (firebaseUser == null) { - result.error(FlutterFirebaseAuthPluginException.noUser()); - return; - } - - if (actionCodeSettings == null) { - firebaseUser - .verifyBeforeUpdateEmail(newEmail) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - result.success(); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - return; - } - - firebaseUser - .verifyBeforeUpdateEmail(newEmail, PigeonParser.getActionCodeSettings(actionCodeSettings)) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - result.success(); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } -} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseMultiFactor.java b/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseMultiFactor.java deleted file mode 100644 index 1ba51914254e..000000000000 --- a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseMultiFactor.java +++ /dev/null @@ -1,252 +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. - */ - -package io.flutter.plugins.firebase.auth; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.firebase.auth.AuthResult; -import com.google.firebase.auth.FirebaseUser; -import com.google.firebase.auth.MultiFactor; -import com.google.firebase.auth.MultiFactorAssertion; -import com.google.firebase.auth.MultiFactorInfo; -import com.google.firebase.auth.MultiFactorResolver; -import com.google.firebase.auth.MultiFactorSession; -import com.google.firebase.auth.PhoneAuthCredential; -import com.google.firebase.auth.PhoneAuthProvider; -import com.google.firebase.auth.PhoneMultiFactorGenerator; -import com.google.firebase.internal.api.FirebaseNoSignedInUserException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -public class FlutterFirebaseMultiFactor - implements GeneratedAndroidFirebaseAuth.MultiFactorUserHostApi, - GeneratedAndroidFirebaseAuth.MultiFactoResolverHostApi { - - // Map an app id to a map of user id to a MultiFactorUser object. - static final Map> multiFactorUserMap = new HashMap<>(); - - // Map an id to a MultiFactorSession object. - static final Map multiFactorSessionMap = new HashMap<>(); - - // Map an id to a MultiFactorResolver object. - static final Map multiFactorResolverMap = new HashMap<>(); - - static final Map multiFactorAssertionMap = new HashMap<>(); - - MultiFactor getAppMultiFactor(@NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app) - throws FirebaseNoSignedInUserException { - final FirebaseUser currentUser = FlutterFirebaseAuthUser.getCurrentUserFromPigeon(app); - if (currentUser == null) { - throw new FirebaseNoSignedInUserException("No user is signed in"); - } - if (multiFactorUserMap.get(app.getAppName()) == null) { - multiFactorUserMap.put(app.getAppName(), new HashMap<>()); - } - - final Map appMultiFactorUser = multiFactorUserMap.get(app.getAppName()); - if (appMultiFactorUser.get(currentUser.getUid()) == null) { - appMultiFactorUser.put(currentUser.getUid(), currentUser.getMultiFactor()); - } - - return appMultiFactorUser.get(currentUser.getUid()); - } - - @Override - public void enrollPhone( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull GeneratedAndroidFirebaseAuth.InternalPhoneMultiFactorAssertion assertion, - @Nullable String displayName, - @NonNull GeneratedAndroidFirebaseAuth.VoidResult result) { - final MultiFactor multiFactor; - try { - multiFactor = getAppMultiFactor(app); - } catch (FirebaseNoSignedInUserException e) { - result.error(e); - return; - } - - PhoneAuthCredential credential = - PhoneAuthProvider.getCredential( - assertion.getVerificationId(), assertion.getVerificationCode()); - - MultiFactorAssertion multiFactorAssertion = PhoneMultiFactorGenerator.getAssertion(credential); - - multiFactor - .enroll(multiFactorAssertion, displayName) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - result.success(); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void enrollTotp( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull String assertionId, - @Nullable String displayName, - @NonNull GeneratedAndroidFirebaseAuth.VoidResult result) { - final MultiFactor multiFactor; - try { - multiFactor = getAppMultiFactor(app); - } catch (FirebaseNoSignedInUserException e) { - result.error(e); - return; - } - - final MultiFactorAssertion multiFactorAssertion = multiFactorAssertionMap.get(assertionId); - - assert multiFactorAssertion != null; - multiFactor - .enroll(multiFactorAssertion, displayName) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - result.success(); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void getSession( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull - GeneratedAndroidFirebaseAuth.Result< - GeneratedAndroidFirebaseAuth.InternalMultiFactorSession> - result) { - final MultiFactor multiFactor; - try { - multiFactor = getAppMultiFactor(app); - } catch (FirebaseNoSignedInUserException e) { - result.error(e); - return; - } - - multiFactor - .getSession() - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - final MultiFactorSession sessionResult = task.getResult(); - final String id = UUID.randomUUID().toString(); - multiFactorSessionMap.put(id, sessionResult); - result.success( - new GeneratedAndroidFirebaseAuth.InternalMultiFactorSession.Builder() - .setId(id) - .build()); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void unenroll( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull String factorUid, - @NonNull GeneratedAndroidFirebaseAuth.VoidResult result) { - final MultiFactor multiFactor; - try { - multiFactor = getAppMultiFactor(app); - } catch (FirebaseNoSignedInUserException e) { - result.error(FlutterFirebaseAuthPluginException.parserExceptionToFlutter(e)); - return; - } - - multiFactor - .unenroll(factorUid) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - result.success(); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void getEnrolledFactors( - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull - GeneratedAndroidFirebaseAuth.Result< - List> - result) { - final MultiFactor multiFactor; - try { - multiFactor = getAppMultiFactor(app); - } catch (FirebaseNoSignedInUserException e) { - result.error(e); - return; - } - - final List factors = multiFactor.getEnrolledFactors(); - - final List resultFactors = - PigeonParser.multiFactorInfoToPigeon(factors); - - result.success(resultFactors); - } - - @Override - public void resolveSignIn( - @NonNull String resolverId, - @Nullable GeneratedAndroidFirebaseAuth.InternalPhoneMultiFactorAssertion assertion, - @Nullable String totpAssertionId, - @NonNull - GeneratedAndroidFirebaseAuth.Result - result) { - final MultiFactorResolver resolver = multiFactorResolverMap.get(resolverId); - - if (resolver == null) { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - new Exception("Resolver not found"))); - return; - } - - MultiFactorAssertion multiFactorAssertion; - - if (assertion != null) { - PhoneAuthCredential credential = - PhoneAuthProvider.getCredential( - assertion.getVerificationId(), assertion.getVerificationCode()); - multiFactorAssertion = PhoneMultiFactorGenerator.getAssertion(credential); - } else { - multiFactorAssertion = multiFactorAssertionMap.get(totpAssertionId); - } - - resolver - .resolveSignIn(multiFactorAssertion) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - final AuthResult authResult = task.getResult(); - result.success(PigeonParser.parseAuthResult(authResult)); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } -} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseTotpMultiFactor.java b/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseTotpMultiFactor.java deleted file mode 100644 index 9761a5df73f2..000000000000 --- a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseTotpMultiFactor.java +++ /dev/null @@ -1,82 +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. - */ - -package io.flutter.plugins.firebase.auth; - -import androidx.annotation.NonNull; -import com.google.firebase.auth.MultiFactorSession; -import com.google.firebase.auth.TotpMultiFactorAssertion; -import com.google.firebase.auth.TotpMultiFactorGenerator; -import com.google.firebase.auth.TotpSecret; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -public class FlutterFirebaseTotpMultiFactor - implements GeneratedAndroidFirebaseAuth.MultiFactorTotpHostApi { - - // Map an app id to a map of user id to a TotpSecret object. - static final Map multiFactorSecret = new HashMap<>(); - - @Override - public void generateSecret( - @NonNull String sessionId, - @NonNull - GeneratedAndroidFirebaseAuth.Result - result) { - MultiFactorSession multiFactorSession = - FlutterFirebaseMultiFactor.multiFactorSessionMap.get(sessionId); - - assert multiFactorSession != null; - TotpMultiFactorGenerator.generateSecret(multiFactorSession) - .addOnCompleteListener( - task -> { - if (task.isSuccessful()) { - TotpSecret secret = task.getResult(); - multiFactorSecret.put(secret.getSharedSecretKey(), secret); - result.success( - new GeneratedAndroidFirebaseAuth.InternalTotpSecret.Builder() - .setCodeIntervalSeconds((long) secret.getCodeIntervalSeconds()) - .setCodeLength((long) secret.getCodeLength()) - .setSecretKey(secret.getSharedSecretKey()) - .setHashingAlgorithm(secret.getHashAlgorithm()) - .setEnrollmentCompletionDeadline(secret.getEnrollmentCompletionDeadline()) - .build()); - } else { - result.error( - FlutterFirebaseAuthPluginException.parserExceptionToFlutter( - task.getException())); - } - }); - } - - @Override - public void getAssertionForEnrollment( - @NonNull String secretKey, - @NonNull String oneTimePassword, - @NonNull GeneratedAndroidFirebaseAuth.Result result) { - final TotpSecret secret = multiFactorSecret.get(secretKey); - - assert secret != null; - TotpMultiFactorAssertion assertion = - TotpMultiFactorGenerator.getAssertionForEnrollment(secret, oneTimePassword); - String assertionId = UUID.randomUUID().toString(); - FlutterFirebaseMultiFactor.multiFactorAssertionMap.put(assertionId, assertion); - result.success(assertionId); - } - - @Override - public void getAssertionForSignIn( - @NonNull String enrollmentId, - @NonNull String oneTimePassword, - @NonNull GeneratedAndroidFirebaseAuth.Result result) { - TotpMultiFactorAssertion assertion = - TotpMultiFactorGenerator.getAssertionForSignIn(enrollmentId, oneTimePassword); - String assertionId = UUID.randomUUID().toString(); - FlutterFirebaseMultiFactor.multiFactorAssertionMap.put(assertionId, assertion); - result.success(assertionId); - } -} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseTotpSecret.java b/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseTotpSecret.java deleted file mode 100644 index 5b32f82826dd..000000000000 --- a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseTotpSecret.java +++ /dev/null @@ -1,42 +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. - */ - -package io.flutter.plugins.firebase.auth; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.firebase.auth.TotpSecret; - -public class FlutterFirebaseTotpSecret - implements GeneratedAndroidFirebaseAuth.MultiFactorTotpSecretHostApi { - - @Override - public void generateQrCodeUrl( - @NonNull String secretKey, - @Nullable String accountName, - @Nullable String issuer, - @NonNull GeneratedAndroidFirebaseAuth.Result result) { - final TotpSecret secret = FlutterFirebaseTotpMultiFactor.multiFactorSecret.get(secretKey); - - assert secret != null; - if (accountName == null || issuer == null) { - result.success(secret.generateQrCodeUrl()); - return; - } - result.success(secret.generateQrCodeUrl(accountName, issuer)); - } - - @Override - public void openInOtpApp( - @NonNull String secretKey, - @NonNull String qrCodeUrl, - @NonNull GeneratedAndroidFirebaseAuth.VoidResult result) { - final TotpSecret secret = FlutterFirebaseTotpMultiFactor.multiFactorSecret.get(secretKey); - assert secret != null; - secret.openInOtpApp(qrCodeUrl); - result.success(); - } -} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/GeneratedAndroidFirebaseAuth.java b/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/GeneratedAndroidFirebaseAuth.java deleted file mode 100644 index 5aaa168b70e8..000000000000 --- a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/GeneratedAndroidFirebaseAuth.java +++ /dev/null @@ -1,5308 +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 - -package io.flutter.plugins.firebase.auth; - -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.RetentionPolicy.CLASS; - -import android.util.Log; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import io.flutter.plugin.common.BasicMessageChannel; -import io.flutter.plugin.common.BinaryMessenger; -import io.flutter.plugin.common.MessageCodec; -import io.flutter.plugin.common.StandardMessageCodec; -import java.io.ByteArrayOutputStream; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -/** Generated class from Pigeon. */ -@SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression", "serial"}) -public class GeneratedAndroidFirebaseAuth { - static boolean pigeonDoubleEquals(double a, double b) { - // Normalize -0.0 to 0.0 and handle NaN equality. - return (a == 0.0 ? 0.0 : a) == (b == 0.0 ? 0.0 : b) || (Double.isNaN(a) && Double.isNaN(b)); - } - - static boolean pigeonFloatEquals(float a, float b) { - // Normalize -0.0 to 0.0 and handle NaN equality. - return (a == 0.0f ? 0.0f : a) == (b == 0.0f ? 0.0f : b) || (Float.isNaN(a) && Float.isNaN(b)); - } - - static int pigeonDoubleHashCode(double d) { - // Normalize -0.0 to 0.0 and handle NaN to ensure consistent hash codes. - if (d == 0.0) { - d = 0.0; - } - long bits = Double.doubleToLongBits(d); - return (int) (bits ^ (bits >>> 32)); - } - - static int pigeonFloatHashCode(float f) { - // Normalize -0.0 to 0.0 and handle NaN to ensure consistent hash codes. - if (f == 0.0f) { - f = 0.0f; - } - return Float.floatToIntBits(f); - } - - static boolean pigeonDeepEquals(Object a, Object b) { - if (a == b) { - return true; - } - if (a == null || b == null) { - return false; - } - if (a instanceof byte[] && b instanceof byte[]) { - return Arrays.equals((byte[]) a, (byte[]) b); - } - if (a instanceof int[] && b instanceof int[]) { - return Arrays.equals((int[]) a, (int[]) b); - } - if (a instanceof long[] && b instanceof long[]) { - return Arrays.equals((long[]) a, (long[]) b); - } - if (a instanceof double[] && b instanceof double[]) { - double[] da = (double[]) a; - double[] db = (double[]) b; - if (da.length != db.length) { - return false; - } - for (int i = 0; i < da.length; i++) { - if (!pigeonDoubleEquals(da[i], db[i])) { - return false; - } - } - return true; - } - if (a instanceof List && b instanceof List) { - List listA = (List) a; - List listB = (List) b; - if (listA.size() != listB.size()) { - return false; - } - for (int i = 0; i < listA.size(); i++) { - if (!pigeonDeepEquals(listA.get(i), listB.get(i))) { - return false; - } - } - return true; - } - if (a instanceof Map && b instanceof Map) { - Map mapA = (Map) a; - Map mapB = (Map) b; - if (mapA.size() != mapB.size()) { - return false; - } - for (Map.Entry entryA : mapA.entrySet()) { - Object keyA = entryA.getKey(); - Object valueA = entryA.getValue(); - boolean found = false; - for (Map.Entry entryB : mapB.entrySet()) { - Object keyB = entryB.getKey(); - if (pigeonDeepEquals(keyA, keyB)) { - Object valueB = entryB.getValue(); - if (pigeonDeepEquals(valueA, valueB)) { - found = true; - break; - } else { - return false; - } - } - } - if (!found) { - return false; - } - } - return true; - } - if (a instanceof Double && b instanceof Double) { - return pigeonDoubleEquals((double) a, (double) b); - } - if (a instanceof Float && b instanceof Float) { - return pigeonFloatEquals((float) a, (float) b); - } - return a.equals(b); - } - - static int pigeonDeepHashCode(Object value) { - if (value == null) { - return 0; - } - if (value instanceof byte[]) { - return Arrays.hashCode((byte[]) value); - } - if (value instanceof int[]) { - return Arrays.hashCode((int[]) value); - } - if (value instanceof long[]) { - return Arrays.hashCode((long[]) value); - } - if (value instanceof double[]) { - double[] da = (double[]) value; - int result = 1; - for (double d : da) { - result = 31 * result + pigeonDoubleHashCode(d); - } - return result; - } - if (value instanceof List) { - int result = 1; - for (Object item : (List) value) { - result = 31 * result + pigeonDeepHashCode(item); - } - return result; - } - if (value instanceof Map) { - int result = 0; - for (Map.Entry entry : ((Map) value).entrySet()) { - result += - ((pigeonDeepHashCode(entry.getKey()) * 31) ^ pigeonDeepHashCode(entry.getValue())); - } - return result; - } - if (value instanceof Object[]) { - int result = 1; - for (Object item : (Object[]) value) { - result = 31 * result + pigeonDeepHashCode(item); - } - return result; - } - if (value instanceof Double) { - return pigeonDoubleHashCode((double) value); - } - if (value instanceof Float) { - return pigeonFloatHashCode((float) value); - } - return value.hashCode(); - } - - /** Error class for passing custom error details to Flutter via a thrown PlatformException. */ - public static class FlutterError extends RuntimeException { - - /** The error code. */ - public final String code; - - /** The error details. Must be a datatype supported by the api codec. */ - public final Object details; - - public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) { - super(message); - this.code = code; - this.details = details; - } - } - - @NonNull - protected static ArrayList wrapError(@NonNull Throwable exception) { - ArrayList errorList = new ArrayList<>(3); - if (exception instanceof FlutterError) { - FlutterError error = (FlutterError) exception; - errorList.add(error.code); - errorList.add(error.getMessage()); - errorList.add(error.details); - } else { - errorList.add(exception.toString()); - errorList.add(exception.getClass().getSimpleName()); - errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); - } - return errorList; - } - - @Target(METHOD) - @Retention(CLASS) - @interface CanIgnoreReturnValue {} - - /** The type of operation that generated the action code from calling [checkActionCode]. */ - public enum ActionCodeInfoOperation { - /** Unknown operation. */ - UNKNOWN(0), - /** Password reset code generated via [sendPasswordResetEmail]. */ - PASSWORD_RESET(1), - /** Email verification code generated via [User.sendEmailVerification]. */ - VERIFY_EMAIL(2), - /** Email change revocation code generated via [User.updateEmail]. */ - RECOVER_EMAIL(3), - /** Email sign in code generated via [sendSignInLinkToEmail]. */ - EMAIL_SIGN_IN(4), - /** Verify and change email code generated via [User.verifyBeforeUpdateEmail]. */ - VERIFY_AND_CHANGE_EMAIL(5), - /** Action code for reverting second factor addition. */ - REVERT_SECOND_FACTOR_ADDITION(6); - - final int index; - - ActionCodeInfoOperation(final int index) { - this.index = index; - } - } - - /** Generated class from Pigeon that represents data sent in messages. */ - public static final class InternalMultiFactorSession { - private @NonNull String id; - - public @NonNull String getId() { - return id; - } - - public void setId(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"id\" is null."); - } - this.id = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - InternalMultiFactorSession() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InternalMultiFactorSession that = (InternalMultiFactorSession) o; - return pigeonDeepEquals(id, that.id); - } - - @Override - public int hashCode() { - Object[] fields = new Object[] {getClass(), id}; - return pigeonDeepHashCode(fields); - } - - public static final class Builder { - - private @Nullable String id; - - @CanIgnoreReturnValue - public @NonNull Builder setId(@NonNull String setterArg) { - this.id = setterArg; - return this; - } - - public @NonNull InternalMultiFactorSession build() { - InternalMultiFactorSession pigeonReturn = new InternalMultiFactorSession(); - pigeonReturn.setId(id); - return pigeonReturn; - } - } - - @NonNull - public ArrayList toList() { - ArrayList toListResult = new ArrayList<>(1); - toListResult.add(id); - return toListResult; - } - - static @NonNull InternalMultiFactorSession fromList(@NonNull ArrayList pigeonVar_list) { - InternalMultiFactorSession pigeonResult = new InternalMultiFactorSession(); - Object id = pigeonVar_list.get(0); - pigeonResult.setId((String) id); - return pigeonResult; - } - } - - /** Generated class from Pigeon that represents data sent in messages. */ - public static final class InternalPhoneMultiFactorAssertion { - private @NonNull String verificationId; - - public @NonNull String getVerificationId() { - return verificationId; - } - - public void setVerificationId(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"verificationId\" is null."); - } - this.verificationId = setterArg; - } - - private @NonNull String verificationCode; - - public @NonNull String getVerificationCode() { - return verificationCode; - } - - public void setVerificationCode(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"verificationCode\" is null."); - } - this.verificationCode = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - InternalPhoneMultiFactorAssertion() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InternalPhoneMultiFactorAssertion that = (InternalPhoneMultiFactorAssertion) o; - return pigeonDeepEquals(verificationId, that.verificationId) - && pigeonDeepEquals(verificationCode, that.verificationCode); - } - - @Override - public int hashCode() { - Object[] fields = new Object[] {getClass(), verificationId, verificationCode}; - return pigeonDeepHashCode(fields); - } - - public static final class Builder { - - private @Nullable String verificationId; - - @CanIgnoreReturnValue - public @NonNull Builder setVerificationId(@NonNull String setterArg) { - this.verificationId = setterArg; - return this; - } - - private @Nullable String verificationCode; - - @CanIgnoreReturnValue - public @NonNull Builder setVerificationCode(@NonNull String setterArg) { - this.verificationCode = setterArg; - return this; - } - - public @NonNull InternalPhoneMultiFactorAssertion build() { - InternalPhoneMultiFactorAssertion pigeonReturn = new InternalPhoneMultiFactorAssertion(); - pigeonReturn.setVerificationId(verificationId); - pigeonReturn.setVerificationCode(verificationCode); - return pigeonReturn; - } - } - - @NonNull - public ArrayList toList() { - ArrayList toListResult = new ArrayList<>(2); - toListResult.add(verificationId); - toListResult.add(verificationCode); - return toListResult; - } - - static @NonNull InternalPhoneMultiFactorAssertion fromList( - @NonNull ArrayList pigeonVar_list) { - InternalPhoneMultiFactorAssertion pigeonResult = new InternalPhoneMultiFactorAssertion(); - Object verificationId = pigeonVar_list.get(0); - pigeonResult.setVerificationId((String) verificationId); - Object verificationCode = pigeonVar_list.get(1); - pigeonResult.setVerificationCode((String) verificationCode); - return pigeonResult; - } - } - - /** Generated class from Pigeon that represents data sent in messages. */ - public static final class InternalMultiFactorInfo { - private @Nullable String displayName; - - public @Nullable String getDisplayName() { - return displayName; - } - - public void setDisplayName(@Nullable String setterArg) { - this.displayName = setterArg; - } - - private @NonNull Double enrollmentTimestamp; - - public @NonNull Double getEnrollmentTimestamp() { - return enrollmentTimestamp; - } - - public void setEnrollmentTimestamp(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"enrollmentTimestamp\" is null."); - } - this.enrollmentTimestamp = setterArg; - } - - private @Nullable String factorId; - - public @Nullable String getFactorId() { - return factorId; - } - - public void setFactorId(@Nullable String setterArg) { - this.factorId = setterArg; - } - - private @NonNull String uid; - - public @NonNull String getUid() { - return uid; - } - - public void setUid(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"uid\" is null."); - } - this.uid = setterArg; - } - - private @Nullable String phoneNumber; - - public @Nullable String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(@Nullable String setterArg) { - this.phoneNumber = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - InternalMultiFactorInfo() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InternalMultiFactorInfo that = (InternalMultiFactorInfo) o; - return pigeonDeepEquals(displayName, that.displayName) - && pigeonDeepEquals(enrollmentTimestamp, that.enrollmentTimestamp) - && pigeonDeepEquals(factorId, that.factorId) - && pigeonDeepEquals(uid, that.uid) - && pigeonDeepEquals(phoneNumber, that.phoneNumber); - } - - @Override - public int hashCode() { - Object[] fields = - new Object[] {getClass(), displayName, enrollmentTimestamp, factorId, uid, phoneNumber}; - return pigeonDeepHashCode(fields); - } - - public static final class Builder { - - private @Nullable String displayName; - - @CanIgnoreReturnValue - public @NonNull Builder setDisplayName(@Nullable String setterArg) { - this.displayName = setterArg; - return this; - } - - private @Nullable Double enrollmentTimestamp; - - @CanIgnoreReturnValue - public @NonNull Builder setEnrollmentTimestamp(@NonNull Double setterArg) { - this.enrollmentTimestamp = setterArg; - return this; - } - - private @Nullable String factorId; - - @CanIgnoreReturnValue - public @NonNull Builder setFactorId(@Nullable String setterArg) { - this.factorId = setterArg; - return this; - } - - private @Nullable String uid; - - @CanIgnoreReturnValue - public @NonNull Builder setUid(@NonNull String setterArg) { - this.uid = setterArg; - return this; - } - - private @Nullable String phoneNumber; - - @CanIgnoreReturnValue - public @NonNull Builder setPhoneNumber(@Nullable String setterArg) { - this.phoneNumber = setterArg; - return this; - } - - public @NonNull InternalMultiFactorInfo build() { - InternalMultiFactorInfo pigeonReturn = new InternalMultiFactorInfo(); - pigeonReturn.setDisplayName(displayName); - pigeonReturn.setEnrollmentTimestamp(enrollmentTimestamp); - pigeonReturn.setFactorId(factorId); - pigeonReturn.setUid(uid); - pigeonReturn.setPhoneNumber(phoneNumber); - return pigeonReturn; - } - } - - @NonNull - public ArrayList toList() { - ArrayList toListResult = new ArrayList<>(5); - toListResult.add(displayName); - toListResult.add(enrollmentTimestamp); - toListResult.add(factorId); - toListResult.add(uid); - toListResult.add(phoneNumber); - return toListResult; - } - - static @NonNull InternalMultiFactorInfo fromList(@NonNull ArrayList pigeonVar_list) { - InternalMultiFactorInfo pigeonResult = new InternalMultiFactorInfo(); - Object displayName = pigeonVar_list.get(0); - pigeonResult.setDisplayName((String) displayName); - Object enrollmentTimestamp = pigeonVar_list.get(1); - pigeonResult.setEnrollmentTimestamp((Double) enrollmentTimestamp); - Object factorId = pigeonVar_list.get(2); - pigeonResult.setFactorId((String) factorId); - Object uid = pigeonVar_list.get(3); - pigeonResult.setUid((String) uid); - Object phoneNumber = pigeonVar_list.get(4); - pigeonResult.setPhoneNumber((String) phoneNumber); - return pigeonResult; - } - } - - /** Generated class from Pigeon that represents data sent in messages. */ - public static final class AuthPigeonFirebaseApp { - private @NonNull String appName; - - public @NonNull String getAppName() { - return appName; - } - - public void setAppName(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"appName\" is null."); - } - this.appName = setterArg; - } - - private @Nullable String tenantId; - - public @Nullable String getTenantId() { - return tenantId; - } - - public void setTenantId(@Nullable String setterArg) { - this.tenantId = setterArg; - } - - private @Nullable String customAuthDomain; - - public @Nullable String getCustomAuthDomain() { - return customAuthDomain; - } - - public void setCustomAuthDomain(@Nullable String setterArg) { - this.customAuthDomain = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - AuthPigeonFirebaseApp() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AuthPigeonFirebaseApp that = (AuthPigeonFirebaseApp) o; - return pigeonDeepEquals(appName, that.appName) - && pigeonDeepEquals(tenantId, that.tenantId) - && pigeonDeepEquals(customAuthDomain, that.customAuthDomain); - } - - @Override - public int hashCode() { - Object[] fields = new Object[] {getClass(), appName, tenantId, customAuthDomain}; - return pigeonDeepHashCode(fields); - } - - public static final class Builder { - - private @Nullable String appName; - - @CanIgnoreReturnValue - public @NonNull Builder setAppName(@NonNull String setterArg) { - this.appName = setterArg; - return this; - } - - private @Nullable String tenantId; - - @CanIgnoreReturnValue - public @NonNull Builder setTenantId(@Nullable String setterArg) { - this.tenantId = setterArg; - return this; - } - - private @Nullable String customAuthDomain; - - @CanIgnoreReturnValue - public @NonNull Builder setCustomAuthDomain(@Nullable String setterArg) { - this.customAuthDomain = setterArg; - return this; - } - - public @NonNull AuthPigeonFirebaseApp build() { - AuthPigeonFirebaseApp pigeonReturn = new AuthPigeonFirebaseApp(); - pigeonReturn.setAppName(appName); - pigeonReturn.setTenantId(tenantId); - pigeonReturn.setCustomAuthDomain(customAuthDomain); - return pigeonReturn; - } - } - - @NonNull - public ArrayList toList() { - ArrayList toListResult = new ArrayList<>(3); - toListResult.add(appName); - toListResult.add(tenantId); - toListResult.add(customAuthDomain); - return toListResult; - } - - static @NonNull AuthPigeonFirebaseApp fromList(@NonNull ArrayList pigeonVar_list) { - AuthPigeonFirebaseApp pigeonResult = new AuthPigeonFirebaseApp(); - Object appName = pigeonVar_list.get(0); - pigeonResult.setAppName((String) appName); - Object tenantId = pigeonVar_list.get(1); - pigeonResult.setTenantId((String) tenantId); - Object customAuthDomain = pigeonVar_list.get(2); - pigeonResult.setCustomAuthDomain((String) customAuthDomain); - return pigeonResult; - } - } - - /** Generated class from Pigeon that represents data sent in messages. */ - public static final class InternalActionCodeInfoData { - private @Nullable String email; - - public @Nullable String getEmail() { - return email; - } - - public void setEmail(@Nullable String setterArg) { - this.email = setterArg; - } - - private @Nullable String previousEmail; - - public @Nullable String getPreviousEmail() { - return previousEmail; - } - - public void setPreviousEmail(@Nullable String setterArg) { - this.previousEmail = setterArg; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InternalActionCodeInfoData that = (InternalActionCodeInfoData) o; - return pigeonDeepEquals(email, that.email) - && pigeonDeepEquals(previousEmail, that.previousEmail); - } - - @Override - public int hashCode() { - Object[] fields = new Object[] {getClass(), email, previousEmail}; - return pigeonDeepHashCode(fields); - } - - public static final class Builder { - - private @Nullable String email; - - @CanIgnoreReturnValue - public @NonNull Builder setEmail(@Nullable String setterArg) { - this.email = setterArg; - return this; - } - - private @Nullable String previousEmail; - - @CanIgnoreReturnValue - public @NonNull Builder setPreviousEmail(@Nullable String setterArg) { - this.previousEmail = setterArg; - return this; - } - - public @NonNull InternalActionCodeInfoData build() { - InternalActionCodeInfoData pigeonReturn = new InternalActionCodeInfoData(); - pigeonReturn.setEmail(email); - pigeonReturn.setPreviousEmail(previousEmail); - return pigeonReturn; - } - } - - @NonNull - public ArrayList toList() { - ArrayList toListResult = new ArrayList<>(2); - toListResult.add(email); - toListResult.add(previousEmail); - return toListResult; - } - - static @NonNull InternalActionCodeInfoData fromList(@NonNull ArrayList pigeonVar_list) { - InternalActionCodeInfoData pigeonResult = new InternalActionCodeInfoData(); - Object email = pigeonVar_list.get(0); - pigeonResult.setEmail((String) email); - Object previousEmail = pigeonVar_list.get(1); - pigeonResult.setPreviousEmail((String) previousEmail); - return pigeonResult; - } - } - - /** Generated class from Pigeon that represents data sent in messages. */ - public static final class InternalActionCodeInfo { - private @NonNull ActionCodeInfoOperation operation; - - public @NonNull ActionCodeInfoOperation getOperation() { - return operation; - } - - public void setOperation(@NonNull ActionCodeInfoOperation setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"operation\" is null."); - } - this.operation = setterArg; - } - - private @NonNull InternalActionCodeInfoData data; - - public @NonNull InternalActionCodeInfoData getData() { - return data; - } - - public void setData(@NonNull InternalActionCodeInfoData setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"data\" is null."); - } - this.data = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - InternalActionCodeInfo() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InternalActionCodeInfo that = (InternalActionCodeInfo) o; - return pigeonDeepEquals(operation, that.operation) && pigeonDeepEquals(data, that.data); - } - - @Override - public int hashCode() { - Object[] fields = new Object[] {getClass(), operation, data}; - return pigeonDeepHashCode(fields); - } - - public static final class Builder { - - private @Nullable ActionCodeInfoOperation operation; - - @CanIgnoreReturnValue - public @NonNull Builder setOperation(@NonNull ActionCodeInfoOperation setterArg) { - this.operation = setterArg; - return this; - } - - private @Nullable InternalActionCodeInfoData data; - - @CanIgnoreReturnValue - public @NonNull Builder setData(@NonNull InternalActionCodeInfoData setterArg) { - this.data = setterArg; - return this; - } - - public @NonNull InternalActionCodeInfo build() { - InternalActionCodeInfo pigeonReturn = new InternalActionCodeInfo(); - pigeonReturn.setOperation(operation); - pigeonReturn.setData(data); - return pigeonReturn; - } - } - - @NonNull - public ArrayList toList() { - ArrayList toListResult = new ArrayList<>(2); - toListResult.add(operation); - toListResult.add(data); - return toListResult; - } - - static @NonNull InternalActionCodeInfo fromList(@NonNull ArrayList pigeonVar_list) { - InternalActionCodeInfo pigeonResult = new InternalActionCodeInfo(); - Object operation = pigeonVar_list.get(0); - pigeonResult.setOperation((ActionCodeInfoOperation) operation); - Object data = pigeonVar_list.get(1); - pigeonResult.setData((InternalActionCodeInfoData) data); - return pigeonResult; - } - } - - /** Generated class from Pigeon that represents data sent in messages. */ - public static final class InternalAdditionalUserInfo { - private @NonNull Boolean isNewUser; - - public @NonNull Boolean getIsNewUser() { - return isNewUser; - } - - public void setIsNewUser(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"isNewUser\" is null."); - } - this.isNewUser = setterArg; - } - - private @Nullable String providerId; - - public @Nullable String getProviderId() { - return providerId; - } - - public void setProviderId(@Nullable String setterArg) { - this.providerId = setterArg; - } - - private @Nullable String username; - - public @Nullable String getUsername() { - return username; - } - - public void setUsername(@Nullable String setterArg) { - this.username = setterArg; - } - - private @Nullable String authorizationCode; - - public @Nullable String getAuthorizationCode() { - return authorizationCode; - } - - public void setAuthorizationCode(@Nullable String setterArg) { - this.authorizationCode = setterArg; - } - - private @Nullable Map profile; - - public @Nullable Map getProfile() { - return profile; - } - - public void setProfile(@Nullable Map setterArg) { - this.profile = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - InternalAdditionalUserInfo() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InternalAdditionalUserInfo that = (InternalAdditionalUserInfo) o; - return pigeonDeepEquals(isNewUser, that.isNewUser) - && pigeonDeepEquals(providerId, that.providerId) - && pigeonDeepEquals(username, that.username) - && pigeonDeepEquals(authorizationCode, that.authorizationCode) - && pigeonDeepEquals(profile, that.profile); - } - - @Override - public int hashCode() { - Object[] fields = - new Object[] {getClass(), isNewUser, providerId, username, authorizationCode, profile}; - return pigeonDeepHashCode(fields); - } - - public static final class Builder { - - private @Nullable Boolean isNewUser; - - @CanIgnoreReturnValue - public @NonNull Builder setIsNewUser(@NonNull Boolean setterArg) { - this.isNewUser = setterArg; - return this; - } - - private @Nullable String providerId; - - @CanIgnoreReturnValue - public @NonNull Builder setProviderId(@Nullable String setterArg) { - this.providerId = setterArg; - return this; - } - - private @Nullable String username; - - @CanIgnoreReturnValue - public @NonNull Builder setUsername(@Nullable String setterArg) { - this.username = setterArg; - return this; - } - - private @Nullable String authorizationCode; - - @CanIgnoreReturnValue - public @NonNull Builder setAuthorizationCode(@Nullable String setterArg) { - this.authorizationCode = setterArg; - return this; - } - - private @Nullable Map profile; - - @CanIgnoreReturnValue - public @NonNull Builder setProfile(@Nullable Map setterArg) { - this.profile = setterArg; - return this; - } - - public @NonNull InternalAdditionalUserInfo build() { - InternalAdditionalUserInfo pigeonReturn = new InternalAdditionalUserInfo(); - pigeonReturn.setIsNewUser(isNewUser); - pigeonReturn.setProviderId(providerId); - pigeonReturn.setUsername(username); - pigeonReturn.setAuthorizationCode(authorizationCode); - pigeonReturn.setProfile(profile); - return pigeonReturn; - } - } - - @NonNull - public ArrayList toList() { - ArrayList toListResult = new ArrayList<>(5); - toListResult.add(isNewUser); - toListResult.add(providerId); - toListResult.add(username); - toListResult.add(authorizationCode); - toListResult.add(profile); - return toListResult; - } - - static @NonNull InternalAdditionalUserInfo fromList(@NonNull ArrayList pigeonVar_list) { - InternalAdditionalUserInfo pigeonResult = new InternalAdditionalUserInfo(); - Object isNewUser = pigeonVar_list.get(0); - pigeonResult.setIsNewUser((Boolean) isNewUser); - Object providerId = pigeonVar_list.get(1); - pigeonResult.setProviderId((String) providerId); - Object username = pigeonVar_list.get(2); - pigeonResult.setUsername((String) username); - Object authorizationCode = pigeonVar_list.get(3); - pigeonResult.setAuthorizationCode((String) authorizationCode); - Object profile = pigeonVar_list.get(4); - pigeonResult.setProfile((Map) profile); - return pigeonResult; - } - } - - /** Generated class from Pigeon that represents data sent in messages. */ - public static final class InternalAuthCredential { - private @NonNull String providerId; - - public @NonNull String getProviderId() { - return providerId; - } - - public void setProviderId(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"providerId\" is null."); - } - this.providerId = setterArg; - } - - private @NonNull String signInMethod; - - public @NonNull String getSignInMethod() { - return signInMethod; - } - - public void setSignInMethod(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"signInMethod\" is null."); - } - this.signInMethod = setterArg; - } - - private @NonNull Long nativeId; - - public @NonNull Long getNativeId() { - return nativeId; - } - - public void setNativeId(@NonNull Long setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"nativeId\" is null."); - } - this.nativeId = setterArg; - } - - private @Nullable String accessToken; - - public @Nullable String getAccessToken() { - return accessToken; - } - - public void setAccessToken(@Nullable String setterArg) { - this.accessToken = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - InternalAuthCredential() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InternalAuthCredential that = (InternalAuthCredential) o; - return pigeonDeepEquals(providerId, that.providerId) - && pigeonDeepEquals(signInMethod, that.signInMethod) - && pigeonDeepEquals(nativeId, that.nativeId) - && pigeonDeepEquals(accessToken, that.accessToken); - } - - @Override - public int hashCode() { - Object[] fields = new Object[] {getClass(), providerId, signInMethod, nativeId, accessToken}; - return pigeonDeepHashCode(fields); - } - - public static final class Builder { - - private @Nullable String providerId; - - @CanIgnoreReturnValue - public @NonNull Builder setProviderId(@NonNull String setterArg) { - this.providerId = setterArg; - return this; - } - - private @Nullable String signInMethod; - - @CanIgnoreReturnValue - public @NonNull Builder setSignInMethod(@NonNull String setterArg) { - this.signInMethod = setterArg; - return this; - } - - private @Nullable Long nativeId; - - @CanIgnoreReturnValue - public @NonNull Builder setNativeId(@NonNull Long setterArg) { - this.nativeId = setterArg; - return this; - } - - private @Nullable String accessToken; - - @CanIgnoreReturnValue - public @NonNull Builder setAccessToken(@Nullable String setterArg) { - this.accessToken = setterArg; - return this; - } - - public @NonNull InternalAuthCredential build() { - InternalAuthCredential pigeonReturn = new InternalAuthCredential(); - pigeonReturn.setProviderId(providerId); - pigeonReturn.setSignInMethod(signInMethod); - pigeonReturn.setNativeId(nativeId); - pigeonReturn.setAccessToken(accessToken); - return pigeonReturn; - } - } - - @NonNull - public ArrayList toList() { - ArrayList toListResult = new ArrayList<>(4); - toListResult.add(providerId); - toListResult.add(signInMethod); - toListResult.add(nativeId); - toListResult.add(accessToken); - return toListResult; - } - - static @NonNull InternalAuthCredential fromList(@NonNull ArrayList pigeonVar_list) { - InternalAuthCredential pigeonResult = new InternalAuthCredential(); - Object providerId = pigeonVar_list.get(0); - pigeonResult.setProviderId((String) providerId); - Object signInMethod = pigeonVar_list.get(1); - pigeonResult.setSignInMethod((String) signInMethod); - Object nativeId = pigeonVar_list.get(2); - pigeonResult.setNativeId((Long) nativeId); - Object accessToken = pigeonVar_list.get(3); - pigeonResult.setAccessToken((String) accessToken); - return pigeonResult; - } - } - - /** Generated class from Pigeon that represents data sent in messages. */ - public static final class InternalUserInfo { - private @NonNull String uid; - - public @NonNull String getUid() { - return uid; - } - - public void setUid(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"uid\" is null."); - } - this.uid = setterArg; - } - - private @Nullable String email; - - public @Nullable String getEmail() { - return email; - } - - public void setEmail(@Nullable String setterArg) { - this.email = setterArg; - } - - private @Nullable String displayName; - - public @Nullable String getDisplayName() { - return displayName; - } - - public void setDisplayName(@Nullable String setterArg) { - this.displayName = setterArg; - } - - private @Nullable String photoUrl; - - public @Nullable String getPhotoUrl() { - return photoUrl; - } - - public void setPhotoUrl(@Nullable String setterArg) { - this.photoUrl = setterArg; - } - - private @Nullable String phoneNumber; - - public @Nullable String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(@Nullable String setterArg) { - this.phoneNumber = setterArg; - } - - private @NonNull Boolean isAnonymous; - - public @NonNull Boolean getIsAnonymous() { - return isAnonymous; - } - - public void setIsAnonymous(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"isAnonymous\" is null."); - } - this.isAnonymous = setterArg; - } - - private @NonNull Boolean isEmailVerified; - - public @NonNull Boolean getIsEmailVerified() { - return isEmailVerified; - } - - public void setIsEmailVerified(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"isEmailVerified\" is null."); - } - this.isEmailVerified = setterArg; - } - - private @Nullable String providerId; - - public @Nullable String getProviderId() { - return providerId; - } - - public void setProviderId(@Nullable String setterArg) { - this.providerId = setterArg; - } - - private @Nullable String tenantId; - - public @Nullable String getTenantId() { - return tenantId; - } - - public void setTenantId(@Nullable String setterArg) { - this.tenantId = setterArg; - } - - private @Nullable String refreshToken; - - public @Nullable String getRefreshToken() { - return refreshToken; - } - - public void setRefreshToken(@Nullable String setterArg) { - this.refreshToken = setterArg; - } - - private @Nullable Long creationTimestamp; - - public @Nullable Long getCreationTimestamp() { - return creationTimestamp; - } - - public void setCreationTimestamp(@Nullable Long setterArg) { - this.creationTimestamp = setterArg; - } - - private @Nullable Long lastSignInTimestamp; - - public @Nullable Long getLastSignInTimestamp() { - return lastSignInTimestamp; - } - - public void setLastSignInTimestamp(@Nullable Long setterArg) { - this.lastSignInTimestamp = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - InternalUserInfo() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InternalUserInfo that = (InternalUserInfo) o; - return pigeonDeepEquals(uid, that.uid) - && pigeonDeepEquals(email, that.email) - && pigeonDeepEquals(displayName, that.displayName) - && pigeonDeepEquals(photoUrl, that.photoUrl) - && pigeonDeepEquals(phoneNumber, that.phoneNumber) - && pigeonDeepEquals(isAnonymous, that.isAnonymous) - && pigeonDeepEquals(isEmailVerified, that.isEmailVerified) - && pigeonDeepEquals(providerId, that.providerId) - && pigeonDeepEquals(tenantId, that.tenantId) - && pigeonDeepEquals(refreshToken, that.refreshToken) - && pigeonDeepEquals(creationTimestamp, that.creationTimestamp) - && pigeonDeepEquals(lastSignInTimestamp, that.lastSignInTimestamp); - } - - @Override - public int hashCode() { - Object[] fields = - new Object[] { - getClass(), - uid, - email, - displayName, - photoUrl, - phoneNumber, - isAnonymous, - isEmailVerified, - providerId, - tenantId, - refreshToken, - creationTimestamp, - lastSignInTimestamp - }; - return pigeonDeepHashCode(fields); - } - - public static final class Builder { - - private @Nullable String uid; - - @CanIgnoreReturnValue - public @NonNull Builder setUid(@NonNull String setterArg) { - this.uid = setterArg; - return this; - } - - private @Nullable String email; - - @CanIgnoreReturnValue - public @NonNull Builder setEmail(@Nullable String setterArg) { - this.email = setterArg; - return this; - } - - private @Nullable String displayName; - - @CanIgnoreReturnValue - public @NonNull Builder setDisplayName(@Nullable String setterArg) { - this.displayName = setterArg; - return this; - } - - private @Nullable String photoUrl; - - @CanIgnoreReturnValue - public @NonNull Builder setPhotoUrl(@Nullable String setterArg) { - this.photoUrl = setterArg; - return this; - } - - private @Nullable String phoneNumber; - - @CanIgnoreReturnValue - public @NonNull Builder setPhoneNumber(@Nullable String setterArg) { - this.phoneNumber = setterArg; - return this; - } - - private @Nullable Boolean isAnonymous; - - @CanIgnoreReturnValue - public @NonNull Builder setIsAnonymous(@NonNull Boolean setterArg) { - this.isAnonymous = setterArg; - return this; - } - - private @Nullable Boolean isEmailVerified; - - @CanIgnoreReturnValue - public @NonNull Builder setIsEmailVerified(@NonNull Boolean setterArg) { - this.isEmailVerified = setterArg; - return this; - } - - private @Nullable String providerId; - - @CanIgnoreReturnValue - public @NonNull Builder setProviderId(@Nullable String setterArg) { - this.providerId = setterArg; - return this; - } - - private @Nullable String tenantId; - - @CanIgnoreReturnValue - public @NonNull Builder setTenantId(@Nullable String setterArg) { - this.tenantId = setterArg; - return this; - } - - private @Nullable String refreshToken; - - @CanIgnoreReturnValue - public @NonNull Builder setRefreshToken(@Nullable String setterArg) { - this.refreshToken = setterArg; - return this; - } - - private @Nullable Long creationTimestamp; - - @CanIgnoreReturnValue - public @NonNull Builder setCreationTimestamp(@Nullable Long setterArg) { - this.creationTimestamp = setterArg; - return this; - } - - private @Nullable Long lastSignInTimestamp; - - @CanIgnoreReturnValue - public @NonNull Builder setLastSignInTimestamp(@Nullable Long setterArg) { - this.lastSignInTimestamp = setterArg; - return this; - } - - public @NonNull InternalUserInfo build() { - InternalUserInfo pigeonReturn = new InternalUserInfo(); - pigeonReturn.setUid(uid); - pigeonReturn.setEmail(email); - pigeonReturn.setDisplayName(displayName); - pigeonReturn.setPhotoUrl(photoUrl); - pigeonReturn.setPhoneNumber(phoneNumber); - pigeonReturn.setIsAnonymous(isAnonymous); - pigeonReturn.setIsEmailVerified(isEmailVerified); - pigeonReturn.setProviderId(providerId); - pigeonReturn.setTenantId(tenantId); - pigeonReturn.setRefreshToken(refreshToken); - pigeonReturn.setCreationTimestamp(creationTimestamp); - pigeonReturn.setLastSignInTimestamp(lastSignInTimestamp); - return pigeonReturn; - } - } - - @NonNull - public ArrayList toList() { - ArrayList toListResult = new ArrayList<>(12); - toListResult.add(uid); - toListResult.add(email); - toListResult.add(displayName); - toListResult.add(photoUrl); - toListResult.add(phoneNumber); - toListResult.add(isAnonymous); - toListResult.add(isEmailVerified); - toListResult.add(providerId); - toListResult.add(tenantId); - toListResult.add(refreshToken); - toListResult.add(creationTimestamp); - toListResult.add(lastSignInTimestamp); - return toListResult; - } - - static @NonNull InternalUserInfo fromList(@NonNull ArrayList pigeonVar_list) { - InternalUserInfo pigeonResult = new InternalUserInfo(); - Object uid = pigeonVar_list.get(0); - pigeonResult.setUid((String) uid); - Object email = pigeonVar_list.get(1); - pigeonResult.setEmail((String) email); - Object displayName = pigeonVar_list.get(2); - pigeonResult.setDisplayName((String) displayName); - Object photoUrl = pigeonVar_list.get(3); - pigeonResult.setPhotoUrl((String) photoUrl); - Object phoneNumber = pigeonVar_list.get(4); - pigeonResult.setPhoneNumber((String) phoneNumber); - Object isAnonymous = pigeonVar_list.get(5); - pigeonResult.setIsAnonymous((Boolean) isAnonymous); - Object isEmailVerified = pigeonVar_list.get(6); - pigeonResult.setIsEmailVerified((Boolean) isEmailVerified); - Object providerId = pigeonVar_list.get(7); - pigeonResult.setProviderId((String) providerId); - Object tenantId = pigeonVar_list.get(8); - pigeonResult.setTenantId((String) tenantId); - Object refreshToken = pigeonVar_list.get(9); - pigeonResult.setRefreshToken((String) refreshToken); - Object creationTimestamp = pigeonVar_list.get(10); - pigeonResult.setCreationTimestamp((Long) creationTimestamp); - Object lastSignInTimestamp = pigeonVar_list.get(11); - pigeonResult.setLastSignInTimestamp((Long) lastSignInTimestamp); - return pigeonResult; - } - } - - /** Generated class from Pigeon that represents data sent in messages. */ - public static final class InternalUserDetails { - private @NonNull InternalUserInfo userInfo; - - public @NonNull InternalUserInfo getUserInfo() { - return userInfo; - } - - public void setUserInfo(@NonNull InternalUserInfo setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"userInfo\" is null."); - } - this.userInfo = setterArg; - } - - private @NonNull List> providerData; - - public @NonNull List> getProviderData() { - return providerData; - } - - public void setProviderData(@NonNull List> setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"providerData\" is null."); - } - this.providerData = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - InternalUserDetails() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InternalUserDetails that = (InternalUserDetails) o; - return pigeonDeepEquals(userInfo, that.userInfo) - && pigeonDeepEquals(providerData, that.providerData); - } - - @Override - public int hashCode() { - Object[] fields = new Object[] {getClass(), userInfo, providerData}; - return pigeonDeepHashCode(fields); - } - - public static final class Builder { - - private @Nullable InternalUserInfo userInfo; - - @CanIgnoreReturnValue - public @NonNull Builder setUserInfo(@NonNull InternalUserInfo setterArg) { - this.userInfo = setterArg; - return this; - } - - private @Nullable List> providerData; - - @CanIgnoreReturnValue - public @NonNull Builder setProviderData(@NonNull List> setterArg) { - this.providerData = setterArg; - return this; - } - - public @NonNull InternalUserDetails build() { - InternalUserDetails pigeonReturn = new InternalUserDetails(); - pigeonReturn.setUserInfo(userInfo); - pigeonReturn.setProviderData(providerData); - return pigeonReturn; - } - } - - @NonNull - public ArrayList toList() { - ArrayList toListResult = new ArrayList<>(2); - toListResult.add(userInfo); - toListResult.add(providerData); - return toListResult; - } - - static @NonNull InternalUserDetails fromList(@NonNull ArrayList pigeonVar_list) { - InternalUserDetails pigeonResult = new InternalUserDetails(); - Object userInfo = pigeonVar_list.get(0); - pigeonResult.setUserInfo((InternalUserInfo) userInfo); - Object providerData = pigeonVar_list.get(1); - pigeonResult.setProviderData((List>) providerData); - return pigeonResult; - } - } - - /** Generated class from Pigeon that represents data sent in messages. */ - public static final class InternalUserCredential { - private @Nullable InternalUserDetails user; - - public @Nullable InternalUserDetails getUser() { - return user; - } - - public void setUser(@Nullable InternalUserDetails setterArg) { - this.user = setterArg; - } - - private @Nullable InternalAdditionalUserInfo additionalUserInfo; - - public @Nullable InternalAdditionalUserInfo getAdditionalUserInfo() { - return additionalUserInfo; - } - - public void setAdditionalUserInfo(@Nullable InternalAdditionalUserInfo setterArg) { - this.additionalUserInfo = setterArg; - } - - private @Nullable InternalAuthCredential credential; - - public @Nullable InternalAuthCredential getCredential() { - return credential; - } - - public void setCredential(@Nullable InternalAuthCredential setterArg) { - this.credential = setterArg; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InternalUserCredential that = (InternalUserCredential) o; - return pigeonDeepEquals(user, that.user) - && pigeonDeepEquals(additionalUserInfo, that.additionalUserInfo) - && pigeonDeepEquals(credential, that.credential); - } - - @Override - public int hashCode() { - Object[] fields = new Object[] {getClass(), user, additionalUserInfo, credential}; - return pigeonDeepHashCode(fields); - } - - public static final class Builder { - - private @Nullable InternalUserDetails user; - - @CanIgnoreReturnValue - public @NonNull Builder setUser(@Nullable InternalUserDetails setterArg) { - this.user = setterArg; - return this; - } - - private @Nullable InternalAdditionalUserInfo additionalUserInfo; - - @CanIgnoreReturnValue - public @NonNull Builder setAdditionalUserInfo( - @Nullable InternalAdditionalUserInfo setterArg) { - this.additionalUserInfo = setterArg; - return this; - } - - private @Nullable InternalAuthCredential credential; - - @CanIgnoreReturnValue - public @NonNull Builder setCredential(@Nullable InternalAuthCredential setterArg) { - this.credential = setterArg; - return this; - } - - public @NonNull InternalUserCredential build() { - InternalUserCredential pigeonReturn = new InternalUserCredential(); - pigeonReturn.setUser(user); - pigeonReturn.setAdditionalUserInfo(additionalUserInfo); - pigeonReturn.setCredential(credential); - return pigeonReturn; - } - } - - @NonNull - public ArrayList toList() { - ArrayList toListResult = new ArrayList<>(3); - toListResult.add(user); - toListResult.add(additionalUserInfo); - toListResult.add(credential); - return toListResult; - } - - static @NonNull InternalUserCredential fromList(@NonNull ArrayList pigeonVar_list) { - InternalUserCredential pigeonResult = new InternalUserCredential(); - Object user = pigeonVar_list.get(0); - pigeonResult.setUser((InternalUserDetails) user); - Object additionalUserInfo = pigeonVar_list.get(1); - pigeonResult.setAdditionalUserInfo((InternalAdditionalUserInfo) additionalUserInfo); - Object credential = pigeonVar_list.get(2); - pigeonResult.setCredential((InternalAuthCredential) credential); - return pigeonResult; - } - } - - /** Generated class from Pigeon that represents data sent in messages. */ - public static final class InternalAuthCredentialInput { - private @NonNull String providerId; - - public @NonNull String getProviderId() { - return providerId; - } - - public void setProviderId(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"providerId\" is null."); - } - this.providerId = setterArg; - } - - private @NonNull String signInMethod; - - public @NonNull String getSignInMethod() { - return signInMethod; - } - - public void setSignInMethod(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"signInMethod\" is null."); - } - this.signInMethod = setterArg; - } - - private @Nullable String token; - - public @Nullable String getToken() { - return token; - } - - public void setToken(@Nullable String setterArg) { - this.token = setterArg; - } - - private @Nullable String accessToken; - - public @Nullable String getAccessToken() { - return accessToken; - } - - public void setAccessToken(@Nullable String setterArg) { - this.accessToken = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - InternalAuthCredentialInput() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InternalAuthCredentialInput that = (InternalAuthCredentialInput) o; - return pigeonDeepEquals(providerId, that.providerId) - && pigeonDeepEquals(signInMethod, that.signInMethod) - && pigeonDeepEquals(token, that.token) - && pigeonDeepEquals(accessToken, that.accessToken); - } - - @Override - public int hashCode() { - Object[] fields = new Object[] {getClass(), providerId, signInMethod, token, accessToken}; - return pigeonDeepHashCode(fields); - } - - public static final class Builder { - - private @Nullable String providerId; - - @CanIgnoreReturnValue - public @NonNull Builder setProviderId(@NonNull String setterArg) { - this.providerId = setterArg; - return this; - } - - private @Nullable String signInMethod; - - @CanIgnoreReturnValue - public @NonNull Builder setSignInMethod(@NonNull String setterArg) { - this.signInMethod = setterArg; - return this; - } - - private @Nullable String token; - - @CanIgnoreReturnValue - public @NonNull Builder setToken(@Nullable String setterArg) { - this.token = setterArg; - return this; - } - - private @Nullable String accessToken; - - @CanIgnoreReturnValue - public @NonNull Builder setAccessToken(@Nullable String setterArg) { - this.accessToken = setterArg; - return this; - } - - public @NonNull InternalAuthCredentialInput build() { - InternalAuthCredentialInput pigeonReturn = new InternalAuthCredentialInput(); - pigeonReturn.setProviderId(providerId); - pigeonReturn.setSignInMethod(signInMethod); - pigeonReturn.setToken(token); - pigeonReturn.setAccessToken(accessToken); - return pigeonReturn; - } - } - - @NonNull - public ArrayList toList() { - ArrayList toListResult = new ArrayList<>(4); - toListResult.add(providerId); - toListResult.add(signInMethod); - toListResult.add(token); - toListResult.add(accessToken); - return toListResult; - } - - static @NonNull InternalAuthCredentialInput fromList( - @NonNull ArrayList pigeonVar_list) { - InternalAuthCredentialInput pigeonResult = new InternalAuthCredentialInput(); - Object providerId = pigeonVar_list.get(0); - pigeonResult.setProviderId((String) providerId); - Object signInMethod = pigeonVar_list.get(1); - pigeonResult.setSignInMethod((String) signInMethod); - Object token = pigeonVar_list.get(2); - pigeonResult.setToken((String) token); - Object accessToken = pigeonVar_list.get(3); - pigeonResult.setAccessToken((String) accessToken); - return pigeonResult; - } - } - - /** Generated class from Pigeon that represents data sent in messages. */ - public static final class InternalActionCodeSettings { - private @NonNull String url; - - public @NonNull String getUrl() { - return url; - } - - public void setUrl(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"url\" is null."); - } - this.url = setterArg; - } - - private @Nullable String dynamicLinkDomain; - - public @Nullable String getDynamicLinkDomain() { - return dynamicLinkDomain; - } - - public void setDynamicLinkDomain(@Nullable String setterArg) { - this.dynamicLinkDomain = setterArg; - } - - private @NonNull Boolean handleCodeInApp; - - public @NonNull Boolean getHandleCodeInApp() { - return handleCodeInApp; - } - - public void setHandleCodeInApp(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"handleCodeInApp\" is null."); - } - this.handleCodeInApp = setterArg; - } - - private @Nullable String iOSBundleId; - - public @Nullable String getIOSBundleId() { - return iOSBundleId; - } - - public void setIOSBundleId(@Nullable String setterArg) { - this.iOSBundleId = setterArg; - } - - private @Nullable String androidPackageName; - - public @Nullable String getAndroidPackageName() { - return androidPackageName; - } - - public void setAndroidPackageName(@Nullable String setterArg) { - this.androidPackageName = setterArg; - } - - private @NonNull Boolean androidInstallApp; - - public @NonNull Boolean getAndroidInstallApp() { - return androidInstallApp; - } - - public void setAndroidInstallApp(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"androidInstallApp\" is null."); - } - this.androidInstallApp = setterArg; - } - - private @Nullable String androidMinimumVersion; - - public @Nullable String getAndroidMinimumVersion() { - return androidMinimumVersion; - } - - public void setAndroidMinimumVersion(@Nullable String setterArg) { - this.androidMinimumVersion = setterArg; - } - - private @Nullable String linkDomain; - - public @Nullable String getLinkDomain() { - return linkDomain; - } - - public void setLinkDomain(@Nullable String setterArg) { - this.linkDomain = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - InternalActionCodeSettings() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InternalActionCodeSettings that = (InternalActionCodeSettings) o; - return pigeonDeepEquals(url, that.url) - && pigeonDeepEquals(dynamicLinkDomain, that.dynamicLinkDomain) - && pigeonDeepEquals(handleCodeInApp, that.handleCodeInApp) - && pigeonDeepEquals(iOSBundleId, that.iOSBundleId) - && pigeonDeepEquals(androidPackageName, that.androidPackageName) - && pigeonDeepEquals(androidInstallApp, that.androidInstallApp) - && pigeonDeepEquals(androidMinimumVersion, that.androidMinimumVersion) - && pigeonDeepEquals(linkDomain, that.linkDomain); - } - - @Override - public int hashCode() { - Object[] fields = - new Object[] { - getClass(), - url, - dynamicLinkDomain, - handleCodeInApp, - iOSBundleId, - androidPackageName, - androidInstallApp, - androidMinimumVersion, - linkDomain - }; - return pigeonDeepHashCode(fields); - } - - public static final class Builder { - - private @Nullable String url; - - @CanIgnoreReturnValue - public @NonNull Builder setUrl(@NonNull String setterArg) { - this.url = setterArg; - return this; - } - - private @Nullable String dynamicLinkDomain; - - @CanIgnoreReturnValue - public @NonNull Builder setDynamicLinkDomain(@Nullable String setterArg) { - this.dynamicLinkDomain = setterArg; - return this; - } - - private @Nullable Boolean handleCodeInApp; - - @CanIgnoreReturnValue - public @NonNull Builder setHandleCodeInApp(@NonNull Boolean setterArg) { - this.handleCodeInApp = setterArg; - return this; - } - - private @Nullable String iOSBundleId; - - @CanIgnoreReturnValue - public @NonNull Builder setIOSBundleId(@Nullable String setterArg) { - this.iOSBundleId = setterArg; - return this; - } - - private @Nullable String androidPackageName; - - @CanIgnoreReturnValue - public @NonNull Builder setAndroidPackageName(@Nullable String setterArg) { - this.androidPackageName = setterArg; - return this; - } - - private @Nullable Boolean androidInstallApp; - - @CanIgnoreReturnValue - public @NonNull Builder setAndroidInstallApp(@NonNull Boolean setterArg) { - this.androidInstallApp = setterArg; - return this; - } - - private @Nullable String androidMinimumVersion; - - @CanIgnoreReturnValue - public @NonNull Builder setAndroidMinimumVersion(@Nullable String setterArg) { - this.androidMinimumVersion = setterArg; - return this; - } - - private @Nullable String linkDomain; - - @CanIgnoreReturnValue - public @NonNull Builder setLinkDomain(@Nullable String setterArg) { - this.linkDomain = setterArg; - return this; - } - - public @NonNull InternalActionCodeSettings build() { - InternalActionCodeSettings pigeonReturn = new InternalActionCodeSettings(); - pigeonReturn.setUrl(url); - pigeonReturn.setDynamicLinkDomain(dynamicLinkDomain); - pigeonReturn.setHandleCodeInApp(handleCodeInApp); - pigeonReturn.setIOSBundleId(iOSBundleId); - pigeonReturn.setAndroidPackageName(androidPackageName); - pigeonReturn.setAndroidInstallApp(androidInstallApp); - pigeonReturn.setAndroidMinimumVersion(androidMinimumVersion); - pigeonReturn.setLinkDomain(linkDomain); - return pigeonReturn; - } - } - - @NonNull - public ArrayList toList() { - ArrayList toListResult = new ArrayList<>(8); - toListResult.add(url); - toListResult.add(dynamicLinkDomain); - toListResult.add(handleCodeInApp); - toListResult.add(iOSBundleId); - toListResult.add(androidPackageName); - toListResult.add(androidInstallApp); - toListResult.add(androidMinimumVersion); - toListResult.add(linkDomain); - return toListResult; - } - - static @NonNull InternalActionCodeSettings fromList(@NonNull ArrayList pigeonVar_list) { - InternalActionCodeSettings pigeonResult = new InternalActionCodeSettings(); - Object url = pigeonVar_list.get(0); - pigeonResult.setUrl((String) url); - Object dynamicLinkDomain = pigeonVar_list.get(1); - pigeonResult.setDynamicLinkDomain((String) dynamicLinkDomain); - Object handleCodeInApp = pigeonVar_list.get(2); - pigeonResult.setHandleCodeInApp((Boolean) handleCodeInApp); - Object iOSBundleId = pigeonVar_list.get(3); - pigeonResult.setIOSBundleId((String) iOSBundleId); - Object androidPackageName = pigeonVar_list.get(4); - pigeonResult.setAndroidPackageName((String) androidPackageName); - Object androidInstallApp = pigeonVar_list.get(5); - pigeonResult.setAndroidInstallApp((Boolean) androidInstallApp); - Object androidMinimumVersion = pigeonVar_list.get(6); - pigeonResult.setAndroidMinimumVersion((String) androidMinimumVersion); - Object linkDomain = pigeonVar_list.get(7); - pigeonResult.setLinkDomain((String) linkDomain); - return pigeonResult; - } - } - - /** Generated class from Pigeon that represents data sent in messages. */ - public static final class InternalFirebaseAuthSettings { - private @NonNull Boolean appVerificationDisabledForTesting; - - public @NonNull Boolean getAppVerificationDisabledForTesting() { - return appVerificationDisabledForTesting; - } - - public void setAppVerificationDisabledForTesting(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException( - "Nonnull field \"appVerificationDisabledForTesting\" is null."); - } - this.appVerificationDisabledForTesting = setterArg; - } - - private @Nullable String userAccessGroup; - - public @Nullable String getUserAccessGroup() { - return userAccessGroup; - } - - public void setUserAccessGroup(@Nullable String setterArg) { - this.userAccessGroup = setterArg; - } - - private @Nullable String phoneNumber; - - public @Nullable String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(@Nullable String setterArg) { - this.phoneNumber = setterArg; - } - - private @Nullable String smsCode; - - public @Nullable String getSmsCode() { - return smsCode; - } - - public void setSmsCode(@Nullable String setterArg) { - this.smsCode = setterArg; - } - - private @Nullable Boolean forceRecaptchaFlow; - - public @Nullable Boolean getForceRecaptchaFlow() { - return forceRecaptchaFlow; - } - - public void setForceRecaptchaFlow(@Nullable Boolean setterArg) { - this.forceRecaptchaFlow = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - InternalFirebaseAuthSettings() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InternalFirebaseAuthSettings that = (InternalFirebaseAuthSettings) o; - return pigeonDeepEquals( - appVerificationDisabledForTesting, that.appVerificationDisabledForTesting) - && pigeonDeepEquals(userAccessGroup, that.userAccessGroup) - && pigeonDeepEquals(phoneNumber, that.phoneNumber) - && pigeonDeepEquals(smsCode, that.smsCode) - && pigeonDeepEquals(forceRecaptchaFlow, that.forceRecaptchaFlow); - } - - @Override - public int hashCode() { - Object[] fields = - new Object[] { - getClass(), - appVerificationDisabledForTesting, - userAccessGroup, - phoneNumber, - smsCode, - forceRecaptchaFlow - }; - return pigeonDeepHashCode(fields); - } - - public static final class Builder { - - private @Nullable Boolean appVerificationDisabledForTesting; - - @CanIgnoreReturnValue - public @NonNull Builder setAppVerificationDisabledForTesting(@NonNull Boolean setterArg) { - this.appVerificationDisabledForTesting = setterArg; - return this; - } - - private @Nullable String userAccessGroup; - - @CanIgnoreReturnValue - public @NonNull Builder setUserAccessGroup(@Nullable String setterArg) { - this.userAccessGroup = setterArg; - return this; - } - - private @Nullable String phoneNumber; - - @CanIgnoreReturnValue - public @NonNull Builder setPhoneNumber(@Nullable String setterArg) { - this.phoneNumber = setterArg; - return this; - } - - private @Nullable String smsCode; - - @CanIgnoreReturnValue - public @NonNull Builder setSmsCode(@Nullable String setterArg) { - this.smsCode = setterArg; - return this; - } - - private @Nullable Boolean forceRecaptchaFlow; - - @CanIgnoreReturnValue - public @NonNull Builder setForceRecaptchaFlow(@Nullable Boolean setterArg) { - this.forceRecaptchaFlow = setterArg; - return this; - } - - public @NonNull InternalFirebaseAuthSettings build() { - InternalFirebaseAuthSettings pigeonReturn = new InternalFirebaseAuthSettings(); - pigeonReturn.setAppVerificationDisabledForTesting(appVerificationDisabledForTesting); - pigeonReturn.setUserAccessGroup(userAccessGroup); - pigeonReturn.setPhoneNumber(phoneNumber); - pigeonReturn.setSmsCode(smsCode); - pigeonReturn.setForceRecaptchaFlow(forceRecaptchaFlow); - return pigeonReturn; - } - } - - @NonNull - public ArrayList toList() { - ArrayList toListResult = new ArrayList<>(5); - toListResult.add(appVerificationDisabledForTesting); - toListResult.add(userAccessGroup); - toListResult.add(phoneNumber); - toListResult.add(smsCode); - toListResult.add(forceRecaptchaFlow); - return toListResult; - } - - static @NonNull InternalFirebaseAuthSettings fromList( - @NonNull ArrayList pigeonVar_list) { - InternalFirebaseAuthSettings pigeonResult = new InternalFirebaseAuthSettings(); - Object appVerificationDisabledForTesting = pigeonVar_list.get(0); - pigeonResult.setAppVerificationDisabledForTesting( - (Boolean) appVerificationDisabledForTesting); - Object userAccessGroup = pigeonVar_list.get(1); - pigeonResult.setUserAccessGroup((String) userAccessGroup); - Object phoneNumber = pigeonVar_list.get(2); - pigeonResult.setPhoneNumber((String) phoneNumber); - Object smsCode = pigeonVar_list.get(3); - pigeonResult.setSmsCode((String) smsCode); - Object forceRecaptchaFlow = pigeonVar_list.get(4); - pigeonResult.setForceRecaptchaFlow((Boolean) forceRecaptchaFlow); - return pigeonResult; - } - } - - /** Generated class from Pigeon that represents data sent in messages. */ - public static final class InternalSignInProvider { - private @NonNull String providerId; - - public @NonNull String getProviderId() { - return providerId; - } - - public void setProviderId(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"providerId\" is null."); - } - this.providerId = setterArg; - } - - private @Nullable List scopes; - - public @Nullable List getScopes() { - return scopes; - } - - public void setScopes(@Nullable List setterArg) { - this.scopes = setterArg; - } - - private @Nullable Map customParameters; - - public @Nullable Map getCustomParameters() { - return customParameters; - } - - public void setCustomParameters(@Nullable Map setterArg) { - this.customParameters = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - InternalSignInProvider() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InternalSignInProvider that = (InternalSignInProvider) o; - return pigeonDeepEquals(providerId, that.providerId) - && pigeonDeepEquals(scopes, that.scopes) - && pigeonDeepEquals(customParameters, that.customParameters); - } - - @Override - public int hashCode() { - Object[] fields = new Object[] {getClass(), providerId, scopes, customParameters}; - return pigeonDeepHashCode(fields); - } - - public static final class Builder { - - private @Nullable String providerId; - - @CanIgnoreReturnValue - public @NonNull Builder setProviderId(@NonNull String setterArg) { - this.providerId = setterArg; - return this; - } - - private @Nullable List scopes; - - @CanIgnoreReturnValue - public @NonNull Builder setScopes(@Nullable List setterArg) { - this.scopes = setterArg; - return this; - } - - private @Nullable Map customParameters; - - @CanIgnoreReturnValue - public @NonNull Builder setCustomParameters(@Nullable Map setterArg) { - this.customParameters = setterArg; - return this; - } - - public @NonNull InternalSignInProvider build() { - InternalSignInProvider pigeonReturn = new InternalSignInProvider(); - pigeonReturn.setProviderId(providerId); - pigeonReturn.setScopes(scopes); - pigeonReturn.setCustomParameters(customParameters); - return pigeonReturn; - } - } - - @NonNull - public ArrayList toList() { - ArrayList toListResult = new ArrayList<>(3); - toListResult.add(providerId); - toListResult.add(scopes); - toListResult.add(customParameters); - return toListResult; - } - - static @NonNull InternalSignInProvider fromList(@NonNull ArrayList pigeonVar_list) { - InternalSignInProvider pigeonResult = new InternalSignInProvider(); - Object providerId = pigeonVar_list.get(0); - pigeonResult.setProviderId((String) providerId); - Object scopes = pigeonVar_list.get(1); - pigeonResult.setScopes((List) scopes); - Object customParameters = pigeonVar_list.get(2); - pigeonResult.setCustomParameters((Map) customParameters); - return pigeonResult; - } - } - - /** Generated class from Pigeon that represents data sent in messages. */ - public static final class InternalVerifyPhoneNumberRequest { - private @Nullable String phoneNumber; - - public @Nullable String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(@Nullable String setterArg) { - this.phoneNumber = setterArg; - } - - private @NonNull Long timeout; - - public @NonNull Long getTimeout() { - return timeout; - } - - public void setTimeout(@NonNull Long setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"timeout\" is null."); - } - this.timeout = setterArg; - } - - private @Nullable Long forceResendingToken; - - public @Nullable Long getForceResendingToken() { - return forceResendingToken; - } - - public void setForceResendingToken(@Nullable Long setterArg) { - this.forceResendingToken = setterArg; - } - - private @Nullable String autoRetrievedSmsCodeForTesting; - - public @Nullable String getAutoRetrievedSmsCodeForTesting() { - return autoRetrievedSmsCodeForTesting; - } - - public void setAutoRetrievedSmsCodeForTesting(@Nullable String setterArg) { - this.autoRetrievedSmsCodeForTesting = setterArg; - } - - private @Nullable String multiFactorInfoId; - - public @Nullable String getMultiFactorInfoId() { - return multiFactorInfoId; - } - - public void setMultiFactorInfoId(@Nullable String setterArg) { - this.multiFactorInfoId = setterArg; - } - - private @Nullable String multiFactorSessionId; - - public @Nullable String getMultiFactorSessionId() { - return multiFactorSessionId; - } - - public void setMultiFactorSessionId(@Nullable String setterArg) { - this.multiFactorSessionId = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - InternalVerifyPhoneNumberRequest() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InternalVerifyPhoneNumberRequest that = (InternalVerifyPhoneNumberRequest) o; - return pigeonDeepEquals(phoneNumber, that.phoneNumber) - && pigeonDeepEquals(timeout, that.timeout) - && pigeonDeepEquals(forceResendingToken, that.forceResendingToken) - && pigeonDeepEquals(autoRetrievedSmsCodeForTesting, that.autoRetrievedSmsCodeForTesting) - && pigeonDeepEquals(multiFactorInfoId, that.multiFactorInfoId) - && pigeonDeepEquals(multiFactorSessionId, that.multiFactorSessionId); - } - - @Override - public int hashCode() { - Object[] fields = - new Object[] { - getClass(), - phoneNumber, - timeout, - forceResendingToken, - autoRetrievedSmsCodeForTesting, - multiFactorInfoId, - multiFactorSessionId - }; - return pigeonDeepHashCode(fields); - } - - public static final class Builder { - - private @Nullable String phoneNumber; - - @CanIgnoreReturnValue - public @NonNull Builder setPhoneNumber(@Nullable String setterArg) { - this.phoneNumber = setterArg; - return this; - } - - private @Nullable Long timeout; - - @CanIgnoreReturnValue - public @NonNull Builder setTimeout(@NonNull Long setterArg) { - this.timeout = setterArg; - return this; - } - - private @Nullable Long forceResendingToken; - - @CanIgnoreReturnValue - public @NonNull Builder setForceResendingToken(@Nullable Long setterArg) { - this.forceResendingToken = setterArg; - return this; - } - - private @Nullable String autoRetrievedSmsCodeForTesting; - - @CanIgnoreReturnValue - public @NonNull Builder setAutoRetrievedSmsCodeForTesting(@Nullable String setterArg) { - this.autoRetrievedSmsCodeForTesting = setterArg; - return this; - } - - private @Nullable String multiFactorInfoId; - - @CanIgnoreReturnValue - public @NonNull Builder setMultiFactorInfoId(@Nullable String setterArg) { - this.multiFactorInfoId = setterArg; - return this; - } - - private @Nullable String multiFactorSessionId; - - @CanIgnoreReturnValue - public @NonNull Builder setMultiFactorSessionId(@Nullable String setterArg) { - this.multiFactorSessionId = setterArg; - return this; - } - - public @NonNull InternalVerifyPhoneNumberRequest build() { - InternalVerifyPhoneNumberRequest pigeonReturn = new InternalVerifyPhoneNumberRequest(); - pigeonReturn.setPhoneNumber(phoneNumber); - pigeonReturn.setTimeout(timeout); - pigeonReturn.setForceResendingToken(forceResendingToken); - pigeonReturn.setAutoRetrievedSmsCodeForTesting(autoRetrievedSmsCodeForTesting); - pigeonReturn.setMultiFactorInfoId(multiFactorInfoId); - pigeonReturn.setMultiFactorSessionId(multiFactorSessionId); - return pigeonReturn; - } - } - - @NonNull - public ArrayList toList() { - ArrayList toListResult = new ArrayList<>(6); - toListResult.add(phoneNumber); - toListResult.add(timeout); - toListResult.add(forceResendingToken); - toListResult.add(autoRetrievedSmsCodeForTesting); - toListResult.add(multiFactorInfoId); - toListResult.add(multiFactorSessionId); - return toListResult; - } - - static @NonNull InternalVerifyPhoneNumberRequest fromList( - @NonNull ArrayList pigeonVar_list) { - InternalVerifyPhoneNumberRequest pigeonResult = new InternalVerifyPhoneNumberRequest(); - Object phoneNumber = pigeonVar_list.get(0); - pigeonResult.setPhoneNumber((String) phoneNumber); - Object timeout = pigeonVar_list.get(1); - pigeonResult.setTimeout((Long) timeout); - Object forceResendingToken = pigeonVar_list.get(2); - pigeonResult.setForceResendingToken((Long) forceResendingToken); - Object autoRetrievedSmsCodeForTesting = pigeonVar_list.get(3); - pigeonResult.setAutoRetrievedSmsCodeForTesting((String) autoRetrievedSmsCodeForTesting); - Object multiFactorInfoId = pigeonVar_list.get(4); - pigeonResult.setMultiFactorInfoId((String) multiFactorInfoId); - Object multiFactorSessionId = pigeonVar_list.get(5); - pigeonResult.setMultiFactorSessionId((String) multiFactorSessionId); - return pigeonResult; - } - } - - /** Generated class from Pigeon that represents data sent in messages. */ - public static final class InternalIdTokenResult { - private @Nullable String token; - - public @Nullable String getToken() { - return token; - } - - public void setToken(@Nullable String setterArg) { - this.token = setterArg; - } - - private @Nullable Long expirationTimestamp; - - public @Nullable Long getExpirationTimestamp() { - return expirationTimestamp; - } - - public void setExpirationTimestamp(@Nullable Long setterArg) { - this.expirationTimestamp = setterArg; - } - - private @Nullable Long authTimestamp; - - public @Nullable Long getAuthTimestamp() { - return authTimestamp; - } - - public void setAuthTimestamp(@Nullable Long setterArg) { - this.authTimestamp = setterArg; - } - - private @Nullable Long issuedAtTimestamp; - - public @Nullable Long getIssuedAtTimestamp() { - return issuedAtTimestamp; - } - - public void setIssuedAtTimestamp(@Nullable Long setterArg) { - this.issuedAtTimestamp = setterArg; - } - - private @Nullable String signInProvider; - - public @Nullable String getSignInProvider() { - return signInProvider; - } - - public void setSignInProvider(@Nullable String setterArg) { - this.signInProvider = setterArg; - } - - private @Nullable Map claims; - - public @Nullable Map getClaims() { - return claims; - } - - public void setClaims(@Nullable Map setterArg) { - this.claims = setterArg; - } - - private @Nullable String signInSecondFactor; - - public @Nullable String getSignInSecondFactor() { - return signInSecondFactor; - } - - public void setSignInSecondFactor(@Nullable String setterArg) { - this.signInSecondFactor = setterArg; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InternalIdTokenResult that = (InternalIdTokenResult) o; - return pigeonDeepEquals(token, that.token) - && pigeonDeepEquals(expirationTimestamp, that.expirationTimestamp) - && pigeonDeepEquals(authTimestamp, that.authTimestamp) - && pigeonDeepEquals(issuedAtTimestamp, that.issuedAtTimestamp) - && pigeonDeepEquals(signInProvider, that.signInProvider) - && pigeonDeepEquals(claims, that.claims) - && pigeonDeepEquals(signInSecondFactor, that.signInSecondFactor); - } - - @Override - public int hashCode() { - Object[] fields = - new Object[] { - getClass(), - token, - expirationTimestamp, - authTimestamp, - issuedAtTimestamp, - signInProvider, - claims, - signInSecondFactor - }; - return pigeonDeepHashCode(fields); - } - - public static final class Builder { - - private @Nullable String token; - - @CanIgnoreReturnValue - public @NonNull Builder setToken(@Nullable String setterArg) { - this.token = setterArg; - return this; - } - - private @Nullable Long expirationTimestamp; - - @CanIgnoreReturnValue - public @NonNull Builder setExpirationTimestamp(@Nullable Long setterArg) { - this.expirationTimestamp = setterArg; - return this; - } - - private @Nullable Long authTimestamp; - - @CanIgnoreReturnValue - public @NonNull Builder setAuthTimestamp(@Nullable Long setterArg) { - this.authTimestamp = setterArg; - return this; - } - - private @Nullable Long issuedAtTimestamp; - - @CanIgnoreReturnValue - public @NonNull Builder setIssuedAtTimestamp(@Nullable Long setterArg) { - this.issuedAtTimestamp = setterArg; - return this; - } - - private @Nullable String signInProvider; - - @CanIgnoreReturnValue - public @NonNull Builder setSignInProvider(@Nullable String setterArg) { - this.signInProvider = setterArg; - return this; - } - - private @Nullable Map claims; - - @CanIgnoreReturnValue - public @NonNull Builder setClaims(@Nullable Map setterArg) { - this.claims = setterArg; - return this; - } - - private @Nullable String signInSecondFactor; - - @CanIgnoreReturnValue - public @NonNull Builder setSignInSecondFactor(@Nullable String setterArg) { - this.signInSecondFactor = setterArg; - return this; - } - - public @NonNull InternalIdTokenResult build() { - InternalIdTokenResult pigeonReturn = new InternalIdTokenResult(); - pigeonReturn.setToken(token); - pigeonReturn.setExpirationTimestamp(expirationTimestamp); - pigeonReturn.setAuthTimestamp(authTimestamp); - pigeonReturn.setIssuedAtTimestamp(issuedAtTimestamp); - pigeonReturn.setSignInProvider(signInProvider); - pigeonReturn.setClaims(claims); - pigeonReturn.setSignInSecondFactor(signInSecondFactor); - return pigeonReturn; - } - } - - @NonNull - public ArrayList toList() { - ArrayList toListResult = new ArrayList<>(7); - toListResult.add(token); - toListResult.add(expirationTimestamp); - toListResult.add(authTimestamp); - toListResult.add(issuedAtTimestamp); - toListResult.add(signInProvider); - toListResult.add(claims); - toListResult.add(signInSecondFactor); - return toListResult; - } - - static @NonNull InternalIdTokenResult fromList(@NonNull ArrayList pigeonVar_list) { - InternalIdTokenResult pigeonResult = new InternalIdTokenResult(); - Object token = pigeonVar_list.get(0); - pigeonResult.setToken((String) token); - Object expirationTimestamp = pigeonVar_list.get(1); - pigeonResult.setExpirationTimestamp((Long) expirationTimestamp); - Object authTimestamp = pigeonVar_list.get(2); - pigeonResult.setAuthTimestamp((Long) authTimestamp); - Object issuedAtTimestamp = pigeonVar_list.get(3); - pigeonResult.setIssuedAtTimestamp((Long) issuedAtTimestamp); - Object signInProvider = pigeonVar_list.get(4); - pigeonResult.setSignInProvider((String) signInProvider); - Object claims = pigeonVar_list.get(5); - pigeonResult.setClaims((Map) claims); - Object signInSecondFactor = pigeonVar_list.get(6); - pigeonResult.setSignInSecondFactor((String) signInSecondFactor); - return pigeonResult; - } - } - - /** Generated class from Pigeon that represents data sent in messages. */ - public static final class InternalUserProfile { - private @Nullable String displayName; - - public @Nullable String getDisplayName() { - return displayName; - } - - public void setDisplayName(@Nullable String setterArg) { - this.displayName = setterArg; - } - - private @Nullable String photoUrl; - - public @Nullable String getPhotoUrl() { - return photoUrl; - } - - public void setPhotoUrl(@Nullable String setterArg) { - this.photoUrl = setterArg; - } - - private @NonNull Boolean displayNameChanged; - - public @NonNull Boolean getDisplayNameChanged() { - return displayNameChanged; - } - - public void setDisplayNameChanged(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"displayNameChanged\" is null."); - } - this.displayNameChanged = setterArg; - } - - private @NonNull Boolean photoUrlChanged; - - public @NonNull Boolean getPhotoUrlChanged() { - return photoUrlChanged; - } - - public void setPhotoUrlChanged(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"photoUrlChanged\" is null."); - } - this.photoUrlChanged = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - InternalUserProfile() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InternalUserProfile that = (InternalUserProfile) o; - return pigeonDeepEquals(displayName, that.displayName) - && pigeonDeepEquals(photoUrl, that.photoUrl) - && pigeonDeepEquals(displayNameChanged, that.displayNameChanged) - && pigeonDeepEquals(photoUrlChanged, that.photoUrlChanged); - } - - @Override - public int hashCode() { - Object[] fields = - new Object[] {getClass(), displayName, photoUrl, displayNameChanged, photoUrlChanged}; - return pigeonDeepHashCode(fields); - } - - public static final class Builder { - - private @Nullable String displayName; - - @CanIgnoreReturnValue - public @NonNull Builder setDisplayName(@Nullable String setterArg) { - this.displayName = setterArg; - return this; - } - - private @Nullable String photoUrl; - - @CanIgnoreReturnValue - public @NonNull Builder setPhotoUrl(@Nullable String setterArg) { - this.photoUrl = setterArg; - return this; - } - - private @Nullable Boolean displayNameChanged; - - @CanIgnoreReturnValue - public @NonNull Builder setDisplayNameChanged(@NonNull Boolean setterArg) { - this.displayNameChanged = setterArg; - return this; - } - - private @Nullable Boolean photoUrlChanged; - - @CanIgnoreReturnValue - public @NonNull Builder setPhotoUrlChanged(@NonNull Boolean setterArg) { - this.photoUrlChanged = setterArg; - return this; - } - - public @NonNull InternalUserProfile build() { - InternalUserProfile pigeonReturn = new InternalUserProfile(); - pigeonReturn.setDisplayName(displayName); - pigeonReturn.setPhotoUrl(photoUrl); - pigeonReturn.setDisplayNameChanged(displayNameChanged); - pigeonReturn.setPhotoUrlChanged(photoUrlChanged); - return pigeonReturn; - } - } - - @NonNull - public ArrayList toList() { - ArrayList toListResult = new ArrayList<>(4); - toListResult.add(displayName); - toListResult.add(photoUrl); - toListResult.add(displayNameChanged); - toListResult.add(photoUrlChanged); - return toListResult; - } - - static @NonNull InternalUserProfile fromList(@NonNull ArrayList pigeonVar_list) { - InternalUserProfile pigeonResult = new InternalUserProfile(); - Object displayName = pigeonVar_list.get(0); - pigeonResult.setDisplayName((String) displayName); - Object photoUrl = pigeonVar_list.get(1); - pigeonResult.setPhotoUrl((String) photoUrl); - Object displayNameChanged = pigeonVar_list.get(2); - pigeonResult.setDisplayNameChanged((Boolean) displayNameChanged); - Object photoUrlChanged = pigeonVar_list.get(3); - pigeonResult.setPhotoUrlChanged((Boolean) photoUrlChanged); - return pigeonResult; - } - } - - /** Generated class from Pigeon that represents data sent in messages. */ - public static final class InternalTotpSecret { - private @Nullable Long codeIntervalSeconds; - - public @Nullable Long getCodeIntervalSeconds() { - return codeIntervalSeconds; - } - - public void setCodeIntervalSeconds(@Nullable Long setterArg) { - this.codeIntervalSeconds = setterArg; - } - - private @Nullable Long codeLength; - - public @Nullable Long getCodeLength() { - return codeLength; - } - - public void setCodeLength(@Nullable Long setterArg) { - this.codeLength = setterArg; - } - - private @Nullable Long enrollmentCompletionDeadline; - - public @Nullable Long getEnrollmentCompletionDeadline() { - return enrollmentCompletionDeadline; - } - - public void setEnrollmentCompletionDeadline(@Nullable Long setterArg) { - this.enrollmentCompletionDeadline = setterArg; - } - - private @Nullable String hashingAlgorithm; - - public @Nullable String getHashingAlgorithm() { - return hashingAlgorithm; - } - - public void setHashingAlgorithm(@Nullable String setterArg) { - this.hashingAlgorithm = setterArg; - } - - private @NonNull String secretKey; - - public @NonNull String getSecretKey() { - return secretKey; - } - - public void setSecretKey(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"secretKey\" is null."); - } - this.secretKey = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - InternalTotpSecret() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InternalTotpSecret that = (InternalTotpSecret) o; - return pigeonDeepEquals(codeIntervalSeconds, that.codeIntervalSeconds) - && pigeonDeepEquals(codeLength, that.codeLength) - && pigeonDeepEquals(enrollmentCompletionDeadline, that.enrollmentCompletionDeadline) - && pigeonDeepEquals(hashingAlgorithm, that.hashingAlgorithm) - && pigeonDeepEquals(secretKey, that.secretKey); - } - - @Override - public int hashCode() { - Object[] fields = - new Object[] { - getClass(), - codeIntervalSeconds, - codeLength, - enrollmentCompletionDeadline, - hashingAlgorithm, - secretKey - }; - return pigeonDeepHashCode(fields); - } - - public static final class Builder { - - private @Nullable Long codeIntervalSeconds; - - @CanIgnoreReturnValue - public @NonNull Builder setCodeIntervalSeconds(@Nullable Long setterArg) { - this.codeIntervalSeconds = setterArg; - return this; - } - - private @Nullable Long codeLength; - - @CanIgnoreReturnValue - public @NonNull Builder setCodeLength(@Nullable Long setterArg) { - this.codeLength = setterArg; - return this; - } - - private @Nullable Long enrollmentCompletionDeadline; - - @CanIgnoreReturnValue - public @NonNull Builder setEnrollmentCompletionDeadline(@Nullable Long setterArg) { - this.enrollmentCompletionDeadline = setterArg; - return this; - } - - private @Nullable String hashingAlgorithm; - - @CanIgnoreReturnValue - public @NonNull Builder setHashingAlgorithm(@Nullable String setterArg) { - this.hashingAlgorithm = setterArg; - return this; - } - - private @Nullable String secretKey; - - @CanIgnoreReturnValue - public @NonNull Builder setSecretKey(@NonNull String setterArg) { - this.secretKey = setterArg; - return this; - } - - public @NonNull InternalTotpSecret build() { - InternalTotpSecret pigeonReturn = new InternalTotpSecret(); - pigeonReturn.setCodeIntervalSeconds(codeIntervalSeconds); - pigeonReturn.setCodeLength(codeLength); - pigeonReturn.setEnrollmentCompletionDeadline(enrollmentCompletionDeadline); - pigeonReturn.setHashingAlgorithm(hashingAlgorithm); - pigeonReturn.setSecretKey(secretKey); - return pigeonReturn; - } - } - - @NonNull - public ArrayList toList() { - ArrayList toListResult = new ArrayList<>(5); - toListResult.add(codeIntervalSeconds); - toListResult.add(codeLength); - toListResult.add(enrollmentCompletionDeadline); - toListResult.add(hashingAlgorithm); - toListResult.add(secretKey); - return toListResult; - } - - static @NonNull InternalTotpSecret fromList(@NonNull ArrayList pigeonVar_list) { - InternalTotpSecret pigeonResult = new InternalTotpSecret(); - Object codeIntervalSeconds = pigeonVar_list.get(0); - pigeonResult.setCodeIntervalSeconds((Long) codeIntervalSeconds); - Object codeLength = pigeonVar_list.get(1); - pigeonResult.setCodeLength((Long) codeLength); - Object enrollmentCompletionDeadline = pigeonVar_list.get(2); - pigeonResult.setEnrollmentCompletionDeadline((Long) enrollmentCompletionDeadline); - Object hashingAlgorithm = pigeonVar_list.get(3); - pigeonResult.setHashingAlgorithm((String) hashingAlgorithm); - Object secretKey = pigeonVar_list.get(4); - pigeonResult.setSecretKey((String) secretKey); - return pigeonResult; - } - } - - private static class PigeonCodec extends StandardMessageCodec { - public static final PigeonCodec INSTANCE = new PigeonCodec(); - - private PigeonCodec() {} - - @Override - protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { - switch (type) { - case (byte) 129: - { - Object value = readValue(buffer); - return value == null - ? null - : ActionCodeInfoOperation.values()[((Long) value).intValue()]; - } - case (byte) 130: - return InternalMultiFactorSession.fromList((ArrayList) readValue(buffer)); - case (byte) 131: - return InternalPhoneMultiFactorAssertion.fromList((ArrayList) readValue(buffer)); - case (byte) 132: - return InternalMultiFactorInfo.fromList((ArrayList) readValue(buffer)); - case (byte) 133: - return AuthPigeonFirebaseApp.fromList((ArrayList) readValue(buffer)); - case (byte) 134: - return InternalActionCodeInfoData.fromList((ArrayList) readValue(buffer)); - case (byte) 135: - return InternalActionCodeInfo.fromList((ArrayList) readValue(buffer)); - case (byte) 136: - return InternalAdditionalUserInfo.fromList((ArrayList) readValue(buffer)); - case (byte) 137: - return InternalAuthCredential.fromList((ArrayList) readValue(buffer)); - case (byte) 138: - return InternalUserInfo.fromList((ArrayList) readValue(buffer)); - case (byte) 139: - return InternalUserDetails.fromList((ArrayList) readValue(buffer)); - case (byte) 140: - return InternalUserCredential.fromList((ArrayList) readValue(buffer)); - case (byte) 141: - return InternalAuthCredentialInput.fromList((ArrayList) readValue(buffer)); - case (byte) 142: - return InternalActionCodeSettings.fromList((ArrayList) readValue(buffer)); - case (byte) 143: - return InternalFirebaseAuthSettings.fromList((ArrayList) readValue(buffer)); - case (byte) 144: - return InternalSignInProvider.fromList((ArrayList) readValue(buffer)); - case (byte) 145: - return InternalVerifyPhoneNumberRequest.fromList((ArrayList) readValue(buffer)); - case (byte) 146: - return InternalIdTokenResult.fromList((ArrayList) readValue(buffer)); - case (byte) 147: - return InternalUserProfile.fromList((ArrayList) readValue(buffer)); - case (byte) 148: - return InternalTotpSecret.fromList((ArrayList) readValue(buffer)); - default: - return super.readValueOfType(type, buffer); - } - } - - @Override - protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { - if (value instanceof ActionCodeInfoOperation) { - stream.write(129); - writeValue(stream, value == null ? null : ((ActionCodeInfoOperation) value).index); - } else if (value instanceof InternalMultiFactorSession) { - stream.write(130); - writeValue(stream, ((InternalMultiFactorSession) value).toList()); - } else if (value instanceof InternalPhoneMultiFactorAssertion) { - stream.write(131); - writeValue(stream, ((InternalPhoneMultiFactorAssertion) value).toList()); - } else if (value instanceof InternalMultiFactorInfo) { - stream.write(132); - writeValue(stream, ((InternalMultiFactorInfo) value).toList()); - } else if (value instanceof AuthPigeonFirebaseApp) { - stream.write(133); - writeValue(stream, ((AuthPigeonFirebaseApp) value).toList()); - } else if (value instanceof InternalActionCodeInfoData) { - stream.write(134); - writeValue(stream, ((InternalActionCodeInfoData) value).toList()); - } else if (value instanceof InternalActionCodeInfo) { - stream.write(135); - writeValue(stream, ((InternalActionCodeInfo) value).toList()); - } else if (value instanceof InternalAdditionalUserInfo) { - stream.write(136); - writeValue(stream, ((InternalAdditionalUserInfo) value).toList()); - } else if (value instanceof InternalAuthCredential) { - stream.write(137); - writeValue(stream, ((InternalAuthCredential) value).toList()); - } else if (value instanceof InternalUserInfo) { - stream.write(138); - writeValue(stream, ((InternalUserInfo) value).toList()); - } else if (value instanceof InternalUserDetails) { - stream.write(139); - writeValue(stream, ((InternalUserDetails) value).toList()); - } else if (value instanceof InternalUserCredential) { - stream.write(140); - writeValue(stream, ((InternalUserCredential) value).toList()); - } else if (value instanceof InternalAuthCredentialInput) { - stream.write(141); - writeValue(stream, ((InternalAuthCredentialInput) value).toList()); - } else if (value instanceof InternalActionCodeSettings) { - stream.write(142); - writeValue(stream, ((InternalActionCodeSettings) value).toList()); - } else if (value instanceof InternalFirebaseAuthSettings) { - stream.write(143); - writeValue(stream, ((InternalFirebaseAuthSettings) value).toList()); - } else if (value instanceof InternalSignInProvider) { - stream.write(144); - writeValue(stream, ((InternalSignInProvider) value).toList()); - } else if (value instanceof InternalVerifyPhoneNumberRequest) { - stream.write(145); - writeValue(stream, ((InternalVerifyPhoneNumberRequest) value).toList()); - } else if (value instanceof InternalIdTokenResult) { - stream.write(146); - writeValue(stream, ((InternalIdTokenResult) value).toList()); - } else if (value instanceof InternalUserProfile) { - stream.write(147); - writeValue(stream, ((InternalUserProfile) value).toList()); - } else if (value instanceof InternalTotpSecret) { - stream.write(148); - writeValue(stream, ((InternalTotpSecret) value).toList()); - } else { - super.writeValue(stream, value); - } - } - } - - /** Asynchronous error handling return type for non-nullable API method returns. */ - public interface Result { - /** Success case callback method for handling returns. */ - void success(@NonNull T result); - - /** Failure case callback method for handling errors. */ - void error(@NonNull Throwable error); - } - - /** Asynchronous error handling return type for nullable API method returns. */ - public interface NullableResult { - /** Success case callback method for handling returns. */ - void success(@Nullable T result); - - /** Failure case callback method for handling errors. */ - void error(@NonNull Throwable error); - } - - /** Asynchronous error handling return type for void API method returns. */ - public interface VoidResult { - /** Success case callback method for handling returns. */ - void success(); - - /** Failure case callback method for handling errors. */ - void error(@NonNull Throwable error); - } - - /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ - public interface FirebaseAuthHostApi { - - void registerIdTokenListener( - @NonNull AuthPigeonFirebaseApp app, @NonNull Result result); - - void registerAuthStateListener( - @NonNull AuthPigeonFirebaseApp app, @NonNull Result result); - - void useEmulator( - @NonNull AuthPigeonFirebaseApp app, - @NonNull String host, - @NonNull Long port, - @NonNull VoidResult result); - - void applyActionCode( - @NonNull AuthPigeonFirebaseApp app, @NonNull String code, @NonNull VoidResult result); - - void checkActionCode( - @NonNull AuthPigeonFirebaseApp app, - @NonNull String code, - @NonNull Result result); - - void confirmPasswordReset( - @NonNull AuthPigeonFirebaseApp app, - @NonNull String code, - @NonNull String newPassword, - @NonNull VoidResult result); - - void createUserWithEmailAndPassword( - @NonNull AuthPigeonFirebaseApp app, - @NonNull String email, - @NonNull String password, - @NonNull Result result); - - void signInAnonymously( - @NonNull AuthPigeonFirebaseApp app, @NonNull Result result); - - void signInWithCredential( - @NonNull AuthPigeonFirebaseApp app, - @NonNull Map input, - @NonNull Result result); - - void signInWithCustomToken( - @NonNull AuthPigeonFirebaseApp app, - @NonNull String token, - @NonNull Result result); - - void signInWithEmailAndPassword( - @NonNull AuthPigeonFirebaseApp app, - @NonNull String email, - @NonNull String password, - @NonNull Result result); - - void signInWithEmailLink( - @NonNull AuthPigeonFirebaseApp app, - @NonNull String email, - @NonNull String emailLink, - @NonNull Result result); - - void signInWithProvider( - @NonNull AuthPigeonFirebaseApp app, - @NonNull InternalSignInProvider signInProvider, - @NonNull Result result); - - void signOut(@NonNull AuthPigeonFirebaseApp app, @NonNull VoidResult result); - - void fetchSignInMethodsForEmail( - @NonNull AuthPigeonFirebaseApp app, - @NonNull String email, - @NonNull Result> result); - - void sendPasswordResetEmail( - @NonNull AuthPigeonFirebaseApp app, - @NonNull String email, - @Nullable InternalActionCodeSettings actionCodeSettings, - @NonNull VoidResult result); - - void sendSignInLinkToEmail( - @NonNull AuthPigeonFirebaseApp app, - @NonNull String email, - @NonNull InternalActionCodeSettings actionCodeSettings, - @NonNull VoidResult result); - - void setLanguageCode( - @NonNull AuthPigeonFirebaseApp app, - @Nullable String languageCode, - @NonNull Result result); - - void setSettings( - @NonNull AuthPigeonFirebaseApp app, - @NonNull InternalFirebaseAuthSettings settings, - @NonNull VoidResult result); - - void verifyPasswordResetCode( - @NonNull AuthPigeonFirebaseApp app, @NonNull String code, @NonNull Result result); - - void verifyPhoneNumber( - @NonNull AuthPigeonFirebaseApp app, - @NonNull InternalVerifyPhoneNumberRequest request, - @NonNull Result result); - - void revokeTokenWithAuthorizationCode( - @NonNull AuthPigeonFirebaseApp app, - @NonNull String authorizationCode, - @NonNull VoidResult result); - - void revokeAccessToken( - @NonNull AuthPigeonFirebaseApp app, - @NonNull String accessToken, - @NonNull VoidResult result); - - void initializeRecaptchaConfig(@NonNull AuthPigeonFirebaseApp app, @NonNull VoidResult result); - - /** The codec used by FirebaseAuthHostApi. */ - static @NonNull MessageCodec getCodec() { - return PigeonCodec.INSTANCE; - } - - /** - * Sets up an instance of `FirebaseAuthHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable FirebaseAuthHostApi api) { - setUp(binaryMessenger, "", api); - } - - static void setUp( - @NonNull BinaryMessenger binaryMessenger, - @NonNull String messageChannelSuffix, - @Nullable FirebaseAuthHostApi api) { - messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.registerIdTokenListener" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - Result resultCallback = - new Result() { - public void success(String result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.registerIdTokenListener(appArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.registerAuthStateListener" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - Result resultCallback = - new Result() { - public void success(String result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.registerAuthStateListener(appArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.useEmulator" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - String hostArg = (String) args.get(1); - Long portArg = (Long) args.get(2); - VoidResult resultCallback = - new VoidResult() { - public void success() { - wrapped.add(0, null); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.useEmulator(appArg, hostArg, portArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.applyActionCode" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - String codeArg = (String) args.get(1); - VoidResult resultCallback = - new VoidResult() { - public void success() { - wrapped.add(0, null); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.applyActionCode(appArg, codeArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.checkActionCode" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - String codeArg = (String) args.get(1); - Result resultCallback = - new Result() { - public void success(InternalActionCodeInfo result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.checkActionCode(appArg, codeArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.confirmPasswordReset" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - String codeArg = (String) args.get(1); - String newPasswordArg = (String) args.get(2); - VoidResult resultCallback = - new VoidResult() { - public void success() { - wrapped.add(0, null); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.confirmPasswordReset(appArg, codeArg, newPasswordArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.createUserWithEmailAndPassword" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - String emailArg = (String) args.get(1); - String passwordArg = (String) args.get(2); - Result resultCallback = - new Result() { - public void success(InternalUserCredential result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.createUserWithEmailAndPassword(appArg, emailArg, passwordArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInAnonymously" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - Result resultCallback = - new Result() { - public void success(InternalUserCredential result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.signInAnonymously(appArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithCredential" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - Map inputArg = (Map) args.get(1); - Result resultCallback = - new Result() { - public void success(InternalUserCredential result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.signInWithCredential(appArg, inputArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithCustomToken" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - String tokenArg = (String) args.get(1); - Result resultCallback = - new Result() { - public void success(InternalUserCredential result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.signInWithCustomToken(appArg, tokenArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithEmailAndPassword" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - String emailArg = (String) args.get(1); - String passwordArg = (String) args.get(2); - Result resultCallback = - new Result() { - public void success(InternalUserCredential result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.signInWithEmailAndPassword(appArg, emailArg, passwordArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithEmailLink" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - String emailArg = (String) args.get(1); - String emailLinkArg = (String) args.get(2); - Result resultCallback = - new Result() { - public void success(InternalUserCredential result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.signInWithEmailLink(appArg, emailArg, emailLinkArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithProvider" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - InternalSignInProvider signInProviderArg = (InternalSignInProvider) args.get(1); - Result resultCallback = - new Result() { - public void success(InternalUserCredential result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.signInWithProvider(appArg, signInProviderArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signOut" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - VoidResult resultCallback = - new VoidResult() { - public void success() { - wrapped.add(0, null); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.signOut(appArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.fetchSignInMethodsForEmail" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - String emailArg = (String) args.get(1); - Result> resultCallback = - new Result>() { - public void success(List result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.fetchSignInMethodsForEmail(appArg, emailArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.sendPasswordResetEmail" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - String emailArg = (String) args.get(1); - InternalActionCodeSettings actionCodeSettingsArg = - (InternalActionCodeSettings) args.get(2); - VoidResult resultCallback = - new VoidResult() { - public void success() { - wrapped.add(0, null); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.sendPasswordResetEmail(appArg, emailArg, actionCodeSettingsArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.sendSignInLinkToEmail" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - String emailArg = (String) args.get(1); - InternalActionCodeSettings actionCodeSettingsArg = - (InternalActionCodeSettings) args.get(2); - VoidResult resultCallback = - new VoidResult() { - public void success() { - wrapped.add(0, null); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.sendSignInLinkToEmail(appArg, emailArg, actionCodeSettingsArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.setLanguageCode" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - String languageCodeArg = (String) args.get(1); - Result resultCallback = - new Result() { - public void success(String result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.setLanguageCode(appArg, languageCodeArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.setSettings" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - InternalFirebaseAuthSettings settingsArg = - (InternalFirebaseAuthSettings) args.get(1); - VoidResult resultCallback = - new VoidResult() { - public void success() { - wrapped.add(0, null); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.setSettings(appArg, settingsArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.verifyPasswordResetCode" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - String codeArg = (String) args.get(1); - Result resultCallback = - new Result() { - public void success(String result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.verifyPasswordResetCode(appArg, codeArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.verifyPhoneNumber" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - InternalVerifyPhoneNumberRequest requestArg = - (InternalVerifyPhoneNumberRequest) args.get(1); - Result resultCallback = - new Result() { - public void success(String result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.verifyPhoneNumber(appArg, requestArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.revokeTokenWithAuthorizationCode" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - String authorizationCodeArg = (String) args.get(1); - VoidResult resultCallback = - new VoidResult() { - public void success() { - wrapped.add(0, null); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.revokeTokenWithAuthorizationCode(appArg, authorizationCodeArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.revokeAccessToken" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - String accessTokenArg = (String) args.get(1); - VoidResult resultCallback = - new VoidResult() { - public void success() { - wrapped.add(0, null); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.revokeAccessToken(appArg, accessTokenArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.initializeRecaptchaConfig" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - VoidResult resultCallback = - new VoidResult() { - public void success() { - wrapped.add(0, null); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.initializeRecaptchaConfig(appArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - } - } - - /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ - public interface FirebaseAuthUserHostApi { - - void delete(@NonNull AuthPigeonFirebaseApp app, @NonNull VoidResult result); - - void getIdToken( - @NonNull AuthPigeonFirebaseApp app, - @NonNull Boolean forceRefresh, - @NonNull Result result); - - void linkWithCredential( - @NonNull AuthPigeonFirebaseApp app, - @NonNull Map input, - @NonNull Result result); - - void linkWithProvider( - @NonNull AuthPigeonFirebaseApp app, - @NonNull InternalSignInProvider signInProvider, - @NonNull Result result); - - void reauthenticateWithCredential( - @NonNull AuthPigeonFirebaseApp app, - @NonNull Map input, - @NonNull Result result); - - void reauthenticateWithProvider( - @NonNull AuthPigeonFirebaseApp app, - @NonNull InternalSignInProvider signInProvider, - @NonNull Result result); - - void reload(@NonNull AuthPigeonFirebaseApp app, @NonNull Result result); - - void sendEmailVerification( - @NonNull AuthPigeonFirebaseApp app, - @Nullable InternalActionCodeSettings actionCodeSettings, - @NonNull VoidResult result); - - void unlink( - @NonNull AuthPigeonFirebaseApp app, - @NonNull String providerId, - @NonNull Result result); - - void updateEmail( - @NonNull AuthPigeonFirebaseApp app, - @NonNull String newEmail, - @NonNull Result result); - - void updatePassword( - @NonNull AuthPigeonFirebaseApp app, - @NonNull String newPassword, - @NonNull Result result); - - void updatePhoneNumber( - @NonNull AuthPigeonFirebaseApp app, - @NonNull Map input, - @NonNull Result result); - - void updateProfile( - @NonNull AuthPigeonFirebaseApp app, - @NonNull InternalUserProfile profile, - @NonNull Result result); - - void verifyBeforeUpdateEmail( - @NonNull AuthPigeonFirebaseApp app, - @NonNull String newEmail, - @Nullable InternalActionCodeSettings actionCodeSettings, - @NonNull VoidResult result); - - /** The codec used by FirebaseAuthUserHostApi. */ - static @NonNull MessageCodec getCodec() { - return PigeonCodec.INSTANCE; - } - - /** - * Sets up an instance of `FirebaseAuthUserHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setUp( - @NonNull BinaryMessenger binaryMessenger, @Nullable FirebaseAuthUserHostApi api) { - setUp(binaryMessenger, "", api); - } - - static void setUp( - @NonNull BinaryMessenger binaryMessenger, - @NonNull String messageChannelSuffix, - @Nullable FirebaseAuthUserHostApi api) { - messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.delete" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - VoidResult resultCallback = - new VoidResult() { - public void success() { - wrapped.add(0, null); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.delete(appArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.getIdToken" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - Boolean forceRefreshArg = (Boolean) args.get(1); - Result resultCallback = - new Result() { - public void success(InternalIdTokenResult result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.getIdToken(appArg, forceRefreshArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.linkWithCredential" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - Map inputArg = (Map) args.get(1); - Result resultCallback = - new Result() { - public void success(InternalUserCredential result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.linkWithCredential(appArg, inputArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.linkWithProvider" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - InternalSignInProvider signInProviderArg = (InternalSignInProvider) args.get(1); - Result resultCallback = - new Result() { - public void success(InternalUserCredential result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.linkWithProvider(appArg, signInProviderArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.reauthenticateWithCredential" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - Map inputArg = (Map) args.get(1); - Result resultCallback = - new Result() { - public void success(InternalUserCredential result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.reauthenticateWithCredential(appArg, inputArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.reauthenticateWithProvider" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - InternalSignInProvider signInProviderArg = (InternalSignInProvider) args.get(1); - Result resultCallback = - new Result() { - public void success(InternalUserCredential result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.reauthenticateWithProvider(appArg, signInProviderArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.reload" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - Result resultCallback = - new Result() { - public void success(InternalUserDetails result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.reload(appArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.sendEmailVerification" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - InternalActionCodeSettings actionCodeSettingsArg = - (InternalActionCodeSettings) args.get(1); - VoidResult resultCallback = - new VoidResult() { - public void success() { - wrapped.add(0, null); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.sendEmailVerification(appArg, actionCodeSettingsArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.unlink" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - String providerIdArg = (String) args.get(1); - Result resultCallback = - new Result() { - public void success(InternalUserCredential result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.unlink(appArg, providerIdArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updateEmail" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - String newEmailArg = (String) args.get(1); - Result resultCallback = - new Result() { - public void success(InternalUserDetails result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.updateEmail(appArg, newEmailArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updatePassword" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - String newPasswordArg = (String) args.get(1); - Result resultCallback = - new Result() { - public void success(InternalUserDetails result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.updatePassword(appArg, newPasswordArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updatePhoneNumber" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - Map inputArg = (Map) args.get(1); - Result resultCallback = - new Result() { - public void success(InternalUserDetails result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.updatePhoneNumber(appArg, inputArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updateProfile" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - InternalUserProfile profileArg = (InternalUserProfile) args.get(1); - Result resultCallback = - new Result() { - public void success(InternalUserDetails result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.updateProfile(appArg, profileArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.verifyBeforeUpdateEmail" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - String newEmailArg = (String) args.get(1); - InternalActionCodeSettings actionCodeSettingsArg = - (InternalActionCodeSettings) args.get(2); - VoidResult resultCallback = - new VoidResult() { - public void success() { - wrapped.add(0, null); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.verifyBeforeUpdateEmail( - appArg, newEmailArg, actionCodeSettingsArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - } - } - - /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ - public interface MultiFactorUserHostApi { - - void enrollPhone( - @NonNull AuthPigeonFirebaseApp app, - @NonNull InternalPhoneMultiFactorAssertion assertion, - @Nullable String displayName, - @NonNull VoidResult result); - - void enrollTotp( - @NonNull AuthPigeonFirebaseApp app, - @NonNull String assertionId, - @Nullable String displayName, - @NonNull VoidResult result); - - void getSession( - @NonNull AuthPigeonFirebaseApp app, @NonNull Result result); - - void unenroll( - @NonNull AuthPigeonFirebaseApp app, @NonNull String factorUid, @NonNull VoidResult result); - - void getEnrolledFactors( - @NonNull AuthPigeonFirebaseApp app, @NonNull Result> result); - - /** The codec used by MultiFactorUserHostApi. */ - static @NonNull MessageCodec getCodec() { - return PigeonCodec.INSTANCE; - } - - /** - * Sets up an instance of `MultiFactorUserHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setUp( - @NonNull BinaryMessenger binaryMessenger, @Nullable MultiFactorUserHostApi api) { - setUp(binaryMessenger, "", api); - } - - static void setUp( - @NonNull BinaryMessenger binaryMessenger, - @NonNull String messageChannelSuffix, - @Nullable MultiFactorUserHostApi api) { - messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.enrollPhone" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - InternalPhoneMultiFactorAssertion assertionArg = - (InternalPhoneMultiFactorAssertion) args.get(1); - String displayNameArg = (String) args.get(2); - VoidResult resultCallback = - new VoidResult() { - public void success() { - wrapped.add(0, null); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.enrollPhone(appArg, assertionArg, displayNameArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.enrollTotp" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - String assertionIdArg = (String) args.get(1); - String displayNameArg = (String) args.get(2); - VoidResult resultCallback = - new VoidResult() { - public void success() { - wrapped.add(0, null); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.enrollTotp(appArg, assertionIdArg, displayNameArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.getSession" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - Result resultCallback = - new Result() { - public void success(InternalMultiFactorSession result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.getSession(appArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.unenroll" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - String factorUidArg = (String) args.get(1); - VoidResult resultCallback = - new VoidResult() { - public void success() { - wrapped.add(0, null); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.unenroll(appArg, factorUidArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.getEnrolledFactors" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthPigeonFirebaseApp appArg = (AuthPigeonFirebaseApp) args.get(0); - Result> resultCallback = - new Result>() { - public void success(List result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.getEnrolledFactors(appArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - } - } - - /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ - public interface MultiFactoResolverHostApi { - - void resolveSignIn( - @NonNull String resolverId, - @Nullable InternalPhoneMultiFactorAssertion assertion, - @Nullable String totpAssertionId, - @NonNull Result result); - - /** The codec used by MultiFactoResolverHostApi. */ - static @NonNull MessageCodec getCodec() { - return PigeonCodec.INSTANCE; - } - - /** - * Sets up an instance of `MultiFactoResolverHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setUp( - @NonNull BinaryMessenger binaryMessenger, @Nullable MultiFactoResolverHostApi api) { - setUp(binaryMessenger, "", api); - } - - static void setUp( - @NonNull BinaryMessenger binaryMessenger, - @NonNull String messageChannelSuffix, - @Nullable MultiFactoResolverHostApi api) { - messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactoResolverHostApi.resolveSignIn" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - String resolverIdArg = (String) args.get(0); - InternalPhoneMultiFactorAssertion assertionArg = - (InternalPhoneMultiFactorAssertion) args.get(1); - String totpAssertionIdArg = (String) args.get(2); - Result resultCallback = - new Result() { - public void success(InternalUserCredential result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.resolveSignIn(resolverIdArg, assertionArg, totpAssertionIdArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - } - } - - /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ - public interface MultiFactorTotpHostApi { - - void generateSecret(@NonNull String sessionId, @NonNull Result result); - - void getAssertionForEnrollment( - @NonNull String secretKey, @NonNull String oneTimePassword, @NonNull Result result); - - void getAssertionForSignIn( - @NonNull String enrollmentId, - @NonNull String oneTimePassword, - @NonNull Result result); - - /** The codec used by MultiFactorTotpHostApi. */ - static @NonNull MessageCodec getCodec() { - return PigeonCodec.INSTANCE; - } - - /** - * Sets up an instance of `MultiFactorTotpHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setUp( - @NonNull BinaryMessenger binaryMessenger, @Nullable MultiFactorTotpHostApi api) { - setUp(binaryMessenger, "", api); - } - - static void setUp( - @NonNull BinaryMessenger binaryMessenger, - @NonNull String messageChannelSuffix, - @Nullable MultiFactorTotpHostApi api) { - messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpHostApi.generateSecret" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - String sessionIdArg = (String) args.get(0); - Result resultCallback = - new Result() { - public void success(InternalTotpSecret result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.generateSecret(sessionIdArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpHostApi.getAssertionForEnrollment" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - String secretKeyArg = (String) args.get(0); - String oneTimePasswordArg = (String) args.get(1); - Result resultCallback = - new Result() { - public void success(String result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.getAssertionForEnrollment(secretKeyArg, oneTimePasswordArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpHostApi.getAssertionForSignIn" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - String enrollmentIdArg = (String) args.get(0); - String oneTimePasswordArg = (String) args.get(1); - Result resultCallback = - new Result() { - public void success(String result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.getAssertionForSignIn(enrollmentIdArg, oneTimePasswordArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - } - } - - /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ - public interface MultiFactorTotpSecretHostApi { - - void generateQrCodeUrl( - @NonNull String secretKey, - @Nullable String accountName, - @Nullable String issuer, - @NonNull Result result); - - void openInOtpApp( - @NonNull String secretKey, @NonNull String qrCodeUrl, @NonNull VoidResult result); - - /** The codec used by MultiFactorTotpSecretHostApi. */ - static @NonNull MessageCodec getCodec() { - return PigeonCodec.INSTANCE; - } - - /** - * Sets up an instance of `MultiFactorTotpSecretHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setUp( - @NonNull BinaryMessenger binaryMessenger, @Nullable MultiFactorTotpSecretHostApi api) { - setUp(binaryMessenger, "", api); - } - - static void setUp( - @NonNull BinaryMessenger binaryMessenger, - @NonNull String messageChannelSuffix, - @Nullable MultiFactorTotpSecretHostApi api) { - messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpSecretHostApi.generateQrCodeUrl" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - String secretKeyArg = (String) args.get(0); - String accountNameArg = (String) args.get(1); - String issuerArg = (String) args.get(2); - Result resultCallback = - new Result() { - public void success(String result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.generateQrCodeUrl(secretKeyArg, accountNameArg, issuerArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpSecretHostApi.openInOtpApp" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - String secretKeyArg = (String) args.get(0); - String qrCodeUrlArg = (String) args.get(1); - VoidResult resultCallback = - new VoidResult() { - public void success() { - wrapped.add(0, null); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.openInOtpApp(secretKeyArg, qrCodeUrlArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - } - } - - /** - * Only used to generate the object interface that are use outside of the Pigeon interface - * - *

Generated interface from Pigeon that represents a handler of messages from Flutter. - */ - public interface GenerateInterfaces { - - void pigeonInterface(@NonNull InternalMultiFactorInfo info); - - /** The codec used by GenerateInterfaces. */ - static @NonNull MessageCodec getCodec() { - return PigeonCodec.INSTANCE; - } - - /** - * Sets up an instance of `GenerateInterfaces` to handle messages through the `binaryMessenger`. - */ - static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable GenerateInterfaces api) { - setUp(binaryMessenger, "", api); - } - - static void setUp( - @NonNull BinaryMessenger binaryMessenger, - @NonNull String messageChannelSuffix, - @Nullable GenerateInterfaces api) { - messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_auth_platform_interface.GenerateInterfaces.pigeonInterface" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - InternalMultiFactorInfo infoArg = (InternalMultiFactorInfo) args.get(0); - try { - api.pigeonInterface(infoArg); - wrapped.add(0, null); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - } - } -} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/IdTokenChannelStreamHandler.java b/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/IdTokenChannelStreamHandler.java deleted file mode 100644 index ae413a402f91..000000000000 --- a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/IdTokenChannelStreamHandler.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2022, 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. - */ - -package io.flutter.plugins.firebase.auth; - -import com.google.firebase.auth.FirebaseAuth; -import com.google.firebase.auth.FirebaseAuth.IdTokenListener; -import com.google.firebase.auth.FirebaseUser; -import io.flutter.plugin.common.EventChannel.EventSink; -import io.flutter.plugin.common.EventChannel.StreamHandler; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; - -public class IdTokenChannelStreamHandler implements StreamHandler { - - private final FirebaseAuth firebaseAuth; - private IdTokenListener idTokenListener; - - public IdTokenChannelStreamHandler(FirebaseAuth firebaseAuth) { - this.firebaseAuth = firebaseAuth; - } - - @Override - public void onListen(Object arguments, EventSink events) { - Map event = new HashMap<>(); - event.put(Constants.APP_NAME, firebaseAuth.getApp().getName()); - - final AtomicBoolean initialAuthState = new AtomicBoolean(true); - - idTokenListener = - auth -> { - if (initialAuthState.get()) { - initialAuthState.set(false); - return; - } - - FirebaseUser user = auth.getCurrentUser(); - - if (user == null) { - event.put(Constants.USER, null); - } else { - event.put( - Constants.USER, PigeonParser.manuallyToList(PigeonParser.parseFirebaseUser(user))); - } - - events.success(event); - }; - - firebaseAuth.addIdTokenListener(idTokenListener); - } - - @Override - public void onCancel(Object arguments) { - if (idTokenListener != null) { - firebaseAuth.removeIdTokenListener(idTokenListener); - idTokenListener = null; - } - } -} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/PhoneNumberVerificationStreamHandler.java b/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/PhoneNumberVerificationStreamHandler.java deleted file mode 100644 index a227be99a49d..000000000000 --- a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/PhoneNumberVerificationStreamHandler.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright 2022, 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. - */ - -package io.flutter.plugins.firebase.auth; - -import android.app.Activity; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.firebase.FirebaseException; -import com.google.firebase.auth.FirebaseAuth; -import com.google.firebase.auth.MultiFactorSession; -import com.google.firebase.auth.PhoneAuthCredential; -import com.google.firebase.auth.PhoneAuthOptions; -import com.google.firebase.auth.PhoneAuthProvider; -import com.google.firebase.auth.PhoneAuthProvider.ForceResendingToken; -import com.google.firebase.auth.PhoneMultiFactorInfo; -import io.flutter.plugin.common.EventChannel.EventSink; -import io.flutter.plugin.common.EventChannel.StreamHandler; -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicReference; - -public class PhoneNumberVerificationStreamHandler implements StreamHandler { - - interface OnCredentialsListener { - void onCredentialsReceived(PhoneAuthCredential credential); - } - - final AtomicReference activityRef = new AtomicReference<>(null); - final FirebaseAuth firebaseAuth; - final String phoneNumber; - final PhoneMultiFactorInfo multiFactorInfo; - final int timeout; - final OnCredentialsListener onCredentialsListener; - - final MultiFactorSession multiFactorSession; - - String autoRetrievedSmsCodeForTesting; - Integer forceResendingToken; - - private static final HashMap forceResendingTokens = new HashMap<>(); - - @Nullable private EventSink eventSink; - - public PhoneNumberVerificationStreamHandler( - Activity activity, - @NonNull GeneratedAndroidFirebaseAuth.AuthPigeonFirebaseApp app, - @NonNull GeneratedAndroidFirebaseAuth.InternalVerifyPhoneNumberRequest request, - @Nullable MultiFactorSession multiFactorSession, - @Nullable PhoneMultiFactorInfo multiFactorInfo, - OnCredentialsListener onCredentialsListener) { - this.activityRef.set(activity); - - this.multiFactorSession = multiFactorSession; - this.multiFactorInfo = multiFactorInfo; - firebaseAuth = FlutterFirebaseAuthPlugin.getAuthFromPigeon(app); - phoneNumber = request.getPhoneNumber(); - timeout = Math.toIntExact(request.getTimeout()); - - if (request.getAutoRetrievedSmsCodeForTesting() != null) { - autoRetrievedSmsCodeForTesting = request.getAutoRetrievedSmsCodeForTesting(); - } - - if (request.getForceResendingToken() != null) { - forceResendingToken = Math.toIntExact(request.getForceResendingToken()); - } - - this.onCredentialsListener = onCredentialsListener; - } - - @Override - public void onListen(Object arguments, EventSink events) { - eventSink = events; - - PhoneAuthProvider.OnVerificationStateChangedCallbacks callbacks = - new PhoneAuthProvider.OnVerificationStateChangedCallbacks() { - @Override - public void onVerificationCompleted(@NonNull PhoneAuthCredential phoneAuthCredential) { - int phoneAuthCredentialHashCode = phoneAuthCredential.hashCode(); - onCredentialsListener.onCredentialsReceived(phoneAuthCredential); - - Map event = new HashMap<>(); - event.put(Constants.TOKEN, phoneAuthCredentialHashCode); - - if (phoneAuthCredential.getSmsCode() != null) { - event.put(Constants.SMS_CODE, phoneAuthCredential.getSmsCode()); - } - - event.put(Constants.NAME, "Auth#phoneVerificationCompleted"); - - if (eventSink != null) { - eventSink.success(event); - } - } - - @Override - public void onVerificationFailed(@NonNull FirebaseException e) { - Map event = new HashMap<>(); - Map error = new HashMap<>(); - GeneratedAndroidFirebaseAuth.FlutterError flutterError = - FlutterFirebaseAuthPluginException.parserExceptionToFlutter(e); - error.put( - "code", - flutterError - .code - .replaceAll("ERROR_", "") - .toLowerCase(Locale.ROOT) - .replaceAll("_", "-")); - error.put("message", flutterError.getMessage()); - error.put("details", flutterError.details); - event.put("error", error); - - event.put(Constants.NAME, "Auth#phoneVerificationFailed"); - - if (eventSink != null) { - eventSink.success(event); - } - } - - @Override - public void onCodeSent( - @NonNull String verificationId, - @NonNull PhoneAuthProvider.ForceResendingToken token) { - int forceResendingTokenHashCode = token.hashCode(); - forceResendingTokens.put(forceResendingTokenHashCode, token); - - Map event = new HashMap<>(); - event.put(Constants.VERIFICATION_ID, verificationId); - event.put(Constants.FORCE_RESENDING_TOKEN, forceResendingTokenHashCode); - - event.put(Constants.NAME, "Auth#phoneCodeSent"); - - if (eventSink != null) { - eventSink.success(event); - } - } - - @Override - public void onCodeAutoRetrievalTimeOut(@NonNull String verificationId) { - Map event = new HashMap<>(); - event.put(Constants.VERIFICATION_ID, verificationId); - - event.put(Constants.NAME, "Auth#phoneCodeAutoRetrievalTimeout"); - - if (eventSink != null) { - eventSink.success(event); - } - } - }; - - // Allows the auto-retrieval flow to be tested. - // See https://firebase.google.com/docs/auth/android/phone-auth#integration-testing - if (autoRetrievedSmsCodeForTesting != null) { - firebaseAuth - .getFirebaseAuthSettings() - .setAutoRetrievedSmsCodeForPhoneNumber(phoneNumber, autoRetrievedSmsCodeForTesting); - } - - PhoneAuthOptions.Builder phoneAuthOptionsBuilder = new PhoneAuthOptions.Builder(firebaseAuth); - phoneAuthOptionsBuilder.setActivity(activityRef.get()); - phoneAuthOptionsBuilder.setCallbacks(callbacks); - - if (phoneNumber != null) { - phoneAuthOptionsBuilder.setPhoneNumber(phoneNumber); - } - if (multiFactorSession != null) { - phoneAuthOptionsBuilder.setMultiFactorSession(multiFactorSession); - } - if (multiFactorInfo != null) { - phoneAuthOptionsBuilder.setMultiFactorHint(multiFactorInfo); - } - phoneAuthOptionsBuilder.setTimeout((long) timeout, TimeUnit.MILLISECONDS); - - if (forceResendingToken != null) { - PhoneAuthProvider.ForceResendingToken forceResendingToken = - forceResendingTokens.get(this.forceResendingToken); - - if (forceResendingToken != null) { - phoneAuthOptionsBuilder.setForceResendingToken(forceResendingToken); - } - } - - PhoneAuthProvider.verifyPhoneNumber(phoneAuthOptionsBuilder.build()); - } - - @Override - public void onCancel(Object arguments) { - eventSink = null; - - activityRef.set(null); - } -} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/PigeonParser.java b/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/PigeonParser.java deleted file mode 100644 index 4c9e102a54ae..000000000000 --- a/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/PigeonParser.java +++ /dev/null @@ -1,382 +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. - */ - -package io.flutter.plugins.firebase.auth; - -import android.net.Uri; -import androidx.annotation.NonNull; -import com.google.firebase.auth.ActionCodeEmailInfo; -import com.google.firebase.auth.ActionCodeInfo; -import com.google.firebase.auth.ActionCodeResult; -import com.google.firebase.auth.ActionCodeSettings; -import com.google.firebase.auth.AdditionalUserInfo; -import com.google.firebase.auth.AuthCredential; -import com.google.firebase.auth.AuthResult; -import com.google.firebase.auth.EmailAuthProvider; -import com.google.firebase.auth.FacebookAuthProvider; -import com.google.firebase.auth.FirebaseAuthProvider; -import com.google.firebase.auth.FirebaseUser; -import com.google.firebase.auth.FirebaseUserMetadata; -import com.google.firebase.auth.GetTokenResult; -import com.google.firebase.auth.GithubAuthProvider; -import com.google.firebase.auth.GoogleAuthProvider; -import com.google.firebase.auth.MultiFactorInfo; -import com.google.firebase.auth.OAuthCredential; -import com.google.firebase.auth.OAuthProvider; -import com.google.firebase.auth.PhoneAuthProvider; -import com.google.firebase.auth.PhoneMultiFactorInfo; -import com.google.firebase.auth.PlayGamesAuthProvider; -import com.google.firebase.auth.TwitterAuthProvider; -import com.google.firebase.auth.UserInfo; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -public class PigeonParser { - static List manuallyToList( - GeneratedAndroidFirebaseAuth.InternalUserDetails pigeonUserDetails) { - List output = new ArrayList<>(); - output.add(pigeonUserDetails.getUserInfo().toList()); - output.add(pigeonUserDetails.getProviderData()); - return output; - } - - static GeneratedAndroidFirebaseAuth.InternalUserCredential parseAuthResult( - @NonNull AuthResult authResult) { - GeneratedAndroidFirebaseAuth.InternalUserCredential.Builder builder = - new GeneratedAndroidFirebaseAuth.InternalUserCredential.Builder(); - - builder.setAdditionalUserInfo(parseAdditionalUserInfo(authResult.getAdditionalUserInfo())); - builder.setCredential(parseAuthCredential(authResult.getCredential())); - builder.setUser(parseFirebaseUser(authResult.getUser())); - - return builder.build(); - } - - private static GeneratedAndroidFirebaseAuth.InternalAdditionalUserInfo parseAdditionalUserInfo( - AdditionalUserInfo additionalUserInfo) { - if (additionalUserInfo == null) { - return null; - } - - GeneratedAndroidFirebaseAuth.InternalAdditionalUserInfo.Builder builder = - new GeneratedAndroidFirebaseAuth.InternalAdditionalUserInfo.Builder(); - - builder.setIsNewUser(additionalUserInfo.isNewUser()); - builder.setProfile(additionalUserInfo.getProfile()); - builder.setProviderId(additionalUserInfo.getProviderId()); - builder.setUsername(additionalUserInfo.getUsername()); - - return builder.build(); - } - - static GeneratedAndroidFirebaseAuth.InternalAuthCredential parseAuthCredential( - AuthCredential authCredential) { - if (authCredential == null) { - return null; - } - - int authCredentialHashCode = authCredential.hashCode(); - FlutterFirebaseAuthPlugin.authCredentials.put(authCredentialHashCode, authCredential); - - GeneratedAndroidFirebaseAuth.InternalAuthCredential.Builder builder = - new GeneratedAndroidFirebaseAuth.InternalAuthCredential.Builder(); - - builder.setProviderId(authCredential.getProvider()); - builder.setSignInMethod(authCredential.getSignInMethod()); - builder.setNativeId((long) authCredentialHashCode); - if (authCredential instanceof OAuthCredential) { - builder.setAccessToken(((OAuthCredential) authCredential).getAccessToken()); - } - - return builder.build(); - } - - static GeneratedAndroidFirebaseAuth.InternalUserDetails parseFirebaseUser( - FirebaseUser firebaseUser) { - if (firebaseUser == null) { - return null; - } - - GeneratedAndroidFirebaseAuth.InternalUserDetails.Builder builder = - new GeneratedAndroidFirebaseAuth.InternalUserDetails.Builder(); - - GeneratedAndroidFirebaseAuth.InternalUserInfo.Builder builderInfo = - new GeneratedAndroidFirebaseAuth.InternalUserInfo.Builder(); - - builderInfo.setDisplayName(firebaseUser.getDisplayName()); - builderInfo.setEmail(firebaseUser.getEmail()); - builderInfo.setIsEmailVerified(firebaseUser.isEmailVerified()); - builderInfo.setIsAnonymous(firebaseUser.isAnonymous()); - - final FirebaseUserMetadata userMetadata = firebaseUser.getMetadata(); - if (userMetadata != null) { - builderInfo.setCreationTimestamp(firebaseUser.getMetadata().getCreationTimestamp()); - builderInfo.setLastSignInTimestamp(firebaseUser.getMetadata().getLastSignInTimestamp()); - } - builderInfo.setPhoneNumber(firebaseUser.getPhoneNumber()); - builderInfo.setPhotoUrl(parsePhotoUrl(firebaseUser.getPhotoUrl())); - builderInfo.setUid(firebaseUser.getUid()); - builderInfo.setTenantId(firebaseUser.getTenantId()); - - builder.setUserInfo(builderInfo.build()); - builder.setProviderData(parseUserInfoList(firebaseUser.getProviderData())); - - return builder.build(); - } - - private static List> parseUserInfoList( - List userInfoList) { - List> output = new ArrayList<>(); - - if (userInfoList == null) { - return null; - } - - for (UserInfo userInfo : new ArrayList(userInfoList)) { - if (userInfo == null) { - continue; - } - if (!FirebaseAuthProvider.PROVIDER_ID.equals(userInfo.getProviderId())) { - output.add(parseUserInfoToMap(userInfo)); - } - } - - return output; - } - - private static Map parseUserInfoToMap(UserInfo userInfo) { - Map output = new HashMap<>(); - output.put("displayName", userInfo.getDisplayName()); - output.put("email", userInfo.getEmail()); - output.put("isEmailVerified", userInfo.isEmailVerified()); - output.put("phoneNumber", userInfo.getPhoneNumber()); - output.put("photoUrl", parsePhotoUrl(userInfo.getPhotoUrl())); - // Can be null on Emulator - output.put("uid", userInfo.getUid() == null ? "" : userInfo.getUid()); - output.put("providerId", userInfo.getProviderId()); - output.put("isAnonymous", false); - return output; - } - - private static String parsePhotoUrl(Uri photoUri) { - if (photoUri == null) { - return null; - } - - String photoUrl = photoUri.toString(); - - // Return null if the URL is an empty string - return "".equals(photoUrl) ? null : photoUrl; - } - - @SuppressWarnings("ConstantConditions") - static AuthCredential getCredential(Map credentialMap) { - // If the credential map contains a token, it means a native one has been stored - if (credentialMap.get(Constants.TOKEN) != null) { - int token = ((Number) credentialMap.get(Constants.TOKEN)).intValue(); - AuthCredential credential = FlutterFirebaseAuthPlugin.authCredentials.get(token); - - if (credential == null) { - throw FlutterFirebaseAuthPluginException.invalidCredential(); - } - - return credential; - } - - String signInMethod = - (String) Objects.requireNonNull(credentialMap.get(Constants.SIGN_IN_METHOD)); - String secret = (String) credentialMap.get(Constants.SECRET); - String idToken = (String) credentialMap.get(Constants.ID_TOKEN); - String accessToken = (String) credentialMap.get(Constants.ACCESS_TOKEN); - String rawNonce = (String) credentialMap.get(Constants.RAW_NONCE); - - switch (signInMethod) { - case Constants.SIGN_IN_METHOD_PASSWORD: - return EmailAuthProvider.getCredential( - (String) Objects.requireNonNull(credentialMap.get(Constants.EMAIL)), - Objects.requireNonNull(secret)); - case Constants.SIGN_IN_METHOD_EMAIL_LINK: - return EmailAuthProvider.getCredentialWithLink( - (String) Objects.requireNonNull(credentialMap.get(Constants.EMAIL)), - (String) Objects.requireNonNull(credentialMap.get(Constants.EMAIL_LINK))); - case Constants.SIGN_IN_METHOD_FACEBOOK: - return FacebookAuthProvider.getCredential(Objects.requireNonNull(accessToken)); - case Constants.SIGN_IN_METHOD_GOOGLE: - return GoogleAuthProvider.getCredential(idToken, accessToken); - case Constants.SIGN_IN_METHOD_TWITTER: - return TwitterAuthProvider.getCredential( - Objects.requireNonNull(accessToken), Objects.requireNonNull(secret)); - case Constants.SIGN_IN_METHOD_GITHUB: - return GithubAuthProvider.getCredential(Objects.requireNonNull(accessToken)); - case Constants.SIGN_IN_METHOD_PHONE: - { - String verificationId = - (String) Objects.requireNonNull(credentialMap.get(Constants.VERIFICATION_ID)); - String smsCode = (String) Objects.requireNonNull(credentialMap.get(Constants.SMS_CODE)); - return PhoneAuthProvider.getCredential(verificationId, smsCode); - } - case Constants.SIGN_IN_METHOD_OAUTH: - { - String providerId = - (String) Objects.requireNonNull(credentialMap.get(Constants.PROVIDER_ID)); - OAuthProvider.CredentialBuilder builder = OAuthProvider.newCredentialBuilder(providerId); - if (accessToken != null) { - builder.setAccessToken(accessToken); - } - if (rawNonce == null) { - builder.setIdToken(Objects.requireNonNull(idToken)); - } else { - builder.setIdTokenWithRawNonce(Objects.requireNonNull(idToken), rawNonce); - } - - return builder.build(); - } - case Constants.SIGN_IN_METHOD_PLAY_GAMES: - { - String serverAuthCode = - (String) Objects.requireNonNull(credentialMap.get(Constants.SERVER_AUTH_CODE)); - return PlayGamesAuthProvider.getCredential(serverAuthCode); - } - default: - return null; - } - } - - static ActionCodeSettings getActionCodeSettings( - @NonNull GeneratedAndroidFirebaseAuth.InternalActionCodeSettings pigeonActionCodeSettings) { - ActionCodeSettings.Builder builder = ActionCodeSettings.newBuilder(); - - builder.setUrl(pigeonActionCodeSettings.getUrl()); - - if (pigeonActionCodeSettings.getDynamicLinkDomain() != null) { - builder.setDynamicLinkDomain(pigeonActionCodeSettings.getDynamicLinkDomain()); - } - - if (pigeonActionCodeSettings.getLinkDomain() != null) { - builder.setLinkDomain(pigeonActionCodeSettings.getLinkDomain()); - } - - builder.setHandleCodeInApp(pigeonActionCodeSettings.getHandleCodeInApp()); - - if (pigeonActionCodeSettings.getAndroidPackageName() != null) { - builder.setAndroidPackageName( - pigeonActionCodeSettings.getAndroidPackageName(), - pigeonActionCodeSettings.getAndroidInstallApp(), - pigeonActionCodeSettings.getAndroidMinimumVersion()); - } - - if (pigeonActionCodeSettings.getIOSBundleId() != null) { - builder.setIOSBundleId(pigeonActionCodeSettings.getIOSBundleId()); - } - - return builder.build(); - } - - static List multiFactorInfoToPigeon( - List hints) { - List pigeonHints = new ArrayList<>(); - for (MultiFactorInfo info : hints) { - if (info instanceof PhoneMultiFactorInfo) { - pigeonHints.add( - new GeneratedAndroidFirebaseAuth.InternalMultiFactorInfo.Builder() - .setPhoneNumber(((PhoneMultiFactorInfo) info).getPhoneNumber()) - .setDisplayName(info.getDisplayName()) - .setEnrollmentTimestamp((double) info.getEnrollmentTimestamp()) - .setUid(info.getUid()) - .setFactorId(info.getFactorId()) - .build()); - - } else { - pigeonHints.add( - new GeneratedAndroidFirebaseAuth.InternalMultiFactorInfo.Builder() - .setDisplayName(info.getDisplayName()) - .setEnrollmentTimestamp((double) info.getEnrollmentTimestamp()) - .setUid(info.getUid()) - .setFactorId(info.getFactorId()) - .build()); - } - } - return pigeonHints; - } - - static List> multiFactorInfoToMap(List hints) { - List> pigeonHints = new ArrayList<>(); - for (GeneratedAndroidFirebaseAuth.InternalMultiFactorInfo info : - multiFactorInfoToPigeon(hints)) { - pigeonHints.add(info.toList()); - } - return pigeonHints; - } - - static GeneratedAndroidFirebaseAuth.InternalActionCodeInfo parseActionCodeResult( - @NonNull ActionCodeResult actionCodeResult) { - GeneratedAndroidFirebaseAuth.InternalActionCodeInfo.Builder builder = - new GeneratedAndroidFirebaseAuth.InternalActionCodeInfo.Builder(); - GeneratedAndroidFirebaseAuth.InternalActionCodeInfoData.Builder builderData = - new GeneratedAndroidFirebaseAuth.InternalActionCodeInfoData.Builder(); - - int operation = actionCodeResult.getOperation(); - - switch (operation) { - case ActionCodeResult.PASSWORD_RESET: - builder.setOperation(GeneratedAndroidFirebaseAuth.ActionCodeInfoOperation.PASSWORD_RESET); - break; - case ActionCodeResult.VERIFY_EMAIL: - builder.setOperation(GeneratedAndroidFirebaseAuth.ActionCodeInfoOperation.VERIFY_EMAIL); - break; - case ActionCodeResult.RECOVER_EMAIL: - builder.setOperation(GeneratedAndroidFirebaseAuth.ActionCodeInfoOperation.RECOVER_EMAIL); - break; - case ActionCodeResult.SIGN_IN_WITH_EMAIL_LINK: - builder.setOperation(GeneratedAndroidFirebaseAuth.ActionCodeInfoOperation.EMAIL_SIGN_IN); - break; - case ActionCodeResult.VERIFY_BEFORE_CHANGE_EMAIL: - builder.setOperation( - GeneratedAndroidFirebaseAuth.ActionCodeInfoOperation.VERIFY_AND_CHANGE_EMAIL); - break; - case ActionCodeResult.REVERT_SECOND_FACTOR_ADDITION: - builder.setOperation( - GeneratedAndroidFirebaseAuth.ActionCodeInfoOperation.REVERT_SECOND_FACTOR_ADDITION); - break; - } - - ActionCodeInfo actionCodeInfo = actionCodeResult.getInfo(); - - if (actionCodeInfo != null && operation == ActionCodeResult.VERIFY_EMAIL - || operation == ActionCodeResult.PASSWORD_RESET) { - builderData.setEmail(actionCodeInfo.getEmail()); - } else if (operation == ActionCodeResult.RECOVER_EMAIL - || operation == ActionCodeResult.VERIFY_BEFORE_CHANGE_EMAIL) { - ActionCodeEmailInfo actionCodeEmailInfo = - (ActionCodeEmailInfo) Objects.requireNonNull(actionCodeInfo); - builderData.setEmail(actionCodeEmailInfo.getEmail()); - builderData.setPreviousEmail(actionCodeEmailInfo.getPreviousEmail()); - } - - builder.setData(builderData.build()); - - return builder.build(); - } - - static GeneratedAndroidFirebaseAuth.InternalIdTokenResult parseTokenResult( - @NonNull GetTokenResult tokenResult) { - final GeneratedAndroidFirebaseAuth.InternalIdTokenResult.Builder builder = - new GeneratedAndroidFirebaseAuth.InternalIdTokenResult.Builder(); - - builder.setToken(tokenResult.getToken()); - builder.setSignInProvider(tokenResult.getSignInProvider()); - builder.setAuthTimestamp(tokenResult.getAuthTimestamp() * 1000); - builder.setExpirationTimestamp(tokenResult.getExpirationTimestamp() * 1000); - builder.setIssuedAtTimestamp(tokenResult.getIssuedAtTimestamp() * 1000); - builder.setClaims(tokenResult.getClaims()); - builder.setSignInSecondFactor(tokenResult.getSignInSecondFactor()); - - return builder.build(); - } -} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/AuthStateChannelStreamHandler.kt b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/AuthStateChannelStreamHandler.kt new file mode 100644 index 000000000000..ee38cbff3679 --- /dev/null +++ b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/AuthStateChannelStreamHandler.kt @@ -0,0 +1,48 @@ +/* + * Copyright 2022, 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. + */ +package io.flutter.plugins.firebase.auth + +import com.google.firebase.auth.FirebaseAuth +import io.flutter.plugin.common.EventChannel.EventSink +import io.flutter.plugin.common.EventChannel.StreamHandler +import java.util.concurrent.atomic.AtomicBoolean + +class AuthStateChannelStreamHandler(private val firebaseAuth: FirebaseAuth) : StreamHandler { + private var authStateListener: FirebaseAuth.AuthStateListener? = null + + override fun onListen(arguments: Any?, events: EventSink) { + val event: MutableMap = HashMap() + event[Constants.APP_NAME] = firebaseAuth.app.name + + val initialAuthState = AtomicBoolean(true) + + authStateListener = + FirebaseAuth.AuthStateListener { auth -> + if (initialAuthState.get()) { + initialAuthState.set(false) + return@AuthStateListener + } + + val user = auth.currentUser + if (user == null) { + event[Constants.USER] = null + } else { + event[Constants.USER] = PigeonParser.manuallyToList(PigeonParser.parseFirebaseUser(user)!!) + } + + events.success(event) + } + + firebaseAuth.addAuthStateListener(authStateListener!!) + } + + override fun onCancel(arguments: Any?) { + if (authStateListener != null) { + firebaseAuth.removeAuthStateListener(authStateListener!!) + authStateListener = null + } + } +} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/Constants.kt b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/Constants.kt new file mode 100644 index 000000000000..be7aa931feb1 --- /dev/null +++ b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/Constants.kt @@ -0,0 +1,42 @@ +/* + * Copyright 2022, 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. + */ +package io.flutter.plugins.firebase.auth + +object Constants { + const val APP_NAME = "appName" + + const val SIGN_IN_METHOD_PASSWORD = "password" + const val SIGN_IN_METHOD_EMAIL_LINK = "emailLink" + const val SIGN_IN_METHOD_FACEBOOK = "facebook.com" + const val SIGN_IN_METHOD_GOOGLE = "google.com" + const val SIGN_IN_METHOD_TWITTER = "twitter.com" + const val SIGN_IN_METHOD_GITHUB = "github.com" + const val SIGN_IN_METHOD_PHONE = "phone" + const val SIGN_IN_METHOD_OAUTH = "oauth" + const val SIGN_IN_METHOD_PLAY_GAMES = "playgames.google.com" + + const val USER = "user" + const val EMAIL = "email" + + const val PROVIDER_ID = "providerId" + const val CREDENTIAL = "credential" + const val SECRET = "secret" + const val ID_TOKEN = "idToken" + const val TOKEN = "token" + const val ACCESS_TOKEN = "accessToken" + const val RAW_NONCE = "rawNonce" + const val EMAIL_LINK = "emailLink" + const val VERIFICATION_ID = "verificationId" + const val SMS_CODE = "smsCode" + const val SIGN_IN_METHOD = "signInMethod" + const val FORCE_RESENDING_TOKEN = "forceResendingToken" + const val NAME = "name" + const val SERVER_AUTH_CODE = "serverAuthCode" + + const val MULTI_FACTOR_HINTS = "multiFactorHints" + const val MULTI_FACTOR_SESSION_ID = "multiFactorSessionId" + const val MULTI_FACTOR_RESOLVER_ID = "multiFactorResolverId" +} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPlugin.kt b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPlugin.kt new file mode 100644 index 000000000000..6faa0480774d --- /dev/null +++ b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPlugin.kt @@ -0,0 +1,551 @@ +// Copyright 2017 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. +package io.flutter.plugins.firebase.auth + +import android.app.Activity +import com.google.android.gms.tasks.Task +import com.google.android.gms.tasks.TaskCompletionSource +import com.google.firebase.FirebaseApp +import com.google.firebase.auth.AuthCredential +import com.google.firebase.auth.FirebaseAuth +import com.google.firebase.auth.OAuthProvider +import com.google.firebase.auth.PhoneMultiFactorInfo +import io.flutter.embedding.engine.plugins.FlutterPlugin +import io.flutter.embedding.engine.plugins.activity.ActivityAware +import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding +import io.flutter.plugin.common.BinaryMessenger +import io.flutter.plugin.common.EventChannel +import io.flutter.plugin.common.EventChannel.StreamHandler +import io.flutter.plugin.common.MethodChannel +import io.flutter.plugins.firebase.core.FlutterFirebaseCorePlugin +import io.flutter.plugins.firebase.core.FlutterFirebasePlugin +import io.flutter.plugins.firebase.core.FlutterFirebasePlugin.cachedThreadPool +import io.flutter.plugins.firebase.core.FlutterFirebasePluginRegistry +import java.util.UUID + +/** Flutter plugin for Firebase Auth. */ +class FlutterFirebaseAuthPlugin : FlutterFirebasePlugin, FlutterPlugin, ActivityAware, FirebaseAuthHostApi { + private var messenger: BinaryMessenger? = null + private var channel: MethodChannel? = null + private var activity: Activity? = null + private val streamHandlers: MutableMap = HashMap() + private val firebaseAuthUser = FlutterFirebaseAuthUser() + private val firebaseMultiFactor = FlutterFirebaseMultiFactor() + private val firebaseTotpMultiFactor = FlutterFirebaseTotpMultiFactor() + private val firebaseTotpSecret = FlutterFirebaseTotpSecret() + + private fun initInstance(messenger: BinaryMessenger) { + FlutterFirebasePluginRegistry.registerPlugin(METHOD_CHANNEL_NAME, this) + channel = MethodChannel(messenger, METHOD_CHANNEL_NAME) + FirebaseAuthHostApi.setUp(messenger, this) + FirebaseAuthUserHostApi.setUp(messenger, firebaseAuthUser) + MultiFactorUserHostApi.setUp(messenger, firebaseMultiFactor) + MultiFactoResolverHostApi.setUp(messenger, firebaseMultiFactor) + MultiFactorTotpHostApi.setUp(messenger, firebaseTotpMultiFactor) + MultiFactorTotpSecretHostApi.setUp(messenger, firebaseTotpSecret) + this.messenger = messenger + } + + override fun onAttachedToEngine(binding: FlutterPlugin.FlutterPluginBinding) { + initInstance(binding.binaryMessenger) + } + + override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) { + channel?.setMethodCallHandler(null) + + val resolvedMessenger = checkNotNull(messenger) + FirebaseAuthHostApi.setUp(resolvedMessenger, null) + FirebaseAuthUserHostApi.setUp(resolvedMessenger, null) + MultiFactorUserHostApi.setUp(resolvedMessenger, null) + MultiFactoResolverHostApi.setUp(resolvedMessenger, null) + MultiFactorTotpHostApi.setUp(resolvedMessenger, null) + MultiFactorTotpSecretHostApi.setUp(resolvedMessenger, null) + + channel = null + messenger = null + removeEventListeners() + } + + override fun onAttachedToActivity(activityPluginBinding: ActivityPluginBinding) { + activity = activityPluginBinding.activity + firebaseAuthUser.setActivity(activity) + } + + override fun onDetachedFromActivityForConfigChanges() { + activity = null + firebaseAuthUser.setActivity(null) + } + + override fun onReattachedToActivityForConfigChanges(activityPluginBinding: ActivityPluginBinding) { + activity = activityPluginBinding.activity + firebaseAuthUser.setActivity(activity) + } + + override fun onDetachedFromActivity() { + activity = null + firebaseAuthUser.setActivity(null) + } + + private fun getActivity(): Activity? { + return activity + } + + override fun registerIdTokenListener(app: AuthPigeonFirebaseApp, callback: (Result) -> Unit) { + try { + val auth = getAuthFromPigeon(app) + val handler = IdTokenChannelStreamHandler(auth) + val name = "$METHOD_CHANNEL_NAME/id-token/${auth.app.name}" + val eventChannel = EventChannel(messenger, name) + eventChannel.setStreamHandler(handler) + streamHandlers[eventChannel] = handler + callback(Result.success(name)) + } catch (e: Exception) { + callback(Result.failure(e)) + } + } + + override fun registerAuthStateListener( + app: AuthPigeonFirebaseApp, + callback: (Result) -> Unit + ) { + try { + val auth = getAuthFromPigeon(app) + val handler = AuthStateChannelStreamHandler(auth) + val name = "$METHOD_CHANNEL_NAME/auth-state/${auth.app.name}" + val eventChannel = EventChannel(messenger, name) + eventChannel.setStreamHandler(handler) + streamHandlers[eventChannel] = handler + callback(Result.success(name)) + } catch (e: Exception) { + callback(Result.failure(e)) + } + } + + override fun useEmulator( + app: AuthPigeonFirebaseApp, + host: String, + port: Long, + callback: (Result) -> Unit + ) { + try { + getAuthFromPigeon(app).useEmulator(host, port.toInt()) + callback(Result.success(Unit)) + } catch (e: Exception) { + callback(Result.failure(e)) + } + } + + override fun applyActionCode( + app: AuthPigeonFirebaseApp, + code: String, + callback: (Result) -> Unit + ) { + getAuthFromPigeon(app).applyActionCode(code).addOnCompleteListener { task -> + completeVoid(task, callback) + } + } + + override fun checkActionCode( + app: AuthPigeonFirebaseApp, + code: String, + callback: (Result) -> Unit + ) { + getAuthFromPigeon(app).checkActionCode(code).addOnCompleteListener { task -> + if (task.isSuccessful) { + callback(Result.success(PigeonParser.parseActionCodeResult(task.result))) + } else { + callback( + Result.failure( + FlutterFirebaseAuthPluginException.parserExceptionToFlutter(task.exception))) + } + } + } + + override fun confirmPasswordReset( + app: AuthPigeonFirebaseApp, + code: String, + newPassword: String, + callback: (Result) -> Unit + ) { + getAuthFromPigeon(app).confirmPasswordReset(code, newPassword).addOnCompleteListener { task -> + completeVoid(task, callback) + } + } + + override fun createUserWithEmailAndPassword( + app: AuthPigeonFirebaseApp, + email: String, + password: String, + callback: (Result) -> Unit + ) { + getAuthFromPigeon(app) + .createUserWithEmailAndPassword(email, password) + .addOnCompleteListener { task -> completeAuthResult(task, callback) } + } + + override fun signInAnonymously( + app: AuthPigeonFirebaseApp, + callback: (Result) -> Unit + ) { + getAuthFromPigeon(app).signInAnonymously().addOnCompleteListener { task -> + completeAuthResult(task, callback) + } + } + + override fun signInWithCredential( + app: AuthPigeonFirebaseApp, + input: Map, + callback: (Result) -> Unit + ) { + val credential = PigeonParser.getCredential(input) + if (credential == null) { + callback(Result.failure(FlutterFirebaseAuthPluginException.invalidCredential())) + return + } + getAuthFromPigeon(app).signInWithCredential(credential).addOnCompleteListener { task -> + completeAuthResult(task, callback) + } + } + + override fun signInWithCustomToken( + app: AuthPigeonFirebaseApp, + token: String, + callback: (Result) -> Unit + ) { + getAuthFromPigeon(app).signInWithCustomToken(token).addOnCompleteListener { task -> + completeAuthResult(task, callback) + } + } + + override fun signInWithEmailAndPassword( + app: AuthPigeonFirebaseApp, + email: String, + password: String, + callback: (Result) -> Unit + ) { + getAuthFromPigeon(app) + .signInWithEmailAndPassword(email, password) + .addOnCompleteListener { task -> completeAuthResult(task, callback) } + } + + override fun signInWithEmailLink( + app: AuthPigeonFirebaseApp, + email: String, + emailLink: String, + callback: (Result) -> Unit + ) { + getAuthFromPigeon(app).signInWithEmailLink(email, emailLink).addOnCompleteListener { task -> + completeAuthResult(task, callback) + } + } + + override fun signInWithProvider( + app: AuthPigeonFirebaseApp, + signInProvider: InternalSignInProvider, + callback: (Result) -> Unit + ) { + val firebaseAuth = getAuthFromPigeon(app) + val provider = OAuthProvider.newBuilder(signInProvider.providerId, firebaseAuth) + signInProvider.scopes?.filterNotNull()?.let { provider.setScopes(it) } + signInProvider.customParameters?.let { params -> + val converted = HashMap() + for ((key, value) in params) { + if (key != null && value != null) { + converted[key] = value + } + } + provider.addCustomParameters(converted) + } + + firebaseAuth + .startActivityForSignInWithProvider(checkNotNull(getActivity()), provider.build()) + .addOnCompleteListener { task -> completeAuthResult(task, callback) } + } + + override fun signOut(app: AuthPigeonFirebaseApp, callback: (Result) -> Unit) { + try { + val firebaseAuth = getAuthFromPigeon(app) + if (firebaseAuth.currentUser != null) { + FlutterFirebaseMultiFactor.multiFactorUserMap[app.appName]?.remove( + firebaseAuth.currentUser!!.uid) + } + firebaseAuth.signOut() + callback(Result.success(Unit)) + } catch (e: Exception) { + callback(Result.failure(e)) + } + } + + override fun fetchSignInMethodsForEmail( + app: AuthPigeonFirebaseApp, + email: String, + callback: (Result>) -> Unit + ) { + getAuthFromPigeon(app).fetchSignInMethodsForEmail(email).addOnCompleteListener { task -> + if (task.isSuccessful) { + callback(Result.success(task.result.signInMethods?.filterNotNull() ?: emptyList())) + } else { + callback( + Result.failure( + FlutterFirebaseAuthPluginException.parserExceptionToFlutter(task.exception))) + } + } + } + + override fun sendPasswordResetEmail( + app: AuthPigeonFirebaseApp, + email: String, + actionCodeSettings: InternalActionCodeSettings?, + callback: (Result) -> Unit + ) { + val firebaseAuth = getAuthFromPigeon(app) + val task = + if (actionCodeSettings == null) { + firebaseAuth.sendPasswordResetEmail(email) + } else { + firebaseAuth.sendPasswordResetEmail( + email, PigeonParser.getActionCodeSettings(actionCodeSettings)) + } + task.addOnCompleteListener { completed -> completeVoid(completed, callback) } + } + + override fun sendSignInLinkToEmail( + app: AuthPigeonFirebaseApp, + email: String, + actionCodeSettings: InternalActionCodeSettings, + callback: (Result) -> Unit + ) { + getAuthFromPigeon(app) + .sendSignInLinkToEmail(email, PigeonParser.getActionCodeSettings(actionCodeSettings)) + .addOnCompleteListener { task -> completeVoid(task, callback) } + } + + override fun setLanguageCode( + app: AuthPigeonFirebaseApp, + languageCode: String?, + callback: (Result) -> Unit + ) { + try { + val firebaseAuth = getAuthFromPigeon(app) + if (languageCode == null) { + firebaseAuth.useAppLanguage() + } else { + firebaseAuth.setLanguageCode(languageCode) + } + callback(Result.success(firebaseAuth.languageCode ?: "")) + } catch (e: Exception) { + callback(Result.failure(e)) + } + } + + override fun setSettings( + app: AuthPigeonFirebaseApp, + settings: InternalFirebaseAuthSettings, + callback: (Result) -> Unit + ) { + try { + val firebaseAuth = getAuthFromPigeon(app) + firebaseAuth + .firebaseAuthSettings + .setAppVerificationDisabledForTesting(settings.appVerificationDisabledForTesting) + + if (settings.forceRecaptchaFlow != null) { + firebaseAuth.firebaseAuthSettings.forceRecaptchaFlowForTesting( + settings.forceRecaptchaFlow!!) + } + + if (settings.phoneNumber != null && settings.smsCode != null) { + firebaseAuth + .firebaseAuthSettings + .setAutoRetrievedSmsCodeForPhoneNumber(settings.phoneNumber, settings.smsCode) + } + + callback(Result.success(Unit)) + } catch (e: Exception) { + callback(Result.failure(e)) + } + } + + override fun verifyPasswordResetCode( + app: AuthPigeonFirebaseApp, + code: String, + callback: (Result) -> Unit + ) { + getAuthFromPigeon(app).verifyPasswordResetCode(code).addOnCompleteListener { task -> + if (task.isSuccessful) { + callback(Result.success(task.result ?: "")) + } else { + callback( + Result.failure( + FlutterFirebaseAuthPluginException.parserExceptionToFlutter(task.exception))) + } + } + } + + override fun verifyPhoneNumber( + app: AuthPigeonFirebaseApp, + request: InternalVerifyPhoneNumberRequest, + callback: (Result) -> Unit + ) { + try { + val eventChannelName = "$METHOD_CHANNEL_NAME/phone/${UUID.randomUUID()}" + val eventChannel = EventChannel(messenger, eventChannelName) + + var multiFactorSession: com.google.firebase.auth.MultiFactorSession? = null + if (request.multiFactorSessionId != null) { + multiFactorSession = + FlutterFirebaseMultiFactor.multiFactorSessionMap[request.multiFactorSessionId] + } + + val multiFactorInfoId = request.multiFactorInfoId + var multiFactorInfo: PhoneMultiFactorInfo? = null + if (multiFactorInfoId != null) { + for (resolver in FlutterFirebaseMultiFactor.multiFactorResolverMap.values) { + for (info in resolver.hints) { + if (info.uid == multiFactorInfoId && info is PhoneMultiFactorInfo) { + multiFactorInfo = info + break + } + } + } + } + + val handler = + PhoneNumberVerificationStreamHandler( + getActivity(), + app, + request, + multiFactorSession, + multiFactorInfo) { credential -> + authCredentials[credential.hashCode()] = credential + } + + eventChannel.setStreamHandler(handler) + streamHandlers[eventChannel] = handler + callback(Result.success(eventChannelName)) + } catch (e: Exception) { + callback(Result.failure(e)) + } + } + + override fun revokeTokenWithAuthorizationCode( + app: AuthPigeonFirebaseApp, + authorizationCode: String, + callback: (Result) -> Unit + ) { + callback(Result.success(Unit)) + } + + override fun revokeAccessToken( + app: AuthPigeonFirebaseApp, + accessToken: String, + callback: (Result) -> Unit + ) { + getAuthFromPigeon(app).revokeAccessToken(accessToken).addOnCompleteListener { task -> + completeVoid(task, callback) + } + } + + override fun initializeRecaptchaConfig( + app: AuthPigeonFirebaseApp, + callback: (Result) -> Unit + ) { + getAuthFromPigeon(app).initializeRecaptchaConfig().addOnCompleteListener { task -> + completeVoid(task, callback) + } + } + + override fun getPluginConstantsForFirebaseApp( + firebaseApp: FirebaseApp? + ): Task> { + val taskCompletionSource = TaskCompletionSource>() + + cachedThreadPool.execute { + try { + val constants = HashMap() + val firebaseAuth = FirebaseAuth.getInstance(firebaseApp!!) + val firebaseUser = firebaseAuth.currentUser + val languageCode = firebaseAuth.languageCode + val user = PigeonParser.parseFirebaseUser(firebaseUser) + + if (languageCode != null) { + constants["APP_LANGUAGE_CODE"] = languageCode + } + if (user != null) { + constants["APP_CURRENT_USER"] = PigeonParser.manuallyToList(user) + } + + taskCompletionSource.setResult(constants) + } catch (e: Exception) { + taskCompletionSource.setException(e) + } + } + + return taskCompletionSource.task + } + + override fun didReinitializeFirebaseCore(): Task { + val taskCompletionSource = TaskCompletionSource() + + cachedThreadPool.execute { + try { + removeEventListeners() + authCredentials.clear() + taskCompletionSource.setResult(null) + } catch (e: Exception) { + taskCompletionSource.setException(e) + } + } + + return taskCompletionSource.task + } + + private fun removeEventListeners() { + for ((eventChannel, streamHandler) in streamHandlers) { + streamHandler.onCancel(null) + eventChannel.setStreamHandler(null) + } + streamHandlers.clear() + } + + private fun completeVoid(task: Task<*>, callback: (Result) -> Unit) { + if (task.isSuccessful) { + callback(Result.success(Unit)) + } else { + callback( + Result.failure( + FlutterFirebaseAuthPluginException.parserExceptionToFlutter(task.exception))) + } + } + + private fun completeAuthResult( + task: Task, + callback: (Result) -> Unit + ) { + if (task.isSuccessful) { + callback(Result.success(PigeonParser.parseAuthResult(task.result))) + } else { + callback( + Result.failure( + FlutterFirebaseAuthPluginException.parserExceptionToFlutter(task.exception))) + } + } + + companion object { + private const val METHOD_CHANNEL_NAME = "plugins.flutter.io/firebase_auth" + val authCredentials: HashMap = HashMap() + + fun getAuthFromPigeon(pigeonApp: AuthPigeonFirebaseApp): FirebaseAuth { + val app = FirebaseApp.getInstance(pigeonApp.appName) + val auth = FirebaseAuth.getInstance(app) + pigeonApp.tenantId?.let { auth.setTenantId(it) } + val customDomain = FlutterFirebaseCorePlugin.customAuthDomain[pigeonApp.appName] + if (customDomain != null) { + auth.setCustomAuthDomain(customDomain) + } + pigeonApp.customAuthDomain?.let { auth.setCustomAuthDomain(it) } + return auth + } + } +} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPluginException.kt b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPluginException.kt new file mode 100644 index 000000000000..c7c72300eb38 --- /dev/null +++ b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPluginException.kt @@ -0,0 +1,125 @@ +/* + * Copyright 2022, 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. + */ +package io.flutter.plugins.firebase.auth + +import com.google.firebase.FirebaseApiNotAvailableException +import com.google.firebase.FirebaseNetworkException +import com.google.firebase.FirebaseTooManyRequestsException +import com.google.firebase.auth.FirebaseAuthException +import com.google.firebase.auth.FirebaseAuthMultiFactorException +import com.google.firebase.auth.FirebaseAuthUserCollisionException +import com.google.firebase.auth.FirebaseAuthWeakPasswordException +import java.util.UUID + +object FlutterFirebaseAuthPluginException { + fun parserExceptionToFlutter(nativeException: Exception?): FlutterError { + if (nativeException == null) { + return FlutterError("UNKNOWN", null, null) + } + var code = "UNKNOWN" + var message = nativeException.message + val additionalData = HashMap() + + if (nativeException is FirebaseAuthMultiFactorException) { + val output = HashMap() + val multiFactorResolver = nativeException.resolver + val hints = multiFactorResolver.hints + val session = multiFactorResolver.session + val sessionId = UUID.randomUUID().toString() + FlutterFirebaseMultiFactor.multiFactorSessionMap[sessionId] = session + + val resolverId = UUID.randomUUID().toString() + FlutterFirebaseMultiFactor.multiFactorResolverMap[resolverId] = multiFactorResolver + + val pigeonHints = PigeonParser.multiFactorInfoToMap(hints) + + output[Constants.APP_NAME] = nativeException.resolver.firebaseAuth.app.name + output[Constants.MULTI_FACTOR_HINTS] = pigeonHints + output[Constants.MULTI_FACTOR_SESSION_ID] = sessionId + output[Constants.MULTI_FACTOR_RESOLVER_ID] = resolverId + + return FlutterError(nativeException.errorCode, nativeException.localizedMessage, output) + } + + if (nativeException is FirebaseNetworkException || + nativeException.cause is FirebaseNetworkException) { + return FlutterError( + "network-request-failed", + "A network error (such as timeout, interrupted connection or unreachable host) has occurred.", + null) + } + + if (nativeException is FirebaseApiNotAvailableException || + nativeException.cause is FirebaseApiNotAvailableException) { + return FlutterError("api-not-available", "The requested API is not available.", null) + } + + if (nativeException is FirebaseTooManyRequestsException || + nativeException.cause is FirebaseTooManyRequestsException) { + return FlutterError( + "too-many-requests", + "We have blocked all requests from this device due to unusual activity. Try again later.", + null) + } + + if (nativeException.message != null && + nativeException + .message!! + .startsWith("Cannot create PhoneAuthCredential without either verificationProof")) { + return FlutterError( + "invalid-verification-code", + "The verification ID used to create the phone auth credential is invalid.", + null) + } + + if (message != null && message.contains("User has already been linked to the given provider.")) { + return alreadyLinkedProvider() + } + + if (nativeException is FirebaseAuthException) { + code = nativeException.errorCode + } + + if (nativeException is FirebaseAuthWeakPasswordException) { + message = nativeException.reason + } + + if (nativeException is FirebaseAuthUserCollisionException) { + val email = nativeException.email + if (email != null) { + additionalData["email"] = email + } + + val authCredential = nativeException.updatedCredential + if (authCredential != null) { + additionalData["authCredential"] = PigeonParser.parseAuthCredential(authCredential) + } + } + + return FlutterError(code, message, additionalData) + } + + fun noUser(): FlutterError { + return FlutterError("NO_CURRENT_USER", "No user currently signed in.", null) + } + + fun invalidCredential(): FlutterError { + return FlutterError( + "INVALID_CREDENTIAL", + "The supplied auth credential is malformed, has expired or is not currently supported.", + null) + } + + fun noSuchProvider(): FlutterError { + return FlutterError( + "NO_SUCH_PROVIDER", "User was not linked to an account with the given provider.", null) + } + + fun alreadyLinkedProvider(): FlutterError { + return FlutterError( + "PROVIDER_ALREADY_LINKED", "User has already been linked to the given provider.", null) + } +} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthRegistrar.kt b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthRegistrar.kt new file mode 100644 index 000000000000..005f2be3430e --- /dev/null +++ b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthRegistrar.kt @@ -0,0 +1,17 @@ +// Copyright 2019 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. +package io.flutter.plugins.firebase.auth + +import androidx.annotation.Keep +import com.google.firebase.components.Component +import com.google.firebase.components.ComponentRegistrar +import com.google.firebase.platforminfo.LibraryVersionComponent + +@Keep +class FlutterFirebaseAuthRegistrar : ComponentRegistrar { + override fun getComponents(): List> { + return listOf( + LibraryVersionComponent.create(BuildConfig.LIBRARY_NAME, BuildConfig.LIBRARY_VERSION)) + } +} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthUser.kt b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthUser.kt new file mode 100644 index 000000000000..05dd6a581e40 --- /dev/null +++ b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthUser.kt @@ -0,0 +1,380 @@ +/* + * 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. + */ +package io.flutter.plugins.firebase.auth + +import android.app.Activity +import android.net.Uri +import com.google.android.gms.tasks.Tasks +import com.google.firebase.FirebaseApp +import com.google.firebase.auth.FirebaseAuth +import com.google.firebase.auth.FirebaseUser +import com.google.firebase.auth.OAuthProvider +import com.google.firebase.auth.PhoneAuthCredential +import com.google.firebase.auth.UserProfileChangeRequest +import io.flutter.plugins.firebase.core.FlutterFirebasePlugin.cachedThreadPool + +class FlutterFirebaseAuthUser : FirebaseAuthUserHostApi { + private var activity: Activity? = null + + fun setActivity(activity: Activity?) { + this.activity = activity + } + + override fun delete(app: AuthPigeonFirebaseApp, callback: (Result) -> Unit) { + val firebaseUser = getCurrentUserFromPigeon(app) + if (firebaseUser == null) { + callback(Result.failure(FlutterFirebaseAuthPluginException.noUser())) + return + } + + firebaseUser.delete().addOnCompleteListener { task -> + if (task.isSuccessful) { + callback(Result.success(Unit)) + } else { + callback( + Result.failure( + FlutterFirebaseAuthPluginException.parserExceptionToFlutter(task.exception))) + } + } + } + + override fun getIdToken( + app: AuthPigeonFirebaseApp, + forceRefresh: Boolean, + callback: (Result) -> Unit + ) { + cachedThreadPool.execute { + val firebaseUser = getCurrentUserFromPigeon(app) + if (firebaseUser == null) { + callback(Result.failure(FlutterFirebaseAuthPluginException.noUser())) + return@execute + } + try { + val response = Tasks.await(firebaseUser.getIdToken(forceRefresh)) + callback(Result.success(PigeonParser.parseTokenResult(response))) + } catch (exception: Exception) { + callback(Result.failure(FlutterFirebaseAuthPluginException.parserExceptionToFlutter(exception))) + } + } + } + + override fun linkWithCredential( + app: AuthPigeonFirebaseApp, + input: Map, + callback: (Result) -> Unit + ) { + val firebaseUser = getCurrentUserFromPigeon(app) + val credential = PigeonParser.getCredential(input) + + if (firebaseUser == null) { + callback(Result.failure(FlutterFirebaseAuthPluginException.noUser())) + return + } + + if (credential == null) { + callback(Result.failure(FlutterFirebaseAuthPluginException.invalidCredential())) + return + } + + firebaseUser.linkWithCredential(credential).addOnCompleteListener { task -> + if (task.isSuccessful) { + callback(Result.success(PigeonParser.parseAuthResult(task.result))) + } else { + callback( + Result.failure( + FlutterFirebaseAuthPluginException.parserExceptionToFlutter(task.exception))) + } + } + } + + override fun linkWithProvider( + app: AuthPigeonFirebaseApp, + signInProvider: InternalSignInProvider, + callback: (Result) -> Unit + ) { + val firebaseUser = getCurrentUserFromPigeon(app) + val provider = buildOAuthProvider(signInProvider) + + firebaseUser!! + .startActivityForLinkWithProvider(checkNotNull(activity), provider) + .addOnCompleteListener { task -> + if (task.isSuccessful) { + callback(Result.success(PigeonParser.parseAuthResult(task.result))) + } else { + callback( + Result.failure( + FlutterFirebaseAuthPluginException.parserExceptionToFlutter(task.exception))) + } + } + } + + override fun reauthenticateWithCredential( + app: AuthPigeonFirebaseApp, + input: Map, + callback: (Result) -> Unit + ) { + val firebaseUser = getCurrentUserFromPigeon(app) + val credential = PigeonParser.getCredential(input) + + if (firebaseUser == null) { + callback(Result.failure(FlutterFirebaseAuthPluginException.noUser())) + return + } + + if (credential == null) { + callback(Result.failure(FlutterFirebaseAuthPluginException.invalidCredential())) + return + } + + firebaseUser.reauthenticateAndRetrieveData(credential).addOnCompleteListener { task -> + if (task.isSuccessful) { + callback(Result.success(PigeonParser.parseAuthResult(task.result))) + } else { + callback( + Result.failure( + FlutterFirebaseAuthPluginException.parserExceptionToFlutter(task.exception))) + } + } + } + + override fun reauthenticateWithProvider( + app: AuthPigeonFirebaseApp, + signInProvider: InternalSignInProvider, + callback: (Result) -> Unit + ) { + val firebaseUser = getCurrentUserFromPigeon(app) + val provider = buildOAuthProvider(signInProvider) + + firebaseUser!! + .startActivityForReauthenticateWithProvider(checkNotNull(activity), provider) + .addOnCompleteListener { task -> + if (task.isSuccessful) { + callback(Result.success(PigeonParser.parseAuthResult(task.result))) + } else { + callback( + Result.failure( + FlutterFirebaseAuthPluginException.parserExceptionToFlutter(task.exception))) + } + } + } + + override fun reload(app: AuthPigeonFirebaseApp, callback: (Result) -> Unit) { + val firebaseUser = getCurrentUserFromPigeon(app) + if (firebaseUser == null) { + callback(Result.failure(FlutterFirebaseAuthPluginException.noUser())) + return + } + + firebaseUser.reload().addOnCompleteListener { task -> + if (task.isSuccessful) { + callback(Result.success(PigeonParser.parseFirebaseUser(firebaseUser)!!)) + } else { + callback( + Result.failure( + FlutterFirebaseAuthPluginException.parserExceptionToFlutter(task.exception))) + } + } + } + + override fun sendEmailVerification( + app: AuthPigeonFirebaseApp, + actionCodeSettings: InternalActionCodeSettings?, + callback: (Result) -> Unit + ) { + val firebaseUser = getCurrentUserFromPigeon(app) + if (firebaseUser == null) { + callback(Result.failure(FlutterFirebaseAuthPluginException.noUser())) + return + } + + val task = + if (actionCodeSettings == null) { + firebaseUser.sendEmailVerification() + } else { + firebaseUser.sendEmailVerification(PigeonParser.getActionCodeSettings(actionCodeSettings)) + } + + task.addOnCompleteListener { completed -> + if (completed.isSuccessful) { + callback(Result.success(Unit)) + } else { + callback( + Result.failure( + FlutterFirebaseAuthPluginException.parserExceptionToFlutter(completed.exception))) + } + } + } + + override fun unlink( + app: AuthPigeonFirebaseApp, + providerId: String, + callback: (Result) -> Unit + ) { + val firebaseUser = getCurrentUserFromPigeon(app) + if (firebaseUser == null) { + callback(Result.failure(FlutterFirebaseAuthPluginException.noUser())) + return + } + + firebaseUser.unlink(providerId).addOnCompleteListener { task -> + if (task.isSuccessful) { + callback(Result.success(PigeonParser.parseAuthResult(task.result))) + } else { + val exception = task.exception + if (exception?.message?.contains( + "User was not linked to an account with the given provider.") == true) { + callback(Result.failure(FlutterFirebaseAuthPluginException.noSuchProvider())) + } else { + callback( + Result.failure(FlutterFirebaseAuthPluginException.parserExceptionToFlutter(exception))) + } + } + } + } + + override fun updateEmail( + app: AuthPigeonFirebaseApp, + newEmail: String, + callback: (Result) -> Unit + ) { + reloadAfterUserUpdate(getCurrentUserFromPigeon(app), callback) { it.updateEmail(newEmail) } + } + + override fun updatePassword( + app: AuthPigeonFirebaseApp, + newPassword: String, + callback: (Result) -> Unit + ) { + reloadAfterUserUpdate(getCurrentUserFromPigeon(app), callback) { it.updatePassword(newPassword) } + } + + override fun updatePhoneNumber( + app: AuthPigeonFirebaseApp, + input: Map, + callback: (Result) -> Unit + ) { + val firebaseUser = getCurrentUserFromPigeon(app) + if (firebaseUser == null) { + callback(Result.failure(FlutterFirebaseAuthPluginException.noUser())) + return + } + + val phoneAuthCredential = PigeonParser.getCredential(input) as? PhoneAuthCredential + if (phoneAuthCredential == null) { + callback(Result.failure(FlutterFirebaseAuthPluginException.invalidCredential())) + return + } + + reloadAfterUserUpdate(firebaseUser, callback) { it.updatePhoneNumber(phoneAuthCredential) } + } + + override fun updateProfile( + app: AuthPigeonFirebaseApp, + profile: InternalUserProfile, + callback: (Result) -> Unit + ) { + val firebaseUser = getCurrentUserFromPigeon(app) + if (firebaseUser == null) { + callback(Result.failure(FlutterFirebaseAuthPluginException.noUser())) + return + } + + val builder = UserProfileChangeRequest.Builder() + if (profile.displayNameChanged) { + builder.setDisplayName(profile.displayName) + } + if (profile.photoUrlChanged) { + builder.setPhotoUri(profile.photoUrl?.let { Uri.parse(it) }) + } + + reloadAfterUserUpdate(firebaseUser, callback) { it.updateProfile(builder.build()) } + } + + override fun verifyBeforeUpdateEmail( + app: AuthPigeonFirebaseApp, + newEmail: String, + actionCodeSettings: InternalActionCodeSettings?, + callback: (Result) -> Unit + ) { + val firebaseUser = getCurrentUserFromPigeon(app) + if (firebaseUser == null) { + callback(Result.failure(FlutterFirebaseAuthPluginException.noUser())) + return + } + + val task = + if (actionCodeSettings == null) { + firebaseUser.verifyBeforeUpdateEmail(newEmail) + } else { + firebaseUser.verifyBeforeUpdateEmail( + newEmail, PigeonParser.getActionCodeSettings(actionCodeSettings)) + } + + task.addOnCompleteListener { completed -> + if (completed.isSuccessful) { + callback(Result.success(Unit)) + } else { + callback( + Result.failure( + FlutterFirebaseAuthPluginException.parserExceptionToFlutter(completed.exception))) + } + } + } + + private fun reloadAfterUserUpdate( + firebaseUser: FirebaseUser?, + callback: (Result) -> Unit, + update: (FirebaseUser) -> com.google.android.gms.tasks.Task + ) { + if (firebaseUser == null) { + callback(Result.failure(FlutterFirebaseAuthPluginException.noUser())) + return + } + + update(firebaseUser).addOnCompleteListener { task -> + if (task.isSuccessful) { + firebaseUser.reload().addOnCompleteListener { reloadTask -> + if (reloadTask.isSuccessful) { + callback(Result.success(PigeonParser.parseFirebaseUser(firebaseUser)!!)) + } else { + callback( + Result.failure( + FlutterFirebaseAuthPluginException.parserExceptionToFlutter( + reloadTask.exception))) + } + } + } else { + callback( + Result.failure( + FlutterFirebaseAuthPluginException.parserExceptionToFlutter(task.exception))) + } + } + } + + companion object { + fun getCurrentUserFromPigeon(pigeonApp: AuthPigeonFirebaseApp): FirebaseUser? { + val app = FirebaseApp.getInstance(pigeonApp.appName) + val auth = FirebaseAuth.getInstance(app) + pigeonApp.tenantId?.let { auth.setTenantId(it) } + return auth.currentUser + } + + fun buildOAuthProvider(signInProvider: InternalSignInProvider): OAuthProvider { + val provider = OAuthProvider.newBuilder(signInProvider.providerId) + signInProvider.scopes?.filterNotNull()?.let { provider.setScopes(it) } + signInProvider.customParameters?.let { params -> + val converted = HashMap() + for ((key, value) in params) { + if (key != null && value != null) { + converted[key] = value + } + } + provider.addCustomParameters(converted) + } + return provider.build() + } + } +} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseMultiFactor.kt b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseMultiFactor.kt new file mode 100644 index 000000000000..336536151fea --- /dev/null +++ b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseMultiFactor.kt @@ -0,0 +1,188 @@ +/* + * 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. + */ +package io.flutter.plugins.firebase.auth + +import com.google.firebase.auth.MultiFactor +import com.google.firebase.auth.MultiFactorAssertion +import com.google.firebase.auth.MultiFactorResolver +import com.google.firebase.auth.MultiFactorSession +import com.google.firebase.auth.PhoneAuthProvider +import com.google.firebase.auth.PhoneMultiFactorGenerator +import com.google.firebase.internal.api.FirebaseNoSignedInUserException +import java.util.UUID + +class FlutterFirebaseMultiFactor : MultiFactorUserHostApi, MultiFactoResolverHostApi { + @Throws(FirebaseNoSignedInUserException::class) + fun getAppMultiFactor(app: AuthPigeonFirebaseApp): MultiFactor { + val currentUser = FlutterFirebaseAuthUser.getCurrentUserFromPigeon(app) + ?: throw FirebaseNoSignedInUserException("No user is signed in") + val appMultiFactorUser = multiFactorUserMap.getOrPut(app.appName) { HashMap() } + return appMultiFactorUser.getOrPut(currentUser.uid) { currentUser.multiFactor } + } + + override fun enrollPhone( + app: AuthPigeonFirebaseApp, + assertion: InternalPhoneMultiFactorAssertion, + displayName: String?, + callback: (Result) -> Unit + ) { + val multiFactor: MultiFactor + try { + multiFactor = getAppMultiFactor(app) + } catch (e: FirebaseNoSignedInUserException) { + callback(Result.failure(e)) + return + } + + val credential = + PhoneAuthProvider.getCredential(assertion.verificationId, assertion.verificationCode) + val multiFactorAssertion = PhoneMultiFactorGenerator.getAssertion(credential) + + multiFactor.enroll(multiFactorAssertion, displayName).addOnCompleteListener { task -> + if (task.isSuccessful) { + callback(Result.success(Unit)) + } else { + callback( + Result.failure( + FlutterFirebaseAuthPluginException.parserExceptionToFlutter(task.exception))) + } + } + } + + override fun enrollTotp( + app: AuthPigeonFirebaseApp, + assertionId: String, + displayName: String?, + callback: (Result) -> Unit + ) { + val multiFactor: MultiFactor + try { + multiFactor = getAppMultiFactor(app) + } catch (e: FirebaseNoSignedInUserException) { + callback(Result.failure(e)) + return + } + + val multiFactorAssertion = multiFactorAssertionMap[assertionId] + checkNotNull(multiFactorAssertion) + multiFactor.enroll(multiFactorAssertion, displayName).addOnCompleteListener { task -> + if (task.isSuccessful) { + callback(Result.success(Unit)) + } else { + callback( + Result.failure( + FlutterFirebaseAuthPluginException.parserExceptionToFlutter(task.exception))) + } + } + } + + override fun getSession( + app: AuthPigeonFirebaseApp, + callback: (Result) -> Unit + ) { + val multiFactor: MultiFactor + try { + multiFactor = getAppMultiFactor(app) + } catch (e: FirebaseNoSignedInUserException) { + callback(Result.failure(e)) + return + } + + multiFactor.session.addOnCompleteListener { task -> + if (task.isSuccessful) { + val sessionResult = task.result + val id = UUID.randomUUID().toString() + multiFactorSessionMap[id] = sessionResult + callback(Result.success(InternalMultiFactorSession(id))) + } else { + callback( + Result.failure( + FlutterFirebaseAuthPluginException.parserExceptionToFlutter(task.exception))) + } + } + } + + override fun unenroll( + app: AuthPigeonFirebaseApp, + factorUid: String, + callback: (Result) -> Unit + ) { + val multiFactor: MultiFactor + try { + multiFactor = getAppMultiFactor(app) + } catch (e: FirebaseNoSignedInUserException) { + callback(Result.failure(FlutterFirebaseAuthPluginException.parserExceptionToFlutter(e))) + return + } + + multiFactor.unenroll(factorUid).addOnCompleteListener { task -> + if (task.isSuccessful) { + callback(Result.success(Unit)) + } else { + callback( + Result.failure( + FlutterFirebaseAuthPluginException.parserExceptionToFlutter(task.exception))) + } + } + } + + override fun getEnrolledFactors( + app: AuthPigeonFirebaseApp, + callback: (Result>) -> Unit + ) { + val multiFactor: MultiFactor + try { + multiFactor = getAppMultiFactor(app) + } catch (e: FirebaseNoSignedInUserException) { + callback(Result.failure(e)) + return + } + + callback(Result.success(PigeonParser.multiFactorInfoToPigeon(multiFactor.enrolledFactors))) + } + + override fun resolveSignIn( + resolverId: String, + assertion: InternalPhoneMultiFactorAssertion?, + totpAssertionId: String?, + callback: (Result) -> Unit + ) { + val resolver = multiFactorResolverMap[resolverId] + if (resolver == null) { + callback( + Result.failure( + FlutterFirebaseAuthPluginException.parserExceptionToFlutter( + Exception("Resolver not found")))) + return + } + + val multiFactorAssertion = + if (assertion != null) { + val credential = + PhoneAuthProvider.getCredential(assertion.verificationId, assertion.verificationCode) + PhoneMultiFactorGenerator.getAssertion(credential) + } else { + multiFactorAssertionMap[totpAssertionId] + } + + resolver.resolveSignIn(multiFactorAssertion!!).addOnCompleteListener { task -> + if (task.isSuccessful) { + callback(Result.success(PigeonParser.parseAuthResult(task.result))) + } else { + callback( + Result.failure( + FlutterFirebaseAuthPluginException.parserExceptionToFlutter(task.exception))) + } + } + } + + companion object { + val multiFactorUserMap: MutableMap> = HashMap() + val multiFactorSessionMap: MutableMap = HashMap() + val multiFactorResolverMap: MutableMap = HashMap() + val multiFactorAssertionMap: MutableMap = HashMap() + } +} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseTotpMultiFactor.kt b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseTotpMultiFactor.kt new file mode 100644 index 000000000000..0ce25fc89641 --- /dev/null +++ b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseTotpMultiFactor.kt @@ -0,0 +1,63 @@ +/* + * 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. + */ +package io.flutter.plugins.firebase.auth + +import com.google.firebase.auth.TotpMultiFactorGenerator +import com.google.firebase.auth.TotpSecret +import java.util.UUID + +class FlutterFirebaseTotpMultiFactor : MultiFactorTotpHostApi { + override fun generateSecret(sessionId: String, callback: (Result) -> Unit) { + val multiFactorSession = FlutterFirebaseMultiFactor.multiFactorSessionMap[sessionId] + checkNotNull(multiFactorSession) + TotpMultiFactorGenerator.generateSecret(multiFactorSession).addOnCompleteListener { task -> + if (task.isSuccessful) { + val secret = task.result + multiFactorSecret[secret.sharedSecretKey] = secret + callback( + Result.success( + InternalTotpSecret( + codeIntervalSeconds = secret.codeIntervalSeconds.toLong(), + codeLength = secret.codeLength.toLong(), + secretKey = secret.sharedSecretKey, + hashingAlgorithm = secret.hashAlgorithm, + enrollmentCompletionDeadline = secret.enrollmentCompletionDeadline))) + } else { + callback( + Result.failure( + FlutterFirebaseAuthPluginException.parserExceptionToFlutter(task.exception))) + } + } + } + + override fun getAssertionForEnrollment( + secretKey: String, + oneTimePassword: String, + callback: (Result) -> Unit + ) { + val secret = multiFactorSecret[secretKey] + checkNotNull(secret) + val assertion = TotpMultiFactorGenerator.getAssertionForEnrollment(secret, oneTimePassword) + val assertionId = UUID.randomUUID().toString() + FlutterFirebaseMultiFactor.multiFactorAssertionMap[assertionId] = assertion + callback(Result.success(assertionId)) + } + + override fun getAssertionForSignIn( + enrollmentId: String, + oneTimePassword: String, + callback: (Result) -> Unit + ) { + val assertion = TotpMultiFactorGenerator.getAssertionForSignIn(enrollmentId, oneTimePassword) + val assertionId = UUID.randomUUID().toString() + FlutterFirebaseMultiFactor.multiFactorAssertionMap[assertionId] = assertion + callback(Result.success(assertionId)) + } + + companion object { + val multiFactorSecret: MutableMap = HashMap() + } +} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseTotpSecret.kt b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseTotpSecret.kt new file mode 100644 index 000000000000..2bc9cdb072ad --- /dev/null +++ b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseTotpSecret.kt @@ -0,0 +1,32 @@ +/* + * 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. + */ +package io.flutter.plugins.firebase.auth + +import com.google.firebase.auth.TotpSecret + +class FlutterFirebaseTotpSecret : MultiFactorTotpSecretHostApi { + override fun generateQrCodeUrl( + secretKey: String, + accountName: String?, + issuer: String?, + callback: (Result) -> Unit + ) { + val secret: TotpSecret? = FlutterFirebaseTotpMultiFactor.multiFactorSecret[secretKey] + checkNotNull(secret) + if (accountName == null || issuer == null) { + callback(Result.success(secret.generateQrCodeUrl())) + return + } + callback(Result.success(secret.generateQrCodeUrl(accountName, issuer))) + } + + override fun openInOtpApp(secretKey: String, qrCodeUrl: String, callback: (Result) -> Unit) { + val secret: TotpSecret? = FlutterFirebaseTotpMultiFactor.multiFactorSecret[secretKey] + checkNotNull(secret) + secret.openInOtpApp(qrCodeUrl) + callback(Result.success(Unit)) + } +} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/GeneratedAndroidFirebaseAuth.g.kt b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/GeneratedAndroidFirebaseAuth.g.kt new file mode 100644 index 000000000000..a0018c9a367e --- /dev/null +++ b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/GeneratedAndroidFirebaseAuth.g.kt @@ -0,0 +1,2510 @@ +// 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 +@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass") + +package io.flutter.plugins.firebase.auth + +import android.util.Log +import io.flutter.plugin.common.BasicMessageChannel +import io.flutter.plugin.common.BinaryMessenger +import io.flutter.plugin.common.EventChannel +import io.flutter.plugin.common.MessageCodec +import io.flutter.plugin.common.StandardMethodCodec +import io.flutter.plugin.common.StandardMessageCodec +import java.io.ByteArrayOutputStream +import java.nio.ByteBuffer +private object GeneratedAndroidFirebaseAuthPigeonUtils { + + fun wrapResult(result: Any?): List { + return listOf(result) + } + + fun wrapError(exception: Throwable): List { + return if (exception is FlutterError) { + listOf( + exception.code, + exception.message, + exception.details + ) + } else { + listOf( + exception.javaClass.simpleName, + exception.toString(), + "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception) + ) + } + } + fun doubleEquals(a: Double, b: Double): Boolean { + // Normalize -0.0 to 0.0 and handle NaN equality. + return (if (a == 0.0) 0.0 else a) == (if (b == 0.0) 0.0 else b) || (a.isNaN() && b.isNaN()) + } + + fun floatEquals(a: Float, b: Float): Boolean { + // Normalize -0.0 to 0.0 and handle NaN equality. + return (if (a == 0.0f) 0.0f else a) == (if (b == 0.0f) 0.0f else b) || (a.isNaN() && b.isNaN()) + } + + fun doubleHash(d: Double): Int { + // Normalize -0.0 to 0.0 and handle NaN to ensure consistent hash codes. + val normalized = if (d == 0.0) 0.0 else d + val bits = java.lang.Double.doubleToLongBits(normalized) + return (bits xor (bits ushr 32)).toInt() + } + + fun floatHash(f: Float): Int { + // Normalize -0.0 to 0.0 and handle NaN to ensure consistent hash codes. + val normalized = if (f == 0.0f) 0.0f else f + return java.lang.Float.floatToIntBits(normalized) + } + + fun deepEquals(a: Any?, b: Any?): Boolean { + if (a === b) { + return true + } + if (a == null || b == null) { + return false + } + if (a is ByteArray && b is ByteArray) { + return a.contentEquals(b) + } + if (a is IntArray && b is IntArray) { + return a.contentEquals(b) + } + if (a is LongArray && b is LongArray) { + return a.contentEquals(b) + } + if (a is DoubleArray && b is DoubleArray) { + if (a.size != b.size) return false + for (i in a.indices) { + if (!doubleEquals(a[i], b[i])) return false + } + return true + } + if (a is FloatArray && b is FloatArray) { + if (a.size != b.size) return false + for (i in a.indices) { + if (!floatEquals(a[i], b[i])) return false + } + return true + } + if (a is Array<*> && b is Array<*>) { + if (a.size != b.size) return false + for (i in a.indices) { + if (!deepEquals(a[i], b[i])) return false + } + return true + } + if (a is List<*> && b is List<*>) { + if (a.size != b.size) return false + val iterA = a.iterator() + val iterB = b.iterator() + while (iterA.hasNext() && iterB.hasNext()) { + if (!deepEquals(iterA.next(), iterB.next())) return false + } + return true + } + if (a is Map<*, *> && b is Map<*, *>) { + if (a.size != b.size) return false + for (entry in a) { + val key = entry.key + var found = false + for (bEntry in b) { + if (deepEquals(key, bEntry.key)) { + if (deepEquals(entry.value, bEntry.value)) { + found = true + break + } else { + return false + } + } + } + if (!found) return false + } + return true + } + if (a is Double && b is Double) { + return doubleEquals(a, b) + } + if (a is Float && b is Float) { + return floatEquals(a, b) + } + return a == b + } + + fun deepHash(value: Any?): Int { + return when (value) { + null -> 0 + is ByteArray -> value.contentHashCode() + is IntArray -> value.contentHashCode() + is LongArray -> value.contentHashCode() + is DoubleArray -> { + var result = 1 + for (item in value) { + result = 31 * result + doubleHash(item) + } + result + } + is FloatArray -> { + var result = 1 + for (item in value) { + result = 31 * result + floatHash(item) + } + result + } + is Array<*> -> { + var result = 1 + for (item in value) { + result = 31 * result + deepHash(item) + } + result + } + is List<*> -> { + var result = 1 + for (item in value) { + result = 31 * result + deepHash(item) + } + result + } + is Map<*, *> -> { + var result = 0 + for (entry in value) { + result += ((deepHash(entry.key) * 31) xor deepHash(entry.value)) + } + result + } + is Double -> doubleHash(value) + is Float -> floatHash(value) + else -> value.hashCode() + } + } + +} + +/** + * Error class for passing custom error details to Flutter via a thrown PlatformException. + * @property code The error code. + * @property message The error message. + * @property details The error details. Must be a datatype supported by the api codec. + */ +class FlutterError ( + val code: String, + override val message: String? = null, + val details: Any? = null +) : RuntimeException() + +/** + * The type of operation that generated the action code from calling + * [checkActionCode]. + */ +enum class ActionCodeInfoOperation(val raw: Int) { + /** Unknown operation. */ + UNKNOWN(0), + /** Password reset code generated via [sendPasswordResetEmail]. */ + PASSWORD_RESET(1), + /** Email verification code generated via [User.sendEmailVerification]. */ + VERIFY_EMAIL(2), + /** Email change revocation code generated via [User.updateEmail]. */ + RECOVER_EMAIL(3), + /** Email sign in code generated via [sendSignInLinkToEmail]. */ + EMAIL_SIGN_IN(4), + /** Verify and change email code generated via [User.verifyBeforeUpdateEmail]. */ + VERIFY_AND_CHANGE_EMAIL(5), + /** Action code for reverting second factor addition. */ + REVERT_SECOND_FACTOR_ADDITION(6); + + companion object { + fun ofRaw(raw: Int): ActionCodeInfoOperation? { + return values().firstOrNull { it.raw == raw } + } + } +} + +/** Generated class from Pigeon that represents data sent in messages. */ +data class InternalMultiFactorSession ( + val id: String +) + { + companion object { + fun fromList(pigeonVar_list: List): InternalMultiFactorSession { + val id = pigeonVar_list[0] as String + return InternalMultiFactorSession(id) + } + } + fun toList(): List { + return listOf( + id, + ) + } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as InternalMultiFactorSession + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.id, other.id) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.id) + return result + } +} + +/** Generated class from Pigeon that represents data sent in messages. */ +data class InternalPhoneMultiFactorAssertion ( + val verificationId: String, + val verificationCode: String +) + { + companion object { + fun fromList(pigeonVar_list: List): InternalPhoneMultiFactorAssertion { + val verificationId = pigeonVar_list[0] as String + val verificationCode = pigeonVar_list[1] as String + return InternalPhoneMultiFactorAssertion(verificationId, verificationCode) + } + } + fun toList(): List { + return listOf( + verificationId, + verificationCode, + ) + } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as InternalPhoneMultiFactorAssertion + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.verificationId, other.verificationId) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.verificationCode, other.verificationCode) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.verificationId) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.verificationCode) + return result + } +} + +/** Generated class from Pigeon that represents data sent in messages. */ +data class InternalMultiFactorInfo ( + val displayName: String? = null, + val enrollmentTimestamp: Double, + val factorId: String? = null, + val uid: String, + val phoneNumber: String? = null +) + { + companion object { + fun fromList(pigeonVar_list: List): InternalMultiFactorInfo { + val displayName = pigeonVar_list[0] as String? + val enrollmentTimestamp = pigeonVar_list[1] as Double + val factorId = pigeonVar_list[2] as String? + val uid = pigeonVar_list[3] as String + val phoneNumber = pigeonVar_list[4] as String? + return InternalMultiFactorInfo(displayName, enrollmentTimestamp, factorId, uid, phoneNumber) + } + } + fun toList(): List { + return listOf( + displayName, + enrollmentTimestamp, + factorId, + uid, + phoneNumber, + ) + } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as InternalMultiFactorInfo + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.displayName, other.displayName) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.enrollmentTimestamp, other.enrollmentTimestamp) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.factorId, other.factorId) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.uid, other.uid) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.phoneNumber, other.phoneNumber) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.displayName) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.enrollmentTimestamp) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.factorId) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.uid) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.phoneNumber) + return result + } +} + +/** Generated class from Pigeon that represents data sent in messages. */ +data class AuthPigeonFirebaseApp ( + val appName: String, + val tenantId: String? = null, + val customAuthDomain: String? = null +) + { + companion object { + fun fromList(pigeonVar_list: List): AuthPigeonFirebaseApp { + val appName = pigeonVar_list[0] as String + val tenantId = pigeonVar_list[1] as String? + val customAuthDomain = pigeonVar_list[2] as String? + return AuthPigeonFirebaseApp(appName, tenantId, customAuthDomain) + } + } + fun toList(): List { + return listOf( + appName, + tenantId, + customAuthDomain, + ) + } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as AuthPigeonFirebaseApp + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.appName, other.appName) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.tenantId, other.tenantId) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.customAuthDomain, other.customAuthDomain) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.appName) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.tenantId) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.customAuthDomain) + return result + } +} + +/** Generated class from Pigeon that represents data sent in messages. */ +data class InternalActionCodeInfoData ( + val email: String? = null, + val previousEmail: String? = null +) + { + companion object { + fun fromList(pigeonVar_list: List): InternalActionCodeInfoData { + val email = pigeonVar_list[0] as String? + val previousEmail = pigeonVar_list[1] as String? + return InternalActionCodeInfoData(email, previousEmail) + } + } + fun toList(): List { + return listOf( + email, + previousEmail, + ) + } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as InternalActionCodeInfoData + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.email, other.email) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.previousEmail, other.previousEmail) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.email) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.previousEmail) + return result + } +} + +/** Generated class from Pigeon that represents data sent in messages. */ +data class InternalActionCodeInfo ( + val operation: ActionCodeInfoOperation, + val data: InternalActionCodeInfoData +) + { + companion object { + fun fromList(pigeonVar_list: List): InternalActionCodeInfo { + val operation = pigeonVar_list[0] as ActionCodeInfoOperation + val data = pigeonVar_list[1] as InternalActionCodeInfoData + return InternalActionCodeInfo(operation, data) + } + } + fun toList(): List { + return listOf( + operation, + data, + ) + } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as InternalActionCodeInfo + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.operation, other.operation) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.data, other.data) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.operation) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.data) + return result + } +} + +/** Generated class from Pigeon that represents data sent in messages. */ +data class InternalAdditionalUserInfo ( + val isNewUser: Boolean, + val providerId: String? = null, + val username: String? = null, + val authorizationCode: String? = null, + val profile: Map? = null +) + { + companion object { + fun fromList(pigeonVar_list: List): InternalAdditionalUserInfo { + val isNewUser = pigeonVar_list[0] as Boolean + val providerId = pigeonVar_list[1] as String? + val username = pigeonVar_list[2] as String? + val authorizationCode = pigeonVar_list[3] as String? + val profile = pigeonVar_list[4] as Map? + return InternalAdditionalUserInfo(isNewUser, providerId, username, authorizationCode, profile) + } + } + fun toList(): List { + return listOf( + isNewUser, + providerId, + username, + authorizationCode, + profile, + ) + } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as InternalAdditionalUserInfo + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.isNewUser, other.isNewUser) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.providerId, other.providerId) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.username, other.username) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.authorizationCode, other.authorizationCode) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.profile, other.profile) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.isNewUser) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.providerId) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.username) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.authorizationCode) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.profile) + return result + } +} + +/** Generated class from Pigeon that represents data sent in messages. */ +data class InternalAuthCredential ( + val providerId: String, + val signInMethod: String, + val nativeId: Long, + val accessToken: String? = null +) + { + companion object { + fun fromList(pigeonVar_list: List): InternalAuthCredential { + val providerId = pigeonVar_list[0] as String + val signInMethod = pigeonVar_list[1] as String + val nativeId = pigeonVar_list[2] as Long + val accessToken = pigeonVar_list[3] as String? + return InternalAuthCredential(providerId, signInMethod, nativeId, accessToken) + } + } + fun toList(): List { + return listOf( + providerId, + signInMethod, + nativeId, + accessToken, + ) + } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as InternalAuthCredential + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.providerId, other.providerId) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.signInMethod, other.signInMethod) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.nativeId, other.nativeId) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.accessToken, other.accessToken) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.providerId) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.signInMethod) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.nativeId) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.accessToken) + return result + } +} + +/** Generated class from Pigeon that represents data sent in messages. */ +data class InternalUserInfo ( + val uid: String, + val email: String? = null, + val displayName: String? = null, + val photoUrl: String? = null, + val phoneNumber: String? = null, + val isAnonymous: Boolean, + val isEmailVerified: Boolean, + val providerId: String? = null, + val tenantId: String? = null, + val refreshToken: String? = null, + val creationTimestamp: Long? = null, + val lastSignInTimestamp: Long? = null +) + { + companion object { + fun fromList(pigeonVar_list: List): InternalUserInfo { + val uid = pigeonVar_list[0] as String + val email = pigeonVar_list[1] as String? + val displayName = pigeonVar_list[2] as String? + val photoUrl = pigeonVar_list[3] as String? + val phoneNumber = pigeonVar_list[4] as String? + val isAnonymous = pigeonVar_list[5] as Boolean + val isEmailVerified = pigeonVar_list[6] as Boolean + val providerId = pigeonVar_list[7] as String? + val tenantId = pigeonVar_list[8] as String? + val refreshToken = pigeonVar_list[9] as String? + val creationTimestamp = pigeonVar_list[10] as Long? + val lastSignInTimestamp = pigeonVar_list[11] as Long? + return InternalUserInfo(uid, email, displayName, photoUrl, phoneNumber, isAnonymous, isEmailVerified, providerId, tenantId, refreshToken, creationTimestamp, lastSignInTimestamp) + } + } + fun toList(): List { + return listOf( + uid, + email, + displayName, + photoUrl, + phoneNumber, + isAnonymous, + isEmailVerified, + providerId, + tenantId, + refreshToken, + creationTimestamp, + lastSignInTimestamp, + ) + } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as InternalUserInfo + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.uid, other.uid) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.email, other.email) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.displayName, other.displayName) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.photoUrl, other.photoUrl) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.phoneNumber, other.phoneNumber) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.isAnonymous, other.isAnonymous) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.isEmailVerified, other.isEmailVerified) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.providerId, other.providerId) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.tenantId, other.tenantId) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.refreshToken, other.refreshToken) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.creationTimestamp, other.creationTimestamp) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.lastSignInTimestamp, other.lastSignInTimestamp) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.uid) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.email) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.displayName) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.photoUrl) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.phoneNumber) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.isAnonymous) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.isEmailVerified) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.providerId) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.tenantId) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.refreshToken) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.creationTimestamp) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.lastSignInTimestamp) + return result + } +} + +/** Generated class from Pigeon that represents data sent in messages. */ +data class InternalUserDetails ( + val userInfo: InternalUserInfo, + val providerData: List?> +) + { + companion object { + fun fromList(pigeonVar_list: List): InternalUserDetails { + val userInfo = pigeonVar_list[0] as InternalUserInfo + val providerData = pigeonVar_list[1] as List?> + return InternalUserDetails(userInfo, providerData) + } + } + fun toList(): List { + return listOf( + userInfo, + providerData, + ) + } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as InternalUserDetails + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.userInfo, other.userInfo) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.providerData, other.providerData) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.userInfo) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.providerData) + return result + } +} + +/** Generated class from Pigeon that represents data sent in messages. */ +data class InternalUserCredential ( + val user: InternalUserDetails? = null, + val additionalUserInfo: InternalAdditionalUserInfo? = null, + val credential: InternalAuthCredential? = null +) + { + companion object { + fun fromList(pigeonVar_list: List): InternalUserCredential { + val user = pigeonVar_list[0] as InternalUserDetails? + val additionalUserInfo = pigeonVar_list[1] as InternalAdditionalUserInfo? + val credential = pigeonVar_list[2] as InternalAuthCredential? + return InternalUserCredential(user, additionalUserInfo, credential) + } + } + fun toList(): List { + return listOf( + user, + additionalUserInfo, + credential, + ) + } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as InternalUserCredential + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.user, other.user) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.additionalUserInfo, other.additionalUserInfo) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.credential, other.credential) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.user) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.additionalUserInfo) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.credential) + return result + } +} + +/** Generated class from Pigeon that represents data sent in messages. */ +data class InternalAuthCredentialInput ( + val providerId: String, + val signInMethod: String, + val token: String? = null, + val accessToken: String? = null +) + { + companion object { + fun fromList(pigeonVar_list: List): InternalAuthCredentialInput { + val providerId = pigeonVar_list[0] as String + val signInMethod = pigeonVar_list[1] as String + val token = pigeonVar_list[2] as String? + val accessToken = pigeonVar_list[3] as String? + return InternalAuthCredentialInput(providerId, signInMethod, token, accessToken) + } + } + fun toList(): List { + return listOf( + providerId, + signInMethod, + token, + accessToken, + ) + } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as InternalAuthCredentialInput + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.providerId, other.providerId) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.signInMethod, other.signInMethod) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.token, other.token) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.accessToken, other.accessToken) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.providerId) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.signInMethod) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.token) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.accessToken) + return result + } +} + +/** Generated class from Pigeon that represents data sent in messages. */ +data class InternalActionCodeSettings ( + val url: String, + val dynamicLinkDomain: String? = null, + val handleCodeInApp: Boolean, + val iOSBundleId: String? = null, + val androidPackageName: String? = null, + val androidInstallApp: Boolean, + val androidMinimumVersion: String? = null, + val linkDomain: String? = null +) + { + companion object { + fun fromList(pigeonVar_list: List): InternalActionCodeSettings { + val url = pigeonVar_list[0] as String + val dynamicLinkDomain = pigeonVar_list[1] as String? + val handleCodeInApp = pigeonVar_list[2] as Boolean + val iOSBundleId = pigeonVar_list[3] as String? + val androidPackageName = pigeonVar_list[4] as String? + val androidInstallApp = pigeonVar_list[5] as Boolean + val androidMinimumVersion = pigeonVar_list[6] as String? + val linkDomain = pigeonVar_list[7] as String? + return InternalActionCodeSettings(url, dynamicLinkDomain, handleCodeInApp, iOSBundleId, androidPackageName, androidInstallApp, androidMinimumVersion, linkDomain) + } + } + fun toList(): List { + return listOf( + url, + dynamicLinkDomain, + handleCodeInApp, + iOSBundleId, + androidPackageName, + androidInstallApp, + androidMinimumVersion, + linkDomain, + ) + } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as InternalActionCodeSettings + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.url, other.url) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.dynamicLinkDomain, other.dynamicLinkDomain) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.handleCodeInApp, other.handleCodeInApp) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.iOSBundleId, other.iOSBundleId) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.androidPackageName, other.androidPackageName) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.androidInstallApp, other.androidInstallApp) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.androidMinimumVersion, other.androidMinimumVersion) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.linkDomain, other.linkDomain) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.url) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.dynamicLinkDomain) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.handleCodeInApp) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.iOSBundleId) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.androidPackageName) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.androidInstallApp) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.androidMinimumVersion) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.linkDomain) + return result + } +} + +/** Generated class from Pigeon that represents data sent in messages. */ +data class InternalFirebaseAuthSettings ( + val appVerificationDisabledForTesting: Boolean, + val userAccessGroup: String? = null, + val phoneNumber: String? = null, + val smsCode: String? = null, + val forceRecaptchaFlow: Boolean? = null +) + { + companion object { + fun fromList(pigeonVar_list: List): InternalFirebaseAuthSettings { + val appVerificationDisabledForTesting = pigeonVar_list[0] as Boolean + val userAccessGroup = pigeonVar_list[1] as String? + val phoneNumber = pigeonVar_list[2] as String? + val smsCode = pigeonVar_list[3] as String? + val forceRecaptchaFlow = pigeonVar_list[4] as Boolean? + return InternalFirebaseAuthSettings(appVerificationDisabledForTesting, userAccessGroup, phoneNumber, smsCode, forceRecaptchaFlow) + } + } + fun toList(): List { + return listOf( + appVerificationDisabledForTesting, + userAccessGroup, + phoneNumber, + smsCode, + forceRecaptchaFlow, + ) + } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as InternalFirebaseAuthSettings + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.appVerificationDisabledForTesting, other.appVerificationDisabledForTesting) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.userAccessGroup, other.userAccessGroup) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.phoneNumber, other.phoneNumber) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.smsCode, other.smsCode) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.forceRecaptchaFlow, other.forceRecaptchaFlow) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.appVerificationDisabledForTesting) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.userAccessGroup) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.phoneNumber) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.smsCode) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.forceRecaptchaFlow) + return result + } +} + +/** Generated class from Pigeon that represents data sent in messages. */ +data class InternalSignInProvider ( + val providerId: String, + val scopes: List? = null, + val customParameters: Map? = null +) + { + companion object { + fun fromList(pigeonVar_list: List): InternalSignInProvider { + val providerId = pigeonVar_list[0] as String + val scopes = pigeonVar_list[1] as List? + val customParameters = pigeonVar_list[2] as Map? + return InternalSignInProvider(providerId, scopes, customParameters) + } + } + fun toList(): List { + return listOf( + providerId, + scopes, + customParameters, + ) + } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as InternalSignInProvider + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.providerId, other.providerId) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.scopes, other.scopes) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.customParameters, other.customParameters) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.providerId) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.scopes) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.customParameters) + return result + } +} + +/** Generated class from Pigeon that represents data sent in messages. */ +data class InternalVerifyPhoneNumberRequest ( + val phoneNumber: String? = null, + val timeout: Long, + val forceResendingToken: Long? = null, + val autoRetrievedSmsCodeForTesting: String? = null, + val multiFactorInfoId: String? = null, + val multiFactorSessionId: String? = null +) + { + companion object { + fun fromList(pigeonVar_list: List): InternalVerifyPhoneNumberRequest { + val phoneNumber = pigeonVar_list[0] as String? + val timeout = pigeonVar_list[1] as Long + val forceResendingToken = pigeonVar_list[2] as Long? + val autoRetrievedSmsCodeForTesting = pigeonVar_list[3] as String? + val multiFactorInfoId = pigeonVar_list[4] as String? + val multiFactorSessionId = pigeonVar_list[5] as String? + return InternalVerifyPhoneNumberRequest(phoneNumber, timeout, forceResendingToken, autoRetrievedSmsCodeForTesting, multiFactorInfoId, multiFactorSessionId) + } + } + fun toList(): List { + return listOf( + phoneNumber, + timeout, + forceResendingToken, + autoRetrievedSmsCodeForTesting, + multiFactorInfoId, + multiFactorSessionId, + ) + } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as InternalVerifyPhoneNumberRequest + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.phoneNumber, other.phoneNumber) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.timeout, other.timeout) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.forceResendingToken, other.forceResendingToken) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.autoRetrievedSmsCodeForTesting, other.autoRetrievedSmsCodeForTesting) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.multiFactorInfoId, other.multiFactorInfoId) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.multiFactorSessionId, other.multiFactorSessionId) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.phoneNumber) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.timeout) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.forceResendingToken) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.autoRetrievedSmsCodeForTesting) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.multiFactorInfoId) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.multiFactorSessionId) + return result + } +} + +/** Generated class from Pigeon that represents data sent in messages. */ +data class InternalIdTokenResult ( + val token: String? = null, + val expirationTimestamp: Long? = null, + val authTimestamp: Long? = null, + val issuedAtTimestamp: Long? = null, + val signInProvider: String? = null, + val claims: Map? = null, + val signInSecondFactor: String? = null +) + { + companion object { + fun fromList(pigeonVar_list: List): InternalIdTokenResult { + val token = pigeonVar_list[0] as String? + val expirationTimestamp = pigeonVar_list[1] as Long? + val authTimestamp = pigeonVar_list[2] as Long? + val issuedAtTimestamp = pigeonVar_list[3] as Long? + val signInProvider = pigeonVar_list[4] as String? + val claims = pigeonVar_list[5] as Map? + val signInSecondFactor = pigeonVar_list[6] as String? + return InternalIdTokenResult(token, expirationTimestamp, authTimestamp, issuedAtTimestamp, signInProvider, claims, signInSecondFactor) + } + } + fun toList(): List { + return listOf( + token, + expirationTimestamp, + authTimestamp, + issuedAtTimestamp, + signInProvider, + claims, + signInSecondFactor, + ) + } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as InternalIdTokenResult + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.token, other.token) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.expirationTimestamp, other.expirationTimestamp) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.authTimestamp, other.authTimestamp) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.issuedAtTimestamp, other.issuedAtTimestamp) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.signInProvider, other.signInProvider) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.claims, other.claims) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.signInSecondFactor, other.signInSecondFactor) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.token) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.expirationTimestamp) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.authTimestamp) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.issuedAtTimestamp) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.signInProvider) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.claims) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.signInSecondFactor) + return result + } +} + +/** Generated class from Pigeon that represents data sent in messages. */ +data class InternalUserProfile ( + val displayName: String? = null, + val photoUrl: String? = null, + val displayNameChanged: Boolean, + val photoUrlChanged: Boolean +) + { + companion object { + fun fromList(pigeonVar_list: List): InternalUserProfile { + val displayName = pigeonVar_list[0] as String? + val photoUrl = pigeonVar_list[1] as String? + val displayNameChanged = pigeonVar_list[2] as Boolean + val photoUrlChanged = pigeonVar_list[3] as Boolean + return InternalUserProfile(displayName, photoUrl, displayNameChanged, photoUrlChanged) + } + } + fun toList(): List { + return listOf( + displayName, + photoUrl, + displayNameChanged, + photoUrlChanged, + ) + } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as InternalUserProfile + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.displayName, other.displayName) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.photoUrl, other.photoUrl) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.displayNameChanged, other.displayNameChanged) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.photoUrlChanged, other.photoUrlChanged) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.displayName) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.photoUrl) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.displayNameChanged) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.photoUrlChanged) + return result + } +} + +/** Generated class from Pigeon that represents data sent in messages. */ +data class InternalTotpSecret ( + val codeIntervalSeconds: Long? = null, + val codeLength: Long? = null, + val enrollmentCompletionDeadline: Long? = null, + val hashingAlgorithm: String? = null, + val secretKey: String +) + { + companion object { + fun fromList(pigeonVar_list: List): InternalTotpSecret { + val codeIntervalSeconds = pigeonVar_list[0] as Long? + val codeLength = pigeonVar_list[1] as Long? + val enrollmentCompletionDeadline = pigeonVar_list[2] as Long? + val hashingAlgorithm = pigeonVar_list[3] as String? + val secretKey = pigeonVar_list[4] as String + return InternalTotpSecret(codeIntervalSeconds, codeLength, enrollmentCompletionDeadline, hashingAlgorithm, secretKey) + } + } + fun toList(): List { + return listOf( + codeIntervalSeconds, + codeLength, + enrollmentCompletionDeadline, + hashingAlgorithm, + secretKey, + ) + } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as InternalTotpSecret + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.codeIntervalSeconds, other.codeIntervalSeconds) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.codeLength, other.codeLength) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.enrollmentCompletionDeadline, other.enrollmentCompletionDeadline) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.hashingAlgorithm, other.hashingAlgorithm) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.secretKey, other.secretKey) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.codeIntervalSeconds) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.codeLength) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.enrollmentCompletionDeadline) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.hashingAlgorithm) + result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.secretKey) + return result + } +} +private open class GeneratedAndroidFirebaseAuthPigeonCodec : StandardMessageCodec() { + override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { + return when (type) { + 129.toByte() -> { + return (readValue(buffer) as Long?)?.let { + ActionCodeInfoOperation.ofRaw(it.toInt()) + } + } + 130.toByte() -> { + return (readValue(buffer) as? List)?.let { + InternalMultiFactorSession.fromList(it) + } + } + 131.toByte() -> { + return (readValue(buffer) as? List)?.let { + InternalPhoneMultiFactorAssertion.fromList(it) + } + } + 132.toByte() -> { + return (readValue(buffer) as? List)?.let { + InternalMultiFactorInfo.fromList(it) + } + } + 133.toByte() -> { + return (readValue(buffer) as? List)?.let { + AuthPigeonFirebaseApp.fromList(it) + } + } + 134.toByte() -> { + return (readValue(buffer) as? List)?.let { + InternalActionCodeInfoData.fromList(it) + } + } + 135.toByte() -> { + return (readValue(buffer) as? List)?.let { + InternalActionCodeInfo.fromList(it) + } + } + 136.toByte() -> { + return (readValue(buffer) as? List)?.let { + InternalAdditionalUserInfo.fromList(it) + } + } + 137.toByte() -> { + return (readValue(buffer) as? List)?.let { + InternalAuthCredential.fromList(it) + } + } + 138.toByte() -> { + return (readValue(buffer) as? List)?.let { + InternalUserInfo.fromList(it) + } + } + 139.toByte() -> { + return (readValue(buffer) as? List)?.let { + InternalUserDetails.fromList(it) + } + } + 140.toByte() -> { + return (readValue(buffer) as? List)?.let { + InternalUserCredential.fromList(it) + } + } + 141.toByte() -> { + return (readValue(buffer) as? List)?.let { + InternalAuthCredentialInput.fromList(it) + } + } + 142.toByte() -> { + return (readValue(buffer) as? List)?.let { + InternalActionCodeSettings.fromList(it) + } + } + 143.toByte() -> { + return (readValue(buffer) as? List)?.let { + InternalFirebaseAuthSettings.fromList(it) + } + } + 144.toByte() -> { + return (readValue(buffer) as? List)?.let { + InternalSignInProvider.fromList(it) + } + } + 145.toByte() -> { + return (readValue(buffer) as? List)?.let { + InternalVerifyPhoneNumberRequest.fromList(it) + } + } + 146.toByte() -> { + return (readValue(buffer) as? List)?.let { + InternalIdTokenResult.fromList(it) + } + } + 147.toByte() -> { + return (readValue(buffer) as? List)?.let { + InternalUserProfile.fromList(it) + } + } + 148.toByte() -> { + return (readValue(buffer) as? List)?.let { + InternalTotpSecret.fromList(it) + } + } + else -> super.readValueOfType(type, buffer) + } + } + override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { + when (value) { + is ActionCodeInfoOperation -> { + stream.write(129) + writeValue(stream, value.raw.toLong()) + } + is InternalMultiFactorSession -> { + stream.write(130) + writeValue(stream, value.toList()) + } + is InternalPhoneMultiFactorAssertion -> { + stream.write(131) + writeValue(stream, value.toList()) + } + is InternalMultiFactorInfo -> { + stream.write(132) + writeValue(stream, value.toList()) + } + is AuthPigeonFirebaseApp -> { + stream.write(133) + writeValue(stream, value.toList()) + } + is InternalActionCodeInfoData -> { + stream.write(134) + writeValue(stream, value.toList()) + } + is InternalActionCodeInfo -> { + stream.write(135) + writeValue(stream, value.toList()) + } + is InternalAdditionalUserInfo -> { + stream.write(136) + writeValue(stream, value.toList()) + } + is InternalAuthCredential -> { + stream.write(137) + writeValue(stream, value.toList()) + } + is InternalUserInfo -> { + stream.write(138) + writeValue(stream, value.toList()) + } + is InternalUserDetails -> { + stream.write(139) + writeValue(stream, value.toList()) + } + is InternalUserCredential -> { + stream.write(140) + writeValue(stream, value.toList()) + } + is InternalAuthCredentialInput -> { + stream.write(141) + writeValue(stream, value.toList()) + } + is InternalActionCodeSettings -> { + stream.write(142) + writeValue(stream, value.toList()) + } + is InternalFirebaseAuthSettings -> { + stream.write(143) + writeValue(stream, value.toList()) + } + is InternalSignInProvider -> { + stream.write(144) + writeValue(stream, value.toList()) + } + is InternalVerifyPhoneNumberRequest -> { + stream.write(145) + writeValue(stream, value.toList()) + } + is InternalIdTokenResult -> { + stream.write(146) + writeValue(stream, value.toList()) + } + is InternalUserProfile -> { + stream.write(147) + writeValue(stream, value.toList()) + } + is InternalTotpSecret -> { + stream.write(148) + writeValue(stream, value.toList()) + } + else -> super.writeValue(stream, value) + } + } +} + + +/** Generated interface from Pigeon that represents a handler of messages from Flutter. */ +interface FirebaseAuthHostApi { + fun registerIdTokenListener(app: AuthPigeonFirebaseApp, callback: (Result) -> Unit) + fun registerAuthStateListener(app: AuthPigeonFirebaseApp, callback: (Result) -> Unit) + fun useEmulator(app: AuthPigeonFirebaseApp, host: String, port: Long, callback: (Result) -> Unit) + fun applyActionCode(app: AuthPigeonFirebaseApp, code: String, callback: (Result) -> Unit) + fun checkActionCode(app: AuthPigeonFirebaseApp, code: String, callback: (Result) -> Unit) + fun confirmPasswordReset(app: AuthPigeonFirebaseApp, code: String, newPassword: String, callback: (Result) -> Unit) + fun createUserWithEmailAndPassword(app: AuthPigeonFirebaseApp, email: String, password: String, callback: (Result) -> Unit) + fun signInAnonymously(app: AuthPigeonFirebaseApp, callback: (Result) -> Unit) + fun signInWithCredential(app: AuthPigeonFirebaseApp, input: Map, callback: (Result) -> Unit) + fun signInWithCustomToken(app: AuthPigeonFirebaseApp, token: String, callback: (Result) -> Unit) + fun signInWithEmailAndPassword(app: AuthPigeonFirebaseApp, email: String, password: String, callback: (Result) -> Unit) + fun signInWithEmailLink(app: AuthPigeonFirebaseApp, email: String, emailLink: String, callback: (Result) -> Unit) + fun signInWithProvider(app: AuthPigeonFirebaseApp, signInProvider: InternalSignInProvider, callback: (Result) -> Unit) + fun signOut(app: AuthPigeonFirebaseApp, callback: (Result) -> Unit) + fun fetchSignInMethodsForEmail(app: AuthPigeonFirebaseApp, email: String, callback: (Result>) -> Unit) + fun sendPasswordResetEmail(app: AuthPigeonFirebaseApp, email: String, actionCodeSettings: InternalActionCodeSettings?, callback: (Result) -> Unit) + fun sendSignInLinkToEmail(app: AuthPigeonFirebaseApp, email: String, actionCodeSettings: InternalActionCodeSettings, callback: (Result) -> Unit) + fun setLanguageCode(app: AuthPigeonFirebaseApp, languageCode: String?, callback: (Result) -> Unit) + fun setSettings(app: AuthPigeonFirebaseApp, settings: InternalFirebaseAuthSettings, callback: (Result) -> Unit) + fun verifyPasswordResetCode(app: AuthPigeonFirebaseApp, code: String, callback: (Result) -> Unit) + fun verifyPhoneNumber(app: AuthPigeonFirebaseApp, request: InternalVerifyPhoneNumberRequest, callback: (Result) -> Unit) + fun revokeTokenWithAuthorizationCode(app: AuthPigeonFirebaseApp, authorizationCode: String, callback: (Result) -> Unit) + fun revokeAccessToken(app: AuthPigeonFirebaseApp, accessToken: String, callback: (Result) -> Unit) + fun initializeRecaptchaConfig(app: AuthPigeonFirebaseApp, callback: (Result) -> Unit) + + companion object { + /** The codec used by FirebaseAuthHostApi. */ + val codec: MessageCodec by lazy { + GeneratedAndroidFirebaseAuthPigeonCodec() + } + /** Sets up an instance of `FirebaseAuthHostApi` to handle messages through the `binaryMessenger`. */ + @JvmOverloads + fun setUp(binaryMessenger: BinaryMessenger, api: FirebaseAuthHostApi?, messageChannelSuffix: String = "") { + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.registerIdTokenListener$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + api.registerIdTokenListener(appArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.registerAuthStateListener$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + api.registerAuthStateListener(appArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.useEmulator$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val hostArg = args[1] as String + val portArg = args[2] as Long + api.useEmulator(appArg, hostArg, portArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.applyActionCode$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val codeArg = args[1] as String + api.applyActionCode(appArg, codeArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.checkActionCode$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val codeArg = args[1] as String + api.checkActionCode(appArg, codeArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.confirmPasswordReset$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val codeArg = args[1] as String + val newPasswordArg = args[2] as String + api.confirmPasswordReset(appArg, codeArg, newPasswordArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.createUserWithEmailAndPassword$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val emailArg = args[1] as String + val passwordArg = args[2] as String + api.createUserWithEmailAndPassword(appArg, emailArg, passwordArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInAnonymously$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + api.signInAnonymously(appArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithCredential$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val inputArg = args[1] as Map + api.signInWithCredential(appArg, inputArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithCustomToken$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val tokenArg = args[1] as String + api.signInWithCustomToken(appArg, tokenArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithEmailAndPassword$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val emailArg = args[1] as String + val passwordArg = args[2] as String + api.signInWithEmailAndPassword(appArg, emailArg, passwordArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithEmailLink$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val emailArg = args[1] as String + val emailLinkArg = args[2] as String + api.signInWithEmailLink(appArg, emailArg, emailLinkArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithProvider$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val signInProviderArg = args[1] as InternalSignInProvider + api.signInWithProvider(appArg, signInProviderArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signOut$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + api.signOut(appArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.fetchSignInMethodsForEmail$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val emailArg = args[1] as String + api.fetchSignInMethodsForEmail(appArg, emailArg) { result: Result> -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.sendPasswordResetEmail$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val emailArg = args[1] as String + val actionCodeSettingsArg = args[2] as InternalActionCodeSettings? + api.sendPasswordResetEmail(appArg, emailArg, actionCodeSettingsArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.sendSignInLinkToEmail$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val emailArg = args[1] as String + val actionCodeSettingsArg = args[2] as InternalActionCodeSettings + api.sendSignInLinkToEmail(appArg, emailArg, actionCodeSettingsArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.setLanguageCode$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val languageCodeArg = args[1] as String? + api.setLanguageCode(appArg, languageCodeArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.setSettings$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val settingsArg = args[1] as InternalFirebaseAuthSettings + api.setSettings(appArg, settingsArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.verifyPasswordResetCode$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val codeArg = args[1] as String + api.verifyPasswordResetCode(appArg, codeArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.verifyPhoneNumber$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val requestArg = args[1] as InternalVerifyPhoneNumberRequest + api.verifyPhoneNumber(appArg, requestArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.revokeTokenWithAuthorizationCode$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val authorizationCodeArg = args[1] as String + api.revokeTokenWithAuthorizationCode(appArg, authorizationCodeArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.revokeAccessToken$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val accessTokenArg = args[1] as String + api.revokeAccessToken(appArg, accessTokenArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.initializeRecaptchaConfig$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + api.initializeRecaptchaConfig(appArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + } + } +} +/** Generated interface from Pigeon that represents a handler of messages from Flutter. */ +interface FirebaseAuthUserHostApi { + fun delete(app: AuthPigeonFirebaseApp, callback: (Result) -> Unit) + fun getIdToken(app: AuthPigeonFirebaseApp, forceRefresh: Boolean, callback: (Result) -> Unit) + fun linkWithCredential(app: AuthPigeonFirebaseApp, input: Map, callback: (Result) -> Unit) + fun linkWithProvider(app: AuthPigeonFirebaseApp, signInProvider: InternalSignInProvider, callback: (Result) -> Unit) + fun reauthenticateWithCredential(app: AuthPigeonFirebaseApp, input: Map, callback: (Result) -> Unit) + fun reauthenticateWithProvider(app: AuthPigeonFirebaseApp, signInProvider: InternalSignInProvider, callback: (Result) -> Unit) + fun reload(app: AuthPigeonFirebaseApp, callback: (Result) -> Unit) + fun sendEmailVerification(app: AuthPigeonFirebaseApp, actionCodeSettings: InternalActionCodeSettings?, callback: (Result) -> Unit) + fun unlink(app: AuthPigeonFirebaseApp, providerId: String, callback: (Result) -> Unit) + fun updateEmail(app: AuthPigeonFirebaseApp, newEmail: String, callback: (Result) -> Unit) + fun updatePassword(app: AuthPigeonFirebaseApp, newPassword: String, callback: (Result) -> Unit) + fun updatePhoneNumber(app: AuthPigeonFirebaseApp, input: Map, callback: (Result) -> Unit) + fun updateProfile(app: AuthPigeonFirebaseApp, profile: InternalUserProfile, callback: (Result) -> Unit) + fun verifyBeforeUpdateEmail(app: AuthPigeonFirebaseApp, newEmail: String, actionCodeSettings: InternalActionCodeSettings?, callback: (Result) -> Unit) + + companion object { + /** The codec used by FirebaseAuthUserHostApi. */ + val codec: MessageCodec by lazy { + GeneratedAndroidFirebaseAuthPigeonCodec() + } + /** Sets up an instance of `FirebaseAuthUserHostApi` to handle messages through the `binaryMessenger`. */ + @JvmOverloads + fun setUp(binaryMessenger: BinaryMessenger, api: FirebaseAuthUserHostApi?, messageChannelSuffix: String = "") { + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.delete$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + api.delete(appArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.getIdToken$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val forceRefreshArg = args[1] as Boolean + api.getIdToken(appArg, forceRefreshArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.linkWithCredential$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val inputArg = args[1] as Map + api.linkWithCredential(appArg, inputArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.linkWithProvider$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val signInProviderArg = args[1] as InternalSignInProvider + api.linkWithProvider(appArg, signInProviderArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.reauthenticateWithCredential$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val inputArg = args[1] as Map + api.reauthenticateWithCredential(appArg, inputArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.reauthenticateWithProvider$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val signInProviderArg = args[1] as InternalSignInProvider + api.reauthenticateWithProvider(appArg, signInProviderArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.reload$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + api.reload(appArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.sendEmailVerification$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val actionCodeSettingsArg = args[1] as InternalActionCodeSettings? + api.sendEmailVerification(appArg, actionCodeSettingsArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.unlink$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val providerIdArg = args[1] as String + api.unlink(appArg, providerIdArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updateEmail$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val newEmailArg = args[1] as String + api.updateEmail(appArg, newEmailArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updatePassword$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val newPasswordArg = args[1] as String + api.updatePassword(appArg, newPasswordArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updatePhoneNumber$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val inputArg = args[1] as Map + api.updatePhoneNumber(appArg, inputArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updateProfile$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val profileArg = args[1] as InternalUserProfile + api.updateProfile(appArg, profileArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.verifyBeforeUpdateEmail$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val newEmailArg = args[1] as String + val actionCodeSettingsArg = args[2] as InternalActionCodeSettings? + api.verifyBeforeUpdateEmail(appArg, newEmailArg, actionCodeSettingsArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + } + } +} +/** Generated interface from Pigeon that represents a handler of messages from Flutter. */ +interface MultiFactorUserHostApi { + fun enrollPhone(app: AuthPigeonFirebaseApp, assertion: InternalPhoneMultiFactorAssertion, displayName: String?, callback: (Result) -> Unit) + fun enrollTotp(app: AuthPigeonFirebaseApp, assertionId: String, displayName: String?, callback: (Result) -> Unit) + fun getSession(app: AuthPigeonFirebaseApp, callback: (Result) -> Unit) + fun unenroll(app: AuthPigeonFirebaseApp, factorUid: String, callback: (Result) -> Unit) + fun getEnrolledFactors(app: AuthPigeonFirebaseApp, callback: (Result>) -> Unit) + + companion object { + /** The codec used by MultiFactorUserHostApi. */ + val codec: MessageCodec by lazy { + GeneratedAndroidFirebaseAuthPigeonCodec() + } + /** Sets up an instance of `MultiFactorUserHostApi` to handle messages through the `binaryMessenger`. */ + @JvmOverloads + fun setUp(binaryMessenger: BinaryMessenger, api: MultiFactorUserHostApi?, messageChannelSuffix: String = "") { + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.enrollPhone$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val assertionArg = args[1] as InternalPhoneMultiFactorAssertion + val displayNameArg = args[2] as String? + api.enrollPhone(appArg, assertionArg, displayNameArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.enrollTotp$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val assertionIdArg = args[1] as String + val displayNameArg = args[2] as String? + api.enrollTotp(appArg, assertionIdArg, displayNameArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.getSession$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + api.getSession(appArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.unenroll$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + val factorUidArg = args[1] as String + api.unenroll(appArg, factorUidArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.getEnrolledFactors$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val appArg = args[0] as AuthPigeonFirebaseApp + api.getEnrolledFactors(appArg) { result: Result> -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + } + } +} +/** Generated interface from Pigeon that represents a handler of messages from Flutter. */ +interface MultiFactoResolverHostApi { + fun resolveSignIn(resolverId: String, assertion: InternalPhoneMultiFactorAssertion?, totpAssertionId: String?, callback: (Result) -> Unit) + + companion object { + /** The codec used by MultiFactoResolverHostApi. */ + val codec: MessageCodec by lazy { + GeneratedAndroidFirebaseAuthPigeonCodec() + } + /** Sets up an instance of `MultiFactoResolverHostApi` to handle messages through the `binaryMessenger`. */ + @JvmOverloads + fun setUp(binaryMessenger: BinaryMessenger, api: MultiFactoResolverHostApi?, messageChannelSuffix: String = "") { + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactoResolverHostApi.resolveSignIn$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val resolverIdArg = args[0] as String + val assertionArg = args[1] as InternalPhoneMultiFactorAssertion? + val totpAssertionIdArg = args[2] as String? + api.resolveSignIn(resolverIdArg, assertionArg, totpAssertionIdArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + } + } +} +/** Generated interface from Pigeon that represents a handler of messages from Flutter. */ +interface MultiFactorTotpHostApi { + fun generateSecret(sessionId: String, callback: (Result) -> Unit) + fun getAssertionForEnrollment(secretKey: String, oneTimePassword: String, callback: (Result) -> Unit) + fun getAssertionForSignIn(enrollmentId: String, oneTimePassword: String, callback: (Result) -> Unit) + + companion object { + /** The codec used by MultiFactorTotpHostApi. */ + val codec: MessageCodec by lazy { + GeneratedAndroidFirebaseAuthPigeonCodec() + } + /** Sets up an instance of `MultiFactorTotpHostApi` to handle messages through the `binaryMessenger`. */ + @JvmOverloads + fun setUp(binaryMessenger: BinaryMessenger, api: MultiFactorTotpHostApi?, messageChannelSuffix: String = "") { + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpHostApi.generateSecret$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val sessionIdArg = args[0] as String + api.generateSecret(sessionIdArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpHostApi.getAssertionForEnrollment$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val secretKeyArg = args[0] as String + val oneTimePasswordArg = args[1] as String + api.getAssertionForEnrollment(secretKeyArg, oneTimePasswordArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpHostApi.getAssertionForSignIn$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val enrollmentIdArg = args[0] as String + val oneTimePasswordArg = args[1] as String + api.getAssertionForSignIn(enrollmentIdArg, oneTimePasswordArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + } + } +} +/** Generated interface from Pigeon that represents a handler of messages from Flutter. */ +interface MultiFactorTotpSecretHostApi { + fun generateQrCodeUrl(secretKey: String, accountName: String?, issuer: String?, callback: (Result) -> Unit) + fun openInOtpApp(secretKey: String, qrCodeUrl: String, callback: (Result) -> Unit) + + companion object { + /** The codec used by MultiFactorTotpSecretHostApi. */ + val codec: MessageCodec by lazy { + GeneratedAndroidFirebaseAuthPigeonCodec() + } + /** Sets up an instance of `MultiFactorTotpSecretHostApi` to handle messages through the `binaryMessenger`. */ + @JvmOverloads + fun setUp(binaryMessenger: BinaryMessenger, api: MultiFactorTotpSecretHostApi?, messageChannelSuffix: String = "") { + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpSecretHostApi.generateQrCodeUrl$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val secretKeyArg = args[0] as String + val accountNameArg = args[1] as String? + val issuerArg = args[2] as String? + api.generateQrCodeUrl(secretKeyArg, accountNameArg, issuerArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpSecretHostApi.openInOtpApp$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val secretKeyArg = args[0] as String + val qrCodeUrlArg = args[1] as String + api.openInOtpApp(secretKeyArg, qrCodeUrlArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) + } else { + reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + } + } +} +/** + * Only used to generate the object interface that are use outside of the Pigeon interface + * + * Generated interface from Pigeon that represents a handler of messages from Flutter. + */ +interface GenerateInterfaces { + fun pigeonInterface(info: InternalMultiFactorInfo) + + companion object { + /** The codec used by GenerateInterfaces. */ + val codec: MessageCodec by lazy { + GeneratedAndroidFirebaseAuthPigeonCodec() + } + /** Sets up an instance of `GenerateInterfaces` to handle messages through the `binaryMessenger`. */ + @JvmOverloads + fun setUp(binaryMessenger: BinaryMessenger, api: GenerateInterfaces?, messageChannelSuffix: String = "") { + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.GenerateInterfaces.pigeonInterface$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val infoArg = args[0] as InternalMultiFactorInfo + val wrapped: List = try { + api.pigeonInterface(infoArg) + listOf(null) + } catch (exception: Throwable) { + GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + } + } +} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/IdTokenChannelStreamHandler.kt b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/IdTokenChannelStreamHandler.kt new file mode 100644 index 000000000000..fba6e9b37ab0 --- /dev/null +++ b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/IdTokenChannelStreamHandler.kt @@ -0,0 +1,48 @@ +/* + * Copyright 2022, 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. + */ +package io.flutter.plugins.firebase.auth + +import com.google.firebase.auth.FirebaseAuth +import io.flutter.plugin.common.EventChannel.EventSink +import io.flutter.plugin.common.EventChannel.StreamHandler +import java.util.concurrent.atomic.AtomicBoolean + +class IdTokenChannelStreamHandler(private val firebaseAuth: FirebaseAuth) : StreamHandler { + private var idTokenListener: FirebaseAuth.IdTokenListener? = null + + override fun onListen(arguments: Any?, events: EventSink) { + val event: MutableMap = HashMap() + event[Constants.APP_NAME] = firebaseAuth.app.name + + val initialAuthState = AtomicBoolean(true) + + idTokenListener = + FirebaseAuth.IdTokenListener { auth -> + if (initialAuthState.get()) { + initialAuthState.set(false) + return@IdTokenListener + } + + val user = auth.currentUser + if (user == null) { + event[Constants.USER] = null + } else { + event[Constants.USER] = PigeonParser.manuallyToList(PigeonParser.parseFirebaseUser(user)!!) + } + + events.success(event) + } + + firebaseAuth.addIdTokenListener(idTokenListener!!) + } + + override fun onCancel(arguments: Any?) { + if (idTokenListener != null) { + firebaseAuth.removeIdTokenListener(idTokenListener!!) + idTokenListener = null + } + } +} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/PhoneNumberVerificationStreamHandler.kt b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/PhoneNumberVerificationStreamHandler.kt new file mode 100644 index 000000000000..b427695f9183 --- /dev/null +++ b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/PhoneNumberVerificationStreamHandler.kt @@ -0,0 +1,145 @@ +/* + * Copyright 2022, 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. + */ +package io.flutter.plugins.firebase.auth + +import android.app.Activity +import com.google.firebase.FirebaseException +import com.google.firebase.auth.FirebaseAuth +import com.google.firebase.auth.MultiFactorSession +import com.google.firebase.auth.PhoneAuthCredential +import com.google.firebase.auth.PhoneAuthOptions +import com.google.firebase.auth.PhoneAuthProvider +import com.google.firebase.auth.PhoneAuthProvider.ForceResendingToken +import com.google.firebase.auth.PhoneMultiFactorInfo +import io.flutter.plugin.common.EventChannel.EventSink +import io.flutter.plugin.common.EventChannel.StreamHandler +import java.util.Locale +import java.util.concurrent.TimeUnit +import java.util.concurrent.atomic.AtomicReference + +class PhoneNumberVerificationStreamHandler( + activity: Activity?, + app: AuthPigeonFirebaseApp, + request: InternalVerifyPhoneNumberRequest, + private val multiFactorSession: MultiFactorSession?, + private val multiFactorInfo: PhoneMultiFactorInfo?, + private val onCredentialsListener: OnCredentialsListener +) : StreamHandler { + fun interface OnCredentialsListener { + fun onCredentialsReceived(credential: PhoneAuthCredential) + } + + private val activityRef = AtomicReference(null) + private val firebaseAuth: FirebaseAuth = FlutterFirebaseAuthPlugin.getAuthFromPigeon(app) + private val phoneNumber: String? = request.phoneNumber + private val timeout: Int = Math.toIntExact(request.timeout) + private var autoRetrievedSmsCodeForTesting: String? = request.autoRetrievedSmsCodeForTesting + private var forceResendingToken: Int? = + request.forceResendingToken?.let { Math.toIntExact(it) } + + private var eventSink: EventSink? = null + + init { + activityRef.set(activity) + } + + override fun onListen(arguments: Any?, events: EventSink) { + eventSink = events + + val callbacks = + object : PhoneAuthProvider.OnVerificationStateChangedCallbacks() { + override fun onVerificationCompleted(phoneAuthCredential: PhoneAuthCredential) { + val phoneAuthCredentialHashCode = phoneAuthCredential.hashCode() + onCredentialsListener.onCredentialsReceived(phoneAuthCredential) + + val event: MutableMap = HashMap() + event[Constants.TOKEN] = phoneAuthCredentialHashCode + + if (phoneAuthCredential.smsCode != null) { + event[Constants.SMS_CODE] = phoneAuthCredential.smsCode + } + + event[Constants.NAME] = "Auth#phoneVerificationCompleted" + + eventSink?.success(event) + } + + override fun onVerificationFailed(e: FirebaseException) { + val event: MutableMap = HashMap() + val error: MutableMap = HashMap() + val flutterError = FlutterFirebaseAuthPluginException.parserExceptionToFlutter(e) + error["code"] = + flutterError.code.replace("ERROR_", "").lowercase(Locale.ROOT).replace("_", "-") + error["message"] = flutterError.message + error["details"] = flutterError.details + event["error"] = error + event[Constants.NAME] = "Auth#phoneVerificationFailed" + + eventSink?.success(event) + } + + override fun onCodeSent(verificationId: String, token: ForceResendingToken) { + val forceResendingTokenHashCode = token.hashCode() + forceResendingTokens[forceResendingTokenHashCode] = token + + val event: MutableMap = HashMap() + event[Constants.VERIFICATION_ID] = verificationId + event[Constants.FORCE_RESENDING_TOKEN] = forceResendingTokenHashCode + event[Constants.NAME] = "Auth#phoneCodeSent" + + eventSink?.success(event) + } + + override fun onCodeAutoRetrievalTimeOut(verificationId: String) { + val event: MutableMap = HashMap() + event[Constants.VERIFICATION_ID] = verificationId + event[Constants.NAME] = "Auth#phoneCodeAutoRetrievalTimeout" + + eventSink?.success(event) + } + } + + if (autoRetrievedSmsCodeForTesting != null) { + firebaseAuth + .firebaseAuthSettings + .setAutoRetrievedSmsCodeForPhoneNumber(phoneNumber, autoRetrievedSmsCodeForTesting) + } + + val phoneAuthOptionsBuilder = PhoneAuthOptions.Builder(firebaseAuth) + activityRef.get()?.let { phoneAuthOptionsBuilder.setActivity(it) } + phoneAuthOptionsBuilder.setCallbacks(callbacks) + + if (phoneNumber != null) { + phoneAuthOptionsBuilder.setPhoneNumber(phoneNumber) + } + if (multiFactorSession != null) { + phoneAuthOptionsBuilder.setMultiFactorSession(multiFactorSession) + } + if (multiFactorInfo != null) { + phoneAuthOptionsBuilder.setMultiFactorHint(multiFactorInfo) + } + phoneAuthOptionsBuilder.setTimeout(timeout.toLong(), TimeUnit.MILLISECONDS) + + val tokenKey = forceResendingToken + if (tokenKey != null) { + val storedToken = forceResendingTokens[tokenKey] + if (storedToken != null) { + phoneAuthOptionsBuilder.setForceResendingToken(storedToken) + } + } + + PhoneAuthProvider.verifyPhoneNumber(phoneAuthOptionsBuilder.build()) + } + + override fun onCancel(arguments: Any?) { + eventSink = null + activityRef.set(null) + } + + companion object { + private val forceResendingTokens = HashMap() + } +} diff --git a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/PigeonParser.kt b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/PigeonParser.kt new file mode 100644 index 000000000000..7bc15a4cc22e --- /dev/null +++ b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/PigeonParser.kt @@ -0,0 +1,281 @@ +/* + * 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. + */ +package io.flutter.plugins.firebase.auth + +import android.net.Uri +import com.google.firebase.auth.ActionCodeEmailInfo +import com.google.firebase.auth.ActionCodeResult +import com.google.firebase.auth.ActionCodeSettings +import com.google.firebase.auth.AdditionalUserInfo +import com.google.firebase.auth.AuthCredential +import com.google.firebase.auth.AuthResult +import com.google.firebase.auth.EmailAuthProvider +import com.google.firebase.auth.FacebookAuthProvider +import com.google.firebase.auth.FirebaseAuthProvider +import com.google.firebase.auth.FirebaseUser +import com.google.firebase.auth.GetTokenResult +import com.google.firebase.auth.GithubAuthProvider +import com.google.firebase.auth.GoogleAuthProvider +import com.google.firebase.auth.MultiFactorInfo +import com.google.firebase.auth.OAuthCredential +import com.google.firebase.auth.OAuthProvider +import com.google.firebase.auth.PhoneAuthProvider +import com.google.firebase.auth.PhoneMultiFactorInfo +import com.google.firebase.auth.PlayGamesAuthProvider +import com.google.firebase.auth.TwitterAuthProvider +import com.google.firebase.auth.UserInfo + +object PigeonParser { + fun manuallyToList(pigeonUserDetails: InternalUserDetails): List { + return listOf(pigeonUserDetails.userInfo.toList(), pigeonUserDetails.providerData) + } + + fun parseAuthResult(authResult: AuthResult): InternalUserCredential { + return InternalUserCredential( + additionalUserInfo = parseAdditionalUserInfo(authResult.additionalUserInfo), + credential = parseAuthCredential(authResult.credential), + user = parseFirebaseUser(authResult.user)) + } + + private fun parseAdditionalUserInfo(additionalUserInfo: AdditionalUserInfo?): InternalAdditionalUserInfo? { + if (additionalUserInfo == null) { + return null + } + + return InternalAdditionalUserInfo( + isNewUser = additionalUserInfo.isNewUser, + profile = additionalUserInfo.profile as Map?, + providerId = additionalUserInfo.providerId, + username = additionalUserInfo.username) + } + + fun parseAuthCredential(authCredential: AuthCredential?): InternalAuthCredential? { + if (authCredential == null) { + return null + } + + val authCredentialHashCode = authCredential.hashCode() + FlutterFirebaseAuthPlugin.authCredentials[authCredentialHashCode] = authCredential + + return InternalAuthCredential( + providerId = authCredential.provider, + signInMethod = authCredential.signInMethod, + nativeId = authCredentialHashCode.toLong(), + accessToken = (authCredential as? OAuthCredential)?.accessToken) + } + + fun parseFirebaseUser(firebaseUser: FirebaseUser?): InternalUserDetails? { + if (firebaseUser == null) { + return null + } + + val userMetadata = firebaseUser.metadata + val userInfo = + InternalUserInfo( + displayName = firebaseUser.displayName, + email = firebaseUser.email, + isEmailVerified = firebaseUser.isEmailVerified, + isAnonymous = firebaseUser.isAnonymous, + creationTimestamp = userMetadata?.creationTimestamp, + lastSignInTimestamp = userMetadata?.lastSignInTimestamp, + phoneNumber = firebaseUser.phoneNumber, + photoUrl = parsePhotoUrl(firebaseUser.photoUrl), + uid = firebaseUser.uid, + tenantId = firebaseUser.tenantId) + + return InternalUserDetails(userInfo = userInfo, providerData = parseUserInfoList(firebaseUser.providerData)) + } + + private fun parseUserInfoList(userInfoList: List?): List?> { + val output = ArrayList?>() + if (userInfoList == null) { + return output + } + + for (userInfo in ArrayList(userInfoList)) { + if (userInfo == null) { + continue + } + if (FirebaseAuthProvider.PROVIDER_ID != userInfo.providerId) { + output.add(parseUserInfoToMap(userInfo)) + } + } + + return output + } + + private fun parseUserInfoToMap(userInfo: UserInfo): Map { + return mapOf( + "displayName" to userInfo.displayName, + "email" to userInfo.email, + "isEmailVerified" to userInfo.isEmailVerified, + "phoneNumber" to userInfo.phoneNumber, + "photoUrl" to parsePhotoUrl(userInfo.photoUrl), + "uid" to (userInfo.uid ?: ""), + "providerId" to userInfo.providerId, + "isAnonymous" to false) + } + + private fun parsePhotoUrl(photoUri: Uri?): String? { + if (photoUri == null) { + return null + } + + val photoUrl = photoUri.toString() + return if (photoUrl == "") null else photoUrl + } + + fun getCredential(credentialMap: Map): AuthCredential? { + if (credentialMap[Constants.TOKEN] != null) { + val token = (credentialMap[Constants.TOKEN] as Number).toInt() + return FlutterFirebaseAuthPlugin.authCredentials[token] + ?: throw FlutterFirebaseAuthPluginException.invalidCredential() + } + + val signInMethod = credentialMap[Constants.SIGN_IN_METHOD] as String + val secret = credentialMap[Constants.SECRET] as String? + val idToken = credentialMap[Constants.ID_TOKEN] as String? + val accessToken = credentialMap[Constants.ACCESS_TOKEN] as String? + val rawNonce = credentialMap[Constants.RAW_NONCE] as String? + + return when (signInMethod) { + Constants.SIGN_IN_METHOD_PASSWORD -> + EmailAuthProvider.getCredential(credentialMap[Constants.EMAIL] as String, secret!!) + Constants.SIGN_IN_METHOD_EMAIL_LINK -> + EmailAuthProvider.getCredentialWithLink( + credentialMap[Constants.EMAIL] as String, credentialMap[Constants.EMAIL_LINK] as String) + Constants.SIGN_IN_METHOD_FACEBOOK -> FacebookAuthProvider.getCredential(accessToken!!) + Constants.SIGN_IN_METHOD_GOOGLE -> GoogleAuthProvider.getCredential(idToken, accessToken) + Constants.SIGN_IN_METHOD_TWITTER -> TwitterAuthProvider.getCredential(accessToken!!, secret!!) + Constants.SIGN_IN_METHOD_GITHUB -> GithubAuthProvider.getCredential(accessToken!!) + Constants.SIGN_IN_METHOD_PHONE -> { + val verificationId = credentialMap[Constants.VERIFICATION_ID] as String + val smsCode = credentialMap[Constants.SMS_CODE] as String + PhoneAuthProvider.getCredential(verificationId, smsCode) + } + Constants.SIGN_IN_METHOD_OAUTH -> { + val providerId = credentialMap[Constants.PROVIDER_ID] as String + val builder = OAuthProvider.newCredentialBuilder(providerId) + if (accessToken != null) { + builder.setAccessToken(accessToken) + } + if (rawNonce == null) { + builder.setIdToken(idToken!!) + } else { + builder.setIdTokenWithRawNonce(idToken!!, rawNonce) + } + builder.build() + } + Constants.SIGN_IN_METHOD_PLAY_GAMES -> { + val serverAuthCode = credentialMap[Constants.SERVER_AUTH_CODE] as String + PlayGamesAuthProvider.getCredential(serverAuthCode) + } + else -> null + } + } + + fun getActionCodeSettings(pigeonActionCodeSettings: InternalActionCodeSettings): ActionCodeSettings { + val builder = ActionCodeSettings.newBuilder() + builder.setUrl(pigeonActionCodeSettings.url) + + if (pigeonActionCodeSettings.dynamicLinkDomain != null) { + builder.setDynamicLinkDomain(pigeonActionCodeSettings.dynamicLinkDomain) + } + + if (pigeonActionCodeSettings.linkDomain != null) { + builder.setLinkDomain(pigeonActionCodeSettings.linkDomain) + } + + builder.setHandleCodeInApp(pigeonActionCodeSettings.handleCodeInApp) + + if (pigeonActionCodeSettings.androidPackageName != null) { + builder.setAndroidPackageName( + pigeonActionCodeSettings.androidPackageName, + pigeonActionCodeSettings.androidInstallApp, + pigeonActionCodeSettings.androidMinimumVersion) + } + + if (pigeonActionCodeSettings.iOSBundleId != null) { + builder.setIOSBundleId(pigeonActionCodeSettings.iOSBundleId) + } + + return builder.build() + } + + fun multiFactorInfoToPigeon(hints: List): List { + val pigeonHints = ArrayList() + for (info in hints) { + if (info is PhoneMultiFactorInfo) { + pigeonHints.add( + InternalMultiFactorInfo( + phoneNumber = info.phoneNumber, + displayName = info.displayName, + enrollmentTimestamp = info.enrollmentTimestamp.toDouble(), + uid = info.uid, + factorId = info.factorId)) + } else { + pigeonHints.add( + InternalMultiFactorInfo( + displayName = info.displayName, + enrollmentTimestamp = info.enrollmentTimestamp.toDouble(), + uid = info.uid, + factorId = info.factorId)) + } + } + return pigeonHints + } + + fun multiFactorInfoToMap(hints: List): List> { + val pigeonHints = ArrayList>() + for (info in multiFactorInfoToPigeon(hints)) { + pigeonHints.add(info.toList()) + } + return pigeonHints + } + + fun parseActionCodeResult(actionCodeResult: ActionCodeResult): InternalActionCodeInfo { + val operation = + when (actionCodeResult.operation) { + ActionCodeResult.PASSWORD_RESET -> ActionCodeInfoOperation.PASSWORD_RESET + ActionCodeResult.VERIFY_EMAIL -> ActionCodeInfoOperation.VERIFY_EMAIL + ActionCodeResult.RECOVER_EMAIL -> ActionCodeInfoOperation.RECOVER_EMAIL + ActionCodeResult.SIGN_IN_WITH_EMAIL_LINK -> ActionCodeInfoOperation.EMAIL_SIGN_IN + ActionCodeResult.VERIFY_BEFORE_CHANGE_EMAIL -> + ActionCodeInfoOperation.VERIFY_AND_CHANGE_EMAIL + ActionCodeResult.REVERT_SECOND_FACTOR_ADDITION -> + ActionCodeInfoOperation.REVERT_SECOND_FACTOR_ADDITION + else -> ActionCodeInfoOperation.UNKNOWN + } + + val actionCodeInfo = actionCodeResult.info + val data = + if (actionCodeInfo != null && + (actionCodeResult.operation == ActionCodeResult.VERIFY_EMAIL || + actionCodeResult.operation == ActionCodeResult.PASSWORD_RESET)) { + InternalActionCodeInfoData(email = actionCodeInfo.email) + } else if (actionCodeResult.operation == ActionCodeResult.RECOVER_EMAIL || + actionCodeResult.operation == ActionCodeResult.VERIFY_BEFORE_CHANGE_EMAIL) { + val actionCodeEmailInfo = actionCodeInfo as ActionCodeEmailInfo + InternalActionCodeInfoData( + email = actionCodeEmailInfo.email, previousEmail = actionCodeEmailInfo.previousEmail) + } else { + InternalActionCodeInfoData() + } + + return InternalActionCodeInfo(operation = operation, data = data) + } + + fun parseTokenResult(tokenResult: GetTokenResult): InternalIdTokenResult { + return InternalIdTokenResult( + token = tokenResult.token, + signInProvider = tokenResult.signInProvider, + authTimestamp = tokenResult.authTimestamp * 1000, + expirationTimestamp = tokenResult.expirationTimestamp * 1000, + issuedAtTimestamp = tokenResult.issuedAtTimestamp * 1000, + claims = tokenResult.claims as Map?, + signInSecondFactor = tokenResult.signInSecondFactor) + } +} diff --git a/packages/firebase_auth/firebase_auth/example/android/settings.gradle b/packages/firebase_auth/firebase_auth/example/android/settings.gradle index 812272422a40..ff739370b7e4 100644 --- a/packages/firebase_auth/firebase_auth/example/android/settings.gradle +++ b/packages/firebase_auth/firebase_auth/example/android/settings.gradle @@ -22,7 +22,7 @@ plugins { // START: FlutterFire Configuration id "com.google.gms.google-services" version "4.3.15" apply false // END: FlutterFire Configuration - id "org.jetbrains.kotlin.android" version "2.1.0" apply false + id "org.jetbrains.kotlin.android" version "2.3.0" apply false } include ":app" 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 9c6cfd4a3c0b..e8db36967ff0 100644 --- a/packages/firebase_auth/firebase_auth_platform_interface/pigeons/messages.dart +++ b/packages/firebase_auth/firebase_auth_platform_interface/pigeons/messages.dart @@ -11,11 +11,10 @@ import 'package:pigeon/pigeon.dart'; dartOut: 'lib/src/pigeon/messages.pigeon.dart', // We export in the lib folder to expose the class to other packages. dartTestOut: 'test/pigeon/test_api.dart', - javaOut: - '../firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/GeneratedAndroidFirebaseAuth.java', - javaOptions: JavaOptions( + kotlinOut: + '../firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/GeneratedAndroidFirebaseAuth.g.kt', + kotlinOptions: KotlinOptions( package: 'io.flutter.plugins.firebase.auth', - className: 'GeneratedAndroidFirebaseAuth', ), swiftOut: '../firebase_auth/ios/firebase_auth/Sources/firebase_auth/FirebaseAuthMessages.g.swift', From ba79abd57c743fb46add0578e1beb078b82f5d07 Mon Sep 17 00:00:00 2001 From: Jude Selase Kwashie <64037520+SelaseKay@users.noreply.github.com> Date: Thu, 20 Aug 2026 11:35:07 +0000 Subject: [PATCH 3/4] fix(auth,android): read customAuthDomain from FlutterFirebasePlugin --- .../flutter/plugins/firebase/auth/FlutterFirebaseAuthPlugin.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPlugin.kt b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPlugin.kt index 6faa0480774d..045b658499cb 100644 --- a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPlugin.kt +++ b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPlugin.kt @@ -18,7 +18,6 @@ import io.flutter.plugin.common.BinaryMessenger import io.flutter.plugin.common.EventChannel import io.flutter.plugin.common.EventChannel.StreamHandler import io.flutter.plugin.common.MethodChannel -import io.flutter.plugins.firebase.core.FlutterFirebaseCorePlugin import io.flutter.plugins.firebase.core.FlutterFirebasePlugin import io.flutter.plugins.firebase.core.FlutterFirebasePlugin.cachedThreadPool import io.flutter.plugins.firebase.core.FlutterFirebasePluginRegistry @@ -540,7 +539,7 @@ class FlutterFirebaseAuthPlugin : FlutterFirebasePlugin, FlutterPlugin, Activity val app = FirebaseApp.getInstance(pigeonApp.appName) val auth = FirebaseAuth.getInstance(app) pigeonApp.tenantId?.let { auth.setTenantId(it) } - val customDomain = FlutterFirebaseCorePlugin.customAuthDomain[pigeonApp.appName] + val customDomain = FlutterFirebasePlugin.customAuthDomain[pigeonApp.appName] if (customDomain != null) { auth.setCustomAuthDomain(customDomain) } From abcb685bb422b70f809209ad95ee162b3d9f0142 Mon Sep 17 00:00:00 2001 From: Jude Kwashie Date: Thu, 20 Aug 2026 11:41:42 +0000 Subject: [PATCH 4/4] fix formatting --- .../auth/AuthStateChannelStreamHandler.kt | 3 +- .../auth/FlutterFirebaseAuthPlugin.kt | 42 +- .../FlutterFirebaseAuthPluginException.kt | 8 +- .../firebase/auth/FlutterFirebaseAuthUser.kt | 15 +- .../auth/FlutterFirebaseMultiFactor.kt | 5 +- .../auth/FlutterFirebaseTotpSecret.kt | 6 +- .../auth/GeneratedAndroidFirebaseAuth.g.kt | 1559 ++++++++++++----- .../auth/IdTokenChannelStreamHandler.kt | 3 +- .../PhoneNumberVerificationStreamHandler.kt | 8 +- .../plugins/firebase/auth/PigeonParser.kt | 14 +- 10 files changed, 1136 insertions(+), 527 deletions(-) diff --git a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/AuthStateChannelStreamHandler.kt b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/AuthStateChannelStreamHandler.kt index ee38cbff3679..723382ca04a6 100644 --- a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/AuthStateChannelStreamHandler.kt +++ b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/AuthStateChannelStreamHandler.kt @@ -30,7 +30,8 @@ class AuthStateChannelStreamHandler(private val firebaseAuth: FirebaseAuth) : St if (user == null) { event[Constants.USER] = null } else { - event[Constants.USER] = PigeonParser.manuallyToList(PigeonParser.parseFirebaseUser(user)!!) + event[Constants.USER] = + PigeonParser.manuallyToList(PigeonParser.parseFirebaseUser(user)!!) } events.success(event) diff --git a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPlugin.kt b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPlugin.kt index 045b658499cb..118b1a112757 100644 --- a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPlugin.kt +++ b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPlugin.kt @@ -24,7 +24,8 @@ import io.flutter.plugins.firebase.core.FlutterFirebasePluginRegistry import java.util.UUID /** Flutter plugin for Firebase Auth. */ -class FlutterFirebaseAuthPlugin : FlutterFirebasePlugin, FlutterPlugin, ActivityAware, FirebaseAuthHostApi { +class FlutterFirebaseAuthPlugin : + FlutterFirebasePlugin, FlutterPlugin, ActivityAware, FirebaseAuthHostApi { private var messenger: BinaryMessenger? = null private var channel: MethodChannel? = null private var activity: Activity? = null @@ -76,7 +77,9 @@ class FlutterFirebaseAuthPlugin : FlutterFirebasePlugin, FlutterPlugin, Activity firebaseAuthUser.setActivity(null) } - override fun onReattachedToActivityForConfigChanges(activityPluginBinding: ActivityPluginBinding) { + override fun onReattachedToActivityForConfigChanges( + activityPluginBinding: ActivityPluginBinding + ) { activity = activityPluginBinding.activity firebaseAuthUser.setActivity(activity) } @@ -90,7 +93,10 @@ class FlutterFirebaseAuthPlugin : FlutterFirebasePlugin, FlutterPlugin, Activity return activity } - override fun registerIdTokenListener(app: AuthPigeonFirebaseApp, callback: (Result) -> Unit) { + override fun registerIdTokenListener( + app: AuthPigeonFirebaseApp, + callback: (Result) -> Unit + ) { try { val auth = getAuthFromPigeon(app) val handler = IdTokenChannelStreamHandler(auth) @@ -178,9 +184,10 @@ class FlutterFirebaseAuthPlugin : FlutterFirebasePlugin, FlutterPlugin, Activity password: String, callback: (Result) -> Unit ) { - getAuthFromPigeon(app) - .createUserWithEmailAndPassword(email, password) - .addOnCompleteListener { task -> completeAuthResult(task, callback) } + getAuthFromPigeon(app).createUserWithEmailAndPassword(email, password).addOnCompleteListener { + task -> + completeAuthResult(task, callback) + } } override fun signInAnonymously( @@ -223,9 +230,10 @@ class FlutterFirebaseAuthPlugin : FlutterFirebasePlugin, FlutterPlugin, Activity password: String, callback: (Result) -> Unit ) { - getAuthFromPigeon(app) - .signInWithEmailAndPassword(email, password) - .addOnCompleteListener { task -> completeAuthResult(task, callback) } + getAuthFromPigeon(app).signInWithEmailAndPassword(email, password).addOnCompleteListener { task + -> + completeAuthResult(task, callback) + } } override fun signInWithEmailLink( @@ -345,9 +353,8 @@ class FlutterFirebaseAuthPlugin : FlutterFirebasePlugin, FlutterPlugin, Activity ) { try { val firebaseAuth = getAuthFromPigeon(app) - firebaseAuth - .firebaseAuthSettings - .setAppVerificationDisabledForTesting(settings.appVerificationDisabledForTesting) + firebaseAuth.firebaseAuthSettings.setAppVerificationDisabledForTesting( + settings.appVerificationDisabledForTesting) if (settings.forceRecaptchaFlow != null) { firebaseAuth.firebaseAuthSettings.forceRecaptchaFlowForTesting( @@ -355,9 +362,8 @@ class FlutterFirebaseAuthPlugin : FlutterFirebasePlugin, FlutterPlugin, Activity } if (settings.phoneNumber != null && settings.smsCode != null) { - firebaseAuth - .firebaseAuthSettings - .setAutoRetrievedSmsCodeForPhoneNumber(settings.phoneNumber, settings.smsCode) + firebaseAuth.firebaseAuthSettings.setAutoRetrievedSmsCodeForPhoneNumber( + settings.phoneNumber, settings.smsCode) } callback(Result.success(Unit)) @@ -412,11 +418,7 @@ class FlutterFirebaseAuthPlugin : FlutterFirebasePlugin, FlutterPlugin, Activity val handler = PhoneNumberVerificationStreamHandler( - getActivity(), - app, - request, - multiFactorSession, - multiFactorInfo) { credential -> + getActivity(), app, request, multiFactorSession, multiFactorInfo) { credential -> authCredentials[credential.hashCode()] = credential } diff --git a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPluginException.kt b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPluginException.kt index c7c72300eb38..6692a7f6f767 100644 --- a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPluginException.kt +++ b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPluginException.kt @@ -66,16 +66,16 @@ object FlutterFirebaseAuthPluginException { } if (nativeException.message != null && - nativeException - .message!! - .startsWith("Cannot create PhoneAuthCredential without either verificationProof")) { + nativeException.message!!.startsWith( + "Cannot create PhoneAuthCredential without either verificationProof")) { return FlutterError( "invalid-verification-code", "The verification ID used to create the phone auth credential is invalid.", null) } - if (message != null && message.contains("User has already been linked to the given provider.")) { + if (message != null && + message.contains("User has already been linked to the given provider.")) { return alreadyLinkedProvider() } diff --git a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthUser.kt b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthUser.kt index 05dd6a581e40..f4e2680b38e0 100644 --- a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthUser.kt +++ b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthUser.kt @@ -56,7 +56,8 @@ class FlutterFirebaseAuthUser : FirebaseAuthUserHostApi { val response = Tasks.await(firebaseUser.getIdToken(forceRefresh)) callback(Result.success(PigeonParser.parseTokenResult(response))) } catch (exception: Exception) { - callback(Result.failure(FlutterFirebaseAuthPluginException.parserExceptionToFlutter(exception))) + callback( + Result.failure(FlutterFirebaseAuthPluginException.parserExceptionToFlutter(exception))) } } } @@ -224,12 +225,14 @@ class FlutterFirebaseAuthUser : FirebaseAuthUserHostApi { callback(Result.success(PigeonParser.parseAuthResult(task.result))) } else { val exception = task.exception - if (exception?.message?.contains( - "User was not linked to an account with the given provider.") == true) { + if (exception + ?.message + ?.contains("User was not linked to an account with the given provider.") == true) { callback(Result.failure(FlutterFirebaseAuthPluginException.noSuchProvider())) } else { callback( - Result.failure(FlutterFirebaseAuthPluginException.parserExceptionToFlutter(exception))) + Result.failure( + FlutterFirebaseAuthPluginException.parserExceptionToFlutter(exception))) } } } @@ -248,7 +251,9 @@ class FlutterFirebaseAuthUser : FirebaseAuthUserHostApi { newPassword: String, callback: (Result) -> Unit ) { - reloadAfterUserUpdate(getCurrentUserFromPigeon(app), callback) { it.updatePassword(newPassword) } + reloadAfterUserUpdate(getCurrentUserFromPigeon(app), callback) { + it.updatePassword(newPassword) + } } override fun updatePhoneNumber( diff --git a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseMultiFactor.kt b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseMultiFactor.kt index 336536151fea..da12c0ad6c17 100644 --- a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseMultiFactor.kt +++ b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseMultiFactor.kt @@ -17,8 +17,9 @@ import java.util.UUID class FlutterFirebaseMultiFactor : MultiFactorUserHostApi, MultiFactoResolverHostApi { @Throws(FirebaseNoSignedInUserException::class) fun getAppMultiFactor(app: AuthPigeonFirebaseApp): MultiFactor { - val currentUser = FlutterFirebaseAuthUser.getCurrentUserFromPigeon(app) - ?: throw FirebaseNoSignedInUserException("No user is signed in") + val currentUser = + FlutterFirebaseAuthUser.getCurrentUserFromPigeon(app) + ?: throw FirebaseNoSignedInUserException("No user is signed in") val appMultiFactorUser = multiFactorUserMap.getOrPut(app.appName) { HashMap() } return appMultiFactorUser.getOrPut(currentUser.uid) { currentUser.multiFactor } } diff --git a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseTotpSecret.kt b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseTotpSecret.kt index 2bc9cdb072ad..aa52d2f769a4 100644 --- a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseTotpSecret.kt +++ b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/FlutterFirebaseTotpSecret.kt @@ -23,7 +23,11 @@ class FlutterFirebaseTotpSecret : MultiFactorTotpSecretHostApi { callback(Result.success(secret.generateQrCodeUrl(accountName, issuer))) } - override fun openInOtpApp(secretKey: String, qrCodeUrl: String, callback: (Result) -> Unit) { + override fun openInOtpApp( + secretKey: String, + qrCodeUrl: String, + callback: (Result) -> Unit + ) { val secret: TotpSecret? = FlutterFirebaseTotpMultiFactor.multiFactorSecret[secretKey] checkNotNull(secret) secret.openInOtpApp(qrCodeUrl) diff --git a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/GeneratedAndroidFirebaseAuth.g.kt b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/GeneratedAndroidFirebaseAuth.g.kt index a0018c9a367e..b116357a8a66 100644 --- a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/GeneratedAndroidFirebaseAuth.g.kt +++ b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/GeneratedAndroidFirebaseAuth.g.kt @@ -10,12 +10,11 @@ package io.flutter.plugins.firebase.auth import android.util.Log import io.flutter.plugin.common.BasicMessageChannel import io.flutter.plugin.common.BinaryMessenger -import io.flutter.plugin.common.EventChannel import io.flutter.plugin.common.MessageCodec -import io.flutter.plugin.common.StandardMethodCodec import io.flutter.plugin.common.StandardMessageCodec import java.io.ByteArrayOutputStream import java.nio.ByteBuffer + private object GeneratedAndroidFirebaseAuthPigeonUtils { fun wrapResult(result: Any?): List { @@ -24,19 +23,15 @@ private object GeneratedAndroidFirebaseAuthPigeonUtils { fun wrapError(exception: Throwable): List { return if (exception is FlutterError) { - listOf( - exception.code, - exception.message, - exception.details - ) + listOf(exception.code, exception.message, exception.details) } else { listOf( - exception.javaClass.simpleName, - exception.toString(), - "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception) - ) + exception.javaClass.simpleName, + exception.toString(), + "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)) } } + fun doubleEquals(a: Double, b: Double): Boolean { // Normalize -0.0 to 0.0 and handle NaN equality. return (if (a == 0.0) 0.0 else a) == (if (b == 0.0) 0.0 else b) || (a.isNaN() && b.isNaN()) @@ -180,25 +175,22 @@ private object GeneratedAndroidFirebaseAuthPigeonUtils { else -> value.hashCode() } } - } /** * Error class for passing custom error details to Flutter via a thrown PlatformException. + * * @property code The error code. * @property message The error message. * @property details The error details. Must be a datatype supported by the api codec. */ -class FlutterError ( - val code: String, - override val message: String? = null, - val details: Any? = null +class FlutterError( + val code: String, + override val message: String? = null, + val details: Any? = null ) : RuntimeException() -/** - * The type of operation that generated the action code from calling - * [checkActionCode]. - */ +/** The type of operation that generated the action code from calling [checkActionCode]. */ enum class ActionCodeInfoOperation(val raw: Int) { /** Unknown operation. */ UNKNOWN(0), @@ -223,21 +215,20 @@ enum class ActionCodeInfoOperation(val raw: Int) { } /** Generated class from Pigeon that represents data sent in messages. */ -data class InternalMultiFactorSession ( - val id: String -) - { +data class InternalMultiFactorSession(val id: String) { companion object { fun fromList(pigeonVar_list: List): InternalMultiFactorSession { val id = pigeonVar_list[0] as String return InternalMultiFactorSession(id) } } + fun toList(): List { return listOf( - id, + id, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -257,11 +248,10 @@ data class InternalMultiFactorSession ( } /** Generated class from Pigeon that represents data sent in messages. */ -data class InternalPhoneMultiFactorAssertion ( - val verificationId: String, - val verificationCode: String -) - { +data class InternalPhoneMultiFactorAssertion( + val verificationId: String, + val verificationCode: String +) { companion object { fun fromList(pigeonVar_list: List): InternalPhoneMultiFactorAssertion { val verificationId = pigeonVar_list[0] as String @@ -269,12 +259,14 @@ data class InternalPhoneMultiFactorAssertion ( return InternalPhoneMultiFactorAssertion(verificationId, verificationCode) } } + fun toList(): List { return listOf( - verificationId, - verificationCode, + verificationId, + verificationCode, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -283,7 +275,10 @@ data class InternalPhoneMultiFactorAssertion ( return true } val other = other as InternalPhoneMultiFactorAssertion - return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.verificationId, other.verificationId) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.verificationCode, other.verificationCode) + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.verificationId, other.verificationId) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.verificationCode, other.verificationCode) } override fun hashCode(): Int { @@ -295,14 +290,13 @@ data class InternalPhoneMultiFactorAssertion ( } /** Generated class from Pigeon that represents data sent in messages. */ -data class InternalMultiFactorInfo ( - val displayName: String? = null, - val enrollmentTimestamp: Double, - val factorId: String? = null, - val uid: String, - val phoneNumber: String? = null -) - { +data class InternalMultiFactorInfo( + val displayName: String? = null, + val enrollmentTimestamp: Double, + val factorId: String? = null, + val uid: String, + val phoneNumber: String? = null +) { companion object { fun fromList(pigeonVar_list: List): InternalMultiFactorInfo { val displayName = pigeonVar_list[0] as String? @@ -313,15 +307,17 @@ data class InternalMultiFactorInfo ( return InternalMultiFactorInfo(displayName, enrollmentTimestamp, factorId, uid, phoneNumber) } } + fun toList(): List { return listOf( - displayName, - enrollmentTimestamp, - factorId, - uid, - phoneNumber, + displayName, + enrollmentTimestamp, + factorId, + uid, + phoneNumber, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -330,13 +326,20 @@ data class InternalMultiFactorInfo ( return true } val other = other as InternalMultiFactorInfo - return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.displayName, other.displayName) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.enrollmentTimestamp, other.enrollmentTimestamp) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.factorId, other.factorId) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.uid, other.uid) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.phoneNumber, other.phoneNumber) + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.displayName, other.displayName) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.enrollmentTimestamp, other.enrollmentTimestamp) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.factorId, other.factorId) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.uid, other.uid) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.phoneNumber, other.phoneNumber) } override fun hashCode(): Int { var result = javaClass.hashCode() result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.displayName) - result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.enrollmentTimestamp) + result = + 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.enrollmentTimestamp) result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.factorId) result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.uid) result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.phoneNumber) @@ -345,12 +348,11 @@ data class InternalMultiFactorInfo ( } /** Generated class from Pigeon that represents data sent in messages. */ -data class AuthPigeonFirebaseApp ( - val appName: String, - val tenantId: String? = null, - val customAuthDomain: String? = null -) - { +data class AuthPigeonFirebaseApp( + val appName: String, + val tenantId: String? = null, + val customAuthDomain: String? = null +) { companion object { fun fromList(pigeonVar_list: List): AuthPigeonFirebaseApp { val appName = pigeonVar_list[0] as String @@ -359,13 +361,15 @@ data class AuthPigeonFirebaseApp ( return AuthPigeonFirebaseApp(appName, tenantId, customAuthDomain) } } + fun toList(): List { return listOf( - appName, - tenantId, - customAuthDomain, + appName, + tenantId, + customAuthDomain, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -374,7 +378,10 @@ data class AuthPigeonFirebaseApp ( return true } val other = other as AuthPigeonFirebaseApp - return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.appName, other.appName) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.tenantId, other.tenantId) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.customAuthDomain, other.customAuthDomain) + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.appName, other.appName) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.tenantId, other.tenantId) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.customAuthDomain, other.customAuthDomain) } override fun hashCode(): Int { @@ -387,11 +394,10 @@ data class AuthPigeonFirebaseApp ( } /** Generated class from Pigeon that represents data sent in messages. */ -data class InternalActionCodeInfoData ( - val email: String? = null, - val previousEmail: String? = null -) - { +data class InternalActionCodeInfoData( + val email: String? = null, + val previousEmail: String? = null +) { companion object { fun fromList(pigeonVar_list: List): InternalActionCodeInfoData { val email = pigeonVar_list[0] as String? @@ -399,12 +405,14 @@ data class InternalActionCodeInfoData ( return InternalActionCodeInfoData(email, previousEmail) } } + fun toList(): List { return listOf( - email, - previousEmail, + email, + previousEmail, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -413,7 +421,8 @@ data class InternalActionCodeInfoData ( return true } val other = other as InternalActionCodeInfoData - return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.email, other.email) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.previousEmail, other.previousEmail) + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.email, other.email) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.previousEmail, other.previousEmail) } override fun hashCode(): Int { @@ -425,11 +434,10 @@ data class InternalActionCodeInfoData ( } /** Generated class from Pigeon that represents data sent in messages. */ -data class InternalActionCodeInfo ( - val operation: ActionCodeInfoOperation, - val data: InternalActionCodeInfoData -) - { +data class InternalActionCodeInfo( + val operation: ActionCodeInfoOperation, + val data: InternalActionCodeInfoData +) { companion object { fun fromList(pigeonVar_list: List): InternalActionCodeInfo { val operation = pigeonVar_list[0] as ActionCodeInfoOperation @@ -437,12 +445,14 @@ data class InternalActionCodeInfo ( return InternalActionCodeInfo(operation, data) } } + fun toList(): List { return listOf( - operation, - data, + operation, + data, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -451,7 +461,8 @@ data class InternalActionCodeInfo ( return true } val other = other as InternalActionCodeInfo - return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.operation, other.operation) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.data, other.data) + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.operation, other.operation) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.data, other.data) } override fun hashCode(): Int { @@ -463,14 +474,13 @@ data class InternalActionCodeInfo ( } /** Generated class from Pigeon that represents data sent in messages. */ -data class InternalAdditionalUserInfo ( - val isNewUser: Boolean, - val providerId: String? = null, - val username: String? = null, - val authorizationCode: String? = null, - val profile: Map? = null -) - { +data class InternalAdditionalUserInfo( + val isNewUser: Boolean, + val providerId: String? = null, + val username: String? = null, + val authorizationCode: String? = null, + val profile: Map? = null +) { companion object { fun fromList(pigeonVar_list: List): InternalAdditionalUserInfo { val isNewUser = pigeonVar_list[0] as Boolean @@ -481,15 +491,17 @@ data class InternalAdditionalUserInfo ( return InternalAdditionalUserInfo(isNewUser, providerId, username, authorizationCode, profile) } } + fun toList(): List { return listOf( - isNewUser, - providerId, - username, - authorizationCode, - profile, + isNewUser, + providerId, + username, + authorizationCode, + profile, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -498,7 +510,12 @@ data class InternalAdditionalUserInfo ( return true } val other = other as InternalAdditionalUserInfo - return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.isNewUser, other.isNewUser) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.providerId, other.providerId) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.username, other.username) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.authorizationCode, other.authorizationCode) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.profile, other.profile) + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.isNewUser, other.isNewUser) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.providerId, other.providerId) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.username, other.username) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.authorizationCode, other.authorizationCode) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.profile, other.profile) } override fun hashCode(): Int { @@ -513,13 +530,12 @@ data class InternalAdditionalUserInfo ( } /** Generated class from Pigeon that represents data sent in messages. */ -data class InternalAuthCredential ( - val providerId: String, - val signInMethod: String, - val nativeId: Long, - val accessToken: String? = null -) - { +data class InternalAuthCredential( + val providerId: String, + val signInMethod: String, + val nativeId: Long, + val accessToken: String? = null +) { companion object { fun fromList(pigeonVar_list: List): InternalAuthCredential { val providerId = pigeonVar_list[0] as String @@ -529,14 +545,16 @@ data class InternalAuthCredential ( return InternalAuthCredential(providerId, signInMethod, nativeId, accessToken) } } + fun toList(): List { return listOf( - providerId, - signInMethod, - nativeId, - accessToken, + providerId, + signInMethod, + nativeId, + accessToken, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -545,7 +563,10 @@ data class InternalAuthCredential ( return true } val other = other as InternalAuthCredential - return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.providerId, other.providerId) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.signInMethod, other.signInMethod) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.nativeId, other.nativeId) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.accessToken, other.accessToken) + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.providerId, other.providerId) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.signInMethod, other.signInMethod) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.nativeId, other.nativeId) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.accessToken, other.accessToken) } override fun hashCode(): Int { @@ -559,21 +580,20 @@ data class InternalAuthCredential ( } /** Generated class from Pigeon that represents data sent in messages. */ -data class InternalUserInfo ( - val uid: String, - val email: String? = null, - val displayName: String? = null, - val photoUrl: String? = null, - val phoneNumber: String? = null, - val isAnonymous: Boolean, - val isEmailVerified: Boolean, - val providerId: String? = null, - val tenantId: String? = null, - val refreshToken: String? = null, - val creationTimestamp: Long? = null, - val lastSignInTimestamp: Long? = null -) - { +data class InternalUserInfo( + val uid: String, + val email: String? = null, + val displayName: String? = null, + val photoUrl: String? = null, + val phoneNumber: String? = null, + val isAnonymous: Boolean, + val isEmailVerified: Boolean, + val providerId: String? = null, + val tenantId: String? = null, + val refreshToken: String? = null, + val creationTimestamp: Long? = null, + val lastSignInTimestamp: Long? = null +) { companion object { fun fromList(pigeonVar_list: List): InternalUserInfo { val uid = pigeonVar_list[0] as String @@ -588,25 +608,39 @@ data class InternalUserInfo ( val refreshToken = pigeonVar_list[9] as String? val creationTimestamp = pigeonVar_list[10] as Long? val lastSignInTimestamp = pigeonVar_list[11] as Long? - return InternalUserInfo(uid, email, displayName, photoUrl, phoneNumber, isAnonymous, isEmailVerified, providerId, tenantId, refreshToken, creationTimestamp, lastSignInTimestamp) + return InternalUserInfo( + uid, + email, + displayName, + photoUrl, + phoneNumber, + isAnonymous, + isEmailVerified, + providerId, + tenantId, + refreshToken, + creationTimestamp, + lastSignInTimestamp) } } + fun toList(): List { return listOf( - uid, - email, - displayName, - photoUrl, - phoneNumber, - isAnonymous, - isEmailVerified, - providerId, - tenantId, - refreshToken, - creationTimestamp, - lastSignInTimestamp, + uid, + email, + displayName, + photoUrl, + phoneNumber, + isAnonymous, + isEmailVerified, + providerId, + tenantId, + refreshToken, + creationTimestamp, + lastSignInTimestamp, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -615,7 +649,21 @@ data class InternalUserInfo ( return true } val other = other as InternalUserInfo - return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.uid, other.uid) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.email, other.email) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.displayName, other.displayName) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.photoUrl, other.photoUrl) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.phoneNumber, other.phoneNumber) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.isAnonymous, other.isAnonymous) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.isEmailVerified, other.isEmailVerified) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.providerId, other.providerId) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.tenantId, other.tenantId) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.refreshToken, other.refreshToken) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.creationTimestamp, other.creationTimestamp) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.lastSignInTimestamp, other.lastSignInTimestamp) + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.uid, other.uid) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.email, other.email) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.displayName, other.displayName) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.photoUrl, other.photoUrl) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.phoneNumber, other.phoneNumber) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.isAnonymous, other.isAnonymous) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.isEmailVerified, other.isEmailVerified) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.providerId, other.providerId) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.tenantId, other.tenantId) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.refreshToken, other.refreshToken) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.creationTimestamp, other.creationTimestamp) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.lastSignInTimestamp, other.lastSignInTimestamp) } override fun hashCode(): Int { @@ -631,17 +679,17 @@ data class InternalUserInfo ( result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.tenantId) result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.refreshToken) result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.creationTimestamp) - result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.lastSignInTimestamp) + result = + 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.lastSignInTimestamp) return result } } /** Generated class from Pigeon that represents data sent in messages. */ -data class InternalUserDetails ( - val userInfo: InternalUserInfo, - val providerData: List?> -) - { +data class InternalUserDetails( + val userInfo: InternalUserInfo, + val providerData: List?> +) { companion object { fun fromList(pigeonVar_list: List): InternalUserDetails { val userInfo = pigeonVar_list[0] as InternalUserInfo @@ -649,12 +697,14 @@ data class InternalUserDetails ( return InternalUserDetails(userInfo, providerData) } } + fun toList(): List { return listOf( - userInfo, - providerData, + userInfo, + providerData, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -663,7 +713,8 @@ data class InternalUserDetails ( return true } val other = other as InternalUserDetails - return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.userInfo, other.userInfo) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.providerData, other.providerData) + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.userInfo, other.userInfo) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.providerData, other.providerData) } override fun hashCode(): Int { @@ -675,12 +726,11 @@ data class InternalUserDetails ( } /** Generated class from Pigeon that represents data sent in messages. */ -data class InternalUserCredential ( - val user: InternalUserDetails? = null, - val additionalUserInfo: InternalAdditionalUserInfo? = null, - val credential: InternalAuthCredential? = null -) - { +data class InternalUserCredential( + val user: InternalUserDetails? = null, + val additionalUserInfo: InternalAdditionalUserInfo? = null, + val credential: InternalAuthCredential? = null +) { companion object { fun fromList(pigeonVar_list: List): InternalUserCredential { val user = pigeonVar_list[0] as InternalUserDetails? @@ -689,13 +739,15 @@ data class InternalUserCredential ( return InternalUserCredential(user, additionalUserInfo, credential) } } + fun toList(): List { return listOf( - user, - additionalUserInfo, - credential, + user, + additionalUserInfo, + credential, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -704,7 +756,10 @@ data class InternalUserCredential ( return true } val other = other as InternalUserCredential - return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.user, other.user) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.additionalUserInfo, other.additionalUserInfo) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.credential, other.credential) + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.user, other.user) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.additionalUserInfo, other.additionalUserInfo) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.credential, other.credential) } override fun hashCode(): Int { @@ -717,13 +772,12 @@ data class InternalUserCredential ( } /** Generated class from Pigeon that represents data sent in messages. */ -data class InternalAuthCredentialInput ( - val providerId: String, - val signInMethod: String, - val token: String? = null, - val accessToken: String? = null -) - { +data class InternalAuthCredentialInput( + val providerId: String, + val signInMethod: String, + val token: String? = null, + val accessToken: String? = null +) { companion object { fun fromList(pigeonVar_list: List): InternalAuthCredentialInput { val providerId = pigeonVar_list[0] as String @@ -733,14 +787,16 @@ data class InternalAuthCredentialInput ( return InternalAuthCredentialInput(providerId, signInMethod, token, accessToken) } } + fun toList(): List { return listOf( - providerId, - signInMethod, - token, - accessToken, + providerId, + signInMethod, + token, + accessToken, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -749,7 +805,10 @@ data class InternalAuthCredentialInput ( return true } val other = other as InternalAuthCredentialInput - return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.providerId, other.providerId) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.signInMethod, other.signInMethod) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.token, other.token) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.accessToken, other.accessToken) + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.providerId, other.providerId) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.signInMethod, other.signInMethod) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.token, other.token) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.accessToken, other.accessToken) } override fun hashCode(): Int { @@ -763,17 +822,16 @@ data class InternalAuthCredentialInput ( } /** Generated class from Pigeon that represents data sent in messages. */ -data class InternalActionCodeSettings ( - val url: String, - val dynamicLinkDomain: String? = null, - val handleCodeInApp: Boolean, - val iOSBundleId: String? = null, - val androidPackageName: String? = null, - val androidInstallApp: Boolean, - val androidMinimumVersion: String? = null, - val linkDomain: String? = null -) - { +data class InternalActionCodeSettings( + val url: String, + val dynamicLinkDomain: String? = null, + val handleCodeInApp: Boolean, + val iOSBundleId: String? = null, + val androidPackageName: String? = null, + val androidInstallApp: Boolean, + val androidMinimumVersion: String? = null, + val linkDomain: String? = null +) { companion object { fun fromList(pigeonVar_list: List): InternalActionCodeSettings { val url = pigeonVar_list[0] as String @@ -784,21 +842,31 @@ data class InternalActionCodeSettings ( val androidInstallApp = pigeonVar_list[5] as Boolean val androidMinimumVersion = pigeonVar_list[6] as String? val linkDomain = pigeonVar_list[7] as String? - return InternalActionCodeSettings(url, dynamicLinkDomain, handleCodeInApp, iOSBundleId, androidPackageName, androidInstallApp, androidMinimumVersion, linkDomain) + return InternalActionCodeSettings( + url, + dynamicLinkDomain, + handleCodeInApp, + iOSBundleId, + androidPackageName, + androidInstallApp, + androidMinimumVersion, + linkDomain) } } + fun toList(): List { return listOf( - url, - dynamicLinkDomain, - handleCodeInApp, - iOSBundleId, - androidPackageName, - androidInstallApp, - androidMinimumVersion, - linkDomain, + url, + dynamicLinkDomain, + handleCodeInApp, + iOSBundleId, + androidPackageName, + androidInstallApp, + androidMinimumVersion, + linkDomain, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -807,7 +875,19 @@ data class InternalActionCodeSettings ( return true } val other = other as InternalActionCodeSettings - return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.url, other.url) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.dynamicLinkDomain, other.dynamicLinkDomain) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.handleCodeInApp, other.handleCodeInApp) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.iOSBundleId, other.iOSBundleId) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.androidPackageName, other.androidPackageName) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.androidInstallApp, other.androidInstallApp) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.androidMinimumVersion, other.androidMinimumVersion) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.linkDomain, other.linkDomain) + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.url, other.url) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.dynamicLinkDomain, other.dynamicLinkDomain) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.handleCodeInApp, other.handleCodeInApp) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.iOSBundleId, other.iOSBundleId) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.androidPackageName, other.androidPackageName) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.androidInstallApp, other.androidInstallApp) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.androidMinimumVersion, other.androidMinimumVersion) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.linkDomain, other.linkDomain) } override fun hashCode(): Int { @@ -818,21 +898,21 @@ data class InternalActionCodeSettings ( result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.iOSBundleId) result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.androidPackageName) result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.androidInstallApp) - result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.androidMinimumVersion) + result = + 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.androidMinimumVersion) result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.linkDomain) return result } } /** Generated class from Pigeon that represents data sent in messages. */ -data class InternalFirebaseAuthSettings ( - val appVerificationDisabledForTesting: Boolean, - val userAccessGroup: String? = null, - val phoneNumber: String? = null, - val smsCode: String? = null, - val forceRecaptchaFlow: Boolean? = null -) - { +data class InternalFirebaseAuthSettings( + val appVerificationDisabledForTesting: Boolean, + val userAccessGroup: String? = null, + val phoneNumber: String? = null, + val smsCode: String? = null, + val forceRecaptchaFlow: Boolean? = null +) { companion object { fun fromList(pigeonVar_list: List): InternalFirebaseAuthSettings { val appVerificationDisabledForTesting = pigeonVar_list[0] as Boolean @@ -840,18 +920,25 @@ data class InternalFirebaseAuthSettings ( val phoneNumber = pigeonVar_list[2] as String? val smsCode = pigeonVar_list[3] as String? val forceRecaptchaFlow = pigeonVar_list[4] as Boolean? - return InternalFirebaseAuthSettings(appVerificationDisabledForTesting, userAccessGroup, phoneNumber, smsCode, forceRecaptchaFlow) + return InternalFirebaseAuthSettings( + appVerificationDisabledForTesting, + userAccessGroup, + phoneNumber, + smsCode, + forceRecaptchaFlow) } } + fun toList(): List { return listOf( - appVerificationDisabledForTesting, - userAccessGroup, - phoneNumber, - smsCode, - forceRecaptchaFlow, + appVerificationDisabledForTesting, + userAccessGroup, + phoneNumber, + smsCode, + forceRecaptchaFlow, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -860,12 +947,21 @@ data class InternalFirebaseAuthSettings ( return true } val other = other as InternalFirebaseAuthSettings - return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.appVerificationDisabledForTesting, other.appVerificationDisabledForTesting) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.userAccessGroup, other.userAccessGroup) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.phoneNumber, other.phoneNumber) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.smsCode, other.smsCode) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.forceRecaptchaFlow, other.forceRecaptchaFlow) + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.appVerificationDisabledForTesting, other.appVerificationDisabledForTesting) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.userAccessGroup, other.userAccessGroup) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.phoneNumber, other.phoneNumber) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.smsCode, other.smsCode) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.forceRecaptchaFlow, other.forceRecaptchaFlow) } override fun hashCode(): Int { var result = javaClass.hashCode() - result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.appVerificationDisabledForTesting) + result = + 31 * result + + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.appVerificationDisabledForTesting) result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.userAccessGroup) result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.phoneNumber) result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.smsCode) @@ -875,12 +971,11 @@ data class InternalFirebaseAuthSettings ( } /** Generated class from Pigeon that represents data sent in messages. */ -data class InternalSignInProvider ( - val providerId: String, - val scopes: List? = null, - val customParameters: Map? = null -) - { +data class InternalSignInProvider( + val providerId: String, + val scopes: List? = null, + val customParameters: Map? = null +) { companion object { fun fromList(pigeonVar_list: List): InternalSignInProvider { val providerId = pigeonVar_list[0] as String @@ -889,13 +984,15 @@ data class InternalSignInProvider ( return InternalSignInProvider(providerId, scopes, customParameters) } } + fun toList(): List { return listOf( - providerId, - scopes, - customParameters, + providerId, + scopes, + customParameters, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -904,7 +1001,10 @@ data class InternalSignInProvider ( return true } val other = other as InternalSignInProvider - return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.providerId, other.providerId) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.scopes, other.scopes) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.customParameters, other.customParameters) + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.providerId, other.providerId) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.scopes, other.scopes) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.customParameters, other.customParameters) } override fun hashCode(): Int { @@ -917,15 +1017,14 @@ data class InternalSignInProvider ( } /** Generated class from Pigeon that represents data sent in messages. */ -data class InternalVerifyPhoneNumberRequest ( - val phoneNumber: String? = null, - val timeout: Long, - val forceResendingToken: Long? = null, - val autoRetrievedSmsCodeForTesting: String? = null, - val multiFactorInfoId: String? = null, - val multiFactorSessionId: String? = null -) - { +data class InternalVerifyPhoneNumberRequest( + val phoneNumber: String? = null, + val timeout: Long, + val forceResendingToken: Long? = null, + val autoRetrievedSmsCodeForTesting: String? = null, + val multiFactorInfoId: String? = null, + val multiFactorSessionId: String? = null +) { companion object { fun fromList(pigeonVar_list: List): InternalVerifyPhoneNumberRequest { val phoneNumber = pigeonVar_list[0] as String? @@ -934,19 +1033,27 @@ data class InternalVerifyPhoneNumberRequest ( val autoRetrievedSmsCodeForTesting = pigeonVar_list[3] as String? val multiFactorInfoId = pigeonVar_list[4] as String? val multiFactorSessionId = pigeonVar_list[5] as String? - return InternalVerifyPhoneNumberRequest(phoneNumber, timeout, forceResendingToken, autoRetrievedSmsCodeForTesting, multiFactorInfoId, multiFactorSessionId) + return InternalVerifyPhoneNumberRequest( + phoneNumber, + timeout, + forceResendingToken, + autoRetrievedSmsCodeForTesting, + multiFactorInfoId, + multiFactorSessionId) } } + fun toList(): List { return listOf( - phoneNumber, - timeout, - forceResendingToken, - autoRetrievedSmsCodeForTesting, - multiFactorInfoId, - multiFactorSessionId, + phoneNumber, + timeout, + forceResendingToken, + autoRetrievedSmsCodeForTesting, + multiFactorInfoId, + multiFactorSessionId, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -955,32 +1062,45 @@ data class InternalVerifyPhoneNumberRequest ( return true } val other = other as InternalVerifyPhoneNumberRequest - return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.phoneNumber, other.phoneNumber) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.timeout, other.timeout) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.forceResendingToken, other.forceResendingToken) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.autoRetrievedSmsCodeForTesting, other.autoRetrievedSmsCodeForTesting) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.multiFactorInfoId, other.multiFactorInfoId) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.multiFactorSessionId, other.multiFactorSessionId) + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.phoneNumber, other.phoneNumber) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.timeout, other.timeout) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.forceResendingToken, other.forceResendingToken) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.autoRetrievedSmsCodeForTesting, other.autoRetrievedSmsCodeForTesting) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.multiFactorInfoId, other.multiFactorInfoId) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.multiFactorSessionId, other.multiFactorSessionId) } override fun hashCode(): Int { var result = javaClass.hashCode() result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.phoneNumber) result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.timeout) - result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.forceResendingToken) - result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.autoRetrievedSmsCodeForTesting) + result = + 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.forceResendingToken) + result = + 31 * result + + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.autoRetrievedSmsCodeForTesting) result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.multiFactorInfoId) - result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.multiFactorSessionId) + result = + 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.multiFactorSessionId) return result } } /** Generated class from Pigeon that represents data sent in messages. */ -data class InternalIdTokenResult ( - val token: String? = null, - val expirationTimestamp: Long? = null, - val authTimestamp: Long? = null, - val issuedAtTimestamp: Long? = null, - val signInProvider: String? = null, - val claims: Map? = null, - val signInSecondFactor: String? = null -) - { +data class InternalIdTokenResult( + val token: String? = null, + val expirationTimestamp: Long? = null, + val authTimestamp: Long? = null, + val issuedAtTimestamp: Long? = null, + val signInProvider: String? = null, + val claims: Map? = null, + val signInSecondFactor: String? = null +) { companion object { fun fromList(pigeonVar_list: List): InternalIdTokenResult { val token = pigeonVar_list[0] as String? @@ -990,20 +1110,29 @@ data class InternalIdTokenResult ( val signInProvider = pigeonVar_list[4] as String? val claims = pigeonVar_list[5] as Map? val signInSecondFactor = pigeonVar_list[6] as String? - return InternalIdTokenResult(token, expirationTimestamp, authTimestamp, issuedAtTimestamp, signInProvider, claims, signInSecondFactor) + return InternalIdTokenResult( + token, + expirationTimestamp, + authTimestamp, + issuedAtTimestamp, + signInProvider, + claims, + signInSecondFactor) } } + fun toList(): List { return listOf( - token, - expirationTimestamp, - authTimestamp, - issuedAtTimestamp, - signInProvider, - claims, - signInSecondFactor, + token, + expirationTimestamp, + authTimestamp, + issuedAtTimestamp, + signInProvider, + claims, + signInSecondFactor, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -1012,13 +1141,25 @@ data class InternalIdTokenResult ( return true } val other = other as InternalIdTokenResult - return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.token, other.token) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.expirationTimestamp, other.expirationTimestamp) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.authTimestamp, other.authTimestamp) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.issuedAtTimestamp, other.issuedAtTimestamp) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.signInProvider, other.signInProvider) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.claims, other.claims) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.signInSecondFactor, other.signInSecondFactor) + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.token, other.token) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.expirationTimestamp, other.expirationTimestamp) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.authTimestamp, other.authTimestamp) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.issuedAtTimestamp, other.issuedAtTimestamp) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.signInProvider, other.signInProvider) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.claims, other.claims) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.signInSecondFactor, other.signInSecondFactor) } override fun hashCode(): Int { var result = javaClass.hashCode() result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.token) - result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.expirationTimestamp) + result = + 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.expirationTimestamp) result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.authTimestamp) result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.issuedAtTimestamp) result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.signInProvider) @@ -1029,13 +1170,12 @@ data class InternalIdTokenResult ( } /** Generated class from Pigeon that represents data sent in messages. */ -data class InternalUserProfile ( - val displayName: String? = null, - val photoUrl: String? = null, - val displayNameChanged: Boolean, - val photoUrlChanged: Boolean -) - { +data class InternalUserProfile( + val displayName: String? = null, + val photoUrl: String? = null, + val displayNameChanged: Boolean, + val photoUrlChanged: Boolean +) { companion object { fun fromList(pigeonVar_list: List): InternalUserProfile { val displayName = pigeonVar_list[0] as String? @@ -1045,14 +1185,16 @@ data class InternalUserProfile ( return InternalUserProfile(displayName, photoUrl, displayNameChanged, photoUrlChanged) } } + fun toList(): List { return listOf( - displayName, - photoUrl, - displayNameChanged, - photoUrlChanged, + displayName, + photoUrl, + displayNameChanged, + photoUrlChanged, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -1061,7 +1203,13 @@ data class InternalUserProfile ( return true } val other = other as InternalUserProfile - return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.displayName, other.displayName) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.photoUrl, other.photoUrl) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.displayNameChanged, other.displayNameChanged) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.photoUrlChanged, other.photoUrlChanged) + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.displayName, other.displayName) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.photoUrl, other.photoUrl) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.displayNameChanged, other.displayNameChanged) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.photoUrlChanged, other.photoUrlChanged) } override fun hashCode(): Int { @@ -1075,14 +1223,13 @@ data class InternalUserProfile ( } /** Generated class from Pigeon that represents data sent in messages. */ -data class InternalTotpSecret ( - val codeIntervalSeconds: Long? = null, - val codeLength: Long? = null, - val enrollmentCompletionDeadline: Long? = null, - val hashingAlgorithm: String? = null, - val secretKey: String -) - { +data class InternalTotpSecret( + val codeIntervalSeconds: Long? = null, + val codeLength: Long? = null, + val enrollmentCompletionDeadline: Long? = null, + val hashingAlgorithm: String? = null, + val secretKey: String +) { companion object { fun fromList(pigeonVar_list: List): InternalTotpSecret { val codeIntervalSeconds = pigeonVar_list[0] as Long? @@ -1090,18 +1237,25 @@ data class InternalTotpSecret ( val enrollmentCompletionDeadline = pigeonVar_list[2] as Long? val hashingAlgorithm = pigeonVar_list[3] as String? val secretKey = pigeonVar_list[4] as String - return InternalTotpSecret(codeIntervalSeconds, codeLength, enrollmentCompletionDeadline, hashingAlgorithm, secretKey) + return InternalTotpSecret( + codeIntervalSeconds, + codeLength, + enrollmentCompletionDeadline, + hashingAlgorithm, + secretKey) } } + fun toList(): List { return listOf( - codeIntervalSeconds, - codeLength, - enrollmentCompletionDeadline, - hashingAlgorithm, - secretKey, + codeIntervalSeconds, + codeLength, + enrollmentCompletionDeadline, + hashingAlgorithm, + secretKey, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -1110,31 +1264,38 @@ data class InternalTotpSecret ( return true } val other = other as InternalTotpSecret - return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.codeIntervalSeconds, other.codeIntervalSeconds) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.codeLength, other.codeLength) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.enrollmentCompletionDeadline, other.enrollmentCompletionDeadline) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.hashingAlgorithm, other.hashingAlgorithm) && GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.secretKey, other.secretKey) + return GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.codeIntervalSeconds, other.codeIntervalSeconds) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.codeLength, other.codeLength) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.enrollmentCompletionDeadline, other.enrollmentCompletionDeadline) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals( + this.hashingAlgorithm, other.hashingAlgorithm) && + GeneratedAndroidFirebaseAuthPigeonUtils.deepEquals(this.secretKey, other.secretKey) } override fun hashCode(): Int { var result = javaClass.hashCode() - result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.codeIntervalSeconds) + result = + 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.codeIntervalSeconds) result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.codeLength) - result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.enrollmentCompletionDeadline) + result = + 31 * result + + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.enrollmentCompletionDeadline) result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.hashingAlgorithm) result = 31 * result + GeneratedAndroidFirebaseAuthPigeonUtils.deepHash(this.secretKey) return result } } + private open class GeneratedAndroidFirebaseAuthPigeonCodec : StandardMessageCodec() { override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { return when (type) { 129.toByte() -> { - return (readValue(buffer) as Long?)?.let { - ActionCodeInfoOperation.ofRaw(it.toInt()) - } + return (readValue(buffer) as Long?)?.let { ActionCodeInfoOperation.ofRaw(it.toInt()) } } 130.toByte() -> { - return (readValue(buffer) as? List)?.let { - InternalMultiFactorSession.fromList(it) - } + return (readValue(buffer) as? List)?.let { InternalMultiFactorSession.fromList(it) } } 131.toByte() -> { return (readValue(buffer) as? List)?.let { @@ -1142,69 +1303,43 @@ private open class GeneratedAndroidFirebaseAuthPigeonCodec : StandardMessageCode } } 132.toByte() -> { - return (readValue(buffer) as? List)?.let { - InternalMultiFactorInfo.fromList(it) - } + return (readValue(buffer) as? List)?.let { InternalMultiFactorInfo.fromList(it) } } 133.toByte() -> { - return (readValue(buffer) as? List)?.let { - AuthPigeonFirebaseApp.fromList(it) - } + return (readValue(buffer) as? List)?.let { AuthPigeonFirebaseApp.fromList(it) } } 134.toByte() -> { - return (readValue(buffer) as? List)?.let { - InternalActionCodeInfoData.fromList(it) - } + return (readValue(buffer) as? List)?.let { InternalActionCodeInfoData.fromList(it) } } 135.toByte() -> { - return (readValue(buffer) as? List)?.let { - InternalActionCodeInfo.fromList(it) - } + return (readValue(buffer) as? List)?.let { InternalActionCodeInfo.fromList(it) } } 136.toByte() -> { - return (readValue(buffer) as? List)?.let { - InternalAdditionalUserInfo.fromList(it) - } + return (readValue(buffer) as? List)?.let { InternalAdditionalUserInfo.fromList(it) } } 137.toByte() -> { - return (readValue(buffer) as? List)?.let { - InternalAuthCredential.fromList(it) - } + return (readValue(buffer) as? List)?.let { InternalAuthCredential.fromList(it) } } 138.toByte() -> { - return (readValue(buffer) as? List)?.let { - InternalUserInfo.fromList(it) - } + return (readValue(buffer) as? List)?.let { InternalUserInfo.fromList(it) } } 139.toByte() -> { - return (readValue(buffer) as? List)?.let { - InternalUserDetails.fromList(it) - } + return (readValue(buffer) as? List)?.let { InternalUserDetails.fromList(it) } } 140.toByte() -> { - return (readValue(buffer) as? List)?.let { - InternalUserCredential.fromList(it) - } + return (readValue(buffer) as? List)?.let { InternalUserCredential.fromList(it) } } 141.toByte() -> { - return (readValue(buffer) as? List)?.let { - InternalAuthCredentialInput.fromList(it) - } + return (readValue(buffer) as? List)?.let { InternalAuthCredentialInput.fromList(it) } } 142.toByte() -> { - return (readValue(buffer) as? List)?.let { - InternalActionCodeSettings.fromList(it) - } + return (readValue(buffer) as? List)?.let { InternalActionCodeSettings.fromList(it) } } 143.toByte() -> { - return (readValue(buffer) as? List)?.let { - InternalFirebaseAuthSettings.fromList(it) - } + return (readValue(buffer) as? List)?.let { InternalFirebaseAuthSettings.fromList(it) } } 144.toByte() -> { - return (readValue(buffer) as? List)?.let { - InternalSignInProvider.fromList(it) - } + return (readValue(buffer) as? List)?.let { InternalSignInProvider.fromList(it) } } 145.toByte() -> { return (readValue(buffer) as? List)?.let { @@ -1212,24 +1347,19 @@ private open class GeneratedAndroidFirebaseAuthPigeonCodec : StandardMessageCode } } 146.toByte() -> { - return (readValue(buffer) as? List)?.let { - InternalIdTokenResult.fromList(it) - } + return (readValue(buffer) as? List)?.let { InternalIdTokenResult.fromList(it) } } 147.toByte() -> { - return (readValue(buffer) as? List)?.let { - InternalUserProfile.fromList(it) - } + return (readValue(buffer) as? List)?.let { InternalUserProfile.fromList(it) } } 148.toByte() -> { - return (readValue(buffer) as? List)?.let { - InternalTotpSecret.fromList(it) - } + return (readValue(buffer) as? List)?.let { InternalTotpSecret.fromList(it) } } else -> super.readValueOfType(type, buffer) } } - override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { + + override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { when (value) { is ActionCodeInfoOperation -> { stream.write(129) @@ -1316,45 +1446,159 @@ private open class GeneratedAndroidFirebaseAuthPigeonCodec : StandardMessageCode } } - /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ interface FirebaseAuthHostApi { fun registerIdTokenListener(app: AuthPigeonFirebaseApp, callback: (Result) -> Unit) + fun registerAuthStateListener(app: AuthPigeonFirebaseApp, callback: (Result) -> Unit) - fun useEmulator(app: AuthPigeonFirebaseApp, host: String, port: Long, callback: (Result) -> Unit) + + fun useEmulator( + app: AuthPigeonFirebaseApp, + host: String, + port: Long, + callback: (Result) -> Unit + ) + fun applyActionCode(app: AuthPigeonFirebaseApp, code: String, callback: (Result) -> Unit) - fun checkActionCode(app: AuthPigeonFirebaseApp, code: String, callback: (Result) -> Unit) - fun confirmPasswordReset(app: AuthPigeonFirebaseApp, code: String, newPassword: String, callback: (Result) -> Unit) - fun createUserWithEmailAndPassword(app: AuthPigeonFirebaseApp, email: String, password: String, callback: (Result) -> Unit) - fun signInAnonymously(app: AuthPigeonFirebaseApp, callback: (Result) -> Unit) - fun signInWithCredential(app: AuthPigeonFirebaseApp, input: Map, callback: (Result) -> Unit) - fun signInWithCustomToken(app: AuthPigeonFirebaseApp, token: String, callback: (Result) -> Unit) - fun signInWithEmailAndPassword(app: AuthPigeonFirebaseApp, email: String, password: String, callback: (Result) -> Unit) - fun signInWithEmailLink(app: AuthPigeonFirebaseApp, email: String, emailLink: String, callback: (Result) -> Unit) - fun signInWithProvider(app: AuthPigeonFirebaseApp, signInProvider: InternalSignInProvider, callback: (Result) -> Unit) + + fun checkActionCode( + app: AuthPigeonFirebaseApp, + code: String, + callback: (Result) -> Unit + ) + + fun confirmPasswordReset( + app: AuthPigeonFirebaseApp, + code: String, + newPassword: String, + callback: (Result) -> Unit + ) + + fun createUserWithEmailAndPassword( + app: AuthPigeonFirebaseApp, + email: String, + password: String, + callback: (Result) -> Unit + ) + + fun signInAnonymously( + app: AuthPigeonFirebaseApp, + callback: (Result) -> Unit + ) + + fun signInWithCredential( + app: AuthPigeonFirebaseApp, + input: Map, + callback: (Result) -> Unit + ) + + fun signInWithCustomToken( + app: AuthPigeonFirebaseApp, + token: String, + callback: (Result) -> Unit + ) + + fun signInWithEmailAndPassword( + app: AuthPigeonFirebaseApp, + email: String, + password: String, + callback: (Result) -> Unit + ) + + fun signInWithEmailLink( + app: AuthPigeonFirebaseApp, + email: String, + emailLink: String, + callback: (Result) -> Unit + ) + + fun signInWithProvider( + app: AuthPigeonFirebaseApp, + signInProvider: InternalSignInProvider, + callback: (Result) -> Unit + ) + fun signOut(app: AuthPigeonFirebaseApp, callback: (Result) -> Unit) - fun fetchSignInMethodsForEmail(app: AuthPigeonFirebaseApp, email: String, callback: (Result>) -> Unit) - fun sendPasswordResetEmail(app: AuthPigeonFirebaseApp, email: String, actionCodeSettings: InternalActionCodeSettings?, callback: (Result) -> Unit) - fun sendSignInLinkToEmail(app: AuthPigeonFirebaseApp, email: String, actionCodeSettings: InternalActionCodeSettings, callback: (Result) -> Unit) - fun setLanguageCode(app: AuthPigeonFirebaseApp, languageCode: String?, callback: (Result) -> Unit) - fun setSettings(app: AuthPigeonFirebaseApp, settings: InternalFirebaseAuthSettings, callback: (Result) -> Unit) - fun verifyPasswordResetCode(app: AuthPigeonFirebaseApp, code: String, callback: (Result) -> Unit) - fun verifyPhoneNumber(app: AuthPigeonFirebaseApp, request: InternalVerifyPhoneNumberRequest, callback: (Result) -> Unit) - fun revokeTokenWithAuthorizationCode(app: AuthPigeonFirebaseApp, authorizationCode: String, callback: (Result) -> Unit) - fun revokeAccessToken(app: AuthPigeonFirebaseApp, accessToken: String, callback: (Result) -> Unit) + + fun fetchSignInMethodsForEmail( + app: AuthPigeonFirebaseApp, + email: String, + callback: (Result>) -> Unit + ) + + fun sendPasswordResetEmail( + app: AuthPigeonFirebaseApp, + email: String, + actionCodeSettings: InternalActionCodeSettings?, + callback: (Result) -> Unit + ) + + fun sendSignInLinkToEmail( + app: AuthPigeonFirebaseApp, + email: String, + actionCodeSettings: InternalActionCodeSettings, + callback: (Result) -> Unit + ) + + fun setLanguageCode( + app: AuthPigeonFirebaseApp, + languageCode: String?, + callback: (Result) -> Unit + ) + + fun setSettings( + app: AuthPigeonFirebaseApp, + settings: InternalFirebaseAuthSettings, + callback: (Result) -> Unit + ) + + fun verifyPasswordResetCode( + app: AuthPigeonFirebaseApp, + code: String, + callback: (Result) -> Unit + ) + + fun verifyPhoneNumber( + app: AuthPigeonFirebaseApp, + request: InternalVerifyPhoneNumberRequest, + callback: (Result) -> Unit + ) + + fun revokeTokenWithAuthorizationCode( + app: AuthPigeonFirebaseApp, + authorizationCode: String, + callback: (Result) -> Unit + ) + + fun revokeAccessToken( + app: AuthPigeonFirebaseApp, + accessToken: String, + callback: (Result) -> Unit + ) + fun initializeRecaptchaConfig(app: AuthPigeonFirebaseApp, callback: (Result) -> Unit) companion object { /** The codec used by FirebaseAuthHostApi. */ - val codec: MessageCodec by lazy { - GeneratedAndroidFirebaseAuthPigeonCodec() - } - /** Sets up an instance of `FirebaseAuthHostApi` to handle messages through the `binaryMessenger`. */ + val codec: MessageCodec by lazy { GeneratedAndroidFirebaseAuthPigeonCodec() } + /** + * Sets up an instance of `FirebaseAuthHostApi` to handle messages through the + * `binaryMessenger`. + */ @JvmOverloads - fun setUp(binaryMessenger: BinaryMessenger, api: FirebaseAuthHostApi?, messageChannelSuffix: String = "") { - val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + fun setUp( + binaryMessenger: BinaryMessenger, + api: FirebaseAuthHostApi?, + messageChannelSuffix: String = "" + ) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.registerIdTokenListener$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.registerIdTokenListener$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1374,7 +1618,11 @@ interface FirebaseAuthHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.registerAuthStateListener$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.registerAuthStateListener$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1394,7 +1642,11 @@ interface FirebaseAuthHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.useEmulator$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.useEmulator$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1415,7 +1667,11 @@ interface FirebaseAuthHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.applyActionCode$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.applyActionCode$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1435,7 +1691,11 @@ interface FirebaseAuthHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.checkActionCode$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.checkActionCode$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1456,7 +1716,11 @@ interface FirebaseAuthHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.confirmPasswordReset$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.confirmPasswordReset$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1477,14 +1741,19 @@ interface FirebaseAuthHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.createUserWithEmailAndPassword$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.createUserWithEmailAndPassword$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val appArg = args[0] as AuthPigeonFirebaseApp val emailArg = args[1] as String val passwordArg = args[2] as String - api.createUserWithEmailAndPassword(appArg, emailArg, passwordArg) { result: Result -> + api.createUserWithEmailAndPassword(appArg, emailArg, passwordArg) { + result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) @@ -1499,7 +1768,11 @@ interface FirebaseAuthHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInAnonymously$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInAnonymously$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1519,7 +1792,11 @@ interface FirebaseAuthHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithCredential$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithCredential$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1540,7 +1817,11 @@ interface FirebaseAuthHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithCustomToken$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithCustomToken$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1561,14 +1842,19 @@ interface FirebaseAuthHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithEmailAndPassword$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithEmailAndPassword$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val appArg = args[0] as AuthPigeonFirebaseApp val emailArg = args[1] as String val passwordArg = args[2] as String - api.signInWithEmailAndPassword(appArg, emailArg, passwordArg) { result: Result -> + api.signInWithEmailAndPassword(appArg, emailArg, passwordArg) { + result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) @@ -1583,14 +1869,19 @@ interface FirebaseAuthHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithEmailLink$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithEmailLink$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val appArg = args[0] as AuthPigeonFirebaseApp val emailArg = args[1] as String val emailLinkArg = args[2] as String - api.signInWithEmailLink(appArg, emailArg, emailLinkArg) { result: Result -> + api.signInWithEmailLink(appArg, emailArg, emailLinkArg) { + result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) @@ -1605,13 +1896,18 @@ interface FirebaseAuthHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithProvider$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithProvider$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val appArg = args[0] as AuthPigeonFirebaseApp val signInProviderArg = args[1] as InternalSignInProvider - api.signInWithProvider(appArg, signInProviderArg) { result: Result -> + api.signInWithProvider(appArg, signInProviderArg) { + result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) @@ -1626,7 +1922,11 @@ interface FirebaseAuthHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signOut$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signOut$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1645,7 +1945,11 @@ interface FirebaseAuthHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.fetchSignInMethodsForEmail$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.fetchSignInMethodsForEmail$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1666,14 +1970,19 @@ interface FirebaseAuthHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.sendPasswordResetEmail$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.sendPasswordResetEmail$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val appArg = args[0] as AuthPigeonFirebaseApp val emailArg = args[1] as String val actionCodeSettingsArg = args[2] as InternalActionCodeSettings? - api.sendPasswordResetEmail(appArg, emailArg, actionCodeSettingsArg) { result: Result -> + api.sendPasswordResetEmail(appArg, emailArg, actionCodeSettingsArg) { + result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) @@ -1687,14 +1996,19 @@ interface FirebaseAuthHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.sendSignInLinkToEmail$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.sendSignInLinkToEmail$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val appArg = args[0] as AuthPigeonFirebaseApp val emailArg = args[1] as String val actionCodeSettingsArg = args[2] as InternalActionCodeSettings - api.sendSignInLinkToEmail(appArg, emailArg, actionCodeSettingsArg) { result: Result -> + api.sendSignInLinkToEmail(appArg, emailArg, actionCodeSettingsArg) { + result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) @@ -1708,7 +2022,11 @@ interface FirebaseAuthHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.setLanguageCode$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.setLanguageCode$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1729,7 +2047,11 @@ interface FirebaseAuthHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.setSettings$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.setSettings$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1749,7 +2071,11 @@ interface FirebaseAuthHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.verifyPasswordResetCode$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.verifyPasswordResetCode$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1770,7 +2096,11 @@ interface FirebaseAuthHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.verifyPhoneNumber$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.verifyPhoneNumber$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1791,13 +2121,18 @@ interface FirebaseAuthHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.revokeTokenWithAuthorizationCode$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.revokeTokenWithAuthorizationCode$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val appArg = args[0] as AuthPigeonFirebaseApp val authorizationCodeArg = args[1] as String - api.revokeTokenWithAuthorizationCode(appArg, authorizationCodeArg) { result: Result -> + api.revokeTokenWithAuthorizationCode(appArg, authorizationCodeArg) { + result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) @@ -1811,7 +2146,11 @@ interface FirebaseAuthHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.revokeAccessToken$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.revokeAccessToken$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1831,7 +2170,11 @@ interface FirebaseAuthHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.initializeRecaptchaConfig$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.initializeRecaptchaConfig$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1855,31 +2198,103 @@ interface FirebaseAuthHostApi { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ interface FirebaseAuthUserHostApi { fun delete(app: AuthPigeonFirebaseApp, callback: (Result) -> Unit) - fun getIdToken(app: AuthPigeonFirebaseApp, forceRefresh: Boolean, callback: (Result) -> Unit) - fun linkWithCredential(app: AuthPigeonFirebaseApp, input: Map, callback: (Result) -> Unit) - fun linkWithProvider(app: AuthPigeonFirebaseApp, signInProvider: InternalSignInProvider, callback: (Result) -> Unit) - fun reauthenticateWithCredential(app: AuthPigeonFirebaseApp, input: Map, callback: (Result) -> Unit) - fun reauthenticateWithProvider(app: AuthPigeonFirebaseApp, signInProvider: InternalSignInProvider, callback: (Result) -> Unit) + + fun getIdToken( + app: AuthPigeonFirebaseApp, + forceRefresh: Boolean, + callback: (Result) -> Unit + ) + + fun linkWithCredential( + app: AuthPigeonFirebaseApp, + input: Map, + callback: (Result) -> Unit + ) + + fun linkWithProvider( + app: AuthPigeonFirebaseApp, + signInProvider: InternalSignInProvider, + callback: (Result) -> Unit + ) + + fun reauthenticateWithCredential( + app: AuthPigeonFirebaseApp, + input: Map, + callback: (Result) -> Unit + ) + + fun reauthenticateWithProvider( + app: AuthPigeonFirebaseApp, + signInProvider: InternalSignInProvider, + callback: (Result) -> Unit + ) + fun reload(app: AuthPigeonFirebaseApp, callback: (Result) -> Unit) - fun sendEmailVerification(app: AuthPigeonFirebaseApp, actionCodeSettings: InternalActionCodeSettings?, callback: (Result) -> Unit) - fun unlink(app: AuthPigeonFirebaseApp, providerId: String, callback: (Result) -> Unit) - fun updateEmail(app: AuthPigeonFirebaseApp, newEmail: String, callback: (Result) -> Unit) - fun updatePassword(app: AuthPigeonFirebaseApp, newPassword: String, callback: (Result) -> Unit) - fun updatePhoneNumber(app: AuthPigeonFirebaseApp, input: Map, callback: (Result) -> Unit) - fun updateProfile(app: AuthPigeonFirebaseApp, profile: InternalUserProfile, callback: (Result) -> Unit) - fun verifyBeforeUpdateEmail(app: AuthPigeonFirebaseApp, newEmail: String, actionCodeSettings: InternalActionCodeSettings?, callback: (Result) -> Unit) + + fun sendEmailVerification( + app: AuthPigeonFirebaseApp, + actionCodeSettings: InternalActionCodeSettings?, + callback: (Result) -> Unit + ) + + fun unlink( + app: AuthPigeonFirebaseApp, + providerId: String, + callback: (Result) -> Unit + ) + + fun updateEmail( + app: AuthPigeonFirebaseApp, + newEmail: String, + callback: (Result) -> Unit + ) + + fun updatePassword( + app: AuthPigeonFirebaseApp, + newPassword: String, + callback: (Result) -> Unit + ) + + fun updatePhoneNumber( + app: AuthPigeonFirebaseApp, + input: Map, + callback: (Result) -> Unit + ) + + fun updateProfile( + app: AuthPigeonFirebaseApp, + profile: InternalUserProfile, + callback: (Result) -> Unit + ) + + fun verifyBeforeUpdateEmail( + app: AuthPigeonFirebaseApp, + newEmail: String, + actionCodeSettings: InternalActionCodeSettings?, + callback: (Result) -> Unit + ) companion object { /** The codec used by FirebaseAuthUserHostApi. */ - val codec: MessageCodec by lazy { - GeneratedAndroidFirebaseAuthPigeonCodec() - } - /** Sets up an instance of `FirebaseAuthUserHostApi` to handle messages through the `binaryMessenger`. */ + val codec: MessageCodec by lazy { GeneratedAndroidFirebaseAuthPigeonCodec() } + /** + * Sets up an instance of `FirebaseAuthUserHostApi` to handle messages through the + * `binaryMessenger`. + */ @JvmOverloads - fun setUp(binaryMessenger: BinaryMessenger, api: FirebaseAuthUserHostApi?, messageChannelSuffix: String = "") { - val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + fun setUp( + binaryMessenger: BinaryMessenger, + api: FirebaseAuthUserHostApi?, + messageChannelSuffix: String = "" + ) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.delete$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.delete$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1898,7 +2313,11 @@ interface FirebaseAuthUserHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.getIdToken$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.getIdToken$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1919,7 +2338,11 @@ interface FirebaseAuthUserHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.linkWithCredential$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.linkWithCredential$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1940,13 +2363,18 @@ interface FirebaseAuthUserHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.linkWithProvider$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.linkWithProvider$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val appArg = args[0] as AuthPigeonFirebaseApp val signInProviderArg = args[1] as InternalSignInProvider - api.linkWithProvider(appArg, signInProviderArg) { result: Result -> + api.linkWithProvider(appArg, signInProviderArg) { result: Result + -> val error = result.exceptionOrNull() if (error != null) { reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) @@ -1961,13 +2389,18 @@ interface FirebaseAuthUserHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.reauthenticateWithCredential$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.reauthenticateWithCredential$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val appArg = args[0] as AuthPigeonFirebaseApp val inputArg = args[1] as Map - api.reauthenticateWithCredential(appArg, inputArg) { result: Result -> + api.reauthenticateWithCredential(appArg, inputArg) { + result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) @@ -1982,13 +2415,18 @@ interface FirebaseAuthUserHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.reauthenticateWithProvider$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.reauthenticateWithProvider$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val appArg = args[0] as AuthPigeonFirebaseApp val signInProviderArg = args[1] as InternalSignInProvider - api.reauthenticateWithProvider(appArg, signInProviderArg) { result: Result -> + api.reauthenticateWithProvider(appArg, signInProviderArg) { + result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) @@ -2003,7 +2441,11 @@ interface FirebaseAuthUserHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.reload$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.reload$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -2023,7 +2465,11 @@ interface FirebaseAuthUserHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.sendEmailVerification$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.sendEmailVerification$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -2043,7 +2489,11 @@ interface FirebaseAuthUserHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.unlink$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.unlink$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -2064,7 +2514,11 @@ interface FirebaseAuthUserHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updateEmail$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updateEmail$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -2085,7 +2539,11 @@ interface FirebaseAuthUserHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updatePassword$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updatePassword$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -2106,7 +2564,11 @@ interface FirebaseAuthUserHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updatePhoneNumber$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updatePhoneNumber$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -2127,7 +2589,11 @@ interface FirebaseAuthUserHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updateProfile$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.updateProfile$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -2148,14 +2614,19 @@ interface FirebaseAuthUserHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.verifyBeforeUpdateEmail$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthUserHostApi.verifyBeforeUpdateEmail$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val appArg = args[0] as AuthPigeonFirebaseApp val newEmailArg = args[1] as String val actionCodeSettingsArg = args[2] as InternalActionCodeSettings? - api.verifyBeforeUpdateEmail(appArg, newEmailArg, actionCodeSettingsArg) { result: Result -> + api.verifyBeforeUpdateEmail(appArg, newEmailArg, actionCodeSettingsArg) { + result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) @@ -2173,23 +2644,50 @@ interface FirebaseAuthUserHostApi { } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ interface MultiFactorUserHostApi { - fun enrollPhone(app: AuthPigeonFirebaseApp, assertion: InternalPhoneMultiFactorAssertion, displayName: String?, callback: (Result) -> Unit) - fun enrollTotp(app: AuthPigeonFirebaseApp, assertionId: String, displayName: String?, callback: (Result) -> Unit) + fun enrollPhone( + app: AuthPigeonFirebaseApp, + assertion: InternalPhoneMultiFactorAssertion, + displayName: String?, + callback: (Result) -> Unit + ) + + fun enrollTotp( + app: AuthPigeonFirebaseApp, + assertionId: String, + displayName: String?, + callback: (Result) -> Unit + ) + fun getSession(app: AuthPigeonFirebaseApp, callback: (Result) -> Unit) + fun unenroll(app: AuthPigeonFirebaseApp, factorUid: String, callback: (Result) -> Unit) - fun getEnrolledFactors(app: AuthPigeonFirebaseApp, callback: (Result>) -> Unit) + + fun getEnrolledFactors( + app: AuthPigeonFirebaseApp, + callback: (Result>) -> Unit + ) companion object { /** The codec used by MultiFactorUserHostApi. */ - val codec: MessageCodec by lazy { - GeneratedAndroidFirebaseAuthPigeonCodec() - } - /** Sets up an instance of `MultiFactorUserHostApi` to handle messages through the `binaryMessenger`. */ + val codec: MessageCodec by lazy { GeneratedAndroidFirebaseAuthPigeonCodec() } + /** + * Sets up an instance of `MultiFactorUserHostApi` to handle messages through the + * `binaryMessenger`. + */ @JvmOverloads - fun setUp(binaryMessenger: BinaryMessenger, api: MultiFactorUserHostApi?, messageChannelSuffix: String = "") { - val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + fun setUp( + binaryMessenger: BinaryMessenger, + api: MultiFactorUserHostApi?, + messageChannelSuffix: String = "" + ) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.enrollPhone$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.enrollPhone$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -2210,7 +2708,11 @@ interface MultiFactorUserHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.enrollTotp$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.enrollTotp$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -2231,7 +2733,11 @@ interface MultiFactorUserHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.getSession$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.getSession$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -2251,7 +2757,11 @@ interface MultiFactorUserHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.unenroll$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.unenroll$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -2271,7 +2781,11 @@ interface MultiFactorUserHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.getEnrolledFactors$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorUserHostApi.getEnrolledFactors$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -2295,26 +2809,42 @@ interface MultiFactorUserHostApi { } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ interface MultiFactoResolverHostApi { - fun resolveSignIn(resolverId: String, assertion: InternalPhoneMultiFactorAssertion?, totpAssertionId: String?, callback: (Result) -> Unit) + fun resolveSignIn( + resolverId: String, + assertion: InternalPhoneMultiFactorAssertion?, + totpAssertionId: String?, + callback: (Result) -> Unit + ) companion object { /** The codec used by MultiFactoResolverHostApi. */ - val codec: MessageCodec by lazy { - GeneratedAndroidFirebaseAuthPigeonCodec() - } - /** Sets up an instance of `MultiFactoResolverHostApi` to handle messages through the `binaryMessenger`. */ + val codec: MessageCodec by lazy { GeneratedAndroidFirebaseAuthPigeonCodec() } + /** + * Sets up an instance of `MultiFactoResolverHostApi` to handle messages through the + * `binaryMessenger`. + */ @JvmOverloads - fun setUp(binaryMessenger: BinaryMessenger, api: MultiFactoResolverHostApi?, messageChannelSuffix: String = "") { - val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + fun setUp( + binaryMessenger: BinaryMessenger, + api: MultiFactoResolverHostApi?, + messageChannelSuffix: String = "" + ) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactoResolverHostApi.resolveSignIn$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactoResolverHostApi.resolveSignIn$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val resolverIdArg = args[0] as String val assertionArg = args[1] as InternalPhoneMultiFactorAssertion? val totpAssertionIdArg = args[2] as String? - api.resolveSignIn(resolverIdArg, assertionArg, totpAssertionIdArg) { result: Result -> + api.resolveSignIn(resolverIdArg, assertionArg, totpAssertionIdArg) { + result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) @@ -2334,20 +2864,40 @@ interface MultiFactoResolverHostApi { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ interface MultiFactorTotpHostApi { fun generateSecret(sessionId: String, callback: (Result) -> Unit) - fun getAssertionForEnrollment(secretKey: String, oneTimePassword: String, callback: (Result) -> Unit) - fun getAssertionForSignIn(enrollmentId: String, oneTimePassword: String, callback: (Result) -> Unit) + + fun getAssertionForEnrollment( + secretKey: String, + oneTimePassword: String, + callback: (Result) -> Unit + ) + + fun getAssertionForSignIn( + enrollmentId: String, + oneTimePassword: String, + callback: (Result) -> Unit + ) companion object { /** The codec used by MultiFactorTotpHostApi. */ - val codec: MessageCodec by lazy { - GeneratedAndroidFirebaseAuthPigeonCodec() - } - /** Sets up an instance of `MultiFactorTotpHostApi` to handle messages through the `binaryMessenger`. */ + val codec: MessageCodec by lazy { GeneratedAndroidFirebaseAuthPigeonCodec() } + /** + * Sets up an instance of `MultiFactorTotpHostApi` to handle messages through the + * `binaryMessenger`. + */ @JvmOverloads - fun setUp(binaryMessenger: BinaryMessenger, api: MultiFactorTotpHostApi?, messageChannelSuffix: String = "") { - val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + fun setUp( + binaryMessenger: BinaryMessenger, + api: MultiFactorTotpHostApi?, + messageChannelSuffix: String = "" + ) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpHostApi.generateSecret$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpHostApi.generateSecret$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -2367,13 +2917,18 @@ interface MultiFactorTotpHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpHostApi.getAssertionForEnrollment$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpHostApi.getAssertionForEnrollment$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val secretKeyArg = args[0] as String val oneTimePasswordArg = args[1] as String - api.getAssertionForEnrollment(secretKeyArg, oneTimePasswordArg) { result: Result -> + api.getAssertionForEnrollment(secretKeyArg, oneTimePasswordArg) { result: Result + -> val error = result.exceptionOrNull() if (error != null) { reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) @@ -2388,13 +2943,18 @@ interface MultiFactorTotpHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpHostApi.getAssertionForSignIn$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpHostApi.getAssertionForSignIn$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val enrollmentIdArg = args[0] as String val oneTimePasswordArg = args[1] as String - api.getAssertionForSignIn(enrollmentIdArg, oneTimePasswordArg) { result: Result -> + api.getAssertionForSignIn(enrollmentIdArg, oneTimePasswordArg) { result: Result + -> val error = result.exceptionOrNull() if (error != null) { reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) @@ -2413,27 +2973,44 @@ interface MultiFactorTotpHostApi { } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ interface MultiFactorTotpSecretHostApi { - fun generateQrCodeUrl(secretKey: String, accountName: String?, issuer: String?, callback: (Result) -> Unit) + fun generateQrCodeUrl( + secretKey: String, + accountName: String?, + issuer: String?, + callback: (Result) -> Unit + ) + fun openInOtpApp(secretKey: String, qrCodeUrl: String, callback: (Result) -> Unit) companion object { /** The codec used by MultiFactorTotpSecretHostApi. */ - val codec: MessageCodec by lazy { - GeneratedAndroidFirebaseAuthPigeonCodec() - } - /** Sets up an instance of `MultiFactorTotpSecretHostApi` to handle messages through the `binaryMessenger`. */ + val codec: MessageCodec by lazy { GeneratedAndroidFirebaseAuthPigeonCodec() } + /** + * Sets up an instance of `MultiFactorTotpSecretHostApi` to handle messages through the + * `binaryMessenger`. + */ @JvmOverloads - fun setUp(binaryMessenger: BinaryMessenger, api: MultiFactorTotpSecretHostApi?, messageChannelSuffix: String = "") { - val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + fun setUp( + binaryMessenger: BinaryMessenger, + api: MultiFactorTotpSecretHostApi?, + messageChannelSuffix: String = "" + ) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpSecretHostApi.generateQrCodeUrl$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpSecretHostApi.generateQrCodeUrl$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val secretKeyArg = args[0] as String val accountNameArg = args[1] as String? val issuerArg = args[2] as String? - api.generateQrCodeUrl(secretKeyArg, accountNameArg, issuerArg) { result: Result -> + api.generateQrCodeUrl(secretKeyArg, accountNameArg, issuerArg) { result: Result + -> val error = result.exceptionOrNull() if (error != null) { reply.reply(GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(error)) @@ -2448,7 +3025,11 @@ interface MultiFactorTotpSecretHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpSecretHostApi.openInOtpApp$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.MultiFactorTotpSecretHostApi.openInOtpApp$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -2480,25 +3061,35 @@ interface GenerateInterfaces { companion object { /** The codec used by GenerateInterfaces. */ - val codec: MessageCodec by lazy { - GeneratedAndroidFirebaseAuthPigeonCodec() - } - /** Sets up an instance of `GenerateInterfaces` to handle messages through the `binaryMessenger`. */ + val codec: MessageCodec by lazy { GeneratedAndroidFirebaseAuthPigeonCodec() } + /** + * Sets up an instance of `GenerateInterfaces` to handle messages through the `binaryMessenger`. + */ @JvmOverloads - fun setUp(binaryMessenger: BinaryMessenger, api: GenerateInterfaces?, messageChannelSuffix: String = "") { - val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + fun setUp( + binaryMessenger: BinaryMessenger, + api: GenerateInterfaces?, + messageChannelSuffix: String = "" + ) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_auth_platform_interface.GenerateInterfaces.pigeonInterface$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_auth_platform_interface.GenerateInterfaces.pigeonInterface$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val infoArg = args[0] as InternalMultiFactorInfo - val wrapped: List = try { - api.pigeonInterface(infoArg) - listOf(null) - } catch (exception: Throwable) { - GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.pigeonInterface(infoArg) + listOf(null) + } catch (exception: Throwable) { + GeneratedAndroidFirebaseAuthPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { diff --git a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/IdTokenChannelStreamHandler.kt b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/IdTokenChannelStreamHandler.kt index fba6e9b37ab0..4ffddb487417 100644 --- a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/IdTokenChannelStreamHandler.kt +++ b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/IdTokenChannelStreamHandler.kt @@ -30,7 +30,8 @@ class IdTokenChannelStreamHandler(private val firebaseAuth: FirebaseAuth) : Stre if (user == null) { event[Constants.USER] = null } else { - event[Constants.USER] = PigeonParser.manuallyToList(PigeonParser.parseFirebaseUser(user)!!) + event[Constants.USER] = + PigeonParser.manuallyToList(PigeonParser.parseFirebaseUser(user)!!) } events.success(event) diff --git a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/PhoneNumberVerificationStreamHandler.kt b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/PhoneNumberVerificationStreamHandler.kt index b427695f9183..c459ef53174e 100644 --- a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/PhoneNumberVerificationStreamHandler.kt +++ b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/PhoneNumberVerificationStreamHandler.kt @@ -37,8 +37,7 @@ class PhoneNumberVerificationStreamHandler( private val phoneNumber: String? = request.phoneNumber private val timeout: Int = Math.toIntExact(request.timeout) private var autoRetrievedSmsCodeForTesting: String? = request.autoRetrievedSmsCodeForTesting - private var forceResendingToken: Int? = - request.forceResendingToken?.let { Math.toIntExact(it) } + private var forceResendingToken: Int? = request.forceResendingToken?.let { Math.toIntExact(it) } private var eventSink: EventSink? = null @@ -103,9 +102,8 @@ class PhoneNumberVerificationStreamHandler( } if (autoRetrievedSmsCodeForTesting != null) { - firebaseAuth - .firebaseAuthSettings - .setAutoRetrievedSmsCodeForPhoneNumber(phoneNumber, autoRetrievedSmsCodeForTesting) + firebaseAuth.firebaseAuthSettings.setAutoRetrievedSmsCodeForPhoneNumber( + phoneNumber, autoRetrievedSmsCodeForTesting) } val phoneAuthOptionsBuilder = PhoneAuthOptions.Builder(firebaseAuth) diff --git a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/PigeonParser.kt b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/PigeonParser.kt index 7bc15a4cc22e..dde91bbece22 100644 --- a/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/PigeonParser.kt +++ b/packages/firebase_auth/firebase_auth/android/src/main/kotlin/io/flutter/plugins/firebase/auth/PigeonParser.kt @@ -40,7 +40,9 @@ object PigeonParser { user = parseFirebaseUser(authResult.user)) } - private fun parseAdditionalUserInfo(additionalUserInfo: AdditionalUserInfo?): InternalAdditionalUserInfo? { + private fun parseAdditionalUserInfo( + additionalUserInfo: AdditionalUserInfo? + ): InternalAdditionalUserInfo? { if (additionalUserInfo == null) { return null } @@ -86,7 +88,8 @@ object PigeonParser { uid = firebaseUser.uid, tenantId = firebaseUser.tenantId) - return InternalUserDetails(userInfo = userInfo, providerData = parseUserInfoList(firebaseUser.providerData)) + return InternalUserDetails( + userInfo = userInfo, providerData = parseUserInfoList(firebaseUser.providerData)) } private fun parseUserInfoList(userInfoList: List?): List?> { @@ -146,7 +149,8 @@ object PigeonParser { EmailAuthProvider.getCredential(credentialMap[Constants.EMAIL] as String, secret!!) Constants.SIGN_IN_METHOD_EMAIL_LINK -> EmailAuthProvider.getCredentialWithLink( - credentialMap[Constants.EMAIL] as String, credentialMap[Constants.EMAIL_LINK] as String) + credentialMap[Constants.EMAIL] as String, + credentialMap[Constants.EMAIL_LINK] as String) Constants.SIGN_IN_METHOD_FACEBOOK -> FacebookAuthProvider.getCredential(accessToken!!) Constants.SIGN_IN_METHOD_GOOGLE -> GoogleAuthProvider.getCredential(idToken, accessToken) Constants.SIGN_IN_METHOD_TWITTER -> TwitterAuthProvider.getCredential(accessToken!!, secret!!) @@ -177,7 +181,9 @@ object PigeonParser { } } - fun getActionCodeSettings(pigeonActionCodeSettings: InternalActionCodeSettings): ActionCodeSettings { + fun getActionCodeSettings( + pigeonActionCodeSettings: InternalActionCodeSettings + ): ActionCodeSettings { val builder = ActionCodeSettings.newBuilder() builder.setUrl(pigeonActionCodeSettings.url)