Skip to content

Commit

Permalink
Fixed mac-windows mixup, fixed notifiers missing translations
Browse files Browse the repository at this point in the history
  • Loading branch information
fribbels committed Mar 23, 2021
1 parent 6801fa4 commit 4717246
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 17 deletions.
10 changes: 10 additions & 0 deletions app/js/lib/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,16 @@ module.exports = {
})
},

htmlSuccessDisableOutsideClick: (html) => {
Swal.fire({
icon: 'success',
html: html,
confirmButtonText: i18next.t("OK"),
allowOutsideClick: outsideClickDisable
// cancelButtonText: i18next.t("Cancel")
})
},

htmlError: (html) => {
Swal.fire({
icon: 'error',
Expand Down
2 changes: 2 additions & 0 deletions app/js/lib/inputHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ document.addEventListener("DOMContentLoaded", async () => {
Subprocess.initialize(async () => {
Selectors.initialize();
Dialog.initialize();
Notifier.initialize();

await HeroData.initialize();
ZarrocConverter.initialize();
OptimizerTab.initialize();
Expand Down
33 changes: 19 additions & 14 deletions app/js/lib/notifier.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
var AWN = require('awesome-notifications').default
var globalOptions = {
icons: {enabled: true},
labels: {
warning: i18next.t("Warning"),
alert: i18next.t("Alert"),
info: i18next.t("Info"),
success: i18next.t("Success"),
error: i18next.t("Error"),
},
durations: {
alert: 20000,
warning: 5000,
info: 7500,
},
position: 'top-right'
}
var notifier = new AWN(globalOptions)

module.exports = {
initialize: () => {
globalOptions = {
icons: {enabled: true},
labels: {
warning: i18next.t("Warning"),
alert: i18next.t("Alert"),
info: i18next.t("Info"),
success: i18next.t("Success"),
error: i18next.t("Error"),
},
durations: {
alert: 20000,
warning: 5000,
info: 7500,
},
position: 'top-right'
}
notifier = new AWN(globalOptions)
},

info: (text) => {
notifier.info(i18next.t(text));
Expand Down
4 changes: 2 additions & 2 deletions app/js/lib/scanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ async function finishedReading(data) {

if (data.length == 0) {
if (Files.isMac()) {
Dialog.htmlError("The scanner did not find any data. Please check that you have <a href='https://github.com/fribbels/Fribbels-Epic-7-Optimizer#using-the-auto-importer'>Python and Npcap installed</a> correctly, then try again.")
} else {
Dialog.htmlError("The scanner did not find any data. Please check that you have <a href='https://github.com/fribbels/Fribbels-Epic-7-Optimizer#using-the-auto-importer'>Python and Wireshark installed</a> correctly, then try again.")
} else {
Dialog.htmlError("The scanner did not find any data. Please check that you have <a href='https://github.com/fribbels/Fribbels-Epic-7-Optimizer#using-the-auto-importer'>Python and Npcap installed</a> correctly, then try again.")
}
document.getElementById('loadFromGameExportOutputText').value = i18next.t("The scanner did not find any data.");
return;
Expand Down
2 changes: 1 addition & 1 deletion app/js/lib/updater.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = {
shell.openExternal(this.href);
});

Dialog.htmlSuccess(i18next.t("New version available: <a href='https://github.com/fribbels/Fribbels-Epic-7-Optimizer/releases'>") + latestVersion + "<a>");
Dialog.htmlSuccessDisableOutsideClick(i18next.t("New version available: <a href='https://github.com/fribbels/Fribbels-Epic-7-Optimizer/releases'>") + latestVersion + "<a>");
}

// console.error(latestDataJson);
Expand Down

0 comments on commit 4717246

Please sign in to comment.