修复bug

This commit is contained in:
liyuhua
2023-10-18 15:11:56 +08:00
parent 63492e37cf
commit 83c26770a4
13 changed files with 128 additions and 63 deletions

View File

@@ -61,11 +61,9 @@ UIKIT_EXTERN NSString * const kShieldingNotification;
///
@property (nonatomic,strong) CountDownHelper *countDownHelper;
///cell
@property(nonatomic,strong)XPNewHomePartyTableViewCell *cell;
///cellUITableViewY
@property(nonatomic,assign) CGFloat cellY;
///cellUITableViewY
@property(nonatomic,assign) CGFloat cellMinY;
@property(nonatomic,strong)XPNewHomePartyTableViewCell *pi_playAudioCell;
///
@property (nonatomic, strong) NSMutableArray<LittleGameInfoModel *> *littleGameArray;
@end
@@ -87,7 +85,7 @@ UIKIT_EXTERN NSString * const kShieldingNotification;
}
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
}
@@ -96,9 +94,9 @@ UIKIT_EXTERN NSString * const kShieldingNotification;
[super viewDidAppear:animated];
[self.countDownHelper stopCountDown];
[[XPSkillCardPlayerManager shareInstance] stopMusic];
if(self.cell != nil){
[self.cell setPlaySoundStatus:NO];
self.cell = nil;
if(self.pi_playAudioCell != nil){
[self.pi_playAudioCell setPlaySoundStatus:NO];
self.pi_playAudioCell = nil;
}
@@ -109,7 +107,7 @@ UIKIT_EXTERN NSString * const kShieldingNotification;
#pragma mark - InitHttp
-(void)requestData{
if(self.cell != nil){
if(self.pi_playAudioCell != nil){
if(self.refreshComplete){
self.refreshComplete();
}
@@ -144,7 +142,7 @@ UIKIT_EXTERN NSString * const kShieldingNotification;
});
dispatch_group_enter(group);
dispatch_group_async(group, queue, ^{
[self.presenter getLittleGameListWithGroup:group];
});
@@ -154,10 +152,10 @@ UIKIT_EXTERN NSString * const kShieldingNotification;
if(self.refreshComplete){
self.refreshComplete();
}
if(self.cell == nil){///
if(self.pi_playAudioCell == nil){///
[self.tableView reloadData];
}
});
@@ -220,14 +218,14 @@ UIKIT_EXTERN NSString * const kShieldingNotification;
cell = [[XPNewHomePlayEmptyTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPNewHomePlayEmptyTableViewCell class])];
}
cell.isClan = YES;
cell.delegate = self;
return cell;
}
XPNewHomePartyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPNewHomePartyTableViewCell class])];
if (cell == nil) {
@@ -269,14 +267,21 @@ UIKIT_EXTERN NSString * const kShieldingNotification;
}
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
if(self.cell != nil){
if(scrollView.contentOffset.y > self.cellY){
if(self.pi_playAudioCell != nil){
BOOL isVisible = YES;
CGRect cellR = [self.tableView rectForRowAtIndexPath:[self.tableView indexPathForCell:self.pi_playAudioCell]];
if((self.tableView.contentOffset.y - (cellR.origin.y)) > cellR.size.height){
isVisible = NO;
}
if (cellR.origin.y - self.tableView.contentOffset.y > self.tableView.frame.size.height) {//
isVisible = NO;
}
if(!isVisible && [self.pi_playAudioCell isKindOfClass:[XPNewHomePartyTableViewCell class]]) {
[self.countDownHelper stopCountDown];
[[XPSkillCardPlayerManager shareInstance] stopMusic];
[self.cell setPlaySoundStatus:NO];
self.cell = nil;
[self.pi_playAudioCell setPlaySoundStatus:NO];
self.pi_playAudioCell = nil;
}
}
if(self.scrollCallback){
self.scrollCallback(scrollView);
@@ -297,26 +302,26 @@ UIKIT_EXTERN NSString * const kShieldingNotification;
}
}
- (void)chooseGameAction{
// XPHomeGameView *gameView = [XPHomeGameView new];
// gameView.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
// gameView.playGameList = self.littleGameArray;
// gameView.delegate = self;
// [kWindow addSubview:gameView];
// XPHomeGameView *gameView = [XPHomeGameView new];
// gameView.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
// gameView.playGameList = self.littleGameArray;
// gameView.delegate = self;
// [kWindow addSubview:gameView];
}
#pragma mark - XPNewHomePlayEmptyTableViewCellDelegate
- (void)emptyCellChooseGameAction{
// XPHomeGameView *gameView = [XPHomeGameView new];
// gameView.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
// gameView.playGameList = self.littleGameArray;
// gameView.delegate = self;
// [kWindow addSubview:gameView];
// XPHomeGameView *gameView = [XPHomeGameView new];
// gameView.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
// gameView.playGameList = self.littleGameArray;
// gameView.delegate = self;
// [kWindow addSubview:gameView];
if(self.delegate && [self.delegate respondsToSelector:@selector(openRoom)]){
[self.delegate openRoom];
}
}
#pragma mark - XPHomeGameViewDelegate
- (void)xpHomeGameViewChooseGameWithGameModel:(LittleGameInfoModel *)gameModel{
NSString * uid = [AccountInfoStorage instance].getUid;
[self showLoading];
[Api getRoomInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
@@ -429,7 +434,7 @@ UIKIT_EXTERN NSString * const kShieldingNotification;
dispatch_group_leave(group);
}
- (void)onGetLittleGameListSuccess:(NSArray<LittleGameInfoModel *> *)items withGroup:(nonnull dispatch_group_t)group{
self.littleGameArray = [[NSMutableArray alloc]initWithArray:items];
dispatch_group_leave(group);
}
@@ -474,16 +479,15 @@ UIKIT_EXTERN NSString * const kShieldingNotification;
///
-(void)xPNewHomePartyTableViewCell:(XPNewHomePartyTableViewCell *_Nullable)cell didPlayVoice:(HomePlayRoomModel *_Nonnull)roomModel didClickPlaySound:(BOOL)isPlay{
if(isPlay == YES){
if(self.cell != nil){
if(self.pi_playAudioCell != nil){
[self.countDownHelper stopCountDown];
[self.cell setPlaySoundStatus:NO];
[self.pi_playAudioCell setPlaySoundStatus:NO];
[[XPSkillCardPlayerManager shareInstance] stopMusic];
self.cell = nil;
self.pi_playAudioCell = nil;
}
self.cell = cell;
CGRect cellRect = [self.tableView rectForRowAtIndexPath:[self.tableView indexPathForCell:self.cell]];
self.cellY = cellRect.origin.y + cellRect.size.height;
self.cellMinY = (cellRect.size.height + self.tableView.frame.size.height);
self.pi_playAudioCell = cell;
NSString *fileName = [[roomModel.userVoice componentsSeparatedByString:@"/"] lastObject];
NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) safeObjectAtIndex1:0] stringByAppendingPathComponent:@"kMineSoundCard"];
NSString *fullPath = [filePath stringByAppendingPathComponent:fileName];
@@ -499,17 +503,17 @@ UIKIT_EXTERN NSString * const kShieldingNotification;
[self playAudioWithUrl:editAudioPath isDelay:[XPSkillCardPlayerManager shareInstance].isMineInMic];
}else{
[self.cell setPlaySoundStatus:NO];
[self.pi_playAudioCell setPlaySoundStatus:NO];
[[XPSkillCardPlayerManager shareInstance] stopMusic];
self.cell = nil;
self.pi_playAudioCell = nil;
}
}];
}
}else{
[self.countDownHelper stopCountDown];
[self.cell setPlaySoundStatus:NO];
[self.pi_playAudioCell setPlaySoundStatus:NO];
[[XPSkillCardPlayerManager shareInstance] stopMusic];
self.cell = nil;
self.pi_playAudioCell = nil;
}
}
@@ -526,12 +530,12 @@ UIKIT_EXTERN NSString * const kShieldingNotification;
}];
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
NSInteger getCurrentTime = ceil([self.cell.roomInfo.voiceDura integerValue]);
NSInteger getCurrentTime = ceil([self.pi_playAudioCell.roomInfo.voiceDura integerValue]);
[self.countDownHelper openCountdownWithTime:(int)getCurrentTime];
});
return;
}
NSInteger getCurrentTime = ceil([self.cell.roomInfo.voiceDura integerValue]);
NSInteger getCurrentTime = ceil([self.pi_playAudioCell.roomInfo.voiceDura integerValue]);
[self.countDownHelper openCountdownWithTime:(int)getCurrentTime];
[[XPSkillCardPlayerManager shareInstance] playerVoiceWithPath:url completionBlock:^{
@@ -540,19 +544,19 @@ UIKIT_EXTERN NSString * const kShieldingNotification;
}
///
- (void)onCountdownFinish{
if(self.cell != nil){
[self.cell setPlaySoundTime:0];
if(self.pi_playAudioCell != nil){
[self.pi_playAudioCell setPlaySoundTime:0];
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[self.cell setPlaySoundStatus:NO];
self.cell = nil;
[self.pi_playAudioCell setPlaySoundStatus:NO];
self.pi_playAudioCell = nil;
});
}
}
///
- (void)onCountdownOpen:(int)time{
if(self.cell != nil){
[self.cell setPlaySoundTime:(int)time + 1];
if(self.pi_playAudioCell != nil){
[self.pi_playAudioCell setPlaySoundTime:(int)time + 1];
}
}

View File

@@ -18,6 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
///房间的代理
@property (nonatomic,weak) id<RoomHostDelegate> hostDelegate;
- (void)showUserCard:(NSInteger)uid;
@end
NS_ASSUME_NONNULL_END

View File

@@ -17,6 +17,8 @@
-(void)unlockAlbumHandleWithInfo:(PIRoomPhotoAlbumItemModel *_Nonnull)info;
///查看图片
-(void)pIRoomMessagePhotoAlbumCell:(PIRoomMessagePhotoAlbumCell *_Nonnull)cell lookUpAlbumPhotoWithAlbumModel:(PIRoomPhotoAlbumItemModel *_Nonnull)albumModel;
///查看资料卡
-(void)pIRoomMessagePhotoAlbumCell:(PIRoomMessagePhotoAlbumCell *_Nonnull)cell lookUpUserCardModel:(PIRoomPhotoAlbumItemModel *_Nonnull)albumModel;
@end
NS_ASSUME_NONNULL_BEGIN

View File

@@ -32,7 +32,10 @@
@property(nonatomic,strong) PIRoomMessagePhotoAlbumView *unlockPhotoView;
///
@property (nonatomic,strong) UITapGestureRecognizer *tapEmptyRecognizer;
///
@property(nonatomic,strong) PIRoomPhotoAlbumItemModel *albumModel;
///
@property(nonatomic,strong) UIButton *loopUserCardBtn;
@end
@implementation PIRoomMessagePhotoAlbumCell
-(void)dealloc{
@@ -58,6 +61,7 @@
[self.contentView addSubview:self.wealthView];
[self.contentView addSubview:self.charmView];
[self.contentView addSubview:self.nameView];
[self.contentView addSubview:self.loopUserCardBtn];
[self.contentView addSubview:self.unlockPhotoView];
@@ -102,7 +106,10 @@
make.height.mas_equalTo(17);
make.centerY.equalTo(self.wealthView);
}];
[self.loopUserCardBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.bottom.equalTo(self.charmView);
make.right.equalTo(self.nameView.mas_right);
}];
[self.unlockPhotoView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.nameView.mas_bottom).mas_offset(5);
make.left.equalTo(self.bubbleImageView).inset(12);
@@ -211,7 +218,11 @@
[self.delegate pIRoomMessagePhotoAlbumCell:self lookUpAlbumPhotoWithAlbumModel:self.albumModel];
}
}
-(void)loopUserCardAction{
if(self.delegate && [self.delegate respondsToSelector:@selector(pIRoomMessagePhotoAlbumCell:lookUpUserCardModel:)]){
[self.delegate pIRoomMessagePhotoAlbumCell:self lookUpUserCardModel:self.albumModel];
}
}
#pragma mark -
- (NetImageView *)bubbleImageView {
if (!_bubbleImageView) {
@@ -265,6 +276,13 @@
}
return _unlockPhotoView;
}
- (UIButton *)loopUserCardBtn{
if(!_loopUserCardBtn){
_loopUserCardBtn = [UIButton new];
[_loopUserCardBtn addTarget:self action:@selector(loopUserCardAction) forControlEvents:UIControlEventTouchUpInside];
}
return _loopUserCardBtn;
}
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code

