1.0.19 feat:开始个性化房间背景

This commit is contained in:
eggmanQQQ
2024-10-30 17:22:29 +08:00
parent 9e9e5fa0e8
commit ae4229675d
29 changed files with 660 additions and 273 deletions

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "切图 31@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "播放@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "房间背景@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -0,0 +1,19 @@
//
// CustomRoomBGCell.h
// YuMi
//
// Created by P on 2024/10/30.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface CustomRoomBGCell : UICollectionViewCell
+ (void)registerTo:(UICollectionView *)collectionView;
+ (CustomRoomBGCell *)reuseFrom:(UICollectionView *)collectionView atIndexPath:(NSIndexPath *)indexPath;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,85 @@
//
// CustomRoomBGCell.m
// YuMi
//
// Created by P on 2024/10/30.
//
#import "CustomRoomBGCell.h"
#import "SVGA.h"
@interface CustomRoomBGCell ()
@property (nonatomic, strong) NetImageView *bgImageView;
@property (nonatomic, strong) SVGAImageView *svgaImageView;
@property (nonatomic, strong) UIView *selectedStateView;
@property (nonatomic, strong) UILabel *remainingDaysLabel;
@property (nonatomic, strong) UILabel *typeLabel;
@property (nonatomic, strong) UIButton *previewButton;
@property (nonatomic, strong) UILabel *pricePerDayLabel;
@property (nonatomic, strong) UIButton *actionButton;
@end
@implementation CustomRoomBGCell
+ (void)registerTo:(UICollectionView *)collectionView {
[collectionView registerClass:[self class]
forCellWithReuseIdentifier:NSStringFromClass([self class])];
}
+ (CustomRoomBGCell *)reuseFrom:(UICollectionView *)collectionView
atIndexPath:(NSIndexPath *)indexPath {
CustomRoomBGCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([self class])
forIndexPath:indexPath];
cell.backgroundColor = [UIColor colorWithWhite:1 alpha:0.3];
return cell;
}
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self setupUI];
}
return self;
}
- (void)setupUI {
[self.contentView addSubview:self.bgImageView];
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.leading.trailing.mas_equalTo(self.contentView);
make.height.mas_equalTo(kGetScaleWidth(180));
}];
[self.contentView addSubview:self.selectedStateView];
[self.selectedStateView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.bgImageView);
}];
}
#pragma mark -
- (NetImageView *)bgImageView {
if (!_bgImageView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.placeHolder = [UIImageConstant defaultEmptyPlaceholder];
_bgImageView = [[NetImageView alloc] initWithConfig:config];
_bgImageView.layer.masksToBounds = YES;
_bgImageView.layer.cornerRadius = 10;
}
return _bgImageView;
}
- (UIView *)selectedStateView {
if (!_selectedStateView) {
_selectedStateView = [[UIView alloc] init];
_selectedStateView.backgroundColor = [UIColor clearColor];
_selectedStateView.layer.cornerRadius = 10;
_selectedStateView.layer.borderColor = UIColorFromRGB(0xFF8C03).CGColor;
_selectedStateView.layer.borderWidth = 2;
_selectedStateView.layer.masksToBounds = YES;
}
return _selectedStateView;
}
@end

View File

