修改聊天闪退

This commit is contained in:
启星
2025-12-06 16:55:26 +08:00
parent 9f8a36544b
commit 16c8869961
12 changed files with 288 additions and 15 deletions

View File

@@ -563,9 +563,15 @@
[weakSelf.categoryView setDefaultSelectedIndex:1]; [weakSelf.categoryView setDefaultSelectedIndex:1];
[weakSelf.categoryView reloadData]; [weakSelf.categoryView reloadData];
}else{ }else{
for (QXGiftLabelModel*md in weakSelf.titles) { ///
for (QXGiftLabelModel*md in list) {
if ([md.id isEqualToString:@"2"]) {
[weakSelf.titles removeObject:md];
continue;
}else{
[arr addObject:md.name]; [arr addObject:md.name];
} }
}
weakSelf.categoryView.titles = arr; weakSelf.categoryView.titles = arr;
[weakSelf.categoryView setDefaultSelectedIndex:0]; [weakSelf.categoryView setDefaultSelectedIndex:0];
[weakSelf.categoryView reloadData]; [weakSelf.categoryView reloadData];

View File

@@ -10,7 +10,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface QXRankHomeSubVC : QXBaseViewController<JXCategoryListContentViewDelegate> @interface QXRankHomeSubVC : UIViewController<JXCategoryListContentViewDelegate>
@property (nonatomic,strong)NSString *roomId; @property (nonatomic,strong)NSString *roomId;
/// 1日 2 周 3月 /// 1日 2 周 3月
@property (nonatomic,strong)NSString *dataType; @property (nonatomic,strong)NSString *dataType;

View File

@@ -24,6 +24,8 @@
@property (nonatomic, strong) QXRankCPTopThreeView *cpHeaderView; @property (nonatomic, strong) QXRankCPTopThreeView *cpHeaderView;
@property (nonatomic, strong) QXMyRankView *myRankView; @property (nonatomic, strong) QXMyRankView *myRankView;
@property (nonatomic, strong) NSMutableArray *topDataArray; @property (nonatomic, strong) NSMutableArray *topDataArray;
@property (nonatomic, strong) NSMutableArray *dataArray;
@property (nonatomic, assign) NSInteger page;
@end @end
@implementation QXRankHomeSubVC @implementation QXRankHomeSubVC
@@ -37,19 +39,25 @@
} }
-(void)viewDidLayoutSubviews{ -(void)viewDidLayoutSubviews{
[super viewDidLayoutSubviews]; [super viewDidLayoutSubviews];
if (self.rankType == 4) {
self.tableView.frame = CGRectMake(0,kSafeAreaTop , SCREEN_WIDTH, self.view.height - kSafeAreaTop-10-self.myRankView.height);
}else{
self.myRankView.frame = CGRectMake(0, self.view.height-ScaleWidth(74)-kSafeAreaTop-kSafeAreaBottom, SCREEN_WIDTH, ScaleWidth(74)); self.myRankView.frame = CGRectMake(0, self.view.height-ScaleWidth(74)-kSafeAreaTop-kSafeAreaBottom, SCREEN_WIDTH, ScaleWidth(74));
self.tableView.frame = CGRectMake(0, self.rankTypeView.bottom+10, SCREEN_WIDTH, self.view.height - self.rankTypeView.height-20-self.myRankView.height-kSafeAreaTop-kSafeAreaBottom); self.tableView.frame = CGRectMake(0, self.rankTypeView.bottom+10, SCREEN_WIDTH, self.view.height - self.rankTypeView.height-20-self.myRankView.height-kSafeAreaTop-kSafeAreaBottom);
}
} }
-(void)initSubViews{ -(void)initSubViews{
self.bgImageHidden = YES; self.page = 1;
self.dataType = @"1"; self.dataType = @"1";
self.view.backgroundColor = [UIColor clearColor]; self.view.backgroundColor = [UIColor clearColor];
[self.view addSubview:self.rankTypeView]; [self.view addSubview:self.rankTypeView];
[self.view addSubview:self.myRankView]; [self.view addSubview:self.myRankView];
if (self.rankType == 4) { if (self.rankType == 4) {
self.rankTypeView.hidden = YES;
self.tableView.tableHeaderView = self.cpHeaderView; self.tableView.tableHeaderView = self.cpHeaderView;
self.myRankView.isCP = YES; self.myRankView.isCP = YES;
}else{ }else{
self.rankTypeView.hidden = NO;
self.myRankView.isCP = NO; self.myRankView.isCP = NO;
self.tableView.tableHeaderView = self.headerView; self.tableView.tableHeaderView = self.headerView;
} }
@@ -266,4 +274,11 @@
} }
return _topDataArray; return _topDataArray;
} }
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
@end @end

