2023-07-14 18:50:55 +08:00
|
|
|
//
|
2023-08-10 16:25:34 +08:00
|
|
|
// XPMineUserDataViewController.m
|
|
|
|
// xplan-ios
|
2023-07-14 18:50:55 +08:00
|
|
|
//
|
2023-08-10 16:25:34 +08:00
|
|
|
// Created by 冯硕 on 2022/4/14.
|
2023-07-14 18:50:55 +08:00
|
|
|
//
|
|
|
|
|
|
|
|
#import "XPMineUserDataViewController.h"
|
|
|
|
///Third
|
|
|
|
#import <Masonry/Masonry.h>
|
|
|
|
///Tool
|
|
|
|
#import "AccountInfoStorage.h"
|
2023-08-10 16:25:34 +08:00
|
|
|
#import "XPMonentsLayoutConfig.h"
|
2023-07-14 18:50:55 +08:00
|
|
|
///View
|
2023-08-10 16:25:34 +08:00
|
|
|
|
2023-07-14 18:50:55 +08:00
|
|
|
#import "XPMineDataClanTableViewCell.h"
|
|
|
|
#import "XPMineDataGiftTableViewCell.h"
|
2023-08-10 16:25:34 +08:00
|
|
|
#import "XPMonentsTableViewCell.h"
|
|
|
|
#import "XPMonentsEmptyTableViewCell.h"
|
2023-07-14 18:50:55 +08:00
|
|
|
///Model
|
|
|
|
#import "ClanDetailInfoModel.h"
|
|
|
|
#import "UserInfoModel.h"
|
2023-08-10 16:25:34 +08:00
|
|
|
#import "MineSkillCardListInfoModel.h"
|
2023-07-14 18:50:55 +08:00
|
|
|
///P
|
|
|
|
#import "XPMineUserDataPresenter.h"
|
|
|
|
#import "XPMineUserDataProtocol.h"
|
2023-08-10 16:25:34 +08:00
|
|
|
#import "XPMonentsMineProtocol.h"
|
2023-07-14 18:50:55 +08:00
|
|
|
///View
|
2023-08-10 16:25:34 +08:00
|
|
|
|
2023-07-14 18:50:55 +08:00
|
|
|
#import "XPMineUserInfoGiftWallViewController.h"
|
|
|
|
#import "XPMineClanViewController.h"
|
|
|
|
#import "XPMineGuildViewController.h"
|
2023-08-10 16:25:34 +08:00
|
|
|
#import "XPMonentsDetailViewController.h"
|
2024-06-25 19:18:51 +08:00
|
|
|
#import "XPMineUserInfoAlbumViewController.h"
|
2024-06-25 15:08:14 +08:00
|
|
|
|
|
|
|
#import "XPMineDataGiftTableViewCell.h"
|
|
|
|
#import "XPMineAlbumTableViewCell.h"
|
|
|
|
#import "XPMineMedalsTableViewCell.h"
|
2024-06-25 17:24:32 +08:00
|
|
|
#import "XPMineGiftsTableViewCell.h"
|
2024-06-25 15:08:14 +08:00
|
|
|
|
|
|
|
#import "MedalModel.h"
|
|
|
|
|
|
|
|
typedef enum : NSUInteger {
|
|
|
|
Album = 0,
|
|
|
|
Medal = 1,
|
|
|
|
Gifts = 2,
|
|
|
|
LuckyGifts = 3,
|
|
|
|
SectionTypeCount = 4
|
|
|
|
} MineUserInfoPageSectionType;
|
|
|
|
|
|
|
|
@interface XPMineUserSectionHeader : UIView
|
|
|
|
|
|
|
|
@property (nonatomic, copy) NSString *title;
|
|
|
|
@property (nonatomic, copy) NSString *num;
|
|
|
|
@property (nonatomic, assign) BOOL hasMore;
|
|
|
|
@property (nonatomic, copy) void(^didTapMore)(void);
|
|
|
|
|
|
|
|
@property (nonatomic, strong) UILabel *titleLabel;
|
|
|
|
@property (nonatomic, strong) UILabel *numLabel;
|
|
|
|
@property (nonatomic, strong) UIButton *arrowButton;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation XPMineUserSectionHeader
|
|
|
|
|
|
|
|
- (instancetype)init
|
|
|
|
{
|
|
|
|
if (self = [super init]) {
|
|
|
|
self.frame = CGRectMake(0, 0, KScreenWidth, 20);
|
|
|
|
|
|
|
|
_titleLabel = [UILabel labelInitWithText:@""
|
|
|
|
font:[UIFont systemFontOfSize:16 weight:UIFontWeightBold]
|
|
|
|
textColor:UIColorFromRGB(0x191919)];
|
|
|
|
[self addSubview:_titleLabel];
|
|
|
|
[_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.centerY.mas_equalTo(self);
|
2024-06-27 21:31:00 +08:00
|
|
|
if (isMSRTL()) {
|
|
|
|
make.right.mas_equalTo(self).offset(0);
|
|
|
|
} else {
|
|
|
|
make.left.mas_equalTo(self).offset(0);
|
|
|
|
}
|
2024-06-25 15:08:14 +08:00
|
|
|
}];
|
|
|
|
|
|
|
|
_numLabel = [UILabel labelInitWithText:@""
|
|
|
|
font:[UIFont systemFontOfSize:16 weight:UIFontWeightBold]
|
|
|
|
textColor:UIColorFromRGB(0x666666)];
|
|
|
|
[self addSubview:_numLabel];
|
|
|
|
[_numLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.centerY.mas_equalTo(self);
|
2024-06-27 21:31:00 +08:00
|
|
|
if (isMSRTL()) {
|
|
|
|
make.right.mas_equalTo(self.titleLabel.mas_left).offset(-4);
|
|
|
|
} else {
|
|
|
|
make.left.mas_equalTo(self.titleLabel.mas_right).offset(4);
|
|
|
|
}
|
2024-06-25 15:08:14 +08:00
|
|
|
}];
|
|
|
|
|
|
|
|
_arrowButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
2024-06-27 21:31:00 +08:00
|
|
|
if (isMSRTL()) {
|
|
|
|
_arrowButton.semanticContentAttribute = UISemanticContentAttributeForceRightToLeft;
|
|
|
|
}
|
|
|
|
if (isMSRTL()) {
|
|
|
|
[_arrowButton setBackgroundImage:[[UIImage imageNamed:@"skillCard_arrow"] ms_SetImageForRTL]
|
|
|
|
forState:UIControlStateNormal];
|
|
|
|
} else {
|
|
|
|
[_arrowButton setBackgroundImage:[UIImage imageNamed:@"skillCard_arrow"]
|
|
|
|
forState:UIControlStateNormal];
|
|
|
|
}
|
2024-06-25 15:08:14 +08:00
|
|
|
[_arrowButton addTarget:self
|
|
|
|
action:@selector(didTapArrowButton)
|
|
|
|
forControlEvents:UIControlEventTouchUpInside];
|
2024-06-25 19:18:51 +08:00
|
|
|
[_arrowButton setEnlargeEdgeWithTop:5 right:10 bottom:10 left:10];
|
2024-06-25 15:08:14 +08:00
|
|
|
[self addSubview:_arrowButton];
|
|
|
|
[_arrowButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.centerY.mas_equalTo(self);
|
2024-06-27 21:31:00 +08:00
|
|
|
make.size.mas_equalTo(CGSizeMake(20, 20));
|
|
|
|
if (isMSRTL()) {
|
|
|
|
make.left.mas_equalTo(self).offset(0);
|
|
|
|
} else {
|
|
|
|
make.right.mas_equalTo(self).offset(0);
|
|
|
|
}
|
2024-06-25 15:08:14 +08:00
|
|
|
}];
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setTitle:(NSString *)title {
|
|
|
|
_titleLabel.text = title;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setNum:(NSString *)num {
|
|
|
|
_numLabel.text = num;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setHasMore:(BOOL)hasMore {
|
|
|
|
_arrowButton.hidden = !hasMore;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)didTapArrowButton {
|
|
|
|
if (self.didTapMore) {
|
|
|
|
self.didTapMore();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
2023-08-10 16:25:34 +08:00
|
|
|
@interface XPMineUserDataViewController ()<XPMineUserDataProtocol, UITableViewDelegate, UITableViewDataSource, XPMineDataClanTableViewCellDelegate, XPMineDataGiftTableViewCellDelegate, XPMonentsTableViewCellDelegate, XPMonentsMineProtocol, XPMonentsDetailViewControllerDelegate>
|
2023-07-14 18:50:55 +08:00
|
|
|
///列表
|
|
|
|
@property (nonatomic,strong) UITableView *tableView;
|
|
|
|
///家族信息
|
|
|
|
@property (nonatomic,strong) ClanDetailInfoModel *clanDetailInfo;
|
2024-06-24 19:11:54 +08:00
|
|
|
|
2023-07-14 18:50:55 +08:00
|
|
|
///是否折叠
|
|
|
|
@property (nonatomic,assign) BOOL isFold;
|
2024-06-25 19:18:51 +08:00
|
|
|
@property (nonatomic,assign) BOOL isGiftsSectionExpand;
|
|
|
|
@property (nonatomic,assign) BOOL isLuckyGiftsSectionExpand;
|
2023-07-14 18:50:55 +08:00
|
|
|
@property (nonatomic, copy) void(^scrollCallback)(UIScrollView *scrollView);
|
|
|
|
///是否展示加入家族房间
|
|
|
|
@property (nonatomic,assign) BOOL isShowEnterClan;
|
2023-08-10 16:25:34 +08:00
|
|
|
///数据源
|
|
|
|
@property (nonatomic,strong) NSMutableArray<MonentsInfoModel *> *datasource;
|
2024-06-25 15:08:14 +08:00
|
|
|
//@property (nonatomic,strong) UIView *headView;
|
|
|
|
@property (nonatomic, strong) UIButton *giftsExpandButton;
|
|
|
|
@property (nonatomic, strong) UIButton *luckyGiftsExpandButton;
|
2023-08-10 16:25:34 +08:00
|
|
|
///
|
2024-06-24 19:11:54 +08:00
|
|
|
@property (nonatomic,assign) BOOL isOpen;
|
2024-06-25 15:08:14 +08:00
|
|
|
|
|
|
|
@property (nonatomic, strong) XPMineUserSectionHeader *albumHeader;
|
|
|
|
@property (nonatomic, strong) XPMineUserSectionHeader *medalHeader;
|
|
|
|
@property (nonatomic, strong) XPMineUserSectionHeader *giftsHeader;
|
|
|
|
@property (nonatomic, strong) XPMineUserSectionHeader *luckyGiftsHeader;
|
|
|
|
|
2023-07-14 18:50:55 +08:00
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation XPMineUserDataViewController
|
|
|
|
|
|
|
|
- (BOOL)isHiddenNavBar {
|
2023-08-10 16:25:34 +08:00
|
|
|
return YES;
|
2023-07-14 18:50:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (__kindof id)createPresenter {
|
2023-08-10 16:25:34 +08:00
|
|
|
return [[XPMineUserDataPresenter alloc] init];
|
2023-07-14 18:50:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)viewDidLoad {
|
|
|
|
[super viewDidLoad];
|
2024-06-25 19:18:51 +08:00
|
|
|
self.view.backgroundColor = [UIColor whiteColor];
|
2024-06-25 15:08:14 +08:00
|
|
|
|
2024-06-25 19:18:51 +08:00
|
|
|
// [self initHttpRequest];
|
2023-08-10 16:25:34 +08:00
|
|
|
[self initSubViews];
|
|
|
|
[self initSubViewConstraints];
|
2023-07-14 18:50:55 +08:00
|
|
|
}
|
|
|
|
#pragma mark - Http
|
2024-06-24 19:11:54 +08:00
|
|
|
- (void)initHttpRequest {
|
|
|
|
self.isOpen = self.userUid.integerValue == [[AccountInfoStorage instance]getUid].integerValue;
|
2023-08-10 16:25:34 +08:00
|
|
|
self.isFold = YES;
|
|
|
|
self.isShowEnterClan = NO;
|
|
|
|
[self.presenter getClanDetailInfo:self.userUid currentUserUid:[AccountInfoStorage instance].getUid];
|
2023-07-14 18:50:55 +08:00
|
|
|
}
|
|
|
|
#pragma mark - Private Method
|
|
|
|
- (void)initSubViews {
|
2023-08-10 16:25:34 +08:00
|
|
|
[self.view addSubview:self.tableView];
|
2023-07-14 18:50:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)initSubViewConstraints {
|
2023-08-10 16:25:34 +08:00
|
|
|
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
2024-06-25 19:18:51 +08:00
|
|
|
make.top.mas_equalTo(self.view).offset(14);
|
|
|
|
make.bottom.mas_equalTo(self.view).offset(-14);
|
|
|
|
make.left.mas_equalTo(self.view).offset(14);
|
|
|
|
make.right.mas_equalTo(self.view).offset(-14);
|
2023-08-10 16:25:34 +08:00
|
|
|
}];
|
2023-07-14 18:50:55 +08:00
|
|
|
}
|
|
|
|
|
2024-06-25 19:18:51 +08:00
|
|
|
- (void)didTapGiftsSectionFoldButton {
|
|
|
|
self.isGiftsSectionExpand = !self.isGiftsSectionExpand;
|
|
|
|
self.giftsExpandButton.transform = self.isGiftsSectionExpand ? CGAffineTransformMakeRotation(M_PI) : CGAffineTransformIdentity;
|
|
|
|
[self.tableView reloadData];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)didTapLuckyGiftsSectionFoldButton {
|
|
|
|
self.isLuckyGiftsSectionExpand = !self.isLuckyGiftsSectionExpand;
|
|
|
|
self.luckyGiftsExpandButton.transform = self.isLuckyGiftsSectionExpand ? CGAffineTransformMakeRotation(M_PI) : CGAffineTransformIdentity;
|
|
|
|
[self.tableView reloadData];
|
|
|
|
}
|
|
|
|
|
2023-07-14 18:50:55 +08:00
|
|
|
#pragma mark - UITableViewDelegate And UITableViewDataSource
|
|
|
|
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
2024-06-25 15:08:14 +08:00
|
|
|
return SectionTypeCount;
|
2023-07-14 18:50:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
2024-06-25 15:08:14 +08:00
|
|
|
switch (section) {
|
|
|
|
case Album:
|
|
|
|
return 1;
|
|
|
|
break;
|
|
|
|
case Medal:
|
2024-06-27 21:31:00 +08:00
|
|
|
return self.medalInfo.medalCount == 0 ? 0 : 1;
|
2024-06-25 15:08:14 +08:00
|
|
|
break;
|
|
|
|
case Gifts:
|
|
|
|
return 1;
|
|
|
|
break;
|
|
|
|
case LuckyGifts:
|
|
|
|
return 1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
break;
|
|
|
|
}
|
2023-07-14 18:50:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
2024-06-25 15:08:14 +08:00
|
|
|
switch (indexPath.section) {
|
|
|
|
case Album:
|
|
|
|
return 90;
|
|
|
|
break;
|
|
|
|
case Medal:
|
|
|
|
return 70;
|
|
|
|
break;
|
|
|
|
case Gifts:
|
2024-06-25 19:18:51 +08:00
|
|
|
return [XPMineGiftsTableViewCell cellHeight:self.isGiftsSectionExpand
|
|
|
|
source:self.giftWall];
|
2024-06-25 15:08:14 +08:00
|
|
|
break;
|
|
|
|
case LuckyGifts:
|
2024-06-25 19:18:51 +08:00
|
|
|
return [XPMineGiftsTableViewCell cellHeight:self.isLuckyGiftsSectionExpand
|
|
|
|
source:self.luckyGiftWall];
|
2024-06-25 15:08:14 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
break;
|
2023-08-10 16:25:34 +08:00
|
|
|
}
|
2024-06-25 15:08:14 +08:00
|
|
|
|
2023-08-10 16:25:34 +08:00
|
|
|
return KScreenHeight - kNavigationHeight - 49 - kSafeAreaBottomHeight;
|
|
|
|
}
|
|
|
|
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
|
2024-06-25 15:08:14 +08:00
|
|
|
switch (section) {
|
|
|
|
case Album:
|
|
|
|
return nil;
|
|
|
|
break;
|
|
|
|
case Medal:
|
|
|
|
return nil;
|
|
|
|
break;
|
|
|
|
case Gifts:
|
2024-06-27 21:31:00 +08:00
|
|
|
return self.giftWall.count > 4 ? self.giftsExpandButton : nil;
|
2024-06-25 15:08:14 +08:00
|
|
|
break;
|
|
|
|
case LuckyGifts:
|
2024-06-27 21:31:00 +08:00
|
|
|
return self.luckyGiftWall.count > 4 ? self.luckyGiftsExpandButton : nil;
|
2024-06-25 15:08:14 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
break;
|
|
|
|
}
|
2023-08-10 16:25:34 +08:00
|
|
|
}
|
|
|
|
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
|
2024-06-25 15:08:14 +08:00
|
|
|
switch (section) {
|
|
|
|
case Album:
|
|
|
|
return 0;
|
|
|
|
break;
|
|
|
|
case Medal:
|
|
|
|
return 0;
|
|
|
|
break;
|
|
|
|
case Gifts:
|
2024-06-27 21:31:00 +08:00
|
|
|
return self.giftWall.count > 4 ? 20 : 0;
|
2024-06-25 15:08:14 +08:00
|
|
|
break;
|
|
|
|
case LuckyGifts:
|
2024-06-27 21:31:00 +08:00
|
|
|
return self.luckyGiftWall.count > 4 ? 20 : 0;
|
2024-06-25 15:08:14 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
break;
|
|
|
|
}
|
2023-08-10 16:25:34 +08:00
|
|
|
}
|
|
|
|
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
|
2024-06-28 17:24:13 +08:00
|
|
|
|
2024-06-27 21:31:00 +08:00
|
|
|
if (section == Medal) {
|
|
|
|
return self.medalInfo.medalCount == 0 ? 0 : 30;
|
2024-06-28 17:24:13 +08:00
|
|
|
} else if (section == Gifts || section == LuckyGifts) {
|
|
|
|
return 50;
|
2024-06-27 21:31:00 +08:00
|
|
|
}
|
2024-06-25 15:08:14 +08:00
|
|
|
return 30;
|
2023-08-10 16:25:34 +08:00
|
|
|
}
|
|
|
|
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
|
2024-06-25 15:08:14 +08:00
|
|
|
switch (section) {
|
|
|
|
case Album:
|
|
|
|
return self.albumHeader;
|
|
|
|
break;
|
|
|
|
case Medal:
|
2024-06-27 21:31:00 +08:00
|
|
|
return self.medalInfo.medalCount == 0 ? [UIView new] : self.medalHeader;
|
2024-06-25 15:08:14 +08:00
|
|
|
break;
|
|
|
|
case Gifts:
|
|
|
|
return self.giftsHeader;
|
|
|
|
break;
|
|
|
|
case LuckyGifts:
|
|
|
|
return self.luckyGiftsHeader;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return [UIView new];
|
|
|
|
break;
|
|
|
|
}
|
2023-07-14 18:50:55 +08:00
|
|
|
}
|
|
|
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
2024-06-25 15:08:14 +08:00
|
|
|
switch (indexPath.section) {
|
2024-06-25 17:24:32 +08:00
|
|
|
case Album: {
|
|
|
|
XPMineAlbumTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineAlbumTableViewCell class])
|
|
|
|
forIndexPath:indexPath];
|
|
|
|
cell.albumDataSource = self.userInfo.privatePhoto;
|
|
|
|
return cell;
|
2023-08-10 16:25:34 +08:00
|
|
|
}
|
2024-06-25 15:08:14 +08:00
|
|
|
break;
|
2024-06-25 17:24:32 +08:00
|
|
|
case Medal: {
|
|
|
|
XPMineMedalsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineMedalsTableViewCell class])
|
|
|
|
forIndexPath:indexPath];
|
|
|
|
cell.medalsDataSource = self.medalInfo.userMedals;
|
|
|
|
return cell;
|
2024-06-25 15:08:14 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case Gifts:{
|
2024-06-25 17:24:32 +08:00
|
|
|
XPMineGiftsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineGiftsTableViewCell class])];
|
2024-06-25 19:18:51 +08:00
|
|
|
cell.giftsDataSource = self.giftWall;
|
|
|
|
cell.isLucky = NO;
|
2024-06-25 15:08:14 +08:00
|
|
|
return cell;
|
|
|
|
}
|
|
|
|
break;
|
2024-06-25 17:24:32 +08:00
|
|
|
case LuckyGifts:{
|
|
|
|
XPMineGiftsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineGiftsTableViewCell class])];
|
2024-06-25 19:18:51 +08:00
|
|
|
cell.giftsDataSource = self.luckyGiftWall;
|
|
|
|
cell.isLucky = YES;
|
2024-06-25 17:24:32 +08:00
|
|
|
return cell;
|
|
|
|
}
|
2024-06-25 15:08:14 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
|
|
|
break;
|
2023-08-10 16:25:34 +08:00
|
|
|
}
|
|
|
|
}
|
2024-06-25 19:18:51 +08:00
|
|
|
|
2023-08-10 16:25:34 +08:00
|
|
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
|
if(indexPath.section == 0)return;
|
|
|
|
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
|
|
|
if (self.datasource.count > 0) {
|
|
|
|
XPMonentsDetailViewController * detailVC = [[XPMonentsDetailViewController alloc] init];
|
2024-06-16 16:18:06 +08:00
|
|
|
MonentsInfoModel * monentsInfo = [self.datasource xpSafeObjectAtIndex:indexPath.row];
|
2023-08-10 16:25:34 +08:00
|
|
|
if(monentsInfo.dynamicId == nil){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
detailVC.monentsInfo = monentsInfo;
|
|
|
|
detailVC.delegate = self;
|
|
|
|
[self.navigationController pushViewController:detailVC animated:YES];
|
|
|
|
}
|
|
|
|
}
|
2024-06-25 19:18:51 +08:00
|
|
|
|
2023-08-10 16:25:34 +08:00
|
|
|
#pragma mark - XPMonentsTableViewCellDelegate
|
|
|
|
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClickLike:(MonentsInfoModel *)monentsInfo {
|
|
|
|
if(monentsInfo.dynamicId == nil){
|
|
|
|
[self showErrorToast:YMLocalizedString(@"XPMineUserDataViewController2")];
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
[self.presenter likeMonent:monentsInfo.dynamicId status:!monentsInfo.isLike likedUid:monentsInfo.uid worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
|
|
|
|
}
|
|
|
|
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicCommon:(MonentsInfoModel *)monentsInfo{
|
|
|
|
if(monentsInfo.dynamicId == nil){
|
|
|
|
[self showErrorToast:YMLocalizedString(@"XPMineUserDataViewController3")];
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
XPMonentsDetailViewController * detailVC = [[XPMonentsDetailViewController alloc] init];
|
|
|
|
detailVC.monentsInfo = monentsInfo;
|
|
|
|
detailVC.delegate = self;
|
|
|
|
[self.navigationController pushViewController:detailVC animated:YES];
|
|
|
|
}
|
|
|
|
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicDelete:(MonentsInfoModel *)monentsInfo {
|
|
|
|
[TTPopup alertWithMessage:YMLocalizedString(@"XPMonentsMineViewController0") confirmHandler:^{
|
|
|
|
[self.presenter deleteMonents:monentsInfo.dynamicId worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
|
|
|
|
} cancelHandler:^{
|
|
|
|
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicShielding:(nonnull MonentsInfoModel *)monentsInfo{
|
|
|
|
[self showLoading];
|
|
|
|
[self.presenter requesstShieldingWtihType:@"0" objId:monentsInfo.dynamicId];
|
|
|
|
}
|
|
|
|
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicFold:(MonentsInfoModel *)monentsInfo {
|
|
|
|
__block MonentsInfoModel * monentsInfos;
|
|
|
|
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
|
if (obj.dynamicId.integerValue == monentsInfo.dynamicId.integerValue) {
|
|
|
|
monentsInfos = obj;
|
|
|
|
*stop = YES;
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
if (monentsInfos) {
|
|
|
|
NSInteger section = [self.datasource indexOfObject:monentsInfo];
|
|
|
|
[self.tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:section inSection:1]] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - XPMonentsDetailViewControllerDelegate
|
|
|
|
- (void)xPMonentsDetailViewController:(XPMonentsDetailViewController *)view deleteMonents:(NSString *)dynamicId {
|
|
|
|
__block MonentsInfoModel * deleteInfo;
|
|
|
|
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
|
if (obj.dynamicId.integerValue == dynamicId.integerValue) {
|
|
|
|
deleteInfo = obj;
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
|
|
|
|
if (deleteInfo) {
|
|
|
|
[self.datasource removeObject:deleteInfo];
|
|
|
|
[self.tableView reloadData];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - XPMonentsMineProtocol
|
|
|
|
- (void)requesstShieldingSuccess:(NSString *)monentsInfo{
|
|
|
|
[self hideHUD];
|
|
|
|
[self showSuccessToast:YMLocalizedString(@"XPMonentsMineViewController2")];
|
|
|
|
__block MonentsInfoModel * deleteInfo;
|
|
|
|
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
|
if (obj.dynamicId.integerValue == monentsInfo.integerValue) {
|
|
|
|
deleteInfo = obj;
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
|
|
|
|
if (deleteInfo) {
|
|
|
|
[self.datasource removeObject:deleteInfo];
|
|
|
|
[self.tableView reloadData];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
- (void)likeMonentsSuccess:(NSString *)dynamicId status:(BOOL)status {
|
|
|
|
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
|
if ([obj.dynamicId isEqualToString:dynamicId]) {
|
|
|
|
NSInteger likeCount = obj.likeCount.integerValue;
|
|
|
|
if (status) {
|
|
|
|
likeCount += 1;
|
|
|
|
obj.isLike += 1;
|
|
|
|
} else {
|
|
|
|
likeCount -= 1;
|
|
|
|
obj.isLike -= 1;
|
|
|
|
}
|
|
|
|
obj.likeCount = @(likeCount).stringValue;
|
|
|
|
*stop = YES;
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
[self.tableView reloadData];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)deleteMonentsSuccess:(NSString *)monentsInfo {
|
|
|
|
[self showSuccessToast:YMLocalizedString(@"XPMonentsMineViewController1")];
|
|
|
|
__block MonentsInfoModel * deleteInfo;
|
|
|
|
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
|
if (obj.dynamicId.integerValue == monentsInfo.integerValue) {
|
|
|
|
deleteInfo = obj;
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
|
|
|
|
if (deleteInfo) {
|
|
|
|
[self.datasource removeObject:deleteInfo];
|
|
|
|
[self.tableView reloadData];
|
|
|
|
}
|
2023-07-14 18:50:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - XPMineDataClanTableViewCellDelegate
|
|
|
|
- (void)xPMineDataClanTableViewCell:(XPMineDataClanTableViewCell *)view didClickFold:(UIButton *)sender {
|
2023-08-10 16:25:34 +08:00
|
|
|
self.isFold = !sender.selected;
|
|
|
|
[self.tableView reloadData];
|
|
|
|
// [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
|
}
|
|
|
|
- (void)xPMineDataClanTableViewCell:(XPMineDataClanTableViewCell *)view didClickOpen:(ClanDetailInfoModel *)clanInfo{
|
2024-06-24 19:11:54 +08:00
|
|
|
self.isOpen = YES;
|
2023-08-10 16:25:34 +08:00
|
|
|
[self.tableView reloadData];
|
2023-07-14 18:50:55 +08:00
|
|
|
}
|
|
|
|
- (void)xPMineDataClanTableViewCell:(XPMineDataClanTableViewCell *)view didClickEnter:(ClanDetailInfoModel *)clanInfo {
|
2023-08-10 16:25:34 +08:00
|
|
|
[self.presenter memberApplyHall:clanInfo.hall.hallId];
|
2023-07-14 18:50:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)xPMineDataClanTableViewCell:(XPMineDataClanTableViewCell *)view didClickClanView:(ClanDetailInfoModel *)clanInfo {
|
2023-08-10 16:25:34 +08:00
|
|
|
XPMineClanViewController * clanVC = [[XPMineClanViewController alloc] init];
|
|
|
|
clanVC.uid = self.clanDetailInfo.clan.elderUid;
|
|
|
|
[self.navigationController pushViewController:clanVC animated:YES];
|
2023-07-14 18:50:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)xPMineDataClanTableViewCell:(XPMineDataClanTableViewCell *)view didClickHallView:(ClanDetailInfoModel *)clanInfo {
|
2023-08-10 16:25:34 +08:00
|
|
|
XPMineGuildViewController * hallVC = [[XPMineGuildViewController alloc] init];
|
|
|
|
hallVC.ownerUid = clanInfo.hall.ownerUid;
|
|
|
|
hallVC.guildId = clanInfo.hall.hallId;
|
|
|
|
[self.navigationController pushViewController:hallVC animated:YES];
|
2023-07-14 18:50:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - XPMineDataGiftTableViewCellDelegate
|
|
|
|
- (void)xPMineDataGiftTableViewCell:(XPMineDataGiftTableViewCell *)view didClickMore:(UIButton *)sender {
|
2023-08-10 16:25:34 +08:00
|
|
|
XPMineUserInfoGiftWallViewController * giftWallVC = [[XPMineUserInfoGiftWallViewController alloc] init];
|
|
|
|
giftWallVC.userUid = self.userUid;
|
|
|
|
[self.navigationController pushViewController:giftWallVC animated:YES];
|
|
|
|
}
|
|
|
|
|
2023-08-10 18:44:46 +08:00
|
|
|
|
2023-07-14 18:50:55 +08:00
|
|
|
|
|
|
|
#pragma mark - JXPagingViewListViewDelegate
|
|
|
|
- (UIView *)listView {
|
2023-08-10 16:25:34 +08:00
|
|
|
return self.view;
|
2023-07-14 18:50:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (UIScrollView *)listScrollView {
|
2023-08-10 16:25:34 +08:00
|
|
|
return self.tableView;
|
2023-07-14 18:50:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)listViewDidScrollCallback:(void (^)(UIScrollView *))callback {
|
2023-08-10 16:25:34 +08:00
|
|
|
self.scrollCallback = callback;
|
2023-07-14 18:50:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
2023-08-10 16:25:34 +08:00
|
|
|
self.scrollCallback(scrollView);
|
2023-07-14 18:50:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - XPMineUserDataProtocol
|
|
|
|
- (void)getClanDetailInfoSuccess:(ClanDetailInfoModel *)clanDetailInfo currentUserClanInfo:(ClanDetailInfoModel *)currentUserClanInfo {
|
2023-08-10 16:25:34 +08:00
|
|
|
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];
|
2023-07-14 18:50:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)memberApplyHallSuccess {
|
2023-08-10 16:25:34 +08:00
|
|
|
[self showSuccessToast:YMLocalizedString(@"XPMineUserDataViewController0")];
|
2023-07-14 18:50:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - Getters And Setters
|
|
|
|
- (void)setUserInfo:(UserInfoModel *)userInfo {
|
2023-08-10 16:25:34 +08:00
|
|
|
_userInfo = userInfo;
|
2024-06-25 19:18:51 +08:00
|
|
|
self.albumHeader.num = [NSString stringWithFormat:@"(%ld)", (long)userInfo.privatePhoto.count];
|
2023-08-10 16:25:34 +08:00
|
|
|
[self.tableView reloadData];
|
2024-06-27 21:31:00 +08:00
|
|
|
|
|
|
|
if (userInfo.uid != [[AccountInfoStorage instance].getUid integerValue]) {
|
|
|
|
self.albumHeader.hasMore = NO;
|
|
|
|
}
|
2023-08-10 16:25:34 +08:00
|
|
|
}
|
|
|
|
- (void)setDynamicInfo:(NSArray<MonentsInfoModel *> *)dynamicInfo {
|
|
|
|
[self.datasource removeAllObjects];
|
|
|
|
[self.datasource addObjectsFromArray:dynamicInfo];
|
|
|
|
[self.tableView reloadData];
|
2024-06-25 15:08:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setMedalInfo:(MedalModel *)medalInfo {
|
|
|
|
_medalInfo = medalInfo;
|
|
|
|
self.medalHeader.num = [NSString stringWithFormat:@"(%ld)", (long)medalInfo.medalCount];
|
|
|
|
[self.tableView reloadData];
|
2023-07-14 18:50:55 +08:00
|
|
|
}
|
2024-06-25 15:08:14 +08:00
|
|
|
|
2023-07-14 18:50:55 +08:00
|
|
|
- (UITableView *)tableView {
|
2023-08-10 16:25:34 +08:00
|
|
|
if (!_tableView) {
|
|
|
|
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
|
|
|
|
_tableView.delegate = self;
|
|
|
|
_tableView.dataSource = self;
|
|
|
|
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
2024-06-25 15:08:14 +08:00
|
|
|
_tableView.backgroundColor = [UIColor whiteColor];
|
2023-08-10 16:25:34 +08:00
|
|
|
if (@available(iOS 11.0, *)) {
|
|
|
|
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
|
|
|
}
|
2024-06-25 15:08:14 +08:00
|
|
|
[_tableView registerClass:[XPMineAlbumTableViewCell class]
|
|
|
|
forCellReuseIdentifier:NSStringFromClass([XPMineAlbumTableViewCell class])];
|
|
|
|
[_tableView registerClass:[XPMineMedalsTableViewCell class]
|
|
|
|
forCellReuseIdentifier:NSStringFromClass([XPMineMedalsTableViewCell class])];
|
2024-06-25 17:24:32 +08:00
|
|
|
[_tableView registerClass:[XPMineGiftsTableViewCell class]
|
|
|
|
forCellReuseIdentifier:NSStringFromClass([XPMineGiftsTableViewCell class])];
|
2023-08-10 16:25:34 +08:00
|
|
|
[_tableView registerClass:[XPMonentsEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
|
|
|
[_tableView registerClass:[XPMonentsTableViewCell class] forCellReuseIdentifier:@"XPMonentsDynamicTableViewCell"];
|
|
|
|
[_tableView registerClass:[XPMineDataClanTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMineDataClanTableViewCell class])];
|
2024-06-25 15:08:14 +08:00
|
|
|
[_tableView registerClass:[XPMineDataGiftTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMineDataGiftTableViewCell class])];
|
2024-06-27 21:31:00 +08:00
|
|
|
if (isMSRTL()) {
|
|
|
|
_tableView.semanticContentAttribute = UISemanticContentAttributeForceRightToLeft;
|
|
|
|
}
|
2023-08-10 16:25:34 +08:00
|
|
|
}
|
|
|
|
return _tableView;
|
|
|
|
}
|
2024-06-25 15:08:14 +08:00
|
|
|
|
2023-08-10 16:25:34 +08:00
|
|
|
- (NSMutableArray<MonentsInfoModel *> *)datasource {
|
|
|
|
if (!_datasource) {
|
|
|
|
_datasource = [NSMutableArray array];
|
|
|
|
}
|
|
|
|
return _datasource;
|
|
|
|
}
|
2024-06-25 15:08:14 +08:00
|
|
|
|
|
|
|
- (XPMineUserSectionHeader *)albumHeader {
|
|
|
|
if (!_albumHeader) {
|
|
|
|
_albumHeader = [[XPMineUserSectionHeader alloc] init];
|
2024-06-27 21:31:00 +08:00
|
|
|
_albumHeader.title = YMLocalizedString(@"QinputPhotoView1");
|
2024-06-25 15:08:14 +08:00
|
|
|
_albumHeader.hasMore = YES;
|
|
|
|
@kWeakify(self);
|
|
|
|
_albumHeader.didTapMore = ^{
|
|
|
|
@kStrongify(self);
|
2024-06-25 19:18:51 +08:00
|
|
|
XPMineUserInfoAlbumViewController * albumVC = [[XPMineUserInfoAlbumViewController alloc] init];
|
|
|
|
[self.navigationController pushViewController:albumVC animated:YES];
|
2024-06-25 15:08:14 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
return _albumHeader;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (XPMineUserSectionHeader *)medalHeader {
|
|
|
|
if (!_medalHeader) {
|
|
|
|
_medalHeader = [[XPMineUserSectionHeader alloc] init];
|
2024-06-27 21:31:00 +08:00
|
|
|
_medalHeader.title = YMLocalizedString(@"XPMineDataGiftTableViewCell2");
|
2024-06-25 15:08:14 +08:00
|
|
|
_medalHeader.num = @"(0)";
|
|
|
|
_medalHeader.hasMore = NO;
|
|
|
|
}
|
|
|
|
return _medalHeader;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (XPMineUserSectionHeader *)giftsHeader {
|
|
|
|
if (!_giftsHeader) {
|
|
|
|
_giftsHeader = [[XPMineUserSectionHeader alloc] init];
|
2024-06-27 21:31:00 +08:00
|
|
|
_giftsHeader.title = YMLocalizedString(@"XPMineDataGiftTableViewCell0");
|
2024-06-25 15:08:14 +08:00
|
|
|
_giftsHeader.hasMore = NO;
|
|
|
|
}
|
|
|
|
return _giftsHeader;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (XPMineUserSectionHeader *)luckyGiftsHeader {
|
|
|
|
if (!_luckyGiftsHeader) {
|
|
|
|
_luckyGiftsHeader = [[XPMineUserSectionHeader alloc] init];
|
2024-06-27 21:31:00 +08:00
|
|
|
_luckyGiftsHeader.title = YMLocalizedString(@"XPMineDataGiftTableViewCell1");
|
2024-06-25 15:08:14 +08:00
|
|
|
_luckyGiftsHeader.hasMore = NO;
|
|
|
|
}
|
|
|
|
return _luckyGiftsHeader;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UIButton *)giftsExpandButton {
|
|
|
|
if (!_giftsExpandButton) {
|
|
|
|
_giftsExpandButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
2024-06-27 21:31:00 +08:00
|
|
|
[_giftsExpandButton setImage:[UIImage imageNamed:@"common_down_arrow"] forState:UIControlStateNormal];
|
2024-06-25 19:18:51 +08:00
|
|
|
[_giftsExpandButton addTarget:self action:@selector(didTapGiftsSectionFoldButton) forControlEvents:UIControlEventTouchUpInside];
|
2024-06-25 15:08:14 +08:00
|
|
|
_giftsExpandButton.selected = YES;
|
|
|
|
[_giftsExpandButton setEnlargeEdgeWithTop:5 right:10 bottom:10 left:10];
|
|
|
|
}
|
|
|
|
return _giftsExpandButton;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UIButton *)luckyGiftsExpandButton {
|
|
|
|
if (!_luckyGiftsExpandButton) {
|
|
|
|
_luckyGiftsExpandButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
2024-06-27 21:31:00 +08:00
|
|
|
[_luckyGiftsExpandButton setImage:[UIImage imageNamed:@"common_down_arrow"] forState:UIControlStateNormal];
|
2024-06-25 19:18:51 +08:00
|
|
|
[_luckyGiftsExpandButton addTarget:self action:@selector(didTapLuckyGiftsSectionFoldButton) forControlEvents:UIControlEventTouchUpInside];
|
2024-06-25 15:08:14 +08:00
|
|
|
_luckyGiftsExpandButton.selected = YES;
|
|
|
|
[_luckyGiftsExpandButton setEnlargeEdgeWithTop:5 right:10 bottom:10 left:10];
|
2023-08-10 16:25:34 +08:00
|
|
|
}
|
2024-06-25 15:08:14 +08:00
|
|
|
return _luckyGiftsExpandButton;
|
2023-07-14 18:50:55 +08:00
|
|
|
}
|
|
|
|
@end
|