Эх сурвалжийг харах

Remove GPS

Signed-off-by: marinofaggiana <ios@nextcloud.com>
marinofaggiana 2 жил өмнө
parent
commit
7b1d2650d4

+ 2 - 2
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 = 10;
+				CURRENT_PROJECT_VERSION = 12;
 				DEVELOPMENT_TEAM = 6JLRKY9ZV7;
 				ENABLE_BITCODE = NO;
 				ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -3067,7 +3067,7 @@
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 10;
+				CURRENT_PROJECT_VERSION = 12;
 				DEVELOPMENT_TEAM = 6JLRKY9ZV7;
 				ENABLE_BITCODE = NO;
 				ENABLE_STRICT_OBJC_MSGSEND = YES;

+ 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/Brand/iOSClient.plist

@@ -117,8 +117,6 @@
 		<string>UIInterfaceOrientationLandscapeRight</string>
 		<string>UIInterfaceOrientationPortraitUpsideDown</string>
 	</array>
-	<key>UISupportsDocumentBrowser</key>
-	<true/>
 	<key>UIViewControllerBasedStatusBarAppearance</key>
 	<true/>
 	<key>UTExportedTypeDeclarations</key>

+ 0 - 1
iOSClient/Data/NCDatabase.swift

@@ -37,7 +37,6 @@ 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 = ""

+ 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               = 221
 
     // Intro selector
     //

+ 2 - 74
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)
         }
     }

+ 3 - 58
iOSClient/Settings/CCManageAutoUpload.m

@@ -132,20 +132,6 @@
     [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];
@@ -272,36 +258,6 @@
         
         [[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"]) {
         
@@ -370,8 +326,6 @@
     
     XLFormRowDescriptor *rowRemovePhotoCameraRoll = [self.form formRowWithTag:@"removePhotoCameraRoll"];
 
-    XLFormRowDescriptor *rowAutoUploadBackground = [self.form formRowWithTag:@"autoUploadBackground"];
-    
     XLFormRowDescriptor *rowAutoUploadFull = [self.form formRowWithTag:@"autoUploadFull"];
     
     XLFormRowDescriptor *rowAutoUploadCreateSubfolder = [self.form formRowWithTag:@"autoUploadCreateSubfolder"];
@@ -398,10 +352,7 @@
     
     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];
     
@@ -418,8 +369,6 @@
     
     rowRemovePhotoCameraRoll.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"];
 
-    rowAutoUploadBackground.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"];
-    
     rowAutoUploadFull.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"];
     
     rowAutoUploadCreateSubfolder.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"];
@@ -457,18 +406,14 @@
             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 6:
             if (activeAccount.autoUpload) sectionName =  NSLocalizedString(@"_autoupload_create_subfolder_footer_", nil);
             else sectionName = @"";
             break;
-        case 8:
+        case 7:
             if (activeAccount.autoUpload) sectionName =  NSLocalizedString(@"_autoupload_filenamemask_footer_", nil);
             else sectionName = @"";
             break;

+ 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
-        }
-    }
 }