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
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 = "2.1.1-beta.2"
s.version = "3.0.0-beta.1"
s.summary = "WordPressKit offers a clean and simple WordPress.com and WordPress.org API."

s.description = <<-DESC
Expand Down
3 changes: 1 addition & 2 deletions WordPressKit/AccountServiceRemoteREST.m
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,7 @@ - (void)requestWPComMagicLinkForEmail:(NSString *)email
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:@{
@"email": email,
@"client_id": clientID,
@"client_secret": clientSecret,
@"locale": [[WordPressComLanguageDatabase new] deviceLanguageSlug],
@"client_secret": clientSecret
}];
if (![@"wordpress" isEqualToString:scheme]) {
[params setObject:scheme forKey:@"scheme"];
Expand Down
8 changes: 1 addition & 7 deletions WordPressKit/ActivityServiceRemote.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ public class ActivityServiceRemote: ServiceRemoteWordPressComREST {
failure: @escaping (Error) -> Void) {
let endpoint = "sites/\(siteID)/activity"
let path = self.path(forEndpoint: endpoint, withVersion: ._2_0)
let locale = WordPressComLanguageDatabase().deviceLanguage.slug
let pageNumber = (offset / count + 1)
let parameters: [String: AnyObject] = [
"locale": locale as AnyObject,
"number": count as AnyObject,
"page": pageNumber as AnyObject
]
Expand Down Expand Up @@ -64,13 +62,9 @@ public class ActivityServiceRemote: ServiceRemoteWordPressComREST {
failure: @escaping (Error) -> Void) {
let endpoint = "sites/\(siteID)/rewind"
let path = self.path(forEndpoint: endpoint, withVersion: ._2_0)
let locale = WordPressComLanguageDatabase().deviceLanguage.slug
let parameters: [String: AnyObject] = [
"locale": locale as AnyObject
]

wordPressComRestApi.GET(path,
parameters: parameters,
parameters: nil,
success: { response, _ in
guard let rewindStatus = response as? [String: AnyObject] else {
failure(ResponseError.decodingFailure)
Expand Down
4 changes: 1 addition & 3 deletions WordPressKit/PlanServiceRemote.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ public class PlanServiceRemote: ServiceRemoteWordPressComREST {
public func getWpcomPlans(_ success: @escaping (AvailablePlans) -> Void, failure: @escaping (Error) -> Void) {
let endpoint = "plans/mobile"
let path = self.path(forEndpoint: endpoint, withVersion: ._2_0)
let locale = WordPressComLanguageDatabase().deviceLanguage.slug
let parameters = ["locale": locale]

wordPressComRestApi.GET(path,
parameters: parameters as [String : AnyObject]?,
parameters: nil,
success: {
response, _ in

Expand Down
5 changes: 2 additions & 3 deletions WordPressKit/PlanServiceRemote_ApiVersion1_3.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ import CocoaLumberjack
failure: @escaping (Error) -> Void) {
let endpoint = "sites/\(siteID)/plans"
let path = self.path(forEndpoint: endpoint, withVersion: ._1_3)
let locale = WordPressComLanguageDatabase().deviceLanguage.slug
let parameters = ["locale": locale]

wordPressComRestApi.GET(
path,
parameters: parameters as [String : AnyObject]?,
parameters: nil,
success: {
response, _ in
do {
Expand Down
2 changes: 0 additions & 2 deletions WordPressKit/ReaderSiteSearchServiceRemote.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ public class ReaderSiteSearchServiceRemote: ServiceRemoteWordPressComREST {
failure: @escaping (Error) -> Void) {
let endpoint = "read/feed"
let path = self.path(forEndpoint: endpoint, withVersion: ._1_1)
let locale = WordPressComLanguageDatabase().deviceLanguage.slug
let parameters: [String: AnyObject] = [
"locale": locale as AnyObject,
"number": count as AnyObject,
"offset": offset as AnyObject,
"exclude_followed": false as AnyObject,
Expand Down
4 changes: 1 addition & 3 deletions WordPressKit/TimeZoneServiceRemote.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ public class TimeZoneServiceRemote: ServiceRemoteWordPressComREST {
public func getTimezones(success: @escaping (([TimeZoneGroup]) -> Void), failure: @escaping ((Error) -> Void)) {
let endpoint = "timezones"
let path = self.path(forEndpoint: endpoint, withVersion: ._2_0)
let locale = WordPressComLanguageDatabase().deviceLanguage.slug
let parameters: [String: AnyObject] = ["_locale": locale as AnyObject]
wordPressComRestApi.GET(path, parameters: parameters, success: { (response, _) in
wordPressComRestApi.GET(path, parameters: nil, success: { (response, _) in
do {
let groups = try self.timezoneGroupsFromResponse(response)
success(groups)
Expand Down
3 changes: 0 additions & 3 deletions WordPressKit/WordPressComServiceRemote.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@ typedef void(^WordPressComServiceFailureBlock)(NSError *error);
* @param email The email to use for the new account. Cannot be nil.
* @param username The username of the new account. Cannot be nil.
* @param password The password of the new account. Cannot be nil.
* @param locale The locale for the new account. Cannot be nil.
* @param success The block to execute on success. Can be nil.
* @param failure The block to execute on failure. Can be nil.
*/
- (void)createWPComAccountWithEmail:(NSString *)email
andUsername:(NSString *)username
andPassword:(NSString *)password
andLocale:(NSString *)locale
andClientID:(NSString *)clientID
andClientSecret:(NSString *)clientSecret
success:(WordPressComServiceSuccessBlock)success
Expand All @@ -45,7 +43,6 @@ typedef void(^WordPressComServiceFailureBlock)(NSError *error);
@param failure failure block
*/
- (void)createWPComAccountWithGoogle:(NSString *)token
andLocale:(NSString *)locale
andClientID:(NSString *)clientID
andClientSecret:(NSString *)clientSecret
success:(WordPressComServiceSuccessBlock)success
Expand Down
6 changes: 0 additions & 6 deletions WordPressKit/WordPressComServiceRemote.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ @implementation WordPressComServiceRemote
- (void)createWPComAccountWithEmail:(NSString *)email
andUsername:(NSString *)username
andPassword:(NSString *)password
andLocale:(NSString *)locale
andClientID:(NSString *)clientID
andClientSecret:(NSString *)clientSecret
success:(WordPressComServiceSuccessBlock)success
Expand All @@ -21,7 +20,6 @@ - (void)createWPComAccountWithEmail:(NSString *)email
[self createWPComAccountWithEmail:email
andUsername:username
andPassword:password
andLocale:locale
andClientID:clientID
andClientSecret:clientSecret
validate:NO
Expand All @@ -32,7 +30,6 @@ - (void)createWPComAccountWithEmail:(NSString *)email
- (void)createWPComAccountWithEmail:(NSString *)email
andUsername:(NSString *)username
andPassword:(NSString *)password
andLocale:(NSString *)locale
andClientID:(NSString *)clientID
andClientSecret:(NSString *)clientSecret
validate:(BOOL)validate
Expand All @@ -57,7 +54,6 @@ - (void)createWPComAccountWithEmail:(NSString *)email
@"username": username,
@"password": password,
@"validate": @(validate),
@"locale": locale,
@"client_id": clientID,
@"client_secret": clientSecret
};
Expand All @@ -70,7 +66,6 @@ - (void)createWPComAccountWithEmail:(NSString *)email

// API v1 POST /users/social/new
- (void)createWPComAccountWithGoogle:(NSString *)token
andLocale:(NSString *)locale
andClientID:(NSString *)clientID
andClientSecret:(NSString *)clientSecret
success:(WordPressComServiceSuccessBlock)success
Expand All @@ -89,7 +84,6 @@ - (void)createWPComAccountWithGoogle:(NSString *)token
@"client_id": clientID,
@"client_secret": clientSecret,
@"id_token": token,
@"locale": locale,
@"service": @"google",
@"signup_flow_name": @"social",
};
Expand Down
1 change: 0 additions & 1 deletion WordPressKitTests/WordPressComServiceRemoteRestTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class WordPressComServiceRemoteRestTests: XCTestCase {
service.createWPComAccount(withEmail: "fakeEmail",
andUsername: "fakeUsername",
andPassword: "fakePassword",
andLocale: "en",
andClientID: "moo",
andClientSecret: "cow",
success: { (responseObject) in
Expand Down