Improvements to android store loading
This commit is contained in:
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "Materialious",
|
||||
"version": "1.14.1",
|
||||
"version": "1.14.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "Materialious",
|
||||
"version": "1.14.1",
|
||||
"version": "1.14.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@capacitor-community/electron": "^5.0.0",
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
)}
|
||||
>
|
||||
<nav>
|
||||
<div class="field label border max">
|
||||
<div class="field prefix label border max">
|
||||
<i>link</i>
|
||||
<input tabindex="0" bind:value={synciousInstance} name="syncious-instance" type="text" />
|
||||
<label tabindex="-1" for="syncious-instance">{$_('layout.instanceUrl')}</label>
|
||||
</div>
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
<form onsubmit={preventDefault(() => deArrowInstanceStore.set(ensureNoTrailingSlash(deArrowUrl)))}>
|
||||
<nav>
|
||||
<div class="field label border max">
|
||||
<div class="field prefix label border max">
|
||||
<i>link</i>
|
||||
<input bind:value={deArrowUrl} name="dearrow-instance" type="text" />
|
||||
<label for="dearrow-instance">{$_('layout.instanceUrl')}</label>
|
||||
</div>
|
||||
|
||||
@@ -165,7 +165,8 @@
|
||||
{#if $backendInUseStore === 'ivg'}
|
||||
<form onsubmit={setInstance}>
|
||||
<nav>
|
||||
<div class="field label border max" class:invalid={invalidInstance}>
|
||||
<div class="field prefix label border max" class:invalid={invalidInstance}>
|
||||
<i>link</i>
|
||||
<input
|
||||
tabindex="0"
|
||||
bind:value={invidiousInstance}
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
)}
|
||||
>
|
||||
<nav>
|
||||
<div class="field label border max">
|
||||
<div class="field prefix label border max">
|
||||
<i>link</i>
|
||||
<input tabindex="0" bind:value={returnYTInstance} name="returnyt-instance" type="text" />
|
||||
<label tabindex="-1" for="returnyt-instance">{$_('layout.instanceUrl')}</label>
|
||||
</div>
|
||||
|
||||
@@ -48,7 +48,8 @@
|
||||
)}
|
||||
>
|
||||
<nav>
|
||||
<div class="field label border max">
|
||||
<div class="field prefix label border max">
|
||||
<i>link</i>
|
||||
<input
|
||||
tabindex="0"
|
||||
bind:value={sponsorBlockInstance}
|
||||
|
||||
@@ -6,8 +6,14 @@ import { getResolveUrl } from '$lib/api';
|
||||
import '$lib/i18n'; // Import to initialize. Important :)
|
||||
import { initI18n } from '$lib/i18n';
|
||||
import { getPages } from '$lib/navPages';
|
||||
import { authStore, instanceStore, interfaceDefaultPage, isAndroidTvStore } from '$lib/store';
|
||||
import { get } from 'svelte/store';
|
||||
import {
|
||||
authStore,
|
||||
backendInUseStore,
|
||||
instanceStore,
|
||||
interfaceDefaultPage,
|
||||
isAndroidTvStore
|
||||
} from '$lib/store';
|
||||
import { get, type Writable } from 'svelte/store';
|
||||
import '$lib/android/http/androidRequests';
|
||||
import { Capacitor } from '@capacitor/core';
|
||||
import { Preferences } from '@capacitor/preferences';
|
||||
@@ -25,14 +31,15 @@ export async function load({ url }) {
|
||||
// Due to race condition with how we set & save persistent store values
|
||||
// we manually set stores like auth & instance before load.
|
||||
if (Capacitor.getPlatform() === 'android') {
|
||||
const instancePreferences = await Preferences.get({ key: 'invidiousInstance' });
|
||||
if (instancePreferences.value !== null) {
|
||||
instanceStore.set(deserialize(instancePreferences.value));
|
||||
}
|
||||
const preferenceKey: Record<string, Writable<any>> = {
|
||||
invidiousInstance: instanceStore,
|
||||
authToken: authStore,
|
||||
backendInUse: backendInUseStore
|
||||
};
|
||||
|
||||
const authPreferences = await Preferences.get({ key: 'authToken' });
|
||||
if (authPreferences.value !== null) {
|
||||
authStore.set(deserialize(authPreferences.value));
|
||||
for (const [key, store] of Object.entries(preferenceKey)) {
|
||||
const result = await Preferences.get({ key: key });
|
||||
if (result.value !== null) store.set(deserialize(result.value));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user