View File

@@ -44,7 +44,7 @@
self.view.backgroundColor = [UIColor clearColor]; self.view.backgroundColor = [UIColor clearColor];
// self.titles = @[@"房间榜", @"财富榜", @"魅力榜",@"公会榜",@"真爱榜"]; // self.titles = @[@"房间榜", @"财富榜", @"魅力榜",@"公会榜",@"真爱榜"];
self.titles = @[@"房间榜", @"财富榜", @"魅力榜",@"真爱榜"]; self.titles = @[@"房间榜", @"财富榜", @"魅力榜",@"心动榜"];
self.listVCArray = [NSMutableArray array]; self.listVCArray = [NSMutableArray array];
self.categoryView = [[JXCategoryTitleView alloc] init]; self.categoryView = [[JXCategoryTitleView alloc] init];
self.categoryView.frame = CGRectMake(0, 0, SCREEN_WIDTH-100, 44); self.categoryView.frame = CGRectMake(0, 0, SCREEN_WIDTH-100, 44);

View File

@@ -44,6 +44,9 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,strong)NSString* user_avatar; @property (nonatomic,strong)NSString* user_avatar;
@property (nonatomic,strong)NSString* user_avatar1; @property (nonatomic,strong)NSString* user_avatar1;
@property (nonatomic,strong)NSString* exp;
@property (nonatomic,strong)NSString* level;
@end @end

View File

@@ -22,7 +22,8 @@
[self.headerImageView1 sd_setImageWithURL:[NSURL URLWithString:model.user_avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]]; [self.headerImageView1 sd_setImageWithURL:[NSURL URLWithString:model.user_avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
[self.headerImageView2 sd_setImageWithURL:[NSURL URLWithString:model.user_avatar1] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]]; [self.headerImageView2 sd_setImageWithURL:[NSURL URLWithString:model.user_avatar1] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.nameLabel.text = [NSString stringWithFormat:@"%@\n%@",model.nickname,model.nickname1]; self.nameLabel.text = [NSString stringWithFormat:@"%@\n%@",model.nickname,model.nickname1];
self.valueLabel.text = [NSString qx_showHotCountNum:model.total.longLongValue]; // self.valueLabel.text = [NSString qx_showHotCountNum:model.total.longLongValue];
self.valueLabel.text = [NSString stringWithFormat:@"Lv %@",model.total];
self.numberLabel.text = model.rank; self.numberLabel.text = model.rank;
} }
- (void)awakeFromNib { - (void)awakeFromNib {

View File

@@ -55,7 +55,7 @@
[self.firstHeaderImage2 sd_setImageWithURL:[NSURL URLWithString:firstModel.user_avatar1] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]]; [self.firstHeaderImage2 sd_setImageWithURL:[NSURL URLWithString:firstModel.user_avatar1] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.firstNameLabel.text = firstModel.nickname; self.firstNameLabel.text = firstModel.nickname;
self.firstIDLabel.text = firstModel.nickname1; self.firstIDLabel.text = firstModel.nickname1;
self.firstRankValueLabel.text = firstModel.total; self.firstRankValueLabel.text = [NSString stringWithFormat:@"Lv %@",firstModel.total];
} }
if (secondModel) { if (secondModel) {
@@ -63,7 +63,8 @@
[self.secondHeaderImage2 sd_setImageWithURL:[NSURL URLWithString:secondModel.user_avatar1] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]]; [self.secondHeaderImage2 sd_setImageWithURL:[NSURL URLWithString:secondModel.user_avatar1] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.secondNameLabel.text = secondModel.nickname; self.secondNameLabel.text = secondModel.nickname;
self.secondIDLabel.text = secondModel.nickname1; self.secondIDLabel.text = secondModel.nickname1;
self.secondRankValueLabel.text = secondModel.total; // self.secondRankValueLabel.text = secondModel.total;
self.secondRankValueLabel.text = [NSString stringWithFormat:@"Lv %@",secondModel.total];
} }
if (thirdModel) { if (thirdModel) {
@@ -71,7 +72,8 @@
[self.thirdHeaderImage2 sd_setImageWithURL:[NSURL URLWithString:thirdModel.user_avatar1] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]]; [self.thirdHeaderImage2 sd_setImageWithURL:[NSURL URLWithString:thirdModel.user_avatar1] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.thirdNameLabel.text = thirdModel.nickname; self.thirdNameLabel.text = thirdModel.nickname;
self.thirdIDLabel.text = thirdModel.nickname1; self.thirdIDLabel.text = thirdModel.nickname1;
self.thirdRankValueLabel.text = thirdModel.total; // self.thirdRankValueLabel.text = thirdModel.total;
self.thirdRankValueLabel.text = [NSString stringWithFormat:@"Lv %@",thirdModel.total];
} }
} }

