This commit is contained in:
启星
2025-09-30 19:42:20 +08:00
parent 2a44a06630
commit 87fc467652
42 changed files with 629 additions and 150 deletions

View File

@@ -33,6 +33,7 @@
#import "QXChirldModeViewController.h"
#import "QXAppVersionView.h"
#import "QXLoginNetwork.h"
#import "QXDrifRoomHourRankView.h"
@interface QXTabbarController ()<UITabBarControllerDelegate,QXTabBarDelegate,UINavigationControllerDelegate,MQTTClientModelDelegate,V2TIMConversationListener>
@property(nonatomic,strong) QXTabBar *customTabBar;
@@ -313,6 +314,9 @@
}else if([topic isEqualToString:qx_ac_topic]){
QXMeetActivityDriftModel *model = [QXMeetActivityDriftModel yy_modelWithJSON:message[@"msg"]];
[[QXMeetActivityDriftView shareView] addActivityModel:model];
}else if ([topic isEqualToString:qx_hour_ranking]){
NSArray *arr = [NSArray yy_modelArrayWithClass:[QXRoomHourDriftModel class] json:message[@"msg"]];
[[QXDrifRoomHourRankView shareView] addActivityModelList:arr];
}
}

View File

@@ -10,7 +10,9 @@
@interface QXAppVersionView()<UITextFieldDelegate>
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UIImageView *topImageView;
@property (nonatomic,strong)UIView *bottomView;
@property (nonatomic,strong)UIScrollView *scrollView;
@property (nonatomic,strong)UILabel *messageLabel;
@property (nonatomic,strong)UIButton *cancelBtn;
@property (nonatomic,strong)UIButton *commitBtn;
@@ -29,88 +31,64 @@
}
-(void)createViews{
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.5];
self.bgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-ScaleWidth(275))/2.0, -self.height, ScaleWidth(275), ScaleWidth(400))];
self.bgView.backgroundColor = [UIColor whiteColor];
self.bgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-ScaleWidth(275))/2.0, -self.height, ScaleWidth(275), ScaleWidth(362))];
// self.bgView.backgroundColor = [UIColor whiteColor];
[self.bgView addRoundedCornersWithRadius:16];
[self addSubview:self.bgView];
self.topImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"app_update_top_bg"]];
self.topImageView.frame = CGRectMake(0, 0, self.bgView.width, ScaleWidth(170));
[self.bgView addSubview:self.topImageView];
self.bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, self.topImageView.bottom-ScaleWidth(12), self.bgView.width, self.bgView.height-self.topImageView.height+ScaleWidth(12))];
self.bottomView.backgroundColor = RGB16(0xffffff);
[self.bottomView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerBottomLeft|UIRectCornerBottomRight)];
[self.bgView addSubview:self.bottomView];
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
self.titleLabel.text = QXText(@"发现新版本");
self.titleLabel.textColor = RGB16(0x333333);
[self.bgView addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.bgView);
make.top.equalTo(self.bgView).offset(16);
make.height.mas_equalTo(24);
}];
self.commitBtn = [[UIButton alloc] init];
self.commitBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.bgView.width-ScaleWidth(110)-20, self.bottomView.height-42-12, ScaleWidth(110), 42)];
[self.commitBtn addRoundedCornersWithRadius:21];
self.commitBtn.backgroundColor = QXConfig.themeColor;
[self.commitBtn setTitle:QXText(@"确认") forState:(UIControlStateNormal)];
[self.commitBtn setTitle:QXText(@"立即升级") forState:(UIControlStateNormal)];
[self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.bgView addSubview:self.commitBtn];
[self.commitBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.bgView).offset(-12);
make.height.mas_equalTo(42);
make.width.mas_equalTo(ScaleWidth(110));
make.right.mas_equalTo(-20);
}];
[self.bottomView addSubview:self.commitBtn];
self.cancelBtn = [[UIButton alloc] init];
self.cancelBtn = [[UIButton alloc] initWithFrame:CGRectMake(20, self.bottomView.height-42-12, ScaleWidth(110), 42)];
[self.cancelBtn addRoundedCornersWithRadius:21];
self.cancelBtn.backgroundColor = RGB16(0xF3F3F3);
[self.cancelBtn setTitle:QXText(@"取消") forState:(UIControlStateNormal)];
[self.cancelBtn setTitleColor:RGB16(0x999999) forState:(UIControlStateNormal)];
self.cancelBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.cancelBtn addTarget:self action:@selector(cancelAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.bgView addSubview:self.cancelBtn];
[self.cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.bgView).offset(-12);
make.height.mas_equalTo(42);
make.width.mas_equalTo(ScaleWidth(110));
make.left.mas_equalTo(20);
}];
[self.bottomView addSubview:self.cancelBtn];
self.messageLabel = [[UILabel alloc] init];
self.messageLabel.font = [UIFont boldSystemFontOfSize:16];
self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(13, 0, self.bgView.width-26, self.commitBtn.top-13)];
[self.bottomView addSubview:self.scrollView];
self.messageLabel = [[UILabel alloc] initWithFrame:self.scrollView.bounds];
self.messageLabel.font = [UIFont boldSystemFontOfSize:14];
self.messageLabel.textColor = RGB16(0x000000);
self.messageLabel.textAlignment = NSTextAlignmentCenter;
self.messageLabel.numberOfLines = 0;
[self.bgView addSubview:self.messageLabel];
[self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.titleLabel.mas_bottom).offset(10);
make.left.equalTo(self.bgView).offset(16);
make.right.equalTo(self.bgView).offset(-16);
make.bottom.equalTo(self.commitBtn.mas_top).offset(-10);
}];
[self.scrollView addSubview:self.messageLabel];
}
-(void)setModel:(QXAppVersionModel *)model{
_model = model;
self.messageLabel.text = model.content;
// self.messageLabel.text = @"动环监控撒谎大健康撒谎科技打撒好看到货时间阿克汉登记卡撒大花洒科技活动极客飒户djsakljdk电视剧啊快回家读书卡多撒u一还有第四u啊个ID撒个hi打撒低功耗设计啊开工大吉萨嘎合计打撒好多个健身卡刚回到家撒合计扩大活动时间卡号大健康撒谎登记卡到货时间啊客户端健身卡核打静待花开撒会尽快的撒回到家凯撒会尽快的撒回到家凯撒会尽快的撒大花洒客户端手机卡击凯撒籍卡打撒";
[self.messageLabel sizeToFit];
self.scrollView.contentSize = CGSizeMake(self.bgView.width-26, self.messageLabel.height);
if (model.is_force.intValue == 1) {
self.cancelBtn.hidden = YES;
[self.commitBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.bgView).offset(-12);
make.height.mas_equalTo(42);
make.width.mas_equalTo(ScaleWidth(110));
make.centerX.equalTo(self.bgView);
}];
self.commitBtn.frame = CGRectMake((self.bgView.width-ScaleWidth(110))/2, self.bottomView.height-42-12, ScaleWidth(110), 42);
}else{
self.cancelBtn.hidden = NO;
[self.commitBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.bgView).offset(-12);
make.height.mas_equalTo(42);
make.width.mas_equalTo(ScaleWidth(110));
make.right.mas_equalTo(-20);
}];
self.commitBtn.frame = CGRectMake(self.bgView.width-ScaleWidth(110)-20, self.bottomView.height-42-12, ScaleWidth(110), 42);
}
}
-(void)cancelAction{
@@ -125,7 +103,7 @@
-(void)showInView:(UIView *)view{
[view addSubview:self];
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
self.bgView.y = (SCREEN_HEIGHT-ScaleWidth(300))/2.0;
self.bgView.y = (SCREEN_HEIGHT-ScaleWidth(362))/2.0;
} completion:^(BOOL finished) {
}];

