diff --git a/components/app-wrapper.js b/components/app-wrapper.js index 0ac1748..4e8665b 100644 --- a/components/app-wrapper.js +++ b/components/app-wrapper.js @@ -10,7 +10,7 @@ export default class AppWrapper extends Component { constructor() { super() this.state = { - showLicense: true + retrievingLicenseSetting: true } nodejs.start('main.js') this.checkLicenseAgreement() @@ -18,25 +18,27 @@ export default class AppWrapper extends Component { async checkLicenseAgreement() { const agreed = await getLicenseFlag() - if (agreed) this.setState({showLicense: false}) + this.setState({retrievingLicenseSetting: false}) + if (!agreed) this.setState({showLicense: true}) } render() { - return ( - this.state.showLicense ? - this.setState({showLicense: false})}/> - : - - {this.state.showApp ? - - : - { - this.setState({showApp: true}) - }} - /> - } - - ) + const whiteScreen = + const licenseScreen = { + this.setState({showLicense: false}) + }}/> + const passwordPrompt = { + this.setState({showApp: true}) + }}/> + + if (this.state.retrievingLicenseSetting) { + return whiteScreen + } else if (this.state.showLicense) { + return licenseScreen + } else if (!this.state.showApp) { + return passwordPrompt + } else { + return + } } } \ No newline at end of file