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" + "\n" +
"Current version: " + (await current_version()).toString() + "\n" + "Current version: " + (await current_version()).toString() + "\n" +
"Target version: " + version.version.toString() "Target version: " + version.version.toString()
} as MessageBoxOptions, result => { } as MessageBoxOptions).then(result => {
if(result == 0) { if(result.response == 0) {
execute_graphical(channel, false).then(() => { execute_graphical(channel, false).then(() => {
update_question_open = false; update_question_open = false;
}); });

View File

@ -13,23 +13,23 @@ import {open_preview} from "./url-preview";
async function execute_app() { async function execute_app() {
/* legacy, will be removed soon */ /* legacy, will be removed soon */
if(process_args.has_value("update-failed")) { if(process_args.has_value("update-failed")) {
const result = electron.dialog.showMessageBox({ const result = await electron.dialog.showMessageBox({
type: "error", type: "error",
message: "Failed to execute update:\n" + process_args.value("update-failed"), message: "Failed to execute update:\n" + process_args.value("update-failed"),
title: "Update failed!", title: "Update failed!",
buttons: ["retry", "ignore"] buttons: ["retry", "ignore"]
} as MessageBoxOptions); } as MessageBoxOptions);
if(result == 0) if(result.response == 0)
if(await app_updater.execute_graphical(await app_updater.selected_channel(), false)) if(await app_updater.execute_graphical(await app_updater.selected_channel(), false))
return; return;
} else if(process_args.has_value("update-succeed")) { } else if(process_args.has_value("update-succeed")) {
const result = electron.dialog.showMessageBox({ const result = await electron.dialog.showMessageBox({
type: "info", type: "info",
message: "Update successfully installed!\nShould we launch TeaClient?", message: "Update successfully installed!\nShould we launch TeaClient?",
title: "Update succeeded!", title: "Update succeeded!",
buttons: ["yes", "no"] buttons: ["yes", "no"]
} as MessageBoxOptions); } as MessageBoxOptions);
if(result != 0) { if(result.response != 0) {
electron.app.exit(0); electron.app.exit(0);
return; //Not really required here! return; //Not really required here!
} }
@ -141,14 +141,14 @@ async function execute_app() {
callback: async () => true callback: async () => true
}); });
const result = await new Promise<number>(resolve => electron.dialog.showMessageBox({ const result = await electron.dialog.showMessageBox({
type: type, type: type,
message: message, message: message,
title: title, title: title,
buttons: buttons.map(e => e.key) buttons: buttons.map(e => e.key)
} as MessageBoxOptions, resolve)); } as MessageBoxOptions);
if(buttons[result].callback) { if(buttons[result.response].callback) {
if(await buttons[result].callback()) if(await buttons[result.response].callback())
return; 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())) { if(ui_vers.newer_than(await current_version())) {
const local_available = cache && cache.local_index ? ui_pack_exists(cache.local_index) : undefined; 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", type: "question",
message: message:
"Local client is outdated.\n" + "Local client is outdated.\n" +
@ -445,7 +445,7 @@ export async function load_files(channel: string, static_cb: (message: string, i
title: "Client outdated!", title: "Client outdated!",
buttons: ["yes", local_available ? "ignore and use last possible (" + cache.local_index.version + ")" : "close client"] buttons: ["yes", local_available ? "ignore and use last possible (" + cache.local_index.version + ")" : "close client"]
} as MessageBoxOptions); } as MessageBoxOptions);
if(result == 0) { if(result.response == 0) {
await execute_graphical(channel, true); await execute_graphical(channel, true);
throw "client outdated"; throw "client outdated";
} else { } else {

View File

@ -68,6 +68,8 @@ export function handle_crash_callback(args: string[]) {
app.on('window-all-closed', () => { app.on('window-all-closed', () => {
process.exit(0); 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)) if(process_args.has_value(Arguments.DUMMY_CRASH_RENDERER))
crash_handler.handler.crash(); crash_handler.handler.crash();
if(!process_args.has_flag(Arguments.DEBUG)) { if(!process_args.has_flag(Arguments.DEBUG)) {
window.open_connected_question = () => { window.open_connected_question = () => remote.dialog.showMessageBox(remote.getCurrentWindow(), {
return new Promise(resolve => { type: 'question',
remote.dialog.showMessageBox(remote.getCurrentWindow(), { buttons: ['Yes', 'No'],
type: 'question', title: 'Confirm',
buttons: ['Yes', 'No'], message: 'Are you really sure?\nYou\'re still connected!'
title: 'Confirm', }).then(result => result.response === 0);
message: 'Are you really sure?\nYou\'re still connected!'
}, choice => {
resolve(choice === 0);
});
});
};
} }
}, },
priority: 110 priority: 110

View File

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