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
30fd4309
Commit
30fd4309
authored
Oct 31, 2019
by
林生雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
ff2695bd
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
15 deletions
+19
-15
workspace.xml
.idea/workspace.xml
+0
-0
AlbumModel.dart
example/lib/AlbumModel/page/album/AlbumModel.dart
+1
-1
AlbumPage.dart
example/lib/AlbumModel/page/album/AlbumPage.dart
+1
-1
AlbumRepository.dart
example/lib/AlbumModel/repository/AlbumRepository.dart
+4
-4
GengmeiFlutterPlugin.m
ios/Classes/GengmeiFlutterPlugin.m
+13
-9
No files found.
.idea/workspace.xml
View file @
30fd4309
This diff is collapsed.
Click to expand it.
example/lib/AlbumModel/page/album/AlbumModel.dart
View file @
30fd4309
...
...
@@ -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
);
...
...
example/lib/AlbumModel/page/album/AlbumPage.dart
View file @
30fd4309
...
...
@@ -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
());
}
...
...
example/lib/AlbumModel/repository/AlbumRepository.dart
View file @
30fd4309
...
...
@@ -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
;
});
}
...
...
ios/Classes/GengmeiFlutterPlugin.m
View file @
30fd4309
...
...
@@ -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
];
...
...
@@ -580,7 +580,7 @@ NSString *cacheDirectory;
if
(
self
.
nowSize
==
201
){
[
self
reslutImg
:
resultId
];
}
else
if
(
self
.
nowSize
==
self
.
needSize
){
self
.
finishScanImg
=
true
;
self
.
finishScanImg
=
true
;
[
self
upImgs
];
}
}
else
{
...
...
@@ -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
];
// });
}];
}];
}
...
...
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