Преглед на файлове

1.音频缓存数据区分磁盘

huangxiaodong преди 3 седмици
родител
ревизия
53d80c17ca

+ 22 - 8
创维盒子/code/Class/Set/previewFile/previewAudioOrDocumentViewController.m

@@ -823,15 +823,11 @@
     [self checkFileTransferTask];
     
     if(!_curNASFileAudioMod){
-        //数据缓存
-        NSString *key = stringKeyAddSn(@"getFileList_audio");
-        NSDictionary *DataDict = [HWDataManager getObjectWithKey:key];
-        if(DataDict){
-            _curNASFileAudioMod = [[NASFileAudioModel alloc] initWithDictionary:DataDict error:nil];
-        }
         
-        [self checkNetWorkStateFun];
         [self getFileListFun:NO];
+        
+        [self checkNetWorkStateFun];
+        
         [self queryShareSwitchFunFun];
     }
 }
@@ -927,6 +923,23 @@
 #pragma mark 获取文件数据
 - (void)getFileListFun:(BOOL)isMoreDataType
 {
+    //无网 拿数据缓存
+    if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
+    {
+        //数据缓存
+        NSString *fullPath = [[NSString alloc] initWithFormat:@"getFileList_audio_%@",self.defaultDiskPath];
+        NSString *key = stringKeyAddSn(fullPath);
+        NSDictionary *DataDict = [HWDataManager getObjectWithKey:key];
+        if(DataDict){
+            _curNASFileAudioMod = [[NASFileAudioModel alloc] initWithDictionary:DataDict error:nil];
+            
+            if(_curNASFileAudioMod && _curNASFileAudioMod.status == 0){
+                [self.tableView reloadData];
+                return;
+            }
+        }
+    }
+    
     NSMutableDictionary*paraDict = [NSMutableDictionary new];
     if(_isAudioType){
         [paraDict setValue:@"audio" forKey:@"type"];
@@ -985,7 +998,8 @@
             }
         
             //数据缓存
-            NSString *key = stringKeyAddSn(@"getFileList_audio");
+            NSString *fullPath = [[NSString alloc] initWithFormat:@"getFileList_audio_%@",self.defaultDiskPath];
+            NSString *key = stringKeyAddSn(fullPath);
             [HWDataManager setObjectWithKey:key value:IdDataDict];
         }
         

+ 7 - 7
创维盒子/code/Class/Set/previewFile/previewImageOrVideoViewController.m

@@ -221,13 +221,13 @@
     
     
     //数据缓存
-    NSString *key = stringKeyAddSn(@"getFileListByDay");
-    NSDictionary * responseObject = [HWDataManager getObjectWithKey:key];
-    if(responseObject){
-        NASFilePicModel*NASFilePicMod = [[NASFilePicModel alloc] initWithDictionary:responseObject error:nil];
-        [self filterDataFun:NASFilePicMod];
-        [self.dataCollectionView    reloadData];
-    }
+//    NSString *key = stringKeyAddSn(@"getFileListByDay");
+//    NSDictionary * responseObject = [HWDataManager getObjectWithKey:key];
+//    if(responseObject){
+//        NASFilePicModel*NASFilePicMod = [[NASFilePicModel alloc] initWithDictionary:responseObject error:nil];
+//        [self filterDataFun:NASFilePicMod];
+//        [self.dataCollectionView    reloadData];
+//    }
     
 }
 

+ 29 - 0
创维盒子/code/NAS/NASViewController.m