@@ -0,0 +1,16 @@
//
// CustomRoomBGContentViewController.h
// YuMi
//
// Created by P on 2024/10/29.
//
#import "MvpViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface CustomRoomBGContentViewController : MvpViewController
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,295 @@
//
// CustomRoomBGContentViewController.m
// YuMi
//
// Created by P on 2024/10/29.
//
#import "CustomRoomBGContentViewController.h"
#import "CustomRoomBGCell.h"
#import "CustomRoomBGPresenter.h"
@interface CustomRoomBGContentViewController () <UICollectionViewDelegateFlowLayout, UICollectionViewDataSource>
@property (nonatomic, strong) UIView *bottomAreaBackGround;
@property (nonatomic, strong) UIView *emptyStateView;
@property (nonatomic, strong) UIButton *freeButton;
@property (nonatomic, strong) UIButton *payButton;
@property (nonatomic, strong) UIButton *customButton;
@property (nonatomic, strong) UICollectionView *collectionView;
@end
@implementation CustomRoomBGContentViewController
- (CustomRoomBGPresenter *)createPresenter {
return [[CustomRoomBGPresenter alloc] init];
}
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapEmptySpace)];
[self.view addGestureRecognizer:tap];
[self setupUI];
[self didSelectedButton:self.freeButton];
}
- (void)setupUI {
[self.view addSubview:[self bottomAreaBackGround]];
[self.view addSubview:self.emptyStateView];
[self.emptyStateView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.bottomAreaBackGround).offset(72);
make.leading.trailing.mas_equalTo(self.view);
make.height.mas_equalTo(26 + 110);
}];
[self setupTopButtons];
[self.view addSubview:self.collectionView];
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.bottomAreaBackGround).offset(50);
make.leading.trailing.mas_equalTo(self.view);
make.height.mas_equalTo(kGetScaleWidth(180 + 32 + 22));
}];
}
- (void)setupTopButtons {
self.freeButton = [self bgCategoryButton:101];
self.payButton = [self bgCategoryButton:102];
self.customButton = [self bgCategoryButton:103];
[self.view addSubview:self.freeButton];
[self.freeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.bottomAreaBackGround).offset(10);
make.leading.mas_equalTo(15);
make.height.mas_equalTo(22);
make.width.mas_greaterThanOrEqualTo(20);
}];
[self.view addSubview:self.payButton];
[self.payButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.freeButton);
make.leading.mas_equalTo(self.freeButton.mas_trailing).offset(25);
make.height.mas_equalTo(22);
make.width.mas_greaterThanOrEqualTo(20);
}];
[self.view addSubview:self.customButton];
[self.customButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.freeButton);
make.leading.mas_equalTo(self.payButton.mas_trailing).offset(25);
make.height.mas_equalTo(22);
make.width.mas_greaterThanOrEqualTo(20);
}];
UIButton *helpButton = [self helpButton];
[self.view addSubview:helpButton];
[helpButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.freeButton);
make.trailing.mas_equalTo(self.view).offset(-15);
make.size.mas_equalTo(CGSizeMake(22, 22));
}];
UIButton *createButton = [self createCustomButton];
[self.view addSubview:createButton];
[createButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.freeButton);
make.trailing.mas_equalTo(helpButton.mas_leading).offset(-5);
make.size.mas_equalTo(CGSizeMake(82, 22));
}];
}
#pragma mark -
- (void)updateDataSource:(NSInteger)tag {
switch (tag) {
case 101:
break;
default:
break;
}
}
#pragma mark -
- (void)didTapEmptySpace {
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)didSelectedButton:(UIButton *)button {
self.freeButton.selected = NO;
self.payButton.selected = NO;
self.customButton.selected = NO;
button.selected = YES;
[self updateDataSource:button.tag];
}
- (void)didTapCreate {
}
- (void)didTapHelp {
}
#pragma mark -
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return 10;
}
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
CustomRoomBGCell *cell = [CustomRoomBGCell reuseFrom:collectionView atIndexPath:indexPath];
return cell;
}
#pragma mark -
- (UIView *)bottomAreaBackGround {
if (!_bottomAreaBackGround) {
CGFloat height = kGetScaleWidth(323) + kSafeAreaBottomHeight;
UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, KScreenHeight - height, KScreenWidth, height)];
v.userInteractionEnabled = YES;
v.backgroundColor = [UIColor blackColor];
v.layer.cornerRadius = 16;
v.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner;
v.layer.masksToBounds = YES;
_bottomAreaBackGround = v;
}
return _bottomAreaBackGround;
}
- (UIButton *)bgCategoryButton:(NSInteger)tag {
UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom];
b.tag = tag;
//
UIFont *normalFont = kFontRegular(15);
NSDictionary *normalAttributes = @{NSFontAttributeName: normalFont,
NSForegroundColorAttributeName: [UIColor colorWithWhite:1 alpha:0.6]};
NSAttributedString *normalTitle = [[NSAttributedString alloc] initWithString:[self titleForTag:tag]
attributes:normalAttributes];
[b setAttributedTitle:normalTitle forState:UIControlStateNormal];
//
UIFont *selectedFont = kFontMedium(15);
NSDictionary *selectedAttributes = @{NSFontAttributeName: selectedFont,
NSForegroundColorAttributeName: [UIColor whiteColor]};
NSAttributedString *selectedTitle = [[NSAttributedString alloc] initWithString:[self titleForTag:tag]
attributes:selectedAttributes];
[b setAttributedTitle:selectedTitle forState:UIControlStateSelected];
[b addTarget:self
action:@selector(didSelectedButton:)
forControlEvents:UIControlEventTouchUpInside];
[b setContentHuggingPriority:UILayoutPriorityRequired
forAxis:UILayoutConstraintAxisHorizontal];
[b setContentCompressionResistancePriority:UILayoutPriorityRequired
forAxis:UILayoutConstraintAxisHorizontal];
return b;
}
- (UIButton *)createCustomButton {
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(0, 0, 82, 22);
[button setTitle:YMLocalizedString(@"1.0.18_4") forState:UIControlStateNormal];
[button.titleLabel setFont:kFontRegular(12)];
button.layer.cornerRadius = 11; //
button.clipsToBounds = YES; // 使
//
CAGradientLayer *gradientLayer = [CAGradientLayer layer];
gradientLayer.colors = @[(__bridge id)UIColorFromRGB(0xE29030).CGColor,
(__bridge id)UIColorFromRGB(0xFCC074).CGColor];
gradientLayer.startPoint = CGPointMake(0.5, 0.0); //
gradientLayer.endPoint = CGPointMake(0.5, 1.0); //
gradientLayer.frame = button.bounds; //
//
[button.layer insertSublayer:gradientLayer atIndex:0];
[button addTarget:self
action:@selector(didTapCreate)
forControlEvents:UIControlEventTouchUpInside];
return button;
}
- (UIButton *)helpButton {
UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom];
[b setImage:kImage(@"custom_bg_help") forState:UIControlStateNormal];
[b addTarget:self
action:@selector(didTapHelp)
forControlEvents:UIControlEventTouchUpInside];
return b;
}
- (UIView *)emptyStateView {
if (!_emptyStateView) {
UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 26 + 110)];
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImageConstant defaultEmptyPlaceholder_UFO]];
[v addSubview:imageView];
[imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.centerX.mas_equalTo(v);
make.size.mas_equalTo(CGSizeMake(kGetScaleWidth(110), kGetScaleWidth(110)));
}];
UILabel *messageLabel = [UILabel labelInitWithText:YMLocalizedString(@"1.0.18_5")
font:kFontRegular(14)
textColor:[UIColor colorWithWhite:1 alpha:0.4]];
messageLabel.textAlignment = NSTextAlignmentCenter;
[v addSubview:messageLabel];
[messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.trailing.mas_equalTo(v).inset(52);
make.top.mas_equalTo(imageView.mas_bottom).offset(6);
make.height.mas_equalTo(22);
}];
_emptyStateView = v;
}
return _emptyStateView;
}
- (UICollectionView *)collectionView {
if (!_collectionView) {
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.itemSize = CGSizeMake(kGetScaleWidth(135), kGetScaleWidth(180 + 32 + 22));
layout.minimumLineSpacing = 0;
layout.minimumInteritemSpacing = 10;
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
layout.sectionInset = UIEdgeInsetsMake(0, 15, 0, 15);
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
_collectionView.backgroundColor = [UIColor clearColor];
_collectionView.delegate = self;
_collectionView.dataSource = self;
_collectionView.showsHorizontalScrollIndicator = NO;
[CustomRoomBGCell registerTo:_collectionView];
}
return _collectionView;
}
#pragma mark -
- (NSString *)titleForTag:(NSInteger)tag {
NSString *title = @"";
switch (tag) {
case 101:
title = YMLocalizedString(@"1.0.18_1");
break;
case 102:
title = YMLocalizedString(@"1.0.18_2");
break;
case 103:
title = YMLocalizedString(@"1.0.18_3");
break;
default:
break;
}
return title;
}
@end

View File

@@ -0,0 +1,16 @@
//
// CustomRoomBGItemModel.h
// YuMi
//
// Created by P on 2024/10/30.
//
#import "PIBaseModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface CustomRoomBGItemModel : PIBaseModel
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,12 @@
//
// CustomRoomBGItemModel.m
// YuMi
//
// Created by P on 2024/10/30.
//
#import "CustomRoomBGItemModel.h"
@implementation CustomRoomBGItemModel
@end

View File

@@ -0,0 +1,16 @@
//
// CustomRoomBGPresenter.h
// YuMi
//
// Created by P on 2024/10/30.
//
#import "BaseMvpPresenter.h"
NS_ASSUME_NONNULL_BEGIN
@interface CustomRoomBGPresenter : BaseMvpPresenter
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,12 @@
//
// CustomRoomBGPresenter.m
// YuMi
//
// Created by P on 2024/10/30.
//
#import "CustomRoomBGPresenter.h"
@implementation CustomRoomBGPresenter
@end

View File

@@ -60,6 +60,8 @@ typedef NS_ENUM(NSInteger, RoomMoreMenuType) {
RoomMoreMenuType_Room_Room_Photo_Album = 24,
/// 设置房间 mic 位类型
RoomMoreMenuType_Room_Type_Setting = 25,
RoomMoreMenuType_Room_Type_Background = 26,
};
@interface XPRoomMoreItemModel : PIBaseModel

