From db4b863d50880fd8fa6d8870a0e10cefd95a056c Mon Sep 17 00:00:00 2001 From: FTCHD Date: Sun, 2 Feb 2025 12:53:02 +0200 Subject: [PATCH] isFirstOpen message --- lib/store.ts | 6 ++++++ main.ts | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/lib/store.ts b/lib/store.ts index 9491cac..bd219ab 100644 --- a/lib/store.ts +++ b/lib/store.ts @@ -56,6 +56,9 @@ interface PersistedState { setLicenseKey: (key: string | undefined) => void licenseValid: boolean setLicenseValid: (valid: boolean) => void + + isFirstOpen: boolean + setIsFirstOpen: (isFirstOpen: boolean) => void } const getStorage = (store: LazyStore): StateStorage => ({ @@ -131,6 +134,9 @@ export const usePersistedStore = create()( setLicenseKey: (key: string | undefined) => set((_) => ({ licenseKey: key })), licenseValid: false, setLicenseValid: (valid: boolean) => set((_) => ({ licenseValid: valid })), + + isFirstOpen: true, + setIsFirstOpen: (isFirstOpen: boolean) => set((_) => ({ isFirstOpen })), }), { name: 'store', diff --git a/main.ts b/main.ts index e572c77..8f7a6f0 100644 --- a/main.ts +++ b/main.ts @@ -205,5 +205,16 @@ initLoadingTray() .then(() => waitForHydration()) .then(() => validateInstance()) .then(() => startRclone()) + .then(async () => { + const firstOpen = usePersistedStore.getState().isFirstOpen + if (firstOpen) { + await message('Rclone has initialized, you can now find it in the tray menu!', { + title: 'Welcome', + kind: 'info', + okLabel: 'Got it', + }) + usePersistedStore.setState({ isFirstOpen: false }) + } + }) .then(() => initTray()) .catch(console.error)