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

commit

parent 971be4de
...@@ -6,15 +6,7 @@ ...@@ -6,15 +6,7 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="5be6bbb5-7d6e-4540-a24f-d2b3bf78b3ba" name="Default Changelist" comment=""> <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/example/lib/AlbumModel/page/album/AlbumModel.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/example/lib/AlbumModel/page/album/AlbumModel.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/example/lib/AlbumModel/page/album/AlbumPage.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/example/lib/AlbumModel/page/album/AlbumPage.dart" 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$/example/lib/AlbumModel/page/album/AlbumModel.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumPage.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumPage.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m" beforeDir="false" afterPath="$PROJECT_DIR$/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" />
<change beforePath="$PROJECT_DIR$/lib/ScanImagePlugn.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/ScanImagePlugn.dart" afterDir="false" />
</list> </list>
<ignored path="$PROJECT_DIR$/.dart_tool/" /> <ignored path="$PROJECT_DIR$/.dart_tool/" />
<ignored path="$PROJECT_DIR$/.idea/" /> <ignored path="$PROJECT_DIR$/.idea/" />
...@@ -58,20 +50,20 @@ ...@@ -58,20 +50,20 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="true"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/ScanImagePlugn.dart"> <entry file="file://$PROJECT_DIR$/lib/ScanImagePlugn.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="289"> <state relative-caret-position="245">
<caret line="38" column="64" selection-start-line="38" selection-start-column="60" selection-end-line="38" selection-end-column="64" /> <caret line="37" column="38" selection-start-line="37" selection-start-column="24" selection-end-line="37" selection-end-column="38" />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart"> <entry file="file://$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="176"> <state relative-caret-position="190">
<caret line="21" column="19" selection-start-line="21" selection-start-column="19" selection-end-line="21" selection-end-column="19" /> <caret line="25" column="38" selection-start-line="25" selection-start-column="24" selection-end-line="25" selection-end-column="38" />
<folding> <folding>
<element signature="e#0#20#0" expanded="true" /> <element signature="e#0#20#0" expanded="true" />
</folding> </folding>
...@@ -112,8 +104,8 @@ ...@@ -112,8 +104,8 @@
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m"> <entry file="file://$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="9768"> <state relative-caret-position="10516">
<caret line="457" column="22" selection-start-line="457" selection-start-column="22" selection-end-line="457" selection-end-column="22" /> <caret line="491" column="22" selection-start-line="491" selection-start-column="22" selection-end-line="491" selection-end-column="22" />
</state> </state>
</provider> </provider>
</entry> </entry>
...@@ -181,11 +173,11 @@ ...@@ -181,11 +173,11 @@
<option value="$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/luban/Engine.kt" /> <option value="$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/luban/Engine.kt" />
<option value="$PROJECT_DIR$/lib/SharedPlugin.dart" /> <option value="$PROJECT_DIR$/lib/SharedPlugin.dart" />
<option value="$PROJECT_DIR$/example/lib/main.dart" /> <option value="$PROJECT_DIR$/example/lib/main.dart" />
<option value="$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart" />
<option value="$PROJECT_DIR$/example/lib/AlbumModel/repository/AlbumRepository.dart" /> <option value="$PROJECT_DIR$/example/lib/AlbumModel/repository/AlbumRepository.dart" />
<option value="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumPage.dart" /> <option value="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumPage.dart" />
<option value="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart" /> <option value="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart" />
<option value="$PROJECT_DIR$/lib/ScanImagePlugn.dart" /> <option value="$PROJECT_DIR$/lib/ScanImagePlugn.dart" />
<option value="$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart" />
</list> </list>
</option> </option>
</component> </component>
...@@ -309,9 +301,8 @@ ...@@ -309,9 +301,8 @@
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="618" y="-877" width="1440" height="812" extended-state="0" /> <frame x="618" y="-877" width="1440" height="812" extended-state="0" />
<editor active="true" />
<layout> <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="Captures" order="1" side_tool="true" />
<window_info id="Structure" order="2" side_tool="true" /> <window_info id="Structure" order="2" side_tool="true" />
<window_info id="Image Layers" order="3" /> <window_info id="Image Layers" order="3" />
...@@ -321,12 +312,12 @@ ...@@ -321,12 +312,12 @@
<window_info id="Capture Tool" order="7" /> <window_info id="Capture Tool" order="7" />
<window_info id="Favorites" order="8" side_tool="true" /> <window_info id="Favorites" order="8" side_tool="true" />
<window_info anchor="bottom" id="Dart Analysis" order="0" weight="0.32963988" /> <window_info anchor="bottom" id="Dart Analysis" order="0" weight="0.32963988" />
<window_info anchor="bottom" id="Run" order="1" visible="true" weight="0.375" /> <window_info anchor="bottom" id="Run" order="1" weight="0.375" />
<window_info anchor="bottom" id="TODO" order="2" /> <window_info anchor="bottom" id="TODO" order="2" />
<window_info anchor="bottom" id="Android Profiler" order="3" show_stripe_button="false" /> <window_info anchor="bottom" id="Android Profiler" order="3" show_stripe_button="false" />
<window_info anchor="bottom" id="Logcat" order="4" weight="0.5479833" /> <window_info anchor="bottom" id="Logcat" order="4" weight="0.5479833" />
<window_info anchor="bottom" id="Debug" order="5" /> <window_info anchor="bottom" id="Debug" order="5" />
<window_info anchor="bottom" id="Terminal" order="6" weight="0.36666667" /> <window_info active="true" anchor="bottom" id="Terminal" order="6" visible="true" weight="0.36666667" />
<window_info anchor="bottom" id="Event Log" order="7" side_tool="true" /> <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="Flutter Performance" order="8" side_tool="true" />
<window_info anchor="bottom" id="Version Control" order="9" /> <window_info anchor="bottom" id="Version Control" order="9" />
...@@ -559,8 +550,8 @@ ...@@ -559,8 +550,8 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m"> <entry file="file://$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="9768"> <state relative-caret-position="10516">
<caret line="457" column="22" selection-start-line="457" selection-start-column="22" selection-end-line="457" selection-end-column="22" /> <caret line="491" column="22" selection-start-line="491" selection-start-column="22" selection-end-line="491" selection-end-column="22" />
</state> </state>
</provider> </provider>
</entry> </entry>
...@@ -580,16 +571,6 @@ ...@@ -580,16 +571,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="176">
<caret line="21" column="19" selection-start-line="21" selection-start-column="19" selection-end-line="21" selection-end-column="19" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumPage.dart"> <entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumPage.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1229"> <state relative-caret-position="-1229">
...@@ -612,8 +593,18 @@ ...@@ -612,8 +593,18 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/ScanImagePlugn.dart"> <entry file="file://$PROJECT_DIR$/lib/ScanImagePlugn.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="289"> <state relative-caret-position="245">
<caret line="38" column="64" selection-start-line="38" selection-start-column="60" selection-end-line="38" selection-end-column="64" /> <caret line="37" column="38" selection-start-line="37" selection-start-column="24" selection-end-line="37" selection-end-column="38" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="190">
<caret line="25" column="38" selection-start-line="25" selection-start-column="24" selection-end-line="25" selection-end-column="38" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
......
...@@ -20,6 +20,9 @@ ...@@ -20,6 +20,9 @@
@property(atomic)Boolean finishScanImg; @property(atomic)Boolean finishScanImg;
@property(atomic,strong)NSMutableDictionary<NSString*,PHAsset *>*scanMap; @property(atomic,strong)NSMutableDictionary<NSString*,PHAsset *>*scanMap;
@property(atomic,strong)NSMutableDictionary<NSString*,NSString *>*takePhotoMap; @property(atomic,strong)NSMutableDictionary<NSString*,NSString *>*takePhotoMap;
@property(atomic,strong)NSMutableArray<NSString*>* channelList;
@property(atomic)int channelSize;
@property(atomic)int channelAllSize;
@end @end
@implementation GengmeiFlutterPlugin @implementation GengmeiFlutterPlugin
...@@ -222,14 +225,47 @@ NSString *cacheDirectory; ...@@ -222,14 +225,47 @@ NSString *cacheDirectory;
}); });
}); });
}else if([@"IOS_IMAGE_BY_PATH" isEqualToString:call.method]){ }else if([@"IOS_IMAGE_BY_PATH" isEqualToString:call.method]){
NSString *path=call.arguments[@"path"]; NSArray<NSString*> *path=call.arguments[@"path"];
long resultTemp=self.resultKey; long resultTemp=self.resultKey;
if(path!=nil){ if(path!=nil){
dispatch_async(queue, ^{ dispatch_async(queue, ^{
if([[self.scanMap allKeys] containsObject:path]){ [self.channelList removeAllObjects];
self.channelSize=0;
self.channelAllSize=path.count;
PHVideoRequestOptions *options = [[PHVideoRequestOptions alloc] init];
options.version = PHImageRequestOptionsVersionCurrent;
options.networkAccessAllowed = true;
options.deliveryMode = PHVideoRequestOptionsDeliveryModeAutomatic;
PHImageRequestOptions *imageRequestOption = [[PHImageRequestOptions alloc] init];
imageRequestOption.synchronous =YES;
imageRequestOption.networkAccessAllowed = YES;
NSString *tempPath = NSTemporaryDirectory(); NSString *tempPath = NSTemporaryDirectory();
NSString* tempTake= [tempPath stringByAppendingPathComponent:[NSString stringWithFormat:@"image_picker_%@", [[NSProcessInfo processInfo] globallyUniqueString]]]; NSFileManager *fileManager = [NSFileManager defaultManager];
PHAsset * assets=self.scanMap[path]; for (int i=0; i<path.count; i++) {
if([[self.scanMap allKeys] containsObject:path[i]]){
NSString* tempTake= [tempPath stringByAppendingPathComponent:[path[i] lastPathComponent]];
PHAsset * assets=self.scanMap[path[i]];
if (assets.mediaType==PHAssetMediaTypeVideo) {
[[PHImageManager defaultManager]requestAVAssetForVideo:assets options:options resultHandler:^(AVAsset * _Nullable asset, AVAudioMix * _Nullable audioMix, NSDictionary * _Nullable info) {
AVURLAsset *urlAsset = (AVURLAsset *)asset;
self.channelSize++;
[self.channelList addObject:[NSString stringWithFormat:@"%@",urlAsset.URL]];
if(self.channelSize==self.channelAllSize){
dispatch_async(dispatch_get_main_queue(), ^{
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :self.channelList];
});
}
}];
}else{
if([fileManager fileExistsAtPath:tempPath]){
self.channelSize++;
[self.channelList addObject:[NSString stringWithFormat:@"%@",tempTake]];
if(self.channelSize==self.channelAllSize){
dispatch_async(dispatch_get_main_queue(), ^{
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :self.channelList];
});
}
}else{
int picWidth=[assets pixelWidth]; int picWidth=[assets pixelWidth];
int picHeight=[assets pixelHeight]; int picHeight=[assets pixelHeight];
float tempScareSize=1; float tempScareSize=1;
...@@ -238,9 +274,7 @@ NSString *cacheDirectory; ...@@ -238,9 +274,7 @@ NSString *cacheDirectory;
if(max>limit){ if(max>limit){
tempScareSize=limit/max; tempScareSize=limit/max;
} }
PHImageRequestOptions *imageRequestOption = [[PHImageRequestOptions alloc] init];
imageRequestOption.synchronous =YES;
imageRequestOption.networkAccessAllowed = YES;
CGSize temp=CGSizeMake(picWidth*tempScareSize, picHeight*tempScareSize); CGSize temp=CGSizeMake(picWidth*tempScareSize, picHeight*tempScareSize);
[[PHImageManager defaultManager] requestImageForAsset:assets targetSize:temp contentMode:PHImageContentModeDefault options:imageRequestOption resultHandler:^(UIImage * _Nullable res, NSDictionary * _Nullable info) { [[PHImageManager defaultManager] requestImageForAsset:assets targetSize:temp contentMode:PHImageContentModeDefault options:imageRequestOption resultHandler:^(UIImage * _Nullable res, NSDictionary * _Nullable info) {
@autoreleasepool{ @autoreleasepool{
...@@ -249,17 +283,29 @@ NSString *cacheDirectory; ...@@ -249,17 +283,29 @@ NSString *cacheDirectory;
data=nil; data=nil;
res=nil; res=nil;
} }
self.channelSize++;
[self.channelList addObject:[NSString stringWithFormat:@"%@",tempTake]];
if(self.channelSize==self.channelAllSize){
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :tempTake]; [[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :self.channelList];
}); });
}
}]; }];
}
}
}else if ([[self.takePhotoMap allKeys] containsObject:path]){ }else if ([[self.takePhotoMap allKeys] containsObject:path]){
self.channelSize++;
[self.channelList addObject:[NSString stringWithFormat:@"%@",self.takePhotoMap[path]]];
if(self.channelSize==self.channelAllSize){
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :self.takePhotoMap[path]]; [[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :self.channelList];
}); });
}
}else{ }else{
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :nil]; [[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :nil];
} }
}
}); });
}else{ }else{
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :nil]; [[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :nil];
...@@ -364,6 +410,10 @@ NSString *cacheDirectory; ...@@ -364,6 +410,10 @@ NSString *cacheDirectory;
if(self.takePhotoMap==nil){ if(self.takePhotoMap==nil){
self.takePhotoMap=[NSMutableDictionary dictionary]; self.takePhotoMap=[NSMutableDictionary dictionary];
} }
if(self.channelList==nil){
self.channelList=[[NSMutableArray alloc] init];
}
[self.channelList removeAllObjects];
[self.finalMap removeAllObjects]; [self.finalMap removeAllObjects];
[self.scanMap removeAllObjects]; [self.scanMap removeAllObjects];
[self.takePhotoMap removeAllObjects]; [self.takePhotoMap removeAllObjects];
...@@ -759,6 +809,7 @@ NSString *cacheDirectory; ...@@ -759,6 +809,7 @@ NSString *cacheDirectory;
-(void)resultImgs:(long)resultId{ -(void)resultImgs:(long)resultId{
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
self.finishScanImg=true;
if(!self.quitPage){ if(!self.quitPage){
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultId] :self.finalMap]; [[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultId] :self.finalMap];
// dispatch_async(queue, ^{ // dispatch_async(queue, ^{
......
...@@ -35,8 +35,8 @@ class ScanImagePlugn { ...@@ -35,8 +35,8 @@ class ScanImagePlugn {
return await channel.invokeMethod("quit_page"); return await channel.invokeMethod("quit_page");
} }
static Future<String> ios_album_path( static Future<List> ios_album_path(
MethodChannel channel, String path) async { MethodChannel channel, List<String> path) async {
return await channel.invokeMethod("IOS_IMAGE_BY_PATH", {"path", path}); return await channel.invokeMethod("IOS_IMAGE_BY_PATH", {"path", path});
} }
} }
......
...@@ -23,7 +23,7 @@ class GengmeiFlutterPlugin { ...@@ -23,7 +23,7 @@ class GengmeiFlutterPlugin {
return await ScanImagePlugn.nativeCamera(_channel, authority); return await ScanImagePlugn.nativeCamera(_channel, authority);
} }
static Future<String> ios_album_path(String path) async { static Future<List> ios_album_path(List<String> path) async {
return await ScanImagePlugn.ios_album_path(_channel, path); return await ScanImagePlugn.ios_album_path(_channel, path);
} }
......
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