礼物面板更改

This commit is contained in:
liyuhua
2023-11-13 16:42:34 +08:00
parent 0161a860af
commit 6e69623fe1
13 changed files with 915 additions and 846 deletions

View File

@@ -332,6 +332,7 @@
23CEFC632AFB8FC100576D89 /* BSRealTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFC442AFB8FC100576D89 /* BSRealTextView.m */; };
23CEFC642AFB8FC100576D89 /* BSkObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFC472AFB8FC100576D89 /* BSkObject.m */; };
23CEFC652AFB8FC100576D89 /* BSDrawLine.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFC482AFB8FC100576D89 /* BSDrawLine.m */; };
23CEFC682AFCCE7700576D89 /* PIGiftInfoSegmentedView.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFC672AFCCE7700576D89 /* PIGiftInfoSegmentedView.m */; };
23D321D22ADD0EBC006B259C /* PIRoomPhotoAlbumItemPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 23D321D12ADD0EBC006B259C /* PIRoomPhotoAlbumItemPresenter.m */; };
23D321D52ADD0F05006B259C /* Api+PhotoAlbum.m in Sources */ = {isa = PBXBuildFile; fileRef = 23D321D42ADD0F05006B259C /* Api+PhotoAlbum.m */; };
23D321D92ADD1B46006B259C /* PIRoomPhotoAlbumItemModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 23D321D82ADD1B46006B259C /* PIRoomPhotoAlbumItemModel.m */; };
@@ -2116,6 +2117,8 @@
23CEFC472AFB8FC100576D89 /* BSkObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BSkObject.m; sourceTree = "<group>"; };
23CEFC482AFB8FC100576D89 /* BSDrawLine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BSDrawLine.m; sourceTree = "<group>"; };
23CEFC492AFB8FC100576D89 /* BSkObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BSkObject.h; sourceTree = "<group>"; };
23CEFC662AFCCE7700576D89 /* PIGiftInfoSegmentedView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PIGiftInfoSegmentedView.h; sourceTree = "<group>"; };
23CEFC672AFCCE7700576D89 /* PIGiftInfoSegmentedView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PIGiftInfoSegmentedView.m; sourceTree = "<group>"; };
23D321D02ADD0EBC006B259C /* PIRoomPhotoAlbumItemPresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PIRoomPhotoAlbumItemPresenter.h; sourceTree = "<group>"; };
23D321D12ADD0EBC006B259C /* PIRoomPhotoAlbumItemPresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PIRoomPhotoAlbumItemPresenter.m; sourceTree = "<group>"; };
23D321D32ADD0F05006B259C /* Api+PhotoAlbum.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Api+PhotoAlbum.h"; sourceTree = "<group>"; };
@@ -8722,6 +8725,8 @@
9B4E91FF28E57A620033419E /* XPGiftHeadTypeView.m */,
E8788940273A55AD00BF1D57 /* XPGiftUsersView.h */,
E8788941273A55AD00BF1D57 /* XPGiftUsersView.m */,
23CEFC662AFCCE7700576D89 /* PIGiftInfoSegmentedView.h */,
23CEFC672AFCCE7700576D89 /* PIGiftInfoSegmentedView.m */,
E8788943273A55C200BF1D57 /* XPGiftInfoView.h */,
E8788944273A55C200BF1D57 /* XPGiftInfoView.m */,
E8788946273A55D000BF1D57 /* XPGiftBarView.h */,
@@ -11752,6 +11757,7 @@
E85E7B4B2A4EB0D300B6D00A /* XPMineGuildManagerSetViewController.m in Sources */,
189DD73D26E21C3F00AB55B1 /* YYUtility+Device.m in Sources */,
187EEEDC26E89B32002833B2 /* BaseModel.m in Sources */,
23CEFC682AFCCE7700576D89 /* PIGiftInfoSegmentedView.m in Sources */,
E878B85E283640A500E22DCF /* MonentsUnReadModel.m in Sources */,
E81366FC26F0D2980076364C /* UIButton+EnlargeTouchArea.m in Sources */,
E85E7BA42A4EC99300B6D00A /* XPMineGiveDiamondCell.m in Sources */,

View File

