Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request Call placeholder & messages updated #6178

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,7 @@ export default {
},
cameraPermissionsNotGranted: 'Camera permissions not granted',
messages: {
noPhoneNumber: 'Please enter a phone number including the country code e.g +447814266907.',
errorMessageInvalidPhone: 'That doesn’t look like a valid phone number. Try again with the country code. e.g. +15005550006',
errorMessageInvalidPhone: 'Please enter a valid phone number without brackets or dashes. If you\'re outside the US please include your country code, eg. +447782339811',
maxParticipantsReached: 'You\'ve reached the maximum number of participants for a group chat.',
},
onfidoStep: {
Expand Down
3 changes: 1 addition & 2 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,7 @@ export default {
},
cameraPermissionsNotGranted: 'No has habilitado los permisos para acceder a la cámara',
messages: {
noPhoneNumber: 'Por favor escribe un número de teléfono que incluya el código de país e.g +447814266907.',
errorMessageInvalidPhone: 'El teléfono no es valido. Inténtalo de nuevo agregando el código de país. P. ej.: +15005550006',
errorMessageInvalidPhone: 'Por favor, introduce un número de teléfono válido sin paréntesis o guiones. Si reside fuera de Estados Unidos, por favor incluye el prefijo internacional. P. ej. +447782339811',
maxParticipantsReached: 'Has llegado al número máximo de participantes para un grupo.',
},
onfidoStep: {
Expand Down
4 changes: 2 additions & 2 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -688,14 +688,14 @@ function getHeaderMessage(hasSelectableOptions, hasUserToInvite, searchValue, ma
}

if (searchValue && CONST.REGEX.DIGITS_AND_PLUS.test(searchValue) && !Str.isValidPhone(searchValue)) {
return translate(preferredLocale, 'messages.noPhoneNumber');
return translate(preferredLocale, 'messages.errorMessageInvalidPhone');
}

// Without a search value, it would be very confusing to see a search validation message.
// Therefore, this skips the validation when there is no search value.
if (searchValue && !hasSelectableOptions && !hasUserToInvite) {
if (/^\d+$/.test(searchValue)) {
return translate(preferredLocale, 'messages.noPhoneNumber');
return translate(preferredLocale, 'messages.errorMessageInvalidPhone');
}

return translate(preferredLocale, 'common.noResultsFound');
Expand Down
7 changes: 2 additions & 5 deletions src/pages/RequestCallPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,7 @@ class RequestCallPage extends Component {
* @returns {String}
*/
getPhoneNumberError() {
if (_.isEmpty(this.state.phoneNumber.trim())) {
return this.props.translate('messages.noPhoneNumber');
}
if (!Str.isValidPhone(this.state.phoneNumber)) {
if (_.isEmpty(this.state.phoneNumber.trim()) || !Str.isValidPhone(this.state.phoneNumber)) {
return this.props.translate('messages.errorMessageInvalidPhone');
}
return '';
Expand Down Expand Up @@ -230,7 +227,7 @@ class RequestCallPage extends Component {
autoCompleteType="off"
autoCorrect={false}
value={this.state.phoneNumber}
placeholder="+14158675309"
placeholder="2109400803"
errorText={this.state.phoneNumberError}
onBlur={this.validatePhoneInput}
onChangeText={phoneNumber => this.setState({phoneNumber})}
Expand Down