Bläddra i källkod

附件相关~备份

zhengkun 2 år sedan
förälder
incheckning
fc789ddc93

BIN
ios/JianYuIOS/JianYuIOS.xcworkspace/xcuserdata/zhengkun.xcuserdatad/UserInterfaceState.xcuserstate


+ 0 - 7
ios/JianYuIOS/JianYuIOS/AppDelegate.m

@@ -194,13 +194,6 @@
     [self removeImgView];
     [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
 
-
-
-    NSLog(@"测试:%@",[LXUserDefaults isInstallWeiXin]?@"1":@"0");
-    NSLog(@"测试:%@",[LXUserDefaults isInstallAli]?@"1":@"0");
-    
-
-    
     //查看粘贴板数据
     NSString  *content = [UIPasteboard generalPasteboard].string;
     //发通知

+ 3 - 3
ios/JianYuIOS/JianYuIOS/Assets.xcassets/otherImg/Contents.json

@@ -1,6 +1,6 @@
 {
   "info" : {
-    "version" : 1,
-    "author" : "xcode"
+    "author" : "xcode",
+    "version" : 1
   }
-}
+}

+ 22 - 0
ios/JianYuIOS/JianYuIOS/Assets.xcassets/otherImg/share.imageset/Contents.json

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

BIN
ios/JianYuIOS/JianYuIOS/Assets.xcassets/otherImg/share.imageset/share@2x.png


BIN
ios/JianYuIOS/JianYuIOS/Assets.xcassets/otherImg/share.imageset/share@3x.png


+ 3 - 3
ios/JianYuIOS/JianYuIOS/BaseClass1/PrefixHeader.pch

@@ -172,7 +172,6 @@ _Pragma("clang diagnostic pop")\
 #import "UIImage+GIFImage.h"
 #import "JhtDocViewer_Define.h"
 #import "JhtFileModel.h"
-
 #import "LoadDocViewController.h"
 
 //#define kHost @"https://web-zyh.jydev.jianyu360.com/" //张雨涵
@@ -181,9 +180,10 @@ _Pragma("clang diagnostic pop")\
 
 //#define kHost @"https://appdev-jytest.jydev.jianyu360.com/"   //其他测试
 
-#define kHost @"https://app-jytest.jydev.jianyu360.com/"  //测试1
+//#define kHost @"https://app-jytest.jydev.jianyu360.com/"  //测试1
 //#define kHost @"https://app2-jytest.jydev.jianyu360.com/"  //测试2
-//#define kHost @"https://app5-jytest.jydev.jianyu360.com/"  //测试5
+#define kHost @"https://app5-jytest.jydev.jianyu360.com/"  //测试5
+
 
 
 //#define kHost @"https://app-i2.jianyu360.cn/"   //新正式

+ 5 - 8
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYNewSearchViewController.m

@@ -544,12 +544,13 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.15 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
         [_webView evaluateJavaScript:jsStr completionHandler:^(id _Nullable result, NSError * _Nullable error) {
             if (error!=nil) {
-
+                
             }
         }];
     });
 }
 
+
 - (void)viewDidLoad {
     [super viewDidLoad];
     // Do any additional setup after loading the view.
@@ -569,19 +570,17 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
     [self.view addGestureRecognizer:self.recognizer];
     
     
-
+    
     
     //定时器-检测错误数据是否超过10个  发送
 //    [NSTimer scheduledTimerWithTimeInterval:180 target:self selector:@selector(errorLogListening) userInfo:nil repeats:YES];
     //监听底部栏
     [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(bottomOneListening) userInfo:nil repeats:YES];
-    
     //监听购买结果
     [[SKPaymentQueue defaultQueue] addTransactionObserver:self];
     
-    
 //    UIButton *testBtn = [ZKControl createButtonWithFrame:CGRectMake(100, 50, 100, 100) title:@"模拟按钮" imageName:@"" bgImageName:@"" target:self method:@selector(testBtnClick)];
-//    [self.webView addSubview:aaa];
+//    [self.webView addSubview:testBtn];
     
 }
 
@@ -589,17 +588,15 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
     LoadDocViewController *load = [[LoadDocViewController alloc] init];
     //构建数据
     JhtFileModel *fileModel = [[JhtFileModel alloc] init];
-    fileModel.fileName = @"1.jpg";
+    fileModel.fileName = @"测试图片.jpg";
     fileModel.viewFileType = Type_Jpg;
     fileModel.url = @"https://jy-datafile.oss-cn-beijing.aliyuncs.com/df3c910008ec25b29138902bcab8a3f3f02c6b5e7376ac12bbd89dc58be27877.jpg";
     fileModel.fileSize = @"19 Kb";
     load.titleStr = fileModel.fileName;
     load.currentFileModel = fileModel;
-//    [self.navigationController pushViewController:load animated:YES];
     kMainQueue(^{
         [self presentViewController:load animated:NO completion:nil];
     });
-    
 }
 
 

+ 0 - 6
ios/JianYuIOS/JianYuIOS/Libs(第三方)/JhtDocViewer_SDK/Tools/JhtNetworkCheckTools/JhtNetworkCheckTools.h

@@ -23,16 +23,10 @@
 typedef NS_ENUM(NSUInteger, JhtNetWorkStatus) {
     // 无网络
     NetWorkStatus_None = 0,
-    
-    // WIFI
     NetWorkStatus_WIFI,
-    
-    // 蜂窝网络
     NetWorkStatus_2G,
     NetWorkStatus_3G,
     NetWorkStatus_4G,
-    
-    // 未知网络
     NetWorkStatus_Unkhow
 };
 

+ 0 - 1
ios/JianYuIOS/JianYuIOS/Libs(第三方)/JhtDocViewer_SDK/Tools/JhtNetworkCheckTools/JhtNetworkCheckTools.m