@@ -393,43 +393,7 @@
return _arrowButton;
}
- (JXCategoryTitleView *)titleView {
if (!_titleView) {
_titleView = [[JXCategoryTitleView alloc] init];
_titleView.delegate = self;
_titleView.titles = self.titles;
_titleView.backgroundColor = [UIColor clearColor];
_titleView.titleColor = [DJDKMIMOMColor secondTextColor];
_titleView.titleSelectedColor = [DJDKMIMOMColor appMainColor];
_titleView.titleFont = [UIFont systemFontOfSize:14];
_titleView.titleSelectedFont = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
_titleView.titleLabelAnchorPointStyle = JXCategoryTitleLabelAnchorPointStyleCenter;
_titleView.contentScrollViewClickTransitionAnimationEnabled = NO;
_titleView.defaultSelectedIndex = 0;
_titleView.cellSpacing = 20;
_titleView.cellWidthIncrement = 5;
_titleView.cellWidth = 60;
_titleView.listContainer = self.pi_containerView;
// JXCategoryIndicatorImageView *lineView = [[JXCategoryIndicatorImageView alloc] init];
// lineView.indicatorImageViewSize = CGSizeMake(60, 8);
// lineView.verticalMargin = 6;
// lineView.indicatorImageView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFFC000), UIColorFromRGB(0xFFD15A)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(60, 8)];
// lineView.indicatorImageView.layer.masksToBounds = YES;
// lineView.indicatorImageView.layer.cornerRadius = 6;
// _titleView.indicators = @[lineView];
}
return _titleView;
}
- (JXCategoryListContainerView *)pi_containerView {
if (!_pi_containerView) {
_pi_containerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self];
_pi_containerView.defaultSelectedIndex = 0;
_pi_containerView.scrollView.tag = 1009;
}
return _pi_containerView;
}
- (NSArray<NSString *> *)titles {
if (!_titles) {

View File

@@ -0,0 +1,48 @@
//
// PIGiftInfoSegmentedView.h
// YuMi
//
// Created by duoban on 2023/11/9.
//
#import <UIKit/UIKit.h>
#import "XPFreeGiftModel.h"
#import "GiftInfoModel.h"
#import "RoomInfoModel.h"
#import "XPSendGiftView.h"
#import "XPGiftInfoView.h"
NS_ASSUME_NONNULL_BEGIN
@class GiftInfoModel,PIGiftInfoSegmentedView, GiftReceiveInfoModel;
@protocol PIGiftInfoSegmentedViewDelegate <NSObject>
///点击了切换不同礼物的tabbar
- (void)pIGiftInfoSegmentedView:(PIGiftInfoSegmentedView *)view didClickSegment:(GiftSegmentType)type;
///点击了某个item
- (void)pIGiftInfoSegmentedView:(PIGiftInfoSegmentedView *)view didClickItem:(GiftInfoModel *)info type:(GiftSegmentType)type;
@end
@interface PIGiftInfoSegmentedView : UIView
@property(nonatomic,weak) id<PIGiftInfoSegmentedViewDelegate>delegate;
///普通礼物/幸运礼物/贵族礼物
@property (nonatomic,strong) NSArray *normalOriginArray;
///背包礼物
@property (nonatomic,strong) NSArray *packOriginArray;
///免费礼物
@property (nonatomic,strong) XPFreeGiftModel *freeModel;
///免费礼物送完删除了,不能出现在背包,防止数据更新时重新加进来
@property (nonatomic,assign) BOOL isDelFreeGift;
///当前用户贵族等级
@property (nonatomic, assign) NSInteger curUserNobleLevel;
///最后一次选中的礼物
@property (nonatomic,strong,readonly) GiftInfoModel *lastSelectGift;
///房间类型
@property (nonatomic,assign) RoomType roomType;
///送背包礼物更新数据源
- (void)updatePackSource:(GiftReceiveInfoModel *)giftReceiveInfo numberUser:(NSInteger)numberUser;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,292 @@
//
// PIGiftInfoSegmentedView.m
// YuMi
//
// Created by duoban on 2023/11/9.
//
#import "PIGiftInfoSegmentedView.h"
#import <JXCategoryView/JXCategoryView.h>
#import <JXCategoryView/JXCategoryIndicatorBackgroundView.h>
#import <JXCategoryView/JXCategoryListContainerView.h>
#import "ThemeColor+SendGift.h"
#import "XPGiftInfoView.h"
@interface PIGiftInfoSegmentedView()<JXCategoryViewDelegate, JXCategoryListContainerViewDelegate,XPGiftInfoViewDelegate>
///
@property (nonatomic, strong) NSArray<NSString *> *pi_titles;
///
@property (nonatomic,strong) UIImageView *segmentBgView;
///
@property (nonatomic, strong) JXCategoryTitleView *titleView;
///lineView
@property (nonatomic, strong) JXCategoryListContainerView *pi_containerView;
///
@property (nonatomic,strong) UILabel *totalValueLabel;
///
@property (nonatomic,strong) UIButton *packGiftButton;
///
@property(nonatomic,strong) XPGiftInfoView *packGiftView;
///
@property(nonatomic,strong) NSMutableArray *giftList;
///
@property (nonatomic,strong) GiftInfoModel *lastSelectGift;
@end
@implementation PIGiftInfoSegmentedView
-(instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if(self){
[self installUI];
[self installConstraints];
}
return self;
}
-(void)installUI{
[self addSubview:self.segmentBgView];
[self addSubview:self.titleView];
[self addSubview:self.pi_containerView];
[self addSubview:self.packGiftButton];
[self addSubview:self.totalValueLabel];
[self addSubview:self.packGiftView];
}
-(void)installConstraints{
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(44+108 * 2 + 10 + 10 + 15);
}];
[self.segmentBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.equalTo(self);
make.height.mas_equalTo(44);
}];
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.leading.equalTo(self);
make.height.mas_equalTo(44);
make.width.mas_equalTo(200);
}];
[self.packGiftButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.trailing.mas_equalTo(-15);
make.centerY.height.mas_equalTo(self.titleView);
make.width.mas_equalTo(30);
}];
[self.totalValueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.packGiftButton.mas_left).mas_offset(-6);
make.centerY.mas_equalTo(self.packGiftButton);
}];
[self.pi_containerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.trailing.bottom.equalTo(self);
make.top.equalTo(self.titleView.mas_bottom).mas_offset(kGetScaleWidth(0));
}];
[self.packGiftView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.pi_containerView);
}];
}
#pragma mark - JXCategoryViewDelegate
- (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView {
return self.pi_titles.count;
}
- (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index {
XPGiftInfoView<JXCategoryListContentViewDelegate> * list = (XPGiftInfoView<JXCategoryListContentViewDelegate> *)[self.pi_containerView.validListDict objectForKey:[NSNumber numberWithInteger:index]];
if (list) {
list.normalOriginArray = [self.giftList safeObjectAtIndex1:index];
return list;
} else {
XPGiftInfoView *vc = [[XPGiftInfoView alloc]init];
if(index == 0){
vc.segmentType = GiftSegmentType_Normal;
}else if (index == 1){
vc.segmentType = GiftSegmentType_Lucky;
}else if (index == 2){
vc.segmentType = GiftSegmentType_WeekStar;
}else{
vc.curUserNobleLevel = self.curUserNobleLevel;
vc.segmentType = GiftSegmentType_Noble;
}
vc.delegate = self;
vc.normalOriginArray = [self.giftList safeObjectAtIndex1:index];
return vc;
}
}
- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index{
self.packGiftView.hidden = YES;
GiftSegmentType type;
if(index == 0){
type = GiftSegmentType_Normal;
}else if (index == 1){
type = GiftSegmentType_Lucky;
}else if (index == 2){
type = GiftSegmentType_WeekStar;
}else{
type = GiftSegmentType_Noble;
}
if(self.delegate && [self.delegate respondsToSelector:@selector(pIGiftInfoSegmentedView:didClickSegment:)]){
[self.delegate pIGiftInfoSegmentedView:self didClickSegment:type];
}
}
-(void)didClickGiftSegmentAction:(UIButton *)sender{
self.packGiftView.hidden = NO;
}
- (void)createPackTotalValueAttribute {
__block NSInteger giftTotal = 0;
[self.packOriginArray enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj isKindOfClass:GiftInfoModel.class]) {
GiftInfoModel *gift = (GiftInfoModel *)obj;
if(gift.giftId != self.freeModel.giftId.integerValue){
giftTotal += gift.count * gift.goldPrice;
}
}
}];
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:YMLocalizedString(@"XPGiftInfoView0" ) attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:10],NSForegroundColorAttributeName:[DJDKMIMOMColor textThirdColor]}];
[str appendAttributedString:[[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@",[self countFormatCoinStr:giftTotal]] attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12],NSForegroundColorAttributeName:[DJDKMIMOMColor appMainColor]}]];
NSTextAttachment *attachImage = [[NSTextAttachment alloc] init];
attachImage.image = [UIImage imageNamed:@"gift_diamond"];
attachImage.bounds = CGRectMake(0, 0, 9, 9);
[str appendAttributedString:[[NSMutableAttributedString alloc] initWithAttributedString:[NSAttributedString attributedStringWithAttachment:attachImage]]];
self.totalValueLabel.attributedText = str;
}
/**
xx.xxW29999W+
@param number
@return
*/
- (NSString *)countFormatCoinStr:(NSInteger)number {
NSString *numStr = [NSString stringWithFormat:@"%li", number];
NSInteger num = number;
if (num > 99990000) {
numStr = @"9999W+";
} else if (num >= 10000) {
CGFloat numF = num / 10000.0;
numStr = [NSString stringWithFormat:@"%.2fW+", numF];
}
return numStr;
}
- (void)setNormalOriginArray:(NSArray *)normalOriginArray {
_normalOriginArray = normalOriginArray;
NSMutableArray * normaleArray = [NSMutableArray array];
NSMutableArray * luckyArray = [NSMutableArray array];
NSMutableArray * weekStarArray = [NSMutableArray array];
NSMutableArray * nobleArray = [NSMutableArray array];
[_normalOriginArray enumerateObjectsUsingBlock:^(GiftInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (obj.giftType == GiftType_Lucky) {
[luckyArray addObject:obj];
} else if(obj.giftType == GiftType_Game) {
[normaleArray addObject:obj];
} else if (obj.giftType == GiftType_Noble) {
[nobleArray addObject:obj];
} else if (obj.giftType == GiftType_WeekStar) {
[weekStarArray addObject:obj];
}
}];
_giftList = [[NSMutableArray alloc]initWithArray:@[normaleArray,luckyArray,weekStarArray,nobleArray]];
}
-(void)setPackOriginArray:(NSArray *)packOriginArray{
_packOriginArray = packOriginArray;
self.packGiftView.packOriginArray = packOriginArray;
}
-(void)setFreeModel:(XPFreeGiftModel *)freeModel{
_freeModel = freeModel;
self.packGiftView.freeModel = freeModel;
}
- (void)setIsDelFreeGift:(BOOL)isDelFreeGift{
_isDelFreeGift = isDelFreeGift;
self.packGiftView.isDelFreeGift = _isDelFreeGift;
}
//- (void)setPackOriginArray:(NSArray *)packOriginArray {
// _packOriginArray = packOriginArray;
//// [self createPackTotalValueAttribute];
//}
///
- (void)updatePackSource:(GiftReceiveInfoModel *)giftReceiveInfo numberUser:(NSInteger)numberUser{
[self.packGiftView updatePackSource:giftReceiveInfo numberUser:numberUser];
}
#pragma mark- XPGiftInfoViewDelegate
///tabbar
- (void)xPGiftInfoView:(XPGiftInfoView *)view dealSelectGift:(GiftInfoModel *)giftInfo{
self.lastSelectGift = giftInfo;
}
///item
- (void)xPGiftInfoView:(XPGiftInfoView *)view didClickItem:(GiftInfoModel *)info type:(GiftSegmentType)type{
if(self.delegate && [self.delegate respondsToSelector:@selector(xPGiftInfoView:didClickItem:type:)]){
[self.delegate pIGiftInfoSegmentedView:self didClickItem:info type:type];
}
}
#pragma mark -
- (NSArray<NSString *> *)pi_titles{
if(!_pi_titles){
_pi_titles = @[YMLocalizedString(@"XPGiftInfoView2"),YMLocalizedString(@"XPGiftInfoView3"),YMLocalizedString(@"XPGiftInfoView4"),YMLocalizedString(@"XPGiftInfoView9")];
}
return _pi_titles;
}
- (JXCategoryTitleView *)titleView {
if (!_titleView) {
_titleView = [[JXCategoryTitleView alloc] init];
_titleView.delegate = self;
_titleView.titles = self.pi_titles;
_titleView.backgroundColor = [UIColor clearColor];
_titleView.titleColor = [DJDKMIMOMColor giftSegmentNormalTitleColor];
_titleView.titleSelectedColor = [DJDKMIMOMColor giftSegmentSelectTitleColor];
_titleView.titleFont = [UIFont systemFontOfSize:13 weight:UIFontWeightSemibold];
_titleView.titleSelectedFont = [UIFont systemFontOfSize:13 weight:UIFontWeightSemibold];
_titleView.titleLabelAnchorPointStyle = JXCategoryTitleLabelAnchorPointStyleCenter;
_titleView.contentScrollViewClickTransitionAnimationEnabled = NO;
_titleView.defaultSelectedIndex = 0;
_titleView.cellSpacing = 0;
_titleView.cellWidthIncrement = 5;
_titleView.cellWidth = 30;
_titleView.listContainer = self.pi_containerView;
}
return _titleView;
}
- (JXCategoryListContainerView *)pi_containerView {
if (!_pi_containerView) {
_pi_containerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self];
_pi_containerView.defaultSelectedIndex = 0;
_pi_containerView.scrollView.tag = 1009;
_pi_containerView.scrollView.scrollEnabled = NO;
}
return _pi_containerView;
}
- (UILabel *)totalValueLabel {
if (!_totalValueLabel) {
_totalValueLabel = [[UILabel alloc] init];
}
return _totalValueLabel;
}
- (UIButton *)packGiftButton {
if (!_packGiftButton) {
_packGiftButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_packGiftButton setTitle:YMLocalizedString(@"XPGiftInfoView5") forState:UIControlStateNormal];
[_packGiftButton setTitleColor:[DJDKMIMOMColor giftSegmentSelectTitleColor] forState:UIControlStateSelected];
[_packGiftButton setTitleColor:[DJDKMIMOMColor giftSegmentNormalTitleColor] forState:UIControlStateNormal];
_packGiftButton.titleLabel.font = [UIFont systemFontOfSize:13 weight:UIFontWeightSemibold];
_packGiftButton.tag = GiftSegmentType_Pack;
_packGiftButton.selected = NO;
[_packGiftButton addTarget:self action:@selector(didClickGiftSegmentAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _packGiftButton;
}
- (XPGiftInfoView *)packGiftView{
if(!_packGiftView){
_packGiftView = [[XPGiftInfoView alloc]initWithFrame:CGRectZero];
_packGiftView.segmentType = GiftSegmentType_Pack;
_packGiftView.hidden = YES;
}
return _packGiftView;
}
- (UIImageView *)segmentBgView {
if (!_segmentBgView) {
_segmentBgView = [[UIImageView alloc] init];
_segmentBgView.userInteractionEnabled = YES;
_segmentBgView.contentMode = UIViewContentModeScaleAspectFill;
_segmentBgView.image = [UIImage gradientColorImageFromColors:@[[DJDKMIMOMColor colorWithHexString:@"#E5FFFF"], [DJDKMIMOMColor colorWithHexString:@"#FFFFFF"]] gradientType:GradientTypeTopToBottom imgSize:CGSizeMake(KScreenWidth, 44)];
_segmentBgView.hidden = YES;
}
return _segmentBgView;
}
@end

View File

@@ -7,6 +7,7 @@
#import <UIKit/UIKit.h>
#import "XPSendGiftView.h"
#import <JXCategoryView/JXCategoryListContainerView.h>
///Model
#import "RoomInfoModel.h"
NS_ASSUME_NONNULL_BEGIN
@@ -28,20 +29,21 @@ typedef NS_ENUM(NSInteger, GiftSegmentType) {
@protocol XPGiftInfoViewDelegate <NSObject>
///点击了切换不同礼物的tabbar
- (void)xPGiftInfoView:(XPGiftInfoView *)view didClickSegment:(GiftSegmentType)type;
- (void)xPGiftInfoView:(XPGiftInfoView *)view dealSelectGift:(GiftInfoModel *)giftInfo;
///点击了某个item
- (void)xPGiftInfoView:(XPGiftInfoView *)view didClickItem:(GiftInfoModel *)info type:(GiftSegmentType)type;
@end
@interface XPGiftInfoView : UIView
@interface XPGiftInfoView : UIView<JXCategoryListContentViewDelegate>
///使用的地方
@property (nonatomic,assign) SendGiftType usingplaceType;
///普通礼物/幸运礼物/贵族礼物
@property (nonatomic,strong) NSArray *normalOriginArray;
///背包礼物
@property (nonatomic,strong) NSArray *packOriginArray;
///送背包礼物更新数据源
- (void)updatePackSource:(GiftReceiveInfoModel *)giftReceiveInfo numberUser:(NSInteger)numberUser;
///代理
@@ -51,7 +53,6 @@ typedef NS_ENUM(NSInteger, GiftSegmentType) {
///当前用户贵族等级
@property (nonatomic, assign) NSInteger curUserNobleLevel;
@property (nonatomic, copy) NSString *defaultSelectGiftId;
///房间类型
@property (nonatomic,assign) RoomType roomType;
///免费礼物送完删除了,不能出现在背包,防止数据更新时重新加进来
@@ -59,10 +60,9 @@ typedef NS_ENUM(NSInteger, GiftSegmentType) {
///免费礼物
@property (nonatomic,strong) XPFreeGiftModel *freeModel;
///头部礼物类型变更
/// - Parameter headType: 1礼物 2互动
- (void)giftHeadTypeHadChange:(NSInteger)headType;
///当前展示的数据的类型
@property (nonatomic,assign) GiftSegmentType segmentType;
@end
NS_ASSUME_NONNULL_END

File diff suppressed because it is too large Load Diff

View File

@@ -32,7 +32,7 @@
#import "XPMessageRemoteExtModel.h"
///View
#import "XPGiftUsersView.h"
#import "XPGiftInfoView.h"
#import "PIGiftInfoSegmentedView.h"
#import "XPGiftBarView.h"
#import "XPRoomHalfWebView.h"
#import "XPGraffitiGiftView.h"
@@ -49,7 +49,7 @@
UIKIT_EXTERN NSString * const kFreeGiftCountdownNotification;
UIKIT_EXTERN NSString * kShowFirstRechargeView;
@interface XPSendGiftView ()< XPGiftBarViewDelegate, XPGiftProtocol, XPGiftInfoViewDelegate, XPGraffitiGiftViewDelegate, XPGiftUsersViewDelegate, XPGiftHeadTypeViewDelegate, XPGiftLuckyGiftBroadcastViewDelegate, XPGiftTwelveStarBroadcastViewDelegate>
@interface XPSendGiftView ()< XPGiftBarViewDelegate, XPGiftProtocol, XPGraffitiGiftViewDelegate, XPGiftUsersViewDelegate, XPGiftHeadTypeViewDelegate, XPGiftLuckyGiftBroadcastViewDelegate, XPGiftTwelveStarBroadcastViewDelegate,PIGiftInfoSegmentedViewDelegate>
///
@property (nonatomic,strong) UIView * topView;
///
@@ -67,7 +67,7 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
///
@property (nonatomic,strong) XPGiftUsersView *userView;
///
@property (nonatomic,strong) XPGiftInfoView *giftInfoView;
@property (nonatomic,strong) PIGiftInfoSegmentedView *giftInfoView;
///
@property (nonatomic,strong) XPGiftBarView *giftBarView;
///View
@@ -506,7 +506,7 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
///
- (void)xPGiftHeadTypeViewDidClickGift:(XPGiftHeadTypeView *)view {
[self.luckyBroadcastView removeFromSuperview];
[self.giftInfoView giftHeadTypeHadChange:1];
// [self.giftInfoView giftHeadTypeHadChange:1];
if (!self.graffitiView.hidden) {//
[self.graffitiView clearData];
[self.graffitiView cratePriceAttribute];
@@ -519,14 +519,15 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
///
- (void)xPGiftHeadTypeViewDidClickInteraction:(XPGiftHeadTypeView *)view {
[self.luckyBroadcastView removeFromSuperview];
[self.giftInfoView giftHeadTypeHadChange:2];
// [self.giftInfoView giftHeadTypeHadChange:2];
}
#pragma mark - XPGiftInfoViewDelegate
- (void)xPGiftInfoView:(XPGiftInfoView *)view didClickSegment:(GiftSegmentType)type {
self.segmentType = type;
self.giftBarView.type = type;
self.giftBarView.drawGiftCount = 0;
#pragma mark - PIGiftInfoSegmentedViewDelegate
///tabbar
- (void)pIGiftInfoSegmentedView:(PIGiftInfoSegmentedView *)view didClickSegment:(GiftSegmentType)type{
self.segmentType = type;
self.giftBarView.type = type;
self.giftBarView.drawGiftCount = 0;
if (type == GiftSegmentType_Lucky) {
[self.constellationBanner removeFromSuperview];
if (!self.luckyBroadcastView.superview) {
@@ -539,48 +540,50 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
}
} else if(type == GiftSegmentType_WeekStar) {
[self.luckyBroadcastView removeFromSuperview];
// if ([ClientConfig shareConfig].configInfo.twelveStarSwitch) {
self.constellationBanner.hidden = NO;
if (!self.constellationBanner.superview) {
[self.view addSubview:self.constellationBanner];
[self.constellationBanner mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.contentView.mas_top);
make.left.right.mas_equalTo(0);
make.height.mas_equalTo(kGetScaleWidth(56));
}];
}
// if ([ClientConfig shareConfig].configInfo.twelveStarSwitch) {
self.constellationBanner.hidden = NO;
if (!self.constellationBanner.superview) {
[self.view addSubview:self.constellationBanner];
[self.constellationBanner mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.contentView.mas_top);
make.left.right.mas_equalTo(0);
make.height.mas_equalTo(kGetScaleWidth(56));
}];
}
// } else {
// self.constellationBanner.hidden = YES;
// }
// } else {
// self.constellationBanner.hidden = YES;
// }
} else {
[self.luckyBroadcastView removeFromSuperview];
[self.constellationBanner removeFromSuperview];
}
}
- (void)xPGiftInfoView:(XPGiftInfoView *)view didClickItem:(GiftInfoModel *)info type:(GiftSegmentType)type {
if (type == GiftSegmentType_Graffiti) {
self.giftInfoView.hidden = YES;
self.graffitiView.hidden = NO;
self.graffitiView.price = info.goldPrice;
self.giftBarView.drawGiftCount = 0;
self.graffitiView.selectUidNumber = self.userView.selectUserArray.count;
[[SDWebImageManager sharedManager] loadImageWithURL:[NSURL URLWithString:info.giftUrl] options:SDWebImageProgressiveLoad progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {
if (error == nil && image) {
self.graffitiView.image = image;
} else {
self.giftInfoView.hidden = NO;
}
}];
///item
- (void)pIGiftInfoSegmentedView:(PIGiftInfoSegmentedView *)view didClickItem:(GiftInfoModel *)info type:(GiftSegmentType)type{
if (type == GiftSegmentType_Graffiti) {
self.giftInfoView.hidden = YES;
self.graffitiView.hidden = NO;
self.graffitiView.price = info.goldPrice;
self.giftBarView.drawGiftCount = 0;
self.graffitiView.selectUidNumber = self.userView.selectUserArray.count;
[[SDWebImageManager sharedManager] loadImageWithURL:[NSURL URLWithString:info.giftUrl] options:SDWebImageProgressiveLoad progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {
if (error == nil && image) {
self.graffitiView.image = image;
} else {
self.giftInfoView.hidden = NO;
}
}];
}else if(type == GiftSegmentType_WeekStar){
self.constellationBanner.giftInfo = info;
}
else {
self.giftBarView.drawGiftCount = 10;
}
self.giftBarView.drawGiftCount = 10;
}
}
#pragma mark - XPGiftUsersViewDelegate
- (void)xPGiftUsersView:(XPGiftUsersView *)view didSelectUsers:(NSArray *)selectUids {
self.graffitiView.selectUidNumber = selectUids.count;
@@ -690,7 +693,8 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
///
[self sendGraffitiGiftMessage];
if (self.segmentType == GiftSegmentType_Graffiti) {
NSString * title = [NSString stringWithFormat:YMLocalizedString(@"XPSendGiftView3"),self.giftInfoView.lastSelectGift.giftName];
NSString * title = @"";
// NSString * title = [NSString stringWithFormat:YMLocalizedString(@"XPSendGiftView3"),self.giftInfoView.lastSelectGift.giftName];
[self showSuccessToast:title];
[self dismissViewControllerAnimated:YES completion:nil];
}
@@ -702,6 +706,7 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
if (code == 31005) {//
[self showNotSufficientFundsWithToast:msg];
} else if (code == 8535) {//
GiftInfoModel * giftInfo = self.giftInfoView.lastSelectGift;
TTAlertConfig *config = [[TTAlertConfig alloc] init];
config.actionStyle = TTAlertActionConfirmStyle;
@@ -746,7 +751,7 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
- (void)setUsingplaceType:(SendGiftType)usingplaceType {
_usingplaceType = usingplaceType;
self.giftBarView.usingplaceType = usingplaceType;
self.giftInfoView.usingplaceType = _usingplaceType;
// self.giftInfoView.usingplaceType = _usingplaceType;
self.headTypeView.hidden = _usingplaceType == SendGiftType_User;
self.userView.hidden = _usingplaceType == SendGiftType_User;
self.effectView.hidden = _usingplaceType == SendGiftType_User;
@@ -757,7 +762,7 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
- (void)setSelectGiftId:(NSString *)selectGiftId {
_selectGiftId = selectGiftId;
self.giftInfoView.defaultSelectGiftId = selectGiftId;
// self.giftInfoView.defaultSelectGiftId = selectGiftId;
}
- (void)setDelegate:(id<RoomHostDelegate>)delegate {
@@ -798,9 +803,9 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
return _userView;
}
- (XPGiftInfoView *)giftInfoView {
- (PIGiftInfoSegmentedView *)giftInfoView {
if (!_giftInfoView) {
_giftInfoView = [[XPGiftInfoView alloc] init];
_giftInfoView = [[PIGiftInfoSegmentedView alloc] initWithFrame:CGRectZero];
_giftInfoView.delegate = self;
}
return _giftInfoView;

View File

@@ -501,7 +501,20 @@
}
}
}
- (void)configPkBtn:(UserInfoModel *)userInfo{
self.groupTypeButton.hidden = YES;
if (self.roomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
if (userInfo.groupType == GroupType_Red) {
self.groupTypeButton.hidden = NO;
[self.groupTypeButton setTitle:YMLocalizedString(@"MicroView2") forState:UIControlStateNormal];
[self.groupTypeButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFC4A95), UIColorFromRGB(0xFE6075)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
} else if(userInfo.groupType == GroupType_Blue) {
self.groupTypeButton.hidden = NO;
[self.groupTypeButton setTitle:YMLocalizedString(@"MicroView3") forState:UIControlStateNormal];
[self.groupTypeButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x3571FE), UIColorFromRGB(0x7994FC)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
}
}
}
- (void)configGiftValue:(long long)giftValue {
self.giftValueView.giftValue = giftValue;
}

View File

@@ -33,7 +33,8 @@ NS_ASSUME_NONNULL_BEGIN
* 设置麦位信息和用户信息。
*/
- (void)configMicroView:(MicroQueueModel *)model;
///设置pk按钮的状态
- (void)configPkBtn:(UserInfoModel *)userInfo;
/**
* 设置用户信息。
*/

View File

@@ -73,7 +73,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, weak, readonly) id<RoomHostDelegate> hostDelegate;
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;
-(void)exitRoom;
@end
NS_ASSUME_NONNULL_END

View File

@@ -142,42 +142,59 @@
}
- (void)initNIMMicroQueues {
RoomInfoModel* roomInfo = self.hostDelegate.getRoomInfo;
// self.micQueue
[[NIMSDK sharedSDK].chatroomManager fetchChatroomInfo:[NSString stringWithFormat:@"%ld", (long)roomInfo.roomId] completion:^(NSError * _Nullable error, NIMChatroom * _Nullable chatroom) {
if (error) {
return;
}
NSDictionary *info = (NSDictionary *)[chatroom.ext toJSONObject];
NSDictionary *micState = [info[@"micQueue"] toJSONObject];
for (NSString *position in micState.allKeys) {
MicroStateModel *state = [MicroStateModel modelWithJSON:micState[position]];
MicroQueueModel *sequence = [self.micQueue objectForKey:position];
sequence.microState = state;
}
[self microQueueUpdated: NO];
}];
RoomInfoModel* roomInfo = self.hostDelegate.getRoomInfo;
// self.micQueue
[[NIMSDK sharedSDK].chatroomManager fetchChatroomInfo:[NSString stringWithFormat:@"%ld", (long)roomInfo.roomId] completion:^(NSError * _Nullable error, NIMChatroom * _Nullable chatroom) {
if (error) {
return;
}
NSDictionary *info = (NSDictionary *)[chatroom.ext toJSONObject];
NSDictionary *micState = [info[@"micQueue"] toJSONObject];
for (NSString *position in micState.allKeys) {
MicroStateModel *state = [MicroStateModel modelWithJSON:micState[position]];
MicroQueueModel *sequence = [self.micQueue objectForKey:position];
sequence.microState = state;
}
[self microQueueUpdated: NO];
}];
self.hadGetQueueInfoSuccess = NO;
// self.micQueue
[[NIMSDK sharedSDK].chatroomManager fetchChatroomQueue:[NSString stringWithFormat:@"%ld", (long)roomInfo.roomId] completion:^(NSError * _Nullable error, NSArray<NSDictionary<NSString *,NSString *> *> * _Nullable info) {
if (error) return;
BOOL ownerRTCChange = NO;
for (NSDictionary *item in info) {
UserInfoModel *userInfo = [UserInfoModel modelWithJSON:item.allValues.firstObject];
NSString *position = item.allKeys.firstObject;
MicroQueueModel *sequence = [self.micQueue objectForKey:position];
sequence.userInfo = userInfo;
if (userInfo.uid == [AccountInfoStorage instance].getUid.integerValue) {
ownerRTCChange = YES;
}
}
[self microQueueUpdated:ownerRTCChange];
[self.hostDelegate onMicroQueueUpdate:self.micQueue];
// self.micQueue
[[NIMSDK sharedSDK].chatroomManager fetchChatroomQueue:[NSString stringWithFormat:@"%ld", (long)roomInfo.roomId] completion:^(NSError * _Nullable error, NSArray<NSDictionary<NSString *,NSString *> *> * _Nullable info) {
if (error) return;
BOOL ownerRTCChange = NO;
MicroQueueModel *meQuence = nil;
for (NSDictionary *item in info) {
UserInfoModel *userInfo = [UserInfoModel modelWithJSON:item.allValues.firstObject];
NSString *position = item.allKeys.firstObject;
MicroQueueModel *sequence = [self.micQueue objectForKey:position];
sequence.userInfo = userInfo;
if (userInfo.uid == [AccountInfoStorage instance].getUid.integerValue) {
ownerRTCChange = YES;
meQuence = sequence;
}
}
[self microQueueUpdated:ownerRTCChange];
[self.hostDelegate onMicroQueueUpdate:self.micQueue];
self.hadGetQueueInfoSuccess = YES;
}];
//
[self initGiftValue];
if(meQuence != nil){
[self enterRoomUpMicWith:meQuence];
}
}];
//
[self initGiftValue];
}
///
-(void)enterRoomUpMicWith:(MicroQueueModel *)sequence{
RoomInfoModel * roomInfo =self.hostDelegate.getRoomInfo;
NSString * roomId = [NSString stringWithFormat:@"%ld", roomInfo.uid];
NIMChatroomQueueUpdateRequest *request = [[NIMChatroomQueueUpdateRequest alloc]init];
request.key = @(sequence.microState.position).stringValue;
request.value = [sequence.userInfo toJSONString];
request.roomId = roomId;
request.transient = YES;
[[NIMSDK sharedSDK].chatroomManager updateChatroomQueueObject:request completion:^(NSError * _Nullable error) {
}];
}
- (void)initGiftValue{
@@ -467,10 +484,36 @@
[RtcManager instance].localMuted = YES;
}
}
if(userInfo.isNoProhibitMic == YES){
for (int i = 0; i < self.countOfMircoView; i++) {
UIView<MicroViewProtocol> * view = [self findMicroViewByIndex:i];
[view configPkBtn:userInfo];
}
}
microQueueChanged = YES;
}
break;
case NIMChatroomEventTypeEnter:
{
///
RoomInfoModel * roomInfo =self.hostDelegate.getRoomInfo;
NSString * roomId = [NSString stringWithFormat:@"%ld", roomInfo.uid];
BOOL isInMic = NO;
for (MicroQueueModel *sequence in self.micQueue.allValues) {
if ([AccountInfoStorage instance].getUid.integerValue == sequence.userInfo.uid) {
isInMic = YES;
NIMChatroomQueueUpdateRequest *request = [[NIMChatroomQueueUpdateRequest alloc]init];
request.key = @(sequence.microState.position).stringValue;
request.value = [sequence.userInfo toJSONString];
request.roomId = roomId;
request.transient = YES;
[[NIMSDK sharedSDK].chatroomManager updateChatroomQueueObject:request completion:^(NSError * _Nullable error) {
}];
}
}
}
break;
case NIMChatroomEventTypeExit:
case NIMChatroomEventTypeKicked:
{
@@ -497,7 +540,23 @@
[self.hostDelegate onMicroQueueUpdate:self.micQueue];
}
}
///退
-(void)exitRoom{
RoomInfoModel * roomInfo =self.hostDelegate.getRoomInfo;
NSString * roomId = [NSString stringWithFormat:@"%ld", roomInfo.uid];
for (MicroQueueModel *sequence in self.micQueue.allValues) {
if ([AccountInfoStorage instance].getUid.integerValue == sequence.userInfo.uid) {
NIMChatroomQueueRemoveRequest *request = [[NIMChatroomQueueRemoveRequest alloc]init];
request.key = @(sequence.microState.position).stringValue;
request.roomId = roomId;
[[NIMSDK sharedSDK].chatroomManager removeChatroomQueueObject:request completion:^(NSError * _Nullable error, NSDictionary<NSString *,NSString *> * _Nullable element) {
}];
}
}
}
- (void)handleNIMCustomMessage:(NIMMessage *)message {
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {

View File

@@ -449,10 +449,33 @@
request.notifyExt = [@{@"reason":@"kick",@"account":targetUid,@"handleUid":uid} toJSONString];
}
[[NIMSDK sharedSDK].chatroomManager kickMember:request completion:^(NSError * _Nullable error) {
if(error == nil){
[self kickUserFinishWithUid:targetUid roomUid:roomId];
}
[[self getView] makeKickUserFinish:error];
}];
}
///idbug
-(void)kickUserFinishWithUid:(NSString *)uid roomUid:(NSString *)roomUid{
NSDate* date = [NSDate dateWithTimeIntervalSinceNow:0];//0
NSTimeInterval time = [date timeIntervalSince1970];
NSString *currentTime = [NSString stringWithFormat:@"%.0f", time];
NSString *key = [NSString stringWithFormat:@"kManageKickedOutRoom_%@_%@", uid, roomUid];
NSMutableDictionary *kickedList = [[NSUserDefaults standardUserDefaults]valueForKey:@"kManageKickedOutRoomList"];
if([kickedList isKindOfClass:[NSString class]]){
kickedList = nil;
}
if(kickedList == nil){
kickedList = [NSMutableDictionary dictionary];
}else{
kickedList = [[NSMutableDictionary alloc]initWithDictionary:kickedList];
}
[kickedList setValue:currentTime forKey:key];
[[NSUserDefaults standardUserDefaults] setObject:kickedList forKey:@"kManageKickedOutRoomList"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
///
/// @param targetNick
/// @param cardInfo

View File

@@ -950,10 +950,17 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
}
///
- (BOOL)isKictOutLatest:(RoomInfoModel *)roomInfo {
NSString *currentUid = [AccountInfoStorage instance].getUid;
NSString *key = [NSString stringWithFormat:@"%@_%ld", currentUid, roomInfo.uid];
NSString *kictOutTime = [[NSUserDefaults standardUserDefaults] objectForKey:key];
- (BOOL)isKictOutLatest:(NSString *)key mainKey:(NSString *)mainKey{
NSMutableDictionary *kickedList = [[NSUserDefaults standardUserDefaults]valueForKey:mainKey];
if([kickedList isKindOfClass:[NSString class]]){
kickedList = nil;
}
if(kickedList == nil){
kickedList = [NSMutableDictionary dictionary];
}else{
kickedList = [[NSMutableDictionary alloc]initWithDictionary:kickedList];
}
NSString *kictOutTime = [kickedList valueForKey:key];
if (kictOutTime) {
NSDate* date = [NSDate dateWithTimeIntervalSinceNow:0];
NSTimeInterval time = [date timeIntervalSince1970];
@@ -964,8 +971,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[[NSUserDefaults standardUserDefaults] synchronize];
return NO;
} else {
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPRoomViewController0")];
[self dismissViewControllerAnimated:YES completion:nil];
return YES;
}
} else {
@@ -1015,7 +1020,11 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
//5
if ([self isKictOutLatest:roomInfo]) {
NSString *currentUid = [AccountInfoStorage instance].getUid;
NSString *key = [NSString stringWithFormat:@"kKickedOutRoom_%@_%ld", currentUid, roomInfo.uid];
if ([self isKictOutLatest:key mainKey:@"kKickedOutRoomList"] == YES) {
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPRoomViewController0")];
[self dismissViewControllerAnimated:YES completion:nil];
return;
}
if (roomInfo.type == RoomType_Anchor) {//
@@ -1386,10 +1395,27 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self showErrorToast:YMLocalizedString(@"XPRoomViewController8")];
///
NSDate* date = [NSDate dateWithTimeIntervalSinceNow:0];//0
NSTimeInterval time=[date timeIntervalSince1970];
NSTimeInterval time = [date timeIntervalSince1970];
NSString *currentTime = [NSString stringWithFormat:@"%.0f", time];
NSString *key = [NSString stringWithFormat:@"%@_%ld", [AccountInfoStorage instance].getUid, self.roomInfo.uid];
[[NSUserDefaults standardUserDefaults] setObject:currentTime forKey:key];
NSString *key = [NSString stringWithFormat:@"kKickedOutRoom_%@_%ld", [AccountInfoStorage instance].getUid, self.roomInfo.uid];
NSMutableDictionary *kickedList = [[NSUserDefaults standardUserDefaults]valueForKey:@"kKickedOutRoomList"];
if([kickedList isKindOfClass:[NSString class]]){
kickedList = nil;
}
if(kickedList == nil){
kickedList = [NSMutableDictionary dictionary];
}else{
kickedList = [[NSMutableDictionary alloc]initWithDictionary:kickedList];
}
NSMutableDictionary *copyList = [[NSMutableDictionary alloc]initWithDictionary:kickedList];
for (NSString *timeKey in copyList.allKeys) {
if([self isKictOutLatest:timeKey mainKey:@"kKickedOutRoomList"] == NO){
[kickedList removeObjectForKey:timeKey];
}
}
[kickedList setValue:currentTime forKey:key];
[[NSUserDefaults standardUserDefaults] setObject:kickedList forKey:@"kKickedOutRoomList"];
[[NSUserDefaults standardUserDefaults] synchronize];
} else if (result.reason == 5) {
[self showErrorToast:YMLocalizedString(@"XPRoomViewController9")];
@@ -1521,6 +1547,23 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
}
break;
case NIMChatroomEventTypeEnter:
{
NSString *currentUid = content.source.userId;
NSString *key = [NSString stringWithFormat:@"kManageKickedOutRoom_%@_%ld", currentUid, self.roomInfo.roomId];
if ([self isKictOutLatest:key mainKey:@"kManageKickedOutRoomList"] == YES) {
NSString * uid = [[AccountInfoStorage instance] getUid];
NIMChatroomMemberKickRequest *request = [[NIMChatroomMemberKickRequest alloc] init];
request.roomId = [NSString stringWithFormat:@"%ld",self.roomInfo.uid];
request.userId = currentUid;
if(currentUid != nil && uid != nil){
request.notifyExt = [@{@"reason":@"kick",@"account":currentUid,@"handleUid":uid} toJSONString];
}
[[NIMSDK sharedSDK].chatroomManager kickMember:request completion:^(NSError * _Nullable error) {
NSLog(@"%@",error);
}];
}
if (content.source.userId.integerValue != [AccountInfoStorage instance].getUid.integerValue && self.userInfo.platformRole != 1) {
onLineNumber += 1;
}else {///
@@ -1530,7 +1573,9 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self.menuContainerView onRoomUpdate];
}
break;
}
case NIMChatroomEventTypeAddBlack:
case NIMChatroomEventTypeKicked:
case NIMChatroomEventTypeExit:
@@ -1796,6 +1841,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
}
- (void)exitRoom {
[self.stageView exitRoom];
[self.menuContainerView menuResignFirstResponder];
[self.animationView resumeTimer];
if (self.roomInfo.roomModeType == RoomModeType_Open_Micro_Mode || self.roomInfo.roomModeType == RoomModeType_Open_Blind) {