浏览代码

Add isCryptoCloudMode

Marino Faggiana 8 年之前
父节点
当前提交
41ecdf7700

+ 8 - 6
Picker/DocumentPickerViewController.swift

@@ -43,7 +43,8 @@ class DocumentPickerViewController: UIDocumentPickerExtensionViewController, CCN
     var parameterProviderIdentifier: String!
     var parameterPasscodeCorrect: Bool? = false
     var parameterEncrypted: Bool? = false
-
+    var isCryptoCloudMode: Bool? = false
+    
     var metadata: CCMetadata?
     var recordsTableMetadata: [TableMetadata]?
     var titleFolder: String?
@@ -66,6 +67,7 @@ class DocumentPickerViewController: UIDocumentPickerExtensionViewController, CCN
     var passcodeIsPush: Bool? = false
     var serverUrlPush: String?
     
+    
     lazy var networkingOperationQueue: OperationQueue = {
         
         var queue = OperationQueue()
@@ -232,7 +234,7 @@ class DocumentPickerViewController: UIDocumentPickerExtensionViewController, CCN
         metadataNet.serverUrl = self.serverUrl
         metadataNet.selector = selectorReadFolder
         
-        let ocNetworking : OCnetworking = OCnetworking.init(delegate: self, metadataNet: metadataNet, withUser: activeUser, withPassword: activePassword, withUrl: activeUrl, withTypeCloud: typeCloud, activityIndicator: false)
+        let ocNetworking : OCnetworking = OCnetworking.init(delegate: self, metadataNet: metadataNet, withUser: activeUser, withPassword: activePassword, withUrl: activeUrl, withTypeCloud: typeCloud, activityIndicator: false, isCryptoCloudMode: isCryptoCloudMode!)
         networkingOperationQueue.addOperation(ocNetworking)
         
         hud.visibleIndeterminateHud()
@@ -306,7 +308,7 @@ class DocumentPickerViewController: UIDocumentPickerExtensionViewController, CCN
                 metadataNet.session = k_download_session_foreground
                 metadataNet.taskStatus = Int(k_taskStatusResume)
                 
-                let ocNetworking : OCnetworking = OCnetworking.init(delegate: self, metadataNet: metadataNet, withUser: activeUser, withPassword: activePassword, withUrl: activeUrl, withTypeCloud: typeCloud, activityIndicator: false)
+                let ocNetworking : OCnetworking = OCnetworking.init(delegate: self, metadataNet: metadataNet, withUser: activeUser, withPassword: activePassword, withUrl: activeUrl, withTypeCloud: typeCloud, activityIndicator: false, isCryptoCloudMode: isCryptoCloudMode!)
                 networkingOperationQueue.addOperation(ocNetworking)
             }
         }
@@ -355,7 +357,7 @@ class DocumentPickerViewController: UIDocumentPickerExtensionViewController, CCN
         metadataNet.selector = selectorDownloadThumbnail;
         metadataNet.serverUrl = self.serverUrl
         
-        let ocNetworking : OCnetworking = OCnetworking.init(delegate: self, metadataNet: metadataNet, withUser: activeUser, withPassword: activePassword, withUrl: activeUrl, withTypeCloud: typeCloud, activityIndicator: false)
+        let ocNetworking : OCnetworking = OCnetworking.init(delegate: self, metadataNet: metadataNet, withUser: activeUser, withPassword: activePassword, withUrl: activeUrl, withTypeCloud: typeCloud, activityIndicator: false, isCryptoCloudMode: isCryptoCloudMode!)
         networkingOperationQueue.addOperation(ocNetworking)
     }
 
