Add license page

This commit is contained in:
Julia Friesel
2018-12-21 17:14:27 +01:00
parent c713ed5490
commit 000e1b63c7
7 changed files with 101 additions and 33 deletions
+27 -12
View File
@@ -3,26 +3,41 @@ import { View } from 'react-native'
import nodejs from 'nodejs-mobile-react-native'
import App from './app'
import PasswordPrompt from './password-prompt'
import License from './license'
import { getLicenseFlag } from '../local-storage'
export default class AppWrapper extends Component {
constructor() {
super()
this.state = {}
this.state = {
showLicense: true
}
nodejs.start('main.js')
this.checkLicenseAgreement()
}
async checkLicenseAgreement() {
const agreed = await getLicenseFlag()
console.log(agreed)
if (agreed) this.setState({showLicense: false})
}
render() {
return (
<View style={{ flex: 1 }}>
{this.state.showApp ?
<App/>
:
<PasswordPrompt
showApp={() => {
this.setState({showApp: true})
}}
/>
}
</View>
this.state.showLicense ?
<License/>
:
<View style={{ flex: 1 }}>
{this.state.showApp ?
<App/>
:
<PasswordPrompt
showApp={() => {
this.setState({showApp: true})
}}
/>
}
</View>
)
}
}