-
Notifications
You must be signed in to change notification settings - Fork 1.1k
5245-Implement WordPress.com Rest API Using NSURLSession on MediaServiceRemoteRest #5327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
5245-Implement WordPress.com Rest API Using NSURLSession on MediaServiceRemoteRest #5327
Conversation
…on based classes.
…using_NSURLSession
…elation and progress report.
…ike NSURLSession doesn't use the same variable/pointer but only the same name.
…using_NSURLSession # Conflicts: # WordPress/Classes/Models/Blog.m # WordPress/Classes/Services/MediaService.m
WordPress/Classes/Models/Blog.h
Outdated
| @return a WordPressComRestApi object if available | ||
| */ | ||
| - (WordPressComRestApi *)comRestApi; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with WPAccount, I'd call this wordPressComRestApi. Also, make sure to mark it _Nullabe once #5325 is merged.
…using_NSURLSession
|
@koke ready for another look. |
|
I like the changes. Can you fix the merge conflicts before I do a final test? |
…using_NSURLSession # Conflicts: # WordPress/WordPress.xcodeproj/project.pbxproj
|
@koke ready for another round of review. |
…using_NSURLSession # Conflicts: # WordPress/Classes/ViewRelated/Me/GravatarPickerViewController.swift # WordPress/Classes/ViewRelated/Me/MeViewController.swift
| */ | ||
| @interface WPUserAgent : NSObject | ||
|
|
||
| + (instancetype)sharedInstance; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since WPUserAgent doesn't hold any state, why do you need a shared instance? Can't you just instantiate a new one when needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, I removed this out and just use a simple instance.
| userInfo[NSLocalizedDescriptionKey] = errorMessage; | ||
| newError = [[NSError alloc] initWithDomain:WordPressComApiErrorDomain code:errorCode userInfo:userInfo]; | ||
| } else if ([error.domain isEqualToString:WordPressComRestApiErrorDomain]) { | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to do anything
|
Looks good, |
Refs #5245
This is the first step to implementing our Network layer using NSURLSession stack.
In this PR I implemented a first version of the WP.com REST API object using the AFNetworking class that use NSURLSession.
One of the main design decisions was to hide away the implementations details on how the Network layer is implemented in a way that we can later switch to another solution if we want to.
This PR only changed the MediaServiceRest to use the new API object other PRs will follow that will change the other services one by one.
To test:
Needs review: @koke