瀏覽代碼

Upload ALL camera

Marino Faggiana 8 年之前
父節點
當前提交
e6f12bc476
共有 3 個文件被更改,包括 28 次插入20 次删除
  1. 3 2
      iOSClient/AppDelegate.m
  2. 24 17
      iOSClient/PhotosCameraUpload/CCPhotosCameraUpload.m
  3. 1 1
      iOSClient/en.lproj/Localizable.strings

+ 3 - 2
iOSClient/AppDelegate.m

@@ -1240,7 +1240,7 @@
     [CCCoreData setCameraUploadFullPhotosActiveAccount:NO activeAccount:app.activeAccount];
     
     // Update icon badge number
-    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 3.0 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
         [self updateApplicationIconBadgeNumber];
     });
 }
@@ -1250,7 +1250,8 @@
 #pragma --------------------------------------------------------------------------------------------
 
 #ifdef CC
-- (void)sessionDidReceiveAuthorizationFailure:(DBSession*)session userId:(NSString *)userId {
+- (void)sessionDidReceiveAuthorizationFailure:(DBSession*)session userId:(NSString *)userId
+{
     
     [[NSNotificationCenter defaultCenter] postNotificationName:@"messageLoginIncorrect" object:nil];
 }

+ 24 - 17
iOSClient/PhotosCameraUpload/CCPhotosCameraUpload.m

@@ -1133,8 +1133,12 @@
     [[UIApplication sharedApplication] setIdleTimerDisabled: YES];
         
     if (!_hud) _hud = [[CCHud alloc] initWithView:[[[UIApplication sharedApplication] delegate] window]];
-    [_hud visibleHudTitle:NSLocalizedString(@"_create_full_upload_", nil) mode:MBProgressHUDModeIndeterminate color:nil];
-        
+    
+    if (assetsFull)
+        [_hud visibleHudTitle:NSLocalizedString(@"_create_full_upload_", nil) mode:MBProgressHUDModeIndeterminate color:nil];
+    else
+        [_hud visibleHudTitle:nil mode:MBProgressHUDModeIndeterminate color:nil];
+    
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.01 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) {
         
         if (assetsFull)
@@ -1163,7 +1167,7 @@
     BOOL createSubfolders = [CCCoreData getCameraUploadCreateSubfolderActiveAccount:app.activeAccount];
     
     for (ALAsset *asset in newItemsToUpload) {
-            
+        
         NSURL *url = [asset valueForProperty:@"ALAssetPropertyAssetURL"];
         PHFetchResult *fetchResult = [PHAsset fetchAssetsWithALAssetURLs:@[url] options:nil];
         PHAsset *asset = [fetchResult firstObject];
@@ -1192,7 +1196,7 @@
             
             if(![self createFolder:[NSString stringWithFormat:@"%@/%@", folderCameraUpload, dateSubFolder]]) {
                 
-                [_hud hideHud];
+                [self endLoadingAssets];
                 
                 if (assetsFull) {
                     
@@ -1201,12 +1205,6 @@
                     [app dropCameraUploadAllPhoto];
                 }
                 
-                // Enable idle timer
-                [[UIApplication sharedApplication] setIdleTimerDisabled:NO];
-
-                // START new request : initStateCameraUpload
-                _AutomaticCameraUploadInProgress = NO;
-                
                 return;
             }
         }
@@ -1272,16 +1270,11 @@
         [app addNetworkingOperationQueue:queue delegate:app.activeMain metadataNet:metadataNet oneByOne:YES];
     }
     
-    [_hud hideHud];
-    
-    // Enable idle timer
-    [[UIApplication sharedApplication] setIdleTimerDisabled:NO];
+    // end loading
+    [self endLoadingAssets];
     
     // Update icon badge number
     [app updateApplicationIconBadgeNumber];
-    
-    // START new request : initStateCameraUpload
-    _AutomaticCameraUploadInProgress = NO;
 }
 
 - (BOOL)createFolder:(NSString *)folderPathName
@@ -1319,4 +1312,18 @@
     return NO;
 }
 
+-(void)endLoadingAssets
+{
+    [_hud hideHud];
+    
+    // START new request : initStateCameraUpload
+    _AutomaticCameraUploadInProgress = NO;
+    
+    // Enable idle timer
+    [[UIApplication sharedApplication] setIdleTimerDisabled:NO];
+
+    // START new request : initStateCameraUpload
+    _AutomaticCameraUploadInProgress = NO;
+}
+
 @end

+ 1 - 1
iOSClient/en.lproj/Localizable.strings

@@ -217,7 +217,7 @@
 "_processing_send_camera_upload_"           = "Uploading camera photo ...";
 "_select_only_localfile_"                   = "File not downloaded yet";
 "_tutorial_photo_view_"                     = "No photos or videos loaded";
-"_create_full_upload_"                      = "Creating archive ...";
+"_create_full_upload_"                      = "Creating archive .. may take a long time, please wait";
 "_error_createsubfolders_upload_"           = "Error creating subfolders";
 
 // Template