@@ -706,6 +706,23 @@
 #pragma mark 走frp方案 获取云机磁盘信息
 - (void)getExtraFilesByFrpHttpFun
 {
+    //无网 拿数据缓存
+    if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
+    {
+        //数据缓存
+        NSString *key = stringKeyAddSn(@"getExtra");
+        NSDictionary *dataDict = [HWDataManager getObjectWithKey:key];
+        
+        if (dataDict) {
+            cloudPhoneExtraFileListModel *model = [[cloudPhoneExtraFileListModel alloc] initWithDictionary:dataDict error:nil];
+            if(model && model.status == 0){
+                ksharedAppDelegate.cloudPhoneExtraFileListMod = model;
+                [self setMySpaceDataFun];
+                return;
+            }
+        }
+    }
+    
     NSMutableDictionary*paraDict = [NSMutableDictionary new];
     
     KWeakSelf
@@ -713,6 +730,18 @@
         
         cloudPhoneExtraFileListModel *model = [[cloudPhoneExtraFileListModel alloc] initWithDictionary:responseObject error:nil];
         if(model && model.status == 0){
+            
+            NSMutableDictionary *IdDataDict = [[NSMutableDictionary alloc] initWithDictionary:responseObject];
+            for (NSString *key in responseObject) {
+                id object = IdDataDict[key];
+                if(!object || [object isKindOfClass:[NSNull class]]){
+                    [IdDataDict removeObjectForKey:key];
+                }
+            }
+            //数据缓存
+            NSString *key = stringKeyAddSn(@"getExtra");
+            [HWDataManager setObjectWithKey:key value:IdDataDict];
+            
             ksharedAppDelegate.cloudPhoneExtraFileListMod = model;
             [weakSelf setMySpaceDataFun];
         }

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

@@ -80,21 +80,21 @@
     
     
     //数据缓存
-    NSString *key = stringKeyAddSn(@"getInstalledApk");
-    NSDictionary *DataDict = [HWDataManager getObjectWithKey:key];
-    if(DataDict){
-        _getInstalledAppListMod = [[getInstalledAppListModel alloc] initWithDictionary:DataDict error:nil];
-        if (_getInstalledAppListMod) {
-            _curInstalledAppListMod = _getInstalledAppListMod;
-        }
-    }
-    
-    //数据缓存
-    NSString *keyUninstall = stringKeyAddSn(@"getUninstallApk");
-    NSDictionary *DataDictUninstall = [HWDataManager getObjectWithKey:keyUninstall];
-    if(DataDictUninstall){
-        _getUninstalledAppListMod = [[getInstalledAppListModel alloc] initWithDictionary:DataDictUninstall error:nil];
-    }
+//    NSString *key = stringKeyAddSn(@"getInstalledApk");
+//    NSDictionary *DataDict = [HWDataManager getObjectWithKey:key];
+//    if(DataDict){
+//        _getInstalledAppListMod = [[getInstalledAppListModel alloc] initWithDictionary:DataDict error:nil];
+//        if (_getInstalledAppListMod) {
+//            _curInstalledAppListMod = _getInstalledAppListMod;
+//        }
+//    }
+//    
+//    //数据缓存
+//    NSString *keyUninstall = stringKeyAddSn(@"getUninstallApk");
+//    NSDictionary *DataDictUninstall = [HWDataManager getObjectWithKey:keyUninstall];
+//    if(DataDictUninstall){
+//        _getUninstalledAppListMod = [[getInstalledAppListModel alloc] initWithDictionary:DataDictUninstall error:nil];
+//    }
    
     
     [self drawAnyView];

+ 5 - 5
创维盒子/code/NAS/NasPreviewVideoViewController.m

@@ -798,11 +798,11 @@
     if(!_curNASFileAudioMod){
         
         //数据缓存
-        NSString *key = stringKeyAddSn(@"getFileList_video");
-        NSDictionary *DataDict = [HWDataManager getObjectWithKey:key];
-        if(DataDict){
-            _curNASFileAudioMod = [[NASFileAudioModel alloc] initWithDictionary:DataDict error:nil];
-        }
+//        NSString *key = stringKeyAddSn(@"getFileList_video");
+//        NSDictionary *DataDict = [HWDataManager getObjectWithKey:key];
+//        if(DataDict){
+//            _curNASFileAudioMod = [[NASFileAudioModel alloc] initWithDictionary:DataDict error:nil];
+//        }
         
         [self getFileListFun:NO];
         [self queryShareSwitchFunFun];