|
@@ -1537,6 +1537,35 @@
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
+- (void)subscribingPushProxy:(NSString *)serverPath pushTokenHash:(NSString *)pushTokenHash deviceIdentifier:(NSString *)deviceIdentifier deviceIdentifierSignature:(NSString *)deviceIdentifierSignature 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];
|
|
|
+
|
|
|
+ OCWebDAVClient *request = [OCWebDAVClient new];
|
|
|
+ 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);
|
|
|
+
|
|
|
+ NSString *publicKey = [jsongParsed objectForKey:@"publicKey"];
|
|
|
+ NSString *deviceIdentifier = [jsongParsed objectForKey:@"deviceIdentifier"];
|
|
|
+ NSString *signature = [jsongParsed objectForKey:@"signature"];
|
|
|
+
|
|
|
+ successRequest(response, publicKey, deviceIdentifier, signature, request.redirectedServer);
|
|
|
+
|
|
|
+ } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
|
|
|
+
|
|
|
+ failureRequest(response, error, request.redirectedServer);
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
#pragma mark - Activity
|
|
|
|
|
|
- (void) getActivityServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *listOfActivity, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
|