Skip to content

Commit

Permalink
Merge pull request #171 from owncloud/switch_multiaccount_fix_library
Browse files Browse the repository at this point in the history
Added serveruserid parameter in request
  • Loading branch information
nasli authored Dec 14, 2017
2 parents e632bb0 + 3d87404 commit 9de11c9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
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

0 comments on commit 9de11c9

Please sign in to comment.