View File

@@ -51,7 +51,7 @@
[self.unlockPhotoView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
[self.unlockView mas_makeConstraints:^(MASConstraintMaker *make) {
[self.lockedView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(48);
make.height.mas_equalTo(24);
make.trailing.bottom.equalTo(self.unlockPhotoView).inset(2);
@@ -84,7 +84,7 @@
}
-(void)setAlbumModel:(PIRoomPhotoAlbumItemModel *)albumModel{
_albumModel = albumModel;
self.lockedView.hidden = YES;
if(_albumModel.type.intValue == 1){
self.pi_maskView.hidden = YES;
self.unlockPhotoView.imageUrl = _albumModel.photoUrl;
@@ -114,6 +114,8 @@
@kStrongify(self);
self.unlockPhotoView.image = image;
}];
self.pi_maskView.hidden = YES;
self.lockedView.hidden = NO;
}
}
@@ -227,6 +229,7 @@
_lockedView = [UILabel labelInitWithText:YMLocalizedString(@"PIRoomMessagePhotoAlbumView1") font:[UIFont systemFontOfSize:11 weight:UIFontWeightRegular] textColor:UIColorFromRGB(0xffffff)];
_lockedView.backgroundColor = UIColorRGBAlpha(0x9E9EA8, 0.8);
_lockedView.hidden = YES;
_lockedView.textAlignment = NSTextAlignmentCenter;
[_lockedView setCornerWithLeftTopCorner:6 rightTopCorner:6 bottomLeftCorner:6 bottomRightCorner:6 size:CGSizeMake(48, 24)];
}
return _lockedView;

