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

c

parent 9dad6bf6
This diff is collapsed.
...@@ -218,8 +218,24 @@ class AlbumModel { ...@@ -218,8 +218,24 @@ class AlbumModel {
if (_selectList.isEmpty) { if (_selectList.isEmpty) {
Navigator.pop(context, ""); Navigator.pop(context, "");
} else { } else {
if (Platform.isAndroid) {
Navigator.pop(context, _selectList[0]); 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) {
......
...@@ -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{
NSLog(@"33333");
NSData *data = UIImageJPEGRepresentation(res, 0.8) ; NSData *data = UIImageJPEGRepresentation(res, 0.8) ;
[data writeToFile:tempTake atomically:YES]; [data writeToFile:tempTake atomically:YES];
data=nil; data=nil;
res=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,6 +555,7 @@ NSString *cacheDirectory; ...@@ -552,6 +555,7 @@ 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];
@synchronized (self) {
NSMutableArray * arr=self.finalMap[docName]; NSMutableArray * arr=self.finalMap[docName];
if (arr==nil) { if (arr==nil) {
self.finalMap[docName]=[NSMutableArray array]; self.finalMap[docName]=[NSMutableArray array];
...@@ -560,6 +564,7 @@ NSString *cacheDirectory; ...@@ -560,6 +564,7 @@ NSString *cacheDirectory;
[self.finalMap[docName] addObject:queryItemDict]; [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,6 +599,7 @@ NSString *cacheDirectory; ...@@ -594,6 +599,7 @@ 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];
@synchronized (self) {
NSMutableArray * arr=self.finalMap[docName]; NSMutableArray * arr=self.finalMap[docName];
if (arr==nil) { if (arr==nil) {
self.finalMap[docName]=[NSMutableArray array]; self.finalMap[docName]=[NSMutableArray array];
...@@ -602,6 +608,7 @@ NSString *cacheDirectory; ...@@ -602,6 +608,7 @@ NSString *cacheDirectory;
[self.finalMap[docName] addObject:queryItemDict]; [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,6 +624,7 @@ NSString *cacheDirectory; ...@@ -617,6 +624,7 @@ 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];
@synchronized (self) {
NSMutableArray * arr=self.finalMap[docName]; NSMutableArray * arr=self.finalMap[docName];
if (arr==nil) { if (arr==nil) {
self.finalMap[docName]=[NSMutableArray array]; self.finalMap[docName]=[NSMutableArray array];
...@@ -625,6 +633,7 @@ NSString *cacheDirectory; ...@@ -625,6 +633,7 @@ NSString *cacheDirectory;
[self.finalMap[docName] addObject:queryItemDict]; [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,8 +664,9 @@ NSString *cacheDirectory; ...@@ -655,8 +664,9 @@ 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++;
@synchronized (self) {
NSMutableArray * arr=self.finalMap[docName];
if (arr==nil) { if (arr==nil) {
self.finalMap[docName]=[NSMutableArray array]; self.finalMap[docName]=[NSMutableArray array];
[self.finalMap[docName] addObject:queryItemDict]; [self.finalMap[docName] addObject:queryItemDict];
...@@ -664,19 +674,11 @@ NSString *cacheDirectory; ...@@ -664,19 +674,11 @@ NSString *cacheDirectory;
[self.finalMap[docName] addObject:queryItemDict]; [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