Making it running for Windows (Part 1)

This commit is contained in:
WolverinDEV 2019-09-01 21:18:54 +02:00
parent 73be094ef3
commit 7888227ec9
7 changed files with 27 additions and 31 deletions

2
github

@ -1 +1 @@
Subproject commit 2dd1f60e8d034a68bbca9afe294070c8a83caa9e
Subproject commit 06391c6cdd772c2f83c1387960f7224f7cd9f514

View File

@ -834,8 +834,8 @@ async function check_update(channel: string) {
"\n" +
"Current version: " + (await current_version()).toString() + "\n" +
"Target version: " + version.version.toString()
} as MessageBoxOptions, result => {
if(result == 0) {
} as MessageBoxOptions).then(result => {
if(result.response == 0) {
execute_graphical(channel, false).then(() => {
update_question_open = false;
});

View File

@ -13,23 +13,23 @@ import {open_preview} from "./url-preview";
async function execute_app() {
/* legacy, will be removed soon */
if(process_args.has_value("update-failed")) {
const result = electron.dialog.showMessageBox({
const result = await electron.dialog.showMessageBox({
type: "error",
message: "Failed to execute update:\n" + process_args.value("update-failed"),
title: "Update failed!",
buttons: ["retry", "ignore"]
} as MessageBoxOptions);
if(result == 0)
if(result.response == 0)
if(await app_updater.execute_graphical(await app_updater.selected_channel(), false))
return;
} else if(process_args.has_value("update-succeed")) {
const result = electron.dialog.showMessageBox({
const result = await electron.dialog.showMessageBox({
type: "info",
message: "Update successfully installed!\nShould we launch TeaClient?",
title: "Update succeeded!",
buttons: ["yes", "no"]
} as MessageBoxOptions);
if(result != 0) {
if(result.response != 0) {
electron.app.exit(0);
return; //Not really required here!
}
@ -141,14 +141,14 @@ async function execute_app() {
callback: async () => true
});
const result = await new Promise<number>(resolve => electron.dialog.showMessageBox({
const result = await electron.dialog.showMessageBox({
type: type,
message: message,
title: title,
buttons: buttons.map(e => e.key)
} as MessageBoxOptions, resolve));
if(buttons[result].callback) {
if(await buttons[result].callback())
} as MessageBoxOptions);
if(buttons[result.response].callback) {
if(await buttons[result.response].callback())
return;
}
}

View File

@ -436,7 +436,7 @@ export async function load_files(channel: string, static_cb: (message: string, i
if(ui_vers.newer_than(await current_version())) {
const local_available = cache && cache.local_index ? ui_pack_exists(cache.local_index) : undefined;
const result = electron.dialog.showMessageBox({
const result = await electron.dialog.showMessageBox({
type: "question",
message:
"Local client is outdated.\n" +
@ -445,7 +445,7 @@ export async function load_files(channel: string, static_cb: (message: string, i
title: "Client outdated!",
buttons: ["yes", local_available ? "ignore and use last possible (" + cache.local_index.version + ")" : "close client"]
} as MessageBoxOptions);
if(result == 0) {
if(result.response == 0) {
await execute_graphical(channel, true);
throw "client outdated";
} else {

View File

@ -68,6 +68,8 @@ export function handle_crash_callback(args: string[]) {
app.on('window-all-closed', () => {
process.exit(0);
});
crash_window.focus();
});
}

View File

@ -82,18 +82,12 @@ export const initialize = async () => {
if(process_args.has_value(Arguments.DUMMY_CRASH_RENDERER))
crash_handler.handler.crash();
if(!process_args.has_flag(Arguments.DEBUG)) {
window.open_connected_question = () => {
return new Promise(resolve => {
remote.dialog.showMessageBox(remote.getCurrentWindow(), {
type: 'question',
buttons: ['Yes', 'No'],
title: 'Confirm',
message: 'Are you really sure?\nYou\'re still connected!'
}, choice => {
resolve(choice === 0);
});
});
};
window.open_connected_question = () => remote.dialog.showMessageBox(remote.getCurrentWindow(), {
type: 'question',
buttons: ['Yes', 'No'],
title: 'Confirm',
message: 'Are you really sure?\nYou\'re still connected!'
}).then(result => result.response === 0);
}
},
priority: 110

View File

@ -26,7 +26,7 @@
"@types/ejs": "^2.6.3",
"@types/electron-packager": "8.7.2",
"@types/fs-extra": "^8.0.0",
"@types/jquery": "^3.3.30",
"@types/jquery": "^3.3.31",
"@types/request": "^2.48.2",
"@types/request-promise": "^4.1.44",
"@types/tar-stream": "^1.6.1",
@ -36,8 +36,8 @@
"electron-packager": "8.7.2",
"nodemon": "^1.19.1",
"platform-dependent-modules": "0.0.14",
"sass": "^1.22.7",
"typescript": "^3.5.3"
"sass": "^1.22.10",
"typescript": "^3.6.2"
},
"dependencies": {
"@types/minimist": "^1.2.0",
@ -50,7 +50,7 @@
"electron": "6.0.7",
"electron-installer-windows": "^1.1.1",
"electron-navigation": "^1.5.8",
"electron-rebuild": "^1.8.5",
"electron-rebuild": "^1.8.6",
"electron-winstaller": "^2.7.0",
"electron-wix-msi": "^2.1.1",
"extend": "^3.0.2",
@ -60,11 +60,11 @@
"jquery": "^3.4.1",
"json-stringify-safe": "^5.0.1",
"jsprim": "^2.0.0",
"jsrender": "^1.0.3",
"jsrender": "^1.0.4",
"nan": "^2.14.0",
"node-ssh": "^6.0.0",
"only": "0.0.2",
"psl": "^1.2.0",
"psl": "^1.3.0",
"pure-uuid": "^1.5.7",
"rc": "^1.2.8",
"rcedit": "^1.1.2",