Commit 5d3d676a authored by 林生雨's avatar 林生雨

commit

parent 4e7c15a7
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<codeStyleSettings language="XML">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
</code_scheme>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
</project>
\ No newline at end of file
<component name="libraryTable">
<library name="Dart SDK">
<CLASSES>
<root url="file:///Users/apple/Downloads/flutter/bin/cache/dart-sdk/lib/async" />
<root url="file:///Users/apple/Downloads/flutter/bin/cache/dart-sdk/lib/collection" />
<root url="file:///Users/apple/Downloads/flutter/bin/cache/dart-sdk/lib/convert" />
<root url="file:///Users/apple/Downloads/flutter/bin/cache/dart-sdk/lib/core" />
<root url="file:///Users/apple/Downloads/flutter/bin/cache/dart-sdk/lib/developer" />
<root url="file:///Users/apple/Downloads/flutter/bin/cache/dart-sdk/lib/html" />
<root url="file:///Users/apple/Downloads/flutter/bin/cache/dart-sdk/lib/io" />
<root url="file:///Users/apple/Downloads/flutter/bin/cache/dart-sdk/lib/isolate" />
<root url="file:///Users/apple/Downloads/flutter/bin/cache/dart-sdk/lib/math" />
<root url="file:///Users/apple/Downloads/flutter/bin/cache/dart-sdk/lib/mirrors" />
<root url="file:///Users/apple/Downloads/flutter/bin/cache/dart-sdk/lib/typed_data" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Flutter Plugins" type="FlutterPluginsLibraryType">
<CLASSES>
<root url="file://$PROJECT_DIR$" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Flutter for Android">
<CLASSES>
<root url="jar:///Users/apple/Downloads/flutter/bin/cache/artifacts/engine/android-arm/flutter.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectType">
<option name="id" value="io.flutter" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/gengmei_flutter_plugin.iml" filepath="$PROJECT_DIR$/gengmei_flutter_plugin.iml" />
<module fileurl="file://$PROJECT_DIR$/android/gengmei_flutter_plugin_android.iml" filepath="$PROJECT_DIR$/android/gengmei_flutter_plugin_android.iml" />
<module fileurl="file://$PROJECT_DIR$/example/android/gengmei_flutter_plugin_example_android.iml" filepath="$PROJECT_DIR$/example/android/gengmei_flutter_plugin_example_android.iml" />
</modules>
</component>
</project>
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="example/lib/main.dart" type="FlutterRunConfigurationType" factoryName="Flutter" singleton="false">
<option name="filePath" value="$PROJECT_DIR$/example/lib/main.dart" />
<method v="2" />
</configuration>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin" vcs="Git" />
</component>
</project>
\ No newline at end of file
This diff is collapsed.
......@@ -10,9 +10,10 @@
@property(nonatomic)int nowSize;
@property(nonatomic) long resultKey;
@property(nonatomic)long nativeCameraKey;
@property(nonatomic)NSMutableDictionary<NSString*,NSMutableArray<NSMutableDictionary<NSString*,NSObject*>*>*>* finalMap;
@property(strong,nonatomic)NSMutableDictionary<NSString*,NSMutableArray<NSMutableDictionary<NSString*,NSObject*>*>*>* finalMap;
@property(nonatomic,strong) UIImagePickerController *imagePicker;
@property(atomic)Boolean quitPage;
@property(atomic)Boolean execdTask;
@end
@implementation GengmeiFlutterPlugin
......@@ -234,18 +235,27 @@ dispatch_queue_t queue;
}
-(void)scanPhone:(long)resultId{
self.nowSize=0;
self.quitPage=false;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
self.needSize=0;
if (self.finalMap==nil) {
self.finalMap=[NSMutableDictionary dictionary];
}
if ([self.finalMap count]>0&&self.execdTask) {
[self resultImgs:resultId];
return;
}
self.nowSize=0;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
NSLog(@"init!!!");
self.needSize=0;
[self.finalMap removeAllObjects];
[assetCollectionList removeAllObjects];
[self scanPhoneImage];
[self copyImg:resultId];
});
// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
//
// });
}
-(void)scanPhoneImage{
......@@ -290,6 +300,7 @@ dispatch_queue_t queue;
}
dispatch_async(dispatch_get_main_queue(), ^{
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultId] :self.finalMap];
self.execdTask=true;
});
}
......@@ -302,22 +313,36 @@ dispatch_queue_t queue;
NSLog(@"09090909090 %d %d",[assetResult count],self.needSize);
for (int i=0; i<[assetResult count]; i++) {
__block NSString* docName=[item collectionTitle];
PHAsset * assets=[assetResult objectAtIndex:i];
// if (assets.mediaType != PHAssetMediaTypeVideo){
NSString * imgName=[assets valueForKey:@"filename"];
if (imgName==nil) {
NSLog(@"NEWWWW!!!!! image name is Null!!! ");
NSString *timeSp = [NSString stringWithFormat:@"%ld", (long)([[NSDate date] timeIntervalSince1970]*100000)];
imgName=[NSString stringWithFormat:@"IMG_%",timeSp];
}
__block NSString *tmpPath=[cacheDirectory stringByAppendingPathComponent:imgName];
if ([fileManager fileExistsAtPath:tmpPath]==YES){
self.nowSize++;
NSMutableDictionary* queryItemDict = [NSMutableDictionary dictionary];
[queryItemDict setObject:tmpPath forKey:@"path"];
NSMutableArray * arr=self.finalMap[docName];
if (arr==nil) {
self.finalMap[docName]=[NSMutableArray array];
[self.finalMap[docName] addObject:queryItemDict];
}else{
[self.finalMap[docName] addObject:queryItemDict];
}
NSLog(@"SIZEEE %d %d ",self.nowSize,self.needSize);
if (self.nowSize==self.needSize) {
[self resultImgs:resultId];
}
}else{
NSLog(@"file NOT EXIT !! ");
PHImageRequestOptions *imageRequestOption = [[PHImageRequestOptions alloc] init];
imageRequestOption.synchronous =YES;
int picWidth=[assets pixelWidth];
int picHeight=[assets pixelHeight];
float scareSize=1;
// if (picWidth>4000) {
// scareSize=480.0/picWidth;
// }else if(picWidth>3000){
// scareSize=600.0/picWidth;
// }else if (picWidth>1024) {
// scareSize=1;
// }
scareSize=340.0/picWidth;
NSLog(@"SCARESIZE %d",picWidth);
CGSize size=CGSizeMake(picWidth*scareSize, picHeight*scareSize);
......@@ -332,31 +357,6 @@ dispatch_queue_t queue;
} else {
data = UIImagePNGRepresentation(result);
}
NSString *tmpPath;
NSString* newString1=[NSString stringWithFormat:@"i%@",data];
if ([newString1 length]>5000) {
NSString *temp = [newString1 stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
NSString *text = [temp stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet ]];
NSString *string1=[text substringWithRange:NSMakeRange([text length]-2000,50)];
tmpPath=[cacheDirectory stringByAppendingPathComponent:string1];
if ([fileManager fileExistsAtPath:tmpPath]==YES) {
self.nowSize++;
NSMutableDictionary* queryItemDict = [NSMutableDictionary dictionary];
[queryItemDict setObject:tmpPath forKey:@"path"];
NSMutableArray * arr=self.finalMap[docName];
if (arr==nil) {
self.finalMap[docName]=[NSMutableArray array];
[self.finalMap[docName] addObject:queryItemDict];
}else{
[self.finalMap[docName] addObject:queryItemDict];
}
NSLog(@"SIZEEE %d %d ",self.nowSize,self.needSize);
if (self.nowSize==self.needSize) {
[self resultImgs:resultId];
}
}else{
NSLog(@"File NotExists!!! %@",tmpPath);
if ([[NSFileManager defaultManager] createFileAtPath:tmpPath contents:data attributes:nil]) {
NSLog(@"result %@",tmpPath);
self.nowSize++;
......@@ -379,36 +379,10 @@ dispatch_queue_t queue;
NSLog(@"ERRORRRR ");
self.needSize--;
}
}
}else{
NSLog(@"File TOO LOw???? !!! %@",tmpPath);
NSString *guid = [[NSProcessInfo processInfo] globallyUniqueString];
NSString *tmpFile = [NSString stringWithFormat:@"image_picker_%@", guid];
tmpPath= [cacheDirectory stringByAppendingPathComponent:tmpFile];
if ([[NSFileManager defaultManager] createFileAtPath:tmpPath contents:data attributes:nil]) {
NSLog(@"result %@",tmpPath);
self.nowSize++;
NSMutableDictionary* queryItemDict = [NSMutableDictionary dictionary];
[queryItemDict setObject:tmpPath forKey:@"path"];
NSMutableArray * arr=self.finalMap[docName];
if (arr==nil) {
self.finalMap[docName]=[NSMutableArray array];
[self.finalMap[docName] addObject:queryItemDict];
}else{
[self.finalMap[docName] addObject:queryItemDict];
}
NSLog(@"SIZEEE %d %d ",self.nowSize,self.needSize);
if (self.nowSize==self.needSize) {
[self resultImgs:resultId];
}
} else {
NSLog(@"ERRORRRR ");
self.needSize--;
}
}
}];
}
}
}
}
- (NSMutableDictionary*)useToFetchCollection {
......
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