Browse Source

Merge branch 'develop'

Marino Faggiana 7 years ago
parent
commit
2c6fd9372f

+ 1 - 1
iOSClient/Brand/Picker.plist

@@ -17,7 +17,7 @@
 	<key>CFBundlePackageType</key>
 	<string>XPC!</string>
 	<key>CFBundleShortVersionString</key>
-	<string>2.18.1</string>
+	<string>2.18.2</string>
 	<key>CFBundleVersion</key>
 	<string>00001</string>
 	<key>NSAppTransportSecurity</key>

+ 1 - 1
iOSClient/Brand/PickerFileProvider.plist

@@ -17,7 +17,7 @@
 	<key>CFBundlePackageType</key>
 	<string>XPC!</string>
 	<key>CFBundleShortVersionString</key>
-	<string>2.18.1</string>
+	<string>2.18.2</string>
 	<key>CFBundleVersion</key>
 	<string>00001</string>
 	<key>NSExtension</key>

+ 1 - 1
iOSClient/Brand/Share.plist

@@ -17,7 +17,7 @@
 	<key>CFBundlePackageType</key>
 	<string>XPC!</string>
 	<key>CFBundleShortVersionString</key>
-	<string>2.18.1</string>
+	<string>2.18.2</string>
 	<key>CFBundleVersion</key>
 	<string>00001</string>
 	<key>NSAppTransportSecurity</key>

+ 4 - 2
iOSClient/Brand/iOSClient.plist

@@ -46,7 +46,7 @@
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
-	<string>2.18.1</string>
+	<string>2.18.2</string>
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleURLTypes</key>
@@ -107,8 +107,10 @@
 	<string>The use of GPS is used to detect new photos from camera roll, continued use of GPS running in the background can dramatically decrease battery life.</string>
 	<key>NSLocationWhenInUseUsageDescription</key>
 	<string>The use of GPS is used to detect new photos from camera roll on background, the use of GPS only when the App is in use is useless</string>
+	<key>NSPhotoLibraryAddUsageDescription</key>
+	<string>$(PRODUCT_NAME) requires access to the photo library</string>
 	<key>NSPhotoLibraryUsageDescription</key>
-	<string>$(PRODUCT_NAME)</string>
+	<string>$(PRODUCT_NAME) requires access to the photo library</string>
 	<key>UIBackgroundModes</key>
 	<array>
 		<string>audio</string>

+ 0 - 1
iOSClient/Main/CCDetail.h

@@ -36,7 +36,6 @@
 @interface CCDetail : UIViewController <UIDocumentInteractionControllerDelegate, MWPhotoBrowserDelegate, ReaderViewControllerDelegate>
 
 @property (nonatomic, strong) tableMetadata *metadataDetail;
-@property BOOL sourceDirectoryLocal;
 @property (nonatomic, strong) NSDate *dateFilterQuery;
 
 // Document

+ 21 - 84
iOSClient/Main/CCDetail.m

@@ -277,17 +277,10 @@
         safeAreaBottom = [UIApplication sharedApplication].delegate.window.safeAreaInsets.bottom;
     }
     
