Add license page
This commit is contained in:
+27
-12
@@ -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>
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import React from 'react'
|
||||
import { View } from 'react-native'
|
||||
import AppText from './app-text'
|
||||
import styles from '../styles'
|
||||
|
||||
export default function Button({ backgroundColor, style, children }) {
|
||||
return (
|
||||
<View style={[
|
||||
styles.button,
|
||||
style,
|
||||
{backgroundColor}
|
||||
]}>
|
||||
<AppText style={styles.homeButtonText}>
|
||||
{children}
|
||||
</AppText>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
+7
-19
@@ -10,19 +10,7 @@ import { getFertilityStatusForDay } from '../lib/sympto-adapter'
|
||||
import styles from '../styles'
|
||||
import AppText, { AppTextLight } from './app-text'
|
||||
import DripHomeIcon from '../assets/drip-home-icons'
|
||||
|
||||
const HomeButton = ({ backgroundColor, children }) => {
|
||||
return (
|
||||
<View style={[
|
||||
styles.homeButton,
|
||||
{backgroundColor}
|
||||
]}>
|
||||
<AppText style={styles.homeButtonText}>
|
||||
{children}
|
||||
</AppText>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
import Button from './button'
|
||||
|
||||
export default class Home extends Component {
|
||||
constructor(props) {
|
||||
@@ -78,9 +66,9 @@ export default class Home extends Component {
|
||||
<AppText style={styles.paragraph}>{cycleDayMoreText}</AppText>
|
||||
}
|
||||
|
||||
<HomeButton backgroundColor={cycleDayColor}>
|
||||
<Button backgroundColor={cycleDayColor}>
|
||||
{labels.editToday}
|
||||
</HomeButton>
|
||||
</Button>
|
||||
|
||||
</TouchableOpacity>
|
||||
|
||||
@@ -103,9 +91,9 @@ export default class Home extends Component {
|
||||
</AppText>
|
||||
}
|
||||
|
||||
<HomeButton backgroundColor={periodColor}>
|
||||
<Button backgroundColor={periodColor}>
|
||||
{labels.trackPeriod}
|
||||
</HomeButton>
|
||||
</Button>
|
||||
|
||||
</TouchableOpacity>
|
||||
|
||||
@@ -136,9 +124,9 @@ export default class Home extends Component {
|
||||
</AppText>
|
||||
}
|
||||
|
||||
<HomeButton backgroundColor={secondaryColor}>
|
||||
<Button backgroundColor={secondaryColor}>
|
||||
{labels.checkFertility}
|
||||
</HomeButton>
|
||||
</Button>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import React from 'react'
|
||||
import { ScrollView, View } from 'react-native'
|
||||
import AppText from './app-text'
|
||||
import { licenseText, shared } from '../i18n/en/labels'
|
||||
import styles,{secondaryColor} from '../styles'
|
||||
import Button from './button'
|
||||
|
||||
export default function License() {
|
||||
return (
|
||||
<ScrollView style={styles.licensePage}>
|
||||
<AppText>{licenseText}</AppText>
|
||||
<View style={styles.licenseButtons}>
|
||||
<Button style={styles.licenseButton} backgroundColor={'grey'}>
|
||||
{shared.cancel}
|
||||
</Button>
|
||||
<Button style={styles.licenseButton} backgroundColor={secondaryColor}>
|
||||
{shared.ok}
|
||||
</Button>
|
||||
</View>
|
||||
</ScrollView>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user