Skip to content

Commit 49d7caa

Browse files
committed
feat(settings): Add a privacy statement dialog box
1 parent 22fcfc9 commit 49d7caa

File tree

1 file changed

+88
-59
lines changed

1 file changed

+88
-59
lines changed

composeApp/src/commonMain/kotlin/com/jankinwu/fntv/client/ui/screen/SettingsScreen.kt

Lines changed: 88 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import com.jankinwu.fntv.client.ui.component.common.BackButton
5858
import com.jankinwu.fntv.client.ui.component.common.ComponentItem
5959
import com.jankinwu.fntv.client.ui.component.common.ComponentNavigator
6060
import com.jankinwu.fntv.client.ui.component.common.dialog.AboutDialog
61+
import com.jankinwu.fntv.client.ui.component.common.dialog.CustomContentDialog
6162
import com.jankinwu.fntv.client.ui.component.common.dialog.UpdateDialog
6263
import com.jankinwu.fntv.client.ui.providable.LocalStore
6364
import com.jankinwu.fntv.client.viewmodel.LogoutViewModel
@@ -100,10 +101,12 @@ fun SettingsScreen(navigator: ComponentNavigator) {
100101
var proxyUrl by remember(guid) { mutableStateOf(AppSettingsStore.githubResourceProxyUrl) }
101102
var includePrerelease by remember(guid) { mutableStateOf(AppSettingsStore.includePrerelease) }
102103
var autoDownloadUpdates by remember(guid) { mutableStateOf(AppSettingsStore.autoDownloadUpdates) }
104+
// var isHardwareInfoReportingEnabled by remember(guid) { mutableStateOf(AppSettingsStore.isHardwareInfoReportingEnabled) }
103105
val scrollState = rememberScrollState()
104106
val uriHandler = LocalUriHandler.current
105107
val focusManager = LocalFocusManager.current
106108
var showUpdateDialog by remember { mutableStateOf(false) }
109+
var showHardwareInfoDialog by remember { mutableStateOf(false) }
107110

108111
UpdateDialog(
109112
status = updateStatus,
@@ -130,6 +133,20 @@ fun SettingsScreen(navigator: ComponentNavigator) {
130133
}
131134
)
132135

136+
if (showHardwareInfoDialog) {
137+
CustomContentDialog(
138+
title = "隐私声明",
139+
visible = true,
140+
primaryButtonText = "我知道了",
141+
onButtonClick = {
142+
showHardwareInfoDialog = false
143+
},
144+
content = {
145+
Text("为了改进软件性能,我们会收集部分硬件信息(如 CPU、GPU 型号等)作为参考依据。这些信息将仅用于优化软件,不会涉及个人隐私。")
146+
}
147+
)
148+
}
149+
133150
Column(
134151
modifier = Modifier
135152
.clickable(
@@ -163,6 +180,66 @@ fun SettingsScreen(navigator: ComponentNavigator) {
163180
.padding(top = 8.dp)
164181
.padding(bottom = 24.dp)
165182
) {
183+
val userInfo by UserInfoMemoryCache.userInfo.collectAsState()
184+
185+
Header("账号")
186+
CardExpanderItem(
187+
icon = {
188+
Icon(
189+
imageVector = Icons.Regular.Person,
190+
contentDescription = "用户",
191+
modifier = Modifier
192+
.size(18.dp)
193+
)
194+
},
195+
heading = {
196+
Row(
197+
verticalAlignment = Alignment.CenterVertically
198+
) {
199+
Text(userInfo?.username ?: "")
200+
if (userInfo?.isAdmin == 1) {
201+
Row(
202+
modifier = Modifier
203+
.padding(start = 8.dp)
204+
.border(1.dp, Colors.AccentColorDefault, RoundedCornerShape(50))
205+
.padding(horizontal = 6.dp, vertical = 1.dp),
206+
verticalAlignment = Alignment.CenterVertically
207+
) {
208+
Text(
209+
text = "管理员",
210+
style = FluentTheme.typography.caption,
211+
color = Colors.AccentColorDefault,
212+
modifier = Modifier
213+
// .padding(start = 2.dp)
214+
)
215+
}
216+
}
217+
}
218+
},
219+
caption = {
220+
Text("FN_Media")
221+
}
222+
)
223+
CardExpanderItem(
224+
icon = {
225+
Icon(
226+
imageVector = Logout,
227+
contentDescription = "退出登录",
228+
modifier = Modifier
229+
.size(18.dp)
230+
)
231+
},
232+
heading = {
233+
Text("退出登录")
234+
},
235+
caption = {
236+
Text("退出当前账号")
237+
},
238+
onClick = {
239+
LoginStateManager.logout(logoutViewModel)
240+
}
241+
)
242+
166243
Header("外观")
167244
val followSystemTheme = store.isFollowingSystemTheme
168245

@@ -436,6 +513,15 @@ fun SettingsScreen(navigator: ComponentNavigator) {
436513
)
437514

438515
Header("关于")
516+
CardExpanderItem(
517+
heading = { Text("隐私声明") },
518+
caption = { Text("隐私声明") },
519+
icon = { Icon(Statement, null, modifier = Modifier.size(18.dp)) },
520+
onClick = {
521+
showHardwareInfoDialog = true
522+
}
523+
)
524+
439525
CardExpanderItem(
440526
heading = {
441527
Text("Fntv Client Multiplatform")
@@ -497,65 +583,8 @@ fun SettingsScreen(navigator: ComponentNavigator) {
497583
Text("本项目为飞牛 OS 爱好者开发的第三方影视客户端,与飞牛影视官方无关。使用前请确保遵守相关服务条款。")
498584
}
499585
)
500-
val userInfo by UserInfoMemoryCache.userInfo.collectAsState()
501-
// 添加登出按钮
502-
Header("账号")
503-
CardExpanderItem(
504-
icon = {
505-
Icon(
506-
imageVector = Icons.Regular.Person,
507-
contentDescription = "用户",
508-
modifier = Modifier
509-
.size(18.dp)
510-
)
511-
},
512-
heading = {
513-
Row(
514-
verticalAlignment = Alignment.CenterVertically
515-
) {
516-
Text(userInfo?.username ?: "")
517-
if (userInfo?.isAdmin == 1) {
518-
Row(
519-
modifier = Modifier
520-
.padding(start = 8.dp)
521-
.border(1.dp, Colors.AccentColorDefault, RoundedCornerShape(50))
522-
.padding(horizontal = 6.dp, vertical = 1.dp),
523-
verticalAlignment = Alignment.CenterVertically
524-
) {
525-
Text(
526-
text = "管理员",
527-
style = FluentTheme.typography.caption,
528-
color = Colors.AccentColorDefault,
529-
modifier = Modifier
530-
// .padding(start = 2.dp)
531-
)
532-
}
533-
}
534-
}
535-
},
536-
caption = {
537-
Text("FN_Media")
538-
}
539-
)
540-
CardExpanderItem(
541-
icon = {
542-
Icon(
543-
imageVector = Logout,
544-
contentDescription = "退出登录",
545-
modifier = Modifier
546-
.size(18.dp)
547-
)
548-
},
549-
heading = {
550-
Text("退出登录")
551-
},
552-
caption = {
553-
Text("退出当前账号")
554-
},
555-
onClick = {
556-
LoginStateManager.logout(logoutViewModel)
557-
}
558-
)
586+
587+
559588
}
560589
}
561590
}

0 commit comments

Comments
 (0)