Skip to content

Commit

Permalink
deps: Upgrade pigeon to 18.0.1
Browse files Browse the repository at this point in the history
Done with:
  $ flutter pub upgrade pigeon
  $ dart run pigeon
  $ tools/check --all-files --fix pigeon

The `dart run pigeon` step just ends up printing the command's
CLI help... but first it causes the `pigeon` package's CLI binary
to get rebuilt.  So it serves as a workaround for zulip#622.
  • Loading branch information
gnprice committed May 30, 2024
1 parent 53853ab commit 803d41f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
32 changes: 15 additions & 17 deletions android/app/src/main/kotlin/com/zulip/flutter/Notifications.g.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Autogenerated from Pigeon (v18.0.0), do not edit directly.
// Autogenerated from Pigeon (v18.0.1), do not edit directly.
// See also: https://pub.dev/packages/pigeon
@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass")

package com.zulip.flutter

Expand All @@ -16,14 +17,14 @@ private fun wrapResult(result: Any?): List<Any?> {
}

private fun wrapError(exception: Throwable): List<Any?> {
if (exception is FlutterError) {
return listOf(
return if (exception is FlutterError) {
listOf(
exception.code,
exception.message,
exception.details
)
} else {
return listOf(
listOf(
exception.javaClass.simpleName,
exception.toString(),
"Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)
Expand Down Expand Up @@ -65,11 +66,11 @@ data class PendingIntent (

) {
companion object {
@Suppress("UNCHECKED_CAST")
fun fromList(list: List<Any?>): PendingIntent {
val requestCode = list[0].let { if (it is Int) it.toLong() else it as Long }
val intentPayload = list[1] as String
val flags = list[2].let { if (it is Int) it.toLong() else it as Long }
@Suppress("LocalVariableName")
fun fromList(__pigeon_list: List<Any?>): PendingIntent {
val requestCode = __pigeon_list[0].let { num -> if (num is Int) num.toLong() else num as Long }
val intentPayload = __pigeon_list[1] as String
val flags = __pigeon_list[2].let { num -> if (num is Int) num.toLong() else num as Long }
return PendingIntent(requestCode, intentPayload, flags)
}
}
Expand All @@ -81,7 +82,6 @@ data class PendingIntent (
)
}
}
@Suppress("UNCHECKED_CAST")
private object AndroidNotificationHostApiCodec : StandardMessageCodec() {
override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? {
return when (type) {
Expand Down Expand Up @@ -133,7 +133,6 @@ interface AndroidNotificationHostApi {
AndroidNotificationHostApiCodec
}
/** Sets up an instance of `AndroidNotificationHostApi` to handle messages through the `binaryMessenger`. */
@Suppress("UNCHECKED_CAST")
fun setUp(binaryMessenger: BinaryMessenger, api: AndroidNotificationHostApi?, messageChannelSuffix: String = "") {
val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else ""
run {
Expand All @@ -142,20 +141,19 @@ interface AndroidNotificationHostApi {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val tagArg = args[0] as String?
val idArg = args[1].let { if (it is Int) it.toLong() else it as Long }
val idArg = args[1].let { num -> if (num is Int) num.toLong() else num as Long }
val channelIdArg = args[2] as String
val colorArg = args[3].let { if (it is Int) it.toLong() else it as Long? }
val colorArg = args[3].let { num -> if (num is Int) num.toLong() else num as Long? }
val contentIntentArg = args[4] as PendingIntent?
val contentTextArg = args[5] as String?
val contentTitleArg = args[6] as String?
val extrasArg = args[7] as Map<String?, String?>?
val smallIconResourceNameArg = args[8] as String?
var wrapped: List<Any?>
try {
val wrapped: List<Any?> = try {
api.notify(tagArg, idArg, channelIdArg, colorArg, contentIntentArg, contentTextArg, contentTitleArg, extrasArg, smallIconResourceNameArg)
wrapped = listOf<Any?>(null)
listOf<Any?>(null)
} catch (exception: Throwable) {
wrapped = wrapError(exception)
wrapError(exception)
}
reply.reply(wrapped)
}
Expand Down
2 changes: 1 addition & 1 deletion lib/host/android_notifications.g.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Autogenerated from Pigeon (v18.0.0), do not edit directly.
// Autogenerated from Pigeon (v18.0.1), do not edit directly.
// See also: https://pub.dev/packages/pigeon
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers

Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -832,10 +832,10 @@ packages:
dependency: "direct dev"
description:
name: pigeon
sha256: be883401d09121c427ed9c5f6e96427787d93d335f55e5e2b0d780a0a22cd561
sha256: "20fe4dc59f7f9b8070f8732783fdb474d3d4dcd7674a3252230ec4d4f7070ae3"
url: "https://pub.dev"
source: hosted
version: "18.0.0"
version: "18.0.1"
platform:
dependency: transitive
description:
Expand Down

0 comments on commit 803d41f

Please sign in to comment.