1.update
parent
39e5a2b52b
commit
ad5d698c66
|
@ -94,15 +94,15 @@ static MopPlugin *_instance;
|
|||
result(dict);
|
||||
}
|
||||
else if ([@"showShareAppletDialog" isEqualToString:call.method]) {
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
UIImage *image = [[FATClient sharedClient] getDefaultCurrentAppletImage:400.0f];
|
||||
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
UIImage *image = [MOPTools getCurrentPageImage];
|
||||
MopShareView *view = [MopShareView viewWithData:call.arguments];
|
||||
view.image = image;
|
||||
[view show];
|
||||
[view setDidSelcetTypeBlock:^(NSString *type) {
|
||||
result(type);
|
||||
}];
|
||||
});
|
||||
// });
|
||||
}
|
||||
else if ([@"showLoading" isEqualToString:call.method]) {
|
||||
UIViewController *currentVC = [MOPTools topViewController];
|
||||
|
@ -124,14 +124,15 @@ static MopPlugin *_instance;
|
|||
}
|
||||
else if ([@"getScreenshot" isEqualToString:call.method]) {
|
||||
UIViewController *currentVC = [MOPTools topViewController];
|
||||
[currentVC.view fatHideToastActivity];
|
||||
[currentVC.view fatHideAllToasts];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
UIImage *image = [[FATClient sharedClient] getDefaultCurrentAppletImage:0.0f];
|
||||
// [currentVC.view fatHideToastActivity];
|
||||
// [currentVC.view fatHideAllToasts];
|
||||
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
// UIImage *image = [[FATClient sharedClient] getDefaultCurrentAppletImage:0.0f];
|
||||
UIImage *image = [MOPTools getCurrentPageImage];
|
||||
NSString *filePtah = [[FATClient sharedClient] saveFile:UIImagePNGRepresentation(image) fileName:[NSString stringWithFormat:@"%@",call.arguments[@"appId"]]];
|
||||
filePtah = [[FATClient sharedClient] fat_absolutePathWithPath:filePtah];
|
||||
result(filePtah);
|
||||
});
|
||||
// });
|
||||
}
|
||||
else if ([@"getPhoneNumberResult" isEqualToString:call.method]) {
|
||||
if ([MOPAppletDelegate instance].bindGetPhoneNumbers) {
|
||||
|
|
|
@ -32,7 +32,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
/// @param string 二维码的内容
|
||||
+ (UIImage *)makeQRCodeForString:(NSString *)string;
|
||||
|
||||
|
||||
+ (UIImage *)getCurrentPageImage;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -206,5 +206,62 @@
|
|||
}
|
||||
}
|
||||
|
||||
+ (UIImage *)getCurrentPageImage {
|
||||
UIViewController *currentVC = [MOPTools topViewController];
|
||||
|
||||
UIGraphicsBeginImageContextWithOptions(CGSizeMake(currentVC.view.frame.size.width, 440), NO, [UIScreen mainScreen].scale);
|
||||
[currentVC.view.layer renderInContext:UIGraphicsGetCurrentContext()];
|
||||
UIImage *snapshotImage = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
return snapshotImage;
|
||||
}
|
||||
|
||||
// 截取当前屏幕 ,返回截取到的图片
|
||||
//+ (UIImage *)getCurrentPageImage {
|
||||
//
|
||||
//
|
||||
// CGSize imageSize = CGSizeZero;
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
|
||||
// if (UIInterfaceOrientationIsPortrait(orientation)) {
|
||||
// imageSize = [UIScreen mainScreen].bounds.size;
|
||||
// } else {
|
||||
// imageSize = CGSizeMake([UIScreen mainScreen].bounds.size.height, [UIScreen mainScreen].bounds.size.width);
|
||||
// }
|
||||
// // 绘制上下文
|
||||
// UIGraphicsBeginImageContextWithOptions(imageSize, NO, 0);
|
||||
// CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
// for (UIWindow *window in [[UIApplication sharedApplication] windows]) {
|
||||
// CGContextSaveGState(context);
|
||||
// CGContextTranslateCTM(context, window.center.x, window.center.y);
|
||||
// CGContextConcatCTM(context, window.transform);
|
||||
// CGContextTranslateCTM(context, -window.bounds.size.width * window.layer.anchorPoint.x, -window.bounds.size.height * window.layer.anchorPoint.y);
|
||||
// if (orientation == UIInterfaceOrientationLandscapeLeft) {
|
||||
// CGContextRotateCTM(context, M_PI_2);
|
||||
// CGContextTranslateCTM(context, 0, -imageSize.width);
|
||||
// } else if (orientation == UIInterfaceOrientationLandscapeRight) {
|
||||
// CGContextRotateCTM(context, -M_PI_2);
|
||||
// CGContextTranslateCTM(context, -imageSize.height, 0);
|
||||
// } else if (orientation == UIInterfaceOrientationPortraitUpsideDown) {
|
||||
// CGContextRotateCTM(context, M_PI);
|
||||
// CGContextTranslateCTM(context, -imageSize.width, -imageSize.height);
|
||||
// }
|
||||
// if ([window respondsToSelector:@selector(drawViewHierarchyInRect:afterScreenUpdates:)]) {
|
||||
// [window drawViewHierarchyInRect:window.bounds afterScreenUpdates:YES];
|
||||
// } else {
|
||||
// [window.layer renderInContext:context];
|
||||
// }
|
||||
// CGContextRestoreGState(context);
|
||||
// }
|
||||
// UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
|
||||
// UIGraphicsEndImageContext();
|
||||
// NSData *imageData = UIImagePNGRepresentation(image);
|
||||
// return [UIImage imageWithData:imageData];
|
||||
//}
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
|
|
@ -60,14 +60,14 @@ returnInsets = inset;\
|
|||
self.shareView.layer.cornerRadius = 6;
|
||||
self.shareView.backgroundColor = UIColor.whiteColor;
|
||||
|
||||
UIImageView *appletImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.shareView.frame.size.width, 300)];
|
||||
appletImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
UIImageView *appletImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 270, 300)];
|
||||
appletImageView.contentMode = UIViewContentModeScaleToFill;
|
||||
self.appletImageView = appletImageView;
|
||||
[self.shareView addSubview:appletImageView];
|
||||
|
||||
float bottomY = appletImageView.frame.size.height + appletImageView.frame.origin.y;
|
||||
UIView *line0 = [[UIView alloc] initWithFrame:CGRectMake(0, bottomY, self.shareView.frame.size.width, 0.5)];
|
||||
line0.backgroundColor = [MOPTools fat_dynamicColorWithLightHexString:@"#eeeeee" darkHexString:@"#2E2E2E"];
|
||||
line0.backgroundColor = [MOPTools fat_dynamicColorWithLightHexString:@"#eeeeee" darkHexString:@"#eeeeee"];
|
||||
[self.shareView addSubview:line0];
|
||||
|
||||
|
||||
|
@ -79,7 +79,7 @@ returnInsets = inset;\
|
|||
[self.shareView addSubview:descLabel];
|
||||
|
||||
UILabel *detailLabel = [[UILabel alloc] init];
|
||||
detailLabel.frame = CGRectMake(14, self.titleLabel.frame.size.height + self.titleLabel.frame.origin.y + 5, 168, 44);
|
||||
detailLabel.frame = CGRectMake(14, self.titleLabel.frame.size.height + self.titleLabel.frame.origin.y, 168, 44);
|
||||
detailLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:11];
|
||||
detailLabel.numberOfLines = 0;
|
||||
detailLabel.textColor = [MOPTools fat_dynamicColorWithLightHexString:@"#666666" darkHexString:@"#666666"];
|
||||
|
|
Loading…
Reference in New Issue