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

commit

parent f5a11ea7
......@@ -8,6 +8,7 @@
<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$/ios/Classes/GengmeiFlutterPlugin.m" beforeDir="false" afterPath="$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/.dart_tool/" />
<ignored path="$PROJECT_DIR$/.idea/" />
......@@ -315,7 +316,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 active="true" anchor="bottom" id="Terminal" order="6" visible="true" weight="0.6175243" />
<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" />
......
......@@ -16,8 +16,6 @@
@property(strong,atomic)NSMutableDictionary<NSString*,NSMutableArray<NSMutableDictionary<NSString*,NSObject*>*>*>* finalMapTemp;
@property(nonatomic,strong) UIImagePickerController *imagePicker;
@property(nonatomic)Boolean quitPage;
@property(atomic)Boolean execdTask;
@property(atomic)Boolean copyScareImgOk;
@property(atomic)Boolean finishScanImg;
@property(atomic,strong)NSMutableDictionary<NSString*,PHAsset *>*scanMap;
@property(atomic,strong)NSMutableDictionary<NSString*,NSString *>*takePhotoMap;
......@@ -428,12 +426,14 @@ NSString *cacheDirectory;
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:self.nativeCameraKey] :nil];
}
CFAbsoluteTime startTime;
-(void)scanPhone:(long)resultId{
self.quitPage=false;
if (self.finishScanImg) {
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultId] :self.finalMap];
return;
}
startTime=CFAbsoluteTimeGetCurrent();
if (self.finalMap==nil) {
self.finalMap=[NSMutableDictionary dictionary];
}
......@@ -557,15 +557,13 @@ NSString *cacheDirectory;
self.nowSize++;
[self.scanMap setObject:assets forKey:tmpPath];
NSMutableArray * arr=self.finalMap[docName];
@synchronized (self) {
if (arr==nil) {
self.finalMap[docName]=[NSMutableArray array];
[self.finalMap[docName] addObject:queryItemDict];
}else{
[self.finalMap[docName] addObject:queryItemDict];
}
[self.finalMap[@"IsGengmeiAlbumAllImages"] addObject:queryItemDict];
if (arr==nil) {
self.finalMap[docName]=[NSMutableArray array];
[self.finalMap[docName] addObject:queryItemDict];
}else{
[self.finalMap[docName] addObject:queryItemDict];
}
[self.finalMap[@"IsGengmeiAlbumAllImages"] addObject:queryItemDict];
NSLog(@"SCARE SIZEEE %d %d ",self.nowSize,self.needSize);
if(self.needSize>200){
if(self.nowSize<=201){
......@@ -582,11 +580,15 @@ NSString *cacheDirectory;
[self reslutImg:resultId];
}else if(self.nowSize==self.needSize){
self.finishScanImg=true;
CFAbsoluteTime linkTime = (CFAbsoluteTimeGetCurrent() - startTime);
NSLog(@"IOS COPY IMAGE 时间:%f ms",linkTime *1000.0);
[self upImgs];
}
}else{
if (self.nowSize==self.needSize) {
self.finishScanImg=true;
CFAbsoluteTime linkTime = (CFAbsoluteTimeGetCurrent() - startTime);
NSLog(@"IOS COPY IMAGE 时间:%f ms",linkTime *1000.0);
[self reslutImg:resultId];
self.finalMap=[self.finalMapTemp mutableCopy];
}
......@@ -639,29 +641,29 @@ NSString *cacheDirectory;
});
}];
}else{
int picWidth=[assets pixelWidth];
int picHeight=[assets pixelHeight];
float tempScareSize=1;
if(picWidth>picHeight){
if (picWidth>320.0) {
tempScareSize=320.0/picWidth;
}
}else{
if (picHeight>320.0) {
tempScareSize=320.0/picHeight;
}
}
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:tmpPath atomically:YES];
data=nil;
result=nil;
[[PHImageManager defaultManager]requestAVAssetForVideo:assets options:options resultHandler:^(AVAsset * _Nullable asset, AVAudioMix * _Nullable audioMix, NSDictionary * _Nullable info) {
//疑问 为什么不切换到对应的线程。。
int picWidth=[assets pixelWidth];
int picHeight=[assets pixelHeight];
float tempScareSize=1;
if(picWidth>picHeight){
if (picWidth>320.0) {
tempScareSize=320.0/picWidth;
}
}else{
if (picHeight>320.0) {
tempScareSize=320.0/picHeight;
}
}
[[PHImageManager defaultManager]requestAVAssetForVideo:assets options:options resultHandler:^(AVAsset * _Nullable asset, AVAudioMix * _Nullable audioMix, NSDictionary * _Nullable info) {
//疑问 为什么不切换到对应的线程。。
dispatch_async(queue, ^{
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:tmpPath atomically:YES];
// data=nil;
// result=nil;
}
dispatch_sync(queue, ^{
AVURLAsset *urlAsset = (AVURLAsset *)asset;
NSMutableDictionary* queryItemDict = [NSMutableDictionary dictionary];
[queryItemDict setObject:[self getVideoDuring:urlAsset.duration] forKey:@"during"];
......@@ -672,6 +674,7 @@ NSString *cacheDirectory;
});
}];
}];
}
}else{
if ([fileManager fileExistsAtPath:tmpPath]==YES){
......
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