From 88d3d5ed95767a35a9349bfc63a7d39d4dac8d07 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Mon, 3 Jun 2024 12:55:21 +0200 Subject: [PATCH] Strip emojis from Linux notifications --- sbapp/sideband/core.py | 7 ++++++- sbapp/ui/helpers.py | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py index 225149d..7668fa6 100644 --- a/sbapp/sideband/core.py +++ b/sbapp/sideband/core.py @@ -786,9 +786,14 @@ class SidebandCore(): RNS.log("Error while setting LXMF propagation node: "+str(e), RNS.LOG_ERROR) def notify(self, title, content, group=None, context_id=None): + if RNS.vendor.platformutils.is_linux(): + from sbapp.ui.helpers import strip_emojis + title = strip_emojis(title) + content = strip_emojis(content) + if not self.is_daemon: if self.config["notifications_on"]: - if RNS.vendor.platformutils.get_platform() == "android": + if RNS.vendor.platformutils.is_android(): if self.getpersistent("permissions.notifications"): notifications_permitted = True else: diff --git a/sbapp/ui/helpers.py b/sbapp/ui/helpers.py index 82a95b8..68f73d4 100644 --- a/sbapp/ui/helpers.py +++ b/sbapp/ui/helpers.py @@ -37,6 +37,13 @@ class IconListItem(OneLineIconListItem): def is_emoji(unicode_character): return unicode_character in emoji_lookup +def strip_emojis(str_input): + output = "" + for cp in str_input: + if not is_emoji(cp): + output += cp + return output + def multilingual_markup(data): # TODO: Remove # import time