|
@@ -1508,7 +1508,7 @@
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
-- (void)subscribingNextcloudServerPush:(NSString *)serverPath pushTokenHash:(NSString *)pushTokenHash devicePublicKey:(NSString *)devicePublicKey onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void (^)(NSHTTPURLResponse *, NSString *))successRequest failureRequest:(void (^)(NSHTTPURLResponse *, NSError *, NSString *))failureRequest {
|
|
|
+- (void)subscribingNextcloudServerPush:(NSString *)serverPath pushTokenHash:(NSString *)pushTokenHash devicePublicKey:(NSString *)devicePublicKey onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *publicKey, NSString *deviceIdentifier, NSString *signature, NSString *redirectedServer)) successRequest failureRequest:(void (^)(NSHTTPURLResponse *, NSError *, NSString *))failureRequest {
|
|
|
|
|
|
serverPath = [serverPath encodeString:NSUTF8StringEncoding];
|
|
|
serverPath = [serverPath stringByAppendingString:k_url_acces_remote_subscribing_nextcloud_server_api];
|
|
@@ -1517,14 +1517,22 @@
|
|
|
request = [self getRequestWithCredentials:request];
|
|
|
|
|
|
[request subscribingNextcloudServerPush:serverPath authorizationToken:_password pushTokenHash:pushTokenHash devicePublicKey:devicePublicKey onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
|
|
|
+
|
|
|
+ NSData *responseData = (NSData*) responseObject;
|
|
|
+
|
|
|
+ //Parse
|
|
|
+ NSError *error;
|
|
|
+ NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
|
|
|
+ NSLog(@"[LOG] Subscribing at the Nextcloud server : %@",jsongParsed);
|
|
|
+
|
|
|
+
|
|
|
if (successRequest) {
|
|
|
//Return success
|
|
|
- successRequest(response, request.redirectedServer);
|
|
|
+ //successRequest(response, request.redirectedServer);
|
|
|
}
|
|
|
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
|
|
|
-
|
|
|
- NSLog(@"%@", response);
|
|
|
|
|
|
+ } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
|
|
|
+
|
|
|
failureRequest(response, error, request.redirectedServer);
|
|
|
}];
|
|
|
}
|