Browse Source

download favorite

Marino Faggiana 8 years ago
parent
commit
c4fd3aab54
1 changed files with 24 additions and 2 deletions
  1. 24 2
      iOSClient/Offline/CCOfflinePageContent.m

+ 24 - 2
iOSClient/Offline/CCOfflinePageContent.m

@@ -219,7 +219,7 @@
 }
 
 #pragma --------------------------------------------------------------------------------------------
-#pragma mark ==== Download Thumbnail Delegate ====
+#pragma mark ==== Download Thumbnail <Delegate> ====
 #pragma --------------------------------------------------------------------------------------------
 
 - (void)downloadThumbnailSuccess:(CCMetadataNet *)metadataNet
@@ -229,6 +229,28 @@
         [self reloadDatasource];
 }
 
+#pragma --------------------------------------------------------------------------------------------
+#pragma mark ==== Download <Delegate> ====
+#pragma --------------------------------------------------------------------------------------------
+
+- (void)downloadFileFailure:(NSString *)fileID serverUrl:(NSString *)serverUrl selector:(NSString *)selector message:(NSString *)message errorCode:(NSInteger)errorCode
+{
+    [app updateApplicationIconBadgeNumber];
+
+    [app messageNotification:@"_download_file_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError];
+}
+
+- (void)downloadFileSuccess:(NSString *)fileID serverUrl:(NSString *)serverUrl selector:(NSString *)selector selectorPost:(NSString *)selectorPost
+{
+    _metadata = [CCCoreData getMetadataWithPreficate:[NSPredicate predicateWithFormat:@"(fileID == %@) AND (account == %@)", fileID, app.activeAccount] context:nil];
+    
+    // File exists
+    if ([self shouldPerformSegue])
+        [self performSegueWithIdentifier:@"segueDetail" sender:self];
+    
+    [app updateApplicationIconBadgeNumber];
+}
+
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ===== menu =====
 #pragma--------------------------------------------------------------------------------------------
@@ -632,7 +654,7 @@
         cell.statusImageView.image = [UIImage imageNamed:image_lock];
     
     // it's in download mode
-    if ([metadata.session length] > 0 && [metadata.session rangeOfString:@"download"].location != NSNotFound)
+    if ([metadata.session length] > 0 && [metadata.session containsString:@"download"])
         cell.statusImageView.image = [UIImage imageNamed:image_attention];
     
     // text and length