Browse Source

1.需求:app安装到TV --进行中

huangxiaodong 3 months ago
parent
commit
3e932141b0

+ 22 - 0
创维盒子/code/Assets.xcassets/Set/uploadFile_app.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "uploadFile_app@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "uploadFile_app@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
创维盒子/code/Assets.xcassets/Set/uploadFile_app.imageset/uploadFile_app@2x.png


BIN
创维盒子/code/Assets.xcassets/Set/uploadFile_app.imageset/uploadFile_app@3x.png


+ 3 - 0
创维盒子/code/Class/Set/uploadFile/downLoadFile/view/downLoadPreViewCell.h

@@ -9,6 +9,7 @@
 #import "couldPhoneFileListModel.h"
 #import "NASFileAudioModel.h"
 #import "NASFileAndFolderModel.h"
+#import "getInstalledAppListModel.h"
 NS_ASSUME_NONNULL_BEGIN
 
 @interface downLoadPreViewCell : UITableViewCell
@@ -28,6 +29,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property(nonatomic,strong) NASFileAndFolderDataModel*curNASFileAndFolderDataModel;
 
+@property(nonatomic,strong) getInstalledAppModel*curGetInstalledAppMod;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 67 - 0
创维盒子/code/Class/Set/uploadFile/downLoadFile/view/downLoadPreViewCell.m

@@ -383,4 +383,71 @@
     
     titleLabel.attributedText = noteStr;
 }
+
+
+- (void)setCurGetInstalledAppMod:(getInstalledAppModel *)curGetInstalledAppMod
+{
+    _curGetInstalledAppMod = curGetInstalledAppMod;
+    
+    checkButton.hidden = NO;
+    checkButton.selected = curGetInstalledAppMod.isSelectType;
+    
+    NSString *filePath = curGetInstalledAppMod.path;
+    
+    // 将 Base64 字符串转换为 NSData
+    NSData *imageData = [[NSData alloc] initWithBase64EncodedString:curGetInstalledAppMod.icon options:NSDataBase64DecodingIgnoreUnknownCharacters];
+
+    // 将 NSData 转换为 UIImage
+    UIImage *image = [UIImage imageWithData:imageData];
+    
+    if(image){
+        mImageView.image = image;
+    }
+    else{
+        mImageView.image = [UIImage imageNamed:@"uploadFile_app"];
+    }
+    
+
+    //时间戳转换为日期
+    NSString *timeStr = [[NSString alloc] initWithFormat:@"%ld",curGetInstalledAppMod.time];
+    NSString *dateStr = [iTools getDateStringWithTimeStr:timeStr];
+    
+    
+    NSString * totalSizeStr = nil;
+    NSInteger totalSize_k = curGetInstalledAppMod.length / 1024;
+    if(totalSize_k == 0){
+        totalSize_k = 1;
+    }
+    
+    if(totalSize_k < 1024){
+        totalSizeStr = [[NSString alloc] initWithFormat:@"%ldKB",totalSize_k];
+    }
+    else if( totalSize_k >= 1024 && totalSize_k < 1024*1024){
+        totalSizeStr = [[NSString alloc] initWithFormat:@"%.2fMB",totalSize_k/1024.0];
+        
+    }
+    else{
+        totalSizeStr = [[NSString alloc] initWithFormat:@"%.2fG",totalSize_k/1024.0/1024.0];
+    }
+    
+    NSString * leftStr = curGetInstalledAppMod.name;
+    NSString * rightStr = [[NSString alloc] initWithFormat:@"\n%@      %@",totalSizeStr,dateStr];
+
+    NSString *totalStr = [[NSString alloc] initWithFormat:@"%@%@",leftStr,rightStr];
+    
+    NSMutableAttributedString *noteStr = [[NSMutableAttributedString alloc] initWithString:totalStr];
+    
+    NSRange redRange = NSMakeRange([totalStr rangeOfString:rightStr].location, [totalStr rangeOfString:rightStr].length);
+    [noteStr addAttribute:NSForegroundColorAttributeName value:[UIColor hwColor:@"#666666" alpha:1.0] range:redRange];
+    [noteStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:12.0] range:redRange];
+    // 设置行间距
+    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
+    [paragraphStyle setLineSpacing:5];        //设置行间距
+    
+    [noteStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [totalStr  length])];
+    
+    
+    titleLabel.attributedText = noteStr;
+}
+
 @end

