Explorar el Código

1.下载缩略图进行中

huangxiaodong hace 1 año
padre
commit
7eb7944aef

+ 16 - 0
创维盒子/双子星云手机.xcodeproj/project.pbxproj

@@ -220,6 +220,10 @@
 		6B5D40302B4BCBC1000965CF /* downLoadPreViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B5D402E2B4BCBC1000965CF /* downLoadPreViewCell.m */; };
 		6B5D40332B4BE358000965CF /* downloadFileBottomView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B5D40312B4BE358000965CF /* downloadFileBottomView.h */; };
 		6B5D40342B4BE358000965CF /* downloadFileBottomView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B5D40322B4BE358000965CF /* downloadFileBottomView.m */; };
+		6B5D40372B4BEEF8000965CF /* downloadThumbnailManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B5D40352B4BEEF8000965CF /* downloadThumbnailManager.h */; };
+		6B5D40382B4BEEF8000965CF /* downloadThumbnailManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B5D40362B4BEEF8000965CF /* downloadThumbnailManager.m */; };
+		6B5D403B2B4BFEB9000965CF /* PlayerViewController+downloadThumbnailImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B5D40392B4BFEB9000965CF /* PlayerViewController+downloadThumbnailImage.h */; };
+		6B5D403C2B4BFEB9000965CF /* PlayerViewController+downloadThumbnailImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B5D403A2B4BFEB9000965CF /* PlayerViewController+downloadThumbnailImage.m */; };
 		6B72724B2B0AF59200C03F87 /* uploadFileRecordTableViewHeadView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B7272492B0AF59200C03F87 /* uploadFileRecordTableViewHeadView.h */; };
 		6B72724C2B0AF59200C03F87 /* uploadFileRecordTableViewHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B72724A2B0AF59200C03F87 /* uploadFileRecordTableViewHeadView.m */; };
 		6B72724F2B0B58E500C03F87 /* uploadFileRecordEditBottomView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B72724D2B0B58E500C03F87 /* uploadFileRecordEditBottomView.h */; };
@@ -641,6 +645,10 @@
 		6B5D402E2B4BCBC1000965CF /* downLoadPreViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = downLoadPreViewCell.m; sourceTree = "<group>"; };
 		6B5D40312B4BE358000965CF /* downloadFileBottomView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = downloadFileBottomView.h; sourceTree = "<group>"; };
 		6B5D40322B4BE358000965CF /* downloadFileBottomView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = downloadFileBottomView.m; sourceTree = "<group>"; };
+		6B5D40352B4BEEF8000965CF /* downloadThumbnailManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = downloadThumbnailManager.h; sourceTree = "<group>"; };
+		6B5D40362B4BEEF8000965CF /* downloadThumbnailManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = downloadThumbnailManager.m; sourceTree = "<group>"; };
+		6B5D40392B4BFEB9000965CF /* PlayerViewController+downloadThumbnailImage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "PlayerViewController+downloadThumbnailImage.h"; sourceTree = "<group>"; };
+		6B5D403A2B4BFEB9000965CF /* PlayerViewController+downloadThumbnailImage.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "PlayerViewController+downloadThumbnailImage.m"; sourceTree = "<group>"; };
 		6B7272492B0AF59200C03F87 /* uploadFileRecordTableViewHeadView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = uploadFileRecordTableViewHeadView.h; sourceTree = "<group>"; };
 		6B72724A2B0AF59200C03F87 /* uploadFileRecordTableViewHeadView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = uploadFileRecordTableViewHeadView.m; sourceTree = "<group>"; };
 		6B72724D2B0B58E500C03F87 /* uploadFileRecordEditBottomView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = uploadFileRecordEditBottomView.h; sourceTree = "<group>"; };
@@ -1131,6 +1139,8 @@
 				6B1FBD312B455DBD00926382 /* PlayerViewController+upLoadFile.m */,
 				6B1FBD342B455DD600926382 /* PlayerViewController+backupsFile.h */,
 				6B1FBD352B455DD600926382 /* PlayerViewController+backupsFile.m */,
+				6B5D40392B4BFEB9000965CF /* PlayerViewController+downloadThumbnailImage.h */,
+				6B5D403A2B4BFEB9000965CF /* PlayerViewController+downloadThumbnailImage.m */,
 				183AE6B12A8C9F5800B11CB0 /* View */,
 				183AE6A52A8C9EA900B11CB0 /* RCCommandHelp.h */,
 				183AE6A72A8C9EAA00B11CB0 /* RCCommandHelp.m */,
@@ -1348,6 +1358,8 @@
 				6B1FBD292B452B3800926382 /* backupsFileManager.m */,
 				6B0582832B0457C400D37290 /* uploadFileManager.h */,
 				6B0582842B0457C400D37290 /* uploadFileManager.m */,
+				6B5D40352B4BEEF8000965CF /* downloadThumbnailManager.h */,
+				6B5D40362B4BEEF8000965CF /* downloadThumbnailManager.m */,
 				6B7272512B0CABC600C03F87 /* cachesFileManager.h */,
 				6B7272522B0CABC600C03F87 /* cachesFileManager.m */,
 			);
@@ -1875,9 +1887,11 @@
 				184C8AD02A94980D00F26650 /* CustomerWebViewController.h in Headers */,
 				6BFF26992AFA16DA00FCB4F7 /* forgetSecretKeyViewController.h in Headers */,
 				6BFF26912AF9D88200FCB4F7 /* AuthCodeTextField.h in Headers */,
+				6B5D403B2B4BFEB9000965CF /* PlayerViewController+downloadThumbnailImage.h in Headers */,
 				184C8ADA2A949DAC00F26650 /* HaveNewVersionView.h in Headers */,
 				6BBB35DD2AE76AD800E4A59B /* AudioSessionObject.h in Headers */,
 				6B0582782AFF7C6D00D37290 /* TZAssetModel+imageData.h in Headers */,
+				6B5D40372B4BEEF8000965CF /* downloadThumbnailManager.h in Headers */,
 				6B0582802B01C67400D37290 /* uploadFileRecordViewController.h in Headers */,
 				183AE6D12A8CA98C00B11CB0 /* CloudPhoneAPI.h in Headers */,
 				1868201D2AB97BE1005702A6 /* TipsQRCodeViewController.h in Headers */,
@@ -2303,6 +2317,7 @@
 				183AE6D52A8CAFAE00B11CB0 /* UIView+View.m in Sources */,
 				6B5D40282B4BC402000965CF /* couldPhoneFileListModel.m in Sources */,
 				183AE64E2A8A2CF000B11CB0 /* AFNetworkActivityIndicatorManager.m in Sources */,
+				6B5D40382B4BEEF8000965CF /* downloadThumbnailManager.m in Sources */,
 				6B7272582B0DAF7600C03F87 /* couldPhoneBaseInfoModel.m in Sources */,
 				6B0581B32AFE02B100D37290 /* uploadFileBottomView.m in Sources */,
 				181E85012A8F6B1800292B96 /* LogoSelectView.m in Sources */,
@@ -2423,6 +2438,7 @@
 				6B0582812B01C67400D37290 /* uploadFileRecordViewController.m in Sources */,
 				A003F6A827D841C800715CBF /* BaseModel.m in Sources */,
 				A0295B1627EDA0EC009C5D8B /* HWHistoryModel.m in Sources */,
+				6B5D403C2B4BFEB9000965CF /* PlayerViewController+downloadThumbnailImage.m in Sources */,
 				183AE6B42A8CA00300B11CB0 /* PlayerView.m in Sources */,
 				A003F6F327D8593600715CBF /* HWToolBar.m in Sources */,
 				18FCE5382AD1351B0020F623 /* PlayerViewController.mm in Sources */,

+ 3 - 0
创维盒子/双子星云手机/AppDelegate/Config/Notification.h

@@ -76,6 +76,9 @@
 /*备份文件更新通知*/
 #define backupsFileRefreshNotification                 @"backupsFileRefreshNot"
 
+/* 下载缩略图通知*/
+#define downloadThumbnailBeginNotification                 @"downloadThumbnailBeginNot"
+
 /* 创建文件夹通知*/
 #define createFolderBeginNotification                 @"createFolderBeginNot"
 /* 创建文件夹通知*/

+ 11 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/downLoadFile/downLoadPreviewViewController.m

@@ -9,6 +9,7 @@
 #import "couldPhoneFileListModel.h"
 #import "downLoadPreViewCell.h"
 #import "downloadFileBottomView.h"
+#import "downloadThumbnailManager.h"
 
 @interface downLoadPreviewViewController ()<UITableViewDelegate,UITableViewDataSource>
 @property (nonatomic, strong) UITableView *tableView;
@@ -227,6 +228,16 @@
     _curCouldPhoneFileListMod = [[couldPhoneFileListModel alloc] initWithDictionary:dataDict error:nil];
     
     [self.tableView reloadData];
+    
+    [self gotoDownThumbnailManagerFun];
+}
+
+
+#pragma mark 去下载缩略图
+- (void)gotoDownThumbnailManagerFun
+{
+    [[downloadThumbnailManager shareInstance] handlToDownloadThumbnailWith:_curCouldPhoneFileListMod.data.list];
 }
 
+
 @end

+ 1 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/model/uploadFileDataModel.h

@@ -22,6 +22,7 @@ typedef enum{
     uploadFileTypeImage = 0,
     uploadFileTypeVideo,
     uploadFileTypeUnkonw,
+    DownLoadThumbnail,//下载缩略图
 }uploadFileType;
 
 //self.fileName = [assetModel.asset valueForKey:@"filename"];

+ 2 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileManager/cachesFileManager.h

@@ -13,6 +13,8 @@
 #define kSHPath_image [cachesFileManager getCreateFilePath:[NSString stringWithFormat:@"%@/Image",CachesPatch]]
 //视频路径
 #define kSHPath_video [cachesFileManager getCreateFilePath:[NSString stringWithFormat:@"%@/Video",CachesPatch]]
+//下载缩略图 图片 DownLoadThumbnail
+#define kSHPath_DownLoadThumbnail [cachesFileManager getCreateFilePath:[NSString stringWithFormat:@"%@/DownLoadThumbnail",CachesPatch]]
 
 NS_ASSUME_NONNULL_BEGIN
 

+ 15 - 1
创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileManager/cachesFileManager.m

@@ -70,6 +70,16 @@
         }
             break;
         
+        case DownLoadThumbnail://image
+        {
+            filePath = [NSString stringWithFormat:@"%@/%@",kSHPath_DownLoadThumbnail,fileName];
+            
+            if ([content isKindOfClass:[NSData class]]) {
+                data = content;
+            }
+        }
+            break;
+            
         default:
             break;
     }
@@ -113,7 +123,11 @@
             name = [NSString stringWithFormat:@"%@/%@",kSHPath_video,name];
         }
             break;
-
+        case DownLoadThumbnail://image
+        {
+            name = [NSString stringWithFormat:@"%@/%@",kSHPath_DownLoadThumbnail,name];
+        }
+            break;
         default:
             break;
     }

+ 26 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileManager/downloadThumbnailManager.h

@@ -0,0 +1,26 @@
+//
+//  downloadThumbnailManager.h
+//  隐私保护
+//
+//  Created by xd h on 2024/1/8.
+//
+
+#import <Foundation/Foundation.h>
+//#import "couldPhoneFileModel.h"
+#import "couldPhoneFileListModel.h"
+
+#define downloadThumbnail_tableName @"downloadThumbnail_tableName"
+//[[NSString alloc] initWithFormat:@"downloadThumbnail_tableName_%@",[connectDeviceManager shareInstance].DeviceThirdIdMod.data.sn]
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface downloadThumbnailManager : NSObject
++(downloadThumbnailManager *)shareInstance;
+
+@property(nonatomic,strong)NSMutableArray *totalTaskArr;
+@property(nonatomic,strong)couldPhoneFileModel *curDownloadFileModel;
+
+- (void)handlToDownloadThumbnailWith:(NSArray*)Arr;
+@end
+
+NS_ASSUME_NONNULL_END

+ 112 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileManager/downloadThumbnailManager.m

