Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.
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
8 changes: 5 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@ version: 2.1

orbs:
# This uses the iOS Orb located at https://github.com/wordpress-mobile/circleci-orbs
ios: wordpress-mobile/ios@0.0.15
ios: wordpress-mobile/ios@0.0.24

workflows:
test_and_validate:
jobs:
- ios/test:
name: Test
xcode-version: "10.2.0"
workspace: WordPressKit.xcworkspace
scheme: WordPressKitTests
device: iPhone X
ios-version: "12.1"
device: iPhone Xs
ios-version: "12.2"
- ios/validate-podspec:
name: Validate Podspec
xcode-version: "10.2.0"
podspec-path: WordPressKit.podspec
update-specs-repo: true
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
source 'https://rubygems.org' do
gem 'cocoapods', '1.5.3'
gem 'cocoapods', '1.6.1'
gem 'cocoapods-repo-update'
gem 'xcpretty'
end
40 changes: 18 additions & 22 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,52 @@ GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.0)
activesupport (4.2.10)
activesupport (4.2.11.1)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
atomos (0.1.3)
claide (1.0.2)
cocoapods (1.5.3)
cocoapods (1.6.1)
activesupport (>= 4.0.2, < 5)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.5.3)
cocoapods-core (= 1.6.1)
cocoapods-deintegrate (>= 1.0.2, < 2.0)
cocoapods-downloader (>= 1.2.0, < 2.0)
cocoapods-downloader (>= 1.2.2, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-stats (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.3.0, < 2.0)
cocoapods-trunk (>= 1.3.1, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (~> 2.0.1)
fourflusher (>= 2.2.0, < 3.0)
gh_inspector (~> 1.0)
molinillo (~> 0.6.5)
molinillo (~> 0.6.6)
nap (~> 1.0)
ruby-macho (~> 1.1)
xcodeproj (>= 1.5.7, < 2.0)
cocoapods-core (1.5.3)
ruby-macho (~> 1.4)
xcodeproj (>= 1.8.1, < 2.0)
cocoapods-core (1.6.1)
activesupport (>= 4.0.2, < 6)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
cocoapods-deintegrate (1.0.2)
cocoapods-deintegrate (1.0.4)
cocoapods-downloader (1.2.2)
cocoapods-plugins (1.0.0)
nap
cocoapods-repo-update (0.0.4)
cocoapods (~> 1.0, >= 1.3.0)
cocoapods-search (1.0.0)
cocoapods-stats (1.0.0)
cocoapods-stats (1.1.0)
cocoapods-trunk (1.3.1)
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.1.0)
colored2 (3.1.2)
concurrent-ruby (1.1.3)
concurrent-ruby (1.1.5)
escape (0.0.4)
fourflusher (2.0.1)
fourflusher (2.2.0)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
i18n (0.9.5)
Expand All @@ -57,27 +57,23 @@ GEM
nanaimo (0.2.6)
nap (1.1.0)
netrc (0.11.0)
rouge (2.0.7)
ruby-macho (1.3.1)
ruby-macho (1.4.0)
thread_safe (0.3.6)
tzinfo (1.2.5)
thread_safe (~> 0.1)
xcodeproj (1.7.0)
xcodeproj (1.8.2)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.2.6)
xcpretty (0.3.0)
rouge (~> 2.0.7)

PLATFORMS
ruby

DEPENDENCIES
cocoapods (= 1.5.3)!
cocoapods (= 1.6.1)!
cocoapods-repo-update!
xcpretty!

BUNDLED WITH
1.17.1
1.17.2
28 changes: 17 additions & 11 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,29 @@ use_frameworks!
platform :ios, '10.0'
plugin 'cocoapods-repo-update'

## WordPress Kit
## =============
##
target 'WordPressKit' do
def wordpresskit_pods
pod 'Alamofire', '~> 4.7.3'
pod 'CocoaLumberjack', '3.4.2'
pod 'WordPressShared', '~> 1.4'
pod 'NSObject-SafeExpectations', '~> 0.0.3'
pod 'wpxmlrpc', '0.8.4'
pod 'UIDeviceIdentifier', '~> 1.1.4'
end

## WordPress Kit
## =============
##
target 'WordPressKit' do
project 'WordPressKit.xcodeproj'
wordpresskit_pods
end

target 'WordPressKitTests' do
inherit! :search_paths
target 'WordPressKitTests' do
project 'WordPressKit.xcodeproj'
wordpresskit_pods

pod 'OHHTTPStubs', '6.1.0'
pod 'OHHTTPStubs/Swift', '6.1.0'
pod 'OCMock', '~> 3.4.2'
pod 'WordPressShared', '~> 1.4'
end
pod 'OHHTTPStubs', '6.1.0'
pod 'OHHTTPStubs/Swift', '6.1.0'
pod 'OCMock', '~> 3.4.2'
pod 'WordPressShared', '~> 1.4'
end
4 changes: 2 additions & 2 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ SPEC CHECKSUMS:
WordPressShared: 63d57a4a07ad9f9a1ee5e8a7162e48fbb5192014
wpxmlrpc: 6ba55c773cfa27083ae4a2173e69b19f46da98e2

PODFILE CHECKSUM: 34d4f957f37c097c360d2863370ce2e5e06511cc
PODFILE CHECKSUM: 2d40a9a3484ab5030d6ddd135b604a0be90271c8

COCOAPODS: 1.5.3
COCOAPODS: 1.6.1
2 changes: 1 addition & 1 deletion WordPressKit.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "WordPressKit"
s.version = "3.2.1"
s.version = "3.2.2"
s.summary = "WordPressKit offers a clean and simple WordPress.com and WordPress.org API."

