Commit 119c7c10 authored by 林生雨's avatar 林生雨

commit

parent 8ff33dab
This diff is collapsed.
...@@ -508,7 +508,58 @@ NSString *cacheDirectory; ...@@ -508,7 +508,58 @@ NSString *cacheDirectory;
NSLog(@"NEED CA<<<<>>>>><<>>"); NSLog(@"NEED CA<<<<>>>>><<>>");
} }
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :@YES]; [[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :@YES];
}else if([@"GET_IOS_IMAGE_DATA" isEqualToString:call.method]){
NSString *path=call.arguments;
long resultTemp=self.resultKey;
if(path!=nil){
if([[self.scanMap allKeys] containsObject:path]){
PHAsset * assets=self.scanMap[path];
PHImageRequestOptions *imageRequestOption = [[PHImageRequestOptions alloc] init];
imageRequestOption.synchronous =NO;
imageRequestOption.networkAccessAllowed = YES;
imageRequestOption.deliveryMode=PHImageRequestOptionsDeliveryModeHighQualityFormat;
imageRequestOption.resizeMode=PHImageRequestOptionsResizeModeFast;
imageRequestOption.version=PHImageRequestOptionsVersionUnadjusted;
[[PHImageManager defaultManager] requestImageDataForAsset:assets options:imageRequestOption resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) {
@autoreleasepool{
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :imageData];
}
}];
}else if ([[self.takePhotoMap allKeys] containsObject:path]){
@autoreleasepool{
NSString* realPath=self.takePhotoMap[path];
NSData *data = [NSData dataWithContentsOfFile:realPath];
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :data];
}
}else{
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :nil];
}
}else{ }else{
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :nil];
}
}else if([@"GET_IOS_IMAGE_DATA" isEqualToString:call.method]){
NSString *path=call.arguments;
long resultTemp=self.resultKey;
if(path!=nil){
if([[self.scanMap allKeys] containsObject:path]){
PHAsset * assets=self.scanMap[path];
PHVideoRequestOptions *options = [[PHVideoRequestOptions alloc] init];
options.version = PHImageRequestOptionsVersionCurrent;
options.networkAccessAllowed = true;
options.deliveryMode = PHVideoRequestOptionsDeliveryModeAutomatic;
[[PHImageManager defaultManager]requestAVAssetForVideo:assets options:options resultHandler:^(AVAsset * _Nullable asset, AVAudioMix * _Nullable audioMix, NSDictionary * _Nullable info) {
AVURLAsset *urlAsset = (AVURLAsset *)asset;
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :[NSString stringWithFormat:@"%@",urlAsset.URL]];
}];
}else{
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :nil];
}
}else{
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :nil];
}
}
else{
result(FlutterMethodNotImplemented); result(FlutterMethodNotImplemented);
} }
} }
......
...@@ -75,6 +75,14 @@ class ScanImagePlugn { ...@@ -75,6 +75,14 @@ class ScanImagePlugn {
} }
} }
static Future getIosImageData(MethodChannel channel, String path) async {
return await channel.invokeMethod("GET_IOS_IMAGE_DATA", path);
}
static Future getIosVideoData(MethodChannel channel, String path) async {
return await channel.invokeMethod("GET_IOS_IMAGE_DATA", path);
}
static Future<List> ios_album_path( static Future<List> ios_album_path(
MethodChannel channel, List<String> path) async { MethodChannel channel, List<String> path) async {
return await channel.invokeMethod("IOS_IMAGE_BY_PATH", path); return await channel.invokeMethod("IOS_IMAGE_BY_PATH", path);
......
...@@ -49,6 +49,14 @@ class GengmeiFlutterPlugin { ...@@ -49,6 +49,14 @@ class GengmeiFlutterPlugin {
isVideo, path, realPath, folderName, during, _channel); isVideo, path, realPath, folderName, during, _channel);
} }
static Future getIosImageData(String path) async {
return await ScanImagePlugn.getIosImageData(_channel, path);
}
static Future getIosVideoData(String path) async {
return await ScanImagePlugn.getIosVideoData(_channel, path);
}
static Future<bool> quitPage() async { static Future<bool> quitPage() async {
return await ScanImagePlugn.quitPage(_channel); return await ScanImagePlugn.quitPage(_channel);
} }
......
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