View File

@@ -38,11 +38,11 @@
acrossRoomPK.type = roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode ? RoomMoreMenuType_Room_Across_PK_Close : RoomMoreMenuType_Room_Across_PK_Open;
acrossRoomPK.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
// XPRoomMoreItemModel * giftValue = [[XPRoomMoreItemModel alloc] init];
// giftValue.title = roomInfo.showGiftValue ? YMLocalizedString(@"XPMoreMenuPresenter27") : YMLocalizedString(@"XPMoreMenuPresenter3");
// giftValue.imageName= @"room_more_menu_gift_value";
// giftValue.type = roomInfo.showGiftValue ? RoomMoreMenuType_Gift_Value_Close : RoomMoreMenuType_Gift_Value_Open;
// giftValue.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
XPRoomMoreItemModel *bgValue = [[XPRoomMoreItemModel alloc] init];
bgValue.title = YMLocalizedString(@"1.0.18_0");
bgValue.imageName= @"room_menu_background";
bgValue.type = RoomMoreMenuType_Room_Type_Background;
bgValue.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
XPRoomMoreItemModel * giftEffect = [[XPRoomMoreItemModel alloc] init];
giftEffect.title = roomInfo.hasAnimationEffect ? YMLocalizedString(@"XPMoreMenuPresenter28") : YMLocalizedString(@"XPMoreMenuPresenter5");
@@ -81,11 +81,6 @@
if (roomInfo.pkMatchStartTime) {
anchorRoomPK.title = YMLocalizedString(@"XPMoreMenuPresenter17");
}
// XPRoomMoreItemModel * messageScreen = [[XPRoomMoreItemModel alloc] init];
// messageScreen.title = roomInfo.isCloseScreen ? YMLocalizedString(@"XPMoreMenuPresenter34") : YMLocalizedString(@"XPMoreMenuPresenter19");
// messageScreen.imageName = @"room_more_menu_message";
// messageScreen.type = roomInfo.isCloseScreen ? RoomMoreMenuType_Message_Screen_Open : RoomMoreMenuType_Message_Screen_Close;
// messageScreen.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
XPRoomMoreItemModel * clearScreen = [[XPRoomMoreItemModel alloc] init];
clearScreen.title = YMLocalizedString(@"XPMoreMenuPresenter20");
@@ -149,7 +144,7 @@
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
request.roomId = roomId;
request.userIds = @[uid];
// __block
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
NSMutableArray * array = [NSMutableArray array];
BOOL isCreator = NO;
@@ -159,8 +154,14 @@
NIMChatroomMember * member = members.firstObject;
isCreator = member.type == NIMChatroomMemberTypeCreator;
isManager = member.type == NIMChatroomMemberTypeManager;
if (isCreator || isManager || isSuperAdmin) {
[array addObject:bgValue];
indexOfRoomAlbum += 1;
}
if ((isCreator || isManager || isSuperAdmin) && roomInfo.type != RoomType_MiniGame && roomInfo.type != RoomType_Anchor) {
[array addObject:roomPK];
[array addObject:roomPK];
indexOfRoomAlbum += 1;
}

View File

@@ -43,6 +43,7 @@
///P
#import "XPMoreMenuPresenter.h"
#import "XPMoreMenuProtocol.h"
#import "CustomRoomBGContentViewController.h"
UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
@@ -249,35 +250,6 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
NSString * roomUid = [NSString stringWithFormat:@"%ld",self.roomInfo.uid];
NSString * roomId = [NSString stringWithFormat:@"%ld", self.roomInfo.roomId];
switch (item.type) {
// case RoomMoreMenuType_Gift_Value_Close:
// {
// [StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"closeGiftValue"}];
// if (self.roomInfo.roomModeType == RoomModeType_Open_Blind) {
// [self showErrorToast:YMLocalizedString(@"XPRoomMoreMenuViewController2")];
// return;
// }
// TTAlertConfig * config = [[TTAlertConfig alloc] init];
// config.title = @"";
// config.message = YMLocalizedString(@"XPRoomMoreMenuViewController3");
// [TTPopup alertWithConfig:config confirmHandler:^{
// [self.presenter closeRoomGiftValue:roomUid];
// } cancelHandler:^{
//
// }];
// }
// break;
// case RoomMoreMenuType_Gift_Value_Open:
// [StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"openGiftValue"}];
// [self.presenter openRoomGiftValue:roomUid];
// break;
// case RoomMoreMenuType_Message_Screen_Open:
// [StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"openScreen"}];
// [self.presenter updateRoomMessageScreenState:NO roomId:roomId];
// break;
// case RoomMoreMenuType_Message_Screen_Close:
// [StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"closeScreen"}];
// [self.presenter updateRoomMessageScreenState:YES roomId:roomId];
// break;
case RoomMoreMenuType_Gift_Effect_Open:
{
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"openGiftEffect"}];
@@ -528,6 +500,15 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
XPRoomTypeSelectionViewController *micSelectionVC = [[XPRoomTypeSelectionViewController alloc] init];
micSelectionVC.model = self.hostDelegate.getRoomInfo;
[self.hostDelegate.getCurrentNav pushViewController:micSelectionVC animated:YES];
}
break;
case RoomMoreMenuType_Room_Type_Background: {
[self dismissViewControllerAnimated:NO completion:nil];
CustomRoomBGContentViewController *vc = [[CustomRoomBGContentViewController alloc] init];
vc.modalPresentationStyle = UIModalPresentationOverFullScreen;
[self.hostDelegate.getCurrentNav presentViewController:vc
animated:YES
completion:nil];
}
break;
default:

View File

@@ -36,8 +36,6 @@ typedef NS_ENUM(NSInteger, RoomSettingItemType) {
RoomSettingItemType_Leave_Model,
///关闭礼物值
RoomSettingItemType_Gift_Value_Model,
///主题
RoomSettingItemType_Theme ,
};
@interface XPRoomSettingItemModel : PIBaseModel

View File

