Skip to content

Commit

Permalink
fix: use useragent instead of tauri api to get platform
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludea committed Oct 7, 2024
1 parent 35b7288 commit 727fc1c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ tokio-stream = "0.1"
rust-argon2 = "2.1.0"
getrandom = "0.2.15"
async-lock = "3.4.0"
tauri-plugin-os = "2.0.0"
tauri-plugin-stronghold = "2.0.0"

[target.'cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))'.dependencies]
Expand All @@ -44,6 +43,7 @@ tauri-plugin-single-instance = "2.0.0"
tauri-plugin-autostart = "2.0.0"
tauri-plugin-shell = "2.0.0"
tauri-plugin-store = "2.0.0"
tauri-plugin-os = "2.0.0"

[features]
default = [ "custom-protocol" ]
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ pub fn run() {

Ok(())
})
.plugin(tauri_plugin_os::init())
.plugin(
tauri_plugin_stronghold::Builder::new(|password| {
let config = Config {
Expand Down Expand Up @@ -66,6 +65,7 @@ pub fn run() {
#[cfg(desktop)]
{
builder = builder
.plugin(tauri_plugin_os::init())
.plugin(tauri_plugin_notification::init())
.plugin(tauri_plugin_shell::init())
.plugin(tauri_plugin_store::Builder::default().build())
Expand Down
5 changes: 4 additions & 1 deletion src/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ interface UpdateEvent {
applied_output_bytes_per_sec: number;
}

const userAgent = navigator.userAgent.toLowerCase();
const isMobile = userAgent.includes("android") || userAgent.includes("iphone");

const convertReadableData = (data: number): string => {
if (data > 1024 && data < 1024 * 1024) {
return `${String(Math.floor((data / 1024) * 100) / 100)} kiB`;
Expand Down Expand Up @@ -60,7 +63,7 @@ function Footer() {
const { setGlobalError } = useContext(SparusErrorContext);

useEffect(() => {
if (platform() !== "android") {
if (!isMobile) {
appConfigDir()
.then((dir) => setLocalConfig(dir))
.catch((err: string) => setGlobalError(err));
Expand Down

0 comments on commit 727fc1c

Please sign in to comment.