Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix an issue with scheduling of posts not working on iOS 17 with Xcode 15 #22012

Merged
merged 2 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
23.8
-----

* [*] [internal] Fix an issue with scheduling of posts not working on iOS 17 with Xcode 15 [#22012]

23.7
-----
Expand All @@ -27,7 +27,6 @@
* [*] Fix an issue with incorrect description for "Hidden" post privacy status [#21955]
* [*] [internal] Refactor sending the API requests for searching posts and pages. [#21976]
* [*] Fix an issue in Menu screen where it fails to create default menu items. [#21949]
* [*] Fix an issue with GIF uploads [#22025]
* [*] [internal] Refactor how site's pages are loaded in Site Settings -> Homepage Settings. [#21974]
* [*] Block Editor: Fix error when pasting deeply nested structure content [https://github.com/WordPress/gutenberg/pull/55613]
* [*] Block Editor: Fix crash related to accessing undefined value in `TextColorEdit` [https://github.com/WordPress/gutenberg/pull/55664]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ class PrepublishingViewController: UITableViewController {
sourceView: tableView.cellForRow(at: indexPath)?.contentView,
sourceRect: nil,
viewModel: publishSettingsViewModel,
transitioningDelegate: nil,
updated: { [weak self] date in
WPAnalytics.track(.editorPostScheduledChanged, properties: Constants.analyticsDefaultProperty)
self?.publishSettingsViewModel.setDate(date)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,16 @@ private struct DateAndTimeRow: ImmuTableRow {

func dateTimeCalendarViewController(with model: PublishSettingsViewModel) -> (ImmuTableRow) -> UIViewController {
return { [weak self] _ in
return PresentableSchedulingViewControllerProvider.viewController(sourceView: self?.viewController?.tableView,
sourceRect: self?.rectForSelectedRow() ?? .zero,
viewModel: model,
transitioningDelegate: self,
updated: { [weak self] date in
WPAnalytics.track(.editorPostScheduledChanged, properties: ["via": "settings"])
self?.viewModel.setDate(date)
NotificationCenter.default.post(name: Foundation.Notification.Name(rawValue: ImmuTableViewController.modelChangedNotification), object: nil)
},
onDismiss: nil)
return PresentableSchedulingViewControllerProvider.viewController(
sourceView: self?.viewController?.tableView,
sourceRect: self?.rectForSelectedRow() ?? .zero,
viewModel: model,
updated: { [weak self] date in
WPAnalytics.track(.editorPostScheduledChanged, properties: ["via": "settings"])
self?.viewModel.setDate(date)
NotificationCenter.default.post(name: Foundation.Notification.Name(rawValue: ImmuTableViewController.modelChangedNotification), object: nil)
},
onDismiss: nil)
}
}

Expand All @@ -223,16 +223,3 @@ private struct DateAndTimeRow: ImmuTableRow {
return viewController.tableView.rectForRow(at: selectedIndexPath)
}
}

// The calendar sheet is shown towards the bottom half of the screen so a custom transitioning delegate is needed.
extension PublishSettingsController: UIViewControllerTransitioningDelegate, UIAdaptivePresentationControllerDelegate {
func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? {
let presentationController = PartScreenPresentationController(presentedViewController: presented, presenting: presenting)
presentationController.delegate = self
return presentationController
}

func adaptivePresentationStyle(for: UIPresentationController, traitCollection: UITraitCollection) -> UIModalPresentationStyle {
return traitCollection.verticalSizeClass == .compact ? .overFullScreen : .none
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class DateCoordinator {

// MARK: - Date Picker

class SchedulingDatePickerViewController: UIViewController, DatePickerSheet, DateCoordinatorHandler, UIViewControllerTransitioningDelegate, UIAdaptivePresentationControllerDelegate {
class SchedulingDatePickerViewController: UIViewController, DatePickerSheet, DateCoordinatorHandler {

var coordinator: DateCoordinator? = nil

Expand Down Expand Up @@ -128,18 +128,6 @@ class SchedulingDatePickerViewController: UIViewController, DatePickerSheet, Dat
}
}

extension SchedulingDatePickerViewController {
@objc func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? {
let presentationController = PartScreenPresentationController(presentedViewController: presented, presenting: presenting)
presentationController.delegate = self
return presentationController
}

@objc func adaptivePresentationStyle(for: UIPresentationController, traitCollection: UITraitCollection) -> UIModalPresentationStyle {
return traitCollection.verticalSizeClass == .compact ? .overFullScreen : .none
}
}

// MARK: Accessibility

private extension SchedulingDatePickerViewController {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,49 +1,33 @@
import Foundation
import UIKit

protocol PresentableSchedulingViewControllerProviding {
class PresentableSchedulingViewControllerProvider {
static func viewController(sourceView: UIView?,
sourceRect: CGRect?,
viewModel: PublishSettingsViewModel,
transitioningDelegate: UIViewControllerTransitioningDelegate?,
updated: @escaping (Date?) -> Void,
onDismiss: (() -> Void)?) -> UINavigationController
}

class PresentableSchedulingViewControllerProvider: PresentableSchedulingViewControllerProviding {
static func viewController(sourceView: UIView?,
sourceRect: CGRect?,
viewModel: PublishSettingsViewModel,
transitioningDelegate: UIViewControllerTransitioningDelegate?,
updated: @escaping (Date?) -> Void,
onDismiss: (() -> Void)?) -> UINavigationController {
let schedulingViewController = schedulingViewController(with: viewModel, updated: updated)
return wrappedSchedulingViewController(schedulingViewController,
sourceView: sourceView,
sourceRect: sourceRect,
transitioningDelegate: transitioningDelegate,
onDismiss: onDismiss)
}

static func wrappedSchedulingViewController(_ schedulingViewController: SchedulingDatePickerViewController,
sourceView: UIView?,
sourceRect: CGRect?,
transitioningDelegate: UIViewControllerTransitioningDelegate?,
onDismiss: (() -> Void)?) -> SchedulingLightNavigationController {
let vc = SchedulingLightNavigationController(rootViewController: schedulingViewController)
vc.onDismiss = onDismiss

if UIDevice.isPad() {
vc.modalPresentationStyle = .popover
} else {
vc.modalPresentationStyle = .custom
vc.transitioningDelegate = transitioningDelegate ?? schedulingViewController
}

if let popoverController = vc.popoverPresentationController,
let sourceView = sourceView {
popoverController.sourceView = sourceView
popoverController.sourceRect = sourceRect ?? sourceView.frame
if let popoverController = vc.popoverPresentationController,
let sourceView = sourceView {
popoverController.sourceView = sourceView
popoverController.sourceRect = sourceRect ?? sourceView.frame
}
}
return vc
}
Expand Down
6 changes: 0 additions & 6 deletions WordPress/WordPress.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3818,7 +3818,6 @@
F580C3C123D22E2D0038E243 /* PreviewDeviceLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F580C3C023D22E2D0038E243 /* PreviewDeviceLabel.swift */; };
F580C3CB23D8F9B40038E243 /* AbstractPost+Dates.swift in Sources */ = {isa = PBXBuildFile; fileRef = F580C3CA23D8F9B40038E243 /* AbstractPost+Dates.swift */; };
F582060223A85495005159A9 /* SiteDateFormatters.swift in Sources */ = {isa = PBXBuildFile; fileRef = F582060123A85495005159A9 /* SiteDateFormatters.swift */; };
F5844B6B235EAF3D007C6557 /* PartScreenPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5844B6A235EAF3D007C6557 /* PartScreenPresentationController.swift */; };
F59AAC10235E430F00385EE6 /* ChosenValueRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = F59AAC0F235E430E00385EE6 /* ChosenValueRow.swift */; };
F59AAC16235EA46D00385EE6 /* LightNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F59AAC15235EA46D00385EE6 /* LightNavigationController.swift */; };
F5A34A9925DEF47D00C9654B /* WPMediaPicker+MediaPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5A34A9825DEF47D00C9654B /* WPMediaPicker+MediaPicker.swift */; };
Expand Down Expand Up @@ -4424,7 +4423,6 @@
FABB21E32602FC2C00C8785C /* NSCalendar+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E167F319C08D18009535AA /* NSCalendar+Helpers.swift */; };
FABB21E42602FC2C00C8785C /* GutenbergCoverUploadProcessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4629E4202440C5B20002E15C /* GutenbergCoverUploadProcessor.swift */; };
FABB21E52602FC2C00C8785C /* MediaQuotaCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF00889E204E01AE007CCE66 /* MediaQuotaCell.swift */; };
FABB21E62602FC2C00C8785C /* PartScreenPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5844B6A235EAF3D007C6557 /* PartScreenPresentationController.swift */; };
FABB21E72602FC2C00C8785C /* WPRichTextImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6805D2E1DCD399600168E4F /* WPRichTextImage.swift */; };
FABB21E82602FC2C00C8785C /* FormattableContentRange.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E4123B420F4097A00DF8486 /* FormattableContentRange.swift */; };
FABB21E92602FC2C00C8785C /* MenuItemSourceHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 08D978521CD2AF7D0054F19A /* MenuItemSourceHeaderView.m */; };
Expand Down Expand Up @@ -9190,7 +9188,6 @@
F580C3C023D22E2D0038E243 /* PreviewDeviceLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreviewDeviceLabel.swift; sourceTree = "<group>"; };
F580C3CA23D8F9B40038E243 /* AbstractPost+Dates.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AbstractPost+Dates.swift"; sourceTree = "<group>"; };
F582060123A85495005159A9 /* SiteDateFormatters.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SiteDateFormatters.swift; sourceTree = "<group>"; };
F5844B6A235EAF3D007C6557 /* PartScreenPresentationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PartScreenPresentationController.swift; sourceTree = "<group>"; };
F59AAC0F235E430E00385EE6 /* ChosenValueRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChosenValueRow.swift; sourceTree = "<group>"; };
F59AAC15235EA46D00385EE6 /* LightNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LightNavigationController.swift; sourceTree = "<group>"; };
F5A34A9825DEF47D00C9654B /* WPMediaPicker+MediaPicker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "WPMediaPicker+MediaPicker.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -17910,7 +17907,6 @@
F5660D08235D1CDD00020B1E /* CalendarMonthView.swift */,
03216EC5279946CA00D444CA /* SchedulingDatePickerViewController.swift */,
03216ECB27995F3500D444CA /* SchedulingViewControllerPresenter.swift */,
F5844B6A235EAF3D007C6557 /* PartScreenPresentationController.swift */,
F59AAC15235EA46D00385EE6 /* LightNavigationController.swift */,
F57402A6235FF9C300374346 /* SchedulingDate+Helpers.swift */,
);
Expand Down Expand Up @@ -21439,7 +21435,6 @@
4629E4212440C5B20002E15C /* GutenbergCoverUploadProcessor.swift in Sources */,
FF00889F204E01AE007CCE66 /* MediaQuotaCell.swift in Sources */,
982DDF94263238A6002B3904 /* LikeUserPreferredBlog+CoreDataClass.swift in Sources */,
F5844B6B235EAF3D007C6557 /* PartScreenPresentationController.swift in Sources */,
E6805D311DCD399600168E4F /* WPRichTextImage.swift in Sources */,
7E4123C120F4097B00DF8486 /* FormattableContentRange.swift in Sources */,
08D978581CD2AF7D0054F19A /* MenuItemSourceHeaderView.m in Sources */,
Expand Down Expand Up @@ -24276,7 +24271,6 @@
FABB21E32602FC2C00C8785C /* NSCalendar+Helpers.swift in Sources */,
FABB21E42602FC2C00C8785C /* GutenbergCoverUploadProcessor.swift in Sources */,
FABB21E52602FC2C00C8785C /* MediaQuotaCell.swift in Sources */,
FABB21E62602FC2C00C8785C /* PartScreenPresentationController.swift in Sources */,
086F2484284F52E100032F39 /* FeatureHighlightStore.swift in Sources */,
FABB21E72602FC2C00C8785C /* WPRichTextImage.swift in Sources */,
17870A75281FBEC100D1C627 /* StatsTotalInsightsCell.swift in Sources */,
Expand Down