mirror of
https://github.com/luminous-devs/lume.git
synced 2024-09-19 19:46:34 +00:00
enable native notification
This commit is contained in:
parent
ea3e5a69f6
commit
f61adb2ff5
70
src-tauri/Cargo.lock
generated
70
src-tauri/Cargo.lock
generated
@ -2096,6 +2096,19 @@ version = "0.1.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
|
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]]
|
[[package]]
|
||||||
name = "malloc_buf"
|
name = "malloc_buf"
|
||||||
version = "0.0.6"
|
version = "0.0.6"
|
||||||
@ -2333,6 +2346,19 @@ dependencies = [
|
|||||||
"minimal-lexical",
|
"minimal-lexical",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "notify-rust"
|
||||||
|
version = "4.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2bfa211d18e360f08e36c364308f394b5eb23a6629150690e109a916dc6f610e"
|
||||||
|
dependencies = [
|
||||||
|
"log",
|
||||||
|
"mac-notification-sys",
|
||||||
|
"serde",
|
||||||
|
"tauri-winrt-notification",
|
||||||
|
"zbus",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nu-ansi-term"
|
name = "nu-ansi-term"
|
||||||
version = "0.46.0"
|
version = "0.46.0"
|
||||||
@ -2787,7 +2813,7 @@ dependencies = [
|
|||||||
"base64 0.21.0",
|
"base64 0.21.0",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"line-wrap",
|
"line-wrap",
|
||||||
"quick-xml",
|
"quick-xml 0.28.2",
|
||||||
"serde",
|
"serde",
|
||||||
"time",
|
"time",
|
||||||
]
|
]
|
||||||
@ -2891,6 +2917,15 @@ dependencies = [
|
|||||||
"rustyline",
|
"rustyline",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quick-xml"
|
||||||
|
version = "0.23.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "11bafc859c6815fbaffbbbf4229ecb767ac913fecb27f9ad4343662e9ef099ea"
|
||||||
|
dependencies = [
|
||||||
|
"memchr",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quick-xml"
|
name = "quick-xml"
|
||||||
version = "0.28.2"
|
version = "0.28.2"
|
||||||
@ -3813,6 +3848,27 @@ version = "0.10.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
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 1.0.109",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.109"
|
version = "1.0.109"
|
||||||
@ -3960,6 +4016,7 @@ dependencies = [
|
|||||||
"http",
|
"http",
|
||||||
"ignore",
|
"ignore",
|
||||||
"minisign-verify",
|
"minisign-verify",
|
||||||
|
"notify-rust",
|
||||||
"objc",
|
"objc",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"open",
|
"open",
|
||||||
@ -4172,6 +4229,17 @@ dependencies = [
|
|||||||
"toml 0.7.3",
|
"toml 0.7.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[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]]
|
[[package]]
|
||||||
name = "tempfile"
|
name = "tempfile"
|
||||||
version = "3.5.0"
|
version = "3.5.0"
|
||||||
|
@ -16,7 +16,7 @@ tauri-build = { version = "1.2", features = [] }
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
tauri = { version = "1.2", features = ["clipboard-read-text", "clipboard-write-text", "dialog-open", "fs-read-dir", "fs-read-file", "http-all", "http-multipart", "os-all", "shell-open", "system-tray", "updater", "window-close", "window-start-dragging"] }
|
tauri = { version = "1.2", features = ["clipboard-read-text", "clipboard-write-text", "dialog-open", "fs-read-dir", "fs-read-file", "http-all", "http-multipart", "notification-all", "os-all", "shell-open", "system-tray", "updater", "window-close", "window-start-dragging"] }
|
||||||
tauri-plugin-single-instance = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
|
tauri-plugin-single-instance = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
|
||||||
tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
|
tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
|
||||||
sqlx-cli = {version = "0.6.3", default-features = false, features = ["sqlite"] }
|
sqlx-cli = {version = "0.6.3", default-features = false, features = ["sqlite"] }
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
"open": true
|
"open": true
|
||||||
},
|
},
|
||||||
"notification": {
|
"notification": {
|
||||||
"all": false
|
"all": true
|
||||||
},
|
},
|
||||||
"window": {
|
"window": {
|
||||||
"startDragging": true,
|
"startDragging": true,
|
||||||
|
@ -14,6 +14,20 @@ export function ChatsList() {
|
|||||||
fetchChats(account.pubkey);
|
fetchChats(account.pubkey);
|
||||||
}, [fetchChats]);
|
}, [fetchChats]);
|
||||||
|
|
||||||
|
if (!account)
|
||||||
|
return (
|
||||||
|
<div className="flex flex-col">
|
||||||
|
<div className="inline-flex h-8 items-center gap-2 rounded-md px-2.5">
|
||||||
|
<div className="relative h-5 w-5 shrink-0 animate-pulse rounded bg-zinc-800" />
|
||||||
|
<div className="h-3 w-full rounded-sm animate-pulse bg-zinc-800" />
|
||||||
|
</div>
|
||||||
|
<div className="inline-flex h-8 items-center gap-2 rounded-md px-2.5">
|
||||||
|
<div className="relative h-5 w-5 shrink-0 animate-pulse rounded bg-zinc-800" />
|
||||||
|
<div className="h-3 w-full rounded-sm animate-pulse bg-zinc-800" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
<ChatsListSelfItem data={account} />
|
<ChatsListSelfItem data={account} />
|
||||||
@ -21,11 +35,11 @@ export function ChatsList() {
|
|||||||
<>
|
<>
|
||||||
<div className="inline-flex h-8 items-center gap-2 rounded-md px-2.5">
|
<div className="inline-flex h-8 items-center gap-2 rounded-md px-2.5">
|
||||||
<div className="relative h-5 w-5 shrink-0 animate-pulse rounded bg-zinc-800" />
|
<div className="relative h-5 w-5 shrink-0 animate-pulse rounded bg-zinc-800" />
|
||||||
<div className="h-3 w-full animate-pulse bg-zinc-800" />
|
<div className="h-3 w-full rounded-sm animate-pulse bg-zinc-800" />
|
||||||
</div>
|
</div>
|
||||||
<div className="inline-flex h-8 items-center gap-2 rounded-md px-2.5">
|
<div className="inline-flex h-8 items-center gap-2 rounded-md px-2.5">
|
||||||
<div className="relative h-5 w-5 shrink-0 animate-pulse rounded bg-zinc-800" />
|
<div className="relative h-5 w-5 shrink-0 animate-pulse rounded bg-zinc-800" />
|
||||||
<div className="h-3 w-full animate-pulse bg-zinc-800" />
|
<div className="h-3 w-full rounded-sm animate-pulse bg-zinc-800" />
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
|
@ -1,18 +1,27 @@
|
|||||||
import { getActiveAccount, getLastLogin } from "@utils/storage";
|
import { getActiveAccount, getLastLogin } from "@utils/storage";
|
||||||
import { create } from "zustand";
|
import { create } from "zustand";
|
||||||
|
import { createJSONStorage, persist } from "zustand/middleware";
|
||||||
|
|
||||||
export const useActiveAccount = create((set) => ({
|
export const useActiveAccount = create(
|
||||||
account: null,
|
persist(
|
||||||
lastLogin: 0,
|
(set) => ({
|
||||||
fetch: async () => {
|
account: null,
|
||||||
const response = await getActiveAccount();
|
lastLogin: 0,
|
||||||
set({ account: response });
|
fetch: async () => {
|
||||||
},
|
const response = await getActiveAccount();
|
||||||
fetchLastLogin: async () => {
|
set({ account: response });
|
||||||
const response = await getLastLogin();
|
},
|
||||||
set({ lastLogin: parseInt(response) });
|
fetchLastLogin: async () => {
|
||||||
},
|
const response = await getLastLogin();
|
||||||
updateFollows: (list: any) => {
|
set({ lastLogin: parseInt(response) });
|
||||||
set((state: any) => ({ account: { ...state.account, follows: list } }));
|
},
|
||||||
},
|
updateFollows: (list: any) => {
|
||||||
}));
|
set((state: any) => ({ account: { ...state.account, follows: list } }));
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
{
|
||||||
|
name: "account",
|
||||||
|
storage: createJSONStorage(() => sessionStorage),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user