View File

@@ -0,0 +1,32 @@
//
// QXHapticManager.h
// QXLive
//
// Created by 启星 on 2025/12/5.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXHapticManager : NSObject
+ (instancetype)shared;
// 检查是否支持触觉反馈
+ (BOOL)isHapticFeedbackSupported;
// 各种触觉反馈方法
- (void)impactWithStyle:(UIImpactFeedbackStyle)style;
- (void)impactMedium;
- (void)notificationWithType:(UINotificationFeedbackType)type;
- (void)selectionChanged;
// 带准备的触觉反馈
- (void)prepareImpactWithStyle:(UIImpactFeedbackStyle)style;
- (void)triggerPreparedImpact;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,172 @@
//
// QXQXQXHapticManager.m
// QXLive
//
// Created by on 2025/12/5.
//
#import "QXHapticManager.h"
#import <sys/utsname.h>
@interface QXHapticManager ()
@property (nonatomic, strong) UIImpactFeedbackGenerator *impactGenerator;
@property (nonatomic, strong) UINotificationFeedbackGenerator *notificationGenerator;
@property (nonatomic, strong) UISelectionFeedbackGenerator *selectionGenerator;
@property (nonatomic, assign) BOOL isImpactPrepared;
@property (nonatomic, assign) UIImpactFeedbackStyle preparedStyle;
@end
@implementation QXHapticManager
+ (instancetype)shared {
static QXHapticManager *instance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
instance = [[QXHapticManager alloc] init];
});
return instance;
}
- (instancetype)init {
self = [super init];
if (self) {
_isImpactPrepared = NO;
//
_impactGenerator = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleMedium];
_notificationGenerator = [[UINotificationFeedbackGenerator alloc] init];
_selectionGenerator = [[UISelectionFeedbackGenerator alloc] init];
//
[self prepareAllGenerators];
}
return self;
}
#pragma mark -
+ (BOOL)isHapticFeedbackSupported {
if (@available(iOS 10.0, *)) {
//
NSString *deviceModel = [[UIDevice currentDevice] model];
// iPhone 7
// 使
// 使 sysctlbyname
struct utsname systemInfo;
uname(&systemInfo);
NSString *deviceIdentifier = [NSString stringWithCString:systemInfo.machine
encoding:NSUTF8StringEncoding];
// iPhone 7
NSArray *supportedDevices = @[
@"iPhone9,", @"iPhone10,", @"iPhone11,", @"iPhone12,",
@"iPhone13,", @"iPhone14,", @"iPhone15,", @"iPhone16,",
@"iPhone8,4" // iPhone SE ()
];
BOOL isSupportedDevice = NO;
for (NSString *prefix in supportedDevices) {
if ([deviceIdentifier hasPrefix:prefix]) {
isSupportedDevice = YES;
break;
}
}
// YES
#if TARGET_IPHONE_SIMULATOR
return YES;
#else
return isSupportedDevice;
#endif
}
return NO;
}
- (void)prepareAllGenerators {
if (![QXHapticManager isHapticFeedbackSupported]) {
return;
}
// 线
dispatch_async(dispatch_get_main_queue(), ^{
[self.impactGenerator prepare];
[self.notificationGenerator prepare];
[self.selectionGenerator prepare];
});
}
#pragma mark -
- (void)impactWithStyle:(UIImpactFeedbackStyle)style {
if (![QXHapticManager isHapticFeedbackSupported]) {
return;
}
dispatch_async(dispatch_get_main_queue(), ^{
//
UIImpactFeedbackGenerator *generator = [[UIImpactFeedbackGenerator alloc] initWithStyle:style];
[generator prepare];
[generator impactOccurred];
//
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[generator prepare];
});
});
}
- (void)impactMedium {
[self impactWithStyle:UIImpactFeedbackStyleMedium];
}
#pragma mark -
- (void)prepareImpactWithStyle:(UIImpactFeedbackStyle)style {
if (![QXHapticManager isHapticFeedbackSupported]) {
return;
}
self.preparedStyle = style;
dispatch_async(dispatch_get_main_queue(), ^{
//
self.impactGenerator = [[UIImpactFeedbackGenerator alloc] initWithStyle:style];
[self.impactGenerator prepare];
self.isImpactPrepared = YES;
});
}
- (void)triggerPreparedImpact {
if (![QXHapticManager isHapticFeedbackSupported] || !self.isImpactPrepared) {
return;
}
dispatch_async(dispatch_get_main_queue(), ^{
if (self.impactGenerator) {
[self.impactGenerator impactOccurred];
//
[self.impactGenerator prepare];
}
});
}
#pragma mark -
- (void)notificationWithType:(UINotificationFeedbackType)type {
if (![QXHapticManager isHapticFeedbackSupported]) {
return;
}
dispatch_async(dispatch_get_main_queue(), ^{
[self.notificationGenerator notificationOccurred:type];
[self.notificationGenerator prepare];
});
}
- (void)selectionChanged {
if (![QXHapticManager isHapticFeedbackSupported]) {
return;
}
dispatch_async(dispatch_get_main_queue(), ^{
[self.selectionGenerator selectionChanged];
[self.selectionGenerator prepare];
});
}
@end