@@ -531,7 +533,7 @@ extension DocumentPickerViewController {
                     metadataNet.session = k_upload_session_foreground
                     metadataNet.taskStatus = Int(k_taskStatusResume)
                     
-                    let ocNetworking : OCnetworking = OCnetworking.init(delegate: self!, metadataNet: metadataNet, withUser: self!.activeUser, withPassword: self!.activePassword, withUrl: self!.activeUrl, withTypeCloud: self!.typeCloud, activityIndicator: false)
+                    let ocNetworking : OCnetworking = OCnetworking.init(delegate: self!, metadataNet: metadataNet, withUser: self!.activeUser, withPassword: self!.activePassword, withUrl: self!.activeUrl, withTypeCloud: self!.typeCloud, activityIndicator: false, isCryptoCloudMode: self!.isCryptoCloudMode!)
                     self!.networkingOperationQueue.addOperation(ocNetworking)
                     
                     self!.hud.visibleHudTitle(NSLocalizedString("_uploading_", comment: ""), mode: MBProgressHUDMode.determinateHorizontalBar, color: self!.navigationController?.view.tintColor)
@@ -765,7 +767,7 @@ extension DocumentPickerViewController: UITableViewDataSource {
                 metadataNet.session = k_download_session_foreground
                 metadataNet.taskStatus = Int(k_taskStatusResume)
             
-                let ocNetworking : OCnetworking = OCnetworking.init(delegate: self, metadataNet: metadataNet, withUser: activeUser, withPassword: activePassword, withUrl: activeUrl, withTypeCloud: typeCloud, activityIndicator: false)
+                let ocNetworking : OCnetworking = OCnetworking.init(delegate: self, metadataNet: metadataNet, withUser: activeUser, withPassword: activePassword, withUrl: activeUrl, withTypeCloud: typeCloud, activityIndicator: false, isCryptoCloudMode: self.isCryptoCloudMode!)
                 networkingOperationQueue.addOperation(ocNetworking)
                 
                 hud.visibleHudTitle(NSLocalizedString("_loading_", comment: ""), mode: MBProgressHUDMode.determinateHorizontalBar, color: self.navigationController?.view.tintColor)

+ 11 - 1
Share Ext/ShareViewController.m

@@ -330,9 +330,19 @@
 - (void)addNetworkingQueue:(CCMetadataNet *)metadataNet
 {
     id operation;
+    BOOL isCryptoCloudMode;
     
+    if ([[CCUtility getKeyChainPasscodeForUUID:[CCUtility getUUID]] length] == 0) {
+        
+        isCryptoCloudMode = NO;
+        
+    } else {
+        
+        isCryptoCloudMode = YES;
+    }
+
     if ([_typeCloud isEqualToString:typeCloudOwnCloud] || [_typeCloud isEqualToString:typeCloudNextcloud])
-        operation = [[OCnetworking alloc] initWithDelegate:self metadataNet:metadataNet withUser:_activeUser withPassword:_activePassword withUrl:_activeUrl withTypeCloud:_typeCloud activityIndicator:NO];
+        operation = [[OCnetworking alloc] initWithDelegate:self metadataNet:metadataNet withUser:_activeUser withPassword:_activePassword withUrl:_activeUrl withTypeCloud:_typeCloud activityIndicator:NO isCryptoCloudMode:isCryptoCloudMode];
     
     [operation setQueuePriority:metadataNet.priority];
     

+ 1 - 1
iOSClient/AppDelegate.m

@@ -1113,7 +1113,7 @@
         activityIndicator = YES;
     
     if ([_typeCloud isEqualToString:typeCloudOwnCloud] || [_typeCloud isEqualToString:typeCloudNextcloud])
-        operation = [[OCnetworking alloc] initWithDelegate:delegate metadataNet:metadataNet withUser:_activeUser withPassword:_activePassword withUrl:_activeUrl withTypeCloud:_typeCloud activityIndicator:activityIndicator];
+        operation = [[OCnetworking alloc] initWithDelegate:delegate metadataNet:metadataNet withUser:_activeUser withPassword:_activePassword withUrl:_activeUrl withTypeCloud:_typeCloud activityIndicator:activityIndicator isCryptoCloudMode:_isCryptoCloudMode];
     
     [operation setQueuePriority:metadataNet.priority];
     

+ 1 - 1
iOSClient/Login/CCLoginNCOC.m

@@ -170,7 +170,7 @@
     if ([[self.baseUrl.text substringFromIndex:[self.baseUrl.text length] - 1] isEqualToString:@"/"])
         self.baseUrl.text = [self.baseUrl.text substringToIndex:[self.baseUrl.text length] - 1];
     
-    OCnetworking *ocNet = [[OCnetworking alloc] initWithDelegate:self metadataNet:nil withUser:self.user.text withPassword:self.password.text withUrl:nil withTypeCloud:_typeCloud activityIndicator:NO];
+    OCnetworking *ocNet = [[OCnetworking alloc] initWithDelegate:self metadataNet:nil withUser:self.user.text withPassword:self.password.text withUrl:nil withTypeCloud:_typeCloud activityIndicator:NO isCryptoCloudMode:NO];
     NSError *error = [ocNet readFileSync:[NSString stringWithFormat:@"%@%@", self.baseUrl.text, webDAV]];
     
     if (!error) {

+ 12 - 1
iOSClient/Move/CCMove.m

@@ -39,6 +39,7 @@
     NSString *activeAccessToken;
     
     CCHud *_hud;
+    BOOL _isCryptoCloudMode;
 }
 @end
 
@@ -63,6 +64,16 @@
         activeUID = recordAccount.uid;
         activeAccessToken = recordAccount.token;
         
+        // Crypto Mode
+        if ([[CCUtility getKeyChainPasscodeForUUID:[CCUtility getUUID]] length] == 0) {
+            
+            _isCryptoCloudMode = NO;
+            
+        } else {
+            
+            _isCryptoCloudMode = YES;
+        }
+        
     } else {
         
         UIAlertController * alert= [UIAlertController alertControllerWithTitle:nil message:NSLocalizedString(@"_no_active_account_", nil) preferredStyle:UIAlertControllerStyleAlert];
@@ -225,7 +236,7 @@
 {
     if ([typeCloud isEqualToString:typeCloudOwnCloud] || [typeCloud isEqualToString:typeCloudNextcloud]) {
         
-        OCnetworking *operation = [[OCnetworking alloc] initWithDelegate:self metadataNet:metadataNet withUser:activeUser withPassword:activePassword withUrl:activeUrl withTypeCloud:typeCloud activityIndicator:NO];
+        OCnetworking *operation = [[OCnetworking alloc] initWithDelegate:self metadataNet:metadataNet withUser:activeUser withPassword:activePassword withUrl:activeUrl withTypeCloud:typeCloud activityIndicator:NO isCryptoCloudMode:_isCryptoCloudMode];
         
         _networkingOperationQueue.maxConcurrentOperationCount = k_maxConcurrentOperation;
         [_networkingOperationQueue addOperation:operation];

+ 1 - 1
iOSClient/Networking/OCNetworking.h

@@ -35,7 +35,7 @@
 
 @interface OCnetworking : NSOperation <CCNetworkingDelegate>
 
-- (id)initWithDelegate:(id <OCNetworkingDelegate>)delegate metadataNet:(CCMetadataNet *)metadataNet withUser:(NSString *)withUser withPassword:(NSString *)withPassword withUrl:(NSString *)withUrl withTypeCloud:(NSString *)withTypeCloud activityIndicator:(BOOL)activityIndicator;
+- (id)initWithDelegate:(id <OCNetworkingDelegate>)delegate metadataNet:(CCMetadataNet *)metadataNet withUser:(NSString *)withUser withPassword:(NSString *)withPassword withUrl:(NSString *)withUrl withTypeCloud:(NSString *)withTypeCloud activityIndicator:(BOOL)activityIndicator isCryptoCloudMode:(BOOL)isCryptoCloudMode;
 
 @property (nonatomic, weak) id <OCNetworkingDelegate> delegate;
 

+ 3 - 2
iOSClient/Networking/OCNetworking.m

@@ -40,15 +40,15 @@
     NSURLSessionDownloadTask *_downloadTask;
     NSURLSessionUploadTask *_uploadTask;
     
+    BOOL _isCryptoCloudMode;
     BOOL _activityIndicator;
-    
     BOOL _hasServerForbiddenCharactersSupport;
 }
 @end
 
 @implementation OCnetworking
 
-- (id)initWithDelegate:(id <OCNetworkingDelegate>)delegate metadataNet:(CCMetadataNet *)metadataNet withUser:(NSString *)withUser withPassword:(NSString *)withPassword withUrl:(NSString *)withUrl withTypeCloud:(NSString *)withTypeCloud activityIndicator:(BOOL)activityIndicator
+- (id)initWithDelegate:(id <OCNetworkingDelegate>)delegate metadataNet:(CCMetadataNet *)metadataNet withUser:(NSString *)withUser withPassword:(NSString *)withPassword withUrl:(NSString *)withUrl withTypeCloud:(NSString *)withTypeCloud activityIndicator:(BOOL)activityIndicator isCryptoCloudMode:(BOOL)isCryptoCloudMode
 {
     self = [super init];
     
@@ -64,6 +64,7 @@
         _activeUrl = withUrl;
         _typeCloud = withTypeCloud;
         
+        _isCryptoCloudMode = isCryptoCloudMode;
         _activityIndicator = activityIndicator;
     }
     

+ 1 - 1
iOSClient/PhotosCameraUpload/CCPhotosCameraUpload.m

@@ -1214,7 +1214,7 @@
         
         NSError *error;
         
-        ocNet = [[OCnetworking alloc] initWithDelegate:self metadataNet:nil withUser:app.activeUser withPassword:app.activePassword withUrl:app.activeUrl withTypeCloud:app.typeCloud activityIndicator:NO];
+        ocNet = [[OCnetworking alloc] initWithDelegate:self metadataNet:nil withUser:app.activeUser withPassword:app.activePassword withUrl:app.activeUrl withTypeCloud:app.typeCloud activityIndicator:NO isCryptoCloudMode:app.isCryptoCloudMode];
     
         error = [ocNet readFileSync:folderPathName];
         if(!error)