Skip to content
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

Added serveruserid parameter in request #171

Merged
merged 2 commits into from
Dec 14, 2017
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 .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode8.2
osx_image: xcode8.3
#xcode_project: OCCommunicationLib/ownCloud iOS library.xcodeproj
#xcode_scheme: ownCloud iOS library
#xcode_sdk: iphonesimulator
Expand Down
4 changes: 2 additions & 2 deletions OCCommunicationLib/OCCommunicationLib/OCCommunication.h
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,8 @@ typedef enum {
* @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
*/
- (void) getUserDisplayNameOfServer:(NSString *)path onCommunication:(OCCommunication *)sharedOCCommunication
success:(void(^)(NSHTTPURLResponse *response, NSString *displayName, NSString *redirectedServer))success
failure:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer))failureRequest;
success:(void(^)(NSHTTPURLResponse *response, NSString *serverUserId, NSString *displayName, NSString *redirectedServer))success
failure:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer))failureRequest ;


///-----------------------------------
Expand Down
7 changes: 5 additions & 2 deletions OCCommunicationLib/OCCommunicationLib/OCCommunication.m
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ - (void) getUserDataOfServer:(NSString *)path onCommunication:(OCCommunication *
///-----------------------------------

- (void) getUserDisplayNameOfServer:(NSString *)path onCommunication:(OCCommunication *)sharedOCCommunication
success:(void(^)(NSHTTPURLResponse *response, NSString *displayName, NSString *redirectedServer))success
success:(void(^)(NSHTTPURLResponse *response, NSString *serverUserId, NSString *displayName, NSString *redirectedServer))success
failure:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer))failureRequest {

OCWebDAVClient *request = [OCWebDAVClient new];
Expand All @@ -664,6 +664,7 @@ - (void) getUserDisplayNameOfServer:(NSString *)path onCommunication:(OCCommunic

NSError *jsonError = nil;
NSString *displayName = @"";
NSString *serverUserId = @"";

NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:responseObject options:kNilOptions error:&jsonError];

Expand All @@ -677,13 +678,15 @@ - (void) getUserDisplayNameOfServer:(NSString *)path onCommunication:(OCCommunic
NSDictionary *userDataDict = [ocsDict objectForKey:k_json_ocs_data];

displayName = [userDataDict objectForKey:k_json_ocs_data_display_name];

serverUserId = [userDataDict objectForKey:k_json_ocs_data_user_id];
}

for(NSString *key in [jsonDict allKeys]) {
NSLog(@"%@",[jsonDict objectForKey:key]);
}

success(response, displayName, request.redirectedServer);
success(response, serverUserId, displayName, request.redirectedServer);

} failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
failureRequest(response,error, request.redirectedServer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#define k_json_ocs @"ocs"
#define k_json_ocs_data @"data"
#define k_json_ocs_data_display_name @"display-name"
#define k_json_ocs_data_user_id @"id"

//Url to access to Shared API to create
#define k_url_acces_shared_api @"ocs/v1.php/apps/files_sharing/api/v1/shares"
Expand Down