Browse Source

Fix: Skype not loading and issues with badges and notifications

pull/2574/head
Vulich Fernando 6 years ago
parent
commit
30d93831df
  1. 61
      app/ux/WebView.js

61
app/ux/WebView.js

@ -456,6 +456,7 @@ Ext.define('Rambox.ux.WebView',{
e.preventDefault(); e.preventDefault();
}); });
let eventsOnDom = false;
webview.addEventListener("dom-ready", function(e) { webview.addEventListener("dom-ready", function(e) {
// Mute Webview // Mute Webview
if ( me.record.get('muted') || localStorage.getItem('locked') || JSON.parse(localStorage.getItem('dontDisturb')) ) me.setAudioMuted(true, true); if ( me.record.get('muted') || localStorage.getItem('locked') || JSON.parse(localStorage.getItem('dontDisturb')) ) me.setAudioMuted(true, true);
@ -501,38 +502,40 @@ Ext.define('Rambox.ux.WebView',{
}); });
me.down('statusbar').down('button').show(); me.down('statusbar').down('button').show();
}); });
if (!eventsOnDom) {
webview.getWebContents().on('before-input-event', (event, input) => {
if (input.type !== 'keyDown') return;
var modifiers = [];
if ( input.shift ) modifiers.push('shift');
if ( input.control ) modifiers.push('control');
if ( input.alt ) modifiers.push('alt');
if ( input.meta ) modifiers.push('meta');
if ( input.isAutoRepeat ) modifiers.push('isAutoRepeat');
if ( input.key === 'Tab' && !(modifiers && modifiers.length) ) return;
// Maps special keys to fire the correct event in Mac OS
if ( require('electron').remote.process.platform === 'darwin' ) {
var keys = [];
keys['ƒ'] = 'f'; // Search
keys[' '] = 'l'; // Lock
input.key = keys[input.key] ? keys[input.key] : input.key;
}
webview.executeJavaScript(js_inject).then(result => {} ).catch(err => { console.log(err) }) if ( input.key === 'F11' || input.key === 'F12' || input.key === 'q' || (input.key === 'F1' && modifiers.includes('control'))) return;
});
webview.getWebContents().on('before-input-event', (event, input) => {
if (input.type !== 'keyDown') return;
var modifiers = [];
if ( input.shift ) modifiers.push('shift');
if ( input.control ) modifiers.push('control');
if ( input.alt ) modifiers.push('alt');
if ( input.meta ) modifiers.push('meta');
if ( input.isAutoRepeat ) modifiers.push('isAutoRepeat');
if ( input.key === 'Tab' && !(modifiers && modifiers.length) ) return;
// Maps special keys to fire the correct event in Mac OS
if ( require('electron').remote.process.platform === 'darwin' ) {
var keys = [];
keys['ƒ'] = 'f'; // Search
keys[' '] = 'l'; // Lock
input.key = keys[input.key] ? keys[input.key] : input.key; require('electron').remote.getCurrentWebContents().sendInputEvent({
type: input.type,
keyCode: input.key,
modifiers: modifiers
});
})
eventsOnDom = true;
} }
webview.executeJavaScript(js_inject).then(result => {} ).catch(err => { console.log(err) })
if ( input.key === 'F11' || input.key === 'F12' || input.key === 'q' || (input.key === 'F1' && modifiers.includes('control'))) return; });
require('electron').remote.getCurrentWebContents().sendInputEvent({
type: input.type,
keyCode: input.key,
modifiers: modifiers
});
})
webview.addEventListener('ipc-message', function(event) { webview.addEventListener('ipc-message', function(event) {
var channel = event.channel; var channel = event.channel;

Loading…
Cancel
Save