Skip to content

Commit

Permalink
Merge release/25.4 into trunk (#23665)
Browse files Browse the repository at this point in the history
* Bump version number

* Update draft release notes for 25.4.

* Update draft release notes for 25.4.

* Release Notes: add new section for next version (25.5)

* Update strings for localization

* Shave a few bytes off all our icons

* Update app translations – `Localizable.strings`

* Update WordPress metadata translations

* Update Jetpack metadata translations

* Bump version number

* Remove alpha channel from WordPress light icon (Any Appearance)

This was done to address an iTMS rejection:

  Asset validation failed (90717) Invalid large app icon.
  The large app icon in the asset catalog in “WordPress.app” can’t be transparent or contain an alpha channel.
  For details, visit: https://developer.apple.com/design/human-interface-guidelines/app-icons.

See https://buildkite.com/automattic/wordpress-ios/builds/24053#019234f2-8086-4160-904a-328283175b3b

This was done via Preview.app: Export... > PNG unticking the "Alpha"
channel.

* Upload Fastlane to handle occasional ASC upload issue

* Update app translations – `Localizable.strings`

* Bump version number

* Bump version number

* Stop handling WordPress.com links in the WordPress app (#23653)

* Stop handling WordPress.com links in the WordPress app

* Address a build failure in the tests because of unhandled `XCTSkip`

---------

Co-authored-by: Gio Lodi <[email protected]>

* feat: Synchronize content with GutenbergKit (#23631)

* Merge release/25.4 into trunk (#23628)

* Bump version number

* Update draft release notes for 25.4.

* Update draft release notes for 25.4.

* Release Notes: add new section for next version (25.5)

* Update strings for localization

* feat: Persist GutenbergKit changes

Ensure post changes are not lost.

* fix: Persist changes if either post title or content changes

The previous conditional erroneously ignored changes unless both values
changed.

* build: Update GutenbergKit ref

* fix: Improve empty editor content check

As noted in the code comment, this value lags behind reality. A race
condition existed in production builds cause inaccurate values. This was
removed to instead rely upon the existing `editorHasContent`
implementation found in the `PostEditor` class.

* build: Update GutenbergKit ref

* build: Update GutenbergKit ref

* build: Update GutenbergKit ref

* Update GutenbergKit ref

* Update GutenbergKit ref

---------

Co-authored-by: WordPress Mobile Bot Account <[email protected]>
Co-authored-by: Gerardo <[email protected]>
Co-authored-by: Jeremy Massel <[email protected]>

* Fix an issue with comment selection state disappearing (#23658)

* Disable Reader anouncemnets (#23655)

* Fix an issue with Me header view alignment (#23647)

* Add Gutenberg Experimental Editor Switch (#23660)

* Add TipKit for Sidebar (#23648)

* Enable TipKit FF (#23661)

* Fix crash in TipKit (#23664)

* Update strings for localization

* Update app translations – `Localizable.strings`

* Bump version number

---------

Co-authored-by: Jeremy Massel <[email protected]>
Co-authored-by: Ian Maia <[email protected]>
Co-authored-by: Gio Lodi <[email protected]>
Co-authored-by: Tony Li <[email protected]>
Co-authored-by: David Calhoun <[email protected]>
Co-authored-by: Gerardo <[email protected]>
Co-authored-by: Alex Grebenyuk <[email protected]>
Co-authored-by: Oguz Kocer <[email protected]>
  • Loading branch information
9 people authored Oct 7, 2024
1 parent 2196d31 commit cfde199
Show file tree
Hide file tree
Showing 32 changed files with 2,076 additions and 52 deletions.
2 changes: 1 addition & 1 deletion Modules/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,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-swift-20240813"),
.package(url: "https://github.com/wordpress-mobile/GutenbergKit", revision: "0987aa05587342f531b646dbb36d5622df12cfea"),
.package(url: "https://github.com/wordpress-mobile/GutenbergKit", revision: "c31879b834ef3ca5ea6b09040c96093ef627e029"),
.package(url: "https://github.com/Automattic/color-studio", branch: "add/swift-file-output"),
],
targets: XcodeSupport.targets + [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/wordpress-mobile/GutenbergKit",
"state" : {
"revision" : "0987aa05587342f531b646dbb36d5622df12cfea"
"revision" : "c31879b834ef3ca5ea6b09040c96093ef627e029"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ enum FeatureFlag: Int, CaseIterable {
case .authenticateUsingApplicationPassword:
return false
case .tipKit:
return BuildConfiguration.current != .appStore
return true
case .sidebar:
return true
case .newGutenberg:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,10 @@ final class HomeSiteHeaderViewController: UIViewController {
super.viewDidAppear(animated)

if #available(iOS 17, *) {
AppTips.SitePickerTip.blogCount = blog.account?.blogs.count ?? 0

if sitePickerTipObserver == nil {
if sitePickerTipObserver == nil, traitCollection.horizontalSizeClass == .compact, blog.account?.blogs.isEmpty == false {
sitePickerTipObserver = registerTipPopover(
AppTips.SitePickerTip(),
sourceView: blogDetailHeaderView.titleView.siteSwitcherButton,
sourceItem: blogDetailHeaderView.titleView.siteSwitcherButton,
arrowDirection: [.up]
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,9 @@ - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)ce

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectSelectedRowWithAnimation:YES];
if (!self.isSidebarModeEnabled) {
[tableView deselectSelectedRowWithAnimation:YES];
}

if (![self indexPathIsValid:indexPath]) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ class ExperimentalFeaturesDataProvider: ExperimentalFeaturesViewModel.DataProvid

let flags: [OverridableFlag] = [
FeatureFlag.authenticateUsingApplicationPassword,
// FeatureFlag.newGutenberg,
FeatureFlag.newGutenberg,
FeatureFlag.newGutenbergThemeStyles,
]

private let flagStore = FeatureFlagOverrideStore()
Expand Down
3 changes: 2 additions & 1 deletion WordPress/Classes/ViewRelated/Me/Views/MeHeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class MeHeaderView: UIView {
[iconView, infoStackView]
)

private lazy var infoStackView = UIStackView(axis: .vertical, spacing: 2, [titleLabel, detailsLabel])
private lazy var infoStackView = UIStackView(axis: .vertical, alignment: .center, spacing: 2, [titleLabel, detailsLabel])

private lazy var iconSizeConstraints = [
iconView.widthAnchor.constraint(equalToConstant: 0),
Expand Down Expand Up @@ -86,6 +86,7 @@ final class MeHeaderView: UIView {
stackView.axis = .horizontal
stackView.spacing = 16
stackView.layoutMargins = UIEdgeInsets(horizontal: 30, vertical: 6)
infoStackView.alignment = .leading
setIconSize(40)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@ class NewGutenbergViewController: UIViewController, PostEditor, PublishingEditor
return !changes.isEmpty
}

// TODO: this has to be incorrect and/or lagging behind
var editorHasContent: Bool {
!editorViewController.state.isEmpty
}

// TODO: remove (none of these APIs are needed for the new editor)
var autosaver = Autosaver(action: {})
func prepopulateMediaItems(_ media: [Media]) {}
Expand Down Expand Up @@ -294,11 +289,14 @@ class NewGutenbergViewController: UIViewController, PostEditor, PublishingEditor
private func getLatestContent() async {
// TODO: read title as well
let startTime = CFAbsoluteTimeGetCurrent()
let content = try? await editorViewController.getContent()
let editorData = try? await editorViewController.getTitleAndContent()
let duration = CFAbsoluteTimeGetCurrent() - startTime
print("gutenbergkit-measure_get-latest-content:", duration)

if content != post.content {
if let title = editorData?.title,
let content = editorData?.content,
title != post.postTitle || content != post.content {
post.postTitle = title
post.content = content
post.managedObjectContext.map(ContextManager.shared.save)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ class ReaderAnnouncementCoordinator {
let repository: UserPersistentRepository = UserPersistentStoreFactory.instance()

var canShowAnnouncement: Bool {
return !isDismissed && RemoteFeatureFlag.readerAnnouncementCard.enabled()
false
// return !isDismissed && RemoteFeatureFlag.readerAnnouncementCard.enabled()
}

var isDismissed: Bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ final class ReaderSidebarViewController: UIHostingController<AnyView> {

private var cancellables: [AnyCancellable] = []
private var viewContext: NSManagedObjectContext { ContextManager.shared.mainContext }
private var didAppear = false

init(viewModel: ReaderSidebarViewModel) {
self.viewModel = viewModel
Expand All @@ -30,6 +31,12 @@ final class ReaderSidebarViewController: UIHostingController<AnyView> {
viewModel.onAppear()
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

didAppear = true
}

func showInitialSelection() {
cancellables = []

Expand Down Expand Up @@ -60,7 +67,7 @@ final class ReaderSidebarViewController: UIHostingController<AnyView> {
showSecondary(makeViewController(withTopicID: objectID))
}

if let splitVC = splitViewController, splitVC.splitBehavior == .overlay {
if didAppear, let splitVC = splitViewController, splitVC.splitBehavior == .overlay {
DispatchQueue.main.async {
splitVC.hide(.supplementary)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ final class SiteMenuViewController: UIViewController {

weak var delegate: SiteMenuViewControllerDelegate?

private var tipObserver: TipObserver?
private var didAppear = false
private let tipAnchor = UIView()

/// - warning: Temporary code. Avoid using it!
var selectedSubsection: BlogDetailsSubsection? {
let subsection = blogDetailsVC.selectedSubsection
Expand Down Expand Up @@ -44,6 +48,42 @@ final class SiteMenuViewController: UIViewController {
navigationItem.title = blog.settings?.name ?? (blog.displayURL as String?) ?? ""
}

private func getTipAnchor() -> UIView {
if tipAnchor.superview != nil {
return tipAnchor
}
guard let navigationBar = navigationController?.navigationBar else {
return view // fallback
}
navigationBar.addSubview(tipAnchor)
tipAnchor.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
tipAnchor.widthAnchor.constraint(equalToConstant: 0),
tipAnchor.heightAnchor.constraint(equalToConstant: 0),
tipAnchor.leadingAnchor.constraint(equalTo: navigationBar.safeAreaLayoutGuide.leadingAnchor, constant: 8),
tipAnchor.topAnchor.constraint(equalTo: navigationBar.safeAreaLayoutGuide.topAnchor, constant: 40)
])
return tipAnchor
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

if #available(iOS 17, *) {
if tipObserver == nil {
tipObserver = registerTipPopover(AppTips.SidebarTip(), sourceItem: getTipAnchor(), arrowDirection: [.up])
}
}

didAppear = true
}

override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)

tipObserver = nil
}

func showSubsection(_ subsection: BlogDetailsSubsection, userInfo: [AnyHashable: Any]) {
blogDetailsVC.showDetailView(for: subsection, userInfo: userInfo)
}
Expand Down Expand Up @@ -103,7 +143,8 @@ extension SiteMenuViewController: BlogDetailsPresentationDelegate {
func presentBlogDetailsViewController(_ viewController: UIViewController) {
delegate?.siteMenuViewController(self, showDetailsViewController: viewController)

if let splitVC = splitViewController, splitVC.splitBehavior == .overlay {
// didAppear prevents it from being hidden on first show
if didAppear, let splitVC = splitViewController, splitVC.splitBehavior == .overlay {
DispatchQueue.main.async {
splitVC.hide(.supplementary)
}
Expand Down
26 changes: 20 additions & 6 deletions WordPress/Classes/ViewRelated/Tips/AppTips.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,25 @@ enum AppTips {
Image(systemName: "rectangle.stack.badge.plus")
}

@Parameter(.transient)
static var blogCount: Int = 0
var options: [any TipOption] {
MaxDisplayCount(1)
}
}

var rules: [Rule] {
#Rule(Self.$blogCount) { $0 > 1 }
@available(iOS 17, *)
struct SidebarTip: Tip {
let id = "sidebar_tip"

var title: Text {
Text(NSLocalizedString("tips.sidebar.title", value: "Sidebar", comment: "Tip for sidebar"))
}

var message: Text? {
Text(NSLocalizedString("tips.sidebar.message", value: "Swipe right to access your sites, Reader, notifications, and profile", comment: "Tip for sidebar"))
}

var image: Image? {
Image(systemName: "sidebar.left")
}

var options: [any TipOption] {
Expand All @@ -47,7 +61,7 @@ extension UIViewController {
@available(iOS 17, *)
func registerTipPopover(
_ tip: some Tip,
sourceView: UIView,
sourceItem: any UIPopoverPresentationControllerSourceItem,
arrowDirection: UIPopoverArrowDirection? = nil,
actionHandler: ((Tips.Action) -> Void)? = nil
) -> TipObserver? {
Expand All @@ -57,7 +71,7 @@ extension UIViewController {
let task = Task { @MainActor [weak self] in
for await shouldDisplay in tip.shouldDisplayUpdates {
if shouldDisplay {
let popoverController = TipUIPopoverViewController(tip, sourceItem: sourceView, actionHandler: actionHandler ?? { _ in })
let popoverController = TipUIPopoverViewController(tip, sourceItem: sourceItem, actionHandler: actionHandler ?? { _ in })
popoverController.view.tintColor = .secondaryLabel
if let arrowDirection {
popoverController.popoverPresentationController?.permittedArrowDirections = arrowDirection
Expand Down
Loading

0 comments on commit cfde199

Please sign in to comment.