@@ -25,10 +25,6 @@
titleItem.title = YMLocalizedString(@"XPRoomSettingPresenter0");
titleItem.subTitle = roomInfo.title;
titleItem.type = RoomSettingItemType_Title;
XPRoomSettingItemModel * themeItem = [[XPRoomSettingItemModel alloc] init];
themeItem.title = YMLocalizedString(@"XPRoomSettingPresenter12");
themeItem.type = RoomSettingItemType_Theme;
XPRoomSettingItemModel * lockItem = [[XPRoomSettingItemModel alloc] init];
lockItem.title = YMLocalizedString(@"XPRoomSettingPresenter1");
@@ -102,18 +98,16 @@
@kStrongify(self);
NSArray * array;
if (error == nil) {
NIMChatroomMember * member = members.firstObject;
NIMChatroomMember *member = members.firstObject;
//
BOOL isCreatorOrSuperAdmin = (member.type == NIMChatroomMemberTypeCreator || isSuperAdmin);
//
// BOOL isPermitRoom = (roomInfo.isPermitRoom == PermitRoomType_License);
BOOL isManagerOrAbove = (member.type == NIMChatroomMemberTypeManager || isCreatorOrSuperAdmin);
//
BOOL hasRoomPwd = (roomInfo.roomPwd.length > 0);
//
//
NSMutableArray *firstSection = [@[titleItem, lockItem] mutableCopy];
if (hasRoomPwd) {
[firstSection addObject:pwdItem];
@@ -122,58 +116,41 @@
NSMutableArray *secondSection = [@[tagItem] mutableCopy];
NSMutableArray *thirdSection = [@[blackItem, giftEffectItem, messageScreedItem] mutableCopy];
//
if (isCreatorOrSuperAdmin) {
// avatarItem
[secondSection insertObject:avatarItem atIndex:0];
[thirdSection insertObject:managerItem atIndex:0];
}
//
if (roomInfo.type == RoomType_Anchor) {
if (isCreatorOrSuperAdmin) {
// -
array = @[firstSection, secondSection, thirdSection];
} else {
// -
array = @[firstSection, secondSection, thirdSection];
}
//
array = @[firstSection, secondSection, thirdSection];
} else {
//
//
if (member.type == NIMChatroomMemberTypeCreator) {
//
[thirdSection addObjectsFromArray:@[arrangeMicItem, leaveItem]];
} else if (isSuperAdmin) {
//
[thirdSection addObject:arrangeMicItem];
} else if (member.type == NIMChatroomMemberTypeManager) {
//
} else if (isManagerOrAbove) {
[thirdSection addObject:arrangeMicItem];
}
if (roomInfo.type == RoomType_MiniGame) {
//
array = @[firstSection, secondSection, thirdSection];
} else {
//
array = @[firstSection, secondSection, thirdSection];
}
array = @[firstSection, secondSection, thirdSection];
}
NSMutableArray *list = [[NSMutableArray alloc]initWithArray:array];
if(member.type == NIMChatroomMemberTypeManager || member.type == NIMChatroomMemberTypeCreator || isSuperAdmin){
NSMutableArray *subList = [[NSMutableArray alloc]initWithArray:[list xpSafeObjectAtIndex:2]?:@[]];
if(subList){
[subList addObject:giftValueItem];
}
list[2] = subList;
NSMutableArray *themeList = [[NSMutableArray alloc]initWithArray:[list xpSafeObjectAtIndex:1]?:@[]];
if(themeList){
[themeList addObject:themeItem];
}
list[1] = themeList;
// 使 `array`
if (roomInfo.type == RoomType_MiniGame) {
array = @[firstSection, secondSection, thirdSection];
}
[[self getView] getRoomSettingListSuccess:list];
// list
NSMutableArray *list = [array mutableCopy];
if (isManagerOrAbove) {
NSMutableArray *thirdSubList = [list[2] mutableCopy];
[thirdSubList addObject:giftValueItem];
list[2] = thirdSubList;
}
//
[[self getView] getRoomSettingListSuccess:list];
}
}];
}

View File

@@ -104,7 +104,6 @@
_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;

View File

