|
|
|
@ -48,17 +48,32 @@ export const GitUI = (props: IGitUi) => { |
|
|
|
|
const [activePanel, setActivePanel] = useState<string>("0") |
|
|
|
|
const [setup, setSetup] = useState<boolean>(false) |
|
|
|
|
const [needsInit, setNeedsInit] = useState<boolean>(true) |
|
|
|
|
const [appLoaded, setAppLoaded] = useState<boolean>(false) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
plugin.emit('statusChanged', { |
|
|
|
|
key:'loading', |
|
|
|
|
type: 'info', |
|
|
|
|
title: 'Loading Git Plugin' |
|
|
|
|
}) |
|
|
|
|
setTimeout(() => { |
|
|
|
|
setAppLoaded(true) |
|
|
|
|
}, 2000) |
|
|
|
|
},[]) |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
if(!appLoaded) return |
|
|
|
|
setCallBacks(plugin, gitDispatch, loaderDispatch) |
|
|
|
|
setPlugin(plugin, gitDispatch, loaderDispatch) |
|
|
|
|
loaderDispatch({ type: 'plugin', payload: true }) |
|
|
|
|
console.log(props) |
|
|
|
|
}, []) |
|
|
|
|
}, [appLoaded]) |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
if(!appLoaded) return |
|
|
|
|
async function checkconfig() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const username = await plugin.call('settings', 'get', 'settings/github-user-name') |
|
|
|
|
const email = await plugin.call('settings', 'get', 'settings/github-email') |
|
|
|
|
const token = await plugin.call('settings', 'get', 'settings/gist-access-token') |
|
|
|
@ -69,7 +84,7 @@ export const GitUI = (props: IGitUi) => { |
|
|
|
|
}, [gitState.gitHubAccessToken, gitState.gitHubUser, gitState.userEmails]) |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
|
|
if(!appLoaded) return |
|
|
|
|
async function setDecorators(gitState: gitState) { |
|
|
|
|
await plugin.call('fileDecorator', 'clearFileDecorators') |
|
|
|
|
await setModifiedDecorator(gitState.modified) |
|
|
|
@ -83,7 +98,7 @@ export const GitUI = (props: IGitUi) => { |
|
|
|
|
}, [gitState.fileStatusResult]) |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
|
|
if(!appLoaded) return |
|
|
|
|
async function updatestate() { |
|
|
|
|
console.log('updatestate', gitState) |
|
|
|
|
if (gitState.currentBranch && gitState.currentBranch.remote && gitState.currentBranch.remote.url) { |
|
|
|
|