Clean up
This commit is contained in:
@@ -72,7 +72,7 @@ export default class CycleChart extends Component {
|
||||
'pain',
|
||||
'note'
|
||||
].filter((symptomName) => {
|
||||
return cycleDaysSortedByDate.some(cycleDay => cycleDay[symptomName])
|
||||
return this.cycleDaysSortedByDate.some(cycleDay => cycleDay[symptomName])
|
||||
})
|
||||
|
||||
const columns = xAxisDates.map(dateString => {
|
||||
|
||||
+1
-7
@@ -9,7 +9,7 @@ import { LocalDate, ChronoUnit } from 'js-joda'
|
||||
import nodejs from 'nodejs-mobile-react-native'
|
||||
import styles from '../styles/index'
|
||||
import cycleModule from '../lib/cycle'
|
||||
import { requestHash, getOrCreateCycleDay, getBleedingDaysSortedByDate, fillWithMucusDummyData, fillWithCervixDummyData, deleteAll, changeEncryptionAndRestartApp } from '../db'
|
||||
import { requestHash, getOrCreateCycleDay, getBleedingDaysSortedByDate, fillWithMucusDummyData, fillWithCervixDummyData, changeEncryptionAndRestartApp } from '../db'
|
||||
import {bleedingPrediction as labels} from './labels'
|
||||
|
||||
export default class Home extends Component {
|
||||
@@ -84,12 +84,6 @@ export default class Home extends Component {
|
||||
title="fill with example data for cervix&temp">
|
||||
</Button>
|
||||
</View>
|
||||
<View style={styles.homeButton}>
|
||||
<Button
|
||||
onPress={() => deleteAll()}
|
||||
title="delete everything">
|
||||
</Button>
|
||||
</View>
|
||||
<View style={styles.homeButton}>
|
||||
<Button
|
||||
onPress={() => {
|
||||
|
||||
@@ -36,6 +36,7 @@ export default class PasswordPrompt extends Component {
|
||||
try {
|
||||
await openDb({hash: msg.message, persistConnection: true })
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
Alert.alert(
|
||||
shared.incorrectPassword,
|
||||
shared.incorrectPasswordMessage,
|
||||
@@ -49,6 +50,35 @@ export default class PasswordPrompt extends Component {
|
||||
this.props.showApp()
|
||||
}
|
||||
|
||||
confirmDeletion = async () => {
|
||||
Alert.alert(
|
||||
labels.deleteDatabaseTitle,
|
||||
labels.deleteDatabaseExplainer,
|
||||
[{
|
||||
text: shared.cancel,
|
||||
style: 'cancel'
|
||||
}, {
|
||||
text: labels.deleteData,
|
||||
onPress: () => {
|
||||
Alert.alert(
|
||||
labels.areYouSureTitle,
|
||||
labels.areYouSure,
|
||||
[{
|
||||
text: shared.cancel,
|
||||
style: 'cancel'
|
||||
}, {
|
||||
text: labels.reallyDeleteData,
|
||||
onPress: async () => {
|
||||
await deleteDbAndOpenNew()
|
||||
this.props.showApp()
|
||||
}
|
||||
}]
|
||||
)
|
||||
}
|
||||
}]
|
||||
)
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
nodejs.channel.removeListener('message', this.passHashToDb)
|
||||
}
|
||||
@@ -79,34 +109,7 @@ export default class PasswordPrompt extends Component {
|
||||
</AppText>
|
||||
</TouchableOpacity>
|
||||
<TouchableOpacity
|
||||
onPress={async () => {
|
||||
Alert.alert(
|
||||
labels.deleteDatabaseTitle,
|
||||
labels.deleteDatabaseExplainer,
|
||||
[{
|
||||
text: shared.cancel,
|
||||
style: 'cancel'
|
||||
}, {
|
||||
text: labels.deleteData,
|
||||
onPress: () => {
|
||||
Alert.alert(
|
||||
labels.areYouSureTitle,
|
||||
labels.areYouSure,
|
||||
[{
|
||||
text: shared.cancel,
|
||||
style: 'cancel'
|
||||
}, {
|
||||
text: labels.reallyDeleteData,
|
||||
onPress: async () => {
|
||||
await deleteDbAndOpenNew()
|
||||
this.props.showApp()
|
||||
}
|
||||
}]
|
||||
)
|
||||
}
|
||||
}]
|
||||
)
|
||||
}}
|
||||
onPress={this.confirmDeletion}
|
||||
>
|
||||
<AppText style={styles.passwordPromptForgotPasswordText}>
|
||||
{labels.forgotPassword}
|
||||
|
||||
@@ -41,6 +41,7 @@ export default class PasswordSetting extends Component {
|
||||
try {
|
||||
await openDb({ hash: msg.message, persistConnection: false })
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
Alert.alert(
|
||||
shared.incorrectPassword,
|
||||
shared.incorrectPasswordMessage,
|
||||
|
||||
Reference in New Issue
Block a user