From 32f443c7acb266612836d10ff4a44fcb92b3bbf0 Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Wed, 22 Feb 2023 20:37:07 +0200 Subject: [PATCH] Add validate contact method button --- .../Contacts/ContactMethodDetailsPage.js | 81 +++++++++---------- 1 file changed, 40 insertions(+), 41 deletions(-) diff --git a/src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.js b/src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.js index f5de6444688d..02b957b93bb2 100644 --- a/src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.js +++ b/src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.js @@ -23,6 +23,7 @@ import TextInput from '../../../../components/TextInput'; import CONST from '../../../../CONST'; import Icon from '../../../../components/Icon'; import colors from '../../../../styles/colors'; +import Button from '../../../../components/Button'; const propTypes = { /* Onyx Props */ @@ -67,6 +68,7 @@ class ContactMethodDetailsPage extends Component { this.confirmDeleteAndHideModal = this.confirmDeleteAndHideModal.bind(this); this.resendValidateCode = this.resendValidateCode.bind(this); this.getContactMethod = this.getContactMethod.bind(this); + this.validateContactMethod = this.validateContactMethod.bind(this); this.state = { isDeleteModalOpen: false, @@ -103,6 +105,13 @@ class ContactMethodDetailsPage extends Component { User.requestContactMethodValidateCode(this.getContactMethod()); } + /** + * Attempt to validate this contact method + */ + validateContactMethod() { + User.validateSecondaryLogin(this.getContactMethod(), this.state.validateCode); + } + render() { const contactMethod = this.getContactMethod(); const loginData = this.props.loginList[contactMethod]; @@ -132,48 +141,38 @@ class ContactMethodDetailsPage extends Component { danger /> {!loginData.validatedDate && ( - <> - {/* console.log('hi')} - shouldShowRightIcon - success - /> */} - {/* */} - - - - - - - - {this.props.translate('contacts.enterMagicCode', {contactMethod})} - - - - this.setState({validateCode: text})} - // onSubmitEditing={this.validateAndSubmitForm} - keyboardType={CONST.KEYBOARD_TYPE.NUMBER_PAD} - errorText="" - blurOnSubmit={false} - /> - - - {this.props.translate('contacts.resendMagicCode')} + + + + + + {this.props.translate('contacts.enterMagicCode', {contactMethod})} - + - + this.setState({validateCode: text})} + keyboardType={CONST.KEYBOARD_TYPE.NUMBER_PAD} + blurOnSubmit={false} + /> + + + {this.props.translate('contacts.resendMagicCode')} + + +