@@ -88,11 +88,37 @@ struct NotificationDataFromLaunch {
88
88
}
89
89
}
90
90
91
+ /// Generated class from Pigeon that represents data sent in messages.
92
+ struct NotificationTapEvent {
93
+ /// The raw payload that is attached to the notification,
94
+ /// holding the information required to carry out the navigation.
95
+ ///
96
+ /// See [notificationTapEvents].
97
+ var payload : [ AnyHashable ? : Any ? ]
98
+
99
+
100
+ // swift-format-ignore: AlwaysUseLowerCamelCase
101
+ static func fromList( _ pigeonVar_list: [ Any ? ] ) -> NotificationTapEvent ? {
102
+ let payload = pigeonVar_list [ 0 ] as! [ AnyHashable ? : Any ? ]
103
+
104
+ return NotificationTapEvent (
105
+ payload: payload
106
+ )
107
+ }
108
+ func toList( ) -> [ Any ? ] {
109
+ return [
110
+ payload
111
+ ]
112
+ }
113
+ }
114
+
91
115
private class NotificationsPigeonCodecReader : FlutterStandardReader {
92
116
override func readValue( ofType type: UInt8 ) -> Any ? {
93
117
switch type {
94
118
case 129 :
95
119
return NotificationDataFromLaunch . fromList ( self . readValue ( ) as! [ Any ? ] )
120
+ case 130 :
121
+ return NotificationTapEvent . fromList ( self . readValue ( ) as! [ Any ? ] )
96
122
default :
97
123
return super. readValue ( ofType: type)
98
124
}
@@ -104,6 +130,9 @@ private class NotificationsPigeonCodecWriter: FlutterStandardWriter {
104
130
if let value = value as? NotificationDataFromLaunch {
105
131
super. writeByte ( 129 )
106
132
super. writeValue ( value. toList ( ) )
133
+ } else if let value = value as? NotificationTapEvent {
134
+ super. writeByte ( 130 )
135
+ super. writeValue ( value. toList ( ) )
107
136
} else {
108
137
super. writeValue ( value)
109
138
}
@@ -124,6 +153,8 @@ class NotificationsPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable
124
153
static let shared = NotificationsPigeonCodec ( readerWriter: NotificationsPigeonCodecReaderWriter ( ) )
125
154
}
126
155
156
+ var notificationsPigeonMethodCodec = FlutterStandardMethodCodec ( readerWriter: NotificationsPigeonCodecReaderWriter ( ) ) ;
157
+
127
158
/// Generated protocol from Pigeon that represents a handler of messages from Flutter.
128
159
protocol NotificationHostApi {
129
160
/// Retrieves notification data if the app was launched by tapping on a notification.
@@ -164,3 +195,67 @@ class NotificationHostApiSetup {
164
195
}
165
196
}
166
197
}
198
+
199
+ private class PigeonStreamHandler < ReturnType> : NSObject , FlutterStreamHandler {
200
+ private let wrapper : PigeonEventChannelWrapper < ReturnType >
201
+ private var pigeonSink : PigeonEventSink < ReturnType > ? = nil
202
+
203
+ init ( wrapper: PigeonEventChannelWrapper < ReturnType > ) {
204
+ self . wrapper = wrapper
205
+ }
206
+
207
+ func onListen( withArguments arguments: Any ? , eventSink events: @escaping FlutterEventSink )
208
+ -> FlutterError ?
209
+ {
210
+ pigeonSink = PigeonEventSink < ReturnType > ( events)
211
+ wrapper. onListen ( withArguments: arguments, sink: pigeonSink!)
212
+ return nil
213
+ }
214
+
215
+ func onCancel( withArguments arguments: Any ? ) -> FlutterError ? {
216
+ pigeonSink = nil
217
+ wrapper. onCancel ( withArguments: arguments)
218
+ return nil
219
+ }
220
+ }
221
+
222
+ class PigeonEventChannelWrapper < ReturnType> {
223
+ func onListen( withArguments arguments: Any ? , sink: PigeonEventSink < ReturnType > ) { }
224
+ func onCancel( withArguments arguments: Any ? ) { }
225
+ }
226
+
227
+ class PigeonEventSink < ReturnType> {
228
+ private let sink : FlutterEventSink
229
+
230
+ init ( _ sink: @escaping FlutterEventSink ) {
231
+ self . sink = sink
232
+ }
233
+
234
+ func success( _ value: ReturnType ) {
235
+ sink ( value)
236
+ }
237
+
238
+ func error( code: String , message: String ? , details: Any ? ) {
239
+ sink ( FlutterError ( code: code, message: message, details: details) )
240
+ }
241
+
242
+ func endOfStream( ) {
243
+ sink ( FlutterEndOfEventStream)
244
+ }
245
+
246
+ }
247
+
248
+ class NotificationTapEventsStreamHandler : PigeonEventChannelWrapper < NotificationTapEvent > {
249
+ static func register( with messenger: FlutterBinaryMessenger ,
250
+ instanceName: String = " " ,
251
+ streamHandler: NotificationTapEventsStreamHandler ) {
252
+ var channelName = " dev.flutter.pigeon.zulip.NotificationEventChannelApi.notificationTapEvents "
253
+ if !instanceName. isEmpty {
254
+ channelName += " . \( instanceName) "
255
+ }
256
+ let internalStreamHandler = PigeonStreamHandler < NotificationTapEvent > ( wrapper: streamHandler)
257
+ let channel = FlutterEventChannel ( name: channelName, binaryMessenger: messenger, codec: notificationsPigeonMethodCodec)
258
+ channel. setStreamHandler ( internalStreamHandler)
259
+ }
260
+ }
261
+
0 commit comments