From 02888004257640ad4398b88e2b021a9a7d8a39dd Mon Sep 17 00:00:00 2001 From: Cynthia J Date: Tue, 28 Jul 2026 13:26:36 -0700 Subject: [PATCH 01/12] bump Firebase iOS SDK to 12.17.0 --- .../firebase_core/firebase_core/ios/firebase_sdk_version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/firebase_core/firebase_core/ios/firebase_sdk_version.rb b/packages/firebase_core/firebase_core/ios/firebase_sdk_version.rb index 54a5edf23c0c..0b539d2a55b2 100644 --- a/packages/firebase_core/firebase_core/ios/firebase_sdk_version.rb +++ b/packages/firebase_core/firebase_core/ios/firebase_sdk_version.rb @@ -1,4 +1,4 @@ # https://firebase.google.com/support/release-notes/ios def firebase_sdk_version!() - '12.16.0' + '12.17.0' end From b9244bbde4dc5a0d7ded0b1eb70fb3ae5cd2bf6f Mon Sep 17 00:00:00 2001 From: Cynthia J Date: Thu, 30 Jul 2026 16:51:31 -0700 Subject: [PATCH 02/12] bump Firebase android SDK to 34.17.0 --- packages/firebase_core/firebase_core/android/gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/firebase_core/firebase_core/android/gradle.properties b/packages/firebase_core/firebase_core/android/gradle.properties index c6704eebca86..4e6e3530b9d3 100644 --- a/packages/firebase_core/firebase_core/android/gradle.properties +++ b/packages/firebase_core/firebase_core/android/gradle.properties @@ -1,2 +1,2 @@ # https://firebase.google.com/support/release-notes/android -FirebaseSDKVersion=34.16.0 +FirebaseSDKVersion=34.17.0 From 45ada10b99db53f86235838071fe4808ed54b747 Mon Sep 17 00:00:00 2001 From: Cynthia J Date: Thu, 30 Jul 2026 16:53:11 -0700 Subject: [PATCH 03/12] bump Firebase web SDK to 12.17.0 --- .../firebase_core_web/lib/src/firebase_sdk_version.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/firebase_core/firebase_core_web/lib/src/firebase_sdk_version.dart b/packages/firebase_core/firebase_core_web/lib/src/firebase_sdk_version.dart index 39d68a2f5359..12bca2b684ca 100644 --- a/packages/firebase_core/firebase_core_web/lib/src/firebase_sdk_version.dart +++ b/packages/firebase_core/firebase_core_web/lib/src/firebase_sdk_version.dart @@ -6,4 +6,4 @@ part of '../firebase_core_web.dart'; /// The currently supported Firebase JS SDK version. -const String supportedFirebaseJsSdkVersion = '12.16.0'; +const String supportedFirebaseJsSdkVersion = '12.17.0'; From f3344f38d85eb606cad58441cfa82f91746b90a2 Mon Sep 17 00:00:00 2001 From: Cynthia J Date: Thu, 30 Jul 2026 21:03:48 -0700 Subject: [PATCH 04/12] update the api to add sitekey for rCE --- .../appcheck/FirebaseAppCheckPlugin.kt | 8 +- .../GeneratedAndroidFirebaseAppCheck.g.kt | 144 ++--- .../FirebaseAppCheckMessages.g.swift | 139 ++--- .../FirebaseAppCheckPlugin.swift | 25 +- .../lib/firebase_app_check.dart | 1 - .../firebase_app_check/windows/messages.g.cpp | 554 ++++++++---------- .../firebase_app_check/windows/messages.g.h | 95 +-- .../lib/src/android_providers.dart | 8 +- .../lib/src/apple_providers.dart | 8 +- .../method_channel_firebase_app_check.dart | 25 + .../lib/src/pigeon/messages.pigeon.dart | 124 ++-- .../lib/src/web_providers.dart | 5 - .../pigeons/messages.dart | 1 + ...ethod_channel_firebase_app_check_test.dart | 6 +- .../lib/firebase_app_check_web.dart | 5 - .../lib/src/interop/app_check.dart | 2 +- .../test/firebase_app_check_web_test.dart | 13 - .../core/FlutterFirebaseCorePlugin.java | 3 - 18 files changed, 490 insertions(+), 676 deletions(-) diff --git a/packages/firebase_app_check/firebase_app_check/android/src/main/kotlin/io/flutter/plugins/firebase/appcheck/FirebaseAppCheckPlugin.kt b/packages/firebase_app_check/firebase_app_check/android/src/main/kotlin/io/flutter/plugins/firebase/appcheck/FirebaseAppCheckPlugin.kt index f390a7d472f3..3e13ad2c0f8a 100644 --- a/packages/firebase_app_check/firebase_app_check/android/src/main/kotlin/io/flutter/plugins/firebase/appcheck/FirebaseAppCheckPlugin.kt +++ b/packages/firebase_app_check/firebase_app_check/android/src/main/kotlin/io/flutter/plugins/firebase/appcheck/FirebaseAppCheckPlugin.kt @@ -53,6 +53,7 @@ class FirebaseAppCheckPlugin : FlutterFirebasePlugin, FlutterPlugin, FirebaseApp androidProvider: String?, appleProvider: String?, debugToken: String?, + recaptchaSiteKey: String?, callback: (Result) -> Unit ) { try { @@ -64,8 +65,11 @@ class FirebaseAppCheckPlugin : FlutterFirebasePlugin, FlutterPlugin, FirebaseApp DebugAppCheckProviderFactory.getInstance()) } "recaptcha" -> { - firebaseAppCheck.installAppCheckProviderFactory( - RecaptchaAppCheckProviderFactory.getInstance()) + if (recaptchaSiteKey == null) { + throw Exception("reCAPTCHA site key must not be null") + } + val factory = RecaptchaAppCheckProviderFactory.getInstance(recaptchaSiteKey) + firebaseAppCheck.installAppCheckProviderFactory(factory) } else -> { firebaseAppCheck.installAppCheckProviderFactory( diff --git a/packages/firebase_app_check/firebase_app_check/android/src/main/kotlin/io/flutter/plugins/firebase/appcheck/GeneratedAndroidFirebaseAppCheck.g.kt b/packages/firebase_app_check/firebase_app_check/android/src/main/kotlin/io/flutter/plugins/firebase/appcheck/GeneratedAndroidFirebaseAppCheck.g.kt index f1162a5cafa7..e9447c796ff4 100644 --- a/packages/firebase_app_check/firebase_app_check/android/src/main/kotlin/io/flutter/plugins/firebase/appcheck/GeneratedAndroidFirebaseAppCheck.g.kt +++ b/packages/firebase_app_check/firebase_app_check/android/src/main/kotlin/io/flutter/plugins/firebase/appcheck/GeneratedAndroidFirebaseAppCheck.g.kt @@ -10,11 +10,12 @@ package io.flutter.plugins.firebase.appcheck 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 GeneratedAndroidFirebaseAppCheckPigeonUtils { fun wrapResult(result: Any?): List { @@ -23,15 +24,19 @@ private object GeneratedAndroidFirebaseAppCheckPigeonUtils { 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()) @@ -175,23 +180,27 @@ private object GeneratedAndroidFirebaseAppCheckPigeonUtils { 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() /** Generated class from Pigeon that represents data sent in messages. */ -data class InternalAppCheckTokenResult(val token: String, val expirationTimestamp: Long? = null) { +data class InternalAppCheckTokenResult ( + val token: String, + val expirationTimestamp: Long? = null +) + { companion object { fun fromList(pigeonVar_list: List): InternalAppCheckTokenResult { val token = pigeonVar_list[0] as String @@ -199,14 +208,12 @@ data class InternalAppCheckTokenResult(val token: String, val expirationTimestam return InternalAppCheckTokenResult(token, expirationTimestamp) } } - fun toList(): List { return listOf( - token, - expirationTimestamp, + token, + expirationTimestamp, ) } - override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -215,31 +222,28 @@ data class InternalAppCheckTokenResult(val token: String, val expirationTimestam return true } val other = other as InternalAppCheckTokenResult - return GeneratedAndroidFirebaseAppCheckPigeonUtils.deepEquals(this.token, other.token) && - GeneratedAndroidFirebaseAppCheckPigeonUtils.deepEquals( - this.expirationTimestamp, other.expirationTimestamp) + return GeneratedAndroidFirebaseAppCheckPigeonUtils.deepEquals(this.token, other.token) && GeneratedAndroidFirebaseAppCheckPigeonUtils.deepEquals(this.expirationTimestamp, other.expirationTimestamp) } override fun hashCode(): Int { var result = javaClass.hashCode() result = 31 * result + GeneratedAndroidFirebaseAppCheckPigeonUtils.deepHash(this.token) - result = - 31 * result + GeneratedAndroidFirebaseAppCheckPigeonUtils.deepHash(this.expirationTimestamp) + result = 31 * result + GeneratedAndroidFirebaseAppCheckPigeonUtils.deepHash(this.expirationTimestamp) return result } } - private open class GeneratedAndroidFirebaseAppCheckPigeonCodec : StandardMessageCodec() { override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { return when (type) { 129.toByte() -> { - return (readValue(buffer) as? List)?.let { InternalAppCheckTokenResult.fromList(it) } + return (readValue(buffer) as? List)?.let { + InternalAppCheckTokenResult.fromList(it) + } } else -> super.readValueOfType(type, buffer) } } - - override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { + override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { when (value) { is InternalAppCheckTokenResult -> { stream.write(129) @@ -250,55 +254,27 @@ private open class GeneratedAndroidFirebaseAppCheckPigeonCodec : StandardMessage } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ interface FirebaseAppCheckHostApi { - fun activate( - appName: String, - androidProvider: String?, - appleProvider: String?, - debugToken: String?, - callback: (Result) -> Unit - ) - + fun activate(appName: String, androidProvider: String?, appleProvider: String?, debugToken: String?, recaptchaSiteKey: String?, callback: (Result) -> Unit) fun getToken(appName: String, forceRefresh: Boolean, callback: (Result) -> Unit) - - fun getTokenResult( - appName: String, - forceRefresh: Boolean, - callback: (Result) -> Unit - ) - - fun setTokenAutoRefreshEnabled( - appName: String, - isTokenAutoRefreshEnabled: Boolean, - callback: (Result) -> Unit - ) - + fun getTokenResult(appName: String, forceRefresh: Boolean, callback: (Result) -> Unit) + fun setTokenAutoRefreshEnabled(appName: String, isTokenAutoRefreshEnabled: Boolean, callback: (Result) -> Unit) fun registerTokenListener(appName: String, callback: (Result) -> Unit) - fun getLimitedUseAppCheckToken(appName: String, callback: (Result) -> Unit) companion object { /** The codec used by FirebaseAppCheckHostApi. */ - val codec: MessageCodec by lazy { GeneratedAndroidFirebaseAppCheckPigeonCodec() } - /** - * Sets up an instance of `FirebaseAppCheckHostApi` to handle messages through the - * `binaryMessenger`. - */ + val codec: MessageCodec by lazy { + GeneratedAndroidFirebaseAppCheckPigeonCodec() + } + /** Sets up an instance of `FirebaseAppCheckHostApi` to handle messages through the `binaryMessenger`. */ @JvmOverloads - fun setUp( - binaryMessenger: BinaryMessenger, - api: FirebaseAppCheckHostApi?, - messageChannelSuffix: String = "" - ) { - val separatedMessageChannelSuffix = - if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + fun setUp(binaryMessenger: BinaryMessenger, api: FirebaseAppCheckHostApi?, messageChannelSuffix: String = "") { + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.activate$separatedMessageChannelSuffix", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.activate$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -306,8 +282,8 @@ interface FirebaseAppCheckHostApi { val androidProviderArg = args[1] as String? val appleProviderArg = args[2] as String? val debugTokenArg = args[3] as String? - api.activate(appNameArg, androidProviderArg, appleProviderArg, debugTokenArg) { - result: Result -> + val recaptchaSiteKeyArg = args[4] as String? + api.activate(appNameArg, androidProviderArg, appleProviderArg, debugTokenArg, recaptchaSiteKeyArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(GeneratedAndroidFirebaseAppCheckPigeonUtils.wrapError(error)) @@ -321,11 +297,7 @@ interface FirebaseAppCheckHostApi { } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getToken$separatedMessageChannelSuffix", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getToken$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -346,18 +318,13 @@ interface FirebaseAppCheckHostApi { } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getTokenResult$separatedMessageChannelSuffix", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getTokenResult$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val appNameArg = args[0] as String val forceRefreshArg = args[1] as Boolean - api.getTokenResult(appNameArg, forceRefreshArg) { - result: Result -> + api.getTokenResult(appNameArg, forceRefreshArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(GeneratedAndroidFirebaseAppCheckPigeonUtils.wrapError(error)) @@ -372,18 +339,13 @@ interface FirebaseAppCheckHostApi { } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.setTokenAutoRefreshEnabled$separatedMessageChannelSuffix", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.setTokenAutoRefreshEnabled$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val appNameArg = args[0] as String val isTokenAutoRefreshEnabledArg = args[1] as Boolean - api.setTokenAutoRefreshEnabled(appNameArg, isTokenAutoRefreshEnabledArg) { - result: Result -> + api.setTokenAutoRefreshEnabled(appNameArg, isTokenAutoRefreshEnabledArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(GeneratedAndroidFirebaseAppCheckPigeonUtils.wrapError(error)) @@ -397,11 +359,7 @@ interface FirebaseAppCheckHostApi { } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.registerTokenListener$separatedMessageChannelSuffix", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.registerTokenListener$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -421,11 +379,7 @@ interface FirebaseAppCheckHostApi { } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getLimitedUseAppCheckToken$separatedMessageChannelSuffix", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getLimitedUseAppCheckToken$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List diff --git a/packages/firebase_app_check/firebase_app_check/ios/firebase_app_check/Sources/firebase_app_check/FirebaseAppCheckMessages.g.swift b/packages/firebase_app_check/firebase_app_check/ios/firebase_app_check/Sources/firebase_app_check/FirebaseAppCheckMessages.g.swift index e3b063889660..cb2c26134f15 100644 --- a/packages/firebase_app_check/firebase_app_check/ios/firebase_app_check/Sources/firebase_app_check/FirebaseAppCheckMessages.g.swift +++ b/packages/firebase_app_check/firebase_app_check/ios/firebase_app_check/Sources/firebase_app_check/FirebaseAppCheckMessages.g.swift @@ -27,12 +27,13 @@ final class PigeonError: Error { } var localizedDescription: String { - "PigeonError(code: \(code), message: \(message ?? ""), details: \(details ?? "")" + return + "PigeonError(code: \(code), message: \(message ?? ""), details: \(details ?? "")" } } private func wrapResult(_ result: Any?) -> [Any?] { - [result] + return [result] } private func wrapError(_ error: Any) -> [Any?] { @@ -58,7 +59,7 @@ private func wrapError(_ error: Any) -> [Any?] { } private func isNullish(_ value: Any?) -> Bool { - value is NSNull || value == nil + return value is NSNull || value == nil } private func nilOrValue(_ value: Any?) -> T? { @@ -67,12 +68,12 @@ private func nilOrValue(_ value: Any?) -> T? { } private func doubleEqualsFirebaseAppCheckMessages(_ lhs: Double, _ rhs: Double) -> Bool { - (lhs.isNaN && rhs.isNaN) || lhs == rhs + return (lhs.isNaN && rhs.isNaN) || lhs == rhs } private func doubleHashFirebaseAppCheckMessages(_ value: Double, _ hasher: inout Hasher) { if value.isNaN { - hasher.combine(0x7FF8_0000_0000_0000) + hasher.combine(0x7FF8000000000000) } else { // Normalize -0.0 to 0.0 hasher.combine(value == 0 ? 0 : value) @@ -144,7 +145,7 @@ func deepEqualsFirebaseAppCheckMessages(_ lhs: Any?, _ rhs: Any?) -> Bool { func deepHashFirebaseAppCheckMessages(value: Any?, hasher: inout Hasher) { let cleanValue = nilOrValue(value) as Any? - if let cleanValue { + if let cleanValue = cleanValue { if let doubleValue = cleanValue as? Double { doubleHashFirebaseAppCheckMessages(doubleValue, &hasher) } else if let valueList = cleanValue as? [Any?] { @@ -175,10 +176,12 @@ func deepHashFirebaseAppCheckMessages(value: Any?, hasher: inout Hasher) { } } + /// Generated class from Pigeon that represents data sent in messages. struct InternalAppCheckTokenResult: Hashable { var token: String - var expirationTimestamp: Int64? + var expirationTimestamp: Int64? = nil + // swift-format-ignore: AlwaysUseLowerCamelCase static func fromList(_ pigeonVar_list: [Any?]) -> InternalAppCheckTokenResult? { @@ -190,23 +193,17 @@ struct InternalAppCheckTokenResult: Hashable { expirationTimestamp: expirationTimestamp ) } - func toList() -> [Any?] { - [ + return [ token, expirationTimestamp, ] } - static func == (lhs: InternalAppCheckTokenResult, rhs: InternalAppCheckTokenResult) -> Bool { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsFirebaseAppCheckMessages(lhs.token, rhs.token) - && deepEqualsFirebaseAppCheckMessages( - lhs.expirationTimestamp, - rhs.expirationTimestamp - ) + return deepEqualsFirebaseAppCheckMessages(lhs.token, rhs.token) && deepEqualsFirebaseAppCheckMessages(lhs.expirationTimestamp, rhs.expirationTimestamp) } func hash(into hasher: inout Hasher) { @@ -220,7 +217,7 @@ private class FirebaseAppCheckMessagesPigeonCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { case 129: - return InternalAppCheckTokenResult.fromList(readValue() as! [Any?]) + return InternalAppCheckTokenResult.fromList(self.readValue() as! [Any?]) default: return super.readValue(ofType: type) } @@ -240,73 +237,45 @@ private class FirebaseAppCheckMessagesPigeonCodecWriter: FlutterStandardWriter { private class FirebaseAppCheckMessagesPigeonCodecReaderWriter: FlutterStandardReaderWriter { override func reader(with data: Data) -> FlutterStandardReader { - FirebaseAppCheckMessagesPigeonCodecReader(data: data) + return FirebaseAppCheckMessagesPigeonCodecReader(data: data) } override func writer(with data: NSMutableData) -> FlutterStandardWriter { - FirebaseAppCheckMessagesPigeonCodecWriter(data: data) + return FirebaseAppCheckMessagesPigeonCodecWriter(data: data) } } class FirebaseAppCheckMessagesPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { - static let shared = - FirebaseAppCheckMessagesPigeonCodec( - readerWriter: FirebaseAppCheckMessagesPigeonCodecReaderWriter() - ) + static let shared = FirebaseAppCheckMessagesPigeonCodec(readerWriter: FirebaseAppCheckMessagesPigeonCodecReaderWriter()) } + /// Generated protocol from Pigeon that represents a handler of messages from Flutter. protocol FirebaseAppCheckHostApi { - func activate( - appName: String, androidProvider: String?, appleProvider: String?, - debugToken: String?, completion: @escaping (Result) -> Void) - func getToken( - appName: String, forceRefresh: Bool, - completion: @escaping (Result) -> Void) - func getTokenResult( - appName: String, forceRefresh: Bool, - completion: @escaping (Result) -> Void) - func setTokenAutoRefreshEnabled( - appName: String, isTokenAutoRefreshEnabled: Bool, - completion: @escaping (Result) -> Void) + func activate(appName: String, androidProvider: String?, appleProvider: String?, debugToken: String?, recaptchaSiteKey: String?, completion: @escaping (Result) -> Void) + func getToken(appName: String, forceRefresh: Bool, completion: @escaping (Result) -> Void) + func getTokenResult(appName: String, forceRefresh: Bool, completion: @escaping (Result) -> Void) + func setTokenAutoRefreshEnabled(appName: String, isTokenAutoRefreshEnabled: Bool, completion: @escaping (Result) -> Void) func registerTokenListener(appName: String, completion: @escaping (Result) -> Void) - func getLimitedUseAppCheckToken( - appName: String, - completion: @escaping (Result) -> Void) + func getLimitedUseAppCheckToken(appName: String, completion: @escaping (Result) -> Void) } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class FirebaseAppCheckHostApiSetup { - static var codec: FlutterStandardMessageCodec { - FirebaseAppCheckMessagesPigeonCodec.shared - } - - /// Sets up an instance of `FirebaseAppCheckHostApi` to handle messages through the - /// `binaryMessenger`. - static func setUp( - binaryMessenger: FlutterBinaryMessenger, api: FirebaseAppCheckHostApi?, - messageChannelSuffix: String = "" - ) { + static var codec: FlutterStandardMessageCodec { FirebaseAppCheckMessagesPigeonCodec.shared } + /// Sets up an instance of `FirebaseAppCheckHostApi` to handle messages through the `binaryMessenger`. + static func setUp(binaryMessenger: FlutterBinaryMessenger, api: FirebaseAppCheckHostApi?, messageChannelSuffix: String = "") { let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" - let activateChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.activate\(channelSuffix)", - binaryMessenger: binaryMessenger, - codec: codec - ) - if let api { + let activateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.activate\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { activateChannel.setMessageHandler { message, reply in let args = message as! [Any?] let appNameArg = args[0] as! String let androidProviderArg: String? = nilOrValue(args[1]) let appleProviderArg: String? = nilOrValue(args[2]) let debugTokenArg: String? = nilOrValue(args[3]) - api.activate( - appName: appNameArg, - androidProvider: androidProviderArg, - appleProvider: appleProviderArg, - debugToken: debugTokenArg - ) { result in + let recaptchaSiteKeyArg: String? = nilOrValue(args[4]) + api.activate(appName: appNameArg, androidProvider: androidProviderArg, appleProvider: appleProviderArg, debugToken: debugTokenArg, recaptchaSiteKey: recaptchaSiteKeyArg) { result in switch result { case .success: reply(wrapResult(nil)) @@ -318,13 +287,8 @@ class FirebaseAppCheckHostApiSetup { } else { activateChannel.setMessageHandler(nil) } - let getTokenChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getToken\(channelSuffix)", - binaryMessenger: binaryMessenger, - codec: codec - ) - if let api { + let getTokenChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getToken\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { getTokenChannel.setMessageHandler { message, reply in let args = message as! [Any?] let appNameArg = args[0] as! String @@ -341,13 +305,8 @@ class FirebaseAppCheckHostApiSetup { } else { getTokenChannel.setMessageHandler(nil) } - let getTokenResultChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getTokenResult\(channelSuffix)", - binaryMessenger: binaryMessenger, - codec: codec - ) - if let api { + let getTokenResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getTokenResult\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { getTokenResultChannel.setMessageHandler { message, reply in let args = message as! [Any?] let appNameArg = args[0] as! String @@ -364,21 +323,13 @@ class FirebaseAppCheckHostApiSetup { } else { getTokenResultChannel.setMessageHandler(nil) } - let setTokenAutoRefreshEnabledChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.setTokenAutoRefreshEnabled\(channelSuffix)", - binaryMessenger: binaryMessenger, - codec: codec - ) - if let api { + let setTokenAutoRefreshEnabledChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.setTokenAutoRefreshEnabled\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { setTokenAutoRefreshEnabledChannel.setMessageHandler { message, reply in let args = message as! [Any?] let appNameArg = args[0] as! String let isTokenAutoRefreshEnabledArg = args[1] as! Bool - api.setTokenAutoRefreshEnabled( - appName: appNameArg, - isTokenAutoRefreshEnabled: isTokenAutoRefreshEnabledArg - ) { result in + api.setTokenAutoRefreshEnabled(appName: appNameArg, isTokenAutoRefreshEnabled: isTokenAutoRefreshEnabledArg) { result in switch result { case .success: reply(wrapResult(nil)) @@ -390,13 +341,8 @@ class FirebaseAppCheckHostApiSetup { } else { setTokenAutoRefreshEnabledChannel.setMessageHandler(nil) } - let registerTokenListenerChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.registerTokenListener\(channelSuffix)", - binaryMessenger: binaryMessenger, - codec: codec - ) - if let api { + let registerTokenListenerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.registerTokenListener\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { registerTokenListenerChannel.setMessageHandler { message, reply in let args = message as! [Any?] let appNameArg = args[0] as! String @@ -412,13 +358,8 @@ class FirebaseAppCheckHostApiSetup { } else { registerTokenListenerChannel.setMessageHandler(nil) } - let getLimitedUseAppCheckTokenChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getLimitedUseAppCheckToken\(channelSuffix)", - binaryMessenger: binaryMessenger, - codec: codec - ) - if let api { + let getLimitedUseAppCheckTokenChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getLimitedUseAppCheckToken\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { getLimitedUseAppCheckTokenChannel.setMessageHandler { message, reply in let args = message as! [Any?] let appNameArg = args[0] as! String diff --git a/packages/firebase_app_check/firebase_app_check/ios/firebase_app_check/Sources/firebase_app_check/FirebaseAppCheckPlugin.swift b/packages/firebase_app_check/firebase_app_check/ios/firebase_app_check/Sources/firebase_app_check/FirebaseAppCheckPlugin.swift index 898906d6f90a..7c7cb4514293 100644 --- a/packages/firebase_app_check/firebase_app_check/ios/firebase_app_check/Sources/firebase_app_check/FirebaseAppCheckPlugin.swift +++ b/packages/firebase_app_check/firebase_app_check/ios/firebase_app_check/Sources/firebase_app_check/FirebaseAppCheckPlugin.swift @@ -64,7 +64,7 @@ public class FirebaseAppCheckPlugin: NSObject, FlutterPlugin, func activate( appName: String, androidProvider: String?, appleProvider: String?, - debugToken: String?, + debugToken: String?, recaptchaSiteKey: String?, completion: @escaping (Result) -> Void ) { guard let app = FLTFirebasePlugin.firebaseAppNamed(appName) else { @@ -82,7 +82,8 @@ public class FirebaseAppCheckPlugin: NSObject, FlutterPlugin, providerFactory?.configure( app: app, providerName: provider, - debugToken: debugToken + debugToken: debugToken, + recaptchaSiteKey: recaptchaSiteKey ) completion(.success(())) @@ -319,7 +320,8 @@ class FlutterAppCheckProviderFactory: NSObject, AppCheckProviderFactory { wrapper.configure( app: app, providerName: "deviceCheck", - debugToken: nil + debugToken: nil, + recaptchaSiteKey: nil ) providers[app.name] = wrapper } @@ -329,7 +331,8 @@ class FlutterAppCheckProviderFactory: NSObject, AppCheckProviderFactory { func configure( app: FirebaseApp, providerName: String, - debugToken: String? + debugToken: String?, + recaptchaSiteKey: String? ) { if providers[app.name] == nil { providers[app.name] = AppCheckProviderWrapper() @@ -337,7 +340,8 @@ class FlutterAppCheckProviderFactory: NSObject, AppCheckProviderFactory { providers[app.name]?.configure( app: app, providerName: providerName, - debugToken: debugToken + debugToken: debugToken, + recaptchaSiteKey: recaptchaSiteKey ) } } @@ -348,7 +352,8 @@ class AppCheckProviderWrapper: NSObject, AppCheckProvider { func configure( app: FirebaseApp, providerName: String, - debugToken: String? + debugToken: String?, + recaptchaSiteKey: String? ) { switch providerName { case "debug": @@ -373,10 +378,14 @@ class AppCheckProviderWrapper: NSObject, AppCheckProvider { } case "recaptcha": #if os(iOS) - delegateProvider = RecaptchaProvider(app: app) + if let recaptchaSiteKey { + delegateProvider = RecaptchaProvider(app: app, siteKey: recaptchaSiteKey) + } else { + delegateProvider = nil + } if delegateProvider == nil { print( - "Firebase App Check: failed to initialize RecaptchaProvider. Ensure site key is in GoogleService-Info.plist." + "Firebase App Check: failed to initialize RecaptchaProvider. Ensure site key is provided." ) } #else diff --git a/packages/firebase_app_check/firebase_app_check/lib/firebase_app_check.dart b/packages/firebase_app_check/firebase_app_check/lib/firebase_app_check.dart index 83b47d6af96f..ef74a9b2e136 100644 --- a/packages/firebase_app_check/firebase_app_check/lib/firebase_app_check.dart +++ b/packages/firebase_app_check/firebase_app_check/lib/firebase_app_check.dart @@ -26,7 +26,6 @@ export 'package:firebase_app_check_platform_interface/firebase_app_check_platfor ReCaptchaV3Provider, WebDebugProvider, WebProvider, - WebReCaptchaProvider, WindowsAppCheckProvider, WindowsDebugProvider; export 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart' diff --git a/packages/firebase_app_check/firebase_app_check/windows/messages.g.cpp b/packages/firebase_app_check/firebase_app_check/windows/messages.g.cpp index 92bc0a0b28eb..d672652a9e6d 100644 --- a/packages/firebase_app_check/firebase_app_check/windows/messages.g.cpp +++ b/packages/firebase_app_check/firebase_app_check/windows/messages.g.cpp @@ -34,36 +34,32 @@ FlutterError CreateConnectionError(const std::string channel_name) { } namespace { -template +template bool PigeonInternalDeepEquals(const T& a, const T& b); bool PigeonInternalDeepEquals(const double& a, const double& b); -template +template bool PigeonInternalDeepEquals(const std::vector& a, const std::vector& b); -template +template bool PigeonInternalDeepEquals(const std::map& a, const std::map& b); -template -bool PigeonInternalDeepEquals(const std::optional& a, - const std::optional& b); +template +bool PigeonInternalDeepEquals(const std::optional& a, const std::optional& b); -template -bool PigeonInternalDeepEquals(const std::unique_ptr& a, - const std::unique_ptr& b); +template +bool PigeonInternalDeepEquals(const std::unique_ptr& a, const std::unique_ptr& b); -bool PigeonInternalDeepEquals(const ::flutter::EncodableValue& a, - const ::flutter::EncodableValue& b); +bool PigeonInternalDeepEquals(const ::flutter::EncodableValue& a, const ::flutter::EncodableValue& b); -template +template bool PigeonInternalDeepEquals(const T& a, const T& b) { return a == b; } -template -bool PigeonInternalDeepEquals(const std::vector& a, - const std::vector& b) { +template +bool PigeonInternalDeepEquals(const std::vector& a, const std::vector& b) { if (a.size() != b.size()) { return false; } @@ -76,8 +72,7 @@ bool PigeonInternalDeepEquals(const std::vector& a, } template -bool PigeonInternalDeepEquals(const std::map& a, - const std::map& b) { +bool PigeonInternalDeepEquals(const std::map& a, const std::map& b) { if (a.size() != b.size()) { return false; } @@ -105,9 +100,8 @@ bool PigeonInternalDeepEquals(const double& a, const double& b) { return (a == b) || (std::isnan(a) && std::isnan(b)); } -template -bool PigeonInternalDeepEquals(const std::optional& a, - const std::optional& b) { +template +bool PigeonInternalDeepEquals(const std::optional& a, const std::optional& b) { if (!a && !b) { return true; } @@ -117,9 +111,8 @@ bool PigeonInternalDeepEquals(const std::optional& a, return PigeonInternalDeepEquals(*a, *b); } -template -bool PigeonInternalDeepEquals(const std::unique_ptr& a, - const std::unique_ptr& b) { +template +bool PigeonInternalDeepEquals(const std::unique_ptr& a, const std::unique_ptr& b) { if (a.get() == b.get()) { return true; } @@ -129,18 +122,15 @@ bool PigeonInternalDeepEquals(const std::unique_ptr& a, return PigeonInternalDeepEquals(*a, *b); } -bool PigeonInternalDeepEquals(const ::flutter::EncodableValue& a, - const ::flutter::EncodableValue& b) { +bool PigeonInternalDeepEquals(const ::flutter::EncodableValue& a, const ::flutter::EncodableValue& b) { if (a.index() != b.index()) { return false; } if (const double* da = std::get_if(&a)) { return PigeonInternalDeepEquals(*da, std::get(b)); - } else if (const ::flutter::EncodableList* la = - std::get_if<::flutter::EncodableList>(&a)) { + } else if (const ::flutter::EncodableList* la = std::get_if<::flutter::EncodableList>(&a)) { return PigeonInternalDeepEquals(*la, std::get<::flutter::EncodableList>(b)); - } else if (const ::flutter::EncodableMap* ma = - std::get_if<::flutter::EncodableMap>(&a)) { + } else if (const ::flutter::EncodableMap* ma = std::get_if<::flutter::EncodableMap>(&a)) { return PigeonInternalDeepEquals(*ma, std::get<::flutter::EncodableMap>(b)); } return a == b; @@ -183,8 +173,7 @@ template size_t PigeonInternalDeepHash(const std::map& v) { size_t result = 0; for (const auto& kv : v) { - result += ((PigeonInternalDeepHash(kv.first) * 31) ^ - PigeonInternalDeepHash(kv.second)); + result += ((PigeonInternalDeepHash(kv.first) * 31) ^ PigeonInternalDeepHash(kv.second)); } return result; } @@ -241,66 +230,60 @@ size_t PigeonInternalDeepHash(const ::flutter::EncodableValue& v) { } // namespace // InternalAppCheckTokenResult -InternalAppCheckTokenResult::InternalAppCheckTokenResult( - const std::string& token) - : token_(token) {} +InternalAppCheckTokenResult::InternalAppCheckTokenResult(const std::string& token) + : token_(token) {} InternalAppCheckTokenResult::InternalAppCheckTokenResult( - const std::string& token, const int64_t* expiration_timestamp) - : token_(token), - expiration_timestamp_(expiration_timestamp - ? std::optional(*expiration_timestamp) - : std::nullopt) {} + const std::string& token, + const int64_t* expiration_timestamp) + : token_(token), + expiration_timestamp_(expiration_timestamp ? std::optional(*expiration_timestamp) : std::nullopt) {} -const std::string& InternalAppCheckTokenResult::token() const { return token_; } +const std::string& InternalAppCheckTokenResult::token() const { + return token_; +} void InternalAppCheckTokenResult::set_token(std::string_view value_arg) { token_ = value_arg; } + const int64_t* InternalAppCheckTokenResult::expiration_timestamp() const { return expiration_timestamp_ ? &(*expiration_timestamp_) : nullptr; } -void InternalAppCheckTokenResult::set_expiration_timestamp( - const int64_t* value_arg) { - expiration_timestamp_ = - value_arg ? std::optional(*value_arg) : std::nullopt; +void InternalAppCheckTokenResult::set_expiration_timestamp(const int64_t* value_arg) { + expiration_timestamp_ = value_arg ? std::optional(*value_arg) : std::nullopt; } void InternalAppCheckTokenResult::set_expiration_timestamp(int64_t value_arg) { expiration_timestamp_ = value_arg; } + EncodableList InternalAppCheckTokenResult::ToEncodableList() const { EncodableList list; list.reserve(2); list.push_back(EncodableValue(token_)); - list.push_back(expiration_timestamp_ ? EncodableValue(*expiration_timestamp_) - : EncodableValue()); + list.push_back(expiration_timestamp_ ? EncodableValue(*expiration_timestamp_) : EncodableValue()); return list; } -InternalAppCheckTokenResult InternalAppCheckTokenResult::FromEncodableList( - const EncodableList& list) { - InternalAppCheckTokenResult decoded(std::get(list[0])); +InternalAppCheckTokenResult InternalAppCheckTokenResult::FromEncodableList(const EncodableList& list) { + InternalAppCheckTokenResult decoded( + std::get(list[0])); auto& encodable_expiration_timestamp = list[1]; if (!encodable_expiration_timestamp.IsNull()) { - decoded.set_expiration_timestamp( - std::get(encodable_expiration_timestamp)); + decoded.set_expiration_timestamp(std::get(encodable_expiration_timestamp)); } return decoded; } -bool InternalAppCheckTokenResult::operator==( - const InternalAppCheckTokenResult& other) const { - return PigeonInternalDeepEquals(token_, other.token_) && - PigeonInternalDeepEquals(expiration_timestamp_, - other.expiration_timestamp_); +bool InternalAppCheckTokenResult::operator==(const InternalAppCheckTokenResult& other) const { + return PigeonInternalDeepEquals(token_, other.token_) && PigeonInternalDeepEquals(expiration_timestamp_, other.expiration_timestamp_); } -bool InternalAppCheckTokenResult::operator!=( - const InternalAppCheckTokenResult& other) const { +bool InternalAppCheckTokenResult::operator!=(const InternalAppCheckTokenResult& other) const { return !(*this == other); } @@ -315,31 +298,28 @@ size_t PigeonInternalDeepHash(const InternalAppCheckTokenResult& v) { return v.Hash(); } + PigeonInternalCodecSerializer::PigeonInternalCodecSerializer() {} EncodableValue PigeonInternalCodecSerializer::ReadValueOfType( - uint8_t type, ::flutter::ByteStreamReader* stream) const { + uint8_t type, + ::flutter::ByteStreamReader* stream) const { switch (type) { case 129: { - return CustomEncodableValue( - InternalAppCheckTokenResult::FromEncodableList( - std::get(ReadValue(stream)))); - } + return CustomEncodableValue(InternalAppCheckTokenResult::FromEncodableList(std::get(ReadValue(stream)))); + } default: return ::flutter::StandardCodecSerializer::ReadValueOfType(type, stream); - } + } } void PigeonInternalCodecSerializer::WriteValue( - const EncodableValue& value, ::flutter::ByteStreamWriter* stream) const { - if (const CustomEncodableValue* custom_value = - std::get_if(&value)) { + const EncodableValue& value, + ::flutter::ByteStreamWriter* stream) const { + if (const CustomEncodableValue* custom_value = std::get_if(&value)) { if (custom_value->type() == typeid(InternalAppCheckTokenResult)) { stream->WriteByte(129); - WriteValue(EncodableValue( - std::any_cast(*custom_value) - .ToEncodableList()), - stream); + WriteValue(EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); return; } } @@ -348,317 +328,247 @@ void PigeonInternalCodecSerializer::WriteValue( /// The codec used by FirebaseAppCheckHostApi. const ::flutter::StandardMessageCodec& FirebaseAppCheckHostApi::GetCodec() { - return ::flutter::StandardMessageCodec::GetInstance( - &PigeonInternalCodecSerializer::GetInstance()); + return ::flutter::StandardMessageCodec::GetInstance(&PigeonInternalCodecSerializer::GetInstance()); } -// Sets up an instance of `FirebaseAppCheckHostApi` to handle messages through -// the `binary_messenger`. +// Sets up an instance of `FirebaseAppCheckHostApi` to handle messages through the `binary_messenger`. void FirebaseAppCheckHostApi::SetUp( - ::flutter::BinaryMessenger* binary_messenger, - FirebaseAppCheckHostApi* api) { + ::flutter::BinaryMessenger* binary_messenger, + FirebaseAppCheckHostApi* api) { FirebaseAppCheckHostApi::SetUp(binary_messenger, api, ""); } void FirebaseAppCheckHostApi::SetUp( - ::flutter::BinaryMessenger* binary_messenger, FirebaseAppCheckHostApi* api, - const std::string& message_channel_suffix) { - const std::string prepended_suffix = - message_channel_suffix.length() > 0 - ? std::string(".") + message_channel_suffix - : ""; + ::flutter::BinaryMessenger* binary_messenger, + FirebaseAppCheckHostApi* api, + const std::string& message_channel_suffix) { + const std::string prepended_suffix = message_channel_suffix.length() > 0 ? std::string(".") + message_channel_suffix : ""; { - BasicMessageChannel<> channel( - binary_messenger, - "dev.flutter.pigeon.firebase_app_check_platform_interface." - "FirebaseAppCheckHostApi.activate" + - prepended_suffix, - &GetCodec()); + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.activate" + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler( - [api](const EncodableValue& message, - const ::flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_app_name_arg = args.at(0); - if (encodable_app_name_arg.IsNull()) { - reply(WrapError("app_name_arg unexpectedly null.")); - return; - } - const auto& app_name_arg = - std::get(encodable_app_name_arg); - const auto& encodable_android_provider_arg = args.at(1); - const auto* android_provider_arg = - std::get_if(&encodable_android_provider_arg); - const auto& encodable_apple_provider_arg = args.at(2); - const auto* apple_provider_arg = - std::get_if(&encodable_apple_provider_arg); - const auto& encodable_debug_token_arg = args.at(3); - const auto* debug_token_arg = - std::get_if(&encodable_debug_token_arg); - api->Activate(app_name_arg, android_provider_arg, - apple_provider_arg, debug_token_arg, - [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); + channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_app_name_arg = args.at(0); + if (encodable_app_name_arg.IsNull()) { + reply(WrapError("app_name_arg unexpectedly null.")); + return; + } + const auto& app_name_arg = std::get(encodable_app_name_arg); + const auto& encodable_android_provider_arg = args.at(1); + const auto* android_provider_arg = std::get_if(&encodable_android_provider_arg); + const auto& encodable_apple_provider_arg = args.at(2); + const auto* apple_provider_arg = std::get_if(&encodable_apple_provider_arg); + const auto& encodable_debug_token_arg = args.at(3); + const auto* debug_token_arg = std::get_if(&encodable_debug_token_arg); + const auto& encodable_recaptcha_site_key_arg = args.at(4); + const auto* recaptcha_site_key_arg = std::get_if(&encodable_recaptcha_site_key_arg); + api->Activate(app_name_arg, android_provider_arg, apple_provider_arg, debug_token_arg, recaptcha_site_key_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel.SetMessageHandler(nullptr); } } { - BasicMessageChannel<> channel( - binary_messenger, - "dev.flutter.pigeon.firebase_app_check_platform_interface." - "FirebaseAppCheckHostApi.getToken" + - prepended_suffix, - &GetCodec()); + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getToken" + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler( - [api](const EncodableValue& message, - const ::flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_app_name_arg = args.at(0); - if (encodable_app_name_arg.IsNull()) { - reply(WrapError("app_name_arg unexpectedly null.")); - return; - } - const auto& app_name_arg = - std::get(encodable_app_name_arg); - const auto& encodable_force_refresh_arg = args.at(1); - if (encodable_force_refresh_arg.IsNull()) { - reply(WrapError("force_refresh_arg unexpectedly null.")); - return; - } - const auto& force_refresh_arg = - std::get(encodable_force_refresh_arg); - api->GetToken( - app_name_arg, force_refresh_arg, - [reply](ErrorOr>&& output) { - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - EncodableList wrapped; - auto output_optional = std::move(output).TakeValue(); - if (output_optional) { - wrapped.push_back( - EncodableValue(std::move(output_optional).value())); - } else { - wrapped.push_back(EncodableValue()); - } - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); + channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_app_name_arg = args.at(0); + if (encodable_app_name_arg.IsNull()) { + reply(WrapError("app_name_arg unexpectedly null.")); + return; + } + const auto& app_name_arg = std::get(encodable_app_name_arg); + const auto& encodable_force_refresh_arg = args.at(1); + if (encodable_force_refresh_arg.IsNull()) { + reply(WrapError("force_refresh_arg unexpectedly null.")); + return; + } + const auto& force_refresh_arg = std::get(encodable_force_refresh_arg); + api->GetToken(app_name_arg, force_refresh_arg, [reply](ErrorOr>&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + EncodableList wrapped; + auto output_optional = std::move(output).TakeValue(); + if (output_optional) { + wrapped.push_back(EncodableValue(std::move(output_optional).value())); + } else { + wrapped.push_back(EncodableValue()); } + reply(EncodableValue(std::move(wrapped))); }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel.SetMessageHandler(nullptr); } } { - BasicMessageChannel<> channel( - binary_messenger, - "dev.flutter.pigeon.firebase_app_check_platform_interface." - "FirebaseAppCheckHostApi.getTokenResult" + - prepended_suffix, - &GetCodec()); + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getTokenResult" + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler( - [api](const EncodableValue& message, - const ::flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_app_name_arg = args.at(0); - if (encodable_app_name_arg.IsNull()) { - reply(WrapError("app_name_arg unexpectedly null.")); - return; - } - const auto& app_name_arg = - std::get(encodable_app_name_arg); - const auto& encodable_force_refresh_arg = args.at(1); - if (encodable_force_refresh_arg.IsNull()) { - reply(WrapError("force_refresh_arg unexpectedly null.")); - return; - } - const auto& force_refresh_arg = - std::get(encodable_force_refresh_arg); - api->GetTokenResult( - app_name_arg, force_refresh_arg, - [reply](ErrorOr>&& - output) { - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - EncodableList wrapped; - auto output_optional = std::move(output).TakeValue(); - if (output_optional) { - wrapped.push_back(CustomEncodableValue( - std::move(output_optional).value())); - } else { - wrapped.push_back(EncodableValue()); - } - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); + channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_app_name_arg = args.at(0); + if (encodable_app_name_arg.IsNull()) { + reply(WrapError("app_name_arg unexpectedly null.")); + return; + } + const auto& app_name_arg = std::get(encodable_app_name_arg); + const auto& encodable_force_refresh_arg = args.at(1); + if (encodable_force_refresh_arg.IsNull()) { + reply(WrapError("force_refresh_arg unexpectedly null.")); + return; + } + const auto& force_refresh_arg = std::get(encodable_force_refresh_arg); + api->GetTokenResult(app_name_arg, force_refresh_arg, [reply](ErrorOr>&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + EncodableList wrapped; + auto output_optional = std::move(output).TakeValue(); + if (output_optional) { + wrapped.push_back(CustomEncodableValue(std::move(output_optional).value())); + } else { + wrapped.push_back(EncodableValue()); } + reply(EncodableValue(std::move(wrapped))); }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel.SetMessageHandler(nullptr); } } { - BasicMessageChannel<> channel( - binary_messenger, - "dev.flutter.pigeon.firebase_app_check_platform_interface." - "FirebaseAppCheckHostApi.setTokenAutoRefreshEnabled" + - prepended_suffix, - &GetCodec()); + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.setTokenAutoRefreshEnabled" + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler( - [api](const EncodableValue& message, - const ::flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_app_name_arg = args.at(0); - if (encodable_app_name_arg.IsNull()) { - reply(WrapError("app_name_arg unexpectedly null.")); - return; - } - const auto& app_name_arg = - std::get(encodable_app_name_arg); - const auto& encodable_is_token_auto_refresh_enabled_arg = - args.at(1); - if (encodable_is_token_auto_refresh_enabled_arg.IsNull()) { - reply(WrapError( - "is_token_auto_refresh_enabled_arg unexpectedly null.")); - return; - } - const auto& is_token_auto_refresh_enabled_arg = - std::get(encodable_is_token_auto_refresh_enabled_arg); - api->SetTokenAutoRefreshEnabled( - app_name_arg, is_token_auto_refresh_enabled_arg, - [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); + channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_app_name_arg = args.at(0); + if (encodable_app_name_arg.IsNull()) { + reply(WrapError("app_name_arg unexpectedly null.")); + return; + } + const auto& app_name_arg = std::get(encodable_app_name_arg); + const auto& encodable_is_token_auto_refresh_enabled_arg = args.at(1); + if (encodable_is_token_auto_refresh_enabled_arg.IsNull()) { + reply(WrapError("is_token_auto_refresh_enabled_arg unexpectedly null.")); + return; + } + const auto& is_token_auto_refresh_enabled_arg = std::get(encodable_is_token_auto_refresh_enabled_arg); + api->SetTokenAutoRefreshEnabled(app_name_arg, is_token_auto_refresh_enabled_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel.SetMessageHandler(nullptr); } } { - BasicMessageChannel<> channel( - binary_messenger, - "dev.flutter.pigeon.firebase_app_check_platform_interface." - "FirebaseAppCheckHostApi.registerTokenListener" + - prepended_suffix, - &GetCodec()); + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.registerTokenListener" + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler( - [api](const EncodableValue& message, - const ::flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_app_name_arg = args.at(0); - if (encodable_app_name_arg.IsNull()) { - reply(WrapError("app_name_arg unexpectedly null.")); - return; - } - const auto& app_name_arg = - std::get(encodable_app_name_arg); - api->RegisterTokenListener( - app_name_arg, [reply](ErrorOr&& output) { - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - EncodableList wrapped; - wrapped.push_back( - EncodableValue(std::move(output).TakeValue())); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); + channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_app_name_arg = args.at(0); + if (encodable_app_name_arg.IsNull()) { + reply(WrapError("app_name_arg unexpectedly null.")); + return; + } + const auto& app_name_arg = std::get(encodable_app_name_arg); + api->RegisterTokenListener(app_name_arg, [reply](ErrorOr&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; } + EncodableList wrapped; + wrapped.push_back(EncodableValue(std::move(output).TakeValue())); + reply(EncodableValue(std::move(wrapped))); }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel.SetMessageHandler(nullptr); } } { - BasicMessageChannel<> channel( - binary_messenger, - "dev.flutter.pigeon.firebase_app_check_platform_interface." - "FirebaseAppCheckHostApi.getLimitedUseAppCheckToken" + - prepended_suffix, - &GetCodec()); + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getLimitedUseAppCheckToken" + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler( - [api](const EncodableValue& message, - const ::flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_app_name_arg = args.at(0); - if (encodable_app_name_arg.IsNull()) { - reply(WrapError("app_name_arg unexpectedly null.")); - return; - } - const auto& app_name_arg = - std::get(encodable_app_name_arg); - api->GetLimitedUseAppCheckToken( - app_name_arg, [reply](ErrorOr&& output) { - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - EncodableList wrapped; - wrapped.push_back( - EncodableValue(std::move(output).TakeValue())); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); + channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_app_name_arg = args.at(0); + if (encodable_app_name_arg.IsNull()) { + reply(WrapError("app_name_arg unexpectedly null.")); + return; + } + const auto& app_name_arg = std::get(encodable_app_name_arg); + api->GetLimitedUseAppCheckToken(app_name_arg, [reply](ErrorOr&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; } + EncodableList wrapped; + wrapped.push_back(EncodableValue(std::move(output).TakeValue())); + reply(EncodableValue(std::move(wrapped))); }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel.SetMessageHandler(nullptr); } } } -EncodableValue FirebaseAppCheckHostApi::WrapError( - std::string_view error_message) { - return EncodableValue( - EncodableList{EncodableValue(std::string(error_message)), - EncodableValue("Error"), EncodableValue()}); +EncodableValue FirebaseAppCheckHostApi::WrapError(std::string_view error_message) { + return EncodableValue(EncodableList{ + EncodableValue(std::string(error_message)), + EncodableValue("Error"), + EncodableValue() + }); } EncodableValue FirebaseAppCheckHostApi::WrapError(const FlutterError& error) { - return EncodableValue(EncodableList{EncodableValue(error.code()), - EncodableValue(error.message()), - error.details()}); + return EncodableValue(EncodableList{ + EncodableValue(error.code()), + EncodableValue(error.message()), + error.details() + }); } } // namespace firebase_app_check_windows diff --git a/packages/firebase_app_check/firebase_app_check/windows/messages.g.h b/packages/firebase_app_check/firebase_app_check/windows/messages.g.h index 143daacf98c8..f27984cb2d17 100644 --- a/packages/firebase_app_check/firebase_app_check/windows/messages.g.h +++ b/packages/firebase_app_check/firebase_app_check/windows/messages.g.h @@ -17,16 +17,17 @@ namespace firebase_app_check_windows { + // Generated class from Pigeon. class FlutterError { public: - explicit FlutterError(const std::string& code) : code_(code) {} + explicit FlutterError(const std::string& code) + : code_(code) {} explicit FlutterError(const std::string& code, const std::string& message) - : code_(code), message_(message) {} - explicit FlutterError(const std::string& code, const std::string& message, - const ::flutter::EncodableValue& details) - : code_(code), message_(message), details_(details) {} + : code_(code), message_(message) {} + explicit FlutterError(const std::string& code, const std::string& message, const ::flutter::EncodableValue& details) + : code_(code), message_(message), details_(details) {} const std::string& code() const { return code_; } const std::string& message() const { return message_; } @@ -38,8 +39,7 @@ class FlutterError { ::flutter::EncodableValue details_; }; -template -class ErrorOr { +template class ErrorOr { public: ErrorOr(const T& rhs) : v_(rhs) {} ErrorOr(const T&& rhs) : v_(std::move(rhs)) {} @@ -58,6 +58,8 @@ class ErrorOr { std::variant v_; }; + + // Generated class from Pigeon that represents data sent in messages. class InternalAppCheckTokenResult { public: @@ -65,8 +67,9 @@ class InternalAppCheckTokenResult { explicit InternalAppCheckTokenResult(const std::string& token); // Constructs an object setting all fields. - explicit InternalAppCheckTokenResult(const std::string& token, - const int64_t* expiration_timestamp); + explicit InternalAppCheckTokenResult( + const std::string& token, + const int64_t* expiration_timestamp); const std::string& token() const; void set_token(std::string_view value_arg); @@ -77,13 +80,10 @@ class InternalAppCheckTokenResult { bool operator==(const InternalAppCheckTokenResult& other) const; bool operator!=(const InternalAppCheckTokenResult& other) const; - /// Returns a hash code value for the object. This method is supported for the - /// benefit of hash tables. + /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; - private: - static InternalAppCheckTokenResult FromEncodableList( - const ::flutter::EncodableList& list); + static InternalAppCheckTokenResult FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; friend class FirebaseAppCheckHostApi; friend class PigeonInternalCodecSerializer; @@ -91,8 +91,8 @@ class InternalAppCheckTokenResult { std::optional expiration_timestamp_; }; -class PigeonInternalCodecSerializer - : public ::flutter::StandardCodecSerializer { + +class PigeonInternalCodecSerializer : public ::flutter::StandardCodecSerializer { public: PigeonInternalCodecSerializer(); inline static PigeonInternalCodecSerializer& GetInstance() { @@ -100,56 +100,59 @@ class PigeonInternalCodecSerializer return sInstance; } - void WriteValue(const ::flutter::EncodableValue& value, - ::flutter::ByteStreamWriter* stream) const override; - + void WriteValue( + const ::flutter::EncodableValue& value, + ::flutter::ByteStreamWriter* stream) const override; protected: ::flutter::EncodableValue ReadValueOfType( - uint8_t type, ::flutter::ByteStreamReader* stream) const override; + uint8_t type, + ::flutter::ByteStreamReader* stream) const override; }; -// Generated interface from Pigeon that represents a handler of messages from -// Flutter. +// Generated interface from Pigeon that represents a handler of messages from Flutter. class FirebaseAppCheckHostApi { public: FirebaseAppCheckHostApi(const FirebaseAppCheckHostApi&) = delete; FirebaseAppCheckHostApi& operator=(const FirebaseAppCheckHostApi&) = delete; virtual ~FirebaseAppCheckHostApi() {} virtual void Activate( - const std::string& app_name, const std::string* android_provider, - const std::string* apple_provider, const std::string* debug_token, - std::function reply)> result) = 0; + const std::string& app_name, + const std::string* android_provider, + const std::string* apple_provider, + const std::string* debug_token, + const std::string* recaptcha_site_key, + std::function reply)> result) = 0; virtual void GetToken( - const std::string& app_name, bool force_refresh, - std::function> reply)> - result) = 0; + const std::string& app_name, + bool force_refresh, + std::function> reply)> result) = 0; virtual void GetTokenResult( - const std::string& app_name, bool force_refresh, - std::function< - void(ErrorOr> reply)> - result) = 0; + const std::string& app_name, + bool force_refresh, + std::function> reply)> result) = 0; virtual void SetTokenAutoRefreshEnabled( - const std::string& app_name, bool is_token_auto_refresh_enabled, - std::function reply)> result) = 0; + const std::string& app_name, + bool is_token_auto_refresh_enabled, + std::function reply)> result) = 0; virtual void RegisterTokenListener( - const std::string& app_name, - std::function reply)> result) = 0; + const std::string& app_name, + std::function reply)> result) = 0; virtual void GetLimitedUseAppCheckToken( - const std::string& app_name, - std::function reply)> result) = 0; + const std::string& app_name, + std::function reply)> result) = 0; // The codec used by FirebaseAppCheckHostApi. static const ::flutter::StandardMessageCodec& GetCodec(); - // Sets up an instance of `FirebaseAppCheckHostApi` to handle messages through - // the `binary_messenger`. - static void SetUp(::flutter::BinaryMessenger* binary_messenger, - FirebaseAppCheckHostApi* api); - static void SetUp(::flutter::BinaryMessenger* binary_messenger, - FirebaseAppCheckHostApi* api, - const std::string& message_channel_suffix); + // Sets up an instance of `FirebaseAppCheckHostApi` to handle messages through the `binary_messenger`. + static void SetUp( + ::flutter::BinaryMessenger* binary_messenger, + FirebaseAppCheckHostApi* api); + static void SetUp( + ::flutter::BinaryMessenger* binary_messenger, + FirebaseAppCheckHostApi* api, + const std::string& message_channel_suffix); static ::flutter::EncodableValue WrapError(std::string_view error_message); static ::flutter::EncodableValue WrapError(const FlutterError& error); - protected: FirebaseAppCheckHostApi() = default; }; diff --git a/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/android_providers.dart b/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/android_providers.dart index 47640028475a..3a88c23d0d6e 100644 --- a/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/android_providers.dart +++ b/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/android_providers.dart @@ -34,8 +34,10 @@ class AndroidPlayIntegrityProvider extends AndroidAppCheckProvider { } /// reCAPTCHA provider for Android. -/// -/// The site key is retrieved automatically from google-services.json. class AndroidReCaptchaProvider extends AndroidAppCheckProvider { - const AndroidReCaptchaProvider() : super('recaptcha'); + /// Creates an Android reCAPTCHA provider with a required [siteKey]. + const AndroidReCaptchaProvider(this.siteKey) : super('recaptcha'); + + /// The reCAPTCHA site key for this provider. + final String siteKey; } diff --git a/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/apple_providers.dart b/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/apple_providers.dart index e768fca29477..9b74b145aa76 100644 --- a/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/apple_providers.dart +++ b/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/apple_providers.dart @@ -56,8 +56,10 @@ class AppleAppAttestWithDeviceCheckFallbackProvider } /// reCAPTCHA provider for Apple platforms. -/// -/// The site key is retrieved automatically from GoogleService-Info.plist. class AppleReCaptchaProvider extends AppleAppCheckProvider { - const AppleReCaptchaProvider() : super('recaptcha'); + /// Creates an Apple reCAPTCHA provider with a required [siteKey]. + const AppleReCaptchaProvider(this.siteKey) : super('recaptcha'); + + /// The reCAPTCHA site key for this provider. + final String siteKey; } diff --git a/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/method_channel/method_channel_firebase_app_check.dart b/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/method_channel/method_channel_firebase_app_check.dart index e367cb95a023..be033a61b73f 100644 --- a/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/method_channel/method_channel_firebase_app_check.dart +++ b/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/method_channel/method_channel_firebase_app_check.dart @@ -133,6 +133,10 @@ class MethodChannelFirebaseAppCheck extends FirebaseAppCheckPlatform { providerApple: providerApple, providerWindows: providerWindows, ), + _getRecaptchaSiteKey( + providerAndroid: providerAndroid, + providerApple: providerApple, + ), ); } on PlatformException catch (e, s) { convertPlatformException(e, s); @@ -220,3 +224,24 @@ String? _getDebugToken({ return null; } } + +String? _getRecaptchaSiteKey({ + AndroidAppCheckProvider? providerAndroid, + AppleAppCheckProvider? providerApple, +}) { + switch (defaultTargetPlatform) { + case TargetPlatform.android: + return providerAndroid is AndroidReCaptchaProvider + ? providerAndroid.siteKey + : null; + case TargetPlatform.iOS: + case TargetPlatform.macOS: + return providerApple is AppleReCaptchaProvider + ? providerApple.siteKey + : null; + case TargetPlatform.windows: + case TargetPlatform.fuchsia: + case TargetPlatform.linux: + return null; + } +} diff --git a/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/pigeon/messages.pigeon.dart b/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/pigeon/messages.pigeon.dart index e44fa71de539..a49a519209a0 100644 --- a/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/pigeon/messages.pigeon.dart +++ b/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/pigeon/messages.pigeon.dart @@ -13,9 +13,9 @@ import 'package:flutter/services.dart'; import 'package:meta/meta.dart' show immutable, protected, visibleForTesting; Object? _extractReplyValueOrThrow( - List? replyList, - String channelName, { - required bool isNullValid, + List? replyList, + String channelName, { + required bool isNullValid, }) { if (replyList == null) { throw PlatformException( @@ -99,6 +99,7 @@ int _deepHash(Object? value) { return value.hashCode; } + class InternalAppCheckTokenResult { InternalAppCheckTokenResult({ required this.token, @@ -117,8 +118,7 @@ class InternalAppCheckTokenResult { } Object encode() { - return _toList(); - } + return _toList(); } static InternalAppCheckTokenResult decode(Object result) { result as List; @@ -131,15 +131,13 @@ class InternalAppCheckTokenResult { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes bool operator ==(Object other) { - if (other is! InternalAppCheckTokenResult || - other.runtimeType != runtimeType) { + if (other is! InternalAppCheckTokenResult || other.runtimeType != runtimeType) { return false; } if (identical(this, other)) { return true; } - return _deepEquals(token, other.token) && - _deepEquals(expirationTimestamp, other.expirationTimestamp); + return _deepEquals(token, other.token) && _deepEquals(expirationTimestamp, other.expirationTimestamp); } @override @@ -147,6 +145,7 @@ class InternalAppCheckTokenResult { int get hashCode => _deepHash([runtimeType, ..._toList()]); } + class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -154,7 +153,7 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is InternalAppCheckTokenResult) { + } else if (value is InternalAppCheckTokenResult) { buffer.putUint8(129); writeValue(buffer, value.encode()); } else { @@ -177,135 +176,124 @@ class FirebaseAppCheckHostApi { /// Constructor for [FirebaseAppCheckHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - FirebaseAppCheckHostApi( - {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + FirebaseAppCheckHostApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); final String pigeonVar_messageChannelSuffix; - Future activate(String appName, String? androidProvider, - String? appleProvider, String? debugToken) async { - final pigeonVar_channelName = - 'dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.activate$pigeonVar_messageChannelSuffix'; + Future activate(String appName, String? androidProvider, String? appleProvider, String? debugToken, String? recaptchaSiteKey) async { + final pigeonVar_channelName = 'dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.activate$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel - .send([appName, androidProvider, appleProvider, debugToken]); + final Future pigeonVar_sendFuture = pigeonVar_channel.send([appName, androidProvider, appleProvider, debugToken, recaptchaSiteKey]); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: true, - ); + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ) + ; } Future getToken(String appName, bool forceRefresh) async { - final pigeonVar_channelName = - 'dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getToken$pigeonVar_messageChannelSuffix'; + final pigeonVar_channelName = 'dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getToken$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = - pigeonVar_channel.send([appName, forceRefresh]); + final Future pigeonVar_sendFuture = pigeonVar_channel.send([appName, forceRefresh]); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: true, - ); + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ) + ; return pigeonVar_replyValue as String?; } - Future getTokenResult( - String appName, bool forceRefresh) async { - final pigeonVar_channelName = - 'dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getTokenResult$pigeonVar_messageChannelSuffix'; + Future getTokenResult(String appName, bool forceRefresh) async { + final pigeonVar_channelName = 'dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getTokenResult$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = - pigeonVar_channel.send([appName, forceRefresh]); + final Future pigeonVar_sendFuture = pigeonVar_channel.send([appName, forceRefresh]); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: true, - ); + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ) + ; return pigeonVar_replyValue as InternalAppCheckTokenResult?; } - Future setTokenAutoRefreshEnabled( - String appName, bool isTokenAutoRefreshEnabled) async { - final pigeonVar_channelName = - 'dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.setTokenAutoRefreshEnabled$pigeonVar_messageChannelSuffix'; + Future setTokenAutoRefreshEnabled(String appName, bool isTokenAutoRefreshEnabled) async { + final pigeonVar_channelName = 'dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.setTokenAutoRefreshEnabled$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = - pigeonVar_channel.send([appName, isTokenAutoRefreshEnabled]); + final Future pigeonVar_sendFuture = pigeonVar_channel.send([appName, isTokenAutoRefreshEnabled]); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: true, - ); + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ) + ; } Future registerTokenListener(String appName) async { - final pigeonVar_channelName = - 'dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.registerTokenListener$pigeonVar_messageChannelSuffix'; + final pigeonVar_channelName = 'dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.registerTokenListener$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = - pigeonVar_channel.send([appName]); + final Future pigeonVar_sendFuture = pigeonVar_channel.send([appName]); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: false, - ); + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ) + ; return pigeonVar_replyValue! as String; } Future getLimitedUseAppCheckToken(String appName) async { - final pigeonVar_channelName = - 'dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getLimitedUseAppCheckToken$pigeonVar_messageChannelSuffix'; + final pigeonVar_channelName = 'dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getLimitedUseAppCheckToken$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = - pigeonVar_channel.send([appName]); + final Future pigeonVar_sendFuture = pigeonVar_channel.send([appName]); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: false, - ); + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ) + ; return pigeonVar_replyValue! as String; } } diff --git a/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/web_providers.dart b/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/web_providers.dart index 6d4a59844cd4..280c5a51f52a 100644 --- a/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/web_providers.dart +++ b/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/web_providers.dart @@ -31,8 +31,3 @@ class WebDebugProvider extends WebProvider { /// The debug token for this provider. final String? debugToken; } - -/// reCAPTCHA Enterprise provider for Web that does not use the enterprise name and does not take in a siteKey. -class WebReCaptchaProvider extends WebProvider { - const WebReCaptchaProvider() : super(''); -} diff --git a/packages/firebase_app_check/firebase_app_check_platform_interface/pigeons/messages.dart b/packages/firebase_app_check/firebase_app_check_platform_interface/pigeons/messages.dart index 25e024623cc1..bdd4d0673002 100644 --- a/packages/firebase_app_check/firebase_app_check_platform_interface/pigeons/messages.dart +++ b/packages/firebase_app_check/firebase_app_check_platform_interface/pigeons/messages.dart @@ -40,6 +40,7 @@ abstract class FirebaseAppCheckHostApi { String? androidProvider, String? appleProvider, String? debugToken, + String? recaptchaSiteKey, ); @async diff --git a/packages/firebase_app_check/firebase_app_check_platform_interface/test/method_channel_tests/method_channel_firebase_app_check_test.dart b/packages/firebase_app_check/firebase_app_check_platform_interface/test/method_channel_tests/method_channel_firebase_app_check_test.dart index 2c969ee4c1ec..e64bff5f1f9c 100644 --- a/packages/firebase_app_check/firebase_app_check_platform_interface/test/method_channel_tests/method_channel_firebase_app_check_test.dart +++ b/packages/firebase_app_check/firebase_app_check_platform_interface/test/method_channel_tests/method_channel_firebase_app_check_test.dart @@ -201,12 +201,13 @@ void main() { ); await appCheck.activate( - providerAndroid: const AndroidReCaptchaProvider(), + providerAndroid: const AndroidReCaptchaProvider('test-site-key'), ); expect(log.length, 1); expect(log[0][0], '[DEFAULT]'); // appName expect(log[0][1], 'recaptcha'); // androidProvider + expect(log[0][4], 'test-site-key'); // recaptchaSiteKey }); test('passes recaptcha on iOS', () async { @@ -228,12 +229,13 @@ void main() { ); await appCheck.activate( - providerApple: const AppleReCaptchaProvider(), + providerApple: const AppleReCaptchaProvider('test-site-key'), ); expect(log.length, 1); expect(log[0][0], '[DEFAULT]'); // appName expect(log[0][2], 'recaptcha'); // appleProvider + expect(log[0][4], 'test-site-key'); // recaptchaSiteKey }); }); }); diff --git a/packages/firebase_app_check/firebase_app_check_web/lib/firebase_app_check_web.dart b/packages/firebase_app_check/firebase_app_check_web/lib/firebase_app_check_web.dart index 62a0395edca4..7b1abae9f041 100644 --- a/packages/firebase_app_check/firebase_app_check_web/lib/firebase_app_check_web.dart +++ b/packages/firebase_app_check/firebase_app_check_web/lib/firebase_app_check_web.dart @@ -23,7 +23,6 @@ class FirebaseAppCheckWeb extends FirebaseAppCheckPlatform { static const recaptchaTypeV3 = 'recaptcha-v3'; static const recaptchaTypeEnterprise = 'enterprise'; static const recaptchaTypeDebug = 'debug'; - static const recaptchaTypeWebRecaptcha = 'web-recaptcha'; static Map> _tokenChangesListeners = {}; /// Stub initializer to allow the [registerWith] to create an instance without @@ -64,8 +63,6 @@ class FirebaseAppCheckWeb extends FirebaseAppCheckPlatform { final debugToken = recaptchaSiteKey?.isNotEmpty ?? false ? recaptchaSiteKey : null; provider = WebDebugProvider(debugToken: debugToken); - } else if (recaptchaType == recaptchaTypeWebRecaptcha) { - provider = const WebReCaptchaProvider(); } else if (recaptchaSiteKey != null) { if (recaptchaType == recaptchaTypeV3) { provider = ReCaptchaV3Provider(recaptchaSiteKey); @@ -146,8 +143,6 @@ class FirebaseAppCheckWeb extends FirebaseAppCheckPlatform { recaptchaType = recaptchaTypeV3; } else if (webProvider is ReCaptchaEnterpriseProvider) { recaptchaType = recaptchaTypeEnterprise; - } else if (webProvider is WebReCaptchaProvider) { - recaptchaType = recaptchaTypeWebRecaptcha; } else { throw Exception('Invalid web provider: $webProvider'); } diff --git a/packages/firebase_app_check/firebase_app_check_web/lib/src/interop/app_check.dart b/packages/firebase_app_check/firebase_app_check_web/lib/src/interop/app_check.dart index a3d2b896e96b..a22243af3e2e 100644 --- a/packages/firebase_app_check/firebase_app_check_web/lib/src/interop/app_check.dart +++ b/packages/firebase_app_check/firebase_app_check_web/lib/src/interop/app_check.dart @@ -18,7 +18,7 @@ export 'app_check_interop.dart'; AppCheck? getAppCheckInstance([App? app, WebProvider? provider]) { app_check_interop.ReCaptchaProvider? jsProvider; - if (provider == null || provider is WebReCaptchaProvider) { + if (provider == null) { jsProvider = null; } else if (provider is WebDebugProvider) { // Set the debug token global before initializing App Check. diff --git a/packages/firebase_app_check/firebase_app_check_web/test/firebase_app_check_web_test.dart b/packages/firebase_app_check/firebase_app_check_web/test/firebase_app_check_web_test.dart index f549b3419891..dd91f9bde80a 100644 --- a/packages/firebase_app_check/firebase_app_check_web/test/firebase_app_check_web_test.dart +++ b/packages/firebase_app_check/firebase_app_check_web/test/firebase_app_check_web_test.dart @@ -58,19 +58,6 @@ void main() { verifyNoMoreInteractions(appCheck); }); - test('activate with WebReCaptchaProvider', () async { - const provider = WebReCaptchaProvider(); - await appCheck.activate( - webProvider: provider, - ); - verify( - appCheck.activate( - webProvider: provider, - ), - ); - verifyNoMoreInteractions(appCheck); - }); - test('getToken', () async { await appCheck.getToken(true); verify(appCheck.getToken(true)); diff --git a/packages/firebase_core/firebase_core/android/src/main/java/io/flutter/plugins/firebase/core/FlutterFirebaseCorePlugin.java b/packages/firebase_core/firebase_core/android/src/main/java/io/flutter/plugins/firebase/core/FlutterFirebaseCorePlugin.java index 9763cfd0ab57..19a4811a9093 100644 --- a/packages/firebase_core/firebase_core/android/src/main/java/io/flutter/plugins/firebase/core/FlutterFirebaseCorePlugin.java +++ b/packages/firebase_core/firebase_core/android/src/main/java/io/flutter/plugins/firebase/core/FlutterFirebaseCorePlugin.java @@ -63,9 +63,6 @@ private GeneratedAndroidFirebaseCore.CoreFirebaseOptions firebaseOptionsToMap( firebaseOptions.setDatabaseURL(options.getDatabaseUrl()); firebaseOptions.setStorageBucket(options.getStorageBucket()); firebaseOptions.setTrackingId(options.getGaTrackingId()); - if (options.getRecaptchaSiteKey() != null) { - firebaseOptions.setRecaptchaSiteKey(options.getRecaptchaSiteKey()); - } return firebaseOptions.build(); } From 0367859805c37b01053ad2de05bbc7e8af840472 Mon Sep 17 00:00:00 2001 From: Cynthia J Date: Thu, 30 Jul 2026 21:31:26 -0700 Subject: [PATCH 05/12] add the test button and sitekey input for rCE --- .../firebase_app_check/example/lib/main.dart | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/packages/firebase_app_check/firebase_app_check/example/lib/main.dart b/packages/firebase_app_check/firebase_app_check/example/lib/main.dart index 8f26c6439a83..b795a3c9e81b 100644 --- a/packages/firebase_app_check/firebase_app_check/example/lib/main.dart +++ b/packages/firebase_app_check/firebase_app_check/example/lib/main.dart @@ -77,6 +77,8 @@ class FirebaseAppCheckExample extends StatefulWidget { class _FirebaseAppCheck extends State { final appCheck = FirebaseAppCheck.instance; + final TextEditingController _recaptchaSiteKeyController = + TextEditingController(text: 'recaptcha-site-key'); String _message = ''; String _eventToken = 'not yet'; @@ -86,6 +88,12 @@ class _FirebaseAppCheck extends State { super.initState(); } + @override + void dispose() { + _recaptchaSiteKeyController.dispose(); + super.dispose(); + } + void setMessage(String message) { setState(() { _message = message; @@ -101,18 +109,20 @@ class _FirebaseAppCheck extends State { Future _activate({ AndroidAppCheckProvider? android, AppleAppCheckProvider? apple, + WebProvider? web, WindowsAppCheckProvider? windows, }) async { try { await appCheck.activate( providerAndroid: android ?? const AndroidPlayIntegrityProvider(), providerApple: apple ?? const AppleDeviceCheckProvider(), - providerWeb: ReCaptchaV3Provider(kWebRecaptchaSiteKey), + providerWeb: web ?? ReCaptchaV3Provider(kWebRecaptchaSiteKey), providerWindows: windows ?? const WindowsDebugProvider(), ); final providerName = windows?.runtimeType.toString() ?? apple?.runtimeType.toString() ?? android?.runtimeType.toString() ?? + web?.runtimeType.toString() ?? 'default'; setMessage('Activated with $providerName'); } catch (e) { @@ -170,6 +180,29 @@ class _FirebaseAppCheck extends State { 'activate(AppAttest + DeviceCheck fallback)', ), ), + const SizedBox(height: 8), + TextField( + controller: _recaptchaSiteKeyController, + decoration: const InputDecoration( + labelText: 'reCAPTCHA Enterprise Site Key', + border: OutlineInputBorder(), + ), + ), + const SizedBox(height: 8), + ElevatedButton( + onPressed: () => _activate( + android: AndroidReCaptchaProvider( + _recaptchaSiteKeyController.text, + ), + apple: AppleReCaptchaProvider( + _recaptchaSiteKeyController.text, + ), + web: ReCaptchaEnterpriseProvider( + _recaptchaSiteKeyController.text, + ), + ), + child: const Text('activate(ReCaptcha)'), + ), const SizedBox(height: 16), const Text( 'Actions', From 46101435fff1b0b5127b9d678cb897709b837a28 Mon Sep 17 00:00:00 2001 From: Cynthia J Date: Thu, 30 Jul 2026 22:08:06 -0700 Subject: [PATCH 06/12] add rCE test provider in example --- .../firebase_app_check/example/lib/main.dart | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/packages/firebase_app_check/firebase_app_check/example/lib/main.dart b/packages/firebase_app_check/firebase_app_check/example/lib/main.dart index b795a3c9e81b..e0567613294d 100644 --- a/packages/firebase_app_check/firebase_app_check/example/lib/main.dart +++ b/packages/firebase_app_check/firebase_app_check/example/lib/main.dart @@ -12,7 +12,9 @@ import 'package:flutter/material.dart'; import 'firebase_options.dart'; -const kWebRecaptchaSiteKey = '6Lemcn0dAAAAABLkf6aiiHvpGD6x-zF3nOSDU2M8'; +const kWebRecaptchaSiteKey = '6LcB120tAAAAALKQNKclit9f4k-gEZgC0ZmFihOD'; +const kIOSRecaptchaSiteKey = 'put-default-ios-sitekey'; +const kAndroidRecaptchaSitekey = 'put-default-android-sitekey'; // Windows: create a debug token in the Firebase Console // (App Check > Apps > Manage debug tokens), then paste it here @@ -78,10 +80,23 @@ class FirebaseAppCheckExample extends StatefulWidget { class _FirebaseAppCheck extends State { final appCheck = FirebaseAppCheck.instance; final TextEditingController _recaptchaSiteKeyController = - TextEditingController(text: 'recaptcha-site-key'); + TextEditingController(); String _message = ''; String _eventToken = 'not yet'; + String get _recaptchaSiteKey { + final text = _recaptchaSiteKeyController.text.trim(); + if (text.isNotEmpty) return text; + if (kIsWeb) return kWebRecaptchaSiteKey; + if (defaultTargetPlatform == TargetPlatform.iOS) { + return kIOSRecaptchaSiteKey; + } + if (defaultTargetPlatform == TargetPlatform.android) { + return kAndroidRecaptchaSitekey; + } + return ''; + } + @override void initState() { appCheck.onTokenChange.listen(setEventToken); @@ -184,22 +199,17 @@ class _FirebaseAppCheck extends State { TextField( controller: _recaptchaSiteKeyController, decoration: const InputDecoration( - labelText: 'reCAPTCHA Enterprise Site Key', + labelText: 'reCAPTCHA Enterprise Site Key (optional)', + hintText: 'Leave empty to use default site key', border: OutlineInputBorder(), ), ), const SizedBox(height: 8), ElevatedButton( onPressed: () => _activate( - android: AndroidReCaptchaProvider( - _recaptchaSiteKeyController.text, - ), - apple: AppleReCaptchaProvider( - _recaptchaSiteKeyController.text, - ), - web: ReCaptchaEnterpriseProvider( - _recaptchaSiteKeyController.text, - ), + android: AndroidReCaptchaProvider(_recaptchaSiteKey), + apple: AppleReCaptchaProvider(_recaptchaSiteKey), + web: ReCaptchaEnterpriseProvider(_recaptchaSiteKey), ), child: const Text('activate(ReCaptcha)'), ), From f5348682685e70b805da9f78e48a62e58fdd049b Mon Sep 17 00:00:00 2001 From: Cynthia J Date: Thu, 30 Jul 2026 22:16:27 -0700 Subject: [PATCH 07/12] remove rCE sitekey from FirebaseOptions --- .../core/GeneratedAndroidFirebaseCore.java | 192 +--- .../firebase_core/FLTFirebaseCorePlugin.m | 2 - .../include/firebase_core/messages.g.h | 102 +-- .../Sources/firebase_core/messages.g.m | 229 ++--- .../test/firebase_core_test.dart | 70 -- .../firebase_core/windows/messages.g.cpp | 846 +++++++----------- .../firebase_core/windows/messages.g.h | 167 ++-- .../lib/src/firebase_options.dart | 10 +- .../method_channel_firebase.dart | 114 +-- .../lib/src/pigeon/messages.pigeon.dart | 161 ++-- .../lib/src/pigeon/test_api.dart | 140 +-- .../pigeons/messages.dart | 3 - .../test/firebase_options_test.dart | 6 - .../lib/firebase_core_web.dart | 1 - .../lib/src/firebase_core_web.dart | 2 - .../lib/src/interop/core.dart | 2 - .../lib/src/interop/core_interop.dart | 3 - .../firebase_core/firebase_core_e2e_test.dart | 54 +- 18 files changed, 726 insertions(+), 1378 deletions(-) diff --git a/packages/firebase_core/firebase_core/android/src/main/java/io/flutter/plugins/firebase/core/GeneratedAndroidFirebaseCore.java b/packages/firebase_core/firebase_core/android/src/main/java/io/flutter/plugins/firebase/core/GeneratedAndroidFirebaseCore.java index fdae685adbd8..a7144782965e 100644 --- a/packages/firebase_core/firebase_core/android/src/main/java/io/flutter/plugins/firebase/core/GeneratedAndroidFirebaseCore.java +++ b/packages/firebase_core/firebase_core/android/src/main/java/io/flutter/plugins/firebase/core/GeneratedAndroidFirebaseCore.java @@ -22,8 +22,11 @@ import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; /** Generated class from Pigeon. */ @SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression", "serial"}) @@ -56,12 +59,8 @@ static int pigeonFloatHashCode(float f) { } static boolean pigeonDeepEquals(Object a, Object b) { - if (a == b) { - return true; - } - if (a == null || b == null) { - return false; - } + 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); } @@ -87,9 +86,7 @@ static boolean pigeonDeepEquals(Object a, Object b) { if (a instanceof List && b instanceof List) { List listA = (List) a; List listB = (List) b; - if (listA.size() != listB.size()) { - return false; - } + 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; @@ -100,9 +97,7 @@ static boolean pigeonDeepEquals(Object a, Object b) { if (a instanceof Map && b instanceof Map) { Map mapA = (Map) a; Map mapB = (Map) b; - if (mapA.size() != mapB.size()) { - return false; - } + if (mapA.size() != mapB.size()) { return false; } for (Map.Entry entryA : mapA.entrySet()) { Object keyA = entryA.getKey(); Object valueA = entryA.getValue(); @@ -135,9 +130,7 @@ static boolean pigeonDeepEquals(Object a, Object b) { } static int pigeonDeepHashCode(Object value) { - if (value == null) { - return 0; - } + if (value == null) { return 0; } if (value instanceof byte[]) { return Arrays.hashCode((byte[]) value); } @@ -165,8 +158,7 @@ static int pigeonDeepHashCode(Object value) { if (value instanceof Map) { int result = 0; for (Map.Entry entry : ((Map) value).entrySet()) { - result += - ((pigeonDeepHashCode(entry.getKey()) * 31) ^ pigeonDeepHashCode(entry.getValue())); + result += ((pigeonDeepHashCode(entry.getKey()) * 31) ^ pigeonDeepHashCode(entry.getValue())); } return result; } @@ -186,6 +178,7 @@ static int pigeonDeepHashCode(Object value) { return value.hashCode(); } + /** Error class for passing custom error details to Flutter via a thrown PlatformException. */ public static class FlutterError extends RuntimeException { @@ -195,7 +188,8 @@ public static class FlutterError extends RuntimeException { /** 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) { + public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) + { super(message); this.code = code; this.details = details; @@ -214,7 +208,7 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { errorList.add(exception.toString()); errorList.add(exception.getClass().getSimpleName()); errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); } return errorList; } @@ -377,66 +371,20 @@ public void setAppGroupId(@Nullable String setterArg) { this.appGroupId = setterArg; } - private @Nullable String recaptchaSiteKey; - - public @Nullable String getRecaptchaSiteKey() { - return recaptchaSiteKey; - } - - public void setRecaptchaSiteKey(@Nullable String setterArg) { - this.recaptchaSiteKey = setterArg; - } - /** Constructor is non-public to enforce null safety; use Builder. */ CoreFirebaseOptions() {} @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } CoreFirebaseOptions that = (CoreFirebaseOptions) o; - return pigeonDeepEquals(apiKey, that.apiKey) - && pigeonDeepEquals(appId, that.appId) - && pigeonDeepEquals(messagingSenderId, that.messagingSenderId) - && pigeonDeepEquals(projectId, that.projectId) - && pigeonDeepEquals(authDomain, that.authDomain) - && pigeonDeepEquals(databaseURL, that.databaseURL) - && pigeonDeepEquals(storageBucket, that.storageBucket) - && pigeonDeepEquals(measurementId, that.measurementId) - && pigeonDeepEquals(trackingId, that.trackingId) - && pigeonDeepEquals(deepLinkURLScheme, that.deepLinkURLScheme) - && pigeonDeepEquals(androidClientId, that.androidClientId) - && pigeonDeepEquals(iosClientId, that.iosClientId) - && pigeonDeepEquals(iosBundleId, that.iosBundleId) - && pigeonDeepEquals(appGroupId, that.appGroupId) - && pigeonDeepEquals(recaptchaSiteKey, that.recaptchaSiteKey); + return pigeonDeepEquals(apiKey, that.apiKey) && pigeonDeepEquals(appId, that.appId) && pigeonDeepEquals(messagingSenderId, that.messagingSenderId) && pigeonDeepEquals(projectId, that.projectId) && pigeonDeepEquals(authDomain, that.authDomain) && pigeonDeepEquals(databaseURL, that.databaseURL) && pigeonDeepEquals(storageBucket, that.storageBucket) && pigeonDeepEquals(measurementId, that.measurementId) && pigeonDeepEquals(trackingId, that.trackingId) && pigeonDeepEquals(deepLinkURLScheme, that.deepLinkURLScheme) && pigeonDeepEquals(androidClientId, that.androidClientId) && pigeonDeepEquals(iosClientId, that.iosClientId) && pigeonDeepEquals(iosBundleId, that.iosBundleId) && pigeonDeepEquals(appGroupId, that.appGroupId); } @Override public int hashCode() { - Object[] fields = - new Object[] { - getClass(), - apiKey, - appId, - messagingSenderId, - projectId, - authDomain, - databaseURL, - storageBucket, - measurementId, - trackingId, - deepLinkURLScheme, - androidClientId, - iosClientId, - iosBundleId, - appGroupId, - recaptchaSiteKey - }; + Object[] fields = new Object[] {getClass(), apiKey, appId, messagingSenderId, projectId, authDomain, databaseURL, storageBucket, measurementId, trackingId, deepLinkURLScheme, androidClientId, iosClientId, iosBundleId, appGroupId}; return pigeonDeepHashCode(fields); } @@ -554,14 +502,6 @@ public static final class Builder { return this; } - private @Nullable String recaptchaSiteKey; - - @CanIgnoreReturnValue - public @NonNull Builder setRecaptchaSiteKey(@Nullable String setterArg) { - this.recaptchaSiteKey = setterArg; - return this; - } - public @NonNull CoreFirebaseOptions build() { CoreFirebaseOptions pigeonReturn = new CoreFirebaseOptions(); pigeonReturn.setApiKey(apiKey); @@ -578,14 +518,13 @@ public static final class Builder { pigeonReturn.setIosClientId(iosClientId); pigeonReturn.setIosBundleId(iosBundleId); pigeonReturn.setAppGroupId(appGroupId); - pigeonReturn.setRecaptchaSiteKey(recaptchaSiteKey); return pigeonReturn; } } @NonNull - public ArrayList toList() { - ArrayList toListResult = new ArrayList<>(15); + ArrayList toList() { + ArrayList toListResult = new ArrayList<>(14); toListResult.add(apiKey); toListResult.add(appId); toListResult.add(messagingSenderId); @@ -600,7 +539,6 @@ public ArrayList toList() { toListResult.add(iosClientId); toListResult.add(iosBundleId); toListResult.add(appGroupId); - toListResult.add(recaptchaSiteKey); return toListResult; } @@ -634,8 +572,6 @@ public ArrayList toList() { pigeonResult.setIosBundleId((String) iosBundleId); Object appGroupId = pigeonVar_list.get(13); pigeonResult.setAppGroupId((String) appGroupId); - Object recaptchaSiteKey = pigeonVar_list.get(14); - pigeonResult.setRecaptchaSiteKey((String) recaptchaSiteKey); return pigeonResult; } } @@ -696,26 +632,15 @@ public void setPluginConstants(@NonNull Map setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } CoreInitializeResponse that = (CoreInitializeResponse) o; - return pigeonDeepEquals(name, that.name) - && pigeonDeepEquals(options, that.options) - && pigeonDeepEquals( - isAutomaticDataCollectionEnabled, that.isAutomaticDataCollectionEnabled) - && pigeonDeepEquals(pluginConstants, that.pluginConstants); + return pigeonDeepEquals(name, that.name) && pigeonDeepEquals(options, that.options) && pigeonDeepEquals(isAutomaticDataCollectionEnabled, that.isAutomaticDataCollectionEnabled) && pigeonDeepEquals(pluginConstants, that.pluginConstants); } @Override public int hashCode() { - Object[] fields = - new Object[] { - getClass(), name, options, isAutomaticDataCollectionEnabled, pluginConstants - }; + Object[] fields = new Object[] {getClass(), name, options, isAutomaticDataCollectionEnabled, pluginConstants}; return pigeonDeepHashCode(fields); } @@ -764,7 +689,7 @@ public static final class Builder { } @NonNull - public ArrayList toList() { + ArrayList toList() { ArrayList toListResult = new ArrayList<>(4); toListResult.add(name); toListResult.add(options); @@ -818,6 +743,7 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { } } + /** Asynchronous error handling return type for non-nullable API method returns. */ public interface Result { /** Success case callback method for handling returns. */ @@ -826,7 +752,6 @@ public interface 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. */ @@ -835,7 +760,6 @@ public interface NullableResult { /** 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. */ @@ -844,14 +768,10 @@ public interface VoidResult { /** 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 FirebaseCoreHostApi { - void initializeApp( - @NonNull String appName, - @NonNull CoreFirebaseOptions initializeAppRequest, - @NonNull Result result); + void initializeApp(@NonNull String appName, @NonNull CoreFirebaseOptions initializeAppRequest, @NonNull Result result); void initializeCore(@NonNull Result> result); @@ -861,27 +781,16 @@ void initializeApp( static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } - - /** - * Sets up an instance of `FirebaseCoreHostApi` to handle messages through the - * `binaryMessenger`. - */ + /**Sets up an instance of `FirebaseCoreHostApi` to handle messages through the `binaryMessenger`. */ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable FirebaseCoreHostApi api) { setUp(binaryMessenger, "", api); } - - static void setUp( - @NonNull BinaryMessenger binaryMessenger, - @NonNull String messageChannelSuffix, - @Nullable FirebaseCoreHostApi api) { + static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String messageChannelSuffix, @Nullable FirebaseCoreHostApi api) { messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeApp" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeApp" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -911,10 +820,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeCore" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeCore" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -941,10 +847,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.optionsFromResource" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.optionsFromResource" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -970,15 +873,12 @@ public void error(Throwable error) { } } } - /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface FirebaseAppHostApi { - void setAutomaticDataCollectionEnabled( - @NonNull String appName, @NonNull Boolean enabled, @NonNull VoidResult result); + void setAutomaticDataCollectionEnabled(@NonNull String appName, @NonNull Boolean enabled, @NonNull VoidResult result); - void setAutomaticResourceManagementEnabled( - @NonNull String appName, @NonNull Boolean enabled, @NonNull VoidResult result); + void setAutomaticResourceManagementEnabled(@NonNull String appName, @NonNull Boolean enabled, @NonNull VoidResult result); void delete(@NonNull String appName, @NonNull VoidResult result); @@ -986,26 +886,16 @@ void setAutomaticResourceManagementEnabled( static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } - - /** - * Sets up an instance of `FirebaseAppHostApi` to handle messages through the `binaryMessenger`. - */ + /**Sets up an instance of `FirebaseAppHostApi` to handle messages through the `binaryMessenger`. */ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable FirebaseAppHostApi api) { setUp(binaryMessenger, "", api); } - - static void setUp( - @NonNull BinaryMessenger binaryMessenger, - @NonNull String messageChannelSuffix, - @Nullable FirebaseAppHostApi api) { + static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String messageChannelSuffix, @Nullable FirebaseAppHostApi api) { messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticDataCollectionEnabled" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticDataCollectionEnabled" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1035,10 +925,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticResourceManagementEnabled" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticResourceManagementEnabled" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1068,10 +955,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.delete" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.delete" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { diff --git a/packages/firebase_core/firebase_core/ios/firebase_core/Sources/firebase_core/FLTFirebaseCorePlugin.m b/packages/firebase_core/firebase_core/ios/firebase_core/Sources/firebase_core/FLTFirebaseCorePlugin.m index 192f984e59fb..23b3f7b9433b 100644 --- a/packages/firebase_core/firebase_core/ios/firebase_core/Sources/firebase_core/FLTFirebaseCorePlugin.m +++ b/packages/firebase_core/firebase_core/ios/firebase_core/Sources/firebase_core/FLTFirebaseCorePlugin.m @@ -93,8 +93,6 @@ - (CoreFirebaseOptions *)optionsFromFIROptions:(FIROptions *)options { pigeonOptions.iosBundleId = (id)options.bundleID ?: [NSNull null]; pigeonOptions.iosClientId = (id)options.clientID ?: [NSNull null]; pigeonOptions.appGroupId = (id)options.appGroupID ?: [NSNull null]; - // recaptchaSiteKey is currently only exposed by Firebase JS options. - pigeonOptions.recaptchaSiteKey = [NSNull null]; return pigeonOptions; } diff --git a/packages/firebase_core/firebase_core/ios/firebase_core/Sources/firebase_core/include/firebase_core/messages.g.h b/packages/firebase_core/firebase_core/ios/firebase_core/Sources/firebase_core/include/firebase_core/messages.g.h index 561383cc4135..8eea66fa1ee9 100644 --- a/packages/firebase_core/firebase_core/ios/firebase_core/Sources/firebase_core/include/firebase_core/messages.g.h +++ b/packages/firebase_core/firebase_core/ios/firebase_core/Sources/firebase_core/include/firebase_core/messages.g.h @@ -20,86 +20,70 @@ NS_ASSUME_NONNULL_BEGIN /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithApiKey:(NSString *)apiKey - appId:(NSString *)appId - messagingSenderId:(NSString *)messagingSenderId - projectId:(NSString *)projectId - authDomain:(nullable NSString *)authDomain - databaseURL:(nullable NSString *)databaseURL - storageBucket:(nullable NSString *)storageBucket - measurementId:(nullable NSString *)measurementId - trackingId:(nullable NSString *)trackingId - deepLinkURLScheme:(nullable NSString *)deepLinkURLScheme - androidClientId:(nullable NSString *)androidClientId - iosClientId:(nullable NSString *)iosClientId - iosBundleId:(nullable NSString *)iosBundleId - appGroupId:(nullable NSString *)appGroupId - recaptchaSiteKey:(nullable NSString *)recaptchaSiteKey; -@property(nonatomic, copy) NSString *apiKey; -@property(nonatomic, copy) NSString *appId; -@property(nonatomic, copy) NSString *messagingSenderId; -@property(nonatomic, copy) NSString *projectId; -@property(nonatomic, copy, nullable) NSString *authDomain; -@property(nonatomic, copy, nullable) NSString *databaseURL; -@property(nonatomic, copy, nullable) NSString *storageBucket; -@property(nonatomic, copy, nullable) NSString *measurementId; -@property(nonatomic, copy, nullable) NSString *trackingId; -@property(nonatomic, copy, nullable) NSString *deepLinkURLScheme; -@property(nonatomic, copy, nullable) NSString *androidClientId; -@property(nonatomic, copy, nullable) NSString *iosClientId; -@property(nonatomic, copy, nullable) NSString *iosBundleId; -@property(nonatomic, copy, nullable) NSString *appGroupId; -@property(nonatomic, copy, nullable) NSString *recaptchaSiteKey; + appId:(NSString *)appId + messagingSenderId:(NSString *)messagingSenderId + projectId:(NSString *)projectId + authDomain:(nullable NSString *)authDomain + databaseURL:(nullable NSString *)databaseURL + storageBucket:(nullable NSString *)storageBucket + measurementId:(nullable NSString *)measurementId + trackingId:(nullable NSString *)trackingId + deepLinkURLScheme:(nullable NSString *)deepLinkURLScheme + androidClientId:(nullable NSString *)androidClientId + iosClientId:(nullable NSString *)iosClientId + iosBundleId:(nullable NSString *)iosBundleId + appGroupId:(nullable NSString *)appGroupId; +@property(nonatomic, copy) NSString * apiKey; +@property(nonatomic, copy) NSString * appId; +@property(nonatomic, copy) NSString * messagingSenderId; +@property(nonatomic, copy) NSString * projectId; +@property(nonatomic, copy, nullable) NSString * authDomain; +@property(nonatomic, copy, nullable) NSString * databaseURL; +@property(nonatomic, copy, nullable) NSString * storageBucket; +@property(nonatomic, copy, nullable) NSString * measurementId; +@property(nonatomic, copy, nullable) NSString * trackingId; +@property(nonatomic, copy, nullable) NSString * deepLinkURLScheme; +@property(nonatomic, copy, nullable) NSString * androidClientId; +@property(nonatomic, copy, nullable) NSString * iosClientId; +@property(nonatomic, copy, nullable) NSString * iosBundleId; +@property(nonatomic, copy, nullable) NSString * appGroupId; @end @interface CoreInitializeResponse : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithName:(NSString *)name - options:(CoreFirebaseOptions *)options + options:(CoreFirebaseOptions *)options isAutomaticDataCollectionEnabled:(nullable NSNumber *)isAutomaticDataCollectionEnabled - pluginConstants:(NSDictionary *)pluginConstants; -@property(nonatomic, copy) NSString *name; -@property(nonatomic, strong) CoreFirebaseOptions *options; -@property(nonatomic, strong, nullable) NSNumber *isAutomaticDataCollectionEnabled; -@property(nonatomic, copy) NSDictionary *pluginConstants; + pluginConstants:(NSDictionary *)pluginConstants; +@property(nonatomic, copy) NSString * name; +@property(nonatomic, strong) CoreFirebaseOptions * options; +@property(nonatomic, strong, nullable) NSNumber * isAutomaticDataCollectionEnabled; +@property(nonatomic, copy) NSDictionary * pluginConstants; @end /// The codec used by all APIs. NSObject *nullGetMessagesCodec(void); @protocol FirebaseCoreHostApi -- (void)initializeAppAppName:(NSString *)appName - initializeAppRequest:(CoreFirebaseOptions *)initializeAppRequest - completion:(void (^)(CoreInitializeResponse *_Nullable, - FlutterError *_Nullable))completion; -- (void)initializeCoreWithCompletion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; -- (void)optionsFromResourceWithCompletion:(void (^)(CoreFirebaseOptions *_Nullable, - FlutterError *_Nullable))completion; +- (void)initializeAppAppName:(NSString *)appName initializeAppRequest:(CoreFirebaseOptions *)initializeAppRequest completion:(void (^)(CoreInitializeResponse *_Nullable, FlutterError *_Nullable))completion; +- (void)initializeCoreWithCompletion:(void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion; +- (void)optionsFromResourceWithCompletion:(void (^)(CoreFirebaseOptions *_Nullable, FlutterError *_Nullable))completion; @end -extern void SetUpFirebaseCoreHostApi(id binaryMessenger, - NSObject *_Nullable api); +extern void SetUpFirebaseCoreHostApi(id binaryMessenger, NSObject *_Nullable api); + +extern void SetUpFirebaseCoreHostApiWithSuffix(id binaryMessenger, NSObject *_Nullable api, NSString *messageChannelSuffix); -extern void SetUpFirebaseCoreHostApiWithSuffix(id binaryMessenger, - NSObject *_Nullable api, - NSString *messageChannelSuffix); @protocol FirebaseAppHostApi -- (void)setAutomaticDataCollectionEnabledAppName:(NSString *)appName - enabled:(BOOL)enabled - completion:(void (^)(FlutterError *_Nullable))completion; -- (void)setAutomaticResourceManagementEnabledAppName:(NSString *)appName - enabled:(BOOL)enabled - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setAutomaticDataCollectionEnabledAppName:(NSString *)appName enabled:(BOOL)enabled completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setAutomaticResourceManagementEnabledAppName:(NSString *)appName enabled:(BOOL)enabled completion:(void (^)(FlutterError *_Nullable))completion; - (void)deleteAppName:(NSString *)appName completion:(void (^)(FlutterError *_Nullable))completion; @end -extern void SetUpFirebaseAppHostApi(id binaryMessenger, - NSObject *_Nullable api); +extern void SetUpFirebaseAppHostApi(id binaryMessenger, NSObject *_Nullable api); -extern void SetUpFirebaseAppHostApiWithSuffix(id binaryMessenger, - NSObject *_Nullable api, - NSString *messageChannelSuffix); +extern void SetUpFirebaseAppHostApiWithSuffix(id binaryMessenger, NSObject *_Nullable api, NSString *messageChannelSuffix); NS_ASSUME_NONNULL_END diff --git a/packages/firebase_core/firebase_core/ios/firebase_core/Sources/firebase_core/messages.g.m b/packages/firebase_core/firebase_core/ios/firebase_core/Sources/firebase_core/messages.g.m index 449944316866..38e4dbb85cfc 100644 --- a/packages/firebase_core/firebase_core/ios/firebase_core/Sources/firebase_core/messages.g.m +++ b/packages/firebase_core/firebase_core/ios/firebase_core/Sources/firebase_core/messages.g.m @@ -23,8 +23,7 @@ static BOOL __attribute__((unused)) FLTPigeonDeepEquals(id _Nullable a, id _Null 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])); + 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; @@ -131,21 +130,20 @@ + (nullable CoreInitializeResponse *)nullableFromList:(NSArray *)list; @implementation CoreFirebaseOptions + (instancetype)makeWithApiKey:(NSString *)apiKey - appId:(NSString *)appId - messagingSenderId:(NSString *)messagingSenderId - projectId:(NSString *)projectId - authDomain:(nullable NSString *)authDomain - databaseURL:(nullable NSString *)databaseURL - storageBucket:(nullable NSString *)storageBucket - measurementId:(nullable NSString *)measurementId - trackingId:(nullable NSString *)trackingId - deepLinkURLScheme:(nullable NSString *)deepLinkURLScheme - androidClientId:(nullable NSString *)androidClientId - iosClientId:(nullable NSString *)iosClientId - iosBundleId:(nullable NSString *)iosBundleId - appGroupId:(nullable NSString *)appGroupId - recaptchaSiteKey:(nullable NSString *)recaptchaSiteKey { - CoreFirebaseOptions *pigeonResult = [[CoreFirebaseOptions alloc] init]; + appId:(NSString *)appId + messagingSenderId:(NSString *)messagingSenderId + projectId:(NSString *)projectId + authDomain:(nullable NSString *)authDomain + databaseURL:(nullable NSString *)databaseURL + storageBucket:(nullable NSString *)storageBucket + measurementId:(nullable NSString *)measurementId + trackingId:(nullable NSString *)trackingId + deepLinkURLScheme:(nullable NSString *)deepLinkURLScheme + androidClientId:(nullable NSString *)androidClientId + iosClientId:(nullable NSString *)iosClientId + iosBundleId:(nullable NSString *)iosBundleId + appGroupId:(nullable NSString *)appGroupId { + CoreFirebaseOptions* pigeonResult = [[CoreFirebaseOptions alloc] init]; pigeonResult.apiKey = apiKey; pigeonResult.appId = appId; pigeonResult.messagingSenderId = messagingSenderId; @@ -160,7 +158,6 @@ + (instancetype)makeWithApiKey:(NSString *)apiKey pigeonResult.iosClientId = iosClientId; pigeonResult.iosBundleId = iosBundleId; pigeonResult.appGroupId = appGroupId; - pigeonResult.recaptchaSiteKey = recaptchaSiteKey; return pigeonResult; } + (CoreFirebaseOptions *)fromList:(NSArray *)list { @@ -179,7 +176,6 @@ + (CoreFirebaseOptions *)fromList:(NSArray *)list { pigeonResult.iosClientId = GetNullableObjectAtIndex(list, 11); pigeonResult.iosBundleId = GetNullableObjectAtIndex(list, 12); pigeonResult.appGroupId = GetNullableObjectAtIndex(list, 13); - pigeonResult.recaptchaSiteKey = GetNullableObjectAtIndex(list, 14); return pigeonResult; } + (nullable CoreFirebaseOptions *)nullableFromList:(NSArray *)list { @@ -201,7 +197,6 @@ + (nullable CoreFirebaseOptions *)nullableFromList:(NSArray *)list { self.iosClientId ?: [NSNull null], self.iosBundleId ?: [NSNull null], self.appGroupId ?: [NSNull null], - self.recaptchaSiteKey ?: [NSNull null], ]; } - (BOOL)isEqual:(id)object { @@ -212,21 +207,7 @@ - (BOOL)isEqual:(id)object { return NO; } CoreFirebaseOptions *other = (CoreFirebaseOptions *)object; - return FLTPigeonDeepEquals(self.apiKey, other.apiKey) && - FLTPigeonDeepEquals(self.appId, other.appId) && - FLTPigeonDeepEquals(self.messagingSenderId, other.messagingSenderId) && - FLTPigeonDeepEquals(self.projectId, other.projectId) && - FLTPigeonDeepEquals(self.authDomain, other.authDomain) && - FLTPigeonDeepEquals(self.databaseURL, other.databaseURL) && - FLTPigeonDeepEquals(self.storageBucket, other.storageBucket) && - FLTPigeonDeepEquals(self.measurementId, other.measurementId) && - FLTPigeonDeepEquals(self.trackingId, other.trackingId) && - FLTPigeonDeepEquals(self.deepLinkURLScheme, other.deepLinkURLScheme) && - FLTPigeonDeepEquals(self.androidClientId, other.androidClientId) && - FLTPigeonDeepEquals(self.iosClientId, other.iosClientId) && - FLTPigeonDeepEquals(self.iosBundleId, other.iosBundleId) && - FLTPigeonDeepEquals(self.appGroupId, other.appGroupId) && - FLTPigeonDeepEquals(self.recaptchaSiteKey, other.recaptchaSiteKey); + return FLTPigeonDeepEquals(self.apiKey, other.apiKey) && FLTPigeonDeepEquals(self.appId, other.appId) && FLTPigeonDeepEquals(self.messagingSenderId, other.messagingSenderId) && FLTPigeonDeepEquals(self.projectId, other.projectId) && FLTPigeonDeepEquals(self.authDomain, other.authDomain) && FLTPigeonDeepEquals(self.databaseURL, other.databaseURL) && FLTPigeonDeepEquals(self.storageBucket, other.storageBucket) && FLTPigeonDeepEquals(self.measurementId, other.measurementId) && FLTPigeonDeepEquals(self.trackingId, other.trackingId) && FLTPigeonDeepEquals(self.deepLinkURLScheme, other.deepLinkURLScheme) && FLTPigeonDeepEquals(self.androidClientId, other.androidClientId) && FLTPigeonDeepEquals(self.iosClientId, other.iosClientId) && FLTPigeonDeepEquals(self.iosBundleId, other.iosBundleId) && FLTPigeonDeepEquals(self.appGroupId, other.appGroupId); } - (NSUInteger)hash { @@ -245,17 +226,16 @@ - (NSUInteger)hash { result = result * 31 + FLTPigeonDeepHash(self.iosClientId); result = result * 31 + FLTPigeonDeepHash(self.iosBundleId); result = result * 31 + FLTPigeonDeepHash(self.appGroupId); - result = result * 31 + FLTPigeonDeepHash(self.recaptchaSiteKey); return result; } @end @implementation CoreInitializeResponse + (instancetype)makeWithName:(NSString *)name - options:(CoreFirebaseOptions *)options + options:(CoreFirebaseOptions *)options isAutomaticDataCollectionEnabled:(nullable NSNumber *)isAutomaticDataCollectionEnabled - pluginConstants:(NSDictionary *)pluginConstants { - CoreInitializeResponse *pigeonResult = [[CoreInitializeResponse alloc] init]; + pluginConstants:(NSDictionary *)pluginConstants { + CoreInitializeResponse* pigeonResult = [[CoreInitializeResponse alloc] init]; pigeonResult.name = name; pigeonResult.options = options; pigeonResult.isAutomaticDataCollectionEnabled = isAutomaticDataCollectionEnabled; @@ -289,11 +269,7 @@ - (BOOL)isEqual:(id)object { return NO; } CoreInitializeResponse *other = (CoreInitializeResponse *)object; - return FLTPigeonDeepEquals(self.name, other.name) && - FLTPigeonDeepEquals(self.options, other.options) && - FLTPigeonDeepEquals(self.isAutomaticDataCollectionEnabled, - other.isAutomaticDataCollectionEnabled) && - FLTPigeonDeepEquals(self.pluginConstants, other.pluginConstants); + return FLTPigeonDeepEquals(self.name, other.name) && FLTPigeonDeepEquals(self.options, other.options) && FLTPigeonDeepEquals(self.isAutomaticDataCollectionEnabled, other.isAutomaticDataCollectionEnabled) && FLTPigeonDeepEquals(self.pluginConstants, other.pluginConstants); } - (NSUInteger)hash { @@ -311,9 +287,9 @@ @interface nullMessagesPigeonCodecReader : FlutterStandardReader @implementation nullMessagesPigeonCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 129: + case 129: return [CoreFirebaseOptions fromList:[self readValue]]; - case 130: + case 130: return [CoreInitializeResponse fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -352,68 +328,47 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - nullMessagesPigeonCodecReaderWriter *readerWriter = - [[nullMessagesPigeonCodecReaderWriter alloc] init]; + nullMessagesPigeonCodecReaderWriter *readerWriter = [[nullMessagesPigeonCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void SetUpFirebaseCoreHostApi(id binaryMessenger, - NSObject *api) { +void SetUpFirebaseCoreHostApi(id binaryMessenger, NSObject *api) { SetUpFirebaseCoreHostApiWithSuffix(binaryMessenger, api, @""); } -void SetUpFirebaseCoreHostApiWithSuffix(id binaryMessenger, - NSObject *api, - NSString *messageChannelSuffix) { - messageChannelSuffix = messageChannelSuffix.length > 0 - ? [NSString stringWithFormat:@".%@", messageChannelSuffix] - : @""; +void SetUpFirebaseCoreHostApiWithSuffix(id binaryMessenger, NSObject *api, NSString *messageChannelSuffix) { + messageChannelSuffix = messageChannelSuffix.length > 0 ? [NSString stringWithFormat: @".%@", messageChannelSuffix] : @""; { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_core_platform_" - @"interface.FirebaseCoreHostApi.initializeApp", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeApp", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:nullGetMessagesCodec()]; + codec:nullGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(initializeAppAppName:initializeAppRequest:completion:)], - @"FirebaseCoreHostApi api (%@) doesn't respond to " - @"@selector(initializeAppAppName:initializeAppRequest:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(initializeAppAppName:initializeAppRequest:completion:)], @"FirebaseCoreHostApi api (%@) doesn't respond to @selector(initializeAppAppName:initializeAppRequest:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_appName = GetNullableObjectAtIndex(args, 0); CoreFirebaseOptions *arg_initializeAppRequest = GetNullableObjectAtIndex(args, 1); - [api initializeAppAppName:arg_appName - initializeAppRequest:arg_initializeAppRequest - completion:^(CoreInitializeResponse *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api initializeAppAppName:arg_appName initializeAppRequest:arg_initializeAppRequest completion:^(CoreInitializeResponse *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_core_platform_" - @"interface.FirebaseCoreHostApi.initializeCore", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeCore", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:nullGetMessagesCodec()]; + codec:nullGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(initializeCoreWithCompletion:)], - @"FirebaseCoreHostApi api (%@) doesn't respond to " - @"@selector(initializeCoreWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(initializeCoreWithCompletion:)], @"FirebaseCoreHostApi api (%@) doesn't respond to @selector(initializeCoreWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api initializeCoreWithCompletion:^(NSArray *_Nullable output, - FlutterError *_Nullable error) { + [api initializeCoreWithCompletion:^(NSArray *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); }]; }]; @@ -422,22 +377,15 @@ void SetUpFirebaseCoreHostApiWithSuffix(id binaryMesseng } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_core_platform_interface." - @"FirebaseCoreHostApi.optionsFromResource", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.optionsFromResource", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:nullGetMessagesCodec()]; + codec:nullGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(optionsFromResourceWithCompletion:)], - @"FirebaseCoreHostApi api (%@) doesn't respond to " - @"@selector(optionsFromResourceWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(optionsFromResourceWithCompletion:)], @"FirebaseCoreHostApi api (%@) doesn't respond to @selector(optionsFromResourceWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api optionsFromResourceWithCompletion:^(CoreFirebaseOptions *_Nullable output, - FlutterError *_Nullable error) { + [api optionsFromResourceWithCompletion:^(CoreFirebaseOptions *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); }]; }]; @@ -446,97 +394,66 @@ void SetUpFirebaseCoreHostApiWithSuffix(id binaryMesseng } } } -void SetUpFirebaseAppHostApi(id binaryMessenger, - NSObject *api) { +void SetUpFirebaseAppHostApi(id binaryMessenger, NSObject *api) { SetUpFirebaseAppHostApiWithSuffix(binaryMessenger, api, @""); } -void SetUpFirebaseAppHostApiWithSuffix(id binaryMessenger, - NSObject *api, - NSString *messageChannelSuffix) { - messageChannelSuffix = messageChannelSuffix.length > 0 - ? [NSString stringWithFormat:@".%@", messageChannelSuffix] - : @""; +void SetUpFirebaseAppHostApiWithSuffix(id binaryMessenger, NSObject *api, NSString *messageChannelSuffix) { + messageChannelSuffix = messageChannelSuffix.length > 0 ? [NSString stringWithFormat: @".%@", messageChannelSuffix] : @""; { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_core_platform_interface." - @"FirebaseAppHostApi.setAutomaticDataCollectionEnabled", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticDataCollectionEnabled", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:nullGetMessagesCodec()]; + codec:nullGetMessagesCodec()]; if (api) { - NSCAssert( - [api - respondsToSelector:@selector( - setAutomaticDataCollectionEnabledAppName:enabled:completion:)], - @"FirebaseAppHostApi api (%@) doesn't respond to " - @"@selector(setAutomaticDataCollectionEnabledAppName:enabled:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setAutomaticDataCollectionEnabledAppName:enabled:completion:)], @"FirebaseAppHostApi api (%@) doesn't respond to @selector(setAutomaticDataCollectionEnabledAppName:enabled:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_appName = GetNullableObjectAtIndex(args, 0); BOOL arg_enabled = [GetNullableObjectAtIndex(args, 1) boolValue]; - [api setAutomaticDataCollectionEnabledAppName:arg_appName - enabled:arg_enabled - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setAutomaticDataCollectionEnabledAppName:arg_appName enabled:arg_enabled completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.firebase_core_platform_interface." - @"FirebaseAppHostApi.setAutomaticResourceManagementEnabled", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticResourceManagementEnabled", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:nullGetMessagesCodec()]; + codec:nullGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setAutomaticResourceManagementEnabledAppName: - enabled:completion:)], - @"FirebaseAppHostApi api (%@) doesn't respond to " - @"@selector(setAutomaticResourceManagementEnabledAppName:enabled:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setAutomaticResourceManagementEnabledAppName:enabled:completion:)], @"FirebaseAppHostApi api (%@) doesn't respond to @selector(setAutomaticResourceManagementEnabledAppName:enabled:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_appName = GetNullableObjectAtIndex(args, 0); BOOL arg_enabled = [GetNullableObjectAtIndex(args, 1) boolValue]; - [api setAutomaticResourceManagementEnabledAppName:arg_appName - enabled:arg_enabled - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setAutomaticResourceManagementEnabledAppName:arg_appName enabled:arg_enabled completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.firebase_core_platform_" - @"interface.FirebaseAppHostApi.delete", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.delete", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:nullGetMessagesCodec()]; + codec:nullGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(deleteAppName:completion:)], - @"FirebaseAppHostApi api (%@) doesn't respond to @selector(deleteAppName:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(deleteAppName:completion:)], @"FirebaseAppHostApi api (%@) doesn't respond to @selector(deleteAppName:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_appName = GetNullableObjectAtIndex(args, 0); - [api deleteAppName:arg_appName - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api deleteAppName:arg_appName completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; diff --git a/packages/firebase_core/firebase_core/test/firebase_core_test.dart b/packages/firebase_core/firebase_core/test/firebase_core_test.dart index cb2bf2f67e12..4354f38c5824 100755 --- a/packages/firebase_core/firebase_core/test/firebase_core_test.dart +++ b/packages/firebase_core/firebase_core/test/firebase_core_test.dart @@ -5,9 +5,6 @@ import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart'; -import 'package:firebase_core_platform_interface/src/pigeon/messages.pigeon.dart' - as pigeon; -import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; import 'package:plugin_platform_interface/plugin_platform_interface.dart'; @@ -158,73 +155,6 @@ void main() { mock.app(expectedName), ]); }); - - test('.initializeApp() preserves recaptchaSiteKey if native drops it', - () async { - Firebase.delegatePackingProperty = null; - MethodChannelFirebase.appInstances.clear(); - MethodChannelFirebase.isCoreInitialized = false; - - const String appName = 'recaptcha-test-app'; - const FirebaseOptions options = FirebaseOptions( - apiKey: 'apiKey', - appId: 'appId', - messagingSenderId: 'messagingSenderId', - projectId: 'projectId', - recaptchaSiteKey: 'test-recaptcha-site-key', - ); - - final TestDefaultBinaryMessenger messenger = - TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger; - - messenger.setMockMessageHandler( - 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeCore', - (ByteData? message) async { - return pigeon.FirebaseCoreHostApi.pigeonChannelCodec.encodeMessage( - [[]], - ); - }, - ); - messenger.setMockMessageHandler( - 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeApp', - (ByteData? message) async { - return pigeon.FirebaseCoreHostApi.pigeonChannelCodec.encodeMessage( - [ - pigeon.CoreInitializeResponse( - name: appName, - options: pigeon.CoreFirebaseOptions( - apiKey: options.apiKey, - appId: options.appId, - messagingSenderId: options.messagingSenderId, - projectId: options.projectId, - ), - pluginConstants: const {}, - ), - ], - ); - }, - ); - addTearDown(() { - messenger.setMockMessageHandler( - 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeCore', - null, - ); - messenger.setMockMessageHandler( - 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeApp', - null, - ); - MethodChannelFirebase.appInstances.clear(); - MethodChannelFirebase.isCoreInitialized = false; - Firebase.delegatePackingProperty = null; - }); - - final FirebaseApp app = await Firebase.initializeApp( - name: appName, - options: options, - ); - - expect(app.options.recaptchaSiteKey, 'test-recaptcha-site-key'); - }); } class MockFirebaseCore extends Mock diff --git a/packages/firebase_core/firebase_core/windows/messages.g.cpp b/packages/firebase_core/firebase_core/windows/messages.g.cpp index 4bfc5dcbf9c4..04c42c4767dd 100644 --- a/packages/firebase_core/firebase_core/windows/messages.g.cpp +++ b/packages/firebase_core/firebase_core/windows/messages.g.cpp @@ -34,36 +34,32 @@ FlutterError CreateConnectionError(const std::string channel_name) { } namespace { -template +template bool PigeonInternalDeepEquals(const T& a, const T& b); bool PigeonInternalDeepEquals(const double& a, const double& b); -template +template bool PigeonInternalDeepEquals(const std::vector& a, const std::vector& b); -template +template bool PigeonInternalDeepEquals(const std::map& a, const std::map& b); -template -bool PigeonInternalDeepEquals(const std::optional& a, - const std::optional& b); +template +bool PigeonInternalDeepEquals(const std::optional& a, const std::optional& b); -template -bool PigeonInternalDeepEquals(const std::unique_ptr& a, - const std::unique_ptr& b); +template +bool PigeonInternalDeepEquals(const std::unique_ptr& a, const std::unique_ptr& b); -bool PigeonInternalDeepEquals(const ::flutter::EncodableValue& a, - const ::flutter::EncodableValue& b); +bool PigeonInternalDeepEquals(const ::flutter::EncodableValue& a, const ::flutter::EncodableValue& b); -template +template bool PigeonInternalDeepEquals(const T& a, const T& b) { return a == b; } -template -bool PigeonInternalDeepEquals(const std::vector& a, - const std::vector& b) { +template +bool PigeonInternalDeepEquals(const std::vector& a, const std::vector& b) { if (a.size() != b.size()) { return false; } @@ -76,8 +72,7 @@ bool PigeonInternalDeepEquals(const std::vector& a, } template -bool PigeonInternalDeepEquals(const std::map& a, - const std::map& b) { +bool PigeonInternalDeepEquals(const std::map& a, const std::map& b) { if (a.size() != b.size()) { return false; } @@ -105,9 +100,8 @@ bool PigeonInternalDeepEquals(const double& a, const double& b) { return (a == b) || (std::isnan(a) && std::isnan(b)); } -template -bool PigeonInternalDeepEquals(const std::optional& a, - const std::optional& b) { +template +bool PigeonInternalDeepEquals(const std::optional& a, const std::optional& b) { if (!a && !b) { return true; } @@ -117,9 +111,8 @@ bool PigeonInternalDeepEquals(const std::optional& a, return PigeonInternalDeepEquals(*a, *b); } -template -bool PigeonInternalDeepEquals(const std::unique_ptr& a, - const std::unique_ptr& b) { +template +bool PigeonInternalDeepEquals(const std::unique_ptr& a, const std::unique_ptr& b) { if (a.get() == b.get()) { return true; } @@ -129,18 +122,15 @@ bool PigeonInternalDeepEquals(const std::unique_ptr& a, return PigeonInternalDeepEquals(*a, *b); } -bool PigeonInternalDeepEquals(const ::flutter::EncodableValue& a, - const ::flutter::EncodableValue& b) { +bool PigeonInternalDeepEquals(const ::flutter::EncodableValue& a, const ::flutter::EncodableValue& b) { if (a.index() != b.index()) { return false; } if (const double* da = std::get_if(&a)) { return PigeonInternalDeepEquals(*da, std::get(b)); - } else if (const ::flutter::EncodableList* la = - std::get_if<::flutter::EncodableList>(&a)) { + } else if (const ::flutter::EncodableList* la = std::get_if<::flutter::EncodableList>(&a)) { return PigeonInternalDeepEquals(*la, std::get<::flutter::EncodableList>(b)); - } else if (const ::flutter::EncodableMap* ma = - std::get_if<::flutter::EncodableMap>(&a)) { + } else if (const ::flutter::EncodableMap* ma = std::get_if<::flutter::EncodableMap>(&a)) { return PigeonInternalDeepEquals(*ma, std::get<::flutter::EncodableMap>(b)); } return a == b; @@ -183,8 +173,7 @@ template size_t PigeonInternalDeepHash(const std::map& v) { size_t result = 0; for (const auto& kv : v) { - result += ((PigeonInternalDeepHash(kv.first) * 31) ^ - PigeonInternalDeepHash(kv.second)); + result += ((PigeonInternalDeepHash(kv.first) * 31) ^ PigeonInternalDeepHash(kv.second)); } return result; } @@ -241,70 +230,64 @@ size_t PigeonInternalDeepHash(const ::flutter::EncodableValue& v) { } // namespace // CoreFirebaseOptions -CoreFirebaseOptions::CoreFirebaseOptions(const std::string& api_key, - const std::string& app_id, - const std::string& messaging_sender_id, - const std::string& project_id) - : api_key_(api_key), - app_id_(app_id), - messaging_sender_id_(messaging_sender_id), - project_id_(project_id) {} +CoreFirebaseOptions::CoreFirebaseOptions( + const std::string& api_key, + const std::string& app_id, + const std::string& messaging_sender_id, + const std::string& project_id) + : api_key_(api_key), + app_id_(app_id), + messaging_sender_id_(messaging_sender_id), + project_id_(project_id) {} CoreFirebaseOptions::CoreFirebaseOptions( - const std::string& api_key, const std::string& app_id, - const std::string& messaging_sender_id, const std::string& project_id, - const std::string* auth_domain, const std::string* database_u_r_l, - const std::string* storage_bucket, const std::string* measurement_id, - const std::string* tracking_id, const std::string* deep_link_u_r_l_scheme, - const std::string* android_client_id, const std::string* ios_client_id, - const std::string* ios_bundle_id, const std::string* app_group_id, - const std::string* recaptcha_site_key) - : api_key_(api_key), - app_id_(app_id), - messaging_sender_id_(messaging_sender_id), - project_id_(project_id), - auth_domain_(auth_domain ? std::optional(*auth_domain) - : std::nullopt), - database_u_r_l_(database_u_r_l - ? std::optional(*database_u_r_l) - : std::nullopt), - storage_bucket_(storage_bucket - ? std::optional(*storage_bucket) - : std::nullopt), - measurement_id_(measurement_id - ? std::optional(*measurement_id) - : std::nullopt), - tracking_id_(tracking_id ? std::optional(*tracking_id) - : std::nullopt), - deep_link_u_r_l_scheme_( - deep_link_u_r_l_scheme - ? std::optional(*deep_link_u_r_l_scheme) - : std::nullopt), - android_client_id_(android_client_id - ? std::optional(*android_client_id) - : std::nullopt), - ios_client_id_(ios_client_id ? std::optional(*ios_client_id) - : std::nullopt), - ios_bundle_id_(ios_bundle_id ? std::optional(*ios_bundle_id) - : std::nullopt), - app_group_id_(app_group_id ? std::optional(*app_group_id) - : std::nullopt), - recaptcha_site_key_(recaptcha_site_key - ? std::optional(*recaptcha_site_key) - : std::nullopt) {} - -const std::string& CoreFirebaseOptions::api_key() const { return api_key_; } + const std::string& api_key, + const std::string& app_id, + const std::string& messaging_sender_id, + const std::string& project_id, + const std::string* auth_domain, + const std::string* database_u_r_l, + const std::string* storage_bucket, + const std::string* measurement_id, + const std::string* tracking_id, + const std::string* deep_link_u_r_l_scheme, + const std::string* android_client_id, + const std::string* ios_client_id, + const std::string* ios_bundle_id, + const std::string* app_group_id) + : api_key_(api_key), + app_id_(app_id), + messaging_sender_id_(messaging_sender_id), + project_id_(project_id), + auth_domain_(auth_domain ? std::optional(*auth_domain) : std::nullopt), + database_u_r_l_(database_u_r_l ? std::optional(*database_u_r_l) : std::nullopt), + storage_bucket_(storage_bucket ? std::optional(*storage_bucket) : std::nullopt), + measurement_id_(measurement_id ? std::optional(*measurement_id) : std::nullopt), + tracking_id_(tracking_id ? std::optional(*tracking_id) : std::nullopt), + deep_link_u_r_l_scheme_(deep_link_u_r_l_scheme ? std::optional(*deep_link_u_r_l_scheme) : std::nullopt), + android_client_id_(android_client_id ? std::optional(*android_client_id) : std::nullopt), + ios_client_id_(ios_client_id ? std::optional(*ios_client_id) : std::nullopt), + ios_bundle_id_(ios_bundle_id ? std::optional(*ios_bundle_id) : std::nullopt), + app_group_id_(app_group_id ? std::optional(*app_group_id) : std::nullopt) {} + +const std::string& CoreFirebaseOptions::api_key() const { + return api_key_; +} void CoreFirebaseOptions::set_api_key(std::string_view value_arg) { api_key_ = value_arg; } -const std::string& CoreFirebaseOptions::app_id() const { return app_id_; } + +const std::string& CoreFirebaseOptions::app_id() const { + return app_id_; +} void CoreFirebaseOptions::set_app_id(std::string_view value_arg) { app_id_ = value_arg; } + const std::string& CoreFirebaseOptions::messaging_sender_id() const { return messaging_sender_id_; } @@ -313,6 +296,7 @@ void CoreFirebaseOptions::set_messaging_sender_id(std::string_view value_arg) { messaging_sender_id_ = value_arg; } + const std::string& CoreFirebaseOptions::project_id() const { return project_id_; } @@ -321,194 +305,163 @@ void CoreFirebaseOptions::set_project_id(std::string_view value_arg) { project_id_ = value_arg; } + const std::string* CoreFirebaseOptions::auth_domain() const { return auth_domain_ ? &(*auth_domain_) : nullptr; } void CoreFirebaseOptions::set_auth_domain(const std::string_view* value_arg) { - auth_domain_ = - value_arg ? std::optional(*value_arg) : std::nullopt; + auth_domain_ = value_arg ? std::optional(*value_arg) : std::nullopt; } void CoreFirebaseOptions::set_auth_domain(std::string_view value_arg) { auth_domain_ = value_arg; } + const std::string* CoreFirebaseOptions::database_u_r_l() const { return database_u_r_l_ ? &(*database_u_r_l_) : nullptr; } -void CoreFirebaseOptions::set_database_u_r_l( - const std::string_view* value_arg) { - database_u_r_l_ = - value_arg ? std::optional(*value_arg) : std::nullopt; +void CoreFirebaseOptions::set_database_u_r_l(const std::string_view* value_arg) { + database_u_r_l_ = value_arg ? std::optional(*value_arg) : std::nullopt; } void CoreFirebaseOptions::set_database_u_r_l(std::string_view value_arg) { database_u_r_l_ = value_arg; } + const std::string* CoreFirebaseOptions::storage_bucket() const { return storage_bucket_ ? &(*storage_bucket_) : nullptr; } -void CoreFirebaseOptions::set_storage_bucket( - const std::string_view* value_arg) { - storage_bucket_ = - value_arg ? std::optional(*value_arg) : std::nullopt; +void CoreFirebaseOptions::set_storage_bucket(const std::string_view* value_arg) { + storage_bucket_ = value_arg ? std::optional(*value_arg) : std::nullopt; } void CoreFirebaseOptions::set_storage_bucket(std::string_view value_arg) { storage_bucket_ = value_arg; } + const std::string* CoreFirebaseOptions::measurement_id() const { return measurement_id_ ? &(*measurement_id_) : nullptr; } -void CoreFirebaseOptions::set_measurement_id( - const std::string_view* value_arg) { - measurement_id_ = - value_arg ? std::optional(*value_arg) : std::nullopt; +void CoreFirebaseOptions::set_measurement_id(const std::string_view* value_arg) { + measurement_id_ = value_arg ? std::optional(*value_arg) : std::nullopt; } void CoreFirebaseOptions::set_measurement_id(std::string_view value_arg) { measurement_id_ = value_arg; } + const std::string* CoreFirebaseOptions::tracking_id() const { return tracking_id_ ? &(*tracking_id_) : nullptr; } void CoreFirebaseOptions::set_tracking_id(const std::string_view* value_arg) { - tracking_id_ = - value_arg ? std::optional(*value_arg) : std::nullopt; + tracking_id_ = value_arg ? std::optional(*value_arg) : std::nullopt; } void CoreFirebaseOptions::set_tracking_id(std::string_view value_arg) { tracking_id_ = value_arg; } + const std::string* CoreFirebaseOptions::deep_link_u_r_l_scheme() const { return deep_link_u_r_l_scheme_ ? &(*deep_link_u_r_l_scheme_) : nullptr; } -void CoreFirebaseOptions::set_deep_link_u_r_l_scheme( - const std::string_view* value_arg) { - deep_link_u_r_l_scheme_ = - value_arg ? std::optional(*value_arg) : std::nullopt; +void CoreFirebaseOptions::set_deep_link_u_r_l_scheme(const std::string_view* value_arg) { + deep_link_u_r_l_scheme_ = value_arg ? std::optional(*value_arg) : std::nullopt; } -void CoreFirebaseOptions::set_deep_link_u_r_l_scheme( - std::string_view value_arg) { +void CoreFirebaseOptions::set_deep_link_u_r_l_scheme(std::string_view value_arg) { deep_link_u_r_l_scheme_ = value_arg; } + const std::string* CoreFirebaseOptions::android_client_id() const { return android_client_id_ ? &(*android_client_id_) : nullptr; } -void CoreFirebaseOptions::set_android_client_id( - const std::string_view* value_arg) { - android_client_id_ = - value_arg ? std::optional(*value_arg) : std::nullopt; +void CoreFirebaseOptions::set_android_client_id(const std::string_view* value_arg) { + android_client_id_ = value_arg ? std::optional(*value_arg) : std::nullopt; } void CoreFirebaseOptions::set_android_client_id(std::string_view value_arg) { android_client_id_ = value_arg; } + const std::string* CoreFirebaseOptions::ios_client_id() const { return ios_client_id_ ? &(*ios_client_id_) : nullptr; } void CoreFirebaseOptions::set_ios_client_id(const std::string_view* value_arg) { - ios_client_id_ = - value_arg ? std::optional(*value_arg) : std::nullopt; + ios_client_id_ = value_arg ? std::optional(*value_arg) : std::nullopt; } void CoreFirebaseOptions::set_ios_client_id(std::string_view value_arg) { ios_client_id_ = value_arg; } + const std::string* CoreFirebaseOptions::ios_bundle_id() const { return ios_bundle_id_ ? &(*ios_bundle_id_) : nullptr; } void CoreFirebaseOptions::set_ios_bundle_id(const std::string_view* value_arg) { - ios_bundle_id_ = - value_arg ? std::optional(*value_arg) : std::nullopt; + ios_bundle_id_ = value_arg ? std::optional(*value_arg) : std::nullopt; } void CoreFirebaseOptions::set_ios_bundle_id(std::string_view value_arg) { ios_bundle_id_ = value_arg; } + const std::string* CoreFirebaseOptions::app_group_id() const { return app_group_id_ ? &(*app_group_id_) : nullptr; } void CoreFirebaseOptions::set_app_group_id(const std::string_view* value_arg) { - app_group_id_ = - value_arg ? std::optional(*value_arg) : std::nullopt; + app_group_id_ = value_arg ? std::optional(*value_arg) : std::nullopt; } void CoreFirebaseOptions::set_app_group_id(std::string_view value_arg) { app_group_id_ = value_arg; } -const std::string* CoreFirebaseOptions::recaptcha_site_key() const { - return recaptcha_site_key_ ? &(*recaptcha_site_key_) : nullptr; -} - -void CoreFirebaseOptions::set_recaptcha_site_key( - const std::string_view* value_arg) { - recaptcha_site_key_ = - value_arg ? std::optional(*value_arg) : std::nullopt; -} - -void CoreFirebaseOptions::set_recaptcha_site_key(std::string_view value_arg) { - recaptcha_site_key_ = value_arg; -} EncodableList CoreFirebaseOptions::ToEncodableList() const { EncodableList list; - list.reserve(15); + list.reserve(14); list.push_back(EncodableValue(api_key_)); list.push_back(EncodableValue(app_id_)); list.push_back(EncodableValue(messaging_sender_id_)); list.push_back(EncodableValue(project_id_)); - list.push_back(auth_domain_ ? EncodableValue(*auth_domain_) - : EncodableValue()); - list.push_back(database_u_r_l_ ? EncodableValue(*database_u_r_l_) - : EncodableValue()); - list.push_back(storage_bucket_ ? EncodableValue(*storage_bucket_) - : EncodableValue()); - list.push_back(measurement_id_ ? EncodableValue(*measurement_id_) - : EncodableValue()); - list.push_back(tracking_id_ ? EncodableValue(*tracking_id_) - : EncodableValue()); - list.push_back(deep_link_u_r_l_scheme_ - ? EncodableValue(*deep_link_u_r_l_scheme_) - : EncodableValue()); - list.push_back(android_client_id_ ? EncodableValue(*android_client_id_) - : EncodableValue()); - list.push_back(ios_client_id_ ? EncodableValue(*ios_client_id_) - : EncodableValue()); - list.push_back(ios_bundle_id_ ? EncodableValue(*ios_bundle_id_) - : EncodableValue()); - list.push_back(app_group_id_ ? EncodableValue(*app_group_id_) - : EncodableValue()); - list.push_back(recaptcha_site_key_ ? EncodableValue(*recaptcha_site_key_) - : EncodableValue()); + list.push_back(auth_domain_ ? EncodableValue(*auth_domain_) : EncodableValue()); + list.push_back(database_u_r_l_ ? EncodableValue(*database_u_r_l_) : EncodableValue()); + list.push_back(storage_bucket_ ? EncodableValue(*storage_bucket_) : EncodableValue()); + list.push_back(measurement_id_ ? EncodableValue(*measurement_id_) : EncodableValue()); + list.push_back(tracking_id_ ? EncodableValue(*tracking_id_) : EncodableValue()); + list.push_back(deep_link_u_r_l_scheme_ ? EncodableValue(*deep_link_u_r_l_scheme_) : EncodableValue()); + list.push_back(android_client_id_ ? EncodableValue(*android_client_id_) : EncodableValue()); + list.push_back(ios_client_id_ ? EncodableValue(*ios_client_id_) : EncodableValue()); + list.push_back(ios_bundle_id_ ? EncodableValue(*ios_bundle_id_) : EncodableValue()); + list.push_back(app_group_id_ ? EncodableValue(*app_group_id_) : EncodableValue()); return list; } -CoreFirebaseOptions CoreFirebaseOptions::FromEncodableList( - const EncodableList& list) { +CoreFirebaseOptions CoreFirebaseOptions::FromEncodableList(const EncodableList& list) { CoreFirebaseOptions decoded( - std::get(list[0]), std::get(list[1]), - std::get(list[2]), std::get(list[3])); + std::get(list[0]), + std::get(list[1]), + std::get(list[2]), + std::get(list[3])); auto& encodable_auth_domain = list[4]; if (!encodable_auth_domain.IsNull()) { decoded.set_auth_domain(std::get(encodable_auth_domain)); @@ -531,13 +484,11 @@ CoreFirebaseOptions CoreFirebaseOptions::FromEncodableList( } auto& encodable_deep_link_u_r_l_scheme = list[9]; if (!encodable_deep_link_u_r_l_scheme.IsNull()) { - decoded.set_deep_link_u_r_l_scheme( - std::get(encodable_deep_link_u_r_l_scheme)); + decoded.set_deep_link_u_r_l_scheme(std::get(encodable_deep_link_u_r_l_scheme)); } auto& encodable_android_client_id = list[10]; if (!encodable_android_client_id.IsNull()) { - decoded.set_android_client_id( - std::get(encodable_android_client_id)); + decoded.set_android_client_id(std::get(encodable_android_client_id)); } auto& encodable_ios_client_id = list[11]; if (!encodable_ios_client_id.IsNull()) { @@ -551,34 +502,11 @@ CoreFirebaseOptions CoreFirebaseOptions::FromEncodableList( if (!encodable_app_group_id.IsNull()) { decoded.set_app_group_id(std::get(encodable_app_group_id)); } - auto& encodable_recaptcha_site_key = list[14]; - if (!encodable_recaptcha_site_key.IsNull()) { - decoded.set_recaptcha_site_key( - std::get(encodable_recaptcha_site_key)); - } return decoded; } bool CoreFirebaseOptions::operator==(const CoreFirebaseOptions& other) const { - return PigeonInternalDeepEquals(api_key_, other.api_key_) && - PigeonInternalDeepEquals(app_id_, other.app_id_) && - PigeonInternalDeepEquals(messaging_sender_id_, - other.messaging_sender_id_) && - PigeonInternalDeepEquals(project_id_, other.project_id_) && - PigeonInternalDeepEquals(auth_domain_, other.auth_domain_) && - PigeonInternalDeepEquals(database_u_r_l_, other.database_u_r_l_) && - PigeonInternalDeepEquals(storage_bucket_, other.storage_bucket_) && - PigeonInternalDeepEquals(measurement_id_, other.measurement_id_) && - PigeonInternalDeepEquals(tracking_id_, other.tracking_id_) && - PigeonInternalDeepEquals(deep_link_u_r_l_scheme_, - other.deep_link_u_r_l_scheme_) && - PigeonInternalDeepEquals(android_client_id_, - other.android_client_id_) && - PigeonInternalDeepEquals(ios_client_id_, other.ios_client_id_) && - PigeonInternalDeepEquals(ios_bundle_id_, other.ios_bundle_id_) && - PigeonInternalDeepEquals(app_group_id_, other.app_group_id_) && - PigeonInternalDeepEquals(recaptcha_site_key_, - other.recaptcha_site_key_); + return PigeonInternalDeepEquals(api_key_, other.api_key_) && PigeonInternalDeepEquals(app_id_, other.app_id_) && PigeonInternalDeepEquals(messaging_sender_id_, other.messaging_sender_id_) && PigeonInternalDeepEquals(project_id_, other.project_id_) && PigeonInternalDeepEquals(auth_domain_, other.auth_domain_) && PigeonInternalDeepEquals(database_u_r_l_, other.database_u_r_l_) && PigeonInternalDeepEquals(storage_bucket_, other.storage_bucket_) && PigeonInternalDeepEquals(measurement_id_, other.measurement_id_) && PigeonInternalDeepEquals(tracking_id_, other.tracking_id_) && PigeonInternalDeepEquals(deep_link_u_r_l_scheme_, other.deep_link_u_r_l_scheme_) && PigeonInternalDeepEquals(android_client_id_, other.android_client_id_) && PigeonInternalDeepEquals(ios_client_id_, other.ios_client_id_) && PigeonInternalDeepEquals(ios_bundle_id_, other.ios_bundle_id_) && PigeonInternalDeepEquals(app_group_id_, other.app_group_id_); } bool CoreFirebaseOptions::operator!=(const CoreFirebaseOptions& other) const { @@ -601,60 +529,56 @@ size_t CoreFirebaseOptions::Hash() const { result = result * 31 + PigeonInternalDeepHash(ios_client_id_); result = result * 31 + PigeonInternalDeepHash(ios_bundle_id_); result = result * 31 + PigeonInternalDeepHash(app_group_id_); - result = result * 31 + PigeonInternalDeepHash(recaptcha_site_key_); return result; } -size_t PigeonInternalDeepHash(const CoreFirebaseOptions& v) { return v.Hash(); } +size_t PigeonInternalDeepHash(const CoreFirebaseOptions& v) { + return v.Hash(); +} // CoreInitializeResponse CoreInitializeResponse::CoreInitializeResponse( - const std::string& name, const CoreFirebaseOptions& options, - const EncodableMap& plugin_constants) - : name_(name), - options_(std::make_unique(options)), - plugin_constants_(plugin_constants) {} - -CoreInitializeResponse::CoreInitializeResponse( - const std::string& name, const CoreFirebaseOptions& options, - const bool* is_automatic_data_collection_enabled, - const EncodableMap& plugin_constants) - : name_(name), - options_(std::make_unique(options)), - is_automatic_data_collection_enabled_( - is_automatic_data_collection_enabled - ? std::optional(*is_automatic_data_collection_enabled) - : std::nullopt), - plugin_constants_(plugin_constants) {} + const std::string& name, + const CoreFirebaseOptions& options, + const EncodableMap& plugin_constants) + : name_(name), + options_(std::make_unique(options)), + plugin_constants_(plugin_constants) {} CoreInitializeResponse::CoreInitializeResponse( - const CoreInitializeResponse& other) - : name_(other.name_), - options_(std::make_unique(*other.options_)), - is_automatic_data_collection_enabled_( - other.is_automatic_data_collection_enabled_ - ? std::optional( - *other.is_automatic_data_collection_enabled_) - : std::nullopt), - plugin_constants_(other.plugin_constants_) {} - -CoreInitializeResponse& CoreInitializeResponse::operator=( - const CoreInitializeResponse& other) { + const std::string& name, + const CoreFirebaseOptions& options, + const bool* is_automatic_data_collection_enabled, + const EncodableMap& plugin_constants) + : name_(name), + options_(std::make_unique(options)), + is_automatic_data_collection_enabled_(is_automatic_data_collection_enabled ? std::optional(*is_automatic_data_collection_enabled) : std::nullopt), + plugin_constants_(plugin_constants) {} + +CoreInitializeResponse::CoreInitializeResponse(const CoreInitializeResponse& other) + : name_(other.name_), + options_(std::make_unique(*other.options_)), + is_automatic_data_collection_enabled_(other.is_automatic_data_collection_enabled_ ? std::optional(*other.is_automatic_data_collection_enabled_) : std::nullopt), + plugin_constants_(other.plugin_constants_) {} + +CoreInitializeResponse& CoreInitializeResponse::operator=(const CoreInitializeResponse& other) { name_ = other.name_; options_ = std::make_unique(*other.options_); - is_automatic_data_collection_enabled_ = - other.is_automatic_data_collection_enabled_; + is_automatic_data_collection_enabled_ = other.is_automatic_data_collection_enabled_; plugin_constants_ = other.plugin_constants_; return *this; } -const std::string& CoreInitializeResponse::name() const { return name_; } +const std::string& CoreInitializeResponse::name() const { + return name_; +} void CoreInitializeResponse::set_name(std::string_view value_arg) { name_ = value_arg; } + const CoreFirebaseOptions& CoreInitializeResponse::options() const { return *options_; } @@ -663,71 +587,56 @@ void CoreInitializeResponse::set_options(const CoreFirebaseOptions& value_arg) { options_ = std::make_unique(value_arg); } -const bool* CoreInitializeResponse::is_automatic_data_collection_enabled() - const { - return is_automatic_data_collection_enabled_ - ? &(*is_automatic_data_collection_enabled_) - : nullptr; + +const bool* CoreInitializeResponse::is_automatic_data_collection_enabled() const { + return is_automatic_data_collection_enabled_ ? &(*is_automatic_data_collection_enabled_) : nullptr; } -void CoreInitializeResponse::set_is_automatic_data_collection_enabled( - const bool* value_arg) { - is_automatic_data_collection_enabled_ = - value_arg ? std::optional(*value_arg) : std::nullopt; +void CoreInitializeResponse::set_is_automatic_data_collection_enabled(const bool* value_arg) { + is_automatic_data_collection_enabled_ = value_arg ? std::optional(*value_arg) : std::nullopt; } -void CoreInitializeResponse::set_is_automatic_data_collection_enabled( - bool value_arg) { +void CoreInitializeResponse::set_is_automatic_data_collection_enabled(bool value_arg) { is_automatic_data_collection_enabled_ = value_arg; } + const EncodableMap& CoreInitializeResponse::plugin_constants() const { return plugin_constants_; } -void CoreInitializeResponse::set_plugin_constants( - const EncodableMap& value_arg) { +void CoreInitializeResponse::set_plugin_constants(const EncodableMap& value_arg) { plugin_constants_ = value_arg; } + EncodableList CoreInitializeResponse::ToEncodableList() const { EncodableList list; list.reserve(4); list.push_back(EncodableValue(name_)); list.push_back(CustomEncodableValue(*options_)); - list.push_back(is_automatic_data_collection_enabled_ - ? EncodableValue(*is_automatic_data_collection_enabled_) - : EncodableValue()); + list.push_back(is_automatic_data_collection_enabled_ ? EncodableValue(*is_automatic_data_collection_enabled_) : EncodableValue()); list.push_back(EncodableValue(plugin_constants_)); return list; } -CoreInitializeResponse CoreInitializeResponse::FromEncodableList( - const EncodableList& list) { - CoreInitializeResponse decoded(std::get(list[0]), - std::any_cast( - std::get(list[1])), - std::get(list[3])); +CoreInitializeResponse CoreInitializeResponse::FromEncodableList(const EncodableList& list) { + CoreInitializeResponse decoded( + std::get(list[0]), + std::any_cast(std::get(list[1])), + std::get(list[3])); auto& encodable_is_automatic_data_collection_enabled = list[2]; if (!encodable_is_automatic_data_collection_enabled.IsNull()) { - decoded.set_is_automatic_data_collection_enabled( - std::get(encodable_is_automatic_data_collection_enabled)); + decoded.set_is_automatic_data_collection_enabled(std::get(encodable_is_automatic_data_collection_enabled)); } return decoded; } -bool CoreInitializeResponse::operator==( - const CoreInitializeResponse& other) const { - return PigeonInternalDeepEquals(name_, other.name_) && - PigeonInternalDeepEquals(options_, other.options_) && - PigeonInternalDeepEquals( - is_automatic_data_collection_enabled_, - other.is_automatic_data_collection_enabled_) && - PigeonInternalDeepEquals(plugin_constants_, other.plugin_constants_); +bool CoreInitializeResponse::operator==(const CoreInitializeResponse& other) const { + return PigeonInternalDeepEquals(name_, other.name_) && PigeonInternalDeepEquals(options_, other.options_) && PigeonInternalDeepEquals(is_automatic_data_collection_enabled_, other.is_automatic_data_collection_enabled_) && PigeonInternalDeepEquals(plugin_constants_, other.plugin_constants_); } -bool CoreInitializeResponse::operator!=( - const CoreInitializeResponse& other) const { +bool CoreInitializeResponse::operator!=(const CoreInitializeResponse& other) const { return !(*this == other); } @@ -735,8 +644,7 @@ size_t CoreInitializeResponse::Hash() const { size_t result = 1; result = result * 31 + PigeonInternalDeepHash(name_); result = result * 31 + PigeonInternalDeepHash(options_); - result = result * 31 + - PigeonInternalDeepHash(is_automatic_data_collection_enabled_); + result = result * 31 + PigeonInternalDeepHash(is_automatic_data_collection_enabled_); result = result * 31 + PigeonInternalDeepHash(plugin_constants_); return result; } @@ -745,42 +653,36 @@ size_t PigeonInternalDeepHash(const CoreInitializeResponse& v) { return v.Hash(); } + PigeonInternalCodecSerializer::PigeonInternalCodecSerializer() {} EncodableValue PigeonInternalCodecSerializer::ReadValueOfType( - uint8_t type, ::flutter::ByteStreamReader* stream) const { + uint8_t type, + ::flutter::ByteStreamReader* stream) const { switch (type) { case 129: { - return CustomEncodableValue(CoreFirebaseOptions::FromEncodableList( - std::get(ReadValue(stream)))); - } + return CustomEncodableValue(CoreFirebaseOptions::FromEncodableList(std::get(ReadValue(stream)))); + } case 130: { - return CustomEncodableValue(CoreInitializeResponse::FromEncodableList( - std::get(ReadValue(stream)))); - } + return CustomEncodableValue(CoreInitializeResponse::FromEncodableList(std::get(ReadValue(stream)))); + } default: return ::flutter::StandardCodecSerializer::ReadValueOfType(type, stream); - } + } } void PigeonInternalCodecSerializer::WriteValue( - const EncodableValue& value, ::flutter::ByteStreamWriter* stream) const { - if (const CustomEncodableValue* custom_value = - std::get_if(&value)) { + const EncodableValue& value, + ::flutter::ByteStreamWriter* stream) const { + if (const CustomEncodableValue* custom_value = std::get_if(&value)) { if (custom_value->type() == typeid(CoreFirebaseOptions)) { stream->WriteByte(129); - WriteValue( - EncodableValue(std::any_cast(*custom_value) - .ToEncodableList()), - stream); + WriteValue(EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); return; } if (custom_value->type() == typeid(CoreInitializeResponse)) { stream->WriteByte(130); - WriteValue( - EncodableValue(std::any_cast(*custom_value) - .ToEncodableList()), - stream); + WriteValue(EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); return; } } @@ -789,131 +691,96 @@ void PigeonInternalCodecSerializer::WriteValue( /// The codec used by FirebaseCoreHostApi. const ::flutter::StandardMessageCodec& FirebaseCoreHostApi::GetCodec() { - return ::flutter::StandardMessageCodec::GetInstance( - &PigeonInternalCodecSerializer::GetInstance()); + return ::flutter::StandardMessageCodec::GetInstance(&PigeonInternalCodecSerializer::GetInstance()); } -// Sets up an instance of `FirebaseCoreHostApi` to handle messages through the -// `binary_messenger`. -void FirebaseCoreHostApi::SetUp(::flutter::BinaryMessenger* binary_messenger, - FirebaseCoreHostApi* api) { +// Sets up an instance of `FirebaseCoreHostApi` to handle messages through the `binary_messenger`. +void FirebaseCoreHostApi::SetUp( + ::flutter::BinaryMessenger* binary_messenger, + FirebaseCoreHostApi* api) { FirebaseCoreHostApi::SetUp(binary_messenger, api, ""); } -void FirebaseCoreHostApi::SetUp(::flutter::BinaryMessenger* binary_messenger, - FirebaseCoreHostApi* api, - const std::string& message_channel_suffix) { - const std::string prepended_suffix = - message_channel_suffix.length() > 0 - ? std::string(".") + message_channel_suffix - : ""; +void FirebaseCoreHostApi::SetUp( + ::flutter::BinaryMessenger* binary_messenger, + FirebaseCoreHostApi* api, + const std::string& message_channel_suffix) { + const std::string prepended_suffix = message_channel_suffix.length() > 0 ? std::string(".") + message_channel_suffix : ""; { - BasicMessageChannel<> channel( - binary_messenger, - "dev.flutter.pigeon.firebase_core_platform_interface." - "FirebaseCoreHostApi.initializeApp" + - prepended_suffix, - &GetCodec()); + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeApp" + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler( - [api](const EncodableValue& message, - const ::flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_app_name_arg = args.at(0); - if (encodable_app_name_arg.IsNull()) { - reply(WrapError("app_name_arg unexpectedly null.")); - return; - } - const auto& app_name_arg = - std::get(encodable_app_name_arg); - const auto& encodable_initialize_app_request_arg = args.at(1); - if (encodable_initialize_app_request_arg.IsNull()) { - reply( - WrapError("initialize_app_request_arg unexpectedly null.")); - return; - } - const auto& initialize_app_request_arg = - std::any_cast( - std::get( - encodable_initialize_app_request_arg)); - api->InitializeApp( - app_name_arg, initialize_app_request_arg, - [reply](ErrorOr&& output) { - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - EncodableList wrapped; - wrapped.push_back( - CustomEncodableValue(std::move(output).TakeValue())); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); + channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_app_name_arg = args.at(0); + if (encodable_app_name_arg.IsNull()) { + reply(WrapError("app_name_arg unexpectedly null.")); + return; + } + const auto& app_name_arg = std::get(encodable_app_name_arg); + const auto& encodable_initialize_app_request_arg = args.at(1); + if (encodable_initialize_app_request_arg.IsNull()) { + reply(WrapError("initialize_app_request_arg unexpectedly null.")); + return; + } + const auto& initialize_app_request_arg = std::any_cast(std::get(encodable_initialize_app_request_arg)); + api->InitializeApp(app_name_arg, initialize_app_request_arg, [reply](ErrorOr&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; } + EncodableList wrapped; + wrapped.push_back(CustomEncodableValue(std::move(output).TakeValue())); + reply(EncodableValue(std::move(wrapped))); }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel.SetMessageHandler(nullptr); } } { - BasicMessageChannel<> channel( - binary_messenger, - "dev.flutter.pigeon.firebase_core_platform_interface." - "FirebaseCoreHostApi.initializeCore" + - prepended_suffix, - &GetCodec()); + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeCore" + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler( - [api](const EncodableValue& message, - const ::flutter::MessageReply& reply) { - try { - api->InitializeCore([reply](ErrorOr&& output) { - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - EncodableList wrapped; - wrapped.push_back( - EncodableValue(std::move(output).TakeValue())); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); + channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { + try { + api->InitializeCore([reply](ErrorOr&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; } + EncodableList wrapped; + wrapped.push_back(EncodableValue(std::move(output).TakeValue())); + reply(EncodableValue(std::move(wrapped))); }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel.SetMessageHandler(nullptr); } } { - BasicMessageChannel<> channel( - binary_messenger, - "dev.flutter.pigeon.firebase_core_platform_interface." - "FirebaseCoreHostApi.optionsFromResource" + - prepended_suffix, - &GetCodec()); + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.optionsFromResource" + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler( - [api](const EncodableValue& message, - const ::flutter::MessageReply& reply) { - try { - api->OptionsFromResource( - [reply](ErrorOr&& output) { - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - EncodableList wrapped; - wrapped.push_back( - CustomEncodableValue(std::move(output).TakeValue())); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); + channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { + try { + api->OptionsFromResource([reply](ErrorOr&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; } + EncodableList wrapped; + wrapped.push_back(CustomEncodableValue(std::move(output).TakeValue())); + reply(EncodableValue(std::move(wrapped))); }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel.SetMessageHandler(nullptr); } @@ -921,160 +788,133 @@ void FirebaseCoreHostApi::SetUp(::flutter::BinaryMessenger* binary_messenger, } EncodableValue FirebaseCoreHostApi::WrapError(std::string_view error_message) { - return EncodableValue( - EncodableList{EncodableValue(std::string(error_message)), - EncodableValue("Error"), EncodableValue()}); + return EncodableValue(EncodableList{ + EncodableValue(std::string(error_message)), + EncodableValue("Error"), + EncodableValue() + }); } EncodableValue FirebaseCoreHostApi::WrapError(const FlutterError& error) { - return EncodableValue(EncodableList{EncodableValue(error.code()), - EncodableValue(error.message()), - error.details()}); + return EncodableValue(EncodableList{ + EncodableValue(error.code()), + EncodableValue(error.message()), + error.details() + }); } /// The codec used by FirebaseAppHostApi. const ::flutter::StandardMessageCodec& FirebaseAppHostApi::GetCodec() { - return ::flutter::StandardMessageCodec::GetInstance( - &PigeonInternalCodecSerializer::GetInstance()); + return ::flutter::StandardMessageCodec::GetInstance(&PigeonInternalCodecSerializer::GetInstance()); } -// Sets up an instance of `FirebaseAppHostApi` to handle messages through the -// `binary_messenger`. -void FirebaseAppHostApi::SetUp(::flutter::BinaryMessenger* binary_messenger, - FirebaseAppHostApi* api) { +// Sets up an instance of `FirebaseAppHostApi` to handle messages through the `binary_messenger`. +void FirebaseAppHostApi::SetUp( + ::flutter::BinaryMessenger* binary_messenger, + FirebaseAppHostApi* api) { FirebaseAppHostApi::SetUp(binary_messenger, api, ""); } -void FirebaseAppHostApi::SetUp(::flutter::BinaryMessenger* binary_messenger, - FirebaseAppHostApi* api, - const std::string& message_channel_suffix) { - const std::string prepended_suffix = - message_channel_suffix.length() > 0 - ? std::string(".") + message_channel_suffix - : ""; +void FirebaseAppHostApi::SetUp( + ::flutter::BinaryMessenger* binary_messenger, + FirebaseAppHostApi* api, + const std::string& message_channel_suffix) { + const std::string prepended_suffix = message_channel_suffix.length() > 0 ? std::string(".") + message_channel_suffix : ""; { - BasicMessageChannel<> channel( - binary_messenger, - "dev.flutter.pigeon.firebase_core_platform_interface." - "FirebaseAppHostApi.setAutomaticDataCollectionEnabled" + - prepended_suffix, - &GetCodec()); + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticDataCollectionEnabled" + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler( - [api](const EncodableValue& message, - const ::flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_app_name_arg = args.at(0); - if (encodable_app_name_arg.IsNull()) { - reply(WrapError("app_name_arg unexpectedly null.")); - return; - } - const auto& app_name_arg = - std::get(encodable_app_name_arg); - const auto& encodable_enabled_arg = args.at(1); - if (encodable_enabled_arg.IsNull()) { - reply(WrapError("enabled_arg unexpectedly null.")); - return; - } - const auto& enabled_arg = std::get(encodable_enabled_arg); - api->SetAutomaticDataCollectionEnabled( - app_name_arg, enabled_arg, - [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); + channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_app_name_arg = args.at(0); + if (encodable_app_name_arg.IsNull()) { + reply(WrapError("app_name_arg unexpectedly null.")); + return; + } + const auto& app_name_arg = std::get(encodable_app_name_arg); + const auto& encodable_enabled_arg = args.at(1); + if (encodable_enabled_arg.IsNull()) { + reply(WrapError("enabled_arg unexpectedly null.")); + return; + } + const auto& enabled_arg = std::get(encodable_enabled_arg); + api->SetAutomaticDataCollectionEnabled(app_name_arg, enabled_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel.SetMessageHandler(nullptr); } } { - BasicMessageChannel<> channel( - binary_messenger, - "dev.flutter.pigeon.firebase_core_platform_interface." - "FirebaseAppHostApi.setAutomaticResourceManagementEnabled" + - prepended_suffix, - &GetCodec()); + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticResourceManagementEnabled" + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler( - [api](const EncodableValue& message, - const ::flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_app_name_arg = args.at(0); - if (encodable_app_name_arg.IsNull()) { - reply(WrapError("app_name_arg unexpectedly null.")); - return; - } - const auto& app_name_arg = - std::get(encodable_app_name_arg); - const auto& encodable_enabled_arg = args.at(1); - if (encodable_enabled_arg.IsNull()) { - reply(WrapError("enabled_arg unexpectedly null.")); - return; - } - const auto& enabled_arg = std::get(encodable_enabled_arg); - api->SetAutomaticResourceManagementEnabled( - app_name_arg, enabled_arg, - [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); + channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_app_name_arg = args.at(0); + if (encodable_app_name_arg.IsNull()) { + reply(WrapError("app_name_arg unexpectedly null.")); + return; + } + const auto& app_name_arg = std::get(encodable_app_name_arg); + const auto& encodable_enabled_arg = args.at(1); + if (encodable_enabled_arg.IsNull()) { + reply(WrapError("enabled_arg unexpectedly null.")); + return; + } + const auto& enabled_arg = std::get(encodable_enabled_arg); + api->SetAutomaticResourceManagementEnabled(app_name_arg, enabled_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel.SetMessageHandler(nullptr); } } { - BasicMessageChannel<> channel(binary_messenger, - "dev.flutter.pigeon.firebase_core_platform_" - "interface.FirebaseAppHostApi.delete" + - prepended_suffix, - &GetCodec()); + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.delete" + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler( - [api](const EncodableValue& message, - const ::flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_app_name_arg = args.at(0); - if (encodable_app_name_arg.IsNull()) { - reply(WrapError("app_name_arg unexpectedly null.")); - return; - } - const auto& app_name_arg = - std::get(encodable_app_name_arg); - api->Delete(app_name_arg, - [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); + channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_app_name_arg = args.at(0); + if (encodable_app_name_arg.IsNull()) { + reply(WrapError("app_name_arg unexpectedly null.")); + return; + } + const auto& app_name_arg = std::get(encodable_app_name_arg); + api->Delete(app_name_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel.SetMessageHandler(nullptr); } @@ -1082,15 +922,19 @@ void FirebaseAppHostApi::SetUp(::flutter::BinaryMessenger* binary_messenger, } EncodableValue FirebaseAppHostApi::WrapError(std::string_view error_message) { - return EncodableValue( - EncodableList{EncodableValue(std::string(error_message)), - EncodableValue("Error"), EncodableValue()}); + return EncodableValue(EncodableList{ + EncodableValue(std::string(error_message)), + EncodableValue("Error"), + EncodableValue() + }); } EncodableValue FirebaseAppHostApi::WrapError(const FlutterError& error) { - return EncodableValue(EncodableList{EncodableValue(error.code()), - EncodableValue(error.message()), - error.details()}); + return EncodableValue(EncodableList{ + EncodableValue(error.code()), + EncodableValue(error.message()), + error.details() + }); } } // namespace firebase_core_windows diff --git a/packages/firebase_core/firebase_core/windows/messages.g.h b/packages/firebase_core/firebase_core/windows/messages.g.h index a55996f5b067..942ab224442d 100644 --- a/packages/firebase_core/firebase_core/windows/messages.g.h +++ b/packages/firebase_core/firebase_core/windows/messages.g.h @@ -17,16 +17,17 @@ namespace firebase_core_windows { + // Generated class from Pigeon. class FlutterError { public: - explicit FlutterError(const std::string& code) : code_(code) {} + explicit FlutterError(const std::string& code) + : code_(code) {} explicit FlutterError(const std::string& code, const std::string& message) - : code_(code), message_(message) {} - explicit FlutterError(const std::string& code, const std::string& message, - const ::flutter::EncodableValue& details) - : code_(code), message_(message), details_(details) {} + : code_(code), message_(message) {} + explicit FlutterError(const std::string& code, const std::string& message, const ::flutter::EncodableValue& details) + : code_(code), message_(message), details_(details) {} const std::string& code() const { return code_; } const std::string& message() const { return message_; } @@ -38,8 +39,7 @@ class FlutterError { ::flutter::EncodableValue details_; }; -template -class ErrorOr { +template class ErrorOr { public: ErrorOr(const T& rhs) : v_(rhs) {} ErrorOr(const T&& rhs) : v_(std::move(rhs)) {} @@ -59,25 +59,34 @@ class ErrorOr { std::variant v_; }; + + // Generated class from Pigeon that represents data sent in messages. class CoreFirebaseOptions { public: // Constructs an object setting all non-nullable fields. - explicit CoreFirebaseOptions(const std::string& api_key, - const std::string& app_id, - const std::string& messaging_sender_id, - const std::string& project_id); + explicit CoreFirebaseOptions( + const std::string& api_key, + const std::string& app_id, + const std::string& messaging_sender_id, + const std::string& project_id); // Constructs an object setting all fields. explicit CoreFirebaseOptions( - const std::string& api_key, const std::string& app_id, - const std::string& messaging_sender_id, const std::string& project_id, - const std::string* auth_domain, const std::string* database_u_r_l, - const std::string* storage_bucket, const std::string* measurement_id, - const std::string* tracking_id, const std::string* deep_link_u_r_l_scheme, - const std::string* android_client_id, const std::string* ios_client_id, - const std::string* ios_bundle_id, const std::string* app_group_id, - const std::string* recaptcha_site_key); + const std::string& api_key, + const std::string& app_id, + const std::string& messaging_sender_id, + const std::string& project_id, + const std::string* auth_domain, + const std::string* database_u_r_l, + const std::string* storage_bucket, + const std::string* measurement_id, + const std::string* tracking_id, + const std::string* deep_link_u_r_l_scheme, + const std::string* android_client_id, + const std::string* ios_client_id, + const std::string* ios_bundle_id, + const std::string* app_group_id); const std::string& api_key() const; void set_api_key(std::string_view value_arg); @@ -131,24 +140,13 @@ class CoreFirebaseOptions { void set_app_group_id(const std::string_view* value_arg); void set_app_group_id(std::string_view value_arg); - const std::string* recaptcha_site_key() const; - void set_recaptcha_site_key(const std::string_view* value_arg); - void set_recaptcha_site_key(std::string_view value_arg); - bool operator==(const CoreFirebaseOptions& other) const; bool operator!=(const CoreFirebaseOptions& other) const; - /// Returns a hash code value for the object. This method is supported for the - /// benefit of hash tables. + /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; - private: - static CoreFirebaseOptions FromEncodableList( - const ::flutter::EncodableList& list); - - public: + static CoreFirebaseOptions FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; - - private: friend class CoreInitializeResponse; friend class FirebaseCoreHostApi; friend class FirebaseAppHostApi; @@ -167,29 +165,30 @@ class CoreFirebaseOptions { std::optional ios_client_id_; std::optional ios_bundle_id_; std::optional app_group_id_; - std::optional recaptcha_site_key_; }; + // Generated class from Pigeon that represents data sent in messages. class CoreInitializeResponse { public: // Constructs an object setting all non-nullable fields. explicit CoreInitializeResponse( - const std::string& name, const CoreFirebaseOptions& options, - const ::flutter::EncodableMap& plugin_constants); + const std::string& name, + const CoreFirebaseOptions& options, + const ::flutter::EncodableMap& plugin_constants); // Constructs an object setting all fields. explicit CoreInitializeResponse( - const std::string& name, const CoreFirebaseOptions& options, - const bool* is_automatic_data_collection_enabled, - const ::flutter::EncodableMap& plugin_constants); + const std::string& name, + const CoreFirebaseOptions& options, + const bool* is_automatic_data_collection_enabled, + const ::flutter::EncodableMap& plugin_constants); ~CoreInitializeResponse() = default; CoreInitializeResponse(const CoreInitializeResponse& other); CoreInitializeResponse& operator=(const CoreInitializeResponse& other); CoreInitializeResponse(CoreInitializeResponse&& other) = default; - CoreInitializeResponse& operator=(CoreInitializeResponse&& other) noexcept = - default; + CoreInitializeResponse& operator=(CoreInitializeResponse&& other) noexcept = default; const std::string& name() const; void set_name(std::string_view value_arg); @@ -205,18 +204,11 @@ class CoreInitializeResponse { bool operator==(const CoreInitializeResponse& other) const; bool operator!=(const CoreInitializeResponse& other) const; - /// Returns a hash code value for the object. This method is supported for the - /// benefit of hash tables. + /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; - private: - static CoreInitializeResponse FromEncodableList( - const ::flutter::EncodableList& list); - - public: + static CoreInitializeResponse FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; - - private: friend class FirebaseCoreHostApi; friend class FirebaseAppHostApi; friend class PigeonInternalCodecSerializer; @@ -226,8 +218,8 @@ class CoreInitializeResponse { ::flutter::EncodableMap plugin_constants_; }; -class PigeonInternalCodecSerializer - : public ::flutter::StandardCodecSerializer { + +class PigeonInternalCodecSerializer : public ::flutter::StandardCodecSerializer { public: PigeonInternalCodecSerializer(); inline static PigeonInternalCodecSerializer& GetInstance() { @@ -235,74 +227,73 @@ class PigeonInternalCodecSerializer return sInstance; } - void WriteValue(const ::flutter::EncodableValue& value, - ::flutter::ByteStreamWriter* stream) const override; - + void WriteValue( + const ::flutter::EncodableValue& value, + ::flutter::ByteStreamWriter* stream) const override; protected: ::flutter::EncodableValue ReadValueOfType( - uint8_t type, ::flutter::ByteStreamReader* stream) const override; + uint8_t type, + ::flutter::ByteStreamReader* stream) const override; }; -// Generated interface from Pigeon that represents a handler of messages from -// Flutter. +// Generated interface from Pigeon that represents a handler of messages from Flutter. class FirebaseCoreHostApi { public: FirebaseCoreHostApi(const FirebaseCoreHostApi&) = delete; FirebaseCoreHostApi& operator=(const FirebaseCoreHostApi&) = delete; virtual ~FirebaseCoreHostApi() {} virtual void InitializeApp( - const std::string& app_name, - const CoreFirebaseOptions& initialize_app_request, - std::function reply)> result) = 0; - virtual void InitializeCore( - std::function reply)> result) = 0; - virtual void OptionsFromResource( - std::function reply)> result) = 0; + const std::string& app_name, + const CoreFirebaseOptions& initialize_app_request, + std::function reply)> result) = 0; + virtual void InitializeCore(std::function reply)> result) = 0; + virtual void OptionsFromResource(std::function reply)> result) = 0; // The codec used by FirebaseCoreHostApi. static const ::flutter::StandardMessageCodec& GetCodec(); - // Sets up an instance of `FirebaseCoreHostApi` to handle messages through the - // `binary_messenger`. - static void SetUp(::flutter::BinaryMessenger* binary_messenger, - FirebaseCoreHostApi* api); - static void SetUp(::flutter::BinaryMessenger* binary_messenger, - FirebaseCoreHostApi* api, - const std::string& message_channel_suffix); + // Sets up an instance of `FirebaseCoreHostApi` to handle messages through the `binary_messenger`. + static void SetUp( + ::flutter::BinaryMessenger* binary_messenger, + FirebaseCoreHostApi* api); + static void SetUp( + ::flutter::BinaryMessenger* binary_messenger, + FirebaseCoreHostApi* api, + const std::string& message_channel_suffix); static ::flutter::EncodableValue WrapError(std::string_view error_message); static ::flutter::EncodableValue WrapError(const FlutterError& error); - protected: FirebaseCoreHostApi() = default; }; -// Generated interface from Pigeon that represents a handler of messages from -// Flutter. +// Generated interface from Pigeon that represents a handler of messages from Flutter. class FirebaseAppHostApi { public: FirebaseAppHostApi(const FirebaseAppHostApi&) = delete; FirebaseAppHostApi& operator=(const FirebaseAppHostApi&) = delete; virtual ~FirebaseAppHostApi() {} virtual void SetAutomaticDataCollectionEnabled( - const std::string& app_name, bool enabled, - std::function reply)> result) = 0; + const std::string& app_name, + bool enabled, + std::function reply)> result) = 0; virtual void SetAutomaticResourceManagementEnabled( - const std::string& app_name, bool enabled, - std::function reply)> result) = 0; + const std::string& app_name, + bool enabled, + std::function reply)> result) = 0; virtual void Delete( - const std::string& app_name, - std::function reply)> result) = 0; + const std::string& app_name, + std::function reply)> result) = 0; // The codec used by FirebaseAppHostApi. static const ::flutter::StandardMessageCodec& GetCodec(); - // Sets up an instance of `FirebaseAppHostApi` to handle messages through the - // `binary_messenger`. - static void SetUp(::flutter::BinaryMessenger* binary_messenger, - FirebaseAppHostApi* api); - static void SetUp(::flutter::BinaryMessenger* binary_messenger, - FirebaseAppHostApi* api, - const std::string& message_channel_suffix); + // Sets up an instance of `FirebaseAppHostApi` to handle messages through the `binary_messenger`. + static void SetUp( + ::flutter::BinaryMessenger* binary_messenger, + FirebaseAppHostApi* api); + static void SetUp( + ::flutter::BinaryMessenger* binary_messenger, + FirebaseAppHostApi* api, + const std::string& message_channel_suffix); static ::flutter::EncodableValue WrapError(std::string_view error_message); static ::flutter::EncodableValue WrapError(const FlutterError& error); - protected: FirebaseAppHostApi() = default; }; diff --git a/packages/firebase_core/firebase_core_platform_interface/lib/src/firebase_options.dart b/packages/firebase_core/firebase_core_platform_interface/lib/src/firebase_options.dart index dbc740a71ffe..ad0e580e88a8 100644 --- a/packages/firebase_core/firebase_core_platform_interface/lib/src/firebase_options.dart +++ b/packages/firebase_core/firebase_core_platform_interface/lib/src/firebase_options.dart @@ -50,7 +50,6 @@ class FirebaseOptions { this.iosClientId, this.iosBundleId, this.appGroupId, - this.recaptchaSiteKey, }); /// Named constructor to create [FirebaseOptions] from a the response of Pigeon channel. @@ -72,8 +71,7 @@ class FirebaseOptions { androidClientId = options.androidClientId, iosClientId = options.iosClientId, iosBundleId = options.iosBundleId, - appGroupId = options.appGroupId, - recaptchaSiteKey = options.recaptchaSiteKey; + appGroupId = options.appGroupId; /// Returns a copy of this FirebaseOptions with the given fields replaced with /// the new values. @@ -92,7 +90,6 @@ class FirebaseOptions { String? iosClientId, String? iosBundleId, String? appGroupId, - String? recaptchaSiteKey, }) { return FirebaseOptions( apiKey: apiKey ?? this.apiKey, @@ -109,7 +106,6 @@ class FirebaseOptions { iosClientId: iosClientId ?? this.iosClientId, iosBundleId: iosBundleId ?? this.iosBundleId, appGroupId: appGroupId ?? this.appGroupId, - recaptchaSiteKey: recaptchaSiteKey ?? this.recaptchaSiteKey, ); } @@ -178,9 +174,6 @@ class FirebaseOptions { /// This property is used on iOS only. final String? appGroupId; - /// The reCAPTCHA site key used for App Check. - final String? recaptchaSiteKey; - /// The current instance as a [Map]. Map get asMap { return { @@ -198,7 +191,6 @@ class FirebaseOptions { 'iosClientId': iosClientId, 'iosBundleId': iosBundleId, 'appGroupId': appGroupId, - 'recaptchaSiteKey': recaptchaSiteKey, }; } diff --git a/packages/firebase_core/firebase_core_platform_interface/lib/src/method_channel/method_channel_firebase.dart b/packages/firebase_core/firebase_core_platform_interface/lib/src/method_channel/method_channel_firebase.dart index dff6228fdce1..ad3dff75c9de 100644 --- a/packages/firebase_core/firebase_core_platform_interface/lib/src/method_channel/method_channel_firebase.dart +++ b/packages/firebase_core/firebase_core_platform_interface/lib/src/method_channel/method_channel_firebase.dart @@ -49,40 +49,6 @@ class MethodChannelFirebase extends FirebasePlatform { response.pluginConstants; } - CoreInitializeResponse _preserveRecaptchaSiteKey( - CoreInitializeResponse response, - FirebaseOptions options, - ) { - if (response.options.recaptchaSiteKey != null || - options.recaptchaSiteKey == null) { - return response; - } - - return CoreInitializeResponse( - name: response.name, - options: CoreFirebaseOptions( - apiKey: response.options.apiKey, - appId: response.options.appId, - messagingSenderId: response.options.messagingSenderId, - projectId: response.options.projectId, - authDomain: response.options.authDomain, - databaseURL: response.options.databaseURL, - storageBucket: response.options.storageBucket, - measurementId: response.options.measurementId, - trackingId: response.options.trackingId, - deepLinkURLScheme: response.options.deepLinkURLScheme, - androidClientId: response.options.androidClientId, - iosClientId: response.options.iosClientId, - iosBundleId: response.options.iosBundleId, - appGroupId: response.options.appGroupId, - recaptchaSiteKey: options.recaptchaSiteKey, - ), - isAutomaticDataCollectionEnabled: - response.isAutomaticDataCollectionEnabled, - pluginConstants: response.pluginConstants, - ); - } - /// Returns the created [FirebaseAppPlatform] instances. @override List get apps { @@ -123,27 +89,25 @@ class MethodChannelFirebase extends FirebasePlatform { // If no options are present & no default app has been setup, the user is // trying to initialize default from Dart if (defaultApp == null && _options != null) { - _initializeFirebaseAppFromMap(_preserveRecaptchaSiteKey( - await api.initializeApp( - defaultFirebaseAppName, - CoreFirebaseOptions( - apiKey: _options.apiKey, - appId: _options.appId, - messagingSenderId: _options.messagingSenderId, - projectId: _options.projectId, - authDomain: _options.authDomain, - databaseURL: _options.databaseURL, - storageBucket: _options.storageBucket, - measurementId: _options.measurementId, - trackingId: _options.trackingId, - deepLinkURLScheme: _options.deepLinkURLScheme, - androidClientId: _options.androidClientId, - iosClientId: _options.iosClientId, - iosBundleId: _options.iosBundleId, - appGroupId: _options.appGroupId, - recaptchaSiteKey: _options.recaptchaSiteKey, - )), - _options)); + _initializeFirebaseAppFromMap(await api.initializeApp( + defaultFirebaseAppName, + CoreFirebaseOptions( + apiKey: _options.apiKey, + appId: _options.appId, + messagingSenderId: _options.messagingSenderId, + projectId: _options.projectId, + authDomain: _options.authDomain, + databaseURL: _options.databaseURL, + storageBucket: _options.storageBucket, + measurementId: _options.measurementId, + trackingId: _options.trackingId, + deepLinkURLScheme: _options.deepLinkURLScheme, + androidClientId: _options.androidClientId, + iosClientId: _options.iosClientId, + iosBundleId: _options.iosBundleId, + appGroupId: _options.appGroupId, + ), + )); defaultApp = appInstances[defaultFirebaseAppName]; } @@ -192,27 +156,25 @@ class MethodChannelFirebase extends FirebasePlatform { } } - _initializeFirebaseAppFromMap(_preserveRecaptchaSiteKey( - await api.initializeApp( - name, - CoreFirebaseOptions( - apiKey: options!.apiKey, - appId: options.appId, - messagingSenderId: options.messagingSenderId, - projectId: options.projectId, - authDomain: options.authDomain, - databaseURL: options.databaseURL, - storageBucket: options.storageBucket, - measurementId: options.measurementId, - trackingId: options.trackingId, - deepLinkURLScheme: options.deepLinkURLScheme, - androidClientId: options.androidClientId, - iosClientId: options.iosClientId, - iosBundleId: options.iosBundleId, - appGroupId: options.appGroupId, - recaptchaSiteKey: options.recaptchaSiteKey, - )), - options)); + _initializeFirebaseAppFromMap(await api.initializeApp( + name, + CoreFirebaseOptions( + apiKey: options!.apiKey, + appId: options.appId, + messagingSenderId: options.messagingSenderId, + projectId: options.projectId, + authDomain: options.authDomain, + databaseURL: options.databaseURL, + storageBucket: options.storageBucket, + measurementId: options.measurementId, + trackingId: options.trackingId, + deepLinkURLScheme: options.deepLinkURLScheme, + androidClientId: options.androidClientId, + iosClientId: options.iosClientId, + iosBundleId: options.iosBundleId, + appGroupId: options.appGroupId, + ), + )); return appInstances[name]!; } diff --git a/packages/firebase_core/firebase_core_platform_interface/lib/src/pigeon/messages.pigeon.dart b/packages/firebase_core/firebase_core_platform_interface/lib/src/pigeon/messages.pigeon.dart index 9bb893bb3aba..9238d41c6246 100644 --- a/packages/firebase_core/firebase_core_platform_interface/lib/src/pigeon/messages.pigeon.dart +++ b/packages/firebase_core/firebase_core_platform_interface/lib/src/pigeon/messages.pigeon.dart @@ -13,9 +13,9 @@ import 'package:flutter/services.dart'; import 'package:meta/meta.dart' show immutable, protected, visibleForTesting; Object? _extractReplyValueOrThrow( - List? replyList, - String channelName, { - required bool isNullValid, + List? replyList, + String channelName, { + required bool isNullValid, }) { if (replyList == null) { throw PlatformException( @@ -37,8 +37,8 @@ Object? _extractReplyValueOrThrow( return replyList.firstOrNull; } -List wrapResponse( - {Object? result, PlatformException? error, bool empty = false}) { + +List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { if (empty) { return []; } @@ -47,7 +47,6 @@ List wrapResponse( } return [error.code, error.message, error.details]; } - bool _deepEquals(Object? a, Object? b) { if (identical(a, b)) { return true; @@ -110,6 +109,7 @@ int _deepHash(Object? value) { return value.hashCode; } + class CoreFirebaseOptions { CoreFirebaseOptions({ required this.apiKey, @@ -126,7 +126,6 @@ class CoreFirebaseOptions { this.iosClientId, this.iosBundleId, this.appGroupId, - this.recaptchaSiteKey, }); String apiKey; @@ -157,8 +156,6 @@ class CoreFirebaseOptions { String? appGroupId; - String? recaptchaSiteKey; - List _toList() { return [ apiKey, @@ -175,13 +172,11 @@ class CoreFirebaseOptions { iosClientId, iosBundleId, appGroupId, - recaptchaSiteKey, ]; } Object encode() { - return _toList(); - } + return _toList(); } static CoreFirebaseOptions decode(Object result) { result as List; @@ -200,7 +195,6 @@ class CoreFirebaseOptions { iosClientId: result[11] as String?, iosBundleId: result[12] as String?, appGroupId: result[13] as String?, - recaptchaSiteKey: result[14] as String?, ); } @@ -213,21 +207,7 @@ class CoreFirebaseOptions { if (identical(this, other)) { return true; } - return _deepEquals(apiKey, other.apiKey) && - _deepEquals(appId, other.appId) && - _deepEquals(messagingSenderId, other.messagingSenderId) && - _deepEquals(projectId, other.projectId) && - _deepEquals(authDomain, other.authDomain) && - _deepEquals(databaseURL, other.databaseURL) && - _deepEquals(storageBucket, other.storageBucket) && - _deepEquals(measurementId, other.measurementId) && - _deepEquals(trackingId, other.trackingId) && - _deepEquals(deepLinkURLScheme, other.deepLinkURLScheme) && - _deepEquals(androidClientId, other.androidClientId) && - _deepEquals(iosClientId, other.iosClientId) && - _deepEquals(iosBundleId, other.iosBundleId) && - _deepEquals(appGroupId, other.appGroupId) && - _deepEquals(recaptchaSiteKey, other.recaptchaSiteKey); + return _deepEquals(apiKey, other.apiKey) && _deepEquals(appId, other.appId) && _deepEquals(messagingSenderId, other.messagingSenderId) && _deepEquals(projectId, other.projectId) && _deepEquals(authDomain, other.authDomain) && _deepEquals(databaseURL, other.databaseURL) && _deepEquals(storageBucket, other.storageBucket) && _deepEquals(measurementId, other.measurementId) && _deepEquals(trackingId, other.trackingId) && _deepEquals(deepLinkURLScheme, other.deepLinkURLScheme) && _deepEquals(androidClientId, other.androidClientId) && _deepEquals(iosClientId, other.iosClientId) && _deepEquals(iosBundleId, other.iosBundleId) && _deepEquals(appGroupId, other.appGroupId); } @override @@ -261,8 +241,7 @@ class CoreInitializeResponse { } Object encode() { - return _toList(); - } + return _toList(); } static CoreInitializeResponse decode(Object result) { result as List; @@ -270,8 +249,7 @@ class CoreInitializeResponse { name: result[0]! as String, options: result[1]! as CoreFirebaseOptions, isAutomaticDataCollectionEnabled: result[2] as bool?, - pluginConstants: - (result[3]! as Map).cast(), + pluginConstants: (result[3]! as Map).cast(), ); } @@ -284,11 +262,7 @@ class CoreInitializeResponse { if (identical(this, other)) { return true; } - return _deepEquals(name, other.name) && - _deepEquals(options, other.options) && - _deepEquals(isAutomaticDataCollectionEnabled, - other.isAutomaticDataCollectionEnabled) && - _deepEquals(pluginConstants, other.pluginConstants); + return _deepEquals(name, other.name) && _deepEquals(options, other.options) && _deepEquals(isAutomaticDataCollectionEnabled, other.isAutomaticDataCollectionEnabled) && _deepEquals(pluginConstants, other.pluginConstants); } @override @@ -296,6 +270,7 @@ class CoreInitializeResponse { int get hashCode => _deepHash([runtimeType, ..._toList()]); } + class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -303,10 +278,10 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is CoreFirebaseOptions) { + } else if (value is CoreFirebaseOptions) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is CoreInitializeResponse) { + } else if (value is CoreInitializeResponse) { buffer.putUint8(130); writeValue(buffer, value.encode()); } else { @@ -331,41 +306,36 @@ class FirebaseCoreHostApi { /// Constructor for [FirebaseCoreHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - FirebaseCoreHostApi( - {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + FirebaseCoreHostApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); final String pigeonVar_messageChannelSuffix; - Future initializeApp( - String appName, CoreFirebaseOptions initializeAppRequest) async { - final pigeonVar_channelName = - 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeApp$pigeonVar_messageChannelSuffix'; + Future initializeApp(String appName, CoreFirebaseOptions initializeAppRequest) async { + final pigeonVar_channelName = 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeApp$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = - pigeonVar_channel.send([appName, initializeAppRequest]); + final Future pigeonVar_sendFuture = pigeonVar_channel.send([appName, initializeAppRequest]); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: false, - ); + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ) + ; return pigeonVar_replyValue! as CoreInitializeResponse; } Future> initializeCore() async { - final pigeonVar_channelName = - 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeCore$pigeonVar_messageChannelSuffix'; + final pigeonVar_channelName = 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeCore$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -375,17 +345,16 @@ class FirebaseCoreHostApi { final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: false, - ); - return (pigeonVar_replyValue! as List) - .cast(); + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ) + ; + return (pigeonVar_replyValue! as List).cast(); } Future optionsFromResource() async { - final pigeonVar_channelName = - 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.optionsFromResource$pigeonVar_messageChannelSuffix'; + final pigeonVar_channelName = 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.optionsFromResource$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -395,10 +364,11 @@ class FirebaseCoreHostApi { final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: false, - ); + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ) + ; return pigeonVar_replyValue! as CoreFirebaseOptions; } } @@ -407,73 +377,66 @@ class FirebaseAppHostApi { /// Constructor for [FirebaseAppHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - FirebaseAppHostApi( - {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + FirebaseAppHostApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); final String pigeonVar_messageChannelSuffix; - Future setAutomaticDataCollectionEnabled( - String appName, bool enabled) async { - final pigeonVar_channelName = - 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticDataCollectionEnabled$pigeonVar_messageChannelSuffix'; + Future setAutomaticDataCollectionEnabled(String appName, bool enabled) async { + final pigeonVar_channelName = 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticDataCollectionEnabled$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = - pigeonVar_channel.send([appName, enabled]); + final Future pigeonVar_sendFuture = pigeonVar_channel.send([appName, enabled]); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: true, - ); + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ) + ; } - Future setAutomaticResourceManagementEnabled( - String appName, bool enabled) async { - final pigeonVar_channelName = - 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticResourceManagementEnabled$pigeonVar_messageChannelSuffix'; + Future setAutomaticResourceManagementEnabled(String appName, bool enabled) async { + final pigeonVar_channelName = 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticResourceManagementEnabled$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = - pigeonVar_channel.send([appName, enabled]); + final Future pigeonVar_sendFuture = pigeonVar_channel.send([appName, enabled]); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: true, - ); + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ) + ; } Future delete(String appName) async { - final pigeonVar_channelName = - 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.delete$pigeonVar_messageChannelSuffix'; + final pigeonVar_channelName = 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.delete$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = - pigeonVar_channel.send([appName]); + final Future pigeonVar_sendFuture = pigeonVar_channel.send([appName]); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: true, - ); + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ) + ; } } diff --git a/packages/firebase_core/firebase_core_platform_interface/lib/src/pigeon/test_api.dart b/packages/firebase_core/firebase_core_platform_interface/lib/src/pigeon/test_api.dart index 9dd32fe50dba..b0cbd8cfb193 100644 --- a/packages/firebase_core/firebase_core_platform_interface/lib/src/pigeon/test_api.dart +++ b/packages/firebase_core/firebase_core_platform_interface/lib/src/pigeon/test_api.dart @@ -13,6 +13,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'messages.pigeon.dart'; + class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -20,10 +21,10 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is CoreFirebaseOptions) { + } else if (value is CoreFirebaseOptions) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is CoreInitializeResponse) { + } else if (value is CoreInitializeResponse) { buffer.putUint8(130); writeValue(buffer, value.encode()); } else { @@ -45,98 +46,73 @@ class _PigeonCodec extends StandardMessageCodec { } abstract class TestFirebaseCoreHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - Future initializeApp( - String appName, CoreFirebaseOptions initializeAppRequest); + Future initializeApp(String appName, CoreFirebaseOptions initializeAppRequest); Future> initializeCore(); Future optionsFromResource(); - static void setUp( - TestFirebaseCoreHostApi? api, { - BinaryMessenger? binaryMessenger, - String messageChannelSuffix = '', - }) { - messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + static void setUp(TestFirebaseCoreHostApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { + messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { final pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeApp$messageChannelSuffix', - pigeonChannelCodec, + 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeApp$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(pigeonVar_channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(pigeonVar_channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, (Object? message) async { final List args = message! as List; final String arg_appName = args[0]! as String; - final CoreFirebaseOptions arg_initializeAppRequest = - args[1]! as CoreFirebaseOptions; + final CoreFirebaseOptions arg_initializeAppRequest = args[1]! as CoreFirebaseOptions; try { - final CoreInitializeResponse output = - await api.initializeApp(arg_appName, arg_initializeAppRequest); + final CoreInitializeResponse output = await api.initializeApp(arg_appName, arg_initializeAppRequest); return [output]; } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); } }); } } { final pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeCore$messageChannelSuffix', - pigeonChannelCodec, + 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeCore$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(pigeonVar_channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(pigeonVar_channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, (Object? message) async { try { - final List output = - await api.initializeCore(); + final List output = await api.initializeCore(); return [output]; } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); } }); } } { final pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.optionsFromResource$messageChannelSuffix', - pigeonChannelCodec, + 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.optionsFromResource$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(pigeonVar_channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(pigeonVar_channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, (Object? message) async { try { final CoreFirebaseOptions output = await api.optionsFromResource(); return [output]; } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); } }); } @@ -145,92 +121,69 @@ abstract class TestFirebaseCoreHostApi { } abstract class TestFirebaseAppHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); Future setAutomaticDataCollectionEnabled(String appName, bool enabled); - Future setAutomaticResourceManagementEnabled( - String appName, bool enabled); + Future setAutomaticResourceManagementEnabled(String appName, bool enabled); Future delete(String appName); - static void setUp( - TestFirebaseAppHostApi? api, { - BinaryMessenger? binaryMessenger, - String messageChannelSuffix = '', - }) { - messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + static void setUp(TestFirebaseAppHostApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { + messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { final pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticDataCollectionEnabled$messageChannelSuffix', - pigeonChannelCodec, + 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticDataCollectionEnabled$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(pigeonVar_channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(pigeonVar_channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, (Object? message) async { final List args = message! as List; final String arg_appName = args[0]! as String; final bool arg_enabled = args[1]! as bool; try { - await api.setAutomaticDataCollectionEnabled( - arg_appName, arg_enabled); + await api.setAutomaticDataCollectionEnabled(arg_appName, arg_enabled); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); } }); } } { final pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticResourceManagementEnabled$messageChannelSuffix', - pigeonChannelCodec, + 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticResourceManagementEnabled$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(pigeonVar_channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(pigeonVar_channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, (Object? message) async { final List args = message! as List; final String arg_appName = args[0]! as String; final bool arg_enabled = args[1]! as bool; try { - await api.setAutomaticResourceManagementEnabled( - arg_appName, arg_enabled); + await api.setAutomaticResourceManagementEnabled(arg_appName, arg_enabled); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); } }); } } { final pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.delete$messageChannelSuffix', - pigeonChannelCodec, + 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.delete$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(pigeonVar_channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(pigeonVar_channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, (Object? message) async { final List args = message! as List; final String arg_appName = args[0]! as String; try { @@ -238,9 +191,8 @@ abstract class TestFirebaseAppHostApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); } }); } diff --git a/packages/firebase_core/firebase_core_platform_interface/pigeons/messages.dart b/packages/firebase_core/firebase_core_platform_interface/pigeons/messages.dart index a42278d0f4e7..a2286f54f1a9 100644 --- a/packages/firebase_core/firebase_core_platform_interface/pigeons/messages.dart +++ b/packages/firebase_core/firebase_core_platform_interface/pigeons/messages.dart @@ -44,7 +44,6 @@ class CoreFirebaseOptions { required this.databaseURL, required this.storageBucket, required this.trackingId, - required this.recaptchaSiteKey, }); final String apiKey; @@ -74,8 +73,6 @@ class CoreFirebaseOptions { final String? iosBundleId; final String? appGroupId; - - final String? recaptchaSiteKey; } class CoreInitializeResponse { diff --git a/packages/firebase_core/firebase_core_platform_interface/test/firebase_options_test.dart b/packages/firebase_core/firebase_core_platform_interface/test/firebase_options_test.dart index 2291efa88878..8b84f78e9525 100644 --- a/packages/firebase_core/firebase_core_platform_interface/test/firebase_options_test.dart +++ b/packages/firebase_core/firebase_core_platform_interface/test/firebase_options_test.dart @@ -55,7 +55,6 @@ void main() { appId: 'appId', messagingSenderId: 'messagingSenderId', projectId: 'projectId', - recaptchaSiteKey: 'recaptchaSiteKey', ), ); @@ -64,7 +63,6 @@ void main() { appId: 'appId', messagingSenderId: 'messagingSenderId', projectId: 'projectId', - recaptchaSiteKey: 'recaptchaSiteKey', ); expect(options1 == options2, isTrue); @@ -93,7 +91,6 @@ void main() { iosClientId: 'newIosClientId', iosBundleId: 'newIosBundleId', appGroupId: 'newAppGroupId', - recaptchaSiteKey: 'newRecaptchaSiteKey', ); expect( @@ -113,7 +110,6 @@ void main() { iosClientId: 'newIosClientId', iosBundleId: 'newIosBundleId', appGroupId: 'newAppGroupId', - recaptchaSiteKey: 'newRecaptchaSiteKey', ), ); }); @@ -134,7 +130,6 @@ void main() { iosBundleId: 'iosBundleId', iosClientId: 'iosClientId', appGroupId: 'appGroupId', - recaptchaSiteKey: 'recaptchaSiteKey', ); expect(options.asMap, { @@ -152,7 +147,6 @@ void main() { 'iosBundleId': 'iosBundleId', 'iosClientId': 'iosClientId', 'appGroupId': 'appGroupId', - 'recaptchaSiteKey': 'recaptchaSiteKey', }); }); }); diff --git a/packages/firebase_core/firebase_core_web/lib/firebase_core_web.dart b/packages/firebase_core/firebase_core_web/lib/firebase_core_web.dart index 4ce9bf96a5a6..fee86d33172e 100644 --- a/packages/firebase_core/firebase_core_web/lib/firebase_core_web.dart +++ b/packages/firebase_core/firebase_core_web/lib/firebase_core_web.dart @@ -43,7 +43,6 @@ FirebaseOptions _createFromJsOptions(firebase.FirebaseOptions options) { messagingSenderId: _safeToDart(options.messagingSenderId) ?? '', appId: _safeToDart(options.appId) ?? '', measurementId: _safeToDart(options.measurementId), - recaptchaSiteKey: _safeToDart(options.recaptchaSiteKey), ); } diff --git a/packages/firebase_core/firebase_core_web/lib/src/firebase_core_web.dart b/packages/firebase_core/firebase_core_web/lib/src/firebase_core_web.dart index 255396f1f982..192e673e7bd0 100644 --- a/packages/firebase_core/firebase_core_web/lib/src/firebase_core_web.dart +++ b/packages/firebase_core/firebase_core_web/lib/src/firebase_core_web.dart @@ -362,7 +362,6 @@ class FirebaseCoreWeb extends FirebasePlatform { messagingSenderId: options.messagingSenderId, appId: options.appId, measurementId: options.measurementId, - recaptchaSiteKey: options.recaptchaSiteKey, ); } } @@ -385,7 +384,6 @@ class FirebaseCoreWeb extends FirebasePlatform { messagingSenderId: options.messagingSenderId, appId: options.appId, measurementId: options.measurementId, - recaptchaSiteKey: options.recaptchaSiteKey, ); } catch (e) { if (_getJSErrorCode(e as JSError) == 'app/duplicate-app') { diff --git a/packages/firebase_core/firebase_core_web/lib/src/interop/core.dart b/packages/firebase_core/firebase_core_web/lib/src/interop/core.dart index 254d07f38292..36f439e65689 100644 --- a/packages/firebase_core/firebase_core_web/lib/src/interop/core.dart +++ b/packages/firebase_core/firebase_core_web/lib/src/interop/core.dart @@ -33,7 +33,6 @@ App initializeApp({ String? name, String? measurementId, String? appId, - String? recaptchaSiteKey, }) { name ??= defaultFirebaseAppName; @@ -48,7 +47,6 @@ App initializeApp({ messagingSenderId: messagingSenderId?.toJS, measurementId: measurementId?.toJS, appId: appId?.toJS, - recaptchaSiteKey: recaptchaSiteKey?.toJS, ), name.toJS, ), diff --git a/packages/firebase_core/firebase_core_web/lib/src/interop/core_interop.dart b/packages/firebase_core/firebase_core_web/lib/src/interop/core_interop.dart index 1aeaafe4ebd0..c4f3be7aa58e 100644 --- a/packages/firebase_core/firebase_core_web/lib/src/interop/core_interop.dart +++ b/packages/firebase_core/firebase_core_web/lib/src/interop/core_interop.dart @@ -62,7 +62,6 @@ extension type FirebaseOptions._(JSObject _) implements JSObject { JSString? messagingSenderId, JSString? measurementId, JSString? appId, - JSString? recaptchaSiteKey, }); } @@ -83,6 +82,4 @@ extension FirebaseOptionsExtension on FirebaseOptions { external set measurementId(JSString? s); external JSString? get appId; external set appId(JSString? s); - external JSString? get recaptchaSiteKey; - external set recaptchaSiteKey(JSString? s); } diff --git a/tests/integration_test/firebase_core/firebase_core_e2e_test.dart b/tests/integration_test/firebase_core/firebase_core_e2e_test.dart index bb8349369128..8204337cd553 100644 --- a/tests/integration_test/firebase_core/firebase_core_e2e_test.dart +++ b/tests/integration_test/firebase_core/firebase_core_e2e_test.dart @@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; import 'package:tests/firebase_options.dart'; -void main({bool includeRecaptchaTests = true}) { +void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); group('firebase_core', () { @@ -83,56 +83,4 @@ void main({bool includeRecaptchaTests = true}) { } }); }); - - if (includeRecaptchaTests) { - recaptchaMain(); - } -} - -void recaptchaMain() { - IntegrationTestWidgetsFlutterBinding.ensureInitialized(); - - group('firebase_core recaptcha', () { - setUpAll(() async { - await Firebase.initializeApp( - options: DefaultFirebaseOptions.currentPlatform, - ); - }); - - test('Firebase.initializeApp with recaptchaSiteKey', () async { - String appName = 'recaptcha-test-app'; - FirebaseOptions options = (defaultTargetPlatform == TargetPlatform.android - ? DefaultFirebaseOptions.currentPlatform.copyWith( - appId: '1:1234567890:android:fedcba0987654321fedcba', - ) - : DefaultFirebaseOptions.currentPlatform) - .copyWith( - recaptchaSiteKey: 'test-recaptcha-site-key', - ); - - await Firebase.initializeApp( - name: appName, - options: options, - ); - - FirebaseApp app = Firebase.app(appName); - expect(app.options.recaptchaSiteKey, 'test-recaptcha-site-key'); - - await app.delete(); - }); - - test('Default app recaptchaSiteKey precedence test', () async { - // Natively initialized default app has no recaptchaSiteKey. - // Trying to initialize it again with different recaptchaSiteKey in Dart. - FirebaseApp app = await Firebase.initializeApp( - options: DefaultFirebaseOptions.currentPlatform.copyWith( - recaptchaSiteKey: 'dart-recaptcha-key', - ), - ); - - // It should NOT update the key, because native initializeApp was skipped. - // (It returns the natively initialized app which has null key). - expect(app.options.recaptchaSiteKey, isNull); - }); - }); } From 7963416abb79873ef5e6b9ff545304a90961dca0 Mon Sep 17 00:00:00 2001 From: Cynthia J Date: Fri, 31 Jul 2026 09:16:07 -0700 Subject: [PATCH 08/12] fix the e2e error --- tests/integration_test/e2e_test.dart | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tests/integration_test/e2e_test.dart b/tests/integration_test/e2e_test.dart index e4ef09e84009..a376838e5d18 100644 --- a/tests/integration_test/e2e_test.dart +++ b/tests/integration_test/e2e_test.dart @@ -53,7 +53,7 @@ void main() { if (kIsWeb) { // Web has its own ordering because App Check runs in a separate job and // Auth can leave emulator state that interferes with Database tests. - firebase_core.main(includeRecaptchaTests: false); + firebase_core.main(); firebase_ai.main(); firebase_database.main(); firebase_auth.main(); @@ -66,7 +66,6 @@ void main() { firebase_performance.main(); firebase_remote_config.main(); firebase_storage.main(); - firebase_core.recaptchaMain(); return; } @@ -92,10 +91,8 @@ void main() { } void runAllTests() { - // Native platforms run the full suite in package order, but keep the - // recaptcha core tests before App Check because Android App Check activation - // changes native recaptcha configuration for later secondary app checks. - firebase_core.main(includeRecaptchaTests: false); + // Native platforms run the full suite in package order. + firebase_core.main(); firebase_ai.main(); firebase_auth.main(); firebase_database.main(); @@ -108,6 +105,5 @@ void runAllTests() { firebase_performance.main(); firebase_remote_config.main(); firebase_storage.main(); - firebase_core.recaptchaMain(); firebase_app_check.main(); } From 305efc21ce489c7236e7a3d8dfe9864c091de79b Mon Sep 17 00:00:00 2001 From: Cynthia J Date: Fri, 31 Jul 2026 09:22:00 -0700 Subject: [PATCH 09/12] fix format for pigeon generated files --- .../GeneratedAndroidFirebaseAppCheck.g.kt | 162 ++-- .../FirebaseAppCheckMessages.g.swift | 73 +- .../firebase_app_check/windows/messages.g.cpp | 558 +++++++----- .../firebase_app_check/windows/messages.g.h | 96 +- .../lib/src/pigeon/messages.pigeon.dart | 134 +-- .../core/GeneratedAndroidFirebaseCore.java | 162 +++- .../include/firebase_core/messages.g.h | 100 ++- .../Sources/firebase_core/messages.g.m | 223 +++-- .../firebase_core/windows/messages.g.cpp | 818 ++++++++++-------- .../firebase_core/windows/messages.g.h | 153 ++-- .../lib/src/pigeon/messages.pigeon.dart | 155 ++-- .../lib/src/pigeon/test_api.dart | 140 ++- 12 files changed, 1679 insertions(+), 1095 deletions(-) diff --git a/packages/firebase_app_check/firebase_app_check/android/src/main/kotlin/io/flutter/plugins/firebase/appcheck/GeneratedAndroidFirebaseAppCheck.g.kt b/packages/firebase_app_check/firebase_app_check/android/src/main/kotlin/io/flutter/plugins/firebase/appcheck/GeneratedAndroidFirebaseAppCheck.g.kt index e9447c796ff4..fe6c1510a9d3 100644 --- a/packages/firebase_app_check/firebase_app_check/android/src/main/kotlin/io/flutter/plugins/firebase/appcheck/GeneratedAndroidFirebaseAppCheck.g.kt +++ b/packages/firebase_app_check/firebase_app_check/android/src/main/kotlin/io/flutter/plugins/firebase/appcheck/GeneratedAndroidFirebaseAppCheck.g.kt @@ -10,12 +10,11 @@ package io.flutter.plugins.firebase.appcheck 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 GeneratedAndroidFirebaseAppCheckPigeonUtils { fun wrapResult(result: Any?): List { @@ -24,19 +23,15 @@ private object GeneratedAndroidFirebaseAppCheckPigeonUtils { 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,27 +175,23 @@ private object GeneratedAndroidFirebaseAppCheckPigeonUtils { 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() /** Generated class from Pigeon that represents data sent in messages. */ -data class InternalAppCheckTokenResult ( - val token: String, - val expirationTimestamp: Long? = null -) - { +data class InternalAppCheckTokenResult(val token: String, val expirationTimestamp: Long? = null) { companion object { fun fromList(pigeonVar_list: List): InternalAppCheckTokenResult { val token = pigeonVar_list[0] as String @@ -208,12 +199,14 @@ data class InternalAppCheckTokenResult ( return InternalAppCheckTokenResult(token, expirationTimestamp) } } + fun toList(): List { return listOf( - token, - expirationTimestamp, + token, + expirationTimestamp, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -222,28 +215,31 @@ data class InternalAppCheckTokenResult ( return true } val other = other as InternalAppCheckTokenResult - return GeneratedAndroidFirebaseAppCheckPigeonUtils.deepEquals(this.token, other.token) && GeneratedAndroidFirebaseAppCheckPigeonUtils.deepEquals(this.expirationTimestamp, other.expirationTimestamp) + return GeneratedAndroidFirebaseAppCheckPigeonUtils.deepEquals(this.token, other.token) && + GeneratedAndroidFirebaseAppCheckPigeonUtils.deepEquals( + this.expirationTimestamp, other.expirationTimestamp) } override fun hashCode(): Int { var result = javaClass.hashCode() result = 31 * result + GeneratedAndroidFirebaseAppCheckPigeonUtils.deepHash(this.token) - result = 31 * result + GeneratedAndroidFirebaseAppCheckPigeonUtils.deepHash(this.expirationTimestamp) + result = + 31 * result + GeneratedAndroidFirebaseAppCheckPigeonUtils.deepHash(this.expirationTimestamp) return result } } + private open class GeneratedAndroidFirebaseAppCheckPigeonCodec : StandardMessageCodec() { override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { return when (type) { 129.toByte() -> { - return (readValue(buffer) as? List)?.let { - InternalAppCheckTokenResult.fromList(it) - } + return (readValue(buffer) as? List)?.let { InternalAppCheckTokenResult.fromList(it) } } else -> super.readValueOfType(type, buffer) } } - override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { + + override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { when (value) { is InternalAppCheckTokenResult -> { stream.write(129) @@ -254,27 +250,56 @@ private open class GeneratedAndroidFirebaseAppCheckPigeonCodec : StandardMessage } } - /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ interface FirebaseAppCheckHostApi { - fun activate(appName: String, androidProvider: String?, appleProvider: String?, debugToken: String?, recaptchaSiteKey: String?, callback: (Result) -> Unit) + fun activate( + appName: String, + androidProvider: String?, + appleProvider: String?, + debugToken: String?, + recaptchaSiteKey: String?, + callback: (Result) -> Unit + ) + fun getToken(appName: String, forceRefresh: Boolean, callback: (Result) -> Unit) - fun getTokenResult(appName: String, forceRefresh: Boolean, callback: (Result) -> Unit) - fun setTokenAutoRefreshEnabled(appName: String, isTokenAutoRefreshEnabled: Boolean, callback: (Result) -> Unit) + + fun getTokenResult( + appName: String, + forceRefresh: Boolean, + callback: (Result) -> Unit + ) + + fun setTokenAutoRefreshEnabled( + appName: String, + isTokenAutoRefreshEnabled: Boolean, + callback: (Result) -> Unit + ) + fun registerTokenListener(appName: String, callback: (Result) -> Unit) + fun getLimitedUseAppCheckToken(appName: String, callback: (Result) -> Unit) companion object { /** The codec used by FirebaseAppCheckHostApi. */ - val codec: MessageCodec by lazy { - GeneratedAndroidFirebaseAppCheckPigeonCodec() - } - /** Sets up an instance of `FirebaseAppCheckHostApi` to handle messages through the `binaryMessenger`. */ + val codec: MessageCodec by lazy { GeneratedAndroidFirebaseAppCheckPigeonCodec() } + /** + * Sets up an instance of `FirebaseAppCheckHostApi` to handle messages through the + * `binaryMessenger`. + */ @JvmOverloads - fun setUp(binaryMessenger: BinaryMessenger, api: FirebaseAppCheckHostApi?, messageChannelSuffix: String = "") { - val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + fun setUp( + binaryMessenger: BinaryMessenger, + api: FirebaseAppCheckHostApi?, + messageChannelSuffix: String = "" + ) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.activate$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.activate$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -283,21 +308,30 @@ interface FirebaseAppCheckHostApi { val appleProviderArg = args[2] as String? val debugTokenArg = args[3] as String? val recaptchaSiteKeyArg = args[4] as String? - api.activate(appNameArg, androidProviderArg, appleProviderArg, debugTokenArg, recaptchaSiteKeyArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(GeneratedAndroidFirebaseAppCheckPigeonUtils.wrapError(error)) - } else { - reply.reply(GeneratedAndroidFirebaseAppCheckPigeonUtils.wrapResult(null)) - } - } + api.activate( + appNameArg, + androidProviderArg, + appleProviderArg, + debugTokenArg, + recaptchaSiteKeyArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(GeneratedAndroidFirebaseAppCheckPigeonUtils.wrapError(error)) + } else { + reply.reply(GeneratedAndroidFirebaseAppCheckPigeonUtils.wrapResult(null)) + } + } } } else { channel.setMessageHandler(null) } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getToken$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getToken$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -318,13 +352,18 @@ interface FirebaseAppCheckHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getTokenResult$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getTokenResult$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val appNameArg = args[0] as String val forceRefreshArg = args[1] as Boolean - api.getTokenResult(appNameArg, forceRefreshArg) { result: Result -> + api.getTokenResult(appNameArg, forceRefreshArg) { + result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(GeneratedAndroidFirebaseAppCheckPigeonUtils.wrapError(error)) @@ -339,13 +378,18 @@ interface FirebaseAppCheckHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.setTokenAutoRefreshEnabled$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.setTokenAutoRefreshEnabled$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val appNameArg = args[0] as String val isTokenAutoRefreshEnabledArg = args[1] as Boolean - api.setTokenAutoRefreshEnabled(appNameArg, isTokenAutoRefreshEnabledArg) { result: Result -> + api.setTokenAutoRefreshEnabled(appNameArg, isTokenAutoRefreshEnabledArg) { + result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(GeneratedAndroidFirebaseAppCheckPigeonUtils.wrapError(error)) @@ -359,7 +403,11 @@ interface FirebaseAppCheckHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.registerTokenListener$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.registerTokenListener$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -379,7 +427,11 @@ interface FirebaseAppCheckHostApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getLimitedUseAppCheckToken$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getLimitedUseAppCheckToken$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List diff --git a/packages/firebase_app_check/firebase_app_check/ios/firebase_app_check/Sources/firebase_app_check/FirebaseAppCheckMessages.g.swift b/packages/firebase_app_check/firebase_app_check/ios/firebase_app_check/Sources/firebase_app_check/FirebaseAppCheckMessages.g.swift index cb2c26134f15..daaa0f7796d6 100644 --- a/packages/firebase_app_check/firebase_app_check/ios/firebase_app_check/Sources/firebase_app_check/FirebaseAppCheckMessages.g.swift +++ b/packages/firebase_app_check/firebase_app_check/ios/firebase_app_check/Sources/firebase_app_check/FirebaseAppCheckMessages.g.swift @@ -73,7 +73,7 @@ private func doubleEqualsFirebaseAppCheckMessages(_ lhs: Double, _ rhs: Double) private func doubleHashFirebaseAppCheckMessages(_ value: Double, _ hasher: inout Hasher) { if value.isNaN { - hasher.combine(0x7FF8000000000000) + hasher.combine(0x7FF8_0000_0000_0000) } else { // Normalize -0.0 to 0.0 hasher.combine(value == 0 ? 0 : value) @@ -176,13 +176,11 @@ func deepHashFirebaseAppCheckMessages(value: Any?, hasher: inout Hasher) { } } - /// Generated class from Pigeon that represents data sent in messages. struct InternalAppCheckTokenResult: Hashable { var token: String var expirationTimestamp: Int64? = nil - // swift-format-ignore: AlwaysUseLowerCamelCase static func fromList(_ pigeonVar_list: [Any?]) -> InternalAppCheckTokenResult? { let token = pigeonVar_list[0] as! String @@ -203,7 +201,8 @@ struct InternalAppCheckTokenResult: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsFirebaseAppCheckMessages(lhs.token, rhs.token) && deepEqualsFirebaseAppCheckMessages(lhs.expirationTimestamp, rhs.expirationTimestamp) + return deepEqualsFirebaseAppCheckMessages(lhs.token, rhs.token) + && deepEqualsFirebaseAppCheckMessages(lhs.expirationTimestamp, rhs.expirationTimestamp) } func hash(into hasher: inout Hasher) { @@ -246,27 +245,41 @@ private class FirebaseAppCheckMessagesPigeonCodecReaderWriter: FlutterStandardRe } class FirebaseAppCheckMessagesPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { - static let shared = FirebaseAppCheckMessagesPigeonCodec(readerWriter: FirebaseAppCheckMessagesPigeonCodecReaderWriter()) + static let shared = FirebaseAppCheckMessagesPigeonCodec( + readerWriter: FirebaseAppCheckMessagesPigeonCodecReaderWriter()) } - /// Generated protocol from Pigeon that represents a handler of messages from Flutter. protocol FirebaseAppCheckHostApi { - func activate(appName: String, androidProvider: String?, appleProvider: String?, debugToken: String?, recaptchaSiteKey: String?, completion: @escaping (Result) -> Void) - func getToken(appName: String, forceRefresh: Bool, completion: @escaping (Result) -> Void) - func getTokenResult(appName: String, forceRefresh: Bool, completion: @escaping (Result) -> Void) - func setTokenAutoRefreshEnabled(appName: String, isTokenAutoRefreshEnabled: Bool, completion: @escaping (Result) -> Void) + func activate( + appName: String, androidProvider: String?, appleProvider: String?, debugToken: String?, + recaptchaSiteKey: String?, completion: @escaping (Result) -> Void) + func getToken( + appName: String, forceRefresh: Bool, completion: @escaping (Result) -> Void) + func getTokenResult( + appName: String, forceRefresh: Bool, + completion: @escaping (Result) -> Void) + func setTokenAutoRefreshEnabled( + appName: String, isTokenAutoRefreshEnabled: Bool, + completion: @escaping (Result) -> Void) func registerTokenListener(appName: String, completion: @escaping (Result) -> Void) - func getLimitedUseAppCheckToken(appName: String, completion: @escaping (Result) -> Void) + func getLimitedUseAppCheckToken( + appName: String, completion: @escaping (Result) -> Void) } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class FirebaseAppCheckHostApiSetup { static var codec: FlutterStandardMessageCodec { FirebaseAppCheckMessagesPigeonCodec.shared } /// Sets up an instance of `FirebaseAppCheckHostApi` to handle messages through the `binaryMessenger`. - static func setUp(binaryMessenger: FlutterBinaryMessenger, api: FirebaseAppCheckHostApi?, messageChannelSuffix: String = "") { + static func setUp( + binaryMessenger: FlutterBinaryMessenger, api: FirebaseAppCheckHostApi?, + messageChannelSuffix: String = "" + ) { let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" - let activateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.activate\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let activateChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.activate\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { activateChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -275,7 +288,10 @@ class FirebaseAppCheckHostApiSetup { let appleProviderArg: String? = nilOrValue(args[2]) let debugTokenArg: String? = nilOrValue(args[3]) let recaptchaSiteKeyArg: String? = nilOrValue(args[4]) - api.activate(appName: appNameArg, androidProvider: androidProviderArg, appleProvider: appleProviderArg, debugToken: debugTokenArg, recaptchaSiteKey: recaptchaSiteKeyArg) { result in + api.activate( + appName: appNameArg, androidProvider: androidProviderArg, appleProvider: appleProviderArg, + debugToken: debugTokenArg, recaptchaSiteKey: recaptchaSiteKeyArg + ) { result in switch result { case .success: reply(wrapResult(nil)) @@ -287,7 +303,10 @@ class FirebaseAppCheckHostApiSetup { } else { activateChannel.setMessageHandler(nil) } - let getTokenChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getToken\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let getTokenChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getToken\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getTokenChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -305,7 +324,10 @@ class FirebaseAppCheckHostApiSetup { } else { getTokenChannel.setMessageHandler(nil) } - let getTokenResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getTokenResult\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let getTokenResultChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getTokenResult\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getTokenResultChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -323,13 +345,18 @@ class FirebaseAppCheckHostApiSetup { } else { getTokenResultChannel.setMessageHandler(nil) } - let setTokenAutoRefreshEnabledChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.setTokenAutoRefreshEnabled\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let setTokenAutoRefreshEnabledChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.setTokenAutoRefreshEnabled\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setTokenAutoRefreshEnabledChannel.setMessageHandler { message, reply in let args = message as! [Any?] let appNameArg = args[0] as! String let isTokenAutoRefreshEnabledArg = args[1] as! Bool - api.setTokenAutoRefreshEnabled(appName: appNameArg, isTokenAutoRefreshEnabled: isTokenAutoRefreshEnabledArg) { result in + api.setTokenAutoRefreshEnabled( + appName: appNameArg, isTokenAutoRefreshEnabled: isTokenAutoRefreshEnabledArg + ) { result in switch result { case .success: reply(wrapResult(nil)) @@ -341,7 +368,10 @@ class FirebaseAppCheckHostApiSetup { } else { setTokenAutoRefreshEnabledChannel.setMessageHandler(nil) } - let registerTokenListenerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.registerTokenListener\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let registerTokenListenerChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.registerTokenListener\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { registerTokenListenerChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -358,7 +388,10 @@ class FirebaseAppCheckHostApiSetup { } else { registerTokenListenerChannel.setMessageHandler(nil) } - let getLimitedUseAppCheckTokenChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getLimitedUseAppCheckToken\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + let getLimitedUseAppCheckTokenChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getLimitedUseAppCheckToken\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getLimitedUseAppCheckTokenChannel.setMessageHandler { message, reply in let args = message as! [Any?] diff --git a/packages/firebase_app_check/firebase_app_check/windows/messages.g.cpp b/packages/firebase_app_check/firebase_app_check/windows/messages.g.cpp index d672652a9e6d..d239741562cc 100644 --- a/packages/firebase_app_check/firebase_app_check/windows/messages.g.cpp +++ b/packages/firebase_app_check/firebase_app_check/windows/messages.g.cpp @@ -34,32 +34,36 @@ FlutterError CreateConnectionError(const std::string channel_name) { } namespace { -template +template bool PigeonInternalDeepEquals(const T& a, const T& b); bool PigeonInternalDeepEquals(const double& a, const double& b); -template +template bool PigeonInternalDeepEquals(const std::vector& a, const std::vector& b); -template +template bool PigeonInternalDeepEquals(const std::map& a, const std::map& b); -template -bool PigeonInternalDeepEquals(const std::optional& a, const std::optional& b); +template +bool PigeonInternalDeepEquals(const std::optional& a, + const std::optional& b); -template -bool PigeonInternalDeepEquals(const std::unique_ptr& a, const std::unique_ptr& b); +template +bool PigeonInternalDeepEquals(const std::unique_ptr& a, + const std::unique_ptr& b); -bool PigeonInternalDeepEquals(const ::flutter::EncodableValue& a, const ::flutter::EncodableValue& b); +bool PigeonInternalDeepEquals(const ::flutter::EncodableValue& a, + const ::flutter::EncodableValue& b); -template +template bool PigeonInternalDeepEquals(const T& a, const T& b) { return a == b; } -template -bool PigeonInternalDeepEquals(const std::vector& a, const std::vector& b) { +template +bool PigeonInternalDeepEquals(const std::vector& a, + const std::vector& b) { if (a.size() != b.size()) { return false; } @@ -72,7 +76,8 @@ bool PigeonInternalDeepEquals(const std::vector& a, const std::vector& b) } template -bool PigeonInternalDeepEquals(const std::map& a, const std::map& b) { +bool PigeonInternalDeepEquals(const std::map& a, + const std::map& b) { if (a.size() != b.size()) { return false; } @@ -100,8 +105,9 @@ bool PigeonInternalDeepEquals(const double& a, const double& b) { return (a == b) || (std::isnan(a) && std::isnan(b)); } -template -bool PigeonInternalDeepEquals(const std::optional& a, const std::optional& b) { +template +bool PigeonInternalDeepEquals(const std::optional& a, + const std::optional& b) { if (!a && !b) { return true; } @@ -111,8 +117,9 @@ bool PigeonInternalDeepEquals(const std::optional& a, const std::optional& return PigeonInternalDeepEquals(*a, *b); } -template -bool PigeonInternalDeepEquals(const std::unique_ptr& a, const std::unique_ptr& b) { +template +bool PigeonInternalDeepEquals(const std::unique_ptr& a, + const std::unique_ptr& b) { if (a.get() == b.get()) { return true; } @@ -122,15 +129,18 @@ bool PigeonInternalDeepEquals(const std::unique_ptr& a, const std::unique_ptr return PigeonInternalDeepEquals(*a, *b); } -bool PigeonInternalDeepEquals(const ::flutter::EncodableValue& a, const ::flutter::EncodableValue& b) { +bool PigeonInternalDeepEquals(const ::flutter::EncodableValue& a, + const ::flutter::EncodableValue& b) { if (a.index() != b.index()) { return false; } if (const double* da = std::get_if(&a)) { return PigeonInternalDeepEquals(*da, std::get(b)); - } else if (const ::flutter::EncodableList* la = std::get_if<::flutter::EncodableList>(&a)) { + } else if (const ::flutter::EncodableList* la = + std::get_if<::flutter::EncodableList>(&a)) { return PigeonInternalDeepEquals(*la, std::get<::flutter::EncodableList>(b)); - } else if (const ::flutter::EncodableMap* ma = std::get_if<::flutter::EncodableMap>(&a)) { + } else if (const ::flutter::EncodableMap* ma = + std::get_if<::flutter::EncodableMap>(&a)) { return PigeonInternalDeepEquals(*ma, std::get<::flutter::EncodableMap>(b)); } return a == b; @@ -173,7 +183,8 @@ template size_t PigeonInternalDeepHash(const std::map& v) { size_t result = 0; for (const auto& kv : v) { - result += ((PigeonInternalDeepHash(kv.first) * 31) ^ PigeonInternalDeepHash(kv.second)); + result += ((PigeonInternalDeepHash(kv.first) * 31) ^ + PigeonInternalDeepHash(kv.second)); } return result; } @@ -230,60 +241,66 @@ size_t PigeonInternalDeepHash(const ::flutter::EncodableValue& v) { } // namespace // InternalAppCheckTokenResult -InternalAppCheckTokenResult::InternalAppCheckTokenResult(const std::string& token) - : token_(token) {} +InternalAppCheckTokenResult::InternalAppCheckTokenResult( + const std::string& token) + : token_(token) {} InternalAppCheckTokenResult::InternalAppCheckTokenResult( - const std::string& token, - const int64_t* expiration_timestamp) - : token_(token), - expiration_timestamp_(expiration_timestamp ? std::optional(*expiration_timestamp) : std::nullopt) {} + const std::string& token, const int64_t* expiration_timestamp) + : token_(token), + expiration_timestamp_(expiration_timestamp + ? std::optional(*expiration_timestamp) + : std::nullopt) {} -const std::string& InternalAppCheckTokenResult::token() const { - return token_; -} +const std::string& InternalAppCheckTokenResult::token() const { return token_; } void InternalAppCheckTokenResult::set_token(std::string_view value_arg) { token_ = value_arg; } - const int64_t* InternalAppCheckTokenResult::expiration_timestamp() const { return expiration_timestamp_ ? &(*expiration_timestamp_) : nullptr; } -void InternalAppCheckTokenResult::set_expiration_timestamp(const int64_t* value_arg) { - expiration_timestamp_ = value_arg ? std::optional(*value_arg) : std::nullopt; +void InternalAppCheckTokenResult::set_expiration_timestamp( + const int64_t* value_arg) { + expiration_timestamp_ = + value_arg ? std::optional(*value_arg) : std::nullopt; } void InternalAppCheckTokenResult::set_expiration_timestamp(int64_t value_arg) { expiration_timestamp_ = value_arg; } - EncodableList InternalAppCheckTokenResult::ToEncodableList() const { EncodableList list; list.reserve(2); list.push_back(EncodableValue(token_)); - list.push_back(expiration_timestamp_ ? EncodableValue(*expiration_timestamp_) : EncodableValue()); + list.push_back(expiration_timestamp_ ? EncodableValue(*expiration_timestamp_) + : EncodableValue()); return list; } -InternalAppCheckTokenResult InternalAppCheckTokenResult::FromEncodableList(const EncodableList& list) { - InternalAppCheckTokenResult decoded( - std::get(list[0])); +InternalAppCheckTokenResult InternalAppCheckTokenResult::FromEncodableList( + const EncodableList& list) { + InternalAppCheckTokenResult decoded(std::get(list[0])); auto& encodable_expiration_timestamp = list[1]; if (!encodable_expiration_timestamp.IsNull()) { - decoded.set_expiration_timestamp(std::get(encodable_expiration_timestamp)); + decoded.set_expiration_timestamp( + std::get(encodable_expiration_timestamp)); } return decoded; } -bool InternalAppCheckTokenResult::operator==(const InternalAppCheckTokenResult& other) const { - return PigeonInternalDeepEquals(token_, other.token_) && PigeonInternalDeepEquals(expiration_timestamp_, other.expiration_timestamp_); +bool InternalAppCheckTokenResult::operator==( + const InternalAppCheckTokenResult& other) const { + return PigeonInternalDeepEquals(token_, other.token_) && + PigeonInternalDeepEquals(expiration_timestamp_, + other.expiration_timestamp_); } -bool InternalAppCheckTokenResult::operator!=(const InternalAppCheckTokenResult& other) const { +bool InternalAppCheckTokenResult::operator!=( + const InternalAppCheckTokenResult& other) const { return !(*this == other); } @@ -298,28 +315,31 @@ size_t PigeonInternalDeepHash(const InternalAppCheckTokenResult& v) { return v.Hash(); } - PigeonInternalCodecSerializer::PigeonInternalCodecSerializer() {} EncodableValue PigeonInternalCodecSerializer::ReadValueOfType( - uint8_t type, - ::flutter::ByteStreamReader* stream) const { + uint8_t type, ::flutter::ByteStreamReader* stream) const { switch (type) { case 129: { - return CustomEncodableValue(InternalAppCheckTokenResult::FromEncodableList(std::get(ReadValue(stream)))); - } + return CustomEncodableValue( + InternalAppCheckTokenResult::FromEncodableList( + std::get(ReadValue(stream)))); + } default: return ::flutter::StandardCodecSerializer::ReadValueOfType(type, stream); - } + } } void PigeonInternalCodecSerializer::WriteValue( - const EncodableValue& value, - ::flutter::ByteStreamWriter* stream) const { - if (const CustomEncodableValue* custom_value = std::get_if(&value)) { + const EncodableValue& value, ::flutter::ByteStreamWriter* stream) const { + if (const CustomEncodableValue* custom_value = + std::get_if(&value)) { if (custom_value->type() == typeid(InternalAppCheckTokenResult)) { stream->WriteByte(129); - WriteValue(EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); + WriteValue(EncodableValue( + std::any_cast(*custom_value) + .ToEncodableList()), + stream); return; } } @@ -328,247 +348,321 @@ void PigeonInternalCodecSerializer::WriteValue( /// The codec used by FirebaseAppCheckHostApi. const ::flutter::StandardMessageCodec& FirebaseAppCheckHostApi::GetCodec() { - return ::flutter::StandardMessageCodec::GetInstance(&PigeonInternalCodecSerializer::GetInstance()); + return ::flutter::StandardMessageCodec::GetInstance( + &PigeonInternalCodecSerializer::GetInstance()); } -// Sets up an instance of `FirebaseAppCheckHostApi` to handle messages through the `binary_messenger`. +// Sets up an instance of `FirebaseAppCheckHostApi` to handle messages through +// the `binary_messenger`. void FirebaseAppCheckHostApi::SetUp( - ::flutter::BinaryMessenger* binary_messenger, - FirebaseAppCheckHostApi* api) { + ::flutter::BinaryMessenger* binary_messenger, + FirebaseAppCheckHostApi* api) { FirebaseAppCheckHostApi::SetUp(binary_messenger, api, ""); } void FirebaseAppCheckHostApi::SetUp( - ::flutter::BinaryMessenger* binary_messenger, - FirebaseAppCheckHostApi* api, - const std::string& message_channel_suffix) { - const std::string prepended_suffix = message_channel_suffix.length() > 0 ? std::string(".") + message_channel_suffix : ""; + ::flutter::BinaryMessenger* binary_messenger, FirebaseAppCheckHostApi* api, + const std::string& message_channel_suffix) { + const std::string prepended_suffix = + message_channel_suffix.length() > 0 + ? std::string(".") + message_channel_suffix + : ""; { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.activate" + prepended_suffix, &GetCodec()); + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.firebase_app_check_platform_interface." + "FirebaseAppCheckHostApi.activate" + + prepended_suffix, + &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_app_name_arg = args.at(0); - if (encodable_app_name_arg.IsNull()) { - reply(WrapError("app_name_arg unexpectedly null.")); - return; - } - const auto& app_name_arg = std::get(encodable_app_name_arg); - const auto& encodable_android_provider_arg = args.at(1); - const auto* android_provider_arg = std::get_if(&encodable_android_provider_arg); - const auto& encodable_apple_provider_arg = args.at(2); - const auto* apple_provider_arg = std::get_if(&encodable_apple_provider_arg); - const auto& encodable_debug_token_arg = args.at(3); - const auto* debug_token_arg = std::get_if(&encodable_debug_token_arg); - const auto& encodable_recaptcha_site_key_arg = args.at(4); - const auto* recaptcha_site_key_arg = std::get_if(&encodable_recaptcha_site_key_arg); - api->Activate(app_name_arg, android_provider_arg, apple_provider_arg, debug_token_arg, recaptcha_site_key_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; + channel.SetMessageHandler( + [api](const EncodableValue& message, + const ::flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_app_name_arg = args.at(0); + if (encodable_app_name_arg.IsNull()) { + reply(WrapError("app_name_arg unexpectedly null.")); + return; + } + const auto& app_name_arg = + std::get(encodable_app_name_arg); + const auto& encodable_android_provider_arg = args.at(1); + const auto* android_provider_arg = + std::get_if(&encodable_android_provider_arg); + const auto& encodable_apple_provider_arg = args.at(2); + const auto* apple_provider_arg = + std::get_if(&encodable_apple_provider_arg); + const auto& encodable_debug_token_arg = args.at(3); + const auto* debug_token_arg = + std::get_if(&encodable_debug_token_arg); + const auto& encodable_recaptcha_site_key_arg = args.at(4); + const auto* recaptcha_site_key_arg = + std::get_if(&encodable_recaptcha_site_key_arg); + api->Activate(app_name_arg, android_provider_arg, + apple_provider_arg, debug_token_arg, + recaptcha_site_key_arg, + [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); } else { channel.SetMessageHandler(nullptr); } } { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getToken" + prepended_suffix, &GetCodec()); + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.firebase_app_check_platform_interface." + "FirebaseAppCheckHostApi.getToken" + + prepended_suffix, + &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_app_name_arg = args.at(0); - if (encodable_app_name_arg.IsNull()) { - reply(WrapError("app_name_arg unexpectedly null.")); - return; - } - const auto& app_name_arg = std::get(encodable_app_name_arg); - const auto& encodable_force_refresh_arg = args.at(1); - if (encodable_force_refresh_arg.IsNull()) { - reply(WrapError("force_refresh_arg unexpectedly null.")); - return; - } - const auto& force_refresh_arg = std::get(encodable_force_refresh_arg); - api->GetToken(app_name_arg, force_refresh_arg, [reply](ErrorOr>&& output) { - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - EncodableList wrapped; - auto output_optional = std::move(output).TakeValue(); - if (output_optional) { - wrapped.push_back(EncodableValue(std::move(output_optional).value())); - } else { - wrapped.push_back(EncodableValue()); + channel.SetMessageHandler( + [api](const EncodableValue& message, + const ::flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_app_name_arg = args.at(0); + if (encodable_app_name_arg.IsNull()) { + reply(WrapError("app_name_arg unexpectedly null.")); + return; + } + const auto& app_name_arg = + std::get(encodable_app_name_arg); + const auto& encodable_force_refresh_arg = args.at(1); + if (encodable_force_refresh_arg.IsNull()) { + reply(WrapError("force_refresh_arg unexpectedly null.")); + return; + } + const auto& force_refresh_arg = + std::get(encodable_force_refresh_arg); + api->GetToken( + app_name_arg, force_refresh_arg, + [reply](ErrorOr>&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + EncodableList wrapped; + auto output_optional = std::move(output).TakeValue(); + if (output_optional) { + wrapped.push_back( + EncodableValue(std::move(output_optional).value())); + } else { + wrapped.push_back(EncodableValue()); + } + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); } - reply(EncodableValue(std::move(wrapped))); }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); } else { channel.SetMessageHandler(nullptr); } } { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getTokenResult" + prepended_suffix, &GetCodec()); + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.firebase_app_check_platform_interface." + "FirebaseAppCheckHostApi.getTokenResult" + + prepended_suffix, + &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_app_name_arg = args.at(0); - if (encodable_app_name_arg.IsNull()) { - reply(WrapError("app_name_arg unexpectedly null.")); - return; - } - const auto& app_name_arg = std::get(encodable_app_name_arg); - const auto& encodable_force_refresh_arg = args.at(1); - if (encodable_force_refresh_arg.IsNull()) { - reply(WrapError("force_refresh_arg unexpectedly null.")); - return; - } - const auto& force_refresh_arg = std::get(encodable_force_refresh_arg); - api->GetTokenResult(app_name_arg, force_refresh_arg, [reply](ErrorOr>&& output) { - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - EncodableList wrapped; - auto output_optional = std::move(output).TakeValue(); - if (output_optional) { - wrapped.push_back(CustomEncodableValue(std::move(output_optional).value())); - } else { - wrapped.push_back(EncodableValue()); + channel.SetMessageHandler( + [api](const EncodableValue& message, + const ::flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_app_name_arg = args.at(0); + if (encodable_app_name_arg.IsNull()) { + reply(WrapError("app_name_arg unexpectedly null.")); + return; + } + const auto& app_name_arg = + std::get(encodable_app_name_arg); + const auto& encodable_force_refresh_arg = args.at(1); + if (encodable_force_refresh_arg.IsNull()) { + reply(WrapError("force_refresh_arg unexpectedly null.")); + return; + } + const auto& force_refresh_arg = + std::get(encodable_force_refresh_arg); + api->GetTokenResult( + app_name_arg, force_refresh_arg, + [reply](ErrorOr>&& + output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + EncodableList wrapped; + auto output_optional = std::move(output).TakeValue(); + if (output_optional) { + wrapped.push_back(CustomEncodableValue( + std::move(output_optional).value())); + } else { + wrapped.push_back(EncodableValue()); + } + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); } - reply(EncodableValue(std::move(wrapped))); }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); } else { channel.SetMessageHandler(nullptr); } } { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.setTokenAutoRefreshEnabled" + prepended_suffix, &GetCodec()); + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.firebase_app_check_platform_interface." + "FirebaseAppCheckHostApi.setTokenAutoRefreshEnabled" + + prepended_suffix, + &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_app_name_arg = args.at(0); - if (encodable_app_name_arg.IsNull()) { - reply(WrapError("app_name_arg unexpectedly null.")); - return; - } - const auto& app_name_arg = std::get(encodable_app_name_arg); - const auto& encodable_is_token_auto_refresh_enabled_arg = args.at(1); - if (encodable_is_token_auto_refresh_enabled_arg.IsNull()) { - reply(WrapError("is_token_auto_refresh_enabled_arg unexpectedly null.")); - return; - } - const auto& is_token_auto_refresh_enabled_arg = std::get(encodable_is_token_auto_refresh_enabled_arg); - api->SetTokenAutoRefreshEnabled(app_name_arg, is_token_auto_refresh_enabled_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; + channel.SetMessageHandler( + [api](const EncodableValue& message, + const ::flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_app_name_arg = args.at(0); + if (encodable_app_name_arg.IsNull()) { + reply(WrapError("app_name_arg unexpectedly null.")); + return; + } + const auto& app_name_arg = + std::get(encodable_app_name_arg); + const auto& encodable_is_token_auto_refresh_enabled_arg = + args.at(1); + if (encodable_is_token_auto_refresh_enabled_arg.IsNull()) { + reply(WrapError( + "is_token_auto_refresh_enabled_arg unexpectedly null.")); + return; + } + const auto& is_token_auto_refresh_enabled_arg = + std::get(encodable_is_token_auto_refresh_enabled_arg); + api->SetTokenAutoRefreshEnabled( + app_name_arg, is_token_auto_refresh_enabled_arg, + [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); } else { channel.SetMessageHandler(nullptr); } } { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.registerTokenListener" + prepended_suffix, &GetCodec()); + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.firebase_app_check_platform_interface." + "FirebaseAppCheckHostApi.registerTokenListener" + + prepended_suffix, + &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_app_name_arg = args.at(0); - if (encodable_app_name_arg.IsNull()) { - reply(WrapError("app_name_arg unexpectedly null.")); - return; - } - const auto& app_name_arg = std::get(encodable_app_name_arg); - api->RegisterTokenListener(app_name_arg, [reply](ErrorOr&& output) { - if (output.has_error()) { - reply(WrapError(output.error())); - return; + channel.SetMessageHandler( + [api](const EncodableValue& message, + const ::flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_app_name_arg = args.at(0); + if (encodable_app_name_arg.IsNull()) { + reply(WrapError("app_name_arg unexpectedly null.")); + return; + } + const auto& app_name_arg = + std::get(encodable_app_name_arg); + api->RegisterTokenListener( + app_name_arg, [reply](ErrorOr&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + EncodableList wrapped; + wrapped.push_back( + EncodableValue(std::move(output).TakeValue())); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); } - EncodableList wrapped; - wrapped.push_back(EncodableValue(std::move(output).TakeValue())); - reply(EncodableValue(std::move(wrapped))); }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); } else { channel.SetMessageHandler(nullptr); } } { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getLimitedUseAppCheckToken" + prepended_suffix, &GetCodec()); + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.firebase_app_check_platform_interface." + "FirebaseAppCheckHostApi.getLimitedUseAppCheckToken" + + prepended_suffix, + &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_app_name_arg = args.at(0); - if (encodable_app_name_arg.IsNull()) { - reply(WrapError("app_name_arg unexpectedly null.")); - return; - } - const auto& app_name_arg = std::get(encodable_app_name_arg); - api->GetLimitedUseAppCheckToken(app_name_arg, [reply](ErrorOr&& output) { - if (output.has_error()) { - reply(WrapError(output.error())); - return; + channel.SetMessageHandler( + [api](const EncodableValue& message, + const ::flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_app_name_arg = args.at(0); + if (encodable_app_name_arg.IsNull()) { + reply(WrapError("app_name_arg unexpectedly null.")); + return; + } + const auto& app_name_arg = + std::get(encodable_app_name_arg); + api->GetLimitedUseAppCheckToken( + app_name_arg, [reply](ErrorOr&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + EncodableList wrapped; + wrapped.push_back( + EncodableValue(std::move(output).TakeValue())); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); } - EncodableList wrapped; - wrapped.push_back(EncodableValue(std::move(output).TakeValue())); - reply(EncodableValue(std::move(wrapped))); }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); } else { channel.SetMessageHandler(nullptr); } } } -EncodableValue FirebaseAppCheckHostApi::WrapError(std::string_view error_message) { - return EncodableValue(EncodableList{ - EncodableValue(std::string(error_message)), - EncodableValue("Error"), - EncodableValue() - }); +EncodableValue FirebaseAppCheckHostApi::WrapError( + std::string_view error_message) { + return EncodableValue( + EncodableList{EncodableValue(std::string(error_message)), + EncodableValue("Error"), EncodableValue()}); } EncodableValue FirebaseAppCheckHostApi::WrapError(const FlutterError& error) { - return EncodableValue(EncodableList{ - EncodableValue(error.code()), - EncodableValue(error.message()), - error.details() - }); + return EncodableValue(EncodableList{EncodableValue(error.code()), + EncodableValue(error.message()), + error.details()}); } } // namespace firebase_app_check_windows diff --git a/packages/firebase_app_check/firebase_app_check/windows/messages.g.h b/packages/firebase_app_check/firebase_app_check/windows/messages.g.h index f27984cb2d17..ab7fde9147b5 100644 --- a/packages/firebase_app_check/firebase_app_check/windows/messages.g.h +++ b/packages/firebase_app_check/firebase_app_check/windows/messages.g.h @@ -17,17 +17,16 @@ namespace firebase_app_check_windows { - // Generated class from Pigeon. class FlutterError { public: - explicit FlutterError(const std::string& code) - : code_(code) {} + explicit FlutterError(const std::string& code) : code_(code) {} explicit FlutterError(const std::string& code, const std::string& message) - : code_(code), message_(message) {} - explicit FlutterError(const std::string& code, const std::string& message, const ::flutter::EncodableValue& details) - : code_(code), message_(message), details_(details) {} + : code_(code), message_(message) {} + explicit FlutterError(const std::string& code, const std::string& message, + const ::flutter::EncodableValue& details) + : code_(code), message_(message), details_(details) {} const std::string& code() const { return code_; } const std::string& message() const { return message_; } @@ -39,7 +38,8 @@ class FlutterError { ::flutter::EncodableValue details_; }; -template class ErrorOr { +template +class ErrorOr { public: ErrorOr(const T& rhs) : v_(rhs) {} ErrorOr(const T&& rhs) : v_(std::move(rhs)) {} @@ -58,8 +58,6 @@ template class ErrorOr { std::variant v_; }; - - // Generated class from Pigeon that represents data sent in messages. class InternalAppCheckTokenResult { public: @@ -67,9 +65,8 @@ class InternalAppCheckTokenResult { explicit InternalAppCheckTokenResult(const std::string& token); // Constructs an object setting all fields. - explicit InternalAppCheckTokenResult( - const std::string& token, - const int64_t* expiration_timestamp); + explicit InternalAppCheckTokenResult(const std::string& token, + const int64_t* expiration_timestamp); const std::string& token() const; void set_token(std::string_view value_arg); @@ -80,10 +77,13 @@ class InternalAppCheckTokenResult { bool operator==(const InternalAppCheckTokenResult& other) const; bool operator!=(const InternalAppCheckTokenResult& other) const; - /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. + /// Returns a hash code value for the object. This method is supported for the + /// benefit of hash tables. size_t Hash() const; + private: - static InternalAppCheckTokenResult FromEncodableList(const ::flutter::EncodableList& list); + static InternalAppCheckTokenResult FromEncodableList( + const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; friend class FirebaseAppCheckHostApi; friend class PigeonInternalCodecSerializer; @@ -91,8 +91,8 @@ class InternalAppCheckTokenResult { std::optional expiration_timestamp_; }; - -class PigeonInternalCodecSerializer : public ::flutter::StandardCodecSerializer { +class PigeonInternalCodecSerializer + : public ::flutter::StandardCodecSerializer { public: PigeonInternalCodecSerializer(); inline static PigeonInternalCodecSerializer& GetInstance() { @@ -100,59 +100,57 @@ class PigeonInternalCodecSerializer : public ::flutter::StandardCodecSerializer return sInstance; } - void WriteValue( - const ::flutter::EncodableValue& value, - ::flutter::ByteStreamWriter* stream) const override; + void WriteValue(const ::flutter::EncodableValue& value, + ::flutter::ByteStreamWriter* stream) const override; + protected: ::flutter::EncodableValue ReadValueOfType( - uint8_t type, - ::flutter::ByteStreamReader* stream) const override; + uint8_t type, ::flutter::ByteStreamReader* stream) const override; }; -// Generated interface from Pigeon that represents a handler of messages from Flutter. +// Generated interface from Pigeon that represents a handler of messages from +// Flutter. class FirebaseAppCheckHostApi { public: FirebaseAppCheckHostApi(const FirebaseAppCheckHostApi&) = delete; FirebaseAppCheckHostApi& operator=(const FirebaseAppCheckHostApi&) = delete; virtual ~FirebaseAppCheckHostApi() {} virtual void Activate( - const std::string& app_name, - const std::string* android_provider, - const std::string* apple_provider, - const std::string* debug_token, - const std::string* recaptcha_site_key, - std::function reply)> result) = 0; + const std::string& app_name, const std::string* android_provider, + const std::string* apple_provider, const std::string* debug_token, + const std::string* recaptcha_site_key, + std::function reply)> result) = 0; virtual void GetToken( - const std::string& app_name, - bool force_refresh, - std::function> reply)> result) = 0; + const std::string& app_name, bool force_refresh, + std::function> reply)> + result) = 0; virtual void GetTokenResult( - const std::string& app_name, - bool force_refresh, - std::function> reply)> result) = 0; + const std::string& app_name, bool force_refresh, + std::function< + void(ErrorOr> reply)> + result) = 0; virtual void SetTokenAutoRefreshEnabled( - const std::string& app_name, - bool is_token_auto_refresh_enabled, - std::function reply)> result) = 0; + const std::string& app_name, bool is_token_auto_refresh_enabled, + std::function reply)> result) = 0; virtual void RegisterTokenListener( - const std::string& app_name, - std::function reply)> result) = 0; + const std::string& app_name, + std::function reply)> result) = 0; virtual void GetLimitedUseAppCheckToken( - const std::string& app_name, - std::function reply)> result) = 0; + const std::string& app_name, + std::function reply)> result) = 0; // The codec used by FirebaseAppCheckHostApi. static const ::flutter::StandardMessageCodec& GetCodec(); - // Sets up an instance of `FirebaseAppCheckHostApi` to handle messages through the `binary_messenger`. - static void SetUp( - ::flutter::BinaryMessenger* binary_messenger, - FirebaseAppCheckHostApi* api); - static void SetUp( - ::flutter::BinaryMessenger* binary_messenger, - FirebaseAppCheckHostApi* api, - const std::string& message_channel_suffix); + // Sets up an instance of `FirebaseAppCheckHostApi` to handle messages through + // the `binary_messenger`. + static void SetUp(::flutter::BinaryMessenger* binary_messenger, + FirebaseAppCheckHostApi* api); + static void SetUp(::flutter::BinaryMessenger* binary_messenger, + FirebaseAppCheckHostApi* api, + const std::string& message_channel_suffix); static ::flutter::EncodableValue WrapError(std::string_view error_message); static ::flutter::EncodableValue WrapError(const FlutterError& error); + protected: FirebaseAppCheckHostApi() = default; }; diff --git a/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/pigeon/messages.pigeon.dart b/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/pigeon/messages.pigeon.dart index a49a519209a0..6033bf98471a 100644 --- a/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/pigeon/messages.pigeon.dart +++ b/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/pigeon/messages.pigeon.dart @@ -13,9 +13,9 @@ import 'package:flutter/services.dart'; import 'package:meta/meta.dart' show immutable, protected, visibleForTesting; Object? _extractReplyValueOrThrow( - List? replyList, - String channelName, { - required bool isNullValid, + List? replyList, + String channelName, { + required bool isNullValid, }) { if (replyList == null) { throw PlatformException( @@ -99,7 +99,6 @@ int _deepHash(Object? value) { return value.hashCode; } - class InternalAppCheckTokenResult { InternalAppCheckTokenResult({ required this.token, @@ -118,7 +117,8 @@ class InternalAppCheckTokenResult { } Object encode() { - return _toList(); } + return _toList(); + } static InternalAppCheckTokenResult decode(Object result) { result as List; @@ -131,13 +131,15 @@ class InternalAppCheckTokenResult { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes bool operator ==(Object other) { - if (other is! InternalAppCheckTokenResult || other.runtimeType != runtimeType) { + if (other is! InternalAppCheckTokenResult || + other.runtimeType != runtimeType) { return false; } if (identical(this, other)) { return true; } - return _deepEquals(token, other.token) && _deepEquals(expirationTimestamp, other.expirationTimestamp); + return _deepEquals(token, other.token) && + _deepEquals(expirationTimestamp, other.expirationTimestamp); } @override @@ -145,7 +147,6 @@ class InternalAppCheckTokenResult { int get hashCode => _deepHash([runtimeType, ..._toList()]); } - class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -153,7 +154,7 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is InternalAppCheckTokenResult) { + } else if (value is InternalAppCheckTokenResult) { buffer.putUint8(129); writeValue(buffer, value.encode()); } else { @@ -176,124 +177,145 @@ class FirebaseAppCheckHostApi { /// Constructor for [FirebaseAppCheckHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - FirebaseAppCheckHostApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + FirebaseAppCheckHostApi( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + pigeonVar_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); final String pigeonVar_messageChannelSuffix; - Future activate(String appName, String? androidProvider, String? appleProvider, String? debugToken, String? recaptchaSiteKey) async { - final pigeonVar_channelName = 'dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.activate$pigeonVar_messageChannelSuffix'; + Future activate( + String appName, + String? androidProvider, + String? appleProvider, + String? debugToken, + String? recaptchaSiteKey) async { + final pigeonVar_channelName = + 'dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.activate$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send([appName, androidProvider, appleProvider, debugToken, recaptchaSiteKey]); + final Future pigeonVar_sendFuture = pigeonVar_channel + .send([ + appName, + androidProvider, + appleProvider, + debugToken, + recaptchaSiteKey + ]); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: true, - ) - ; + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } Future getToken(String appName, bool forceRefresh) async { - final pigeonVar_channelName = 'dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getToken$pigeonVar_messageChannelSuffix'; + final pigeonVar_channelName = + 'dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getToken$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send([appName, forceRefresh]); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([appName, forceRefresh]); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: true, - ) - ; + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); return pigeonVar_replyValue as String?; } - Future getTokenResult(String appName, bool forceRefresh) async { - final pigeonVar_channelName = 'dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getTokenResult$pigeonVar_messageChannelSuffix'; + Future getTokenResult( + String appName, bool forceRefresh) async { + final pigeonVar_channelName = + 'dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getTokenResult$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send([appName, forceRefresh]); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([appName, forceRefresh]); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: true, - ) - ; + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); return pigeonVar_replyValue as InternalAppCheckTokenResult?; } - Future setTokenAutoRefreshEnabled(String appName, bool isTokenAutoRefreshEnabled) async { - final pigeonVar_channelName = 'dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.setTokenAutoRefreshEnabled$pigeonVar_messageChannelSuffix'; + Future setTokenAutoRefreshEnabled( + String appName, bool isTokenAutoRefreshEnabled) async { + final pigeonVar_channelName = + 'dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.setTokenAutoRefreshEnabled$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send([appName, isTokenAutoRefreshEnabled]); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([appName, isTokenAutoRefreshEnabled]); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: true, - ) - ; + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } Future registerTokenListener(String appName) async { - final pigeonVar_channelName = 'dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.registerTokenListener$pigeonVar_messageChannelSuffix'; + final pigeonVar_channelName = + 'dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.registerTokenListener$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send([appName]); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([appName]); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: false, - ) - ; + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); return pigeonVar_replyValue! as String; } Future getLimitedUseAppCheckToken(String appName) async { - final pigeonVar_channelName = 'dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getLimitedUseAppCheckToken$pigeonVar_messageChannelSuffix'; + final pigeonVar_channelName = + 'dev.flutter.pigeon.firebase_app_check_platform_interface.FirebaseAppCheckHostApi.getLimitedUseAppCheckToken$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send([appName]); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([appName]); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: false, - ) - ; + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); return pigeonVar_replyValue! as String; } } diff --git a/packages/firebase_core/firebase_core/android/src/main/java/io/flutter/plugins/firebase/core/GeneratedAndroidFirebaseCore.java b/packages/firebase_core/firebase_core/android/src/main/java/io/flutter/plugins/firebase/core/GeneratedAndroidFirebaseCore.java index a7144782965e..b0a698faf51c 100644 --- a/packages/firebase_core/firebase_core/android/src/main/java/io/flutter/plugins/firebase/core/GeneratedAndroidFirebaseCore.java +++ b/packages/firebase_core/firebase_core/android/src/main/java/io/flutter/plugins/firebase/core/GeneratedAndroidFirebaseCore.java @@ -22,11 +22,8 @@ import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; /** Generated class from Pigeon. */ @SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression", "serial"}) @@ -59,8 +56,12 @@ static int pigeonFloatHashCode(float f) { } static boolean pigeonDeepEquals(Object a, Object b) { - if (a == b) { return true; } - if (a == null || b == null) { return false; } + 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); } @@ -86,7 +87,9 @@ static boolean pigeonDeepEquals(Object a, Object b) { if (a instanceof List && b instanceof List) { List listA = (List) a; List listB = (List) b; - if (listA.size() != listB.size()) { return false; } + 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; @@ -97,7 +100,9 @@ static boolean pigeonDeepEquals(Object a, Object b) { if (a instanceof Map && b instanceof Map) { Map mapA = (Map) a; Map mapB = (Map) b; - if (mapA.size() != mapB.size()) { return false; } + if (mapA.size() != mapB.size()) { + return false; + } for (Map.Entry entryA : mapA.entrySet()) { Object keyA = entryA.getKey(); Object valueA = entryA.getValue(); @@ -130,7 +135,9 @@ static boolean pigeonDeepEquals(Object a, Object b) { } static int pigeonDeepHashCode(Object value) { - if (value == null) { return 0; } + if (value == null) { + return 0; + } if (value instanceof byte[]) { return Arrays.hashCode((byte[]) value); } @@ -158,7 +165,8 @@ static int pigeonDeepHashCode(Object value) { if (value instanceof Map) { int result = 0; for (Map.Entry entry : ((Map) value).entrySet()) { - result += ((pigeonDeepHashCode(entry.getKey()) * 31) ^ pigeonDeepHashCode(entry.getValue())); + result += + ((pigeonDeepHashCode(entry.getKey()) * 31) ^ pigeonDeepHashCode(entry.getValue())); } return result; } @@ -178,7 +186,6 @@ static int pigeonDeepHashCode(Object value) { return value.hashCode(); } - /** Error class for passing custom error details to Flutter via a thrown PlatformException. */ public static class FlutterError extends RuntimeException { @@ -188,8 +195,7 @@ public static class FlutterError extends RuntimeException { /** 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) - { + public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) { super(message); this.code = code; this.details = details; @@ -208,7 +214,7 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { errorList.add(exception.toString()); errorList.add(exception.getClass().getSimpleName()); errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); } return errorList; } @@ -376,15 +382,49 @@ public void setAppGroupId(@Nullable String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } CoreFirebaseOptions that = (CoreFirebaseOptions) o; - return pigeonDeepEquals(apiKey, that.apiKey) && pigeonDeepEquals(appId, that.appId) && pigeonDeepEquals(messagingSenderId, that.messagingSenderId) && pigeonDeepEquals(projectId, that.projectId) && pigeonDeepEquals(authDomain, that.authDomain) && pigeonDeepEquals(databaseURL, that.databaseURL) && pigeonDeepEquals(storageBucket, that.storageBucket) && pigeonDeepEquals(measurementId, that.measurementId) && pigeonDeepEquals(trackingId, that.trackingId) && pigeonDeepEquals(deepLinkURLScheme, that.deepLinkURLScheme) && pigeonDeepEquals(androidClientId, that.androidClientId) && pigeonDeepEquals(iosClientId, that.iosClientId) && pigeonDeepEquals(iosBundleId, that.iosBundleId) && pigeonDeepEquals(appGroupId, that.appGroupId); + return pigeonDeepEquals(apiKey, that.apiKey) + && pigeonDeepEquals(appId, that.appId) + && pigeonDeepEquals(messagingSenderId, that.messagingSenderId) + && pigeonDeepEquals(projectId, that.projectId) + && pigeonDeepEquals(authDomain, that.authDomain) + && pigeonDeepEquals(databaseURL, that.databaseURL) + && pigeonDeepEquals(storageBucket, that.storageBucket) + && pigeonDeepEquals(measurementId, that.measurementId) + && pigeonDeepEquals(trackingId, that.trackingId) + && pigeonDeepEquals(deepLinkURLScheme, that.deepLinkURLScheme) + && pigeonDeepEquals(androidClientId, that.androidClientId) + && pigeonDeepEquals(iosClientId, that.iosClientId) + && pigeonDeepEquals(iosBundleId, that.iosBundleId) + && pigeonDeepEquals(appGroupId, that.appGroupId); } @Override public int hashCode() { - Object[] fields = new Object[] {getClass(), apiKey, appId, messagingSenderId, projectId, authDomain, databaseURL, storageBucket, measurementId, trackingId, deepLinkURLScheme, androidClientId, iosClientId, iosBundleId, appGroupId}; + Object[] fields = + new Object[] { + getClass(), + apiKey, + appId, + messagingSenderId, + projectId, + authDomain, + databaseURL, + storageBucket, + measurementId, + trackingId, + deepLinkURLScheme, + androidClientId, + iosClientId, + iosBundleId, + appGroupId + }; return pigeonDeepHashCode(fields); } @@ -632,15 +672,26 @@ public void setPluginConstants(@NonNull Map setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } CoreInitializeResponse that = (CoreInitializeResponse) o; - return pigeonDeepEquals(name, that.name) && pigeonDeepEquals(options, that.options) && pigeonDeepEquals(isAutomaticDataCollectionEnabled, that.isAutomaticDataCollectionEnabled) && pigeonDeepEquals(pluginConstants, that.pluginConstants); + return pigeonDeepEquals(name, that.name) + && pigeonDeepEquals(options, that.options) + && pigeonDeepEquals( + isAutomaticDataCollectionEnabled, that.isAutomaticDataCollectionEnabled) + && pigeonDeepEquals(pluginConstants, that.pluginConstants); } @Override public int hashCode() { - Object[] fields = new Object[] {getClass(), name, options, isAutomaticDataCollectionEnabled, pluginConstants}; + Object[] fields = + new Object[] { + getClass(), name, options, isAutomaticDataCollectionEnabled, pluginConstants + }; return pigeonDeepHashCode(fields); } @@ -743,7 +794,6 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { } } - /** Asynchronous error handling return type for non-nullable API method returns. */ public interface Result { /** Success case callback method for handling returns. */ @@ -752,6 +802,7 @@ public interface 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. */ @@ -760,6 +811,7 @@ public interface NullableResult { /** 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. */ @@ -768,10 +820,14 @@ public interface VoidResult { /** 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 FirebaseCoreHostApi { - void initializeApp(@NonNull String appName, @NonNull CoreFirebaseOptions initializeAppRequest, @NonNull Result result); + void initializeApp( + @NonNull String appName, + @NonNull CoreFirebaseOptions initializeAppRequest, + @NonNull Result result); void initializeCore(@NonNull Result> result); @@ -781,16 +837,27 @@ public interface FirebaseCoreHostApi { static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } - /**Sets up an instance of `FirebaseCoreHostApi` to handle messages through the `binaryMessenger`. */ + + /** + * Sets up an instance of `FirebaseCoreHostApi` to handle messages through the + * `binaryMessenger`. + */ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable FirebaseCoreHostApi api) { setUp(binaryMessenger, "", api); } - static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String messageChannelSuffix, @Nullable FirebaseCoreHostApi api) { + + static void setUp( + @NonNull BinaryMessenger binaryMessenger, + @NonNull String messageChannelSuffix, + @Nullable FirebaseCoreHostApi api) { messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeApp" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeApp" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -820,7 +887,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeCore" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeCore" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -847,7 +917,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.optionsFromResource" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.optionsFromResource" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -873,12 +946,15 @@ public void error(Throwable error) { } } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface FirebaseAppHostApi { - void setAutomaticDataCollectionEnabled(@NonNull String appName, @NonNull Boolean enabled, @NonNull VoidResult result); + void setAutomaticDataCollectionEnabled( + @NonNull String appName, @NonNull Boolean enabled, @NonNull VoidResult result); - void setAutomaticResourceManagementEnabled(@NonNull String appName, @NonNull Boolean enabled, @NonNull VoidResult result); + void setAutomaticResourceManagementEnabled( + @NonNull String appName, @NonNull Boolean enabled, @NonNull VoidResult result); void delete(@NonNull String appName, @NonNull VoidResult result); @@ -886,16 +962,26 @@ public interface FirebaseAppHostApi { static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } - /**Sets up an instance of `FirebaseAppHostApi` to handle messages through the `binaryMessenger`. */ + + /** + * Sets up an instance of `FirebaseAppHostApi` to handle messages through the `binaryMessenger`. + */ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable FirebaseAppHostApi api) { setUp(binaryMessenger, "", api); } - static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String messageChannelSuffix, @Nullable FirebaseAppHostApi api) { + + static void setUp( + @NonNull BinaryMessenger binaryMessenger, + @NonNull String messageChannelSuffix, + @Nullable FirebaseAppHostApi api) { messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticDataCollectionEnabled" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticDataCollectionEnabled" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -925,7 +1011,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticResourceManagementEnabled" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticResourceManagementEnabled" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -955,7 +1044,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.delete" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.delete" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { diff --git a/packages/firebase_core/firebase_core/ios/firebase_core/Sources/firebase_core/include/firebase_core/messages.g.h b/packages/firebase_core/firebase_core/ios/firebase_core/Sources/firebase_core/include/firebase_core/messages.g.h index 8eea66fa1ee9..913fdbbd3e43 100644 --- a/packages/firebase_core/firebase_core/ios/firebase_core/Sources/firebase_core/include/firebase_core/messages.g.h +++ b/packages/firebase_core/firebase_core/ios/firebase_core/Sources/firebase_core/include/firebase_core/messages.g.h @@ -20,70 +20,84 @@ NS_ASSUME_NONNULL_BEGIN /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithApiKey:(NSString *)apiKey - appId:(NSString *)appId - messagingSenderId:(NSString *)messagingSenderId - projectId:(NSString *)projectId - authDomain:(nullable NSString *)authDomain - databaseURL:(nullable NSString *)databaseURL - storageBucket:(nullable NSString *)storageBucket - measurementId:(nullable NSString *)measurementId - trackingId:(nullable NSString *)trackingId - deepLinkURLScheme:(nullable NSString *)deepLinkURLScheme - androidClientId:(nullable NSString *)androidClientId - iosClientId:(nullable NSString *)iosClientId - iosBundleId:(nullable NSString *)iosBundleId - appGroupId:(nullable NSString *)appGroupId; -@property(nonatomic, copy) NSString * apiKey; -@property(nonatomic, copy) NSString * appId; -@property(nonatomic, copy) NSString * messagingSenderId; -@property(nonatomic, copy) NSString * projectId; -@property(nonatomic, copy, nullable) NSString * authDomain; -@property(nonatomic, copy, nullable) NSString * databaseURL; -@property(nonatomic, copy, nullable) NSString * storageBucket; -@property(nonatomic, copy, nullable) NSString * measurementId; -@property(nonatomic, copy, nullable) NSString * trackingId; -@property(nonatomic, copy, nullable) NSString * deepLinkURLScheme; -@property(nonatomic, copy, nullable) NSString * androidClientId; -@property(nonatomic, copy, nullable) NSString * iosClientId; -@property(nonatomic, copy, nullable) NSString * iosBundleId; -@property(nonatomic, copy, nullable) NSString * appGroupId; + appId:(NSString *)appId + messagingSenderId:(NSString *)messagingSenderId + projectId:(NSString *)projectId + authDomain:(nullable NSString *)authDomain + databaseURL:(nullable NSString *)databaseURL + storageBucket:(nullable NSString *)storageBucket + measurementId:(nullable NSString *)measurementId + trackingId:(nullable NSString *)trackingId + deepLinkURLScheme:(nullable NSString *)deepLinkURLScheme + androidClientId:(nullable NSString *)androidClientId + iosClientId:(nullable NSString *)iosClientId + iosBundleId:(nullable NSString *)iosBundleId + appGroupId:(nullable NSString *)appGroupId; +@property(nonatomic, copy) NSString *apiKey; +@property(nonatomic, copy) NSString *appId; +@property(nonatomic, copy) NSString *messagingSenderId; +@property(nonatomic, copy) NSString *projectId; +@property(nonatomic, copy, nullable) NSString *authDomain; +@property(nonatomic, copy, nullable) NSString *databaseURL; +@property(nonatomic, copy, nullable) NSString *storageBucket; +@property(nonatomic, copy, nullable) NSString *measurementId; +@property(nonatomic, copy, nullable) NSString *trackingId; +@property(nonatomic, copy, nullable) NSString *deepLinkURLScheme; +@property(nonatomic, copy, nullable) NSString *androidClientId; +@property(nonatomic, copy, nullable) NSString *iosClientId; +@property(nonatomic, copy, nullable) NSString *iosBundleId; +@property(nonatomic, copy, nullable) NSString *appGroupId; @end @interface CoreInitializeResponse : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithName:(NSString *)name - options:(CoreFirebaseOptions *)options + options:(CoreFirebaseOptions *)options isAutomaticDataCollectionEnabled:(nullable NSNumber *)isAutomaticDataCollectionEnabled - pluginConstants:(NSDictionary *)pluginConstants; -@property(nonatomic, copy) NSString * name; -@property(nonatomic, strong) CoreFirebaseOptions * options; -@property(nonatomic, strong, nullable) NSNumber * isAutomaticDataCollectionEnabled; -@property(nonatomic, copy) NSDictionary * pluginConstants; + pluginConstants:(NSDictionary *)pluginConstants; +@property(nonatomic, copy) NSString *name; +@property(nonatomic, strong) CoreFirebaseOptions *options; +@property(nonatomic, strong, nullable) NSNumber *isAutomaticDataCollectionEnabled; +@property(nonatomic, copy) NSDictionary *pluginConstants; @end /// The codec used by all APIs. NSObject *nullGetMessagesCodec(void); @protocol FirebaseCoreHostApi -- (void)initializeAppAppName:(NSString *)appName initializeAppRequest:(CoreFirebaseOptions *)initializeAppRequest completion:(void (^)(CoreInitializeResponse *_Nullable, FlutterError *_Nullable))completion; -- (void)initializeCoreWithCompletion:(void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion; -- (void)optionsFromResourceWithCompletion:(void (^)(CoreFirebaseOptions *_Nullable, FlutterError *_Nullable))completion; +- (void)initializeAppAppName:(NSString *)appName + initializeAppRequest:(CoreFirebaseOptions *)initializeAppRequest + completion:(void (^)(CoreInitializeResponse *_Nullable, + FlutterError *_Nullable))completion; +- (void)initializeCoreWithCompletion:(void (^)(NSArray *_Nullable, + FlutterError *_Nullable))completion; +- (void)optionsFromResourceWithCompletion:(void (^)(CoreFirebaseOptions *_Nullable, + FlutterError *_Nullable))completion; @end -extern void SetUpFirebaseCoreHostApi(id binaryMessenger, NSObject *_Nullable api); - -extern void SetUpFirebaseCoreHostApiWithSuffix(id binaryMessenger, NSObject *_Nullable api, NSString *messageChannelSuffix); +extern void SetUpFirebaseCoreHostApi(id binaryMessenger, + NSObject *_Nullable api); +extern void SetUpFirebaseCoreHostApiWithSuffix(id binaryMessenger, + NSObject *_Nullable api, + NSString *messageChannelSuffix); @protocol FirebaseAppHostApi -- (void)setAutomaticDataCollectionEnabledAppName:(NSString *)appName enabled:(BOOL)enabled completion:(void (^)(FlutterError *_Nullable))completion; -- (void)setAutomaticResourceManagementEnabledAppName:(NSString *)appName enabled:(BOOL)enabled completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setAutomaticDataCollectionEnabledAppName:(NSString *)appName + enabled:(BOOL)enabled + completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setAutomaticResourceManagementEnabledAppName:(NSString *)appName + enabled:(BOOL)enabled + completion:(void (^)(FlutterError *_Nullable))completion; - (void)deleteAppName:(NSString *)appName completion:(void (^)(FlutterError *_Nullable))completion; @end -extern void SetUpFirebaseAppHostApi(id binaryMessenger, NSObject *_Nullable api); +extern void SetUpFirebaseAppHostApi(id binaryMessenger, + NSObject *_Nullable api); -extern void SetUpFirebaseAppHostApiWithSuffix(id binaryMessenger, NSObject *_Nullable api, NSString *messageChannelSuffix); +extern void SetUpFirebaseAppHostApiWithSuffix(id binaryMessenger, + NSObject *_Nullable api, + NSString *messageChannelSuffix); NS_ASSUME_NONNULL_END diff --git a/packages/firebase_core/firebase_core/ios/firebase_core/Sources/firebase_core/messages.g.m b/packages/firebase_core/firebase_core/ios/firebase_core/Sources/firebase_core/messages.g.m index 38e4dbb85cfc..b1a0a1e69e45 100644 --- a/packages/firebase_core/firebase_core/ios/firebase_core/Sources/firebase_core/messages.g.m +++ b/packages/firebase_core/firebase_core/ios/firebase_core/Sources/firebase_core/messages.g.m @@ -23,7 +23,8 @@ static BOOL __attribute__((unused)) FLTPigeonDeepEquals(id _Nullable a, id _Null 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])); + 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; @@ -130,20 +131,20 @@ + (nullable CoreInitializeResponse *)nullableFromList:(NSArray *)list; @implementation CoreFirebaseOptions + (instancetype)makeWithApiKey:(NSString *)apiKey - appId:(NSString *)appId - messagingSenderId:(NSString *)messagingSenderId - projectId:(NSString *)projectId - authDomain:(nullable NSString *)authDomain - databaseURL:(nullable NSString *)databaseURL - storageBucket:(nullable NSString *)storageBucket - measurementId:(nullable NSString *)measurementId - trackingId:(nullable NSString *)trackingId - deepLinkURLScheme:(nullable NSString *)deepLinkURLScheme - androidClientId:(nullable NSString *)androidClientId - iosClientId:(nullable NSString *)iosClientId - iosBundleId:(nullable NSString *)iosBundleId - appGroupId:(nullable NSString *)appGroupId { - CoreFirebaseOptions* pigeonResult = [[CoreFirebaseOptions alloc] init]; + appId:(NSString *)appId + messagingSenderId:(NSString *)messagingSenderId + projectId:(NSString *)projectId + authDomain:(nullable NSString *)authDomain + databaseURL:(nullable NSString *)databaseURL + storageBucket:(nullable NSString *)storageBucket + measurementId:(nullable NSString *)measurementId + trackingId:(nullable NSString *)trackingId + deepLinkURLScheme:(nullable NSString *)deepLinkURLScheme + androidClientId:(nullable NSString *)androidClientId + iosClientId:(nullable NSString *)iosClientId + iosBundleId:(nullable NSString *)iosBundleId + appGroupId:(nullable NSString *)appGroupId { + CoreFirebaseOptions *pigeonResult = [[CoreFirebaseOptions alloc] init]; pigeonResult.apiKey = apiKey; pigeonResult.appId = appId; pigeonResult.messagingSenderId = messagingSenderId; @@ -207,7 +208,20 @@ - (BOOL)isEqual:(id)object { return NO; } CoreFirebaseOptions *other = (CoreFirebaseOptions *)object; - return FLTPigeonDeepEquals(self.apiKey, other.apiKey) && FLTPigeonDeepEquals(self.appId, other.appId) && FLTPigeonDeepEquals(self.messagingSenderId, other.messagingSenderId) && FLTPigeonDeepEquals(self.projectId, other.projectId) && FLTPigeonDeepEquals(self.authDomain, other.authDomain) && FLTPigeonDeepEquals(self.databaseURL, other.databaseURL) && FLTPigeonDeepEquals(self.storageBucket, other.storageBucket) && FLTPigeonDeepEquals(self.measurementId, other.measurementId) && FLTPigeonDeepEquals(self.trackingId, other.trackingId) && FLTPigeonDeepEquals(self.deepLinkURLScheme, other.deepLinkURLScheme) && FLTPigeonDeepEquals(self.androidClientId, other.androidClientId) && FLTPigeonDeepEquals(self.iosClientId, other.iosClientId) && FLTPigeonDeepEquals(self.iosBundleId, other.iosBundleId) && FLTPigeonDeepEquals(self.appGroupId, other.appGroupId); + return FLTPigeonDeepEquals(self.apiKey, other.apiKey) && + FLTPigeonDeepEquals(self.appId, other.appId) && + FLTPigeonDeepEquals(self.messagingSenderId, other.messagingSenderId) && + FLTPigeonDeepEquals(self.projectId, other.projectId) && + FLTPigeonDeepEquals(self.authDomain, other.authDomain) && + FLTPigeonDeepEquals(self.databaseURL, other.databaseURL) && + FLTPigeonDeepEquals(self.storageBucket, other.storageBucket) && + FLTPigeonDeepEquals(self.measurementId, other.measurementId) && + FLTPigeonDeepEquals(self.trackingId, other.trackingId) && + FLTPigeonDeepEquals(self.deepLinkURLScheme, other.deepLinkURLScheme) && + FLTPigeonDeepEquals(self.androidClientId, other.androidClientId) && + FLTPigeonDeepEquals(self.iosClientId, other.iosClientId) && + FLTPigeonDeepEquals(self.iosBundleId, other.iosBundleId) && + FLTPigeonDeepEquals(self.appGroupId, other.appGroupId); } - (NSUInteger)hash { @@ -232,10 +246,10 @@ - (NSUInteger)hash { @implementation CoreInitializeResponse + (instancetype)makeWithName:(NSString *)name - options:(CoreFirebaseOptions *)options + options:(CoreFirebaseOptions *)options isAutomaticDataCollectionEnabled:(nullable NSNumber *)isAutomaticDataCollectionEnabled - pluginConstants:(NSDictionary *)pluginConstants { - CoreInitializeResponse* pigeonResult = [[CoreInitializeResponse alloc] init]; + pluginConstants:(NSDictionary *)pluginConstants { + CoreInitializeResponse *pigeonResult = [[CoreInitializeResponse alloc] init]; pigeonResult.name = name; pigeonResult.options = options; pigeonResult.isAutomaticDataCollectionEnabled = isAutomaticDataCollectionEnabled; @@ -269,7 +283,11 @@ - (BOOL)isEqual:(id)object { return NO; } CoreInitializeResponse *other = (CoreInitializeResponse *)object; - return FLTPigeonDeepEquals(self.name, other.name) && FLTPigeonDeepEquals(self.options, other.options) && FLTPigeonDeepEquals(self.isAutomaticDataCollectionEnabled, other.isAutomaticDataCollectionEnabled) && FLTPigeonDeepEquals(self.pluginConstants, other.pluginConstants); + return FLTPigeonDeepEquals(self.name, other.name) && + FLTPigeonDeepEquals(self.options, other.options) && + FLTPigeonDeepEquals(self.isAutomaticDataCollectionEnabled, + other.isAutomaticDataCollectionEnabled) && + FLTPigeonDeepEquals(self.pluginConstants, other.pluginConstants); } - (NSUInteger)hash { @@ -287,9 +305,9 @@ @interface nullMessagesPigeonCodecReader : FlutterStandardReader @implementation nullMessagesPigeonCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 129: + case 129: return [CoreFirebaseOptions fromList:[self readValue]]; - case 130: + case 130: return [CoreInitializeResponse fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -328,47 +346,68 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - nullMessagesPigeonCodecReaderWriter *readerWriter = [[nullMessagesPigeonCodecReaderWriter alloc] init]; + nullMessagesPigeonCodecReaderWriter *readerWriter = + [[nullMessagesPigeonCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void SetUpFirebaseCoreHostApi(id binaryMessenger, NSObject *api) { +void SetUpFirebaseCoreHostApi(id binaryMessenger, + NSObject *api) { SetUpFirebaseCoreHostApiWithSuffix(binaryMessenger, api, @""); } -void SetUpFirebaseCoreHostApiWithSuffix(id binaryMessenger, NSObject *api, NSString *messageChannelSuffix) { - messageChannelSuffix = messageChannelSuffix.length > 0 ? [NSString stringWithFormat: @".%@", messageChannelSuffix] : @""; +void SetUpFirebaseCoreHostApiWithSuffix(id binaryMessenger, + NSObject *api, + NSString *messageChannelSuffix) { + messageChannelSuffix = messageChannelSuffix.length > 0 + ? [NSString stringWithFormat:@".%@", messageChannelSuffix] + : @""; { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeApp", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.firebase_core_platform_" + @"interface.FirebaseCoreHostApi.initializeApp", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:nullGetMessagesCodec()]; + codec:nullGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(initializeAppAppName:initializeAppRequest:completion:)], @"FirebaseCoreHostApi api (%@) doesn't respond to @selector(initializeAppAppName:initializeAppRequest:completion:)", api); + NSCAssert( + [api respondsToSelector:@selector(initializeAppAppName:initializeAppRequest:completion:)], + @"FirebaseCoreHostApi api (%@) doesn't respond to " + @"@selector(initializeAppAppName:initializeAppRequest:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_appName = GetNullableObjectAtIndex(args, 0); CoreFirebaseOptions *arg_initializeAppRequest = GetNullableObjectAtIndex(args, 1); - [api initializeAppAppName:arg_appName initializeAppRequest:arg_initializeAppRequest completion:^(CoreInitializeResponse *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api initializeAppAppName:arg_appName + initializeAppRequest:arg_initializeAppRequest + completion:^(CoreInitializeResponse *_Nullable output, + FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeCore", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.firebase_core_platform_" + @"interface.FirebaseCoreHostApi.initializeCore", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:nullGetMessagesCodec()]; + codec:nullGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(initializeCoreWithCompletion:)], @"FirebaseCoreHostApi api (%@) doesn't respond to @selector(initializeCoreWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(initializeCoreWithCompletion:)], + @"FirebaseCoreHostApi api (%@) doesn't respond to " + @"@selector(initializeCoreWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api initializeCoreWithCompletion:^(NSArray *_Nullable output, FlutterError *_Nullable error) { + [api initializeCoreWithCompletion:^(NSArray *_Nullable output, + FlutterError *_Nullable error) { callback(wrapResult(output, error)); }]; }]; @@ -377,15 +416,22 @@ void SetUpFirebaseCoreHostApiWithSuffix(id binaryMesseng } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.optionsFromResource", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.firebase_core_platform_interface." + @"FirebaseCoreHostApi.optionsFromResource", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:nullGetMessagesCodec()]; + codec:nullGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(optionsFromResourceWithCompletion:)], @"FirebaseCoreHostApi api (%@) doesn't respond to @selector(optionsFromResourceWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(optionsFromResourceWithCompletion:)], + @"FirebaseCoreHostApi api (%@) doesn't respond to " + @"@selector(optionsFromResourceWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api optionsFromResourceWithCompletion:^(CoreFirebaseOptions *_Nullable output, FlutterError *_Nullable error) { + [api optionsFromResourceWithCompletion:^(CoreFirebaseOptions *_Nullable output, + FlutterError *_Nullable error) { callback(wrapResult(output, error)); }]; }]; @@ -394,66 +440,97 @@ void SetUpFirebaseCoreHostApiWithSuffix(id binaryMesseng } } } -void SetUpFirebaseAppHostApi(id binaryMessenger, NSObject *api) { +void SetUpFirebaseAppHostApi(id binaryMessenger, + NSObject *api) { SetUpFirebaseAppHostApiWithSuffix(binaryMessenger, api, @""); } -void SetUpFirebaseAppHostApiWithSuffix(id binaryMessenger, NSObject *api, NSString *messageChannelSuffix) { - messageChannelSuffix = messageChannelSuffix.length > 0 ? [NSString stringWithFormat: @".%@", messageChannelSuffix] : @""; +void SetUpFirebaseAppHostApiWithSuffix(id binaryMessenger, + NSObject *api, + NSString *messageChannelSuffix) { + messageChannelSuffix = messageChannelSuffix.length > 0 + ? [NSString stringWithFormat:@".%@", messageChannelSuffix] + : @""; { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticDataCollectionEnabled", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + [NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.firebase_core_platform_interface." + @"FirebaseAppHostApi.setAutomaticDataCollectionEnabled", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:nullGetMessagesCodec()]; + codec:nullGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setAutomaticDataCollectionEnabledAppName:enabled:completion:)], @"FirebaseAppHostApi api (%@) doesn't respond to @selector(setAutomaticDataCollectionEnabledAppName:enabled:completion:)", api); + NSCAssert( + [api + respondsToSelector:@selector( + setAutomaticDataCollectionEnabledAppName:enabled:completion:)], + @"FirebaseAppHostApi api (%@) doesn't respond to " + @"@selector(setAutomaticDataCollectionEnabledAppName:enabled:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_appName = GetNullableObjectAtIndex(args, 0); BOOL arg_enabled = [GetNullableObjectAtIndex(args, 1) boolValue]; - [api setAutomaticDataCollectionEnabledAppName:arg_appName enabled:arg_enabled completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setAutomaticDataCollectionEnabledAppName:arg_appName + enabled:arg_enabled + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticResourceManagementEnabled", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.firebase_core_platform_interface." + @"FirebaseAppHostApi.setAutomaticResourceManagementEnabled", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:nullGetMessagesCodec()]; + codec:nullGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setAutomaticResourceManagementEnabledAppName:enabled:completion:)], @"FirebaseAppHostApi api (%@) doesn't respond to @selector(setAutomaticResourceManagementEnabledAppName:enabled:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setAutomaticResourceManagementEnabledAppName: + enabled:completion:)], + @"FirebaseAppHostApi api (%@) doesn't respond to " + @"@selector(setAutomaticResourceManagementEnabledAppName:enabled:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_appName = GetNullableObjectAtIndex(args, 0); BOOL arg_enabled = [GetNullableObjectAtIndex(args, 1) boolValue]; - [api setAutomaticResourceManagementEnabledAppName:arg_appName enabled:arg_enabled completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setAutomaticResourceManagementEnabledAppName:arg_appName + enabled:arg_enabled + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.delete", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.firebase_core_platform_" + @"interface.FirebaseAppHostApi.delete", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:nullGetMessagesCodec()]; + codec:nullGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(deleteAppName:completion:)], @"FirebaseAppHostApi api (%@) doesn't respond to @selector(deleteAppName:completion:)", api); + NSCAssert( + [api respondsToSelector:@selector(deleteAppName:completion:)], + @"FirebaseAppHostApi api (%@) doesn't respond to @selector(deleteAppName:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_appName = GetNullableObjectAtIndex(args, 0); - [api deleteAppName:arg_appName completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api deleteAppName:arg_appName + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; diff --git a/packages/firebase_core/firebase_core/windows/messages.g.cpp b/packages/firebase_core/firebase_core/windows/messages.g.cpp index 04c42c4767dd..42e8046a21e1 100644 --- a/packages/firebase_core/firebase_core/windows/messages.g.cpp +++ b/packages/firebase_core/firebase_core/windows/messages.g.cpp @@ -34,32 +34,36 @@ FlutterError CreateConnectionError(const std::string channel_name) { } namespace { -template +template bool PigeonInternalDeepEquals(const T& a, const T& b); bool PigeonInternalDeepEquals(const double& a, const double& b); -template +template bool PigeonInternalDeepEquals(const std::vector& a, const std::vector& b); -template +template bool PigeonInternalDeepEquals(const std::map& a, const std::map& b); -template -bool PigeonInternalDeepEquals(const std::optional& a, const std::optional& b); +template +bool PigeonInternalDeepEquals(const std::optional& a, + const std::optional& b); -template -bool PigeonInternalDeepEquals(const std::unique_ptr& a, const std::unique_ptr& b); +template +bool PigeonInternalDeepEquals(const std::unique_ptr& a, + const std::unique_ptr& b); -bool PigeonInternalDeepEquals(const ::flutter::EncodableValue& a, const ::flutter::EncodableValue& b); +bool PigeonInternalDeepEquals(const ::flutter::EncodableValue& a, + const ::flutter::EncodableValue& b); -template +template bool PigeonInternalDeepEquals(const T& a, const T& b) { return a == b; } -template -bool PigeonInternalDeepEquals(const std::vector& a, const std::vector& b) { +template +bool PigeonInternalDeepEquals(const std::vector& a, + const std::vector& b) { if (a.size() != b.size()) { return false; } @@ -72,7 +76,8 @@ bool PigeonInternalDeepEquals(const std::vector& a, const std::vector& b) } template -bool PigeonInternalDeepEquals(const std::map& a, const std::map& b) { +bool PigeonInternalDeepEquals(const std::map& a, + const std::map& b) { if (a.size() != b.size()) { return false; } @@ -100,8 +105,9 @@ bool PigeonInternalDeepEquals(const double& a, const double& b) { return (a == b) || (std::isnan(a) && std::isnan(b)); } -template -bool PigeonInternalDeepEquals(const std::optional& a, const std::optional& b) { +template +bool PigeonInternalDeepEquals(const std::optional& a, + const std::optional& b) { if (!a && !b) { return true; } @@ -111,8 +117,9 @@ bool PigeonInternalDeepEquals(const std::optional& a, const std::optional& return PigeonInternalDeepEquals(*a, *b); } -template -bool PigeonInternalDeepEquals(const std::unique_ptr& a, const std::unique_ptr& b) { +template +bool PigeonInternalDeepEquals(const std::unique_ptr& a, + const std::unique_ptr& b) { if (a.get() == b.get()) { return true; } @@ -122,15 +129,18 @@ bool PigeonInternalDeepEquals(const std::unique_ptr& a, const std::unique_ptr return PigeonInternalDeepEquals(*a, *b); } -bool PigeonInternalDeepEquals(const ::flutter::EncodableValue& a, const ::flutter::EncodableValue& b) { +bool PigeonInternalDeepEquals(const ::flutter::EncodableValue& a, + const ::flutter::EncodableValue& b) { if (a.index() != b.index()) { return false; } if (const double* da = std::get_if(&a)) { return PigeonInternalDeepEquals(*da, std::get(b)); - } else if (const ::flutter::EncodableList* la = std::get_if<::flutter::EncodableList>(&a)) { + } else if (const ::flutter::EncodableList* la = + std::get_if<::flutter::EncodableList>(&a)) { return PigeonInternalDeepEquals(*la, std::get<::flutter::EncodableList>(b)); - } else if (const ::flutter::EncodableMap* ma = std::get_if<::flutter::EncodableMap>(&a)) { + } else if (const ::flutter::EncodableMap* ma = + std::get_if<::flutter::EncodableMap>(&a)) { return PigeonInternalDeepEquals(*ma, std::get<::flutter::EncodableMap>(b)); } return a == b; @@ -173,7 +183,8 @@ template size_t PigeonInternalDeepHash(const std::map& v) { size_t result = 0; for (const auto& kv : v) { - result += ((PigeonInternalDeepHash(kv.first) * 31) ^ PigeonInternalDeepHash(kv.second)); + result += ((PigeonInternalDeepHash(kv.first) * 31) ^ + PigeonInternalDeepHash(kv.second)); } return result; } @@ -230,64 +241,66 @@ size_t PigeonInternalDeepHash(const ::flutter::EncodableValue& v) { } // namespace // CoreFirebaseOptions -CoreFirebaseOptions::CoreFirebaseOptions( - const std::string& api_key, - const std::string& app_id, - const std::string& messaging_sender_id, - const std::string& project_id) - : api_key_(api_key), - app_id_(app_id), - messaging_sender_id_(messaging_sender_id), - project_id_(project_id) {} +CoreFirebaseOptions::CoreFirebaseOptions(const std::string& api_key, + const std::string& app_id, + const std::string& messaging_sender_id, + const std::string& project_id) + : api_key_(api_key), + app_id_(app_id), + messaging_sender_id_(messaging_sender_id), + project_id_(project_id) {} CoreFirebaseOptions::CoreFirebaseOptions( - const std::string& api_key, - const std::string& app_id, - const std::string& messaging_sender_id, - const std::string& project_id, - const std::string* auth_domain, - const std::string* database_u_r_l, - const std::string* storage_bucket, - const std::string* measurement_id, - const std::string* tracking_id, - const std::string* deep_link_u_r_l_scheme, - const std::string* android_client_id, - const std::string* ios_client_id, - const std::string* ios_bundle_id, - const std::string* app_group_id) - : api_key_(api_key), - app_id_(app_id), - messaging_sender_id_(messaging_sender_id), - project_id_(project_id), - auth_domain_(auth_domain ? std::optional(*auth_domain) : std::nullopt), - database_u_r_l_(database_u_r_l ? std::optional(*database_u_r_l) : std::nullopt), - storage_bucket_(storage_bucket ? std::optional(*storage_bucket) : std::nullopt), - measurement_id_(measurement_id ? std::optional(*measurement_id) : std::nullopt), - tracking_id_(tracking_id ? std::optional(*tracking_id) : std::nullopt), - deep_link_u_r_l_scheme_(deep_link_u_r_l_scheme ? std::optional(*deep_link_u_r_l_scheme) : std::nullopt), - android_client_id_(android_client_id ? std::optional(*android_client_id) : std::nullopt), - ios_client_id_(ios_client_id ? std::optional(*ios_client_id) : std::nullopt), - ios_bundle_id_(ios_bundle_id ? std::optional(*ios_bundle_id) : std::nullopt), - app_group_id_(app_group_id ? std::optional(*app_group_id) : std::nullopt) {} - -const std::string& CoreFirebaseOptions::api_key() const { - return api_key_; -} + const std::string& api_key, const std::string& app_id, + const std::string& messaging_sender_id, const std::string& project_id, + const std::string* auth_domain, const std::string* database_u_r_l, + const std::string* storage_bucket, const std::string* measurement_id, + const std::string* tracking_id, const std::string* deep_link_u_r_l_scheme, + const std::string* android_client_id, const std::string* ios_client_id, + const std::string* ios_bundle_id, const std::string* app_group_id) + : api_key_(api_key), + app_id_(app_id), + messaging_sender_id_(messaging_sender_id), + project_id_(project_id), + auth_domain_(auth_domain ? std::optional(*auth_domain) + : std::nullopt), + database_u_r_l_(database_u_r_l + ? std::optional(*database_u_r_l) + : std::nullopt), + storage_bucket_(storage_bucket + ? std::optional(*storage_bucket) + : std::nullopt), + measurement_id_(measurement_id + ? std::optional(*measurement_id) + : std::nullopt), + tracking_id_(tracking_id ? std::optional(*tracking_id) + : std::nullopt), + deep_link_u_r_l_scheme_( + deep_link_u_r_l_scheme + ? std::optional(*deep_link_u_r_l_scheme) + : std::nullopt), + android_client_id_(android_client_id + ? std::optional(*android_client_id) + : std::nullopt), + ios_client_id_(ios_client_id ? std::optional(*ios_client_id) + : std::nullopt), + ios_bundle_id_(ios_bundle_id ? std::optional(*ios_bundle_id) + : std::nullopt), + app_group_id_(app_group_id ? std::optional(*app_group_id) + : std::nullopt) {} + +const std::string& CoreFirebaseOptions::api_key() const { return api_key_; } void CoreFirebaseOptions::set_api_key(std::string_view value_arg) { api_key_ = value_arg; } - -const std::string& CoreFirebaseOptions::app_id() const { - return app_id_; -} +const std::string& CoreFirebaseOptions::app_id() const { return app_id_; } void CoreFirebaseOptions::set_app_id(std::string_view value_arg) { app_id_ = value_arg; } - const std::string& CoreFirebaseOptions::messaging_sender_id() const { return messaging_sender_id_; } @@ -296,7 +309,6 @@ void CoreFirebaseOptions::set_messaging_sender_id(std::string_view value_arg) { messaging_sender_id_ = value_arg; } - const std::string& CoreFirebaseOptions::project_id() const { return project_id_; } @@ -305,137 +317,142 @@ void CoreFirebaseOptions::set_project_id(std::string_view value_arg) { project_id_ = value_arg; } - const std::string* CoreFirebaseOptions::auth_domain() const { return auth_domain_ ? &(*auth_domain_) : nullptr; } void CoreFirebaseOptions::set_auth_domain(const std::string_view* value_arg) { - auth_domain_ = value_arg ? std::optional(*value_arg) : std::nullopt; + auth_domain_ = + value_arg ? std::optional(*value_arg) : std::nullopt; } void CoreFirebaseOptions::set_auth_domain(std::string_view value_arg) { auth_domain_ = value_arg; } - const std::string* CoreFirebaseOptions::database_u_r_l() const { return database_u_r_l_ ? &(*database_u_r_l_) : nullptr; } -void CoreFirebaseOptions::set_database_u_r_l(const std::string_view* value_arg) { - database_u_r_l_ = value_arg ? std::optional(*value_arg) : std::nullopt; +void CoreFirebaseOptions::set_database_u_r_l( + const std::string_view* value_arg) { + database_u_r_l_ = + value_arg ? std::optional(*value_arg) : std::nullopt; } void CoreFirebaseOptions::set_database_u_r_l(std::string_view value_arg) { database_u_r_l_ = value_arg; } - const std::string* CoreFirebaseOptions::storage_bucket() const { return storage_bucket_ ? &(*storage_bucket_) : nullptr; } -void CoreFirebaseOptions::set_storage_bucket(const std::string_view* value_arg) { - storage_bucket_ = value_arg ? std::optional(*value_arg) : std::nullopt; +void CoreFirebaseOptions::set_storage_bucket( + const std::string_view* value_arg) { + storage_bucket_ = + value_arg ? std::optional(*value_arg) : std::nullopt; } void CoreFirebaseOptions::set_storage_bucket(std::string_view value_arg) { storage_bucket_ = value_arg; } - const std::string* CoreFirebaseOptions::measurement_id() const { return measurement_id_ ? &(*measurement_id_) : nullptr; } -void CoreFirebaseOptions::set_measurement_id(const std::string_view* value_arg) { - measurement_id_ = value_arg ? std::optional(*value_arg) : std::nullopt; +void CoreFirebaseOptions::set_measurement_id( + const std::string_view* value_arg) { + measurement_id_ = + value_arg ? std::optional(*value_arg) : std::nullopt; } void CoreFirebaseOptions::set_measurement_id(std::string_view value_arg) { measurement_id_ = value_arg; } - const std::string* CoreFirebaseOptions::tracking_id() const { return tracking_id_ ? &(*tracking_id_) : nullptr; } void CoreFirebaseOptions::set_tracking_id(const std::string_view* value_arg) { - tracking_id_ = value_arg ? std::optional(*value_arg) : std::nullopt; + tracking_id_ = + value_arg ? std::optional(*value_arg) : std::nullopt; } void CoreFirebaseOptions::set_tracking_id(std::string_view value_arg) { tracking_id_ = value_arg; } - const std::string* CoreFirebaseOptions::deep_link_u_r_l_scheme() const { return deep_link_u_r_l_scheme_ ? &(*deep_link_u_r_l_scheme_) : nullptr; } -void CoreFirebaseOptions::set_deep_link_u_r_l_scheme(const std::string_view* value_arg) { - deep_link_u_r_l_scheme_ = value_arg ? std::optional(*value_arg) : std::nullopt; +void CoreFirebaseOptions::set_deep_link_u_r_l_scheme( + const std::string_view* value_arg) { + deep_link_u_r_l_scheme_ = + value_arg ? std::optional(*value_arg) : std::nullopt; } -void CoreFirebaseOptions::set_deep_link_u_r_l_scheme(std::string_view value_arg) { +void CoreFirebaseOptions::set_deep_link_u_r_l_scheme( + std::string_view value_arg) { deep_link_u_r_l_scheme_ = value_arg; } - const std::string* CoreFirebaseOptions::android_client_id() const { return android_client_id_ ? &(*android_client_id_) : nullptr; } -void CoreFirebaseOptions::set_android_client_id(const std::string_view* value_arg) { - android_client_id_ = value_arg ? std::optional(*value_arg) : std::nullopt; +void CoreFirebaseOptions::set_android_client_id( + const std::string_view* value_arg) { + android_client_id_ = + value_arg ? std::optional(*value_arg) : std::nullopt; } void CoreFirebaseOptions::set_android_client_id(std::string_view value_arg) { android_client_id_ = value_arg; } - const std::string* CoreFirebaseOptions::ios_client_id() const { return ios_client_id_ ? &(*ios_client_id_) : nullptr; } void CoreFirebaseOptions::set_ios_client_id(const std::string_view* value_arg) { - ios_client_id_ = value_arg ? std::optional(*value_arg) : std::nullopt; + ios_client_id_ = + value_arg ? std::optional(*value_arg) : std::nullopt; } void CoreFirebaseOptions::set_ios_client_id(std::string_view value_arg) { ios_client_id_ = value_arg; } - const std::string* CoreFirebaseOptions::ios_bundle_id() const { return ios_bundle_id_ ? &(*ios_bundle_id_) : nullptr; } void CoreFirebaseOptions::set_ios_bundle_id(const std::string_view* value_arg) { - ios_bundle_id_ = value_arg ? std::optional(*value_arg) : std::nullopt; + ios_bundle_id_ = + value_arg ? std::optional(*value_arg) : std::nullopt; } void CoreFirebaseOptions::set_ios_bundle_id(std::string_view value_arg) { ios_bundle_id_ = value_arg; } - const std::string* CoreFirebaseOptions::app_group_id() const { return app_group_id_ ? &(*app_group_id_) : nullptr; } void CoreFirebaseOptions::set_app_group_id(const std::string_view* value_arg) { - app_group_id_ = value_arg ? std::optional(*value_arg) : std::nullopt; + app_group_id_ = + value_arg ? std::optional(*value_arg) : std::nullopt; } void CoreFirebaseOptions::set_app_group_id(std::string_view value_arg) { app_group_id_ = value_arg; } - EncodableList CoreFirebaseOptions::ToEncodableList() const { EncodableList list; list.reserve(14); @@ -443,25 +460,35 @@ EncodableList CoreFirebaseOptions::ToEncodableList() const { list.push_back(EncodableValue(app_id_)); list.push_back(EncodableValue(messaging_sender_id_)); list.push_back(EncodableValue(project_id_)); - list.push_back(auth_domain_ ? EncodableValue(*auth_domain_) : EncodableValue()); - list.push_back(database_u_r_l_ ? EncodableValue(*database_u_r_l_) : EncodableValue()); - list.push_back(storage_bucket_ ? EncodableValue(*storage_bucket_) : EncodableValue()); - list.push_back(measurement_id_ ? EncodableValue(*measurement_id_) : EncodableValue()); - list.push_back(tracking_id_ ? EncodableValue(*tracking_id_) : EncodableValue()); - list.push_back(deep_link_u_r_l_scheme_ ? EncodableValue(*deep_link_u_r_l_scheme_) : EncodableValue()); - list.push_back(android_client_id_ ? EncodableValue(*android_client_id_) : EncodableValue()); - list.push_back(ios_client_id_ ? EncodableValue(*ios_client_id_) : EncodableValue()); - list.push_back(ios_bundle_id_ ? EncodableValue(*ios_bundle_id_) : EncodableValue()); - list.push_back(app_group_id_ ? EncodableValue(*app_group_id_) : EncodableValue()); + list.push_back(auth_domain_ ? EncodableValue(*auth_domain_) + : EncodableValue()); + list.push_back(database_u_r_l_ ? EncodableValue(*database_u_r_l_) + : EncodableValue()); + list.push_back(storage_bucket_ ? EncodableValue(*storage_bucket_) + : EncodableValue()); + list.push_back(measurement_id_ ? EncodableValue(*measurement_id_) + : EncodableValue()); + list.push_back(tracking_id_ ? EncodableValue(*tracking_id_) + : EncodableValue()); + list.push_back(deep_link_u_r_l_scheme_ + ? EncodableValue(*deep_link_u_r_l_scheme_) + : EncodableValue()); + list.push_back(android_client_id_ ? EncodableValue(*android_client_id_) + : EncodableValue()); + list.push_back(ios_client_id_ ? EncodableValue(*ios_client_id_) + : EncodableValue()); + list.push_back(ios_bundle_id_ ? EncodableValue(*ios_bundle_id_) + : EncodableValue()); + list.push_back(app_group_id_ ? EncodableValue(*app_group_id_) + : EncodableValue()); return list; } -CoreFirebaseOptions CoreFirebaseOptions::FromEncodableList(const EncodableList& list) { +CoreFirebaseOptions CoreFirebaseOptions::FromEncodableList( + const EncodableList& list) { CoreFirebaseOptions decoded( - std::get(list[0]), - std::get(list[1]), - std::get(list[2]), - std::get(list[3])); + std::get(list[0]), std::get(list[1]), + std::get(list[2]), std::get(list[3])); auto& encodable_auth_domain = list[4]; if (!encodable_auth_domain.IsNull()) { decoded.set_auth_domain(std::get(encodable_auth_domain)); @@ -484,11 +511,13 @@ CoreFirebaseOptions CoreFirebaseOptions::FromEncodableList(const EncodableList& } auto& encodable_deep_link_u_r_l_scheme = list[9]; if (!encodable_deep_link_u_r_l_scheme.IsNull()) { - decoded.set_deep_link_u_r_l_scheme(std::get(encodable_deep_link_u_r_l_scheme)); + decoded.set_deep_link_u_r_l_scheme( + std::get(encodable_deep_link_u_r_l_scheme)); } auto& encodable_android_client_id = list[10]; if (!encodable_android_client_id.IsNull()) { - decoded.set_android_client_id(std::get(encodable_android_client_id)); + decoded.set_android_client_id( + std::get(encodable_android_client_id)); } auto& encodable_ios_client_id = list[11]; if (!encodable_ios_client_id.IsNull()) { @@ -506,7 +535,23 @@ CoreFirebaseOptions CoreFirebaseOptions::FromEncodableList(const EncodableList& } bool CoreFirebaseOptions::operator==(const CoreFirebaseOptions& other) const { - return PigeonInternalDeepEquals(api_key_, other.api_key_) && PigeonInternalDeepEquals(app_id_, other.app_id_) && PigeonInternalDeepEquals(messaging_sender_id_, other.messaging_sender_id_) && PigeonInternalDeepEquals(project_id_, other.project_id_) && PigeonInternalDeepEquals(auth_domain_, other.auth_domain_) && PigeonInternalDeepEquals(database_u_r_l_, other.database_u_r_l_) && PigeonInternalDeepEquals(storage_bucket_, other.storage_bucket_) && PigeonInternalDeepEquals(measurement_id_, other.measurement_id_) && PigeonInternalDeepEquals(tracking_id_, other.tracking_id_) && PigeonInternalDeepEquals(deep_link_u_r_l_scheme_, other.deep_link_u_r_l_scheme_) && PigeonInternalDeepEquals(android_client_id_, other.android_client_id_) && PigeonInternalDeepEquals(ios_client_id_, other.ios_client_id_) && PigeonInternalDeepEquals(ios_bundle_id_, other.ios_bundle_id_) && PigeonInternalDeepEquals(app_group_id_, other.app_group_id_); + return PigeonInternalDeepEquals(api_key_, other.api_key_) && + PigeonInternalDeepEquals(app_id_, other.app_id_) && + PigeonInternalDeepEquals(messaging_sender_id_, + other.messaging_sender_id_) && + PigeonInternalDeepEquals(project_id_, other.project_id_) && + PigeonInternalDeepEquals(auth_domain_, other.auth_domain_) && + PigeonInternalDeepEquals(database_u_r_l_, other.database_u_r_l_) && + PigeonInternalDeepEquals(storage_bucket_, other.storage_bucket_) && + PigeonInternalDeepEquals(measurement_id_, other.measurement_id_) && + PigeonInternalDeepEquals(tracking_id_, other.tracking_id_) && + PigeonInternalDeepEquals(deep_link_u_r_l_scheme_, + other.deep_link_u_r_l_scheme_) && + PigeonInternalDeepEquals(android_client_id_, + other.android_client_id_) && + PigeonInternalDeepEquals(ios_client_id_, other.ios_client_id_) && + PigeonInternalDeepEquals(ios_bundle_id_, other.ios_bundle_id_) && + PigeonInternalDeepEquals(app_group_id_, other.app_group_id_); } bool CoreFirebaseOptions::operator!=(const CoreFirebaseOptions& other) const { @@ -532,53 +577,56 @@ size_t CoreFirebaseOptions::Hash() const { return result; } -size_t PigeonInternalDeepHash(const CoreFirebaseOptions& v) { - return v.Hash(); -} +size_t PigeonInternalDeepHash(const CoreFirebaseOptions& v) { return v.Hash(); } // CoreInitializeResponse CoreInitializeResponse::CoreInitializeResponse( - const std::string& name, - const CoreFirebaseOptions& options, - const EncodableMap& plugin_constants) - : name_(name), - options_(std::make_unique(options)), - plugin_constants_(plugin_constants) {} + const std::string& name, const CoreFirebaseOptions& options, + const EncodableMap& plugin_constants) + : name_(name), + options_(std::make_unique(options)), + plugin_constants_(plugin_constants) {} CoreInitializeResponse::CoreInitializeResponse( - const std::string& name, - const CoreFirebaseOptions& options, - const bool* is_automatic_data_collection_enabled, - const EncodableMap& plugin_constants) - : name_(name), - options_(std::make_unique(options)), - is_automatic_data_collection_enabled_(is_automatic_data_collection_enabled ? std::optional(*is_automatic_data_collection_enabled) : std::nullopt), - plugin_constants_(plugin_constants) {} - -CoreInitializeResponse::CoreInitializeResponse(const CoreInitializeResponse& other) - : name_(other.name_), - options_(std::make_unique(*other.options_)), - is_automatic_data_collection_enabled_(other.is_automatic_data_collection_enabled_ ? std::optional(*other.is_automatic_data_collection_enabled_) : std::nullopt), - plugin_constants_(other.plugin_constants_) {} - -CoreInitializeResponse& CoreInitializeResponse::operator=(const CoreInitializeResponse& other) { + const std::string& name, const CoreFirebaseOptions& options, + const bool* is_automatic_data_collection_enabled, + const EncodableMap& plugin_constants) + : name_(name), + options_(std::make_unique(options)), + is_automatic_data_collection_enabled_( + is_automatic_data_collection_enabled + ? std::optional(*is_automatic_data_collection_enabled) + : std::nullopt), + plugin_constants_(plugin_constants) {} + +CoreInitializeResponse::CoreInitializeResponse( + const CoreInitializeResponse& other) + : name_(other.name_), + options_(std::make_unique(*other.options_)), + is_automatic_data_collection_enabled_( + other.is_automatic_data_collection_enabled_ + ? std::optional( + *other.is_automatic_data_collection_enabled_) + : std::nullopt), + plugin_constants_(other.plugin_constants_) {} + +CoreInitializeResponse& CoreInitializeResponse::operator=( + const CoreInitializeResponse& other) { name_ = other.name_; options_ = std::make_unique(*other.options_); - is_automatic_data_collection_enabled_ = other.is_automatic_data_collection_enabled_; + is_automatic_data_collection_enabled_ = + other.is_automatic_data_collection_enabled_; plugin_constants_ = other.plugin_constants_; return *this; } -const std::string& CoreInitializeResponse::name() const { - return name_; -} +const std::string& CoreInitializeResponse::name() const { return name_; } void CoreInitializeResponse::set_name(std::string_view value_arg) { name_ = value_arg; } - const CoreFirebaseOptions& CoreInitializeResponse::options() const { return *options_; } @@ -587,56 +635,71 @@ void CoreInitializeResponse::set_options(const CoreFirebaseOptions& value_arg) { options_ = std::make_unique(value_arg); } - -const bool* CoreInitializeResponse::is_automatic_data_collection_enabled() const { - return is_automatic_data_collection_enabled_ ? &(*is_automatic_data_collection_enabled_) : nullptr; +const bool* CoreInitializeResponse::is_automatic_data_collection_enabled() + const { + return is_automatic_data_collection_enabled_ + ? &(*is_automatic_data_collection_enabled_) + : nullptr; } -void CoreInitializeResponse::set_is_automatic_data_collection_enabled(const bool* value_arg) { - is_automatic_data_collection_enabled_ = value_arg ? std::optional(*value_arg) : std::nullopt; +void CoreInitializeResponse::set_is_automatic_data_collection_enabled( + const bool* value_arg) { + is_automatic_data_collection_enabled_ = + value_arg ? std::optional(*value_arg) : std::nullopt; } -void CoreInitializeResponse::set_is_automatic_data_collection_enabled(bool value_arg) { +void CoreInitializeResponse::set_is_automatic_data_collection_enabled( + bool value_arg) { is_automatic_data_collection_enabled_ = value_arg; } - const EncodableMap& CoreInitializeResponse::plugin_constants() const { return plugin_constants_; } -void CoreInitializeResponse::set_plugin_constants(const EncodableMap& value_arg) { +void CoreInitializeResponse::set_plugin_constants( + const EncodableMap& value_arg) { plugin_constants_ = value_arg; } - EncodableList CoreInitializeResponse::ToEncodableList() const { EncodableList list; list.reserve(4); list.push_back(EncodableValue(name_)); list.push_back(CustomEncodableValue(*options_)); - list.push_back(is_automatic_data_collection_enabled_ ? EncodableValue(*is_automatic_data_collection_enabled_) : EncodableValue()); + list.push_back(is_automatic_data_collection_enabled_ + ? EncodableValue(*is_automatic_data_collection_enabled_) + : EncodableValue()); list.push_back(EncodableValue(plugin_constants_)); return list; } -CoreInitializeResponse CoreInitializeResponse::FromEncodableList(const EncodableList& list) { - CoreInitializeResponse decoded( - std::get(list[0]), - std::any_cast(std::get(list[1])), - std::get(list[3])); +CoreInitializeResponse CoreInitializeResponse::FromEncodableList( + const EncodableList& list) { + CoreInitializeResponse decoded(std::get(list[0]), + std::any_cast( + std::get(list[1])), + std::get(list[3])); auto& encodable_is_automatic_data_collection_enabled = list[2]; if (!encodable_is_automatic_data_collection_enabled.IsNull()) { - decoded.set_is_automatic_data_collection_enabled(std::get(encodable_is_automatic_data_collection_enabled)); + decoded.set_is_automatic_data_collection_enabled( + std::get(encodable_is_automatic_data_collection_enabled)); } return decoded; } -bool CoreInitializeResponse::operator==(const CoreInitializeResponse& other) const { - return PigeonInternalDeepEquals(name_, other.name_) && PigeonInternalDeepEquals(options_, other.options_) && PigeonInternalDeepEquals(is_automatic_data_collection_enabled_, other.is_automatic_data_collection_enabled_) && PigeonInternalDeepEquals(plugin_constants_, other.plugin_constants_); +bool CoreInitializeResponse::operator==( + const CoreInitializeResponse& other) const { + return PigeonInternalDeepEquals(name_, other.name_) && + PigeonInternalDeepEquals(options_, other.options_) && + PigeonInternalDeepEquals( + is_automatic_data_collection_enabled_, + other.is_automatic_data_collection_enabled_) && + PigeonInternalDeepEquals(plugin_constants_, other.plugin_constants_); } -bool CoreInitializeResponse::operator!=(const CoreInitializeResponse& other) const { +bool CoreInitializeResponse::operator!=( + const CoreInitializeResponse& other) const { return !(*this == other); } @@ -644,7 +707,8 @@ size_t CoreInitializeResponse::Hash() const { size_t result = 1; result = result * 31 + PigeonInternalDeepHash(name_); result = result * 31 + PigeonInternalDeepHash(options_); - result = result * 31 + PigeonInternalDeepHash(is_automatic_data_collection_enabled_); + result = result * 31 + + PigeonInternalDeepHash(is_automatic_data_collection_enabled_); result = result * 31 + PigeonInternalDeepHash(plugin_constants_); return result; } @@ -653,36 +717,42 @@ size_t PigeonInternalDeepHash(const CoreInitializeResponse& v) { return v.Hash(); } - PigeonInternalCodecSerializer::PigeonInternalCodecSerializer() {} EncodableValue PigeonInternalCodecSerializer::ReadValueOfType( - uint8_t type, - ::flutter::ByteStreamReader* stream) const { + uint8_t type, ::flutter::ByteStreamReader* stream) const { switch (type) { case 129: { - return CustomEncodableValue(CoreFirebaseOptions::FromEncodableList(std::get(ReadValue(stream)))); - } + return CustomEncodableValue(CoreFirebaseOptions::FromEncodableList( + std::get(ReadValue(stream)))); + } case 130: { - return CustomEncodableValue(CoreInitializeResponse::FromEncodableList(std::get(ReadValue(stream)))); - } + return CustomEncodableValue(CoreInitializeResponse::FromEncodableList( + std::get(ReadValue(stream)))); + } default: return ::flutter::StandardCodecSerializer::ReadValueOfType(type, stream); - } + } } void PigeonInternalCodecSerializer::WriteValue( - const EncodableValue& value, - ::flutter::ByteStreamWriter* stream) const { - if (const CustomEncodableValue* custom_value = std::get_if(&value)) { + const EncodableValue& value, ::flutter::ByteStreamWriter* stream) const { + if (const CustomEncodableValue* custom_value = + std::get_if(&value)) { if (custom_value->type() == typeid(CoreFirebaseOptions)) { stream->WriteByte(129); - WriteValue(EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); + WriteValue( + EncodableValue(std::any_cast(*custom_value) + .ToEncodableList()), + stream); return; } if (custom_value->type() == typeid(CoreInitializeResponse)) { stream->WriteByte(130); - WriteValue(EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); + WriteValue( + EncodableValue(std::any_cast(*custom_value) + .ToEncodableList()), + stream); return; } } @@ -691,96 +761,131 @@ void PigeonInternalCodecSerializer::WriteValue( /// The codec used by FirebaseCoreHostApi. const ::flutter::StandardMessageCodec& FirebaseCoreHostApi::GetCodec() { - return ::flutter::StandardMessageCodec::GetInstance(&PigeonInternalCodecSerializer::GetInstance()); + return ::flutter::StandardMessageCodec::GetInstance( + &PigeonInternalCodecSerializer::GetInstance()); } -// Sets up an instance of `FirebaseCoreHostApi` to handle messages through the `binary_messenger`. -void FirebaseCoreHostApi::SetUp( - ::flutter::BinaryMessenger* binary_messenger, - FirebaseCoreHostApi* api) { +// Sets up an instance of `FirebaseCoreHostApi` to handle messages through the +// `binary_messenger`. +void FirebaseCoreHostApi::SetUp(::flutter::BinaryMessenger* binary_messenger, + FirebaseCoreHostApi* api) { FirebaseCoreHostApi::SetUp(binary_messenger, api, ""); } -void FirebaseCoreHostApi::SetUp( - ::flutter::BinaryMessenger* binary_messenger, - FirebaseCoreHostApi* api, - const std::string& message_channel_suffix) { - const std::string prepended_suffix = message_channel_suffix.length() > 0 ? std::string(".") + message_channel_suffix : ""; +void FirebaseCoreHostApi::SetUp(::flutter::BinaryMessenger* binary_messenger, + FirebaseCoreHostApi* api, + const std::string& message_channel_suffix) { + const std::string prepended_suffix = + message_channel_suffix.length() > 0 + ? std::string(".") + message_channel_suffix + : ""; { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeApp" + prepended_suffix, &GetCodec()); + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.firebase_core_platform_interface." + "FirebaseCoreHostApi.initializeApp" + + prepended_suffix, + &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_app_name_arg = args.at(0); - if (encodable_app_name_arg.IsNull()) { - reply(WrapError("app_name_arg unexpectedly null.")); - return; - } - const auto& app_name_arg = std::get(encodable_app_name_arg); - const auto& encodable_initialize_app_request_arg = args.at(1); - if (encodable_initialize_app_request_arg.IsNull()) { - reply(WrapError("initialize_app_request_arg unexpectedly null.")); - return; - } - const auto& initialize_app_request_arg = std::any_cast(std::get(encodable_initialize_app_request_arg)); - api->InitializeApp(app_name_arg, initialize_app_request_arg, [reply](ErrorOr&& output) { - if (output.has_error()) { - reply(WrapError(output.error())); - return; + channel.SetMessageHandler( + [api](const EncodableValue& message, + const ::flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_app_name_arg = args.at(0); + if (encodable_app_name_arg.IsNull()) { + reply(WrapError("app_name_arg unexpectedly null.")); + return; + } + const auto& app_name_arg = + std::get(encodable_app_name_arg); + const auto& encodable_initialize_app_request_arg = args.at(1); + if (encodable_initialize_app_request_arg.IsNull()) { + reply( + WrapError("initialize_app_request_arg unexpectedly null.")); + return; + } + const auto& initialize_app_request_arg = + std::any_cast( + std::get( + encodable_initialize_app_request_arg)); + api->InitializeApp( + app_name_arg, initialize_app_request_arg, + [reply](ErrorOr&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + EncodableList wrapped; + wrapped.push_back( + CustomEncodableValue(std::move(output).TakeValue())); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); } - EncodableList wrapped; - wrapped.push_back(CustomEncodableValue(std::move(output).TakeValue())); - reply(EncodableValue(std::move(wrapped))); }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); } else { channel.SetMessageHandler(nullptr); } } { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeCore" + prepended_suffix, &GetCodec()); + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.firebase_core_platform_interface." + "FirebaseCoreHostApi.initializeCore" + + prepended_suffix, + &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { - try { - api->InitializeCore([reply](ErrorOr&& output) { - if (output.has_error()) { - reply(WrapError(output.error())); - return; + channel.SetMessageHandler( + [api](const EncodableValue& message, + const ::flutter::MessageReply& reply) { + try { + api->InitializeCore([reply](ErrorOr&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + EncodableList wrapped; + wrapped.push_back( + EncodableValue(std::move(output).TakeValue())); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); } - EncodableList wrapped; - wrapped.push_back(EncodableValue(std::move(output).TakeValue())); - reply(EncodableValue(std::move(wrapped))); }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); } else { channel.SetMessageHandler(nullptr); } } { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.optionsFromResource" + prepended_suffix, &GetCodec()); + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.firebase_core_platform_interface." + "FirebaseCoreHostApi.optionsFromResource" + + prepended_suffix, + &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { - try { - api->OptionsFromResource([reply](ErrorOr&& output) { - if (output.has_error()) { - reply(WrapError(output.error())); - return; + channel.SetMessageHandler( + [api](const EncodableValue& message, + const ::flutter::MessageReply& reply) { + try { + api->OptionsFromResource( + [reply](ErrorOr&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + EncodableList wrapped; + wrapped.push_back( + CustomEncodableValue(std::move(output).TakeValue())); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); } - EncodableList wrapped; - wrapped.push_back(CustomEncodableValue(std::move(output).TakeValue())); - reply(EncodableValue(std::move(wrapped))); }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); } else { channel.SetMessageHandler(nullptr); } @@ -788,133 +893,160 @@ void FirebaseCoreHostApi::SetUp( } EncodableValue FirebaseCoreHostApi::WrapError(std::string_view error_message) { - return EncodableValue(EncodableList{ - EncodableValue(std::string(error_message)), - EncodableValue("Error"), - EncodableValue() - }); + return EncodableValue( + EncodableList{EncodableValue(std::string(error_message)), + EncodableValue("Error"), EncodableValue()}); } EncodableValue FirebaseCoreHostApi::WrapError(const FlutterError& error) { - return EncodableValue(EncodableList{ - EncodableValue(error.code()), - EncodableValue(error.message()), - error.details() - }); + return EncodableValue(EncodableList{EncodableValue(error.code()), + EncodableValue(error.message()), + error.details()}); } /// The codec used by FirebaseAppHostApi. const ::flutter::StandardMessageCodec& FirebaseAppHostApi::GetCodec() { - return ::flutter::StandardMessageCodec::GetInstance(&PigeonInternalCodecSerializer::GetInstance()); + return ::flutter::StandardMessageCodec::GetInstance( + &PigeonInternalCodecSerializer::GetInstance()); } -// Sets up an instance of `FirebaseAppHostApi` to handle messages through the `binary_messenger`. -void FirebaseAppHostApi::SetUp( - ::flutter::BinaryMessenger* binary_messenger, - FirebaseAppHostApi* api) { +// Sets up an instance of `FirebaseAppHostApi` to handle messages through the +// `binary_messenger`. +void FirebaseAppHostApi::SetUp(::flutter::BinaryMessenger* binary_messenger, + FirebaseAppHostApi* api) { FirebaseAppHostApi::SetUp(binary_messenger, api, ""); } -void FirebaseAppHostApi::SetUp( - ::flutter::BinaryMessenger* binary_messenger, - FirebaseAppHostApi* api, - const std::string& message_channel_suffix) { - const std::string prepended_suffix = message_channel_suffix.length() > 0 ? std::string(".") + message_channel_suffix : ""; +void FirebaseAppHostApi::SetUp(::flutter::BinaryMessenger* binary_messenger, + FirebaseAppHostApi* api, + const std::string& message_channel_suffix) { + const std::string prepended_suffix = + message_channel_suffix.length() > 0 + ? std::string(".") + message_channel_suffix + : ""; { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticDataCollectionEnabled" + prepended_suffix, &GetCodec()); + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.firebase_core_platform_interface." + "FirebaseAppHostApi.setAutomaticDataCollectionEnabled" + + prepended_suffix, + &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_app_name_arg = args.at(0); - if (encodable_app_name_arg.IsNull()) { - reply(WrapError("app_name_arg unexpectedly null.")); - return; - } - const auto& app_name_arg = std::get(encodable_app_name_arg); - const auto& encodable_enabled_arg = args.at(1); - if (encodable_enabled_arg.IsNull()) { - reply(WrapError("enabled_arg unexpectedly null.")); - return; - } - const auto& enabled_arg = std::get(encodable_enabled_arg); - api->SetAutomaticDataCollectionEnabled(app_name_arg, enabled_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; + channel.SetMessageHandler( + [api](const EncodableValue& message, + const ::flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_app_name_arg = args.at(0); + if (encodable_app_name_arg.IsNull()) { + reply(WrapError("app_name_arg unexpectedly null.")); + return; + } + const auto& app_name_arg = + std::get(encodable_app_name_arg); + const auto& encodable_enabled_arg = args.at(1); + if (encodable_enabled_arg.IsNull()) { + reply(WrapError("enabled_arg unexpectedly null.")); + return; + } + const auto& enabled_arg = std::get(encodable_enabled_arg); + api->SetAutomaticDataCollectionEnabled( + app_name_arg, enabled_arg, + [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); } else { channel.SetMessageHandler(nullptr); } } { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticResourceManagementEnabled" + prepended_suffix, &GetCodec()); + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.firebase_core_platform_interface." + "FirebaseAppHostApi.setAutomaticResourceManagementEnabled" + + prepended_suffix, + &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_app_name_arg = args.at(0); - if (encodable_app_name_arg.IsNull()) { - reply(WrapError("app_name_arg unexpectedly null.")); - return; - } - const auto& app_name_arg = std::get(encodable_app_name_arg); - const auto& encodable_enabled_arg = args.at(1); - if (encodable_enabled_arg.IsNull()) { - reply(WrapError("enabled_arg unexpectedly null.")); - return; - } - const auto& enabled_arg = std::get(encodable_enabled_arg); - api->SetAutomaticResourceManagementEnabled(app_name_arg, enabled_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; + channel.SetMessageHandler( + [api](const EncodableValue& message, + const ::flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_app_name_arg = args.at(0); + if (encodable_app_name_arg.IsNull()) { + reply(WrapError("app_name_arg unexpectedly null.")); + return; + } + const auto& app_name_arg = + std::get(encodable_app_name_arg); + const auto& encodable_enabled_arg = args.at(1); + if (encodable_enabled_arg.IsNull()) { + reply(WrapError("enabled_arg unexpectedly null.")); + return; + } + const auto& enabled_arg = std::get(encodable_enabled_arg); + api->SetAutomaticResourceManagementEnabled( + app_name_arg, enabled_arg, + [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); } else { channel.SetMessageHandler(nullptr); } } { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.delete" + prepended_suffix, &GetCodec()); + BasicMessageChannel<> channel(binary_messenger, + "dev.flutter.pigeon.firebase_core_platform_" + "interface.FirebaseAppHostApi.delete" + + prepended_suffix, + &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_app_name_arg = args.at(0); - if (encodable_app_name_arg.IsNull()) { - reply(WrapError("app_name_arg unexpectedly null.")); - return; - } - const auto& app_name_arg = std::get(encodable_app_name_arg); - api->Delete(app_name_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; + channel.SetMessageHandler( + [api](const EncodableValue& message, + const ::flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_app_name_arg = args.at(0); + if (encodable_app_name_arg.IsNull()) { + reply(WrapError("app_name_arg unexpectedly null.")); + return; + } + const auto& app_name_arg = + std::get(encodable_app_name_arg); + api->Delete(app_name_arg, + [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); } else { channel.SetMessageHandler(nullptr); } @@ -922,19 +1054,15 @@ void FirebaseAppHostApi::SetUp( } EncodableValue FirebaseAppHostApi::WrapError(std::string_view error_message) { - return EncodableValue(EncodableList{ - EncodableValue(std::string(error_message)), - EncodableValue("Error"), - EncodableValue() - }); + return EncodableValue( + EncodableList{EncodableValue(std::string(error_message)), + EncodableValue("Error"), EncodableValue()}); } EncodableValue FirebaseAppHostApi::WrapError(const FlutterError& error) { - return EncodableValue(EncodableList{ - EncodableValue(error.code()), - EncodableValue(error.message()), - error.details() - }); + return EncodableValue(EncodableList{EncodableValue(error.code()), + EncodableValue(error.message()), + error.details()}); } } // namespace firebase_core_windows diff --git a/packages/firebase_core/firebase_core/windows/messages.g.h b/packages/firebase_core/firebase_core/windows/messages.g.h index 942ab224442d..c456febacce9 100644 --- a/packages/firebase_core/firebase_core/windows/messages.g.h +++ b/packages/firebase_core/firebase_core/windows/messages.g.h @@ -17,17 +17,16 @@ namespace firebase_core_windows { - // Generated class from Pigeon. class FlutterError { public: - explicit FlutterError(const std::string& code) - : code_(code) {} + explicit FlutterError(const std::string& code) : code_(code) {} explicit FlutterError(const std::string& code, const std::string& message) - : code_(code), message_(message) {} - explicit FlutterError(const std::string& code, const std::string& message, const ::flutter::EncodableValue& details) - : code_(code), message_(message), details_(details) {} + : code_(code), message_(message) {} + explicit FlutterError(const std::string& code, const std::string& message, + const ::flutter::EncodableValue& details) + : code_(code), message_(message), details_(details) {} const std::string& code() const { return code_; } const std::string& message() const { return message_; } @@ -39,7 +38,8 @@ class FlutterError { ::flutter::EncodableValue details_; }; -template class ErrorOr { +template +class ErrorOr { public: ErrorOr(const T& rhs) : v_(rhs) {} ErrorOr(const T&& rhs) : v_(std::move(rhs)) {} @@ -59,34 +59,24 @@ template class ErrorOr { std::variant v_; }; - - // Generated class from Pigeon that represents data sent in messages. class CoreFirebaseOptions { public: // Constructs an object setting all non-nullable fields. - explicit CoreFirebaseOptions( - const std::string& api_key, - const std::string& app_id, - const std::string& messaging_sender_id, - const std::string& project_id); + explicit CoreFirebaseOptions(const std::string& api_key, + const std::string& app_id, + const std::string& messaging_sender_id, + const std::string& project_id); // Constructs an object setting all fields. explicit CoreFirebaseOptions( - const std::string& api_key, - const std::string& app_id, - const std::string& messaging_sender_id, - const std::string& project_id, - const std::string* auth_domain, - const std::string* database_u_r_l, - const std::string* storage_bucket, - const std::string* measurement_id, - const std::string* tracking_id, - const std::string* deep_link_u_r_l_scheme, - const std::string* android_client_id, - const std::string* ios_client_id, - const std::string* ios_bundle_id, - const std::string* app_group_id); + const std::string& api_key, const std::string& app_id, + const std::string& messaging_sender_id, const std::string& project_id, + const std::string* auth_domain, const std::string* database_u_r_l, + const std::string* storage_bucket, const std::string* measurement_id, + const std::string* tracking_id, const std::string* deep_link_u_r_l_scheme, + const std::string* android_client_id, const std::string* ios_client_id, + const std::string* ios_bundle_id, const std::string* app_group_id); const std::string& api_key() const; void set_api_key(std::string_view value_arg); @@ -142,10 +132,13 @@ class CoreFirebaseOptions { bool operator==(const CoreFirebaseOptions& other) const; bool operator!=(const CoreFirebaseOptions& other) const; - /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. + /// Returns a hash code value for the object. This method is supported for the + /// benefit of hash tables. size_t Hash() const; + private: - static CoreFirebaseOptions FromEncodableList(const ::flutter::EncodableList& list); + static CoreFirebaseOptions FromEncodableList( + const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; friend class CoreInitializeResponse; friend class FirebaseCoreHostApi; @@ -167,28 +160,26 @@ class CoreFirebaseOptions { std::optional app_group_id_; }; - // Generated class from Pigeon that represents data sent in messages. class CoreInitializeResponse { public: // Constructs an object setting all non-nullable fields. explicit CoreInitializeResponse( - const std::string& name, - const CoreFirebaseOptions& options, - const ::flutter::EncodableMap& plugin_constants); + const std::string& name, const CoreFirebaseOptions& options, + const ::flutter::EncodableMap& plugin_constants); // Constructs an object setting all fields. explicit CoreInitializeResponse( - const std::string& name, - const CoreFirebaseOptions& options, - const bool* is_automatic_data_collection_enabled, - const ::flutter::EncodableMap& plugin_constants); + const std::string& name, const CoreFirebaseOptions& options, + const bool* is_automatic_data_collection_enabled, + const ::flutter::EncodableMap& plugin_constants); ~CoreInitializeResponse() = default; CoreInitializeResponse(const CoreInitializeResponse& other); CoreInitializeResponse& operator=(const CoreInitializeResponse& other); CoreInitializeResponse(CoreInitializeResponse&& other) = default; - CoreInitializeResponse& operator=(CoreInitializeResponse&& other) noexcept = default; + CoreInitializeResponse& operator=(CoreInitializeResponse&& other) noexcept = + default; const std::string& name() const; void set_name(std::string_view value_arg); @@ -204,10 +195,13 @@ class CoreInitializeResponse { bool operator==(const CoreInitializeResponse& other) const; bool operator!=(const CoreInitializeResponse& other) const; - /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. + /// Returns a hash code value for the object. This method is supported for the + /// benefit of hash tables. size_t Hash() const; + private: - static CoreInitializeResponse FromEncodableList(const ::flutter::EncodableList& list); + static CoreInitializeResponse FromEncodableList( + const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; friend class FirebaseCoreHostApi; friend class FirebaseAppHostApi; @@ -218,8 +212,8 @@ class CoreInitializeResponse { ::flutter::EncodableMap plugin_constants_; }; - -class PigeonInternalCodecSerializer : public ::flutter::StandardCodecSerializer { +class PigeonInternalCodecSerializer + : public ::flutter::StandardCodecSerializer { public: PigeonInternalCodecSerializer(); inline static PigeonInternalCodecSerializer& GetInstance() { @@ -227,73 +221,74 @@ class PigeonInternalCodecSerializer : public ::flutter::StandardCodecSerializer return sInstance; } - void WriteValue( - const ::flutter::EncodableValue& value, - ::flutter::ByteStreamWriter* stream) const override; + void WriteValue(const ::flutter::EncodableValue& value, + ::flutter::ByteStreamWriter* stream) const override; + protected: ::flutter::EncodableValue ReadValueOfType( - uint8_t type, - ::flutter::ByteStreamReader* stream) const override; + uint8_t type, ::flutter::ByteStreamReader* stream) const override; }; -// Generated interface from Pigeon that represents a handler of messages from Flutter. +// Generated interface from Pigeon that represents a handler of messages from +// Flutter. class FirebaseCoreHostApi { public: FirebaseCoreHostApi(const FirebaseCoreHostApi&) = delete; FirebaseCoreHostApi& operator=(const FirebaseCoreHostApi&) = delete; virtual ~FirebaseCoreHostApi() {} virtual void InitializeApp( - const std::string& app_name, - const CoreFirebaseOptions& initialize_app_request, - std::function reply)> result) = 0; - virtual void InitializeCore(std::function reply)> result) = 0; - virtual void OptionsFromResource(std::function reply)> result) = 0; + const std::string& app_name, + const CoreFirebaseOptions& initialize_app_request, + std::function reply)> result) = 0; + virtual void InitializeCore( + std::function reply)> result) = 0; + virtual void OptionsFromResource( + std::function reply)> result) = 0; // The codec used by FirebaseCoreHostApi. static const ::flutter::StandardMessageCodec& GetCodec(); - // Sets up an instance of `FirebaseCoreHostApi` to handle messages through the `binary_messenger`. - static void SetUp( - ::flutter::BinaryMessenger* binary_messenger, - FirebaseCoreHostApi* api); - static void SetUp( - ::flutter::BinaryMessenger* binary_messenger, - FirebaseCoreHostApi* api, - const std::string& message_channel_suffix); + // Sets up an instance of `FirebaseCoreHostApi` to handle messages through the + // `binary_messenger`. + static void SetUp(::flutter::BinaryMessenger* binary_messenger, + FirebaseCoreHostApi* api); + static void SetUp(::flutter::BinaryMessenger* binary_messenger, + FirebaseCoreHostApi* api, + const std::string& message_channel_suffix); static ::flutter::EncodableValue WrapError(std::string_view error_message); static ::flutter::EncodableValue WrapError(const FlutterError& error); + protected: FirebaseCoreHostApi() = default; }; -// Generated interface from Pigeon that represents a handler of messages from Flutter. +// Generated interface from Pigeon that represents a handler of messages from +// Flutter. class FirebaseAppHostApi { public: FirebaseAppHostApi(const FirebaseAppHostApi&) = delete; FirebaseAppHostApi& operator=(const FirebaseAppHostApi&) = delete; virtual ~FirebaseAppHostApi() {} virtual void SetAutomaticDataCollectionEnabled( - const std::string& app_name, - bool enabled, - std::function reply)> result) = 0; + const std::string& app_name, bool enabled, + std::function reply)> result) = 0; virtual void SetAutomaticResourceManagementEnabled( - const std::string& app_name, - bool enabled, - std::function reply)> result) = 0; + const std::string& app_name, bool enabled, + std::function reply)> result) = 0; virtual void Delete( - const std::string& app_name, - std::function reply)> result) = 0; + const std::string& app_name, + std::function reply)> result) = 0; // The codec used by FirebaseAppHostApi. static const ::flutter::StandardMessageCodec& GetCodec(); - // Sets up an instance of `FirebaseAppHostApi` to handle messages through the `binary_messenger`. - static void SetUp( - ::flutter::BinaryMessenger* binary_messenger, - FirebaseAppHostApi* api); - static void SetUp( - ::flutter::BinaryMessenger* binary_messenger, - FirebaseAppHostApi* api, - const std::string& message_channel_suffix); + // Sets up an instance of `FirebaseAppHostApi` to handle messages through the + // `binary_messenger`. + static void SetUp(::flutter::BinaryMessenger* binary_messenger, + FirebaseAppHostApi* api); + static void SetUp(::flutter::BinaryMessenger* binary_messenger, + FirebaseAppHostApi* api, + const std::string& message_channel_suffix); static ::flutter::EncodableValue WrapError(std::string_view error_message); static ::flutter::EncodableValue WrapError(const FlutterError& error); + protected: FirebaseAppHostApi() = default; }; diff --git a/packages/firebase_core/firebase_core_platform_interface/lib/src/pigeon/messages.pigeon.dart b/packages/firebase_core/firebase_core_platform_interface/lib/src/pigeon/messages.pigeon.dart index 9238d41c6246..6d4123a1f1cb 100644 --- a/packages/firebase_core/firebase_core_platform_interface/lib/src/pigeon/messages.pigeon.dart +++ b/packages/firebase_core/firebase_core_platform_interface/lib/src/pigeon/messages.pigeon.dart @@ -13,9 +13,9 @@ import 'package:flutter/services.dart'; import 'package:meta/meta.dart' show immutable, protected, visibleForTesting; Object? _extractReplyValueOrThrow( - List? replyList, - String channelName, { - required bool isNullValid, + List? replyList, + String channelName, { + required bool isNullValid, }) { if (replyList == null) { throw PlatformException( @@ -37,8 +37,8 @@ Object? _extractReplyValueOrThrow( return replyList.firstOrNull; } - -List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse( + {Object? result, PlatformException? error, bool empty = false}) { if (empty) { return []; } @@ -47,6 +47,7 @@ List wrapResponse({Object? result, PlatformException? error, bool empty } return [error.code, error.message, error.details]; } + bool _deepEquals(Object? a, Object? b) { if (identical(a, b)) { return true; @@ -109,7 +110,6 @@ int _deepHash(Object? value) { return value.hashCode; } - class CoreFirebaseOptions { CoreFirebaseOptions({ required this.apiKey, @@ -176,7 +176,8 @@ class CoreFirebaseOptions { } Object encode() { - return _toList(); } + return _toList(); + } static CoreFirebaseOptions decode(Object result) { result as List; @@ -207,7 +208,20 @@ class CoreFirebaseOptions { if (identical(this, other)) { return true; } - return _deepEquals(apiKey, other.apiKey) && _deepEquals(appId, other.appId) && _deepEquals(messagingSenderId, other.messagingSenderId) && _deepEquals(projectId, other.projectId) && _deepEquals(authDomain, other.authDomain) && _deepEquals(databaseURL, other.databaseURL) && _deepEquals(storageBucket, other.storageBucket) && _deepEquals(measurementId, other.measurementId) && _deepEquals(trackingId, other.trackingId) && _deepEquals(deepLinkURLScheme, other.deepLinkURLScheme) && _deepEquals(androidClientId, other.androidClientId) && _deepEquals(iosClientId, other.iosClientId) && _deepEquals(iosBundleId, other.iosBundleId) && _deepEquals(appGroupId, other.appGroupId); + return _deepEquals(apiKey, other.apiKey) && + _deepEquals(appId, other.appId) && + _deepEquals(messagingSenderId, other.messagingSenderId) && + _deepEquals(projectId, other.projectId) && + _deepEquals(authDomain, other.authDomain) && + _deepEquals(databaseURL, other.databaseURL) && + _deepEquals(storageBucket, other.storageBucket) && + _deepEquals(measurementId, other.measurementId) && + _deepEquals(trackingId, other.trackingId) && + _deepEquals(deepLinkURLScheme, other.deepLinkURLScheme) && + _deepEquals(androidClientId, other.androidClientId) && + _deepEquals(iosClientId, other.iosClientId) && + _deepEquals(iosBundleId, other.iosBundleId) && + _deepEquals(appGroupId, other.appGroupId); } @override @@ -241,7 +255,8 @@ class CoreInitializeResponse { } Object encode() { - return _toList(); } + return _toList(); + } static CoreInitializeResponse decode(Object result) { result as List; @@ -249,7 +264,8 @@ class CoreInitializeResponse { name: result[0]! as String, options: result[1]! as CoreFirebaseOptions, isAutomaticDataCollectionEnabled: result[2] as bool?, - pluginConstants: (result[3]! as Map).cast(), + pluginConstants: + (result[3]! as Map).cast(), ); } @@ -262,7 +278,11 @@ class CoreInitializeResponse { if (identical(this, other)) { return true; } - return _deepEquals(name, other.name) && _deepEquals(options, other.options) && _deepEquals(isAutomaticDataCollectionEnabled, other.isAutomaticDataCollectionEnabled) && _deepEquals(pluginConstants, other.pluginConstants); + return _deepEquals(name, other.name) && + _deepEquals(options, other.options) && + _deepEquals(isAutomaticDataCollectionEnabled, + other.isAutomaticDataCollectionEnabled) && + _deepEquals(pluginConstants, other.pluginConstants); } @override @@ -270,7 +290,6 @@ class CoreInitializeResponse { int get hashCode => _deepHash([runtimeType, ..._toList()]); } - class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -278,10 +297,10 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is CoreFirebaseOptions) { + } else if (value is CoreFirebaseOptions) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is CoreInitializeResponse) { + } else if (value is CoreInitializeResponse) { buffer.putUint8(130); writeValue(buffer, value.encode()); } else { @@ -306,36 +325,41 @@ class FirebaseCoreHostApi { /// Constructor for [FirebaseCoreHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - FirebaseCoreHostApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + FirebaseCoreHostApi( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + pigeonVar_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); final String pigeonVar_messageChannelSuffix; - Future initializeApp(String appName, CoreFirebaseOptions initializeAppRequest) async { - final pigeonVar_channelName = 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeApp$pigeonVar_messageChannelSuffix'; + Future initializeApp( + String appName, CoreFirebaseOptions initializeAppRequest) async { + final pigeonVar_channelName = + 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeApp$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send([appName, initializeAppRequest]); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([appName, initializeAppRequest]); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: false, - ) - ; + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); return pigeonVar_replyValue! as CoreInitializeResponse; } Future> initializeCore() async { - final pigeonVar_channelName = 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeCore$pigeonVar_messageChannelSuffix'; + final pigeonVar_channelName = + 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeCore$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -345,16 +369,17 @@ class FirebaseCoreHostApi { final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: false, - ) - ; - return (pigeonVar_replyValue! as List).cast(); + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return (pigeonVar_replyValue! as List) + .cast(); } Future optionsFromResource() async { - final pigeonVar_channelName = 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.optionsFromResource$pigeonVar_messageChannelSuffix'; + final pigeonVar_channelName = + 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.optionsFromResource$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -364,11 +389,10 @@ class FirebaseCoreHostApi { final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: false, - ) - ; + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); return pigeonVar_replyValue! as CoreFirebaseOptions; } } @@ -377,66 +401,73 @@ class FirebaseAppHostApi { /// Constructor for [FirebaseAppHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - FirebaseAppHostApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + FirebaseAppHostApi( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + pigeonVar_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); final String pigeonVar_messageChannelSuffix; - Future setAutomaticDataCollectionEnabled(String appName, bool enabled) async { - final pigeonVar_channelName = 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticDataCollectionEnabled$pigeonVar_messageChannelSuffix'; + Future setAutomaticDataCollectionEnabled( + String appName, bool enabled) async { + final pigeonVar_channelName = + 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticDataCollectionEnabled$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send([appName, enabled]); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([appName, enabled]); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: true, - ) - ; + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } - Future setAutomaticResourceManagementEnabled(String appName, bool enabled) async { - final pigeonVar_channelName = 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticResourceManagementEnabled$pigeonVar_messageChannelSuffix'; + Future setAutomaticResourceManagementEnabled( + String appName, bool enabled) async { + final pigeonVar_channelName = + 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticResourceManagementEnabled$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send([appName, enabled]); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([appName, enabled]); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: true, - ) - ; + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } Future delete(String appName) async { - final pigeonVar_channelName = 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.delete$pigeonVar_messageChannelSuffix'; + final pigeonVar_channelName = + 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.delete$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send([appName]); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([appName]); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: true, - ) - ; + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } } diff --git a/packages/firebase_core/firebase_core_platform_interface/lib/src/pigeon/test_api.dart b/packages/firebase_core/firebase_core_platform_interface/lib/src/pigeon/test_api.dart index b0cbd8cfb193..9dd32fe50dba 100644 --- a/packages/firebase_core/firebase_core_platform_interface/lib/src/pigeon/test_api.dart +++ b/packages/firebase_core/firebase_core_platform_interface/lib/src/pigeon/test_api.dart @@ -13,7 +13,6 @@ import 'package:flutter_test/flutter_test.dart'; import 'messages.pigeon.dart'; - class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -21,10 +20,10 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is CoreFirebaseOptions) { + } else if (value is CoreFirebaseOptions) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is CoreInitializeResponse) { + } else if (value is CoreInitializeResponse) { buffer.putUint8(130); writeValue(buffer, value.encode()); } else { @@ -46,73 +45,98 @@ class _PigeonCodec extends StandardMessageCodec { } abstract class TestFirebaseCoreHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - Future initializeApp(String appName, CoreFirebaseOptions initializeAppRequest); + Future initializeApp( + String appName, CoreFirebaseOptions initializeAppRequest); Future> initializeCore(); Future optionsFromResource(); - static void setUp(TestFirebaseCoreHostApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { - messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + static void setUp( + TestFirebaseCoreHostApi? api, { + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) { + messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { final pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeApp$messageChannelSuffix', pigeonChannelCodec, + 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeApp$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(pigeonVar_channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(pigeonVar_channel, + (Object? message) async { final List args = message! as List; final String arg_appName = args[0]! as String; - final CoreFirebaseOptions arg_initializeAppRequest = args[1]! as CoreFirebaseOptions; + final CoreFirebaseOptions arg_initializeAppRequest = + args[1]! as CoreFirebaseOptions; try { - final CoreInitializeResponse output = await api.initializeApp(arg_appName, arg_initializeAppRequest); + final CoreInitializeResponse output = + await api.initializeApp(arg_appName, arg_initializeAppRequest); return [output]; } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); } }); } } { final pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeCore$messageChannelSuffix', pigeonChannelCodec, + 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeCore$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(pigeonVar_channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(pigeonVar_channel, + (Object? message) async { try { - final List output = await api.initializeCore(); + final List output = + await api.initializeCore(); return [output]; } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); } }); } } { final pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.optionsFromResource$messageChannelSuffix', pigeonChannelCodec, + 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.optionsFromResource$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(pigeonVar_channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(pigeonVar_channel, + (Object? message) async { try { final CoreFirebaseOptions output = await api.optionsFromResource(); return [output]; } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); } }); } @@ -121,69 +145,92 @@ abstract class TestFirebaseCoreHostApi { } abstract class TestFirebaseAppHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); Future setAutomaticDataCollectionEnabled(String appName, bool enabled); - Future setAutomaticResourceManagementEnabled(String appName, bool enabled); + Future setAutomaticResourceManagementEnabled( + String appName, bool enabled); Future delete(String appName); - static void setUp(TestFirebaseAppHostApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { - messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + static void setUp( + TestFirebaseAppHostApi? api, { + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) { + messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { final pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticDataCollectionEnabled$messageChannelSuffix', pigeonChannelCodec, + 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticDataCollectionEnabled$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(pigeonVar_channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(pigeonVar_channel, + (Object? message) async { final List args = message! as List; final String arg_appName = args[0]! as String; final bool arg_enabled = args[1]! as bool; try { - await api.setAutomaticDataCollectionEnabled(arg_appName, arg_enabled); + await api.setAutomaticDataCollectionEnabled( + arg_appName, arg_enabled); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); } }); } } { final pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticResourceManagementEnabled$messageChannelSuffix', pigeonChannelCodec, + 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.setAutomaticResourceManagementEnabled$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(pigeonVar_channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(pigeonVar_channel, + (Object? message) async { final List args = message! as List; final String arg_appName = args[0]! as String; final bool arg_enabled = args[1]! as bool; try { - await api.setAutomaticResourceManagementEnabled(arg_appName, arg_enabled); + await api.setAutomaticResourceManagementEnabled( + arg_appName, arg_enabled); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); } }); } } { final pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.delete$messageChannelSuffix', pigeonChannelCodec, + 'dev.flutter.pigeon.firebase_core_platform_interface.FirebaseAppHostApi.delete$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(pigeonVar_channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(pigeonVar_channel, + (Object? message) async { final List args = message! as List; final String arg_appName = args[0]! as String; try { @@ -191,8 +238,9 @@ abstract class TestFirebaseAppHostApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); } }); } From ec33f76dae8fb2a6e545b0959c1e41bc2c5cde7f Mon Sep 17 00:00:00 2001 From: Cynthia J Date: Fri, 31 Jul 2026 09:24:23 -0700 Subject: [PATCH 10/12] make web sitekey placeholder --- .../firebase_app_check/firebase_app_check/example/lib/main.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/firebase_app_check/firebase_app_check/example/lib/main.dart b/packages/firebase_app_check/firebase_app_check/example/lib/main.dart index e0567613294d..6e9c8225546c 100644 --- a/packages/firebase_app_check/firebase_app_check/example/lib/main.dart +++ b/packages/firebase_app_check/firebase_app_check/example/lib/main.dart @@ -12,7 +12,7 @@ import 'package:flutter/material.dart'; import 'firebase_options.dart'; -const kWebRecaptchaSiteKey = '6LcB120tAAAAALKQNKclit9f4k-gEZgC0ZmFihOD'; +const kWebRecaptchaSiteKey = 'put-default-web-sitekey'; const kIOSRecaptchaSiteKey = 'put-default-ios-sitekey'; const kAndroidRecaptchaSitekey = 'put-default-android-sitekey'; From 8edbc78ee7d96d489d19ff4b02d371339db7d977 Mon Sep 17 00:00:00 2001 From: Cynthia J Date: Fri, 31 Jul 2026 10:03:25 -0700 Subject: [PATCH 11/12] fix build error --- .../flutter/plugins/firebase/core/FlutterFirebaseCorePlugin.java | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/firebase_core/firebase_core/android/src/main/java/io/flutter/plugins/firebase/core/FlutterFirebaseCorePlugin.java b/packages/firebase_core/firebase_core/android/src/main/java/io/flutter/plugins/firebase/core/FlutterFirebaseCorePlugin.java index 19a4811a9093..a1552f051263 100644 --- a/packages/firebase_core/firebase_core/android/src/main/java/io/flutter/plugins/firebase/core/FlutterFirebaseCorePlugin.java +++ b/packages/firebase_core/firebase_core/android/src/main/java/io/flutter/plugins/firebase/core/FlutterFirebaseCorePlugin.java @@ -149,7 +149,6 @@ public void initializeApp( .setProjectId(initializeAppRequest.getProjectId()) .setStorageBucket(initializeAppRequest.getStorageBucket()) .setGaTrackingId(initializeAppRequest.getTrackingId()) - .setRecaptchaSiteKey(initializeAppRequest.getRecaptchaSiteKey()) .build(); // TODO(Salakar) hacky workaround a bug with FirebaseInAppMessaging causing the error: // Can't create handler inside thread Thread[pool-3-thread-1,5,main] that has not From 989b334d0387fc6e83db7844c0a1115216bb91d9 Mon Sep 17 00:00:00 2001 From: Cynthia J Date: Fri, 31 Jul 2026 10:40:34 -0700 Subject: [PATCH 12/12] reserve the entry for now to compatible with flutterfire_cli operation. --- .../lib/src/firebase_options.dart | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/firebase_core/firebase_core_platform_interface/lib/src/firebase_options.dart b/packages/firebase_core/firebase_core_platform_interface/lib/src/firebase_options.dart index ad0e580e88a8..3487164bb4a9 100644 --- a/packages/firebase_core/firebase_core_platform_interface/lib/src/firebase_options.dart +++ b/packages/firebase_core/firebase_core_platform_interface/lib/src/firebase_options.dart @@ -43,6 +43,7 @@ class FirebaseOptions { this.databaseURL, this.storageBucket, this.measurementId, + this.recaptchaSiteKey, // ios specific this.trackingId, this.deepLinkURLScheme, @@ -71,7 +72,9 @@ class FirebaseOptions { androidClientId = options.androidClientId, iosClientId = options.iosClientId, iosBundleId = options.iosBundleId, - appGroupId = options.appGroupId; + appGroupId = options.appGroupId, + recaptchaSiteKey = + ''; // Placeholder to coordinate with fluttefire cli current operation. /// Returns a copy of this FirebaseOptions with the given fields replaced with /// the new values. @@ -138,6 +141,13 @@ class FirebaseOptions { /// The project measurement ID value used on web platforms with analytics. final String? measurementId; + /// Reserved as a placeholder to maintain alignment with the FlutterFire CLI. + /// + /// **Note:** This field is currently non-functional and does not take effect in the active runtime. + /// It is preserved strictly to prevent breaking changes and ensure compatibility with + /// configuration files generated by the CLI. + final String? recaptchaSiteKey; + /// The tracking ID for Google Analytics, for example "UA-12345678-1", used to /// configure Google Analytics. ///