View File

@@ -420,6 +420,7 @@
} }
self.nameLabel.text = userModel.nickname; self.nameLabel.text = userModel.nickname;
self.idLabel.text = [NSString stringWithFormat:@"ID:%@",userModel.user_code]; self.idLabel.text = [NSString stringWithFormat:@"ID:%@",userModel.user_code];
self.bodyPriceMoneyLabel.text = userModel.market_value;
UILabel *followLabel = [self viewWithTag:10]; UILabel *followLabel = [self viewWithTag:10];
UILabel *fansLabel = [self viewWithTag:11]; UILabel *fansLabel = [self viewWithTag:11];
UILabel *lookLabel = [self viewWithTag:12]; UILabel *lookLabel = [self viewWithTag:12];

View File

@@ -10,6 +10,7 @@
#import "UIButton+QX.h" #import "UIButton+QX.h"
#import "QXCOSUploadManager.h" #import "QXCOSUploadManager.h"
#import "QXMineNetwork.h" #import "QXMineNetwork.h"
#import "QXHapticManager.h"
@interface QXAudioRecorderView() <AVAudioRecorderDelegate, AVAudioPlayerDelegate,UIGestureRecognizerDelegate> @interface QXAudioRecorderView() <AVAudioRecorderDelegate, AVAudioPlayerDelegate,UIGestureRecognizerDelegate>
// UI Components // UI Components
@@ -63,6 +64,8 @@
} }
- (void)setupUI { - (void)setupUI {
BOOL isSupported = [QXHapticManager isHapticFeedbackSupported];
NSLog(@"触觉反馈支持: %@", isSupported ? @"是" : @"否");
self.backgroundColor = [UIColor whiteColor]; self.backgroundColor = [UIColor whiteColor];
[self addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)]; [self addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
@@ -248,14 +251,18 @@
- (void)handleLongPress:(UILongPressGestureRecognizer *)gesture { - (void)handleLongPress:(UILongPressGestureRecognizer *)gesture {
CGPoint touchPoint = [gesture locationInView:self]; CGPoint touchPoint = [gesture locationInView:self];
UIImpactFeedbackGenerator *generator = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleMedium];
[generator prepare];
[generator impactOccurred];
switch (gesture.state) { switch (gesture.state) {
case UIGestureRecognizerStateBegan: case UIGestureRecognizerStateBegan:{
[self stopPlayback]; [self stopPlayback];
// [[QXHapticManager shared] impactMedium];
NSLog(@"开始录制 - 第%ld段", (long)self.recordingSessionCount + 1); NSLog(@"开始录制 - 第%ld段", (long)self.recordingSessionCount + 1);
self.isCancelled = NO; self.isCancelled = NO;
[self startRecording]; [self startRecording];
break;
} break;
case UIGestureRecognizerStateChanged: case UIGestureRecognizerStateChanged:
// //

View File

@@ -66,9 +66,43 @@
-(void)reloadConversationList{ -(void)reloadConversationList{
self.settingDataProvider.delegate = nil; self.settingDataProvider.delegate = nil;
self.settingDataProvider = nil; self.settingDataProvider = nil;
[_tableViewForAll removeFromSuperview];
_tableViewForAll.delegate = nil;
_tableViewForAll = nil;
TUIConversationListDataProvider *dataProvider = [[TUIConversationListDataProvider alloc] init]; TUIConversationListDataProvider *dataProvider = [[TUIConversationListDataProvider alloc] init];
self.settingDataProvider = dataProvider; self.settingDataProvider = dataProvider;
[_tableViewForAll setDataProvider:dataProvider]; [self.tableViewContainer addSubview:self.tableViewForAll];
if (self.isShowConversationGroup) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NSArray *extensionList = [TUICore getExtensionList:TUICore_TUIConversationExtension_ConversationGroupListBanner_ClassicExtensionID param:nil];
@weakify(self);
[[[RACObserve(self, actualShowConversationGroup) distinctUntilChanged] skip:0] subscribeNext:^(NSNumber *showConversationGroup) {
@strongify(self);
if ([showConversationGroup boolValue]) {
[self.tableViewContainer setFrame:CGRectMake(0, self.groupView.mm_maxY, self.view.mm_w, self.viewHeight - self.groupView.mm_maxY)];
self.groupItemList = [NSMutableArray array];
[self addGroup:self.allGroupItem];
for (TUIExtensionInfo *info in extensionList) {
TUIConversationGroupItem *groupItem = info.data[TUICore_TUIConversationExtension_ConversationGroupListBanner_GroupItemKey];
if (groupItem) {
[self addGroup:groupItem];
}
}
[self onSelectGroup:self.allGroupItem];
} else {
self.tableViewContainer.frame = CGRectMake(0, self.bannerView.mm_maxY, self.view.mm_w, self.viewHeight - self.bannerView.mm_maxY);
self.tableViewForAll.frame = self.tableViewContainer.bounds;
}
}];
self.actualShowConversationGroup = (extensionList.count > 0);
});
} else {
self.tableViewContainer.frame = CGRectMake(0, 0, self.view.mm_w, self.viewHeight - TabBar_Height-NavBar_Height-StatusBar_Height);
self.tableViewForAll.frame = self.tableViewContainer.bounds;
}
} }
#pragma mark - Life Cycle #pragma mark - Life Cycle
- (void)viewDidLoad { - (void)viewDidLoad {