feat: 更新项目配置和功能模块

- 修改Package.swift以支持iOS 15和macOS 12。
- 更新swift-tca-architecture-guidelines.mdc中的alwaysApply设置为false。
- 注释掉AppDelegate中的NIMSDK导入,移除不再使用的NIMConfigurationManager和NIMSessionManager文件。
- 添加新的API相关文件,包括EMailLoginFeature、IDLoginFeature和相关视图,增强登录功能。
- 更新APIConstants和APIEndpoints以反映新的API路径。
- 添加本地化支持文件,包含英文和中文简体的本地化字符串。
- 新增字体管理和安全工具类,支持AES和DES加密。
- 更新Xcode项目配置,调整版本号和启动画面设置。
This commit is contained in:
edwinQQQ
2025-07-09 16:14:19 +08:00
parent 5926906f3c
commit c470dba79c
71 changed files with 4000 additions and 522 deletions

View File

@@ -33,36 +33,44 @@ final class yanaAPITests: XCTestCase {
}
}
func testClientInit_Success() {
let expectation = self.expectation(description: "clientInit success")
API.clientInit { result in
switch result {
case .success(let data):
XCTAssertNotNil(data)
//
case .failure(let error):
XCTFail("Expected success, got error: \(error)")
}
expectation.fulfill()
}
waitForExpectations(timeout: 5, handler: nil)
func testIDLoginRequest_Creation() {
// ID
let userID = "399113"
let password = "a123456"
let request = LoginHelper.createIDLoginRequest(userID: userID, password: password)
XCTAssertNotNil(request, "登录请求应该创建成功")
XCTAssertEqual(request?.endpoint, "/oauth/token", "端点应该正确")
XCTAssertEqual(request?.method, .POST, "请求方法应该是POST")
}
func testClientInit_Failure() {
// mock
//
let expectation = self.expectation(description: "clientInit failure")
// APIbaseURLmock
API.clientInit { result in
switch result {
case .success(_):
// fail
XCTFail("Expected failure, got success")
case .failure(let error):
XCTAssertNotNil(error)
}
expectation.fulfill()
}
waitForExpectations(timeout: 5, handler: nil)
func testIDLoginResponse_Success() {
//
let successResponse = IDLoginResponse(
status: "success",
message: "登录成功",
code: 200,
data: IDLoginData(
accessToken: "test_token",
refreshToken: "refresh_token",
tokenType: "Bearer",
expiresIn: 3600,
scope: "read write",
userInfo: UserInfo(
userId: "123",
username: "testuser",
nickname: "Test User",
avatar: nil,
email: "test@example.com",
phone: "399113",
status: "active",
createTime: "2024-01-01",
updateTime: "2024-01-01"
)
)
)
XCTAssertTrue(successResponse.isSuccess, "响应应该标记为成功")
XCTAssertEqual(successResponse.data?.accessToken, "test_token", "访问令牌应该正确")
}
}