From 5b7cb801429015db485e110b8b59e9c5693c5024 Mon Sep 17 00:00:00 2001 From: Niko PLP Date: Sun, 14 Jul 2024 23:59:17 +0300 Subject: [PATCH] fix on mobile tauri --- ng-app/src-tauri/src/lib.rs | 6 +- ng-app/src/api.ts | 5 + .../src/lib/components/PasswordInput.svelte | 1 + ng-app/src/routes/WalletInfo.svelte | 119 ++++++++---------- 4 files changed, 64 insertions(+), 67 deletions(-) diff --git a/ng-app/src-tauri/src/lib.rs b/ng-app/src-tauri/src/lib.rs index 18ff0f4..873d008 100644 --- a/ng-app/src-tauri/src/lib.rs +++ b/ng-app/src-tauri/src/lib.rs @@ -572,7 +572,9 @@ impl AppBuilder { pub fn run(self) { let setup = self.setup; - let builder = tauri::Builder::default() + + #[allow(unused_mut)] + let mut builder = tauri::Builder::default() .setup(move |app| { if let Some(setup) = setup { (setup)(app)?; @@ -592,7 +594,7 @@ impl AppBuilder { #[cfg(mobile)] { - let builder = builder.plugin(tauri_plugin_barcode_scanner::init()); + builder = builder.plugin(tauri_plugin_barcode_scanner::init()); } builder diff --git a/ng-app/src/api.ts b/ng-app/src/api.ts index 05e13d2..f6eaecc 100644 --- a/ng-app/src/api.ts +++ b/ng-app/src/api.ts @@ -106,6 +106,11 @@ const handler = { }; //console.log(info,res); return res; + } else if (path[0] === "get_device_name") { + let tauri_platform = import.meta.env.TAURI_PLATFORM; + if (tauri_platform == 'android') return "Android Phone"; + else if (tauri_platform == 'ios') return "iPhone"; + else return await tauri.invoke(path[0],{}); } else if (path[0] === "locales") { let from_rust = await tauri.invoke("locales",{}); let from_js = window.navigator.languages; diff --git a/ng-app/src/lib/components/PasswordInput.svelte b/ng-app/src/lib/components/PasswordInput.svelte index 6ed9c88..80a9569 100644 --- a/ng-app/src/lib/components/PasswordInput.svelte +++ b/ng-app/src/lib/components/PasswordInput.svelte @@ -40,6 +40,7 @@
+ {/if} {:else if sub_menu === "text_code"} - - - -
  • -

    - {$t("pages.wallet_info.gen_text_code.title")} -

    -
  • +
    +
    +

    + {$t("pages.wallet_info.gen_text_code.title")} +

    +
    - - + + - - {#if generation_state === "before_start"} -
    - - {@html $t("wallet_sync.textcode.usage_warning")} - -
    - {/if} - - {#if !$online} -
  • - - {@html $t("wallet_sync.offline_warning")} - -
  • - {:else} -
  • - {@html $t("wallet_sync.expiry")} -
  • - {/if} + + {#if generation_state === "before_start"} +
    + + {@html $t("wallet_sync.textcode.usage_warning")} + +
    + {/if} + +
    + {#if !$online} + + {@html $t("wallet_sync.offline_warning")} + + {:else} + {@html $t("wallet_sync.expiry")} + {/if} +
    -
    - {#if generation_state === "before_start"} - - {:else if generation_state == "loading"} - - {:else} - - {$t("pages.wallet_info.gen_text_code.label")} -
    - -
    - {/if} +
    + {#if generation_state === "before_start"} + + {:else if generation_state == "loading"} + + {:else} + + {$t("pages.wallet_info.gen_text_code.label")} +
    +
    - - - + {/if} +
    +
    {/if}
    {#if error}