Browse Source

1.图片记住上传旋转的磁盘路径

huangxiaodong 8 months ago
parent
commit
4106edee1a

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

@@ -163,6 +163,9 @@ UIKIT_EXTERN NSString *const Const_did_show_newer_Guide;
 /*记录音频播放的模式*/
 UIKIT_EXTERN NSString *const Const_audio_playMode_record;
 
+/*记录上一次的图片预览磁盘*/
+UIKIT_EXTERN NSString *const Const_image_pre_disk_check;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 2 - 0
创维盒子/双子星云手机/AppDelegate/Config/Const.m

@@ -160,4 +160,6 @@ NSString *const Const_did_show_newer_Guide = @"did_show_newer_Guide";
 /*记录音频播放的模式*/
 NSString *const Const_audio_playMode_record = @"audio_playMode_record";
 
+/*记录上一次的图片预览磁盘*/
+NSString *const Const_image_pre_disk_check = @"image_pre_disk_check";
 @end

+ 33 - 3
创维盒子/双子星云手机/Class/Set/previewFile/previewImageOrVideoViewController.m

@@ -160,9 +160,34 @@
     }
     
     if(arr.count >0){
-        cloudPhoneExtraFileModel *model = arr.firstObject;
-        model.isCheckType = YES;
-        _defaultDiskPath = model.extraPath;
+        //上一次选中的磁盘
+        NSString*preChekDiskStr =  [HWDataManager getStringWithKey:Const_image_pre_disk_check];
+        
+        //1.没有选择过 默认选择第一次(云机)
+        if(!preChekDiskStr || preChekDiskStr.length == 0){
+            cloudPhoneExtraFileModel *model = arr.firstObject;
+            model.isCheckType = YES;
+            _defaultDiskPath = model.extraPath;
+        }
+        else{//2.选择过 查询磁盘是否还存在
+            BOOL didCheckDisk = NO;
+            for (cloudPhoneExtraFileModel *model in arr) {
+                HLog(@"磁盘路径比较 pre:%@---%@",preChekDiskStr,model.extraPath)
+                if([model.extraPath isEqualToString:preChekDiskStr]){
+                    model.isCheckType = YES;
+                    _defaultDiskPath = model.extraPath;
+                    didCheckDisk = YES;
+                    break;
+                }
+            }
+            
+            //3.选择过 查询磁盘不存在
+            if(!didCheckDisk){
+                cloudPhoneExtraFileModel *model = arr.firstObject;
+                model.isCheckType = YES;
+                _defaultDiskPath = model.extraPath;
+            }
+        }
     }
     _diskListArr = arr;
     [self setTitleAfterGetdiskFun];
@@ -328,6 +353,11 @@
         [_didSelectListArr removeAllObjects];
     }
     
+    //保存选中的磁盘
+    if(pathStr){
+        [HWDataManager setStringWithKey:Const_image_pre_disk_check value:pathStr];
+    }
+    
     self.defaultDiskPath = pathStr;
     [self getFileListFun];
     [self setTitleAfterGetdiskFun];