Bläddra i källkod

1.修改Apex CRM适配不同屏幕。
2.修改Apex CRM分享。

Pen Li 7 år sedan
förälder
incheckning
2a216500d3

+ 2 - 0
RedAnt CRM/APEX CRM/APEX CRM.xcodeproj/project.pbxproj

@@ -568,6 +568,7 @@
 				CODE_SIGN_STYLE = Automatic;
 				DEVELOPMENT_TEAM = HXWLAA5YN5;
 				INFOPLIST_FILE = "APEX CRM/Info.plist";
+				IPHONEOS_DEPLOYMENT_TARGET = 9.1;
 				LD_RUNPATH_SEARCH_PATHS = (
 					"$(inherited)",
 					"@executable_path/Frameworks",
@@ -585,6 +586,7 @@
 				CODE_SIGN_STYLE = Automatic;
 				DEVELOPMENT_TEAM = HXWLAA5YN5;
 				INFOPLIST_FILE = "APEX CRM/Info.plist";
+				IPHONEOS_DEPLOYMENT_TARGET = 9.1;
 				LD_RUNPATH_SEARCH_PATHS = (
 					"$(inherited)",
 					"@executable_path/Frameworks",

+ 8 - 3
RedAnt CRM/APEX CRM/APEX CRM/Base.lproj/Main.storyboard

@@ -60,13 +60,18 @@
                         <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
-                            <view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="nSN-pu-SH2" customClass="RAWKWebView">
-                                <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
-                                <autoresizingMask key="autoresizingMask"/>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nSN-pu-SH2" customClass="RAWKWebView">
+                                <rect key="frame" x="0.0" y="44" width="414" height="818"/>
                                 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                             </view>
                         </subviews>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                        <constraints>
+                            <constraint firstItem="nSN-pu-SH2" firstAttribute="trailing" secondItem="Wtw-Bc-GH6" secondAttribute="trailing" id="0Uo-vg-5QR"/>
+                            <constraint firstItem="Wtw-Bc-GH6" firstAttribute="bottom" secondItem="nSN-pu-SH2" secondAttribute="bottom" id="3Qh-xt-Tdd"/>
+                            <constraint firstItem="nSN-pu-SH2" firstAttribute="leading" secondItem="Wtw-Bc-GH6" secondAttribute="leading" id="MlI-NB-kJZ"/>
+                            <constraint firstItem="nSN-pu-SH2" firstAttribute="top" secondItem="Wtw-Bc-GH6" secondAttribute="top" id="Pfg-Ba-FQr"/>
+                        </constraints>
                         <viewLayoutGuide key="safeArea" id="Wtw-Bc-GH6"/>
                     </view>
                     <connections>

+ 1 - 0
RedAnt CRM/APEX CRM/APEX CRM/RAWKWebView.h

@@ -14,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 - (void)LoadFromURL:(NSString*)url;
 
+@property(nonatomic) UIScrollViewContentInsetAdjustmentBehavior contentInsetAdjustmentBehavior API_AVAILABLE(ios(11.0),tvos(11.0));
 
 @property (nonatomic , copy) void (^JumpTo)(NSString* url,NSString* module);
 

+ 61 - 40
RedAnt CRM/APEX CRM/APEX CRM/RAWKWebView.m

@@ -55,6 +55,13 @@
     }
     return self;
 }
+
+- (void)layoutSubviews {
+    [super layoutSubviews];
+    
+    self.wkwebView.frame = self.bounds;
+}
+
 -(void) initWKWebView
 {
     WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init];
@@ -64,11 +71,12 @@
     preferences.minimumFontSize = 40.0;
     configuration.preferences = preferences;
     
-    self.wkwebView = [[WKWebView alloc] initWithFrame:self.frame configuration:configuration];
+    self.wkwebView = [[WKWebView alloc] initWithFrame:self.bounds configuration:configuration];
     self.wkwebView.UIDelegate = self;
     self.wkwebView.navigationDelegate = self;
     [self addSubview:self.wkwebView];
 }
+
 -(void)LoadFromURL:(NSString *)url
 {
     if(self.wkwebView==nil)
@@ -117,6 +125,12 @@
 
 }
 
