feat: update to tauri 2.12

- (MSRV bump
- Android compiler options update
- notification plugin windows7 feature deprecation
This commit is contained in:
Lucas Nogueira
2026-09-26 14:46:48 -03:00
parent 3a01943572
commit 9b29b601f3
94 changed files with 939 additions and 537 deletions
+5 -5
View File
@@ -47,12 +47,12 @@ serde_repr = "0.1"
[target.'cfg(target_os = "ios")'.dependencies]
tauri = { workspace = true, features = ["wry"] }
[target."cfg(windows)".dependencies]
win7-notifications = { version = "0.4.5", optional = true }
windows-version = { version = "0.1", optional = true }
[target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
notify-rust = "4.11"
[features]
windows7-compat = ["win7-notifications", "windows-version"]
# Deprecated: tauri 2.12 no longer supports Windows 7, so this feature does nothing.
windows7-compat = []
# Kept so the implicit features of the removed optional dependencies still resolve.
win7-notifications = []
windows-version = []
+1 -1
View File
@@ -12,7 +12,7 @@ Send message notifications (brief auto-expiring OS window element) to your user.
## Install
_This plugin requires a Rust version of at least **1.77.2**_
_This plugin requires a Rust version of at least **1.90**_
There are three general methods of installation that we can recommend.
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
@@ -18,8 +20,11 @@ android {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_1_8
}
}
+1 -1
View File
@@ -24,6 +24,6 @@
"LICENSE"
],
"dependencies": {
"@tauri-apps/api": "^2.11.0"
"@tauri-apps/api": "^2.12.0"
}
}
+4 -79
View File
@@ -36,10 +36,6 @@ impl<R: Runtime> crate::NotificationBuilder<R> {
///
/// Returns an error when the notification could not be prepared,
/// e.g. when the path of the running executable cannot be resolved on Windows.
///
/// ## Platform-specific
///
/// - **Windows**: Not supported on Windows 7 unless the `windows7-compat` Cargo feature is enabled.
pub fn show(self) -> crate::Result<()> {
let mut notification = imp::Notification::new(self.app.config().identifier.clone());
@@ -59,11 +55,6 @@ impl<R: Runtime> crate::NotificationBuilder<R> {
if let Some(sound) = self.data.sound {
notification = notification.sound(sound);
}
#[cfg(feature = "windows7-compat")]
{
notification.notify(&self.app)?;
}
#[cfg(not(feature = "windows7-compat"))]
notification.show()?;
Ok(())
@@ -209,14 +200,6 @@ mod imp {
/// .run(tauri::generate_context!("test/tauri.conf.json"))
/// .expect("error while running tauri application");
/// ```
///
/// ## Platform-specific
///
/// - **Windows**: Not supported on Windows 7. If your app targets it, enable the `windows7-compat` feature and use [`Self::notify`].
#[cfg_attr(
all(not(docsrs), feature = "windows7-compat"),
deprecated = "This function does not work on Windows 7. Use `Self::notify` instead."
)]
pub fn show(self) -> crate::Result<()> {
let mut notification = notify_rust::Notification::new();
if let Some(body) = self.body {
@@ -261,70 +244,12 @@ mod imp {
Ok(())
}
/// Shows the notification. This API is similar to [`Self::show`], but it also works on Windows 7.
///
/// # Examples
///
/// ```no_run
/// use tauri_plugin_notification::NotificationExt;
///
/// tauri::Builder::default()
/// .setup(move |app| {
/// app.notification().builder()
/// .title("Tauri")
/// .body("Tauri is awesome!")
/// .show()
/// .unwrap();
/// Ok(())
/// })
/// .run(tauri::generate_context!("test/tauri.conf.json"))
/// .expect("error while running tauri application");
/// ```
/// Shows the notification. Same as [`Self::show`].
#[cfg(feature = "windows7-compat")]
#[cfg_attr(docsrs, doc(cfg(feature = "windows7-compat")))]
#[allow(unused_variables)]
pub fn notify<R: tauri::Runtime>(self, app: &tauri::AppHandle<R>) -> crate::Result<()> {
#[cfg(windows)]
{
fn is_windows_7() -> bool {
let v = windows_version::OsVersion::current();
// windows 7 is 6.1
v.major == 6 && v.minor == 1
}
if is_windows_7() {
self.notify_win7(app)
} else {
#[allow(deprecated)]
self.show()
}
}
#[cfg(not(windows))]
{
#[allow(deprecated)]
self.show()
}
}
/// Shows the notification on Windows 7.
#[cfg(all(windows, feature = "windows7-compat"))]
fn notify_win7<R: tauri::Runtime>(self, app: &tauri::AppHandle<R>) -> crate::Result<()> {
let app_ = app.clone();
let _ = app.clone().run_on_main_thread(move || {
let mut notification = win7_notifications::Notification::new();
if let Some(body) = self.body {
notification.body(&body);
}
if let Some(title) = self.title {
notification.summary(&title);
}
if let Some(icon) = app_.default_window_icon() {
notification.icon(icon.rgba().to_vec(), icon.width(), icon.height());
}
let _ = notification.show();
});
Ok(())
#[deprecated = "Tauri no longer supports Windows 7, use `Self::show` instead."]
pub fn notify<R: tauri::Runtime>(self, _app: &tauri::AppHandle<R>) -> crate::Result<()> {
self.show()
}
}
}
+1 -1
View File
@@ -6,7 +6,7 @@
//!
//! ## Cargo features
//!
//! - **windows7-compat**: Adds support for the legacy Windows 7 notification implementation and Windows-version detection.
//! - **windows7-compat**: Deprecated and does nothing, since Tauri no longer supports Windows 7.
#![doc(
html_logo_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png",