diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 329636fe1cfd..f218aac8f5d0 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -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 ----- @@ -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] diff --git a/WordPress/Classes/ViewRelated/Post/Prepublishing/PrepublishingViewController.swift b/WordPress/Classes/ViewRelated/Post/Prepublishing/PrepublishingViewController.swift index 9c618cf8bb5e..6493129af2e3 100644 --- a/WordPress/Classes/ViewRelated/Post/Prepublishing/PrepublishingViewController.swift +++ b/WordPress/Classes/ViewRelated/Post/Prepublishing/PrepublishingViewController.swift @@ -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) diff --git a/WordPress/Classes/ViewRelated/Post/Scheduling/PartScreenPresentationController.swift b/WordPress/Classes/ViewRelated/Post/Scheduling/PartScreenPresentationController.swift deleted file mode 100644 index 1fa71d36c922..000000000000 --- a/WordPress/Classes/ViewRelated/Post/Scheduling/PartScreenPresentationController.swift +++ /dev/null @@ -1,77 +0,0 @@ -import Foundation - -class PartScreenPresentationController: FancyAlertPresentationController { - - var minimumHeight: CGFloat { - return presentedViewController.preferredContentSize.height - } - - private weak var tapGestureRecognizer: UITapGestureRecognizer? - - override var frameOfPresentedViewInContainerView: CGRect { - /// If we are in compact mode, don't override the default - guard traitCollection.verticalSizeClass != .compact else { - return super.frameOfPresentedViewInContainerView - } - guard let containerView = containerView else { - return .zero - } - let height = max(containerView.bounds.height/2, minimumHeight) - let width = containerView.bounds.width - - return CGRect(x: 0, y: containerView.bounds.height - height, width: width, height: height) - } - - override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { - coordinator.animate(alongsideTransition: { _ in - self.presentedView?.frame = self.frameOfPresentedViewInContainerView - }, completion: nil) - super.viewWillTransition(to: size, with: coordinator) - } - - override func preferredContentSizeDidChange(forChildContentContainer container: UIContentContainer) { - super.preferredContentSizeDidChange(forChildContentContainer: container) - presentedViewController.view.frame = frameOfPresentedViewInContainerView - } - - override func containerViewDidLayoutSubviews() { - super.containerViewDidLayoutSubviews() - - if tapGestureRecognizer == nil { - addGestureRecognizer() - } - } - - private func addGestureRecognizer() { - let gestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(dismiss)) - gestureRecognizer.cancelsTouchesInView = false - gestureRecognizer.delegate = self - containerView?.addGestureRecognizer(gestureRecognizer) - tapGestureRecognizer = gestureRecognizer - } - - /// This may need to be added to FancyAlertPresentationController - override var shouldPresentInFullscreen: Bool { - return false - } - - @objc func dismiss() { - presentedViewController.dismiss(animated: true, completion: nil) - } -} - -extension PartScreenPresentationController: UIGestureRecognizerDelegate { - func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool { - - /// Shouldn't happen; should always have container & presented view when tapped - guard let containerView = containerView, let presentedView = presentedView else { - return false - } - - let touchPoint = touch.location(in: containerView) - let isInPresentedView = presentedView.frame.contains(touchPoint) - - /// Do not accept the touch if inside of the presented view - return (gestureRecognizer == tapGestureRecognizer) && isInPresentedView == false - } -} diff --git a/WordPress/Classes/ViewRelated/Post/Scheduling/PublishSettingsViewController.swift b/WordPress/Classes/ViewRelated/Post/Scheduling/PublishSettingsViewController.swift index 83cf39bb0ac3..1a3c8a6727ab 100644 --- a/WordPress/Classes/ViewRelated/Post/Scheduling/PublishSettingsViewController.swift +++ b/WordPress/Classes/ViewRelated/Post/Scheduling/PublishSettingsViewController.swift @@ -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) } } @@ -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 - } -} diff --git a/WordPress/Classes/ViewRelated/Post/Scheduling/SchedulingDatePickerViewController.swift b/WordPress/Classes/ViewRelated/Post/Scheduling/SchedulingDatePickerViewController.swift index 439148936c99..86e9b5ff0c55 100644 --- a/WordPress/Classes/ViewRelated/Post/Scheduling/SchedulingDatePickerViewController.swift +++ b/WordPress/Classes/ViewRelated/Post/Scheduling/SchedulingDatePickerViewController.swift @@ -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 @@ -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 { diff --git a/WordPress/Classes/ViewRelated/Post/Scheduling/SchedulingViewControllerPresenter.swift b/WordPress/Classes/ViewRelated/Post/Scheduling/SchedulingViewControllerPresenter.swift index 2ac06408e9f4..4cc36b9ce7ca 100644 --- a/WordPress/Classes/ViewRelated/Post/Scheduling/SchedulingViewControllerPresenter.swift +++ b/WordPress/Classes/ViewRelated/Post/Scheduling/SchedulingViewControllerPresenter.swift @@ -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 } diff --git a/WordPress/WordPress.xcodeproj/project.pbxproj b/WordPress/WordPress.xcodeproj/project.pbxproj index 1d8e709b666b..71fdc28e92e5 100644 --- a/WordPress/WordPress.xcodeproj/project.pbxproj +++ b/WordPress/WordPress.xcodeproj/project.pbxproj @@ -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 */; }; @@ -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 */; }; @@ -9190,7 +9188,6 @@ F580C3C023D22E2D0038E243 /* PreviewDeviceLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreviewDeviceLabel.swift; sourceTree = ""; }; F580C3CA23D8F9B40038E243 /* AbstractPost+Dates.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AbstractPost+Dates.swift"; sourceTree = ""; }; F582060123A85495005159A9 /* SiteDateFormatters.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SiteDateFormatters.swift; sourceTree = ""; }; - F5844B6A235EAF3D007C6557 /* PartScreenPresentationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PartScreenPresentationController.swift; sourceTree = ""; }; F59AAC0F235E430E00385EE6 /* ChosenValueRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChosenValueRow.swift; sourceTree = ""; }; F59AAC15235EA46D00385EE6 /* LightNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LightNavigationController.swift; sourceTree = ""; }; F5A34A9825DEF47D00C9654B /* WPMediaPicker+MediaPicker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "WPMediaPicker+MediaPicker.swift"; sourceTree = ""; }; @@ -17910,7 +17907,6 @@ F5660D08235D1CDD00020B1E /* CalendarMonthView.swift */, 03216EC5279946CA00D444CA /* SchedulingDatePickerViewController.swift */, 03216ECB27995F3500D444CA /* SchedulingViewControllerPresenter.swift */, - F5844B6A235EAF3D007C6557 /* PartScreenPresentationController.swift */, F59AAC15235EA46D00385EE6 /* LightNavigationController.swift */, F57402A6235FF9C300374346 /* SchedulingDate+Helpers.swift */, ); @@ -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 */, @@ -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 */,