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