From bf123f308af63ebfe42192810b70e36c90caed8f Mon Sep 17 00:00:00 2001 From: Pedro Pombeiro Date: Thu, 15 Nov 2018 08:19:57 +0100 Subject: [PATCH] Add missing configuration for Windows desktop notifications. Part of #6728 --- .../desktop/CMakeLists.txt | 8 ++++++-- .../desktop/desktopnotification.cpp | 9 +++++++-- scripts/build-desktop.sh | 6 ++---- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/modules/react-native-desktop-notification/desktop/CMakeLists.txt b/modules/react-native-desktop-notification/desktop/CMakeLists.txt index 3fce1f5fd4..bd0a32ea97 100755 --- a/modules/react-native-desktop-notification/desktop/CMakeLists.txt +++ b/modules/react-native-desktop-notification/desktop/CMakeLists.txt @@ -10,7 +10,11 @@ include(${CMAKE_ROOT}/Modules/ExternalProject.cmake) set(SN_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/SnoreNotify_ep-prefix/src/SnoreNotify_ep) if (WIN32) - set(SnoreNotify_CMAKE_ARGS -DMINGW=1 -DBUILD_osxnotificationcenter=OFF -DBUILD_sound=OFF -DBUILD_speech=OFF -DBUILD_toasty=OFF -DBUILD_snoretoast=OFF + set(SnoreNotifyWindowsToast_STATIC_LIB ${SN_PREFIX}/lib${SN_LIBPATHSUFFIX}/${CMAKE_STATIC_LIBRARY_PREFIX}snore_backend_windowstoast${CMAKE_STATIC_LIBRARY_SUFFIX}) + + set(SnoreNotify_LIBS ${SnoreNotifyWindowsToast_STATIC_LIB}) + + set(SnoreNotify_CMAKE_ARGS -DMINGW=1 -DBUILD_osxnotificationcenter=OFF -DBUILD_sound=OFF -DBUILD_speech=OFF -DBUILD_toasty=OFF -DBUILD_freedesktop_backend=OFF -DBUILD_snarl=OFF -DBUILD_growl=OFF -DBUILD_trayicon=OFF -DBUILD_pushover_backend=OFF) endif() @@ -66,7 +70,7 @@ ExternalProject_Add(SnoreNotify_ep GIT_REPOSITORY https://github.com/status-im/snorenotify.git CMAKE_ARGS ${SnoreNotify_CMAKE_ARGS} BUILD_BYPRODUCTS ${SnoreNotify_STATIC_LIB} ${SnoreNotify_LIBS} ${SnoreNotifyBackend_STATIC_LIB} - ${SnoreNotifyBackendSettings_STATIC_LIB} ${SnoreNotifySettings_STATIC_LIB} + ${SnoreNotifyBackendSettings_STATIC_LIB} ${SnoreNotifySettings_STATIC_LIB} LOG_DOWNLOAD 1 ) diff --git a/modules/react-native-desktop-notification/desktop/desktopnotification.cpp b/modules/react-native-desktop-notification/desktop/desktopnotification.cpp index 91ae7eba24..1b7be25e47 100644 --- a/modules/react-native-desktop-notification/desktop/desktopnotification.cpp +++ b/modules/react-native-desktop-notification/desktop/desktopnotification.cpp @@ -24,12 +24,16 @@ Q_LOGGING_CATEGORY(NOTIFICATION, "RCTNotification") -#ifdef Q_OS_LINUX +#if defined(Q_OS_LINUX) || defined(Q_OS_WIN) namespace SnorePlugin {} using namespace SnorePlugin; +#if defined(Q_OS_LINUX) Q_IMPORT_PLUGIN(Freedesktop) +#elif defined(Q_OS_WIN) +Q_IMPORT_PLUGIN(WindowsToast) +#endif Q_IMPORT_PLUGIN(Snore) static void loadSnoreResources() @@ -43,7 +47,7 @@ static void loadSnoreResources() } Q_COREAPP_STARTUP_FUNCTION(loadSnoreResources) -#endif // Q_OS_LINUX +#endif // defined(Q_OS_LINUX) || defined(Q_OS_WIN) namespace { struct RegisterQMLMetaType { @@ -74,6 +78,7 @@ DesktopNotification::DesktopNotification(QObject *parent) Snore::Icon icon(":/icon.png"); d_ptr->snoreApp = Snore::Application(QCoreApplication::applicationName(), icon); + d_ptr->snoreApp.hints().setValue("windows-app-id", "StatusIm.Status.Desktop.1"); d_ptr->snoreApp.addAlert(Snore::Alert(NewMessageAlert, icon)); Snore::SnoreCore::instance().registerApplication(d_ptr->snoreApp); diff --git a/scripts/build-desktop.sh b/scripts/build-desktop.sh index 90a0cb6efd..b0df8a07b5 100755 --- a/scripts/build-desktop.sh +++ b/scripts/build-desktop.sh @@ -228,10 +228,8 @@ function bundleWindows() { pushd Windows cp $STATUSREACTPATH/.env . mkdir -p assets/resources notifier - cp $STATUSREACTPATH/node_modules/node-notifier/vendor/notifu/*.exe \ - notifier/ - cp $STATUSREACTPATH/node_modules/node-notifier/vendor/snoreToast/SnoreToast.exe \ - . + cp $STATUSREACTPATH/node_modules/node-notifier/vendor/snoreToast/SnoreToast.exe . + cp $STATUSREACTPATH/node_modules/node-notifier/vendor/notifu/*.exe notifier/ cp -r $STATUSREACTPATH/resources/fonts \ $STATUSREACTPATH/resources/icons \ $STATUSREACTPATH/resources/images \