Skip to content

Add remaining public APIs for Keystone #24406

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

Merged
merged 1 commit into from
Apr 7, 2025
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
7 changes: 0 additions & 7 deletions WordPress/Classes/Categories/NSMutableArray+NullableObjects.h

This file was deleted.

11 changes: 0 additions & 11 deletions WordPress/Classes/Categories/NSMutableArray+NullableObjects.m

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ extension WPStyleGuide {
viewController.navigationItem.compactScrollEdgeAppearance = standardAppearance
}

@objc class func configureTabBar(_ tabBar: UITabBar) {
@objc public class func configureTabBar(_ tabBar: UITabBar) {
tabBar.tintColor = UIAppColor.tint
tabBar.unselectedItemTintColor = UIColor(named: "TabUnselected")
}
Expand Down
4 changes: 2 additions & 2 deletions WordPress/Classes/Extensions/Comment+Interface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extension Comment {
/// readable, and you should use the *descriptionForSectionIdentifier* method
/// as well!
///
@objc func relativeDateSectionIdentifier() -> String? {
@objc public func relativeDateSectionIdentifier() -> String? {
guard let dateCreated else {
return nil
}
Expand Down Expand Up @@ -46,7 +46,7 @@ extension Comment {

/// Translates a relative date section identifier into a human-readable string.
///
@objc static func descriptionForSectionIdentifier(_ identifier: String) -> String {
@objc public static func descriptionForSectionIdentifier(_ identifier: String) -> String {
guard let section = Sections(rawValue: identifier) else {
return String()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import CoreData
extension NSFetchedResultsController {
/// Returns whether an indexPath represents the last row in it's section, or not
///
@objc func isLastIndexPathInSection(_ indexPath: IndexPath) -> Bool {
@objc public func isLastIndexPathInSection(_ indexPath: IndexPath) -> Bool {
guard let sections else {
return false
}
Expand All @@ -19,7 +19,7 @@ extension NSFetchedResultsController {
/// Returns the NSManagedObject at the specified indexPath, if the Row + Section are still valid.
/// Otherwise, null will be returned.
///
@objc func managedObject(atUnsafe indexPath: IndexPath) -> NSManagedObject? {
@objc public func managedObject(atUnsafe indexPath: IndexPath) -> NSManagedObject? {
guard let sections else {
return nil
}
Expand All @@ -37,7 +37,7 @@ extension NSFetchedResultsController {

/// Returns whether an NSFetchedResultsController is empty
///
@objc func isEmpty() -> Bool {
@objc public func isEmpty() -> Bool {
// We can not return fetchedObjects.count == 0 because of a Swift compiler error:
// Extension of a generic Objective-C class cannot access the class's generic parameters at runtime
return sections?.first(where: { $0.numberOfObjects > 0 }) == nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ extension Notification {
/// Returns a Section Identifier that can be sorted. Note that this string is not human readable, and
/// you should use the *descriptionForSectionIdentifier* method as well!.
///
@objc func sectionIdentifier() -> String {
@objc public func sectionIdentifier() -> String {
// Normalize Dates: Time must not be considered. Just the raw dates
let fromDate = timestampAsDate.normalizedDate()
let toDate = Date().normalizedDate()
Expand Down Expand Up @@ -37,7 +37,7 @@ extension Notification {

/// Translates a Section Identifier into a Human-Readable String.
///
@objc class func descriptionForSectionIdentifier(_ identifier: String) -> String {
@objc public class func descriptionForSectionIdentifier(_ identifier: String) -> String {
guard let section = Sections(rawValue: identifier) else {
return String()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import UIKit

extension UIBarButtonItem {
/// Returns a bar button item with a spinner activity indicator.
@objc class var activityIndicator: UIBarButtonItem {
@objc public class var activityIndicator: UIBarButtonItem {
let activityIndicator = UIActivityIndicatorView(style: .medium)
activityIndicator.sizeToFit()
activityIndicator.startAnimating()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import UIKit

extension UINavigationController {
@objc func scrollContentToTopAnimated(_ animated: Bool) {
@objc public func scrollContentToTopAnimated(_ animated: Bool) {
guard viewControllers.count == 1 else { return }

if let topViewController = topViewController as? ScrollableViewController {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import UIKit

@objc
class MigrationSuccessCell: UITableViewCell {
public class MigrationSuccessCell: UITableViewCell {

var onTap: (() -> Void)?
var cardView: MigrationSuccessCardView?

override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setup()
}

required init?(coder: NSCoder) {
public required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand All @@ -25,12 +25,12 @@ class MigrationSuccessCell: UITableViewCell {
cardView = view
}

@objc func configureForSidebarMode() {
@objc public func configureForSidebarMode() {
cardView?.backgroundColor = .clear
}

@objc(configureWithViewController:)
func configure(with viewController: UIViewController) {
public func configure(with viewController: UIViewController) {
self.onTap = { [weak viewController] in
guard let viewController else {
return
Expand All @@ -40,17 +40,3 @@ class MigrationSuccessCell: UITableViewCell {
}
}
}

extension BlogDetailsViewController {

@objc func migrationSuccessSectionViewModel() -> BlogDetailsSection {
let row = BlogDetailsRow()
row.callback = {}

let section = BlogDetailsSection(title: nil,
rows: [row],
footerTitle: nil,
category: .migrationSuccess)
return section
}
}
2 changes: 1 addition & 1 deletion WordPress/Classes/Models/Blog/Blog+Editor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ extension Blog {
return mobileEditor ?? GutenbergSettings().getDefaultEditor(for: self)
}

@objc var isGutenbergEnabled: Bool {
@objc public var isGutenbergEnabled: Bool {
return editor == .gutenberg
}
}
4 changes: 2 additions & 2 deletions WordPress/Classes/Models/PublicizeService+Lookup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension PublicizeService {
}

@objc(lookupPublicizeServiceNamed:inContext:)
static func objc_lookupPublicizeServiceNamed(_ name: String, in context: NSManagedObjectContext) -> PublicizeService? {
public static func objc_lookupPublicizeServiceNamed(_ name: String, in context: NSManagedObjectContext) -> PublicizeService? {
try? lookupPublicizeServiceNamed(name, in: context)
}

Expand All @@ -21,7 +21,7 @@ extension PublicizeService {
/// - Returns: An array of `PublicizeService`. The array is empty if no objects are cached.
///
@objc(allPublicizeServicesInContext:error:)
static func allPublicizeServices(in context: NSManagedObjectContext) throws -> [PublicizeService] {
public static func allPublicizeServices(in context: NSManagedObjectContext) throws -> [PublicizeService] {
let request = NSFetchRequest<PublicizeService>(entityName: PublicizeService.classNameWithoutNamespaces())
let sortDescriptor = NSSortDescriptor(key: "order", ascending: true)
request.sortDescriptors = [sortDescriptor]
Expand Down
2 changes: 1 addition & 1 deletion WordPress/Classes/Services/AccountService+Swift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ extension AccountService {
}
}

@objc func setupAppExtensions(defaultAccount: WPAccount) {
@objc public func setupAppExtensions(defaultAccount: WPAccount) {
let shareExtensionService = ShareExtensionService()
let notificationSupportService = NotificationSupportService()

Expand Down
2 changes: 1 addition & 1 deletion WordPress/Classes/Services/BlogService+Domains.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension BlogService {
/// Convenience method to be able to refresh the blogs from ObjC.
///
@objc
func refreshDomains(for blog: Blog, success: (() -> Void)?, failure: ((Error) -> Void)?) {
public func refreshDomains(for blog: Blog, success: (() -> Void)?, failure: ((Error) -> Void)?) {
guard let account = blog.account else {
failure?(BlogServiceDomainError.noAccountForSpecifiedBlog(blog: blog))
return
Expand Down
2 changes: 1 addition & 1 deletion WordPress/Classes/Stores/StatsWidgetsStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ private extension StatsWidgetsStore {
}

extension StatsViewController {
@objc func initializeStatsWidgetsIfNeeded() {
@objc public func initializeStatsWidgetsIfNeeded() {
StoreContainer.shared.statsWidgets.initializeStatsWidgetsIfNeeded()
}
}
6 changes: 3 additions & 3 deletions WordPress/Classes/System/Root View/ReaderPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import WordPressData
import WordPressUI

/// Manages top-level Reader navigation.
final class ReaderPresenter: NSObject, SplitViewDisplayable {
public final class ReaderPresenter: NSObject, SplitViewDisplayable {
private let sidebarViewModel = ReaderSidebarViewModel()

// The view controllers used during split view presentation.
Expand All @@ -23,7 +23,7 @@ final class ReaderPresenter: NSObject, SplitViewDisplayable {

private var selectionObserver: AnyCancellable?

override init() {
public override init() {
secondary = UINavigationController()
sidebar = ReaderSidebarViewController(viewModel: sidebarViewModel)
sidebar.navigationItem.largeTitleDisplayMode = .automatic
Expand All @@ -36,7 +36,7 @@ final class ReaderPresenter: NSObject, SplitViewDisplayable {
}

// TODO: (reader) update to allow seamless transitions between split view and tabs
@objc func prepareForTabBarPresentation() -> UINavigationController {
@objc public func prepareForTabBarPresentation() -> UINavigationController {
guard AccountHelper.isDotcomAvailable() else {
return UINavigationController(rootViewController: ReaderLoggedOutViewController())
}
Expand Down
2 changes: 1 addition & 1 deletion WordPress/Classes/Utility/AccountHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ import Foundation
deleteAccountData()
}

@objc static func deleteAccountData() {
static func deleteAccountData() {
// Delete saved dashboard states
BlogDashboardState.resetAllStates()

Expand Down
1 change: 1 addition & 0 deletions WordPress/Classes/Utility/Analytics/WPAppAnalytics.m
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import WordPressShared;
@import NSObject_SafeExpectations;

#import "WPAppAnalytics.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import Foundation
import BuildSettingsKit

/// - warning: Soft-deprecated. Use `BuildSettings` directly.
@objc class AppConfiguration: NSObject {
@objc static var isJetpack: Bool {
struct AppConfiguration {
static var isJetpack: Bool {
BuildSettings.current.brand == .jetpack
}

@objc static var isWordPress: Bool {
static var isWordPress: Bool {
BuildSettings.current.brand == .wordpress
}
}
8 changes: 4 additions & 4 deletions WordPress/Classes/Utility/Editor/GutenbergSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -215,19 +215,19 @@ class GutenbergSettings {
}

@objc(GutenbergSettings)
class GutenbergSettingsBridge: NSObject {
public class GutenbergSettingsBridge: NSObject {
@objc(setGutenbergEnabled:forBlog:)
static func setGutenbergEnabled(_ isEnabled: Bool, for blog: Blog) {
public static func setGutenbergEnabled(_ isEnabled: Bool, for blog: Blog) {
GutenbergSettings().setGutenbergEnabled(isEnabled, for: blog, source: .viaSiteSettings)
}

@objc(postSettingsToRemoteForBlog:)
static func postSettingsToRemote(for blog: Blog) {
public static func postSettingsToRemote(for blog: Blog) {
GutenbergSettings().postSettingsToRemote(for: blog)
}

@objc(isSimpleWPComSite:)
static func isSimpleWPComSite(_ blog: Blog) -> Bool {
public static func isSimpleWPComSite(_ blog: Blog) -> Bool {
return GutenbergSettings().isSimpleWPComSite(blog)
}
}
Expand Down
Loading