Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AppXManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<Logo>assets\StoreLogo.png</Logo>
</Properties>
<Resources>
<Resource Language="en-us" />
<Resource Language="en" />
</Resources>
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14316.0" MaxVersionTested="10.0.14316.0" />
Expand Down
Binary file modified resources/desktop/StoreLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 28 additions & 12 deletions www/core/components/emulator/services/localnotif.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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, {
Expand All @@ -592,7 +608,7 @@ angular.module('mm.core.emulator')

// Listen for click events.
notifInstance.onclick = function() {
$rootScope.$broadcast('$cordovaLocalNotification:click', notification, 'foreground');
notificationClicked(notification);
};
}
}
Expand Down
11 changes: 10 additions & 1 deletion www/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function createWindow() {

mainWindow.once('ready-to-show', () => {
mainWindow.show();
mainWindow.maximize();
});

// Emitted when the window is closed.
Expand Down Expand Up @@ -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.
}
}

Expand All @@ -124,3 +131,5 @@ ipcMain.on('closeSecondaryWindows', () => {
}
}
});

ipcMain.on('focusApp', focusApp);