Skip to content

notif ios: Handle opening of conversation on tap; take 2 #1379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import io.flutter.plugin.common.StandardMethodCodec
import io.flutter.plugin.common.StandardMessageCodec
import java.io.ByteArrayOutputStream
import java.nio.ByteBuffer
private object NotificationsPigeonUtils {
private object AndroidNotificationsPigeonUtils {

fun wrapResult(result: Any?): List<Any?> {
return listOf(result)
Expand Down Expand Up @@ -128,7 +128,7 @@ data class NotificationChannel (
if (this === other) {
return true
}
return NotificationsPigeonUtils.deepEquals(toList(), other.toList()) }
return AndroidNotificationsPigeonUtils.deepEquals(toList(), other.toList()) }

override fun hashCode(): Int = toList().hashCode()
}
Expand Down Expand Up @@ -171,7 +171,7 @@ data class AndroidIntent (
if (this === other) {
return true
}
return NotificationsPigeonUtils.deepEquals(toList(), other.toList()) }
return AndroidNotificationsPigeonUtils.deepEquals(toList(), other.toList()) }

override fun hashCode(): Int = toList().hashCode()
}
Expand Down Expand Up @@ -215,7 +215,7 @@ data class PendingIntent (
if (this === other) {
return true
}
return NotificationsPigeonUtils.deepEquals(toList(), other.toList()) }
return AndroidNotificationsPigeonUtils.deepEquals(toList(), other.toList()) }

override fun hashCode(): Int = toList().hashCode()
}
Expand Down Expand Up @@ -249,7 +249,7 @@ data class InboxStyle (
if (this === other) {
return true
}
return NotificationsPigeonUtils.deepEquals(toList(), other.toList()) }
return AndroidNotificationsPigeonUtils.deepEquals(toList(), other.toList()) }

override fun hashCode(): Int = toList().hashCode()
}
Expand Down Expand Up @@ -299,7 +299,7 @@ data class Person (
if (this === other) {
return true
}
return NotificationsPigeonUtils.deepEquals(toList(), other.toList()) }
return AndroidNotificationsPigeonUtils.deepEquals(toList(), other.toList()) }

override fun hashCode(): Int = toList().hashCode()
}
Expand Down Expand Up @@ -339,7 +339,7 @@ data class MessagingStyleMessage (
if (this === other) {
return true
}
return NotificationsPigeonUtils.deepEquals(toList(), other.toList()) }
return AndroidNotificationsPigeonUtils.deepEquals(toList(), other.toList()) }

override fun hashCode(): Int = toList().hashCode()
}
Expand Down Expand Up @@ -382,7 +382,7 @@ data class MessagingStyle (
if (this === other) {
return true
}
return NotificationsPigeonUtils.deepEquals(toList(), other.toList()) }
return AndroidNotificationsPigeonUtils.deepEquals(toList(), other.toList()) }

override fun hashCode(): Int = toList().hashCode()
}
Expand Down Expand Up @@ -419,7 +419,7 @@ data class Notification (
if (this === other) {
return true
}
return NotificationsPigeonUtils.deepEquals(toList(), other.toList()) }
return AndroidNotificationsPigeonUtils.deepEquals(toList(), other.toList()) }

override fun hashCode(): Int = toList().hashCode()
}
Expand Down Expand Up @@ -459,7 +459,7 @@ data class StatusBarNotification (
if (this === other) {
return true
}
return NotificationsPigeonUtils.deepEquals(toList(), other.toList()) }
return AndroidNotificationsPigeonUtils.deepEquals(toList(), other.toList()) }

override fun hashCode(): Int = toList().hashCode()
}
Expand Down Expand Up @@ -509,11 +509,11 @@ data class StoredNotificationSound (
if (this === other) {
return true
}
return NotificationsPigeonUtils.deepEquals(toList(), other.toList()) }
return AndroidNotificationsPigeonUtils.deepEquals(toList(), other.toList()) }

