-- 优化 iOS 端页面效果(个人页/聊天气泡)

-- 优化 iOS 端部分 API 多次调用逻辑和错误处理
-- 修正相亲房玩法入口问题
This commit is contained in:
eggmanQQQ
2024-08-01 19:59:50 +08:00
parent ba06b327a5
commit ca5137dff9
25 changed files with 401 additions and 305 deletions

View File

@@ -15,16 +15,13 @@
#import "XPMessageRemoteExtModel.h"
#import "MessageContentChatHallHeadView.h"
#import "MSSessionPublicChatHalRightTextCell.h"
#import "XPNetImageYYLabel.h"
@interface MSSessionPublicChatHalRightTextCell()
/**
*/
@property (nonatomic, strong) YYLabel * messageText;
@property (nonatomic, strong) XPNetImageYYLabel * messageText;
@property(nonatomic,strong) UIImageView *bgImage;
@@ -57,6 +54,16 @@
self.bubbleImageView.image = [self resizableImage:image1];
}];
}
self.messageText.attributedText = textModel.textAttribute;
if (isMSRTL()) { // MARK:
[self.messageText mas_remakeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(kGetScaleWidth(55));
make.leading.mas_equalTo(kGetScaleWidth(82));
make.bottom.mas_equalTo(-kGetScaleWidth(10));
make.width.mas_equalTo(self.messageText.textWidth + 20);
}];
}
}
-(void)installUI{
self.contentView.backgroundColor = [UIColor clearColor];
@@ -106,6 +113,9 @@
if(!_bgImage){
_bgImage = [UIImageView new];
_bgImage.image = [self resizableImage:kImage(@"ms_message_headlines_text_right")];
if (isMSRTL()) {
_bgImage.transform = CGAffineTransformMakeScale(-1.0, 1.0);
}
}
return _bgImage;
}
@@ -116,15 +126,15 @@
}
return _bubbleImageView;
}
- (YYLabel *)messageText {
- (XPNetImageYYLabel *)messageText {
if (!_messageText) {
_messageText = [[YYLabel alloc]initWithFrame:CGRectZero];
_messageText = [[XPNetImageYYLabel alloc]initWithFrame:CGRectZero];
_messageText.textColor = DJDKMIMOMColor.mainTextColor;
_messageText.numberOfLines = 0;
_messageText.font = kFontMedium(14);
_messageText.textColor = [UIColor whiteColor];
_messageText.textAlignment = NSTextAlignmentLeft;
_messageText.textAlignment = NSTextAlignmentNatural;
_messageText.userInteractionEnabled = YES;
_messageText.preferredMaxLayoutWidth = kGetScaleWidth(220);
}

View File

@@ -16,11 +16,13 @@
#import "MessageHeadlinesTextModel.h"
#import "XPMessageRemoteExtModel.h"
#import "MessageContentChatHallHeadView.h"
#import "XPNetImageYYLabel.h"
@interface MSSessionPublicChatHalTextCell ()
/**
*/
@property (nonatomic, strong) YYLabel * messageText;
@property (nonatomic, strong) XPNetImageYYLabel * messageText;
@property(nonatomic,strong) UIImageView *bgImage;
///
@property (nonatomic,strong) NetImageView *bubbleImageView;
@@ -54,7 +56,16 @@
self.bubbleImageView.image = [self resizableImage:image1];
}];
}
self.messageText.attributedText = textModel.textAttribute;
if (isMSRTL()) {
[self.messageText mas_remakeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(kGetScaleWidth(55));
make.leading.mas_equalTo(kGetScaleWidth(82));
make.bottom.mas_equalTo(-kGetScaleWidth(10));
make.width.mas_equalTo(self.messageText.textWidth + 20);
}];
}
}
-(void)installUI{
self.contentView.backgroundColor = [UIColor clearColor];
@@ -102,6 +113,9 @@
if(!_bgImage){
_bgImage = [UIImageView new];
_bgImage.image = [self resizableImage:kImage(@"ms_message_headlines_text_left")];
if (isMSRTL()) {
_bgImage.transform = CGAffineTransformMakeScale(-1.0, 1.0);
}
}
return _bgImage;
}
@@ -114,15 +128,15 @@
return _bubbleImageView;
}
- (YYLabel *)messageText {
- (XPNetImageYYLabel *)messageText {
if (!_messageText) {
_messageText = [[YYLabel alloc]initWithFrame:CGRectZero];
_messageText = [[XPNetImageYYLabel alloc]initWithFrame:CGRectZero];
_messageText.textColor = DJDKMIMOMColor.mainTextColor;
_messageText.numberOfLines = 0;
_messageText.font = kFontMedium(14);
_messageText.textColor = [UIColor whiteColor];
_messageText.textAlignment = NSTextAlignmentLeft;
_messageText.textAlignment = NSTextAlignmentNatural;
_messageText.userInteractionEnabled = YES;
_messageText.preferredMaxLayoutWidth = kGetScaleWidth(220);
}

View File

@@ -37,7 +37,7 @@
[Api userDetailInfoCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
UserInfoModel * infoModel = [UserInfoModel modelWithDictionary:data.data];
[[self getView] ongetDetailInfoSuccess:infoModel];
[[self getView] onGetDetailInfoSuccess:infoModel];
}] uid:uid page:@"1" pageSize:@"20"];
}

View File

