diff --git a/src/client.js b/src/client.js index 47400a87..966ce35a 100644 --- a/src/client.js +++ b/src/client.js @@ -11,6 +11,8 @@ localforage.config({ description: 'paimonmoe local storage', }); +window.localforage = localforage; + startClient(); sapper.start({ diff --git a/src/components/DataSync.svelte b/src/components/DataSync.svelte index d9186f27..8231ee76 100644 --- a/src/components/DataSync.svelte +++ b/src/components/DataSync.svelte @@ -99,7 +99,7 @@ async function useRemoteData() { // check if old local storage version - if (remoteSave['converted'] === undefined) { + if (!remoteSave['converted'] === undefined) { for (const key in remoteSave) { if (key.endsWith('ar') || key.endsWith('wl')) { await updateSave(key, Number(remoteSave[key]), true); @@ -109,7 +109,8 @@ key.endsWith('accounts') || key.endsWith('locale') || key.endsWith('server') || - key.endsWith('update-time') + key.endsWith('update-time') || + key.endsWith('converted') ) { await updateSave(key, remoteSave[key], true); } else if ( @@ -126,8 +127,35 @@ } console.log('finished convert from google drive'); } else { - for (const k in remoteSave) { - await updateSave(k, remoteSave[k], true); + for (const key in remoteSave) { + if (typeof remoteSave[key] === 'string') { + console.log('converting', key); + if (key.endsWith('ar') || key.endsWith('wl')) { + await updateSave(key, Number(remoteSave[key]), true); + } else if (key.endsWith('collectables-updated')) { + await updateSave(key, remoteSave[key] === 'true', true); + } else if ( + key.endsWith('accounts') || + key.endsWith('locale') || + key.endsWith('server') || + key.endsWith('update-time') || + key.endsWith('converted') + ) { + await updateSave(key, remoteSave[key], true); + } else if ( + key.endsWith('wish-counter-character-event') || + key.endsWith('wish-counter-weapon-event') || + key.endsWith('wish-counter-standard') || + key.endsWith('wish-counter-beginners') + ) { + const converted = convertTime(JSON.parse(remoteSave[key])); + await updateSave(key, converted, true); + } else { + await updateSave(key, JSON.parse(remoteSave[key]), true); + } + } else { + await updateSave(key, remoteSave[key], true); + } } } diff --git a/src/components/SettingData.svelte b/src/components/SettingData.svelte index 2e554367..e8c0df1e 100644 --- a/src/components/SettingData.svelte +++ b/src/components/SettingData.svelte @@ -9,9 +9,9 @@ let unsubscribeWl = null; let firstLoad = true; - $: if ($fromRemote) { - readLocalData(); - } + // $: if ($fromRemote) { + // readLocalData(); + // } onMount(async () => { await readLocalData(); diff --git a/src/data/banners.js b/src/data/banners.js index 664ae51d..b64fc295 100644 --- a/src/data/banners.js +++ b/src/data/banners.js @@ -142,6 +142,7 @@ export const banners = { start: '2021-05-18 18:00:00', end: '2021-06-08 15:00:00', color: '#A6D6E0', + featuredRare: ['xingqiu', 'beidou', 'xinyan'], featured: ['eula'], }, ], diff --git a/src/routes/_index/banner.svelte b/src/routes/_index/banner.svelte index a0b80503..a6addc0d 100644 --- a/src/routes/_index/banner.svelte +++ b/src/routes/_index/banner.svelte @@ -59,6 +59,7 @@ await tick(); dispatch('done'); }); +
@@ -68,20 +69,20 @@ {#each Object.entries(featured) as [_, item], i}
-

+

{#if loading} {:else} {item.count} {/if}

-

{$t(`home.banner.featured.${i}`)}

+

+ {$t(`home.banner.featured.${i}`)} + {$t('home.banner.summoned')} +

{/each}
@@ -96,7 +97,7 @@

{$t('home.banner.avg')} {item.average}

{/each} -

※ {$t('home.banner.subtitle', { values: { user }})}

+

※ {$t('home.banner.subtitle', { values: { user } })}

- + {banner.name}
diff --git a/src/stores/saveManager.js b/src/stores/saveManager.js index e7854f3e..462c851e 100644 --- a/src/stores/saveManager.js +++ b/src/stores/saveManager.js @@ -129,6 +129,7 @@ export const getLocalSaveJson = async () => { }; export const updateSave = async (key, data, isFromRemote) => { + console.log('updateSave', key, isFromRemote); if (!isFromRemote) { localModified.set(true); }