Skip to content

Commit

Permalink
updating formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ekjotmultani committed Oct 1, 2024
1 parent 8ef9d66 commit d765390
Show file tree
Hide file tree
Showing 4 changed files with 201 additions and 199 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ mixin AuthenticatorPhoneFieldMixin<FieldType extends Enum,
// this is to handle the case where the user may errantly input their dial code again in their phone number
// we make sure the user's phone number doesn't naturally just start with their dial code by checking if the number exceeds the maximum phone length of the country's phone number scheme before truncating it
if (phoneNumber.startsWith(prefix.substring(1))) {
if (countryPhoneNumberLengths.containsKey(prefix) && phoneNumber.length > countryPhoneNumberLengths[prefix]!){
phoneNumber = phoneNumber.substring(prefix.length-1);
if (countryPhoneNumberLengths.containsKey(prefix) &&
phoneNumber.length > countryPhoneNumberLengths[prefix]!) {
phoneNumber = phoneNumber.substring(prefix.length - 1);
}
}
return phoneNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ mixin AuthenticatorUsernameField<FieldType extends Enum,
return null;
}
}

String displayPhoneNumber(String? phoneNumber) {
phoneNumber = phoneNumber ?? '';
final prefix = '+${state.dialCode.value}';
Expand All @@ -174,8 +174,9 @@ mixin AuthenticatorUsernameField<FieldType extends Enum,
// this is to handle the case where the user may errantly input their dial code again in their phone number
// we make sure the user's phone number doesn't naturally just start with their dial code by checking if the number exceeds the maximum phone length of the country's phone number scheme before truncating it
if (phoneNumber.startsWith(prefix.substring(1))) {
if (countryPhoneNumberLengths.containsKey(prefix) && phoneNumber.length > countryPhoneNumberLengths[prefix]!){
phoneNumber = phoneNumber.substring(prefix.length-1);
if (countryPhoneNumberLengths.containsKey(prefix) &&
phoneNumber.length > countryPhoneNumberLengths[prefix]!) {
phoneNumber = phoneNumber.substring(prefix.length - 1);
}
}
return phoneNumber;
Expand Down
Loading

0 comments on commit d765390

Please sign in to comment.