diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index d75d709..6b9aa4f 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -465,17 +465,6 @@ dependencies = [ "syn", ] -[[package]] -name = "dbus" -version = "0.9.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bb21987b9fb1613058ba3843121dd18b163b254d8a6e797e144cbac14d96d1b" -dependencies = [ - "libc", - "libdbus-sys", - "winapi", -] - [[package]] name = "derive_more" version = "0.99.17" @@ -1261,15 +1250,6 @@ version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" -[[package]] -name = "libdbus-sys" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2264f9d90a9b4e60a2dc722ad899ea0374f03c2e96e755fe22a8f551d4d5fb3c" -dependencies = [ - "pkg-config", -] - [[package]] name = "libloading" version = "0.7.4" @@ -1329,19 +1309,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" -[[package]] -name = "mac-notification-sys" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e72d50edb17756489e79d52eb146927bec8eba9dd48faadf9ef08bca3791ad5" -dependencies = [ - "cc", - "dirs-next", - "objc-foundation", - "objc_id", - "time", -] - [[package]] name = "malloc_buf" version = "0.0.6" @@ -1468,17 +1435,6 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" -[[package]] -name = "notify-rust" -version = "4.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ce656bb6d22a93ae276a23de52d1aec5ba4db3ece3c0eb79dfd5add7384db6a" -dependencies = [ - "dbus", - "mac-notification-sys", - "tauri-winrt-notification", -] - [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -1595,16 +1551,6 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" -[[package]] -name = "open" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2078c0039e6a54a0c42c28faa984e115fb4c2d5bf2208f77d1961002df8576f8" -dependencies = [ - "pathdiff", - "windows-sys", -] - [[package]] name = "openssl" version = "0.10.45" @@ -1650,27 +1596,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "os_info" -version = "3.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4750134fb6a5d49afc80777394ad5d95b04bc12068c6abb92fae8f43817270f" -dependencies = [ - "log", - "serde", - "winapi", -] - -[[package]] -name = "os_pipe" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6a252f1f8c11e84b3ab59d7a488e48e4478a93937e027076638c49536204639" -dependencies = [ - "libc", - "windows-sys", -] - [[package]] name = "overload" version = "0.1.1" @@ -1731,12 +1656,6 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" -[[package]] -name = "pathdiff" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" - [[package]] name = "percent-encoding" version = "2.2.0" @@ -1878,7 +1797,7 @@ dependencies = [ "base64", "indexmap", "line-wrap", - "quick-xml 0.26.0", + "quick-xml", "serde", "time", ] @@ -1967,15 +1886,6 @@ dependencies = [ "tauri-build", ] -[[package]] -name = "quick-xml" -version = "0.23.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11bafc859c6815fbaffbbbf4229ecb767ac913fecb27f9ad4343662e9ef099ea" -dependencies = [ - "memchr", -] - [[package]] name = "quick-xml" version = "0.26.0" @@ -2427,16 +2337,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "shared_child" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0d94659ad3c2137fef23ae75b03d5241d633f8acded53d672decfa0e6e0caef" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "siphasher" version = "0.3.10" @@ -2533,27 +2433,6 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" -[[package]] -name = "strum" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7ac893c7d471c8a21f31cfe213ec4f6d9afeed25537c772e08ef3f005f8729e" -dependencies = [ - "strum_macros", -] - -[[package]] -name = "strum_macros" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "339f799d8b549e3744c7ac7feb216383e4005d94bdb22561b3ab8f3b808ae9fb" -dependencies = [ - "heck 0.3.3", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "syn" version = "1.0.107" @@ -2672,23 +2551,17 @@ dependencies = [ "http", "ignore", "minisign-verify", - "notify-rust", "objc", "once_cell", - "open", - "os_info", - "os_pipe", "percent-encoding", "rand 0.8.5", "raw-window-handle", - "regex", "rfd", "semver 1.0.16", "serde", "serde_json", "serde_repr", "serialize-to-javascript", - "shared_child", "state", "tar", "tauri-macros", @@ -2737,7 +2610,6 @@ dependencies = [ "png", "proc-macro2", "quote", - "regex", "semver 1.0.16", "serde", "serde_json", @@ -2831,17 +2703,6 @@ dependencies = [ "windows 0.39.0", ] -[[package]] -name = "tauri-winrt-notification" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c58de036c4d2e20717024de2a3c4bf56c301f07b21bc8ef9b57189fce06f1f3b" -dependencies = [ - "quick-xml 0.23.1", - "strum", - "windows 0.39.0", -] - [[package]] name = "tempfile" version = "3.3.0" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 0b426f4..deb3769 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -16,7 +16,7 @@ tauri-build = { version = "1.2", features = [] } [dependencies] serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } -tauri = { version = "1.2", features = ["api-all", "system-tray", "updater"] } +tauri = { version = "1.2", features = ["app-all", "fs-exists", "fs-read-file", "fs-write-file", "path-all", "system-tray", "updater", "window-close", "window-create", "window-hide", "window-minimize", "window-set-position", "window-show"] } [features] # by default Tauri runs in production mode diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 7f73f06..969c380 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -11,10 +11,25 @@ }, "tauri": { "allowlist": { - "all": true, + "app": { + "all": true + }, "fs": { - "all": true, + "readFile": true, + "writeFile": true, + "exists": true, "scope": ["$HOME/.quicktracker/*", "$HOME/.quicktracker", "$HOME/*"] + }, + "path": { + "all": true + }, + "window": { + "create": true, + "hide": true, + "close": true, + "show": true, + "setPosition": true, + "minimize": true } }, "bundle": { diff --git a/src/hooks/useListenForNewTrackEvent.ts b/src/hooks/useListenForNewTrackEvent.ts index 7275a52..2ea53c0 100644 --- a/src/hooks/useListenForNewTrackEvent.ts +++ b/src/hooks/useListenForNewTrackEvent.ts @@ -13,14 +13,17 @@ export type EventAddTrackPlayload = { export const useListenForNewTrackEvent = () => { useEffect(() => { const addListener = async () => { + if (listener) { + listener(); + } + + console.log("Add listener"); listener = await listen("addTrack", (event) => { addTrack(event.payload.track, event.payload.frequency); }); }; - if (!listener) { - addListener(); - } + addListener(); return () => { if (listener) {