@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
///获取用户信息成功
- (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo;
///获取用户详细信息成功
- (void)ongetDetailInfoSuccess:(UserInfoModel *)userInfo;
- (void)onGetDetailInfoSuccess:(UserInfoModel *)userInfo;
///关注/取消关注
- (void)attentionUserSuccess:(BOOL)status;
///获取关注状态

View File

@@ -131,6 +131,7 @@
[self.contentView addSubview:self.orderButton];
[self.orderButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.bgImageView);
make.trailing.mas_equalTo(-12);
make.width.mas_greaterThanOrEqualTo(72.5);
make.height.mas_equalTo(27);

View File

@@ -34,11 +34,10 @@
- (void)setModel:(XPMineGameOrderRecoredModel *)model {
_model = model;
self.gameNameLabel.text = model.gameName.length > 0 ? model.gameName : @"Moli Star";
self.gameNameLabel.text = model.gameName.length > 0 ? model.gameName : @" ";
self.timeLabel.text = model.orderTime;
self.orderIDLabel.text = model.orderNo;
self.gamePriceLabel.text = @(self.model.amount).stringValue;
// [self updatePriceContent];
}
- (void)setType:(NSInteger)type {

View File

@@ -74,8 +74,7 @@ typedef enum : NSUInteger {
textColor:UIColorFromRGB(0x191919)];
[self addSubview:_titleLabel];
[_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self);
make.leading.mas_equalTo(self).offset(0);
make.leading.centerY.mas_equalTo(self);
}];
_numLabel = [UILabel labelInitWithText:@""

View File

@@ -102,6 +102,8 @@ XPMineCustomNavViewDelegate, XPMineUserInfoProtocol, XPMineUserInfoHeaderViewDel
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
[self initHttpRequest];
}
-(void)viewDidDisappear:(BOOL)animated{
@@ -111,9 +113,9 @@ XPMineCustomNavViewDelegate, XPMineUserInfoProtocol, XPMineUserInfoHeaderViewDel
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
if (self.uid > 0) {
[self initHttpRequest];
}
[self.presenter getUserInfoWithUid:@(self.uid).stringValue];
if([XPSkillCardPlayerManager shareInstance].isInRoom == YES && [XPSkillCardPlayerManager shareInstance].isInRoomFirstRecharge == NO){
[XPSkillCardPlayerManager shareInstance].isInRoomFirstRecharge = YES;
}
@@ -160,12 +162,9 @@ XPMineCustomNavViewDelegate, XPMineUserInfoProtocol, XPMineUserInfoHeaderViewDel
- (void)initHttpRequest {
NSString *uid = [NSString stringWithFormat:@"%ld", self.uid];
[self.presenter getUserInfoWithUid:uid];
// [self.presenter getUserInfoWithUid:uid];
[self.presenter getUserAttentionState:uid];
// 使
[self.presenter getUserDetailInfoWithUid:uid];
///访
if (![uid isEqualToString:[[AccountInfoStorage instance] getUid]]) {
[self.presenter visitUser:uid];
@@ -182,8 +181,8 @@ XPMineCustomNavViewDelegate, XPMineUserInfoProtocol, XPMineUserInfoHeaderViewDel
NSString *uid = [NSString stringWithFormat:@"%ld",self.uid];
TTActionSheetConfig *report = [TTActionSheetConfig normalTitle:YMLocalizedString(@"XPMineUserInfoViewController0") clickAction:^{
XPWebViewController *vc = [[XPWebViewController alloc]init];
NSString *urlstr = [NSString stringWithFormat:@"%@?reportUid=%@&source=PERSONAL",URLWithType(kReportRoomURL),uid];
vc.url = urlstr;
NSString *urlStr = [NSString stringWithFormat:@"%@?reportUid=%@&source=PERSONAL",URLWithType(kReportRoomURL),uid];
vc.url = urlStr;
[self.navigationController pushViewController:vc animated:YES];
}];
@@ -216,8 +215,10 @@ XPMineCustomNavViewDelegate, XPMineUserInfoProtocol, XPMineUserInfoHeaderViewDel
TTAlertConfig *config = [[TTAlertConfig alloc] init];
config.title = title;
config.message = message;
@kWeakify(self);
[TTPopup alertWithConfig:config confirmHandler:^{
@kStrongify(self);
if (isRemove) {
[[NIMSDK sharedSDK].userManager removeFromBlackBlackList:uid completion:^(NSError * _Nullable error) {
if (error == nil) {
@@ -274,16 +275,11 @@ XPMineCustomNavViewDelegate, XPMineUserInfoProtocol, XPMineUserInfoHeaderViewDel
}
- (id<JXPagerViewListViewDelegate>)pagerView:(JXPagerView *)pagerView initListAtIndex:(NSInteger)index {
if(isMSRTL()){
if (index == 1) {
return self.userDataVC;
}
return self.userMomentVC;
}
if (index == 0) {
return self.userDataVC;
return isMSRTL() ? self.userMomentVC : self.userDataVC;
} else {
return isMSRTL() ? self.userDataVC : self.userMomentVC;
}
return self.userMomentVC;
}
#pragma mark - JXPagerMainTableViewGestureDelegate
@@ -352,19 +348,16 @@ XPMineCustomNavViewDelegate, XPMineUserInfoProtocol, XPMineUserInfoHeaderViewDel
self.editVC.tagModel = tagModel;
self.headView.tagModel = tagModel;
self.userDataVC.userInfo = userInfo;
if(isMSRTL()){
[self.titleView selectItemAtIndex:0];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.titleView selectItemAtIndex:0];
});
}
self.headerHeight = [XPMineUserInfoHeaderView headerHeight:userInfo];
[self.pagingView reloadData];
// 使
[self.presenter getUserDetailInfoWithUid:@(self.uid).stringValue];
}
- (void)ongetDetailInfoSuccess:(UserInfoModel *)userInfo {
- (void)onGetDetailInfoSuccess:(UserInfoModel *)userInfo {
self.userDataVC.giftWall = userInfo.userGiftWall;
self.userDataVC.luckyGiftWall = userInfo.userLuckyBagGiftWall;
self.userDataVC.dynamicInfo = userInfo.dynamicInfo;
@@ -374,12 +367,10 @@ XPMineCustomNavViewDelegate, XPMineUserInfoProtocol, XPMineUserInfoHeaderViewDel
self.giftVC.userInfo = userInfo;
if(isMSRTL()){
[self.titleView selectItemAtIndex:1];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.titleView selectItemAtIndex:0];
});
}
[self.pagingView reloadData];
}
- (void)getAttentionStateSuccess:(BOOL)status {
@@ -426,12 +417,10 @@ XPMineCustomNavViewDelegate, XPMineUserInfoProtocol, XPMineUserInfoHeaderViewDel
NSString * uidStr = [NSString stringWithFormat:@"%ld", uid];
self.userDataVC.userUid = uidStr;
self.giftVC.userUid = uidStr;
[self.presenter getUserInfoWithUid:uidStr];
self.editVC.uid = uidStr;
}
}
- (XPMineUserInfoHeaderView *)headView {
if (!_headView) {
_headView = [[XPMineUserInfoHeaderView alloc] init];
@@ -507,12 +496,11 @@ XPMineCustomNavViewDelegate, XPMineUserInfoProtocol, XPMineUserInfoHeaderViewDel
_titleView.titleSelectedFont = [UIFont systemFontOfSize:20 weight:UIFontWeightBold];
_titleView.titleLabelAnchorPointStyle = JXCategoryTitleLabelAnchorPointStyleCenter;
_titleView.contentScrollViewClickTransitionAnimationEnabled = NO;
_titleView.defaultSelectedIndex = 0;
_titleView.defaultSelectedIndex = isMSRTL() ? 1 : 0;
_titleView.averageCellSpacingEnabled = NO;
_titleView.contentEdgeInsetLeft = 15;
_titleView.titles = self.titles;
_titleView.cellSpacing = 20;
_titleView.titles = self.titles;
_titleView.listContainer = (id<JXCategoryViewListContainer>)self.pagingView.listContainerView;
JXCategoryIndicatorImageView *lineView = [[JXCategoryIndicatorImageView alloc] init];

View File

@@ -0,0 +1,18 @@
//
// XPBeautIDView.h
// YuMi
//
// Created by P on 2024/8/1.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPBeautIDView : UIView
@property (nonatomic, copy) NSString *num;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,92 @@
//
// XPBeautIDView.m
// YuMi
//
// Created by P on 2024/8/1.
//
#import "XPBeautIDView.h"
@interface XPBeautIDView ()
@property (nonatomic, strong) UIImageView *frameImageView;
@property (nonatomic, strong) UILabel *numLabel;
@property (nonatomic, strong) UIImageView *copiedImageView;
@end
@implementation XPBeautIDView
- (instancetype)init
{
self = [super init];
if (self) {
[self addSubview:self.frameImageView];
[self addSubview:self.numLabel];
[self addSubview:self.copiedImageView];
[self.frameImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.leading.bottom.mas_equalTo(self);
make.trailing.mas_equalTo(self).offset(-18);
}];
[self.numLabel mas_makeConstraints:^(MASConstraintMaker *make) {
if (isMSRTL()) {
make.leading.mas_equalTo(self).offset(10);
make.trailing.mas_equalTo(self).offset(-46);
} else {
make.leading.mas_equalTo(self).offset(28);
make.trailing.mas_equalTo(self).offset(-26);
}
make.centerY.mas_equalTo(self);
}];
[self.copiedImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.trailing.centerY.mas_equalTo(self);
make.size.mas_equalTo(CGSizeMake(14, 14));
}];
}
return self;
}
- (void)setNum:(NSString *)num {
_num = num;
self.numLabel.text = num;
UIImage *longBackgroundImage = [UIImage imageNamed:@"user_info_id_beatiful_mark_short"];
UIEdgeInsets capInsets = UIEdgeInsetsMake(0, 20, 0, 14);
UIImage *resizableImage = [longBackgroundImage resizableImageWithCapInsets:capInsets resizingMode:UIImageResizingModeStretch];
self.frameImageView.image = resizableImage;
}
- (UIImageView *)frameImageView {
if (!_frameImageView) {
_frameImageView = [[UIImageView alloc] init];
_frameImageView.image = [UIImage imageNamed:@"user_info_id_beatiful_mark_short"];
}
return _frameImageView;
}
- (UIImageView *)copiedImageView {
if (!_copiedImageView) {
_copiedImageView = [[UIImageView alloc] init];
_copiedImageView.contentMode = UIViewContentModeScaleAspectFit;
_copiedImageView.image = [UIImage getLanguageImage:@"user_card_copy_id1"];
}
return _copiedImageView;
}
- (UILabel *)numLabel {
if (!_numLabel) {
_numLabel = [[UILabel alloc] init];
_numLabel.font = [UIFont systemFontOfSize:11 weight:UIFontWeightMedium];
_numLabel.textAlignment = NSTextAlignmentCenter;
_numLabel.textColor = [UIColor whiteColor];
_numLabel.userInteractionEnabled = YES;
_numLabel.clipsToBounds = NO;
}
return _numLabel;
}
@end

View File

@@ -22,6 +22,7 @@
#import "SpriteSheetImageManager.h"
///view
#import "XPMineUserInfoHeaderTagView.h"
#import "XPBeautIDView.h"
///Model
#import "UserInfoModel.h"
@@ -66,18 +67,18 @@ return view;\
//@property (nonatomic,strong) UIImageView *onlineView;
///icon
@property (nonatomic,strong) SVGAImageView *onlineIconView;
/////tilte
///tilte
//@property (nonatomic,strong) UILabel *onlineTitleView;
///
@property (nonatomic,strong) UIButton *onlineButton;
///
@property (nonatomic,strong) UIStackView *idStackView;
///
@property (nonatomic,strong) UIImageView *beautifulImageView;
///id
@property (nonatomic,strong) UILabel *idLabel;
@property (nonatomic, strong) UIImageView *idIconImageView;
@property (nonatomic, strong) UIImageView *copyIdImageView;
@property (nonatomic, strong) XPBeautIDView *beautIDView;
@property (nonatomic, strong) UIButton *copyIdButton;
///
@@ -278,6 +279,7 @@ return view;\
- (void)setupIDArea {
[self.userInfoView addSubview:self.idStackView];
[self.userInfoView addSubview:self.beautIDView];
if (isMSRTL()) {
[self.idStackView addArrangedSubview:self.copyIdImageView];
@@ -289,11 +291,14 @@ return view;\
[self.idStackView addArrangedSubview:self.copyIdImageView];
}
// [self.idStackView addSubview:self.idIconImageView];
// [self.idStackView addSubview:self.copyIdImageView];
[self.idStackView insertSubview:self.beautifulImageView belowSubview:self.idLabel];
[self.idStackView addSubview:self.copyIdButton];
[self.beautIDView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.nickStackView.mas_bottom).offset(6);
make.height.mas_equalTo(24);
make.centerX.mas_equalTo(self.userInfoView);
}];
[self.idStackView mas_makeConstraints:^(MASConstraintMaker *make) {
if (isMSRTL()) {
make.centerX.mas_equalTo(self.userInfoView).offset(8);
@@ -303,12 +308,7 @@ return view;\
make.top.mas_equalTo(self.nickStackView.mas_bottom).offset(6);
make.height.mas_equalTo(24);
}];
[self.beautifulImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(23.5);
make.leading.mas_equalTo(self.idLabel).offset(-18);
make.trailing.mas_equalTo(self.idLabel).offset(4);
make.centerY.mas_equalTo(self.idLabel).offset(-0.5);
}];
[self.idIconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(14);
}];
@@ -546,7 +546,6 @@ return view;\
self.officialImageView.hidden = userInfo.defUser != UserLevelType_Offical;
self.newUserImageView.hidden = !userInfo.newUser;
if (userInfo.userLevelVo.experUrl) {
[self.experImageView loadImageWithUrl:userInfo.userLevelVo.experUrl completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
self.experImageView.image = image;
@@ -689,38 +688,13 @@ return view;\
text = [NSString stringWithFormat:@" %ld", (long)self.userInfo.erbanNo];
}
self.beautifulImageView.hidden = !hasBeautifulID;
self.idIconImageView.hidden = hasBeautifulID;
if (hasBeautifulID) {
NSString *offsetSpace = @"";
if (hasBeautifulID) {
if (self.userInfo.erbanNo > 9) {
offsetSpace = @" ";
} else if (self.userInfo.erbanNo > 99) {
offsetSpace = @" ";
} else if (self.userInfo.erbanNo > 999) {
offsetSpace = @" ";
} else if (self.userInfo.erbanNo > 999) {
offsetSpace = @"";
}
}
self.idLabel.text = [NSString stringWithFormat:@"%@%@",offsetSpace,text];
self.idLabel.alpha = 1;
self.idLabel.textColor = [UIColor whiteColor];
UIImage *longBackgroundImage = [UIImage imageNamed:@"user_info_id_beatiful_mark_short"];
UIEdgeInsets capInsets = UIEdgeInsetsMake(0, 20, 0, 4);
UIImage *resizableImage = [longBackgroundImage resizableImageWithCapInsets:capInsets resizingMode:UIImageResizingModeStretch];
self.beautifulImageView.image = resizableImage;
[self.copyIdButton mas_remakeConstraints:^(MASConstraintMaker *make) {
make.top.bottom.trailing.mas_equalTo(self.idStackView);
make.leading.mas_equalTo(self.idStackView).offset(-20);
}];
self.beautIDView.num = text;
self.idStackView.hidden = YES;
} else {
self.beautIDView.hidden = YES;
self.idLabel.text = text;
self.idLabel.alpha = 0.8;
}
@@ -780,9 +754,7 @@ return view;\
self.headWearSvgaImageView.videoItem = videoItem;
[self.headWearSvgaImageView startAnimation];
}
failureBlock:^(NSError * _Nullable error) {
}];
failureBlock:^(NSError * _Nullable error) {}];
}
- (void)playAnimate:(NSString *)headwearUrlString {
@@ -792,9 +764,7 @@ return view;\
[self.manager loadSpriteSheetImageWithURL:url completionBlock:^(YYSpriteSheetImage * _Nullable sprit) {
@kStrongify(self);
self.headWearImageView.image = sprit;
} failureBlock:^(NSError * _Nullable error) {
NSLog(@"%@", error);
}];
} failureBlock:^(NSError * _Nullable error) {}];
}
#pragma mark - Getters
@@ -863,22 +833,12 @@ return view;\
return _idStackView;
}
- (UIImageView *)beautifulImageView {
if (!_beautifulImageView) {
_beautifulImageView = [[UIImageView alloc] init];
_beautifulImageView.userInteractionEnabled = YES;
_beautifulImageView.hidden = YES;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(copyNameAction)];
[_beautifulImageView addGestureRecognizer:tap];
}
return _beautifulImageView;
}
- (UILabel *)idLabel {
if (!_idLabel) {
_idLabel = [[UILabel alloc] init];
_idLabel.font = [UIFont systemFontOfSize:11 weight:UIFontWeightMedium];
_idLabel.textColor = UIColorFromRGB(0x191919);
_idLabel.textAlignment = NSTextAlignmentCenter;
_idLabel.userInteractionEnabled = YES;
_idLabel.clipsToBounds = NO;
}
@@ -907,12 +867,20 @@ return view;\
- (UIButton *)copyIdButton {
if (!_copyIdButton) {
_copyIdButton = [UIButton buttonWithType:UIButtonTypeCustom];
// [_copyIdButton setImage:[UIImage getLanguageImage:@"user_card_copy_id1"] forState:UIControlStateNormal];
[_copyIdButton addTarget:self action:@selector(copyNameAction) forControlEvents:UIControlEventTouchUpInside];
}
return _copyIdButton;
}
- (XPBeautIDView *)beautIDView {
if (!_beautIDView) {
_beautIDView = [[XPBeautIDView alloc] init];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(copyNameAction)];
[_beautIDView addGestureRecognizer:tap];
}
return _beautIDView;
}
- (SVGAImageView *)onlineIconView {
if (_onlineIconView == nil) {
_onlineIconView = [[SVGAImageView alloc]init];
@@ -995,7 +963,7 @@ return view;\
if (!_tagStackView) {
_tagStackView = [[UIStackView alloc] init];
_tagStackView.axis = UILayoutConstraintAxisHorizontal;
_tagStackView.distribution = UIStackViewDistributionFillProportionally;
_tagStackView.distribution = UIStackViewDistributionFill;
_tagStackView.alignment = UIStackViewAlignmentCenter;
_tagStackView.spacing = 6;
}
@@ -1041,7 +1009,7 @@ return view;\
config.imageType = ImageTypeUserCardLevel;
_nameplateImageView = [[NetImageView alloc] initWithConfig:config];
_nameplateImageView.userInteractionEnabled = YES;
_nameplateImageView.contentMode = UIViewContentModeScaleAspectFill;
_nameplateImageView.contentMode = UIViewContentModeScaleAspectFit;
}
return _nameplateImageView;
}