+ 51 - 55
创维盒子/code/NAS/NasPreviewAPPViewController.m

@@ -24,6 +24,7 @@
 //#import "audioPlayerViewController.h"
 #import "videoPlayByAVPlayerViewController.h"
 #import "MJRefresh.h"
+#import "getInstalledAppListModel.h"
 
 @interface NasPreviewAPPViewController ()<UITableViewDelegate,UITableViewDataSource,DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
 {
@@ -50,7 +51,7 @@
 @property(nonatomic,strong) UIButton*uploadFileButton;
 
 @property (nonatomic, strong)  NSMutableArray*didSelectListArr;//选中的数据
-@property (nonatomic, strong)NASFileAudioModel * curNASFileAudioMod;
+@property (nonatomic, strong)getInstalledAppListModel*getInstalledAppListMod;
 @end
 
 @implementation NasPreviewAPPViewController
@@ -351,7 +352,7 @@
     }
     
     self.defaultDiskPath = pathStr;
-    _curNASFileAudioMod = nil;
+    _getInstalledAppListMod = nil;
     [self getFileListFun:NO];
     [self setTitleAfterGetdiskFun];
     [self hideDiskListVieFun];
@@ -363,10 +364,10 @@
 }
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
-    if(!_curNASFileAudioMod){
+    if(!_getInstalledAppListMod){
         return 0;
     }
-    return _curNASFileAudioMod.data.list.count;
+    return _getInstalledAppListMod.data.count;
 }
 
 - (downLoadPreViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
@@ -390,9 +391,9 @@
         
     }
     
