Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/trunk' into mokagio/remove-cocoa…
Browse files Browse the repository at this point in the history
…pods-christmast-branch

There were various conflicts, all of which I addressed by picking the
`trunk` version assuming that version was the one already processed
after the merge of
#23923, which the
branch for this work stems from, into `trunk`.

 Conflicts:

    Modules/Sources/AsyncImageKit/ImagePrefetcher.swift
    Modules/Sources/AsyncImageKit/ImageRequest.swift
    Modules/Sources/AsyncImageKit/Views/AsyncImageView.swift
    WordPress.xcworkspace/xcshareddata/swiftpm/Package.resolved
    WordPress/Classes/ViewRelated/Blog/Blog Details/Detail Header/BlogDetailHeaderView.swift
    WordPress/Classes/ViewRelated/Blog/My Site/Header/HomeSiteHeaderViewController+SiteActions.swift
    WordPress/Classes/ViewRelated/Gutenberg/EditorMediaUtility.swift
    WordPress/Classes/ViewRelated/Media/External/ExternalMediaPickerViewController.swift
    WordPress/Classes/ViewRelated/NewGutenberg/NewGutenbergViewController.swift
    WordPress/Classes/ViewRelated/Notifications/Views/NoteBlockHeaderTableViewCell.swift
    WordPress/Classes/ViewRelated/Post/Views/PostListCell.swift
    WordPress/Classes/ViewRelated/Reader/Cards/ReaderCrossPostCell.swift
    WordPress/Classes/ViewRelated/Reader/Cards/ReaderPostCell.swift
  • Loading branch information
mokagio committed Jan 17, 2025
2 parents b2e22a1 + 8b454c7 commit 7dc268b
Show file tree
Hide file tree
Showing 36 changed files with 467 additions and 216 deletions.
2 changes: 1 addition & 1 deletion Modules/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ let package = Package(
.package(url: "https://github.com/zendesk/support_sdk_ios", from: "8.0.3"),
// We can't use wordpress-rs branches nor commits here. Only tags work.
.package(url: "https://github.com/Automattic/wordpress-rs", revision: "alpha-20241116"),
.package(url: "https://github.com/wordpress-mobile/GutenbergKit", revision: "4476d597b271778d001a26c50d74e527b54ebfef"),
.package(url: "https://github.com/wordpress-mobile/GutenbergKit", revision: "cc52214a50893b41898607ac0bff7f2787b085bb"),
.package(url: "https://github.com/Automattic/color-studio", branch: "trunk"),
.package(url: "https://github.com/allenhumphreys/AztecEditor-iOS", branch: "ah/spm"),
],
Expand Down
1 change: 1 addition & 0 deletions Modules/Sources/AsyncImageKit/ImagePrefetcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public final class ImagePrefetcher {
value.task?.cancel()
}
queue.removeAll()
numberOfActiveTasks = 0
}
}

