@@ -107,6 +107,102 @@ data class InboxStyle (
107
107
)
108
108
}
109
109
}
110
+
111
+ /* *
112
+ * Corresponds to `androidx.core.app.Person`
113
+ *
114
+ * See: https://developer.android.com/reference/androidx/core/app/Person
115
+ *
116
+ * Generated class from Pigeon that represents data sent in messages.
117
+ */
118
+ data class Person (
119
+ val iconData : ByteArray? = null ,
120
+ val key : String ,
121
+ val name : String
122
+
123
+ ) {
124
+ companion object {
125
+ @Suppress(" LocalVariableName" )
126
+ fun fromList (__pigeon_list : List <Any ?>): Person {
127
+ val iconData = __pigeon_list [0 ] as ByteArray?
128
+ val key = __pigeon_list [1 ] as String
129
+ val name = __pigeon_list [2 ] as String
130
+ return Person (iconData, key, name)
131
+ }
132
+ }
133
+ fun toList (): List <Any ?> {
134
+ return listOf<Any ?>(
135
+ iconData,
136
+ key,
137
+ name,
138
+ )
139
+ }
140
+ }
141
+
142
+ /* *
143
+ * Corresponds to `androidx.core.app.NotificationCompat.MessagingStyle.Message`
144
+ *
145
+ * See: https://developer.android.com/reference/androidx/core/app/NotificationCompat.MessagingStyle.Message
146
+ *
147
+ * Generated class from Pigeon that represents data sent in messages.
148
+ */
149
+ data class MessagingStyleMessage (
150
+ val text : String ,
151
+ val timestampMs : Long ,
152
+ val person : Person
153
+
154
+ ) {
155
+ companion object {
156
+ @Suppress(" LocalVariableName" )
157
+ fun fromList (__pigeon_list : List <Any ?>): MessagingStyleMessage {
158
+ val text = __pigeon_list [0 ] as String
159
+ val timestampMs = __pigeon_list [1 ].let { num -> if (num is Int ) num.toLong() else num as Long }
160
+ val person = __pigeon_list [2 ] as Person
161
+ return MessagingStyleMessage (text, timestampMs, person)
162
+ }
163
+ }
164
+ fun toList (): List <Any ?> {
165
+ return listOf<Any ?>(
166
+ text,
167
+ timestampMs,
168
+ person,
169
+ )
170
+ }
171
+ }
172
+
173
+ /* *
174
+ * Corresponds to `androidx.core.app.NotificationCompat.MessagingStyle`
175
+ *
176
+ * See: https://developer.android.com/reference/androidx/core/app/NotificationCompat.MessagingStyle
177
+ *
178
+ * Generated class from Pigeon that represents data sent in messages.
179
+ */
180
+ data class MessagingStyle (
181
+ val user : Person ,
182
+ val conversationTitle : String? = null ,
183
+ val isGroupConversation : Boolean ,
184
+ val messages : List <MessagingStyleMessage ?>? = null
185
+
186
+ ) {
187
+ companion object {
188
+ @Suppress(" LocalVariableName" )
189
+ fun fromList (__pigeon_list : List <Any ?>): MessagingStyle {
190
+ val user = __pigeon_list [0 ] as Person
191
+ val conversationTitle = __pigeon_list [1 ] as String?
192
+ val isGroupConversation = __pigeon_list [2 ] as Boolean
193
+ val messages = __pigeon_list [3 ] as List <MessagingStyleMessage ?>?
194
+ return MessagingStyle (user, conversationTitle, isGroupConversation, messages)
195
+ }
196
+ }
197
+ fun toList (): List <Any ?> {
198
+ return listOf<Any ?>(
199
+ user,
200
+ conversationTitle,
201
+ isGroupConversation,
202
+ messages,
203
+ )
204
+ }
205
+ }
110
206
private object AndroidNotificationHostApiCodec : StandardMessageCodec() {
111
207
override fun readValueOfType (type : Byte , buffer : ByteBuffer ): Any? {
112
208
return when (type) {
@@ -116,10 +212,25 @@ private object AndroidNotificationHostApiCodec : StandardMessageCodec() {
116
212
}
117
213
}
118
214
129 .toByte() -> {
215
+ return (readValue(buffer) as ? List <Any ?>)?.let {
216
+ MessagingStyle .fromList(it)
217
+ }
218
+ }
219
+ 130 .toByte() -> {
220
+ return (readValue(buffer) as ? List <Any ?>)?.let {
221
+ MessagingStyleMessage .fromList(it)
222
+ }
223
+ }
224
+ 131 .toByte() -> {
119
225
return (readValue(buffer) as ? List <Any ?>)?.let {
120
226
PendingIntent .fromList(it)
121
227
}
122
228
}
229
+ 132 .toByte() -> {
230
+ return (readValue(buffer) as ? List <Any ?>)?.let {
231
+ Person .fromList(it)
232
+ }
233
+ }
123
234
else -> super .readValueOfType(type, buffer)
124
235
}
125
236
}
@@ -129,10 +240,22 @@ private object AndroidNotificationHostApiCodec : StandardMessageCodec() {
129
240
stream.write(128 )
130
241
writeValue(stream, value.toList())
131
242
}
132
- is PendingIntent -> {
243
+ is MessagingStyle -> {
133
244
stream.write(129 )
134
245
writeValue(stream, value.toList())
135
246
}
247
+ is MessagingStyleMessage -> {
248
+ stream.write(130 )
249
+ writeValue(stream, value.toList())
250
+ }
251
+ is PendingIntent -> {
252
+ stream.write(131 )
253
+ writeValue(stream, value.toList())
254
+ }
255
+ is Person -> {
256
+ stream.write(132 )
257
+ writeValue(stream, value.toList())
258
+ }
136
259
else -> super .writeValue(stream, value)
137
260
}
138
261
}
@@ -159,7 +282,8 @@ interface AndroidNotificationHostApi {
159
282
* https://developer.android.com/reference/kotlin/android/app/NotificationManager.html#notify
160
283
* https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder
161
284
*/
162
- fun notify (tag : String? , id : Long , channelId : String , color : Long? , contentIntent : PendingIntent ? , contentText : String? , contentTitle : String? , extras : Map <String ?, String ?>? , smallIconResourceName : String? , groupKey : String? , isGroupSummary : Boolean? , inboxStyle : InboxStyle ? , autoCancel : Boolean? )
285
+ fun notify (tag : String? , id : Long , channelId : String , color : Long? , contentIntent : PendingIntent ? , contentText : String? , contentTitle : String? , extras : Map <String ?, String ?>? , smallIconResourceName : String? , groupKey : String? , isGroupSummary : Boolean? , inboxStyle : InboxStyle ? , messagingStyle : MessagingStyle ? , number : Long? , autoCancel : Boolean? )
286
+ fun getActiveNotificationMessagingStyleByTag (tag : String ): MessagingStyle ?
163
287
164
288
companion object {
165
289
/* * The codec used by AndroidNotificationHostApi. */
@@ -186,9 +310,11 @@ interface AndroidNotificationHostApi {
186
310
val groupKeyArg = args[9 ] as String?
187
311
val isGroupSummaryArg = args[10 ] as Boolean?
188
312
val inboxStyleArg = args[11 ] as InboxStyle ?
189
- val autoCancelArg = args[12 ] as Boolean?
313
+ val messagingStyleArg = args[12 ] as MessagingStyle ?
314
+ val numberArg = args[13 ].let { num -> if (num is Int ) num.toLong() else num as Long? }
315
+ val autoCancelArg = args[14 ] as Boolean?
190
316
val wrapped: List <Any ?> = try {
191
- api.notify(tagArg, idArg, channelIdArg, colorArg, contentIntentArg, contentTextArg, contentTitleArg, extrasArg, smallIconResourceNameArg, groupKeyArg, isGroupSummaryArg, inboxStyleArg, autoCancelArg)
317
+ api.notify(tagArg, idArg, channelIdArg, colorArg, contentIntentArg, contentTextArg, contentTitleArg, extrasArg, smallIconResourceNameArg, groupKeyArg, isGroupSummaryArg, inboxStyleArg, messagingStyleArg, numberArg, autoCancelArg)
192
318
listOf<Any ?>(null )
193
319
} catch (exception: Throwable ) {
194
320
wrapError(exception)
@@ -199,6 +325,23 @@ interface AndroidNotificationHostApi {
199
325
channel.setMessageHandler(null )
200
326
}
201
327
}
328
+ run {
329
+ val channel = BasicMessageChannel <Any ?>(binaryMessenger, " dev.flutter.pigeon.zulip.AndroidNotificationHostApi.getActiveNotificationMessagingStyleByTag$separatedMessageChannelSuffix " , codec)
330
+ if (api != null ) {
331
+ channel.setMessageHandler { message, reply ->
332
+ val args = message as List <Any ?>
333
+ val tagArg = args[0 ] as String
334
+ val wrapped: List <Any ?> = try {
335
+ listOf<Any ?>(api.getActiveNotificationMessagingStyleByTag(tagArg))
336
+ } catch (exception: Throwable ) {
337
+ wrapError(exception)
338
+ }
339
+ reply.reply(wrapped)
340
+ }
341
+ } else {
342
+ channel.setMessageHandler(null )
343
+ }
344
+ }
202
345
}
203
346
}
204
347
}
0 commit comments