-    if(row < _curNASFileAudioMod.data.list.count){
-        NASFileAndFolderDataModel* dataModel = _curNASFileAudioMod.data.list[row];
-        cell.curNASFileAndFolderDataModel = dataModel;
+    if(row < _getInstalledAppListMod.data.count){
+        getInstalledAppModel* dataModel = _getInstalledAppListMod.data[row];
+        cell.curGetInstalledAppMod = dataModel;
         
         KWeakSelf
         cell.didClickSwitch = ^(BOOL SwitchOn) {
@@ -408,23 +409,23 @@
     return 70;
 }
 
-- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
-{
-    NSInteger row = indexPath.row;
-    if(row < _curNASFileAudioMod.data.list.count){
-        
-        NASFilePicDataArrModel *dataModel = _curNASFileAudioMod.data.list[row];
-        //videoPlayViewController *vc = [videoPlayViewController new];
-        videoPlayByAVPlayerViewController *vc = [videoPlayByAVPlayerViewController new];
-        vc.VideoDataMode = dataModel;
-        [self.navigationController pushViewController:vc animated:YES];
-        
-        KWeakSelf
-        vc.didNeedDeleteFile = ^(NSString * _Nonnull filePath) {
-            [weakSelf deleteNetDataByFilePath:filePath];
-        };
-    }
-}
+//- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+//{
+//    NSInteger row = indexPath.row;
+//    if(row < _curNASFileAudioMod.data.list.count){
+//        
+//        NASFilePicDataArrModel *dataModel = _curNASFileAudioMod.data.list[row];
+//        //videoPlayViewController *vc = [videoPlayViewController new];
+//        videoPlayByAVPlayerViewController *vc = [videoPlayByAVPlayerViewController new];
+//        vc.VideoDataMode = dataModel;
+//        [self.navigationController pushViewController:vc animated:YES];
+//        
+//        KWeakSelf
+//        vc.didNeedDeleteFile = ^(NSString * _Nonnull filePath) {
+//            [weakSelf deleteNetDataByFilePath:filePath];
+//        };
+//    }
+//}
 
 #pragma mark 空数据
 - (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView {
@@ -549,8 +550,8 @@
 
 - (void)userCheckFilePreviewByRow:(NSInteger)row
 {
-    if(row < _curNASFileAudioMod.data.list.count){
-        NASFileAudioDataModel* dataModel = _curNASFileAudioMod.data.list[row];
+    if(row < _getInstalledAppListMod.data.count){
+        NASFileAudioDataModel* dataModel = _getInstalledAppListMod.data[row];
         
         if(dataModel.isSelectType){
             [_didSelectListArr removeObject:dataModel];
@@ -571,7 +572,7 @@
     
     [_didSelectListArr removeAllObjects];
     
-    for (NASFileAudioDataModel* dataModel in _curNASFileAudioMod.data.list) {
+    for (NASFileAudioDataModel* dataModel in _getInstalledAppListMod.data) {
         
         if(!button.selected){
             dataModel.isSelectType = button.selected;
@@ -749,7 +750,7 @@
     [self showDownloadTipFun];
     [self checkFileTransferTask];
     
-    if(!_curNASFileAudioMod){
+    if(!_getInstalledAppListMod){
         [self getFileListFun:NO];
         [self queryShareSwitchFunFun];
     }
@@ -865,14 +866,9 @@
     [[netWorkManager shareInstance] cloudPhoneGETCallBackCode:@"getInstalledApk" Parameters:paraDict success:^(id  _Nonnull responseObject) {
         //[weakSelf.tableView.mj_footer endRefreshing];
         [weakSelf removeNewIndicatorHaveStr];
-        NASFileAudioModel*NASFileAudioMod = [[NASFileAudioModel alloc] initWithDictionary:responseObject error:nil];
-        
-//        if(NASFileAudioMod.data.list.count < pageSizeNum){
-//            [weakSelf.tableView.mj_footer endRefreshingWithNoMoreData];
-//        }
+        weakSelf.getInstalledAppListMod = [[getInstalledAppListModel alloc] initWithDictionary:responseObject error:nil];
         
-        [weakSelf handelNetDataAfterFilterDataBy:NASFileAudioMod];
-        if(weakSelf.curNASFileAudioMod && weakSelf.curNASFileAudioMod.status == 0){
+        if(weakSelf.getInstalledAppListMod && weakSelf.getInstalledAppListMod.status == 0){
             [weakSelf.tableView reloadData];
         }
         
@@ -899,22 +895,22 @@
 #pragma mark 分页数据组装
 - (void)handelNetDataAfterFilterDataBy:(NASFileAudioModel*)NASFileAudioMod
 {
-    if(_curNASFileAudioMod && _curNASFileAudioMod.data && _curNASFileAudioMod.data.list){
-        NSMutableArray *handelDataArr = [NSMutableArray arrayWithArray:_curNASFileAudioMod.data.list];//旧数据
-        [handelDataArr addObjectsFromArray:NASFileAudioMod.data.list];//新数据
-        
-        _curNASFileAudioMod.data.list = (NSArray<NASFileAudioDataModel>*)handelDataArr;
-    }
-    else{
-        _curNASFileAudioMod = NASFileAudioMod;
-    }
-    
-    if(_curNASFileAudioMod.data.list.count == 0 ){
-        self.tableView.mj_footer.hidden = YES;
-    }
-    else{
-        self.tableView.mj_footer.hidden = NO;
-    }
+//    if(_getInstalledAppListMod && _getInstalledAppListMod.data ){
+//        NSMutableArray *handelDataArr = [NSMutableArray arrayWithArray:_getInstalledAppListMod.data];//旧数据
+//        [handelDataArr addObjectsFromArray:NASFileAudioMod.data.list];//新数据
+//        
+//        _curNASFileAudioMod.data.list = (NSArray<NASFileAudioDataModel>*)handelDataArr;
+//    }
+//    else{
+//        _curNASFileAudioMod = NASFileAudioMod;
+//    }
+//    
+//    if(_curNASFileAudioMod.data.list.count == 0 ){
+//        self.tableView.mj_footer.hidden = YES;
+//    }
+//    else{
+//        self.tableView.mj_footer.hidden = NO;
+//    }
 }
 
 #pragma mark 调整文件上传
@@ -1038,13 +1034,13 @@
 - (void)deleteNetDataByDeleteSucFun
 {
     NSMutableArray *afterFilterArr = [NSMutableArray new];
-    for (NASFileAudioDataModel *model in _curNASFileAudioMod.data.list) {
+    for (getInstalledAppModel *model in _getInstalledAppListMod.data) {
         if (!model.isSelectType) {
             [afterFilterArr addObject:model];
         }
     }
     
-    _curNASFileAudioMod.data.list = (NSArray<NASFileAudioDataModel>*)afterFilterArr;
+    _getInstalledAppListMod.data = (NSArray<getInstalledAppModel>*)afterFilterArr;
     
     [self.tableView reloadData];
 }
@@ -1057,13 +1053,13 @@
     }
     
     NSMutableArray *afterFilterArr = [NSMutableArray new];
-    for (NASFileAudioDataModel *model in _curNASFileAudioMod.data.list) {
+    for (getInstalledAppModel *model in _getInstalledAppListMod.data) {
         if (![model.path isEqualToString:filePath]) {
             [afterFilterArr addObject:model];
         }
     }
     
-    _curNASFileAudioMod.data.list = (NSArray<NASFileAudioDataModel>*)afterFilterArr;
+    _getInstalledAppListMod.data = (NSArray<getInstalledAppModel>*)afterFilterArr;
     [self.tableView reloadData];
 }
 

+ 29 - 0
创维盒子/code/NAS/model/getInstalledAppListModel.h

@@ -0,0 +1,29 @@
+//
+//  getInstalledAppListModel.h
+//  双子星云手机
+//
+//  Created by xd h on 2025/3/13.
+//
+
+#import "SuperModel.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface getInstalledAppModel : SuperModel
+@property(nonatomic,copy) NSString* path;//路径
+@property(nonatomic,copy) NSString* fileType;//文件类型
+@property(nonatomic,copy) NSString* name;//名称
+@property(nonatomic,copy) NSString* icon;//图片
+@property(nonatomic,assign) NSInteger length;//文件大小
+@property(nonatomic,assign) NSInteger time;//时间戳
+
+//自定义
+@property (nonatomic, assign) BOOL isSelectType;
+@end
+
+@protocol getInstalledAppModel;
+@interface getInstalledAppListModel : SuperModel
+@property (nonatomic, strong) NSArray<getInstalledAppModel>* data;
+@end
+
+NS_ASSUME_NONNULL_END

+ 15 - 0
创维盒子/code/NAS/model/getInstalledAppListModel.m

@@ -0,0 +1,15 @@
+//
+//  getInstalledAppListModel.m
+//  双子星云手机
+//
+//  Created by xd h on 2025/3/13.
+//
+
+#import "getInstalledAppListModel.h"
+
+@implementation getInstalledAppModel
+
+@end
+@implementation getInstalledAppListModel
+
+@end

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

@@ -677,6 +677,10 @@
 		6B6C97FE2D82B5290095A4CA /* appInstallTypeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6C97FC2D82B5290095A4CA /* appInstallTypeView.m */; };
 		6B6C97FF2D82B5290095A4CA /* appInstallTypeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6C97FC2D82B5290095A4CA /* appInstallTypeView.m */; };
 		6B6C98002D82B5290095A4CA /* appInstallTypeView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6C97FB2D82B5290095A4CA /* appInstallTypeView.h */; };
+		6B6C98032D82D8430095A4CA /* getInstalledAppListModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6C98022D82D8430095A4CA /* getInstalledAppListModel.m */; };
+		6B6C98042D82D8430095A4CA /* getInstalledAppListModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6C98012D82D8430095A4CA /* getInstalledAppListModel.h */; };
+		6B6C98052D82D8430095A4CA /* getInstalledAppListModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6C98012D82D8430095A4CA /* getInstalledAppListModel.h */; };
+		6B6C98062D82D8430095A4CA /* getInstalledAppListModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6C98022D82D8430095A4CA /* getInstalledAppListModel.m */; };
 		6B6D42EB2C290A06006CAE3A /* cloudPhoneSetView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D42EA2C290A06006CAE3A /* cloudPhoneSetView.m */; };
 		6B6D42EC2C290A06006CAE3A /* cloudPhoneSetView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D42E92C290A06006CAE3A /* cloudPhoneSetView.h */; };
 		6B6D42ED2C290A06006CAE3A /* cloudPhoneSetView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D42EA2C290A06006CAE3A /* cloudPhoneSetView.m */; };
@@ -1993,6 +1997,8 @@
 		6B6ABEF12BFF6B4C00480BAC /* boxSaveFileManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = boxSaveFileManager.m; sourceTree = "<group>"; };
 		6B6C97FB2D82B5290095A4CA /* appInstallTypeView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = appInstallTypeView.h; sourceTree = "<group>"; };
 		6B6C97FC2D82B5290095A4CA /* appInstallTypeView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = appInstallTypeView.m; sourceTree = "<group>"; };
+		6B6C98012D82D8430095A4CA /* getInstalledAppListModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = getInstalledAppListModel.h; sourceTree = "<group>"; };
+		6B6C98022D82D8430095A4CA /* getInstalledAppListModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = getInstalledAppListModel.m; sourceTree = "<group>"; };
 		6B6D42E92C290A06006CAE3A /* cloudPhoneSetView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cloudPhoneSetView.h; sourceTree = "<group>"; };
 		6B6D42EA2C290A06006CAE3A /* cloudPhoneSetView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = cloudPhoneSetView.m; sourceTree = "<group>"; };
 		6B6D42EF2C295BCD006CAE3A /* playerSetView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = playerSetView.h; sourceTree = "<group>"; };
@@ -3719,6 +3725,8 @@
 			children = (
 				6BF62B162D55D9E400E7A98A /* queryHeartbeatModel.h */,
 				6BF62B172D55D9E400E7A98A /* queryHeartbeatModel.m */,
+				6B6C98012D82D8430095A4CA /* getInstalledAppListModel.h */,
+				6B6C98022D82D8430095A4CA /* getInstalledAppListModel.m */,
 			);
 			path = model;
 			sourceTree = "<group>";
@@ -4159,6 +4167,7 @@
 				6B7E04302C3E5A98004B4948 /* customDownloadOperation.h in Headers */,
 				6B4C0F6A2C0314BA0070EF2E /* DFPlayerRequestManager.h in Headers */,
 				6B97739C2C637C4800213317 /* nasUploadManager.h in Headers */,
+				6B6C98052D82D8430095A4CA /* getInstalledAppListModel.h in Headers */,
 				6B2C1E882C070ADE00FDCF82 /* ZFPlayerController.h in Headers */,
 				6B1FBD262B4503E700926382 /* photosBackupsTaskModel.h in Headers */,
 				6B34DC4E2BF1BA11002DD1EF /* previewImageOrVideoViewController.h in Headers */,
@@ -4462,6 +4471,7 @@
 				6B7E04312C3E5A98004B4948 /* customDownloadOperation.h in Headers */,
 				6B4C0F6B2C0314BA0070EF2E /* DFPlayerRequestManager.h in Headers */,
 				6B97739D2C637C4800213317 /* nasUploadManager.h in Headers */,
+				6B6C98042D82D8430095A4CA /* getInstalledAppListModel.h in Headers */,
 				6B2C1E892C070ADE00FDCF82 /* ZFPlayerController.h in Headers */,
 				6BD506B62B9576A4006E7CB0 /* photosBackupsTaskModel.h in Headers */,
 				6B34DC502BF1BA11002DD1EF /* previewImageOrVideoViewController.h in Headers */,
@@ -5028,6 +5038,7 @@
 				6BD507352B9576A4006E7CB0 /* HWBookmarkListCell.m in Sources */,
 				6BD507362B9576A4006E7CB0 /* downLoadPreViewCell.m in Sources */,
 				6BD507372B9576A4006E7CB0 /* JSONModelError.m in Sources */,
+				6B6C98032D82D8430095A4CA /* getInstalledAppListModel.m in Sources */,
 				6BD507382B9576A4006E7CB0 /* PlayerViewController+otherDelegate.mm in Sources */,
 				6B2C1E632C070ADE00FDCF82 /* ZFKVOController.m in Sources */,
 				6B42A2142C40DC3D000555BB /* previewLandscapeTopMoreView.m in Sources */,
@@ -5413,6 +5424,7 @@
 				A031DD6D27EC1FCD00909527 /* HWBookmarkListCell.m in Sources */,
 				6B5D40302B4BCBC1000965CF /* downLoadPreViewCell.m in Sources */,
 				183AE6052A89CE3C00B11CB0 /* JSONModelError.m in Sources */,
+				6B6C98062D82D8430095A4CA /* getInstalledAppListModel.m in Sources */,
 				6B7B65592AD9227700BE8CB3 /* PlayerViewController+otherDelegate.mm in Sources */,
 				6B2C1E622C070ADE00FDCF82 /* ZFKVOController.m in Sources */,
 				6B42A2122C40DC3D000555BB /* previewLandscapeTopMoreView.m in Sources */,