Skip to content

Commit 4cbd62c

Browse files
authored
Add Subscribers screen (#24513)
* Add new Subscribers screen * Add subscibers row * Remove filter from PeopleViewController and rename it * Remove Followers role * Implemenet initial SubscribersView * Add paging * Add ListFooterView * Hide private APIs * Extract SubscribersPaginatedResponse * Implement search * Simplify paging and searching * Add SubscribersListViewModel * Rework how search is shown * Remove isLoadingFromSearch * Add separate search view * Add basic filtering * Simplify search * Fix search * Extract SubscribersMenu * Move bindings to SubscribersMenu * Add SubscriberRowView * Fix when we show email/user * Remove temporary code * Update UI tests * Fix UI tests * Update WordPressKit * Add delete confirmation dialog * Add initial SubscriberDetailsView * Add initial API * Fix unwanted reload of SubscribersListView on reappear * Remove the cell when subscriber is deleted * Hide disclosure indicators * Show subscribed sice * Show number of subscribers * Add a note about supporters * Add SubscriberInviteView * Integrate the API * Apply correct tint * Update how we show dates * Display how many months ago you subscribed * Update permissions * Update Stats to use the new Subscribers screen * Fix an issue with top email subsribers not shown * Add delete to context menu * Add swipe actions * Extract SubscriberDetailsHeaderView * Fix XML encoded characters * Prefetch earlier * Fix tests * Rename to LoadMoreFooterView
1 parent b66999d commit 4cbd62c

32 files changed

+1688
-111
lines changed

Modules/Package.resolved

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ let package = Package(
5050
.package(url: "https://github.com/wordpress-mobile/NSURL-IDN", revision: "b34794c9a3f32312e1593d4a3d120572afa0d010"),
5151
.package(
5252
url: "https://github.com/wordpress-mobile/WordPressKit-iOS",
53-
revision: "5bc08764d2025e21685816065f611e884c8672d1" // see wpios-edition branch
53+
revision: "cc7fd8a7ea609fc139e7b9d9f53b12c51002ddf4" // see wpios-edition branch
5454
),
5555
.package(url: "https://github.com/zendesk/support_sdk_ios", from: "8.0.3"),
5656
// We can't use wordpress-rs branches nor commits here. Only tags work.

Modules/Sources/DesignSystem/Foundation/AppColor.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ public enum UIAppColor {
3333
case .reader: CSColor.WordPressBlue.shade(shade)
3434
}
3535
}
36+
37+
public static var secondary: UIColor {
38+
UIColor(light: CSColor.Gray.shade(.shade60), dark: CSColor.Gray.shade(.shade20))
39+
}
3640
}
3741

