@@ -157,11 +157,42 @@ struct NotificationDataFromLaunch: Hashable {
157
157
}
158
158
}
159
159
160
+ /// Generated class from Pigeon that represents data sent in messages.
161
+ struct NotificationTapEvent : Hashable {
162
+ /// The raw payload that is attached to the notification,
163
+ /// holding the information required to carry out the navigation.
164
+ ///
165
+ /// See [notificationTapEvents].
166
+ var payload : [ AnyHashable ? : Any ? ]
167
+
168
+
169
+ // swift-format-ignore: AlwaysUseLowerCamelCase
170
+ static func fromList( _ pigeonVar_list: [ Any ? ] ) -> NotificationTapEvent ? {
171
+ let payload = pigeonVar_list [ 0 ] as! [ AnyHashable ? : Any ? ]
172
+
173
+ return NotificationTapEvent (
174
+ payload: payload
175
+ )
176
+ }
177
+ func toList( ) -> [ Any ? ] {
178
+ return [
179
+ payload
180
+ ]
181
+ }
182
+ static func == ( lhs: NotificationTapEvent , rhs: NotificationTapEvent ) -> Bool {
183
+ return deepEqualsNotifications ( lhs. toList ( ) , rhs. toList ( ) ) }
184
+ func hash( into hasher: inout Hasher ) {
185
+ deepHashNotifications ( value: toList ( ) , hasher: & hasher)
186
+ }
187
+ }
188
+
160
189
private class NotificationsPigeonCodecReader : FlutterStandardReader {
161
190
override func readValue( ofType type: UInt8 ) -> Any ? {
162
191
switch type {
163
192
case 129 :
164
193
return NotificationDataFromLaunch . fromList ( self . readValue ( ) as! [ Any ? ] )
194
+ case 130 :
195
+ return NotificationTapEvent . fromList ( self . readValue ( ) as! [ Any ? ] )
165
196
default :
166
197
return super. readValue ( ofType: type)
167
198
}
@@ -173,6 +204,9 @@ private class NotificationsPigeonCodecWriter: FlutterStandardWriter {
173
204
if let value = value as? NotificationDataFromLaunch {
174
205
super. writeByte ( 129 )
175
206
super. writeValue ( value. toList ( ) )
207
+ } else if let value = value as? NotificationTapEvent {
208
+ super. writeByte ( 130 )
209
+ super. writeValue ( value. toList ( ) )
176
210
} else {
177
211
super. writeValue ( value)
178
212
}
@@ -193,6 +227,8 @@ class NotificationsPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable
193
227
static let shared = NotificationsPigeonCodec ( readerWriter: NotificationsPigeonCodecReaderWriter ( ) )
194
228
}
195
229
230
+ var notificationsPigeonMethodCodec = FlutterStandardMethodCodec ( readerWriter: NotificationsPigeonCodecReaderWriter ( ) ) ;
231
+
196
232
/// Generated protocol from Pigeon that represents a handler of messages from Flutter.
197
233
protocol NotificationHostApi {
198
234
/// Retrieves notification data if the app was launched by tapping on a notification.
@@ -233,3 +269,67 @@ class NotificationHostApiSetup {
233
269
}
234
270
}
235
271
}
272
+
273
+ private class PigeonStreamHandler < ReturnType> : NSObject , FlutterStreamHandler {
274
+ private let wrapper : PigeonEventChannelWrapper < ReturnType >
275
+ private var pigeonSink : PigeonEventSink < ReturnType > ? = nil
276
+
277
+ init ( wrapper: PigeonEventChannelWrapper < ReturnType > ) {
278
+ self . wrapper = wrapper
279
+ }
280
+
281
+ func onListen( withArguments arguments: Any ? , eventSink events: @escaping FlutterEventSink )
282
+ -> FlutterError ?
283
+ {
284
+ pigeonSink = PigeonEventSink < ReturnType > ( events)
285
+ wrapper. onListen ( withArguments: arguments, sink: pigeonSink!)
286
+ return nil
287
+ }
288
+
289
+ func onCancel( withArguments arguments: Any ? ) -> FlutterError ? {
290
+ pigeonSink = nil
291
+ wrapper. onCancel ( withArguments: arguments)
292
+ return nil
293
+ }
294
+ }
295
+
296
+ class PigeonEventChannelWrapper < ReturnType> {
297
+ func onListen( withArguments arguments: Any ? , sink: PigeonEventSink < ReturnType > ) { }
298
+ func onCancel( withArguments arguments: Any ? ) { }
299
+ }
300
+
301
+ class PigeonEventSink < ReturnType> {
302
+ private let sink : FlutterEventSink
303
+
304
+ init ( _ sink: @escaping FlutterEventSink ) {
305
+ self . sink = sink
306
+ }
307
+
308
+ func success( _ value: ReturnType ) {
309
+ sink ( value)
310
+ }
311
+
312
+ func error( code: String , message: String ? , details: Any ? ) {
313
+ sink ( FlutterError ( code: code, message: message, details: details) )
314
+ }
315
+
316
+ func endOfStream( ) {
317
+ sink ( FlutterEndOfEventStream)
318
+ }
319
+
320
+ }
321
+
322
+ class NotificationTapEventsStreamHandler : PigeonEventChannelWrapper < NotificationTapEvent > {
323
+ static func register( with messenger: FlutterBinaryMessenger ,
324
+ instanceName: String = " " ,
325
+ streamHandler: NotificationTapEventsStreamHandler ) {
326
+ var channelName = " dev.flutter.pigeon.zulip.NotificationEventChannelApi.notificationTapEvents "
327
+ if !instanceName. isEmpty {
328
+ channelName += " . \( instanceName) "
329
+ }
330
+ let internalStreamHandler = PigeonStreamHandler < NotificationTapEvent > ( wrapper: streamHandler)
331
+ let channel = FlutterEventChannel ( name: channelName, binaryMessenger: messenger, codec: notificationsPigeonMethodCodec)
332
+ channel. setStreamHandler ( internalStreamHandler)
333
+ }
334
+ }
335
+
0 commit comments