2021-09-16 19:30:22 +08:00
|
|
|
//
|
|
|
|
// XPMineViewController.m
|
|
|
|
// xplan-ios
|
|
|
|
//
|
|
|
|
// Created by 冯硕 on 2021/9/16.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "XPMineViewController.h"
|
|
|
|
///Third
|
|
|
|
#import <Masonry/Masonry.h>
|
2021-09-17 19:41:09 +08:00
|
|
|
#import <flutter_boost/FlutterBoost.h>
|
2021-09-16 19:30:22 +08:00
|
|
|
///Tool
|
2022-01-21 19:47:46 +08:00
|
|
|
#import "TTPopup.h"
|
2021-09-16 19:30:22 +08:00
|
|
|
#import "XPMacro.h"
|
2021-09-17 19:41:09 +08:00
|
|
|
#import "XPHtmlUrl.h"
|
|
|
|
#import "UIButton+EnlargeTouchArea.h"
|
2022-01-11 11:28:04 +08:00
|
|
|
#import "StatisticsServiceHelper.h"
|
2022-01-26 15:51:19 +08:00
|
|
|
#import "XPConstant.h"
|
2022-01-21 19:47:46 +08:00
|
|
|
#import "Api+Room.h"
|
2022-07-26 19:09:14 +08:00
|
|
|
#import "Api+RoomSetting.h"
|
|
|
|
#import "AccountInfoStorage.h"
|
2021-09-16 19:30:22 +08:00
|
|
|
///Model
|
|
|
|
#import "XPMineItemModel.h"
|
2021-09-23 18:38:33 +08:00
|
|
|
#import "UserInfoModel.h"
|
2022-01-26 15:51:19 +08:00
|
|
|
#import "XPMineVisitorUnReadModel.h"
|
2022-04-14 00:35:31 +08:00
|
|
|
#import "ClanDetailInfoModel.h"
|
2022-07-22 18:48:23 +08:00
|
|
|
#import "HomeBannerInfoModel.h"
|
|
|
|
#import "XPMineFuntionItemModel.h"
|
|
|
|
#import "LittleGameInfoModel.h"
|
|
|
|
#import "WalletInfoModel.h"
|
2022-07-26 19:09:14 +08:00
|
|
|
#import "HomeLittleGameRoomModel.h"
|
2021-09-16 19:30:22 +08:00
|
|
|
///P
|
|
|
|
#import "XPMineProtocol.h"
|
|
|
|
#import "XPMinePresent.h"
|
|
|
|
///View
|
2022-01-19 16:04:46 +08:00
|
|
|
#import "XPMineHeadItemTableViewCell.h"
|
2021-09-16 19:30:22 +08:00
|
|
|
#import "XPMineHeadView.h"
|
2022-01-21 19:47:46 +08:00
|
|
|
#import "XPLittleGameRoomOpenView.h"
|
2022-07-22 18:48:23 +08:00
|
|
|
#import "XPMineGameTableViewCell.h"
|
|
|
|
#import "XPHomeBannerTableViewCell.h"
|
2021-09-17 19:41:09 +08:00
|
|
|
///VC
|
|
|
|
#import "XPMineSettingViewController.h"
|
2021-09-22 18:30:15 +08:00
|
|
|
#import "XPMineTeenagerViewController.h"
|
2021-09-23 18:38:33 +08:00
|
|
|
#import "XPMineUserInfoViewController.h"
|
2021-09-24 19:17:19 +08:00
|
|
|
#import "XPMineRechargeViewController.h"
|
2021-09-17 19:41:09 +08:00
|
|
|
#import "XPWebViewController.h"
|
2021-10-14 21:10:04 +08:00
|
|
|
#import "XPRoomViewController.h"
|
2021-12-16 19:02:31 +08:00
|
|
|
#import "XPMineDressUpViewController.h"
|
2021-12-21 18:10:33 +08:00
|
|
|
#import "XPMineFansViewController.h"
|
|
|
|
#import "XPMineAttentionViewController.h"
|
2021-12-28 17:32:27 +08:00
|
|
|
#import "XPNobleCenterViewController.h"
|
2022-01-19 16:04:46 +08:00
|
|
|
#import "XPMatchManageViewController.h"
|
2022-01-19 18:58:30 +08:00
|
|
|
#import "XPSkillCardViewController.h"
|
2022-01-26 11:51:06 +08:00
|
|
|
#import "XPMineVisitorViewController.h"
|
2022-04-08 16:16:38 +08:00
|
|
|
#import "XPMineFansTeamViewController.h"
|
2022-04-06 21:52:38 +08:00
|
|
|
#import "XPMineClanViewController.h"
|
2022-04-14 00:35:31 +08:00
|
|
|
#import "XPMineGuildViewController.h"
|
2022-07-26 11:08:01 +08:00
|
|
|
#import "XPMineFootPrintViewController.h"
|
2022-01-19 16:04:46 +08:00
|
|
|
|
2022-07-22 18:48:23 +08:00
|
|
|
@interface XPMineViewController ()<UITableViewDelegate, UITableViewDataSource, XPMineProtocol, XPMineHeadItemTableViewCellDelegate, XPMineHeadViewDelegate, XPMineGameTableViewCellDelegate, XPHomeBannerTableViewCellDelegate>
|
2022-01-19 16:04:46 +08:00
|
|
|
///顶部背景
|
|
|
|
@property (nonatomic, strong) UIView *bgImageView;
|
2021-09-22 18:30:15 +08:00
|
|
|
|
2021-09-16 19:30:22 +08:00
|
|
|
@property (nonatomic,strong) UITableView *tableView;
|
2022-07-22 18:48:23 +08:00
|
|
|
///个人功能
|
|
|
|
@property (nonatomic, strong) NSMutableArray<XPMineFuntionItemModel *> *functionArray;
|
|
|
|
///游戏列表
|
|
|
|
@property (nonatomic, strong) NSMutableArray<LittleGameInfoModel *> *littleGameArray;
|
|
|
|
///banner列表
|
|
|
|
@property (nonatomic, strong) NSMutableArray<HomeBannerInfoModel *> *bannerArray;
|
2021-09-16 19:30:22 +08:00
|
|
|
///头部
|
|
|
|
@property (nonatomic,strong) XPMineHeadView *headView;
|
|
|
|
///设置
|
|
|
|
@property (nonatomic,strong) UIButton *settingButton;
|
2022-04-14 00:35:31 +08:00
|
|
|
///用户信息
|
2021-09-18 20:05:02 +08:00
|
|
|
@property (nonatomic,strong) UserInfoModel *userInfo;
|
2022-04-14 00:35:31 +08:00
|
|
|
///家族信息
|
|
|
|
@property (nonatomic,strong) ClanDetailInfoModel *clanInfo;
|
|
|
|
///我的公会
|
|
|
|
@property (nonatomic,strong) XPMineItemModel *guildItemModel;
|
2021-09-16 19:30:22 +08:00
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation XPMineViewController
|
|
|
|
|
2022-01-26 15:51:19 +08:00
|
|
|
|
|
|
|
- (void)dealloc {
|
|
|
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
|
|
}
|
|
|
|
|
2021-09-16 19:30:22 +08:00
|
|
|
- (BOOL)isHiddenNavBar {
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (XPMinePresent *)createPresenter {
|
|
|
|
return [[XPMinePresent alloc] init];;
|
|
|
|
}
|
|
|
|
|
2022-01-26 15:51:19 +08:00
|
|
|
- (instancetype)init {
|
|
|
|
if (self = [super init]) {
|
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onVisitorUnReadCountUpdate:) name:kVisitorUnReadCountNotificationKey object:nil];
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2021-09-16 19:30:22 +08:00
|
|
|
- (void)viewDidLoad {
|
2021-09-22 18:30:15 +08:00
|
|
|
[super viewDidLoad];
|
2021-09-16 19:30:22 +08:00
|
|
|
[self initSubViews];
|
|
|
|
[self initSubViewConstraints];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)viewWillAppear:(BOOL)animated {
|
|
|
|
[super viewWillAppear:animated];
|
|
|
|
[self.presenter getUserInfo];
|
2022-07-22 18:48:23 +08:00
|
|
|
[self.presenter getPersonItemList];
|
|
|
|
[self.presenter getLittleGameList];
|
|
|
|
[self.presenter getMineBannerList];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)viewDidAppear:(BOOL)animated {
|
|
|
|
[super viewDidAppear:animated];
|
|
|
|
[self.presenter getUserWalletInfo];
|
2021-09-16 19:30:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - Response
|
|
|
|
- (void)settingButtonAction:(UIButton *)sender {
|
2021-09-17 19:41:09 +08:00
|
|
|
XPMineSettingViewController * settingVC = [[XPMineSettingViewController alloc] init];
|
2021-09-18 20:05:02 +08:00
|
|
|
settingVC.userInfo = self.userInfo;
|
2021-09-17 19:41:09 +08:00
|
|
|
[self.navigationController pushViewController:settingVC animated:YES];
|
2021-09-16 19:30:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - Private Method
|
|
|
|
- (void)initSubViews {
|
2022-01-19 16:04:46 +08:00
|
|
|
[self.view addSubview:self.bgImageView];
|
2021-09-16 19:30:22 +08:00
|
|
|
[self.view addSubview:self.tableView];
|
|
|
|
[self.view addSubview:self.settingButton];
|
|
|
|
self.tableView.tableHeaderView = self.headView;
|
2022-01-19 16:29:07 +08:00
|
|
|
if (@available(iOS 15.0, *)) {//移除iOS15列表头默认增加的22高度
|
|
|
|
self.tableView.sectionHeaderTopPadding = 0;
|
|
|
|
}
|
2021-09-16 19:30:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)initSubViewConstraints {
|
2022-01-19 16:04:46 +08:00
|
|
|
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.left.right.top.mas_equalTo(0);
|
|
|
|
}];
|
2021-09-16 19:30:22 +08:00
|
|
|
[self.settingButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.size.mas_equalTo(CGSizeMake(18, 18));
|
|
|
|
make.right.mas_equalTo(self.view).offset(-14);
|
|
|
|
make.top.mas_equalTo(self.view).offset(kSafeAreaTopHeight + 29);
|
|
|
|
}];
|
|
|
|
|
|
|
|
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.top.mas_equalTo(self.view);
|
|
|
|
make.left.right.bottom.mas_equalTo(self.view);
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
|
2022-07-22 18:48:23 +08:00
|
|
|
- (void)pushViewControllerWithType:(NSInteger)type functionItem:(XPMineFuntionItemModel *)item {
|
2021-09-16 19:30:22 +08:00
|
|
|
switch (type) {
|
2022-01-19 16:04:46 +08:00
|
|
|
case XPMineItemType_Match_Manage: {
|
|
|
|
XPMatchManageViewController *vc = [[XPMatchManageViewController alloc] init];
|
|
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
|
|
}
|
|
|
|
break;
|
2021-09-16 19:30:22 +08:00
|
|
|
case XPMineItemType_Match_Relevance_Account:
|
2022-07-22 18:48:23 +08:00
|
|
|
[self pushWebViewWIthUrl:item.centerUrl];
|
2021-09-16 19:30:22 +08:00
|
|
|
break;
|
2022-07-26 11:08:01 +08:00
|
|
|
case XPMineItemType_Foot_Print:
|
|
|
|
{
|
|
|
|
XPMineFootPrintViewController *vc = [[XPMineFootPrintViewController alloc] init];
|
|
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
|
|
}
|
|
|
|
break;
|
2021-09-16 19:30:22 +08:00
|
|
|
case XPMineItemType_Teenager_Mode:
|
2021-09-22 18:30:15 +08:00
|
|
|
{
|
|
|
|
XPMineTeenagerViewController * vc = [[XPMineTeenagerViewController alloc] init];
|
|
|
|
vc.userInfo = self.userInfo;
|
|
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
|
|
}
|
2021-09-16 19:30:22 +08:00
|
|
|
break;
|
2021-09-17 19:41:09 +08:00
|
|
|
case XPMineItemType_Account:
|
2021-09-24 19:17:19 +08:00
|
|
|
{
|
2021-10-25 10:22:40 +08:00
|
|
|
XPMineRechargeViewController * rechargeVC = [[XPMineRechargeViewController alloc] init];
|
|
|
|
[self.navigationController pushViewController:rechargeVC animated:YES];
|
2021-09-24 19:17:19 +08:00
|
|
|
}
|
2021-09-17 19:41:09 +08:00
|
|
|
break;
|
|
|
|
case XPMineItemType_Personinfo:
|
2021-09-23 18:38:33 +08:00
|
|
|
{
|
|
|
|
XPMineUserInfoViewController * infoVC = [[XPMineUserInfoViewController alloc] init];
|
|
|
|
infoVC.uid = self.userInfo.uid;
|
|
|
|
[self.navigationController pushViewController:infoVC animated:YES];
|
|
|
|
}
|
2021-09-16 19:30:22 +08:00
|
|
|
break;
|
2021-11-04 15:27:11 +08:00
|
|
|
case XPMineItemType_My_Room:
|
|
|
|
{
|
|
|
|
NSString* roomUid = [NSString stringWithFormat:@"%ld", (long)self.userInfo.uid];
|
2022-01-21 19:47:46 +08:00
|
|
|
[Api getRoomInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
|
|
|
if (code == 200) {
|
|
|
|
RoomInfoModel * roomInfo = [RoomInfoModel modelWithJSON:data.data];
|
|
|
|
if (roomInfo.isReselect) {
|
|
|
|
XPLittleGameRoomOpenView * roomOpenView = [[XPLittleGameRoomOpenView alloc] init];
|
2022-01-22 11:35:44 +08:00
|
|
|
roomOpenView.roomInfo = roomInfo;
|
|
|
|
roomOpenView.currentVC = self;
|
2022-01-21 19:47:46 +08:00
|
|
|
[TTPopup popupView:roomOpenView style:TTPopupStyleActionSheet];
|
|
|
|
} else {
|
|
|
|
[XPRoomViewController openRoom:roomUid viewController:self];
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
[self showErrorToast:msg];
|
|
|
|
}
|
|
|
|
} uid:roomUid intoUid:roomUid];
|
2021-11-04 15:27:11 +08:00
|
|
|
}
|
|
|
|
break;
|
2021-12-16 19:02:31 +08:00
|
|
|
case XPMineItemType_My_Dressup:
|
|
|
|
{
|
|
|
|
XPMineDressUpViewController * dressUpVC = [[XPMineDressUpViewController alloc] init];
|
|
|
|
[self.navigationController pushViewController:dressUpVC animated:YES];
|
|
|
|
}
|
|
|
|
break;
|
2021-12-21 18:10:33 +08:00
|
|
|
case XPMineItemType_Fans_List:
|
|
|
|
{
|
|
|
|
XPMineFansViewController * fansVC = [[XPMineFansViewController alloc] init];
|
|
|
|
[self.navigationController pushViewController:fansVC animated:YES];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case XPMineItemType_Attention_List:
|
|
|
|
{
|
|
|
|
XPMineAttentionViewController * attentionVC = [[XPMineAttentionViewController alloc] init];
|
|
|
|
[self.navigationController pushViewController:attentionVC animated:YES];
|
|
|
|
}
|
|
|
|
break;
|
2021-12-28 17:32:27 +08:00
|
|
|
case XPMineItemType_Noble_Center:
|
|
|
|
{
|
|
|
|
XPNobleCenterViewController *nobleCenterVC = [[XPNobleCenterViewController alloc] init];
|
|
|
|
[self.navigationController pushViewController:nobleCenterVC animated:YES];
|
2022-01-19 18:58:30 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case XPMineItemType_Skill_Card:
|
|
|
|
{
|
|
|
|
XPSkillCardViewController *skillCardVC = [[XPSkillCardViewController alloc] init];
|
|
|
|
skillCardVC.uid = self.userInfo.uid;
|
|
|
|
[self.navigationController pushViewController:skillCardVC animated:YES];
|
2022-01-26 11:51:06 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case XPMineItemType_Visitor:
|
|
|
|
{
|
2022-01-26 15:51:19 +08:00
|
|
|
[self.tabBarItem setBadgeValue:nil];
|
2022-07-22 18:48:23 +08:00
|
|
|
for (XPMineFuntionItemModel * model in self.functionArray) {
|
|
|
|
if (model.skipType == XPMineItemType_Visitor) {
|
2022-01-26 15:51:19 +08:00
|
|
|
model.unReadCount = 0;
|
|
|
|
}
|
|
|
|
}
|
2022-01-26 11:51:06 +08:00
|
|
|
XPMineVisitorViewController *visitorVC = [[XPMineVisitorViewController alloc] init];
|
|
|
|
[self.navigationController pushViewController:visitorVC animated:YES];
|
2022-04-08 16:16:38 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case XPMineItemType_FansTeam: {
|
|
|
|
XPMineFansTeamViewController *fansTeamVc = [[XPMineFansTeamViewController alloc] init];
|
|
|
|
[self.navigationController pushViewController:fansTeamVc animated:YES];
|
2021-12-28 17:32:27 +08:00
|
|
|
}
|
|
|
|
break;
|
2022-04-06 21:52:38 +08:00
|
|
|
case XPMineItemType_My_Guild:
|
|
|
|
{
|
2022-04-14 00:35:31 +08:00
|
|
|
if (self.clanInfo.clan.elderUid.length > 0) {
|
|
|
|
XPMineClanViewController * clanVC = [[XPMineClanViewController alloc] init];
|
|
|
|
clanVC.uid = [NSString stringWithFormat:@"%ld", self.userInfo.uid];
|
|
|
|
[self.navigationController pushViewController:clanVC animated:YES];
|
|
|
|
} else if(self.clanInfo.hall.hallId.length > 0) {
|
|
|
|
XPMineGuildViewController * guildVC = [[XPMineGuildViewController alloc] init];
|
|
|
|
guildVC.ownerUid = self.clanInfo.hall.ownerUid;
|
|
|
|
guildVC.guildId = self.clanInfo.hall.hallId;
|
|
|
|
[self.navigationController pushViewController:guildVC animated:YES];
|
|
|
|
}
|
|
|
|
|
2022-04-06 21:52:38 +08:00
|
|
|
}
|
|
|
|
break;
|
2021-09-16 19:30:22 +08:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2021-09-17 19:41:09 +08:00
|
|
|
|
|
|
|
- (void)pushWebViewWIthUrl:(NSString *)url {
|
|
|
|
XPWebViewController * webVC = [[XPWebViewController alloc] init];
|
|
|
|
webVC.url = url;
|
|
|
|
[self.navigationController pushViewController:webVC animated:YES];
|
|
|
|
}
|
|
|
|
|
2021-09-16 19:30:22 +08:00
|
|
|
#pragma mark - UITableViewDelegate And UITableViewDataSource
|
2022-07-22 18:48:23 +08:00
|
|
|
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
|
|
|
return 3;
|
2021-09-16 19:30:22 +08:00
|
|
|
}
|
|
|
|
|
2022-07-22 18:48:23 +08:00
|
|
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
|
|
|
return 1;
|
2021-09-16 19:30:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
|
if (indexPath.section == 0) {
|
2022-07-22 18:48:23 +08:00
|
|
|
return 172;
|
|
|
|
} else if (indexPath.section == 1) {
|
|
|
|
return 129;
|
|
|
|
} else {
|
|
|
|
return 80;
|
|
|
|
}
|
2021-09-16 19:30:22 +08:00
|
|
|
return 53;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
|
if (indexPath.section == 0) {
|
2022-01-19 16:04:46 +08:00
|
|
|
XPMineHeadItemTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineHeadItemTableViewCell class])];
|
2021-09-16 19:30:22 +08:00
|
|
|
if (cell == nil) {
|
2022-01-19 16:04:46 +08:00
|
|
|
cell = [[XPMineHeadItemTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineHeadItemTableViewCell class])];
|
2021-09-16 19:30:22 +08:00
|
|
|
}
|
2022-07-22 18:48:23 +08:00
|
|
|
if (self.functionArray.count) {
|
|
|
|
cell.datasource = self.functionArray;
|
|
|
|
}
|
2021-09-16 19:30:22 +08:00
|
|
|
cell.delegate = self;
|
|
|
|
return cell;
|
2022-07-22 18:48:23 +08:00
|
|
|
} else if (indexPath.section == 1) {
|
|
|
|
XPMineGameTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineGameTableViewCell class])];
|
2021-09-16 19:30:22 +08:00
|
|
|
if (cell == nil) {
|
2022-07-22 18:48:23 +08:00
|
|
|
cell = [[XPMineGameTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineGameTableViewCell class])];
|
2021-09-16 19:30:22 +08:00
|
|
|
}
|
2022-07-22 18:48:23 +08:00
|
|
|
if (self.littleGameArray.count) {
|
|
|
|
cell.datasource = self.littleGameArray;
|
|
|
|
}
|
|
|
|
cell.delegate = self;
|
2021-09-16 19:30:22 +08:00
|
|
|
return cell;
|
2022-07-22 18:48:23 +08:00
|
|
|
} else {
|
|
|
|
XPHomeBannerTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPHomeBannerTableViewCell class])];
|
|
|
|
if (cell == nil) {
|
|
|
|
cell = [[XPHomeBannerTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPHomeBannerTableViewCell class])];
|
|
|
|
}
|
|
|
|
if (self.bannerArray.count) {
|
|
|
|
cell.bannerList = self.bannerArray;
|
|
|
|
}
|
|
|
|
cell.delegate = self;
|
|
|
|
return cell;
|
|
|
|
}
|
2021-09-16 19:30:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
|
2022-01-19 16:29:07 +08:00
|
|
|
return 16;
|
2021-09-16 19:30:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
|
|
|
|
UIView * view = [[UIView alloc] init];
|
|
|
|
view.backgroundColor = [UIColor clearColor];
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - XPMineHeadViewDelegate
|
|
|
|
///点击头像
|
|
|
|
- (void)xPMineHeadView:(XPMineHeadView *)view didClickAvatar:(UserInfoModel *)info {
|
2022-07-22 18:48:23 +08:00
|
|
|
[self pushViewControllerWithType:XPMineItemType_Personinfo functionItem:nil];
|
2021-09-17 19:41:09 +08:00
|
|
|
}
|
|
|
|
|
2022-07-22 18:48:23 +08:00
|
|
|
///点击了粉丝
|
|
|
|
- (void)xpMineHeadViewClickFans {
|
|
|
|
[self pushViewControllerWithType:XPMineItemType_Fans_List functionItem:nil];
|
2021-09-17 19:41:09 +08:00
|
|
|
}
|
|
|
|
|
2022-07-22 18:48:23 +08:00
|
|
|
///点击了关注
|
|
|
|
- (void)xpMineHeadViewClickAttention {
|
|
|
|
[self pushViewControllerWithType:XPMineItemType_Attention_List functionItem:nil];
|
2021-09-16 19:30:22 +08:00
|
|
|
}
|
|
|
|
|
2022-07-22 18:48:23 +08:00
|
|
|
///点击了技能卡
|
|
|
|
- (void)xpMineHeadViewClickSkillCard {
|
|
|
|
[self pushViewControllerWithType:XPMineItemType_Skill_Card functionItem:nil];
|
2021-12-21 18:10:33 +08:00
|
|
|
}
|
|
|
|
|
2022-07-22 18:48:23 +08:00
|
|
|
///点击了访客
|
|
|
|
- (void)xpMineHeadViewClickVisitor {
|
|
|
|
[self pushViewControllerWithType:XPMineItemType_Visitor functionItem:nil];
|
2021-12-21 18:10:33 +08:00
|
|
|
}
|
2022-01-06 17:50:59 +08:00
|
|
|
|
2022-07-22 18:48:23 +08:00
|
|
|
///点击了足迹
|
|
|
|
- (void)xpMineHeadViewClickFootprint {
|
2022-07-26 11:08:01 +08:00
|
|
|
[self pushViewControllerWithType:XPMineItemType_Foot_Print functionItem:nil];
|
2022-07-22 18:48:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
///点击了账户中心
|
|
|
|
- (void)xpMineHeadViewClickAcount {
|
|
|
|
[self pushViewControllerWithType:XPMineItemType_Account functionItem:nil];
|
|
|
|
}
|
|
|
|
|
|
|
|
///点击了贵族中心
|
2022-01-06 17:50:59 +08:00
|
|
|
- (void)xPMineHeadViewCliekNobleCenter {
|
2022-01-11 11:28:04 +08:00
|
|
|
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventvipEntranceMeClick];
|
2022-07-22 18:48:23 +08:00
|
|
|
[self pushViewControllerWithType:XPMineItemType_Noble_Center functionItem:nil];
|
2022-01-06 17:50:59 +08:00
|
|
|
}
|
|
|
|
|
2021-09-16 19:30:22 +08:00
|
|
|
#pragma mark - XPMineProtocol
|
2022-07-22 18:48:23 +08:00
|
|
|
///获取个人中心功能
|
|
|
|
- (void)onGetMineFuntionItemSuccess:(NSArray<XPMineFuntionItemModel *> *)items {
|
|
|
|
[self.functionArray removeAllObjects];
|
|
|
|
[self.functionArray addObjectsFromArray:items];
|
2022-07-25 18:16:45 +08:00
|
|
|
[self.functionArray enumerateObjectsUsingBlock:^(XPMineFuntionItemModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
|
if (obj.skipType == XPMineItemType_Collect_Room | obj.skipType == XPMineItemType_CP) {
|
|
|
|
[self.functionArray removeObject:obj];
|
|
|
|
}
|
|
|
|
}];
|
2022-07-22 18:48:23 +08:00
|
|
|
[self.tableView reloadData];
|
2021-09-16 19:30:22 +08:00
|
|
|
}
|
|
|
|
|
2022-07-22 18:48:23 +08:00
|
|
|
///获取小游戏列表
|
|
|
|
- (void)onGetLittleGameListSuccess:(NSArray<LittleGameInfoModel *> *)items {
|
|
|
|
[self.littleGameArray removeAllObjects];
|
|
|
|
[self.littleGameArray addObjectsFromArray:items];
|
|
|
|
[self.tableView reloadData];
|
|
|
|
}
|
|
|
|
|
|
|
|
///获取个人中心banner
|
|
|
|
- (void)onGetPersonalBannerListSuccess:(NSArray<HomeBannerInfoModel *> *)items {
|
|
|
|
[self.bannerArray removeAllObjects];
|
|
|
|
[self.bannerArray addObjectsFromArray:items];
|
2022-01-19 16:04:46 +08:00
|
|
|
[self.tableView reloadData];
|
2021-09-16 19:30:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo {
|
2021-09-18 20:05:02 +08:00
|
|
|
self.userInfo = userInfo;
|
2021-09-16 19:30:22 +08:00
|
|
|
self.headView.userInfo = userInfo;
|
2022-01-19 16:29:07 +08:00
|
|
|
[self.tableView reloadData];
|
2021-09-16 19:30:22 +08:00
|
|
|
}
|
2022-01-19 16:04:46 +08:00
|
|
|
|
2022-07-22 18:48:23 +08:00
|
|
|
- (void)getUserWalletInfo:(WalletInfoModel *)balanceInfo {
|
|
|
|
self.headView.walletInfo = balanceInfo;
|
|
|
|
}
|
|
|
|
|
2022-04-14 00:35:31 +08:00
|
|
|
- (void)onGetClanDetailInfoSuccess:(ClanDetailInfoModel *)clanInfo {
|
|
|
|
self.clanInfo = clanInfo;
|
2022-07-22 18:48:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
///匹配游戏房成功
|
2022-07-26 19:09:14 +08:00
|
|
|
- (void)quickMatchLittleGameRoomSuccess:(HomeLittleGameRoomModel *)roomInfo mgId:(NSString *)mgId {
|
|
|
|
if (roomInfo.isPick && roomInfo.uid.length > 0) {
|
|
|
|
[XPRoomViewController openRoom:roomInfo.uid viewController:self];
|
|
|
|
} else if (roomInfo.needOpenSelfRoom) {
|
|
|
|
NSString* roomUid = [NSString stringWithFormat:@"%ld", (long)self.userInfo.uid];
|
|
|
|
[Api getRoomInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
|
|
|
if (code == 200) {
|
|
|
|
RoomInfoModel * roomInfo = [RoomInfoModel modelWithJSON:data.data];
|
|
|
|
if (roomInfo.mgId != [mgId intValue]) {///更新房间游戏类型
|
|
|
|
NSMutableDictionary * params = [NSMutableDictionary dictionary];
|
|
|
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
|
|
|
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
|
|
|
[params setObject:ticket forKey:@"ticket"];
|
|
|
|
[params setObject:uid forKey:@"uid"];
|
|
|
|
[params setObject:[NSString stringWithFormat:@"%ld", roomInfo.uid] forKey:@"roomUid"];
|
|
|
|
if (roomInfo.title.length > 0) {
|
|
|
|
[params setObject:roomInfo.title forKey:@"title"];
|
|
|
|
}
|
|
|
|
if (roomInfo.roomPwd.length > 0) {
|
|
|
|
[params setObject:roomInfo.roomPwd forKey:@"roomPwd"];
|
|
|
|
} else{
|
|
|
|
[params setObject:@"" forKey:@"roomPwd"];
|
|
|
|
}
|
|
|
|
if (roomInfo.tagId > 0) {
|
|
|
|
[params setObject:[NSString stringWithFormat:@"%ld", roomInfo.tagId] forKey:@"tagId"];
|
|
|
|
}
|
|
|
|
[params setObject:@(RoomType_MiniGame) forKey:@"type"];
|
|
|
|
[params setObject:mgId forKey:@"mgId"];
|
|
|
|
[params setObject:@(roomInfo.hasAnimationEffect) forKey:@"hasAnimationEffect"];
|
|
|
|
[Api ownerUpdateRoomInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
|
|
|
if (code == 200) {
|
|
|
|
[XPRoomViewController openRoom:[AccountInfoStorage instance].getUid mgId:mgId viewController:self];
|
|
|
|
}
|
|
|
|
} params:params];
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
[self showErrorToast:msg];
|
|
|
|
}
|
|
|
|
} uid:roomUid intoUid:roomUid];
|
2022-07-22 18:48:23 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///匹配游戏房失败
|
|
|
|
- (void)quickMatchLittleGameRoomFail:(NSString *)mgId {
|
|
|
|
[XPRoomViewController openRoom:[NSString stringWithFormat:@"%ld", self.userInfo.uid] mgId:mgId viewController:self];
|
2022-04-14 00:35:31 +08:00
|
|
|
}
|
|
|
|
|
2022-01-19 16:04:46 +08:00
|
|
|
#pragma mark - XPMineHeadItemTableViewCellDelegate
|
2022-07-22 18:48:23 +08:00
|
|
|
- (void)xPMineHeadItemTableViewCell:(XPMineHeadItemTableViewCell *)cell didSelectItem:(XPMineFuntionItemModel *)item {
|
|
|
|
[self pushViewControllerWithType:item.skipType functionItem:item];
|
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - XPHomeBannerTableViewCellDelegate
|
|
|
|
///点击了某个banner
|
|
|
|
- (void)xPHomeBannerTableViewCell:(XPHomeBannerTableViewCell *)view didClickBanner:(HomeBannerInfoModel *)info {
|
|
|
|
switch (info.skipType) {
|
|
|
|
case HomeBannerInfoSkipType_Room:
|
|
|
|
{
|
|
|
|
if (info.skipUri.length > 0) {
|
|
|
|
[XPRoomViewController openRoom:info.skipUri viewController:self];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HomeBannerInfoSkipType_Web:
|
|
|
|
{
|
|
|
|
XPWebViewController *vc = [[XPWebViewController alloc]init];
|
|
|
|
vc.url = info.skipUri;
|
|
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - XPMineGameTableViewCellDelegate
|
|
|
|
///选择了某个游戏
|
|
|
|
- (void)xPMineGameTableViewCell:(XPMineGameTableViewCell *)cell didSelectItem:(LittleGameInfoModel *)item {
|
|
|
|
[self.presenter quickMatchLittleGameWithMgId:item.mgId];
|
2021-09-16 19:30:22 +08:00
|
|
|
}
|
2022-01-19 16:04:46 +08:00
|
|
|
|
2022-01-26 15:51:19 +08:00
|
|
|
#pragma mark - NSNotification
|
|
|
|
- (void)onVisitorUnReadCountUpdate:(NSNotification *)noti {
|
|
|
|
XPMineVisitorUnReadModel *model = (XPMineVisitorUnReadModel *)noti.object;
|
|
|
|
if (model.visitNum > 0) {
|
|
|
|
[self.tabBarItem setBadgeValue:[NSString stringWithFormat:@"%ld", model.visitNum]];
|
|
|
|
} else {
|
|
|
|
[self.tabBarItem setBadgeValue:nil];
|
|
|
|
}
|
|
|
|
|
2022-07-22 18:48:23 +08:00
|
|
|
for (int i = 0; i<self.functionArray.count; i++) {
|
|
|
|
XPMineFuntionItemModel * item = [self.functionArray objectAtIndex:i];
|
|
|
|
if (item.skipType == XPMineItemType_Visitor) {
|
2022-01-26 15:51:19 +08:00
|
|
|
item.unReadCount = model.visitNum;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
[self.tableView reloadData];
|
|
|
|
}
|
|
|
|
|
2021-09-16 19:30:22 +08:00
|
|
|
#pragma mark - Getters And Setters
|
|
|
|
- (UITableView *)tableView {
|
|
|
|
if (!_tableView) {
|
|
|
|
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
|
|
|
_tableView.delegate = self;
|
|
|
|
_tableView.dataSource = self;
|
|
|
|
_tableView.showsVerticalScrollIndicator = NO;
|
|
|
|
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
2022-07-22 18:48:23 +08:00
|
|
|
[_tableView registerClass:[XPMineGameTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMineGameTableViewCell class])];
|
2022-01-19 16:04:46 +08:00
|
|
|
[_tableView registerClass:[XPMineHeadItemTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMineHeadItemTableViewCell class])];
|
2022-07-22 18:48:23 +08:00
|
|
|
[_tableView registerClass:[XPHomeBannerTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPHomeBannerTableViewCell class])];
|
2021-09-16 19:30:22 +08:00
|
|
|
_tableView.backgroundColor = [UIColor clearColor];
|
|
|
|
}
|
|
|
|
return _tableView;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (XPMineHeadView *)headView {
|
|
|
|
if (!_headView) {
|
2022-07-22 18:48:23 +08:00
|
|
|
CGFloat height = (KScreenWidth - 30 - 17) * 0.5 * 64 / 164;
|
|
|
|
_headView = [[XPMineHeadView alloc] initWithFrame:CGRectMake(0, 0,KScreenWidth , 123 + height + kSafeAreaTopHeight + 50)];
|
2021-09-16 19:30:22 +08:00
|
|
|
_headView.delegate = self;
|
|
|
|
}
|
|
|
|
return _headView;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UIButton *)settingButton {
|
|
|
|
if (!_settingButton) {
|
|
|
|
_settingButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
[_settingButton setImage:[UIImage imageNamed:@"mine_nav_setting"] forState:UIControlStateNormal];
|
|
|
|
[_settingButton setImage:[UIImage imageNamed:@"mine_nav_setting"] forState:UIControlStateSelected];
|
|
|
|
[_settingButton addTarget:self action:@selector(settingButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
2021-09-17 19:41:09 +08:00
|
|
|
[_settingButton setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10];
|
2021-09-16 19:30:22 +08:00
|
|
|
}
|
|
|
|
return _settingButton;
|
|
|
|
}
|
|
|
|
|
2022-01-19 16:04:46 +08:00
|
|
|
- (UIView *)bgImageView {
|
|
|
|
if (!_bgImageView) {
|
|
|
|
_bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mine_head_bg"]];
|
|
|
|
_bgImageView.contentMode = UIViewContentModeScaleAspectFill;
|
|
|
|
}
|
|
|
|
return _bgImageView;
|
|
|
|
}
|
2021-09-16 19:30:22 +08:00
|
|
|
|
2022-07-22 18:48:23 +08:00
|
|
|
- (NSMutableArray<XPMineFuntionItemModel *> *)functionArray {
|
|
|
|
if (!_functionArray) {
|
|
|
|
_functionArray = [NSMutableArray array];
|
2022-01-19 16:29:07 +08:00
|
|
|
}
|
2022-07-22 18:48:23 +08:00
|
|
|
return _functionArray;
|
2022-01-19 16:29:07 +08:00
|
|
|
}
|
|
|
|
|
2022-07-22 18:48:23 +08:00
|
|
|
- (NSMutableArray<LittleGameInfoModel *> *)littleGameArray {
|
|
|
|
if (!_littleGameArray) {
|
|
|
|
_littleGameArray = [NSMutableArray array];
|
|
|
|
}
|
|
|
|
return _littleGameArray;
|
2022-04-14 00:35:31 +08:00
|
|
|
}
|
|
|
|
|
2022-07-22 18:48:23 +08:00
|
|
|
- (NSMutableArray<HomeBannerInfoModel *> *)bannerArray {
|
|
|
|
if (!_bannerArray) {
|
|
|
|
_bannerArray = [NSMutableArray array];
|
|
|
|
}
|
|
|
|
return _bannerArray;
|
2022-04-14 00:35:31 +08:00
|
|
|
}
|
|
|
|
|
2021-09-16 19:30:22 +08:00
|
|
|
@end
|