Make it so we don't have to give permission multiple times on launch.
This commit is contained in:
@@ -44,17 +44,21 @@ export default function App(): JSX.Element {
|
|||||||
await loadSession()
|
await loadSession()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load file tree, restore prefs + session, and detect first run
|
// Load file tree, restore prefs + session, and detect first run.
|
||||||
|
// Draft-directory calls are sequenced so macOS only prompts for folder access once.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
window.api.listFiles().then(setFileTree)
|
async function init(): Promise<void> {
|
||||||
initPrefs()
|
initPrefs()
|
||||||
loadSession()
|
const files = await window.api.listFiles()
|
||||||
window.api.readConfig().then((cfg) => {
|
setFileTree(files)
|
||||||
|
await loadSession()
|
||||||
|
const cfg = await window.api.readConfig()
|
||||||
if (!cfg.apiKey || !cfg.projectPath) {
|
if (!cfg.apiKey || !cfg.projectPath) {
|
||||||
setIsFirstRun(true)
|
setIsFirstRun(true)
|
||||||
setSettingsOpen(true)
|
setSettingsOpen(true)
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
init()
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
// Handle menu actions sent from the main process
|
// Handle menu actions sent from the main process
|
||||||
|
|||||||
Reference in New Issue
Block a user