mirror of
https://github.com/JannisX11/blockbench.git
synced 2024-11-27 04:21:46 +08:00
Add message box with instructions before updating
This commit is contained in:
parent
9fce77c389
commit
7744d48f6b
@ -191,7 +191,7 @@ const Blockbench = {
|
||||
}
|
||||
},
|
||||
showMessageBox(options = 0, cb) {
|
||||
new MessageBox(options, cb).show();
|
||||
return new MessageBox(options, cb).show();
|
||||
},
|
||||
async textPrompt(title, value, callback, placeholder = null) {
|
||||
let answer = await new Promise((resolve) => {
|
||||
|
@ -648,10 +648,20 @@ window.onbeforeunload = function (event) {
|
||||
}
|
||||
}
|
||||
|
||||
function closeBlockbenchWindow() {
|
||||
async function closeBlockbenchWindow() {
|
||||
for (let project of ModelProject.all.slice()) {
|
||||
project.closeOnQuit();
|
||||
}
|
||||
if (Blockbench.hasFlag('update_downloaded')) {
|
||||
await new Promise(resolve => {
|
||||
Blockbench.showMessageBox({
|
||||
title: 'message.installing_update.title',
|
||||
message: tl('message.installing_update.message', '60'),
|
||||
icon: 'update',
|
||||
width: 534
|
||||
}, resolve);
|
||||
})
|
||||
}
|
||||
window.onbeforeunload = null;
|
||||
Blockbench.addFlag('allow_closing');
|
||||
Blockbench.dispatchEvent('before_closing')
|
||||
@ -694,6 +704,7 @@ ipcRenderer.on('update-available', (event, arg) => {
|
||||
console.error(err);
|
||||
})
|
||||
ipcRenderer.on('update-downloaded', (event) => {
|
||||
Blockbench.addFlag('update_downloaded');
|
||||
action.setName(tl('message.update_after_restart'));
|
||||
MenuBar.menus.help.removeAction(action);
|
||||
icon_node.textContent = 'done';
|
||||
|
@ -290,6 +290,8 @@
|
||||
"message.update_notification.title": "Could not Install Update",
|
||||
"message.update_notification.message": "A new Blockbench version is available. Please enable Automatic Updates in the settings in order to update!",
|
||||
"message.update_after_restart": "The update will be installed after the next restart",
|
||||
"message.installing_update.title": "Update Available",
|
||||
"message.installing_update.message": "A new version is ready to be installed. After closing the app, please allow for around %0 seconds before opening Blockbench again or turning off the computer, for the update to be installed.",
|
||||
"message.import_particle_texture.import": "Import Particle Texture",
|
||||
"message.import_particle_texture.message": "Would you like to import a texture file to be used for your particle?",
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user