summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPacho Ramos <pacho@gentoo.org>2020-05-14 22:25:22 +0200
committerPacho Ramos <pacho@gentoo.org>2020-05-14 22:25:32 +0200
commit0340f4324cc232b9357f33a5d0ed81dfbcfb093a (patch)
tree507938cfdf11d34409f08fe4fd0b056f1f5bb0d4 /gnome-extra/gnome-shell-extension-gsconnect
parentmedia-libs/mesa: Version bump to 20.1.0_rc3 (diff)
downloadgentoo-0340f4324cc232b9357f33a5d0ed81dfbcfb093a.tar.gz
gentoo-0340f4324cc232b9357f33a5d0ed81dfbcfb093a.tar.bz2
gentoo-0340f4324cc232b9357f33a5d0ed81dfbcfb093a.zip
gnome-extra/gnome-shell-extension-gsconnect: Avoid repeated notifications
Fix WhatsApp notifications handling and avoid repetitions with backported fixes from upstream. Package-Manager: Portage-2.3.99, Repoman-2.3.22 Signed-off-by: Pacho Ramos <pacho@gentoo.org>
Diffstat (limited to 'gnome-extra/gnome-shell-extension-gsconnect')
-rw-r--r--gnome-extra/gnome-shell-extension-gsconnect/files/gnome-shell-extension-gsconnect-33-avoid-repetitions.patch51
-rw-r--r--gnome-extra/gnome-shell-extension-gsconnect/files/gnome-shell-extension-gsconnect-33-whatsapp-duplicates.patch34
-rw-r--r--gnome-extra/gnome-shell-extension-gsconnect/gnome-shell-extension-gsconnect-33-r2.ebuild74
3 files changed, 159 insertions, 0 deletions
diff --git a/gnome-extra/gnome-shell-extension-gsconnect/files/gnome-shell-extension-gsconnect-33-avoid-repetitions.patch b/gnome-extra/gnome-shell-extension-gsconnect/files/gnome-shell-extension-gsconnect-33-avoid-repetitions.patch
new file mode 100644
index 000000000000..d7ed8780ee0b
--- /dev/null
+++ b/gnome-extra/gnome-shell-extension-gsconnect/files/gnome-shell-extension-gsconnect-33-avoid-repetitions.patch
@@ -0,0 +1,51 @@
+--- a/src/shell/notification.js.orig 2020-05-14 13:57:38.781404129 +0200
++++ b/src/shell/notification.js 2020-05-14 13:57:54.335642763 +0200
+@@ -200,20 +200,27 @@
+ this._notificationPending = true;
+ let notification = this._notifications[localId];
+
+- // Check if @notificationParams represents an exact repeat
+- let repeat = (
+- notification &&
+- notification.title === notificationParams.title.unpack() &&
+- notification.bannerBodyText === notificationParams.body.unpack()
+- );
+-
+- // If it's a repeat, we still update the metadata
+- if (repeat) {
+- notification.deviceId = deviceId;
+- notification.remoteId = remoteId;
++ // Check if this is a repeat
++ if (notification) {
+ notification.requestReplyId = requestReplyId;
+
+- // Device Notification
++ // Bail early If @notificationParams represents an exact repeat
++ let title = notificationParams.title.unpack();
++ let body = notificationParams.body ?
++
++ notificationParams.body.unpack() :
++ null;
++
++ if (notification.title === title &&
++ notification.bannerBodyText === body) {
++ this._notificationPending = false;
++ return;
++ }
++
++ notification.title = title;
++ notification.bannerBodyText = body;
++
++ // Device Notification
+ } else if (idMatch) {
+ notification = new NotificationDaemon.GtkNotificationDaemonNotification(this, notificationParams);
+
+@@ -237,7 +244,7 @@
+ this._notifications[localId] = notification;
+ }
+
+- if (showBanner && !repeat)
++ if (showBanner)
+ this.notify(notification);
+ else
+ this.pushNotification(notification);
diff --git a/gnome-extra/gnome-shell-extension-gsconnect/files/gnome-shell-extension-gsconnect-33-whatsapp-duplicates.patch b/gnome-extra/gnome-shell-extension-gsconnect/files/gnome-shell-extension-gsconnect-33-whatsapp-duplicates.patch
new file mode 100644
index 000000000000..7301bfe11321
--- /dev/null
+++ b/gnome-extra/gnome-shell-extension-gsconnect/files/gnome-shell-extension-gsconnect-33-whatsapp-duplicates.patch
@@ -0,0 +1,34 @@
+From 959799d934360f95a2e49223b64ffc77bba2736e Mon Sep 17 00:00:00 2001
+From: Andy Holmes <andrew.g.r.holmes@gmail.com>
+Date: Fri, 8 May 2020 21:26:19 -0700
+Subject: [PATCH] Shell Notifications: account for apps that insert newlines in
+ IDs
+
+We need to account for the totally reasonable practice of inserting
+literal newline characters in notification IDs, like WhatsApp does.
+
+Not doing so was resulting in such notifications failing to match as
+device notifications, allowing them to be duplicated in the message tray
+
+closes #788
+---
+ src/shell/notification.js | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/shell/notification.js b/src/shell/notification.js
+index e7a5f67ce..eef623a71 100644
+--- a/src/shell/notification.js
++++ b/src/shell/notification.js
+@@ -16,10 +16,10 @@ const APP_PATH = '/org/gnome/Shell/Extensions/GSConnect';
+
+
+ // deviceId Pattern (<device-id>|<remote-id>)
+-const DEVICE_REGEX = /^([^|]+)\|(.+)$/;
++const DEVICE_REGEX = /^([^|]+)\|([\s\S]+)$/;
+
+ // requestReplyId Pattern (<device-id>|<remote-id>)|<reply-id>)
+-const REPLY_REGEX = /^([^|]+)\|(.+)\|([0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$/i;
++const REPLY_REGEX = /^([^|]+)\|([\s\S]+)\|([0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$/i;
+
+
+ /**
diff --git a/gnome-extra/gnome-shell-extension-gsconnect/gnome-shell-extension-gsconnect-33-r2.ebuild b/gnome-extra/gnome-shell-extension-gsconnect/gnome-shell-extension-gsconnect-33-r2.ebuild
new file mode 100644
index 000000000000..5b9bc72ccdc8
--- /dev/null
+++ b/gnome-extra/gnome-shell-extension-gsconnect/gnome-shell-extension-gsconnect-33-r2.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+inherit gnome2-utils meson readme.gentoo-r1
+
+DESCRIPTION="KDE Connect implementation for Gnome Shell"
+HOMEPAGE="https://github.com/andyholmes/gnome-shell-extension-gsconnect"
+SRC_URI="https://github.com/andyholmes/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="nautilus"
+
+COMMON_DEPEND="dev-libs/glib:2"
+RDEPEND="${COMMON_DEPEND}
+ app-eselect/eselect-gnome-shell-extensions
+ >=dev-libs/gjs-1.48
+ =gnome-base/gnome-shell-3.34*
+ gnome-base/gvfs
+ gnome-extra/evolution-data-server
+ || ( media-libs/libcanberra media-libs/gsound )
+ nautilus? (
+ dev-python/nautilus-python
+ gnome-base/nautilus[introspection] )
+"
+DEPEND="${COMMON_DEPEND}"
+BDEPEND="
+ virtual/pkgconfig
+"
+
+DISABLE_AUTOFORMATTING="yes"
+DOC_CONTENTS="For knowing more about how to do the setup, please visit:
+https://github.com/andyholmes/gnome-shell-extension-gsconnect/wiki/Installation"
+
+PATCHES=(
+ # From 'master'
+ # Shell Notifications: set a limit of 10 notifications from GSConnect
+ "${FILESDIR}/${P}-notifications-limit.patch"
+
+ # Don't show duplicated WhatsApp notifications and avoid repetitions
+ "${FILESDIR}/${P}-whatsapp-duplicates.patch"
+ "${FILESDIR}/${P}-avoid-repetitions.patch"
+)
+
+src_configure() {
+ # nemo support relies on nemo-python from https://github.com/linuxmint/nemo-extensions
+ # https://bugs.gentoo.org/694388
+ meson_src_configure \
+ -Dnemo=false \
+ $(meson_use nautilus)
+}
+
+src_install() {
+ meson_src_install
+ readme.gentoo_create_doc
+}
+
+pkg_preinst() {
+ gnome2_schemas_savelist
+}
+
+pkg_postinst() {
+ gnome2_schemas_update
+ ebegin "Updating list of installed extensions"
+ eselect gnome-shell-extensions update
+ eend $?
+ readme.gentoo_print_elog
+}
+
+pkg_postrm() {
+ gnome2_schemas_update
+}