Skip to content

Commit feedc06

Browse files
rajveermalviyagnprice
authored andcommitted
deps: Update pigeon to 25.3.1, from 25.0.0
Changelog: https://pub.dev/packages/pigeon/changelog#2531 Updates to the generator to generate equality methods for the classes, and some bug fixes.
1 parent 830b94d commit feedc06

File tree

4 files changed

+386
-40
lines changed

4 files changed

+386
-40
lines changed

android/app/src/main/kotlin/com/zulip/flutter/Notifications.g.kt

Lines changed: 158 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Autogenerated from Pigeon (v25.0.0), do not edit directly.
1+
// Autogenerated from Pigeon (v25.3.1), do not edit directly.
22
// See also: https://pub.dev/packages/pigeon
33
@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass")
44

@@ -13,25 +13,57 @@ import io.flutter.plugin.common.StandardMethodCodec
1313
import io.flutter.plugin.common.StandardMessageCodec
1414
import java.io.ByteArrayOutputStream
1515
import java.nio.ByteBuffer
16+
private object NotificationsPigeonUtils {
1617

17-
private fun wrapResult(result: Any?): List<Any?> {
18-
return listOf(result)
19-
}
18+
fun wrapResult(result: Any?): List<Any?> {
19+
return listOf(result)
20+
}
2021

21-
private fun wrapError(exception: Throwable): List<Any?> {
22-
return if (exception is FlutterError) {
23-
listOf(
24-
exception.code,
25-
exception.message,
26-
exception.details
27-
)
28-
} else {
29-
listOf(
30-
exception.javaClass.simpleName,
31-
exception.toString(),
32-
"Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)
33-
)
22+
fun wrapError(exception: Throwable): List<Any?> {
23+
return if (exception is FlutterError) {
24+
listOf(
25+
exception.code,
26+
exception.message,
27+
exception.details
28+
)
29+
} else {
30+
listOf(
31+
exception.javaClass.simpleName,
32+
exception.toString(),
33+
"Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)
34+
)
35+
}
36+
}
37+
fun deepEquals(a: Any?, b: Any?): Boolean {
38+
if (a is ByteArray && b is ByteArray) {
39+
return a.contentEquals(b)
40+
}
41+
if (a is IntArray && b is IntArray) {
42+
return a.contentEquals(b)
43+
}
44+
if (a is LongArray && b is LongArray) {
45+
return a.contentEquals(b)
46+
}
47+
if (a is DoubleArray && b is DoubleArray) {
48+
return a.contentEquals(b)
49+
}
50+
if (a is Array<*> && b is Array<*>) {
51+
return a.size == b.size &&
52+
a.indices.all{ deepEquals(a[it], b[it]) }
53+
}
54+
if (a is List<*> && b is List<*>) {
55+
return a.size == b.size &&
56+
a.indices.all{ deepEquals(a[it], b[it]) }
57+
}
58+
if (a is Map<*, *> && b is Map<*, *>) {
59+
return a.size == b.size && a.all {
60+
(b as Map<Any?, Any?>).containsKey(it.key) &&
61+
deepEquals(it.value, b[it.key])
62+
}
63+
}
64+
return a == b
3465
}
66+
3567
}
3668

3769
/**
@@ -89,6 +121,16 @@ data class NotificationChannel (
89121
vibrationPattern,
90122
)
91123
}
124+
override fun equals(other: Any?): Boolean {
125+
if (other !is NotificationChannel) {
126+
return false
127+
}
128+
if (this === other) {
129+
return true
130+
}
131+
return NotificationsPigeonUtils.deepEquals(toList(), other.toList()) }
132+
133+
override fun hashCode(): Int = toList().hashCode()
92134
}
93135

94136
/**
@@ -122,6 +164,16 @@ data class AndroidIntent (
122164
flags,
123165
)
124166
}
167+
override fun equals(other: Any?): Boolean {
168+
if (other !is AndroidIntent) {
169+
return false
170+
}
171+
if (this === other) {
172+
return true
173+
}
174+
return NotificationsPigeonUtils.deepEquals(toList(), other.toList()) }
175+
176+
override fun hashCode(): Int = toList().hashCode()
125177
}
126178

127179
/**
@@ -156,6 +208,16 @@ data class PendingIntent (
156208
flags,
157209
)
158210
}
211+
override fun equals(other: Any?): Boolean {
212+
if (other !is PendingIntent) {
213+
return false
214+
}
215+
if (this === other) {
216+
return true
217+
}
218+
return NotificationsPigeonUtils.deepEquals(toList(), other.toList()) }
219+
220+
override fun hashCode(): Int = toList().hashCode()
159221
}
160222

161223
/**
@@ -180,6 +242,16 @@ data class InboxStyle (
180242
summaryText,
181243
)
182244
}
245+
override fun equals(other: Any?): Boolean {
246+
if (other !is InboxStyle) {
247+
return false
248+
}
249+
if (this === other) {
250+
return true
251+
}
252+
return NotificationsPigeonUtils.deepEquals(toList(), other.toList()) }
253+
254+
override fun hashCode(): Int = toList().hashCode()
183255
}
184256

185257
/**
@@ -220,6 +292,16 @@ data class Person (
220292
name,
221293
)
222294
}
295+
override fun equals(other: Any?): Boolean {
296+
if (other !is Person) {
297+
return false
298+
}
299+
if (this === other) {
300+
return true
301+
}
302+
return NotificationsPigeonUtils.deepEquals(toList(), other.toList()) }
303+
304+
override fun hashCode(): Int = toList().hashCode()
223305
}
224306

225307
/**
@@ -250,6 +332,16 @@ data class MessagingStyleMessage (
250332
person,
251333
)
252334
}
335+
override fun equals(other: Any?): Boolean {
336+
if (other !is MessagingStyleMessage) {
337+
return false
338+
}
339+
if (this === other) {
340+
return true
341+
}
342+
return NotificationsPigeonUtils.deepEquals(toList(), other.toList()) }
343+
344+
override fun hashCode(): Int = toList().hashCode()
253345
}
254346

255347
/**
@@ -283,6 +375,16 @@ data class MessagingStyle (
283375
isGroupConversation,
284376
)
285377
}
378+
override fun equals(other: Any?): Boolean {
379+
if (other !is MessagingStyle) {
380+
return false
381+
}
382+
if (this === other) {
383+
return true
384+
}
385+
return NotificationsPigeonUtils.deepEquals(toList(), other.toList()) }
386+
387+
override fun hashCode(): Int = toList().hashCode()
286388
}
287389

288390
/**
@@ -310,6 +412,16 @@ data class Notification (
310412
extras,
311413
)
312414
}
415+
override fun equals(other: Any?): Boolean {
416+
if (other !is Notification) {
417+
return false
418+
}
419+
if (this === other) {
420+
return true
421+
}
422+
return NotificationsPigeonUtils.deepEquals(toList(), other.toList()) }
423+
424+
override fun hashCode(): Int = toList().hashCode()
313425
}
314426

315427
/**
@@ -340,6 +452,16 @@ data class StatusBarNotification (
340452
notification,
341453
)
342454
}
455+
override fun equals(other: Any?): Boolean {
456+
if (other !is StatusBarNotification) {
457+
return false
458+
}
459+
if (this === other) {
460+
return true
461+
}
462+
return NotificationsPigeonUtils.deepEquals(toList(), other.toList()) }
463+
464+
override fun hashCode(): Int = toList().hashCode()
343465
}
344466

345467
/**
@@ -380,6 +502,16 @@ data class StoredNotificationSound (
380502
contentUrl,
381503
)
382504
}
505+
override fun equals(other: Any?): Boolean {
506+
if (other !is StoredNotificationSound) {
507+
return false
508+
}
509+
if (this === other) {
510+
return true
511+
}
512+
return NotificationsPigeonUtils.deepEquals(toList(), other.toList()) }
513+
514+
override fun hashCode(): Int = toList().hashCode()
383515
}
384516
private open class NotificationsPigeonCodec : StandardMessageCodec() {
385517
override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? {
@@ -605,7 +737,7 @@ interface AndroidNotificationHostApi {
605737
api.createNotificationChannel(channelArg)
606738
listOf(null)
607739
} catch (exception: Throwable) {
608-
wrapError(exception)
740+
NotificationsPigeonUtils.wrapError(exception)
609741
}
610742
reply.reply(wrapped)
611743
}
@@ -620,7 +752,7 @@ interface AndroidNotificationHostApi {
620752
val wrapped: List<Any?> = try {
621753
listOf(api.getNotificationChannels())
622754
} catch (exception: Throwable) {
623-
wrapError(exception)
755+
NotificationsPigeonUtils.wrapError(exception)
624756
}
625757
reply.reply(wrapped)
626758
}
@@ -638,7 +770,7 @@ interface AndroidNotificationHostApi {
638770
api.deleteNotificationChannel(channelIdArg)
639771
listOf(null)
640772
} catch (exception: Throwable) {
641-
wrapError(exception)
773+
NotificationsPigeonUtils.wrapError(exception)
642774
}
643775
reply.reply(wrapped)
644776
}
@@ -653,7 +785,7 @@ interface AndroidNotificationHostApi {
653785
val wrapped: List<Any?> = try {
654786
listOf(api.listStoredSoundsInNotificationsDirectory())
655787
} catch (exception: Throwable) {
656-
wrapError(exception)
788+
NotificationsPigeonUtils.wrapError(exception)
657789
}
658790
reply.reply(wrapped)
659791
}
@@ -671,7 +803,7 @@ interface AndroidNotificationHostApi {
671803
val wrapped: List<Any?> = try {
672804
listOf(api.copySoundResourceToMediaStore(targetFileDisplayNameArg, sourceResourceNameArg))
673805
} catch (exception: Throwable) {
674-
wrapError(exception)
806+
NotificationsPigeonUtils.wrapError(exception)
675807
}
676808
reply.reply(wrapped)
677809
}
@@ -703,7 +835,7 @@ interface AndroidNotificationHostApi {
703835
api.notify(tagArg, idArg, autoCancelArg, channelIdArg, colorArg, contentIntentArg, contentTextArg, contentTitleArg, extrasArg, groupKeyArg, inboxStyleArg, isGroupSummaryArg, messagingStyleArg, numberArg, smallIconResourceNameArg)
704836
listOf(null)
705837
} catch (exception: Throwable) {
706-
wrapError(exception)
838+
NotificationsPigeonUtils.wrapError(exception)
707839
}
708840
reply.reply(wrapped)
709841
}
@@ -720,7 +852,7 @@ interface AndroidNotificationHostApi {
720852
val wrapped: List<Any?> = try {
721853
listOf(api.getActiveNotificationMessagingStyleByTag(tagArg))
722854
} catch (exception: Throwable) {
723-
wrapError(exception)
855+
NotificationsPigeonUtils.wrapError(exception)
724856
}
725857
reply.reply(wrapped)
726858
}
@@ -737,7 +869,7 @@ interface AndroidNotificationHostApi {
737869
val wrapped: List<Any?> = try {
738870
listOf(api.getActiveNotifications(desiredExtrasArg))
739871
} catch (exception: Throwable) {
740-
wrapError(exception)
872+
NotificationsPigeonUtils.wrapError(exception)
741873
}
742874
reply.reply(wrapped)
743875
}
@@ -756,7 +888,7 @@ interface AndroidNotificationHostApi {
756888
api.cancel(tagArg, idArg)
757889
listOf(null)
758890
} catch (exception: Throwable) {
759-
wrapError(exception)
891+
NotificationsPigeonUtils.wrapError(exception)
760892
}
761893
reply.reply(wrapped)
762894
}

0 commit comments

Comments
 (0)