Explorar el Código

Merge pull request #2013 from nextcloud/removeGPS

Remove gps
Marino Faggiana hace 3 años
padre
commit
1ed46d2751

+ 2 - 1
Nextcloud.xcodeproj/project.pbxproj

@@ -3006,7 +3006,7 @@
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 11;
+				CURRENT_PROJECT_VERSION = 12;
 				DEVELOPMENT_TEAM = 6JLRKY9ZV7;
 				ENABLE_BITCODE = NO;
 				ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -3067,6 +3067,7 @@
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COPY_PHASE_STRIP = NO;
+				CURRENT_PROJECT_VERSION = 12;
 				CURRENT_PROJECT_VERSION = 11;
 				DEVELOPMENT_TEAM = 6JLRKY9ZV7;
 				ENABLE_BITCODE = NO;

+ 0 - 12
iOSClient/Brand/iOSClient.entitlements

@@ -4,18 +4,6 @@
 <dict>
 	<key>aps-environment</key>
 	<string>development</string>
-	<key>com.apple.developer.icloud-container-identifiers</key>
-	<array>
-		<string>iCloud.$(CFBundleIdentifier)</string>
-	</array>
-	<key>com.apple.developer.icloud-services</key>
-	<array>
-		<string>CloudDocuments</string>
-	</array>
-	<key>com.apple.developer.ubiquity-container-identifiers</key>
-	<array>
-		<string>iCloud.$(CFBundleIdentifier)</string>
-	</array>
 	<key>com.apple.security.application-groups</key>
 	<array>
 		<string>group.it.twsweb.Crypto-Cloud</string>

+ 0 - 2
iOSClient/Data/NCDatabase.swift

@@ -37,9 +37,7 @@ class tableAccount: Object, NCUserBaseUrl {
     @objc dynamic var address = ""
     @objc dynamic var alias = ""
     @objc dynamic var autoUpload: Bool = false
-    @objc dynamic var autoUploadBackground: Bool = false
     @objc dynamic var autoUploadCreateSubfolder: Bool = false
-    @objc dynamic var autoUploadDeleteAssetLocalIdentifier: Bool = false
     @objc dynamic var autoUploadDirectory = ""
     @objc dynamic var autoUploadFileName = ""
     @objc dynamic var autoUploadFull: Bool = false

+ 2 - 2
iOSClient/Data/NCManageDatabase+Metadata.swift

@@ -708,14 +708,14 @@ extension NCManageDatabase {
         }
     }
 
