Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions frontend/jest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ jest.mock('@tauri-apps/plugin-shell', () => ({
open: jest.fn().mockResolvedValue(undefined),
}));

jest.mock('@tauri-apps/plugin-notification', () => ({
isPermissionGranted: jest.fn().mockResolvedValue(true),
requestPermission: jest.fn().mockResolvedValue('granted'),
sendNotification: jest.fn(),
}));

jest.mock('@tauri-apps/plugin-store', () => ({
Store: jest.fn().mockImplementation(() => ({
get: jest.fn().mockResolvedValue(null),
Expand Down
10 changes: 10 additions & 0 deletions frontend/package-lock.json

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

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"@tauri-apps/api": ">=2.0.0-beta.0",
"@tauri-apps/plugin-dialog": "^2.2.0",
"@tauri-apps/plugin-fs": "^2.2.0",
"@tauri-apps/plugin-notification": "^2.3.1",
"@tauri-apps/plugin-opener": "^2.5.2",
"@tauri-apps/plugin-process": "^2.3.0",
"@tauri-apps/plugin-shell": "^2.2.0",
Expand Down
75 changes: 67 additions & 8 deletions frontend/src-tauri/Cargo.lock

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

5 changes: 3 additions & 2 deletions frontend/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tauri-build = { version = "2.0.6", features = [] }

[dependencies]
tauri = { version = "2.9.1", features = ["protocol-asset", "devtools", "tray-icon"] }
reqwest = { version = "0.12", features = ["blocking"] }
reqwest = { version = "0.12", features = ["blocking", "json"] }
walkdir = "2.3"
sysinfo = "0.37.2"
serde = { version = "1.0", features = ["derive"] }
Expand All @@ -21,7 +21,7 @@ anyhow = "1.0"
image = "0.24.6"
ring = "0.16.20"
data-encoding = "2.3.2"
tokio = { version = "1", features = ["macros"] }
tokio = { version = "1", features = ["macros", "time"] }
tempfile = "3"
arrayref = "0.3.6"
directories = "4.0"
Expand All @@ -37,6 +37,7 @@ tauri-plugin-process = "2.3.1"
tauri-plugin-store = "2.4.1"
tauri-plugin-updater = "2.9.0"
tauri-plugin-opener = "2.5.2"
tauri-plugin-notification = "2.3.3"
tauri-plugin-autostart = "2"

[features]
Expand Down
3 changes: 2 additions & 1 deletion frontend/src-tauri/capabilities/migrated.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
"fs:default",
"dialog:default",
"store:default",
"opener:allow-reveal-item-in-dir"
"opener:allow-reveal-item-in-dir",
"notification:default"
]
}
14 changes: 14 additions & 0 deletions frontend/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

mod memories;
mod services;

use sysinfo::System;
Expand Down Expand Up @@ -52,6 +53,13 @@ fn is_process_alive() -> bool {
}

fn on_window_event(window: &Window, event: &WindowEvent) {
// Covers the app being left open across midnight, and coming back from the
// tray. Throttled inside.
if matches!(event, WindowEvent::Focused(true)) && window.label() == "main" {
memories::check_on_resume(window.app_handle().clone());
return;
}

if let WindowEvent::CloseRequested { api, .. } = event {
// Secondary windows (e.g. model-manager) close normally.
if window.label() != "main" {
Expand Down Expand Up @@ -284,12 +292,16 @@ fn main() {
.plugin(tauri_plugin_fs::init())
.plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_process::init())
.plugin(tauri_plugin_notification::init())
.setup(|app| {
let resource_path = app.path().resolve("resources", BaseDirectory::Resource)?;
println!("Resource path: {:?}", resource_path);

prod(app.handle(), &resource_path)?;

app.manage(memories::MemoryTaskState::default());
memories::spawn_memory_task(app.handle().clone());

// When auto-started at boot (--minimized flag), keep the window hidden
if std::env::args().any(|a| a == "--minimized") {
if let Some(window) = app.get_webview_window("main") {
Expand Down Expand Up @@ -347,6 +359,8 @@ fn main() {
.invoke_handler(tauri::generate_handler![
services::get_resources_folder_path,
open_model_manager,
memories::open_memory,
memories::take_pending_memory,
enable_autostart,
disable_autostart,
is_autostart_enabled,
Expand Down
Loading
Loading