Commit 732b57d5 authored by 林生雨's avatar 林生雨

coomit

parent 9e406c65
......@@ -5,12 +5,7 @@
<option name="TOOL_WINDOW_CONFIGURED_FILTER" value="Show only selected application" />
</component>
<component name="ChangeListManager">
<list default="true" id="5be6bbb5-7d6e-4540-a24f-d2b3bf78b3ba" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/ios/Classes/GengmeiFlutterPlugin.m" beforeDir="false" afterPath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/ios/Classes/GengmeiFlutterPlugin.m" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m" beforeDir="false" afterPath="$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m" afterDir="false" />
</list>
<list default="true" id="5be6bbb5-7d6e-4540-a24f-d2b3bf78b3ba" name="Default Changelist" comment="" />
<ignored path="$PROJECT_DIR$/.dart_tool/" />
<ignored path="$PROJECT_DIR$/.idea/" />
<ignored path="$PROJECT_DIR$/.pub/" />
......@@ -106,8 +101,8 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="11616">
<caret line="549" column="22" selection-start-line="549" selection-start-column="22" selection-end-line="549" selection-end-column="22" />
<state relative-caret-position="11506">
<caret line="544" column="22" selection-start-line="544" selection-start-column="22" selection-end-line="544" selection-end-column="22" />
</state>
</provider>
</entry>
......@@ -188,7 +183,8 @@
</option>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="y" value="35" />
<option name="x" value="-33" />
<option name="y" value="23" />
<option name="width" value="1440" />
<option name="height" value="811" />
</component>
......@@ -306,8 +302,9 @@
</component>
<component name="ToolWindowManager">
<frame x="9" y="23" width="1440" height="811" extended-state="6" />
<editor active="true" />
<layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.19742489" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.19742489" />
<window_info id="Captures" order="1" side_tool="true" />
<window_info id="Structure" order="2" side_tool="true" />
<window_info id="Image Layers" order="3" />
......@@ -322,7 +319,7 @@
<window_info anchor="bottom" id="Android Profiler" order="3" show_stripe_button="false" />
<window_info anchor="bottom" id="Logcat" order="4" weight="0.4534075" />
<window_info anchor="bottom" id="Debug" order="5" />
<window_info anchor="bottom" id="Terminal" order="6" visible="true" weight="0.29346314" />
<window_info active="true" anchor="bottom" id="Terminal" order="6" visible="true" weight="0.29346314" />
<window_info anchor="bottom" id="Event Log" order="7" side_tool="true" />
<window_info anchor="bottom" id="Flutter Performance" order="8" side_tool="true" />
<window_info anchor="bottom" id="Version Control" order="9" />
......@@ -534,8 +531,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="11616">
<caret line="549" column="22" selection-start-line="549" selection-start-column="22" selection-end-line="549" selection-end-column="22" />
<state relative-caret-position="11506">
<caret line="544" column="22" selection-start-line="544" selection-start-column="22" selection-end-line="544" selection-end-column="22" />
</state>
</provider>
</entry>
......
......@@ -25,7 +25,7 @@
@end
@implementation GengmeiFlutterPlugin
dispatch_queue_t concurrentQueue;
FlutterEventSink _eventSink;
NSMutableArray<AlbumItem *> *assetCollectionList;
UIViewController * viewController;
......@@ -43,7 +43,7 @@ NSString *cacheDirectory;
[registrar addMethodCallDelegate:instance channel:channel];
assetCollectionList = [NSMutableArray array];
viewController =[UIApplication sharedApplication].delegate.window.rootViewController;
// queue = dispatch_queue_create("com.gengmei_flutter_plugin", DISPATCH_QUEUE_CONCURRENT);
concurrentQueue = dispatch_queue_create("com.gengmei_flutter_plugin", DISPATCH_QUEUE_CONCURRENT);
queue = dispatch_queue_create("com.gengmei_flutter_plugin", DISPATCH_QUEUE_SERIAL);
FlutterEventChannel* chargingChannel = [FlutterEventChannel
eventChannelWithName:@"gengmei_flutter_plugin_event"
......@@ -228,7 +228,7 @@ NSString *cacheDirectory;
NSArray<NSString*> *path=call.arguments;
long resultTemp=self.resultKey;
if(path!=nil){
dispatch_async(queue, ^{
dispatch_async(concurrentQueue, ^{
[self.channelList removeAllObjects];
if(path.count==0){
dispatch_async(dispatch_get_main_queue(), ^{
......@@ -285,18 +285,20 @@ NSString *cacheDirectory;
});
}
}else{
int picWidth=[assets pixelWidth];
int picHeight=[assets pixelHeight];
float tempScareSize=1;
float limit=1560.0;
float max=MAX(picWidth, picHeight);
if(max>limit){
tempScareSize=limit/max;
}
CGSize temp=CGSizeMake(picWidth*tempScareSize, picHeight*tempScareSize);
// int picWidth=[assets pixelWidth];
// int picHeight=[assets pixelHeight];
// float tempScareSize=1;
// float limit=1560.0;
// float max=MAX(picWidth, picHeight);
// if(max>limit){
// tempScareSize=limit/max;
// }
//
// CGSize temp=CGSizeMake(picWidth*tempScareSize, picHeight*tempScareSize);
[[PHImageManager defaultManager] requestImageDataForAsset:assets options:imageRequestOption resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) {
// [[PHImageManager defaultManager] requestImageForAsset:assets targetSize:temp contentMode:PHImageContentModeDefault options:imageRequestOption resultHandler:^(UIImage * _Nullable res, NSDictionary * _Nullable info) {
dispatch_async(concurrentQueue, ^{
@autoreleasepool{
UIImage * res=[UIImage imageWithData:imageData];
NSData *data = UIImageJPEGRepresentation(res, 0.8) ;
......@@ -316,6 +318,7 @@ NSString *cacheDirectory;
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :self.channelList];
});
}
});
}];
}
}
......@@ -341,6 +344,56 @@ NSString *cacheDirectory;
}else{
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :nil];
}
}else if([@"IOS_IMAGE_ITEM" isEqualToString:call.method]){
long resultTemp=self.resultKey;
NSString*path=call.arguments;
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];
if([[self.scanMap allKeys] containsObject:path]){
NSString* tempTake= [tempPath stringByAppendingPathComponent:[path lastPathComponent]];
PHAsset * assets=self.scanMap[path];
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{
int picWidth=[assets pixelWidth];
int picHeight=[assets pixelHeight];
float tempScareSize=1;
float limit=1560.0;
float max=MAX(picWidth, picHeight);
if(max>limit){
tempScareSize=limit/max;
}
CGSize temp=CGSizeMake(picWidth*tempScareSize, picHeight*tempScareSize);
[[PHImageManager defaultManager] requestImageForAsset:assets targetSize:temp contentMode:PHImageContentModeDefault options:imageRequestOption resultHandler:^(UIImage * _Nullable result, NSDictionary * _Nullable info) {
@autoreleasepool{
NSData *data = UIImageJPEGRepresentation(result, 0.8) ;
[data writeToFile:tempTake atomically:YES];
result=nil;
data=nil;
}
NSMutableDictionary *dict=[[NSMutableDictionary alloc] init];
[dict setObject:path forKey:@"path"];
[dict setObject:tempTake forKey:@"realImagePath"];
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :dict];
}];
}
}else if ([[self.takePhotoMap allKeys] containsObject:path]){
NSMutableDictionary *dict=[[NSMutableDictionary alloc] init];
[dict setObject:path forKey:@"path"];
[dict setObject:self.takePhotoMap[path] forKey:@"realImagePath"];
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :dict];
}else{
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :nil];
}
}else{
result(FlutterMethodNotImplemented);
}
......
......@@ -46,6 +46,11 @@ class ScanImagePlugn {
MethodChannel channel, List<String> path) async {
return await channel.invokeMethod("IOS_IMAGE_BY_PATH", path);
}
static Future<Map> ios_album_item(
MethodChannel channel, String path) async {
return await channel.invokeMethod("IOS_IMAGE_ITEM", path);
}
}
class ScanImageItem {
......
......@@ -27,6 +27,10 @@ class GengmeiFlutterPlugin {
return await ScanImagePlugn.ios_album_path(_channel, path);
}
static Future<Map> ios_album_item(String path) async {
return await ScanImagePlugn.ios_album_item(_channel, path);
}
static Future<bool> quitPage() async {
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