更换支付方式

This commit is contained in:
liyuhua
2023-08-10 12:09:54 +08:00
parent f8c778a14a
commit 9bcafa9086
16 changed files with 322 additions and 969 deletions

View File

@@ -24,7 +24,6 @@
#import "NSMutableDictionary+Saft.h"
#import "XPSkillCardPlayerManager.h"
#import "XCCurrentVCStackManager.h"
#import "CountDownHelper.h"
///Model
#import "RoomInfoModel.h"
#import "UserInfoModel.h"
@@ -37,7 +36,6 @@
#import "XPReceiveRedPacketModel.h"
#import "XPRedPacketModel.h"
#import "FirstChargeRoomWindowModel.h"
#import "XPFreeGiftModel.h"
///View
#import "BaseNavigationController.h"
#import "XPRoomActivityContainerView.h"
@@ -58,31 +56,24 @@
#import "AnchorRoomSrollTipView.h"
#import "XPReceiveRedPacketView.h"
#import "XPFirstRechargeView.h"
#import "XPWebViewController.h"
#import "SessionViewController.h"
#import "XPFreeGiftsObtainView.h"
///P
#import "XPRoomPresenter.h"
#import "XPRoomProtocol.h"
#import "XPWebViewController.h"
#import "RoomHostDelegate.h"
#import "RoomGuestDelegate.h"
#import "XNDJTDDLoadingTool.h"
#import "ClientConfig.h"
#import "LittleGameStageView.h"
#import "LittleGameScrollStageView.h"
#import "XPRoomLittleGameContainerView.h"
UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
UIKIT_EXTERN NSString * const kRoomMiniNotificationKey;
UIKIT_EXTERN NSString * kNewUserRechargeKey;
UIKIT_EXTERN NSString * kShowFirstRechargeView;
UIKIT_EXTERN NSString * const kFreeGiftCountdownNotification;
NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//
NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//退
@interface XPRoomViewController ()<XPRoomProtocol, RoomHostDelegate, NIMChatroomManagerDelegate, NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMLoginManagerDelegate, XPRoomSettingInputViewDelegate, AnchorRoomScrollViewDelegate, XPFirstRechargeViewDelegate,NIMBroadcastManagerDelegate,XPRoomLittleGameContainerViewDelegate,CountDownHelperDelegate>
@interface XPRoomViewController ()<XPRoomProtocol, RoomHostDelegate, NIMChatroomManagerDelegate, NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMLoginManagerDelegate, XPRoomSettingInputViewDelegate, AnchorRoomScrollViewDelegate, XPFirstRechargeViewDelegate>
///
@property (nonatomic,strong) XPRoomBackContainerView *backContainerView;
@@ -104,8 +95,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
@property (nonatomic,strong) XPRoomAnimationView *animationView;
///view
@property (nonatomic,strong) XPRoomFunctionContainerView *functionView;
///
@property (nonatomic,strong) XPRoomLittleGameContainerView *littleGameView;
///Uid
@property (nonatomic,copy) NSString * roomUid;
///id
@@ -137,10 +126,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
@property (nonatomic,assign) NSInteger anchorIndex;
@property (nonatomic,strong) XPFirstRechargeView *firstRechargeView;
@property (nonatomic,assign) BOOL isShowFirstRecharge;
///
@property (nonatomic,strong) XPFreeGiftModel *freeModel;
///
@property (nonatomic,strong) XPFreeGiftsObtainView *freeView;
@end
@implementation XPRoomViewController
@@ -214,13 +199,10 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
if([[XPRoomMiniManager shareManager] getRoomInfo]==nil){
[XPSkillCardPlayerManager shareInstance].isMineInMic = NO;
}
[[CountDownHelper shareHelper] stopCountDown];
[CountDownHelper shareHelper].delegate = nil;
[[NIMSDK sharedSDK].chatroomManager removeDelegate:self];
[[NIMSDK sharedSDK].chatManager removeDelegate:self];
[[NIMSDK sharedSDK].loginManager removeDelegate:self];
[[NIMSDK sharedSDK].conversationManager removeDelegate:self];
[[NIMSDK sharedSDK].broadcastManager removeDelegate:self];
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
@@ -248,8 +230,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self.presenter getNormalGiftList:self.roomUid];
///
[self.presenter getRoomSuperAdmin:self.roomUid];
///
[self.presenter getFreeGiftData];
///
[self.presenter getRoomFirstCharegWindow:self.roomUid];
//x
@@ -257,8 +237,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[[NIMSDK sharedSDK].chatManager addDelegate:self];
[[NIMSDK sharedSDK].loginManager addDelegate:self];
[[NIMSDK sharedSDK].conversationManager addDelegate:self];
[[NIMSDK sharedSDK].broadcastManager addDelegate:self];
[CountDownHelper shareHelper].delegate = self;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myGiftEffectUpdate:) name:kRoomGiftEffectUpdateNotificationKey object:nil];
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(showRoomFirstChargeWindowFormNot:) name:kShowFirstRechargeView object:nil];
[XPSkillCardPlayerManager shareInstance].isInRoom = YES;
@@ -272,13 +250,16 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[super viewWillAppear:animated];
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
}
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
self.freeView.hidden = YES;
}
- (void)viewDidDisappear:(BOOL)animated{
[super viewDidDisappear:animated];
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
[XPSkillCardPlayerManager shareInstance].isInRoomVC = NO;
}
@@ -298,7 +279,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
- (void)initSubViews {
self.view.backgroundColor = [UIColor clearColor];
[self.view addSubview:self.backContainerView];
[self.view addSubview:self.littleGameView];
[self.view addSubview:self.stageView];
[self.view addSubview:self.messageContainerView];
[self.view addSubview:self.quickMessageContainerView];
@@ -307,21 +287,13 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self.view addSubview:self.roomHeaderView];
[self.view addSubview:self.functionView];
[self.view addSubview:self.animationView];
self.activityContainerView.hidden = YES;
self.littleGameView.hidden = YES;
if ([ClientConfig shareConfig].canOpen) {
self.littleGameView.hidden = NO;
self.activityContainerView.hidden = NO;
}
}
- (void)initSubViewConstraints {
[self.backContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.view);
}];
[self.littleGameView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.view);
}];
[self.roomHeaderView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.mas_equalTo(self.view);
make.height.mas_equalTo(kNavigationHeight);
@@ -479,17 +451,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
self.stageView = nil;
self.stageView = [[AnchorStageView alloc] initWithDelegate:self];
}
}else if(self.roomInfo.type == RoomType_MiniGame) {
if (self.roomInfo.mgMicNum > 6 && ![self.stageView isKindOfClass:[LittleGameScrollStageView class]]) {
[self.stageView removeFromSuperview];
self.stageView = nil;
self.stageView = [[LittleGameScrollStageView alloc] initWithDelegate:self];
} else if (self.roomInfo.mgMicNum <= 6 && ![self.stageView isKindOfClass:[LittleGameStageView class]]) {
[self.stageView removeFromSuperview];
self.stageView = nil;
self.stageView = [[LittleGameStageView alloc] initWithDelegate:self];
}
}else if(self.roomInfo.hadChangeRoomType && ![self.stageView isKindOfClass:[SocialStageView class]]) {
}else if(self.roomInfo.hadChangeRoomType && ![self.stageView isKindOfClass:[SocialStageView class]]) {
[self.stageView removeFromSuperview];
self.stageView = nil;
self.stageView = [[SocialStageView alloc] initWithDelegate:self];
@@ -502,7 +464,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self.view insertSubview:self.stageView belowSubview:self.roomHeaderView];
}
[self.functionView updateRankViewConstraintsWityType:self.roomInfo.type];
if (self.roomInfo.type == RoomType_MiniGame) {
[self.stageView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.view);
@@ -521,22 +483,14 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
make.left.mas_equalTo(self.view);
make.right.mas_equalTo(self.activityContainerView.mas_left).offset(-10);
}];
self.quickMessageContainerView.hidden = YES;
[self.quickMessageContainerView mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(0);
}];
[self.activityContainerView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(65);
make.right.mas_equalTo(self.view);
make.bottom.mas_equalTo(self.quickMessageContainerView.mas_top).offset(-5);
make.width.mas_equalTo(80);
}];
} else {
self.quickMessageContainerView.hidden = NO;
[self.quickMessageContainerView mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(30);
}];
[self.stageView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.view);
make.top.mas_equalTo(self.roomHeaderView.mas_bottom);
@@ -608,29 +562,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
}];
}
#pragma mark - CountDownHelperDelegate
- (void)onCountdownFinish {
[[NSNotificationCenter defaultCenter]postNotificationName:kFreeGiftCountdownNotification object:nil userInfo:@{@"isCountdownFinish":@(YES)}];
if(self.freeModel.curStage.integerValue < self.freeModel.maxStage.integerValue){
[self.presenter getFreeGiftData];
}
if(self.freeModel.curStage.intValue == 0){
self.freeView.freeModel = self.freeModel;
if(!self.freeView.superview){
[kWindow addSubview:self.freeView];
}
}
}
- (void)onCountdownOpen:(int)time {
NSInteger seconds = time;
int hours = (seconds)%(24*3600)/3600;
int minutes = (seconds)%3600/60;
int second = (seconds)%60;
[[NSNotificationCenter defaultCenter]postNotificationName:kFreeGiftCountdownNotification object:nil userInfo:@{@"text":[NSString stringWithFormat:@"%02d:%02d:%02d",hours,minutes,second],@"isCountdownFinish":@(NO)}];
}
-(void)showRoomFirstChargeWindowFormNot:(NSNotification *)not{
if(not != nil){
NSDictionary *parameter = not.object;
@@ -731,7 +662,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self.activityContainerView onRoomEntered];
[self.menuContainerView onRoomEntered];
[self.backContainerView onRoomEntered];
[self.littleGameView onRoomEntered];
if ([XPRoomMiniManager shareManager].getRoomInfo.uid != self.roomUid.integerValue) {// 退
[self.presenter enterNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId] user:self.userInfo];
[self.functionView onRoomEntered];
@@ -800,7 +730,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self.activityContainerView onRoomEntered];
[self.menuContainerView onRoomEntered];
[self.backContainerView onRoomEntered];
[self.littleGameView onRoomEntered];
if ([XPRoomMiniManager shareManager].getRoomInfo.uid != self.roomUid.integerValue) {// 退
[self.presenter enterNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId] user:self.userInfo];
[self.functionView onRoomEntered];
@@ -852,9 +781,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
return NO;
}
}
-(void)requesstShieldingAction{
[self.presenter requesstShieldingWtihType:@"1" objId:[NSString stringWithFormat:@"%ld",self.roomInfo.uid]];
}
#pragma mark -
- (void)myGiftEffectUpdate:(NSNotification *)notification {
NSDictionary * dic = notification.object;
@@ -899,7 +826,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self.activityContainerView onRoomEntered];
[self.menuContainerView onRoomEntered];
[self.backContainerView onRoomEntered];
[self.littleGameView onRoomEntered];
self.quickMessageContainerView.titleArray = self.roomInfo.speakTemplate;
if ([XPRoomMiniManager shareManager].getRoomInfo.uid != self.roomUid.integerValue) {// 退
[self.presenter enterNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId] user:self.userInfo];
@@ -952,7 +878,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self.roomHeaderView onRoomEntered];
[self.activityContainerView onRoomEntered];
[self.backContainerView onRoomEntered];
[self.littleGameView onRoomEntered];
[self.functionView onRoomEntered];
[self.messageContainerView onRoomEntered];
self.quickMessageContainerView.titleArray = self.roomInfo.speakTemplate;
@@ -1123,7 +1048,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self.activityContainerView onRoomEntered];
[self.menuContainerView onRoomEntered];
[self.backContainerView onRoomEntered];
[self.littleGameView onRoomEntered];
if ([XPRoomMiniManager shareManager].getRoomInfo.uid != self.roomUid.integerValue) {// 退
[self.presenter enterNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId] user:self.userInfo];
[self.functionView onRoomEntered];
@@ -1179,29 +1103,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self.view bringSubviewToFront:view];
}
}
-(void)getFreeGiftDataSuccess:(XPFreeGiftModel *)freeModel{
self.freeModel = freeModel;
self.menuContainerView.freeModel = freeModel;
if(self.freeModel.curStage.integerValue < self.freeModel.maxStage.integerValue){
[CountDownHelper shareHelper].isCountdownFinish = NO;
[[CountDownHelper shareHelper] openCountdownWithTime:freeModel.curStageSecond.intValue];
}else{
if([CountDownHelper shareHelper].isCountdownFinish == NO){
[CountDownHelper shareHelper].isCountdownFinish = YES;
}
[[NSNotificationCenter defaultCenter]postNotificationName:kFreeGiftCountdownNotification object:nil userInfo:@{@"isHiddenCountdown":@(YES)}];
[[CountDownHelper shareHelper] stopCountDown];
}
if(self.freeModel.curStage.intValue > 0 && [[XPRoomMiniManager shareManager].curState isEqualToString:@"0"]){
self.freeView.freeModel = self.freeModel;
if(!self.freeView.superview){
[kWindow addSubview:self.freeView];
}
[XPRoomMiniManager shareManager].curState = nil;
}
}
- (void)getRoomFirstChargeWindowSuccess:(FirstChargeRoomWindowModel *)model{
if(model.needToShow == NO || model.showAfterSecond <= 0 || self.isShowFirstRecharge == YES)return;
self.isShowFirstRecharge = YES;
@@ -1227,8 +1129,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self cancelRoomArrangeMic];
[[RtcManager instance] exitRoom];
[self.presenter reportUserOutRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.uid]];
[self.littleGameView handleSelfInExitEvent];
[self.littleGameView destroyMG];
[self dismissViewControllerAnimated:YES completion:nil];
}
@@ -1328,7 +1228,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self.functionView onRoomUpdate];
[self.activityContainerView onRoomUpdate];
[self.messageContainerView onRoomUpdate];
[self.littleGameView onRoomUpdate];
} else {
if (self.roomInfo.type == RoomType_Anchor) {
[self changeStageViewOnAnchorRoom];
@@ -1340,7 +1239,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self.functionView onRoomUpdate];
[self.activityContainerView onRoomUpdate];
[self.messageContainerView onRoomUpdate];
[self.littleGameView onRoomUpdate];
}
}
break;
@@ -1383,7 +1281,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self.activityContainerView handleNIMNotificationMessage:message];
[self.menuContainerView handleNIMNotificationMessage:message];
[self.functionView handleNIMNotificationMessage:message];
[self.littleGameView handleNIMNotificationMessage:message];
if([self.stageView findMicroViewByUid:@(self.userInfo.uid).stringValue] != nil){
[XPSkillCardPlayerManager shareInstance].isMineInMic = YES;
}else{
@@ -1398,7 +1295,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self.menuContainerView handleNIMCustomMessage:message];
[self.activityContainerView handleNIMCustomMessage:message];
[self.functionView handleNIMCustomMessage:message];
[self.littleGameView handleNIMCustomMessage:message];
if (attachment.first == CustomMessageType_First_Recharge_Reward && attachment.second == Custom_Message_Sub_Room_First_Recharge_Reward) {
self.userInfo.isFirstCharge = NO;
[self.menuContainerView onRoomUpdate];
@@ -1426,8 +1322,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self cancelRoomArrangeMic];
[[RtcManager instance] exitRoom];
[self.presenter reportUserOutRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.uid]];
[self.littleGameView handleSelfInExitEvent];
[self.littleGameView destroyMG];
[self dismissViewControllerAnimated:YES completion:nil];
}
} else if (attachment.first == CustomMessageType_RedPacket) {
@@ -1444,57 +1338,17 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self.view addSubview:view];
[self.view bringSubviewToFront:view];
}
}else if(attachment.first == CustomMessageType_Free_Gift_Star_Reset_Time){
if(attachment.second == Custom_Message_Sub_Free_Gift_Star_Reset_Time){
[self.presenter getFreeGiftData];
[[NSNotificationCenter defaultCenter]postNotificationName:kFreeGiftCountdownNotification object:nil userInfo:@{@"isReset":@(YES)}];
}else if(attachment.second == Custom_Message_Sub_Update_Gift_Information){
[self.presenter getFreeGiftData];
[[NSNotificationCenter defaultCenter]postNotificationName:kFreeGiftCountdownNotification object:nil userInfo:@{@"updateGiftInfo":attachment.data ?: @""}];
}
}
}
[self.messageContainerView handleNIMCustomMessage:message];
}
} else if(message.messageType == NIMMessageTypeText) {
[self.messageContainerView handleNIMTextMessage:message];
[self.littleGameView handleNIMTextMessage:message];
} else if(message.messageType == NIMMessageTypeTip) {
[self.messageContainerView handleNIMTextMessage:message];
}
}
}
#pragma mark - NIMBroadcastDelegate
// 广
- (void)onReceiveBroadcastMessage:(NIMBroadcastMessage *)broadcastMessage{
if (![ClientConfig shareConfig].canOpen) {
return;
}
if (broadcastMessage.content) {
NSDictionary *msgDictionary = [broadcastMessage.content toJSONObject];
AttachmentModel *attachment = [AttachmentModel modelWithJSON:msgDictionary[@"body"]];
BOOL isHave = NO;
if(attachment.first == CustomMessageType_Graffiti_Star_Kitchen && attachment.second == Custom_Message_Sub_Star_Kitchen_FullScreen){
isHave = YES;
}else if(attachment.first == CustomMessageType_Look_Love && attachment.second == Custom_Message_Sub_Look_Love_InRoom_NeedAllMicSend){
}else if (attachment.first == CustomMessageType_Treasure_Fairy && (attachment.second == Custom_Message_Sub_Treasure_Fairy_Draw_Gift_L4 || attachment.second == Custom_Message_Sub_Treasure_Fairy_Draw_Gift_L5 || attachment.second == Custom_Message_Sub_Treasure_Fairy_Convert_L1 || attachment.second == Custom_Message_Sub_Treasure_Fairy_Convert_L2 || attachment.second == Custom_Message_Sub_Treasure_Fairy_Convert_L3)) { //
}else if (attachment.first == CustomMessageType_Tarot && (attachment.second == Custom_Message_Sub_Tarot_Advanced || attachment.second == Custom_Message_Sub_Tarot_Intermediate)){
isHave = YES;
}
if(isHave == NO)return;
attachment.isBroadcast = YES;
NIMMessage *message = [NIMMessage new];
NIMCustomObject *object = [NIMCustomObject new];
object.attachment = attachment;
message.messageObject = object;
[self.messageContainerView handleNIMTextMessage:message];
}
}
//
- (void)sendMessage:(NIMMessage *)message didCompleteWithError:(NSError *)error {
//
@@ -1515,7 +1369,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
if (message.messageType == NIMMessageTypeCustom) {
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
AttachmentModel * attachment = (AttachmentModel *)obj.attachment;
AttachmentModel * attachment = obj.attachment;
[self.stageView handleNIMCustomMessage:message];
[self.animationView handleNIMCustomMessage:message];
[self.functionView handleNIMCustomMessage:message];
@@ -1564,7 +1418,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
- (void)exitRoom {
[self.menuContainerView menuResignFirstResponder];
[self.animationView resumeTimer];
if (self.roomInfo.roomModeType == RoomModeType_Open_Micro_Mode || self.roomInfo.roomModeType == RoomModeType_Open_Blind) {
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.roomInfo.uid];
NSString * uid = [AccountInfoStorage instance].getUid;
@@ -1639,33 +1492,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self handleFirstOutRoom];
[self dismissViewControllerAnimated:YES completion:nil];
} roomUid:roomUid operUid:uid page:@"1" pageSize:@"50"];
}else if(self.roomInfo.type == RoomType_MiniGame) {
if ([self.littleGameView isInSudGame]) {
TTAlertConfig *config = [[TTAlertConfig alloc] init];
config.cancelButtonConfig.title = YMLocalizedString(@"XPRoomSettingInputView4");
config.confirmButtonConfig.title = YMLocalizedString(@"XPRoomSettingInputView5");
config.message = YMLocalizedString(@"XPRoomViewController14");
[TTPopup alertWithConfig:config confirmHandler:^{ //
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.presenter exitNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]];
[[RtcManager instance] exitRoom];
[self.littleGameView handleSelfInExitEvent];
[self.littleGameView destroyMG];
[self handleFirstOutRoom];
[self dismissViewControllerAnimated:YES completion:nil];
});
} cancelHandler:^{
}];
} else {
[self.presenter exitNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]];
[[RtcManager instance] exitRoom];
[self.littleGameView handleSelfInExitEvent];
[self.littleGameView destroyMG];
[self handleFirstOutRoom];
[self dismissViewControllerAnimated:YES completion:nil];
}
}
else {
} else {
[self.presenter exitNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]];
[[XPRoomMiniManager shareManager] resetLocalMessage];
[[RtcManager instance] exitRoom];
@@ -1676,57 +1503,18 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
}
- (void)miniRoom {
if(self.freeModel != nil){
[XPRoomMiniManager shareManager].curState = self.freeModel.curStage;
}
[self.menuContainerView menuResignFirstResponder];
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(showRoomFirstChargeWindow) object:nil];
NSDictionary *roomInfoDic = self.roomInfo.model2dictionary != nil ? self.roomInfo.model2dictionary : @{};
NSDictionary *userInfoDic = self.userInfo.model2dictionary != nil ? self.userInfo.model2dictionary : @{};
NSMutableDictionary *queueDic = self.getMicroQueue != nil ? self.getMicroQueue : [@{} mutableCopy];
if(self.roomInfo.type == RoomType_MiniGame) {
if ([self.littleGameView isInSudGame]) {
TTAlertConfig *config = [[TTAlertConfig alloc] init];
config.cancelButtonConfig.title = YMLocalizedString(@"XPRoomViewController15");
config.confirmButtonConfig.title = YMLocalizedString(@"XPRoomViewController16");
config.message = YMLocalizedString(@"XPRoomViewController17");
[TTPopup alertWithConfig:config confirmHandler:^{ //
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[[XPRoomMiniManager shareManager] configRoomInfo:self.roomInfo];
[[XPRoomMiniManager shareManager] configUserInfo:self.userInfo];
[[XPRoomMiniManager shareManager] configCurrentMusic:self.functionView.getCurrentMusic isPlaying:self.functionView.isPlaying];
NSDictionary * dic = @{@"roomInfo":roomInfoDic, @"userInfo":userInfoDic, @"microQueue":queueDic};
[[NSNotificationCenter defaultCenter] postNotificationName:kRoomMiniNotificationKey object:nil userInfo:dic];
[self.view endEditing:YES];
[self.littleGameView handleSelfInExitEvent];
[self.littleGameView destroyMG];
[self handleFirstOutRoom];
[self dismissViewControllerAnimated:YES completion:nil];
});
} cancelHandler:^{
}];
} else {
[[XPRoomMiniManager shareManager] configRoomInfo:self.roomInfo];
[[XPRoomMiniManager shareManager] configUserInfo:self.userInfo];
[[XPRoomMiniManager shareManager] configCurrentMusic:self.functionView.getCurrentMusic isPlaying:self.functionView.isPlaying];
NSDictionary * dic = @{@"roomInfo":roomInfoDic, @"userInfo":userInfoDic, @"microQueue":queueDic};
[[NSNotificationCenter defaultCenter] postNotificationName:kRoomMiniNotificationKey object:nil userInfo:dic];
[self.view endEditing:YES];
[self.littleGameView handleSelfInExitEvent];
[self.littleGameView destroyMG];
[self handleFirstOutRoom];
[self dismissViewControllerAnimated:YES completion:nil];
}
}else {
[[XPRoomMiniManager shareManager] configRoomInfo:self.roomInfo];
[[XPRoomMiniManager shareManager] configUserInfo:self.userInfo];
[[XPRoomMiniManager shareManager] configCurrentMusic:self.functionView.getCurrentMusic isPlaying:self.functionView.isPlaying];
NSDictionary * dic = @{@"roomInfo":roomInfoDic, @"userInfo":userInfoDic, @"microQueue":queueDic};
[[NSNotificationCenter defaultCenter] postNotificationName:kRoomMiniNotificationKey object:nil userInfo:dic];
[self.view endEditing:YES];
[self handleFirstOutRoom];
[self dismissViewControllerAnimated:YES completion:nil];
}
[self.menuContainerView menuResignFirstResponder];
[[XPRoomMiniManager shareManager] configRoomInfo:self.roomInfo];
[[XPRoomMiniManager shareManager] configUserInfo:self.userInfo];
[[XPRoomMiniManager shareManager] configCurrentMusic:self.functionView.getCurrentMusic isPlaying:self.functionView.isPlaying];
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
[dic safeSetObject:self.roomInfo.model2dictionary forKey:@"roomInfo"];
[dic safeSetObject:self.userInfo.model2dictionary forKey:@"userInfo"];
[dic safeSetObject:self.getMicroQueue forKey:@"microQueue"];
[[NSNotificationCenter defaultCenter] postNotificationName:kRoomMiniNotificationKey object:nil userInfo:dic];
[self.view endEditing:YES];
[self handleFirstOutRoom];
[self dismissViewControllerAnimated:YES completion:nil];
}
- (UINavigationController *)getCurrentNav {
@@ -1782,11 +1570,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[[NSNotificationCenter defaultCenter] postNotificationName:kNewUserRechargeKey object:nil];
}
}
#pragma mark - XPRoomLittleGameContainerViewDelegate
- (void)hiddenSudGamePostionView {
[self.functionView hiddenSudGamePostionView];
}
#pragma mark - AnchorRoomScrollViewDelegate
- (void)anchorScrollViewScrollToNext:(AnchorRoomScrollView *)anchorScrollView {
if (!self) {
@@ -1852,8 +1635,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self.activityContainerView onRoomEntered];
[self.menuContainerView onRoomEntered];
[self.backContainerView onRoomEntered];
[self.littleGameView onRoomEntered];
[self.littleGameView onRoomEntered];
if ([XPRoomMiniManager shareManager].getRoomInfo.uid != self.roomUid.integerValue) {// 退
[self.presenter enterNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId] user:self.userInfo];
[self.functionView onRoomEntered];
@@ -1874,11 +1655,9 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self.menuContainerView onRoomEntered];
[self changeStageViewOnRoomUpdate];
[self.backContainerView onRoomEntered];
[self.littleGameView onRoomEntered];
[self.functionView onRoomEntered];
[self.presenter enterNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId] user:self.userInfo];
[self.messageContainerView onRoomEntered];
[self.littleGameView onRoomEntered];
[[XPRoomMiniManager shareManager] configRoomInfo:nil];
[[XPRoomMiniManager shareManager] configUserInfo:nil];
[[XPRoomMiniManager shareManager] configCurrentMusic:nil isPlaying:NO];
@@ -1893,52 +1672,13 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self enterRoomFail:0];
}
}
#pragma mark - XPFirstRechargeViewDelegate
-(void)rechargeHandle{
XPWebViewController * vc =[[XPWebViewController alloc] initWithCustomizeNav:YES];
NSString *channel = @"p";
channel = [NSString stringWithFormat:@"%@a",channel];
channel = [NSString stringWithFormat:@"%@y",channel];
NSString *url = [NSString stringWithFormat:URLWithType(kChannelUrl),channel,@"6",[YYUtility deviceID]];
vc.url = url;
vc.isPush = YES;
vc.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:vc animated:YES completion:nil];
}
-(void)contactCustomerService{
TTAlertConfig *config = [[TTAlertConfig alloc]init];
config.title = YMLocalizedString(@"XPIAPRechargeViewController7");
config.message = YMLocalizedString(@"XPIAPRechargeViewController8");
TTAlertButtonConfig *confirmButtonConfig = [[TTAlertButtonConfig alloc]init];
confirmButtonConfig.title = YMLocalizedString(@"XPIAPRechargeViewController9");
UIImage *image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x13E2F5),UIColorFromRGB(0x9DB4FF),UIColorFromRGB(0xCC67FF)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(200, 200)];
confirmButtonConfig.backgroundColor = [UIColor colorWithPatternImage:image];
confirmButtonConfig.cornerRadius = 38/2;
config.confirmButtonConfig = confirmButtonConfig;
[TTPopup alertWithConfig:config confirmHandler:^{
[self requestContactCustomerService];
} cancelHandler:^{
}];
}
-(void)requestContactCustomerService{
[XNDJTDDLoadingTool showLoading];
[Api requestContactCustomerServiceCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
[XNDJTDDLoadingTool hideHUD];
if(code == 200){
NSString *uid = [NSString stringWithFormat:@"%@",data.data];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NIMSession * session = [NIMSession session:uid type:NIMSessionTypeP2P];
SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:session];
[self.getCurrentNav pushViewController:sessionVC animated:YES];
});
}
}];
XPWebViewController * webVC =[[XPWebViewController alloc] initWithCustomizeNav:YES];
webVC.url = [NSString stringWithFormat:URLWithType(kThirdPartyPay),@"6",[YYUtility deviceID]];
webVC.isPush = YES;
webVC.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:webVC animated:YES completion:nil];
}
- (XPRoomBackContainerView *)backContainerView {
if (!_backContainerView) {
@@ -2002,13 +1742,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
}
return _stageView;
}
- (XPRoomLittleGameContainerView *)littleGameView {
if (!_littleGameView) {
_littleGameView = [[XPRoomLittleGameContainerView alloc] initWithDelegate:self];
_littleGameView.delegate = self;
}
return _littleGameView;
}
- (AnchorRoomScrollView *)anchorScrollView {
if (!_anchorScrollView) {
_anchorScrollView = [[AnchorRoomScrollView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
@@ -2044,10 +1778,5 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
}
return _firstRechargeView;
}
-(XPFreeGiftsObtainView *)freeView{
if (!_freeView){
_freeView = [[XPFreeGiftsObtainView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
}
return _freeView;
}
@end