|
|
@@ -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) {
|
|
|
|