View File

@@ -62,11 +62,11 @@
} showLoading:YES errorToast:NO] uid:uid];
[Api getRoomInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
RoomInfoModel * model = [RoomInfoModel modelWithJSON:data.data];
RoomInfoModel *model = [RoomInfoModel modelWithJSON:data.data];
[room sendNext:model];
[room sendCompleted];
} fail:^(NSInteger code, NSString * _Nullable msg) {
[user sendError:nil];
[room sendError:nil];
if (msg.length > 0) {
TTAlertConfig *config = [[TTAlertConfig alloc]init];
config.message = msg;
@@ -107,7 +107,8 @@
extModel.gender = userInfo.gender;
extModel.fromSayHelloChannel = userInfo.fromSayHelloChannel;
extModel.platformRole = userInfo.platformRole;
NSMutableDictionary *ext = [NSMutableDictionary dictionaryWithObject:extModel.model2dictionary forKey:[NSString stringWithFormat:@"%ld", userInfo.uid]];
request.roomExt = [ext toJSONString];
@kWeakify(self);
@@ -127,7 +128,7 @@
publicChatRoomRequest.roomExt = [publicChatRoomExt toJSONString];
[[NIMSDK sharedSDK].chatroomManager enterChatroom:publicChatRoomRequest completion:^(NSError * _Nullable error, NIMChatroom * _Nullable chatroom, NIMChatroomMember * _Nullable me) {
NSLog(@"111");
// NSLog(@"111");
}];
}
@@ -195,10 +196,8 @@
delayDuration = 0.25;
}
@kWeakify(self);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayDuration * NSEC_PER_SEC)), dispatch_get_global_queue(0, 0), ^{
[Api requestNormalGiftList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
if (data.data) {
[[XPGiftStorage shareStorage] cacheWith:data.data inRoom:roomUid];
}

View File

@@ -24,9 +24,9 @@ NS_ASSUME_NONNULL_BEGIN
///获取超管成功
- (void)getRoomSuperAdminSuccess:(NSArray *)list;
///获取下一个个播房成功
- (void)getNextAnchorRoomSuccess:(RoomInfoModel *)roomInfo;
- (void)getNextAnchorRoomSuccess:(RoomInfoModel * _Nullable)roomInfo;
///获取当前房间的信息
- (void)getCurrentRoomInfoSuccess:(RoomInfoModel *_Nullable)roomInfo;
- (void)getCurrentRoomInfoSuccess:(RoomInfoModel * _Nullable)roomInfo;
///获取红包成功
- (void)getRedPacketSuccess:(NSArray *)list;
///获取红包成功

View File

@@ -157,7 +157,6 @@
rect.origin.y = 0;
halfMessageView.frame = rect;
}];
}
break;
case XPRoomMenuItemType_More: {
@@ -284,13 +283,8 @@
[self.scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self).offset(16);
make.height.mas_equalTo(29);
if (isMSRTL()) {
make.leading.mas_equalTo(self.inputButton.mas_trailing).offset(11);
make.trailing.mas_equalTo(self.giftButton.mas_leading).offset(-15);
} else {
make.leading.mas_equalTo(self.inputButton.mas_trailing).offset(15);
make.trailing.mas_equalTo(self.giftButton.mas_leading).offset(-11);
}
make.leading.mas_equalTo(self.inputButton.mas_trailing).offset(15);
make.trailing.mas_equalTo(self.giftButton.mas_leading).offset(-11);
}];
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -415,7 +409,7 @@
self.pkButton.hidden = YES;
if ([AccountInfoStorage instance].getUid.integerValue == roomInfo.uid) {
self.baiShunGameButton.hidden = NO;
self.pkButton.hidden = NO;
self.pkButton.hidden = roomInfo.type != RoomType_Anchor;
} else {
for (GuildSuperAdminInfoModel *managerInfo in self.delegate.getRoomSuperAdminList) {
if ([managerInfo.uid isEqualToString:[AccountInfoStorage instance].getUid]) {

View File

@@ -62,7 +62,6 @@
make.top.leading.mas_equalTo(kGetScaleWidth(0));
make.width.mas_equalTo(150);
make.height.mas_equalTo(kGetScaleWidth(30));
}];
[self.pi_containerView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -100,7 +99,6 @@
}else{
self.chatHallView.topModel = topModel;
self.roomView.topModel = topModel;
}
}
}
@@ -112,13 +110,10 @@
return;
}
[self.chatHallView handleNIMCustomMessage:message];
}
- (void)handleNIMNotificationMessage:(NIMMessage *)message {
UserInfoModel *infoModel = self.hostDelegate.getUserInfo;
NSString *publicChatRoomId = [NSString stringWithFormat:@"%@",[ClientConfig shareConfig].configInfo.publicChatRoomIdMap[infoModel.partitionId]];
if(![message.session.sessionId isEqualToString:publicChatRoomId]){

View File

@@ -94,7 +94,6 @@
}
}
switch (messageType) {
case NIMMessageTypeText:
{

View File

@@ -16,6 +16,9 @@ NS_ASSUME_NONNULL_BEGIN
*/
@interface XPNetImageYYLabel : YYLabel
@property (nonatomic, assign) CGFloat textWidth;
@property (nonatomic, assign) CGFloat maxWidth;
@end
NS_ASSUME_NONNULL_END

View File

@@ -15,26 +15,43 @@
- (void)setAttributedText:(NSAttributedString *)attributedText {
NSMutableAttributedString* attributedTextCopy = [attributedText mutableCopy];
CGSize maxSize = CGSizeMake(kRoomMessageMaxWidth - 24, MAXFLOAT);
YYTextLayout * layout = [YYTextLayout layoutWithContainerSize:maxSize text:attributedText];
for (int i = 0; i< layout.attachments.count; i++) {
YYTextAttachment * attachment = [layout.attachments xpSafeObjectAtIndex:i];
if (!attachment || ![attachment.content isKindOfClass:[NetImageView class]]) continue;
NetImageView* imageView = attachment.content;
NSValue * value = [layout.attachmentRanges xpSafeObjectAtIndex:i];
NSRange range = value.rangeValue;
if (!imageView.imageUrl) continue;
if (imageView.state == NetImageStateLoaded) {
attributedTextCopy = [self updateNetImageAttribute:imageView attributes:attributedTextCopy range:range];
continue;
}else {
[imageView loadImage:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
imageView.image = image;
[super setAttributedText:[self updateNetImageAttribute:imageView attributes:attributedTextCopy range:range]];
}];
}
}
self.maxWidth = maxSize.width - 8;
CGSize size = [attributedText boundingRectWithSize:maxSize
options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin
context:nil].size;
YYTextContainer *container = [YYTextContainer containerWithSize:CGSizeMake(size.width, MAXFLOAT)];
container.truncationType = YYTextTruncationTypeEnd;
// YYTextLayout * layout = [YYTextLayout layoutWithContainerSize:maxSize text:attributedText];
YYTextLayout * layout = [YYTextLayout layoutWithContainer:container text:attributedText];
for (YYTextAttachment *attachment in layout.attachments) {
if (!attachment || ![attachment.content isKindOfClass:[NetImageView class]]) continue;
NSInteger index = [layout.attachments indexOfObject:attachment];
NetImageView* imageView = attachment.content;
if (!imageView.imageUrl) continue;
NSValue * value = [layout.attachmentRanges xpSafeObjectAtIndex:index];
NSRange range = value.rangeValue;
if (imageView.state == NetImageStateLoaded) {
attributedTextCopy = [self updateNetImageAttribute:imageView attributes:attributedTextCopy range:range];
continue;
}else {
@kWeakify(self);
[imageView loadImage:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
@kStrongify(self);
imageView.image = image;
[super setAttributedText:[self updateNetImageAttribute:imageView attributes:attributedTextCopy range:range]];
}];
}
}
self.textWidth = layout.textBoundingRect.size.width;
[super setAttributedText:attributedTextCopy];
}

