mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-14 20:55:26 +02:00
Merge remote-tracking branch 'origin/v2' into v3
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
# Changelog
|
||||
|
||||
## [2.4.0]
|
||||
|
||||
- [`db9c5998`](https://github.com/tauri-apps/plugins-workspace/commit/db9c5998feff9384f9cbbefcbe0d45937c00a1fc) ([#3531](https://github.com/tauri-apps/plugins-workspace/pull/3531) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Fix missing `consumer-rules.pro` on Gradle v9.
|
||||
- [`304292d7`](https://github.com/tauri-apps/plugins-workspace/commit/304292d740a666d3903ab58329860fc0fdde2818) ([#2805](https://github.com/tauri-apps/plugins-workspace/pull/2805) by [@Innominus](https://github.com/tauri-apps/plugins-workspace/../../Innominus)) - Add Rust builders for mobile notification action types.
|
||||
- Fix Android action-group entries being stored under the action type ID instead of sequential indices, causing later actions to overwrite earlier ones.
|
||||
|
||||
## \[2.3.3]
|
||||
|
||||
- [`93426f85`](https://github.com/tauri-apps/plugins-workspace/commit/93426f85120f49beb9f40222bff45185a32d54a9) Fixed an issue that caused docs.rs builds to fail. No user facing changes.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tauri-plugin-notification"
|
||||
version = "2.3.3"
|
||||
version = "2.4.0"
|
||||
description = "Send desktop and mobile notifications on your Tauri application."
|
||||
edition = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
@@ -8,6 +8,14 @@ license = { workspace = true }
|
||||
rust-version = { workspace = true }
|
||||
repository = { workspace = true }
|
||||
links = "tauri-plugin-notification"
|
||||
exclude = [
|
||||
"/banner.png",
|
||||
"/guest-js",
|
||||
"/package.json",
|
||||
"/rollup.config.js",
|
||||
"/test",
|
||||
"/tsconfig.json",
|
||||
]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu", "x86_64-linux-android"]
|
||||
|
||||
@@ -14,15 +14,6 @@ android {
|
||||
consumerProguardFiles("consumer-rules.pro")
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = false
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
@@ -80,11 +80,11 @@ class NotificationStorage(private val context: Context, private val jsonMapper:
|
||||
|
||||
fun writeActionGroup(actions: List<ActionType>) {
|
||||
for (type in actions) {
|
||||
val i = type.id
|
||||
val editor = getStorage(ACTION_TYPES_ID + type.id).edit()
|
||||
editor.clear()
|
||||
editor.putInt("count", type.actions.size)
|
||||
for (action in type.actions) {
|
||||
for (i in 0 until type.actions.size) {
|
||||
val action = type.actions[i]
|
||||
editor.putString("id$i", action.id)
|
||||
editor.putString("title$i", action.title)
|
||||
editor.putBoolean("input$i", action.input ?: false)
|
||||
|
||||
@@ -73,7 +73,8 @@ interface Options {
|
||||
/**
|
||||
* The sound resource name or file path for the notification.
|
||||
*
|
||||
* Platform specific behavior:
|
||||
* ## Platform-specific behavior:
|
||||
*
|
||||
* - On macOS: use system sounds (e.g., "Ping", "Blow") or sound files in the app bundle
|
||||
* - On Linux: use XDG theme sounds (e.g., "message-new-instant") or file paths
|
||||
* - On Windows: use file paths to sound files (.wav format)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tauri-apps/plugin-notification",
|
||||
"version": "2.3.3",
|
||||
"version": "2.4.0",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"authors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//! Send message notifications (brief auto-expiring OS window element) to your user. Can also be used with the Notification Web API.
|
||||
//!
|
||||
//! ## Cargo features
|
||||
//!
|
||||
//! - **windows7-compat**: Adds support for the legacy Windows 7 notification implementation and Windows-version detection.
|
||||
|
||||
#![doc(
|
||||
html_logo_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png",
|
||||
|
||||
@@ -320,6 +320,95 @@ pub struct ActionType {
|
||||
hidden_previews_show_subtitle: bool,
|
||||
}
|
||||
|
||||
#[cfg(mobile)]
|
||||
#[derive(Debug)]
|
||||
pub struct ActionTypeBuilder(ActionType);
|
||||
|
||||
#[cfg(mobile)]
|
||||
impl ActionType {
|
||||
pub fn builder(id: impl Into<String>) -> ActionTypeBuilder {
|
||||
ActionTypeBuilder(Self {
|
||||
id: id.into(),
|
||||
actions: Vec::new(),
|
||||
hidden_previews_body_placeholder: None,
|
||||
custom_dismiss_action: false,
|
||||
allow_in_car_play: false,
|
||||
hidden_previews_show_title: false,
|
||||
hidden_previews_show_subtitle: false,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn id(&self) -> &str {
|
||||
&self.id
|
||||
}
|
||||
|
||||
pub fn actions(&self) -> &[Action] {
|
||||
&self.actions
|
||||
}
|
||||
|
||||
pub fn hidden_previews_body_placeholder(&self) -> Option<&str> {
|
||||
self.hidden_previews_body_placeholder.as_deref()
|
||||
}
|
||||
|
||||
pub fn custom_dismiss_action(&self) -> bool {
|
||||
self.custom_dismiss_action
|
||||
}
|
||||
|
||||
pub fn allow_in_car_play(&self) -> bool {
|
||||
self.allow_in_car_play
|
||||
}
|
||||
|
||||
pub fn hidden_previews_show_title(&self) -> bool {
|
||||
self.hidden_previews_show_title
|
||||
}
|
||||
|
||||
pub fn hidden_previews_show_subtitle(&self) -> bool {
|
||||
self.hidden_previews_show_subtitle
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(mobile)]
|
||||
impl ActionTypeBuilder {
|
||||
pub fn actions(mut self, actions: Vec<Action>) -> Self {
|
||||
self.0.actions = actions;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn hidden_previews_body_placeholder(
|
||||
mut self,
|
||||
hidden_previews_body_placeholder: impl Into<String>,
|
||||
) -> Self {
|
||||
self.0
|
||||
.hidden_previews_body_placeholder
|
||||
.replace(hidden_previews_body_placeholder.into());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn custom_dismiss_action(mut self, custom_dismiss_action: bool) -> Self {
|
||||
self.0.custom_dismiss_action = custom_dismiss_action;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn allow_in_car_play(mut self, allow_in_car_play: bool) -> Self {
|
||||
self.0.allow_in_car_play = allow_in_car_play;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn hidden_previews_show_title(mut self, hidden_previews_show_title: bool) -> Self {
|
||||
self.0.hidden_previews_show_title = hidden_previews_show_title;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn hidden_previews_show_subtitle(mut self, hidden_previews_show_subtitle: bool) -> Self {
|
||||
self.0.hidden_previews_show_subtitle = hidden_previews_show_subtitle;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn build(self) -> ActionType {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(mobile)]
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
@@ -334,6 +423,95 @@ pub struct Action {
|
||||
input_placeholder: Option<String>,
|
||||
}
|
||||
|
||||
#[cfg(mobile)]
|
||||
#[derive(Debug)]
|
||||
pub struct ActionBuilder(Action);
|
||||
|
||||
#[cfg(mobile)]
|
||||
impl Action {
|
||||
pub fn builder(id: impl Into<String>, title: impl Into<String>) -> ActionBuilder {
|
||||
ActionBuilder(Self {
|
||||
id: id.into(),
|
||||
title: title.into(),
|
||||
requires_authentication: false,
|
||||
foreground: false,
|
||||
destructive: false,
|
||||
input: false,
|
||||
input_button_title: None,
|
||||
input_placeholder: None,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn id(&self) -> &str {
|
||||
&self.id
|
||||
}
|
||||
|
||||
pub fn title(&self) -> &str {
|
||||
&self.title
|
||||
}
|
||||
|
||||
pub fn requires_authentication(&self) -> bool {
|
||||
self.requires_authentication
|
||||
}
|
||||
|
||||
pub fn foreground(&self) -> bool {
|
||||
self.foreground
|
||||
}
|
||||
|
||||
pub fn destructive(&self) -> bool {
|
||||
self.destructive
|
||||
}
|
||||
|
||||
pub fn input(&self) -> bool {
|
||||
self.input
|
||||
}
|
||||
|
||||
pub fn input_button_title(&self) -> Option<&str> {
|
||||
self.input_button_title.as_deref()
|
||||
}
|
||||
|
||||
pub fn input_placeholder(&self) -> Option<&str> {
|
||||
self.input_placeholder.as_deref()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(mobile)]
|
||||
impl ActionBuilder {
|
||||
pub fn requires_authentication(mut self, requires_authentication: bool) -> Self {
|
||||
self.0.requires_authentication = requires_authentication;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn foreground(mut self, foreground: bool) -> Self {
|
||||
self.0.foreground = foreground;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn destructive(mut self, destructive: bool) -> Self {
|
||||
self.0.destructive = destructive;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn input(mut self, input: bool) -> Self {
|
||||
self.0.input = input;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn input_button_title(mut self, input_button_title: impl Into<String>) -> Self {
|
||||
self.0.input_button_title.replace(input_button_title.into());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn input_placeholder(mut self, input_placeholder: impl Into<String>) -> Self {
|
||||
self.0.input_placeholder.replace(input_placeholder.into());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn build(self) -> Action {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
pub use android::*;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user