-    @objc func getAssetLocalIdentifiersUploaded(account: String, sessionSelector: String) -> [String] {
+    @objc func getAssetLocalIdentifiersUploaded(account: String) -> [String] {
 
         let realm = try! Realm()
         realm.refresh()
 
         var assetLocalIdentifiers: [String] = []
 
-        let results = realm.objects(tableMetadata.self).filter("account == %@ AND assetLocalIdentifier != '' AND deleteAssetLocalIdentifier == true AND sessionSelector == %@", account, sessionSelector)
+        let results = realm.objects(tableMetadata.self).filter("account == %@ AND assetLocalIdentifier != '' AND deleteAssetLocalIdentifier == true", account)
         for result in results {
             assetLocalIdentifiers.append(result.assetLocalIdentifier)
         }

+ 1 - 1
iOSClient/Data/NCManageDatabase.swift

@@ -149,7 +149,7 @@ class NCManageDatabase: NSObject {
                         }
                     }
 
-                    if oldSchemaVersion < 220 && NCUtility.shared.SYSTEM_VERSION_LESS_THAN(version: "13") {
+                    if oldSchemaVersion < 222 && NCUtility.shared.SYSTEM_VERSION_LESS_THAN(version: "13") {
                         migration.deleteData(forType: tableMetadata.className())
                         migration.deleteData(forType: tableDirectory.className())
                     }

+ 0 - 1
iOSClient/Main/Create cloud/NCCreateFormUploadAssets.swift

@@ -415,7 +415,6 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate {
                 metadataForUpload.assetLocalIdentifier = asset.localIdentifier
                 metadataForUpload.session = self.session
                 metadataForUpload.sessionSelector = NCGlobal.shared.selectorUploadFile
-                metadataForUpload.size = NCUtilityFileSystem.shared.getFileSize(asset: asset)
                 metadataForUpload.status = NCGlobal.shared.metadataStatusWaitUpload
 
                 if livePhoto {

+ 1 - 1
iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift

@@ -423,7 +423,7 @@ extension NCCreateFormUploadConflict: UITableViewDataSource {
 
                 } else {
 
-                    CCUtility.extractImageVideoFromAssetLocalIdentifier(forUpload: metadataNewFile, notification: false) { metadataNew, fileNamePath in
+                    CCUtility.extractImageVideoFromAssetLocalIdentifier(forUpload: metadataNewFile) { metadataNew, fileNamePath in
 
                         if metadataNew != nil {
                             self.fileNamesPath[metadataNewFile.fileNameView] = fileNamePath!

+ 1 - 1
iOSClient/NCGlobal.swift

@@ -112,7 +112,7 @@ class NCGlobal: NSObject {
     // Database Realm
     //
     let databaseDefault                             = "nextcloud.realm"
-    let databaseSchemaVersion: UInt64               = 220
+    let databaseSchemaVersion: UInt64               = 222
 
     // Intro selector
     //

+ 2 - 75
iOSClient/Networking/NCAutoUpload.swift

@@ -25,78 +25,17 @@ import UIKit
 import CoreLocation
 import NCCommunication
 
-class NCAutoUpload: NSObject, CLLocationManagerDelegate {
+class NCAutoUpload: NSObject {
     @objc static let shared: NCAutoUpload = {
         let instance = NCAutoUpload()
         return instance
     }()
 
     private let appDelegate = UIApplication.shared.delegate as! AppDelegate
-    public var locationManager: CLLocationManager?
     private var endForAssetToUpload: Bool = false
 
     // MARK: -
 
-    @objc func startSignificantChangeUpdates() {
-
-        if locationManager == nil {
-
-            locationManager = CLLocationManager()
-            locationManager?.delegate = self
-            locationManager?.distanceFilter = 10
-        }
-
-        locationManager?.requestAlwaysAuthorization()
-        locationManager?.startMonitoringSignificantLocationChanges()
-    }
-
-    @objc func stopSignificantChangeUpdates() {
-
-        locationManager?.stopMonitoringSignificantLocationChanges()
-    }
-
-    func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
-
-        let location = locations.last
-        guard let latitude = location?.coordinate.latitude else { return }
-        guard let longitude = location?.coordinate.longitude else { return }
-
-        NCCommunicationCommon.shared.writeLog("Location manager: latitude \(latitude) longitude \(longitude)")
-
-        if let activeAccount = NCManageDatabase.shared.getActiveAccount() {
-            if activeAccount.autoUpload && activeAccount.autoUploadBackground && UIApplication.shared.applicationState == UIApplication.State.background {
-                NCAskAuthorization.shared.askAuthorizationPhotoLibrary(viewController: nil) { hasPermission in
-                    if hasPermission {
-                        self.uploadAssetsNewAndFull(viewController: nil, selector: NCGlobal.shared.selectorUploadAutoUpload, log: "Change location") { items in
-                            NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUpdateBadgeNumber)
-                            if items > 0 {
-                                self.appDelegate.networkingProcessUpload?.startProcess()
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
-        if CLLocationManager.authorizationStatus() != CLAuthorizationStatus.authorizedAlways {
-            NCManageDatabase.shared.setAccountAutoUploadProperty("autoUploadBackground", state: false)
-            self.stopSignificantChangeUpdates()
-        }
-    }
-
-    func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
-        NCAskAuthorization.shared.askAuthorizationLocationManager { hasFullPermissions in
-            if !hasFullPermissions {
-                NCManageDatabase.shared.setAccountAutoUploadProperty("autoUploadBackground", state: false)
-                self.stopSignificantChangeUpdates()
-            }
-        }
-    }
-
-    // MARK: -
-
     @objc func initAutoUpload(viewController: UIViewController?, completion: @escaping (_ items: Int) -> Void) {
         if let activeAccount = NCManageDatabase.shared.getActiveAccount() {
             if activeAccount.autoUpload {
@@ -108,19 +47,9 @@ class NCAutoUpload: NSObject, CLLocationManagerDelegate {
                             }
                             completion(items)
                         }
-                        if activeAccount.autoUploadBackground {
-                            NCAskAuthorization.shared.askAuthorizationLocationManager { hasFullPermissions in
-                                if hasFullPermissions {
-                                    self.startSignificantChangeUpdates()
-                                } else {
-                                    NCManageDatabase.shared.setAccountAutoUploadProperty("autoUploadBackground", state: false)
-                                    self.stopSignificantChangeUpdates()
-                                }
-                            }
-                        }
+
                     } else {
                         NCManageDatabase.shared.setAccountAutoUploadProperty("autoUpload", state: false)
-                        self.stopSignificantChangeUpdates()
                         completion(0)
                     }
                 }
@@ -128,7 +57,6 @@ class NCAutoUpload: NSObject, CLLocationManagerDelegate {
                 completion(0)
             }
         } else {
-            stopSignificantChangeUpdates()
             completion(0)
         }
     }
@@ -241,7 +169,6 @@ class NCAutoUpload: NSObject, CLLocationManagerDelegate {
                         metadataForUpload.assetLocalIdentifier = asset.localIdentifier
                         metadataForUpload.session = session
                         metadataForUpload.sessionSelector = selector
-                        metadataForUpload.size = NCUtilityFileSystem.shared.getFileSize(asset: asset)
                         metadataForUpload.status = NCGlobal.shared.metadataStatusWaitUpload
                         if assetMediaType == PHAssetMediaType.video {
                             metadataForUpload.classFile = NCCommunicationCommon.typeClassFile.video.rawValue

+ 17 - 6
iOSClient/Networking/NCNetworking.swift

@@ -413,10 +413,22 @@ import Queuer
     @objc func upload(metadata: tableMetadata, start: @escaping () -> Void, completion: @escaping (_ errorCode: Int, _ errorDescription: String) -> Void) {
         
         func uploadMetadata(_ metadata: tableMetadata) {
-            
+
+            // DETECT IF CHUNCK
+            let chunckSize = CCUtility.getChunkSize() * 1000000
+            if metadata.size > chunckSize {
+                metadata.chunk = true
+                metadata.session = NCCommunicationCommon.shared.sessionIdentifierUpload
+            }
+
+            // DETECT IF E2EE
+            if CCUtility.isFolderEncrypted(metadata.serverUrl, e2eEncrypted: metadata.e2eEncrypted, account: metadata.account, urlBase: metadata.urlBase) {
+                metadata.e2eEncrypted = true
+            }
+
             NCManageDatabase.shared.addMetadata(metadata)
             let metadata = tableMetadata.init(value: metadata)
-            
+
             if metadata.e2eEncrypted {
 #if !EXTENSION_FILE_PROVIDER_EXTENSION
                 NCNetworkingE2EE.shared.upload(metadata: metadata, start: start) { errorCode, errorDescription in
@@ -448,7 +460,7 @@ import Queuer
         
         let metadata = tableMetadata.init(value: metadata)
 
-        if CCUtility.fileProviderStorageExists(metadata) {
+        if metadata.assetLocalIdentifier.isEmpty {
 
             let fileNameLocalPath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)!
             let results = NCCommunicationCommon.shared.getInternalType(fileName: metadata.fileNameView, mimeType: metadata.contentType, directory: false)
@@ -467,7 +479,7 @@ import Queuer
 
         } else {
 
-            CCUtility.extractImageVideoFromAssetLocalIdentifier(forUpload: metadata, notification: true) { extractMetadata, fileNamePath in
+            CCUtility.extractImageVideoFromAssetLocalIdentifier(forUpload: metadata) { extractMetadata, fileNamePath in
 
                 guard let metadata = extractMetadata else {
                     NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", metadata.ocId))
@@ -577,7 +589,6 @@ import Queuer
         }
 
         guard let metadata = NCManageDatabase.shared.getMetadataFromOcId(description) else { return }
-        guard let tableAccount = NCManageDatabase.shared.getAccount(predicate: NSPredicate(format: "account == %@", metadata.account)) else { return }
         let ocIdTemp = metadata.ocId
         var errorDescription = errorDescription
 
@@ -601,7 +612,7 @@ import Queuer
             metadata.status = NCGlobal.shared.metadataStatusNormal
 
             // Delete Asset on Photos album
-            if tableAccount.autoUploadDeleteAssetLocalIdentifier && metadata.assetLocalIdentifier != "" && metadata.sessionSelector == NCGlobal.shared.selectorUploadAutoUpload {
+            if CCUtility.getRemovePhotoCameraRoll() && !metadata.assetLocalIdentifier.isEmpty {
                 metadata.deleteAssetLocalIdentifier = true
             }
 

+ 6 - 0
iOSClient/Networking/NCNetworkingChunkedUpload.swift

@@ -149,6 +149,7 @@ extension NCNetworking {
                         if errorCode == 0 {
 
                             let serverUrl = metadata.serverUrl
+                            let assetLocalIdentifier = metadata.assetLocalIdentifier
 
                             NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", metadata.ocId))
                             NCManageDatabase.shared.deleteChunks(account: metadata.account, ocId: metadata.ocId)
@@ -158,6 +159,11 @@ extension NCNetworking {
 
                                 if errorCode == 0, let metadata = metadata {
 
+                                    metadata.assetLocalIdentifier = assetLocalIdentifier
+                                    // Delete Asset on Photos album
+                                    if CCUtility.getRemovePhotoCameraRoll() && !metadata.assetLocalIdentifier.isEmpty {
+                                        metadata.deleteAssetLocalIdentifier = true
+                                    }
                                     NCManageDatabase.shared.addMetadata(metadata)
                                     NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSource, userInfo: ["serverUrl": serverUrl])
 

+ 4 - 19
iOSClient/Networking/NCNetworkingProcessUpload.swift

@@ -160,11 +160,9 @@ class NCNetworkingProcessUpload: NSObject {
                 }
             }
              
-            
-            
             // verify delete Asset Local Identifiers in auto upload (DELETE Photos album)
             if (counterUpload == 0 && !self.appDelegate.isPasscodePresented()) {
-                self.deleteAssetLocalIdentifiers(account: self.appDelegate.account, sessionSelector: NCGlobal.shared.selectorUploadAutoUpload) {
+                self.deleteAssetLocalIdentifiers(account: self.appDelegate.account) {
                     self.startTimer()
                 }
             } else {
@@ -173,7 +171,7 @@ class NCNetworkingProcessUpload: NSObject {
         }
     }
 
-    private func deleteAssetLocalIdentifiers(account: String, sessionSelector: String, completition: @escaping () -> Void) {
+    private func deleteAssetLocalIdentifiers(account: String, completition: @escaping () -> Void) {
 
         if UIApplication.shared.applicationState != .active {
             completition()
@@ -184,7 +182,7 @@ class NCNetworkingProcessUpload: NSObject {
             completition()
             return
         }
-        let localIdentifiers = NCManageDatabase.shared.getAssetLocalIdentifiersUploaded(account: account, sessionSelector: sessionSelector)
+        let localIdentifiers = NCManageDatabase.shared.getAssetLocalIdentifiersUploaded(account: account)
         if localIdentifiers.isEmpty {
             completition()
             return
@@ -215,20 +213,7 @@ class NCNetworkingProcessUpload: NSObject {
                 }
             }
 
-            // E2EE
-            if CCUtility.isFolderEncrypted(metadata.serverUrl, e2eEncrypted: metadata.e2eEncrypted, account: metadata.account, urlBase: metadata.urlBase) {
-                metadata.e2eEncrypted = true
-            }
-
-            // CHUNCK
-            let chunckSize = CCUtility.getChunkSize() * 1000000
-            if chunckSize == 0 || metadata.size <= chunckSize {
-                metadatasForUpload.append(metadata)
-            } else {
-                metadata.chunk = true
-                metadata.session = NCCommunicationCommon.shared.sessionIdentifierUpload
-                metadatasForUpload.append(tableMetadata.init(value: metadata))
-            }
+            metadatasForUpload.append(metadata)
         }
 
         NCManageDatabase.shared.addMetadatas(metadatasForUpload)

+ 15 - 2
iOSClient/Settings/CCAdvanced.m

@@ -54,11 +54,11 @@
     [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"];
     [section addFormRow:row];
     
-    // Format Compatibility + Live Photo
+    // Format Compatibility + Live Photo + Delete asset
     
     section = [XLFormSectionDescriptor formSection];
     [form addFormSection:section];
-    section.footerTitle = [NSString stringWithFormat:@"%@\n%@", NSLocalizedString(@"_format_compatibility_footer_", nil), NSLocalizedString(@"_upload_mov_livephoto_footer_", nil)];
+    section.footerTitle = [NSString stringWithFormat:@"%@\n%@\n%@", NSLocalizedString(@"_format_compatibility_footer_", nil), NSLocalizedString(@"_upload_mov_livephoto_footer_", nil), NSLocalizedString(@"_remove_photo_CameraRoll_desc_", nil)];
 
     row = [XLFormRowDescriptor formRowDescriptorWithTag:@"formatCompatibility" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_format_compatibility_", nil)];
     row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground;
@@ -75,6 +75,14 @@
     [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
     [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"];
     [section addFormRow:row];
+
+    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"removePhotoCameraRoll" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_remove_photo_CameraRoll_", nil)];
+    row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground;
+    if ([CCUtility getRemovePhotoCameraRoll]) row.value = @"1";
+    else row.value = @0;
+    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
+    [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"];
+    [section addFormRow:row];
     
     // Disable Local Cache After Upload
     
@@ -351,6 +359,11 @@
         
         [CCUtility setLivePhoto:[[rowDescriptor.value valueData] boolValue]];
     }
+
+    if ([rowDescriptor.tag isEqualToString:@"removePhotoCameraRoll"]) {
+
+        [CCUtility setRemovePhotoCameraRoll:[[rowDescriptor.value valueData] boolValue]];
+    }
     
     if ([rowDescriptor.tag isEqualToString:@"disableLocalCacheAfterUpload"]) {
         

+ 3 - 88
iOSClient/Settings/CCManageAutoUpload.m

@@ -118,34 +118,6 @@
     [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"];
     [section addFormRow:row];
     
-    // Delete asset
-    
-    section = [XLFormSectionDescriptor formSection];
-    [form addFormSection:section];
-    
-    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"removePhotoCameraRoll" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_remove_photo_CameraRoll_", nil)];
-    row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground;
-    row.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"];
-    if (activeAccount.autoUploadDeleteAssetLocalIdentifier) row.value = @1;
-    else row.value = @0;
-    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
-    [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"];
-    [section addFormRow:row];
-    
-    // Auto Upload Background
-    
-    section = [XLFormSectionDescriptor formSection];
-    [form addFormSection:section];
-
-    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"autoUploadBackground" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_autoupload_background_", nil)];
-    row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground;
-    row.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"];
-    if (activeAccount.autoUploadBackground) row.value = @1;
-    else row.value = @0;
-    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
-    [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"];
-    [section addFormRow:row];
-    
     // Auto Upload Full
     section = [XLFormSectionDescriptor formSection];
     [form addFormSection:section];
@@ -267,41 +239,6 @@
         
         [self reloadForm];
     }
-    
-    if ([rowDescriptor.tag isEqualToString:@"removePhotoCameraRoll"]) {
-        
-        [[NCManageDatabase shared] setAccountAutoUploadProperty:@"autoUploadDeleteAssetLocalIdentifier" state:[[rowDescriptor.value valueData] boolValue]];
-    }
-    
-    if ([rowDescriptor.tag isEqualToString:@"autoUploadBackground"]) {
-        
-        if ([[rowDescriptor.value valueData] boolValue] == YES) {
-                        
-            [[NCAskAuthorization shared]  askAuthorizationLocationManagerWithCompletion: ^(BOOL hasFullPermissions) {
-                
-                if (hasFullPermissions == YES) {
-                    
-                    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"_autoupload_background_title_", nil) message:NSLocalizedString(@"_autoupload_background_msg_", nil) preferredStyle:UIAlertControllerStyleAlert];
-                    UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"_ok_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {}];
-                    
-                    [alertController addAction:okAction];
-                    [self presentViewController:alertController animated:YES completion:nil];
-                    
-                    [[NCManageDatabase shared] setAccountAutoUploadProperty:@"autoUploadBackground" state:YES];
-                    [[NCAutoUpload shared] startSignificantChangeUpdates];
-                        
-                } else {
-                     
-                    [self reloadForm];
-                }
-            }];
-            
-        } else {
-            
-            [[NCManageDatabase shared] setAccountAutoUploadProperty:@"autoUploadBackground" state:NO];
-            [[NCAutoUpload shared] stopSignificantChangeUpdates];
-        }
-    }
 
     if ([rowDescriptor.tag isEqualToString:@"autoUploadFull"]) {
         
@@ -367,11 +304,7 @@
     
     XLFormRowDescriptor *rowAutoUploadVideo = [self.form formRowWithTag:@"autoUploadVideo"];
     XLFormRowDescriptor *rowAutoUploadWWAnVideo = [self.form formRowWithTag:@"autoUploadWWAnVideo"];
-    
-    XLFormRowDescriptor *rowRemovePhotoCameraRoll = [self.form formRowWithTag:@"removePhotoCameraRoll"];
 
-    XLFormRowDescriptor *rowAutoUploadBackground = [self.form formRowWithTag:@"autoUploadBackground"];
-    
     XLFormRowDescriptor *rowAutoUploadFull = [self.form formRowWithTag:@"autoUploadFull"];
     
     XLFormRowDescriptor *rowAutoUploadCreateSubfolder = [self.form formRowWithTag:@"autoUploadCreateSubfolder"];
@@ -395,13 +328,7 @@
     
     if (activeAccount.autoUploadWWAnVideo)
         [rowAutoUploadWWAnVideo setValue:@1]; else [rowAutoUploadWWAnVideo setValue:@0];
-    
-    if (activeAccount.autoUploadDeleteAssetLocalIdentifier)
-           [rowRemovePhotoCameraRoll setValue:@1]; else [rowRemovePhotoCameraRoll setValue:@0];
-    
-    if (activeAccount.autoUploadBackground)
-        [rowAutoUploadBackground setValue:@1]; else [rowAutoUploadBackground setValue:@0];
-    
+
     if (activeAccount.autoUploadFull)
         [rowAutoUploadFull setValue:@1]; else [rowAutoUploadFull setValue:@0];
     
@@ -415,11 +342,7 @@
     
     rowAutoUploadVideo.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"];
     rowAutoUploadWWAnVideo.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"];
-    
-    rowRemovePhotoCameraRoll.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"];
 
-    rowAutoUploadBackground.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"];
-    
     rowAutoUploadFull.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"];
     
     rowAutoUploadCreateSubfolder.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"];
@@ -453,22 +376,14 @@
             else sectionName = @"";
             break;
         case 4:
-            if (activeAccount.autoUpload) sectionName = NSLocalizedString(@"_remove_photo_CameraRoll_desc_", nil);
-            else sectionName = @"";
-            break;
-        case 5:
-            if (activeAccount.autoUpload) sectionName = NSLocalizedString(@"_autoupload_description_background_", nil);
-            else sectionName = @"";
-            break;
-        case 6:
             if (activeAccount.autoUpload) sectionName =  NSLocalizedString(@"_autoupload_fullphotos_footer_", nil);
             else sectionName = @"";
             break;
-        case 7:
+        case 5:
             if (activeAccount.autoUpload) sectionName =  NSLocalizedString(@"_autoupload_create_subfolder_footer_", nil);
             else sectionName = @"";
             break;
-        case 8:
+        case 6:
             if (activeAccount.autoUpload) sectionName =  NSLocalizedString(@"_autoupload_filenamemask_footer_", nil);
             else sectionName = @"";
             break;

+ 1 - 1
iOSClient/Supporting Files/en.lproj/Localizable.strings

@@ -442,7 +442,7 @@
 "_error_createsubfolders_upload_"           = "Error creating subfolders";
 "_activate_autoupload_"                     = "Enable auto upload";
 "_remove_photo_CameraRoll_"                 = "Remove from camera roll";
-"_remove_photo_CameraRoll_desc_"            = "After successful automatic uploads, a confirmation message will be displayed to delete the uploaded photos or videos from the camera roll. The deleted photos or videos will still be available in the iOS Photos Trash for 30 days.";
+"_remove_photo_CameraRoll_desc_"            = "\"Remove from camera roll\" after uploads, a confirmation message will be displayed to delete the uploaded photos or videos from the camera roll. The deleted photos or videos will still be available in the iOS Photos Trash for 30 days.";
 "_never_"                       = "never";
 "_less_a_minute_"               = "less than a minute ago";
 "_a_minute_ago_"                = "a minute ago";

+ 4 - 1
iOSClient/Utility/CCUtility.h

@@ -183,6 +183,9 @@
 + (BOOL)getPrivacyScreenEnabled;
 + (void)setPrivacyScreenEnabled:(BOOL)set;
 
++ (BOOL)getRemovePhotoCameraRoll;
++ (void)setRemovePhotoCameraRoll:(BOOL)set;
+
 // ===== Varius =====
 
 + (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL;
@@ -240,7 +243,7 @@
 
 + (NSString *)getMimeType:(NSString *)fileNameView;
 
-+ (void)extractImageVideoFromAssetLocalIdentifierForUpload:(tableMetadata *)metadataForUpload notification:(BOOL)notification completion:(void(^)(tableMetadata *newMetadata, NSString* fileNamePath))completion;
++ (void)extractImageVideoFromAssetLocalIdentifierForUpload:(tableMetadata *)metadataForUpload completion:(void(^)(tableMetadata *newMetadata, NSString* fileNamePath))completion;
 + (void)extractLivePhotoAsset:(PHAsset*)asset filePath:(NSString *)filePath withCompletion:(void (^)(NSURL* url))completion;
 
 // ===== E2E Encrypted =====

+ 15 - 21
iOSClient/Utility/CCUtility.m

@@ -734,6 +734,17 @@
     [UICKeyChainStore setString:sSet forKey:@"privacyScreen" service:NCGlobal.shared.serviceShareKeyChain];
 }
 
++ (BOOL)getRemovePhotoCameraRoll
+{
+    return [[UICKeyChainStore stringForKey:@"removePhotoCameraRoll" service:NCGlobal.shared.serviceShareKeyChain] boolValue];
+}
+
++ (void)setRemovePhotoCameraRoll:(BOOL)set
+{
+    NSString *sSet = (set) ? @"true" : @"false";
+    [UICKeyChainStore setString:sSet forKey:@"removePhotoCameraRoll" service:NCGlobal.shared.serviceShareKeyChain];
+}
+
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ===== Various =====
 #pragma --------------------------------------------------------------------------------------------
@@ -1332,7 +1343,7 @@
     return path;
 }
 
-+ (void)extractImageVideoFromAssetLocalIdentifierForUpload:(tableMetadata *)metadataForUpload notification:(BOOL)notification completion:(void(^)(tableMetadata *metadata, NSString* fileNamePath))completion
++ (void)extractImageVideoFromAssetLocalIdentifierForUpload:(tableMetadata *)metadataForUpload completion:(void(^)(tableMetadata *metadata, NSString* fileNamePath))completion
 {
     if (metadataForUpload == nil) {
         return completion(nil, nil);
@@ -1342,10 +1353,6 @@
     
     PHFetchResult *result = [PHAsset fetchAssetsWithLocalIdentifiers:@[metadata.assetLocalIdentifier] options:nil];
     if (!result.count) {
-        if (notification) {
-            [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:NCGlobal.shared.notificationCenterUploadedFile object:nil userInfo:@{@"ocId": metadata.ocId, @"errorCode": @(NCGlobal.shared.errorInternalError), @"errorDescription": @"_err_file_not_found_"}];
-        }
-        
         return completion(nil, nil);
     }
     
@@ -1367,10 +1374,7 @@
                 NSLog(@"cacheAsset: %f", progress);
                 
                 if (error) {
-                    if (notification) {
-                        [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:NCGlobal.shared.notificationCenterUploadedFile object:nil userInfo:@{@"ocId": metadata.ocId, @"errorCode": @(error.code), @"errorDescription": [NSString stringWithFormat:@"Image request iCloud failed [%@]", error.description]}];
-                    }
-                    
+                    [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:NCGlobal.shared.notificationCenterUploadedFile object:nil userInfo:@{@"ocId": metadata.ocId, @"errorCode": @(error.code), @"errorDescription": [NSString stringWithFormat:@"Image request iCloud failed [%@]", error.description]}];
                     return completion(nil, nil);
                 }
             };
@@ -1432,10 +1436,7 @@
                 NSLog(@"cacheAsset: %f", progress);
                 
                 if (error) {
-                    if (notification) {
-                        [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:NCGlobal.shared.notificationCenterUploadedFile object:nil userInfo:@{@"ocId": metadata.ocId, @"errorCode": @(error.code), @"errorDescription": [NSString stringWithFormat:@"Video request iCloud failed [%@]", error.description]}];
-                    }
-                    
+                    [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:NCGlobal.shared.notificationCenterUploadedFile object:nil userInfo:@{@"ocId": metadata.ocId, @"errorCode": @(error.code), @"errorDescription": [NSString stringWithFormat:@"Video request iCloud failed [%@]", error.description]}];
                     completion(nil, nil);
                 }
             };
@@ -1456,19 +1457,12 @@
                     dispatch_async(dispatch_get_main_queue(), ^{
                         
                         if (error) {
-                            
-                            if (notification) {
-                                [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:NCGlobal.shared.notificationCenterUploadedFile object:nil userInfo:@{@"ocId": metadata.ocId, @"errorCode": @(error.code), @"errorDescription": [NSString stringWithFormat:@"Video request iCloud failed [%@]", error.description]}];
-                            }
-                            
+                            [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:NCGlobal.shared.notificationCenterUploadedFile object:nil userInfo:@{@"ocId": metadata.ocId, @"errorCode": @(error.code), @"errorDescription": [NSString stringWithFormat:@"Video request iCloud failed [%@]", error.description]}];
                             completion(nil, nil);
-                            
                         } else {
-                            
                             metadata.creationDate = creationDate;
                             metadata.date = modificationDate;
                             metadata.size = [[NCUtilityFileSystem shared] getFileSizeWithFilePath:fileNamePath];
-                            
                             completion(metadata, fileNamePath);
                         }
                     });

+ 0 - 29
iOSClient/Utility/NCAskAuthorization.swift

@@ -107,33 +107,4 @@ class NCAskAuthorization: NSObject {
             break
         }
     }
-
-    @objc func askAuthorizationLocationManager(completion: @escaping (_ hasFullPermissions: Bool) -> Void) {
-
-        switch CLLocationManager.authorizationStatus() {
-        case CLAuthorizationStatus.authorizedAlways:
-            completion(true)
-            break
-        /*
-        case CLAuthorizationStatus.authorizedWhenInUse, CLAuthorizationStatus.denied, CLAuthorizationStatus.restricted:
-            DispatchQueue.main.async {
-                NCAutoUpload.shared.startSignificantChangeUpdates()
-            }
-            completion(false)
-            break
-        case CLAuthorizationStatus.notDetermined:
-            DispatchQueue.main.async {
-                NCAutoUpload.shared.startSignificantChangeUpdates()
-            }
-            completion(false)
-            break
-        */
-        default:
-            DispatchQueue.main.async {
-                NCAutoUpload.shared.startSignificantChangeUpdates()
-            }
-            completion(false)
-            break
-        }
-    }
 }

+ 0 - 14
iOSClient/Utility/NCUtilityFileSystem.swift

@@ -32,20 +32,6 @@ class NCUtilityFileSystem: NSObject {
 
     let fileManager = FileManager.default
 
-    @objc func getFileSize(asset: PHAsset) -> Int64 {
-
-        let resources = PHAssetResource.assetResources(for: asset)
-
-        if let resource = resources.first {
-            if resource.responds(to: #selector(NSDictionary.fileSize)) {
-                let unsignedInt64 = resource.value(forKey: "fileSize") as! CLong
-                return Int64(bitPattern: UInt64(unsignedInt64))
-            }
-        }
-
-        return 0
-    }
-
     @objc func getFileSize(filePath: String) -> Int64 {
 
         do {