mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-27 23:37:05 -05:00
fix: Notifications on Web build causing exceptions
This commit is contained in:
@@ -1002,17 +1002,21 @@ namespace hex {
|
||||
}
|
||||
#elif defined(OS_WEB)
|
||||
EM_ASM({
|
||||
const t = UTF8ToString($0);
|
||||
const m = UTF8ToString($1);
|
||||
try {
|
||||
const t = UTF8ToString($0);
|
||||
const m = UTF8ToString($1);
|
||||
|
||||
if (Notification.permission === "granted") {
|
||||
new Notification(t, { body: m });
|
||||
} else if (Notification.permission !== "denied") {
|
||||
Notification.requestPermission().then(function(p) {
|
||||
if (p === "granted") {
|
||||
new Notification(t, { body: m });
|
||||
}
|
||||
});
|
||||
if (Notification.permission === "granted") {
|
||||
new Notification(t, { body: m });
|
||||
} else if (Notification.permission !== "denied") {
|
||||
Notification.requestPermission().then(function(p) {
|
||||
if (p === "granted") {
|
||||
new Notification(t, { body: m });
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}, title.c_str(), message.c_str());
|
||||
#endif
|
||||
|
||||
@@ -432,9 +432,10 @@ namespace hex::plugin::builtin {
|
||||
if (!taskFinishedNotificationEnabled)
|
||||
return;
|
||||
|
||||
|
||||
if (!ImHexApi::System::isMainWindowFocused() && !task.isBackgroundTask())
|
||||
hex::showToastMessage("ImHex", fmt::format("hex.builtin.os_toast_message.task_finished"_lang, Lang(task.getUnlocalizedName())));
|
||||
#if !defined(OS_WEB)
|
||||
if (!ImHexApi::System::isMainWindowFocused() && !task.isBackgroundTask())
|
||||
hex::showToastMessage("ImHex", fmt::format("hex.builtin.os_toast_message.task_finished"_lang, Lang(task.getUnlocalizedName())));
|
||||
#endif
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user