新增 next-chat.mdc 文件以定义对话上下文的规则;在 Assets.xcassets 中添加多个图像资源及其对应的 Contents.json 文件;更新 AttachmentModel.h 中的枚举值以修正飘屏消息类型;在 SessionViewController.h 和 SessionViewController.m 中添加 userInfo 属性并调整相关逻辑;在 SessionListViewController.h 和 SessionListViewController.m 中优化会话列表的展示逻辑;在多个模型和视图文件中进行小幅调整以提升代码可读性和一致性。

This commit is contained in:
edwinQQQ
2025-07-02 15:52:48 +08:00
parent f0dad8886f
commit 8a096239da
55 changed files with 1708 additions and 432 deletions

View File

@@ -13,7 +13,6 @@
#import <JXCategoryView/JXCategoryView.h>
#import <MJRefresh/MJRefresh.h>
#import "SDWebImageManager.h"
#import "FirstRechargeManager.h"
///Tool
#import "Api+Home.h"
#import "YUMIMacroUitls.h"
@@ -330,8 +329,7 @@ JXCategoryViewDelegate,
XPHomeContainerProtocol,
XPNewHomeNavViewDelegate,
XPNewHomeHeadViewDelegate,
XPHomeRecommendOtherRoomViewDelegate,
FirstRechargeManagerDelegate>
XPHomeRecommendOtherRoomViewDelegate>
///
@property(nonatomic,strong) XPNewHomeHeadView *headView;
@@ -359,11 +357,6 @@ FirstRechargeManagerDelegate>
@property (nonatomic, assign) bool hasLoadAPIs;
//
@property (nonatomic, strong) XPWebViewController *firstChargeWebVC;
//
@property (nonatomic, strong) UIView *firstChargeBackgroundView;
@end
@implementation XPNewHomeViewController
@@ -377,7 +370,6 @@ FirstRechargeManagerDelegate>
-(void)dealloc{
[[NSNotificationCenter defaultCenter]removeObserver:self];
[FirstRechargeManager sharedManager].delegate = nil;
}
- (BOOL)isHiddenNavBar {
@@ -398,12 +390,6 @@ FirstRechargeManagerDelegate>
[self initSubViewConstraints];
[self requestCheckIp];
//
[FirstRechargeManager sharedManager].delegate = self;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[[FirstRechargeManager sharedManager] startMonitoring];
});
}
}
@@ -416,13 +402,10 @@ FirstRechargeManagerDelegate>
});
self.hasLoadAPIs = YES;
}
}
- (void)tokenInvalid {
//
[[FirstRechargeManager sharedManager] stopMonitoring];
[[AccountInfoStorage instance] saveAccountInfo:nil];
[[AccountInfoStorage instance] saveTicket:nil];
if ([NIMSDK sharedSDK].loginManager.isLogined) {
@@ -786,135 +769,7 @@ FirstRechargeManagerDelegate>
self.type = index;
}
- (void)getFirstChargeSuccess:(FirstRechargeModel *)model {
if (model.chargeStatus == NO) {
// TODO: web view
XPWebViewController *web = [[XPWebViewController alloc] initWithRoomUID:@""];
[self addChildViewController:web];
[self.view addSubview:web.view];
web.view.frame = CGRectMake(0, 0, KScreenWidth/2, KScreenHeight/2);
web.view.center = self.view.center;
}
}
#pragma mark - FirstRechargeManagerDelegate
- (void)firstRechargeManager:(FirstRechargeManager *)manager didCheckFirstRecharge:(FirstRechargeModel *)model shouldShow:(BOOL)shouldShow {
if (shouldShow && model.chargeStatus == NO) {
//
[self showFirstRechargePopup:model];
//
[[FirstRechargeManager sharedManager] markTodayShown];
}
}
- (void)showFirstRechargePopup:(FirstRechargeModel *)model {
if (model.chargeStatus) {
return;
}
//
[self removeFirstChargePopup];
// keyWindow tabbar
UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
if (!keyWindow) {
keyWindow = [UIApplication sharedApplication].windows.firstObject;
}
// 使 keyWindow bounds
self.firstChargeBackgroundView = [[UIView alloc] initWithFrame:keyWindow.bounds];
self.firstChargeBackgroundView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
//
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleBackgroundTap:)];
[self.firstChargeBackgroundView addGestureRecognizer:tapGesture];
// keyWindow tabbar
[keyWindow addSubview:self.firstChargeBackgroundView];
// web
self.firstChargeWebVC = [[XPWebViewController alloc] initWithRoomUID:@""];
self.firstChargeWebVC.isPush = NO;
self.firstChargeWebVC.url = URLWithType(kFirstChargeHomeIndex);
//
UIViewController *rootViewController = keyWindow.rootViewController;
if ([rootViewController isKindOfClass:[UINavigationController class]]) {
rootViewController = [(UINavigationController *)rootViewController topViewController];
} else if ([rootViewController isKindOfClass:[UITabBarController class]]) {
UITabBarController *tabBarController = (UITabBarController *)rootViewController;
rootViewController = tabBarController.selectedViewController;
if ([rootViewController isKindOfClass:[UINavigationController class]]) {
rootViewController = [(UINavigationController *)rootViewController topViewController];
}
}
[rootViewController addChildViewController:self.firstChargeWebVC];
[self.firstChargeBackgroundView addSubview:self.firstChargeWebVC.view];
[self.firstChargeWebVC didMoveToParentViewController:rootViewController];
self.firstChargeWebVC.view.backgroundColor = [UIColor clearColor];
self.firstChargeWebVC.webview.backgroundColor = [UIColor clearColor];
self.firstChargeWebVC.webview.opaque = NO;
self.firstChargeWebVC.webview.scrollView.backgroundColor = [UIColor clearColor];
self.firstChargeWebVC.view.frame = CGRectMake(0, 0, KScreenWidth - 40, KScreenHeight*2/3);
self.firstChargeWebVC.view.center = self.firstChargeBackgroundView.center;
//
// UIButton *closeButton = [UIButton buttonWithType:UIButtonTypeCustom];
// [closeButton setTitle:@"✕" forState:UIControlStateNormal];
// [closeButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
// closeButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightBold];
// [closeButton addTarget:self action:@selector(removeFirstChargePopup) forControlEvents:UIControlEventTouchUpInside];
// closeButton.frame = CGRectMake(0, 0, 30, 30);
// closeButton.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
// closeButton.layer.cornerRadius = 15;
// [self.firstChargeBackgroundView addSubview:closeButton];
//
// // webView
// CGRect webViewFrame = self.firstChargeWebVC.view.frame;
// closeButton.center = CGPointMake(CGRectGetMaxX(webViewFrame) - 15, CGRectGetMinY(webViewFrame) + 15);
// 3
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// [self removeFirstChargePopup];
// });
}
//
- (void)handleBackgroundTap:(UITapGestureRecognizer *)gesture {
//
CGPoint location = [gesture locationInView:self.firstChargeBackgroundView];
// webView
if (self.firstChargeWebVC && self.firstChargeWebVC.view) {
CGRect webViewFrame = self.firstChargeWebVC.view.frame;
if (!CGRectContainsPoint(webViewFrame, location)) {
// webView
[self removeFirstChargePopup];
}
} else {
// webView
[self removeFirstChargePopup];
}
}
//
- (void)removeFirstChargePopup {
if (self.firstChargeWebVC) {
[self.firstChargeWebVC willMoveToParentViewController:nil];
[self.firstChargeWebVC.view removeFromSuperview];
[self.firstChargeWebVC removeFromParentViewController];
self.firstChargeWebVC = nil;
}
if (self.firstChargeBackgroundView) {
[self.firstChargeBackgroundView removeFromSuperview];
self.firstChargeBackgroundView = nil;
}
}
#pragma mark - XPNewHomeHeadViewDelegate
///