修复bug

This commit is contained in:
liyuhua
2023-10-31 18:02:12 +08:00
parent e5ae6d3157
commit edff4262a6
14 changed files with 68 additions and 18 deletions

View File

@@ -44,7 +44,9 @@ NS_ASSUME_NONNULL_BEGIN
//@property (nonatomic, strong) NSArray<> *gold2GiftIds;
@property (nonatomic, strong) NSArray *openRooms;
@property(nonatomic,assign) NSInteger beginSecond;
///红包有效时间
@property(nonatomic,assign) NSInteger endSecond;
@end
NS_ASSUME_NONNULL_END

View File

@@ -106,7 +106,8 @@
self.messageInfo = info;
//
NSTimeInterval now = [[NSDate date] timeIntervalSince1970];
if (now - model.message.timestamp > 60*30) {
NSInteger time = [self getTimeDifferenceWithTimestamp:now beginTime:info.endTime / 1000];
if (time <= 0) {
self.titleLabel.text = YMLocalizedString(@"MessageContentRedPacketView0");
self.descLabel.text = YMLocalizedString(@"MessageContentRedPacketView1");
self.subLabel.hidden = YES;
@@ -134,7 +135,12 @@
}
}
}
-(NSInteger)getTimeDifferenceWithTimestamp:(long)timestamp beginTime:(long)beginTime {
NSString *time1 = [NSDate timestampSwitchTime:(NSInteger)timestamp formatter:@"YYYY-MM-dd hh:mm:ss"];
NSString *time2 = [NSDate timestampSwitchTime:(NSInteger)beginTime formatter:@"YYYY-MM-dd hh:mm:ss"];
NSInteger second = [NSDate pleaseInsertStarTimeo:time1 andInsertEndTime:time2];
return second;
}
- (void)event:(UITapGestureRecognizer *)gesture {
UIViewController * controllerView = [XCCurrentVCStackManager shareManager].getCurrentVC;
//退 TODO

View File

@@ -87,6 +87,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
self = [super init];
if (self) {
self.isLoadHistoryMessage = YES;
self.hostDelegate = delegate;
[self initSubViews];
[self initSubViewConstraints];
@@ -388,7 +389,11 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
return YES;
}else if(attachment.first == CustomMessageType_Gift) {
if(attachment.data[@"isRoomAlbum"] != nil){
return NO ;
BOOL isRoomAlbum = [attachment.data[@"isRoomAlbum"] boolValue];
if(isRoomAlbum == YES){
return NO;
}
}
}
return [[[self supportMessageDic] objectForKey:@(attachment.first)] containsObject:@(attachment.second)];
@@ -652,7 +657,9 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content;
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
if (content.eventType == NIMChatroomEventTypeEnter) {
if (roomInfo.isCloseScreen) {
self.isLoadHistoryMessage = NO;
AttachmentModel *attachement = [[AttachmentModel alloc]init];
attachement.first = CustomMessageType_Update_RoomInfo;
attachement.second = Custom_Message_Sub_Update_RoomInfo_MessageState;
@@ -667,8 +674,10 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
NIMChatroomNotificationMember *member = content.targets[0];
if (member.userId.integerValue == [AccountInfoStorage instance].getUid.integerValue) {
///
if(self.datasource.count > 0)return;
[self handleFetchHistoryMessage:message];
} else {
self.isLoadHistoryMessage = NO;
BOOL hideEnter = [self handleHideEnter:message];
if (!hideEnter) {
///
@@ -707,6 +716,9 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
option.order = NIMMessageSearchOrderAsc;
option.messageTypes = @[@(NIMMessageTypeText),@(NIMMessageTypeCustom)];
[[NIMSDK sharedSDK].chatroomManager fetchMessageHistory:roomId option:option result:^(NSError * _Nullable error, NSArray<NIMMessage *> * _Nullable messages) {
if(error != nil){
self.isLoadHistoryMessage = NO;
}
if (messages.count) {
//50
if (messages.count == [ClientConfig shareConfig].configInfo.roomMessageCount) {

View File

@@ -44,7 +44,7 @@
- (void)textFieldDidChange:(UITextField *)textField {
if(textField.text.length <= 0){
textField.text = @"";
self.pi_numView.text = [NSString stringWithFormat:@"0/20"];
self.pi_numView.text = [NSString stringWithFormat:@"0/10"];
return;
}
if(textField.text.length > 10){

View File

@@ -35,6 +35,8 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic,copy) NSString *redEnvelopeNum;
// 1 无门槛红包 2 关注红包 3 分享红包 4 弹幕红包
@property(nonatomic, assign) int kind;
///红包有效时间
@property(nonatomic,assign) NSInteger endTime;
@end
NS_ASSUME_NONNULL_END

View File

@@ -7,9 +7,17 @@
#import <UIKit/UIKit.h>
#import "XPRedPacketResultModel.h"
@protocol PIReceiveRedPacketSuccessViewDelegate <NSObject>
-(void)closeedPacketSuccessView;
@end
NS_ASSUME_NONNULL_BEGIN
@interface PIReceiveRedPacketSuccessView : UIView
@property(nonatomic,weak) id<PIReceiveRedPacketSuccessViewDelegate>delegate;
@property(nonatomic,strong) XPRedPacketResultModel *resultModel;
@end

View File

@@ -120,7 +120,10 @@
}
#pragma mark - action
- (void)onCloseButtonClick:(UIButton *)sender {
[self.superview removeFromSuperview];
if(self.delegate && [self.delegate respondsToSelector:@selector(closeedPacketSuccessView)]){
[self.delegate closeedPacketSuccessView];
}
}
-(void)setResultModel:(XPRedPacketResultModel *)resultModel{

View File

@@ -185,6 +185,9 @@
[XNDJTDDLoadingTool hideHUD];
if(code == 200){
XPRedPacketModel *redModel = [XPRedPacketModel modelWithJSON:data.data];
if(redModel.kind == 0){
redModel.kind = 1;
}
redModel.timestamp = data.timestamp;
redModel.sendUserNick = data.data[@"nick"];
redModel.sendUserAvatar = data.data[@"avatar"];

View File

@@ -17,6 +17,7 @@
#import "RoomInfoModel.h"
#import "XPIAPRechargeViewController.h"
#import "XCCurrentVCStackManager.h"
#import "ClientConfig.h"
@interface PIRoomSendRedPacketItemVC ()<PIRedPacketChooseTypeViewDelegate,XPRoomRedPacketPwdViewDelegate>
///host
@@ -383,7 +384,11 @@
}
- (UILabel *)tipsView{
if(!_tipsView){
_tipsView = [UILabel labelInitWithText:YMLocalizedString(@"PIRoomSendRedPacketItemVC6") font:kFontRegular(12) textColor:UIColorFromRGB(0x94959C)];
CGFloat time = [ClientConfig shareConfig].configInfo.redEnvelopeConfig.endSecond / 3600.0;
NSString *timeStr = [NSString stringWithFormat:@"%.1f",time];
timeStr = [timeStr stringByReplacingOccurrencesOfString:@".0" withString:@""];
_tipsView = [UILabel labelInitWithText:[NSString stringWithFormat:YMLocalizedString(@"PIRoomSendRedPacketItemVC6"),timeStr] font:kFontRegular(12) textColor:UIColorFromRGB(0x94959C)];
}
return _tipsView;
}

View File

@@ -27,7 +27,7 @@
#import "CountDownHelper.h"
#import "PIReceiveRedPacketSuccessView.h"
@interface XPReceiveRedPacketView()<CountDownHelperDelegate>
@interface XPReceiveRedPacketView()<CountDownHelperDelegate,PIReceiveRedPacketSuccessViewDelegate>
@property (nonatomic, strong) XPRedPacketResultModel *resultData;
@@ -418,6 +418,7 @@
sender.enabled = YES;
if (code != 200) {
[XNDJTDDLoadingTool showErrorWithMessage:msg];
[sender.layer removeAllAnimations];
return;;
}
XPRedPacketResultModel *model = [XPRedPacketResultModel modelWithJSON:data.data];
@@ -441,10 +442,14 @@
[[NSNotificationCenter defaultCenter]postNotificationName:@"kOpenRedPacketResult" object:resultData];
PIReceiveRedPacketSuccessView *successView = [[PIReceiveRedPacketSuccessView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
successView.resultModel = resultData;
successView.delegate = self;
[self addSubview:successView];
}
#pragma mark - PIReceiveRedPacketSuccessViewDelegate
- (void)closeedPacketSuccessView{
[self onCloseButtonClick];
}
#pragma mark- CountDownHelperDelegate
///
@@ -470,6 +475,7 @@
int second = (seconds)%60;
self.countDownView.text = [NSString stringWithFormat:@"%02d:%02d",minutes,second];
}
#pragma mark - action
- (void)onCloseButtonClick{
[self removeFromSuperview];

View File

@@ -1632,6 +1632,15 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
self.activityContainerView.redPacketList = redPacketList;
}else if(attachment.second == Custom_Message_Sub_NewRoomDiamandRedPacket){
XPRedPacketModel *curData = [XPRedPacketModel modelWithJSON:attachment.data];
if(self.activityContainerView.redPacketList == nil){
self.activityContainerView.redPacketList = [NSMutableArray array];
}
NSMutableArray *redPacketList = [NSMutableArray arrayWithArray:self.activityContainerView.redPacketList];
[redPacketList insertObject:curData atIndex:0];
if(self.roomInfo.uid > 0 && curData.redEnvelopeNum.integerValue != redPacketList.count){
[self.presenter getRedPacket:[NSString stringWithFormat:@"%ld", self.roomInfo.uid]];
return;
}
curData.redEnvelopeId = attachment.data[@"redEnvelopeId"];
if(curData.validityType == 0){
XPReceiveRedPacketView *view = [[XPReceiveRedPacketView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
@@ -1647,12 +1656,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self.view addSubview:view];
[self.view bringSubviewToFront:view];
}
if(self.activityContainerView.redPacketList == nil){
self.activityContainerView.redPacketList = [NSMutableArray array];
}
NSMutableArray *redPacketList = [NSMutableArray arrayWithArray:self.activityContainerView.redPacketList];
[redPacketList insertObject:curData atIndex:0];
self.activityContainerView.redPacketList = redPacketList;
}

View File

@@ -83,7 +83,7 @@
#import "PIFullScreenBannerAnimation.h"
#import <SVGA.h>
#import "Api+Gift.h"
#import "PIReceiveRedPacketSuccessView.h"

View File

@@ -3159,7 +3159,7 @@
"PIRoomSendRedPacketItemVC3"="个";
"PIRoomSendRedPacketItemVC4"="立即生效";
"PIRoomSendRedPacketItemVC5"="限时生效";
"PIRoomSendRedPacketItemVC6"="未抢完的红包将在12小时后返还你的钱包";
"PIRoomSendRedPacketItemVC6"="未抢完的红包将在%@小时后返还你的钱包";
"PIRoomSendRedPacketItemVC7"="请输入弹幕内容";
///PIInputScrollingView
"PIInputScrollingView0"="输入指定弹幕内容最多10个字符";

View File

@@ -3161,7 +3161,7 @@
"PIRoomSendRedPacketItemVC3"="個";
"PIRoomSendRedPacketItemVC4"="立即生效";
"PIRoomSendRedPacketItemVC5"="限時生效";
"PIRoomSendRedPacketItemVC6"="未搶完的紅包將在12小時後返還你的錢包";
"PIRoomSendRedPacketItemVC6"="未搶完的紅包將在%@小時後返還你的錢包";
"PIRoomSendRedPacketItemVC7"="請輸入彈幕內容";
///PIInputScrollingView
"PIInputScrollingView0"="輸入指定彈幕內容最多10個字符";