View File

@@ -338,6 +338,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
///
- (void)scrollToBottom:(BOOL)animated {
if(self.datasource.count > 0){
[self.messageTableView.superview layoutIfNeeded];
NSIndexPath *ip = [NSIndexPath indexPathForRow:self.datasource.count-1 inSection:0]; //
[self.messageTableView scrollToRowAtIndexPath:ip atScrollPosition:UITableViewScrollPositionBottom animated:animated]; //
self.atCount = 0;
@@ -943,6 +944,9 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
self.lookUpModel = albumModel;
[browser show];
}
- (void)pIRoomMessagePhotoAlbumCell:(PIRoomMessagePhotoAlbumCell *)cell lookUpUserCardModel:(PIRoomPhotoAlbumItemModel *)albumModel{
[self.messageParser showUserCard:albumModel.uid.integerValue];
}
#pragma mark - PIRoomMessageUnlockPhotoAlbumViewDelegate
- (void)unlockRoomAlbumImageWithAlbumModel:(PIRoomPhotoAlbumItemModel *)albumModel{
[XNDJTDDLoadingTool showLoading];

View File

@@ -21,7 +21,7 @@
NSArray *list = [PIRoomPhotoAlbumItemModel modelsWithArray:data.data];
[[self getView]getRoomAlbumListSuccessWithList:list];
}fail:^(NSInteger code, NSString * _Nullable msg) {
[[self getView]getRoomAlbumListFail];
[[self getView]getRoomAlbumListFailWithCode:code];
} showLoading:NO errorToast:YES] roomUid:roomUid page:page pageSize:pageSize uid:uid ticket:ticket type:type] ;
}

