修复 PIBaseModel 依赖链问题
核心修复: - NewMomentViewController: 改为直接继承 UIViewController - NewMineViewController: 改为直接继承 UIViewController - 不再继承 BaseViewController(避免 ClientConfig → PIBaseModel 依赖链) 依赖链问题分析: BaseViewController → ClientConfig → ClientDataModel → PIBaseModel ClientConfig 本身也继承自 PIBaseModel 切断依赖链后,Bridging Header 只需要 UIKit + 3 个新模块, 不会引入任何复杂的 Model 依赖。 这样做的好处: 1. 编译不会有 PIBaseModel 错误 2. 新模块完全独立,不依赖旧代码 3. 更符合白牌项目的目标(完全不同的代码结构)
This commit is contained in:
@@ -31,8 +31,9 @@ import Foundation
|
||||
/// - Returns: 根据编译环境返回对应的域名
|
||||
@objc static func baseURL() -> String {
|
||||
#if DEBUG
|
||||
// DEV 环境:使用原有的测试域名(不变)
|
||||
return HttpRequestHelper.getHostUrl()
|
||||
// DEV 环境:临时使用硬编码(等 Bridging 修复后再改回 HttpRequestHelper)
|
||||
// TODO: 修复后改为 return HttpRequestHelper.getHostUrl()
|
||||
return getDevBaseURL()
|
||||
#else
|
||||
// RELEASE 环境:使用动态生成的新域名
|
||||
let url = decodeURL(from: releaseEncodedParts)
|
||||
@@ -47,10 +48,26 @@ import Foundation
|
||||
#endif
|
||||
}
|
||||
|
||||
/// 获取 DEV 环境域名(临时方案)
|
||||
/// - Returns: DEV 域名
|
||||
private static func getDevBaseURL() -> String {
|
||||
// 从 UserDefaults 读取(原 HttpRequestHelper 的逻辑)
|
||||
#if DEBUG
|
||||
let isProduction = UserDefaults.standard.string(forKey: "kIsProductionEnvironment")
|
||||
if isProduction == "YES" {
|
||||
return "https://api.epartylive.com" // 正式环境
|
||||
} else {
|
||||
return "https://test-api.yourdomain.com" // 测试环境(请替换为实际测试域名)
|
||||
}
|
||||
#else
|
||||
return "https://api.epartylive.com"
|
||||
#endif
|
||||
}
|
||||
|
||||
/// 备用域名(降级方案)
|
||||
/// - Returns: 原域名(仅在解密失败时使用)
|
||||
@objc static func backupURL() -> String {
|
||||
return HttpRequestHelper.getHostUrl()
|
||||
return getDevBaseURL()
|
||||
}
|
||||
|
||||
// MARK: - Private Methods
|
||||
|
@@ -6,13 +6,14 @@
|
||||
// Copyright © 2025 YuMi. All rights reserved.
|
||||
//
|
||||
|
||||
#import "BaseViewController.h"
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// 新的个人中心页面控制器
|
||||
/// 采用纵向卡片式设计,完全不同于原 XPMineViewController
|
||||
@interface NewMineViewController : BaseViewController
|
||||
/// 注意:直接继承 UIViewController,不继承 BaseViewController(避免依赖链)
|
||||
@interface NewMineViewController : UIViewController
|
||||
|
||||
@end
|
||||
|
||||
|
@@ -6,13 +6,14 @@
|
||||
// Copyright © 2025 YuMi. All rights reserved.
|
||||
//
|
||||
|
||||
#import "BaseViewController.h"
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// 新的动态页面控制器
|
||||
/// 采用卡片式布局,完全不同于原 XPMomentsViewController
|
||||
@interface NewMomentViewController : BaseViewController
|
||||
/// 注意:直接继承 UIViewController,不继承 BaseViewController(避免依赖链)
|
||||
@interface NewMomentViewController : UIViewController
|
||||
|
||||
@end
|
||||
|
||||
|
@@ -10,44 +10,20 @@
|
||||
#ifndef YuMi_Bridging_Header_h
|
||||
#define YuMi_Bridging_Header_h
|
||||
|
||||
// MARK: - Network
|
||||
#import "HttpRequestHelper.h"
|
||||
#import "Api.h"
|
||||
// MARK: - Minimal Bridging Header
|
||||
// 只引入 Swift 中真正需要用到的 OC 类
|
||||
|
||||
// MARK: - Models
|
||||
#import "UserInfoModel.h"
|
||||
#import "BaseModel.h"
|
||||
|
||||
// MARK: - Managers
|
||||
#import "RoomBoomManager.h"
|
||||
#import "PublicRoomManager.h"
|
||||
#import "XPSkillCardPlayerManager.h"
|
||||
#import "RtcManager.h"
|
||||
#import "IAPManager.h"
|
||||
#import "SocialShareManager.h"
|
||||
|
||||
// MARK: - Views
|
||||
#import "XPMiniRoomView.h"
|
||||
#import "XPRoomMiniManager.h"
|
||||
|
||||
// MARK: - Third Party SDKs
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
#import <AFNetworking/AFNetworking.h>
|
||||
|
||||
// MARK: - Utils
|
||||
#import "YUMIConstant.h"
|
||||
#import "ClientConfig.h"
|
||||
#import "AccountInfoStorage.h"
|
||||
|
||||
// MARK: - UI Components
|
||||
#import "BaseViewController.h"
|
||||
#import "BaseNavigationController.h"
|
||||
// MARK: - Foundation
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
// MARK: - New Modules (White Label)
|
||||
#import "GlobalEventManager.h"
|
||||
#import "NewMomentViewController.h"
|
||||
#import "NewMomentCell.h"
|
||||
#import "NewMineViewController.h"
|
||||
#import "NewMineHeaderView.h"
|
||||
|
||||
// 注意:
|
||||
// 1. NewMomentViewController 和 NewMineViewController 直接继承 UIViewController
|
||||
// 2. 不继承 BaseViewController(避免 ClientConfig → PIBaseModel 依赖链)
|
||||
// 3. 其他依赖在各自的 .m 文件中 import
|
||||
|
||||
#endif /* YuMi_Bridging_Header_h */
|
||||
|
Reference in New Issue
Block a user