1.update
parent
179eeacc95
commit
e25f744df4
|
@ -123,10 +123,16 @@ static MopPlugin *_instance;
|
||||||
result([self appInfoDictWithAppId:call.arguments[@"appId"]]);
|
result([self appInfoDictWithAppId:call.arguments[@"appId"]]);
|
||||||
}
|
}
|
||||||
else if ([@"getScreenshot" isEqualToString:call.method]) {
|
else if ([@"getScreenshot" isEqualToString:call.method]) {
|
||||||
UIImage *image = [MOPTools imageWithScreenshot];
|
UIViewController *currentVC = [MOPTools topViewController];
|
||||||
NSString *filePtah = [[FATClient sharedClient] saveFile:UIImagePNGRepresentation(image) fileName:[NSString stringWithFormat:@"%@",call.arguments[@"appId"]]];
|
[currentVC.view fatHideToastActivity];
|
||||||
filePtah = [[FATClient sharedClient] fat_absolutePathWithPath:filePtah];
|
[currentVC.view fatHideAllToasts];
|
||||||
result(filePtah);
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
|
UIImage *image = [MOPTools imageWithScreenshot];
|
||||||
|
// UIImage *image = [[FATClient sharedClient] getCurrentAppletImage];
|
||||||
|
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]) {
|
else if ([@"getPhoneNumberResult" isEqualToString:call.method]) {
|
||||||
if ([MOPAppletDelegate instance].bindGetPhoneNumbers) {
|
if ([MOPAppletDelegate instance].bindGetPhoneNumbers) {
|
||||||
|
|
|
@ -186,7 +186,7 @@
|
||||||
CGContextSetInterpolationQuality(context, kCGInterpolationNone);
|
CGContextSetInterpolationQuality(context, kCGInterpolationNone);
|
||||||
CGContextScaleCTM(context, 1.0, -1.0);//生成的QRCode就是上下颠倒的,需要翻转一下
|
CGContextScaleCTM(context, 1.0, -1.0);//生成的QRCode就是上下颠倒的,需要翻转一下
|
||||||
CGContextDrawImage(context, CGContextGetClipBoundingBox(context), cgImage);
|
CGContextDrawImage(context, CGContextGetClipBoundingBox(context), cgImage);
|
||||||
UIImage *codeImage = UIGraphicsGetImageFromCurrentImageContext();
|
UIGraphicsGetImageFromCurrentImageContext();
|
||||||
UIGraphicsEndImageContext();
|
UIGraphicsEndImageContext();
|
||||||
CGImageRelease(cgImage);
|
CGImageRelease(cgImage);
|
||||||
|
|
||||||
|
@ -199,9 +199,14 @@
|
||||||
|
|
||||||
|
|
||||||
CGSize imageSize = CGSizeZero;
|
CGSize imageSize = CGSizeZero;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
|
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
|
||||||
if (UIInterfaceOrientationIsPortrait(orientation)) {
|
if (UIInterfaceOrientationIsPortrait(orientation)) {
|
||||||
imageSize = [UIScreen mainScreen].bounds.size;
|
// imageSize = [UIScreen mainScreen].bounds.size;
|
||||||
|
imageSize = CGSizeMake([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height - [self getStatusHeight]);
|
||||||
} else {
|
} else {
|
||||||
imageSize = CGSizeMake([UIScreen mainScreen].bounds.size.height, [UIScreen mainScreen].bounds.size.width);
|
imageSize = CGSizeMake([UIScreen mainScreen].bounds.size.height, [UIScreen mainScreen].bounds.size.width);
|
||||||
}
|
}
|
||||||
|
@ -210,9 +215,9 @@
|
||||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||||
for (UIWindow *window in [[UIApplication sharedApplication] windows]) {
|
for (UIWindow *window in [[UIApplication sharedApplication] windows]) {
|
||||||
CGContextSaveGState(context);
|
CGContextSaveGState(context);
|
||||||
CGContextTranslateCTM(context, window.center.x, window.center.y);
|
CGContextTranslateCTM(context, window.center.x, window.center.y - [self getStatusHeight]);
|
||||||
CGContextConcatCTM(context, window.transform);
|
CGContextConcatCTM(context, window.transform);
|
||||||
CGContextTranslateCTM(context, -window.bounds.size.width * window.layer.anchorPoint.x, -window.bounds.size.height * window.layer.anchorPoint.y);
|
CGContextTranslateCTM(context, -window.bounds.size.width * window.layer.anchorPoint.x, -(window.bounds.size.height + [self getStatusHeight] ) * window.layer.anchorPoint.y);
|
||||||
if (orientation == UIInterfaceOrientationLandscapeLeft) {
|
if (orientation == UIInterfaceOrientationLandscapeLeft) {
|
||||||
CGContextRotateCTM(context, M_PI_2);
|
CGContextRotateCTM(context, M_PI_2);
|
||||||
CGContextTranslateCTM(context, 0, -imageSize.width);
|
CGContextTranslateCTM(context, 0, -imageSize.width);
|
||||||
|
@ -224,7 +229,7 @@
|
||||||
CGContextTranslateCTM(context, -imageSize.width, -imageSize.height);
|
CGContextTranslateCTM(context, -imageSize.width, -imageSize.height);
|
||||||
}
|
}
|
||||||
if ([window respondsToSelector:@selector(drawViewHierarchyInRect:afterScreenUpdates:)]) {
|
if ([window respondsToSelector:@selector(drawViewHierarchyInRect:afterScreenUpdates:)]) {
|
||||||
[window drawViewHierarchyInRect:window.bounds afterScreenUpdates:YES];
|
[window drawViewHierarchyInRect:CGRectMake(0, [self getStatusHeight], window.bounds.size.width, window.bounds.size.height - [self getStatusHeight]) afterScreenUpdates:YES];
|
||||||
} else {
|
} else {
|
||||||
[window.layer renderInContext:context];
|
[window.layer renderInContext:context];
|
||||||
}
|
}
|
||||||
|
@ -236,4 +241,16 @@
|
||||||
return [UIImage imageWithData:imageData];
|
return [UIImage imageWithData:imageData];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// 顶部状态栏高度(包括安全区)
|
||||||
|
+ (CGFloat)getStatusHeight {
|
||||||
|
if (@available(iOS 13.0, *)) {
|
||||||
|
NSSet *set = [UIApplication sharedApplication].connectedScenes;
|
||||||
|
UIWindowScene *windowScene = [set anyObject];
|
||||||
|
UIStatusBarManager *statusBarManager = windowScene.statusBarManager;
|
||||||
|
return statusBarManager.statusBarFrame.size.height;
|
||||||
|
} else {
|
||||||
|
return [UIApplication sharedApplication].statusBarFrame.size.height;
|
||||||
|
}
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in New Issue