Skip to content

Commit

Permalink
finalize startup logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Brendonovich committed Nov 15, 2024
1 parent a6da58d commit 6a7beb5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion apps/desktop/src-tauri/src/general_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ pub struct GeneralSettingsStore {
pub enable_notifications: bool,
#[serde(default)]
pub disable_auto_open_links: bool,
#[serde(default)]
// first launch: store won't exist so show startup
#[serde(default = "true_b")]
pub has_completed_startup: bool,
}

Expand Down
10 changes: 8 additions & 2 deletions apps/desktop/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2529,8 +2529,14 @@ pub async fn run() {
let permissions = permissions::do_permissions_check(false);
println!("Permissions check result: {:?}", permissions);

if !permissions.screen_recording.permitted() || !permissions.accessibility.permitted() {
println!("Required permissions not granted, showing permissions window");
if !permissions.screen_recording.permitted()
|| !permissions.accessibility.permitted()
|| GeneralSettingsStore::get(app.handle())
.ok()
.flatten()
.map(|s| !s.has_completed_startup)
.unwrap_or(false)
{
CapWindow::Setup.show(&app_handle).ok();
} else {
println!("Permissions granted, showing main window");
Expand Down

1 comment on commit 6a7beb5

@vercel
Copy link

@vercel vercel bot commented on 6a7beb5 Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.