Skip to content

Commit

Permalink
Adding a possible fix to @mentions not working when edge user agent s…
Browse files Browse the repository at this point in the history
…elected. Need to test it tomorrow at work before releasing
  • Loading branch information
IsmaelMartinez committed Oct 28, 2018
1 parent 23837a0 commit 5c34e23
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
12 changes: 5 additions & 7 deletions app/lib/browser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
const path = require('path');
const { ipcRenderer } = require('electron');
const trayNotifications = require('./tray-notifications');
// const nativeNotifications = require('./native-notifications');
require('./zoom')();

const iconPath = path.join(__dirname, '../assets/icons/icon-96x96.png');
Expand All @@ -14,10 +13,9 @@
iconPath
});

// document.addEventListener(
// 'DOMContentLoaded',
// nativeNotifications({
// ipc: ipcRenderer,
// iconPath
// }));
//change userAgent to chrome to fix the issue of notifications disapearing.
document.addEventListener(
'DOMContentLoaded',
navigator.__defineGetter__('userAgent', () => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36')
);
})();
4 changes: 2 additions & 2 deletions app/lib/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ function argv(configPath) {
userAgent: {
describe: 'HTTP User Agent',
type: 'string',
default: 'chrome'
default: 'edge'
},
edgeUserAgent: {
describe: 'Microsoft Edge User Agent',
type: 'string',
default:
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134'
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/12.246'
},
chromeUserAgent: {
describe: 'Google Chrome User Agent',
Expand Down
8 changes: 4 additions & 4 deletions app/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ app.on('ready', () => {

ipcMain.on('notifications', async (e, msg) => {
if (msg.count > 0) {
const body = "(" + msg.count + ")" + ((msg.text) ? ": " + msg.text : "");
const body = ((msg.text) ? "(" + msg.count + "): " + msg.text : "You got " + msg.count + " notification(s)");
const notification = new NativeNotification(
"Microsoft Teams",
{
Expand Down Expand Up @@ -93,13 +93,13 @@ app.on('ready', () => {
app.exit(0);
}
});

if (config.userAgent === 'edge') {
window.webContents.setUserAgent(config.edgeUserAgent);
} else {
window.webContents.setUserAgent(config.chromeUserAgent);
}

}
window.once('ready-to-show', () => window.show());

window.webContents.on('did-finish-load', function () {
Expand Down

0 comments on commit 5c34e23

Please sign in to comment.