Commit 7b5944f0 authored by banchichen's avatar banchichen

1.7.6 加入同步和共享相册

parent c100f4df
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.7.5</string> <string>1.7.6</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
......
...@@ -122,29 +122,23 @@ static CGFloat TZScreenScale; ...@@ -122,29 +122,23 @@ static CGFloat TZScreenScale;
PHFetchResult *myPhotoStreamAlbum = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeAlbumMyPhotoStream options:nil]; PHFetchResult *myPhotoStreamAlbum = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeAlbumMyPhotoStream options:nil];
PHFetchResult *smartAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum subtype:PHAssetCollectionSubtypeAlbumRegular options:nil]; PHFetchResult *smartAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum subtype:PHAssetCollectionSubtypeAlbumRegular options:nil];
PHFetchResult *topLevelUserCollections = [PHCollectionList fetchTopLevelUserCollectionsWithOptions:nil]; PHFetchResult *topLevelUserCollections = [PHCollectionList fetchTopLevelUserCollectionsWithOptions:nil];
for (PHAssetCollection *collection in myPhotoStreamAlbum) { PHFetchResult *syncedAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeAlbumSyncedAlbum options:nil];
PHFetchResult *fetchResult = [PHAsset fetchAssetsInAssetCollection:collection options:option]; PHFetchResult *sharedAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeAlbumCloudShared options:nil];
if (fetchResult.count < 1) continue; NSArray *allAlbums = @[myPhotoStreamAlbum,smartAlbums,topLevelUserCollections,syncedAlbums,sharedAlbums];
[albumArr addObject:[self modelWithResult:fetchResult name:collection.localizedTitle]]; for (PHFetchResult *fetchResult in allAlbums) {
} for (PHAssetCollection *collection in fetchResult) {
for (PHAssetCollection *collection in smartAlbums) { // 有可能是PHCollectionList类的的对象,过滤掉
// 有可能是PHCollectionList类的的对象,过滤掉 if (![collection isKindOfClass:[PHAssetCollection class]]) continue;
if (![collection isKindOfClass:[PHAssetCollection class]]) continue; PHFetchResult *fetchResult = [PHAsset fetchAssetsInAssetCollection:collection options:option];
PHFetchResult *fetchResult = [PHAsset fetchAssetsInAssetCollection:collection options:option]; if (fetchResult.count < 1) continue;
if (fetchResult.count < 1) continue; if ([collection.localizedTitle containsString:@"Deleted"] || [collection.localizedTitle isEqualToString:@"最近删除"]) continue;
if ([collection.localizedTitle containsString:@"Deleted"] || [collection.localizedTitle isEqualToString:@"最近删除"]) continue; if ([self isCameraRollAlbum:collection.localizedTitle]) {
if ([self isCameraRollAlbum:collection.localizedTitle]) { [albumArr insertObject:[self modelWithResult:fetchResult name:collection.localizedTitle] atIndex:0];
[albumArr insertObject:[self modelWithResult:fetchResult name:collection.localizedTitle] atIndex:0]; } else {
} else { [albumArr addObject:[self modelWithResult:fetchResult name:collection.localizedTitle]];
[albumArr addObject:[self modelWithResult:fetchResult name:collection.localizedTitle]]; }
} }
} }
for (PHAssetCollection *collection in topLevelUserCollections) {
if (![collection isKindOfClass:[PHAssetCollection class]]) continue;
PHFetchResult *fetchResult = [PHAsset fetchAssetsInAssetCollection:collection options:option];
if (fetchResult.count < 1) continue;
[albumArr addObject:[self modelWithResult:fetchResult name:collection.localizedTitle]];
}
if (completion && albumArr.count > 0) completion(albumArr); if (completion && albumArr.count > 0) completion(albumArr);
} else { } else {
[self.assetLibrary enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop) { [self.assetLibrary enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// //
// Created by 谭真 on 15/12/24. // Created by 谭真 on 15/12/24.
// Copyright © 2015年 谭真. All rights reserved. // Copyright © 2015年 谭真. All rights reserved.
// version 1.7.5 - 2016.12.7 // version 1.7.6 - 2016.12.8
/* /*
经过测试,比起xib的方式,把TZAssetCell改用纯代码的方式来写,滑动帧数明显提高了(约提高10帧左右) 经过测试,比起xib的方式,把TZAssetCell改用纯代码的方式来写,滑动帧数明显提高了(约提高10帧左右)
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// //
// Created by 谭真 on 15/12/24. // Created by 谭真 on 15/12/24.
// Copyright © 2015年 谭真. All rights reserved. // Copyright © 2015年 谭真. All rights reserved.
// version 1.7.5 - 2016.12.7 // version 1.7.6 - 2016.12.8
#import "TZImagePickerController.h" #import "TZImagePickerController.h"
#import "TZPhotoPickerController.h" #import "TZPhotoPickerController.h"
......
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