@@ -0,0 +1,112 @@
+//
+//  downloadThumbnailManager.m
+//  隐私保护
+//
+//  Created by xd h on 2024/1/8.
+//
+
+#import "downloadThumbnailManager.h"
+
+@implementation downloadThumbnailManager
+static downloadThumbnailManager * cur_downloadFileShareInstance = nil;
++(downloadThumbnailManager *)shareInstance;
+{
+    static dispatch_once_t onceToken;
+    
+    dispatch_once(&onceToken, ^{
+        cur_downloadFileShareInstance = [[downloadThumbnailManager alloc] init];
+        
+    });
+    
+    return cur_downloadFileShareInstance;
+}
+
+- (id)init
+{
+    self = [super init];
+    
+    if (self) {
+        //[self initManager];
+    }
+    
+    return self;
+}
+
+- (void)handlToDownloadThumbnailWith:(NSArray*)Arr
+{
+    KWeakSelf
+    //dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), ^{
+        [couldPhoneFileModel bg_findAsync:downloadThumbnail_tableName limit:0 orderBy:nil desc:NO complete:^(NSArray * _Nullable array) {
+            [weakSelf checkTaskRepeatWithHadTask:array withNewTask:Arr];
+        }];
+    //});
+}
+
+-(void)checkTaskRepeatWithHadTask:(NSArray*)hadTaskArr withNewTask:(NSArray*)newTaskArr
+{
+    NSMutableArray *curTaskArr = [NSMutableArray arrayWithArray:hadTaskArr];
+    
+    //for (couldPhoneFileModel *addModel in newTask)
+    
+    //倒序遍历
+    [newTaskArr enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
+        //NSLog(@"%ld----",idx);
+        
+        couldPhoneFileModel *addModel = newTaskArr[idx];
+        
+        NSString *newFileName =  [addModel getFileNameFun];
+        BOOL isNeedAdd = YES;
+        
+        for (couldPhoneFileModel *hadModel in hadTaskArr) {
+            NSString *hadFileName =  [addModel getFileNameFun];
+            
+            if([newFileName isEqualToString:hadFileName]){
+                isNeedAdd = NO;
+                break;
+            }
+        }
+        
+        [curTaskArr addObject:addModel];
+    }];
+   
+    
+    KWeakSelf
+    [couldPhoneFileModel bg_saveOrUpdateArrayAsync:curTaskArr complete:^(BOOL isSuccess) {
+        [weakSelf planToDownloadThumbnailFun];
+    }];
+}
+
+- (void)planToDownloadThumbnailFun
+{
+    KWeakSelf
+    [couldPhoneFileModel bg_findAsync:downloadThumbnail_tableName limit:0 orderBy:nil desc:NO complete:^(NSArray * _Nullable array) {
+        [weakSelf checkCouldPhoneFileModelTaskStateBy:array];
+    }];
+}
+
+- (void)checkCouldPhoneFileModelTaskStateBy:(NSArray*)array
+{
+    NSMutableArray *taskArr = [NSMutableArray new];
+    
+    for (couldPhoneFileModel*curModel in array) {
+        if(curModel.curDownloadStateType != downloadStateDone){
+            [taskArr addObject:curModel];
+        }
+    }
+    
+    _totalTaskArr = taskArr;
+}
+
+- (void)beginDownloadThumbnailFun
+{
+    if (_totalTaskArr.count >0) {
+        _curDownloadFileModel = _totalTaskArr.firstObject;
+    }
+    else{
+        return;
+    }
+    
+    [[NSNotificationCenter defaultCenter] postNotificationName:downloadThumbnailBeginNotification object:_curDownloadFileModel];
+}
+
+@end

+ 12 - 0
创维盒子/双子星云手机/CloudPlayer/Model/couldPhoneFileListModel.h

@@ -6,6 +6,7 @@
 //
 
 #import "SuperModel.h"
+#import "BGFMDB.h" //添加该头文件,本类就具有了存储功能.
 
 NS_ASSUME_NONNULL_BEGIN
 
@@ -24,6 +25,14 @@ NS_ASSUME_NONNULL_BEGIN
 //  }
 //}
 
+typedef enum{
+    downloadStateWait = 0,
+    downloadStateUploading,
+    downloadStateSuspend,
+    downloadStateFail,
+    downloadStateDone,//
+}downloadStateType;
+
 @interface couldPhoneFileModel : SuperModel
 @property (nonatomic, copy) NSString * fileType;
 @property (nonatomic, copy) NSString * path;
