Improved crash handling

This commit is contained in:
WolverinDEV 2019-10-27 23:21:08 +01:00
parent 99b354fd51
commit a2eb4620aa
4 changed files with 18 additions and 3 deletions

View File

@ -1,3 +1,5 @@
import {main_window} from "../core/main_window";
require("../shared/require").setup_require(module);
import {app, BrowserWindow, remote} from "electron";
import * as path from "path";
@ -55,6 +57,8 @@ export function handle_crash_callback(args: string[]) {
javascript: true
}
});
crash_window.on('focus', event => crash_window.flashFrame(false));
crash_window.setMenu(null);
crash_window.loadFile(path.join(path.dirname(module.filename), "ui", "index.html"));
crash_window.on('ready-to-show', () => {
@ -65,13 +69,14 @@ export function handle_crash_callback(args: string[]) {
else
crash_window.webContents.send('dump-url', crash_file);
crash_window.show();
crash_window.setProgressBar(1, {mode: "error"});
crash_window.flashFrame(true);
});
app.on('window-all-closed', () => {
process.exit(0);
});
crash_window.focus();
});
app.commandLine.appendSwitch('autoplay-policy', 'no-user-gesture-required');
}
export const handler = require( "teaclient_crash_handler");

View File

@ -4,6 +4,16 @@ function open_issue_tracker() {
shell.openExternal("https://github.com/TeaSpeak/TeaClient/issues");
}
function play_sound() {
// Replaying sound from https://freesound.org/people/dersuperanton/sounds/435883/
const node = document.createElement("audio");
node.src = "./oh-oh.wav";
node.volume = 1;
document.body.append(node);
node.play();
}
play_sound();
function set_dump_error_flag(flag: boolean) {
for(const node of document.getElementsByClassName("error-show") as HTMLCollectionOf<HTMLElement>)
node.style.display = flag ? "block" : "none";

Binary file not shown.

View File

@ -267,5 +267,5 @@ const load_modules = async () => {
console.log("Loaded native extensions");
remote.getCurrentWindow().on('focus', () => main_window.flashFrame(false));
remote.getCurrentWindow().flashFrame(true);
// remote.getCurrentWindow().flashFrame(true);
};