View File

@@ -0,0 +1,38 @@
//
// QXDrifRoomHourRankView.h
// QXLive
//
// Created by 启星 on 2025/9/29.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger) {
/// 第一名
QXDrifRoomHourRankTypeFirst = 1,
/// 第二名
QXDrifRoomHourRankTypeSecond = 2,
/// 第三名
QXDrifRoomHourRankTypeThird = 3,
}QXDrifRoomHourRankType;
NS_ASSUME_NONNULL_BEGIN
@class QXRoomHourDriftModel;
@interface QXDrifRoomHourRankView : UIView
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)NSMutableArray *dataArray;
@property (nonatomic,strong)QXRoomHourDriftModel *model;
-(void)addActivityModel:(QXRoomHourDriftModel*)model;
-(void)addActivityModelList:(NSArray<QXRoomHourDriftModel*>*)list;
-(void)drifPopIsClose:(BOOL)isClose;
+(instancetype)shareView;
@end
@interface QXRoomHourDriftModel : NSObject
@property (nonatomic,strong)NSString *room_id;
@property (nonatomic,strong)NSString *room_name;
@property (nonatomic,strong)NSString *text;
@property (nonatomic,assign)NSInteger rank_number;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,174 @@
//
// QXDrifRoomHourRankView.m
// QXLive
//
// Created by on 2025/8/29.
//
#import "QXDrifRoomHourRankView.h"
@interface QXDrifRoomHourRankView()
@property (nonatomic,assign)BOOL isPlaying;
@property (nonatomic,assign)BOOL isClose;
@end
@implementation QXDrifRoomHourRankView
- (instancetype)init
{
self = [super init];
if (self) {
self.frame = CGRectMake(SCREEN_WIDTH, ScaleWidth(200), SCREEN_WIDTH, ScaleWidth(90));
BOOL isClose = [[NSUserDefaults standardUserDefaults] boolForKey:kIsCloseDrifPop];
self.isClose = isClose;
[self initSubviews];
}
return self;
}
+(instancetype)shareView{
static QXDrifRoomHourRankView *manager = nil;
static dispatch_once_t predicate;
dispatch_once(&predicate, ^{
manager = [[QXDrifRoomHourRankView alloc] init];
});
return manager;
}
-(void)initSubviews{
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ac_meet_start_pop_bg"]];
self.bgImageView.contentMode = UIViewContentModeScaleToFill;
[self addSubview:self.bgImageView];
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(SCREEN_WIDTH);
make.height.mas_equalTo(ScaleWidth(90));
make.centerX.equalTo(self);
make.top.equalTo(self);
}];
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.font = [UIFont systemFontOfSize:12];
self.titleLabel.textColor = RGB16(0xFFFFFF);
[self addSubview:self.titleLabel];;
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.bgImageView).offset(ScaleWidth(53));
make.centerY.equalTo(self.bgImageView);
}];
self.userInteractionEnabled = YES;
MJWeakSelf
[self addTapBlock:^(id _Nonnull obj) {
if ([weakSelf.model.room_id isExist]) {
[[QXGlobal shareGlobal] joinRoomWithRoomId:weakSelf.model.room_id isRejoin:NO navagationController:weakSelf.viewController.navigationController];
}
}];
}
-(void)addActivityModel:(QXRoomHourDriftModel *)model{
if (self.isClose) {
return;
}
[self.dataArray addObject:model];
[self giftAction];
}
-(void)addActivityModelList:(NSArray<QXRoomHourDriftModel *> *)list{
if (self.isClose) {
return;
}
[self.dataArray addObjectsFromArray:list];
[self giftAction];
}
-(void)giftAction{
if (self.isPlaying) {
return;
}
MJWeakSelf
[QXDrifRoomHourRankView shareView].isPlaying = YES;
[QXDrifRoomHourRankView shareView].model = [QXDrifRoomHourRankView shareView].dataArray.firstObject;
[KEYWINDOW addSubview:[QXDrifRoomHourRankView shareView]];
[UIView animateWithDuration:1.5 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
[QXDrifRoomHourRankView shareView].x = 0;
} completion:^(BOOL finished) {
NSInteger dalayTime = 5;
if (weakSelf.model.rank_number == 1) {
dalayTime = 5;
}else if (weakSelf.model.rank_number == 2){
dalayTime = 4;
}else if (weakSelf.model.rank_number == 2){
dalayTime = 3;
}
[weakSelf performSelector:@selector(dissmissAnimate) afterDelay:dalayTime];
}];
}
-(void)dissmissAnimate{
[UIView animateWithDuration:2 delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{
[QXDrifRoomHourRankView shareView].x = -SCREEN_WIDTH;
} completion:^(BOOL finished) {
[QXDrifRoomHourRankView shareView].x = SCREEN_WIDTH;
[[QXDrifRoomHourRankView shareView] removeFromSuperview];
[[QXDrifRoomHourRankView shareView].dataArray removeFirstObject];
[QXDrifRoomHourRankView shareView].isPlaying = NO;
if ([QXDrifRoomHourRankView shareView].dataArray.count>0) {
[[QXDrifRoomHourRankView shareView] giftAction];
}
}];
}
-(void)setModel:(QXRoomHourDriftModel *)model{
_model = model;
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:model.text];
switch (model.rank_number) {
case QXDrifRoomHourRankTypeFirst:{
self.bgImageView.image = [UIImage imageNamed:@"room_hour_rank_drif_first"];
if ([model.room_name isExist]) {
[attr yy_setColor:RGB16(0xFFFA63) range:[model.text rangeOfString:model.room_name]];
}
}
break;
case QXDrifRoomHourRankTypeSecond:{
self.bgImageView.image = [UIImage imageNamed:@"room_hour_rank_drif_second"];
if ([model.room_name isExist]) {
[attr yy_setColor:RGB16(0xFEFE20) range:[model.text rangeOfString:model.room_name]];
}
}
break;
case QXDrifRoomHourRankTypeThird:{
self.bgImageView.image = [UIImage imageNamed:@"room_hour_rank_drif_third"];
if ([model.room_name isExist]) {
[attr yy_setColor:RGB16(0x1FFFE5) range:[model.text rangeOfString:model.room_name]];
}
}
break;
default:
break;
}
self.titleLabel.attributedText = attr;
}
-(void)drifPopIsClose:(BOOL)isClose{
_isClose = isClose;
self.hidden = self.isClose;
[[NSUserDefaults standardUserDefaults] setBool:isClose forKey:kIsCloseDrifPop];
[[NSUserDefaults standardUserDefaults] synchronize];
if (isClose) {
[QXDrifRoomHourRankView shareView].x = SCREEN_WIDTH;
[[QXDrifRoomHourRankView shareView] removeFromSuperview];
[[QXDrifRoomHourRankView shareView].dataArray removeAllObjects];
[QXDrifRoomHourRankView shareView].isPlaying = NO;
}
}
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
@end
@implementation QXRoomHourDriftModel
@end