|
@@ -42,7 +42,6 @@ class NCNetworkingProcessUpload: NSObject {
|
|
|
}
|
|
|
|
|
|
func startTimer() {
|
|
|
- guard UIApplication.shared.applicationState == .active else { return }
|
|
|
timerProcess?.invalidate()
|
|
|
timerProcess = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(process), userInfo: nil, repeats: true)
|
|
|
}
|
|
@@ -52,9 +51,7 @@ class NCNetworkingProcessUpload: NSObject {
|
|
|
}
|
|
|
|
|
|
@objc private func process() {
|
|
|
- guard let account = NCManageDatabase.shared.getActiveAccount(), UIApplication.shared.applicationState == .active else {
|
|
|
- return
|
|
|
- }
|
|
|
+ guard let account = NCManageDatabase.shared.getActiveAccount() else { return }
|
|
|
|
|
|
stopTimer()
|
|
|
|
|
@@ -113,11 +110,7 @@ class NCNetworkingProcessUpload: NSObject {
|
|
|
NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", metadata.ocId))
|
|
|
}
|
|
|
for metadata in metadatas {
|
|
|
- #if !EXTENSION
|
|
|
if (metadata.e2eEncrypted || metadata.chunk) && UIApplication.shared.applicationState != .active { continue }
|
|
|
- #else
|
|
|
- if (metadata.e2eEncrypted || metadata.chunk) { continue }
|
|
|
- #endif
|
|
|
let isWiFi = NCNetworking.shared.networkReachability == NKCommon.typeReachability.reachableEthernetOrWiFi
|
|
|
if metadata.session == NCNetworking.shared.sessionIdentifierBackgroundWWan && !isWiFi { continue }
|
|
|
if let metadata = NCManageDatabase.shared.setMetadataStatus(ocId: metadata.ocId, status: NCGlobal.shared.metadataStatusInUpload) {
|
|
@@ -145,7 +138,6 @@ class NCNetworkingProcessUpload: NSObject {
|
|
|
}
|
|
|
|
|
|
// verify delete Asset Local Identifiers in auto upload (DELETE Photos album)
|
|
|
- #if !EXTENSION
|
|
|
DispatchQueue.main.async {
|
|
|
if (counterUpload == 0 && !(UIApplication.shared.delegate as! AppDelegate).isPasscodePresented()) {
|
|
|
self.deleteAssetLocalIdentifiers(account: account.account) {
|
|
@@ -155,11 +147,9 @@ class NCNetworkingProcessUpload: NSObject {
|
|
|
self.startTimer()
|
|
|
}
|
|
|
}
|
|
|
- #endif
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- #if !EXTENSION
|
|
|
private func deleteAssetLocalIdentifiers(account: String, completition: @escaping () -> Void) {
|
|
|
|
|
|
if UIApplication.shared.applicationState != .active {
|
|
@@ -187,7 +177,6 @@ class NCNetworkingProcessUpload: NSObject {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- #endif
|
|
|
|
|
|
// MARK: -
|
|
|
|