|
|
@@ -9,10 +9,8 @@
|
|
|
#import "ContentPreviewController.h"
|
|
|
#import "PhotoPreviewCell.h"
|
|
|
#import "VideoPreviewCell.h"
|
|
|
-
|
|
|
-#import "iSalesDB.h"
|
|
|
#import "AppDelegate.h"
|
|
|
-
|
|
|
+#import "FileCache.h"
|
|
|
|
|
|
@interface ContentPreviewController ()<UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
|
|
|
|
|
|
@@ -355,7 +353,7 @@
|
|
|
if([item_json[@"is_localfile"] boolValue])
|
|
|
img_data = [NSData dataWithContentsOfFile:img_url];
|
|
|
else
|
|
|
- img_data = [iSalesDB load_cached_img:file_name loadFrom:img_url];
|
|
|
+ img_data = [FileCache load_cached_img:file_name loadFrom:img_url];
|
|
|
}
|
|
|
|
|
|
// 设置Image
|
|
|
@@ -371,7 +369,11 @@
|
|
|
else
|
|
|
{
|
|
|
NSData* downloadimg_data = nil;
|
|
|
- if (!appDelegate.offline_mode) {
|
|
|
+ BOOL offline_mode = NO;
|
|
|
+#ifdef OFFLINE_MODE
|
|
|
+ offline_mode = appDelegate.offline_mode;
|
|
|
+#endif
|
|
|
+ if (!offline_mode) {
|
|
|
downloadimg_data = [NSData dataWithContentsOfURL:[NSURL URLWithString:img_url]];
|
|
|
}
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
@@ -381,7 +383,7 @@
|
|
|
if(downloadimg_data!=nil)
|
|
|
{
|
|
|
|
|
|
- [iSalesDB cache_img:downloadimg_data filename:file_name saveTo:img_url];
|
|
|
+ [FileCache cache_img:downloadimg_data filename:file_name saveTo:img_url];
|
|
|
|
|
|
UIImage * img =[UIImage imageWithData:downloadimg_data];
|
|
|
[cell setPhoto:img];
|
|
|
@@ -405,8 +407,12 @@
|
|
|
|
|
|
- (IBAction)closeBtnClick:(UIButton *)sender {
|
|
|
|
|
|
- self.navigationController.navigationBarHidden = self.hideNavigationBar;
|
|
|
- [self.navigationController popViewControllerAnimated:YES];
|
|
|
+ if (self.navigationController) {
|
|
|
+ self.navigationController.navigationBarHidden = self.hideNavigationBar;
|
|
|
+ [self.navigationController popViewControllerAnimated:YES];
|
|
|
+ } else {
|
|
|
+ [self dismissViewControllerAnimated:YES completion:nil];
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|