Commit 1fbc53fc authored by Ewann's avatar Ewann Committed by Commit Bot

[iOS][ContextMenus] Updates Open Offline Version action

This CL updates the name and adds an image to this action.

Bug: 1093302, 1121996
Change-Id: I915726687eff87649482d09cf40697a637a85806
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2387567Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: Ewann Pellé <ewannpv@chromium.org>
Cr-Commit-Position: refs/heads/master@{#803832}
parent 570e6380
...@@ -1583,6 +1583,9 @@ While in incognito, sites can't use cookies to see your browsing activity across ...@@ -1583,6 +1583,9 @@ While in incognito, sites can't use cookies to see your browsing activity across
<message name="IDS_IOS_READING_LIST_NO_ENTRIES_TITLE" desc="Title shown on the Reading List screen when there are no entries."> <message name="IDS_IOS_READING_LIST_NO_ENTRIES_TITLE" desc="Title shown on the Reading List screen when there are no entries.">
You'll find your reading list here You'll find your reading list here
</message> </message>
<message name="IDS_IOS_READING_LIST_OPEN_OFFLINE_BUTTON" desc="Label of the button to display the Offline version instead of the Online one. [Length: 25em]">
Open Offline Version
</message>
<message name="IDS_IOS_READING_LIST_READ_HEADER" desc="Heading. Appears above a list of articles the user has already read, in their Reading List. Appears on the same page as an 'Unread' heading, which contains articles the user hasn't read yet. In English, 'Read' can be both verb and adjective so we needed to be more explicit. Does not need to be translated literally. [Length: 40em]" meaning="The entries below this header are read. [Length: 40em]"> <message name="IDS_IOS_READING_LIST_READ_HEADER" desc="Heading. Appears above a list of articles the user has already read, in their Reading List. Appears on the same page as an 'Unread' heading, which contains articles the user hasn't read yet. In English, 'Read' can be both verb and adjective so we needed to be more explicit. Does not need to be translated literally. [Length: 40em]" meaning="The entries below this header are read. [Length: 40em]">
Pages You've Read Pages You've Read
</message> </message>
......
286c7ce7e74a30f886eae89d72e014f8ec852365
\ No newline at end of file
...@@ -17,6 +17,7 @@ source_set("menu") { ...@@ -17,6 +17,7 @@ source_set("menu") {
"resources:edit", "resources:edit",
"resources:mark_read", "resources:mark_read",
"resources:move_folder", "resources:move_folder",
"resources:offline",
"resources:open_in_incognito", "resources:open_in_incognito",
"resources:open_in_new_tab", "resources:open_in_new_tab",
"resources:open_new_window", "resources:open_new_window",
...@@ -45,6 +46,7 @@ source_set("unit_tests") { ...@@ -45,6 +46,7 @@ source_set("unit_tests") {
"resources:edit", "resources:edit",
"resources:mark_read", "resources:mark_read",
"resources:move_folder", "resources:move_folder",
"resources:offline",
"resources:open_in_incognito", "resources:open_in_incognito",
"resources:open_in_new_tab", "resources:open_in_new_tab",
"resources:open_new_window", "resources:open_new_window",
......
...@@ -105,8 +105,7 @@ API_AVAILABLE(ios(13.0)) ...@@ -105,8 +105,7 @@ API_AVAILABLE(ios(13.0))
// Creates a UIAction instance whose title and icon are configured for viewing // Creates a UIAction instance whose title and icon are configured for viewing
// an offline version of an URL in a new tab. When triggered, the action will // an offline version of an URL in a new tab. When triggered, the action will
// invoke the |block| when executed. // invoke the |block| when executed.
- (UIAction*)actionToViewOfflineVersionInInNewTabWithBlock: - (UIAction*)actionToOpenOfflineVersionInNewTabWithBlock:(ProceduralBlock)block;
(ProceduralBlock)block;
@end @end
......
...@@ -207,11 +207,11 @@ ...@@ -207,11 +207,11 @@
block:block]; block:block];
} }
- (UIAction*)actionToViewOfflineVersionInInNewTabWithBlock: - (UIAction*)actionToOpenOfflineVersionInNewTabWithBlock:
(ProceduralBlock)block { (ProceduralBlock)block {
return [self actionWithTitle:l10n_util::GetNSString( return [self actionWithTitle:l10n_util::GetNSString(
IDS_IOS_READING_LIST_CONTENT_CONTEXT_OFFLINE) IDS_IOS_READING_LIST_OPEN_OFFLINE_BUTTON)
image:nil image:[UIImage imageNamed:@"offline"]
type:MenuActionType::ViewOffline type:MenuActionType::ViewOffline
block:block]; block:block];
} }
......
...@@ -364,12 +364,12 @@ TEST_F(ActionFactoryTest, viewOfflineVersion) { ...@@ -364,12 +364,12 @@ TEST_F(ActionFactoryTest, viewOfflineVersion) {
[[ActionFactory alloc] initWithBrowser:test_browser_.get() [[ActionFactory alloc] initWithBrowser:test_browser_.get()
scenario:kTestMenuScenario]; scenario:kTestMenuScenario];
UIImage* expectedImage = nil; UIImage* expectedImage = [UIImage imageNamed:@"offline"];
NSString* expectedTitle = NSString* expectedTitle =
l10n_util::GetNSString(IDS_IOS_READING_LIST_CONTENT_CONTEXT_OFFLINE); l10n_util::GetNSString(IDS_IOS_READING_LIST_OPEN_OFFLINE_BUTTON);
UIAction* action = [factory actionToViewOfflineVersionInInNewTabWithBlock:^{ UIAction* action = [factory actionToOpenOfflineVersionInNewTabWithBlock:^{
}]; }];
EXPECT_TRUE([expectedTitle isEqualToString:action.title]); EXPECT_TRUE([expectedTitle isEqualToString:action.title]);
......
...@@ -83,3 +83,11 @@ imageset("mark_read") { ...@@ -83,3 +83,11 @@ imageset("mark_read") {
"mark_read.imageset/mark_read@3x.png", "mark_read.imageset/mark_read@3x.png",
] ]
} }
imageset("offline") {
sources = [
"offline.imageset/Contents.json",
"offline.imageset/offline@2x.png",
"offline.imageset/offline@3x.png",
]
}
{
"images": [
{
"idiom": "universal",
"filename": "offline@2x.png",
"scale": "2x"
},
{
"idiom": "universal",
"filename": "offline@3x.png",
"scale": "3x"
}
],
"info": {
"author": "xcode",
"version": 1
},
"properties": {
"template-rendering-intent": "template"
}
}
\ No newline at end of file
...@@ -471,7 +471,7 @@ animationControllerForDismissedController:(UIViewController*)dismissed { ...@@ -471,7 +471,7 @@ animationControllerForDismissedController:(UIViewController*)dismissed {
entry->DistilledPath(), item.entryURL, entry->DistilledURL()); entry->DistilledPath(), item.entryURL, entry->DistilledURL());
[menuElements [menuElements
addObject:[actionFactory addObject:[actionFactory
actionToViewOfflineVersionInInNewTabWithBlock:^{ actionToOpenOfflineVersionInNewTabWithBlock:^{
[weakSelf loadEntryURL:item.entryURL [weakSelf loadEntryURL:item.entryURL
withOfflineURL:offlineURL withOfflineURL:offlineURL
inNewTab:YES inNewTab:YES
......
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