Skip to content

Commit

Permalink
feat(notifications): use the ligh windows-version crate (#750)
Browse files Browse the repository at this point in the history
* feat(notifications): use the ligh `windows-version` crate

* Update desktop.rs

* optional
  • Loading branch information
amrbashir authored Nov 21, 2023
1 parent 88d260d commit 445c1e6
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 2 deletions.
67 changes: 67 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion plugins/notification/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
8 changes: 7 additions & 1 deletion plugins/notification/src/desktop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down

0 comments on commit 445c1e6

Please sign in to comment.