+#pragma mark - Setter
+
+- (void)setContentInsetAdjustmentBehavior:(UIScrollViewContentInsetAdjustmentBehavior)contentInsetAdjustmentBehavior {
+    self.wkwebView.scrollView.contentInsetAdjustmentBehavior = contentInsetAdjustmentBehavior;
+}
+
 #pragma mark - Private
 
 - (UIViewController *)ra_viewController {
@@ -237,8 +251,8 @@
     [mc setSubject:subject];
     
     
-    [mc setToRecipients:[receipt componentsSeparatedByString:@";"]];
-    [mc setCcRecipients:[cc componentsSeparatedByString:@";"]];
+    [mc setToRecipients:[receipt componentsSeparatedByString:@","]];
+    [mc setCcRecipients:[cc componentsSeparatedByString:@","]];
     
     if(!content)
         content=@"";
@@ -263,50 +277,56 @@
 
 - (void)ra_share:(NSDictionary *)params {
     
+    /**
+     content = "\U6d4b\U8bd5\U5206\U4eab\U7684\U5185\U5bb9";
+     image = "http://192.168.0.138:8080/backend_test/1.png";
+     title = "\U6d4b\U8bd5\U5206\U4eab\U7684\U6807\U9898";
+     url = "http://192.168.0.138:8080/backend_test/index.html";
+     */
+    
     // 设置分享内容
     
-    NSString *filePath = nil;
-    NSString *subject = [params objectForKey:@"subject"];
-    NSString *receipt = [params objectForKey:@"receipt"];
     NSString *content = [params objectForKey:@"content"];
-    NSString *cc = [params objectForKey:@"cc"];
-    
-    NSURL *url = [NSURL fileURLWithPath:filePath];
-    
-    NSArray *activityItems = @[url];
+    NSString *imageURL = [params objectForKey:@"image"];
+    NSString *title = [params objectForKey:@"title"];
+    NSString *url = [params objectForKey:@"url"];
     
-    LPShareActivity *share = [[LPShareActivity alloc] init];
-    share.to = [receipt componentsSeparatedByString:@";"];
-    share.subject = subject;
-    share.body = content;
-    share.filePath = filePath;
-    share.handle = ^(UIViewController *vc) {
-        [self.ra_viewController presentViewController:vc animated:YES completion:^{
-            // ...
-        }];
-    };
-    
-    // 服务类型控制器
-    UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:@[share]];
-    //    _activityViewController = activityViewController;
-    //    activityViewController.excludedActivityTypes = @[UIActivityTypeMail];
-    activityViewController.modalInPopover = true;
-    
-    // 选中分享类型
-    [activityViewController setCompletionWithItemsHandler:^(NSString * __nullable activityType, BOOL completed, NSArray * __nullable returnedItems, NSError * __nullable activityError){
-        
-        // 显示选中的分享类型
-        NSLog(@"act type %@",activityType);
+    [RADataProvider GET_DownloadFile:imageURL toFolder:nil progressHandler:^(NSURLSessionTask *task, double progress) {
         
-        if (completed) {
-            NSLog(@"ok");
-        }else {
-            NSLog(@"not ok");
+    } completionHandler:^(NSMutableDictionary *result) {
+       
+        int code = [[result objectForKey:@"result"] intValue];
+        if (code == RESULT_TRUE) {
+            
+            NSString *path = [result objectForKey:@"path"];
+            
+            NSArray *activityItems = @[title,content,[NSURL fileURLWithPath:path],url];
+            
+            // 服务类型控制器
+            UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:@[]];
+            //    _activityViewController = activityViewController;
+            //    activityViewController.excludedActivityTypes = @[UIActivityTypeMail];
+            activityViewController.modalInPopover = true;
+            
+            // 选中分享类型
+            [activityViewController setCompletionWithItemsHandler:^(NSString * __nullable activityType, BOOL completed, NSArray * __nullable returnedItems, NSError * __nullable activityError){
+                
+                // 显示选中的分享类型
+                NSLog(@"act type %@",activityType);
+                
+                if (completed) {
+                    NSLog(@"ok");
+                }else {
+                    NSLog(@"not ok");
+                }
+                
+            }];
+            
+            [self.ra_viewController presentViewController:activityViewController animated:YES completion:nil];
+            
         }
         
     }];
-    
-    [self.ra_viewController presentViewController:activityViewController animated:YES completion:nil];
 }
 
 #pragma mark -MFMailComposeViewControllerDelegate delegate
@@ -329,6 +349,7 @@
         default:
             break;
     }
+    [controller dismissViewControllerAnimated:YES completion:nil];
 }
 
 
@@ -524,7 +545,7 @@
 #pragma mark - WKNavigationDelegate
 - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
 {
-    self.wkwebView.scrollView.scrollEnabled = NO;
+//    self.wkwebView.scrollView.scrollEnabled = NO;
     [webView evaluateJavaScript:@"document.body.scrollHeight"
               completionHandler:^(id result, NSError *_Nullable error) {
                   

+ 5 - 2
RedAnt CRM/APEX CRM/APEX CRM/WKWebTestViewController.m

@@ -19,9 +19,12 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
     
+    if (@available(iOS 11, *)) {
+        self.webview.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
+    } else {
+        self.automaticallyAdjustsScrollViewInsets = NO;
+    }
     [self.webview LoadFromURL:_url];
-    
-    
     self.webview.JumpTo = ^(NSString* url, NSString* module){
         
 //        Class class_container =NSClassFromString(module);

+ 1 - 1
RedAnt CRM/APEX CRM/APEX CRM/en.lproj/InfoPlist.strings

@@ -5,7 +5,7 @@
   Created by Jack on 2018/11/27.
   Copyright © 2018年 USAI. All rights reserved.
 */
-CFBundleDisplayName = "Apex & Drivers";
+CFBundleDisplayName = "Apex CRM";
 NSCameraUsageDescription = "Take process evidence";
 NSLocationAlwaysAndWhenInUseUsageDescription = "Display location on map and navigation, report cargo location";
 NSLocationAlwaysUsageDescription = "Report cargo location";

+ 1 - 1
RedAnt CRM/APEX CRM/APEX CRM/zh-Hans.lproj/InfoPlist.strings

@@ -5,7 +5,7 @@
   Created by Jack on 2018/11/27.
   Copyright © 2018年 USAI. All rights reserved.
 */
-CFBundleDisplayName = "Apex & Drivers";
+CFBundleDisplayName = "Apex CRM";
 NSCameraUsageDescription = "采取过程证据";
 NSLocationAlwaysAndWhenInUseUsageDescription = "在地图和导航上显示位置,报告货物位置";
 NSLocationAlwaysUsageDescription = "报告货物位置";