Delete password button bug fix

This commit is contained in:
mashazyu
2019-04-15 14:05:51 +02:00
parent 772a277315
commit a291c78379
5 changed files with 29 additions and 10 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ export default class CreatePassword extends Component {
}
startSettingPassword = () => {
showBackUpReminder(this.toggleSettingPassword)
showBackUpReminder(this.toggleSettingPassword, () => {})
}
render () {
+2 -1
View File
@@ -14,7 +14,7 @@ export default class DeletePassword extends Component {
startConfirmWithPassword = () => {
this.setState({ enteringCurrentPassword: true })
this.props.onStartDeletingPassword()
this.props.onStartDelete()
}
startDeletePassword = async () => {
@@ -23,6 +23,7 @@ export default class DeletePassword extends Component {
cancelConfirmationWithPassword = () => {
this.setState({ enteringCurrentPassword: false })
this.props.onCancelDelete()
}
render() {
+12 -2
View File
@@ -24,10 +24,18 @@ export default class PasswordSetting extends Component {
this.setState({ isChangingPassword: true })
}
onCancelChangingPassword = () => {
this.setState({ isChangingPassword: false })
}
onDeletingPassword = () => {
this.setState({ isDeletingPassword: true })
}
onCancelDeletingPassword = () => {
this.setState({ isDeletingPassword: false })
}
render() {
const {
@@ -53,13 +61,15 @@ export default class PasswordSetting extends Component {
{ (isPasswordSet && !isDeletingPassword) && (
<ChangePassword
onStartChangingPassword = {this.onChangingPassword}
onStartChange = {this.onChangingPassword}
onCancelChange = {this.onCancelChangingPassword}
/>
)}
{ (isPasswordSet && !isChangingPassword) && (
<DeletePassword
onStartDeletingPassword = {this.onDeletingPassword}
onStartDelete = {this.onDeletingPassword}
onCancelDelete = {this.onCancelDeletingPassword}
/>
)}
</FramedSegment>
@@ -2,7 +2,7 @@ import { Alert } from 'react-native'
import { shared } from '../../../i18n/en/labels'
import labels from '../../../i18n/en/settings'
export default function showBackUpReminder(okHandler, isDelete) {
export default function showBackUpReminder(okHandler, cancelHandler, isDelete) {
let title, message
if (isDelete) {
title = labels.passwordSettings.deleteBackupReminderTitle
@@ -17,10 +17,12 @@ export default function showBackUpReminder(okHandler, isDelete) {
message,
[{
text: shared.cancel,
onPress: cancelHandler,
style: 'cancel'
}, {
text: shared.ok,
onPress: okHandler
}]
}],
{ onDismiss: cancelHandler }
)
}
+10 -4
View File
@@ -17,10 +17,15 @@ export default class ChangePassword extends Component {
}
startChangingPassword = () => {
showBackUpReminder(() => {
this.setState({ enteringCurrentPassword: true })
})
this.props.onStartChangingPassword()
showBackUpReminder(
this.startEnteringCurrentPassword,
this.cancelConfirmationWithPassword
)
}
startEnteringCurrentPassword = () => {
this.setState({ enteringCurrentPassword: true })
this.props.onStartChange()
}
startEnteringNewPassword = () => {
@@ -37,6 +42,7 @@ export default class ChangePassword extends Component {
enteringNewPassword: false,
enteringCurrentPassword: false
})
this.props.onCancelChange()
}
render() {