Commit 87244d9b authored by sczs's avatar sczs Committed by Commit Bot

[ios] Adds support for UserFeedback product specific data

Adds specificProductData dictionary to UserFeedbackProvider,
this is needed in order to send card data as part of sending user
feedback.

This is transparent and its show in the UI along the other product
specific data the user is sending. Screenshot:
https://drive.google.com/file/d/1Js0zW7-tNZwAPtfZRvI24OwuUSeab-8N/view?usp=sharing

Bug: 1085419
Change-Id: I716345b61f87c78c7ebbfc7ce07479b84f93bde5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2358482Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#798675}
parent 22d98b41
......@@ -115,6 +115,13 @@ enum class KeyRetrievalTriggerForUMA;
- (void)showReportAnIssueFromViewController:
(UIViewController*)baseViewController;
// Shows the Report an Issue UI, presenting from |baseViewController|, using
// |specificProductData| for additional product data to be sent in the report.
- (void)
showReportAnIssueFromViewController:(UIViewController*)baseViewController
specificProductData:(NSDictionary<NSString*, NSString*>*)
specificProductData;
// Opens the |command| URL in a new tab.
// TODO(crbug.com/907527): Check if it is possible to merge it with the
// URLLoader methods.
......
......@@ -198,6 +198,11 @@ const char kMultiWindowOpenInNewWindowHistogram[] =
// time it is accessed.
@property(nonatomic, strong) SigninCoordinator* signinCoordinator;
// Additional product specific data used by UserFeedbackDataSource.
// TODO(crbug.com/1117041): Move this into a UserFeedback config object.
@property(nonatomic, strong)
NSDictionary<NSString*, NSString*>* specificProductData;
@end
@implementation SceneController {
......@@ -845,7 +850,16 @@ const char kMultiWindowOpenInNewWindowHistogram[] =
- (void)showReportAnIssueFromViewController:
(UIViewController*)baseViewController {
[self showReportAnIssueFromViewController:baseViewController
specificProductData:nil];
}
- (void)
showReportAnIssueFromViewController:(UIViewController*)baseViewController
specificProductData:(NSDictionary<NSString*, NSString*>*)
specificProductData {
DCHECK(baseViewController);
self.specificProductData = specificProductData;
// This dispatch is necessary to give enough time for the tools menu to
// disappear before taking a screenshot.
dispatch_async(dispatch_get_main_queue(), ^{
......@@ -1216,6 +1230,10 @@ const char kMultiWindowOpenInNewWindowHistogram[] =
return username.empty() ? nil : base::SysUTF8ToNSString(username);
}
- (NSDictionary<NSString*, NSString*>*)specificProductData {
return _specificProductData;
}
#pragma mark - SettingsNavigationControllerDelegate
- (void)closeSettings {
......
......@@ -13,14 +13,18 @@
// This data source object is used to obtain initial data to populate the fields
// on the User Feedback form.
// TODO(crbug.com/1117041): Rename this protocol to something more specific to
// currentPageScreenshot since that might be the only method remaining.
@protocol UserFeedbackDataSource<NSObject>
// Returns whether user was viewing a tab in Incognito mode.
// TODO(crbug.com/1117041): Move this into a UserFeedback config object.
- (BOOL)currentPageIsIncognito;
// Returns a formatted string representation of the URL that the user was
// viewing. May return nil if the tab viewed does not have a valid URL to be
// shown (e.g. user was viewing stack view controller).
// TODO(crbug.com/1117041): Move this into a UserFeedback config object.
- (NSString*)currentPageDisplayURL;
// Returns a screenshot of the application suitable for attaching to problem
......@@ -30,8 +34,14 @@
// Returns the username of the account being synced.
// Returns nil if sync is not enabled or user is in incognito mode.
// TODO(crbug.com/1117041): Move this into a UserFeedback config object.
- (NSString*)currentPageSyncedUserName;
// Returns the additional product specific data to be sent in the Send Feedback
// report.
// TODO(crbug.com/1117041): Move this into a UserFeedback config object.
- (NSDictionary<NSString*, NSString*>*)specificProductData;
@end
// UserFeedbackProvider allows embedders to provide functionality to collect
......@@ -46,6 +56,8 @@ class UserFeedbackProvider {
// |data_source| provides the information to initialize the view controller
// and |dispatcher| is an object from the embedder that can perform operations
// on behalf of the UserFeedbackProvider.
// TODO(crbug.com/1117041): Send a configuration object instead of these
// parameters.
virtual UIViewController* CreateViewController(
id<UserFeedbackDataSource> data_source,
id<ApplicationCommands> handler);
......
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