Browse Source

new Auto upload

marinofaggiana 4 years ago
parent
commit
f1232ed106

+ 1 - 1
iOSClient/AutoUpload/NCAutoUpload.swift

@@ -58,7 +58,7 @@ class NCManageLocation: NSObject, CLLocationManagerDelegate {
         return instance
     }()
     
-    var locationManager: CLLocationManager?
+    public var locationManager: CLLocationManager?
     @objc public var firstChangeAuthorizationDone: Bool = false
     
     @objc public func startSignificantChangeUpdates() {

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

@@ -843,6 +843,7 @@
 "_err_e2ee_app_version_"                = "Error: The version of app End-to-End encryption is not compatible, please update your server";
 "_err_permission_microphone_"           = "Please allow Microphone usage from Settings";
 "_err_permission_photolibrary_"         = "Please allow Photos - All Photos from Settings";
+"_err_permission_locationmanager_"      = "Please allow Location - Always from Settings";
 
 // QRCode
 

+ 13 - 0
iOSClient/Utility/NCAskAuthorization.swift

@@ -103,7 +103,20 @@ class NCAskAuthorization: NSObject {
         case CLAuthorizationStatus.authorizedAlways:
             completion(true)
             break
+        case CLAuthorizationStatus.authorizedWhenInUse, CLAuthorizationStatus.denied, CLAuthorizationStatus.restricted:
+            let alert = UIAlertController(title: NSLocalizedString("_error_", comment: ""), message: NSLocalizedString("_err_permission_locationmanager_", comment: ""), preferredStyle: .alert)
+            alert.addAction(UIAlertAction(title: NSLocalizedString("_open_settings_", comment: ""), style: .default, handler: { action in
+                UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!)
+                completion(false)
+            }))
+            alert.addAction(UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .cancel, handler: { action in
+                completion(false)
+            }))
+            viewController.present(alert, animated: true, completion: nil)
+            break
         case CLAuthorizationStatus.notDetermined:
+            NCManageLocation.shared.startSignificantChangeUpdates()
+            completion(false)
             break
         default:
             break