fix on mobile tauri

pull/32/head
Niko PLP 4 months ago
parent 3fb85ea8c7
commit 323aefd655
  1. 6
      ng-app/src-tauri/src/lib.rs
  2. 5
      ng-app/src/api.ts
  3. 1
      ng-app/src/lib/components/PasswordInput.svelte
  4. 119
      ng-app/src/routes/WalletInfo.svelte

@ -572,7 +572,9 @@ impl AppBuilder {
pub fn run(self) { pub fn run(self) {
let setup = self.setup; let setup = self.setup;
let builder = tauri::Builder::default()
#[allow(unused_mut)]
let mut builder = tauri::Builder::default()
.setup(move |app| { .setup(move |app| {
if let Some(setup) = setup { if let Some(setup) = setup {
(setup)(app)?; (setup)(app)?;
@ -592,7 +594,7 @@ impl AppBuilder {
#[cfg(mobile)] #[cfg(mobile)]
{ {
let builder = builder.plugin(tauri_plugin_barcode_scanner::init()); builder = builder.plugin(tauri_plugin_barcode_scanner::init());
} }
builder builder

@ -106,6 +106,11 @@ const handler = {
}; };
//console.log(info,res); //console.log(info,res);
return 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") { } else if (path[0] === "locales") {
let from_rust = await tauri.invoke("locales",{}); let from_rust = await tauri.invoke("locales",{});
let from_js = window.navigator.languages; let from_js = window.navigator.languages;

@ -40,6 +40,7 @@
</script> </script>
<div class="relative"> <div class="relative">
<!-- svelte-ignore a11y-autofocus -->
<input <input
bind:this={input} bind:this={input}
{value} {value}

@ -576,75 +576,64 @@
</div> </div>
{/if} {/if}
{:else if sub_menu === "text_code"} {:else if sub_menu === "text_code"}
<Sidebar {nonActiveClass}> <div
<SidebarWrapper class="flex flex-col justify-center max-w-md mx-6 mb-20 bg-gray-60 overflow-y-auto py-4 dark:bg-gray-800"
divClass="mb-10 bg-gray-60 overflow-y-auto py-4 px-3 rounded dark:bg-gray-800" >
> <div>
<SidebarGroup ulClass="space-y-2" role="menu"> <h2 class="text-xl mb-6">
<li> {$t("pages.wallet_info.gen_text_code.title")}
<h2 class="text-xl mb-6"> </h2>
{$t("pages.wallet_info.gen_text_code.title")} </div>
</h2>
</li>
<!-- Go Back --> <!-- Go Back -->
<li <button
tabindex="0" on:click={to_main_menu}
role="menuitem" class="w-full text-gray-500 dark:text-gray-400 focus:ring-4 focus:ring-primary-100/50 rounded-lg text-lg px-5 py-2.5 text-center inline-flex items-center dark:focus:ring-primary-700/55"
class="text-left flex items-center p-2 text-base font-normal text-gray-900 clickable rounded-lg dark:text-white hover:bg-gray-200 dark:hover:bg-gray-700" ><ArrowLeft
on:keypress={to_main_menu} tabindex="-1"
on:click={to_main_menu} class="w-8 h-8 mr-2 -ml-1 transition duration-75 focus:outline-none group-hover:text-gray-900 dark:group-hover:text-white"
> />{$t("buttons.back")}</button
<ArrowLeft >
tabindex="-1"
class="w-7 h-7 text-black transition duration-75 dark:text-white group-hover:text-gray-900 dark:group-hover:text-white"
/>
<span class="ml-3">{$t("buttons.back")}</span>
</li>
<!-- Warning to prefer QR codes or wallet downloads --> <!-- Warning to prefer QR codes or wallet downloads -->
{#if generation_state === "before_start"} {#if generation_state === "before_start"}
<div class="text-left my-4"> <div class="text-left my-4">
<Alert color="yellow"> <Alert color="yellow">
{@html $t("wallet_sync.textcode.usage_warning")} {@html $t("wallet_sync.textcode.usage_warning")}
</Alert> </Alert>
</div> </div>
{/if} {/if}
<!-- Warning if offline --> <!-- Warning if offline -->
{#if !$online} <div class="text-left my-4">
<li class="text-left my-4"> {#if !$online}
<Alert color="red"> <Alert color="red">
{@html $t("wallet_sync.offline_warning")} {@html $t("wallet_sync.offline_warning")}
</Alert> </Alert>
</li> {:else}
{:else} {@html $t("wallet_sync.expiry")}
<li class="text-left my-4"> {/if}
{@html $t("wallet_sync.expiry")} </div>
</li>
{/if}
<div class="mt-4"> <div class="mt-4">
{#if generation_state === "before_start"} {#if generation_state === "before_start"}
<Button <Button
on:click={generate_text_code} on:click={generate_text_code}
disabled={!$online} disabled={!$online}
class="my-4 w-full text-white bg-primary-700 hover:bg-primary-700/90 focus:ring-4 focus:ring-primary-100/50 rounded-lg text-lg px-5 py-2.5 text-center inline-flex items-center dark:focus:ring-primary-700/55" class="my-4 w-full text-white bg-primary-700 hover:bg-primary-700/90 focus:ring-4 focus:ring-primary-100/50 rounded-lg text-lg px-5 py-2.5 text-center inline-flex items-center dark:focus:ring-primary-700/55"
> >
{$t("pages.wallet_info.gen_text_code.gen_btn")} {$t("pages.wallet_info.gen_text_code.gen_btn")}
</Button> </Button>
{:else if generation_state == "loading"} {:else if generation_state == "loading"}
<Spinner class="mx-auto" size="6" /> <Spinner class="mx-auto" size="6" />
{:else} {:else}
<!-- TextCode Code --> <!-- TextCode Code -->
<span>{$t("pages.wallet_info.gen_text_code.label")}</span> <span>{$t("pages.wallet_info.gen_text_code.label")}</span>
<div> <div>
<CopyToClipboard rows={8} value={generated_text_code} /> <CopyToClipboard rows={8} value={generated_text_code} />
</div>
{/if}
</div> </div>
</SidebarGroup> {/if}
</SidebarWrapper> </div>
</Sidebar> </div>
{/if} {/if}
</div> </div>
{#if error} {#if error}

Loading…
Cancel
Save