better clipboard handeling with new crate

This commit is contained in:
pandadev 2024-07-05 18:44:34 +02:00
parent 2446f7320f
commit 16fef86753
No known key found for this signature in database
GPG key ID: C39629DACB8E762F

View file

@ -50,13 +50,10 @@ pub fn setup(app_handle: tauri::AppHandle) {
if is_format_avail(formats::Bitmap.into()) { if is_format_avail(formats::Bitmap.into()) {
match get_clipboard(formats::Bitmap) { match get_clipboard(formats::Bitmap) {
Ok(image) => { Ok(image) => {
println!("Image found in clipboard");
rt.block_on(async { rt.block_on(async {
let base64_image = STANDARD.encode(&image); let base64_image = STANDARD.encode(&image);
println!("Image encoded to base64");
insert_content_if_not_exists(&pool, "image", base64_image) insert_content_if_not_exists(&pool, "image", base64_image)
.await; .await;
println!("Image inserted into database");
}); });
} }
Err(e) => { Err(e) => {
@ -66,15 +63,6 @@ pub fn setup(app_handle: tauri::AppHandle) {
} else { } else {
println!("No image format available in clipboard"); println!("No image format available in clipboard");
} }
match get_clipboard(formats::RawData(0)) {
Ok(data) => {
println!("{:?}", data);
}
Err(e) => {
println!("Error reading raw data from clipboard: {:?}", e);
}
}
} }
} }
_ => {} _ => {}