-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Windows 10 notifications by resolving snoretoast executable path
- Loading branch information
1 parent
560933e
commit 880d0ae
Showing
3 changed files
with
46 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,8 @@ import * as Sentry from '@sentry/electron' | |
import { app, BrowserWindow, Input, ipcMain, Menu, nativeImage, powerMonitor, shell, Tray } from 'electron' | ||
import { autoUpdater } from 'electron-updater' | ||
import isOnline from 'is-online' | ||
import * as notifier from 'node-notifier' | ||
import { WindowsToaster } from 'node-notifier' | ||
import * as os from 'os' | ||
import * as path from 'path' | ||
import * as si from 'systeminformation' | ||
import { Config } from './config' | ||
|
@@ -16,19 +17,32 @@ import { SaladBridgeNotificationService } from './salad-bowl/SaladBridgeNotifica | |
import { SaladBridge } from './SaladBridge' | ||
import { DefaultTheme as theme } from './SaladTheme' | ||
|
||
const appVersion = app.getVersion() | ||
// The path to the `/static` folder. This is provided by electron-webpack. | ||
declare const __static: string | ||
|
||
// Register to send Windows 10 notifications. | ||
app.setAppUserModelId('salad-technologies-desktop-app') | ||
|
||
// Capture unhandled errors. | ||
Sentry.init({ | ||
dsn: 'https://[email protected]/1804227', | ||
release: appVersion, | ||
release: app.getVersion(), | ||
}) | ||
|
||
/** Path to the /static folder. Provided via electron-webpack */ | ||
declare const __static: string | ||
|
||
//Overrides the console.log behavior | ||
// Redirect `console` to the application log file. | ||
Logger.connect() | ||
|
||
// Ensure we have the correct path to `snoretoast.exe`. Note: Kyle _hates_ this. | ||
var notifier = new WindowsToaster({ | ||
withFallback: false, | ||
customPath: path | ||
.resolve( | ||
app.getAppPath(), | ||
'node_modules/node-notifier/vendor/snoreToast/snoretoast-x' + (os.arch() === 'x64' ? '64' : '86') + '.exe', | ||
) | ||
.replace('app.asar', 'app.asar.unpacked'), | ||
}) | ||
|
||
const AutoLaunch = require('auto-launch') | ||
|
||
const getDesktopVersion = 'get-desktop-version' | ||
|
@@ -392,11 +406,6 @@ const checkForUpdates = () => { | |
} | ||
|
||
const onReady = async () => { | ||
// TODO: Determine if this is necessary to get Windows 10 notifications working. | ||
// if (process.platform === 'win32') { | ||
// app.setAppUserModelId('salad-technologies-desktop-app') | ||
// } | ||
|
||
if (await isOnline({ timeout: 10000 })) { | ||
createMainWindow() | ||
checkForUpdates() | ||
|
@@ -434,7 +443,7 @@ const cleanExit = () => { | |
|
||
process.on('SIGINT', cleanExit) // catch ctrl-c | ||
process.on('SIGTERM', cleanExit) // catch kill | ||
console.log(`Running ${app.name} ${appVersion}`) | ||
console.log(`Running ${app.name} ${app.getVersion()}`) | ||
|
||
function createSystemTrayMenu(isVisible: boolean): Menu { | ||
return Menu.buildFromTemplate([ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -796,9 +796,9 @@ | |
semver "^5.5.0" | ||
|
||
"@babel/preset-modules@^0.1.3": | ||
version "0.1.3" | ||
resolved "https://registry.yarnpkg.com/@babel/preset-modules/-/preset-modules-0.1.3.tgz#13242b53b5ef8c883c3cf7dddd55b36ce80fbc72" | ||
integrity sha512-Ra3JXOHBq2xd56xSF7lMKXdjBn3T772Y1Wet3yWnkDly9zHvJki029tAFzvAAK5cf4YV3yoxuP61crYRol6SVg== | ||
version "0.1.4" | ||
resolved "https://registry.yarnpkg.com/@babel/preset-modules/-/preset-modules-0.1.4.tgz#362f2b68c662842970fdb5e254ffc8fc1c2e415e" | ||
integrity sha512-J36NhwnfdzpmH41M1DrnkkgAqhZaqr/NBdPfQ677mLzlaXo+oDiv1deyCDtgAhz8p328otdob0Du7+xgHGZbKg== | ||
dependencies: | ||
"@babel/helper-plugin-utils" "^7.0.0" | ||
"@babel/plugin-proposal-unicode-property-regex" "^7.4.4" | ||
|
@@ -1040,10 +1040,10 @@ | |
dependencies: | ||
"@types/node" "*" | ||
|
||
"@types/node@*", "@types/[email protected].0": | ||
version "14.6.0" | ||
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.6.0.tgz#7d4411bf5157339337d7cff864d9ff45f177b499" | ||
integrity sha512-mikldZQitV94akrc4sCcSjtJfsTKt4p+e/s0AGscVA6XArQ9kFclP+ZiYUMnq987rc6QlYxXv/EivqlfSLxpKA== | ||
"@types/node@*", "@types/[email protected].1": | ||
version "14.6.1" | ||
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.6.1.tgz#fdf6f6c6c73d3d8eee9c98a9a0485bc524b048d7" | ||
integrity sha512-HnYlg/BRF8uC1FyKRFZwRaCPTPYKa+6I8QiUZFLredaGOou481cgFS4wKRFyKvQtX8xudqkSdBczJHIYSQYKrQ== | ||
|
||
"@types/node@^12.0.12": | ||
version "12.12.54" | ||
|
@@ -2844,9 +2844,9 @@ [email protected]: | |
chokidar "^3.0.2" | ||
|
||
electron-to-chromium@^1.3.523: | ||
version "1.3.549" | ||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.549.tgz#bf500c8eb75a7286a895e34f41aa144384ac613b" | ||
integrity sha512-q09qZdginlqDH3+Y1P6ch5UDTW8nZ1ijwMkxFs15J/DAWOwqolIx8HZH1UP0vReByBigk/dPlU22xS1MaZ+kpQ== | ||
version "1.3.552" | ||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.552.tgz#6a50736f155f9666501839c8e134ea28a5c80b84" | ||
integrity sha512-8K28xz8WRBZw/tmP7W3bTC3M5RI58QyS4O7uX7m2zxLKniMO79CNg5wkuRw2Qya621Cuqa3pCGs3FHZptltB1Q== | ||
|
||
[email protected]: | ||
version "4.3.4" | ||
|
@@ -2915,10 +2915,10 @@ [email protected]: | |
webpack-merge "^4.2.2" | ||
yargs "^15.3.1" | ||
|
||
[email protected].0: | ||
version "10.0.0" | ||
resolved "https://registry.yarnpkg.com/electron/-/electron-10.0.0.tgz#4e777612ead76b39bc7241c7749bf6b0ece47889" | ||
integrity sha512-0XX/LqYAHHCSbfLjUk9VRDPOeYjDPEzA9i7F50AqpEpFIWR2bp++0S0beRANUpPdkvtBDp+0R6vHV3iXPvuKyA== | ||
[email protected].1: | ||
version "10.0.1" | ||
resolved "https://registry.yarnpkg.com/electron/-/electron-10.0.1.tgz#96ff885007ea72397a35ef9617f802b5101be7a9" | ||
integrity sha512-BXJzajuLMYJNnmAOJffjEjz1Mi1cQCaF+P7FgLsrKFMCacgCqmiLLigjrVoZwmbTuHuD4nLkD5lmhXiIhC3g2g== | ||
dependencies: | ||
"@electron/get" "^1.0.1" | ||
"@types/node" "^12.0.12" | ||
|
@@ -3094,9 +3094,9 @@ etag@~1.8.1: | |
integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= | ||
|
||
eventemitter3@^4.0.0: | ||
version "4.0.6" | ||
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.6.tgz#1258f6fa51b4908aadc2cd624fcd6e64f99f49d6" | ||
integrity sha512-s3GJL04SQoM+gn2c14oyqxvZ3Pcq7cduSDqy3sBFXx6UPSUmgVYwQM9zwkTn9je0lrfg0gHEwR42pF3Q2dCQkQ== | ||
version "4.0.7" | ||
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" | ||
integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== | ||
|
||
events@^3.0.0: | ||
version "3.2.0" | ||
|
@@ -6792,10 +6792,10 @@ ts-loader@^6.2.2: | |
micromatch "^4.0.0" | ||
semver "^6.0.0" | ||
|
||
[email protected].2: | ||
version "6.2.2" | ||
resolved "https://registry.yarnpkg.com/ts-unused-exports/-/ts-unused-exports-6.2.2.tgz#f9727d8c66724b27d790e33d28b1cf509214b5a1" | ||
integrity sha512-7EIUM1QAmtJyr3PtI0eaGlbJ29RxcenhX59MSrbEVV4mQxukiVepj5u42z4h/tJwzd1drQRFbQD9/1vKKslF+Q== | ||
[email protected].3: | ||
version "6.2.3" | ||
resolved "https://registry.yarnpkg.com/ts-unused-exports/-/ts-unused-exports-6.2.3.tgz#788e6f53051a5331b6edf0713f6ff5e3115b0152" | ||
integrity sha512-ry0g8Cw6I68s9qJdUcI/b/vSSetFvM6rfoGqy3k5NlTzVHQWtq4Mfi4tgnESyXIrasTZqRWDPICWOwS12Nrbtg== | ||
dependencies: | ||
chalk "^3.0.0" | ||
tsconfig-paths "^3.9.0" | ||
|