@@ -130,7 +130,6 @@ static JhtNetworkCheckTools *jhtNetworkCheck = nil;
 /** 查询网络连接状态 */
 - (JhtNetWorkStatus)nctChectStatusWithRadioAccessTechnology {
     JhtNetWorkStatus status = (JhtNetWorkStatus)[self.reachability currentReachabilityStatus];
-    
     NSString *technology = self.currentRaioAccess;
     if ((status == ReachableViaWWAN) && (technology != nil)) {
         if ([self.network2GArray containsObject:technology]) {

+ 1 - 2
ios/JianYuIOS/JianYuIOS/Libs(第三方)/JhtDocViewer_SDK/View /JhtDownTipsDumpingView/JhtDownTipsDumpingView.m

@@ -30,9 +30,8 @@
     frame.origin.y -= model.showViewFrame.size.height;
     JhtDownTipsDumpingView *dump = [[JhtDownTipsDumpingView alloc] initWithFrame:frame withFView:view withText:text withShowDumpingViewModelParam:model];
     [view addSubview:dump];
-    
     // 开始动画
-    [dump startDampingAnimation:0.3];
+    [dump startDampingAnimation:1];
 }
 
 

+ 8 - 0
ios/JianYuIOS/JianYuIOS/Libs(第三方)/JhtDocViewer_SDK/View /JhtLoadDocView/JhtLoadDocView.h

@@ -39,6 +39,11 @@
  */
 - (instancetype)initWithFrame:(CGRect)frame fileModel:(JhtFileModel *)fileModel showErrorViewOfFatherView:(UIView *)errorFView loadDocViewParamModel:(JhtLoadDocViewParamModel *)loadDocViewParamModel showDumpingViewParamModel:(JhtShowDumpingViewParamModel *)showDumpingViewParamModel otherOpenButtonParamModel:(OtherOpenButtonParamModel *)otherOpenButtonParamModel;
 
+//隐藏展示~不同页面
+-(void)previewFileView:(BOOL)b;
+
+
+
 
 typedef void(^finishedDownloadCompletionHandler)(NSString *urlStr);
 typedef void(^finishShareHandler)(NSString *urlStr);
@@ -46,4 +51,7 @@ typedef void(^finishShareHandler)(NSString *urlStr);
 -(void)finishedDownloadCompletionHandler:(finishedDownloadCompletionHandler)block;
 -(void)finishShareHandler:(finishShareHandler)block;
 
+
+
+
 @end

+ 41 - 45
ios/JianYuIOS/JianYuIOS/Libs(第三方)/JhtDocViewer_SDK/View /JhtLoadDocView/JhtLoadDocView.m

@@ -76,9 +76,7 @@
         [self ldvCreateUI];
         
         
-        
-        
-        
+    
         dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
             // 清理几天前 downloadFilesPath && otherAppFilesPath 文件
             [self.fileUtil cleanFileAfterDays:self.loadDocViewParamModel.daysAgo filePathArray:nil];
@@ -95,6 +93,24 @@
     _shareblock = block;
 }
 
+-(void)previewFileView:(BOOL)b {
+    if (b) {
+        [UIView animateWithDuration:0.5 animations:^{
+            [self.docWebView setY:self.height];
+        } completion:^(BOOL finished) {
+            
+        }];
+    }else {
+        [UIView animateWithDuration:0.5 animations:^{
+            [self.docWebView setY:0];
+        } completion:^(BOOL finished) {
+            
+        }];
+    }
+}
+
+
+
 #pragma mark - Private Method
 /** 创建文件工具类 */
 - (void)ldvCreatefileUtil {
@@ -133,28 +149,22 @@
     __weak typeof(self) weakSelf = self;
     // 点击block 0-重新加载,1-点击关闭
     [self.downloadView clickBtnBlock:^(NSInteger index) {
-        if (index == 0) {
-            // 重新加载
+        if (index == 0) {// 重新加载
             [self ldvDrawProgressUIForDowningFile];
             [weakSelf ldvRetryClick];
-        }  else if (index == 3) {
-            NSString *pathUrl = [[_fileUtil stitchLocalFilePath] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
-            if (_shareblock) {
-                _shareblock(pathUrl);
+        }  else if (index == 3) { //分享点击
+            NSString *pathUrl = [[self->_fileUtil stitchLocalFilePath] stringByRemovingPercentEncoding];
+            if (self->_shareblock) {
+                self->_shareblock(pathUrl);
             }
-        }   else if (index == 2) {
-            //打开页面
-            self.downloadView.hidden = YES;
-            // 创建WebView
+        }   else if (index == 2) { //预览页面
             [weakSelf ldvCreateWebView];
-            //网络下载成功,本地路径
-            NSString *pathUrl = [[_fileUtil stitchLocalFilePath] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
-            if (_block) {
-                _block(pathUrl);
+            NSString *pathUrl = [[self->_fileUtil stitchLocalFilePath] stringByRemovingPercentEncoding];
+            if (self->_block) {
+                self->_block(pathUrl);
             }
-            self.docWebView.hidden = NO;
-        }else {
-            // 点击关闭
+            [self previewFileView:false];
+        }else { //点击关闭
             [weakSelf ldvCloseClick];
         }
     }];
@@ -167,24 +177,18 @@
 #pragma mark 判断是否具备下载条件(网络 && 存储空间)
 /** 判断是否具备下载条件(网络) */
 - (void)ldvJudgeDownloadConditions {
-    if ([self ldvCurrentFreeDiskSpaceToFileSize] < 0) {
-        // 内存不足
+    if ([self ldvCurrentFreeDiskSpaceToFileSize] < 0) {// 内存不足
         [self ldvShowDumpingView:self.loadDocViewParamModel.notEnoughMemoryHint];
         self.downloadView.downloadBtn.hidden = NO;
-        
     } else {
-        return;
         if (([JhtNetworkCheckTools currentNetWork_Status] == NetWorkStatus_2G) || ([JhtNetworkCheckTools currentNetWork_Status] == NetWorkStatus_3G) || ([JhtNetworkCheckTools currentNetWork_Status] == NetWorkStatus_4G)) {
             UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"下载流量提醒" message:@"当前处于非wifi环境,继续查看将会产生手机流量" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
-            
             alert.tag = 123;
             [alert show];
-            
         } else if ([JhtNetworkCheckTools currentNetWork_Status] == NetWorkStatus_None) {
-            // 没网啥都不做
+            
         } else {
-            // 开始下载
-            [self ldvDrawProgressUIForDowningFile];
+
         }
     }
 }
@@ -236,8 +240,8 @@
             [self.downloadView.fileProgressView setProgress:downloadProgress.fractionCompleted animated:YES];
         });
     } setupFilePath:^NSURL *(NSURLResponse *response) {
-        NSString *cachePath = [NSString stringWithFormat:@"%@", _currentFileModel.fileName];
-        NSString *filePath = [_fileUtil stitchDownloadFilePath];
+        NSString *cachePath = [NSString stringWithFormat:@"%@", self->_currentFileModel.fileName];
+        NSString *filePath = [self->_fileUtil stitchDownloadFilePath];
         BOOL isDir = NO;
         NSFileManager *fileManager = [NSFileManager defaultManager];
         BOOL existed = [fileManager fileExistsAtPath:filePath isDirectory:&isDir];
@@ -250,15 +254,14 @@
     } downloadCompletionHandler:^(NSURL *filePath, NSError *error) {
         NSLog(@"fileDownloadError ==> %@", error);
         if (!error) {
-            NSString *filePath = [_fileUtil stitchLocalFilePath];
+            NSString *filePath = [self->_fileUtil stitchLocalFilePath];
             CGFloat fileSize = [self ldvFileSizeForPath:filePath];
-            self.downloadView.hidden = NO;
             self.downloadView.fileProgressView.hidden = YES;
             self.downloadView.closeBtn.hidden = YES;
             self.downloadView.downloadBtn.hidden = YES;
             self.downloadView.downloadingStateLabel.hidden = NO;
-            self.downloadView.downloadingStateLabel.text = [NSString stringWithFormat:@"文件大小:%.f",fileSize];
-            if(_currentFileModel.viewFileType==Type_Unknow) {
+            self.downloadView.downloadingStateLabel.text = [NSString stringWithFormat:@"文件大小:%@",[NSByteCountFormatter stringFromByteCount:fileSize countStyle:NSByteCountFormatterCountStyleFile]];
+            if(self->_currentFileModel.viewFileType==Type_Unknow) {
                 self.downloadView.openBtn.hidden = YES;
                 self.downloadView.shareBtn.hidden = NO;
             }else{
@@ -266,14 +269,11 @@
                 self.downloadView.shareBtn.hidden = YES;
             }
         
-        
         } else {
-            self.downloadView.hidden = NO;
             self.downloadView.downloadingStateLabel.text = self.loadDocViewParamModel.downloadFailedHint;
             self.downloadView.downloadBtn.hidden = NO;
-            self.docWebView.hidden = YES;
             // 文件下载失败时,清除文件路径
-            [_fileUtil removeFileWhenDownloadFileFailure];
+            [self->_fileUtil removeFileWhenDownloadFileFailure];
         }
     }];
 }
@@ -298,7 +298,7 @@
 #pragma mark - Getter
 - (JhtDocWebView *)docWebView {
     if (!_docWebView) {
-        _docWebView = [[JhtDocWebView alloc] initWithFrame:CGRectMake(0, 0, FrameW, FrameH)];
+        _docWebView = [[JhtDocWebView alloc] initWithFrame:CGRectMake(0, FrameH, FrameW, FrameH)];
     }
     
     return _docWebView;
@@ -402,19 +402,15 @@
 #pragma mark - UIAlertViewDelegate
 - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
     if (alertView.tag == 123) {
-        if (buttonIndex == 1) {
-            // 开始下载
+        if (buttonIndex == 1) {// 开始下载
             [self ldvDrawProgressUIForDowningFile];
-            
         } else {
             // 展示下载
-            self.downloadView.hidden = NO;
             self.downloadView.fileProgressView.hidden = YES;
             self.downloadView.closeBtn.hidden = YES;
             self.downloadView.downloadBtn.hidden = NO;
             self.downloadView.downloadingStateLabel.hidden = NO;
             self.downloadView.downloadingStateLabel.text = @"该文件暂不支持在线预览,请下载后查看";
-            self.docWebView.hidden = YES;
         }
     }
 }

+ 2 - 2
ios/JianYuIOS/JianYuIOS/guide/Reachability.h

@@ -48,8 +48,8 @@ extern NSString *const kReachabilityChangedNotification;
 typedef NS_ENUM(NSInteger, NetworkStatus) {
     // Apple NetworkStatus Compatible Names.
     NotReachable = 0,
-    ReachableViaWiFi = 2,
-    ReachableViaWWAN = 1
+    ReachableViaWiFi = 1,
+    ReachableViaWWAN = 2
 };
 
 @class Reachability;

+ 17 - 9
ios/JianYuIOS/JianYuIOS/openfile/LoadDocViewController.m

@@ -13,6 +13,7 @@
     JhtLoadDocView *_docView;
     UIButton *shareBtn;
     NSString *pathstr;
+    BOOL backStatus;
 }
 
 
@@ -35,6 +36,7 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
     self.view.backgroundColor = [UIColor whiteColor];
+    backStatus = NO;
     [self ldCreateUI];// CreateUI
 }
 
@@ -43,15 +45,21 @@
 /** 设置导航栏 */
 
 -(void)backBtnClick{
-//    [self.navigationController popViewControllerAnimated:YES];
-    
-    kMainQueue(^{
-        [self dismissViewControllerAnimated:YES completion:nil];
-    });
+    if (backStatus) {
+        [_docView  previewFileView:YES];
+        shareBtn.hidden = YES;
+        backStatus = NO;
+    }else {
+        kMainQueue(^{
+            [self dismissViewControllerAnimated:YES completion:nil];
+        });
+    }
 }
 
 -(void)shareBtnClick {
-    NSURL *url = [NSURL fileURLWithPath:pathstr];
+    //解码
+    NSString *new_str = [pathstr stringByRemovingPercentEncoding];
+    NSURL *url = [NSURL fileURLWithPath:new_str];
     NSArray *activityItems = @[url];
     UIActivityViewController *activityVC = [[UIActivityViewController alloc]initWithActivityItems:activityItems applicationActivities:nil];
     UIActivityViewControllerCompletionWithItemsHandler completionHandler = ^(UIActivityType __nullable activityType, BOOL completed, NSArray * __nullable returnedItems, NSError * __nullable activityError){
@@ -62,7 +70,6 @@
         }
     };
     activityVC.completionWithItemsHandler = completionHandler;
-
     kMainQueue(^{
         [self presentViewController:activityVC animated:YES completion:nil];
     });
@@ -81,7 +88,7 @@
     UILabel *titleLabel = [ZKControl createLabelWithFrame:CGRectMake(50, STATUS_BAR_HEIGHT, WIDTH-100, 44) font:17 text:self.currentFileModel.fileName TextAlignment:NSTextAlignmentCenter TextColor:UIColorFromRGB(0x333333) bgColor:nil];
     UIView *lineView= [ZKControl createViewWithFrame:CGRectMake(0, NAVIGATION_BAR_HEIGHT-1, WIDTH, 1) color:[UIColor groupTableViewBackgroundColor]];
     
-    shareBtn = [ZKControl createButtonWithFrame:CGRectMake(WIDTH-80, STATUS_BAR_HEIGHT, 60, 44) title:@"" imageName:@"five_1" bgImageName:nil target:self method:@selector(shareBtnClick)];
+    shareBtn = [ZKControl createButtonWithFrame:CGRectMake(WIDTH-80, STATUS_BAR_HEIGHT, 60, 44) title:@"" imageName:@"share" bgImageName:nil target:self method:@selector(shareBtnClick)];
     shareBtn.hidden = YES;
     
     
@@ -111,13 +118,14 @@
     
     CGRect tempFrame = CGRectMake(0, titleView.height, self.view.width, self.view.height-titleView.height);
     tempFrame.size.height -= JhtSafeAreaInsetsBottom;
-    _docView = [[JhtLoadDocView alloc] initWithFrame:tempFrame fileModel:self.currentFileModel showErrorViewOfFatherView:self.navigationController.view loadDocViewParamModel:loadDocViewParamModel showDumpingViewParamModel:showDumpingViewParamModel otherOpenButtonParamModel:nil];
+    _docView = [[JhtLoadDocView alloc] initWithFrame:tempFrame fileModel:self.currentFileModel showErrorViewOfFatherView:titleView loadDocViewParamModel:loadDocViewParamModel showDumpingViewParamModel:showDumpingViewParamModel otherOpenButtonParamModel:nil];
     [self.view addSubview:_docView];
     
     
     [_docView finishedDownloadCompletionHandler:^(NSString *urlStr) {
         self->pathstr = urlStr;
         self->shareBtn.hidden = NO;
+        self->backStatus = YES;
     }];
     
     [_docView finishShareHandler:^(NSString *urlStr) {