Skip to content
Snippets Groups Projects
Commit 480e4533 authored by Julia Friesel's avatar Julia Friesel
Browse files

Fix license screen flicker

parent 2c1b8562
No related branches found
No related tags found
No related merge requests found
...@@ -10,7 +10,7 @@ export default class AppWrapper extends Component { ...@@ -10,7 +10,7 @@ export default class AppWrapper extends Component {
constructor() { constructor() {
super() super()
this.state = { this.state = {
showLicense: true retrievingLicenseSetting: true
} }
nodejs.start('main.js') nodejs.start('main.js')
this.checkLicenseAgreement() this.checkLicenseAgreement()
...@@ -18,25 +18,27 @@ export default class AppWrapper extends Component { ...@@ -18,25 +18,27 @@ export default class AppWrapper extends Component {
async checkLicenseAgreement() { async checkLicenseAgreement() {
const agreed = await getLicenseFlag() const agreed = await getLicenseFlag()
if (agreed) this.setState({showLicense: false}) this.setState({retrievingLicenseSetting: false})
if (!agreed) this.setState({showLicense: true})
} }
render() { render() {
return ( const whiteScreen = <View style={{ flex: 1 }}></View>
this.state.showLicense ? const licenseScreen = <License setLicense={() => {
<License setLicense={() => this.setState({showLicense: false})}/> this.setState({showLicense: false})
: }}/>
<View style={{ flex: 1 }}> const passwordPrompt = <PasswordPrompt showApp={() => {
{this.state.showApp ? this.setState({showApp: true})
<App/> }}/>
:
<PasswordPrompt if (this.state.retrievingLicenseSetting) {
showApp={() => { return whiteScreen
this.setState({showApp: true}) } else if (this.state.showLicense) {
}} return licenseScreen
/> } else if (!this.state.showApp) {
} return passwordPrompt
</View> } else {
) return <App/>
}
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment