From a946ee1c508f02292f006704f4ad1dc19ae67dec Mon Sep 17 00:00:00 2001 From: eggmanQQQ <3671373519@qq.com> Date: Mon, 21 Oct 2024 18:34:18 +0800 Subject: [PATCH] =?UTF-8?q?1.0.18=20feat=EF=BC=9A=E5=A4=84=E7=90=86=20GIF?= =?UTF-8?q?=20=E5=A4=B4=E5=83=8F=E4=B8=8A=E4=BC=A0=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../XPMineUserInfoEditViewController.m | 70 +++++++++++++------ .../View/Cell/XPRoomSettingTableViewCell.m | 9 ++- YuMi/zh-Hans.lproj/Localizable.strings | 3 + YuMi/zh-Hant.lproj/Localizable.strings | 1 + 4 files changed, 61 insertions(+), 22 deletions(-) diff --git a/YuMi/Modules/YMMine/View/MineInfo/XPMineUserInfoEditViewController.m b/YuMi/Modules/YMMine/View/MineInfo/XPMineUserInfoEditViewController.m index dbbe1d3d..d3400c20 100644 --- a/YuMi/Modules/YMMine/View/MineInfo/XPMineUserInfoEditViewController.m +++ b/YuMi/Modules/YMMine/View/MineInfo/XPMineUserInfoEditViewController.m @@ -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 *)photos sourceAssets:(NSArray *)assets diff --git a/YuMi/Modules/YMRoom/View/Setting/View/Cell/XPRoomSettingTableViewCell.m b/YuMi/Modules/YMRoom/View/Setting/View/Cell/XPRoomSettingTableViewCell.m index af25478d..f5895227 100644 --- a/YuMi/Modules/YMRoom/View/Setting/View/Cell/XPRoomSettingTableViewCell.m +++ b/YuMi/Modules/YMRoom/View/Setting/View/Cell/XPRoomSettingTableViewCell.m @@ -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; diff --git a/YuMi/zh-Hans.lproj/Localizable.strings b/YuMi/zh-Hans.lproj/Localizable.strings index 83f05fa1..485ba7e6 100644 --- a/YuMi/zh-Hans.lproj/Localizable.strings +++ b/YuMi/zh-Hans.lproj/Localizable.strings @@ -3412,3 +3412,6 @@ "RoomMicState_0" = "你打開了麥克風和音樂。"; "RoomMicState_1" = "您打開了音樂但關閉了麥克風。"; "RoomMicState_2" = "你關掉了音樂和麥克風。"; + +"UserInfoEdit_1.0.17_0" = "Gif 头像"; +"RoomSetting_1.0.17_0" = "房间头像"; diff --git a/YuMi/zh-Hant.lproj/Localizable.strings b/YuMi/zh-Hant.lproj/Localizable.strings index 1206e679..f51b2495 100644 --- a/YuMi/zh-Hant.lproj/Localizable.strings +++ b/YuMi/zh-Hant.lproj/Localizable.strings @@ -3405,3 +3405,4 @@ "RoomMicState_1" = "您打開了音樂但關閉了麥克風。"; "RoomMicState_2" = "你關掉了音樂和麥克風。"; +"UserInfoEdit_1.0.17_0" = "Gif 头像";