View File

@@ -63,6 +63,7 @@
make.leading.mas_equalTo(12);
make.bottom.mas_equalTo(-20);
make.top.mas_equalTo(10);
make.width.mas_equalTo(20);
}];
}
@@ -99,6 +100,8 @@
_messageInfo = messageInfo;
if (_messageInfo) {
self.contentLabel.attributedText = _messageInfo.content;
if (_messageInfo.bubbleImageUrl.length) {
@kWeakify(self);
[self.bubbleImageView loadImageWithUrl:_messageInfo.bubbleImageUrl completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
@@ -106,19 +109,34 @@
UIImage *image1 = [UIImage imageWithCGImage:image.CGImage scale:2.0 orientation:UIImageOrientationUp];
self.bubbleImageView.image = [self resizableImage:image1];
}];
[self.contentLabel mas_updateConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self.bubbleImageView).offset(self.messageInfo.contentLeftMargin);
make.top.mas_equalTo(self.bubbleImageView).offset(self.messageInfo.contentTopMargin);
make.bottom.mas_equalTo(self.bubbleImageView).offset(-self.messageInfo.contentBottomMargin);
if (isMSRTL()) { // MARK: 使 layout
make.width.mas_equalTo([self RTLLabelWidth]);
}
}];
} else {
_bubbleImageView.image = [UIImage imageWithColor:[DJDKMIMOMColor messageBubbleColor]];
}
[self.contentLabel mas_updateConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self.bubbleImageView).offset(_messageInfo.contentLeftMargin);
make.top.mas_equalTo(self.bubbleImageView).offset(_messageInfo.contentTopMargin);
make.bottom.mas_equalTo(self.bubbleImageView).offset(-_messageInfo.contentBottomMargin);
}];
[self.contentLabel mas_updateConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(12);
make.bottom.mas_equalTo(-20);
make.top.mas_equalTo(10);
// MARK: 使 layout
make.width.mas_equalTo([self RTLLabelWidth]);
}];
}
_bubbleImageView.hidden = _messageInfo.isHiddenBubble;
}
}
- (CGFloat)RTLLabelWidth {
return MIN(self.contentLabel.textWidth + self.messageInfo.contentLeftMargin + self.messageInfo.contentRightMargin + 4, self.contentLabel.maxWidth);
}
- (UIImage *)scaleToSize:(UIImage *)img {
// bitmapcontext
// 使context

View File

@@ -357,10 +357,8 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
}
//
NSMutableArray *indexPaths = [NSMutableArray array];
for (NIMMessage *item in self.incomingMessages) {
[self.datasource addObject:[self.messageParser parseMessageAttribute:item]];
[indexPaths addObject:[NSIndexPath indexPathForRow:self.datasource.count - 1 inSection:0]];
}
[self.incomingMessages removeAllObjects];
[self.messageTableView reloadData];
@@ -378,7 +376,6 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
self.atTipBtn.hidden = YES;
[self.locationArray removeAllObjects];
}
}
///
@@ -597,7 +594,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
}
///
- (void)createUserEnterRoomAddRoomtopicMessage {
- (void)createUserEnterRoomAddRoomTopicMessage {
if ([ClientConfig shareConfig].configInfo.appStoreAuditNoticeVersion == YES) {
return;
}
@@ -715,13 +712,13 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
if (roomInfo.isCloseScreen) {
self.isLoadHistoryMessage = NO;
AttachmentModel *attachement = [[AttachmentModel alloc]init];
attachement.first = CustomMessageType_Update_RoomInfo;
attachement.second = Custom_Message_Sub_Update_RoomInfo_MessageState;
attachement.data = @{@"roomInfo":self.hostDelegate.getRoomInfo.model2dictionary};
AttachmentModel *attachment = [[AttachmentModel alloc]init];
attachment.first = CustomMessageType_Update_RoomInfo;
attachment.second = Custom_Message_Sub_Update_RoomInfo_MessageState;
attachment.data = @{@"roomInfo":self.hostDelegate.getRoomInfo.model2dictionary};
NIMMessage *message = [[NIMMessage alloc]init];
NIMCustomObject *object = [[NIMCustomObject alloc] init];
object.attachment = attachement;
object.attachment = attachment;
message.messageObject = object;
[self addRoomMessage:message];
return;
@@ -785,62 +782,62 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
option.limit = [ClientConfig shareConfig].configInfo.roomMessageCount;
option.order = NIMMessageSearchOrderDesc;
option.messageTypes = @[@(NIMMessageTypeText),@(NIMMessageTypeCustom)];
@kWeakify(self);
[[NIMSDK sharedSDK].chatroomManager fetchMessageHistory:roomId option:option result:^(NSError * _Nullable error, NSArray<NIMMessage *> * _Nullable messages) {
@kStrongify(self);
if(error != nil){
self.isLoadHistoryMessage = NO;
}
dispatch_async(dispatch_get_main_queue(), ^{///线
if (self.datasource.count > kRoomMessageMaxLength) {
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
NSArray *needRemoveMsgArray = [self.datasource objectsAtIndexes:set];
[self.datasource removeObjectsInArray:needRemoveMsgArray];
}
//
for (NIMMessage *item in messages.reverseObjectEnumerator) {
[self dealWithHistoryDataWithMessage:item];
}
if (self.datasource.count > kRoomMessageMaxLength) {
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
NSArray *needRemoveMsgArray = [self.datasource objectsAtIndexes:set];
[self.datasource removeObjectsInArray:needRemoveMsgArray];
}
//
for (NIMMessage *item in messages.reverseObjectEnumerator) {
[self dealWithHistoryDataWithMessage:item];
}
self.isLoadHistoryMessage = NO;
BOOL hideEnter = [self handleHideEnter:message];
if (!hideEnter) {
///
[self addRoomMessage:message];
}
if (!roomInfo.hasAnimationEffect) {
[self roomInfoNoGiftAnimationMessage:message];
}
[self createUserEnterRoomAddRoomTopicMessage];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.messageTableView reloadData];
//
[self scrollToBottom:YES];
self.isLoadHistoryMessage = NO;
BOOL hideEnter = [self handleHideEnter:message];
if (!hideEnter) {
///
[self addRoomMessage:message];
}
if (!roomInfo.hasAnimationEffect) {
[self roomInfoNoGiftAnimationMessage:message];
}
[self createUserEnterRoomAddRoomtopicMessage];
});
}];
return;
}
dispatch_async(dispatch_get_main_queue(), ^{///线
if (self.datasource.count > kRoomMessageMaxLength) {
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
NSArray *needRemoveMsgArray = [self.datasource objectsAtIndexes:set];
[self.datasource removeObjectsInArray:needRemoveMsgArray];
}
//
for (NIMMessage *item in messages) {
[self dealWithHistoryDataWithMessage:item];
}
if (self.datasource.count > kRoomMessageMaxLength) {
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
NSArray *needRemoveMsgArray = [self.datasource objectsAtIndexes:set];
[self.datasource removeObjectsInArray:needRemoveMsgArray];
}
//
for (NIMMessage *item in messages) {
[self dealWithHistoryDataWithMessage:item];
}
self.isLoadHistoryMessage = NO;
BOOL hideEnter = [self handleHideEnter:message];
if (!hideEnter) {
///
[self addRoomMessage:message];
}
if (!roomInfo.hasAnimationEffect) {
[self roomInfoNoGiftAnimationMessage:message];
}
[self createUserEnterRoomAddRoomTopicMessage];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.messageTableView reloadData];
//
[self scrollToBottom:YES];
self.isLoadHistoryMessage = NO;
BOOL hideEnter = [self handleHideEnter:message];
if (!hideEnter) {
///
[self addRoomMessage:message];
}
if (!roomInfo.hasAnimationEffect) {
[self roomInfoNoGiftAnimationMessage:message];
}
[self createUserEnterRoomAddRoomtopicMessage];
});
}else{
dispatch_async(dispatch_get_main_queue(), ^{///线
@@ -853,7 +850,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
if (!roomInfo.hasAnimationEffect) {
[self roomInfoNoGiftAnimationMessage:message];
}
[self createUserEnterRoomAddRoomtopicMessage];
[self createUserEnterRoomAddRoomTopicMessage];
});
}
@@ -888,9 +885,6 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
[[XPRoomMiniManager shareManager] saveRoomMessage:item];
}
}
}
- (void)handleNIMTextMessage:(NIMMessage *)message {
self.isMiniEnter = NO;
@@ -914,7 +908,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
self.isMiniEnter = YES;
self.isLoadHistoryMessage = NO;
///
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NSArray * temArray = [XPRoomMiniManager shareManager].getLocalCurrentRoomMessage;
//
for (NIMMessage *item in temArray) {

View File

@@ -178,8 +178,22 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
[self.presenter getUserInfo:[AccountInfoStorage instance].getUid];
[self.presenter getUserWallInfo];
@kWeakify(self);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_global_queue(0, 0), ^{
[self.presenter luckyGiftBroadcastRecord];
@kStrongify(self);
if (self) {
[self.presenter luckyGiftBroadcastRecord];
}
});
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_global_queue(0, 0), ^{
@kStrongify(self);
if (self) {
if (self.didLoadPackGiftList) {
return;
}
self.didLoadPackGiftList = YES;
[self.presenter getPackGiftList];
}
});
}
@@ -748,7 +762,6 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
///
[self sendGraffitiGiftMessage];
if (self.segmentType == GiftSegmentType_Graffiti) {
NSString * title = [NSString stringWithFormat:YMLocalizedString(@"XPSendGiftView3"),self.giftInfoView.lastSelectGift.giftName];
[self showSuccessToast:title];
[self dismissViewControllerAnimated:YES completion:nil];

View File

@@ -46,15 +46,20 @@
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
request.roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
request.userIds = @[uid];
@kWeakify(self);
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
@kStrongify(self);
if (error == nil) {
NIMChatroomMember * member = members.firstObject;
@kWeakify(self);
if (member.type == NIMTeamMemberTypeOwner) {
[Api ownerUpdateRoomInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
[[self getView] updateRoomTopicSuccess];
} showLoading:YES] params:params];
} else if(member.type == NIMTeamMemberTypeManager) {
[Api managerUpdateRoomInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
[[self getView] updateRoomTopicSuccess];
} showLoading:YES] params:params];
}

