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

Unified Diff: ios/chrome/browser/ui/payments/credit_card_edit_coordinator.mm

Issue 2944083003: [Payment Request] Fixes modally presented editors (Closed)
Patch Set: Addressed comment Created 3 years, 6 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
Index: ios/chrome/browser/ui/payments/credit_card_edit_coordinator.mm
diff --git a/ios/chrome/browser/ui/payments/credit_card_edit_coordinator.mm b/ios/chrome/browser/ui/payments/credit_card_edit_coordinator.mm
index a75fa00cb9ba9ff360025af959ca926981ccd3b4..63f1c2e4afe92dd1d0f47d721b396356605d0c20 100644
--- a/ios/chrome/browser/ui/payments/credit_card_edit_coordinator.mm
+++ b/ios/chrome/browser/ui/payments/credit_card_edit_coordinator.mm
@@ -69,7 +69,10 @@ bool IsValidCreditCardNumber(const base::string16& card_number,
@property(nonatomic, strong)
BillingAddressSelectionCoordinator* billingAddressSelectionCoordinator;
-@property(nonatomic, strong) PaymentRequestEditViewController* viewController;
+@property(nonatomic, strong) UINavigationController* viewController;
+
+@property(nonatomic, strong)
+ PaymentRequestEditViewController* editViewController;
@property(nonatomic, strong) CreditCardEditViewControllerMediator* mediator;
@@ -83,25 +86,33 @@ bool IsValidCreditCardNumber(const base::string16& card_number,
@synthesize billingAddressSelectionCoordinator =
_billingAddressSelectionCoordinator;
@synthesize viewController = _viewController;
+@synthesize editViewController = _editViewController;
@synthesize mediator = _mediator;
- (void)start {
- _viewController = [[PaymentRequestEditViewController alloc] init];
+ _editViewController = [[PaymentRequestEditViewController alloc] init];
// TODO(crbug.com/602666): Title varies depending on the missing fields.
NSString* title = _creditCard
? l10n_util::GetNSString(IDS_PAYMENTS_EDIT_CARD)
: l10n_util::GetNSString(IDS_PAYMENTS_ADD_CARD_LABEL);
- [_viewController setTitle:title];
- [_viewController setDelegate:self];
- [_viewController setValidatorDelegate:self];
+ [_editViewController setTitle:title];
+ [_editViewController setDelegate:self];
+ [_editViewController setValidatorDelegate:self];
_mediator = [[CreditCardEditViewControllerMediator alloc]
initWithPaymentRequest:_paymentRequest
creditCard:_creditCard];
- [_mediator setConsumer:_viewController];
- [_viewController setDataSource:_mediator];
- [_viewController loadModel];
-
- [[self baseViewController] presentViewController:_viewController
+ [_mediator setConsumer:_editViewController];
+ [_editViewController setDataSource:_mediator];
+ [_editViewController loadModel];
+
+ self.viewController = [[UINavigationController alloc]
+ initWithRootViewController:self.editViewController];
+ [self.viewController setModalPresentationStyle:UIModalPresentationFormSheet];
+ [self.viewController
+ setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
+ [self.viewController setNavigationBarHidden:YES];
+
+ [[self baseViewController] presentViewController:self.viewController
animated:YES
completion:nil];
}
@@ -112,7 +123,8 @@ bool IsValidCreditCardNumber(const base::string16& card_number,
completion:nil];
[self.billingAddressSelectionCoordinator stop];
self.billingAddressSelectionCoordinator = nil;
- _viewController = nil;
+ self.editViewController = nil;
+ self.viewController = nil;
}
#pragma mark - PaymentRequestEditViewControllerValidator
@@ -148,7 +160,7 @@ bool IsValidCreditCardNumber(const base::string16& card_number,
if (field.autofillUIType == AutofillUITypeCreditCardBillingAddress) {
self.billingAddressSelectionCoordinator =
[[BillingAddressSelectionCoordinator alloc]
- initWithBaseViewController:self.viewController];
+ initWithBaseViewController:self.editViewController];
[self.billingAddressSelectionCoordinator
setPaymentRequest:self.paymentRequest];
[self.billingAddressSelectionCoordinator
@@ -222,8 +234,8 @@ bool IsValidCreditCardNumber(const base::string16& card_number,
// controller.
DCHECK(billingAddress);
[self.mediator setBillingProfile:billingAddress];
- [self.viewController loadModel];
- [self.viewController.collectionView reloadData];
+ [self.editViewController loadModel];
+ [self.editViewController.collectionView reloadData];
[self.billingAddressSelectionCoordinator stop];
self.billingAddressSelectionCoordinator = nil;

Powered by Google App Engine
This is Rietveld 408576698