feat: 更新.gitignore,删除需求文档,优化API调试信息
- 在.gitignore中添加忽略项以排除不必要的文件。 - 删除架构分析需求文档以简化项目文档。 - 在APIEndpoints.swift和LoginModels.swift中移除调试信息的异步调用,提升代码简洁性。 - 在EMailLoginFeature.swift和HomeFeature.swift中新增登录流程状态管理,优化用户体验。 - 在多个视图中调整状态管理和导航逻辑,确保一致性和可维护性。 - 更新Xcode项目配置以增强调试信息的输出格式。
This commit is contained in:
@@ -11,11 +11,20 @@ struct EMailLoginFeature {
|
||||
var isCodeLoading: Bool = false
|
||||
var errorMessage: String? = nil
|
||||
var isCodeSent: Bool = false
|
||||
// 新增:登录流程状态
|
||||
var loginStep: LoginStep = .initial
|
||||
enum LoginStep: Equatable {
|
||||
case initial
|
||||
case authenticating
|
||||
case completed
|
||||
case failed
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
init() {
|
||||
self.email = "exzero@126.com"
|
||||
self.verificationCode = ""
|
||||
self.loginStep = .initial
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -109,6 +118,7 @@ struct EMailLoginFeature {
|
||||
|
||||
state.isLoading = true
|
||||
state.errorMessage = nil
|
||||
state.loginStep = .authenticating
|
||||
|
||||
return .run { send in
|
||||
do {
|
||||
@@ -149,14 +159,16 @@ struct EMailLoginFeature {
|
||||
|
||||
case .loginResponse(.success(let accountModel)):
|
||||
state.isLoading = false
|
||||
state.loginStep = .completed
|
||||
// Effect 保存AccountModel并发送通知
|
||||
return .run { _ in
|
||||
await UserInfoManager.saveAccountModel(accountModel)
|
||||
NotificationCenter.default.post(name: .ticketSuccess, object: nil)
|
||||
// 移除:NotificationCenter.default.post(name: .ticketSuccess, object: nil)
|
||||
}
|
||||
|
||||
case .loginResponse(.failure(let error)):
|
||||
state.isLoading = false
|
||||
state.loginStep = .failed
|
||||
if let apiError = error as? APIError {
|
||||
state.errorMessage = apiError.localizedDescription
|
||||
} else {
|
||||
@@ -174,6 +186,7 @@ struct EMailLoginFeature {
|
||||
state.isCodeLoading = false
|
||||
state.errorMessage = nil
|
||||
state.isCodeSent = false
|
||||
state.loginStep = .initial
|
||||
return .none
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user