|
@@ -222,7 +222,7 @@
|
|
|
OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
|
|
|
|
|
__block NSError *returnError = nil;
|
|
|
- __block NSString *token = [[NCManageDatabase sharedInstance] getDirectoryE2ETokenLockWithServerUrl:serverUrl];
|
|
|
+ __block NSString *tokenDatabase = [[NCManageDatabase sharedInstance] getDirectoryE2ETokenLockWithServerUrl:serverUrl];
|
|
|
|
|
|
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
|
|
|
|
@@ -240,10 +240,12 @@
|
|
|
}
|
|
|
|
|
|
// LOCK
|
|
|
- [communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
|
|
|
+ [communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:tokenDatabase onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
|
|
|
|
|
|
- [[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:token];
|
|
|
-
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ [[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:token];
|
|
|
+ });
|
|
|
+
|
|
|
// REMOVE METADATA
|
|
|
[communication deleteEndToEndMetadata:[url stringByAppendingString:@"/"] fileID:fileID onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
|
|
NSLog(@"[LOG] Found metadata and delete");
|
|
@@ -257,7 +259,9 @@
|
|
|
// UNLOCK
|
|
|
[communication unlockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
|
|
|
|
|
- [[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:@""];
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ [[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:@""];
|
|
|
+ });
|
|
|
dispatch_semaphore_signal(semaphore);
|
|
|
|
|
|
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
|
@@ -296,7 +300,7 @@
|
|
|
OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
|
|
|
|
|
__block NSError *returnError = nil;
|
|
|
- __block NSString *token = [[NCManageDatabase sharedInstance] getDirectoryE2ETokenLockWithServerUrl:serverUrl];
|
|
|
+ __block NSString *tokenDatabase = [[NCManageDatabase sharedInstance] getDirectoryE2ETokenLockWithServerUrl:serverUrl];
|
|
|
|
|
|
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
|
|
|
|
@@ -314,10 +318,12 @@
|
|
|
}
|
|
|
|
|
|
// LOCK
|
|
|
- [communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
|
|
|
-
|
|
|
- [[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:token];
|
|
|
+ [communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:tokenDatabase onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
|
|
|
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ [[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:token];
|
|
|
+ });
|
|
|
+
|
|
|
// DELETE METADATA
|
|
|
[communication deleteEndToEndMetadata:[url stringByAppendingString:@"/"] fileID:fileID onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
|
|
NSLog(@"[LOG] Found metadata and delete");
|
|
@@ -331,7 +337,9 @@
|
|
|
// UNLOCK
|
|
|
[communication unlockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
|
|
|
|
|
- [[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:@""];
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ [[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:@""];
|
|
|
+ });
|
|
|
dispatch_semaphore_signal(semaphore);
|
|
|
|
|
|
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
|
@@ -427,7 +435,7 @@
|
|
|
OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
|
|
|
|
|
__block NSError *returnError = nil;
|
|
|
- __block NSString *token = [[NCManageDatabase sharedInstance] getDirectoryE2ETokenLockWithServerUrl:serverUrl];
|
|
|
+ __block NSString *tokenDatabase = [[NCManageDatabase sharedInstance] getDirectoryE2ETokenLockWithServerUrl:serverUrl];
|
|
|
|
|
|
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
|
|
|
|
@@ -435,9 +443,11 @@
|
|
|
[communication setUserAgent:[CCUtility getUserAgent]];
|
|
|
|
|
|
// LOCK
|
|
|
- [communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
|
|
|
+ [communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:tokenDatabase onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
|
|
|
|
|
|
- [[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:token];
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ [[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:token];
|
|
|
+ });
|
|
|
|
|
|
// STORE METADATA
|
|
|
[communication storeEndToEndMetadata:[url stringByAppendingString:@"/"] fileID:fileID encryptedMetadata:metadata onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *encryptedMetadata, NSString *redirectedServer) {
|
|
@@ -467,7 +477,7 @@
|
|
|
OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
|
|
|
|
|
__block NSError *returnError = nil;
|
|
|
- __block NSString *token = [[NCManageDatabase sharedInstance] getDirectoryE2ETokenLockWithServerUrl:serverUrl];
|
|
|
+ __block NSString *tokenDatabase = [[NCManageDatabase sharedInstance] getDirectoryE2ETokenLockWithServerUrl:serverUrl];
|
|
|
|
|
|
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
|
|
|
|
@@ -475,9 +485,11 @@
|
|
|
[communication setUserAgent:[CCUtility getUserAgent]];
|
|
|
|
|
|
// LOCK
|
|
|
- [communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
|
|
|
+ [communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:tokenDatabase onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
|
|
|
|
|
|
- [[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:token];
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ [[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:token];
|
|
|
+ });
|
|
|
|
|
|
// UPDATA METADATA
|
|
|
[communication updateEndToEndMetadata:[url stringByAppendingString:@"/"] fileID:fileID encryptedMetadata:metadata token:token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *encryptedMetadata, NSString *redirectedServer) {
|
|
@@ -507,7 +519,7 @@
|
|
|
OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
|
|
|
|
|
__block NSError *returnError = nil;
|
|
|
- __block NSString *token = [[NCManageDatabase sharedInstance] getDirectoryE2ETokenLockWithServerUrl:serverUrl];
|
|
|
+ __block NSString *tokenDatabase = [[NCManageDatabase sharedInstance] getDirectoryE2ETokenLockWithServerUrl:serverUrl];
|
|
|
|
|
|
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
|
|
|
|
@@ -515,10 +527,12 @@
|
|
|
[communication setUserAgent:[CCUtility getUserAgent]];
|
|
|
|
|
|
// LOCK
|
|
|
- [communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
|
|
|
+ [communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:tokenDatabase onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
|
|
|
|
|
|
// Write DB token
|
|
|
- [[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:token];
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ [[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:token];
|
|
|
+ });
|
|
|
dispatch_semaphore_signal(semaphore);
|
|
|
|
|
|
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
|
@@ -548,7 +562,9 @@
|
|
|
[communication unlockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
|
|
|
|
|
// Write DB token ""
|
|
|
- [[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:@""];
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ [[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:@""];
|
|
|
+ });
|
|
|
dispatch_semaphore_signal(semaphore);
|
|
|
|
|
|
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|