Skip to content
Draft
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
96 changes: 15 additions & 81 deletions src-tauri/Cargo.lock

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

10 changes: 7 additions & 3 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ tauri = { version = "2.5.1", features = ["macos-private-api"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
screenshots = "0.8.10"
bson = "2.14.0"
bson = "2.15.0"
typify = "0.4.1"
chrono = { version = "0.4.41", features = ["serde"] }
tauri-plugin-dialog = "2.2.1"
tauri-plugin-dialog = "2.2.2"
sentry = "0.38.1"
dotenvy_macro = "0.15.7"
keyring = { version = "3.6.2", features = [
Expand All @@ -29,7 +29,11 @@ keyring = { version = "3.6.2", features = [
] }
tauri-plugin-http = { version = "2.4.3", features = ["multipart"] }
base64 = "0.22.1"
tauri-plugin-opener = "2"
tauri-plugin-opener = "2.2.7"

[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
tauri-plugin-updater = "2.7.1"

[dependencies.windows]
version = "0.61.1"
features = ["ApplicationModel"]
40 changes: 40 additions & 0 deletions src-tauri/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use screenshots::Screen;
use tauri::{AppHandle, State, Window};

use crate::{
config::AppStore,
error::{Error, PassToSentry},
request::post_screenshot,
secret, utils, SentryState,
Expand Down Expand Up @@ -87,3 +88,42 @@ pub fn emit_to_sentry(error_str: String, sentry_state: State<SentryState>, app:
client.flush(None);
}
}

/// Returns the store the app was installed/downloaded from
#[tauri::command]
pub fn get_app_store() -> AppStore {
#[cfg(target_os = "windows")]
{
let package = windows::ApplicationModel::Package::Current();
match package {
Ok(package) => {
dbg!("Package: {:?}", package);
// if package
// .Id()
// .unwrap()
// .FamilyName()
// .unwrap()
// .to_string()
// .contains("Microsoft")
// {
// return AppStore::Microsoft;
// } else {
// return AppStore::Unknown;
// }
return AppStore::Microsoft;
}
Err(_) => return AppStore::GitHub,
}
}

// TODO: Determine app store for MacOS
#[cfg(target_os = "macos")]
{
return AppStore::Unknown;
}

#[cfg(target_os = "linux")]
{
return AppStore::GitHub;
}
}
8 changes: 8 additions & 0 deletions src-tauri/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ pub struct AppConfig {
pub authorization_token: Option<String>,
}

#[derive(Deserialize, Serialize)]
pub enum AppStore {
Microsoft,
Apple,
GitHub,
Unknown,
}

typify::import_types!(schema = "../prisma/json-schema.json");

#[derive(Deserialize)]
Expand Down
3 changes: 2 additions & 1 deletion src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ fn main() {
commands::remove_authorization_token,
commands::take_screenshot,
commands::restart_app,
commands::emit_to_sentry
commands::emit_to_sentry,
commands::get_app_store
])
.manage(sentry_state)
.run(tauri::generate_context!())
Expand Down
Loading