This commit is contained in:
Julia Friesel
2018-09-14 13:08:11 +02:00
parent 01a1fa4385
commit a74eb40805
4 changed files with 42 additions and 17 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

+1 -1
View File
@@ -106,6 +106,6 @@ export const bleedingPrediction = {
} }
export const passwordPrompt = { export const passwordPrompt = {
title: 'Log in', title: 'Unlock app',
enterPassword: 'Enter password here' enterPassword: 'Enter password here'
} }
+12 -8
View File
@@ -1,5 +1,5 @@
import React, { Component } from 'react' import React, { Component } from 'react'
import { View, TextInput, TouchableOpacity, Alert } from 'react-native' import { View, TextInput, TouchableOpacity, Alert, Image } from 'react-native'
import nodejs from 'nodejs-mobile-react-native' import nodejs from 'nodejs-mobile-react-native'
import { AppText } from './app-text' import { AppText } from './app-text'
import { hasEncryptionObservable } from '../local-storage' import { hasEncryptionObservable } from '../local-storage'
@@ -55,33 +55,37 @@ export default class PasswordPrompt extends Component {
render() { render() {
return ( return (
<View style={styles.passwordPrompt}> <View flex={1}>
{this.state.showPasswordPrompt && {this.state.showPasswordPrompt &&
<View> <View style={styles.passwordPromptPage}>
<Image
source={require('../assets/drip_small.png')}
style={styles.passwordPromptImage}
/>
<TextInput <TextInput
onChangeText={val => this.setState({ password: val })} onChangeText={val => this.setState({ password: val })}
style={styles.passwordField} style={styles.passwordPromptField}
secureTextEntry={true} secureTextEntry={true}
placeholder={passwordPrompt.enterPassword} placeholder={passwordPrompt.enterPassword}
/> />
<TouchableOpacity <TouchableOpacity
style={styles.settingsButton} style={styles.passwordPromptButton}
onPress={() => { onPress={() => {
requestHash(this.state.password) requestHash(this.state.password)
}} }}
> >
<AppText style={styles.settingsButtonText}> <AppText style={styles.passwordPromptButtonText}>
{passwordPrompt.title} {passwordPrompt.title}
</AppText> </AppText>
</TouchableOpacity> </TouchableOpacity>
<TouchableOpacity <TouchableOpacity
style={styles.settingsButton} style={styles.passwordPromptButton}
onPress={async () => { onPress={async () => {
await deleteDbAndOpenNew() await deleteDbAndOpenNew()
this.setState({ showApp: true }) this.setState({ showApp: true })
}} }}
> >
<AppText style={styles.settingsButtonText}> <AppText style={styles.passwordPromptButtonText}>
{'Delete old db and make unencrypted new'} {'Delete old db and make unencrypted new'}
</AppText> </AppText>
</TouchableOpacity> </TouchableOpacity>
+29 -8
View File
@@ -170,7 +170,7 @@ export default StyleSheet.create({
backgroundColor: secondaryColor, backgroundColor: secondaryColor,
padding: 10, padding: 10,
alignItems: 'center', alignItems: 'center',
margin: 10 margin: 10,
}, },
settingsButtonText: { settingsButtonText: {
color: fontOnPrimaryColor color: fontOnPrimaryColor
@@ -251,16 +251,37 @@ export default StyleSheet.create({
marginTop: 1 marginTop: 1
}, },
passwordField: { passwordField: {
backgroundColor: 'white',
padding: 10, padding: 10,
marginTop: 10, marginTop: 10,
marginHorizontal: 10 marginHorizontal: 10,
backgroundColor: 'white'
},
passwordPromptPage: {
padding: 30,
alignItems: 'center'
},
passwordPromptField: {
padding: 10,
marginTop: 10,
marginHorizontal: 10,
borderBottomWidth: 3,
borderBottomColor: primaryColor,
width: '100%',
fontSize: 20,
marginVertical: 20
},
passwordPromptButton: {
backgroundColor: secondaryColor,
padding: 10,
alignItems: 'center',
margin: 10,
width: '100%',
borderRadius: 10
},
passwordPromptButtonText: {
color: fontOnPrimaryColor,
fontSize: 20
}, },
passwordPrompt: {
backgroundColor: 'lightgrey',
flex: 1,
padding: 30
}
}) })
export const iconStyles = { export const iconStyles = {