feat: 更新iOS和Podfile的部署目标以支持新版本
- 将iOS平台版本更新至17,确保与最新的开发环境兼容。 - 更新Podfile中的iOS部署目标至17.0,确保依赖项与新版本兼容。 - 修改Podfile.lock以反映新的依赖项版本,确保项目一致性。 - 在多个视图中重构代码,优化状态管理和视图逻辑,提升用户体验。
This commit is contained in:
@@ -6,15 +6,13 @@ struct MainView: View {
|
||||
var onLogout: (() -> Void)? = nil
|
||||
|
||||
var body: some View {
|
||||
WithViewStore(self.store, observe: { $0 }) { viewStore in
|
||||
WithPerceptionTracking {
|
||||
InternalMainView(store: store)
|
||||
.onChange(of: viewStore.isLoggedOut) { isLoggedOut in
|
||||
if isLoggedOut {
|
||||
onLogout?()
|
||||
}
|
||||
WithPerceptionTracking {
|
||||
InternalMainView(store: store)
|
||||
.onChange(of: store.isLoggedOut) { isLoggedOut in
|
||||
if isLoggedOut {
|
||||
onLogout?()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,26 +25,24 @@ struct InternalMainView: View {
|
||||
_path = State(initialValue: store.withState { $0.navigationPath })
|
||||
}
|
||||
var body: some View {
|
||||
WithViewStore(self.store, observe: { $0 }) { viewStore in
|
||||
WithPerceptionTracking {
|
||||
NavigationStack(path: $path) {
|
||||
GeometryReader { geometry in
|
||||
contentView(geometry: geometry, viewStore: viewStore)
|
||||
.navigationDestination(for: MainFeature.Destination.self) { destination in
|
||||
DestinationView(destination: destination, store: self.store)
|
||||
WithPerceptionTracking {
|
||||
NavigationStack(path: $path) {
|
||||
GeometryReader { geometry in
|
||||
contentView(geometry: geometry)
|
||||
.navigationDestination(for: MainFeature.Destination.self) { destination in
|
||||
DestinationView(destination: destination, store: self.store)
|
||||
}
|
||||
.onChange(of: path) { newPath in
|
||||
store.send(.navigationPathChanged(newPath))
|
||||
}
|
||||
.onChange(of: store.navigationPath) { newPath in
|
||||
if path != newPath {
|
||||
path = newPath
|
||||
}
|
||||
.onChange(of: path) { newPath in
|
||||
viewStore.send(.navigationPathChanged(newPath))
|
||||
}
|
||||
.onChange(of: viewStore.navigationPath) { newPath in
|
||||
if path != newPath {
|
||||
path = newPath
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
viewStore.send(.onAppear)
|
||||
}
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
store.send(.onAppear)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,7 +70,7 @@ struct InternalMainView: View {
|
||||
}
|
||||
}
|
||||
|
||||
private func contentView(geometry: GeometryProxy, viewStore: ViewStoreOf<MainFeature>) -> some View {
|
||||
private func contentView(geometry: GeometryProxy) -> some View {
|
||||
WithPerceptionTracking {
|
||||
ZStack {
|
||||
// 背景图片
|
||||
@@ -87,7 +83,7 @@ struct InternalMainView: View {
|
||||
// 主内容
|
||||
MainContentView(
|
||||
store: store,
|
||||
selectedTab: viewStore.selectedTab
|
||||
selectedTab: store.selectedTab
|
||||
)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.padding(.bottom, 80) // 为底部导航栏留出空间
|
||||
@@ -95,7 +91,7 @@ struct InternalMainView: View {
|
||||
// 底部导航栏 - 固定在底部
|
||||
VStack {
|
||||
Spacer()
|
||||
BottomTabView(selectedTab: viewStore.binding(
|
||||
BottomTabView(selectedTab: store.binding(
|
||||
get: { Tab(rawValue: $0.selectedTab.rawValue) ?? .feed },
|
||||
send: { MainFeature.Action.selectTab(MainFeature.Tab(rawValue: $0.rawValue) ?? .feed) }
|
||||
))
|
||||
|
Reference in New Issue
Block a user