feat(notifications): use the ligh windows-version crate (#750)

* feat(notifications): use the ligh `windows-version` crate

* Update desktop.rs

* optional
This commit is contained in:
Amr Bashir
2023-11-21 14:23:47 +02:00
committed by GitHub
parent 88d260d901
commit 445c1e6cb6
3 changed files with 76 additions and 2 deletions
+2 -1
View File
@@ -32,6 +32,7 @@ notify-rust = "4.5"
[target."cfg(windows)".dependencies]
win7-notifications = { version = "0.3.1", optional = true }
windows-version = { version = "0.1", optional = true }
[features]
windows7-compat = [ "win7-notifications" ]
windows7-compat = [ "win7-notifications", "windows-version" ]
+7 -1
View File
@@ -226,7 +226,13 @@ mod imp {
pub fn notify<R: tauri::Runtime>(self, app: &tauri::AppHandle<R>) -> crate::Result<()> {
#[cfg(windows)]
{
if tauri::utils::platform::is_windows_7() {
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)]