s.description = <<-DESC
Expand Down
27 changes: 16 additions & 11 deletions WordPressKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1998,7 +1998,7 @@
9368C7721EC5EF1B0092CE8E /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "Automattic Inc.";
TargetAttributes = {
9368C77A1EC5EF1B0092CE8E = {
Expand All @@ -2018,6 +2018,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = 9368C7711EC5EF1B0092CE8E;
Expand Down Expand Up @@ -2308,32 +2309,32 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-WordPressKitTests/Pods-WordPressKitTests-frameworks.sh",
"${PODS_ROOT}/Target Support Files/Pods-WordPressKitTests/Pods-WordPressKitTests-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework",
"${BUILT_PRODUCTS_DIR}/CocoaLumberjack/CocoaLumberjack.framework",
"${BUILT_PRODUCTS_DIR}/FormatterKit/FormatterKit.framework",
"${BUILT_PRODUCTS_DIR}/WordPressShared/WordPressShared.framework",
"${BUILT_PRODUCTS_DIR}/OCMock/OCMock.framework",
"${BUILT_PRODUCTS_DIR}/OHHTTPStubs/OHHTTPStubs.framework",
"${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework",
"${BUILT_PRODUCTS_DIR}/NSObject-SafeExpectations/NSObject_SafeExpectations.framework",
"${BUILT_PRODUCTS_DIR}/UIDeviceIdentifier/UIDeviceIdentifier.framework",
"${BUILT_PRODUCTS_DIR}/WordPressShared/WordPressShared.framework",
"${BUILT_PRODUCTS_DIR}/wpxmlrpc/wpxmlrpc.framework",
"${BUILT_PRODUCTS_DIR}/OCMock/OCMock.framework",
"${BUILT_PRODUCTS_DIR}/OHHTTPStubs/OHHTTPStubs.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Alamofire.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CocoaLumberjack.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FormatterKit.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/WordPressShared.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OCMock.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OHHTTPStubs.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Alamofire.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/NSObject_SafeExpectations.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/UIDeviceIdentifier.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/WordPressShared.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/wpxmlrpc.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OCMock.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OHHTTPStubs.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-WordPressKitTests/Pods-WordPressKitTests-frameworks.sh\"\n";
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-WordPressKitTests/Pods-WordPressKitTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
Expand Down Expand Up @@ -2583,6 +2584,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
Expand Down Expand Up @@ -2644,6 +2646,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
Expand Down Expand Up @@ -2790,6 +2793,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
Expand Down Expand Up @@ -2890,6 +2894,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
4 changes: 2 additions & 2 deletions WordPressKit/BlogJetpackSettingsServiceRemote.swift
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ private extension BlogJetpackSettingsServiceRemote {

public extension BlogJetpackSettingsServiceRemote {

public enum Keys {
enum Keys {

// RemoteBlogJetpackSettings keys
public static let monitorEnabled = "monitor"
Expand All @@ -252,7 +252,7 @@ public extension BlogJetpackSettingsServiceRemote {

}

public enum ModuleOptionKeys {
enum ModuleOptionKeys {

// Whether or not the module is currently active
public static let active = "active"
Expand Down
2 changes: 1 addition & 1 deletion WordPressKit/BlogServiceRemoteREST+Jetpack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public enum JetpackInstallError: String, Error {
}

public extension BlogServiceRemoteREST {
public func installJetpack(url: String,
func installJetpack(url: String,
username: String,
password: String,
completion: @escaping (Bool, JetpackInstallError?) -> Void) {
Expand Down
39 changes: 39 additions & 0 deletions WordPressKit/DomainsServiceRemote.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ public struct DomainSuggestion: Codable {
}
}

/// Allows the construction of a request for domain suggestions.
///
public struct DomainSuggestionRequest: Encodable {
public let query: String
public let segmentID: Int64

public init(query: String, segmentID: Int64) {
self.query = query
self.segmentID = segmentID
}
}

public class DomainsServiceRemote: ServiceRemoteWordPressComREST {
public enum ResponseError: Error {
case decodingFailed
Expand Down Expand Up @@ -156,6 +168,33 @@ public class DomainsServiceRemote: ServiceRemoteWordPressComREST {
}
}

public func getDomainSuggestions(request: DomainSuggestionRequest,
success: @escaping ([DomainSuggestion]) -> Void,
failure: @escaping (Error) -> Void) {
let endPoint = "domains/suggestions"
let servicePath = path(forEndpoint: endPoint, withVersion: ._1_1)
let parameters: [String: AnyObject] = [
"segment_id": request.segmentID as AnyObject,
"query": request.query as AnyObject
]

wordPressComRestApi.GET(servicePath,
parameters: parameters,
success: {
response, _ in
do {
let suggestions = try map(suggestions: response)
success(suggestions)
} catch {
DDLogError("Error parsing domains response (\(error)): \(response)")
failure(error)
}
}, failure: {
error, _ in
failure(error)
})
}

public func getDomainSuggestions(base query: String,
domainSuggestionType: DomainSuggestionType = .onlyWordPressDotCom,
success: @escaping ([DomainSuggestion]) -> Void,
Expand Down
4 changes: 2 additions & 2 deletions WordPressKit/ObjectValidation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Foundation
/// Validate if a class is a valid NSObject and if it's not nil
///
/// - Returns: Bool value
@objc public func wp_isValidObject() -> Bool {
@objc func wp_isValidObject() -> Bool {
return !(self is NSNull)
}
}
Expand All @@ -17,7 +17,7 @@ import Foundation
/// Validate if a class is a valid NSString and if it's not nil
///
/// - Returns: Bool value
@objc public func wp_isValidString() -> Bool {
@objc func wp_isValidString() -> Bool {
return wp_isValidObject() && self != ""
}
}
Loading