mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-06-06 13:53:54 +02:00
feat: update to tauri beta, add permissions (#862)
Co-authored-by: Lucas Nogueira <lucas@tauri.app> Co-authored-by: Lucas Nogueira <lucas@crabnebula.dev>
This commit is contained in:
@@ -9,12 +9,12 @@ rust-version = { workspace = true }
|
||||
links = "tauri-plugin-notification"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
rustc-args = [ "--cfg", "docsrs" ]
|
||||
rustdoc-args = [ "--cfg", "docsrs" ]
|
||||
targets = [ "x86_64-unknown-linux-gnu", "x86_64-linux-android" ]
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
targets = ["x86_64-unknown-linux-gnu", "x86_64-linux-android"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { workspace = true }
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
|
||||
[dependencies]
|
||||
serde = { workspace = true }
|
||||
@@ -23,8 +23,8 @@ tauri = { workspace = true }
|
||||
log = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
rand = "0.8"
|
||||
time = { version = "0.3", features = [ "serde", "parsing", "formatting" ] }
|
||||
url = { version = "2", features = [ "serde" ] }
|
||||
time = { version = "0.3", features = ["serde", "parsing", "formatting"] }
|
||||
url = { version = "2", features = ["serde"] }
|
||||
serde_repr = "0.1"
|
||||
|
||||
[target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
|
||||
@@ -35,4 +35,4 @@ win7-notifications = { version = "0.3.1", optional = true }
|
||||
windows-version = { version = "0.1", optional = true }
|
||||
|
||||
[features]
|
||||
windows7-compat = [ "win7-notifications", "windows-version" ]
|
||||
windows7-compat = ["win7-notifications", "windows-version"]
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
const COMMANDS: &[&str] = &["notify", "request_permission", "is_permission_granted"];
|
||||
|
||||
fn main() {
|
||||
if let Err(error) = tauri_build::mobile::PluginBuilder::new()
|
||||
if let Err(error) = tauri_plugin::Builder::new(COMMANDS)
|
||||
.android_path("android")
|
||||
.ios_path("ios")
|
||||
.run()
|
||||
.try_build()
|
||||
{
|
||||
println!("{error:#}");
|
||||
// when building documentation for Android the plugin build result is irrelevant to the crate itself
|
||||
|
||||
@@ -23,6 +23,6 @@
|
||||
"LICENSE"
|
||||
],
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.0.0-alpha.13"
|
||||
"@tauri-apps/api": "2.0.0-beta.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
schemas/
|
||||
@@ -0,0 +1 @@
|
||||
schemas/
|
||||
@@ -0,0 +1,13 @@
|
||||
# Automatically generated - DO NOT EDIT!
|
||||
|
||||
"$schema" = "../../schemas/schema.json"
|
||||
|
||||
[[permission]]
|
||||
identifier = "allow-is-permission-granted"
|
||||
description = "Enables the is_permission_granted command without any pre-configured scope."
|
||||
commands.allow = ["is_permission_granted"]
|
||||
|
||||
[[permission]]
|
||||
identifier = "deny-is-permission-granted"
|
||||
description = "Denies the is_permission_granted command without any pre-configured scope."
|
||||
commands.deny = ["is_permission_granted"]
|
||||
@@ -0,0 +1,13 @@
|
||||
# Automatically generated - DO NOT EDIT!
|
||||
|
||||
"$schema" = "../../schemas/schema.json"
|
||||
|
||||
[[permission]]
|
||||
identifier = "allow-notify"
|
||||
description = "Enables the notify command without any pre-configured scope."
|
||||
commands.allow = ["notify"]
|
||||
|
||||
[[permission]]
|
||||
identifier = "deny-notify"
|
||||
description = "Denies the notify command without any pre-configured scope."
|
||||
commands.deny = ["notify"]
|
||||
@@ -0,0 +1,13 @@
|
||||
# Automatically generated - DO NOT EDIT!
|
||||
|
||||
"$schema" = "../../schemas/schema.json"
|
||||
|
||||
[[permission]]
|
||||
identifier = "allow-request-permission"
|
||||
description = "Enables the request_permission command without any pre-configured scope."
|
||||
commands.allow = ["request_permission"]
|
||||
|
||||
[[permission]]
|
||||
identifier = "deny-request-permission"
|
||||
description = "Denies the request_permission command without any pre-configured scope."
|
||||
commands.deny = ["request_permission"]
|
||||
@@ -0,0 +1,30 @@
|
||||
# Permissions
|
||||
|
||||
## allow-is-permission-granted
|
||||
|
||||
Enables the is_permission_granted command without any pre-configured scope.
|
||||
|
||||
## deny-is-permission-granted
|
||||
|
||||
Denies the is_permission_granted command without any pre-configured scope.
|
||||
|
||||
## allow-notify
|
||||
|
||||
Enables the notify command without any pre-configured scope.
|
||||
|
||||
## deny-notify
|
||||
|
||||
Denies the notify command without any pre-configured scope.
|
||||
|
||||
## allow-request-permission
|
||||
|
||||
Enables the request_permission command without any pre-configured scope.
|
||||
|
||||
## deny-request-permission
|
||||
|
||||
Denies the request_permission command without any pre-configured scope.
|
||||
|
||||
## default
|
||||
|
||||
Allows requesting permission, checking permission state and sending notifications
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
"$schema" = "schemas/schema.json"
|
||||
[default]
|
||||
description = "Allows requesting permission, checking permission state and sending notifications"
|
||||
permissions = [
|
||||
"allow-is-permission-granted",
|
||||
"allow-request-permission",
|
||||
"allow-notify",
|
||||
]
|
||||
@@ -19,13 +19,12 @@ pub struct Notification<R: Runtime>(AppHandle<R>);
|
||||
|
||||
impl<R: Runtime> crate::NotificationBuilder<R> {
|
||||
pub fn show(self) -> crate::Result<()> {
|
||||
let mut notification =
|
||||
imp::Notification::new(self.app.config().tauri.bundle.identifier.clone());
|
||||
let mut notification = imp::Notification::new(self.app.config().identifier.clone());
|
||||
|
||||
if let Some(title) = self
|
||||
.data
|
||||
.title
|
||||
.or_else(|| self.app.config().package.product_name.clone())
|
||||
.or_else(|| self.app.config().product_name.clone())
|
||||
{
|
||||
notification = notification.title(title);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"identifier": "studio.tauri.example",
|
||||
"$schema": "../../../node_modules/.pnpm/@tauri-apps+cli@2.0.0-alpha.17/node_modules/@tauri-apps/cli/schema.json",
|
||||
"identifier": "app.tauri.example",
|
||||
"build": {
|
||||
"frontendDist": ".",
|
||||
"devUrl": "http://localhost:4000"
|
||||
|
||||
Reference in New Issue
Block a user