Skip to content

Commit efd1535

Browse files
committed
新增isFetchingMedia标志位,在获取大图时相册的变化忽略掉
1 parent d6f7d36 commit efd1535

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

TZImagePickerController/TZImagePickerController/TZImagePickerController.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
/// Default is 600px / 默认600像素宽
6868
@property (nonatomic, assign) CGFloat photoPreviewMaxWidth;
6969

70-
/// Default is 15, While fetching photo, HUD will dismiss automatic if timeout;
71-
/// 超时时间,默认为15秒,当取图片时间超过15秒还没有取成功时,会自动dismiss HUD;
70+
/// Default is 30, While fetching photo, HUD will dismiss automatic if timeout;
71+
/// 超时时间,默认为30秒,当取图片时间超过30秒还没有取成功时,会自动dismiss HUD;
7272
@property (nonatomic, assign) NSInteger timeout;
7373

7474
/// Default is YES, if set NO, the original photo button will hide. user can't picking original photo.

TZImagePickerController/TZImagePickerController/TZImagePickerController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ - (instancetype)initCropTypeWithAsset:(PHAsset *)asset photo:(UIImage *)photo co
268268

269269
- (void)configDefaultSetting {
270270
self.autoSelectCurrentWhenDone = YES;
271-
self.timeout = 15;
271+
self.timeout = 30;
272272
self.photoWidth = 828.0;
273273
self.photoPreviewMaxWidth = 600;
274274
self.naviTitleColor = [UIColor whiteColor];

TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ @interface TZPhotoPickerController ()<UICollectionViewDataSource,UICollectionVie
4545
@property (strong, nonatomic) CLLocation *location;
4646
@property (nonatomic, strong) NSOperationQueue *operationQueue;
4747
@property (nonatomic, assign) BOOL isSavingMedia;
48+
@property (nonatomic, assign) BOOL isFetchingMedia;
4849
@end
4950

5051
static CGSize AssetGridThumbnailSize;
@@ -440,6 +441,7 @@ - (void)doneButtonClick {
440441

441442
[tzImagePickerVc showProgressHUD];
442443
_doneButton.enabled = NO;
444+
self.isFetchingMedia = YES;
443445
NSMutableArray *assets = [NSMutableArray array];
444446
NSMutableArray *photos;
445447
NSMutableArray *infoArr;
@@ -502,6 +504,7 @@ - (void)didGetAllPhotos:(NSArray *)photos assets:(NSArray *)assets infoArr:(NSAr
502504
TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
503505
[tzImagePickerVc hideProgressHUD];
504506
_doneButton.enabled = YES;
507+
self.isFetchingMedia = NO;
505508

506509
if (tzImagePickerVc.autoDismiss) {
507510
[self.navigationController dismissViewControllerAnimated:YES completion:^{
@@ -963,7 +966,7 @@ - (void)dealloc {
963966
#pragma mark - PHPhotoLibraryChangeObserver
964967

965968
- (void)photoLibraryDidChange:(PHChange *)changeInstance {
966-
if (self.isSavingMedia) {
969+
if (self.isSavingMedia || self.isFetchingMedia) {
967970
return;
968971
}
969972
dispatch_async(dispatch_get_main_queue(), ^{

0 commit comments

Comments
 (0)