更新 YUMIHtmlUrl.h 和 YUMIHtmlUrl.m,新增首充相关的 URL 类型和路径;在 FeedBackViewController.h 和 FeedBackViewController.m 中,调整属性类型为强引用以增强内存管理;重构 FeedBackViewController 的视图设置逻辑,添加子视图的初始化方法以提高代码可读性;移除不再使用的 FeedBackViewController.xib 文件,优化项目结构;在 XPGiftBarView.h 和 XPGiftBarView.m 中,移除首充按钮相关代码,替换为新的首充视图逻辑;更新 XPWebViewController.h 和 XPWebViewController.m,调整 webview 属性为可写以支持动态更新;在 FirstRechargeManager.m 中,优化首充状态检查逻辑,确保在调试模式下始终显示首充信息。

This commit is contained in:
edwinQQQ
2025-06-27 11:33:16 +08:00
parent 86094da26f
commit f52af5d620
19 changed files with 532 additions and 380 deletions

View File

@@ -13,7 +13,6 @@
#import <JXCategoryView/JXCategoryView.h>
#import <MJRefresh/MJRefresh.h>
#import "SDWebImageManager.h"
#import "FirstRechargeModel.h"
#import "FirstRechargeManager.h"
///Tool
#import "Api+Home.h"
@@ -402,9 +401,9 @@ FirstRechargeManagerDelegate>
//
[FirstRechargeManager sharedManager].delegate = self;
[[FirstRechargeManager sharedManager] startMonitoring];
// [self.presenter getUserFirstChargeStatus];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[[FirstRechargeManager sharedManager] startMonitoring];
});
}
}
@@ -818,36 +817,86 @@ FirstRechargeManagerDelegate>
//
[self removeFirstChargePopup];
//
self.firstChargeBackgroundView = [[UIView alloc] initWithFrame:self.view.bounds];
// 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];
//
[self.view addSubview:self.firstChargeBackgroundView];
// keyWindow tabbar
[keyWindow addSubview:self.firstChargeBackgroundView];
// web
self.firstChargeWebVC = [[XPWebViewController alloc] initWithRoomUID:@""];
self.firstChargeWebVC.isPush = NO;
self.firstChargeWebVC.url = @"https://jandan.net/pic";
[self addChildViewController:self.firstChargeWebVC];
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.view.frame = CGRectMake(0, 0, KScreenWidth/2, KScreenHeight/2);
[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)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self removeFirstChargePopup];
});
// 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];
if (!CGRectContainsPoint(self.firstChargeWebVC.view.frame, location)) {
// webView
if (self.firstChargeWebVC && self.firstChargeWebVC.view) {
CGRect webViewFrame = self.firstChargeWebVC.view.frame;
if (!CGRectContainsPoint(webViewFrame, location)) {
// webView
[self removeFirstChargePopup];
}
} else {
// webView
[self removeFirstChargePopup];
}
}
@@ -855,6 +904,7 @@ FirstRechargeManagerDelegate>
//
- (void)removeFirstChargePopup {
if (self.firstChargeWebVC) {
[self.firstChargeWebVC willMoveToParentViewController:nil];
[self.firstChargeWebVC.view removeFromSuperview];
[self.firstChargeWebVC removeFromParentViewController];
self.firstChargeWebVC = nil;