Skip to content

Commit d44c1a1

Browse files
oguzkocerwpmobilebotkean
authored
Merge release/25.4.1 into trunk using cherry picked commits (#23698)
* Bump version number * Fix crash in ImageDownloader * Revert split view changes * Show post stats from Authors section * Improve sharing --------- Co-authored-by: Automattic Release Bot <[email protected]> Co-authored-by: kean <[email protected]>
1 parent 29027d1 commit d44c1a1

File tree

19 files changed

+118
-234
lines changed

19 files changed

+118
-234
lines changed

WordPress/Classes/System/SplitViewRootPresenter.swift

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -318,19 +318,9 @@ extension SplitViewRootPresenter: UISplitViewControllerDelegate {
318318

319319
// TODO: refactor this
320320
func splitViewControllerDidCollapse(_ svc: UISplitViewController) {
321-
let mainContext = ContextManager.shared.mainContext
322321
switch sidebarViewModel.selection {
323-
case .blog(let objectID):
324-
guard let blog = try? mainContext.existingObject(with: objectID) else {
325-
return
326-
}
327-
if let navigationVC = svc.viewController(for: .supplementary) as? UINavigationController,
328-
let menuVC = navigationVC.viewControllers.first as? SiteMenuViewController,
329-
let subsection = menuVC.selectedSubsection, subsection != .home {
330-
tabBarVC.showBlogDetails(for: blog, then: subsection, userInfo: [:])
331-
} else {
332-
tabBarVC.showBlogDetails(for: blog)
333-
}
322+
case .blog:
323+
break
334324
case .reader:
335325
if let selection = readerPresenter.sidebar.viewModel.selection {
336326
switch selection {

WordPress/Classes/Utility/Media/ImageDownloader.swift

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,23 +106,25 @@ actor ImageDownloader {
106106

107107
private func data(for request: URLRequest, options: ImageRequestOptions) async throws -> Data {
108108
let requestKey = request.urlRequest?.url?.absoluteString ?? ""
109-
let task = tasks[requestKey] ?? ImageDataTask(task: Task {
109+
let task = tasks[requestKey] ?? ImageDataTask(key: requestKey, Task {
110110
try await self._data(for: request, options: options, key: requestKey)
111111
})
112+
task.downloader = self
113+
112114
let subscriptionID = UUID()
113115
task.subscriptions.insert(subscriptionID)
114116
tasks[requestKey] = task
115117

116-
return try await withTaskCancellationHandler {
117-
try await task.task.value
118-
} onCancel: {
119-
Task {
120-
await self.unsubscribe(subscriptionID, key: requestKey)
121-
}
118+
return try await task.getData(subscriptionID: subscriptionID)
119+
}
120+
121+
fileprivate nonisolated func unsubscribe(_ subscriptionID: UUID, key: String) {
122+
Task {
123+
await _unsubscribe(subscriptionID, key: key)
122124
}
123125
}
124126

125-
private func unsubscribe(_ subscriptionID: UUID, key: String) {
127+
private func _unsubscribe(_ subscriptionID: UUID, key: String) {
126128
guard let task = tasks[key],
127129
task.subscriptions.remove(subscriptionID) != nil,
128130
task.subscriptions.isEmpty else {
@@ -151,14 +153,24 @@ actor ImageDownloader {
151153
}
152154

153155
private final class ImageDataTask {
156+
let key: String
154157
var subscriptions = Set<UUID>()
155-
var isCancelled = false
156-
var task: Task<Data, Error>
158+
let task: Task<Data, Error>
159+
weak var downloader: ImageDownloader?
157160

158-
init(subscriptions: Set<UUID> = Set<UUID>(), task: Task<Data, Error>) {
159-
self.subscriptions = subscriptions
161+
init(key: String, _ task: Task<Data, Error>) {
162+
self.key = key
160163
self.task = task
161164
}
165+
166+
func getData(subscriptionID: UUID) async throws -> Data {
167+
try await withTaskCancellationHandler {
168+
try await task.value
169+
} onCancel: { [weak self] in
170+
guard let self else { return }
171+
self.downloader?.unsubscribe(subscriptionID, key: self.key)
172+
}
173+
}
162174
}
163175

164176
// MARK: - ImageDownloader (Closures)

WordPress/Classes/Utility/Sharing/SafariActivity.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ @implementation SafariActivity {
66

77
- (UIImage *)activityImage
88
{
9-
return [UIImage imageNamed:@"Safari"];
9+
return [UIImage systemImageNamed:@"safari"];
1010
}
1111

1212
- (NSString *)activityTitle

WordPress/Classes/ViewRelated/Blog/Blog Details/BlogDetailsViewController.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,6 @@ typedef NS_ENUM(NSUInteger, BlogDetailsNavigationSource) {
8989
@property (nonatomic) BOOL showsDisclosureIndicator;
9090
@property (nonatomic, copy, nullable) void (^callback)(void);
9191

92-
/// - warning: This property is not specified for every row.
93-
@property (nonatomic, readonly) BlogDetailsSubsection subsection;
94-
9592
- (instancetype _Nonnull)initWithTitle:(NSString * __nonnull)title
9693
identifier:(NSString * __nonnull)identifier
9794
accessibilityIdentifier:(NSString *__nullable)accessibilityIdentifier
@@ -118,8 +115,6 @@ typedef NS_ENUM(NSUInteger, BlogDetailsNavigationSource) {
118115
renderingMode:(UIImageRenderingMode)renderingMode
119116
callback:(void(^_Nullable)(void))callback;
120117

121-
- (BlogDetailsRow * _Nonnull)withSubsection:(BlogDetailsSubsection)subsection;
122-
123118
@end
124119

125120
@protocol ScenePresenter;
@@ -140,9 +135,6 @@ typedef NS_ENUM(NSUInteger, BlogDetailsNavigationSource) {
140135
/// A new display mode for the displaying it as part of the site menu.
141136
@property (nonatomic) BOOL isSidebarModeEnabled;
142137

143-
/// - warning: A temporary solution for restoring selection on iPad – imprecise!
144-
@property (nonatomic, readonly) BlogDetailsSubsection selectedSubsection;
145-
146138
- (id _Nonnull)init;
147139
- (void)showDetailViewForSubsection:(BlogDetailsSubsection)section;
148140
- (void)showDetailViewForSubsection:(BlogDetailsSubsection)section userInfo:(nonnull NSDictionary *)userInfo;

0 commit comments

Comments
 (0)