Skip to content

Commit 808aafc

Browse files
authored
Remove .newPublishingSheet FF (#24912)
* Remove .newPublishingSheet FF * Remove PrepublishingHeaderView * Move Blog+title extension * Remove more stuff * Remove publish_v2
1 parent e5076c9 commit 808aafc

20 files changed

+40
-1221
lines changed

Sources/WordPressData/Blog+Extensions.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ import WordPressShared
44

55
extension Blog {
66

7+
/// The title of the blog
8+
public var title: String? {
9+
guard let blogName = settings?.name, !blogName.isEmpty else {
10+
return displayURL as String?
11+
}
12+
return blogName
13+
}
14+
715
// MARK: - Post Formats
816

917
/// Returns an array of post format keys sorted with "standard" first, then alphabetically

Tests/KeystoneTests/Tests/Services/PostCoordinatorTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ class PostCoordinatorTests: CoreDataTestCase {
407407
await fulfillment(of: [expectation], timeout: 2)
408408

409409
// WHEN
410-
try await coordinator.publish(post, options: .init(visibility: .public, password: nil, publishDate: nil))
410+
try await coordinator.publish(post)
411411

412412
// THEN the coordinator wait for the sync to complete and the post to
413413
// be created and only then sends a parial update to get it published
@@ -462,7 +462,7 @@ class PostCoordinatorTests: CoreDataTestCase {
462462
}
463463

464464
// WHEN
465-
try await coordinator.publish(post, options: .init(visibility: .public, password: nil, publishDate: nil))
465+
try await coordinator.publish(post)
466466

467467
// THEN
468468
XCTAssertEqual(post.publicizeMessage, "message-a")

WordPress/Classes/Services/PostCoordinator.swift

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -73,61 +73,6 @@ class PostCoordinator: NSObject {
7373
NotificationCenter.default.addObserver(self, selector: #selector(didUpdateReachability), name: .reachabilityUpdated, object: nil)
7474
}
7575

76-
struct PublishingOptions {
77-
var visibility: PostVisibility
78-
var password: String?
79-
var publishDate: Date?
80-
81-
init(visibility: PostVisibility, password: String?, publishDate: Date?) {
82-
self.visibility = visibility
83-
self.password = password
84-
self.publishDate = publishDate
85-
}
86-
}
87-
88-
/// Publishes the post according to the current settings and user capabilities.
89-
///
90-
/// - warning: Before publishing, ensure that the media for the post got
91-
/// uploaded. Managing media is not the responsibility of `PostRepository.`
92-
@MainActor
93-
func publish(_ post: AbstractPost, options: PublishingOptions) async throws {
94-
wpAssert(post.isOriginal())
95-
wpAssert(post.isStatus(in: [.draft, .pending]))
96-
97-
await pauseSyncing(for: post)
98-
defer { resumeSyncing(for: post) }
99-
100-
var parameters = RemotePostUpdateParameters()
101-
switch options.visibility {
102-
case .public, .protected:
103-
parameters.status = Post.Status.publish.rawValue
104-
case .private:
105-
parameters.status = Post.Status.publishPrivate.rawValue
106-
}
107-
let latest = post.latest()
108-
if (latest.password ?? "") != (options.password ?? "") {
109-
parameters.password = options.password
110-
}
111-
if let publishDate = options.publishDate {
112-
parameters.date = publishDate
113-
} else {
114-
// If the post was previously scheduled for a different date,
115-
// the app has to send a new value to override it.
116-
parameters.date = post.shouldPublishImmediately() ? nil : Date()
117-
}
118-
119-
do {
120-
let repository = PostRepository(coreDataStack: coreDataStack)
121-
try await repository.save(post, changes: parameters)
122-
didPublish(post)
123-
show(PostCoordinator.makeUploadSuccessNotice(for: post))
124-
} catch {
125-
trackError(error, operation: "post-publish", post: post)
126-
handleError(error, for: post)
127-
throw error
128-
}
129-
}
130-
13176
/// Publishes the post according to the current settings and user capabilities.
13277
///
13378
/// - warning: Before publishing, ensure that the media for the post got
@@ -136,7 +81,7 @@ class PostCoordinator: NSObject {
13681
/// - parameter changes: The set of changes apply to the post together
13782
/// with the publishing options.
13883
@MainActor
139-
func publish_v2(_ post: AbstractPost, parameters: RemotePostUpdateParameters) async throws {
84+
func publish(_ post: AbstractPost, parameters: RemotePostUpdateParameters = .init()) async throws {
14085
wpAssert(post.isOriginal())
14186
wpAssert(post.isStatus(in: [.draft, .pending]))
14287

WordPress/Classes/Utility/BuildInformation/FeatureFlag.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ public enum FeatureFlag: Int, CaseIterable {
2525
case readerGutenbergCommentComposer
2626
case pluginManagementOverhaul
2727
case newStats
28-
case newPublishingSheet
2928
case mediaQuotaView
3029
case intelligence
3130

@@ -82,8 +81,6 @@ public enum FeatureFlag: Int, CaseIterable {
8281
return false
8382
case .newStats:
8483
return false
85-
case .newPublishingSheet:
86-
return true
8784
case .mediaQuotaView:
8885
return false
8986
case .intelligence:
@@ -131,7 +128,6 @@ extension FeatureFlag {
131128
case .pluginManagementOverhaul: "Plugin Management Overhaul"
132129
case .readerGutenbergCommentComposer: "Gutenberg Comment Composer"
133130
case .newStats: "New Stats"
134-
case .newPublishingSheet: "New Publishing Sheet"
135131
case .mediaQuotaView: "Media Quota"
136132
case .intelligence: "Intelligence"
137133
}

WordPress/Classes/Utility/SiteDateFormatters.swift

Lines changed: 0 additions & 12 deletions
This file was deleted.

WordPress/Classes/ViewRelated/Post/Controllers/AbstractPostListViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ class AbstractPostListViewController: UIViewController,
654654

655655
func publish(_ post: AbstractPost) {
656656
WPAnalytics.track(.postListPublishAction, withProperties: propertiesForAnalytics())
657-
PrepublishingViewController.show(for: post, isStandalone: true, from: self) { [weak self] result in
657+
PublishPostViewController.show(for: post, isStandalone: true, from: self) { [weak self] result in
658658
switch result {
659659
case .published:
660660
self?.dismiss(animated: true)

WordPress/Classes/ViewRelated/Post/PostEditor+Publish.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ extension PublishingEditor {
108108

109109
private func showPublishingConfirmation(for action: PostEditorAction, analyticsStat: WPAnalyticsStat?) {
110110
let originalFeaturedImageID = post.featuredImage?.mediaID
111-
PrepublishingViewController.show(for: post, from: self) { [weak self] result in
111+
PublishPostViewController.show(for: post, from: self) { [weak self] result in
112112
guard let self else { return }
113113
switch result {
114114
case .published:

WordPress/Classes/ViewRelated/Post/PostSettings/PostSettingsViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ final class PostSettingsViewModel: NSObject, ObservableObject {
307307
do {
308308
let coordinator = PostCoordinator.shared
309309
let changes = settings.makeUpdateParameters(from: post)
310-
try await coordinator.publish_v2(post.original(), parameters: changes)
310+
try await coordinator.publish(post.original(), parameters: changes)
311311
onPostPublished?()
312312
} catch {
313313
isSaving = false

WordPress/Classes/ViewRelated/Post/Prepublishing Nudge/Blog+Title.swift

Lines changed: 0 additions & 14 deletions
This file was deleted.

WordPress/Classes/ViewRelated/Post/Prepublishing Nudge/PrepublishingHeaderView.swift

Lines changed: 0 additions & 86 deletions
This file was deleted.

0 commit comments

Comments
 (0)