feat: 移除设置功能并优化主功能状态管理

- 从HomeFeature和MainFeature中移除设置相关状态和逻辑,简化状态管理。
- 更新视图以去除设置页面的展示,提升用户体验。
- 删除SettingFeature及其相关视图,减少冗余代码,增强代码可维护性。
This commit is contained in:
edwinQQQ
2025-07-24 15:04:39 +08:00
parent 6cc4b11e93
commit c072a7e73d
6 changed files with 2 additions and 497 deletions

View File

@@ -14,7 +14,6 @@ struct MainFeature: Reducer {
var accountModel: AccountModel? = nil
// State
var navigationPath: [Destination] = []
var settingState: SettingFeature.State? = nil
var appSettingState: AppSettingFeature.State? = nil
//
var isLoggedOut: Bool = false
@@ -22,7 +21,6 @@ struct MainFeature: Reducer {
//
enum Destination: Hashable, Equatable {
case setting
case test
case appSetting
}
@@ -36,8 +34,6 @@ struct MainFeature: Reducer {
case accountModelLoaded(AccountModel?)
//
case navigationPathChanged([Destination])
case settingButtonTapped
case settingAction(SettingFeature.Action)
case testButtonTapped
case appSettingButtonTapped
case appSettingAction(AppSettingFeature.Action)
@@ -84,20 +80,11 @@ struct MainFeature: Reducer {
return .none
case .navigationPathChanged(let newPath):
// pop settingState
if !newPath.contains(.setting) {
state.settingState = nil
}
if !newPath.contains(.appSetting) {
state.appSettingState = nil
}
state.navigationPath = newPath
return .none
case .settingButtonTapped:
state.settingState = SettingFeature.State()
state.navigationPath.append(.setting)
return .none
case .settingAction:
return .none
case .testButtonTapped:
state.navigationPath.append(.test)
return .none
@@ -117,9 +104,6 @@ struct MainFeature: Reducer {
}
}
//
.ifLet(\ .settingState, action: \.settingAction) {
SettingFeature()
}
.ifLet(\ .appSettingState, action: \.appSettingAction) {
AppSettingFeature()
}