View File

@@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
///获取已上传图片
-(void)getRoomAlbumListSuccessWithList:(NSArray *)list;
///获取已上传图片失败
-(void)getRoomAlbumListFail;
-(void)getRoomAlbumListFailWithCode:(NSInteger )code;
///上传房间图片成功
-(void)uploadRoomAlbumListSuccess;
///上传房间图片失败

View File

@@ -14,10 +14,17 @@ typedef enum : NSUInteger {
Photo_Album_Type_Unlock,///解锁照片
} PIRoomPhotoAlbumItemVCType;
@protocol PIRoomPhotoAlbumItemVCDelegate <NSObject>
///没权限返回
-(void)backWitNoPermissionAction;
@end
NS_ASSUME_NONNULL_BEGIN
@interface PIRoomPhotoAlbumItemVC : MvpViewController<JXCategoryListContentViewDelegate>
@property(nonatomic,weak) id<PIRoomPhotoAlbumItemVCDelegate>delegate;
- (instancetype)initWithType:(PIRoomPhotoAlbumItemVCType)type roomUid:(NSString *)roomUid;
@end

View File

@@ -121,7 +121,12 @@
}
}
///
-(void)getRoomAlbumListFail{
-(void)getRoomAlbumListFailWithCode:(NSInteger )code{
if(code == 1900){
if(self.delegate && [self.delegate respondsToSelector:@selector(backWitNoPermissionAction)]){
[self.delegate backWitNoPermissionAction];
}
}
[self.collectionView.mj_header endRefreshing];
[self.collectionView.mj_footer endRefreshing];
}
@@ -182,6 +187,19 @@
cell.delegate = self;
return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
PIRoomPhotoAlbumItemModel *albumModel = [self.photoList safeObjectAtIndex1:indexPath.row];
if(albumModel.type.intValue != 1)return;
PIRoomPhotoAlbumItemCell *cell = (PIRoomPhotoAlbumItemCell *)[self.collectionView cellForItemAtIndexPath:indexPath];
self.lookUpModel = albumModel;
SDPhotoBrowser *browser = [[SDPhotoBrowser alloc]init];
browser.sourceImagesContainerView = cell;
browser.delegate = self;
browser.imageCount = 1;
browser.currentImageIndex = 0;
browser.isMe = NO;
[browser show];
}
#pragma mark - JXCategoryListContentViewDelegate
- (UIView *)listView {
return self.view;
@@ -336,7 +354,7 @@
NSInteger row = [self.photoList indexOfObject:albumModel];
PIRoomPhotoAlbumItemCell *cell = (PIRoomPhotoAlbumItemCell *)[self.collectionView cellForItemAtIndexPath:[NSIndexPath indexPathForRow:row inSection:0]];
SDPhotoBrowser *browser = [[SDPhotoBrowser alloc]init];
if(cell !=nil){
if(cell != nil){
browser.sourceImagesContainerView = cell;
}
browser.delegate = self;

View File

@@ -10,7 +10,7 @@
#import <JXCategoryView/JXCategoryIndicatorBackgroundView.h>
#import <JXCategoryView/JXCategoryListContainerView.h>
#import "PIRoomPhotoAlbumItemVC.h"
@interface PIRoomPhotoAlbumVC ()<JXCategoryViewDelegate, JXCategoryListContainerViewDelegate>
@interface PIRoomPhotoAlbumVC ()<JXCategoryViewDelegate, JXCategoryListContainerViewDelegate,PIRoomPhotoAlbumItemVCDelegate>
///
@property (nonatomic, strong) NSArray<NSString *> *titles;
///
@@ -55,9 +55,14 @@
return list;
} else {
PIRoomPhotoAlbumItemVC *vc = [[PIRoomPhotoAlbumItemVC alloc]initWithType:index roomUid:self.roomUid];
vc.delegate = self;
return vc;
}
}
#pragma mark - PIRoomPhotoAlbumItemVCDelegate
- (void)backWitNoPermissionAction{
[self.navigationController popViewControllerAnimated:YES];
}
#pragma mark -
- (JXCategoryTitleView *)titleView {
if (!_titleView) {

View File

@@ -344,6 +344,9 @@
} else {
self.rewardIndex = (12 - self.currentIndex) + i +1;
}
if(self.rewardNumber > 11){
self.rewardNumber = 0;
}
break;
}
}

View File

@@ -531,8 +531,8 @@
}];
}
NSString * nick = userInfo.nick;
if (nick.length > 10) {
nick = [NSString stringWithFormat:@"%@…", [nick substringToIndex:10]];
if (nick.length > 8) {
nick = [NSString stringWithFormat:@"%@…", [nick substringToIndex:8]];
}
self.nickLabel.text = nick.length > 0 ? nick : @"";