@@ -33,6 +42,9 @@ NS_ASSUME_NONNULL_BEGIN
 
 //自定义
 @property (nonatomic, assign) BOOL isSelectType;
+@property (nonatomic, assign) downloadStateType curDownloadStateType;
+
+- (NSString*)getFileNameFun;
 @end
 
 @protocol couldPhoneFileModel;

+ 4 - 1
创维盒子/双子星云手机/CloudPlayer/Model/couldPhoneFileListModel.m

@@ -8,7 +8,10 @@
 #import "couldPhoneFileListModel.h"
 
 @implementation couldPhoneFileModel
-
+- (NSString*)getFileNameFun
+{
+    return [[NSString alloc] initWithFormat:@"%ld_%@",self.length,self.name];
+}
 @end
 
 @implementation couldPhoneFileArrModel

+ 16 - 0
创维盒子/双子星云手机/CloudPlayer/PlayerViewController+downloadThumbnailImage.h

@@ -0,0 +1,16 @@
+//
+//  PlayerViewController+downloadThumbnailImage.h
+//  隐私保护
+//
+//  Created by xd h on 2024/1/8.
+//
+
+#import "PlayerViewController.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface PlayerViewController (downloadThumbnailImage)
+- (void)begindownloadThumbnailImageFun:(NSNotification *)notification;
+@end
+
+NS_ASSUME_NONNULL_END

+ 37 - 0
创维盒子/双子星云手机/CloudPlayer/PlayerViewController+downloadThumbnailImage.m

@@ -0,0 +1,37 @@
+//
+//  PlayerViewController+downloadThumbnailImage.m
+//  隐私保护
+//
+//  Created by xd h on 2024/1/8.
+//
+
+#import "PlayerViewController+downloadThumbnailImage.h"
+
+@implementation PlayerViewController (downloadThumbnailImage)
+- (void)begindownloadThumbnailImageFun:(NSNotification *)notification
+{
+    self.curDownloadThumbnailModel = [notification object];
+    
+    if(!self.curDownloadThumbnailModel
+       || ![self.curDownloadThumbnailModel isKindOfClass:[couldPhoneFileModel class]]){
+        return;
+    }
+    
+    [self ApplyDownloadThumbnailFun];
+}
+
+#pragma mark 申请下载缩略图
+- (void)ApplyDownloadThumbnailFun
+{
+    
+    self.downloadThumbnailTaskUid = [iTools getTaskUidStr];
+ 
+    
+    
+//    NSString * commandStr = [RCCommandHelp applyForBackupsFileBy:self.backupsTaskUid withFileName:self.backupsFileName withSavePath:backupsDefaultPath];
+//    
+//    
+//    [self.commandChannelManager rc_sendData:commandStr];
+}
+
+@end

+ 5 - 0
创维盒子/双子星云手机/CloudPlayer/PlayerViewController.h

@@ -23,6 +23,7 @@
 #import "backupsFileManager.h"
 #import "photosBackupsTaskModel.h"
 #import "AFNetworkReachabilityManager.h"
+#import "couldPhoneFileListModel.h"
 
 @protocol PlayerViewControllerDelegate <NSObject>
 
@@ -122,6 +123,10 @@
 //@property (nonatomic, assign) NSInteger cutFileEachPieceSzie;
 @property (nonatomic, strong) photosBackupsTaskModel *curPhotosBackupsTaskMod;
 
+//下载缩略图用到
+@property (nonatomic, copy) NSString * _Nullable downloadThumbnailTaskUid;
+@property (nonatomic, strong) couldPhoneFileModel *curDownloadThumbnailModel;
+
 
 /**
  * @brief 云手机类型  VIP星动云手机  SVIP星曜云手机  STAR 唔即云手机

+ 2 - 0
创维盒子/双子星云手机/CloudPlayer/PlayerViewController.mm

@@ -2314,6 +2314,8 @@ BOOL inReconnect = NO;
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getFolderListBeginNotFun:) name:getFolderListBeginNotification object:nil];
     
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(searchFileListBeginFun:) name:searchFileListBeginNotification object:nil];
+
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(begindownloadThumbnailImageFun:) name:downloadThumbnailBeginNotification object:nil];
 }
 
 - (void)removeNSNotification