修复bug
This commit is contained in:
@@ -4006,13 +4006,13 @@
|
||||
186A532B26FC6ED900D67B2C /* TTPopup */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
186A532C26FC6ED900D67B2C /* TTPopup.m */,
|
||||
186A532D26FC6ED900D67B2C /* Config */,
|
||||
186A533626FC6ED900D67B2C /* Manager */,
|
||||
186A533A26FC6ED900D67B2C /* TTPopup.h */,
|
||||
186A533B26FC6ED900D67B2C /* View */,
|
||||
186A534026FC6ED900D67B2C /* Service */,
|
||||
186A534426FC6ED900D67B2C /* Header */,
|
||||
186A533626FC6ED900D67B2C /* Manager */,
|
||||
186A534026FC6ED900D67B2C /* Service */,
|
||||
186A533A26FC6ED900D67B2C /* TTPopup.h */,
|
||||
186A532C26FC6ED900D67B2C /* TTPopup.m */,
|
||||
186A533B26FC6ED900D67B2C /* View */,
|
||||
);
|
||||
path = TTPopup;
|
||||
sourceTree = "<group>";
|
||||
|
@@ -31,7 +31,7 @@
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
buildConfiguration = "Release"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
|
@@ -9,7 +9,6 @@
|
||||
#import "SDPhotoBrowser.h"
|
||||
#import "UIImageView+WebCache.h"
|
||||
#import "SDBrowserImageView.h"
|
||||
#import <SDWebImageFLPlugin/SDWebImageFLPlugin.h>
|
||||
#import <AssetsLibrary/AssetsLibrary.h>
|
||||
#import <Photos/Photos.h>
|
||||
#define iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO) //判断是否iPhoneX
|
||||
@@ -97,7 +96,7 @@
|
||||
- (void)saveImage
|
||||
{
|
||||
int index = _scrollView.contentOffset.x / _scrollView.bounds.size.width;
|
||||
FLAnimatedImageView *currentImageView = _scrollView.subviews[index];
|
||||
SDBrowserImageView *currentImageView = _scrollView.subviews[index];
|
||||
NSData *imageData = currentImageView.animatedImage.data;
|
||||
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
|
||||
if(imageData != nil){
|
||||
|
@@ -145,7 +145,7 @@
|
||||
make.right.mas_equalTo(-10);
|
||||
make.top.mas_equalTo(self.avatarImageView.mas_top).offset(5);
|
||||
make.height.mas_equalTo(20);
|
||||
make.width.mas_lessThanOrEqualTo(126);
|
||||
make.width.mas_greaterThanOrEqualTo(kGetScaleWidth(100));
|
||||
}];
|
||||
|
||||
[self.gameView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -289,7 +289,11 @@
|
||||
- (void)setRoomInfo:(UserInfoModel *)roomInfo {
|
||||
_roomInfo = roomInfo;
|
||||
self.avatarImageView.imageUrl = roomInfo.avatar;
|
||||
self.nickLabel.text = roomInfo.nick;
|
||||
NSString *nick = roomInfo.nick;
|
||||
if(nick.length > 7){
|
||||
nick = [NSString stringWithFormat:@"%@...",[nick substringToIndex:7]];
|
||||
}
|
||||
self.nickLabel.text = nick;
|
||||
if (roomInfo.gender == GenderType_Female) {
|
||||
[self.sexBtn setImage:[UIImage imageNamed:@"home_sex_female"] forState:UIControlStateNormal];
|
||||
self.sexBtn.backgroundColor = [ThemeColor colorWithHexString:@"#FF9CCE"];
|
||||
|
@@ -29,6 +29,8 @@
|
||||
[Api userDetailInfoCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
UserInfoModel * infoModel = [UserInfoModel modelWithDictionary:data.data];
|
||||
[[self getView] onGetSessionUserInfoSuccess:infoModel];
|
||||
}fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
[[self getView]onGetSessionUserInfoFail];
|
||||
}] uid:uid page:@"1" pageSize:@"20"];
|
||||
}
|
||||
|
||||
|
@@ -17,6 +17,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
///获取用户信息成功
|
||||
- (void)onGetSessionUserInfoSuccess:(UserInfoModel *)userInfo;
|
||||
///获取用户信息失败
|
||||
- (void)onGetSessionUserInfoFail;
|
||||
///获取粉丝喜欢成功
|
||||
- (void)getFansLikeSuccess:(BOOL)isLike;
|
||||
///关注成功
|
||||
|
@@ -14,7 +14,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@protocol MessageContentCustomViewDelegate <NSObject>
|
||||
|
||||
- (void)updateMessageSuccess:(NIMMessage *)message;
|
||||
|
||||
///查看点单信息
|
||||
- (void)checkGameListInfo:(NIMMessage *)message;
|
||||
@end
|
||||
|
||||
@interface MessageContentCustomView : UIView <MessageContentProtocol>
|
||||
|
@@ -22,6 +22,7 @@
|
||||
@property(nonatomic,strong) UILabel *gameNameView;
|
||||
///游戏局数
|
||||
@property(nonatomic,strong) UILabel *gameNumView;
|
||||
@property(nonatomic,strong) NIMMessage *msg;
|
||||
@end
|
||||
@implementation MessageContentGameView
|
||||
|
||||
@@ -89,6 +90,7 @@
|
||||
}
|
||||
|
||||
- (void)render:(NIMMessage *)message {
|
||||
self.msg = message;
|
||||
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||
AttachmentModel * attach = obj.attachment;
|
||||
UserGameInfoVo *gameInfo = [UserGameInfoVo modelWithDictionary:attach.data];
|
||||
@@ -97,11 +99,19 @@
|
||||
_gameNumView.text = [NSString stringWithFormat:@"%@ 局",gameInfo.inning];
|
||||
|
||||
|
||||
}
|
||||
-(void)checkGameAction{
|
||||
if(self.delegate && [self.delegate respondsToSelector:@selector(checkGameListInfo:)]){
|
||||
[self.delegate checkGameListInfo:self.msg];
|
||||
}
|
||||
}
|
||||
- (NetImageView *)bgImageView{
|
||||
if(!_bgImageView){
|
||||
_bgImageView = [NetImageView new];
|
||||
_bgImageView.image = kImage(@"message_session_game_Invite_bg");
|
||||
_bgImageView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(checkGameAction)];
|
||||
[_bgImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _bgImageView;
|
||||
}
|
||||
@@ -131,6 +141,7 @@
|
||||
NetImageConfig *config = [[NetImageConfig alloc]init];
|
||||
config.placeHolder = [UIImageConstant defaultEmptyAvatarPlaceholder];
|
||||
_gameIcomView = [[NetImageView alloc]initWithConfig:config];
|
||||
_gameIcomView.userInteractionEnabled = YES;
|
||||
}
|
||||
return _gameIcomView;
|
||||
}
|
||||
|
@@ -18,7 +18,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)didTapAvatar:(NSString *)uid;
|
||||
///发送失败点击了重试
|
||||
- (void)didFailRetry:(NIMMessage *)message;
|
||||
|
||||
///查看点单信息
|
||||
- (void)checkGameListInfo:(NIMMessage *)message;
|
||||
@end
|
||||
|
||||
@interface MessageCell : UITableViewCell
|
||||
|
@@ -408,7 +408,9 @@
|
||||
if ([self.messageContent isKindOfClass:[MessageContentGameView class]]) {
|
||||
return self.messageContent;
|
||||
}
|
||||
return [[MessageContentGameView alloc] init];
|
||||
MessageContentGameView*gameView = [[MessageContentGameView alloc] init];
|
||||
gameView.delegate = self;
|
||||
return gameView;
|
||||
}else {
|
||||
if ([self.messageContent isKindOfClass:[MessageContentUnSupportView class]]) {
|
||||
return self.messageContent;
|
||||
@@ -423,7 +425,11 @@
|
||||
[self.delegate updateMessageSuccess:message];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)checkGameListInfo:(NIMMessage *)message{
|
||||
if(self.delegate && [self.delegate respondsToSelector:@selector(checkGameListInfo:)]){
|
||||
[self.delegate checkGameListInfo:message];
|
||||
}
|
||||
}
|
||||
#pragma mark - Event Response
|
||||
- (void)rightAvatarTapRecognizer {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(didTapAvatar:)]) {
|
||||
|
@@ -118,14 +118,19 @@
|
||||
}
|
||||
-(void)getAttentionUserNotification{
|
||||
[self.presenter getChatLimitReceiverUid:self.session.sessionId];
|
||||
if ([self showChatRiskView:self.userInfo]) {
|
||||
self.riskAlertView.warning = self.userInfo.banAccount ? @" 温馨提醒:当前对方账号存在异常,请谨慎来往!" : @"温馨提示:对方和您非好友关系,请注意隐私安全!";
|
||||
self.riskAlertView.hidden = NO;
|
||||
self.emptyVeiw.hidden = YES;
|
||||
}else{
|
||||
self.riskAlertView.hidden = YES;
|
||||
self.emptyVeiw.hidden = NO;
|
||||
}
|
||||
dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC));
|
||||
dispatch_after(delayTime, dispatch_get_main_queue(), ^{
|
||||
if ([self showChatRiskView:self.userInfo]==YES) {
|
||||
self.riskAlertView.warning = self.userInfo.banAccount ? @" 温馨提醒:当前对方账号存在异常,请谨慎来往!" : @"温馨提示:对方和您非好友关系,请注意隐私安全!";
|
||||
self.riskAlertView.hidden = NO;
|
||||
self.emptyVeiw.hidden = YES;
|
||||
}else{
|
||||
self.riskAlertView.hidden = YES;
|
||||
self.emptyVeiw.hidden = NO;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
@@ -204,6 +209,10 @@
|
||||
make.top.equalTo(self.self.sessionNavView.mas_bottom);
|
||||
|
||||
}];
|
||||
[self.emptyVeiw mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.view);
|
||||
make.height.mas_equalTo(0);
|
||||
}];
|
||||
[self.riskAlertView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.view);
|
||||
make.height.mas_equalTo(20);
|
||||
@@ -357,22 +366,32 @@
|
||||
if (userInfo.nick.length > 0) {
|
||||
self.sessionNavView.title = userInfo.nick;
|
||||
}
|
||||
|
||||
if (userInfo.roomUid && self.openType != SessionListOpenTypeRoom) {
|
||||
self.isShowfollowInRoomView = YES;
|
||||
self.sessionNavView.isShowLive = YES;
|
||||
if ([self showChatRiskView:userInfo]) {
|
||||
|
||||
if ([self showChatRiskView:userInfo]==YES) {
|
||||
self.riskAlertView.warning = userInfo.banAccount ? @" 温馨提醒:当前对方账号存在异常,请谨慎来往!" : @"温馨提示:对方和您非好友关系,请注意隐私安全!";
|
||||
self.riskAlertView.hidden = NO;
|
||||
}else{
|
||||
self.riskAlertView.hidden = YES;
|
||||
self.emptyVeiw.hidden = NO;
|
||||
}
|
||||
} else {
|
||||
if ([self showChatRiskView:userInfo]) {
|
||||
self.riskAlertView.warning = userInfo.banAccount ? @" 温馨提醒:当前对方账号存在异常,请谨慎来往!" : @"温馨提示:对方和您非好友关系,请注意隐私安全!";
|
||||
self.riskAlertView.hidden = NO;
|
||||
}else{
|
||||
self.riskAlertView.hidden = YES;
|
||||
self.emptyVeiw.hidden = NO;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
///获取用户信息失败
|
||||
- (void)onGetSessionUserInfoFail{
|
||||
[self.presenter getGamePartnerInfoListWithUid:self.session.sessionId];
|
||||
}
|
||||
- (void)getFansLikeSuccess:(BOOL)isLike {
|
||||
if ([[ClientConfig shareConfig].configInfo.officialMsgUids containsObject:self.session.sessionId] || [[ClientConfig shareConfig].configInfo.officialAccountUids containsObject:self.session.sessionId]) {
|
||||
self.sessionNavView.isLike = YES;
|
||||
@@ -392,6 +411,25 @@
|
||||
[self.sessionTableView reloadData];
|
||||
}
|
||||
}
|
||||
- (void)checkGameListInfo:(NIMMessage *)message{
|
||||
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||
AttachmentModel * attachment = obj.attachment;
|
||||
if(attachment.first == CustomMessageType_Initiat_Invitation && attachment.second == Custom_Message_Sub_Initiat_Invitation_Initiating_User){
|
||||
UserGameInfoVo *gameInfo = [UserGameInfoVo modelWithDictionary:attachment.data];
|
||||
int type = [gameInfo.toUid isEqualToString:[AccountInfoStorage instance].getUid] ? 1 : 0;
|
||||
XPMineGameOrderDetailsView *orderView = [[XPMineGameOrderDetailsView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight) type:type];
|
||||
orderView.gameInfo = gameInfo;
|
||||
if(type == 0 && self.gameArray.count == 0){
|
||||
orderView.isHiddenBtn = YES;
|
||||
}
|
||||
orderView.isFormChat = YES;
|
||||
orderView.delegate = self;
|
||||
[self.view addSubview:orderView];
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
- (void)didTapAvatar:(NSString *)uid {
|
||||
//过滤官方账号
|
||||
@@ -565,19 +603,7 @@
|
||||
return [MessageCell measureHeight:msg];
|
||||
}
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
NIMMessage * message = [self.messages safeObjectAtIndex1:indexPath.row];
|
||||
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||
AttachmentModel * attachment = obj.attachment;
|
||||
if(attachment.first == CustomMessageType_Initiat_Invitation && attachment.second == Custom_Message_Sub_Initiat_Invitation_Initiating_User){
|
||||
UserGameInfoVo *gameInfo = [UserGameInfoVo modelWithDictionary:attachment.data];
|
||||
|
||||
XPMineGameOrderDetailsView *orderView = [[XPMineGameOrderDetailsView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight) type:[gameInfo.toUid isEqualToString:[AccountInfoStorage instance].getUid] ? 1 : 0];
|
||||
orderView.gameInfo = gameInfo;
|
||||
orderView.isFormChat = YES;
|
||||
orderView.delegate = self;
|
||||
|
||||
[self.view addSubview:orderView];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#pragma mark - XPMineGameOrderDetailsViewDelegate
|
||||
@@ -899,6 +925,7 @@
|
||||
if (!_riskAlertView) {
|
||||
_riskAlertView = [[SessionRiskView alloc] init];
|
||||
_riskAlertView.delegate = self;
|
||||
_riskAlertView.hidden = YES;
|
||||
}
|
||||
return _riskAlertView;
|
||||
}
|
||||
@@ -941,7 +968,7 @@
|
||||
}
|
||||
- (UIView *)emptyVeiw{
|
||||
if(!_emptyVeiw){
|
||||
_emptyVeiw = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, kGetScaleWidth(10))];
|
||||
_emptyVeiw = [[UIView alloc]initWithFrame:CGRectZero];
|
||||
_emptyVeiw.hidden = YES;
|
||||
_emptyVeiw.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
|
@@ -11,7 +11,7 @@
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SessionListCell : UITableViewCell
|
||||
|
||||
@property(nonatomic,strong) NIMRecentSession *session;
|
||||
- (void)renderWithSession:(NIMRecentSession*)recent;
|
||||
|
||||
@end
|
||||
|
@@ -49,6 +49,7 @@
|
||||
}
|
||||
|
||||
- (void)renderWithSession:(NIMRecentSession *)recent {
|
||||
_session = recent;
|
||||
NIMUser *user = [[NIMSDK sharedSDK].userManager userInfo:recent.session.sessionId];
|
||||
NSString *avatarUrl = user.userInfo.avatarUrl;
|
||||
self.avatarImageView.imageUrl = avatarUrl;
|
||||
|
@@ -220,21 +220,6 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
|
||||
return 75.f;
|
||||
}
|
||||
|
||||
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
UITableViewRowAction * deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"置顶" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
|
||||
NIMRecentSession * session = [self.recentSessions safeObjectAtIndex1:indexPath.row];
|
||||
NIMDeleteMessagesOption * opt = [[NIMDeleteMessagesOption alloc] init];
|
||||
opt.removeSession = YES;
|
||||
[[NIMSDK sharedSDK].conversationManager deleteAllmessagesInSession:session.session option:opt];
|
||||
}];
|
||||
deleteAction.title = @"删除";
|
||||
deleteAction.backgroundColor = [UIColor redColor];
|
||||
return @[deleteAction];
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDataSource
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
@@ -246,10 +231,38 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
|
||||
SessionListCell * cell = [tableView dequeueReusableCellWithIdentifier:cellId];
|
||||
if (!cell) {
|
||||
cell = [[SessionListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
|
||||
UILongPressGestureRecognizer *longPressPR = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(longPressAction:)];
|
||||
longPressPR.minimumPressDuration = 1;
|
||||
cell.tag = indexPath.row;
|
||||
[cell addGestureRecognizer:longPressPR];
|
||||
}
|
||||
NIMRecentSession *recent = [self.recentSessions safeObjectAtIndex1:indexPath.row];
|
||||
[cell renderWithSession:recent];
|
||||
return cell;
|
||||
}
|
||||
// ⑥长按手势的回调方法
|
||||
- (void)longPressAction:(UILongPressGestureRecognizer *)sender{
|
||||
if(sender.state == UIGestureRecognizerStateBegan){
|
||||
TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
||||
config.title = @"提示";
|
||||
config.message = @"确定删除该聊天吗?";
|
||||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||||
SessionListCell * cell = (SessionListCell *)sender.view;
|
||||
NIMRecentSession * session = cell.session;
|
||||
|
||||
NIMSessionDeleteAllRemoteMessagesOptions *option = [[NIMSessionDeleteAllRemoteMessagesOptions alloc]init];
|
||||
|
||||
[[NIMSDK sharedSDK].conversationManager deleteAllRemoteMessagesInSession:session.session options:option completion:^(NSError * _Nullable error) {
|
||||
[[NIMSDK sharedSDK].conversationManager deleteRecentSession:session];
|
||||
}];
|
||||
} cancelHandler:^{
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
#pragma mark - NIMConversationManagerDelegate
|
||||
- (void)didLoadAllRecentSessionCompletion {
|
||||
@@ -434,6 +447,7 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
|
||||
_sessionListView.delegate = self;
|
||||
_sessionListView.dataSource = self;
|
||||
_sessionListView.showsVerticalScrollIndicator = NO;
|
||||
|
||||
}
|
||||
return _sessionListView;
|
||||
}
|
||||
|
@@ -51,15 +51,30 @@
|
||||
/// @param targetUid 目标用户的uid
|
||||
/// @param state 是否关注 yes 关注 NO 取消关注
|
||||
- (void)attentionUser:(NSString *)targetUid state:(BOOL)state {
|
||||
NSString * uid = [[AccountInfoStorage instance] getUid];
|
||||
NSString * ticket = [[AccountInfoStorage instance] getTicket];
|
||||
NSString * type = state ? @"1" : @"2";
|
||||
[Api attentionCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
[[self getView] attentionUserSuccess:state];
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kAttentionUserNotification" object:nil];
|
||||
}] uid:uid likedUid:targetUid ticket:ticket type:type];
|
||||
if(state == NO){
|
||||
TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
||||
config.title = @"提示";
|
||||
config.message = @"确定取消关注该用户吗?";
|
||||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||||
[self initiateAttentionUser:targetUid state:state];
|
||||
} cancelHandler:^{
|
||||
|
||||
}];
|
||||
return;
|
||||
}
|
||||
[self initiateAttentionUser:targetUid state:state];
|
||||
|
||||
|
||||
}
|
||||
-(void)initiateAttentionUser:(NSString *)targetUid state:(BOOL)state{
|
||||
NSString * uid = [[AccountInfoStorage instance] getUid];
|
||||
NSString * ticket = [[AccountInfoStorage instance] getTicket];
|
||||
NSString * type = state ? @"1" : @"2";
|
||||
[Api attentionCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
[[self getView] attentionUserSuccess:state];
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kAttentionUserNotification" object:nil];
|
||||
}] uid:uid likedUid:targetUid ticket:ticket type:type];
|
||||
}
|
||||
|
||||
- (void)getClanDetailInfo:(NSString *)uid {
|
||||
[Api getClanDetailInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
ClanDetailInfoModel * clanDetailInfo = [ClanDetailInfoModel modelWithDictionary:data.data];
|
||||
|
@@ -119,7 +119,7 @@
|
||||
[self.mainController.view addSubview:sessionVC.view];
|
||||
} else {
|
||||
SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:[NIMSession session:[NSString stringWithFormat:@"%ld", userInfo.uid] type:NIMSessionTypeP2P]];
|
||||
sessionVC.openType = SessionListOpenTypeRoom;
|
||||
sessionVC.openType = SessionListOpenTypeDefault;
|
||||
[self.navigationController pushViewController:sessionVC animated:YES];
|
||||
}
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPMineGameOrderDetailsView : UIView
|
||||
@property(nonatomic,weak) id<XPMineGameOrderDetailsViewDelegate>delegate;
|
||||
@property(nonatomic,assign) BOOL isHiddenBtn;
|
||||
@property(nonatomic,strong) UserGameInfoVo *gameInfo;
|
||||
@property(nonatomic,assign) BOOL isFormChat;
|
||||
-(instancetype)initWithFrame:(CGRect)frame type:(int)type;
|
||||
|
@@ -199,7 +199,16 @@
|
||||
[orderAtt insertAttributedString:[NSMutableAttributedString attributedStringWithAttachment:orderAttachment] atIndex:[NSString stringWithFormat:@"订单编号:%@ ",_gameInfo.orderNo].length];
|
||||
_orderNumView.attributedText = orderAtt;
|
||||
}
|
||||
|
||||
-(void)setIsHiddenBtn:(BOOL)isHiddenBtn{
|
||||
_isHiddenBtn = isHiddenBtn;
|
||||
if(_isHiddenBtn == YES){
|
||||
self.inviteBnt.hidden = YES;
|
||||
[self.bgView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.leading.trailing.equalTo(self);
|
||||
make.height.mas_equalTo(kGetScaleWidth(234));
|
||||
}];
|
||||
}
|
||||
}
|
||||
#pragma mark - 懒加载
|
||||
- (UIButton *)closeView{
|
||||
if(!_closeView){
|
||||
|
@@ -36,6 +36,7 @@
|
||||
///余额
|
||||
@property(nonatomic, copy)NSString *diamonds;
|
||||
@property(nonatomic,copy) NSString *chatId;
|
||||
@property(nonatomic,copy) NSArray *gameList;
|
||||
@end
|
||||
@implementation XPMineGameOrderVC
|
||||
- (__kindof id)createPresenter {
|
||||
@@ -81,6 +82,8 @@
|
||||
self.diamonds = model.diamonds;
|
||||
}
|
||||
} uid:[AccountInfoStorage instance].getUid ticket:[AccountInfoStorage instance].getTicket];
|
||||
|
||||
|
||||
}
|
||||
#pragma mark - JXCategoryViewDelegate
|
||||
- (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView {
|
||||
@@ -109,41 +112,49 @@
|
||||
}
|
||||
#pragma mark - XPMineGameOrderItemVCDelegate
|
||||
-(void)showGameOrderDetailsViewWithGameInfo:(UserGameInfoVo *)gameInfo type:(int)type{
|
||||
XPMineGameOrderDetailsView *detailsView = [[XPMineGameOrderDetailsView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight) type:type];
|
||||
detailsView.gameInfo = gameInfo;
|
||||
detailsView.delegate = self;
|
||||
[self.view addSubview:detailsView];
|
||||
}
|
||||
#pragma mark - XPMineGameOrderDetailsViewDelegate
|
||||
///再次邀请
|
||||
-(void)againinitiateInvitationWithGameInfo:(UserGameInfoVo *)gameInfo{
|
||||
[self showLoading];
|
||||
NSString *uid = [gameInfo.toUid isEqualToString:[AccountInfoStorage instance].getUid] ? gameInfo.fromUid : gameInfo.toUid;
|
||||
[Api requestGamePartnerInfoList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
[self hideHUD];
|
||||
if(code == 200){
|
||||
self.chatId = uid;
|
||||
NSArray *list = [UserGameInfoVo modelsWithArray:data.data];
|
||||
XPMinePlaceOrderView *orderVeiw = [[XPMinePlaceOrderView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||
self.gameList = [UserGameInfoVo modelsWithArray:data.data];
|
||||
|
||||
for (int i = 0; i < list.count; i++) {
|
||||
UserGameInfoVo *model = list[i];
|
||||
if([model.gameId isEqualToString:gameInfo.gameId]){
|
||||
orderVeiw.selectGameInfo = model;
|
||||
}
|
||||
XPMineGameOrderDetailsView *detailsView = [[XPMineGameOrderDetailsView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight) type:type];
|
||||
detailsView.gameInfo = gameInfo;
|
||||
|
||||
if(type == 0 && self.gameList.count == 0){
|
||||
detailsView.isHiddenBtn = YES;
|
||||
}
|
||||
orderVeiw.inning = gameInfo.inning;
|
||||
|
||||
orderVeiw.diamonds = self.diamonds;
|
||||
orderVeiw.gameList = list;
|
||||
orderVeiw.delegate = self;
|
||||
[self.view addSubview:orderVeiw];
|
||||
detailsView.delegate = self;
|
||||
[self.view addSubview:detailsView];
|
||||
return;
|
||||
}
|
||||
[self showErrorToast:msg];
|
||||
} uid:uid];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
#pragma mark - XPMineGameOrderDetailsViewDelegate
|
||||
///再次邀请
|
||||
-(void)againinitiateInvitationWithGameInfo:(UserGameInfoVo *)gameInfo{
|
||||
XPMinePlaceOrderView *orderVeiw = [[XPMinePlaceOrderView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||
for (int i = 0; i < self.gameList.count; i++) {
|
||||
UserGameInfoVo *model = self.gameList[i];
|
||||
if([model.gameId isEqualToString:gameInfo.gameId]){
|
||||
orderVeiw.selectGameInfo = model;
|
||||
}
|
||||
}
|
||||
orderVeiw.inning = gameInfo.inning;
|
||||
orderVeiw.diamonds = self.diamonds;
|
||||
orderVeiw.gameList = self.gameList;
|
||||
orderVeiw.delegate = self;
|
||||
[self.view addSubview:orderVeiw];
|
||||
|
||||
|
||||
}
|
||||
///发信息
|
||||
-(void)sendMessageHandleWithGameInfo:(UserGameInfoVo *)gameInfo{
|
||||
@@ -164,7 +175,6 @@
|
||||
#pragma mark - XPMinePlaceOrderViewDelegate
|
||||
///发起邀请
|
||||
-(void)initiateInvitationWithGameInfo:(UserGameInfoVo *)gameInfo count:(NSString *)count{
|
||||
NSString *uid = [gameInfo.toUid isEqualToString:[AccountInfoStorage instance].getUid] ? gameInfo.fromUid : gameInfo.toUid;
|
||||
[self.presenter initiateInvitationGameWithGameId:gameInfo.gameId gameUid:gameInfo.uid inning:count uid:[AccountInfoStorage instance].getUid];
|
||||
}
|
||||
///充值
|
||||
|
@@ -44,6 +44,7 @@
|
||||
}
|
||||
gameInfo.tags = tagList;
|
||||
}
|
||||
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
#pragma mark - UITableViewDelegate And UITableViewDataSource
|
||||
@@ -56,7 +57,7 @@
|
||||
UserGameInfoVo *gameInfo = [self.gameList safeObjectAtIndex1:indexPath.row];
|
||||
CGFloat height = 98;
|
||||
if(gameInfo.tags.count > 2){
|
||||
height = (gameInfo.tags.count - 2) * 22;
|
||||
height = height + (gameInfo.tags.count - 2) * 22;
|
||||
}
|
||||
return kGetScaleWidth(height);
|
||||
}
|
||||
|
@@ -497,16 +497,23 @@
|
||||
[self.navigationController pushViewController:payVC animated:YES];
|
||||
}
|
||||
-(void)sendInitiateInvitationGameSuccess{
|
||||
NSString * sessionId = [NSString stringWithFormat:@"%ld",self.uid];
|
||||
NIMSession * session = [NIMSession session:sessionId type:NIMSessionTypeP2P];
|
||||
SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:session];
|
||||
[self.navigationController pushViewController:sessionVC animated:YES];
|
||||
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
NSString * sessionId = [NSString stringWithFormat:@"%ld",self.uid];
|
||||
NIMSession * session = [NIMSession session:sessionId type:NIMSessionTypeP2P];
|
||||
SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:session];
|
||||
[self.navigationController pushViewController:sessionVC animated:YES];
|
||||
});
|
||||
|
||||
}
|
||||
- (void)consultingOrderSuccess{
|
||||
NSString * sessionId = [NSString stringWithFormat:@"%ld",self.uid];
|
||||
NIMSession * session = [NIMSession session:sessionId type:NIMSessionTypeP2P];
|
||||
SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:session];
|
||||
[self.navigationController pushViewController:sessionVC animated:YES];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
NSString * sessionId = [NSString stringWithFormat:@"%ld",self.uid];
|
||||
NIMSession * session = [NIMSession session:sessionId type:NIMSessionTypeP2P];
|
||||
SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:session];
|
||||
[self.navigationController pushViewController:sessionVC animated:YES];
|
||||
});
|
||||
|
||||
}
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setUid:(NSInteger)uid {
|
||||
|
@@ -254,7 +254,7 @@
|
||||
}
|
||||
|
||||
|
||||
if([self.inningView.text integerValue] <= 0){
|
||||
if([self.inningView.text integerValue] <= 1){
|
||||
self.inningView.text = @"1";
|
||||
if(self.path == nil)return;
|
||||
UserGameInfoVo *gameInfo = [self.gameList safeObjectAtIndex1:self.path.row];
|
||||
@@ -264,8 +264,9 @@
|
||||
return;
|
||||
}
|
||||
self.subtractBtn.enabled = YES;
|
||||
if([self.inningView.text integerValue] > 99){
|
||||
self.inningView.text = @"99";
|
||||
if([self.inningView.text integerValue] > 999){
|
||||
self.inningView.text = [self.inningView.text substringToIndex:3];
|
||||
[XCHUDTool showErrorWithMessage:@"下单的局数,不可超过3位数"];
|
||||
if(self.path == nil)return;
|
||||
UserGameInfoVo *gameInfo = [self.gameList safeObjectAtIndex1:self.path.row];
|
||||
NSInteger count = self.inningView.text.integerValue;
|
||||
@@ -296,8 +297,9 @@
|
||||
}
|
||||
-(void)addAction{
|
||||
NSInteger text = [self.inningView.text integerValue]+1;
|
||||
if(text > 99){
|
||||
text = 99;
|
||||
if(text > 999){
|
||||
[XCHUDTool showErrorWithMessage:@"下单的局数,不可超过3位数"];
|
||||
return;
|
||||
}
|
||||
self.inningView.text = @(text).stringValue;
|
||||
self.subtractBtn.enabled = text > 1;
|
||||
@@ -342,7 +344,18 @@
|
||||
}
|
||||
|
||||
[self.collectionView reloadData];
|
||||
[self.collectionView scrollToItemAtIndexPath:self.path atScrollPosition:UICollectionViewScrollPositionBottom animated:YES];
|
||||
|
||||
self.collectionView.hidden = YES;
|
||||
dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC));
|
||||
dispatch_after(delayTime, dispatch_get_main_queue(), ^{
|
||||
|
||||
CGFloat x = kGetScaleWidth(188) * self.path.row ;
|
||||
self.collectionView.contentOffset = CGPointMake(x, 0);
|
||||
self.collectionView.hidden = NO;
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
-(void)setDiamonds:(NSString *)diamonds{
|
||||
@@ -390,9 +403,9 @@
|
||||
if (!_collectionView) {
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
||||
layout.itemSize = CGSizeMake(kGetScaleWidth(176), 80);
|
||||
layout.itemSize = CGSizeMake(kGetScaleWidth(176), kGetScaleWidth(80));
|
||||
layout.minimumLineSpacing = kGetScaleWidth(12);
|
||||
layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
|
||||
layout.sectionInset = UIEdgeInsetsMake(0, kGetScaleWidth(16), 0, kGetScaleWidth(16));
|
||||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||||
_collectionView.dataSource = self;
|
||||
_collectionView.showsHorizontalScrollIndicator = NO;
|
||||
|
@@ -62,6 +62,7 @@
|
||||
make.bottom.mas_equalTo(-kGetScaleWidth(0));
|
||||
make.leading.trailing.equalTo(self.contentView).inset(kGetScaleWidth(16));
|
||||
}];
|
||||
|
||||
[self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.height.mas_equalTo(kGetScaleWidth(52));
|
||||
make.top.mas_equalTo(kGetScaleWidth(18));
|
||||
@@ -115,7 +116,7 @@
|
||||
- (void)setGameInfo:(UserGameInfoVo *)gameInfo{
|
||||
_gameInfo = gameInfo;
|
||||
_iconView.imageUrl = _gameInfo.logo;
|
||||
_payBtn.imageUrl = _gameInfo.btnRgb;
|
||||
_payBtn.imageUrl = _gameInfo.btnBg;
|
||||
[_payTitleBnt setTitleColor:UIColorFromRGB(0xBBBCBD) forState:UIControlStateNormal];
|
||||
self.tierView.textColor = UIColorFromRGB(0xBBBCBD);
|
||||
self.tierBgView.backgroundColor = [UIColor colorWithWhite:1 alpha:0.6];
|
||||
@@ -154,6 +155,19 @@
|
||||
_priceView.textAlignment = NSTextAlignmentRight;
|
||||
_priceView.attributedText = textAtt;
|
||||
_itemList = _gameInfo.tags;
|
||||
if(_itemList.count <= 1){
|
||||
[self.titleView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.equalTo(self.iconView.mas_trailing).mas_offset(kGetScaleWidth(14));
|
||||
make.top.mas_equalTo(kGetScaleWidth(20));
|
||||
make.height.mas_equalTo(kGetScaleWidth(22));
|
||||
}];
|
||||
}else{
|
||||
[self.titleView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.equalTo(self.iconView.mas_trailing).mas_offset(kGetScaleWidth(14));
|
||||
make.top.mas_equalTo(kGetScaleWidth(10));
|
||||
make.height.mas_equalTo(kGetScaleWidth(22));
|
||||
}];
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
@@ -181,6 +195,8 @@
|
||||
config.placeHolder = kImage(@"mine_user_game_cell_bg");
|
||||
_bgImageView = [[NetImageView alloc]initWithConfig:config];
|
||||
_bgImageView.userInteractionEnabled = YES;
|
||||
_bgImageView.layer.masksToBounds = YES;
|
||||
_bgImageView.layer.cornerRadius = kGetScaleWidth(12);
|
||||
}
|
||||
return _bgImageView;
|
||||
}
|
||||
|
@@ -144,6 +144,18 @@
|
||||
- (void)dealloc {
|
||||
[NSObject cancelPreviousPerformRequestsWithTarget:self];
|
||||
[[NIMSDK sharedSDK].broadcastManager removeDelegate:self];
|
||||
if(self.giftEffectTimer != nil){
|
||||
dispatch_resume(self.giftEffectTimer);
|
||||
self.giftEffectTimer = nil;
|
||||
}
|
||||
if(self.luckyprizeTimer != nil){
|
||||
dispatch_resume(self.luckyprizeTimer);
|
||||
self.luckyprizeTimer = nil;
|
||||
}
|
||||
if(self.giftTimer != nil){
|
||||
dispatch_resume(self.giftTimer);
|
||||
self.giftTimer = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
|
||||
|
@@ -395,17 +395,30 @@
|
||||
/// @param targetUid 目标用户的uid
|
||||
/// @param status 是否关注 yes 关注 NO 取消关注
|
||||
- (void)attentionUser:(NSString *)targetUid status:(BOOL)status {
|
||||
NSString * uid = [[AccountInfoStorage instance] getUid];
|
||||
NSString * ticket = [[AccountInfoStorage instance] getTicket];
|
||||
NSString * type = status ? @"1" : @"2";
|
||||
[Api attentionCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
self.attentionItem.isSelect = status;
|
||||
[[self getView] attentionUserSuccess:self.attentionItem];
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kAttentionUserNotification" object:nil];
|
||||
}] uid:uid likedUid:targetUid ticket:ticket type:type];
|
||||
if(status == NO){
|
||||
TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
||||
config.title = @"提示";
|
||||
config.message = @"确定取消关注该用户吗?";
|
||||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||||
[self initiateAttentionUser:targetUid status:status];
|
||||
} cancelHandler:^{
|
||||
|
||||
}];
|
||||
return;
|
||||
}
|
||||
[self initiateAttentionUser:targetUid status:status];
|
||||
}
|
||||
|
||||
|
||||
-(void)initiateAttentionUser:(NSString *)targetUid status:(BOOL)status{
|
||||
NSString * uid = [[AccountInfoStorage instance] getUid];
|
||||
NSString * ticket = [[AccountInfoStorage instance] getTicket];
|
||||
NSString * type = status ? @"1" : @"2";
|
||||
[Api attentionCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
self.attentionItem.isSelect = status;
|
||||
[[self getView] attentionUserSuccess:self.attentionItem];
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kAttentionUserNotification" object:nil];
|
||||
}] uid:uid likedUid:targetUid ticket:ticket type:type];
|
||||
}
|
||||
/// 加入黑名单
|
||||
/// @param targetUid 目标用户的uid
|
||||
/// @param roomId 房间的uid
|
||||
|
@@ -566,7 +566,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
[self.getKeyWindowNav.viewControllers enumerateObjectsUsingBlock:^(__kindof UIViewController * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if ([obj isKindOfClass:[SessionViewController class]]) {
|
||||
SessionViewController *chatVC = (SessionViewController *)obj;
|
||||
if(![gameInfo.toUid isEqualToString:chatVC.session.sessionId]){
|
||||
if([gameInfo.fromUid isEqualToString:chatVC.session.sessionId]){
|
||||
isInChat = YES;
|
||||
}
|
||||
*stop = YES;
|
||||
|
Reference in New Issue
Block a user