3842
extension UIAppColor {
@@ -148,6 +152,7 @@ extension UIAppColor {
148152
public enum AppColor {
149153
public static var tint: Color { Color(UIAppColor.tint) }
150154
public static var primary: Color { Color(UIAppColor.primary) }
155+
public static var secondary: Color { Color(UIAppColor.secondary) }
151156
}
152157

153158
private extension UIColor {

Modules/Sources/UITestsFoundation/Screens/MySiteMoreMenuScreen.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public class MySiteMoreMenuScreen: ScreenObject {
4343
$0.cells["Settings Row"]
4444
}
4545

46-
private let peopleButtonGetter: (XCUIApplication) -> XCUIElement = {
47-
$0.cells["People Row"]
46+
private let usersButtonGetter: (XCUIApplication) -> XCUIElement = {
47+
$0.cells["Users Row"]
4848
}
4949

5050
var activityLogButton: XCUIElement { activityLogButtonGetter(app) }
@@ -54,7 +54,7 @@ public class MySiteMoreMenuScreen: ScreenObject {
5454
var jetpackScanButton: XCUIElement { jetpackScanButtonGetter(app) }
5555
var mediaButton: XCUIElement { mediaButtonGetter(app) }
5656
var mySiteNavigationBar: XCUIElement { mySiteNavigationBarGetter(app) }
57-
var peopleButton: XCUIElement { peopleButtonGetter(app) }
57+
var usersButton: XCUIElement { usersButtonGetter(app) }
5858
var postsButton: XCUIElement { postsButtonGetter(app) }
5959
var settingsButton: XCUIElement { settingsButtonGetter(app) }
6060
var statsButton: XCUIElement { statsButtonGetter(app) }
@@ -112,9 +112,9 @@ public class MySiteMoreMenuScreen: ScreenObject {
112112
}
113113

114114
@discardableResult
115-
public func goToPeople() throws -> PeopleScreen {
116-
peopleButton.tap()
117-
return try PeopleScreen()
115+
public func goToUsers() throws -> UsersScreen {
116+
usersButton.tap()
117+
return try UsersScreen()
118118
}
119119

120120
public static func isLoaded() -> Bool {

Modules/Sources/UITestsFoundation/Screens/PeopleScreen.swift

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import ScreenObject
2+
import XCTest
3+
4+
public class UsersScreen: ScreenObject {
5+
6+
private let usersTableGetter: (XCUIApplication) -> XCUIElement = {
7+
$0.tables["users_table_view"].firstMatch
8+
}
9+
10+
init(app: XCUIApplication = XCUIApplication()) throws {
11+
try super.init(
12+
expectedElementGetters: [usersTableGetter],
13+
app: app
14+
)
15+
}
16+
17+
public static func isLoaded() -> Bool {
18+
(try? UsersScreen().isLoaded) ?? false
19+
}
20+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import SwiftUI
2+
3+
public struct LoadMoreFooterView: View {
4+
public enum State {
5+
case loading
6+
case failure
7+
}
8+
9+
let state: State
10+
var onRetry: (() -> Void)?
11+
12+
public init(_ state: State) {
13+
self.state = state
14+
}
15+
16+
public func onRetry(_ closure: (() -> Void)?) -> LoadMoreFooterView {
17+
var copy = self
18+
copy.onRetry = closure
19+
return copy
20+
}
21+
22+
public var body: some View {
23+
contentView
24+
.frame(maxWidth: .infinity)
25+
.listRowSeparator(.hidden)
26+
}
27+
28+
@ViewBuilder
29+
private var contentView: some View {
30+
switch state {
31+
case .loading:
32+
ProgressView()
33+
case .failure:
34+
Button(action: onRetry ?? {}) {
35+
HStack {
36+
Image(systemName: "exclamationmark.circle")
37+
if onRetry != nil {
38+
Text(AppLocalizedString("shared.button.retry", value: "Retry", comment: "A shared button title used in different contexts"))
39+
} else {
40+
Text(AppLocalizedString("shared.error.geneirc", value: "Something went wrong", comment: "A generic error message"))
41+
}
42+
}
43+
.lineLimit(1)
44+
}
45+
.disabled(onRetry == nil)
46+
}
47+
}
48+
}

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
-----
33
* [**] Add new “Subscribers” screen that shows both your email and Reader subscribers [#24513]
44
* [*] Fix an issue with “Stats / Subscribers” sometimes not showing the latest email subscribers [#24513]
5+
* [*] Fix an issue with "Stats" / "Subscribers" / "Emails" showing html encoded characters [#24513]
56

67
25.9
78
-----

WordPress/Classes/Extensions/EmptyStateView+Extensions.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ extension EmptyStateView where Label == SwiftUI.Label<Text, Image>, Description
1212
}
1313
}
1414

15-
extension EmptyStateView where Label == SwiftUI.Label<Text, Image>, Description == Text?, Actions == Button<Text> {
16-
static func failure(error: Error, onRetry: @escaping () -> Void) -> Self {
15+
extension EmptyStateView where Label == SwiftUI.Label<Text, Image>, Description == Text?, Actions == Button<Text>? {
16+
static func failure(error: Error, onRetry: (() -> Void)? = nil) -> Self {
1717
EmptyStateView {
1818
Label(SharedStrings.Error.generic, systemImage: "exclamationmark.circle")
1919
} description: {
2020
Text(error.localizedDescription)
2121
} actions: {
22-
Button(SharedStrings.Button.retry, action: onRetry)
22+
if let onRetry {
23+
Button(SharedStrings.Button.retry, action: onRetry)
24+
}
2325
}
2426
}
2527
}

WordPress/Classes/Utility/BuildInformation/FeatureFlag.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public enum FeatureFlag: Int, CaseIterable {
8080
case .nativeJetpackConnection:
8181
return BuildConfiguration.current == .debug
8282
case .newsletterSubscribers:
83-
return BuildConfiguration.current == .debug
83+
return true
8484
}
8585
}
8686

0 commit comments

Comments
 (0)