浏览代码

1.音频数据缓存

huangxiaodong 2 月之前
父节点
当前提交
b64c2af8fc
共有 1 个文件被更改,包括 20 次插入0 次删除
  1. 20 0
      创维盒子/code/Class/Set/previewFile/previewAudioOrDocumentViewController.m

+ 20 - 0
创维盒子/code/Class/Set/previewFile/previewAudioOrDocumentViewController.m

@@ -816,6 +816,13 @@
     [self checkFileTransferTask];
     
     if(!_curNASFileAudioMod){
+        //数据缓存
+        NSString *key = stringKeyAddSn(@"getFileList_audio");
+        NSDictionary *DataDict = [HWDataManager getObjectWithKey:key];
+        if(DataDict){
+            _curNASFileAudioMod = [[NASFileAudioModel alloc] initWithDictionary:DataDict error:nil];
+        }
+        
         [self getFileListFun:NO];
         [self queryShareSwitchFunFun];
     }
@@ -959,6 +966,19 @@
 
         if(weakSelf.curNASFileAudioMod && weakSelf.curNASFileAudioMod.status == 0){
             [weakSelf.tableView reloadData];
+            
+            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(@"getFileList_audio");
+            [HWDataManager setObjectWithKey:key value:IdDataDict];
         }
         
     } failure:^(NSError * _Nonnull error) {