From ad13092b64b22b9f3577cc949b3a5fb9f04a38d8 Mon Sep 17 00:00:00 2001 From: Yael Rubinstein Date: Thu, 17 Oct 2019 11:24:58 -0700 Subject: [PATCH 1/5] Added signup_flow_name attribute to account creation with email --- WordPressKit/WordPressComServiceRemote.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/WordPressKit/WordPressComServiceRemote.m b/WordPressKit/WordPressComServiceRemote.m index 5d77127f..3ad5cc60 100644 --- a/WordPressKit/WordPressComServiceRemote.m +++ b/WordPressKit/WordPressComServiceRemote.m @@ -55,7 +55,8 @@ - (void)createWPComAccountWithEmail:(NSString *)email @"password": password, @"validate": @(validate), @"client_id": clientID, - @"client_secret": clientSecret + @"client_secret": clientSecret, + @"signup_flow_name": @"mobile-ios" }; NSString *requestUrl = [self pathForEndpoint:@"users/new" From c67da35d2bb75f62cfeeb89fdbce57117588f57c Mon Sep 17 00:00:00 2001 From: Yael Rubinstein Date: Thu, 17 Oct 2019 16:53:04 -0700 Subject: [PATCH 2/5] Now adding the param in the right place --- WordPressKit/AccountServiceRemoteREST.m | 3 ++- WordPressKit/WordPressComServiceRemote.m | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/WordPressKit/AccountServiceRemoteREST.m b/WordPressKit/AccountServiceRemoteREST.m index 795bd936..09fa4ab4 100644 --- a/WordPressKit/AccountServiceRemoteREST.m +++ b/WordPressKit/AccountServiceRemoteREST.m @@ -240,7 +240,8 @@ - (void)requestWPComMagicLinkForEmail:(NSString *)email NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:@{ @"email": email, @"client_id": clientID, - @"client_secret": clientSecret + @"client_secret": clientSecret, + @"signup_flow_name": @"mobile-ios" }]; if (![@"wordpress" isEqualToString:scheme]) { [params setObject:scheme forKey:@"scheme"]; diff --git a/WordPressKit/WordPressComServiceRemote.m b/WordPressKit/WordPressComServiceRemote.m index 3ad5cc60..5d77127f 100644 --- a/WordPressKit/WordPressComServiceRemote.m +++ b/WordPressKit/WordPressComServiceRemote.m @@ -55,8 +55,7 @@ - (void)createWPComAccountWithEmail:(NSString *)email @"password": password, @"validate": @(validate), @"client_id": clientID, - @"client_secret": clientSecret, - @"signup_flow_name": @"mobile-ios" + @"client_secret": clientSecret }; NSString *requestUrl = [self pathForEndpoint:@"users/new" From 98f546df688cd117803852fdaf85fef354331f30 Mon Sep 17 00:00:00 2001 From: Yael Rubinstein Date: Fri, 18 Oct 2019 12:00:36 -0700 Subject: [PATCH 3/5] Adding sign_up_flow as an extra param --- WordPressKit/AccountServiceRemoteREST.m | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/WordPressKit/AccountServiceRemoteREST.m b/WordPressKit/AccountServiceRemoteREST.m index 09fa4ab4..e9a042e4 100644 --- a/WordPressKit/AccountServiceRemoteREST.m +++ b/WordPressKit/AccountServiceRemoteREST.m @@ -202,6 +202,7 @@ - (void)requestWPComAuthLinkForEmail:(NSString *)email path:path clientID:clientID clientSecret:clientSecret + extraParams: nil wpcomScheme:scheme success:success failure:failure]; @@ -217,11 +218,14 @@ - (void)requestWPComSignupLinkForEmail:(NSString *)email NSString *path = [self pathForEndpoint:@"auth/send-signup-email" withVersion:ServiceRemoteWordPressComRESTApiVersion_1_1]; - + + NSDictionary *signupFlowParam = @{@"signup_flow_name": @"mobile-ios"}; + [self requestWPComMagicLinkForEmail:email path:path clientID:clientID clientSecret:clientSecret + extraParams:signupFlowParam wpcomScheme:scheme success:success failure:failure]; @@ -231,6 +235,7 @@ - (void)requestWPComMagicLinkForEmail:(NSString *)email path:(NSString *)path clientID:(NSString *)clientID clientSecret:(NSString *)clientSecret + extraParams:(nullable NSDictionary *)extraParams wpcomScheme:(NSString *)scheme success:(void (^)(void))success failure:(void (^)(NSError *error))failure @@ -241,11 +246,15 @@ - (void)requestWPComMagicLinkForEmail:(NSString *)email @"email": email, @"client_id": clientID, @"client_secret": clientSecret, - @"signup_flow_name": @"mobile-ios" - }]; + }]; + if (![@"wordpress" isEqualToString:scheme]) { [params setObject:scheme forKey:@"scheme"]; } + + if (extraParams != nil) { + [params addEntriesFromDictionary:extraParams]; + } [self.wordPressComRestApi POST:path parameters:[NSDictionary dictionaryWithDictionary:params] From d827634da40a78f6633262850d6dde9e8e311c94 Mon Sep 17 00:00:00 2001 From: Yael Rubinstein Date: Fri, 18 Oct 2019 12:05:31 -0700 Subject: [PATCH 4/5] remove comma --- WordPressKit/AccountServiceRemoteREST.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPressKit/AccountServiceRemoteREST.m b/WordPressKit/AccountServiceRemoteREST.m index e9a042e4..6670ff8f 100644 --- a/WordPressKit/AccountServiceRemoteREST.m +++ b/WordPressKit/AccountServiceRemoteREST.m @@ -245,7 +245,7 @@ - (void)requestWPComMagicLinkForEmail:(NSString *)email NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:@{ @"email": email, @"client_id": clientID, - @"client_secret": clientSecret, + @"client_secret": clientSecret }]; if (![@"wordpress" isEqualToString:scheme]) { From 910f9b131038fe79a006a47fe4db3fd7db9550d1 Mon Sep 17 00:00:00 2001 From: Yael Rubinstein Date: Mon, 21 Oct 2019 13:49:44 -0700 Subject: [PATCH 5/5] bump version --- WordPressKit.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPressKit.podspec b/WordPressKit.podspec index acd9805c..ef17bb88 100644 --- a/WordPressKit.podspec +++ b/WordPressKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "WordPressKit" - s.version = "4.5.1" + s.version = "4.5.2-beta.1" s.summary = "WordPressKit offers a clean and simple WordPress.com and WordPress.org API." s.description = <<-DESC