override fun hashCode(): Int = toList().hashCode()
}
private open class NotificationsPigeonCodec : StandardMessageCodec() {
private open class AndroidNotificationsPigeonCodec : StandardMessageCodec() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit-message nit:

pigeon [nfc]: Rename pigeon file to `notification` -> `android_notifications`

I think the "to" should be deleted? Or moved to replace the "->"?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pigeon [nfc]: Rename pigeon file `notifications.dart` to `android_notifications.dart`

commit-message nit: limit summary line length to 76 (this is 85).

override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? {
return when (type) {
129.toByte() -> {
Expand Down Expand Up @@ -721,7 +721,7 @@ interface AndroidNotificationHostApi {
companion object {
/** The codec used by AndroidNotificationHostApi. */
val codec: MessageCodec<Any?> by lazy {
NotificationsPigeonCodec()
AndroidNotificationsPigeonCodec()
}
/** Sets up an instance of `AndroidNotificationHostApi` to handle messages through the `binaryMessenger`. */
@JvmOverloads
Expand All @@ -737,7 +737,7 @@ interface AndroidNotificationHostApi {
api.createNotificationChannel(channelArg)
listOf(null)
} catch (exception: Throwable) {
NotificationsPigeonUtils.wrapError(exception)
AndroidNotificationsPigeonUtils.wrapError(exception)
}
reply.reply(wrapped)
}
Expand All @@ -752,7 +752,7 @@ interface AndroidNotificationHostApi {
val wrapped: List<Any?> = try {
listOf(api.getNotificationChannels())
} catch (exception: Throwable) {
NotificationsPigeonUtils.wrapError(exception)
AndroidNotificationsPigeonUtils.wrapError(exception)
}
reply.reply(wrapped)
}
Expand All @@ -770,7 +770,7 @@ interface AndroidNotificationHostApi {
api.deleteNotificationChannel(channelIdArg)
listOf(null)
} catch (exception: Throwable) {
NotificationsPigeonUtils.wrapError(exception)
AndroidNotificationsPigeonUtils.wrapError(exception)
}
reply.reply(wrapped)
}
Expand All @@ -785,7 +785,7 @@ interface AndroidNotificationHostApi {
val wrapped: List<Any?> = try {
listOf(api.listStoredSoundsInNotificationsDirectory())
} catch (exception: Throwable) {
NotificationsPigeonUtils.wrapError(exception)
AndroidNotificationsPigeonUtils.wrapError(exception)
}
reply.reply(wrapped)
}
Expand All @@ -803,7 +803,7 @@ interface AndroidNotificationHostApi {
val wrapped: List<Any?> = try {
listOf(api.copySoundResourceToMediaStore(targetFileDisplayNameArg, sourceResourceNameArg))
} catch (exception: Throwable) {
NotificationsPigeonUtils.wrapError(exception)
AndroidNotificationsPigeonUtils.wrapError(exception)
}
reply.reply(wrapped)
}
Expand Down Expand Up @@ -835,7 +835,7 @@ interface AndroidNotificationHostApi {
api.notify(tagArg, idArg, autoCancelArg, channelIdArg, colorArg, contentIntentArg, contentTextArg, contentTitleArg, extrasArg, groupKeyArg, inboxStyleArg, isGroupSummaryArg, messagingStyleArg, numberArg, smallIconResourceNameArg)
listOf(null)
} catch (exception: Throwable) {
NotificationsPigeonUtils.wrapError(exception)
AndroidNotificationsPigeonUtils.wrapError(exception)
}
reply.reply(wrapped)
}
Expand All @@ -852,7 +852,7 @@ interface AndroidNotificationHostApi {
val wrapped: List<Any?> = try {
listOf(api.getActiveNotificationMessagingStyleByTag(tagArg))
} catch (exception: Throwable) {
NotificationsPigeonUtils.wrapError(exception)
AndroidNotificationsPigeonUtils.wrapError(exception)
}
reply.reply(wrapped)
}
Expand All @@ -869,7 +869,7 @@ interface AndroidNotificationHostApi {
val wrapped: List<Any?> = try {
listOf(api.getActiveNotifications(desiredExtrasArg))
} catch (exception: Throwable) {
NotificationsPigeonUtils.wrapError(exception)
AndroidNotificationsPigeonUtils.wrapError(exception)
}
reply.reply(wrapped)
}
Expand All @@ -888,7 +888,7 @@ interface AndroidNotificationHostApi {
api.cancel(tagArg, idArg)
listOf(null)
} catch (exception: Throwable) {
NotificationsPigeonUtils.wrapError(exception)
AndroidNotificationsPigeonUtils.wrapError(exception)
}
reply.reply(wrapped)
}
Expand Down
6 changes: 3 additions & 3 deletions assets/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -911,9 +911,9 @@
"@errorNotificationOpenTitle": {
"description": "Error title when notification opening fails"
},
"errorNotificationOpenAccountMissing": "The account associated with this notification no longer exists.",
"@errorNotificationOpenAccountMissing": {
"description": "Error message when the account associated with the notification is not found"
"errorNotificationOpenAccountNotFound": "The account associated with this notification could not be found.",
"@errorNotificationOpenAccountNotFound": {
"description": "Error message when the account associated with the notification could not be found"
},
"errorReactionAddingFailedTitle": "Adding reaction failed",
"@errorReactionAddingFailedTitle": {
Expand Down
4 changes: 0 additions & 4 deletions assets/l10n/app_pl.arb
Original file line number Diff line number Diff line change
Expand Up @@ -557,10 +557,6 @@
"@errorNotificationOpenTitle": {
"description": "Error title when notification opening fails"
},
"errorNotificationOpenAccountMissing": "Konto związane z tym powiadomieniem już nie istnieje.",
"@errorNotificationOpenAccountMissing": {
"description": "Error message when the account associated with the notification is not found"
},
"aboutPageOpenSourceLicenses": "Licencje otwartego źródła",
"@aboutPageOpenSourceLicenses": {
"description": "Item title in About Zulip page to navigate to Licenses page"
Expand Down
4 changes: 0 additions & 4 deletions assets/l10n/app_ru.arb
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,6 @@
"@errorNotificationOpenTitle": {
"description": "Error title when notification opening fails"
},
"errorNotificationOpenAccountMissing": "Учетной записи, связанной с этим оповещением, больше нет.",
"@errorNotificationOpenAccountMissing": {
"description": "Error message when the account associated with the notification is not found"
},
"switchAccountButton": "Сменить учетную запись",
"@switchAccountButton": {
"description": "Label for main-menu button leading to the choose-account page."
Expand Down
Loading