Commit 7eb50ad7 authored by David Jean's avatar David Jean Committed by Commit Bot

[ios] Add manual fallback actions for Credit Cards and Addresses

Follows adding piping into settings in https://crrev.com/c/1332298

Bug: 845472
Change-Id: I490d24ea9a64beb534372b5c0aad25dfd40f7f6d
Reviewed-on: https://chromium-review.googlesource.com/c/1332932
Commit-Queue: David Jean <djean@chromium.org>
Reviewed-by: default avatarJavier Ernesto Flores Robles <javierrobles@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607551}
parent 3c9ddfeb
...@@ -885,6 +885,12 @@ locale. The strings in this file are specific to iOS. ...@@ -885,6 +885,12 @@ locale. The strings in this file are specific to iOS.
<message name="IDS_IOS_MANUAL_FALLBACK_USE_OTHER_PASSWORD_WITH_DOTS" desc="The title for the button in the manual fallback passwords UI that is used to open a list of all the user credentials where they can select one to fill a form. This button is showed at the same time as a different button with IDS_IOS_MANUAL_FALLBACK_MANAGE_PASSWORDS as title. [30em]"> <message name="IDS_IOS_MANUAL_FALLBACK_USE_OTHER_PASSWORD_WITH_DOTS" desc="The title for the button in the manual fallback passwords UI that is used to open a list of all the user credentials where they can select one to fill a form. This button is showed at the same time as a different button with IDS_IOS_MANUAL_FALLBACK_MANAGE_PASSWORDS as title. [30em]">
Use Other Password... Use Other Password...
</message> </message>
<message name="IDS_IOS_MANUAL_FALLBACK_MANAGE_CREDIT_CARDS" desc="The title for the button in the manual fallback UI that takes the user to the payments settings. In this screen they see all the credit cards and can erase them. [30em]">
Manage Credit Cards...
</message>
<message name="IDS_IOS_MANUAL_FALLBACK_MANAGE_ADDRESSES" desc="The title for the button in the manual fallback UI that takes the user to the addresses settings. In this screen they see all the addresses and can erase them. [30em]">
Manage Addresses...
</message>
<message name="IDS_IOS_MICROPHONE_USAGE_DESCRIPTION" desc="Specifies the reason for accessing the user's microphone while the app is in use [Length: unlimited] [iOS only]."> <message name="IDS_IOS_MICROPHONE_USAGE_DESCRIPTION" desc="Specifies the reason for accessing the user's microphone while the app is in use [Length: unlimited] [iOS only].">
This lets you search faster using your voice. This lets you search faster using your voice.
</message> </message>
......
...@@ -60,6 +60,7 @@ initWithBaseViewController:(UIViewController*)viewController ...@@ -60,6 +60,7 @@ initWithBaseViewController:(UIViewController*)viewController
_addressMediator = _addressMediator =
[[ManualFillAddressMediator alloc] initWithProfiles:profiles]; [[ManualFillAddressMediator alloc] initWithProfiles:profiles];
_addressMediator.navigationDelegate = self;
_addressMediator.contentDelegate = self.manualFillInjectionHandler; _addressMediator.contentDelegate = self.manualFillInjectionHandler;
_addressMediator.consumer = _addressViewController; _addressMediator.consumer = _addressViewController;
} }
......
...@@ -30,6 +30,9 @@ extern NSString* const ManageAddressAccessibilityIdentifier; ...@@ -30,6 +30,9 @@ extern NSString* const ManageAddressAccessibilityIdentifier;
// The delegate in charge of using the content selected by the user. // The delegate in charge of using the content selected by the user.
@property(nonatomic, weak) id<ManualFillContentDelegate> contentDelegate; @property(nonatomic, weak) id<ManualFillContentDelegate> contentDelegate;
// The delegate in charge of navigation.
@property(nonatomic, weak) id<AddressListDelegate> navigationDelegate;
// The designated initializer. // The designated initializer.
- (instancetype)initWithProfiles: - (instancetype)initWithProfiles:
(std::vector<autofill::AutofillProfile*>)profiles NS_DESIGNATED_INITIALIZER; (std::vector<autofill::AutofillProfile*>)profiles NS_DESIGNATED_INITIALIZER;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <vector> #include <vector>
#include "base/metrics/user_metrics.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "components/autofill/core/browser/autofill_manager.h" #include "components/autofill/core/browser/autofill_manager.h"
#include "components/autofill/core/browser/autofill_profile.h" #include "components/autofill/core/browser/autofill_profile.h"
...@@ -82,8 +83,19 @@ NSString* const ManageAddressAccessibilityIdentifier = ...@@ -82,8 +83,19 @@ NSString* const ManageAddressAccessibilityIdentifier =
if (!self.consumer) { if (!self.consumer) {
return; return;
} }
// TODO(crbug.com/845472): implement. NSString* manageAddressesTitle =
[self.consumer presentActions:@[]]; l10n_util::GetNSString(IDS_IOS_MANUAL_FALLBACK_MANAGE_ADDRESSES);
__weak __typeof(self) weakSelf = self;
auto manageAddressesItem = [[ManualFillActionItem alloc]
initWithTitle:manageAddressesTitle
action:^{
base::RecordAction(base::UserMetricsAction(
"ManualFallback_Profiles_OpenManageProfiles"));
[weakSelf.navigationDelegate openAddressSettings];
}];
manageAddressesItem.accessibilityIdentifier =
manual_fill::ManageAddressAccessibilityIdentifier;
[self.consumer presentActions:@[ manageAddressesItem ]];
} }
@end @end
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <vector> #include <vector>
#include "base/metrics/user_metrics.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "components/autofill/core/browser/autofill_manager.h" #include "components/autofill/core/browser/autofill_manager.h"
#include "components/autofill/core/browser/credit_card.h" #include "components/autofill/core/browser/credit_card.h"
...@@ -90,8 +91,19 @@ NSString* const ManageCardsAccessibilityIdentifier = ...@@ -90,8 +91,19 @@ NSString* const ManageCardsAccessibilityIdentifier =
if (!self.consumer) { if (!self.consumer) {
return; return;
} }
// TODO(crbug.com/845472): implement. NSString* manageCreditCardsTitle =
[self.consumer presentActions:@[]]; l10n_util::GetNSString(IDS_IOS_MANUAL_FALLBACK_MANAGE_CREDIT_CARDS);
__weak __typeof(self) weakSelf = self;
auto manageCreditCardsItem = [[ManualFillActionItem alloc]
initWithTitle:manageCreditCardsTitle
action:^{
base::RecordAction(base::UserMetricsAction(
"ManualFallback_CreditCard_OpenManageCreditCard"));
[weakSelf.navigationDelegate openCardSettings];
}];
manageCreditCardsItem.accessibilityIdentifier =
manual_fill::ManageCardsAccessibilityIdentifier;
[self.consumer presentActions:@[ manageCreditCardsItem ]];
} }
#pragma mark - FullCardRequestResultDelegateObserving #pragma mark - FullCardRequestResultDelegateObserving
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment