From 11c3828fc224624c8266d6a439a81e84865d9854 Mon Sep 17 00:00:00 2001 From: Cynthia J Date: Mon, 1 Jun 2026 13:35:15 -0700 Subject: [PATCH 1/4] Add Recaptcha Site Key to FirebaseOptions --- .../core/FlutterFirebaseCorePlugin.java | 3 + .../core/GeneratedAndroidFirebaseCore.java | 186 ++-- .../firebase_core/FLTFirebaseCorePlugin.m | 3 + .../include/firebase_core/messages.g.h | 102 +-- .../Sources/firebase_core/messages.g.m | 228 ++--- .../firebase_core/windows/messages.g.cpp | 841 ++++++++---------- .../firebase_core/windows/messages.g.h | 171 ++-- .../lib/src/firebase_options.dart | 10 +- .../lib/src/pigeon/messages.pigeon.dart | 160 ++-- .../lib/src/pigeon/test_api.dart | 140 +-- .../pigeons/messages.dart | 3 + .../test/firebase_options_test.dart | 4 + .../lib/src/firebase_core_web.dart | 2 + 13 files changed, 770 insertions(+), 1083 deletions(-) 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 a1fed94439e3..fcdeb2a7f5ac 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,6 +63,7 @@ private GeneratedAndroidFirebaseCore.CoreFirebaseOptions firebaseOptionsToMap( firebaseOptions.setDatabaseURL(options.getDatabaseUrl()); firebaseOptions.setStorageBucket(options.getStorageBucket()); firebaseOptions.setTrackingId(options.getGaTrackingId()); + // TODO(recaptchaSiteKey): Map recaptchaSiteKey if stored. return firebaseOptions.build(); } @@ -165,6 +166,8 @@ public void initializeApp( customAuthDomain.put(appName, initializeAppRequest.getAuthDomain()); } + // TODO(recaptchaSiteKey): Store or use recaptchaSiteKey if needed. + FirebaseApp firebaseApp = FirebaseApp.initializeApp(applicationContext, options, appName); taskCompletionSource.setResult(Tasks.await(firebaseAppToMap(firebaseApp))); 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 b0a698faf51c..d2c456295ea3 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,54 +371,30 @@ 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); + 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); } @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, recaptchaSiteKey}; return pigeonDeepHashCode(fields); } @@ -542,6 +512,14 @@ 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); @@ -558,13 +536,14 @@ public static final class Builder { pigeonReturn.setIosClientId(iosClientId); pigeonReturn.setIosBundleId(iosBundleId); pigeonReturn.setAppGroupId(appGroupId); + pigeonReturn.setRecaptchaSiteKey(recaptchaSiteKey); return pigeonReturn; } } @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList<>(14); + ArrayList toListResult = new ArrayList<>(15); toListResult.add(apiKey); toListResult.add(appId); toListResult.add(messagingSenderId); @@ -579,6 +558,7 @@ ArrayList toList() { toListResult.add(iosClientId); toListResult.add(iosBundleId); toListResult.add(appGroupId); + toListResult.add(recaptchaSiteKey); return toListResult; } @@ -612,6 +592,8 @@ 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; } } @@ -672,26 +654,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); } @@ -794,6 +765,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. */ @@ -802,7 +774,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. */ @@ -811,7 +782,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. */ @@ -820,14 +790,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); @@ -837,27 +803,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) -> { @@ -887,10 +842,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) -> { @@ -917,10 +869,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) -> { @@ -946,15 +895,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); @@ -962,26 +908,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) -> { @@ -1011,10 +947,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) -> { @@ -1044,10 +977,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 23b3f7b9433b..b68d963b08c7 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,6 +93,7 @@ - (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]; + // TODO(recaptchaSiteKey): Map recaptchaSiteKey if stored. return pigeonOptions; } @@ -178,6 +179,8 @@ - (void)initializeAppAppName:(nonnull NSString *)appName options.appGroupID = initializeAppRequest.appGroupId; } + // TODO(recaptchaSiteKey): Store or use recaptchaSiteKey if needed. + if (initializeAppRequest.authDomain != nil) { customAuthDomains[appNameIos] = initializeAppRequest.authDomain; } 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 913fdbbd3e43..00fa803e5b82 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,84 +20,72 @@ 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 + 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; @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 b1a0a1e69e45..3af8c26029a0 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,20 +130,21 @@ + (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 + recaptchaSiteKey:(nullable NSString *)recaptchaSiteKey { + CoreFirebaseOptions* pigeonResult = [[CoreFirebaseOptions alloc] init]; pigeonResult.apiKey = apiKey; pigeonResult.appId = appId; pigeonResult.messagingSenderId = messagingSenderId; @@ -159,6 +159,7 @@ + (instancetype)makeWithApiKey:(NSString *)apiKey pigeonResult.iosClientId = iosClientId; pigeonResult.iosBundleId = iosBundleId; pigeonResult.appGroupId = appGroupId; + pigeonResult.recaptchaSiteKey = recaptchaSiteKey; return pigeonResult; } + (CoreFirebaseOptions *)fromList:(NSArray *)list { @@ -177,6 +178,7 @@ + (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 { @@ -198,6 +200,7 @@ + (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 { @@ -208,20 +211,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); + 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); } - (NSUInteger)hash { @@ -240,16 +230,17 @@ - (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; @@ -283,11 +274,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 { @@ -305,9 +292,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]; @@ -346,68 +333,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)); }]; }]; @@ -416,22 +382,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)); }]; }]; @@ -440,97 +399,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/windows/messages.g.cpp b/packages/firebase_core/firebase_core/windows/messages.g.cpp index 42e8046a21e1..6e2c2860736d 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,66 +230,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, + 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_; +} 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_; } @@ -309,6 +298,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_; } @@ -317,178 +307,177 @@ 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(14); + list.reserve(15); 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(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()); 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)); @@ -511,13 +500,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()) { @@ -531,27 +518,15 @@ 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_); + 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_); } bool CoreFirebaseOptions::operator!=(const CoreFirebaseOptions& other) const { @@ -574,59 +549,57 @@ 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) {} + 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_; } @@ -635,71 +608,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); } @@ -707,8 +665,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; } @@ -717,42 +674,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; } } @@ -761,131 +712,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); } @@ -893,160 +809,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); } @@ -1054,15 +943,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 bce0a6a81f24..d5247a8e2840 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,24 +59,35 @@ 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* recaptcha_site_key); const std::string& api_key() const; void set_api_key(std::string_view value_arg); @@ -130,22 +141,17 @@ 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: - public: + static CoreFirebaseOptions FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; - - private: - private: friend class CoreInitializeResponse; friend class FirebaseCoreHostApi; friend class FirebaseAppHostApi; @@ -164,28 +170,31 @@ 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); @@ -201,20 +210,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: - public: + static CoreInitializeResponse FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; - - private: - private: friend class FirebaseCoreHostApi; friend class FirebaseAppHostApi; friend class PigeonInternalCodecSerializer; @@ -224,8 +224,8 @@ class CoreInitializeResponse { ::flutter::EncodableMap plugin_constants_; }; -class PigeonInternalCodecSerializer - : public ::flutter::StandardCodecSerializer { + +class PigeonInternalCodecSerializer : public ::flutter::StandardCodecSerializer { public: PigeonInternalCodecSerializer(); inline static PigeonInternalCodecSerializer& GetInstance() { @@ -233,74 +233,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 ad0e580e88a8..dbc740a71ffe 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,6 +50,7 @@ class FirebaseOptions { this.iosClientId, this.iosBundleId, this.appGroupId, + this.recaptchaSiteKey, }); /// Named constructor to create [FirebaseOptions] from a the response of Pigeon channel. @@ -71,7 +72,8 @@ class FirebaseOptions { androidClientId = options.androidClientId, iosClientId = options.iosClientId, iosBundleId = options.iosBundleId, - appGroupId = options.appGroupId; + appGroupId = options.appGroupId, + recaptchaSiteKey = options.recaptchaSiteKey; /// Returns a copy of this FirebaseOptions with the given fields replaced with /// the new values. @@ -90,6 +92,7 @@ class FirebaseOptions { String? iosClientId, String? iosBundleId, String? appGroupId, + String? recaptchaSiteKey, }) { return FirebaseOptions( apiKey: apiKey ?? this.apiKey, @@ -106,6 +109,7 @@ class FirebaseOptions { iosClientId: iosClientId ?? this.iosClientId, iosBundleId: iosBundleId ?? this.iosBundleId, appGroupId: appGroupId ?? this.appGroupId, + recaptchaSiteKey: recaptchaSiteKey ?? this.recaptchaSiteKey, ); } @@ -174,6 +178,9 @@ 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 { @@ -191,6 +198,7 @@ class FirebaseOptions { 'iosClientId': iosClientId, 'iosBundleId': iosBundleId, 'appGroupId': appGroupId, + 'recaptchaSiteKey': recaptchaSiteKey, }; } 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 6d4123a1f1cb..e59e8441aed4 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,6 +126,7 @@ class CoreFirebaseOptions { this.iosClientId, this.iosBundleId, this.appGroupId, + this.recaptchaSiteKey, }); String apiKey; @@ -156,6 +157,8 @@ class CoreFirebaseOptions { String? appGroupId; + String? recaptchaSiteKey; + List _toList() { return [ apiKey, @@ -172,12 +175,12 @@ class CoreFirebaseOptions { iosClientId, iosBundleId, appGroupId, + recaptchaSiteKey, ]; } Object encode() { - return _toList(); - } + return _toList(); } static CoreFirebaseOptions decode(Object result) { result as List; @@ -196,6 +199,7 @@ class CoreFirebaseOptions { iosClientId: result[11] as String?, iosBundleId: result[12] as String?, appGroupId: result[13] as String?, + recaptchaSiteKey: result[14] as String?, ); } @@ -208,20 +212,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); + 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); } @override @@ -255,8 +246,7 @@ class CoreInitializeResponse { } Object encode() { - return _toList(); - } + return _toList(); } static CoreInitializeResponse decode(Object result) { result as List; @@ -264,8 +254,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(), ); } @@ -278,11 +267,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 @@ -290,6 +275,7 @@ class CoreInitializeResponse { int get hashCode => _deepHash([runtimeType, ..._toList()]); } + class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -297,10 +283,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 { @@ -325,41 +311,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, @@ -369,17 +350,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, @@ -389,10 +369,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; } } @@ -401,73 +382,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 a2286f54f1a9..a42278d0f4e7 100644 --- a/packages/firebase_core/firebase_core_platform_interface/pigeons/messages.dart +++ b/packages/firebase_core/firebase_core_platform_interface/pigeons/messages.dart @@ -44,6 +44,7 @@ class CoreFirebaseOptions { required this.databaseURL, required this.storageBucket, required this.trackingId, + required this.recaptchaSiteKey, }); final String apiKey; @@ -73,6 +74,8 @@ 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 8b84f78e9525..91f66e2a03c0 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 @@ -91,6 +91,7 @@ void main() { iosClientId: 'newIosClientId', iosBundleId: 'newIosBundleId', appGroupId: 'newAppGroupId', + recaptchaSiteKey: 'newRecaptchaSiteKey', ); expect( @@ -110,6 +111,7 @@ void main() { iosClientId: 'newIosClientId', iosBundleId: 'newIosBundleId', appGroupId: 'newAppGroupId', + recaptchaSiteKey: 'newRecaptchaSiteKey', ), ); }); @@ -130,6 +132,7 @@ void main() { iosBundleId: 'iosBundleId', iosClientId: 'iosClientId', appGroupId: 'appGroupId', + recaptchaSiteKey: 'recaptchaSiteKey', ); expect(options.asMap, { @@ -147,6 +150,7 @@ void main() { 'iosBundleId': 'iosBundleId', 'iosClientId': 'iosClientId', 'appGroupId': 'appGroupId', + 'recaptchaSiteKey': '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 a3ae6f933db6..f649fa1a2f5e 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 @@ -334,6 +334,7 @@ class FirebaseCoreWeb extends FirebasePlatform { // At this point, there is no default app so we need to create it with // the users options. + // TODO(recaptchaSiteKey): Pass recaptchaSiteKey if supported. app = firebase.initializeApp( apiKey: options!.apiKey, authDomain: options.authDomain, @@ -355,6 +356,7 @@ class FirebaseCoreWeb extends FirebasePlatform { ); try { + // TODO(recaptchaSiteKey): Pass recaptchaSiteKey if supported. app = firebase.initializeApp( name: name, apiKey: options!.apiKey, From ebe835f660f743ba4187274b221722e35a48027b Mon Sep 17 00:00:00 2001 From: Cynthia J Date: Mon, 1 Jun 2026 13:35:15 -0700 Subject: [PATCH 2/4] Add Recaptcha Site Key to FirebaseOptions --- .../core/FlutterFirebaseCorePlugin.java | 3 ++ .../core/GeneratedAndroidFirebaseCore.java | 40 ++++++++++++++----- .../firebase_core/FLTFirebaseCorePlugin.m | 3 ++ .../include/firebase_core/messages.g.h | 4 +- .../Sources/firebase_core/messages.g.m | 10 ++++- .../firebase_core/windows/messages.g.cpp | 36 +++++++++++++++-- .../firebase_core/windows/messages.g.h | 16 ++++---- .../lib/src/firebase_options.dart | 10 ++++- .../lib/src/pigeon/messages.pigeon.dart | 8 +++- .../pigeons/messages.dart | 3 ++ .../test/firebase_options_test.dart | 4 ++ .../lib/src/firebase_core_web.dart | 2 + 12 files changed, 110 insertions(+), 29 deletions(-) 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 a1fed94439e3..fcdeb2a7f5ac 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,6 +63,7 @@ private GeneratedAndroidFirebaseCore.CoreFirebaseOptions firebaseOptionsToMap( firebaseOptions.setDatabaseURL(options.getDatabaseUrl()); firebaseOptions.setStorageBucket(options.getStorageBucket()); firebaseOptions.setTrackingId(options.getGaTrackingId()); + // TODO(recaptchaSiteKey): Map recaptchaSiteKey if stored. return firebaseOptions.build(); } @@ -165,6 +166,8 @@ public void initializeApp( customAuthDomain.put(appName, initializeAppRequest.getAuthDomain()); } + // TODO(recaptchaSiteKey): Store or use recaptchaSiteKey if needed. + FirebaseApp firebaseApp = FirebaseApp.initializeApp(applicationContext, options, appName); taskCompletionSource.setResult(Tasks.await(firebaseAppToMap(firebaseApp))); 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 b0a698faf51c..13a93f80d5da 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 @@ -377,6 +377,16 @@ 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() {} @@ -402,7 +412,8 @@ && pigeonDeepEquals(deepLinkURLScheme, that.deepLinkURLScheme) && pigeonDeepEquals(androidClientId, that.androidClientId) && pigeonDeepEquals(iosClientId, that.iosClientId) && pigeonDeepEquals(iosBundleId, that.iosBundleId) - && pigeonDeepEquals(appGroupId, that.appGroupId); + && pigeonDeepEquals(appGroupId, that.appGroupId) + && pigeonDeepEquals(recaptchaSiteKey, that.recaptchaSiteKey); } @Override @@ -423,7 +434,8 @@ public int hashCode() { androidClientId, iosClientId, iosBundleId, - appGroupId + appGroupId, + recaptchaSiteKey }; return pigeonDeepHashCode(fields); } @@ -542,6 +554,14 @@ 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); @@ -558,13 +578,14 @@ public static final class Builder { pigeonReturn.setIosClientId(iosClientId); pigeonReturn.setIosBundleId(iosBundleId); pigeonReturn.setAppGroupId(appGroupId); + pigeonReturn.setRecaptchaSiteKey(recaptchaSiteKey); return pigeonReturn; } } @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(14); + public ArrayList toList() { + ArrayList toListResult = new ArrayList<>(15); toListResult.add(apiKey); toListResult.add(appId); toListResult.add(messagingSenderId); @@ -579,6 +600,7 @@ ArrayList toList() { toListResult.add(iosClientId); toListResult.add(iosBundleId); toListResult.add(appGroupId); + toListResult.add(recaptchaSiteKey); return toListResult; } @@ -612,6 +634,8 @@ 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; } } @@ -740,7 +764,7 @@ public static final class Builder { } @NonNull - ArrayList toList() { + public ArrayList toList() { ArrayList toListResult = new ArrayList<>(4); toListResult.add(name); toListResult.add(options); @@ -802,7 +826,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. */ @@ -811,7 +834,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. */ @@ -820,7 +842,6 @@ 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 { @@ -837,7 +858,6 @@ void initializeApp( static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } - /** * Sets up an instance of `FirebaseCoreHostApi` to handle messages through the * `binaryMessenger`. @@ -946,7 +966,6 @@ public void error(Throwable error) { } } } - /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface FirebaseAppHostApi { @@ -962,7 +981,6 @@ void setAutomaticResourceManagementEnabled( static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } - /** * Sets up an instance of `FirebaseAppHostApi` to handle messages through the `binaryMessenger`. */ 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 23b3f7b9433b..b68d963b08c7 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,6 +93,7 @@ - (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]; + // TODO(recaptchaSiteKey): Map recaptchaSiteKey if stored. return pigeonOptions; } @@ -178,6 +179,8 @@ - (void)initializeAppAppName:(nonnull NSString *)appName options.appGroupID = initializeAppRequest.appGroupId; } + // TODO(recaptchaSiteKey): Store or use recaptchaSiteKey if needed. + if (initializeAppRequest.authDomain != nil) { customAuthDomains[appNameIos] = initializeAppRequest.authDomain; } 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 913fdbbd3e43..561383cc4135 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 @@ -32,7 +32,8 @@ NS_ASSUME_NONNULL_BEGIN androidClientId:(nullable NSString *)androidClientId iosClientId:(nullable NSString *)iosClientId iosBundleId:(nullable NSString *)iosBundleId - appGroupId:(nullable NSString *)appGroupId; + appGroupId:(nullable NSString *)appGroupId + recaptchaSiteKey:(nullable NSString *)recaptchaSiteKey; @property(nonatomic, copy) NSString *apiKey; @property(nonatomic, copy) NSString *appId; @property(nonatomic, copy) NSString *messagingSenderId; @@ -47,6 +48,7 @@ NS_ASSUME_NONNULL_BEGIN @property(nonatomic, copy, nullable) NSString *iosClientId; @property(nonatomic, copy, nullable) NSString *iosBundleId; @property(nonatomic, copy, nullable) NSString *appGroupId; +@property(nonatomic, copy, nullable) NSString *recaptchaSiteKey; @end @interface CoreInitializeResponse : NSObject 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 b1a0a1e69e45..449944316866 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 @@ -143,7 +143,8 @@ + (instancetype)makeWithApiKey:(NSString *)apiKey androidClientId:(nullable NSString *)androidClientId iosClientId:(nullable NSString *)iosClientId iosBundleId:(nullable NSString *)iosBundleId - appGroupId:(nullable NSString *)appGroupId { + appGroupId:(nullable NSString *)appGroupId + recaptchaSiteKey:(nullable NSString *)recaptchaSiteKey { CoreFirebaseOptions *pigeonResult = [[CoreFirebaseOptions alloc] init]; pigeonResult.apiKey = apiKey; pigeonResult.appId = appId; @@ -159,6 +160,7 @@ + (instancetype)makeWithApiKey:(NSString *)apiKey pigeonResult.iosClientId = iosClientId; pigeonResult.iosBundleId = iosBundleId; pigeonResult.appGroupId = appGroupId; + pigeonResult.recaptchaSiteKey = recaptchaSiteKey; return pigeonResult; } + (CoreFirebaseOptions *)fromList:(NSArray *)list { @@ -177,6 +179,7 @@ + (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 { @@ -198,6 +201,7 @@ + (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 { @@ -221,7 +225,8 @@ - (BOOL)isEqual:(id)object { FLTPigeonDeepEquals(self.androidClientId, other.androidClientId) && FLTPigeonDeepEquals(self.iosClientId, other.iosClientId) && FLTPigeonDeepEquals(self.iosBundleId, other.iosBundleId) && - FLTPigeonDeepEquals(self.appGroupId, other.appGroupId); + FLTPigeonDeepEquals(self.appGroupId, other.appGroupId) && + FLTPigeonDeepEquals(self.recaptchaSiteKey, other.recaptchaSiteKey); } - (NSUInteger)hash { @@ -240,6 +245,7 @@ - (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 diff --git a/packages/firebase_core/firebase_core/windows/messages.g.cpp b/packages/firebase_core/firebase_core/windows/messages.g.cpp index 42e8046a21e1..4bfc5dcbf9c4 100644 --- a/packages/firebase_core/firebase_core/windows/messages.g.cpp +++ b/packages/firebase_core/firebase_core/windows/messages.g.cpp @@ -257,7 +257,8 @@ CoreFirebaseOptions::CoreFirebaseOptions( 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* 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), @@ -287,7 +288,10 @@ CoreFirebaseOptions::CoreFirebaseOptions( 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) {} + : 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_; } @@ -453,9 +457,23 @@ 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(14); + list.reserve(15); list.push_back(EncodableValue(api_key_)); list.push_back(EncodableValue(app_id_)); list.push_back(EncodableValue(messaging_sender_id_)); @@ -481,6 +499,8 @@ EncodableList CoreFirebaseOptions::ToEncodableList() const { : EncodableValue()); list.push_back(app_group_id_ ? EncodableValue(*app_group_id_) : EncodableValue()); + list.push_back(recaptcha_site_key_ ? EncodableValue(*recaptcha_site_key_) + : EncodableValue()); return list; } @@ -531,6 +551,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; } @@ -551,7 +576,9 @@ bool CoreFirebaseOptions::operator==(const CoreFirebaseOptions& other) const { 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(app_group_id_, other.app_group_id_) && + PigeonInternalDeepEquals(recaptcha_site_key_, + other.recaptcha_site_key_); } bool CoreFirebaseOptions::operator!=(const CoreFirebaseOptions& other) const { @@ -574,6 +601,7 @@ 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; } diff --git a/packages/firebase_core/firebase_core/windows/messages.g.h b/packages/firebase_core/firebase_core/windows/messages.g.h index bce0a6a81f24..30f08627d12a 100644 --- a/packages/firebase_core/firebase_core/windows/messages.g.h +++ b/packages/firebase_core/firebase_core/windows/messages.g.h @@ -76,7 +76,8 @@ class CoreFirebaseOptions { 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* ios_bundle_id, const std::string* app_group_id, + const std::string* recaptcha_site_key); const std::string& api_key() const; void set_api_key(std::string_view value_arg); @@ -130,6 +131,10 @@ 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 @@ -139,12 +144,8 @@ class CoreFirebaseOptions { private: static CoreFirebaseOptions FromEncodableList( const ::flutter::EncodableList& list); - - public: public: ::flutter::EncodableList ToEncodableList() const; - - private: private: friend class CoreInitializeResponse; friend class FirebaseCoreHostApi; @@ -164,6 +165,7 @@ 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. @@ -208,12 +210,8 @@ class CoreInitializeResponse { private: static CoreInitializeResponse FromEncodableList( const ::flutter::EncodableList& list); - - public: public: ::flutter::EncodableList ToEncodableList() const; - - private: private: friend class FirebaseCoreHostApi; friend class FirebaseAppHostApi; 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..dbc740a71ffe 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,6 +50,7 @@ class FirebaseOptions { this.iosClientId, this.iosBundleId, this.appGroupId, + this.recaptchaSiteKey, }); /// Named constructor to create [FirebaseOptions] from a the response of Pigeon channel. @@ -71,7 +72,8 @@ class FirebaseOptions { androidClientId = options.androidClientId, iosClientId = options.iosClientId, iosBundleId = options.iosBundleId, - appGroupId = options.appGroupId; + appGroupId = options.appGroupId, + recaptchaSiteKey = options.recaptchaSiteKey; /// Returns a copy of this FirebaseOptions with the given fields replaced with /// the new values. @@ -90,6 +92,7 @@ class FirebaseOptions { String? iosClientId, String? iosBundleId, String? appGroupId, + String? recaptchaSiteKey, }) { return FirebaseOptions( apiKey: apiKey ?? this.apiKey, @@ -106,6 +109,7 @@ class FirebaseOptions { iosClientId: iosClientId ?? this.iosClientId, iosBundleId: iosBundleId ?? this.iosBundleId, appGroupId: appGroupId ?? this.appGroupId, + recaptchaSiteKey: recaptchaSiteKey ?? this.recaptchaSiteKey, ); } @@ -174,6 +178,9 @@ 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 { @@ -191,6 +198,7 @@ class FirebaseOptions { 'iosClientId': iosClientId, 'iosBundleId': iosBundleId, 'appGroupId': appGroupId, + 'recaptchaSiteKey': recaptchaSiteKey, }; } 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 6d4123a1f1cb..9bb893bb3aba 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 @@ -126,6 +126,7 @@ class CoreFirebaseOptions { this.iosClientId, this.iosBundleId, this.appGroupId, + this.recaptchaSiteKey, }); String apiKey; @@ -156,6 +157,8 @@ class CoreFirebaseOptions { String? appGroupId; + String? recaptchaSiteKey; + List _toList() { return [ apiKey, @@ -172,6 +175,7 @@ class CoreFirebaseOptions { iosClientId, iosBundleId, appGroupId, + recaptchaSiteKey, ]; } @@ -196,6 +200,7 @@ class CoreFirebaseOptions { iosClientId: result[11] as String?, iosBundleId: result[12] as String?, appGroupId: result[13] as String?, + recaptchaSiteKey: result[14] as String?, ); } @@ -221,7 +226,8 @@ class CoreFirebaseOptions { _deepEquals(androidClientId, other.androidClientId) && _deepEquals(iosClientId, other.iosClientId) && _deepEquals(iosBundleId, other.iosBundleId) && - _deepEquals(appGroupId, other.appGroupId); + _deepEquals(appGroupId, other.appGroupId) && + _deepEquals(recaptchaSiteKey, other.recaptchaSiteKey); } @override 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 a2286f54f1a9..a42278d0f4e7 100644 --- a/packages/firebase_core/firebase_core_platform_interface/pigeons/messages.dart +++ b/packages/firebase_core/firebase_core_platform_interface/pigeons/messages.dart @@ -44,6 +44,7 @@ class CoreFirebaseOptions { required this.databaseURL, required this.storageBucket, required this.trackingId, + required this.recaptchaSiteKey, }); final String apiKey; @@ -73,6 +74,8 @@ 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 8b84f78e9525..91f66e2a03c0 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 @@ -91,6 +91,7 @@ void main() { iosClientId: 'newIosClientId', iosBundleId: 'newIosBundleId', appGroupId: 'newAppGroupId', + recaptchaSiteKey: 'newRecaptchaSiteKey', ); expect( @@ -110,6 +111,7 @@ void main() { iosClientId: 'newIosClientId', iosBundleId: 'newIosBundleId', appGroupId: 'newAppGroupId', + recaptchaSiteKey: 'newRecaptchaSiteKey', ), ); }); @@ -130,6 +132,7 @@ void main() { iosBundleId: 'iosBundleId', iosClientId: 'iosClientId', appGroupId: 'appGroupId', + recaptchaSiteKey: 'recaptchaSiteKey', ); expect(options.asMap, { @@ -147,6 +150,7 @@ void main() { 'iosBundleId': 'iosBundleId', 'iosClientId': 'iosClientId', 'appGroupId': 'appGroupId', + 'recaptchaSiteKey': '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 a3ae6f933db6..f649fa1a2f5e 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 @@ -334,6 +334,7 @@ class FirebaseCoreWeb extends FirebasePlatform { // At this point, there is no default app so we need to create it with // the users options. + // TODO(recaptchaSiteKey): Pass recaptchaSiteKey if supported. app = firebase.initializeApp( apiKey: options!.apiKey, authDomain: options.authDomain, @@ -355,6 +356,7 @@ class FirebaseCoreWeb extends FirebasePlatform { ); try { + // TODO(recaptchaSiteKey): Pass recaptchaSiteKey if supported. app = firebase.initializeApp( name: name, apiKey: options!.apiKey, From f9a527e80e8441d8353fabfdb01971fd212aa630 Mon Sep 17 00:00:00 2001 From: Cynthia J Date: Mon, 1 Jun 2026 16:26:02 -0700 Subject: [PATCH 3/4] chore: regenerate and format pigeon files to resolve merge state --- .../core/GeneratedAndroidFirebaseCore.java | 113 ++- .../include/firebase_core/messages.g.h | 46 +- .../Sources/firebase_core/messages.g.m | 176 +++-- .../firebase_core/windows/messages.g.cpp | 701 ++++++++++-------- .../firebase_core/windows/messages.g.h | 126 ++-- .../lib/src/pigeon/messages.pigeon.dart | 141 ++-- .../lib/src/pigeon/test_api.dart | 140 ++-- 7 files changed, 865 insertions(+), 578 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 5fa9e681fc6c..13a93f80d5da 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; } @@ -386,8 +392,12 @@ public void setRecaptchaSiteKey(@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) @@ -686,15 +696,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); } @@ -797,7 +818,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. */ @@ -825,7 +845,10 @@ public interface VoidResult { /** 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); @@ -842,12 +865,19 @@ public interface FirebaseCoreHostApi { 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) -> { @@ -877,7 +907,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) -> { @@ -904,7 +937,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) -> { @@ -933,9 +969,11 @@ 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); @@ -949,12 +987,19 @@ public interface FirebaseAppHostApi { 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) -> { @@ -984,7 +1029,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) -> { @@ -1014,7 +1062,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 d12fc667e8d7..561383cc4135 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 @@ -55,37 +55,51 @@ NS_ASSUME_NONNULL_BEGIN /// `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 8ed9587bedfd..449944316866 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; @@ -251,10 +252,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; @@ -288,7 +289,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 { @@ -347,47 +352,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)); }]; }]; @@ -396,15 +422,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)); }]; }]; @@ -413,66 +446,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 eb260c22c912..4bfc5dcbf9c4 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,15 +241,14 @@ 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, @@ -283,24 +293,18 @@ CoreFirebaseOptions::CoreFirebaseOptions( ? std::optional(*recaptcha_site_key) : std::nullopt) {} -const std::string& CoreFirebaseOptions::api_key() const { - return api_key_; -} +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_; } @@ -309,7 +313,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_; } @@ -318,130 +321,136 @@ 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) { @@ -495,12 +504,11 @@ EncodableList CoreFirebaseOptions::ToEncodableList() const { 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)); @@ -523,11 +531,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()) { @@ -595,53 +605,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 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 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_; } @@ -650,56 +663,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); } @@ -707,7 +735,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; } @@ -716,36 +745,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; } } @@ -754,96 +789,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); } @@ -851,133 +921,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); } @@ -985,19 +1082,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 f9851744669e..30f08627d12a 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,17 +59,14 @@ 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( @@ -140,8 +137,10 @@ 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); @@ -169,28 +168,26 @@ class CoreFirebaseOptions { 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); @@ -206,8 +203,10 @@ 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); @@ -223,8 +222,8 @@ class CoreInitializeResponse { ::flutter::EncodableMap plugin_constants_; }; - -class PigeonInternalCodecSerializer : public ::flutter::StandardCodecSerializer { +class PigeonInternalCodecSerializer + : public ::flutter::StandardCodecSerializer { public: PigeonInternalCodecSerializer(); inline static PigeonInternalCodecSerializer& GetInstance() { @@ -232,73 +231,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 6fdf447205c2..9bb893bb3aba 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, @@ -127,7 +127,6 @@ class CoreFirebaseOptions { this.iosBundleId, this.appGroupId, this.recaptchaSiteKey, - this.recaptchaSiteKey, }); String apiKey; @@ -181,7 +180,8 @@ class CoreFirebaseOptions { } Object encode() { - return _toList(); } + return _toList(); + } static CoreFirebaseOptions decode(Object result) { result as List; @@ -261,7 +261,8 @@ class CoreInitializeResponse { } Object encode() { - return _toList(); } + return _toList(); + } static CoreInitializeResponse decode(Object result) { result as List; @@ -269,7 +270,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(), ); } @@ -282,7 +284,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 @@ -290,7 +296,6 @@ class CoreInitializeResponse { int get hashCode => _deepHash([runtimeType, ..._toList()]); } - class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -298,10 +303,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 { @@ -326,36 +331,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, @@ -365,16 +375,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, @@ -384,11 +395,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; } } @@ -397,66 +407,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 dc8d1b057441a81f8181a7317395637b63f53861 Mon Sep 17 00:00:00 2001 From: Cynthia J Date: Mon, 1 Jun 2026 17:20:08 -0700 Subject: [PATCH 4/4] chore: format pigeon generated files --- .../plugins/firebase/core/GeneratedAndroidFirebaseCore.java | 6 ++++++ packages/firebase_core/firebase_core/windows/messages.g.h | 4 ++++ 2 files changed, 10 insertions(+) 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 13a93f80d5da..fdae685adbd8 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 @@ -826,6 +826,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. */ @@ -834,6 +835,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. */ @@ -842,6 +844,7 @@ 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 { @@ -858,6 +861,7 @@ void initializeApp( static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } + /** * Sets up an instance of `FirebaseCoreHostApi` to handle messages through the * `binaryMessenger`. @@ -966,6 +970,7 @@ public void error(Throwable error) { } } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface FirebaseAppHostApi { @@ -981,6 +986,7 @@ void setAutomaticResourceManagementEnabled( static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } + /** * Sets up an instance of `FirebaseAppHostApi` to handle messages through the `binaryMessenger`. */ diff --git a/packages/firebase_core/firebase_core/windows/messages.g.h b/packages/firebase_core/firebase_core/windows/messages.g.h index 30f08627d12a..a55996f5b067 100644 --- a/packages/firebase_core/firebase_core/windows/messages.g.h +++ b/packages/firebase_core/firebase_core/windows/messages.g.h @@ -144,8 +144,10 @@ class CoreFirebaseOptions { private: static CoreFirebaseOptions FromEncodableList( const ::flutter::EncodableList& list); + public: ::flutter::EncodableList ToEncodableList() const; + private: friend class CoreInitializeResponse; friend class FirebaseCoreHostApi; @@ -210,8 +212,10 @@ class CoreInitializeResponse { private: static CoreInitializeResponse FromEncodableList( const ::flutter::EncodableList& list); + public: ::flutter::EncodableList ToEncodableList() const; + private: friend class FirebaseCoreHostApi; friend class FirebaseAppHostApi;