Quellcode durchsuchen

coding

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana vor 2 Jahren
Ursprung
Commit
fc465209ed

+ 1 - 0
iOSClient/AppDelegate.swift

@@ -59,6 +59,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
     var networkingProcessUpload: NCNetworkingProcessUpload?
     var shares: [tableShare] = []
     var timerErrorNetworking: Timer?
+    var timerProcess: Timer?
 
     private var privacyProtectionWindow: UIWindow?
 

+ 6 - 6
iOSClient/Networking/NCNetworkingProcessUpload.swift

@@ -27,7 +27,7 @@ import Photos
 
 class NCNetworkingProcessUpload: NSObject {
 
-    var timerProcess: Timer?
+    let appDelegate = UIApplication.shared.delegate as? AppDelegate
 
     override init() {
         super.init()
@@ -35,18 +35,18 @@ class NCNetworkingProcessUpload: NSObject {
     }
 
     private func startProcess() {
-        if timerProcess?.isValid ?? false {
+        if appDelegate?.timerProcess?.isValid ?? false {
             DispatchQueue.main.async { self.process() }
         }
     }
 
     func startTimer() {
-        timerProcess?.invalidate()
-        timerProcess = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(process), userInfo: nil, repeats: true)
+        appDelegate?.timerProcess?.invalidate()
+        appDelegate?.timerProcess = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(process), userInfo: nil, repeats: true)
     }
 
     func stopTimer() {
-        timerProcess?.invalidate()
+        appDelegate?.timerProcess?.invalidate()
     }
 
     @objc private func process() {
@@ -137,7 +137,7 @@ class NCNetworkingProcessUpload: NSObject {
              
             // verify delete Asset Local Identifiers in auto upload (DELETE Photos album)
             DispatchQueue.main.async {
-                if UIApplication.shared.applicationState == .active && counterUpload == 0 && !(UIApplication.shared.delegate as! AppDelegate).isPasscodePresented() {
+                if counterUpload == 0 && !(UIApplication.shared.delegate as! AppDelegate).isPasscodePresented() {
                     self.deleteAssetLocalIdentifiers(account: account.account) {
                         self.startTimer()
                     }