feat: 新增注销帐号功能以增强用户交互体验
- 在APIEndpoints中新增注销帐号的API路径。 - 在AppSettingFeature中添加showDeactivateAccount状态和相关动作,支持注销帐号的逻辑。 - 在AppSettingView中整合注销帐号的视图逻辑,新增注销帐号行和绑定。 - 在Localizable.strings中添加英文和中文的注销帐号文本支持。
This commit is contained in:
@@ -113,6 +113,9 @@ struct AppSettingView: View {
|
||||
.sheet(isPresented: privacyPolicyBinding(viewStore: viewStore)) {
|
||||
WebView(url: APIConfiguration.webURL(for: .privacyPolicy)!)
|
||||
}
|
||||
.sheet(isPresented: deactivateAccountBinding(viewStore: viewStore)) {
|
||||
WebView(url: APIConfiguration.webURL(for: .deactivateAccount)!)
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
@@ -304,6 +307,7 @@ struct AppSettingView: View {
|
||||
helpRow(viewStore: viewStore)
|
||||
clearCacheRow(viewStore: viewStore)
|
||||
checkUpdatesRow(viewStore: viewStore)
|
||||
deactivateAccountRow(viewStore: viewStore)
|
||||
aboutUsRow(viewStore: viewStore)
|
||||
}
|
||||
.background(Color.clear)
|
||||
@@ -342,6 +346,14 @@ struct AppSettingView: View {
|
||||
)
|
||||
}
|
||||
|
||||
// MARK: - 注销帐号行
|
||||
private func deactivateAccountRow(viewStore: ViewStoreOf<AppSettingFeature>) -> some View {
|
||||
settingRow(
|
||||
title: NSLocalizedString("appSetting.deactivateAccount", comment: "Deactivate Account"),
|
||||
action: { viewStore.send(.deactivateAccountTapped) }
|
||||
)
|
||||
}
|
||||
|
||||
// MARK: - 关于我们行
|
||||
private func aboutUsRow(viewStore: ViewStoreOf<AppSettingFeature>) -> some View {
|
||||
settingRow(
|
||||
@@ -404,6 +416,14 @@ struct AppSettingView: View {
|
||||
)
|
||||
}
|
||||
|
||||
// MARK: - 注销帐号绑定
|
||||
private func deactivateAccountBinding(viewStore: ViewStoreOf<AppSettingFeature>) -> Binding<Bool> {
|
||||
viewStore.binding(
|
||||
get: \.showDeactivateAccount,
|
||||
send: AppSettingFeature.Action.deactivateAccountDismissed
|
||||
)
|
||||
}
|
||||
|
||||
// MARK: - 昵称Alert内容
|
||||
@ViewBuilder
|
||||
private func nicknameAlertContent(viewStore: ViewStoreOf<AppSettingFeature>) -> some View {
|
||||
|
Reference in New Issue
Block a user