diff --git a/AppXManifest.xml b/AppXManifest.xml index d525ac270d7..d31855a1b76 100644 --- a/AppXManifest.xml +++ b/AppXManifest.xml @@ -14,7 +14,7 @@ assets\StoreLogo.png - + diff --git a/resources/desktop/StoreLogo.png b/resources/desktop/StoreLogo.png index 4061075bcf3..fa5cebb178b 100644 Binary files a/resources/desktop/StoreLogo.png and b/resources/desktop/StoreLogo.png differ diff --git a/www/core/components/emulator/services/localnotif.js b/www/core/components/emulator/services/localnotif.js index 9ad132cad7f..54b45ba1215 100644 --- a/www/core/components/emulator/services/localnotif.js +++ b/www/core/components/emulator/services/localnotif.js @@ -488,6 +488,18 @@ angular.module('mm.core.emulator') return options; } + /** + * Function called when a notification is clicked. + * + * @param {Object} notification Clicked notification. + * @return {Void} + */ + function notificationClicked(notification) { + $rootScope.$broadcast('$cordovaLocalNotification:click', notification, 'foreground'); + // Focus the app. + require('electron').ipcRenderer.send('focusApp'); + } + /** * Parse a interval and convert it to a number of milliseconds (0 if not valid). * Code extracted from the Cordova plugin. @@ -570,20 +582,24 @@ angular.module('mm.core.emulator') // Listen for click events. notifInstance.on('activated', function() { - $rootScope.$broadcast('$cordovaLocalNotification:click', notification, 'foreground'); + notificationClicked(notification); }); - notifInstance.show() - - // Show it in Tile too. - var tileNotif = new winNotif.TileNotification({ - tag: notification.id + '', - template: tileTemplate, - strings: [notification.title, notification.text, notification.title, notification.text, notification.title, notification.text], - expirationTime: new Date(Date.now() + mmCoreSecondsHour * 1000) // Expire in 1 hour. - }) + notifInstance.show(); - tileNotif.show() + try { + // Show it in Tile too. + var tileNotif = new winNotif.TileNotification({ + tag: notification.id + '', + template: tileTemplate, + strings: [notification.title, notification.text, notification.title, notification.text, notification.title, notification.text], + expirationTime: new Date(Date.now() + mmCoreSecondsHour * 1000) // Expire in 1 hour. + }) + + tileNotif.show() + } catch(ex) { + $log.warn('Error showing TileNotification. Please notice they only work with the app installed.', ex); + } } else { // Use Electron default notifications. var notifInstance = new Notification(notification.title, { @@ -592,7 +608,7 @@ angular.module('mm.core.emulator') // Listen for click events. notifInstance.onclick = function() { - $rootScope.$broadcast('$cordovaLocalNotification:click', notification, 'foreground'); + notificationClicked(notification); }; } } diff --git a/www/electron.js b/www/electron.js index 9a354b1d504..9e149a52fac 100644 --- a/www/electron.js +++ b/www/electron.js @@ -41,6 +41,7 @@ function createWindow() { mainWindow.once('ready-to-show', () => { mainWindow.show(); + mainWindow.maximize(); }); // Emitted when the window is closed. @@ -102,12 +103,18 @@ if (shouldQuit) { function appLaunched(url) { // App was launched again with a URL. Focus the main window and send an event to treat the URL. + if (mainWindow) { + focusApp(); + mainWindow.webContents.send('mmAppLaunched', url); // Send an event to the main window. + } +} + +function focusApp() { if (mainWindow) { if (mainWindow.isMinimized()) { mainWindow.restore(); } mainWindow.focus(); - mainWindow.webContents.send('mmAppLaunched', url); // Send an event to the main window. } } @@ -124,3 +131,5 @@ ipcMain.on('closeSecondaryWindows', () => { } } }); + +ipcMain.on('focusApp', focusApp);