Commit 60f3421d authored by 林生雨's avatar 林生雨

c

parent 9dad6bf6
This diff is collapsed.
...@@ -218,10 +218,26 @@ class AlbumModel { ...@@ -218,10 +218,26 @@ class AlbumModel {
if (_selectList.isEmpty) { if (_selectList.isEmpty) {
Navigator.pop(context, ""); Navigator.pop(context, "");
} else { } else {
Navigator.pop(context, _selectList[0]); if (Platform.isAndroid) {
Navigator.pop(context, _selectList[0]);
} else {
iosAlbum(_selectList, context, (value) {
print(value);
Navigator.pop(context, List<String>.from(value)[0]);
});
}
} }
} }
void iosAlbum(List<String> list, BuildContext context, Function fun) {
GengmeiFlutterPlugin.ios_album_path(list).then((value) {
fun(value);
}).catchError((error) {
print(error);
});
}
void nativeCamera(BuildContext context) { void nativeCamera(BuildContext context) {
if (_selectList.length == maxCount) { if (_selectList.length == maxCount) {
// Toast.show(context, "最多选择${_maxCount}张图片"); // Toast.show(context, "最多选择${_maxCount}张图片");
......
...@@ -257,7 +257,8 @@ NSString *cacheDirectory; ...@@ -257,7 +257,8 @@ NSString *cacheDirectory;
} }
}]; }];
}else{ }else{
if([fileManager fileExistsAtPath:tempPath]){ if([fileManager fileExistsAtPath:tempTake]){
NSLog(@"1111");
self.channelSize++; self.channelSize++;
[self.channelList addObject:[NSString stringWithFormat:@"%@",tempTake]]; [self.channelList addObject:[NSString stringWithFormat:@"%@",tempTake]];
if(self.channelSize==self.channelAllSize){ if(self.channelSize==self.channelAllSize){
...@@ -266,6 +267,7 @@ NSString *cacheDirectory; ...@@ -266,6 +267,7 @@ NSString *cacheDirectory;
}); });
} }
}else{ }else{
NSLog(@"222");
int picWidth=[assets pixelWidth]; int picWidth=[assets pixelWidth];
int picHeight=[assets pixelHeight]; int picHeight=[assets pixelHeight];
float tempScareSize=1; float tempScareSize=1;
...@@ -277,12 +279,13 @@ NSString *cacheDirectory; ...@@ -277,12 +279,13 @@ NSString *cacheDirectory;
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{
NSData *data = UIImageJPEGRepresentation(res, 0.8) ; NSLog(@"33333");
[data writeToFile:tempTake atomically:YES]; NSData *data = UIImageJPEGRepresentation(res, 0.8) ;
data=nil; [data writeToFile:tempTake atomically:YES];
res=nil; data=nil;
} res=nil;
// }
self.channelSize++; self.channelSize++;
[self.channelList addObject:[NSString stringWithFormat:@"%@",tempTake]]; [self.channelList addObject:[NSString stringWithFormat:@"%@",tempTake]];
if(self.channelSize==self.channelAllSize){ if(self.channelSize==self.channelAllSize){
...@@ -552,14 +555,16 @@ NSString *cacheDirectory; ...@@ -552,14 +555,16 @@ NSString *cacheDirectory;
[queryItemDict setObject:tmpPath forKey:@"path"]; [queryItemDict setObject:tmpPath forKey:@"path"];
[queryItemDict setObject:@"T" forKey:@"isVideo"]; [queryItemDict setObject:@"T" forKey:@"isVideo"];
[self.scanMap setObject:assets forKey:tmpPath]; [self.scanMap setObject:assets forKey:tmpPath];
NSMutableArray * arr=self.finalMap[docName]; @synchronized (self) {
if (arr==nil) { NSMutableArray * arr=self.finalMap[docName];
self.finalMap[docName]=[NSMutableArray array]; if (arr==nil) {
[self.finalMap[docName] addObject:queryItemDict]; self.finalMap[docName]=[NSMutableArray array];
}else{ [self.finalMap[docName] addObject:queryItemDict];
[self.finalMap[docName] addObject:queryItemDict]; }else{
[self.finalMap[docName] addObject:queryItemDict];
}
[self.finalMap[@"IsGengmeiAlbumAllImages"] addObject:queryItemDict];
} }
[self.finalMap[@"IsGengmeiAlbumAllImages"] addObject:queryItemDict];
NSLog(@"SCARE SIZEEE %d %d ",self.nowSize,self.needSize); NSLog(@"SCARE SIZEEE %d %d ",self.nowSize,self.needSize);
if (self.nowSize==self.needSize) { if (self.nowSize==self.needSize) {
[self resultImgs:resultId]; [self resultImgs:resultId];
...@@ -594,14 +599,16 @@ NSString *cacheDirectory; ...@@ -594,14 +599,16 @@ NSString *cacheDirectory;
[queryItemDict setObject:tmpPath forKey:@"path"]; [queryItemDict setObject:tmpPath forKey:@"path"];
[queryItemDict setObject:@"T" forKey:@"isVideo"]; [queryItemDict setObject:@"T" forKey:@"isVideo"];
[self.scanMap setObject:assets forKey:tmpPath]; [self.scanMap setObject:assets forKey:tmpPath];
NSMutableArray * arr=self.finalMap[docName]; @synchronized (self) {
if (arr==nil) { NSMutableArray * arr=self.finalMap[docName];
self.finalMap[docName]=[NSMutableArray array]; if (arr==nil) {
[self.finalMap[docName] addObject:queryItemDict]; self.finalMap[docName]=[NSMutableArray array];
}else{ [self.finalMap[docName] addObject:queryItemDict];
[self.finalMap[docName] addObject:queryItemDict]; }else{
[self.finalMap[docName] addObject:queryItemDict];
}
[self.finalMap[@"IsGengmeiAlbumAllImages"] addObject:queryItemDict];
} }
[self.finalMap[@"IsGengmeiAlbumAllImages"] addObject:queryItemDict];
NSLog(@"SCARE SIZEEE %d %d ",self.nowSize,self.needSize); NSLog(@"SCARE SIZEEE %d %d ",self.nowSize,self.needSize);
if (self.nowSize==self.needSize) { if (self.nowSize==self.needSize) {
[self resultImgs:resultId]; [self resultImgs:resultId];
...@@ -617,14 +624,16 @@ NSString *cacheDirectory; ...@@ -617,14 +624,16 @@ NSString *cacheDirectory;
[queryItemDict setObject:tmpPath forKey:@"path"]; [queryItemDict setObject:tmpPath forKey:@"path"];
[queryItemDict setObject:@"F" forKey:@"isVideo"]; [queryItemDict setObject:@"F" forKey:@"isVideo"];
[self.scanMap setObject:assets forKey:tmpPath]; [self.scanMap setObject:assets forKey:tmpPath];
NSMutableArray * arr=self.finalMap[docName]; @synchronized (self) {
if (arr==nil) { NSMutableArray * arr=self.finalMap[docName];
self.finalMap[docName]=[NSMutableArray array]; if (arr==nil) {
[self.finalMap[docName] addObject:queryItemDict]; self.finalMap[docName]=[NSMutableArray array];
}else{ [self.finalMap[docName] addObject:queryItemDict];
[self.finalMap[docName] addObject:queryItemDict]; }else{
[self.finalMap[docName] addObject:queryItemDict];
}
[self.finalMap[@"IsGengmeiAlbumAllImages"] addObject:queryItemDict];
} }
[self.finalMap[@"IsGengmeiAlbumAllImages"] addObject:queryItemDict];
NSLog(@"SCARE SIZEEE %d %d ",self.nowSize,self.needSize); NSLog(@"SCARE SIZEEE %d %d ",self.nowSize,self.needSize);
if (self.nowSize==self.needSize) { if (self.nowSize==self.needSize) {
[self resultImgs:resultId]; [self resultImgs:resultId];
...@@ -655,28 +664,21 @@ NSString *cacheDirectory; ...@@ -655,28 +664,21 @@ NSString *cacheDirectory;
[queryItemDict setObject:tmpPath forKey:@"path"]; [queryItemDict setObject:tmpPath forKey:@"path"];
[queryItemDict setObject:@"F" forKey:@"isVideo"]; [queryItemDict setObject:@"F" forKey:@"isVideo"];
[self.scanMap setObject:assets forKey:tmpPath]; [self.scanMap setObject:assets forKey:tmpPath];
NSMutableArray * arr=self.finalMap[docName];
self.copySize++; self.copySize++;
if (arr==nil) { @synchronized (self) {
self.finalMap[docName]=[NSMutableArray array]; NSMutableArray * arr=self.finalMap[docName];
[self.finalMap[docName] addObject:queryItemDict]; if (arr==nil) {
}else{ self.finalMap[docName]=[NSMutableArray array];
[self.finalMap[docName] addObject:queryItemDict]; [self.finalMap[docName] addObject:queryItemDict];
}else{
[self.finalMap[docName] addObject:queryItemDict];
}
[self.finalMap[@"IsGengmeiAlbumAllImages"] addObject:queryItemDict];
} }
[self.finalMap[@"IsGengmeiAlbumAllImages"] addObject:queryItemDict];
NSLog(@"SCARE SIZEEE %d %d ",self.nowSize,self.needSize); NSLog(@"SCARE SIZEEE %d %d ",self.nowSize,self.needSize);
if (self.nowSize==self.needSize) { if (self.nowSize==self.needSize) {
[self resultImgs:resultId]; [self resultImgs:resultId];
} }
// if(self.needSize>80&&self.copySize==80){
// [self resultImgs:resultId];
// }else if(self.needSize<=80&&self.nowSize==self.needSize){
// [self resultImgs:resultId];
// }else if(self.needSize>80&&self.nowSize==self.needSize){
// [self upImgs];
// }else if(self.needSize>80&&self.copySize>80&&self.copySize%200==0){
// [self upImgs];
// }
}]; }];
} }
} }
......
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