@@ -1,16 +0,0 @@
//
// MSRoomSetingBackdropVC.h
// YuMi
//
// Created by duoban on 2024/5/22.
//
#import "MvpViewController.h"
#import "RoomHostDelegate.h"
NS_ASSUME_NONNULL_BEGIN
@interface MSRoomSetingBackdropVC : MvpViewController
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -1,153 +0,0 @@
//
// MSRoomSetingBackdropVC.m
// YuMi
//
// Created by duoban on 2024/5/22.
//
#import "MSRoomSetingBackdropVC.h"
#import "MSRoomSetingBackdropCell.h"
#import "RoomInfoModel.h"
#import "XPRoomSettingPresenter.h"
@interface MSRoomSetingBackdropVC ()<UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
@property(nonatomic,strong) UICollectionView *collectionView;
@property(nonatomic,strong) UILabel *titleView;
@property(nonatomic,strong) UIButton *backView;
@property(nonatomic,copy) NSArray *imageList;
@property (nonatomic,weak) id<RoomHostDelegate> hostDelegate;
@property(nonatomic,strong) RoomInfoModel *roomInfo;
@end
@implementation MSRoomSetingBackdropVC
- (XPRoomSettingPresenter *)createPresenter {
return [[XPRoomSettingPresenter alloc] init];
}
- (BOOL)isHiddenNavBar{
return YES;
}
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
if (self = [super init]) {
self.hostDelegate = delegate;
self.roomInfo = [self.hostDelegate getRoomInfo];
}
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
[self installUI];
[self installConstraints];
}
-(void)installUI{
self.view.backgroundColor = UIColorFromRGB(0x181526);
[self.view addSubview:self.backView];
[self.view addSubview:self.titleView];
[self.view addSubview:self.collectionView];
}
-(void)installConstraints{
CGFloat top = (44 - kGetScaleWidth(22))/2 + kStatusBarHeight;
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(kGetScaleWidth(22));
make.top.equalTo(self.view).mas_offset(top);
make.leading.mas_equalTo(kGetScaleWidth(9));
}];
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.backView);
make.centerX.equalTo(self.view);
}];
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.trailing.bottom.equalTo(self.view);
make.top.equalTo(self.backView.mas_bottom).mas_offset(kGetScaleWidth(30));
}];
}
-(void)bakcBtnAction{
[self.navigationController popViewControllerAnimated:YES];
}
#pragma mark - UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return self.imageList.count;
}
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
MSRoomSetingBackdropCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([MSRoomSetingBackdropCell class]) forIndexPath:indexPath];
NSString *imageUrl = self.imageList[indexPath.row];
cell.isUse = [imageUrl isEqualToString:self.roomInfo.backPic];
cell.imageUrl = imageUrl;
return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
TTAlertConfig *config = [[TTAlertConfig alloc]init];
config.title = YMLocalizedString(@"XPIAPRechargeViewController7");
config.message = YMLocalizedString(@"MSRoomSetingBackdropCell1");
[TTPopup alertWithConfig:config confirmHandler:^{
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.roomInfo.uid];
NSString * roomId = [NSString stringWithFormat:@"%ld", self.roomInfo.roomId];
NSString * roomTag = [NSString stringWithFormat:@"%ld", self.roomInfo.tagId];
NSString * mgId = [NSString stringWithFormat:@"%lld", self.roomInfo.mgId];
NSString * roomClassifyId = self.roomInfo.singleRoomSortId;
NSString *backPic = self.imageList[indexPath.row];
[self.presenter updateRoomInfo:self.roomInfo.title
roomPwd:self.roomInfo.roomPwd
tagId:roomTag
classifyId:roomClassifyId
hasAnimationEffect:self.roomInfo.hasAnimationEffect
roomUid:roomUid
roomId:roomId
type:self.roomInfo.type
itemType:RoomSettingItemType_Title
mgId:mgId
backPic:backPic
avatar:self.roomInfo.avatar];
} cancelHandler:^{
[self.navigationController popViewControllerAnimated:YES];
}];
}
///
- (void)updateRoomInfoSuccess:(RoomInfoModel *)roomInfo itemType:(RoomSettingItemType)itemType{
self.roomInfo = roomInfo;
[self.collectionView reloadData];
}
///
- (void)updateRoomInfoFail:(NSString *)message{
[self showErrorToast:message];
}
#pragma mark -
- (NSArray *)imageList{
if(!_imageList){
_imageList = @[@"https://image.molistar.xyz/BG_0.webp",@"https://image.molistar.xyz/BG_1.webp",@"https://image.molistar.xyz/BG_2.webp",@"https://image.molistar.xyz/BG_3.webp",@"https://image.molistar.xyz/BG_4.webp",@"https://image.molistar.xyz/BG_5.webp"];
}
return _imageList;
}
- (UICollectionView *)collectionView{
if (!_collectionView) {
MSBaseRTLFlowLayout *layout = [[MSBaseRTLFlowLayout alloc] init];
layout.itemSize = CGSizeMake(kGetScaleWidth(166), kGetScaleWidth(206));
layout.minimumLineSpacing = kGetScaleWidth(16);
layout.minimumInteritemSpacing = kGetScaleWidth(16);
layout.scrollDirection = UICollectionViewScrollDirectionVertical;
layout.sectionInset = UIEdgeInsetsMake(0, kGetScaleWidth(13), 0, kGetScaleWidth(13));
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
_collectionView.dataSource = self;
_collectionView.delegate = self;
_collectionView.backgroundColor = [UIColor clearColor];
[_collectionView registerClass:[MSRoomSetingBackdropCell class] forCellWithReuseIdentifier:NSStringFromClass([MSRoomSetingBackdropCell class])];
}
return _collectionView;
}
- (UILabel *)titleView{
if(!_titleView){
_titleView = [UILabel labelInitWithText:YMLocalizedString(@"XPRoomSettingPresenter12") font:kFontBold(16) textColor:[UIColor whiteColor]];
}
return _titleView;
}
- (UIButton *)backView{
if(!_backView){
_backView = [UIButton new];
[_backView setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10];
[_backView setImage:[kImage(@"ms_room_reting_backdrop_back")ms_SetImageForRTL] forState:UIControlStateNormal];
[_backView addTarget:self action:@selector(bakcBtnAction) forControlEvents:UIControlEventTouchUpInside];
}
return _backView;
}
@end

View File

