Commit 30fd4309 authored by 林生雨's avatar 林生雨

commit

parent ff2695bd
This diff is collapsed.
......@@ -148,7 +148,7 @@ class AlbumModel {
if (value != null) {
_mainValue = value;
value.forEach((key, eachValue) {
print("VALUE!!! $key");
// print("VALUE!!! $key");
if (eachValue != null && !eachValue.isEmpty) {
if (key == MainDir) {
titleData.notifyView(MainDirExplain);
......
......@@ -115,7 +115,7 @@ class AlbumState extends State<AlbumPage> {
initialData: _model.albumLive.data,
builder:
(BuildContext context, AsyncSnapshot<List<ScanImageItem>> imgList) {
print("FINALL $imgList ${imgList.data}");
// print("FINALL $imgList ${imgList.data}");
if (imgList.data == null) {
return Center(child: CircularProgressIndicator());
}
......
......@@ -24,10 +24,10 @@ class AlbumRepository {
Observable<Map<String, List<ScanImageItem>>> scanPhoneImg() {
return Observable.fromFuture(GengmeiFlutterPlugin.phoneImages())
.map((value) {
if (value != null) {
_cacheList.clear();
_cacheList.addAll(value);
}
// if (value != null) {
// _cacheList.clear();
// _cacheList.addAll(value);
// }
return value;
});
}
......
......@@ -45,7 +45,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);
// queue = 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"
......@@ -298,7 +298,7 @@ NSString *cacheDirectory;
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) {
// [[PHImageManager defaultManager] requestImageForAsset:assets targetSize:temp contentMode:PHImageContentModeDefault options:imageRequestOption resultHandler:^(UIImage * _Nullable res, NSDictionary * _Nullable info) {
@autoreleasepool{
UIImage * res=[UIImage imageWithData:imageData];
NSData *data = UIImageJPEGRepresentation(res, 0.8) ;
......@@ -321,10 +321,10 @@ NSString *cacheDirectory;
}];
}
}
}else if ([[self.takePhotoMap allKeys] containsObject:path]){
}else if ([[self.takePhotoMap allKeys] containsObject:path[i]]){
NSMutableDictionary *dict=[[NSMutableDictionary alloc] init];
[dict setObject:path[i] forKey:@"path"];
[dict setObject:self.takePhotoMap[path] forKey:@"realImagePath"];
[dict setObject:self.takePhotoMap[path[i]] forKey:@"realImagePath"];
@synchronized (self) {
self.channelSize++;
[self.channelList addObject:dict];
......@@ -392,7 +392,7 @@ NSString *cacheDirectory;
[image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData *data= UIImageJPEGRepresentation(newImage,0.8);
NSData *data= UIImageJPEGRepresentation(newImage,0.6);
NSString *guid = [[NSProcessInfo processInfo] globallyUniqueString];
NSString *tmpFile = [NSString stringWithFormat:@"image_picker_%@", guid];
NSString* tmpPath= [cacheDirectory stringByAppendingPathComponent:tmpFile];
......@@ -485,7 +485,7 @@ NSString *cacheDirectory;
}
-(void)scanPhoneImage{
//
//
PHFetchResult<PHAssetCollection *> *favoritesCollection = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum subtype:PHAssetCollectionSubtypeSmartAlbumFavorites options:nil];
// 获得相机胶卷
PHFetchResult<PHAssetCollection *> *assetCollections = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeSmartAlbumUserLibrary options:nil];
......@@ -554,7 +554,7 @@ NSString *cacheDirectory;
-(void) saveItemAndUpload:(NSMutableDictionary*)queryItemDict :(PHAsset*)assets :(NSString*)tmpPath :(NSString*)docName :(long)resultId{
NSLog(@"RUNNING THREAD %@",[NSThread currentThread]);
// @synchronized (self) {
@synchronized (self) {
self.nowSize++;
[self.scanMap setObject:assets forKey:tmpPath];
NSMutableArray * arr=self.finalMap[docName];
......@@ -590,7 +590,7 @@ NSString *cacheDirectory;
self.finalMap=[self.finalMapTemp mutableCopy];
}
}
// }
}
}
-(void) copyImg:(long)resultId{
......@@ -626,6 +626,7 @@ NSString *cacheDirectory;
if(assets.mediaType==PHAssetMediaTypeVideo){
if ([fileManager fileExistsAtPath:tmpPath]==YES){
[[PHImageManager defaultManager]requestAVAssetForVideo:assets options:options resultHandler:^(AVAsset * _Nullable asset, AVAudioMix * _Nullable audioMix, NSDictionary * _Nullable info) {
NSLog(@"VIDEO EXITTTT ");
dispatch_async(queue, ^{
AVURLAsset *urlAsset = (AVURLAsset *)asset;
NSMutableDictionary* queryItemDict = [NSMutableDictionary dictionary];
......@@ -658,6 +659,8 @@ NSString *cacheDirectory;
result=nil;
}
[[PHImageManager defaultManager]requestAVAssetForVideo:assets options:options resultHandler:^(AVAsset * _Nullable asset, AVAudioMix * _Nullable audioMix, NSDictionary * _Nullable info) {
//疑问 为什么不切换到对应的线程。。
// dispatch_async(queue, ^{
AVURLAsset *urlAsset = (AVURLAsset *)asset;
NSMutableDictionary* queryItemDict = [NSMutableDictionary dictionary];
[queryItemDict setObject:[self getVideoDuring:urlAsset.duration] forKey:@"during"];
......@@ -665,6 +668,7 @@ NSString *cacheDirectory;
[queryItemDict setObject:@"T" forKey:@"isVideo"];
[queryItemDict setObject:[NSString stringWithFormat:@"%ld", (long)[assets.creationDate timeIntervalSince1970]*1000] forKey:@"dataToken"];
[self saveItemAndUpload:queryItemDict :assets :tmpPath :docName :resultId];
// });
}];
}];
}
......
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