feat: enhance ActionsMenu functionality with improved keyboard context management and dynamic history updates

This commit is contained in:
pandadev 2025-03-16 22:26:28 +01:00
parent be1718d9a5
commit a79268d0f7
No known key found for this signature in database
GPG key ID: C39629DACB8E762F
2 changed files with 31 additions and 16 deletions

View file

@ -5,6 +5,7 @@ use rand::distr::Alphanumeric;
use sqlx::{ Row, SqlitePool };
use std::fs;
use tauri_plugin_aptabase::EventTracker;
use tauri::Emitter;
pub async fn initialize_history(pool: &SqlitePool) -> Result<(), Box<dyn std::error::Error>> {
let id: String = rng()
@ -106,6 +107,8 @@ pub async fn add_history_item(
"content_type": item.content_type.to_string()
}))
);
let _ = app_handle.emit("clipboard-content-updated", ());
Ok(())
}
@ -195,6 +198,7 @@ pub async fn delete_history_item(
.map_err(|e| e.to_string())?;
let _ = app_handle.track_event("history_item_deleted", None);
let _ = app_handle.emit("clipboard-content-updated", ());
Ok(())
}
@ -210,6 +214,7 @@ pub async fn clear_history(
.map_err(|e| e.to_string())?;
let _ = app_handle.track_event("history_cleared", None);
let _ = app_handle.emit("clipboard-content-updated", ());
Ok(())
}