feat: 实现DetailView头像点击功能并优化MeView

- 在DetailView中添加头像点击功能,支持展示非当前用户的主页。
- 更新OptimizedDynamicCardView以支持头像点击回调。
- 修改DetailFeature以管理用户主页显示状态。
- 在MeView中添加关闭按钮支持,优化用户体验。
- 确保其他页面的兼容性,未影响现有功能。
This commit is contained in:
edwinQQQ
2025-08-01 16:12:24 +08:00
parent 57ba103996
commit fa544139c1
11 changed files with 214 additions and 51 deletions

View File

@@ -12,7 +12,7 @@ struct MainFeature {
struct State: Equatable {
var selectedTab: Tab = .feed
var feedList: FeedListFeature.State = .init()
var me: MeFeature.State = .init()
var me: MeFeature.State
var accountModel: AccountModel? = nil
// State
var navigationPath: [Destination] = []
@@ -20,8 +20,10 @@ struct MainFeature {
//
var isLoggedOut: Bool = false
init() {
//
init(accountModel: AccountModel? = nil) {
self.accountModel = accountModel
let uid = accountModel?.uid.flatMap { Int($0) } ?? 0
self.me = MeFeature.State(displayUID: uid > 0 ? uid : nil)
}
}
@@ -64,9 +66,9 @@ struct MainFeature {
state.selectedTab = tab
state.navigationPath = []
if tab == .other, let uidStr = state.accountModel?.uid, let uid = Int(uidStr), uid > 0 {
if state.me.uid != uid {
state.me.uid = uid
state.me.isFirstLoad = true //
if state.me.displayUID != uid {
state.me.displayUID = uid
state.me.isFirstLoad = true
}
return .send(.me(.onAppear))
}
@@ -86,8 +88,8 @@ struct MainFeature {
state.accountModel = accountModel
// MeView uid
if state.selectedTab == .other, let uidStr = accountModel?.uid, let uid = Int(uidStr), uid > 0 {
if state.me.uid != uid {
state.me.uid = uid
if state.me.displayUID != uid {
state.me.displayUID = uid
state.me.isFirstLoad = true
}
return .send(.me(.onAppear))