Skip to content

Commit 93bdb6d

Browse files
committed
Revert "fix(notification/windows): Grant permission without invoking backend"
This reverts commit 4c120d4.
1 parent 4c120d4 commit 93bdb6d

File tree

4 files changed

+8
-17
lines changed

4 files changed

+8
-17
lines changed

.changes/fix-notification-access-violation.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

plugins/notification/guest-js/init.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,16 @@ import type { Options } from "./index";
1010
let permissionValue = "default";
1111

1212
async function isPermissionGranted(): Promise<boolean> {
13-
// @ts-expect-error __TEMPLATE_windows__ will be replaced in rust before it's injected.
14-
if (window.Notification.permission !== "default" || __TEMPLATE_windows__) {
13+
if (window.Notification.permission !== "default") {
1514
return await Promise.resolve(
16-
window.Notification.permission === "granted"
15+
window.Notification.permission === "granted",
1716
);
1817
}
1918
return await invoke("plugin:notification|is_permission_granted");
2019
}
2120

2221
function setNotificationPermission(
23-
value: "granted" | "denied" | "default"
22+
value: "granted" | "denied" | "default",
2423
): void {
2524
permissionSettable = true;
2625
// @ts-expect-error we can actually set this value on the webview
@@ -32,10 +31,10 @@ import type { Options } from "./index";
3231
"default" | "denied" | "granted" | "prompt"
3332
> {
3433
return await invoke<"prompt" | "default" | "granted" | "denied">(
35-
"plugin:notification|request_permission"
34+
"plugin:notification|request_permission",
3635
).then((permission) => {
3736
setNotificationPermission(
38-
permission === "prompt" ? "default" : permission
37+
permission === "prompt" ? "default" : permission,
3938
);
4039
return permission;
4140
});
@@ -65,7 +64,7 @@ import type { Options } from "./index";
6564
Object.assign(opts, {
6665
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
6766
title,
68-
})
67+
}),
6968
);
7069
};
7170

plugins/notification/src/init-iife.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/notification/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,7 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
227227
commands::request_permission,
228228
commands::is_permission_granted
229229
])
230-
.js_init_script(include_str!("init-iife.js").replace(
231-
"__TEMPLATE_windows__",
232-
if cfg!(windows) { "true" } else { "false" },
233-
))
230+
.js_init_script(include_str!("init-iife.js").to_string())
234231
.setup(|app, api| {
235232
#[cfg(mobile)]
236233
let notification = mobile::init(app, api)?;

0 commit comments

Comments
 (0)