Skip to content
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 WordPress/Classes/Services/AccountService.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ extern NSNotificationName const WPAccountEmailAndDefaultBlogUpdatedNotification;
@param failure A failure block.
*/
- (void)createOrUpdateAccountWithAuthToken:(NSString *)authToken
success:(void (^)(WPAccount * _Nonnull))success
success:(void (^)(WPAccount * _Nullable))success
failure:(void (^)(NSError * _Nonnull))failure;

- (NSManagedObjectID *)createOrUpdateAccountWithUserDetails:(RemoteUser *)remoteUser authToken:(NSString *)authToken;
Expand Down
2 changes: 1 addition & 1 deletion WordPress/Classes/Services/AccountService.m
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ - (WPAccount *)findDefaultAccountCandidateFromAccounts:(NSArray *)allAccounts
}

- (void)createOrUpdateAccountWithAuthToken:(NSString *)authToken
success:(void (^)(WPAccount * _Nonnull))success
success:(void (^)(WPAccount * _Nullable))success
failure:(void (^)(NSError * _Nonnull))failure
{
WordPressComRestApi *api = [WordPressComRestApi defaultApiWithOAuthToken:authToken userAgent:[WPUserAgent wordPressUserAgent] localeKey:[WordPressComRestApi LocaleKeyDefault]];
Expand Down
4 changes: 4 additions & 0 deletions WordPress/Classes/Services/WordPressComSyncService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class WordPressComSyncService {
func syncWPCom(authToken: String, isJetpackLogin: Bool, onSuccess: @escaping (WPAccount) -> Void, onFailure: @escaping (Error) -> Void) {
let accountService = AccountService(coreDataStack: coreDataStack)
accountService.createOrUpdateAccount(withAuthToken: authToken, success: { account in
guard let account else {
onFailure(URLError(.unknown))
return
}
self.syncOrAssociateBlogs(account: account, isJetpackLogin: isJetpackLogin, onSuccess: onSuccess, onFailure: onFailure)
}, failure: { error in
onFailure(error)
Expand Down