From 00279fa9855c6f56b240141067d5ff924960e05e Mon Sep 17 00:00:00 2001 From: FTCHD <144691102+FTCHD@users.noreply.github.com> Date: Tue, 14 Oct 2025 02:44:38 +0200 Subject: [PATCH] move onboard to startup Signed-off-by: FTCHD <144691102+FTCHD@users.noreply.github.com> --- lib/rclone/init.ts | 2 +- lib/store.ts | 9 +++------ main.ts | 10 +++++----- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/lib/rclone/init.ts b/lib/rclone/init.ts index 9ec9f0c..a454bc1 100644 --- a/lib/rclone/init.ts +++ b/lib/rclone/init.ts @@ -30,7 +30,7 @@ export async function initRclone(args: string[]) { // rclone not available, let's download it if (!system && !internal) { - usePersistedStore.setState({ isFirstOpen: false }) + useStore.setState({ startupDisplayed: true }) useStore.setState({ startupStatus: 'initializing' }) await openSmallWindow({ name: 'Startup', diff --git a/lib/store.ts b/lib/store.ts index 5d366c5..89a40de 100644 --- a/lib/store.ts +++ b/lib/store.ts @@ -46,6 +46,8 @@ interface State { | 'updated' | 'error' | 'fatal' + + startupDisplayed: boolean } interface PersistedState { @@ -91,9 +93,6 @@ interface PersistedState { licenseValid: boolean setLicenseValid: (valid: boolean) => void - isFirstOpen: boolean - setIsFirstOpen: (isFirstOpen: boolean) => void - startOnBoot: boolean setStartOnBoot: (startOnBoot: boolean) => void @@ -153,6 +152,7 @@ export const useStore = create()( set((state) => ({ remotes: state.remotes.filter((r) => r !== remote) })), startupStatus: null, + startupDisplayed: false, }), { name: 'shared-store' } ) @@ -199,9 +199,6 @@ export const usePersistedStore = create()( licenseValid: false, setLicenseValid: (valid: boolean) => set((_) => ({ licenseValid: valid })), - isFirstOpen: true, - setIsFirstOpen: (isFirstOpen: boolean) => set((_) => ({ isFirstOpen })), - startOnBoot: false, setStartOnBoot: (startOnBoot: boolean) => set((_) => ({ startOnBoot })), diff --git a/main.ts b/main.ts index 67fb1b9..4be27b0 100644 --- a/main.ts +++ b/main.ts @@ -357,15 +357,15 @@ async function startupMounts() { } } -async function onboardUser() { - const firstOpen = usePersistedStore.getState().isFirstOpen - if (firstOpen) { +async function showStartup() { + const startupDisplayed = useStore.getState().startupDisplayed + if (startupDisplayed) { useStore.setState({ startupStatus: 'initialized' }) await openSmallWindow({ name: 'Startup', url: '/startup', }) - usePersistedStore.setState({ isFirstOpen: false }) + useStore.setState({ startupDisplayed: false }) } } @@ -649,7 +649,7 @@ checkTraySupport() .then(() => validateInstance()) .then(() => checkAlreadyRunning()) .then(() => startRclone()) - .then(() => onboardUser()) + .then(() => showStartup()) .then(() => startupMounts()) .then(() => resumeTasks()) .then(() => showDefaultTray())