修复房间相册bug

This commit is contained in:
liyuhua
2023-10-18 17:16:50 +08:00
parent 83c26770a4
commit f8f6f04b0d
6 changed files with 29 additions and 14 deletions

View File

@@ -6,12 +6,14 @@
//
#import <Foundation/Foundation.h>
#import "XPMessageRemoteExtModel.h"
#import "PIRoomPhotoAlbumItemModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface XPMessageInfoModel : NSObject
@property(nonatomic,strong) PIRoomPhotoAlbumItemModel *albumModel;
@property(nonatomic,strong) NSString *charmUrl;
@property(nonatomic,strong) NSString *experUrl;
@property(nonatomic,assign) int first;
@property(nonatomic,copy) NSDictionary * data;
@property(nonatomic,copy) NSString *nameText;
///显示文本
@property (nonatomic,strong) NSAttributedString *content;

View File

@@ -145,14 +145,26 @@
}else if (first == CustomMessageType_Treasure_Fairy) {
return [self createTreasureFairyAttribute:attachment messageInfo:messageInfo];
}else if (first == CustomMessageType_Room_Album) {
NSDictionary *userInfo = attachment.data[@"user"];
NSDictionary *userLevel = attachment.data[@"userLevel"];
if(userLevel != nil){
NSString *charmUrl = userLevel[@"charmUrl"];
NSString *experUrl = userLevel[@"experUrl"];
messageInfo.charmUrl = charmUrl;
messageInfo.experUrl = experUrl;
}
PIRoomPhotoAlbumItemModel *albumModel = [PIRoomPhotoAlbumItemModel modelWithDictionary:attachment.data[@"roomPhoto"]];
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * nick = [NSString stringWithFormat:@"%@:", ((NIMMessageChatroomExtension *)message.messageExt).roomNickname];
NSString * nick = @"";
if(userInfo != nil){
nick = [NSString stringWithFormat:@"%@:", userInfo[@"nick"]];
}
if ([message.from isEqualToString:uid]) {
nick = YMLocalizedString(@"XPRoomMessageParser0");
}
messageInfo.first = CustomMessageType_Room_Album;
messageInfo.nameText = nick;
messageInfo.data = attachment.data;
messageInfo.albumModel = albumModel;
return messageInfo;
}
return nil;

View File

@@ -173,19 +173,16 @@
- (void)setMessageInfo:(XPMessageInfoModel *)messageInfo {
_messageInfo = messageInfo;
if (_messageInfo) {
PIRoomPhotoAlbumItemModel *albumModel = [PIRoomPhotoAlbumItemModel modelWithDictionary:messageInfo.data[@"roomPhoto"]];
PIRoomPhotoAlbumItemModel *albumModel = _messageInfo.albumModel;
if([[XPSkillCardPlayerManager shareInstance].photoIdList containsObject:albumModel.ID] && ![albumModel.uid isEqualToString:[AccountInfoStorage instance].getUid] && albumModel.type.intValue == 2) {
albumModel.status = 1;
}else{
albumModel.status = 0;
}
NSDictionary *userLevel = messageInfo.data[@"userLevel"];
if(userLevel != nil){
NSString *charmUrl = userLevel[@"charmUrl"];
NSString *experUrl = userLevel[@"experUrl"];
self.charmView.imageUrl = charmUrl;
self.wealthView.imageUrl = experUrl;
}
self.charmView.imageUrl = _messageInfo.charmUrl;
self.wealthView.imageUrl = _messageInfo.experUrl;
self.albumModel = albumModel;
self.unlockPhotoView.albumModel = albumModel;
self.nameView.text = _messageInfo.nameText;

View File

@@ -7,6 +7,7 @@
#import <UIKit/UIKit.h>
#import "PIRoomPhotoAlbumItemModel.h"
#import "PIRoomPhotoAlbumItemVC.h"
@class PIRoomPhotoAlbumItemCell;
@protocol PIRoomPhotoAlbumItemCellDelegate <NSObject>
@@ -20,6 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface PIRoomPhotoAlbumItemCell : UICollectionViewCell
@property(nonatomic,weak) id<PIRoomPhotoAlbumItemCellDelegate>delegate;
@property(nonatomic,strong) PIRoomPhotoAlbumItemModel *albumModel;
@property(nonatomic,assign) PIRoomPhotoAlbumItemVCType roomType;
@end
NS_ASSUME_NONNULL_END

View File

@@ -79,7 +79,7 @@
_albumModel = albumModel;
@kWeakify(self);
self.coverView.hidden = _albumModel.type.intValue == 1;
self.operateBtn.hidden = ![_albumModel.uid isEqualToString:[AccountInfoStorage instance].getUid];
self.operateBtn.hidden = !([_albumModel.uid isEqualToString:[AccountInfoStorage instance].getUid] && self.roomType == Photo_Album_Type_Mine);
if(_albumModel.type.intValue == 2){
_pi_priceView.text = _albumModel.totalGoldPrice;
_lockView.hidden = _albumModel.status == 1;

View File

@@ -183,13 +183,15 @@
return cell;
}
PIRoomPhotoAlbumItemCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([PIRoomPhotoAlbumItemCell class]) forIndexPath:indexPath];
cell.roomType = self.type;
cell.albumModel = [self.photoList safeObjectAtIndex1:indexPath.row];
cell.delegate = self;
return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
if(self.type == Photo_Album_Type_Mine)return;
PIRoomPhotoAlbumItemModel *albumModel = [self.photoList safeObjectAtIndex1:indexPath.row];
if(albumModel.type.intValue != 1)return;
if(albumModel.type.intValue == 2 && albumModel.status == 0)return;
PIRoomPhotoAlbumItemCell *cell = (PIRoomPhotoAlbumItemCell *)[self.collectionView cellForItemAtIndexPath:indexPath];
self.lookUpModel = albumModel;
SDPhotoBrowser *browser = [[SDPhotoBrowser alloc]init];