View File

@@ -300,20 +300,16 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self initSubViews];
[self initSubViewConstraints];
[self loadRoomDataAndUsers];
[self setupNimSDK];
[self loadRoomDataAndUsers];
[self setupNotifications];
[self handleActivityContainerViewEvents];
///
[self.presenter getRoomSuperAdmin:self.roomUid];
///
// [self.presenter getRoomFirstCharegWindow:self.roomUid];
///id
// [self.presenter getUnlockRoomAlbumPhotoListWithRoomUid:self.roomUid];
[self startCheckOnlineCountTimer];
@@ -324,8 +320,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
}
- (void)loadRoomDataAndUsers {
[self showLoading];
// [XNDJTDDLoadingTool showAnchorLoading:self.navigationController.view];
[XNDJTDDLoadingTool showAnchorLoading:self.navigationController.view];
[self.presenter initEnterRoom:self.roomUid user:[AccountInfoStorage instance].getUid];
}
@@ -426,16 +421,11 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
self.freeView.hidden = NO;
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
[XPSkillCardPlayerManager shareInstance].isInRoomVC = YES;
if([XPSkillCardPlayerManager shareInstance].isInRoomFirstRecharge == YES && self.isShowFirstRecharge == NO){
[XPSkillCardPlayerManager shareInstance].isInRoomFirstRecharge = NO;
///
// [self.presenter getRoomFirstCharegWindow:self.roomUid];
}
}
#pragma mark - Private Method
- (void)initSubViews {
self.view.backgroundColor = [UIColor clearColor];
self.view.backgroundColor = [UIColor darkGrayColor];
[self.view addSubview:self.backContainerView];
[self.view addSubview:self.littleGameView];
[self.view addSubview:self.stageView];
@@ -655,8 +645,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
}
- (Class)stageViewClassForRoomInfo:(RoomInfoModel *)roomInfo {
if (roomInfo.roomModeType == RoomModeType_Open_Blind &&
![self.stageView isKindOfClass:[DatingStageView class]]) {
if (roomInfo.roomModeType == RoomModeType_Open_Blind) {
return [DatingStageView class];
} else if (roomInfo.datingState == RoomDatingStateChangeType_Close &&
![self.stageView isKindOfClass:[SocialStageView class]]) {
@@ -917,45 +906,22 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[kWindow addSubview:self.freeView];
}
}
}
- (void)onCountdownOpen:(int)time {
NSInteger seconds = time;
int hours = (seconds)%(24*3600)/3600;
int minutes = (seconds)%3600/60;
int second = (seconds)%60;
[[NSNotificationCenter defaultCenter]postNotificationName:kFreeGiftCountdownNotification object:nil userInfo:@{@"text":[NSString stringWithFormat:@"%02d:%02d:%02d",hours,minutes,second],@"isCountdownFinish":@(NO)}];
}
-(void)showRoomFirstChargeWindowFormNot:(NSNotification *)not{
// if(not != nil){
// NSDictionary *parameter = not.object;
// if(parameter != nil){
// self.firstRechargeView.type = parameter[@"type"];
// self.firstRechargeView.diamonds = parameter[@"diamonds"];
// }
// }
// [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(showRoomFirstChargeWindow) object:nil];
// [[UIApplication sharedApplication].keyWindow addSubview:self.firstRechargeView];
// [self.presenter updateRoomFirstCharegWindow:self.roomUid];
}
-(void)showRoomFirstChargeWindow{
// if([XPSkillCardPlayerManager shareInstance].isInRoomFirstRecharge == YES){
// self.isShowFirstRecharge = NO;
// return;
// }
// UIViewController *viewController = [XCCurrentVCStackManager shareManager].getCurrentVC;
// if(![viewController isKindOfClass:[XPRoomViewController class]]){
// [viewController dismissViewControllerAnimated:YES completion:nil];
// }
// self.isShowFirstRecharge = NO;
// [self.presenter updateRoomFirstCharegWindow:self.roomUid];
// [[UIApplication sharedApplication].keyWindow addSubview:self.firstRechargeView];
[[NSNotificationCenter defaultCenter] postNotificationName:kFreeGiftCountdownNotification
object:nil
userInfo:@{@"text": [NSString stringWithFormat:@"%02d:%02d:%02d", hours, minutes, second],
@"isCountdownFinish": @(NO)}];
}
-(void)showRoomFirstChargeWindowFormNot:(NSNotification *)not{}
-(void)showRoomFirstChargeWindow{}
- (void)cancelRoomArrangeMic {
///退
if (self.roomInfo.roomModeType == RoomModeType_Open_Micro_Mode || self.roomInfo.roomModeType == RoomModeType_Open_Blind) {
@@ -1141,13 +1107,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
}
#pragma mark - XPRoomProtocol
///id
-(void)getUnlockRoomAlbumPhotoListSuccessWithList:(NSArray *)list{
[XPSkillCardPlayerManager shareInstance].photoIdList = [NSMutableArray array];
for (int i = 0; i < list.count; i++) {
[[XPSkillCardPlayerManager shareInstance].photoIdList addObject:[NSString stringWithFormat:@"%@",list[i]]];
}
[[NSNotificationCenter defaultCenter]postNotificationName:@"kGetgetUnlockRoomAlbumPhotoListNot" object:nil];
}
-(void)getUnlockRoomAlbumPhotoListSuccessWithList:(NSArray *)list{}
///
-(void)getKickUserListSuccessWithList:(NSArray *)list{
NSString *uid = [[AccountInfoStorage instance]getUid];
@@ -1158,7 +1118,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
break;
}
}
}
- (void)handleRoomWithPasswordAfterInitRoom {
@@ -1177,8 +1136,8 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
- (void)handleRoomWithoutPasswordAfterInitRoom {
self.roomInfo.datingState = (self.roomInfo.roomModeType == RoomModeType_Open_Blind) ?
RoomDatingStateChangeType_Open :
RoomDatingStateChangeType_Normal;
RoomDatingStateChangeType_Open :
RoomDatingStateChangeType_Normal;
[self changeStageViewOnRoomUpdate];
[self.roomHeaderView onRoomEntered];
@@ -1188,8 +1147,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self.backContainerView onRoomEntered];
[self.littleGameView onRoomEntered];
// return;
self.quickMessageContainerView.titleArray = self.roomInfo.speakTemplate;
if ([XPRoomMiniManager shareManager].getRoomInfo.uid != self.roomUid.integerValue) {
@@ -1251,8 +1208,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
}
- (void)initEnterRoomSuccess:(RoomInfoModel *)roomInfo user:(UserInfoModel *)userInfo {
// [XNDJTDDLoadingTool hideHUDInView:self.navigationController.view];
[self hideHUD];
[XNDJTDDLoadingTool hideHUDInView:self.navigationController.view];
[XPSkillCardPlayerManager shareInstance].roomUid = @(roomInfo.uid).stringValue;
@@ -1265,40 +1221,42 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
self.userInfo = userInfo;
@kWeakify(self);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_global_queue(0, 0), ^{
@kStrongify(self);
//
[self.presenter getRedPacket:[NSString stringWithFormat:@"%ld", self.roomInfo.uid]];
});
if (roomInfo.type == RoomType_Anchor) {//
[self handleInitAnchorRoom];
[self showAnchorScrollTipView];
return;
}
switch (roomInfo.type) {
case RoomType_Anchor:
[self handleInitAnchorRoom];
[self showAnchorScrollTipView];
break;
if (roomInfo.valid) { //
if (roomInfo.roomPwd.length > 0 &&
roomInfo.uid != [AccountInfoStorage instance].getUid.integerValue &&
[XPRoomMiniManager shareManager].getRoomInfo.uid != self.roomUid.integerValue) {//
[self handleRoomWithPasswordAfterInitRoom];
} else {
[self handleRoomWithoutPasswordAfterInitRoom];
}
} else { //
if ([self.roomUid isEqualToString:[NSString stringWithFormat:@"%ld", userInfo.uid]]) {
//
[self enterMyRoom];
} else { //
[self showSuccessToast:YMLocalizedString(@"XPRoomViewController2")];
[self enterRoomFail:0];
}
default: {
if (roomInfo.valid) { //
if (roomInfo.roomPwd.length > 0 &&
roomInfo.uid != [AccountInfoStorage instance].getUid.integerValue &&
[XPRoomMiniManager shareManager].getRoomInfo.uid != self.roomUid.integerValue) {//
[self handleRoomWithPasswordAfterInitRoom];
} else {
[self handleRoomWithoutPasswordAfterInitRoom];
}
} else { //
if ([self.roomUid isEqualToString:[NSString stringWithFormat:@"%ld", userInfo.uid]]) {
//
[self enterMyRoom];
} else { //
[self showSuccessToast:YMLocalizedString(@"XPRoomViewController2")];
[self enterRoomFail:0];
}
} }
break;
}
}
- (void)openRoomSuccess:(RoomInfoModel *)roomInfo {
[XNDJTDDLoadingTool hideHUDInView:self.navigationController.view];
[self hideHUD];
self.roomInfo = roomInfo;
@@ -1351,7 +1309,9 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self dismissViewControllerAnimated:YES completion:nil];
}
-(void)getOnlineCount{
@kWeakify(self);
[Api requestRoomOnlineUserList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
@kStrongify(self);
if(code == 200){
NSArray *list = [XPMessageRemoteExtModel modelsWithArray:data.data];
self.roomInfo.onlineNum = list.count;
@@ -2452,7 +2412,9 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
confirmButtonConfig.backgroundColor = [UIColor colorWithPatternImage:image];
confirmButtonConfig.cornerRadius = 38/2;
config.confirmButtonConfig = confirmButtonConfig;
@kWeakify(self);
[TTPopup alertWithConfig:config confirmHandler:^{
@kStrongify(self);
[self requestContactCustomerService];
} cancelHandler:^{
}];

View File

@@ -66,7 +66,9 @@ static NSString * kUpdateVersionNum = @"kUpdateVersionNum";
}
- (void)getUserInfo {
@kWeakify(self);
[Api getUserInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
[[self getView] getUserInfoSuccess:[UserInfoModel modelWithDictionary:data.data]];
}] uid:[[AccountInfoStorage instance] getUid]];
}