1.0.18 feat:处理 GIF 头像上传入口

This commit is contained in:
eggmanQQQ
2024-10-21 18:34:18 +08:00
parent 8c64d6fdc0
commit a946ee1c50
4 changed files with 61 additions and 22 deletions

View File

@@ -59,6 +59,8 @@ TZImagePickerControllerDelegate>
@property (nonatomic,assign) CGFloat maxWidth;
@property (nonatomic, assign) BOOL isPhotoPickerDisplayGIF;
@end
@implementation XPMineUserInfoEditViewController
@@ -117,7 +119,7 @@ TZImagePickerControllerDelegate>
}];
}];
TTActionSheetConfig *photoLibrayConfig = [TTActionSheetConfig normalTitle:YMLocalizedString(@"XPMineUserInfoEditViewController6") clickAction:^{
TTActionSheetConfig *photoLibraryConfig = [TTActionSheetConfig normalTitle:YMLocalizedString(@"XPMineUserInfoEditViewController6") clickAction:^{
[YYUtility checkAssetsLibrayAvailable:^{
@strongify(self);
// UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
@@ -131,22 +133,9 @@ TZImagePickerControllerDelegate>
// [imagePicker setDidSelectedAsset:^(PHAsset * _Nonnull asset) {
//
// }];
TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:1
delegate:self];
imagePickerVc.modalPresentationStyle = UIModalPresentationOverFullScreen;
imagePickerVc.allowPickingVideo = NO;
imagePickerVc.allowTakeVideo = NO;
imagePickerVc.allowPickingGif = YES;
imagePickerVc.allowCrop = YES;
CGFloat cropWidth = KScreenWidth;
imagePickerVc.cropRect = CGRectMake(0, (self.view.bounds.size.height - cropWidth) / 2, cropWidth, cropWidth);
imagePickerVc.naviBgColor = [DJDKMIMOMColor appCellBackgroundColor];
imagePickerVc.naviTitleColor = [DJDKMIMOMColor mainTextColor];
imagePickerVc.barItemTextColor = [DJDKMIMOMColor mainTextColor];
[self presentViewController:imagePickerVc animated:YES completion:nil];
[self presentViewController:[self photoPickerWillDisplayGIF: NO]
animated:YES
completion:nil];
} denied:^{
@strongify(self);
[self showNotPhoto:YMLocalizedString(@"XPMineUserInfoEditViewController7") content:YMLocalizedString(@"XPMineUserInfoEditViewController8")];
@@ -156,7 +145,43 @@ TZImagePickerControllerDelegate>
}];
}];
[TTPopup actionSheetWithItems:@[cameraConfig, photoLibrayConfig]];
if (self.userInfo.userVipInfoVO.vipLevel >= 1) {
TTActionSheetConfig *gifLibraryConfig = [TTActionSheetConfig normalTitle:YMLocalizedString(@"UserInfoEdit_1.0.17_0") clickAction:^{
[YYUtility checkAssetsLibrayAvailable:^{
@strongify(self);
[self presentViewController:[self photoPickerWillDisplayGIF: YES]
animated:YES
completion:nil];
} denied:^{
@strongify(self);
[self showNotPhoto:YMLocalizedString(@"XPMineUserInfoEditViewController7") content:YMLocalizedString(@"XPMineUserInfoEditViewController8")];
} restriction:^{
@strongify(self);
[self showNotPhoto:YMLocalizedString(@"XPMineUserInfoEditViewController9") content:YMLocalizedString(@"XPMineUserInfoEditViewController10")];
}];
}];
[TTPopup actionSheetWithItems:@[cameraConfig, photoLibraryConfig, gifLibraryConfig]];
} else {
[TTPopup actionSheetWithItems:@[cameraConfig, photoLibraryConfig]];
}
}
- (TZImagePickerController *)photoPickerWillDisplayGIF:(BOOL)displayGIF {
self.isPhotoPickerDisplayGIF = displayGIF;
TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:1
delegate:self];
imagePickerVc.modalPresentationStyle = UIModalPresentationOverFullScreen;
imagePickerVc.allowPickingVideo = NO;
imagePickerVc.allowTakeVideo = NO;
imagePickerVc.allowPickingGif = displayGIF;
imagePickerVc.allowCrop = YES;
CGFloat cropWidth = KScreenWidth;
imagePickerVc.cropRect = CGRectMake(0, (self.view.bounds.size.height - cropWidth) / 2, cropWidth, cropWidth);
imagePickerVc.naviBgColor = [DJDKMIMOMColor appCellBackgroundColor];
imagePickerVc.naviTitleColor = [DJDKMIMOMColor mainTextColor];
imagePickerVc.barItemTextColor = [DJDKMIMOMColor mainTextColor];
return imagePickerVc;
}
- (void)showNotPhoto:(NSString *)title content:(NSString *)content {
@@ -364,17 +389,20 @@ TZImagePickerControllerDelegate>
#pragma mark - TZImagePickerControllerDelegate
- (BOOL)isAssetCanBeDisplayed:(PHAsset *)asset {
if (self.isPhotoPickerDisplayGIF) {
return [[asset valueForKey:@"filename"] containsString:@"GIF"];
} else {
return ![[asset valueForKey:@"filename"] containsString:@"GIF"];
}
// if ([[asset valueForKey:@"filename"] containsString:@"GIF"]) {
// // TODO: GIF
// if (self.userInfo.userVipInfoVO.vipLevel > 2) {
// return NO;
// }
// }
return YES; //
// return YES; //
}
- (void)imagePickerController:(TZImagePickerController *)picker
didFinishPickingPhotos:(NSArray<UIImage *> *)photos
sourceAssets:(NSArray *)assets

View File

@@ -84,7 +84,14 @@
- (void)setItemModel:(XPRoomSettingItemModel *)itemModel {
_itemModel = itemModel;
self.titleLabel.text = _itemModel.title;
if (_itemModel.type == RoomSettingItemType_Title || _itemModel.type == RoomSettingItemType_Class || _itemModel.type == RoomSettingItemType_Tag || _itemModel.type == RoomSettingItemType_Black_List || _itemModel.type == RoomSettingItemType_Manager_List || _itemModel.type == RoomSettingItemType_Pwd || _itemModel.type == RoomSettingItemType_Theme) {
if (_itemModel.type == RoomSettingItemType_Title ||
_itemModel.type == RoomSettingItemType_Class ||
_itemModel.type == RoomSettingItemType_Tag ||
_itemModel.type == RoomSettingItemType_Black_List ||
_itemModel.type == RoomSettingItemType_Manager_List ||
_itemModel.type == RoomSettingItemType_Pwd ||
_itemModel.type == RoomSettingItemType_Theme ||
_itemModel.type == RoomSettingItemType_Avatar) {
self.switchView.hidden = YES;
self.arrowImageView.hidden = NO;
self.subTitleLabel.hidden = NO;

View File

@@ -3412,3 +3412,6 @@
"RoomMicState_0" = "你打開了麥克風和音樂。";
"RoomMicState_1" = "您打開了音樂但關閉了麥克風。";
"RoomMicState_2" = "你關掉了音樂和麥克風。";
"UserInfoEdit_1.0.17_0" = "Gif 头像";
"RoomSetting_1.0.17_0" = "房间头像";

View File

@@ -3405,3 +3405,4 @@
"RoomMicState_1" = "您打開了音樂但關閉了麥克風。";
"RoomMicState_2" = "你關掉了音樂和麥克風。";
"UserInfoEdit_1.0.17_0" = "Gif 头像";