Commit 11938e72 authored by 翟书觅's avatar 翟书觅

补充允许图片和视频选择时,iCoud无法同步的视频,提示交互

parent e60ab198
......@@ -487,7 +487,7 @@
TargetAttributes = {
900E657B1C2BB8D5003D9A9E = {
CreatedOnToolsVersion = 7.2;
DevelopmentTeam = JYK5L225PH;
DevelopmentTeam = LTFQDC2QVX;
ProvisioningStyle = Automatic;
};
900E65941C2BB8D5003D9A9E = {
......@@ -799,7 +799,7 @@
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = JYK5L225PH;
DEVELOPMENT_TEAM = LTFQDC2QVX;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/TZImagePickerController",
......@@ -808,7 +808,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 3.3.2;
PRODUCT_BUNDLE_IDENTIFIER = zsmios2020.TZImagePickerController.www;
PRODUCT_BUNDLE_IDENTIFIER = tanzhenios2019.TZImagePickerController.www;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "";
......@@ -823,7 +823,7 @@
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = JYK5L225PH;
DEVELOPMENT_TEAM = LTFQDC2QVX;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/TZImagePickerController",
......@@ -832,7 +832,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 3.3.2;
PRODUCT_BUNDLE_IDENTIFIER = zsmios2020.TZImagePickerController.www;
PRODUCT_BUNDLE_IDENTIFIER = tanzhenios2019.TZImagePickerController.www;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "";
......
......@@ -168,6 +168,13 @@
}
_bigImageRequestID = [[TZImageManager manager] requestImageDataForAsset:_model.asset completion:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {
if (!imageData && [info[PHImageResultIsInCloudKey] boolValue]) {
self.model.iCloudFaile = YES;
if (self.didSelectPhotoBlock) {
self.didSelectPhotoBlock(YES);
self.selectImageView.image = self.photoDefImage;
}
}
[self hideProgressView];
} progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {
if (self.model.isSelected) {
......
......@@ -24,6 +24,7 @@ typedef enum : NSUInteger {
@property (nonatomic, assign) BOOL isSelected; ///< The select status of a photo, default is No
@property (nonatomic, assign) TZAssetModelMediaType type;
@property (nonatomic, copy) NSString *timeLength;
@property (nonatomic, assign) BOOL iCloudFaile;
/// Init a photo dataModel With a PHAsset
/// 用一个PHAsset实例,初始化一个照片模型
......
......@@ -566,6 +566,11 @@ static CGFloat itemMargin = 5;
[[NSNotificationCenter defaultCenter] postNotificationName:@"TZ_PHOTO_PICKER_RELOAD_NOTIFICATION" object:strongSelf.navigationController];
}
[UIView showOscillatoryAnimationWithLayer:strongLayer type:TZOscillatoryAnimationToSmaller];
if (strongCell.model.iCloudFaile) {
[strongSelf->_models replaceObjectAtIndex:indexPath.item withObject:strongCell.model];
NSString *title = [NSBundle tz_localizedStringForKey:@"iCloud sync failed"];
[tzImagePickerVc showAlertWithTitle:title];
}
} else {
// 2. select:check if over the maxImagesCount / 选择照片,检查是否超过了最大个数的限制
if (tzImagePickerVc.selectedModels.count < tzImagePickerVc.maxImagesCount) {
......
......@@ -12,7 +12,6 @@
@interface TZAssetPreviewCell : UICollectionViewCell
@property (nonatomic, strong) TZAssetModel *model;
@property (nonatomic, copy) void (^singleTapGestureBlock)(void);
- (void)configSubviews;
- (void)photoPreviewCollectionViewDidScroll;
@end
......@@ -39,6 +38,9 @@
@property (nonatomic, strong) UIScrollView *scrollView;
@property (nonatomic, strong) UIView *imageContainerView;
@property (nonatomic, strong) TZProgressView *progressView;
@property (nonatomic, strong) UIImageView *icloudErrorIcon;
@property (nonatomic, strong) UILabel *icloudErrorLB;
@property (nonatomic, assign) BOOL allowCrop;
@property (nonatomic, assign) CGRect cropRect;
......@@ -47,9 +49,6 @@
@property (nonatomic, strong) id asset;
@property (nonatomic, copy) void (^singleTapGestureBlock)(void);
@property (nonatomic, copy) void (^imageProgressUpdateBlock)(double progress);
@property (nonatomic, copy) void (^iCloudSyncFailedBlock)(BOOL hidden); // iCloud同步失败回调
@property (nonatomic, strong) UIImageView *icloudErrorIcon;
@property (nonatomic, strong) UILabel *icloudErrorLB;
@property (nonatomic, assign) int32_t imageRequestID;
......@@ -64,8 +63,9 @@
@property (strong, nonatomic) UIButton *playButton;
@property (strong, nonatomic) UIImage *cover;
@property (nonatomic, strong) NSURL *videoURL;
@property (nonatomic, strong) UIImageView *icloudErrorIcon;
@property (nonatomic, strong) UILabel *icloudErrorLB;
- (void)pausePlayerAndShowNaviBar;
@property (nonatomic, copy) void (^iCloudSyncFailedBlock)(BOOL hidden); // iCloud同步失败回调
@end
......
......@@ -145,8 +145,6 @@
_icloudErrorLB.hidden = YES;
[self addSubview:_icloudErrorLB];
UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTap:)];
[self addGestureRecognizer:tap1];
UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doubleTap:)];
......@@ -173,15 +171,9 @@
// 先显示缩略图
[[TZImageManager manager] getPhotoWithAsset:model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
if (!photo && [info[PHImageResultIsInCloudKey] boolValue]) {
if (self.iCloudSyncFailedBlock) {
self.iCloudSyncFailedBlock(NO);
}
self->_icloudErrorLB.hidden = NO;
self->_icloudErrorIcon.hidden = NO;
} else {
if (self.iCloudSyncFailedBlock) {
self.iCloudSyncFailedBlock(YES);
}
self->_icloudErrorLB.hidden = YES;
self->_icloudErrorIcon.hidden = YES;
}
......@@ -231,15 +223,9 @@
_asset = asset;
self.imageRequestID = [[TZImageManager manager] getPhotoWithAsset:asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
if (!photo && [info[PHImageResultIsInCloudKey] boolValue]) {
if (self.iCloudSyncFailedBlock) {
self.iCloudSyncFailedBlock(NO);
}
self->_icloudErrorLB.hidden = NO;
self->_icloudErrorIcon.hidden = NO;
} else {
if (self.iCloudSyncFailedBlock) {
self.iCloudSyncFailedBlock(YES);
}
self->_icloudErrorLB.hidden = YES;
self->_icloudErrorIcon.hidden = YES;
}
......@@ -411,6 +397,14 @@
- (void)configSubviews {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillResignActiveNotification) name:UIApplicationWillResignActiveNotification object:nil];
_icloudErrorIcon = [[UIImageView alloc] init];
_icloudErrorIcon.image = [UIImage tz_imageNamedFromMyBundle:@"iCloudError"];
_icloudErrorIcon.hidden = YES;
_icloudErrorLB = [[UILabel alloc] init];
_icloudErrorLB.font = [UIFont systemFontOfSize:10];
_icloudErrorLB.textColor = [UIColor whiteColor];
_icloudErrorLB.text = [NSBundle tz_localizedStringForKey:@"iCloud sync failed"];
_icloudErrorLB.hidden = YES;
}
- (void)configPlayButton {
......@@ -422,6 +416,8 @@
[_playButton setImage:[UIImage tz_imageNamedFromMyBundle:@"MMVideoPreviewPlayHL"] forState:UIControlStateHighlighted];
[_playButton addTarget:self action:@selector(playButtonClick) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:_playButton];
[self addSubview:_icloudErrorIcon];
[self addSubview:_icloudErrorLB];
}
- (void)setModel:(TZAssetModel *)model {
......@@ -445,13 +441,11 @@
if (self.model && self.model.asset) {
[[TZImageManager manager] getPhotoWithAsset:self.model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
if (!photo && [info[PHImageResultIsInCloudKey] boolValue]) {
if (self.iCloudSyncFailedBlock) {
self.iCloudSyncFailedBlock(NO);
}
self->_icloudErrorLB.hidden = NO;
self->_icloudErrorIcon.hidden = NO;
} else {
if (self.iCloudSyncFailedBlock) {
self.iCloudSyncFailedBlock(YES);
}
self->_icloudErrorLB.hidden = YES;
self->_icloudErrorIcon.hidden = YES;
}
self.cover = photo;
}];
......@@ -480,6 +474,8 @@
[super layoutSubviews];
_playerLayer.frame = self.bounds;
_playButton.frame = CGRectMake(0, 64, self.tz_width, self.tz_height - 64 - 44);
_icloudErrorIcon.frame = CGRectMake(20, [TZCommonTools tz_isIPhoneX] ? 88 + 10 : 64 + 10, 28, 28);
_icloudErrorLB.frame = CGRectMake(53, [TZCommonTools tz_isIPhoneX] ? 88 + 10 : 64 + 10, self.tz_width - 63, 28);
}
- (void)photoPreviewCollectionViewDidScroll {
......
......@@ -442,7 +442,6 @@
_currentIndex = currentIndex;
[self refreshNaviBarAndBottomBarState];
}
[[NSNotificationCenter defaultCenter] postNotificationName:@"photoPreviewCollectionViewDidScroll" object:nil];
}
......@@ -460,19 +459,8 @@
__weak typeof(self) weakSelf = self;
if (_tzImagePickerVc.allowPickingMultipleVideo && model.type == TZAssetModelMediaTypeVideo) {
cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"TZVideoPreviewCell" forIndexPath:indexPath];
// TZVideoPreviewCell *videoPreviewCell = (TZVideoPreviewCell *)cell;
// videoPreviewCell.iCloudSyncFailedBlock = ^(BOOL hidden) {
// weakSelf.iCloudErrorView.hidden = hidden;
// self->_doneButton.enabled = hidden;
// };
} else if (_tzImagePickerVc.allowPickingMultipleVideo && model.type == TZAssetModelMediaTypePhotoGif && _tzImagePickerVc.allowPickingGif) {
cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"TZGifPreviewCell" forIndexPath:indexPath];
// TZGifPreviewCell *gifPreviewCell = (TZGifPreviewCell *)cell;
// gifPreviewCell.previewView.iCloudSyncFailedBlock = ^(BOOL hidden) {
// weakSelf.iCloudErrorView.hidden = hidden;
// self->_doneButton.enabled = hidden;
// };
} else {
cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"TZPhotoPreviewCell" forIndexPath:indexPath];
TZPhotoPreviewCell *photoPreviewCell = (TZPhotoPreviewCell *)cell;
......@@ -497,10 +485,6 @@
}
}
}];
// photoPreviewCell.previewView.iCloudSyncFailedBlock = ^(BOOL hidden) {
// weakSelf.iCloudErrorView.hidden = hidden;
// self->_doneButton.enabled = hidden;
// };
}
cell.model = model;
......@@ -579,6 +563,37 @@
_originalPhotoLabel.hidden = YES;
_doneButton.hidden = YES;
}
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:self.currentIndex inSection:0];
UICollectionViewCell *cell = [_collectionView cellForItemAtIndexPath:indexPath];
if ([cell isKindOfClass:[TZPhotoPreviewCell class]]) {
TZPhotoPreviewCell *currentCell = (TZPhotoPreviewCell *)cell;
if (_tzImagePickerVc.selectedModels.count <= 0) {
_doneButton.enabled = currentCell.previewView.icloudErrorLB.hidden;
} else {
_doneButton.enabled = YES;
}
_selectButton.hidden = !currentCell.previewView.icloudErrorLB.hidden;
} else if([cell isKindOfClass:[TZVideoPreviewCell class]]){
TZVideoPreviewCell *currentCell = (TZVideoPreviewCell *)cell;
if (_tzImagePickerVc.selectedModels.count <= 0) {
_doneButton.enabled = currentCell.icloudErrorLB.hidden;
} else {
_doneButton.enabled = YES;
}
_selectButton.hidden = !currentCell.icloudErrorLB.hidden;
} else if ([cell isKindOfClass:[TZGifPreviewCell class]]){
TZGifPreviewCell *currentCell = (TZGifPreviewCell *)cell;
if (_tzImagePickerVc.selectedModels.count <= 0) {
_doneButton.enabled = currentCell.previewView.icloudErrorLB.hidden;
} else {
_doneButton.enabled = YES;
}
_selectButton.hidden = !currentCell.previewView.icloudErrorLB.hidden;
}
if (model.iCloudFaile) {
_selectButton.hidden = YES;
_doneButton.enabled = NO;
}
if (_tzImagePickerVc.photoPreviewPageDidRefreshStateBlock) {
_tzImagePickerVc.photoPreviewPageDidRefreshStateBlock(_collectionView, _naviBar, _backButton, _selectButton, _indexLabel, _toolBar, _originalPhotoButton, _originalPhotoLabel, _doneButton, _numberImageView, _numberLabel);
......@@ -605,24 +620,4 @@
return [TZCommonTools tz_isRightToLeftLayout] ? self.models.count - _currentIndex - 1 : _currentIndex;
}
//#pragma mark - lazy
//- (UIView *)iCloudErrorView{
// if (!_iCloudErrorView) {
// _iCloudErrorView = [[UIView alloc] initWithFrame:CGRectMake(0, [TZCommonTools tz_isIPhoneX] ? 88 + 10 : 64 + 10, self.view.tz_width, 28)];
// UIImageView *icloud = [[UIImageView alloc] init];
// icloud.image = [UIImage tz_imageNamedFromMyBundle:@"iCloudError"];
// icloud.frame = CGRectMake(20, 0, 28, 28);
// [_iCloudErrorView addSubview:icloud];
// UILabel *label = [[UILabel alloc] init];
// label.frame = CGRectMake(53, 0, self.view.tz_width - 63, 28);
// label.font = [UIFont systemFontOfSize:10];
// label.textColor = [UIColor whiteColor];
// label.text = [NSBundle tz_localizedStringForKey:@"iCloud sync failed"];
// [_iCloudErrorView addSubview:label];
// [self.view addSubview:_iCloudErrorView];
// _iCloudErrorView.hidden = YES;
// }
// return _iCloudErrorView;
//}
@end
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