Skip to content

Commit

Permalink
修复iOS14上首次授权选择图片后未显示图片问题等问题
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaunceyLee committed Mar 4, 2022
1 parent 5f7c301 commit 6afcca0
Showing 1 changed file with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ @implementation TZPhotoPickerController
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- (void)updateAlbum{
if ([[TZImageManager manager] authorizationStatusAuthorized]) {
if (SYSTEM_VERSION_GREATER_THAN_15) {
[[PHPhotoLibrary sharedPhotoLibrary] registerChangeObserver:self];
}
[self.albumVc configTableView];
Expand All @@ -73,9 +73,11 @@ - (void)setModel:(TZAlbumModel *)model{

if (self.model && self.isFirstAppear == NO){
if (self.showAlbumInPhotoPickerVc) {
[self configTitleView];
self->_shouldScrollToBottom = YES;
[self fetchAssetModels];
dispatch_async(dispatch_get_main_queue(), ^{
[self configTitleView];
self->_shouldScrollToBottom = YES;
[self fetchAssetModels];
});
}
}
}
Expand Down Expand Up @@ -180,9 +182,9 @@ - (void)fetchAssetModels {
}
dispatch_async(dispatch_get_global_queue(0, 0), ^{
CGFloat systemVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
if (!tzImagePickerVc.sortAscendingByModificationDate && self->_isFirstAppear && self->_model.isCameraRoll) {
if ((!tzImagePickerVc.sortAscendingByModificationDate && self->_isFirstAppear && self->_model.isCameraRoll) || (self->_showAlbumInPhotoPickerVc && self->_model == nil)) {
[[TZImageManager manager] getCameraRollAlbumWithFetchAssets:YES completion:^(TZAlbumModel *model) {
self->_model = model;
self.model = model;
self->_models = [NSMutableArray arrayWithArray:self->_model.models];
[self initSubviews];
}];
Expand All @@ -203,6 +205,11 @@ - (void)initSubviews {
TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
[tzImagePickerVc hideProgressHUD];

if (self.showAlbumInPhotoPickerVc) {
self->_authorizationLimited = [[TZImageManager manager] isPHAuthorizationStatusLimited];
self->_showTakePhotoBtn = self->_model.isCameraRoll && ((tzImagePickerVc.allowTakePicture && tzImagePickerVc.allowPickingImage) || (tzImagePickerVc.allowTakeVideo && tzImagePickerVc.allowPickingVideo));
}

[self checkSelectedModels];
[self configCollectionView];
self->_collectionView.hidden = YES;
Expand Down

0 comments on commit 6afcca0

Please sign in to comment.