Commit d1da53f0 authored by 林生雨's avatar 林生雨

commit

parent c4e2b084
This diff is collapsed.
......@@ -132,6 +132,7 @@ class GengmeiFlutterPlugin : MethodCallHandler {
when (requestCode) {
CAMERA_REQUEST_CODE -> {
if (resultCode == RESULT_OK) {
android.util.Log.e("lsy"," RESULT OKKKKK ")
if (nativeImage != null && nativeImage!!.exists()) {
ImageRespository.getInstance().scareImg(nativeImage!!.absolutePath).subscribe({
val map = HashMap<String, Any>()
......@@ -139,6 +140,8 @@ class GengmeiFlutterPlugin : MethodCallHandler {
map.put("path", it.second)
map.put("isVideo", "F")
map.put("folderName", "GengmeiAlbum")
android.util.Log.e("lsy"," RESULT MAPPP ")
// try {
// MediaStore.Images.Media.insertImage(resign.context().applicationContext.getContentResolver(),
// nativeImage!!.absolutePath, getFileName(nativeImage!!.absolutePath), null);
......@@ -212,6 +215,7 @@ class GengmeiFlutterPlugin : MethodCallHandler {
ScanImage(result)
}
NATIVE_CAMERA -> {
gotoNativeCameraKey=resultKey;
gotoNativeCamera(call.argument<String>("authority")!!)
}
SAVE_STRING_SHARED -> {
......
......@@ -2,9 +2,8 @@
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Users/apple/Downloads/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/apple/lsy/gengmei_flutter_plugin/example"
export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_TARGET=/Users/apple/lsy/gengmei_flutter_plugin/example/lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "FLUTTER_FRAMEWORK_DIR=/Users/apple/Downloads/flutter/bin/cache/artifacts/engine/ios"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
export "TRACK_WIDGET_CREATION=true"
......@@ -14,9 +14,9 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/gengmei_flutter_plugin/ios"
SPEC CHECKSUMS:
Flutter: 58dd7d1b27887414a370fcccb9e645c08ffd7a6a
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
gengmei_flutter_plugin: 9461e8644c06c4a0e38292ddcca1cc55e6ac6156
PODFILE CHECKSUM: 7fb83752f59ead6285236625b82473f90b1cb932
COCOAPODS: 1.7.4
COCOAPODS: 1.8.4
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
archive:
dependency: transitive
description:
name: archive
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.10"
args:
dependency: transitive
description:
name: args
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.5.2"
async:
dependency: transitive
description:
......@@ -43,20 +29,6 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.14.11"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.1"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.3"
cupertino_icons:
dependency: "direct main"
description:
......@@ -81,13 +53,6 @@ packages:
relative: true
source: path
version: "0.0.735"
image:
dependency: transitive
description:
name: image
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.4"
matcher:
dependency: transitive
description:
......@@ -116,13 +81,6 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.0+1"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.4.0"
quiver:
dependency: transitive
description:
......@@ -198,12 +156,5 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.8"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.5.0"
sdks:
dart: ">=2.4.0 <3.0.0"
dart: ">=2.2.2 <3.0.0"
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<component name="NewModuleRootManager" inherit-compiler-output="$ENABLE_FLUTTER_DESKTOP$">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />
......
......@@ -383,45 +383,7 @@ NSString *cacheDirectory;
[video setImagePre:assets];
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :@YES];
// if([fileManager fileExistsAtPath:tempTake]){
// NSMutableDictionary *dict=[[NSMutableDictionary alloc] init];
// [dict setObject:path forKey:@"path"];
// [dict setObject:tempTake forKey:@"realImagePath"];
// [[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :dict];
// }else{
// dispatch_async(queue, ^{
// CFAbsoluteTime start=CFAbsoluteTimeGetCurrent();
// int picWidth=[assets pixelWidth];
// int picHeight=[assets pixelHeight];
// float tempScareSize=1;
// float limit=1024.0;
// float max=MAX(picWidth, picHeight);
// if(max>limit){
// tempScareSize=limit/max;
// }
// CGSize temp=CGSizeMake(picWidth*tempScareSize, picHeight*tempScareSize);
// __block bool isResult=false;
// [[PHImageManager defaultManager] requestImageForAsset:assets targetSize:temp contentMode:PHImageContentModeDefault options:imageRequestOption resultHandler:^(UIImage * _Nullable result, NSDictionary * _Nullable info) {
// if(isResult){
// return ;
// }
// isResult=true;
// @autoreleasepool{
// NSData *data = UIImageJPEGRepresentation(result, 0.7) ;
// [data writeToFile:tempTake atomically:YES];
// // result=nil;
// // data=nil;
// }
// NSMutableDictionary *dict=[[NSMutableDictionary alloc] init];
// [dict setObject:path forKey:@"path"];
// [dict setObject:tempTake forKey:@"realImagePath"];
// dispatch_async(dispatch_get_main_queue(), ^{
// NSLog(@"压缩预览图片耗时:%f ms Temp路径%@",(CFAbsoluteTimeGetCurrent()-start)*1000,tempTake);
// [[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :dict];
// });
// }];
// });
// }
}else if ([[self.takePhotoMap allKeys] containsObject:path]){
MyPreviewController* video=[[MyPreviewController alloc] init];
[viewController presentViewController:video animated:YES completion:nil];
......@@ -434,6 +396,60 @@ NSString *cacheDirectory;
}else{
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :nil];
}
}else if([@"scare_image" isEqualToString:call.method] ){
long resultTemp=self.resultKey;
NSMutableDictionary * dict =call.arguments;
int size=dict[@"size"];
PHImageRequestOptions *imageRequestOption = [[PHImageRequestOptions alloc] init];
imageRequestOption.synchronous =NO;
imageRequestOption.networkAccessAllowed = YES;
imageRequestOption.deliveryMode=PHImageRequestOptionsDeliveryModeHighQualityFormat;
imageRequestOption.resizeMode=PHImageRequestOptionsResizeModeFast;
imageRequestOption.version=PHImageRequestOptionsVersionUnadjusted;
NSString *tempPath = NSTemporaryDirectory();
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString* path=dict[@"path"];
if(path!=nil){
if([[self.scanMap allKeys] containsObject:path]){
NSString* name=[path lastPathComponent];
NSString* tempTake= [tempPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@%@",name,@"_preview"]];
PHAsset * assets=self.scanMap[path];
if([fileManager fileExistsAtPath:tempTake]){
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :tempTake];
}else{
dispatch_async(queue, ^{
CFAbsoluteTime start=CFAbsoluteTimeGetCurrent();
int picWidth=[assets pixelWidth];
int picHeight=[assets pixelHeight];
float tempScareSize=1;
float limit=size+0.0;
float max=MAX(picWidth, picHeight);
if(max>limit){
tempScareSize=limit/max;
}
CGSize temp=CGSizeMake(picWidth*tempScareSize, picHeight*tempScareSize);
__block bool isResult=false;
[[PHImageManager defaultManager] requestImageForAsset:assets targetSize:temp contentMode:PHImageContentModeDefault options:imageRequestOption resultHandler:^(UIImage * _Nullable result, NSDictionary * _Nullable info) {
if(isResult){
return ;
}
isResult=true;
@autoreleasepool{
NSData *data = UIImageJPEGRepresentation(result, 1) ;
[data writeToFile:tempTake atomically:YES];
// result=nil;
// data=nil;
}
NSLog(@"压缩预览图片耗时:%f ms Temp路径%@",(CFAbsoluteTimeGetCurrent()-start)*1000,tempTake);
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :tempTake];
}];
});
}
}else if ([[self.takePhotoMap allKeys] containsObject:path]){
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :self.takePhotoMap[path]];
}
}
}else if([@"play_album_video" isEqualToString:call.method] ){
long resultTemp=self.resultKey;
NSString * path=call.arguments;
......@@ -923,12 +939,12 @@ CFAbsoluteTime startTime;
-(void)popWindow:(NSString*)str{
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:str preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
NSLog(@"确定");
}];
[alertController addAction:okAction];
[viewController presentViewController:alertController animated:YES completion:nil];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
NSLog(@"确定");
}];
[alertController addAction:okAction];
[viewController presentViewController:alertController animated:YES completion:nil];
}
//-(void)execRealImg:(long)resultId{
......
......@@ -38,6 +38,12 @@ class ScanImagePlugn {
.invokeMethod("native_camera", {"authority": authority});
}
static Future<String> scareImg(
MethodChannel channel, String path, int scare) async {
return await channel
.invokeMethod("scare_image", {"path": path, "size": scare});
}
static Future<bool> quitPage(MethodChannel channel) async {
return await channel.invokeMethod("quit_page");
}
......
......@@ -19,6 +19,10 @@ class GengmeiFlutterPlugin {
return await ScanImagePlugn.scanImages(_channel);
}
static Future<String> scareImg(String path, int scare) async {
return await ScanImagePlugn.scareImg(_channel, path, scare);
}
static Future<Map> nativeCamera(String authority) async {
return await ScanImagePlugn.nativeCamera(_channel, authority);
}
......
......@@ -7,14 +7,14 @@ packages:
name: async
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.0"
version: "2.3.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.4"
version: "1.0.5"
charcode:
dependency: transitive
description:
......@@ -52,28 +52,28 @@ packages:
name: meta
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.6"
version: "1.1.7"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.6.2"
version: "1.6.4"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.7.0"
version: "1.8.0+1"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.3"
version: "2.0.5"
sky_engine:
dependency: transitive
description: flutter
......@@ -106,7 +106,7 @@ packages:
name: string_scanner
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.4"
version: "1.0.5"
term_glyph:
dependency: transitive
description:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment