Skip to content

Commit 8c92718

Browse files
committed
feat(installations): Add support for pigeons
1 parent 44d99a9 commit 8c92718

File tree

11 files changed

+2141
-15
lines changed

11 files changed

+2141
-15
lines changed

packages/firebase_app_installations/firebase_app_installations/android/src/main/java/io/flutter/plugins/firebase/installations/GeneratedAndroidFirebaseAppInstallations.java

Lines changed: 553 additions & 0 deletions
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Copyright 2025, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
// Autogenerated from Pigeon (v25.3.2), do not edit directly.
5+
// See also: https://pub.dev/packages/pigeon
6+
7+
#import <Foundation/Foundation.h>
8+
9+
@protocol FlutterBinaryMessenger;
10+
@protocol FlutterMessageCodec;
11+
@class FlutterError;
12+
@class FlutterStandardTypedData;
13+
14+
NS_ASSUME_NONNULL_BEGIN
15+
16+
@class AppInstallationsPigeonSettings;
17+
@class AppInstallationsPigeonFirebaseApp;
18+
19+
@interface AppInstallationsPigeonSettings : NSObject
20+
/// `init` unavailable to enforce nonnull fields, see the `make` class method.
21+
- (instancetype)init NS_UNAVAILABLE;
22+
+ (instancetype)makeWithPersistenceEnabled:(BOOL )persistenceEnabled
23+
forceRefreshOnSignIn:(BOOL )forceRefreshOnSignIn
24+
forceRefreshOnTokenChange:(BOOL )forceRefreshOnTokenChange
25+
forceRefreshOnAppUpdate:(BOOL )forceRefreshOnAppUpdate;
26+
@property(nonatomic, assign) BOOL persistenceEnabled;
27+
@property(nonatomic, assign) BOOL forceRefreshOnSignIn;
28+
@property(nonatomic, assign) BOOL forceRefreshOnTokenChange;
29+
@property(nonatomic, assign) BOOL forceRefreshOnAppUpdate;
30+
@end
31+
32+
@interface AppInstallationsPigeonFirebaseApp : NSObject
33+
/// `init` unavailable to enforce nonnull fields, see the `make` class method.
34+
- (instancetype)init NS_UNAVAILABLE;
35+
+ (instancetype)makeWithAppName:(NSString *)appName;
36+
@property(nonatomic, copy) NSString * appName;
37+
@end
38+
39+
/// The codec used by all APIs.
40+
NSObject<FlutterMessageCodec> *nullGetFirebaseAppInstallationsMessagesCodec(void);
41+
42+
@protocol FirebaseAppInstallationsHostApi
43+
- (void)initializeAppApp:(AppInstallationsPigeonFirebaseApp *)app settings:(AppInstallationsPigeonSettings *)settings completion:(void (^)(FlutterError *_Nullable))completion;
44+
- (void)deleteApp:(AppInstallationsPigeonFirebaseApp *)app completion:(void (^)(FlutterError *_Nullable))completion;
45+
- (void)getIdApp:(AppInstallationsPigeonFirebaseApp *)app completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion;
46+
- (void)getTokenApp:(AppInstallationsPigeonFirebaseApp *)app forceRefresh:(BOOL)forceRefresh completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion;
47+
- (void)onIdChangeApp:(AppInstallationsPigeonFirebaseApp *)app newId:(NSString *)newId completion:(void (^)(FlutterError *_Nullable))completion;
48+
@end
49+
50+
extern void SetUpFirebaseAppInstallationsHostApi(id<FlutterBinaryMessenger> binaryMessenger, NSObject<FirebaseAppInstallationsHostApi> *_Nullable api);
51+
52+
extern void SetUpFirebaseAppInstallationsHostApiWithSuffix(id<FlutterBinaryMessenger> binaryMessenger, NSObject<FirebaseAppInstallationsHostApi> *_Nullable api, NSString *messageChannelSuffix);
53+
54+
55+
@interface FirebaseAppInstallationsFlutterApi : NSObject
56+
- (instancetype)initWithBinaryMessenger:(id<FlutterBinaryMessenger>)binaryMessenger;
57+
- (instancetype)initWithBinaryMessenger:(id<FlutterBinaryMessenger>)binaryMessenger messageChannelSuffix:(nullable NSString *)messageChannelSuffix;
58+
- (void)registerIdTokenListenerApp:(AppInstallationsPigeonFirebaseApp *)app completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion;
59+
@end
60+
61+
NS_ASSUME_NONNULL_END
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,298 @@
1+
// Copyright 2025, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
// Autogenerated from Pigeon (v25.3.2), do not edit directly.
5+
// See also: https://pub.dev/packages/pigeon
6+
7+
#import "firebase_app_installations_messages.g.h"
8+
9+
#if TARGET_OS_OSX
10+
#import <FlutterMacOS/FlutterMacOS.h>
11+
#else
12+
#import <Flutter/Flutter.h>
13+
#endif
14+
15+
#if !__has_feature(objc_arc)
16+
#error File requires ARC to be enabled.
17+
#endif
18+
19+
static NSArray<id> *wrapResult(id result, FlutterError *error) {
20+
if (error) {
21+
return @[
22+
error.code ?: [NSNull null], error.message ?: [NSNull null], error.details ?: [NSNull null]
23+
];
24+
}
25+
return @[ result ?: [NSNull null] ];
26+
}
27+
28+
static FlutterError *createConnectionError(NSString *channelName) {
29+
return [FlutterError errorWithCode:@"channel-error" message:[NSString stringWithFormat:@"%@/%@/%@", @"Unable to establish connection on channel: '", channelName, @"'."] details:@""];
30+
}
31+
32+
static id GetNullableObjectAtIndex(NSArray<id> *array, NSInteger key) {
33+
id result = array[key];
34+
return (result == [NSNull null]) ? nil : result;
35+
}
36+
37+
@interface AppInstallationsPigeonSettings ()
38+
+ (AppInstallationsPigeonSettings *)fromList:(NSArray<id> *)list;
39+
+ (nullable AppInstallationsPigeonSettings *)nullableFromList:(NSArray<id> *)list;
40+
- (NSArray<id> *)toList;
41+
@end
42+
43+
@interface AppInstallationsPigeonFirebaseApp ()
44+
+ (AppInstallationsPigeonFirebaseApp *)fromList:(NSArray<id> *)list;
45+
+ (nullable AppInstallationsPigeonFirebaseApp *)nullableFromList:(NSArray<id> *)list;
46+
- (NSArray<id> *)toList;
47+
@end
48+
49+
@implementation AppInstallationsPigeonSettings
50+
+ (instancetype)makeWithPersistenceEnabled:(BOOL )persistenceEnabled
51+
forceRefreshOnSignIn:(BOOL )forceRefreshOnSignIn
52+
forceRefreshOnTokenChange:(BOOL )forceRefreshOnTokenChange
53+
forceRefreshOnAppUpdate:(BOOL )forceRefreshOnAppUpdate {
54+
AppInstallationsPigeonSettings* pigeonResult = [[AppInstallationsPigeonSettings alloc] init];
55+
pigeonResult.persistenceEnabled = persistenceEnabled;
56+
pigeonResult.forceRefreshOnSignIn = forceRefreshOnSignIn;
57+
pigeonResult.forceRefreshOnTokenChange = forceRefreshOnTokenChange;
58+
pigeonResult.forceRefreshOnAppUpdate = forceRefreshOnAppUpdate;
59+
return pigeonResult;
60+
}
61+
+ (AppInstallationsPigeonSettings *)fromList:(NSArray<id> *)list {
62+
AppInstallationsPigeonSettings *pigeonResult = [[AppInstallationsPigeonSettings alloc] init];
63+
pigeonResult.persistenceEnabled = [GetNullableObjectAtIndex(list, 0) boolValue];
64+
pigeonResult.forceRefreshOnSignIn = [GetNullableObjectAtIndex(list, 1) boolValue];
65+
pigeonResult.forceRefreshOnTokenChange = [GetNullableObjectAtIndex(list, 2) boolValue];
66+
pigeonResult.forceRefreshOnAppUpdate = [GetNullableObjectAtIndex(list, 3) boolValue];
67+
return pigeonResult;
68+
}
69+
+ (nullable AppInstallationsPigeonSettings *)nullableFromList:(NSArray<id> *)list {
70+
return (list) ? [AppInstallationsPigeonSettings fromList:list] : nil;
71+
}
72+
- (NSArray<id> *)toList {
73+
return @[
74+
@(self.persistenceEnabled),
75+
@(self.forceRefreshOnSignIn),
76+
@(self.forceRefreshOnTokenChange),
77+
@(self.forceRefreshOnAppUpdate),
78+
];
79+
}
80+
@end
81+
82+
@implementation AppInstallationsPigeonFirebaseApp
83+
+ (instancetype)makeWithAppName:(NSString *)appName {
84+
AppInstallationsPigeonFirebaseApp* pigeonResult = [[AppInstallationsPigeonFirebaseApp alloc] init];
85+
pigeonResult.appName = appName;
86+
return pigeonResult;
87+
}
88+
+ (AppInstallationsPigeonFirebaseApp *)fromList:(NSArray<id> *)list {
89+
AppInstallationsPigeonFirebaseApp *pigeonResult = [[AppInstallationsPigeonFirebaseApp alloc] init];
90+
pigeonResult.appName = GetNullableObjectAtIndex(list, 0);
91+
return pigeonResult;
92+
}
93+
+ (nullable AppInstallationsPigeonFirebaseApp *)nullableFromList:(NSArray<id> *)list {
94+
return (list) ? [AppInstallationsPigeonFirebaseApp fromList:list] : nil;
95+
}
96+
- (NSArray<id> *)toList {
97+
return @[
98+
self.appName ?: [NSNull null],
99+
];
100+
}
101+
@end
102+
103+
@interface nullFirebaseAppInstallationsMessagesPigeonCodecReader : FlutterStandardReader
104+
@end
105+
@implementation nullFirebaseAppInstallationsMessagesPigeonCodecReader
106+
- (nullable id)readValueOfType:(UInt8)type {
107+
switch (type) {
108+
case 129:
109+
return [AppInstallationsPigeonSettings fromList:[self readValue]];
110+
case 130:
111+
return [AppInstallationsPigeonFirebaseApp fromList:[self readValue]];
112+
default:
113+
return [super readValueOfType:type];
114+
}
115+
}
116+
@end
117+
118+
@interface nullFirebaseAppInstallationsMessagesPigeonCodecWriter : FlutterStandardWriter
119+
@end
120+
@implementation nullFirebaseAppInstallationsMessagesPigeonCodecWriter
121+
- (void)writeValue:(id)value {
122+
if ([value isKindOfClass:[AppInstallationsPigeonSettings class]]) {
123+
[self writeByte:129];
124+
[self writeValue:[value toList]];
125+
} else if ([value isKindOfClass:[AppInstallationsPigeonFirebaseApp class]]) {
126+
[self writeByte:130];
127+
[self writeValue:[value toList]];
128+
} else {
129+
[super writeValue:value];
130+
}
131+
}
132+
@end
133+
134+
@interface nullFirebaseAppInstallationsMessagesPigeonCodecReaderWriter : FlutterStandardReaderWriter
135+
@end
136+
@implementation nullFirebaseAppInstallationsMessagesPigeonCodecReaderWriter
137+
- (FlutterStandardWriter *)writerWithData:(NSMutableData *)data {
138+
return [[nullFirebaseAppInstallationsMessagesPigeonCodecWriter alloc] initWithData:data];
139+
}
140+
- (FlutterStandardReader *)readerWithData:(NSData *)data {
141+
return [[nullFirebaseAppInstallationsMessagesPigeonCodecReader alloc] initWithData:data];
142+
}
143+
@end
144+
145+
NSObject<FlutterMessageCodec> *nullGetFirebaseAppInstallationsMessagesCodec(void) {
146+
static FlutterStandardMessageCodec *sSharedObject = nil;
147+
static dispatch_once_t sPred = 0;
148+
dispatch_once(&sPred, ^{
149+
nullFirebaseAppInstallationsMessagesPigeonCodecReaderWriter *readerWriter = [[nullFirebaseAppInstallationsMessagesPigeonCodecReaderWriter alloc] init];
150+
sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter];
151+
});
152+
return sSharedObject;
153+
}
154+
void SetUpFirebaseAppInstallationsHostApi(id<FlutterBinaryMessenger> binaryMessenger, NSObject<FirebaseAppInstallationsHostApi> *api) {
155+
SetUpFirebaseAppInstallationsHostApiWithSuffix(binaryMessenger, api, @"");
156+
}
157+
158+
void SetUpFirebaseAppInstallationsHostApiWithSuffix(id<FlutterBinaryMessenger> binaryMessenger, NSObject<FirebaseAppInstallationsHostApi> *api, NSString *messageChannelSuffix) {
159+
messageChannelSuffix = messageChannelSuffix.length > 0 ? [NSString stringWithFormat: @".%@", messageChannelSuffix] : @"";
160+
{
161+
FlutterBasicMessageChannel *channel =
162+
[[FlutterBasicMessageChannel alloc]
163+
initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.firebase_app_installations_platform_interface.FirebaseAppInstallationsHostApi.initializeApp", messageChannelSuffix]
164+
binaryMessenger:binaryMessenger
165+
codec:nullGetFirebaseAppInstallationsMessagesCodec()];
166+
if (api) {
167+
NSCAssert([api respondsToSelector:@selector(initializeAppApp:settings:completion:)], @"FirebaseAppInstallationsHostApi api (%@) doesn't respond to @selector(initializeAppApp:settings:completion:)", api);
168+
[channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
169+
NSArray<id> *args = message;
170+
AppInstallationsPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0);
171+
AppInstallationsPigeonSettings *arg_settings = GetNullableObjectAtIndex(args, 1);
172+
[api initializeAppApp:arg_app settings:arg_settings completion:^(FlutterError *_Nullable error) {
173+
callback(wrapResult(nil, error));
174+
}];
175+
}];
176+
} else {
177+
[channel setMessageHandler:nil];
178+
}
179+
}
180+
{
181+
FlutterBasicMessageChannel *channel =
182+
[[FlutterBasicMessageChannel alloc]
183+
initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.firebase_app_installations_platform_interface.FirebaseAppInstallationsHostApi.delete", messageChannelSuffix]
184+
binaryMessenger:binaryMessenger
185+
codec:nullGetFirebaseAppInstallationsMessagesCodec()];
186+
if (api) {
187+
NSCAssert([api respondsToSelector:@selector(deleteApp:completion:)], @"FirebaseAppInstallationsHostApi api (%@) doesn't respond to @selector(deleteApp:completion:)", api);
188+
[channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
189+
NSArray<id> *args = message;
190+
AppInstallationsPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0);
191+
[api deleteApp:arg_app completion:^(FlutterError *_Nullable error) {
192+
callback(wrapResult(nil, error));
193+
}];
194+
}];
195+
} else {
196+
[channel setMessageHandler:nil];
197+
}
198+
}
199+
{
200+
FlutterBasicMessageChannel *channel =
201+
[[FlutterBasicMessageChannel alloc]
202+
initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.firebase_app_installations_platform_interface.FirebaseAppInstallationsHostApi.getId", messageChannelSuffix]
203+
binaryMessenger:binaryMessenger
204+
codec:nullGetFirebaseAppInstallationsMessagesCodec()];
205+
if (api) {
206+
NSCAssert([api respondsToSelector:@selector(getIdApp:completion:)], @"FirebaseAppInstallationsHostApi api (%@) doesn't respond to @selector(getIdApp:completion:)", api);
207+
[channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
208+
NSArray<id> *args = message;
209+
AppInstallationsPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0);
210+
[api getIdApp:arg_app completion:^(NSString *_Nullable output, FlutterError *_Nullable error) {
211+
callback(wrapResult(output, error));
212+
}];
213+
}];
214+
} else {
215+
[channel setMessageHandler:nil];
216+
}
217+
}
218+
{
219+
FlutterBasicMessageChannel *channel =
220+
[[FlutterBasicMessageChannel alloc]
221+
initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.firebase_app_installations_platform_interface.FirebaseAppInstallationsHostApi.getToken", messageChannelSuffix]
222+
binaryMessenger:binaryMessenger
223+
codec:nullGetFirebaseAppInstallationsMessagesCodec()];
224+
if (api) {
225+
NSCAssert([api respondsToSelector:@selector(getTokenApp:forceRefresh:completion:)], @"FirebaseAppInstallationsHostApi api (%@) doesn't respond to @selector(getTokenApp:forceRefresh:completion:)", api);
226+
[channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
227+
NSArray<id> *args = message;
228+
AppInstallationsPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0);
229+
BOOL arg_forceRefresh = [GetNullableObjectAtIndex(args, 1) boolValue];
230+
[api getTokenApp:arg_app forceRefresh:arg_forceRefresh completion:^(NSString *_Nullable output, FlutterError *_Nullable error) {
231+
callback(wrapResult(output, error));
232+
}];
233+
}];
234+
} else {
235+
[channel setMessageHandler:nil];
236+
}
237+
}
238+
{
239+
FlutterBasicMessageChannel *channel =
240+
[[FlutterBasicMessageChannel alloc]
241+
initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.firebase_app_installations_platform_interface.FirebaseAppInstallationsHostApi.onIdChange", messageChannelSuffix]
242+
binaryMessenger:binaryMessenger
243+
codec:nullGetFirebaseAppInstallationsMessagesCodec()];
244+
if (api) {
245+
NSCAssert([api respondsToSelector:@selector(onIdChangeApp:newId:completion:)], @"FirebaseAppInstallationsHostApi api (%@) doesn't respond to @selector(onIdChangeApp:newId:completion:)", api);
246+
[channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
247+
NSArray<id> *args = message;
248+
AppInstallationsPigeonFirebaseApp *arg_app = GetNullableObjectAtIndex(args, 0);
249+
NSString *arg_newId = GetNullableObjectAtIndex(args, 1);
250+
[api onIdChangeApp:arg_app newId:arg_newId completion:^(FlutterError *_Nullable error) {
251+
callback(wrapResult(nil, error));
252+
}];
253+
}];
254+
} else {
255+
[channel setMessageHandler:nil];
256+
}
257+
}
258+
}
259+
@interface FirebaseAppInstallationsFlutterApi ()
260+
@property(nonatomic, strong) NSObject<FlutterBinaryMessenger> *binaryMessenger;
261+
@property(nonatomic, strong) NSString *messageChannelSuffix;
262+
@end
263+
264+
@implementation FirebaseAppInstallationsFlutterApi
265+
266+
- (instancetype)initWithBinaryMessenger:(NSObject<FlutterBinaryMessenger> *)binaryMessenger {
267+
return [self initWithBinaryMessenger:binaryMessenger messageChannelSuffix:@""];
268+
}
269+
- (instancetype)initWithBinaryMessenger:(NSObject<FlutterBinaryMessenger> *)binaryMessenger messageChannelSuffix:(nullable NSString*)messageChannelSuffix{
270+
self = [self init];
271+
if (self) {
272+
_binaryMessenger = binaryMessenger;
273+
_messageChannelSuffix = [messageChannelSuffix length] == 0 ? @"" : [NSString stringWithFormat: @".%@", messageChannelSuffix];
274+
}
275+
return self;
276+
}
277+
- (void)registerIdTokenListenerApp:(AppInstallationsPigeonFirebaseApp *)arg_app completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion {
278+
NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.firebase_app_installations_platform_interface.FirebaseAppInstallationsFlutterApi.registerIdTokenListener", _messageChannelSuffix];
279+
FlutterBasicMessageChannel *channel =
280+
[FlutterBasicMessageChannel
281+
messageChannelWithName:channelName
282+
binaryMessenger:self.binaryMessenger
283+
codec:nullGetFirebaseAppInstallationsMessagesCodec()];
284+
[channel sendMessage:@[arg_app ?: [NSNull null]] reply:^(NSArray<id> *reply) {
285+
if (reply != nil) {
286+
if (reply.count > 1) {
287+
completion(nil, [FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]);
288+
} else {
289+
NSString *output = reply[0] == [NSNull null] ? nil : reply[0];
290+
completion(output, nil);
291+
}
292+
} else {
293+
completion(nil, createConnectionError(channelName));
294+
}
295+
}];
296+
}
297+
@end
298+

0 commit comments

Comments
 (0)