-- 优化 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

@@ -534,6 +534,7 @@
548E01C62C3F78360071C83D /* FeedBackViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 548E01C42C3F78360071C83D /* FeedBackViewController.m */; }; 548E01C62C3F78360071C83D /* FeedBackViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 548E01C42C3F78360071C83D /* FeedBackViewController.m */; };
548E01C92C3F78600071C83D /* FeedBackConfigModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 548E01C82C3F78600071C83D /* FeedBackConfigModel.m */; }; 548E01C92C3F78600071C83D /* FeedBackConfigModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 548E01C82C3F78600071C83D /* FeedBackConfigModel.m */; };
548E01CC2C3FB1C70071C83D /* i18nGiftNameMap.m in Sources */ = {isa = PBXBuildFile; fileRef = 548E01CB2C3FB1C70071C83D /* i18nGiftNameMap.m */; }; 548E01CC2C3FB1C70071C83D /* i18nGiftNameMap.m in Sources */ = {isa = PBXBuildFile; fileRef = 548E01CB2C3FB1C70071C83D /* i18nGiftNameMap.m */; };
54ACDCC22C5B31BD0099472C /* XPBeautIDView.m in Sources */ = {isa = PBXBuildFile; fileRef = 54ACDCC12C5B31BD0099472C /* XPBeautIDView.m */; };
54C3895C2C215F5100FD47B1 /* XPHomeMineViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 54C3895B2C215F5100FD47B1 /* XPHomeMineViewController.m */; }; 54C3895C2C215F5100FD47B1 /* XPHomeMineViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 54C3895B2C215F5100FD47B1 /* XPHomeMineViewController.m */; };
54C3895F2C2189DD00FD47B1 /* XPHomeMinePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 54C3895E2C2189DD00FD47B1 /* XPHomeMinePresenter.m */; }; 54C3895F2C2189DD00FD47B1 /* XPHomeMinePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 54C3895E2C2189DD00FD47B1 /* XPHomeMinePresenter.m */; };
54C389622C23BD1600FD47B1 /* HomeRankAvatarModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 54C389612C23BD1600FD47B1 /* HomeRankAvatarModel.m */; }; 54C389622C23BD1600FD47B1 /* HomeRankAvatarModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 54C389612C23BD1600FD47B1 /* HomeRankAvatarModel.m */; };
@@ -2615,6 +2616,8 @@
548E01C82C3F78600071C83D /* FeedBackConfigModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FeedBackConfigModel.m; sourceTree = "<group>"; }; 548E01C82C3F78600071C83D /* FeedBackConfigModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FeedBackConfigModel.m; sourceTree = "<group>"; };
548E01CA2C3FB1C70071C83D /* i18nGiftNameMap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = i18nGiftNameMap.h; sourceTree = "<group>"; }; 548E01CA2C3FB1C70071C83D /* i18nGiftNameMap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = i18nGiftNameMap.h; sourceTree = "<group>"; };
548E01CB2C3FB1C70071C83D /* i18nGiftNameMap.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = i18nGiftNameMap.m; sourceTree = "<group>"; }; 548E01CB2C3FB1C70071C83D /* i18nGiftNameMap.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = i18nGiftNameMap.m; sourceTree = "<group>"; };
54ACDCC02C5B31BD0099472C /* XPBeautIDView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPBeautIDView.h; sourceTree = "<group>"; };
54ACDCC12C5B31BD0099472C /* XPBeautIDView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPBeautIDView.m; sourceTree = "<group>"; };
54C3895A2C215F5100FD47B1 /* XPHomeMineViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeMineViewController.h; sourceTree = "<group>"; }; 54C3895A2C215F5100FD47B1 /* XPHomeMineViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeMineViewController.h; sourceTree = "<group>"; };
54C3895B2C215F5100FD47B1 /* XPHomeMineViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPHomeMineViewController.m; sourceTree = "<group>"; }; 54C3895B2C215F5100FD47B1 /* XPHomeMineViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPHomeMineViewController.m; sourceTree = "<group>"; };
54C3895D2C2189DD00FD47B1 /* XPHomeMinePresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeMinePresenter.h; sourceTree = "<group>"; }; 54C3895D2C2189DD00FD47B1 /* XPHomeMinePresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeMinePresenter.h; sourceTree = "<group>"; };
@@ -9841,6 +9844,8 @@
E873EB08280960990071030D /* XPMineUserInfoVoiceCardView.m */, E873EB08280960990071030D /* XPMineUserInfoVoiceCardView.m */,
E8998D832859B4FA00C68558 /* XPMineUserInfoGiftView.h */, E8998D832859B4FA00C68558 /* XPMineUserInfoGiftView.h */,
E8998D842859B4FA00C68558 /* XPMineUserInfoGiftView.m */, E8998D842859B4FA00C68558 /* XPMineUserInfoGiftView.m */,
54ACDCC02C5B31BD0099472C /* XPBeautIDView.h */,
54ACDCC12C5B31BD0099472C /* XPBeautIDView.m */,
); );
path = MineInfo; path = MineInfo;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -11681,6 +11686,7 @@
9BE01AED2893D0DF00B50299 /* XPDressShopSearchTableViewCell.m in Sources */, 9BE01AED2893D0DF00B50299 /* XPDressShopSearchTableViewCell.m in Sources */,
23FF42732AA6CC480055733C /* PIHomeItemModel.m in Sources */, 23FF42732AA6CC480055733C /* PIHomeItemModel.m in Sources */,
E81060F12987C52B00B772F0 /* MessageGuildModel.m in Sources */, E81060F12987C52B00B772F0 /* MessageGuildModel.m in Sources */,
54ACDCC22C5B31BD0099472C /* XPBeautIDView.m in Sources */,
E87E62772A3F5907002F68C9 /* XPNewHomeRecommendTableViewCell.m in Sources */, E87E62772A3F5907002F68C9 /* XPNewHomeRecommendTableViewCell.m in Sources */,
9BA812D228BF145700783EA7 /* ClientRedPacketModel.m in Sources */, 9BA812D228BF145700783EA7 /* ClientRedPacketModel.m in Sources */,
1427219229A75F6F00C7C423 /* MultipartFormDataParser.m in Sources */, 1427219229A75F6F00C7C423 /* MultipartFormDataParser.m in Sources */,

