Skip to content
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
2 changes: 0 additions & 2 deletions Sources/Keystone/WordPress.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ FOUNDATION_EXPORT const unsigned char WordPressVersionString[];

#import <WordPress/NSObject+Helpers.h>

#import <WordPress/PageSettingsViewController.h>
#import <WordPress/PostCategoryService.h>
#import <WordPress/PostSettingsViewController.h>
#import <WordPress/PostTagService.h>

#import <WordPress/ReaderPostService.h>
Expand Down
5 changes: 0 additions & 5 deletions Sources/WordPressData/Objective-C/AbstractPost.m
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,6 @@ - (BOOL)isPrivateAtWPCom
return self.blog.isPrivateAtWPCom;
}

- (BOOL)isMultiAuthorBlog
{
return self.blog.isMultiAuthor;
}

- (BOOL)isUploading
{
return self.remoteStatus == AbstractPostRemoteStatusPushing;
Expand Down
1 change: 0 additions & 1 deletion Sources/WordPressData/Objective-C/include/AbstractPost.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ typedef NS_ENUM(NSUInteger, AbstractPostRemoteStatus) {
- (NSString *)authorNameForDisplay;
- (NSString *)blavatarForDisplay;
- (NSString *)dateStringForDisplay;
- (BOOL)isMultiAuthorBlog;
- (BOOL)isPrivateAtWPCom;


Expand Down
7 changes: 0 additions & 7 deletions Sources/WordPressData/Swift/AbstractPost.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,6 @@ public extension AbstractPost {
}
}

// MARK: - Misc

/// A title describing the status. Ie.: "Public" or "Private" or "Password protected"
@objc var titleForVisibility: String {
PostVisibility(post: self).localizedTitle
}

/// Represent the supported properties used to sort posts.
///
enum SortField {
Expand Down
25 changes: 5 additions & 20 deletions Sources/WordPressData/Swift/Post.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,6 @@ public class Post: AbstractPost {

// MARK: - Categories

/// Returns categories as a comma-separated list
///
@objc public func categoriesText() -> String {

guard let allStrings = categories?.map({ return $0.categoryName as String }) else {
return ""
}

let orderedStrings = allStrings.sorted { (categoryName1, categoryName2) -> Bool in
return categoryName1.localizedCaseInsensitiveCompare(categoryName2) == .orderedAscending
}

return orderedStrings.joined(separator: ", ")
}

/// Set the categories for a post
///
/// - Parameter categoryNames: a `NSArray` with the names of the categories for this post. If
Expand Down Expand Up @@ -119,7 +104,7 @@ public class Post: AbstractPost {
let isKeyringEntryDisabled = disabledPublicizeConnections?[keyringID]?[Constants.publicizeValueKey] == Constants.publicizeDisabledValue

// try to check in case there's an entry for the PublicizeConnection that's keyed by the connectionID.
guard let connections = blog.connections as? Set<PublicizeConnection>,
guard let connections = blog.connections,
let connection = connections.first(where: { $0.keyringConnectionID == keyringID }),
let existingValue = disabledPublicizeConnections?[connection.connectionID]?[Constants.publicizeValueKey] else {
// fall back to keyringID if there is no such entry with the connectionID.
Expand All @@ -130,10 +115,10 @@ public class Post: AbstractPost {
return isConnectionEntryDisabled || isKeyringEntryDisabled
}

@objc public func enablePublicizeConnectionWithKeyringID(_ keyringID: NSNumber) {
public func enablePublicizeConnectionWithKeyringID(_ keyringID: NSNumber) {
// if there's another entry keyed by connectionID references to the same connection,
// we need to make sure that the values are kept in sync.
if let connections = blog.connections as? Set<PublicizeConnection>,
if let connections = blog.connections,
let connection = connections.first(where: { $0.keyringConnectionID == keyringID }),
let _ = disabledPublicizeConnections?[connection.connectionID] {
enablePublicizeConnection(keyedBy: connection.connectionID)
Expand All @@ -142,10 +127,10 @@ public class Post: AbstractPost {
enablePublicizeConnection(keyedBy: keyringID)
}

@objc public func disablePublicizeConnectionWithKeyringID(_ keyringID: NSNumber) {
public func disablePublicizeConnectionWithKeyringID(_ keyringID: NSNumber) {
// if there's another entry keyed by connectionID references to the same connection,
// we need to make sure that the values are kept in sync.
if let connections = blog.connections as? Set<PublicizeConnection>,
if let connections = blog.connections,
let connectionID = connections.first(where: { $0.keyringConnectionID == keyringID })?.connectionID,
let _ = disabledPublicizeConnections?[connectionID] {
disablePublicizeConnection(keyedBy: connectionID)
Expand Down
4 changes: 2 additions & 2 deletions Sources/WordPressData/Swift/PostHelper+JetpackSocial.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ extension PostHelper {
// the connectionID, and return its keyringID.
let entryConnectionID = Int(key.removingPrefix(SkipPrefix.connection.rawValue))

guard let connections = post.blog.connections as? Set<PublicizeConnection>,
guard let connections = post.blog.connections,
let connectionID = entryConnectionID,
let connection = connections.first(where: { $0.connectionID.intValue == connectionID }) else {
/// Otherwise, fall back to the connectionID extracted from the metadata key.
Expand Down Expand Up @@ -94,7 +94,7 @@ extension PostHelper {
// Try to add a key with the new format ONLY if the metadata hasn't been synced to the remote.
let metadataKeyValue: String = {
guard entry[Keys.publicizeIdKey] == nil,
let connections = post.blog.connections as? Set<PublicizeConnection>,
let connections = post.blog.connections,
let connection = connections.first(where: { $0.keyringConnectionID == keyringID }) else {
// Fall back to the old keyring format.
return "\(SkipPrefix.keyring.rawValue)\(keyringID)"
Expand Down

This file was deleted.

18 changes: 0 additions & 18 deletions Tests/KeystoneTests/Tests/Models/PostTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,6 @@ class PostTests: CoreDataTestCase {
return category
}

func testThatNoCategoriesReturnEmptyStringWhenCallingCategoriesText() {
let post = newTestPost()
let categoriesText = post.categoriesText()

XCTAssertEqual(categoriesText, "")
}

func testThatSomeCategoriesReturnAListWhenCallingCategoriesText() {

let post = newTestPost()

post.categories = [newTestPostCategory("1"), newTestPostCategory("2"), newTestPostCategory("3")]

let categoriesText = post.categoriesText()

XCTAssertEqual(categoriesText, "1, 2, 3")
}

func testSetCategoriesFromNamesWithTwoCategories() {
let blog = newTestBlog()
let post = newTestPost()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class SharingServiceTests: CoreDataTestCase {
}

// Then
let connections = try XCTUnwrap(blog.connections as? Set<PublicizeConnection>)
let connections = try XCTUnwrap(blog.connections)

// the one with ID `1002` should be skipped since it's an unshared private connection from another user.
XCTAssertEqual(connections.count, 2)
Expand Down
2 changes: 0 additions & 2 deletions WordPress/Classes/System/WordPress-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@

#import "NSObject+Helpers.h"

#import "PageSettingsViewController.h"
#import "PostCategoryService.h"
#import "PostSettingsViewController.h"
#import "PostTagService.h"

#import "ReaderPostService.h"
Expand Down
4 changes: 0 additions & 4 deletions WordPress/Classes/Utility/BuildInformation/FeatureFlag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public enum FeatureFlag: Int, CaseIterable {
case pluginManagementOverhaul
case nativeJetpackConnection
case newsletterSubscribers
case postSettingsV2

/// Returns a boolean indicating if the feature is enabled.
///
Expand Down Expand Up @@ -83,8 +82,6 @@ public enum FeatureFlag: Int, CaseIterable {
return BuildConfiguration.current == .debug
case .newsletterSubscribers:
return true
case .postSettingsV2:
return false
}
}

Expand Down Expand Up @@ -128,7 +125,6 @@ extension FeatureFlag {
case .readerGutenbergCommentComposer: "Gutenberg Comment Composer"
case .nativeJetpackConnection: "Native Jetpack Connection"
case .newsletterSubscribers: "Newsletter Subscribers"
case .postSettingsV2: "Post Settings V2"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ extension WPStyleGuide {
///
/// - Returns: A template UIImage that can be tinted by a UIImageView's tintColor property.
///
@objc public class func iconForService(_ service: NSString) -> UIImage {
public class func iconForService(_ service: NSString) -> UIImage {
let name = service.lowercased.replacingOccurrences(of: "_", with: "-")
var iconName: String

Expand All @@ -68,7 +68,7 @@ extension WPStyleGuide {
return image!.withRenderingMode(.alwaysTemplate)
}

@objc public class func socialIcon(for service: NSString) -> UIImage {
public class func socialIcon(for service: NSString) -> UIImage {
UIImage(named: "icon-\(service)") ?? iconForService(service)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import AutomatticTracks
import Combine
import ImagePlayground

class GutenbergViewController: UIViewController, PostEditor, FeaturedImageDelegate, PublishingEditor {
class GutenbergViewController: UIViewController, PostEditor, PublishingEditor {
let errorDomain: String = "GutenbergViewController.errorDomain"

enum RequestHTMLReason {
Expand Down

This file was deleted.

34 changes: 0 additions & 34 deletions WordPress/Classes/ViewRelated/Pages/PageSettingsViewController.m

This file was deleted.

19 changes: 1 addition & 18 deletions WordPress/Classes/ViewRelated/Post/PostEditor+MoreOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ extension PostEditor {

@MainActor
func displayPostSettings() {
guard FeatureFlag.postSettingsV2.enabled else {
return showDeprecatedPostSettings()
}
// Use the new SwiftUI-based Post Settings
let originalFeaturedImageID = post.featuredImage?.mediaID
let viewModel = PostSettingsViewModel(post: post)
Expand All @@ -27,25 +24,11 @@ extension PostEditor {

self?.navigationController?.dismiss(animated: true)
}
let postSettingsVC = NewPostSettingsViewController(viewModel: viewModel)
let postSettingsVC = PostSettingsViewController(viewModel: viewModel)
let navigation = UINavigationController(rootViewController: postSettingsVC)
self.navigationController?.present(navigation, animated: true)
}

private func showDeprecatedPostSettings() {
let viewController = PostSettingsViewController.make(for: post)
viewController.featuredImageDelegate = self as? FeaturedImageDelegate
let doneButton = UIBarButtonItem(systemItem: .done, primaryAction: .init(handler: { [weak self] _ in
self?.editorContentWasUpdated()
self?.navigationController?.dismiss(animated: true)
}))
doneButton.accessibilityIdentifier = "close"
viewController.navigationItem.rightBarButtonItem = doneButton

let navigation = UINavigationController(rootViewController: viewController)
self.navigationController?.present(navigation, animated: true)
}

private func savePostBeforePreview(completion: @escaping ((String?, Error?) -> Void)) {
guard !post.changes.isEmpty || post.original().isNewDraft else {
completion(nil, nil)
Expand Down
Loading