|
@@ -1427,6 +1427,7 @@
|
|
|
- (void)loadAutoDownloadUpload:(NSNumber *)maxConcurrent
|
|
|
{
|
|
|
CCMetadataNet *metadataNet;
|
|
|
+ NSUInteger priority = 0; // All
|
|
|
|
|
|
// Stop Timer
|
|
|
[_timerProcessAutoDownloadUpload invalidate];
|
|
@@ -1439,6 +1440,10 @@
|
|
|
|
|
|
NSInteger counterNewUpload = 0;
|
|
|
|
|
|
+ // Priority
|
|
|
+ if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground)
|
|
|
+ priority = k_priorityAutoUploadError;
|
|
|
+
|
|
|
// ------------------------- <selector Auto Download> -------------------------
|
|
|
|
|
|
while (counterDownloadInSession < maxConcurrentDownloadUpload) {
|
|
@@ -1458,13 +1463,9 @@
|
|
|
|
|
|
while (counterUploadInSessionAndInLock < maxConcurrentDownloadUpload) {
|
|
|
|
|
|
- metadataNet = [[NCManageDatabase sharedInstance] getQueueUploadLockWithSelector:selectorUploadAutoUpload];
|
|
|
+ metadataNet = [[NCManageDatabase sharedInstance] getQueueUploadLockWithSelector:selectorUploadAutoUpload priority:priority];
|
|
|
if (metadataNet) {
|
|
|
|
|
|
- // Priority Error only in Foreground
|
|
|
- if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground && metadataNet.priority <= k_priorityAutoUploadError)
|
|
|
- continue;
|
|
|
-
|
|
|
[[CCNetworking sharedNetworking] uploadFileFromAssetLocalIdentifier:metadataNet delegate:_activeMain];
|
|
|
|
|
|
counterNewUpload++;
|
|
@@ -1490,13 +1491,9 @@
|
|
|
|
|
|
while (counterUploadInSessionAndInLock < maxConcurrentDownloadUpload) {
|
|
|
|
|
|
- metadataNet = [[NCManageDatabase sharedInstance] getQueueUploadLockWithSelector:selectorUploadAutoUploadAll];
|
|
|
+ metadataNet = [[NCManageDatabase sharedInstance] getQueueUploadLockWithSelector:selectorUploadAutoUploadAll priority:priority];
|
|
|
if (metadataNet) {
|
|
|
|
|
|
- // Priority Error only in Foreground
|
|
|
- if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground && metadataNet.priority <= k_priorityAutoUploadError)
|
|
|
- continue;
|
|
|
-
|
|
|
[[CCNetworking sharedNetworking] uploadFileFromAssetLocalIdentifier:metadataNet delegate:_activeMain];
|
|
|
|
|
|
counterNewUpload++;
|
|
@@ -1512,7 +1509,7 @@
|
|
|
|
|
|
if (counterUploadInSessionAndInLock < maxConcurrentDownloadUpload && counterUploadInLock < 1) {
|
|
|
|
|
|
- metadataNet = [[NCManageDatabase sharedInstance] getQueueUploadLockWithSelector:selectorUploadFile];
|
|
|
+ metadataNet = [[NCManageDatabase sharedInstance] getQueueUploadLockWithSelector:selectorUploadFile priority:priority];
|
|
|
if (metadataNet) {
|
|
|
|
|
|
[[CCNetworking sharedNetworking] uploadFileFromAssetLocalIdentifier:metadataNet delegate:_activeMain];
|