Skip to content

Commit fde9122

Browse files
authored
Reader: Merge feature branch for UI updates to content navigation and filtering (#22536)
2 parents 7dcbfec + 7402fed commit fde9122

72 files changed

Lines changed: 2007 additions & 1306 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

API-Mocks/WordPressMocks/src/main/assets/mocks/mappings/wpcom/reader/rest_v2_read_tags_cards.json

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,31 @@
1515
"page": 1,
1616
"refresh": 1,
1717
"cards": [
18+
{
19+
"type": "interests_you_may_like",
20+
"data": [
21+
{
22+
"slug": "blogging",
23+
"title": "Blogging",
24+
"score": 278
25+
},
26+
{
27+
"slug": "travel",
28+
"title": "Travel",
29+
"score": 251
30+
},
31+
{
32+
"slug": "photos",
33+
"title": "Photos",
34+
"score": 173
35+
},
36+
{
37+
"slug": "technology",
38+
"title": "Technology",
39+
"score": 139
40+
}
41+
]
42+
},
1843
{
1944
"type": "interests_you_may_like",
2045
"data": [
@@ -3934,13 +3959,12 @@
39343959
"use_excerpt": false
39353960
}
39363961
}
3937-
],
3938-
"next_page_handle": "ZnJvbT04JnJlZnJlc2g9MQ=="
3962+
]
39393963
},
39403964
"headers": {
39413965
"Content-Type": "application/json",
39423966
"Connection": "keep-alive",
39433967
"Cache-Control": "no-cache, must-revalidate, max-age=0"
39443968
}
39453969
}
3946-
}
3970+
}

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* [**] Prevent images from temporarily disappearing when uploading media [https://github.com/WordPress/gutenberg/pull/57869]
44
* [**] Fix crash occurring on large post on Android [https://github.com/WordPress/gutenberg/pull/58266]
55
* [*] [Jetpack-only] Site Monitoring: Add Metrics, PHP Logs, and Web Server Logs under Site Monitoring [#22475, #22499, #22504, #22500]
6+
* [***] [Jetpack-only] Reader: introduced new UI/UX for content navigation and filtering [#]
67

78
24.0.1
89
-----

WordPress/Classes/Extensions/NoResultsViewController+FollowedSites.swift

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,21 @@ import Foundation
22

33
extension NoResultsViewController {
44
private struct Constants {
5-
static let noFollowedSitesTitle = NSLocalizedString("No followed sites", comment: "Title for the no followed sites result screen")
6-
static let noFollowedSitesSubtitle = NSLocalizedString("When you follow sites, you’ll see their content here.", comment: "Subtitle for the no followed sites result screen")
7-
static let noFollowedSitesButtonTitle = NSLocalizedString("Discover Sites", comment: "Title for button on the no followed sites result screen")
8-
9-
static let noFollowedSitesImage = "wp-illustration-following-empty-results"
5+
static let noFollowedSitesTitle = NSLocalizedString(
6+
"reader.no.blogs.title",
7+
value: "No blog subscriptions",
8+
comment: "Title for the no followed blogs result screen"
9+
)
10+
static let noFollowedSitesSubtitle = NSLocalizedString(
11+
"reader.no.blogs.subtitle",
12+
value: "Subscribe to blogs in Discover and you’ll see their latest posts here. Or search for a blog that you like already.",
13+
comment: "Subtitle for the no followed blogs result screen"
14+
)
15+
static let noFollowedSitesButtonTitle = NSLocalizedString(
16+
"reader.no.blogs.button",
17+
value: "Discover Blogs",
18+
comment: "Title for button on the no followed blogs result screen"
19+
)
1020
}
1121

1222
class func noFollowedSitesController(showActionButton showButton: Bool) -> NoResultsViewController {
@@ -23,11 +33,23 @@ extension NoResultsViewController {
2333
buttonTitle: showButton ? Constants.noFollowedSitesButtonTitle : nil,
2434
attributedSubtitle: subtitleText,
2535
attributedSubtitleConfiguration: { (attributedText: NSAttributedString) -> NSAttributedString? in
26-
return subtitleText },
27-
image: Constants.noFollowedSitesImage)
28-
controller.labelStackViewSpacing = 12
36+
return subtitleText })
37+
controller.hideImageView()
38+
controller.labelStackViewSpacing = 8
2939
controller.labelButtonStackViewSpacing = 18
40+
controller.loadViewIfNeeded()
41+
controller.setupReaderButtonStyles()
3042

3143
return controller
3244
}
3345
}
46+
47+
extension NoResultsViewController {
48+
49+
func setupReaderButtonStyles() {
50+
actionButton.primaryNormalBackgroundColor = .text
51+
actionButton.primaryTitleColor = .systemBackground
52+
actionButton.primaryHighlightBackgroundColor = .text
53+
}
54+
55+
}

WordPress/Classes/Extensions/Post+BloggingPrompts.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ extension Post {
3636
"""
3737
}
3838

39-
private enum Strings {
39+
enum Strings {
4040
static let promptTag = "dailyprompt"
41-
static let emptyParagraphBlock = """
41+
fileprivate static let emptyParagraphBlock = """
4242
<!-- wp:paragraph -->
4343
<p></p>
4444
<!-- /wp:paragraph -->

WordPress/Classes/Services/Reader Post/ReaderPostService.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -768,8 +768,8 @@ - (void)mergePosts:(NSArray *)remotePosts
768768
[self deletePostsFromBlockedSitesInContext:context];
769769

770770
BOOL spaceAvailable = ([self numberOfPostsForTopic:readerTopic inContext:context] < [self maxPostsToSaveForTopic:readerTopic]);
771-
if ([ReaderHelpers isTopicTag:readerTopic]) {
772-
// For tags, assume there is more content as long as more than zero results are returned.
771+
if ([ReaderHelpers isTopicTag:readerTopic] || [ReaderHelpers isRSSFeed:readerTopic]) {
772+
// For tags and RSS feeds, assume there is more content as long as more than zero results are returned.
773773
hasMore = (postsCount > 0 ) && spaceAvailable;
774774
} else {
775775
// For other topics, assume there is more content as long as the number of results requested is returned.
@@ -1153,8 +1153,8 @@ - (ReaderPost *)createOrReplaceFromRemotePost:(RemoteReaderPost *)remotePost for
11531153
- (BOOL)canLoadMorePostsForTopic:(ReaderAbstractTopic * _Nonnull)readerTopic remotePosts:(NSArray * _Nonnull)remotePosts inContext: (NSManagedObjectContext * _Nonnull)context {
11541154
BOOL hasMore = NO;
11551155
BOOL spaceAvailable = ([self numberOfPostsForTopic:readerTopic inContext:context] < [self maxPostsToSaveForTopic:readerTopic]);
1156-
if ([ReaderHelpers isTopicTag:readerTopic]) {
1157-
// For tags, assume there is more content as long as more than zero results are returned.
1156+
if ([ReaderHelpers isTopicTag:readerTopic] || [ReaderHelpers isRSSFeed:readerTopic]) {
1157+
// For tags and RSS feeds, assume there is more content as long as more than zero results are returned.
11581158
hasMore = ([remotePosts count] > 0 ) && spaceAvailable;
11591159
} else {
11601160
// For other topics, assume there is more content as long as the number of results requested is returned.

WordPress/Classes/Services/ReaderCardService.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ class ReaderCardService {
5252
}
5353

5454
cards.enumerated().forEach { index, remoteCard in
55+
if isFirstPage && index == 0 && remoteCard.type == .interests {
56+
// Removes displaying the tags recommendation card
57+
// first in the Discover feed
58+
return
59+
}
60+
5561
let card = ReaderCard(context: context, from: remoteCard)
5662

5763
// Assign each interest an endpoint

WordPress/Classes/Services/ReaderSiteService.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,12 @@ - (NSError *)errorForNotLoggedIn
287287

288288
- (NSError *)errorForAlreadyFollowingSiteOrFeed
289289
{
290-
NSString *description = NSLocalizedString(@"You are already following this site.", @"Error message informing the user that they are already following a site in their reader.");
290+
291+
NSString *description = NSLocalizedStringWithDefaultValue(@"reader.error.already.subscribed.message",
292+
nil,
293+
[NSBundle mainBundle],
294+
@"You are already subscribed to this blog.",
295+
@"Error message informing the user that they are already following a blog in their reader.");
291296
NSDictionary *userInfo = @{NSLocalizedDescriptionKey:description};
292297
NSError *error = [[NSError alloc] initWithDomain:ReaderSiteServiceErrorDomain code:ReaderSiteServiceErrorAlreadyFollowingSite userInfo:userInfo];
293298
return error;

WordPress/Classes/Utility/Analytics/WPAnalyticsEvent.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,10 @@ import Foundation
305305
case readerManageViewDisplayed
306306
case readerManageViewDismissed
307307

308+
// Reader: Navigation menu dropdown
309+
case readerDropdownOpened
310+
case readerDropdownItemTapped
311+
308312
// App Settings
309313
case settingsDidChange
310314

@@ -1097,6 +1101,12 @@ import Foundation
10971101
case .readerManageViewDismissed:
10981102
return "reader_manage_view_dismissed"
10991103

1104+
// Reader: Navigation menu dropdown
1105+
case .readerDropdownOpened:
1106+
return "reader_dropdown_menu_opened"
1107+
case .readerDropdownItemTapped:
1108+
return "reader_dropdown_menu_item_tapped"
1109+
11001110
// App Settings
11011111
case .settingsDidChange:
11021112
return "settings_did_change"

WordPress/Classes/ViewRelated/Reader/Detail/Views/ReaderDetailHeaderView.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,11 @@ class ReaderDetailHeaderView: UIStackView, NibLoadable, ReaderDetailHeader {
236236

237237
blogNameButton.isAccessibilityElement = true
238238
blogNameButton.accessibilityTraits = [.staticText, .button]
239-
blogNameButton.accessibilityHint = NSLocalizedString("Shows the site's posts.", comment: "Accessibility hint for the site name and URL button on Reader's Post Details.")
239+
blogNameButton.accessibilityHint = NSLocalizedString(
240+
"reader.blog.name.accessibility.hint",
241+
value: "Shows the blog's posts.",
242+
comment: "Accessibility hint for the blog name and URL button on Reader's Post Details."
243+
)
240244
if let label = blogNameLabel(post) {
241245
blogNameButton.accessibilityLabel = label
242246
}

WordPress/Classes/ViewRelated/Reader/Filter/EmptyActionView.swift

Lines changed: 0 additions & 94 deletions
This file was deleted.

0 commit comments

Comments
 (0)