isFirstOpen message
This commit is contained in:
@@ -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<PersistedState>()(
|
||||
setLicenseKey: (key: string | undefined) => set((_) => ({ licenseKey: key })),
|
||||
licenseValid: false,
|
||||
setLicenseValid: (valid: boolean) => set((_) => ({ licenseValid: valid })),
|
||||
|
||||
isFirstOpen: true,
|
||||
setIsFirstOpen: (isFirstOpen: boolean) => set((_) => ({ isFirstOpen })),
|
||||
}),
|
||||
{
|
||||
name: 'store',
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user