View File

@@ -15,16 +15,13 @@
#import "XPMessageRemoteExtModel.h" #import "XPMessageRemoteExtModel.h"
#import "MessageContentChatHallHeadView.h" #import "MessageContentChatHallHeadView.h"
#import "MSSessionPublicChatHalRightTextCell.h" #import "MSSessionPublicChatHalRightTextCell.h"
#import "XPNetImageYYLabel.h"
@interface MSSessionPublicChatHalRightTextCell() @interface MSSessionPublicChatHalRightTextCell()
/** /**
*/ */
@property (nonatomic, strong) XPNetImageYYLabel * messageText;
@property (nonatomic, strong) YYLabel * messageText;
@property(nonatomic,strong) UIImageView *bgImage; @property(nonatomic,strong) UIImageView *bgImage;
@@ -57,6 +54,16 @@
self.bubbleImageView.image = [self resizableImage:image1]; 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{ -(void)installUI{
self.contentView.backgroundColor = [UIColor clearColor]; self.contentView.backgroundColor = [UIColor clearColor];
@@ -106,6 +113,9 @@
if(!_bgImage){ if(!_bgImage){
_bgImage = [UIImageView new]; _bgImage = [UIImageView new];
_bgImage.image = [self resizableImage:kImage(@"ms_message_headlines_text_right")]; _bgImage.image = [self resizableImage:kImage(@"ms_message_headlines_text_right")];
if (isMSRTL()) {
_bgImage.transform = CGAffineTransformMakeScale(-1.0, 1.0);
}
} }
return _bgImage; return _bgImage;
} }
@@ -116,15 +126,15 @@
} }
return _bubbleImageView; return _bubbleImageView;
} }
- (YYLabel *)messageText { - (XPNetImageYYLabel *)messageText {
if (!_messageText) { if (!_messageText) {
_messageText = [[YYLabel alloc]initWithFrame:CGRectZero]; _messageText = [[XPNetImageYYLabel alloc]initWithFrame:CGRectZero];
_messageText.textColor = DJDKMIMOMColor.mainTextColor; _messageText.textColor = DJDKMIMOMColor.mainTextColor;
_messageText.numberOfLines = 0; _messageText.numberOfLines = 0;
_messageText.font = kFontMedium(14); _messageText.font = kFontMedium(14);
_messageText.textColor = [UIColor whiteColor]; _messageText.textColor = [UIColor whiteColor];
_messageText.textAlignment = NSTextAlignmentLeft; _messageText.textAlignment = NSTextAlignmentNatural;
_messageText.userInteractionEnabled = YES; _messageText.userInteractionEnabled = YES;
_messageText.preferredMaxLayoutWidth = kGetScaleWidth(220); _messageText.preferredMaxLayoutWidth = kGetScaleWidth(220);
} }

View File

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

View File

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

View File

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

View File

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

View File

@@ -34,11 +34,10 @@
- (void)setModel:(XPMineGameOrderRecoredModel *)model { - (void)setModel:(XPMineGameOrderRecoredModel *)model {
_model = 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.timeLabel.text = model.orderTime;
self.orderIDLabel.text = model.orderNo; self.orderIDLabel.text = model.orderNo;
self.gamePriceLabel.text = @(self.model.amount).stringValue; self.gamePriceLabel.text = @(self.model.amount).stringValue;
// [self updatePriceContent];
} }
- (void)setType:(NSInteger)type { - (void)setType:(NSInteger)type {

View File

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

View File

@@ -102,6 +102,8 @@ XPMineCustomNavViewDelegate, XPMineUserInfoProtocol, XPMineUserInfoHeaderViewDel
-(void)viewDidAppear:(BOOL)animated{ -(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated]; [super viewDidAppear:animated];
[self initHttpRequest];
} }
-(void)viewDidDisappear:(BOOL)animated{ -(void)viewDidDisappear:(BOOL)animated{
@@ -111,9 +113,9 @@ XPMineCustomNavViewDelegate, XPMineUserInfoProtocol, XPMineUserInfoHeaderViewDel
- (void)viewWillAppear:(BOOL)animated { - (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear: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){ if([XPSkillCardPlayerManager shareInstance].isInRoom == YES && [XPSkillCardPlayerManager shareInstance].isInRoomFirstRecharge == NO){
[XPSkillCardPlayerManager shareInstance].isInRoomFirstRecharge = YES; [XPSkillCardPlayerManager shareInstance].isInRoomFirstRecharge = YES;
} }
@@ -160,12 +162,9 @@ XPMineCustomNavViewDelegate, XPMineUserInfoProtocol, XPMineUserInfoHeaderViewDel
- (void)initHttpRequest { - (void)initHttpRequest {
NSString *uid = [NSString stringWithFormat:@"%ld", self.uid]; NSString *uid = [NSString stringWithFormat:@"%ld", self.uid];
[self.presenter getUserInfoWithUid:uid]; // [self.presenter getUserInfoWithUid:uid];
[self.presenter getUserAttentionState:uid]; [self.presenter getUserAttentionState:uid];
// 使
[self.presenter getUserDetailInfoWithUid:uid];
///访 ///访
if (![uid isEqualToString:[[AccountInfoStorage instance] getUid]]) { if (![uid isEqualToString:[[AccountInfoStorage instance] getUid]]) {
[self.presenter visitUser:uid]; [self.presenter visitUser:uid];
@@ -182,8 +181,8 @@ XPMineCustomNavViewDelegate, XPMineUserInfoProtocol, XPMineUserInfoHeaderViewDel
NSString *uid = [NSString stringWithFormat:@"%ld",self.uid]; NSString *uid = [NSString stringWithFormat:@"%ld",self.uid];
TTActionSheetConfig *report = [TTActionSheetConfig normalTitle:YMLocalizedString(@"XPMineUserInfoViewController0") clickAction:^{ TTActionSheetConfig *report = [TTActionSheetConfig normalTitle:YMLocalizedString(@"XPMineUserInfoViewController0") clickAction:^{
XPWebViewController *vc = [[XPWebViewController alloc]init]; XPWebViewController *vc = [[XPWebViewController alloc]init];
NSString *urlstr = [NSString stringWithFormat:@"%@?reportUid=%@&source=PERSONAL",URLWithType(kReportRoomURL),uid]; NSString *urlStr = [NSString stringWithFormat:@"%@?reportUid=%@&source=PERSONAL",URLWithType(kReportRoomURL),uid];
vc.url = urlstr; vc.url = urlStr;
[self.navigationController pushViewController:vc animated:YES]; [self.navigationController pushViewController:vc animated:YES];
}]; }];
@@ -216,8 +215,10 @@ XPMineCustomNavViewDelegate, XPMineUserInfoProtocol, XPMineUserInfoHeaderViewDel
TTAlertConfig *config = [[TTAlertConfig alloc] init]; TTAlertConfig *config = [[TTAlertConfig alloc] init];
config.title = title; config.title = title;
config.message = message; config.message = message;
@kWeakify(self);
[TTPopup alertWithConfig:config confirmHandler:^{ [TTPopup alertWithConfig:config confirmHandler:^{
@kStrongify(self);
if (isRemove) { if (isRemove) {
[[NIMSDK sharedSDK].userManager removeFromBlackBlackList:uid completion:^(NSError * _Nullable error) { [[NIMSDK sharedSDK].userManager removeFromBlackBlackList:uid completion:^(NSError * _Nullable error) {
if (error == nil) { if (error == nil) {
@@ -274,16 +275,11 @@ XPMineCustomNavViewDelegate, XPMineUserInfoProtocol, XPMineUserInfoHeaderViewDel
} }
- (id<JXPagerViewListViewDelegate>)pagerView:(JXPagerView *)pagerView initListAtIndex:(NSInteger)index { - (id<JXPagerViewListViewDelegate>)pagerView:(JXPagerView *)pagerView initListAtIndex:(NSInteger)index {
if(isMSRTL()){
if (index == 1) {
return self.userDataVC;
}
return self.userMomentVC;
}
if (index == 0) { 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 #pragma mark - JXPagerMainTableViewGestureDelegate
@@ -352,19 +348,16 @@ XPMineCustomNavViewDelegate, XPMineUserInfoProtocol, XPMineUserInfoHeaderViewDel
self.editVC.tagModel = tagModel; self.editVC.tagModel = tagModel;
self.headView.tagModel = tagModel; self.headView.tagModel = tagModel;
self.userDataVC.userInfo = userInfo; 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.headerHeight = [XPMineUserInfoHeaderView headerHeight:userInfo];
[self.pagingView reloadData]; [self.pagingView reloadData];
// 使
[self.presenter getUserDetailInfoWithUid:@(self.uid).stringValue];
} }
- (void)ongetDetailInfoSuccess:(UserInfoModel *)userInfo { - (void)onGetDetailInfoSuccess:(UserInfoModel *)userInfo {
self.userDataVC.giftWall = userInfo.userGiftWall; self.userDataVC.giftWall = userInfo.userGiftWall;
self.userDataVC.luckyGiftWall = userInfo.userLuckyBagGiftWall; self.userDataVC.luckyGiftWall = userInfo.userLuckyBagGiftWall;
self.userDataVC.dynamicInfo = userInfo.dynamicInfo; self.userDataVC.dynamicInfo = userInfo.dynamicInfo;
@@ -374,12 +367,10 @@ XPMineCustomNavViewDelegate, XPMineUserInfoProtocol, XPMineUserInfoHeaderViewDel
self.giftVC.userInfo = userInfo; self.giftVC.userInfo = userInfo;
if(isMSRTL()){ if(isMSRTL()){
[self.titleView selectItemAtIndex:1];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.titleView selectItemAtIndex:0]; [self.titleView selectItemAtIndex:0];
}); });
} }
[self.pagingView reloadData];
} }
- (void)getAttentionStateSuccess:(BOOL)status { - (void)getAttentionStateSuccess:(BOOL)status {
@@ -426,12 +417,10 @@ XPMineCustomNavViewDelegate, XPMineUserInfoProtocol, XPMineUserInfoHeaderViewDel
NSString * uidStr = [NSString stringWithFormat:@"%ld", uid]; NSString * uidStr = [NSString stringWithFormat:@"%ld", uid];
self.userDataVC.userUid = uidStr; self.userDataVC.userUid = uidStr;
self.giftVC.userUid = uidStr; self.giftVC.userUid = uidStr;
[self.presenter getUserInfoWithUid:uidStr];
self.editVC.uid = uidStr; self.editVC.uid = uidStr;
} }
} }
- (XPMineUserInfoHeaderView *)headView { - (XPMineUserInfoHeaderView *)headView {
if (!_headView) { if (!_headView) {
_headView = [[XPMineUserInfoHeaderView alloc] init]; _headView = [[XPMineUserInfoHeaderView alloc] init];
@@ -507,12 +496,11 @@ XPMineCustomNavViewDelegate, XPMineUserInfoProtocol, XPMineUserInfoHeaderViewDel
_titleView.titleSelectedFont = [UIFont systemFontOfSize:20 weight:UIFontWeightBold]; _titleView.titleSelectedFont = [UIFont systemFontOfSize:20 weight:UIFontWeightBold];
_titleView.titleLabelAnchorPointStyle = JXCategoryTitleLabelAnchorPointStyleCenter; _titleView.titleLabelAnchorPointStyle = JXCategoryTitleLabelAnchorPointStyleCenter;
_titleView.contentScrollViewClickTransitionAnimationEnabled = NO; _titleView.contentScrollViewClickTransitionAnimationEnabled = NO;
_titleView.defaultSelectedIndex = 0; _titleView.defaultSelectedIndex = isMSRTL() ? 1 : 0;
_titleView.averageCellSpacingEnabled = NO; _titleView.averageCellSpacingEnabled = NO;
_titleView.contentEdgeInsetLeft = 15; _titleView.contentEdgeInsetLeft = 15;
_titleView.titles = self.titles; _titleView.titles = self.titles;
_titleView.cellSpacing = 20; _titleView.cellSpacing = 20;
_titleView.titles = self.titles;
_titleView.listContainer = (id<JXCategoryViewListContainer>)self.pagingView.listContainerView; _titleView.listContainer = (id<JXCategoryViewListContainer>)self.pagingView.listContainerView;
JXCategoryIndicatorImageView *lineView = [[JXCategoryIndicatorImageView alloc] init]; 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" #import "SpriteSheetImageManager.h"
///view ///view
#import "XPMineUserInfoHeaderTagView.h" #import "XPMineUserInfoHeaderTagView.h"
#import "XPBeautIDView.h"
///Model ///Model
#import "UserInfoModel.h" #import "UserInfoModel.h"
@@ -66,18 +67,18 @@ return view;\
//@property (nonatomic,strong) UIImageView *onlineView; //@property (nonatomic,strong) UIImageView *onlineView;
///icon ///icon
@property (nonatomic,strong) SVGAImageView *onlineIconView; @property (nonatomic,strong) SVGAImageView *onlineIconView;
/////tilte ///tilte
//@property (nonatomic,strong) UILabel *onlineTitleView; //@property (nonatomic,strong) UILabel *onlineTitleView;
/// ///
@property (nonatomic,strong) UIButton *onlineButton; @property (nonatomic,strong) UIButton *onlineButton;
/// ///
@property (nonatomic,strong) UIStackView *idStackView; @property (nonatomic,strong) UIStackView *idStackView;
///
@property (nonatomic,strong) UIImageView *beautifulImageView;
///id ///id
@property (nonatomic,strong) UILabel *idLabel; @property (nonatomic,strong) UILabel *idLabel;
@property (nonatomic, strong) UIImageView *idIconImageView; @property (nonatomic, strong) UIImageView *idIconImageView;
@property (nonatomic, strong) UIImageView *copyIdImageView; @property (nonatomic, strong) UIImageView *copyIdImageView;
@property (nonatomic, strong) XPBeautIDView *beautIDView;
@property (nonatomic, strong) UIButton *copyIdButton; @property (nonatomic, strong) UIButton *copyIdButton;
/// ///
@@ -278,6 +279,7 @@ return view;\
- (void)setupIDArea { - (void)setupIDArea {
[self.userInfoView addSubview:self.idStackView]; [self.userInfoView addSubview:self.idStackView];
[self.userInfoView addSubview:self.beautIDView];
if (isMSRTL()) { if (isMSRTL()) {
[self.idStackView addArrangedSubview:self.copyIdImageView]; [self.idStackView addArrangedSubview:self.copyIdImageView];
@@ -289,11 +291,14 @@ return view;\
[self.idStackView addArrangedSubview:self.copyIdImageView]; [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.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) { [self.idStackView mas_makeConstraints:^(MASConstraintMaker *make) {
if (isMSRTL()) { if (isMSRTL()) {
make.centerX.mas_equalTo(self.userInfoView).offset(8); 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.top.mas_equalTo(self.nickStackView.mas_bottom).offset(6);
make.height.mas_equalTo(24); 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) { [self.idIconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(14); make.width.height.mas_equalTo(14);
}]; }];
@@ -546,7 +546,6 @@ return view;\
self.officialImageView.hidden = userInfo.defUser != UserLevelType_Offical; self.officialImageView.hidden = userInfo.defUser != UserLevelType_Offical;
self.newUserImageView.hidden = !userInfo.newUser; self.newUserImageView.hidden = !userInfo.newUser;
if (userInfo.userLevelVo.experUrl) { if (userInfo.userLevelVo.experUrl) {
[self.experImageView loadImageWithUrl:userInfo.userLevelVo.experUrl completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) { [self.experImageView loadImageWithUrl:userInfo.userLevelVo.experUrl completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
self.experImageView.image = image; self.experImageView.image = image;
@@ -689,38 +688,13 @@ return view;\
text = [NSString stringWithFormat:@" %ld", (long)self.userInfo.erbanNo]; text = [NSString stringWithFormat:@" %ld", (long)self.userInfo.erbanNo];
} }
self.beautifulImageView.hidden = !hasBeautifulID;
self.idIconImageView.hidden = hasBeautifulID; self.idIconImageView.hidden = hasBeautifulID;
if (hasBeautifulID) { if (hasBeautifulID) {
self.beautIDView.num = text;
NSString *offsetSpace = @""; self.idStackView.hidden = YES;
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);
}];
} else { } else {
self.beautIDView.hidden = YES;
self.idLabel.text = text; self.idLabel.text = text;
self.idLabel.alpha = 0.8; self.idLabel.alpha = 0.8;
} }
@@ -780,9 +754,7 @@ return view;\
self.headWearSvgaImageView.videoItem = videoItem; self.headWearSvgaImageView.videoItem = videoItem;
[self.headWearSvgaImageView startAnimation]; [self.headWearSvgaImageView startAnimation];
} }
failureBlock:^(NSError * _Nullable error) { failureBlock:^(NSError * _Nullable error) {}];
}];
} }
- (void)playAnimate:(NSString *)headwearUrlString { - (void)playAnimate:(NSString *)headwearUrlString {
@@ -792,9 +764,7 @@ return view;\
[self.manager loadSpriteSheetImageWithURL:url completionBlock:^(YYSpriteSheetImage * _Nullable sprit) { [self.manager loadSpriteSheetImageWithURL:url completionBlock:^(YYSpriteSheetImage * _Nullable sprit) {
@kStrongify(self); @kStrongify(self);
self.headWearImageView.image = sprit; self.headWearImageView.image = sprit;
} failureBlock:^(NSError * _Nullable error) { } failureBlock:^(NSError * _Nullable error) {}];
NSLog(@"%@", error);
}];
} }
#pragma mark - Getters #pragma mark - Getters
@@ -863,22 +833,12 @@ return view;\
return _idStackView; 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 { - (UILabel *)idLabel {
if (!_idLabel) { if (!_idLabel) {
_idLabel = [[UILabel alloc] init]; _idLabel = [[UILabel alloc] init];
_idLabel.font = [UIFont systemFontOfSize:11 weight:UIFontWeightMedium]; _idLabel.font = [UIFont systemFontOfSize:11 weight:UIFontWeightMedium];
_idLabel.textColor = UIColorFromRGB(0x191919); _idLabel.textColor = UIColorFromRGB(0x191919);
_idLabel.textAlignment = NSTextAlignmentCenter;
_idLabel.userInteractionEnabled = YES; _idLabel.userInteractionEnabled = YES;
_idLabel.clipsToBounds = NO; _idLabel.clipsToBounds = NO;
} }
@@ -907,12 +867,20 @@ return view;\
- (UIButton *)copyIdButton { - (UIButton *)copyIdButton {
if (!_copyIdButton) { if (!_copyIdButton) {
_copyIdButton = [UIButton buttonWithType:UIButtonTypeCustom]; _copyIdButton = [UIButton buttonWithType:UIButtonTypeCustom];
// [_copyIdButton setImage:[UIImage getLanguageImage:@"user_card_copy_id1"] forState:UIControlStateNormal];
[_copyIdButton addTarget:self action:@selector(copyNameAction) forControlEvents:UIControlEventTouchUpInside]; [_copyIdButton addTarget:self action:@selector(copyNameAction) forControlEvents:UIControlEventTouchUpInside];
} }
return _copyIdButton; 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 { - (SVGAImageView *)onlineIconView {
if (_onlineIconView == nil) { if (_onlineIconView == nil) {
_onlineIconView = [[SVGAImageView alloc]init]; _onlineIconView = [[SVGAImageView alloc]init];
@@ -995,7 +963,7 @@ return view;\
if (!_tagStackView) { if (!_tagStackView) {
_tagStackView = [[UIStackView alloc] init]; _tagStackView = [[UIStackView alloc] init];
_tagStackView.axis = UILayoutConstraintAxisHorizontal; _tagStackView.axis = UILayoutConstraintAxisHorizontal;
_tagStackView.distribution = UIStackViewDistributionFillProportionally; _tagStackView.distribution = UIStackViewDistributionFill;
_tagStackView.alignment = UIStackViewAlignmentCenter; _tagStackView.alignment = UIStackViewAlignmentCenter;
_tagStackView.spacing = 6; _tagStackView.spacing = 6;
} }
@@ -1041,7 +1009,7 @@ return view;\
config.imageType = ImageTypeUserCardLevel; config.imageType = ImageTypeUserCardLevel;
_nameplateImageView = [[NetImageView alloc] initWithConfig:config]; _nameplateImageView = [[NetImageView alloc] initWithConfig:config];
_nameplateImageView.userInteractionEnabled = YES; _nameplateImageView.userInteractionEnabled = YES;
_nameplateImageView.contentMode = UIViewContentModeScaleAspectFill; _nameplateImageView.contentMode = UIViewContentModeScaleAspectFit;
} }
return _nameplateImageView; return _nameplateImageView;
} }

View File

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

View File

@@ -24,9 +24,9 @@ NS_ASSUME_NONNULL_BEGIN
///获取超管成功 ///获取超管成功
- (void)getRoomSuperAdminSuccess:(NSArray *)list; - (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; - (void)getRedPacketSuccess:(NSArray *)list;
///获取红包成功 ///获取红包成功

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -63,6 +63,7 @@
make.leading.mas_equalTo(12); make.leading.mas_equalTo(12);
make.bottom.mas_equalTo(-20); make.bottom.mas_equalTo(-20);
make.top.mas_equalTo(10); make.top.mas_equalTo(10);
make.width.mas_equalTo(20);
}]; }];
} }
@@ -99,6 +100,8 @@
_messageInfo = messageInfo; _messageInfo = messageInfo;
if (_messageInfo) { if (_messageInfo) {
self.contentLabel.attributedText = _messageInfo.content; self.contentLabel.attributedText = _messageInfo.content;
if (_messageInfo.bubbleImageUrl.length) { if (_messageInfo.bubbleImageUrl.length) {
@kWeakify(self); @kWeakify(self);
[self.bubbleImageView loadImageWithUrl:_messageInfo.bubbleImageUrl completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) { [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]; UIImage *image1 = [UIImage imageWithCGImage:image.CGImage scale:2.0 orientation:UIImageOrientationUp];
self.bubbleImageView.image = [self resizableImage:image1]; 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 { } else {
_bubbleImageView.image = [UIImage imageWithColor:[DJDKMIMOMColor messageBubbleColor]]; _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; _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 { - (UIImage *)scaleToSize:(UIImage *)img {
// bitmapcontext // bitmapcontext
// 使context // 使context

View File

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

View File

@@ -178,8 +178,22 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
[self.presenter getUserInfo:[AccountInfoStorage instance].getUid]; [self.presenter getUserInfo:[AccountInfoStorage instance].getUid];
[self.presenter getUserWallInfo]; [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), ^{ 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]; [self sendGraffitiGiftMessage];
if (self.segmentType == GiftSegmentType_Graffiti) { if (self.segmentType == GiftSegmentType_Graffiti) {
NSString * title = [NSString stringWithFormat:YMLocalizedString(@"XPSendGiftView3"),self.giftInfoView.lastSelectGift.giftName]; NSString * title = [NSString stringWithFormat:YMLocalizedString(@"XPSendGiftView3"),self.giftInfoView.lastSelectGift.giftName];
[self showSuccessToast:title]; [self showSuccessToast:title];
[self dismissViewControllerAnimated:YES completion:nil]; [self dismissViewControllerAnimated:YES completion:nil];

View File

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

View File

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

View File

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