Skip to content
Merged
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
20 changes: 10 additions & 10 deletions assets/css/settings.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
$primary: #2E2D2B;
$accent: #FEB453;
$primary: #2e2d2b;
$accent: #feb453;
$divider: #ffffff0d;

$text: #E5DFD5;
$text2: #ADA9A1;
$mutedtext: #78756F;
$text: #e5dfd5;
$text2: #ada9a1;
$mutedtext: #78756f;

.bg {
width: 750px;
Expand All @@ -25,7 +25,7 @@ $mutedtext: #78756F;
gap: 8px;
align-items: center;

img{
img {
background-color: $divider;
border-radius: 6px;
padding: 8px 6px;
Expand Down Expand Up @@ -123,7 +123,7 @@ $mutedtext: #78756F;
background-color: $divider;
margin-left: 8px;
margin-right: 4px;
transition: all .2s;
transition: all 0.2s;
}

.actions {
Expand All @@ -134,16 +134,16 @@ $mutedtext: #78756F;
gap: 8px;
border-radius: 7px;
background-color: transparent;
transition: all .2s;
transition: all 0.2s;
cursor: pointer;
}

.actions:hover {
background-color: $divider;
}

&:hover .actions:hover~.divider {
&:hover .actions:hover ~ .divider {
opacity: 0;
}
}
}
}
8 changes: 8 additions & 0 deletions src-tauri/src/api/tray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub fn setup(app: &mut tauri::App) -> Result<(), Box<dyn std::error::Error>> {
.build(app)?])
.items(&[&MenuItemBuilder::with_id("show", "Show/Hide").build(app)?])
.items(&[&MenuItemBuilder::with_id("keybind", "Change keybind").build(app)?])
.items(&[&MenuItemBuilder::with_id("check_updates", "Check for updates").build(app)?])
.items(&[&MenuItemBuilder::with_id("quit", "Quit").build(app)?])
.build()?,
)
Expand All @@ -48,6 +49,13 @@ pub fn setup(app: &mut tauri::App) -> Result<(), Box<dyn std::error::Error>> {
let _ = _app.track_event("tray_keybind_change", None);
window.emit("change_keybind", ()).unwrap();
}
"check_updates" => {
let _ = _app.track_event("tray_check_updates", None);
let app_handle = _app.app_handle().clone();
tauri::async_runtime::spawn(async move {
crate::api::updater::check_for_updates(app_handle, true).await;
});
}
_ => (),
})
.icon(icon)
Expand Down
26 changes: 22 additions & 4 deletions src-tauri/src/api/updater.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use tauri::Manager;
use tauri::{async_runtime, AppHandle};
use tauri_plugin_dialog::{DialogExt, MessageDialogButtons, MessageDialogKind};
use tauri_plugin_updater::UpdaterExt;

pub async fn check_for_updates(app: AppHandle) {
pub async fn check_for_updates(app: AppHandle, prompted: bool) {
println!("Checking for updates...");

let updater = app.updater().unwrap();
Expand All @@ -18,6 +19,10 @@ pub async fn check_for_updates(app: AppHandle) {
"Would you like to install it now?",
]);

let window = app.get_webview_window("main").unwrap();
window.show().unwrap();
window.set_focus().unwrap();

app.dialog()
.message(msg)
.title("Qopy Update Available")
Expand All @@ -31,7 +36,7 @@ pub async fn check_for_updates(app: AppHandle) {
Ok(_) => {
app.dialog()
.message("Update installed successfully. The application needs to restart to apply the changes.")
.title("Qopy Update Installed")
.title("Qopy Needs to Restart")
.buttons(MessageDialogButtons::OkCancelCustom(String::from("Restart"), String::from("Cancel")))
.show(move |response| {
if response {
Expand All @@ -50,9 +55,22 @@ pub async fn check_for_updates(app: AppHandle) {
});
});
}
Ok(None) => println!("No updates available."),
Ok(None) => {
println!("No updates available.");
}
Err(e) => {
println!("Failed to check for updates: {:?}", e);
if prompted {
let window = app.get_webview_window("main").unwrap();
window.show().unwrap();
window.set_focus().unwrap();

app.dialog()
.message("No updates available.")
.title("Qopy Update Check")
.show(|_| {});
}

println!("No updates available. {}", e.to_string());
}
}
}
2 changes: 1 addition & 1 deletion src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ fn main() {
let _ = app.track_event("app_started", None);

tauri::async_runtime::spawn(async move {
api::updater::check_for_updates(app_handle).await;
api::updater::check_for_updates(app_handle, false).await;
});

Ok(())
Expand Down
Loading