Set parent window for about/new version, escape to close (#1795)
* Set parent window for about/new version, escape to close * Exclude jquery from jshint run
This commit is contained in:
parent
158b575885
commit
1c455c83e0
6 changed files with 9241 additions and 6 deletions
|
@ -96,6 +96,7 @@ module.exports = function(grunt) {
|
||||||
files: [
|
files: [
|
||||||
'Gruntfile.js',
|
'Gruntfile.js',
|
||||||
'js/**/*.js',
|
'js/**/*.js',
|
||||||
|
'!js/jquery.js',
|
||||||
'!js/libtextsecure.js',
|
'!js/libtextsecure.js',
|
||||||
'!js/WebAudioRecorderMp3.js',
|
'!js/WebAudioRecorderMp3.js',
|
||||||
'!js/Mp3LameEncoder.min.js',
|
'!js/Mp3LameEncoder.min.js',
|
||||||
|
@ -131,6 +132,9 @@ module.exports = function(grunt) {
|
||||||
}, {
|
}, {
|
||||||
src: 'components/webaudiorecorder/lib/WebAudioRecorderMp3.js',
|
src: 'components/webaudiorecorder/lib/WebAudioRecorderMp3.js',
|
||||||
dest: 'js/WebAudioRecorderMp3.js'
|
dest: 'js/WebAudioRecorderMp3.js'
|
||||||
|
}, {
|
||||||
|
src: 'components/jquery/dist/jquery.js',
|
||||||
|
dest: 'js/jquery.js'
|
||||||
}],
|
}],
|
||||||
},
|
},
|
||||||
res: {
|
res: {
|
||||||
|
|
10
about.html
10
about.html
|
@ -34,6 +34,16 @@ a {
|
||||||
<a href="https://signal.org">signal.org</a>
|
<a href="https://signal.org">signal.org</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script type='text/javascript' src='js/jquery.js'></script>
|
||||||
|
<script>
|
||||||
|
$(document).on('keyup', function(e) {
|
||||||
|
if (e.keyCode === 27) {
|
||||||
|
window.closeAbout();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -19,7 +19,7 @@ function checkForUpdates() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var showingDialog = false;
|
var showingDialog = false;
|
||||||
function showUpdateDialog(messages) {
|
function showUpdateDialog(mainWindow, messages) {
|
||||||
if (showingDialog) {
|
if (showingDialog) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ function showUpdateDialog(messages) {
|
||||||
cancelId: LATER_BUTTON
|
cancelId: LATER_BUTTON
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog.showMessageBox(options, function(response) {
|
dialog.showMessageBox(mainWindow, options, function(response) {
|
||||||
if (response == RESTART_BUTTON) {
|
if (response == RESTART_BUTTON) {
|
||||||
windowState.markShouldQuit();
|
windowState.markShouldQuit();
|
||||||
autoUpdater.quitAndInstall();
|
autoUpdater.quitAndInstall();
|
||||||
|
@ -52,7 +52,7 @@ function onError(error) {
|
||||||
console.log("Got an error while updating: ", error.stack);
|
console.log("Got an error while updating: ", error.stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
function initialize(messages) {
|
function initialize(getMainWindow, messages) {
|
||||||
if (!messages) {
|
if (!messages) {
|
||||||
throw new Error('auto-update initialize needs localized messages');
|
throw new Error('auto-update initialize needs localized messages');
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ function initialize(messages) {
|
||||||
}
|
}
|
||||||
|
|
||||||
autoUpdater.addListener('update-downloaded', function() {
|
autoUpdater.addListener('update-downloaded', function() {
|
||||||
showUpdateDialog(messages);
|
showUpdateDialog(getMainWindow(), messages);
|
||||||
});
|
});
|
||||||
autoUpdater.addListener('error', onError);
|
autoUpdater.addListener('error', onError);
|
||||||
|
|
||||||
|
|
9205
js/jquery.js
vendored
Normal file
9205
js/jquery.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
16
main.js
16
main.js
|
@ -22,6 +22,10 @@ app.setAppUserModelId('org.whispersystems.signal-desktop')
|
||||||
// be closed automatically when the JavaScript object is garbage collected.
|
// be closed automatically when the JavaScript object is garbage collected.
|
||||||
let mainWindow;
|
let mainWindow;
|
||||||
|
|
||||||
|
function getMainWindow() {
|
||||||
|
return mainWindow;
|
||||||
|
}
|
||||||
|
|
||||||
const config = require("./app/config");
|
const config = require("./app/config");
|
||||||
|
|
||||||
if (config.environment === 'production' && !process.mas) {
|
if (config.environment === 'production' && !process.mas) {
|
||||||
|
@ -241,7 +245,8 @@ function showAbout() {
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
nodeIntegration: false,
|
nodeIntegration: false,
|
||||||
preload: path.join(__dirname, 'preload.js')
|
preload: path.join(__dirname, 'preload.js')
|
||||||
}
|
},
|
||||||
|
parent: mainWindow,
|
||||||
};
|
};
|
||||||
|
|
||||||
aboutWindow = new BrowserWindow(options);
|
aboutWindow = new BrowserWindow(options);
|
||||||
|
@ -269,7 +274,7 @@ app.on('ready', function() {
|
||||||
locale = loadLocale();
|
locale = loadLocale();
|
||||||
}
|
}
|
||||||
|
|
||||||
autoUpdate.initialize(locale.messages);
|
autoUpdate.initialize(getMainWindow, locale.messages);
|
||||||
|
|
||||||
createWindow();
|
createWindow();
|
||||||
|
|
||||||
|
@ -342,3 +347,10 @@ ipc.on("set-auto-hide-menu-bar", function(event, autoHide) {
|
||||||
ipc.on("set-menu-bar-visibility", function(event, visibility) {
|
ipc.on("set-menu-bar-visibility", function(event, visibility) {
|
||||||
mainWindow.setMenuBarVisibility(visibility);
|
mainWindow.setMenuBarVisibility(visibility);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipc.on("close-about", function() {
|
||||||
|
if (aboutWindow) {
|
||||||
|
aboutWindow.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,10 @@
|
||||||
console.log('restart');
|
console.log('restart');
|
||||||
ipc.send('restart');
|
ipc.send('restart');
|
||||||
};
|
};
|
||||||
|
window.closeAbout = function() {
|
||||||
|
ipc.send('close-about');
|
||||||
|
};
|
||||||
|
|
||||||
ipc.on('debug-log', function() {
|
ipc.on('debug-log', function() {
|
||||||
Whisper.events.trigger('showDebugLog');
|
Whisper.events.trigger('showDebugLog');
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue