From 96fb61ccfc9db553e7dd73496c391d5a46e4df4a Mon Sep 17 00:00:00 2001 From: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com> Date: Tue, 26 Mar 2024 19:43:45 +0700 Subject: [PATCH] desktop: show toast if failed to show notification (#3955) * desktop: show toast if failed to show notification * longer timeout * returned old version of the lib --- apps/multiplatform/common/build.gradle.kts | 2 +- .../common/src/commonMain/resources/MR/base/strings.xml | 1 + .../kotlin/chat/simplex/common/model/NtfManager.desktop.kt | 6 +++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/multiplatform/common/build.gradle.kts b/apps/multiplatform/common/build.gradle.kts index 436aa5a6e3..b020a8641b 100644 --- a/apps/multiplatform/common/build.gradle.kts +++ b/apps/multiplatform/common/build.gradle.kts @@ -96,7 +96,7 @@ kotlin { dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-swing:1.8.0") implementation("com.github.Dansoftowner:jSystemThemeDetector:3.8") - implementation("com.sshtools:two-slices:0.9.3") + implementation("com.sshtools:two-slices:0.9.0-SNAPSHOT") implementation("org.slf4j:slf4j-simple:2.0.12") implementation("uk.co.caprica:vlcj:4.8.2") implementation("com.github.NanoHttpd.nanohttpd:nanohttpd:efb2ebf85a") diff --git a/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml b/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml index c2348568b1..c2045fe436 100644 --- a/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml +++ b/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml @@ -211,6 +211,7 @@ new message New contact request Connected + Error showing notification, contact developers. SimpleX Lock diff --git a/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/model/NtfManager.desktop.kt b/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/model/NtfManager.desktop.kt index 3f2e1a74ab..3fab849361 100644 --- a/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/model/NtfManager.desktop.kt +++ b/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/model/NtfManager.desktop.kt @@ -111,8 +111,12 @@ object NtfManager { } try { prevNtfs.add(chatId to builder.toast()) - } catch (e: Exception) { + } catch (e: Throwable) { Log.e(TAG, e.stackTraceToString()) + if (e !is Exception) { + val text = e.stackTraceToString().lines().getOrNull(0) ?: "" + showToast(generalGetString(MR.strings.error_showing_desktop_notification) + " " + text, 4_000) + } } }