開黑點單 & Bug fix

This commit is contained in:
eggmanQQQ
2024-07-11 10:06:33 +08:00
parent e57895d3e3
commit fb58ff1ec7
46 changed files with 2363 additions and 120 deletions

View File

@@ -12,13 +12,10 @@
#import "AccountInfoStorage.h"
#import "XPMonentsLayoutConfig.h"
///View
#import "XPMineDataClanTableViewCell.h"
#import "XPMineDataGiftTableViewCell.h"
#import "XPMonentsTableViewCell.h"
#import "XPMonentsEmptyTableViewCell.h"
///Model
#import "ClanDetailInfoModel.h"
#import "UserInfoModel.h"
#import "MineSkillCardListInfoModel.h"
///P
@@ -28,7 +25,6 @@
///View
#import "XPMineUserInfoGiftWallViewController.h"
#import "XPMineClanViewController.h"
#import "XPMineGuildViewController.h"
#import "XPMonentsDetailViewController.h"
#import "XPMineUserInfoAlbumViewController.h"
@@ -37,15 +33,20 @@
#import "XPMineAlbumTableViewCell.h"
#import "XPMineMedalsTableViewCell.h"
#import "XPMineGiftsTableViewCell.h"
#import "XPMineDataGameMateTableViewCell.h"
#import "XPMineGameMateOrderView.h"
#import "MedalModel.h"
#import "XPMineGamePartnerInfoModel.h"
typedef enum : NSUInteger {
Album = 0,
Medal = 1,
Gifts = 2,
LuckyGifts = 3,
SectionTypeCount = 4
GameMate = 0,
Album = 1,
Medal = 2,
Gifts = 3,
LuckyGifts = 4,
SectionTypeCount = 5
} MineUserInfoPageSectionType;
@interface XPMineUserSectionHeader : UIView
@@ -144,19 +145,16 @@ typedef enum : NSUInteger {
@end
@interface XPMineUserDataViewController ()<XPMineUserDataProtocol, UITableViewDelegate, UITableViewDataSource, XPMineDataClanTableViewCellDelegate, XPMineDataGiftTableViewCellDelegate, XPMonentsTableViewCellDelegate, XPMonentsMineProtocol, XPMonentsDetailViewControllerDelegate>
@interface XPMineUserDataViewController ()<UITableViewDelegate, UITableViewDataSource, XPMineDataGiftTableViewCellDelegate, XPMonentsTableViewCellDelegate, XPMonentsMineProtocol, XPMonentsDetailViewControllerDelegate>
///
@property (nonatomic,strong) UITableView *tableView;
///
@property (nonatomic,strong) ClanDetailInfoModel *clanDetailInfo;
///
@property (nonatomic,assign) BOOL isFold;
@property (nonatomic,assign) BOOL isGiftsSectionExpand;
@property (nonatomic,assign) BOOL isLuckyGiftsSectionExpand;
@property (nonatomic, copy) void(^scrollCallback)(UIScrollView *scrollView);
///
@property (nonatomic,assign) BOOL isShowEnterClan;
///
@property (nonatomic,strong) NSMutableArray<MonentsInfoModel *> *datasource;
//@property (nonatomic,strong) UIView *headView;
@@ -165,11 +163,14 @@ typedef enum : NSUInteger {
///
@property (nonatomic,assign) BOOL isOpen;
@property (nonatomic, strong) XPMineUserSectionHeader *gameMateHeader;
@property (nonatomic, strong) XPMineUserSectionHeader *albumHeader;
@property (nonatomic, strong) XPMineUserSectionHeader *medalHeader;
@property (nonatomic, strong) XPMineUserSectionHeader *giftsHeader;
@property (nonatomic, strong) XPMineUserSectionHeader *luckyGiftsHeader;
@property (nonatomic, copy) NSArray<XPMineGamePartnerInfoModel *> *gameInfos;
@end
@implementation XPMineUserDataViewController
@@ -186,17 +187,10 @@ typedef enum : NSUInteger {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
// [self initHttpRequest];
[self initSubViews];
[self initSubViewConstraints];
}
#pragma mark - Http
- (void)initHttpRequest {
self.isOpen = self.userUid.integerValue == [[AccountInfoStorage instance]getUid].integerValue;
self.isFold = YES;
self.isShowEnterClan = NO;
[self.presenter getClanDetailInfo:self.userUid currentUserUid:[AccountInfoStorage instance].getUid];
}
#pragma mark - Private Method
- (void)initSubViews {
[self.view addSubview:self.tableView];
@@ -223,6 +217,24 @@ typedef enum : NSUInteger {
[self.tableView reloadData];
}
- (void)submitGameOrder:(XPMineGamePartnerInfoModel *)model round:(NSInteger)round {
@kWeakify(self);
[self showLoading];
[self.presenter submitOrder:^{
@kStrongify(self);
[self showSuccessToast:@"下单成功~"];
if (self.delegate) {
[self.delegate dismissGameOrderView];
}
} failure:^(NSString * _Nonnull msg) {
@kStrongify(self);
[self showErrorToast:msg];
}
gameId:model.gameId
gameUid:model.uid
inning:round];
}
#pragma mark - UITableViewDelegate And UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return SectionTypeCount;
@@ -230,6 +242,9 @@ typedef enum : NSUInteger {
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
switch (section) {
case GameMate:
return self.gameInfos.count;
break;
case Album:
return 1;
break;
@@ -250,6 +265,9 @@ typedef enum : NSUInteger {
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
switch (indexPath.section) {
case GameMate:
return 78.5;
break;
case Album:
return 90;
break;
@@ -273,6 +291,9 @@ typedef enum : NSUInteger {
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
switch (section) {
case GameMate:
return nil;
break;
case Album:
return nil;
break;
@@ -292,6 +313,9 @@ typedef enum : NSUInteger {
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
switch (section) {
case GameMate:
return 0;
break;
case Album:
return 0;
break;
@@ -310,16 +334,31 @@ typedef enum : NSUInteger {
}
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
if (section == Medal) {
return self.medalInfo.medalCount == 0 ? 0 : 30;
} else if (section == Gifts || section == LuckyGifts) {
return 50;
switch (section) {
case GameMate:
return self.gameInfos.count > 0 ? 30 : 0;
break;
case Album:
return 30;
break;
case Medal:
return self.medalInfo.medalCount == 0 ? 0 : 30;
break;
case Gifts:
return 50;
break;
case LuckyGifts:
return 50;
break;
default:
return 30;
break;
}
return 30;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
switch (section) {
case GameMate:
return self.gameInfos.count > 0 ? self.gameMateHeader : nil;
case Album:
return self.albumHeader;
break;
@@ -339,6 +378,19 @@ typedef enum : NSUInteger {
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
switch (indexPath.section) {
case GameMate: {
XPMineDataGameMateTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineDataGameMateTableViewCell class])
forIndexPath:indexPath];
cell.cellModel = [self.gameInfos xpSafeObjectAtIndex:indexPath.row];
@kWeakify(self);
[cell setDidTapOrder:^(XPMineGamePartnerInfoModel *model) {
if (self.delegate) {
[self.delegate showGameOrderView:model];
}
}];
return cell;
}
break;
case Album: {
XPMineAlbumTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineAlbumTableViewCell class])
forIndexPath:indexPath];
@@ -354,14 +406,14 @@ typedef enum : NSUInteger {
}
break;
case Gifts:{
XPMineGiftsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineGiftsTableViewCell class])];
XPMineGiftsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineGiftsTableViewCell class]) forIndexPath:indexPath];
cell.giftsDataSource = self.giftWall;
cell.isLucky = NO;
return cell;
}
break;
case LuckyGifts:{
XPMineGiftsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineGiftsTableViewCell class])];
XPMineGiftsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineGiftsTableViewCell class]) forIndexPath:indexPath];
cell.giftsDataSource = self.luckyGiftWall;
cell.isLucky = YES;
return cell;
@@ -495,33 +547,6 @@ typedef enum : NSUInteger {
}
}
#pragma mark - XPMineDataClanTableViewCellDelegate
- (void)xPMineDataClanTableViewCell:(XPMineDataClanTableViewCell *)view didClickFold:(UIButton *)sender {
self.isFold = !sender.selected;
[self.tableView reloadData];
// [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationNone];
}
- (void)xPMineDataClanTableViewCell:(XPMineDataClanTableViewCell *)view didClickOpen:(ClanDetailInfoModel *)clanInfo{
self.isOpen = YES;
[self.tableView reloadData];
}
- (void)xPMineDataClanTableViewCell:(XPMineDataClanTableViewCell *)view didClickEnter:(ClanDetailInfoModel *)clanInfo {
[self.presenter memberApplyHall:clanInfo.hall.hallId];
}
- (void)xPMineDataClanTableViewCell:(XPMineDataClanTableViewCell *)view didClickClanView:(ClanDetailInfoModel *)clanInfo {
XPMineClanViewController * clanVC = [[XPMineClanViewController alloc] init];
clanVC.uid = self.clanDetailInfo.clan.elderUid;
[self.navigationController pushViewController:clanVC animated:YES];
}
- (void)xPMineDataClanTableViewCell:(XPMineDataClanTableViewCell *)view didClickHallView:(ClanDetailInfoModel *)clanInfo {
XPMineGuildViewController * hallVC = [[XPMineGuildViewController alloc] init];
hallVC.ownerUid = clanInfo.hall.ownerUid;
hallVC.guildId = clanInfo.hall.hallId;
[self.navigationController pushViewController:hallVC animated:YES];
}
#pragma mark - XPMineDataGiftTableViewCellDelegate
- (void)xPMineDataGiftTableViewCell:(XPMineDataGiftTableViewCell *)view didClickMore:(UIButton *)sender {
XPMineUserInfoGiftWallViewController * giftWallVC = [[XPMineUserInfoGiftWallViewController alloc] init];
@@ -529,8 +554,6 @@ typedef enum : NSUInteger {
[self.navigationController pushViewController:giftWallVC animated:YES];
}
#pragma mark - JXPagingViewListViewDelegate
- (UIView *)listView {
return self.view;
@@ -548,22 +571,6 @@ typedef enum : NSUInteger {
self.scrollCallback(scrollView);
}
#pragma mark - XPMineUserDataProtocol
- (void)getClanDetailInfoSuccess:(ClanDetailInfoModel *)clanDetailInfo currentUserClanInfo:(ClanDetailInfoModel *)currentUserClanInfo {
self.clanDetailInfo = clanDetailInfo;
if (clanDetailInfo.hall.hallName.length > 0 && currentUserClanInfo.hall.hallName.length <= 0 && ![[AccountInfoStorage instance].getUid isEqualToString:self.userUid]) {
self.isShowEnterClan = YES;
} else {
self.isShowEnterClan = NO;
}
[self.tableView reloadData];
// [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:1] withRowAnimation:UITableViewRowAnimationNone];
}
- (void)memberApplyHallSuccess {
[self showSuccessToast:YMLocalizedString(@"XPMineUserDataViewController0")];
}
#pragma mark - Getters And Setters
- (void)setUserInfo:(UserInfoModel *)userInfo {
_userInfo = userInfo;
@@ -573,6 +580,13 @@ typedef enum : NSUInteger {
if (userInfo.uid != [[AccountInfoStorage instance].getUid integerValue]) {
self.albumHeader.hasMore = NO;
}
@kWeakify(self);
[self.presenter loadGamePartnerInfoList:^(NSArray<XPMineGamePartnerInfoModel *> * _Nonnull infos) {
@kStrongify(self);
self.gameInfos = infos;
[self.tableView reloadData];
} uid:userInfo.uid];
}
- (void)setDynamicInfo:(NSArray<MonentsInfoModel *> *)dynamicInfo {
[self.datasource removeAllObjects];
@@ -596,6 +610,8 @@ typedef enum : NSUInteger {
if (@available(iOS 11.0, *)) {
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
[_tableView registerClass:[XPMineDataGameMateTableViewCell class]
forCellReuseIdentifier:NSStringFromClass([XPMineDataGameMateTableViewCell class])];
[_tableView registerClass:[XPMineAlbumTableViewCell class]
forCellReuseIdentifier:NSStringFromClass([XPMineAlbumTableViewCell class])];
[_tableView registerClass:[XPMineMedalsTableViewCell class]
@@ -603,8 +619,6 @@ typedef enum : NSUInteger {
[_tableView registerClass:[XPMineGiftsTableViewCell class]
forCellReuseIdentifier:NSStringFromClass([XPMineGiftsTableViewCell class])];
[_tableView registerClass:[XPMonentsEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
[_tableView registerClass:[XPMonentsTableViewCell class] forCellReuseIdentifier:@"XPMonentsDynamicTableViewCell"];
[_tableView registerClass:[XPMineDataClanTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMineDataClanTableViewCell class])];
[_tableView registerClass:[XPMineDataGiftTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMineDataGiftTableViewCell class])];
if (isMSRTL()) {
_tableView.semanticContentAttribute = UISemanticContentAttributeForceRightToLeft;
@@ -620,6 +634,15 @@ typedef enum : NSUInteger {
return _datasource;
}
- (XPMineUserSectionHeader *)gameMateHeader {
if (!_gameMateHeader) {
_gameMateHeader = [[XPMineUserSectionHeader alloc] init];
_gameMateHeader.title = @"組隊開黑嘿嘿嘿嘿";//YMLocalizedString(@"QinputPhotoView1");
_gameMateHeader.hasMore = NO;
}
return _gameMateHeader;
}
- (XPMineUserSectionHeader *)albumHeader {
if (!_albumHeader) {
_albumHeader = [[XPMineUserSectionHeader alloc] init];