Expand Down
29 changes: 17 additions & 12 deletions Modules/Sources/AsyncImageKit/ImageRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,29 +51,34 @@ public struct ImageRequestOptions: Hashable, Sendable {

/// Image size in **pixels**.
public struct ImageSize: Hashable, Sendable {
public let width: CGFloat
public let height: CGFloat
/// Width in **pixels**.
public var width: Int
/// Height in **pixels**.
public var height: Int

public init(width: CGFloat, height: CGFloat) {
/// Initializes the struct with given size in **pixels**.
public init(width: Int, height: Int) {
self.width = width
self.height = height
}

public init(_ size: CGSize) {
self.width = size.width
self.height = size.height
/// Initializes the struct with given size in **pixels**.
public init(pixels size: CGSize) {
self.width = Int(size.width)
self.height = Int(size.height)
}

/// Initializes `ImageSize` with the given size scaled for the given view.
/// A convenience initializer that creates `ImageSize` with the given size
/// in **points** scaled for the given view.
@MainActor
public init(scaling size: CGSize, in view: UIView) {
self.init(size.scaled(by: view.traitCollection.displayScale))
self.init(scaling: size, scale: view.traitCollection.displayScale)
}

/// Initializes `ImageSize` with the given size scaled for the current trait
/// collection display scale.
public init(scaling size: CGSize) {
self.init(size.scaled(by: UITraitCollection.current.displayScale))
/// Initializes `ImageSize` with the given size in **points** scaled for the
/// current trait collection display scale.
public init(scaling size: CGSize, scale: CGFloat) {
self.init(pixels: size.scaled(by: max(1, scale)))
}
}

Expand Down
1 change: 1 addition & 0 deletions Modules/Sources/AsyncImageKit/Views/AsyncImageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public final class AsyncImageView: UIView {
/// By default, `background`.
public var loadingStyle = LoadingStyle.background

// TODO: remove when WPRichTextImage is removed
public var passTouchesToSuperview = false

public init() {}
Expand Down
13 changes: 11 additions & 2 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
25.7
-----
* [**] Add Image Playground support (part of Apple Intelligence suite) for adding images to your posts, generated featured image, site icons, and more [#23688]
* [**] Add new lightbox screen for images with modern transitions and enhanced performance [#23922]
* [**] Enable history navigation (undo and redo) for the experimental editor. [#23961]
* [**] Enhance the Gravatar Quick Editor by adding features that allow users to delete and share their avatars. [#23868]
* [**] Add new lightbox screen for images with modern transitions and enhanced performance [#23922]
* [**] Add the capability to create an avatar using Apple Image Playground through the Gravatar Quick Editor. [#23868]
* [**] Various bug fixes and improvements in the new experimental editor [#23919]
* [*] Fix sorting in Stats Subscriber Emails (latest first) [#23913]
Expand Down Expand Up @@ -39,6 +40,14 @@
* [*] Fix small tap area for “More” button in the Subscriptions screen in Reader [#23964]
* [*] Fix “Notification Settings” for individual posts sometimes being clipped [#23964]
* [*] Add context menu (long-press) and previews for subscriptions with quick access to “Share”, “Copy Link”, “Add to Favorites”, “Notification Settings”, and “Unsubscribe” buttons in both the Subscriptions view and the Sidebar in Reader [#23964]
* [*] Fix an issue with fullscreen button in reply view clipped by the notch [#23965]
* [*] Remove "Lazy Images" option that is no longer part of the Jetpack plugin [#23966]
* [*] Fix an issue with "Speed up your site" section not refreshing (fails silently) [#23966]
* [*] Fix an issue with small tap area of the ellipsis in the post list [#23973]
* [*] Avoid unexpectedly marking post content as unsaved. [#23969]
* [*] Fix an issue with Mastodon connection not working [#23981]
* [**] Send feedback from within the experimental editor "more" options menu. [#23980]
* [**] Support accessing the code editor within the experimental editor. [#23979]

25.6
-----
Expand Down Expand Up @@ -98,7 +107,7 @@
* [*] [internal] Incorporate a parser to handle Gutenberg blocks more efficiently for improved performance [#22886]
* [**] Improve performance of Image and Gallery block processors to avoid long delay when saving a post [#22896]
* [*] Improve performance of File block processor [#22897]
* [*] [internal] Prompt users to keep the app up to date on their devices, so they can try new features, as well as benefit from performance improvements and bug fixes [#23195, #23216, #23218, #23211]
* [*] [internal] Prompt users to keep the app up to date on their devices, so they can try new features, as well as benefit from performance improvements and bug fixes [#23195, #23216, #23218, #23211]
* [**] [Jetpack-only] Reader: Add a new feed dedicated to tags [#23242]

24.9.1
Expand Down
6 changes: 3 additions & 3 deletions WordPress.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "c6c4224bb9091cbaed87a958001b2435576248fec163dc8ce6be041f8e1da166",
"originHash" : "d8a7faa1972ab73744be3161f236c4bae7faf7c44f840b7bd0a52b3ee1ee6d6c",
"pins" : [
{
"identity" : "alamofire",
Expand Down Expand Up @@ -150,7 +150,7 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/wordpress-mobile/GutenbergKit",
"state" : {
"revision" : "4476d597b271778d001a26c50d74e527b54ebfef"
"revision" : "cc52214a50893b41898607ac0bff7f2787b085bb"
}
},
{
Expand Down Expand Up @@ -392,7 +392,7 @@
"location" : "https://github.com/wordpress-mobile/WordPressKit-iOS",
"state" : {
"branch" : "wpios-edition",
"revision" : "908d96a6ff4eb38217e57c03996bf1f3e9cdb114"
"revision" : "a9a057ea6fba8080c146497336951dc805409771"
}
},
{
Expand Down
1 change: 1 addition & 0 deletions WordPress/Classes/Models/Blog/BlogSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ open class BlogSettings: NSManagedObject {

/// Jetpack Setting: lazy load images.
///
@available(*, deprecated)
@NSManaged var jetpackLazyLoadImages: Bool

// MARK: - Discussion
Expand Down
4 changes: 4 additions & 0 deletions WordPress/Classes/Models/ReaderTagTopic.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ import Foundation
return topic
}

var formattedTitle: String {
title.split(separator: "-").map(\.capitalized).joined(separator: " ")
}

/// Convenience method to update the tag's `following` state and also updates `showInMenu`.
@objc func toggleFollowing(_ isFollowing: Bool) {
following = isFollowing
Expand Down
24 changes: 0 additions & 24 deletions WordPress/Classes/Services/BlogJetpackSettingsService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,29 +142,6 @@ struct BlogJetpackSettingsService {
)
}

func updateJetpackLazyImagesModuleSettingForBlog(_ blog: Blog, success: @escaping () -> Void, failure: @escaping (Error?) -> Void) {
guard let blogSettings = blog.settings else {
failure(nil)
return
}

let isActive = blogSettings.jetpackLazyLoadImages
updateJetpackModuleActiveSettingForBlog(
blog,
module: BlogJetpackSettingsServiceRemote.Keys.lazyLoadImages,
active: isActive,
success: {
self.coreDataStack.performAndSave({ context in
guard let blogSettingsInContext = Blog.lookup(withObjectID: blog.objectID, in: context)?.settings else {
return
}
blogSettingsInContext.jetpackLazyLoadImages = isActive
}, completion: success, on: .main)
},
failure: failure
)
}

func updateJetpackServeImagesFromOurServersModuleSettingForBlog(_ blog: Blog, success: @escaping () -> Void, failure: @escaping (Error?) -> Void) {
guard let blogSettings = blog.settings else {
failure(nil)
Expand Down Expand Up @@ -235,7 +212,6 @@ private extension BlogJetpackSettingsService {
}

func updateJetpackModulesSettings(_ settings: BlogSettings, remoteSettings: RemoteBlogJetpackModulesSettings) {
settings.jetpackLazyLoadImages = remoteSettings.lazyLoadImages
settings.jetpackServeImagesFromOurServers = remoteSettings.serveImagesFromOurServers
}

Expand Down
21 changes: 6 additions & 15 deletions WordPress/Classes/System/Root View/ReaderPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ final class ReaderPresenter: NSObject, SplitViewDisplayable {

/// The navigation controller for the main content when shown using tabs.
private var mainNavigationController = UINavigationController()
private var latestContentVC: UIViewController?

private var viewContext: NSManagedObjectContext {
ContextManager.shared.mainContext
Expand Down Expand Up @@ -58,8 +57,8 @@ final class ReaderPresenter: NSObject, SplitViewDisplayable {
// -warning: List occasionally sets the selection to `nil` when switching items.
selectionObserver = sidebarViewModel.$selection.compactMap { $0 }
.removeDuplicates { [weak self] in
guard $0 == $1 else { return false }
self?.popMainNavigationController()
guard $0 == $1, let self, let splitViewController else { return false }
self.popMainNavigationController(in: splitViewController)
return true
}
.sink { [weak self] in self?.configure(for: $0) }
Expand All @@ -84,17 +83,10 @@ final class ReaderPresenter: NSObject, SplitViewDisplayable {
hideSupplementaryColumnIfNeeded()
}

private func popMainNavigationController() {
if let splitViewController {
let secondaryVC = splitViewController.viewController(for: .secondary)
(secondaryVC as? UINavigationController)?.popToRootViewController(animated: true)
hideSupplementaryColumnIfNeeded()
} else {
if let latestContentVC {
// Return to the previous view controller preserving its state
mainNavigationController.safePushViewController(latestContentVC, animated: true)
}
}
private func popMainNavigationController(in splitViewController: UISplitViewController) {
let secondaryVC = splitViewController.viewController(for: .secondary)
(secondaryVC as? UINavigationController)?.popToRootViewController(animated: true)
hideSupplementaryColumnIfNeeded()
}

private func hideSupplementaryColumnIfNeeded() {
Expand Down Expand Up @@ -190,7 +182,6 @@ final class ReaderPresenter: NSObject, SplitViewDisplayable {
}
splitViewController.setViewController(navigationVC, for: .secondary)
} else {
latestContentVC = viewController
mainNavigationController.safePushViewController(viewController, animated: true)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import WordPressShared

final class SubmitFeedbackViewController: UIViewController {
private var source: String
private var feedbackPrefix: String?

init(source: String) {
init(source: String, feedbackPrefix: String? = nil) {
self.source = source
self.feedbackPrefix = feedbackPrefix
super.init(nibName: nil, bundle: nil)
self.modalPresentationStyle = .formSheet
}
Expand All @@ -18,7 +20,7 @@ final class SubmitFeedbackViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()

let viewController = UIHostingController(rootView: SubmitFeedbackView(presentingViewController: self, source: source))
let viewController = UIHostingController(rootView: SubmitFeedbackView(presentingViewController: self, source: source, feedbackPrefix: feedbackPrefix))

let navigationController = UINavigationController(rootViewController: viewController)

Expand All @@ -33,6 +35,7 @@ final class SubmitFeedbackViewController: UIViewController {
private struct SubmitFeedbackView: View {
weak var presentingViewController: UIViewController?
let source: String
let feedbackPrefix: String?

@State private var text = ""
@State private var isSubmitting = false
Expand Down Expand Up @@ -141,9 +144,10 @@ private struct SubmitFeedbackView: View {

isSubmitting = true

let descriptionPrefix = feedbackPrefix.map { "[\($0)] " } ?? ""
ZendeskUtils.sharedInstance.createNewRequest(
in: presentingViewController,
description: text.trim(),
description: descriptionPrefix + text.trim(),
tags: ["appreview_jetpack", "in_app_feedback"],
attachments: attachmentsViewModel.attachments.compactMap(\.response),
alertOptions: nil
Expand Down Expand Up @@ -195,6 +199,6 @@ private enum Strings {

#Preview {
NavigationView {
SubmitFeedbackView(source: "preview")
SubmitFeedbackView(source: "preview", feedbackPrefix: nil)
}
}
1 change: 1 addition & 0 deletions WordPress/Classes/Utility/SharedStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ enum SharedStrings {

enum Error {
static let generic = NSLocalizedString("shared.error.geneirc", value: "Something went wrong", comment: "A generic error message")
static let refreshFailed = NSLocalizedString("shared.error.failiedToReloadData", value: "Failed to update data", comment: "A generic error title indicating that a screen failed to fetch the latest data")
}

enum Reader {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ - (void)setupTitle

- (void)setupWebView
{
self.webView.customUserAgent = [WPUserAgent wordPressUserAgent];
self.webView.navigationDelegate = self;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ class BlogDetailHeaderView: UIView {

private func makeSiteLinkMenu() -> UIMenu {
UIMenu(children: [
UIAction(title: SharedStrings.Button.share, image: UIImage(systemName: "square.and.arrow.up"), handler: { [weak self] _ in
self?.delegate?.buttonShareSiteTapped()
}),
UIAction(title: Strings.visitSite, image: UIImage(systemName: "safari"), handler: { [weak self] _ in
self?.delegate?.visitSiteTapped()
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private enum MenuItem {
var title: String {
switch self {
case .visitSite: return Strings.visitSite
case .shareSite: return SharedStrings.Button.share + ""
case .shareSite: return SharedStrings.Button.share
case .siteTitle: return Strings.siteTitle
case .personalizeHome: return Strings.personalizeHome
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,6 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath

- (void)handleConnectTapped:(NSIndexPath *)indexPath
{
if (![ReachabilityUtils isInternetReachable]) {
[ReachabilityUtils showAlertNoInternetConnection];
return;
}

if ([UIDevice isPad]) {
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
self.helper.popoverSourceView = cell.textLabel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,6 @@ - (void)updateSharedGlobally:(BOOL)shared

- (void)reconnectPublicizeConnection
{
if (![ReachabilityUtils isInternetReachable]) {
[ReachabilityUtils showAlertNoInternetConnection];
return;
}

SharingService *sharingService = [[SharingService alloc] initWithContextManager:[ContextManager sharedInstance]];

__weak __typeof(self) weakSelf = self;
Expand Down Expand Up @@ -273,11 +268,6 @@ - (void)disconnectPublicizeConnection

- (void)promptToConfirmDisconnect
{
if (![ReachabilityUtils isInternetReachable]) {
[ReachabilityUtils showAlertNoInternetConnection];
return;
}

NSString *message = NSLocalizedString(@"Disconnecting this account means published posts will no longer be automatically shared to %@", @"Explanatory text for the user. The `%@` is a placeholder for the name of a third-party sharing service.");
message = [NSString stringWithFormat:message, self.publicizeConnection.label];
UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import WordPressKit

class ComplianceLocationService {
private let session = URLSession(configuration: .ephemeral)

func getIPCountryCode(completion: @escaping (Result<String, Error>) -> Void) {
IPLocationRemote().fetchIPCountryCode(completion: completion)
IPLocationRemote(urlSession: session).fetchIPCountryCode(completion: completion)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class EditorMediaUtility {
callbackQueue.async {
failure(error)
}
return MeediaUtilityTask { /* do nothing */ }
return MediaUtilityTask { /* do nothing */ }
case let .success((imageURL, host)):
let task = Task { @MainActor in
do {
Expand All @@ -98,7 +98,7 @@ class EditorMediaUtility {

}
}
return MeediaUtilityTask { task.cancel() }
return MediaUtilityTask { task.cancel() }
}
}

Expand Down Expand Up @@ -202,7 +202,7 @@ class EditorMediaUtility {
}
}

private struct MeediaUtilityTask: ImageDownloaderTask {
private struct MediaUtilityTask: ImageDownloaderTask {
let closure: @Sendable () -> Void

func cancel() {
Expand Down
Loading

0 comments on commit 7dc268b

Please sign in to comment.