diff --git a/desktop/addons/windows-pushnotifications/.gitignore b/desktop/addons/windows-pushnotifications/.gitignore new file mode 100644 --- /dev/null +++ b/desktop/addons/windows-pushnotifications/.gitignore @@ -0,0 +1,2 @@ +build/ +Microsoft.WindowsAppSDK.*/ diff --git a/desktop/addons/windows-pushnotifications/_nodert_generated.cpp b/desktop/addons/windows-pushnotifications/_nodert_generated.cpp --- a/desktop/addons/windows-pushnotifications/_nodert_generated.cpp +++ b/desktop/addons/windows-pushnotifications/_nodert_generated.cpp @@ -27,6 +27,9 @@ #include "OpaqueWrapper.h" #include "WrapperBase.h" +#include "Microsoft.WindowsAppSDK.1.2.221109.1\include\WindowsAppSDK-VersionInfo.h" +#include "Microsoft.WindowsAppSDK.1.2.221109.1\include\MddBootstrap.h" + #using < Microsoft.Windows.PushNotifications.WinMD> // this undefs fixes the issues of compiling Windows.Data.Json, Windows.Storag.FileProperties, and Windows.Stroage.Search @@ -419,7 +422,7 @@ try { ::Windows::Foundation::Uri ^ result = wrapper->_instance->Uri; - info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Foundation", "Uri", result)); + info.GetReturnValue().Set(NodeRT::Utils::NewString(result->ToString()->Data())); return; } catch (Platform::Exception ^ exception) @@ -1650,6 +1653,13 @@ } */ + PACKAGE_VERSION version; + version.Version = Microsoft::WindowsAppSDK::Runtime::Version::UInt64; + if (FAILED(MddBootstrapInitialize(Microsoft::WindowsAppSDK::Release::MajorMinor, Microsoft::WindowsAppSDK::Release::VersionTag, version))) + { + throw std::exception("Error in Bootstrap initialization"); + } + NodeRT::Microsoft::Windows::PushNotifications::InitPushNotificationChannelStatusEnum(target); NodeRT::Microsoft::Windows::PushNotifications::InitPushNotificationChannel(target); NodeRT::Microsoft::Windows::PushNotifications::InitPushNotificationCreateChannelResult(target); diff --git a/desktop/addons/windows-pushnotifications/binding.gyp b/desktop/addons/windows-pushnotifications/binding.gyp --- a/desktop/addons/windows-pushnotifications/binding.gyp +++ b/desktop/addons/windows-pushnotifications/binding.gyp @@ -1,43 +1,36 @@ { - "variables": { - "USE_ADDITIONAL_WINMD": "true" - }, "includes": ["common.gypi"], "targets": [{ "target_name": "binding", - "sources": [], "include_dirs": [ " + + + diff --git a/desktop/addons/windows-pushnotifications/preinstall.sh b/desktop/addons/windows-pushnotifications/preinstall.sh new file mode 100644 --- /dev/null +++ b/desktop/addons/windows-pushnotifications/preinstall.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -Eeuo pipefail + +if ! [[ "$OSTYPE" == 'msys' ]]; then + exit 1 +fi + +nuget install \ No newline at end of file diff --git a/desktop/package.json b/desktop/package.json --- a/desktop/package.json +++ b/desktop/package.json @@ -22,6 +22,9 @@ "dependencies": { "@babel/runtime": "^7.20.1" }, + "optionalDependencies": { + "@commapp/windowspush": "file:addons/windows-pushnotifications" + }, "devDependencies": { "@babel/core": "^7.13.14", "@babel/plugin-proposal-class-properties": "^7.13.0", diff --git a/keyserver/Dockerfile b/keyserver/Dockerfile --- a/keyserver/Dockerfile +++ b/keyserver/Dockerfile @@ -116,6 +116,8 @@ COPY --chown=comm native/package.json native/.flowconfig native/ COPY --chown=comm landing/package.json landing/.flowconfig landing/ COPY --chown=comm desktop/package.json desktop/ +COPY --chown=comm desktop/addons/windows-pushnotifications/package.json \ + desktop/addons/windows-pushnotifications/ COPY --chown=comm keyserver/addons/rust-node-addon/package.json \ keyserver/addons/rust-node-addon/install_ci_deps.sh \ keyserver/addons/rust-node-addon/postinstall.sh \ diff --git a/yarn.lock b/yarn.lock --- a/yarn.lock +++ b/yarn.lock @@ -1734,6 +1734,11 @@ resolved "https://registry.yarnpkg.com/@commapp/sqlcipher-amalgamation/-/sqlcipher-amalgamation-4.4.3-a.tgz#39c297132b9ad02358bf022a164bfc03292ecce1" integrity sha512-nPu0ZpvfqzxudOMi2bE3g9LdR80RLovcwrYhhFVfWCQQZqkVgUpOOqG1U647d06kz/P9hZRdFktnEqRua+RqBQ== +"@commapp/windowspush@file:desktop/addons/windows-pushnotifications": + version "0.0.1" + dependencies: + nan "2.17.0" + "@discoveryjs/json-ext@^0.5.0": version "0.5.7" resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz#1d572bfbbe14b7704e0ba0f39b74815b84870d70" @@ -17152,16 +17157,16 @@ dependencies: lru-cache "^4.1.3" +nan@2.17.0, nan@^2.4.0: + version "2.17.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.17.0.tgz#c0150a2368a182f033e9aa5195ec76ea41a199cb" + integrity sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ== + nan@^2.12.1: version "2.14.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== -nan@^2.4.0: - version "2.17.0" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.17.0.tgz#c0150a2368a182f033e9aa5195ec76ea41a199cb" - integrity sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ== - nanoid@^2.0.0: version "2.1.11" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-2.1.11.tgz#ec24b8a758d591561531b4176a01e3ab4f0f0280"