@@ -34,7 +34,6 @@
///VC
#import "XPRoomTagListViewController.h"
#import "XPRoomRoleViewController.h"
#import "MSRoomSetingBackdropVC.h"
#import "UploadFile.h"
@@ -67,6 +66,11 @@
return [[XPRoomSettingPresenter alloc] init];
}
- (void)dealloc
{
[self hideHUD];
}
- (void)viewDidLoad {
[super viewDidLoad];
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.roomInfo.uid];
@@ -85,6 +89,8 @@
[self initSubViewConstraints];
}
#pragma mark - Private Method
- (void)initSubViews {
self.title = YMLocalizedString(@"XPRoomSettingViewController0");
@@ -295,12 +301,6 @@ XPRoomSettingItemModel * itemModel = [[self.datasource xpSafeObjectAtIndex:index
[self.navigationController pushViewController:managerVC animated:YES];
}
break;
case RoomSettingItemType_Theme:
{
MSRoomSetingBackdropVC * backdropVC = [[ MSRoomSetingBackdropVC alloc]initWithDelegate:self.hostDelegate];
[self.navigationController pushViewController:backdropVC animated:YES];
break;
}
default:
break;

View File

@@ -3964,3 +3964,11 @@ ineHeadView12" = "الحمل";
"VipSettin_1.0.17_5" = "منع الطرد";
"UserCard_1.0.17_0" = "%@فشل الإعداد، هذا المستخدم هو في اي بي";
"UserCard_1.0.17_1" = "فشل المتابعة، تم تعيين المستخدم على عدم إمكانية متابعته";
"1.0.18_0" = "房间背景";
"1.0.18_1" = "免费";
"1.0.18_2" = "给点";
"1.0.18_3" = "给多点你就是王";
"1.0.18_4" = "Create new";
"1.0.18_5" = "You can customize up to 6 backgrounds.";
"1.0.18_6" = "You can only upload up to 6 images at a time as a custom background. Once the background is created, it cannot be canceled. We will review the uploaded background within 24 hours. If the background is rejected, you will receive a refund of coins.";

View File

@@ -3760,3 +3760,11 @@
"VipSettin_1.0.17_5" = "Anti-Kick";
"UserCard_1.0.17_0" = "Setting failed, this user is VIP%@";
"UserCard_1.0.17_1" = "Follow failed, the user has been set to be unfollowable.";
"1.0.18_0" = "房间背景";
"1.0.18_1" = "免费";
"1.0.18_2" = "给点";
"1.0.18_3" = "给多点你就是王";
"1.0.18_4" = "Create new";
"1.0.18_5" = "You can customize up to 6 backgrounds.";
"1.0.18_6" = "You can only upload up to 6 images at a time as a custom background. Once the background is created, it cannot be canceled. We will review the uploaded background within 24 hours. If the background is rejected, you will receive a refund of coins.";

View File

@@ -3546,3 +3546,11 @@
"XPMineGameTableViewCell0"="Gündelik Oyunlar";
"MSRoomGameQuit tGameView3"="Eşleşme başarısız oldu, tekrar eşleşmek ister misiniz?";
"MSRoomGameVC1"="Cüzdan";
"1.0.18_0" = "房间背景";
"1.0.18_1" = "免费";
"1.0.18_2" = "给点";
"1.0.18_3" = "给多点你就是王";
"1.0.18_4" = "Create new";
"1.0.18_5" = "You can customize up to 6 backgrounds.";
"1.0.18_6" = "You can only upload up to 6 images at a time as a custom background. Once the background is created, it cannot be canceled. We will review the uploaded background within 24 hours. If the background is rejected, you will receive a refund of coins.";

View File

@@ -3416,3 +3416,11 @@
"VipSettin_1.0.17_5" = "防踢";
"UserCard_1.0.17_0" = "設定失敗用户為尊貴的VIP%@";
"UserCard_1.0.17_1" = "關注失敗,該用戶已被設定為不可關注。";
"1.0.18_0" = "房间背景";
"1.0.18_1" = "免费";
"1.0.18_2" = "给点";
"1.0.18_3" = "给多点你就是王";
"1.0.18_4" = "Create new";
"1.0.18_5" = "You can customize up to 6 backgrounds.";
"1.0.18_6" = "You can only upload up to 6 images at a time as a custom background. Once the background is created, it cannot be canceled. We will review the uploaded background within 24 hours. If the background is rejected, you will receive a refund of coins.";