-    if (_sourceDirectoryLocal) {
+    fileName = [NSTemporaryDirectory() stringByAppendingString:self.metadataDetail.fileName];
         
-        fileName = [NSString stringWithFormat:@"%@/%@", self.metadataDetail.directoryID, self.metadataDetail.fileName];
-        
-    } else {
-        
-        fileName = [NSTemporaryDirectory() stringByAppendingString:self.metadataDetail.fileName];
-        
-        [[NSFileManager defaultManager] removeItemAtPath:fileName error:nil];
-        [[NSFileManager defaultManager] linkItemAtPath:[NSString stringWithFormat:@"%@/%@", app.directoryUser, self.metadataDetail.fileID] toPath:fileName error:nil];
-    }
+    [[NSFileManager defaultManager] removeItemAtPath:fileName error:nil];
+    [[NSFileManager defaultManager] linkItemAtPath:[NSString stringWithFormat:@"%@/%@", app.directoryUser, self.metadataDetail.fileID] toPath:fileName error:nil];
     
     if ([[NSFileManager defaultManager] fileExistsAtPath:fileName] == NO) {
         
@@ -417,24 +410,18 @@
 - (void)photoBrowser:(MWPhotoBrowser *)photoBrowser didDisplayPhotoAtIndex:(NSUInteger)index
 {
     tableMetadata *metadata = [self.dataSourceImagesVideos objectAtIndex:index];
-    NSString *directory;
     
     _indexNowVisible = index;
     _fileIDNowVisible = metadata.fileID;
     
     photoBrowser.toolbar.hidden = NO;
     
-    if (_sourceDirectoryLocal)
-        directory = self.metadataDetail.directoryID;
-    else
-        directory = app.directoryUser;
-    
     // Download image ?
     if (metadata) {
         
         tableMetadata *metadataDB = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"fileID = %@", metadata.fileID]];
 
-        if ([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@", directory, metadata.fileID]] == NO && [metadataDB.session length] == 0)
+        if ([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@", app.directoryUser, metadata.fileID]] == NO && [metadataDB.session length] == 0)
             [self downloadPhotoBrowser:metadata];
     }
     
@@ -451,14 +438,8 @@
 
 - (id <MWPhoto>)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index
 {
-    NSString *directory;
     UIImage *image;
     
-    if (_sourceDirectoryLocal)
-        directory = self.metadataDetail.directoryID;
-    else
-        directory = app.directoryUser;
-
     tableMetadata *metadata = [self.dataSourceImagesVideos objectAtIndex:index];
     
     if (index < self.photos.count) {
@@ -467,7 +448,7 @@
             
             if ([metadata.typeFile isEqualToString: k_metadataTypeFile_image]) {
                 
-                NSString *fileImage = [NSString stringWithFormat:@"%@/%@", directory, metadata.fileID];
+                NSString *fileImage = [NSString stringWithFormat:@"%@/%@", app.directoryUser, metadata.fileID];
                 NSString *ext = [CCUtility getExtension:metadata.fileName];
                 
                 if ([ext isEqualToString:@"GIF"]) image = [UIImage animatedImageWithAnimatedGIFURL:[NSURL fileURLWithPath:fileImage]];
@@ -499,13 +480,13 @@
             
             if ([metadata.typeFile isEqualToString: k_metadataTypeFile_video]) {
                 
-                if ([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@", directory, metadata.fileID]]) {
+                if ([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@", app.directoryUser, metadata.fileID]]) {
                     
                     // remove and make the simbolic link in temp
                     NSString *toPath = [NSTemporaryDirectory() stringByAppendingString:metadata.fileName];
                     
                     [[NSFileManager defaultManager] removeItemAtPath:toPath error:nil];
-                    [[NSFileManager defaultManager] linkItemAtPath:[NSString stringWithFormat:@"%@/%@", directory, metadata.fileID] toPath:toPath error:nil];
+                    [[NSFileManager defaultManager] linkItemAtPath:[NSString stringWithFormat:@"%@/%@", app.directoryUser, metadata.fileID] toPath:toPath error:nil];
                     NSURL *url = [NSURL fileURLWithPath:toPath];
                     
                     MWPhoto *video = [MWPhoto photoWithImage:[CCGraphics thumbnailImageForVideo:url atTime:1.0]];
@@ -528,7 +509,7 @@
             
             if ([metadata.typeFile isEqualToString: k_metadataTypeFile_audio]) {
                 
-                if ([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@", directory, metadata.fileID]]) {
+                if ([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@", app.directoryUser, metadata.fileID]]) {
                     
                     MWPhoto *audio;
                     UIImage *audioImage;
@@ -537,11 +518,11 @@
                     NSString *toPath = [NSTemporaryDirectory() stringByAppendingString:metadata.fileName];
                     
                     [[NSFileManager defaultManager] removeItemAtPath:toPath error:nil];
-                    [[NSFileManager defaultManager] linkItemAtPath:[NSString stringWithFormat:@"%@/%@", directory, metadata.fileID] toPath:toPath error:nil];
+                    [[NSFileManager defaultManager] linkItemAtPath:[NSString stringWithFormat:@"%@/%@", app.directoryUser, metadata.fileID] toPath:toPath error:nil];
                     NSURL *url = [NSURL fileURLWithPath:toPath];
                     
-                    if ([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@.ico", directory, metadata.fileID]]) {
-                        audioImage = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.ico", directory, metadata.fileID]];
+                    if ([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@.ico", app.directoryUser, metadata.fileID]]) {
+                        audioImage = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.ico", app.directoryUser, metadata.fileID]];
                     } else {
                         audioImage = [UIImage imageNamed:@"notaMusic"]; //[CCGraphics scaleImage:[UIImage imageNamed:@"notaMusic"] toSize:CGSizeMake(200, 200) isAspectRation:YES];
                     }
@@ -589,31 +570,14 @@
 
 - (id <MWPhoto>)photoBrowser:(MWPhotoBrowser *)photoBrowser thumbPhotoAtIndex:(NSUInteger)index
 {
-    NSString *directory;
-    
     tableMetadata *metadata = [self.dataSourceImagesVideos objectAtIndex:index];
     
-    if (_sourceDirectoryLocal)
-        directory = self.metadataDetail.directoryID;
-    else
-        directory = app.directoryUser;
-
     if (index < self.thumbs.count) {
         
         if (metadata.fileID) {
             
-            UIImage *image;
-            
-            if (_sourceDirectoryLocal) {
-                
-                image = [CCGraphics createNewImageFrom:metadata.fileID directoryUser:directory fileNameTo:metadata.fileID extension:[metadata.fileName pathExtension] size:@"m" imageForUpload:NO typeFile:metadata.typeFile writePreview:NO optimizedFileName:[CCUtility getOptimizedPhoto]];
-                
-            } else {
-                
-                NSString *fileImage = [NSString stringWithFormat:@"%@/%@.ico", directory, metadata.fileID];
-                
-                image = [UIImage animatedImageWithAnimatedGIFURL:[NSURL fileURLWithPath:fileImage]];
-            }
+            NSString *fileImage = [NSString stringWithFormat:@"%@/%@.ico", app.directoryUser, metadata.fileID];
+            UIImage *image = [UIImage animatedImageWithAnimatedGIFURL:[NSURL fileURLWithPath:fileImage]];
             
             if (image) {
                 
@@ -630,22 +594,13 @@
 
 - (void)photoBrowser:(MWPhotoBrowser *)photoBrowser actionButtonPressedForPhotoAtIndex:(NSUInteger)index
 {
-    NSString *filePath;
-
     tableMetadata *metadata = [self.dataSourceImagesVideos objectAtIndex:index];
     if (metadata == nil) return;
     
-    if (_sourceDirectoryLocal) {
+    NSString *filePath = [NSString stringWithFormat:@"%@/%@", app.directoryUser, metadata.fileName];
         
-        filePath = [NSString stringWithFormat:@"%@/%@", self.metadataDetail.directoryID, self.metadataDetail.fileName];
-        
-    } else {
-        
-        filePath = [NSString stringWithFormat:@"%@/%@", app.directoryUser, metadata.fileName];
-        
-        [[NSFileManager defaultManager] removeItemAtPath:filePath error:nil];
-        [[NSFileManager defaultManager] linkItemAtPath:[NSString stringWithFormat:@"%@/%@", app.directoryUser, metadata.fileID] toPath:filePath error:nil];
-    }
+    [[NSFileManager defaultManager] removeItemAtPath:filePath error:nil];
+    [[NSFileManager defaultManager] linkItemAtPath:[NSString stringWithFormat:@"%@/%@", app.directoryUser, metadata.fileID] toPath:filePath error:nil];
     
     self.docController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:filePath]];
     
@@ -820,19 +775,10 @@
 
 - (void)viewPDF:(NSString *)password
 {
-    NSString *fileName;
-    
-    if (_sourceDirectoryLocal) {
-        
-        fileName = [NSString stringWithFormat:@"%@/%@", self.metadataDetail.directoryID, self.metadataDetail.fileName];
-        
-    } else {
+    NSString *fileName = [NSTemporaryDirectory() stringByAppendingString:self.metadataDetail.fileName];
         
-        fileName = [NSTemporaryDirectory() stringByAppendingString:self.metadataDetail.fileName];
-        
-        [[NSFileManager defaultManager] removeItemAtPath:fileName error:nil];
-        [[NSFileManager defaultManager] linkItemAtPath:[NSString stringWithFormat:@"%@/%@", app.directoryUser, self.metadataDetail.fileID] toPath:fileName error:nil];
-    }
+    [[NSFileManager defaultManager] removeItemAtPath:fileName error:nil];
+    [[NSFileManager defaultManager] linkItemAtPath:[NSString stringWithFormat:@"%@/%@", app.directoryUser, self.metadataDetail.fileID] toPath:fileName error:nil];
     
     if ([[NSFileManager defaultManager] fileExistsAtPath:fileName isDirectory:nil] == NO) {
         
@@ -1045,19 +991,10 @@
 
 - (void)actionButtonPressed:(UIBarButtonItem *)sender
 {
-    NSString *filePath;
-    
     if ([self.metadataDetail.fileName length] == 0) return;
     
-    if (_sourceDirectoryLocal) {
-        
-        filePath = [NSString stringWithFormat:@"%@/%@", self.metadataDetail.directoryID, self.metadataDetail.fileName];
-        
-    } else {
-        
-        filePath = [NSString stringWithFormat:@"%@%@", NSTemporaryDirectory(), self.metadataDetail.fileName];
-    }
-    
+    NSString *filePath = [NSString stringWithFormat:@"%@%@", NSTemporaryDirectory(), self.metadataDetail.fileName];
+
     self.docController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:filePath]];
 
     self.docController.delegate = self;

+ 37 - 37
iOSClient/Networking/CCNetworking.m

@@ -1078,59 +1078,59 @@
         return;
     }
     
-    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
-
-        NSURLSession *sessionUpload;
-        NSError *error;
-
-        // *** IS ENCRYPTED --> LOCK ***
-        BOOL encrypted = [CCUtility isFolderEncrypted:serverUrl account:_activeAccount];
-        if (encrypted) {
+    NSURLSession *sessionUpload;
+    
+    // *** IS ENCRYPTED --> LOCK ***
+    /*
+    NSError *error;
+    BOOL encrypted = [CCUtility isFolderEncrypted:serverUrl account:_activeAccount];
+    if (encrypted) {
             
-            NSString *tokenLock = [[NCManageDatabase sharedInstance] getE2eEncryptionTokenLockWithServerUrl:serverUrl];
-            tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND serverUrl = %@", _activeAccount, serverUrl]];
-            error = [[NCNetworkingSync sharedManager] lockEndToEndFolderEncrypted:_activeUser userID:_activeUserID password:_activePassword url:_activeUrl fileID:directory.fileID token:&tokenLock];
-        }
+        NSString *tokenLock = [[NCManageDatabase sharedInstance] getE2eEncryptionTokenLockWithServerUrl:serverUrl];
+        tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND serverUrl = %@", _activeAccount, serverUrl]];
+        error = [[NCNetworkingSync sharedManager] lockEndToEndFolderEncrypted:_activeUser userID:_activeUserID password:_activePassword url:_activeUrl fileID:directory.fileID token:&tokenLock];
+    }
+    */
     
-        // NSURLSession
-        if ([session isEqualToString:k_upload_session]) sessionUpload = [self sessionUpload];
-        else if ([session isEqualToString:k_upload_session_foreground]) sessionUpload = [self sessionUploadForeground];
-        else if ([session isEqualToString:k_upload_session_wwan]) sessionUpload = [self sessionWWanUpload];
+    // NSURLSession
+    if ([session isEqualToString:k_upload_session]) sessionUpload = [self sessionUpload];
+    else if ([session isEqualToString:k_upload_session_foreground]) sessionUpload = [self sessionUploadForeground];
+    else if ([session isEqualToString:k_upload_session_wwan]) sessionUpload = [self sessionWWanUpload];
 
-        NSURLSessionUploadTask *uploadTask = [sessionUpload uploadTaskWithRequest:request fromFile:[NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/%@", _directoryUser, fileNameForUpload]]];
+    NSURLSessionUploadTask *uploadTask = [sessionUpload uploadTaskWithRequest:request fromFile:[NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/%@", _directoryUser, fileNameForUpload]]];
     
-        // Error
-        if (uploadTask == nil) {
+    // Error
+    if (uploadTask == nil) {
         
-            [[NCManageDatabase sharedInstance] addActivityClient:fileName fileID:assetLocalIdentifier action:k_activityDebugActionUpload selector:selector note:@"Upload task not available" type:k_activityTypeFailure verbose:k_activityVerboseHigh activeUrl:_activeUrl];
+        [[NCManageDatabase sharedInstance] addActivityClient:fileName fileID:assetLocalIdentifier action:k_activityDebugActionUpload selector:selector note:@"Upload task not available" type:k_activityTypeFailure verbose:k_activityVerboseHigh activeUrl:_activeUrl];
         
-            [[NCManageDatabase sharedInstance] setMetadataSession:session sessionError:[NSString stringWithFormat:@"%@", @k_CCErrorTaskNil] sessionSelector:nil sessionSelectorPost:nil sessionTaskIdentifier:k_taskIdentifierError predicate:[NSPredicate predicateWithFormat:@"sessionID = %@ AND account = %@", sessionID, _activeAccount]];
+        [[NCManageDatabase sharedInstance] setMetadataSession:session sessionError:[NSString stringWithFormat:@"%@", @k_CCErrorTaskNil] sessionSelector:nil sessionSelectorPost:nil sessionTaskIdentifier:k_taskIdentifierError predicate:[NSPredicate predicateWithFormat:@"sessionID = %@ AND account = %@", sessionID, _activeAccount]];
         
-            NSLog(@"[LOG] Upload file TaskIdentifier [error CCErrorTaskNil] - %@", fileName);
+        NSLog(@"[LOG] Upload file TaskIdentifier [error CCErrorTaskNil] - %@", fileName);
         
-        } else {
+    } else {
         
-            [[NCManageDatabase sharedInstance] setMetadataSession:session sessionError:@"" sessionSelector:nil sessionSelectorPost:nil sessionTaskIdentifier:uploadTask.taskIdentifier predicate:[NSPredicate predicateWithFormat:@"sessionID = %@ AND account = %@", sessionID, _activeAccount]];
+        [[NCManageDatabase sharedInstance] setMetadataSession:session sessionError:@"" sessionSelector:nil sessionSelectorPost:nil sessionTaskIdentifier:uploadTask.taskIdentifier predicate:[NSPredicate predicateWithFormat:@"sessionID = %@ AND account = %@", sessionID, _activeAccount]];
         
-            // OOOOOOKKKK remove record on Table Auto Upload
-            [[NCManageDatabase sharedInstance] deleteQueueUploadWithAssetLocalIdentifier:assetLocalIdentifier selector:selector];
+        // OOOOOOKKKK remove record on Table Auto Upload
+        [[NCManageDatabase sharedInstance] deleteQueueUploadWithAssetLocalIdentifier:assetLocalIdentifier selector:selector];
         
-            // Manage uploadTask cancel,suspend,resume
-            if (taskStatus == k_taskStatusCancel) [uploadTask cancel];
-            else if (taskStatus == k_taskStatusSuspend) [uploadTask suspend];
-            else if (taskStatus == k_taskStatusResume) [uploadTask resume];
+        // Manage uploadTask cancel,suspend,resume
+        if (taskStatus == k_taskStatusCancel) [uploadTask cancel];
+        else if (taskStatus == k_taskStatusSuspend) [uploadTask suspend];
+        else if (taskStatus == k_taskStatusResume) [uploadTask resume];
         
-            NSLog(@"[LOG] Upload file %@ TaskIdentifier %lu", fileName, (unsigned long)uploadTask.taskIdentifier);
-        }
+        NSLog(@"[LOG] Upload file %@ TaskIdentifier %lu", fileName, (unsigned long)uploadTask.taskIdentifier);
+    }
 
-        // refresh main
-        if ([self.delegate respondsToSelector:@selector(reloadDatasource:)])
-            [self.delegate reloadDatasource:serverUrl];
+    // refresh main
+    if ([self.delegate respondsToSelector:@selector(reloadDatasource:)])
+        [self.delegate reloadDatasource:serverUrl];
         
 #ifndef EXTENSION
-        [app updateApplicationIconBadgeNumber];
+    [app updateApplicationIconBadgeNumber];
 #endif
-     });
+    
 }
 
 - (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data

+ 1 - 0
iOSClient/Networking/NCNetworkingSync.h

@@ -13,6 +13,7 @@
 
 + (NCNetworkingSync *)sharedManager;
 
+- (NSError *)uploadFile:(NSString *)localFilePathName remoteFilePathName:(NSString *)remoteFilePathName user:(NSString *)user userID:(NSString *)userID password:(NSString *)password;
 - (NSError *)readFile:(NSString *)filePathName user:(NSString *)user userID:(NSString *)userID password:(NSString *)password;
 - (NSError *)checkServer:(NSString *)serverUrl user:(NSString *)user userID:(NSString *)userID password:(NSString *)password;
 

+ 38 - 2
iOSClient/Networking/NCNetworkingSync.m

@@ -27,6 +27,42 @@
 #pragma mark ============================
 #pragma --------------------------------------------------------------------------------------------
 
+- (NSError *)uploadFile:(NSString *)localFilePathName remoteFilePathName:(NSString *)remoteFilePathName user:(NSString *)user userID:(NSString *)userID password:(NSString *)password
+{
+    OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
+    __block NSError *returnError = nil;
+    
+    dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
+
+    [communication setCredentialsWithUser:user andUserID:userID andPassword:password];
+    [communication setUserAgent:[CCUtility getUserAgent]];
+    
+    [communication uploadFileSession:localFilePathName toDestiny:remoteFilePathName onCommunication:communication progress:^(NSProgress *progress) {
+        // Progress
+    } successRequest:^(NSURLResponse *response, NSString *redirectedServer) {
+        
+        dispatch_semaphore_signal(semaphore);
+        
+    } failureRequest:^(NSURLResponse *response, NSString *redirectedServer, NSError *error) {
+        
+        NSHTTPURLResponse* httpResponse = (NSHTTPURLResponse*)response;
+        
+        returnError = [NSError errorWithDomain:@"com.nextcloud.nextcloud" code:httpResponse.statusCode userInfo:[NSDictionary dictionaryWithObject:@"Upload file error" forKey:NSLocalizedDescriptionKey]];
+        dispatch_semaphore_signal(semaphore);
+
+    } failureBeforeRequest:^(NSError *error) {
+        
+        returnError = error;
+        dispatch_semaphore_signal(semaphore);
+
+    }];
+     
+     while (dispatch_semaphore_wait(semaphore, DISPATCH_TIME_NOW))
+         [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:k_timeout_webdav]];
+     
+     return returnError;
+}
+
 - (NSError *)checkServer:(NSString *)serverUrl user:(NSString *)user userID:(NSString *)userID password:(NSString *)password
 {
     OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
@@ -43,7 +79,7 @@
         
     } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
         
-        returnError = error;
+        returnError = [NSError errorWithDomain:@"com.nextcloud.nextcloud" code:response.statusCode userInfo:[NSDictionary dictionaryWithObject:@"Check server error" forKey:NSLocalizedDescriptionKey]];
         dispatch_semaphore_signal(semaphore);
     }];
     
@@ -69,7 +105,7 @@
         
     } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
         
-        returnError = error;
+        returnError = [NSError errorWithDomain:@"com.nextcloud.nextcloud" code:response.statusCode userInfo:[NSDictionary dictionaryWithObject:@"Read file error" forKey:NSLocalizedDescriptionKey]];
         dispatch_semaphore_signal(semaphore);
     }];
     

+ 1 - 1
iOSClient/Settings/CCSettings.m

@@ -107,7 +107,7 @@
     [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
     [section addFormRow:row];
 
-/*
+    /*
 #ifdef DEBUG
     // Section : E2EEncryption --------------------------------------------------------------