Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2024e63
Use `WordPressComRESTAPIInterfacing` in `ActivityServiceRemote`
mokagio Apr 4, 2024
68b7e1b
Use `WordPressComRESTAPIInterfacing` in `AutomatedTransferService`
mokagio Apr 4, 2024
3acacde
Use `WordPressComRESTAPIInterfacing` in `BlogJetpackSettingsServiceRe…
mokagio Apr 4, 2024
00ea99b
Use `WordPressComRESTAPIInterfacing` in `DashboardServiceRemote`
mokagio Apr 4, 2024
5686b20
Use `WordPressComRESTAPIInterfacing` in `AtomicAuthenticationServiceR…
mokagio Apr 4, 2024
fc01a5b
Use `WordPressComRESTAPIInterfacing` in `BloggingPromptsServiceRemote`
mokagio Apr 4, 2024
a2cbce0
Use `WordPressComRESTAPIInterfacing` in `EditorServiceRemote`
mokagio Apr 4, 2024
62628a0
Use `WordPressComRESTAPIInterfacing` in `FeatureFlagRemote`
mokagio Apr 4, 2024
2873779
Use `WordPressComRESTAPIInterfacing` in `HomepageSettingsServiceRemote`
mokagio Apr 4, 2024
8d7b816
Use `WordPressComRESTAPIInterfacing` in `JetpackBackupServiceRemote`
mokagio Apr 4, 2024
1872f2f
Use `WordPressComRESTAPIInterfacing` in `JetpackCapabilitiesServiceRe…
mokagio Apr 4, 2024
d9c58df
Use `WordPressComRESTAPIInterfacing` in `JetpackScanServiceRemote`
mokagio Apr 4, 2024
ffe285d
Use `WordPressComRESTAPIInterfacing` in `JetpackServiceRemote`
mokagio Apr 4, 2024
9990bc8
Use `WordPressComRESTAPIInterfacing` in `JetpackProxyServiceRemote`
mokagio Apr 4, 2024
6363aa0
Use `WordPressComRESTAPIInterfacing` in `NotificationSettingsServiceR…
mokagio Apr 4, 2024
6e93cbd
Use `WordPressComRESTAPIInterfacing` in `NotificationSyncServiceRemote`
mokagio Apr 4, 2024
8c49c9f
Use `WordPressComRESTAPIInterfacing` in `PeopleServiceRemote`
mokagio Apr 4, 2024
0d7b95c
Use `WordPressComRESTAPIInterfacing` in `PlanServiceRemote_ApiVersion…
mokagio Apr 4, 2024
a5cb669
Use `WordPressComRESTAPIInterfacing` in `PlanServiceRemote`
mokagio Apr 4, 2024
19f086d
Use `WordPressComRESTAPIInterfacing` in `PluginServiceRemote`
mokagio Apr 4, 2024
ea2d327
Use `WordPressComRESTAPIInterfacing` in `PostServiceRemoteREST+Revisi…
mokagio Apr 4, 2024
bf66e02
Use `WordPressComRESTAPIInterfacing` in `ProductServiceRemote`
mokagio Apr 4, 2024
e812c17
Use `WordPressComRESTAPIInterfacing` in `PushAuthenticationServiceRem…
mokagio Apr 4, 2024
05efbae
Use `WordPressComRESTAPIInterfacing` in `QRLoginServiceRemote`
mokagio Apr 4, 2024
42326b3
Use `WordPressComRESTAPIInterfacing` in `ReaderPostServiceRemote`
mokagio Apr 4, 2024
ce3627a
Use `WordPressComRESTAPIInterfacing` in `ReaderSiteSearchServiceRemote`
mokagio Apr 4, 2024
3790cb7
Use `WordPressComRESTAPIInterfacing` in `ReaderTopicServiceRemote`
mokagio Apr 4, 2024
de8e0e2
Use `WordPressComRESTAPIInterfacing` in `SharingServiceRemote`
mokagio Apr 4, 2024
b6f7d63
Use `WordPressComRESTAPIInterfacing` in `SiteManagementServiceRemote`
mokagio Apr 4, 2024
2c1aea3
Use `WordPressComRESTAPIInterfacing` in `StatsServiceRemoteV2`
mokagio Apr 4, 2024
75451ba
Use `WordPressComRESTAPIInterfacing` in `TimeZoneServiceRemote`
mokagio Apr 4, 2024
8f1196b
Use `WordPressComRESTAPIInterfacing` in `TransactionsServiceRemote`
mokagio Apr 4, 2024
0285a53
Use `WordPressComRESTAPIInterfacing` in `AtomicSiteServiceRemote`
mokagio Apr 4, 2024
852e042
Use `WordPressComRESTAPIInterfacing` in `WordPressComServiceRemote`
mokagio Apr 4, 2024
cba707d
Use `WordPressComRESTAPIInterfacing` in `RemoteConfigRemote`
mokagio Apr 4, 2024
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
15 changes: 8 additions & 7 deletions Sources/WordPressKit/Services/JetpackServiceRemote.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ public class JetpackServiceRemote: ServiceRemoteWordPressComREST {
failure: @escaping (Error?) -> Void) {
let path = self.path(forEndpoint: "connect/site-info", withVersion: ._1_0)
let parameters = ["url": url.absoluteString as AnyObject]
wordPressComRestApi.GET(path,
wordPressComRESTAPI.get(path,
parameters: parameters,
success: { [weak self] (response: AnyObject, _: HTTPURLResponse?) in
success: { [weak self] response, _ in
do {
let hasJetpack = try self?.hasJetpackMapping(object: response)
success(hasJetpack ?? false)
} catch {
failure(error)
}
}) { (error: NSError, _: HTTPURLResponse?) in
}) { error, _ in
failure(error)
}
}
Expand All @@ -74,16 +74,17 @@ public class JetpackServiceRemote: ServiceRemoteWordPressComREST {
let parameters = ["user": username,
"password": password]

wordPressComRestApi.POST(requestUrl,
wordPressComRESTAPI.post(requestUrl,
parameters: parameters as [String: AnyObject],
success: { (response: AnyObject, _: HTTPURLResponse?) in
success: { response, _ in
if let response = response as? [String: Bool],
let success = response[Constants.status] {
completion(success, nil)
} else {
completion(false, JetpackInstallError(type: .installResponseError))
}
}) { (error: NSError, _: HTTPURLResponse?) in
}) { error, _ in
let error = error as NSError
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

let key = error.userInfo[WordPressComRestApi.ErrorKeyErrorCode] as? String
let jetpackError = JetpackInstallError(title: error.localizedDescription,
code: error.code,
Expand All @@ -99,7 +100,7 @@ public class JetpackServiceRemote: ServiceRemoteWordPressComREST {
}

private extension JetpackServiceRemote {
func hasJetpackMapping(object: AnyObject) throws -> Bool {
func hasJetpackMapping(object: Any) throws -> Bool {
guard let response = object as? [String: AnyObject],
let hasJetpack = response[Constants.hasJetpack] as? NSNumber else {
throw ResponseError.decodingFailed
Expand Down