Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
flutter_plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林生雨
flutter_plugin
Commits
9dad6bf6
Commit
9dad6bf6
authored
Oct 29, 2019
by
林生雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
cb37d7ce
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
127 additions
and
125 deletions
+127
-125
workspace.xml
.idea/workspace.xml
+5
-3
GengmeiFlutterPlugin.m
ios/Classes/GengmeiFlutterPlugin.m
+122
-122
No files found.
.idea/workspace.xml
View file @
9dad6bf6
...
@@ -5,7 +5,9 @@
...
@@ -5,7 +5,9 @@
<option
name=
"TOOL_WINDOW_CONFIGURED_FILTER"
value=
"Show only selected application"
/>
<option
name=
"TOOL_WINDOW_CONFIGURED_FILTER"
value=
"Show only selected application"
/>
</component>
</component>
<component
name=
"ChangeListManager"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"5be6bbb5-7d6e-4540-a24f-d2b3bf78b3ba"
name=
"Default Changelist"
comment=
""
/>
<list
default=
"true"
id=
"5be6bbb5-7d6e-4540-a24f-d2b3bf78b3ba"
name=
"Default Changelist"
comment=
""
>
<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$/.dart_tool/"
/>
<ignored
path=
"$PROJECT_DIR$/.idea/"
/>
<ignored
path=
"$PROJECT_DIR$/.idea/"
/>
<ignored
path=
"$PROJECT_DIR$/.pub/"
/>
<ignored
path=
"$PROJECT_DIR$/.pub/"
/>
...
@@ -103,7 +105,7 @@
...
@@ -103,7 +105,7 @@
<entry
file=
"file://$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m"
>
<entry
file=
"file://$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"10516"
>
<state
relative-caret-position=
"10516"
>
<caret
line=
"50
8"
column=
"22"
selection-start-line=
"508"
selection-start-column=
"22"
selection-end-line=
"508
"
selection-end-column=
"22"
/>
<caret
line=
"50
7"
column=
"22"
selection-start-line=
"507"
selection-start-column=
"22"
selection-end-line=
"507
"
selection-end-column=
"22"
/>
</state>
</state>
</provider>
</provider>
</entry>
</entry>
...
@@ -550,7 +552,7 @@
...
@@ -550,7 +552,7 @@
<entry
file=
"file://$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m"
>
<entry
file=
"file://$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"10516"
>
<state
relative-caret-position=
"10516"
>
<caret
line=
"50
8"
column=
"22"
selection-start-line=
"508"
selection-start-column=
"22"
selection-end-line=
"508
"
selection-end-column=
"22"
/>
<caret
line=
"50
7"
column=
"22"
selection-start-line=
"507"
selection-start-column=
"22"
selection-end-line=
"507
"
selection-end-column=
"22"
/>
</state>
</state>
</provider>
</provider>
</entry>
</entry>
...
...
ios/Classes/GengmeiFlutterPlugin.m
View file @
9dad6bf6
...
@@ -237,7 +237,7 @@ NSString *cacheDirectory;
...
@@ -237,7 +237,7 @@ NSString *cacheDirectory;
options
.
networkAccessAllowed
=
true
;
options
.
networkAccessAllowed
=
true
;
options
.
deliveryMode
=
PHVideoRequestOptionsDeliveryModeAutomatic
;
options
.
deliveryMode
=
PHVideoRequestOptionsDeliveryModeAutomatic
;
PHImageRequestOptions
*
imageRequestOption
=
[[
PHImageRequestOptions
alloc
]
init
];
PHImageRequestOptions
*
imageRequestOption
=
[[
PHImageRequestOptions
alloc
]
init
];
imageRequestOption
.
synchronous
=
YES
;
imageRequestOption
.
synchronous
=
NO
;
imageRequestOption
.
networkAccessAllowed
=
YES
;
imageRequestOption
.
networkAccessAllowed
=
YES
;
NSString
*
tempPath
=
NSTemporaryDirectory
();
NSString
*
tempPath
=
NSTemporaryDirectory
();
NSFileManager
*
fileManager
=
[
NSFileManager
defaultManager
];
NSFileManager
*
fileManager
=
[
NSFileManager
defaultManager
];
...
@@ -696,116 +696,116 @@ NSString *cacheDirectory;
...
@@ -696,116 +696,116 @@ NSString *cacheDirectory;
return
videoDurationText
;
return
videoDurationText
;
}
}
-
(
void
)
execRealImg
:
(
long
)
resultId
{
//
-(void)execRealImg:(long)resultId{
dispatch_queue_t
queue
=
dispatch_queue_create
(
"execRealImg"
,
DISPATCH_QUEUE_CONCURRENT
);
//
dispatch_queue_t queue = dispatch_queue_create("execRealImg", DISPATCH_QUEUE_CONCURRENT);
self
.
nowSize
=
0
;
//
self.nowSize=0;
self
.
copySize
=
0
;
//
self.copySize=0;
NSString
*
cacheDirectory
=
[
NSSearchPathForDirectoriesInDomains
(
NSCachesDirectory
,
NSUserDomainMask
,
YES
)
firstObject
];
//
NSString *cacheDirectory = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject];
//
NSFileManager
*
fileManager
=
[
NSFileManager
defaultManager
];
//
NSFileManager *fileManager = [NSFileManager defaultManager];
for
(
int
j
=
0
;
j
<
assetCollectionList
.
count
;
j
++
)
{
//
for (int j=0; j<assetCollectionList.count; j++) {
AlbumItem
*
item
=
assetCollectionList
[
j
];
//
AlbumItem * item=assetCollectionList[j];
PHFetchResult
<
PHAsset
*>
*
assetResult
=
[
item
assets
];
//
PHFetchResult<PHAsset *> * assetResult =[item assets];
for
(
int
i
=
0
;
i
<
[
assetResult
count
];
i
++
)
{
//
for (int i=0; i<[assetResult count]; i++) {
if
(
self
.
quitPage
){
//
if(self.quitPage){
return
;
//
return;
}
//
}
__block
NSString
*
docName
=
[
item
collectionTitle
];
//
__block NSString* docName=[item collectionTitle];
PHAsset
*
assets
=
[
assetResult
objectAtIndex
:
i
];
//
PHAsset * assets=[assetResult objectAtIndex:i];
__block
NSString
*
imgName
=
[
assets
valueForKey
:
@"filename"
];
//
__block NSString * imgName=[assets valueForKey:@"filename"];
NSString
*
imgRealName
=
[
NSString
stringWithFormat
:
@"%@_REAL"
,
imgName
];
//
NSString * imgRealName=[NSString stringWithFormat:@"%@_REAL",imgName];
if
(
imgName
==
nil
)
{
//
if (imgName==nil) {
NSLog
(
@"NEWWWW!!!!! image name is Null!!! "
);
//
NSLog(@"NEWWWW!!!!! image name is Null!!! ");
NSString
*
timeSp
=
[
NSString
stringWithFormat
:
@"%ld"
,
(
long
)([[
NSDate
date
]
timeIntervalSince1970
]
*
100000
)];
//
NSString *timeSp = [NSString stringWithFormat:@"%ld", (long)([[NSDate date] timeIntervalSince1970]*100000)];
imgName
=
[
NSString
stringWithFormat
:
@"IMG_%@"
,
timeSp
];
//
imgName=[NSString stringWithFormat:@"IMG_%@",timeSp];
imgRealName
=
[
NSString
stringWithFormat
:
@"REAL_PATH_IMG_%@"
,
timeSp
];
//
imgRealName=[NSString stringWithFormat:@"REAL_PATH_IMG_%@",timeSp];
}
//
}
__block
NSString
*
realPath
=
[
cacheDirectory
stringByAppendingPathComponent
:
imgRealName
];
//
__block NSString *realPath=[cacheDirectory stringByAppendingPathComponent:imgRealName];
NSLog
(
@"REALLL %@"
,
realPath
);
//
NSLog(@"REALLL %@",realPath);
__block
NSString
*
tmpPath
=
[
cacheDirectory
stringByAppendingPathComponent
:
imgName
];
//
__block NSString *tmpPath=[cacheDirectory stringByAppendingPathComponent:imgName];
if
([
fileManager
fileExistsAtPath
:
realPath
]
==
YES
){
//
if ([fileManager fileExistsAtPath:realPath]==YES){
self
.
nowSize
++
;
//
self.nowSize++;
NSLog
(
@"!!!REAL IS EXIE!! %@"
,
realPath
);
//
NSLog(@"!!!REAL IS EXIE!! %@",realPath);
[
self
searchPath
:
realPath
:
tmpPath
:
docName
];
//
[self searchPath:realPath :tmpPath :docName];
NSLog
(
@"SIZEEE %d %d "
,
self
.
nowSize
,
self
.
needSize
);
//
NSLog(@"SIZEEE %d %d ",self.nowSize,self.needSize);
if
(
self
.
nowSize
==
self
.
needSize
)
{
//
if (self.nowSize==self.needSize) {
// [self upImgs];
//
// [self upImgs];
[
self
reslutImg
:
resultId
];
//
[self reslutImg:resultId];
self
.
finishScanImg
=
true
;
//
self.finishScanImg=true;
}
//
}
}
else
{
//
}else{
NSLog
(
@"file NOT EXIT !! %@"
,
realPath
);
//
NSLog(@"file NOT EXIT !! %@",realPath);
dispatch_async
(
queue
,
^
{
//
dispatch_async(queue, ^{
if
(
assets
.
mediaType
==
PHAssetMediaTypeVideo
){
//
if(assets.mediaType==PHAssetMediaTypeVideo){
PHVideoRequestOptions
*
options
=
[[
PHVideoRequestOptions
alloc
]
init
];
//
PHVideoRequestOptions *options = [[PHVideoRequestOptions alloc] init];
options
.
version
=
PHImageRequestOptionsVersionCurrent
;
//
options.version = PHImageRequestOptionsVersionCurrent;
options
.
networkAccessAllowed
=
true
;
//
options.networkAccessAllowed = true;
options
.
deliveryMode
=
PHVideoRequestOptionsDeliveryModeAutomatic
;
//
options.deliveryMode = PHVideoRequestOptionsDeliveryModeAutomatic;
[[
PHImageManager
defaultManager
]
requestAVAssetForVideo
:
assets
options
:
options
resultHandler
:^
(
AVAsset
*
_Nullable
asset
,
AVAudioMix
*
_Nullable
audioMix
,
NSDictionary
*
_Nullable
info
)
{
//
[[PHImageManager defaultManager]requestAVAssetForVideo:assets options:options resultHandler:^(AVAsset * _Nullable asset, AVAudioMix * _Nullable audioMix, NSDictionary * _Nullable info) {
self
.
nowSize
++
;
//
self.nowSize++;
AVURLAsset
*
urlAsset
=
(
AVURLAsset
*
)
asset
;
//
AVURLAsset *urlAsset = (AVURLAsset *)asset;
NSString
*
videoUrl
=
[
NSString
stringWithFormat
:
@"%@"
,
urlAsset
.
URL
];
//
NSString* videoUrl=[NSString stringWithFormat:@"%@",urlAsset.URL];
[
self
searchPath
:
videoUrl
:
tmpPath
:
docName
];
//
[self searchPath:videoUrl :tmpPath :docName];
if
(
self
.
nowSize
==
self
.
needSize
)
{
//
if (self.nowSize==self.needSize) {
[
self
upImgs
];
//
[self upImgs];
// [self reslutImg:resultId];
//
// [self reslutImg:resultId];
self
.
finishScanImg
=
true
;
//
self.finishScanImg=true;
//
}
//
}
}];
//
}];
}
else
{
//
}else{
PHImageRequestOptions
*
imageRequestOption
=
[[
PHImageRequestOptions
alloc
]
init
];
//
PHImageRequestOptions *imageRequestOption = [[PHImageRequestOptions alloc] init];
imageRequestOption
.
synchronous
=
NO
;
//
imageRequestOption.synchronous =NO;
int
picWidth
=
[
assets
pixelWidth
];
//
int picWidth=[assets pixelWidth];
int
picHeight
=
[
assets
pixelHeight
];
//
int picHeight=[assets pixelHeight];
float
tempScareSize
=
1
;
//
float tempScareSize=1;
float
limit
=
1560
.
0
;
//
float limit=1560.0;
if
(
picWidth
>
picHeight
){
//
if(picWidth>picHeight){
if
(
picWidth
>
limit
)
{
//
if (picWidth>limit) {
tempScareSize
=
limit
/
picWidth
;
//
tempScareSize=limit/picWidth;
}
//
}
}
else
{
//
}else{
if
(
picHeight
>
limit
)
{
//
if (picHeight>limit) {
tempScareSize
=
limit
/
picHeight
;
//
tempScareSize=limit/picHeight;
}
//
}
}
//
}
NSLog
(
@"SCARE SZIE %d %d %f %f %f"
,
picWidth
,
picHeight
,
tempScareSize
,
picWidth
*
tempScareSize
,
picHeight
*
tempScareSize
);
//
NSLog(@"SCARE SZIE %d %d %f %f %f",picWidth,picHeight,tempScareSize,picWidth*tempScareSize,picHeight*tempScareSize);
CGSize
temp
=
CGSizeMake
(
picWidth
*
tempScareSize
,
picHeight
*
tempScareSize
);
//
CGSize temp=CGSizeMake(picWidth*tempScareSize, picHeight*tempScareSize);
imageRequestOption
.
networkAccessAllowed
=
YES
;
//
imageRequestOption.networkAccessAllowed = YES;
imageRequestOption
.
deliveryMode
=
PHImageRequestOptionsDeliveryModeHighQualityFormat
;
//
imageRequestOption.deliveryMode=PHImageRequestOptionsDeliveryModeHighQualityFormat;
// imageRequestOption.deliveryMode=PHImageRequestOptionsDeliveryModeFastFormat;
//
// imageRequestOption.deliveryMode=PHImageRequestOptionsDeliveryModeFastFormat;
imageRequestOption
.
resizeMode
=
PHImageRequestOptionsResizeModeFast
;
//
imageRequestOption.resizeMode=PHImageRequestOptionsResizeModeFast;
imageRequestOption
.
version
=
PHImageRequestOptionsVersionUnadjusted
;
//
imageRequestOption.version=PHImageRequestOptionsVersionUnadjusted;
[[
PHImageManager
defaultManager
]
requestImageDataForAsset
:
assets
options
:
imageRequestOption
resultHandler
:^
(
NSData
*
_Nullable
imageData
,
NSString
*
_Nullable
dataUTI
,
UIImageOrientation
orientation
,
NSDictionary
*
_Nullable
info
)
{
//
[[PHImageManager defaultManager] requestImageDataForAsset:assets options:imageRequestOption resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) {
self
.
nowSize
++
;
//
self.nowSize++;
self
.
copySize
++
;
//
self.copySize++;
NSString
*
finalRealPath
;
//
NSString* finalRealPath;
if
([
info
objectForKey
:
@"PHImageFileURLKey"
]){
//
if([info objectForKey:@"PHImageFileURLKey"]){
NSURL
*
path
=
[
info
objectForKey
:
@"PHImageFileURLKey"
];
//
NSURL * path=[info objectForKey:@"PHImageFileURLKey"];
NSLog
(
@"PATHHHH %@"
,
path
);
//
NSLog(@"PATHHHH %@",path);
finalRealPath
=
[
NSString
stringWithFormat
:
@"%@"
,
path
];
//
finalRealPath=[NSString stringWithFormat:@"%@",path];
}
else
{
//
}else{
NSLog
(
@"NOT HAVE IT!!! %@"
,
realPath
);
//
NSLog(@"NOT HAVE IT!!! %@",realPath);
[
imageData
writeToFile
:
realPath
atomically
:
YES
];
//
[imageData writeToFile:realPath atomically:YES];
finalRealPath
=
realPath
;
//
finalRealPath=realPath;
}
//
}
[
self
searchPath
:
finalRealPath
:
tmpPath
:
docName
];
//
[self searchPath:finalRealPath :tmpPath :docName];
NSLog
(
@"SIZEEE %d %d %d"
,
self
.
nowSize
,
self
.
needSize
,
self
.
copySize
);
//
NSLog(@"SIZEEE %d %d %d",self.nowSize,self.needSize,self.copySize);
if
(
self
.
nowSize
==
self
.
needSize
)
{
//
if (self.nowSize==self.needSize) {
[
self
upImgs
];
//
[self upImgs];
// [self reslutImg:resultId];
//
// [self reslutImg:resultId];
self
.
finishScanImg
=
true
;
//
self.finishScanImg=true;
}
//
}
// else if(self.copySize%100==0||self.copySize==50){
//
// else if(self.copySize%100==0||self.copySize==50){
// [self upImgs];
//
// [self upImgs];
// }
//
// }
}];
//
}];
}
//
}
});
//
});
}
//
}
}
//
}
}
//
}
}
//
}
-
(
void
)
resultImgs
:
(
long
)
resultId
{
-
(
void
)
resultImgs
:
(
long
)
resultId
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
...
@@ -830,17 +830,17 @@ NSString *cacheDirectory;
...
@@ -830,17 +830,17 @@ NSString *cacheDirectory;
}
}
-
(
void
)
searchPath
:
(
NSString
*
)
finalRealPath
:
(
NSString
*
)
tmpPath
:
(
NSString
*
)
docName
{
//
-(void)searchPath:(NSString*)finalRealPath :(NSString*)tmpPath :(NSString*)docName{
NSMutableArray
<
NSMutableDictionary
<
NSString
*
,
NSObject
*>*>*
array
=
self
.
finalMap
[
docName
];
//
NSMutableArray<NSMutableDictionary<NSString*,NSObject*>*>* array=self.finalMap[docName];
for
(
int
x
=
0
;
x
<
[
array
count
];
x
++
)
{
//
for (int x=0; x<[array count]; x++) {
NSMutableDictionary
<
NSString
*
,
NSObject
*>*
map
=
[
array
objectAtIndex
:
x
];
//
NSMutableDictionary<NSString*,NSObject*>* map=[array objectAtIndex:x];
NSString
*
index
=
[
map
objectForKey
:
@"path"
];
//
NSString* index=[map objectForKey:@"path"];
if
([
index
isEqualToString
:
tmpPath
])
{
//
if ([index isEqualToString:tmpPath]) {
[
map
setObject
:
finalRealPath
forKey
:
@"realPath"
];
//
[map setObject:finalRealPath forKey:@"realPath"];
break
;
//
break;
}
//
}
}
//
}
}
//
}
-
(
void
)
writeImage
:
(
UIImage
*
)
image
dest
:
(
NSString
*
)
path
{
-
(
void
)
writeImage
:
(
UIImage
*
)
image
dest
:
(
NSString
*
)
path
{
@autoreleasepool
{
@autoreleasepool
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment