Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(979)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillAddress.java

Issue 2715783004: [Payments] Make phone number optional for billing addresses. (Closed)
Patch Set: Addressed comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentApp.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillAddress.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillAddress.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillAddress.java
index 25ab7acdb4e9046becd2f51342cc6f248fdb2aca..0eab750b07840786c2a5060af8e90363908ebb84 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillAddress.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillAddress.java
@@ -55,6 +55,14 @@ public class AutofillAddress extends PaymentOption {
/** Multiple fields are invalid or missing. */
public static final int INVALID_MULTIPLE_FIELDS = 4;
+ @IntDef({NORMAL_COMPLETENESS_CHECK, IGNORE_PHONE_COMPLETENESS_CHECK})
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface CompletenessCheckType {}
+ /** A normal completeness check. */
+ public static final int NORMAL_COMPLETENESS_CHECK = 0;
+ /** A completeness check that ignores phone numbers. */
+ public static final int IGNORE_PHONE_COMPLETENESS_CHECK = 1;
+
@Nullable private static Pattern sRegionCodePattern;
private Context mContext;
@@ -159,8 +167,8 @@ public class AutofillAddress extends PaymentOption {
* status.
*/
private void checkAndUpdateAddressCompleteness() {
- Pair<Integer, Integer> messageResIds =
- getEditMessageAndTitleResIds(checkAddressCompletionStatus(mProfile));
+ Pair<Integer, Integer> messageResIds = getEditMessageAndTitleResIds(
+ checkAddressCompletionStatus(mProfile, NORMAL_COMPLETENESS_CHECK));
mEditMessage = messageResIds.first.intValue() == 0
? null
@@ -222,12 +230,14 @@ public class AutofillAddress extends PaymentOption {
* @return int The completion status.
*/
@CompletionStatus
- public static int checkAddressCompletionStatus(AutofillProfile profile) {
+ public static int checkAddressCompletionStatus(
+ AutofillProfile profile, @CompletenessCheckType int checkType) {
int invalidFieldsCount = 0;
int completionStatus = COMPLETE;
- if (!PhoneNumberUtils.isGlobalPhoneNumber(
- PhoneNumberUtils.stripSeparators(profile.getPhoneNumber().toString()))) {
+ if (checkType != IGNORE_PHONE_COMPLETENESS_CHECK
+ && !PhoneNumberUtils.isGlobalPhoneNumber(
+ PhoneNumberUtils.stripSeparators(profile.getPhoneNumber().toString()))) {
completionStatus = INVALID_PHONE_NUMBER;
invalidFieldsCount++;
}
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentApp.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698