diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/database/DatabaseView.kt b/apps/android/app/src/main/java/chat/simplex/app/views/database/DatabaseView.kt index 0356a6e70c..e77ad5b67f 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/database/DatabaseView.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/database/DatabaseView.kt @@ -27,6 +27,8 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.* +import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.fragment.app.FragmentActivity @@ -87,6 +89,8 @@ fun DatabaseView( m.controller.appPrefs.privacyFullBackup, appFilesCountAndSize, chatItemTTL, + m.currentUser.value, + m.users, startChat = { startChat(m, runChat, chatLastStart, m.chatDbChanged) }, stopChatAlert = { stopChatAlert(m, runChat, context) }, exportArchive = { exportArchive(context, m, progressIndicator, chatArchiveName, chatArchiveTime, chatArchiveFile, saveArchiveLauncher) }, @@ -136,6 +140,8 @@ fun DatabaseLayout( privacyFullBackup: SharedPreference, appFilesCountAndSize: MutableState>, chatItemTTL: MutableState, + currentUser: User?, + users: List, startChat: () -> Unit, stopChatAlert: () -> Unit, exportArchive: () -> Unit, @@ -148,10 +154,27 @@ fun DatabaseLayout( val operationsDisabled = !stopped || progressIndicator Column( - Modifier.fillMaxWidth().verticalScroll(rememberScrollState()), + Modifier.fillMaxWidth().verticalScroll(rememberScrollState()).padding(bottom = 48.dp), horizontalAlignment = Alignment.Start, ) { AppBarTitle(stringResource(R.string.your_chat_database)) + + SectionView(stringResource(R.string.messages_section_title).uppercase()) { + SectionItemView { TtlOptions(chatItemTTL, enabled = rememberUpdatedState(!progressIndicator && !chatDbChanged), onChatItemTTLSelected) } + } + SectionTextFooter( + remember(currentUser?.displayName) { + buildAnnotatedString { + append(generalGetString(R.string.messages_section_description) + " ") + withStyle(SpanStyle(fontWeight = FontWeight.Bold)) { + append(currentUser?.displayName ?: "") + } + append(".") + } + } + ) + SectionSpacer() + SectionView(stringResource(R.string.run_chat_section)) { RunChatSetting(runChat, stopped, chatDbDeleted, startChat, stopChatAlert) } @@ -224,16 +247,14 @@ fun DatabaseLayout( ) SectionSpacer() - SectionView(stringResource(R.string.data_section)) { - SectionItemView { TtlOptions(chatItemTTL, enabled = rememberUpdatedState(!progressIndicator && !chatDbChanged), onChatItemTTLSelected) } - SectionDivider() + SectionView(stringResource(R.string.files_and_media_section).uppercase()) { val deleteFilesDisabled = operationsDisabled || appFilesCountAndSize.value.first == 0 SectionItemView( deleteAppFilesAndMedia, disabled = deleteFilesDisabled ) { Text( - stringResource(R.string.delete_files_and_media), + stringResource(if (users.size > 1) R.string.delete_files_and_media_for_all_users else R.string.delete_files_and_media_all), color = if (deleteFilesDisabled) HighOrLowlight else Color.Red ) } @@ -696,6 +717,8 @@ fun PreviewDatabaseLayout() { privacyFullBackup = SharedPreference({ true }, {}), appFilesCountAndSize = remember { mutableStateOf(0 to 0L) }, chatItemTTL = remember { mutableStateOf(ChatItemTTL.None) }, + currentUser = User.sampleData, + users = listOf(UserInfo.sampleData), startChat = {}, stopChatAlert = {}, exportArchive = {}, diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/helpers/Section.kt b/apps/android/app/src/main/java/chat/simplex/app/views/helpers/Section.kt index ed5f7998e0..3d7a4e3c15 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/helpers/Section.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/helpers/Section.kt @@ -12,6 +12,7 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.platform.LocalDensity +import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.* import chat.simplex.app.ui.theme.* @@ -159,6 +160,11 @@ fun SectionItemWithValue( @Composable fun SectionTextFooter(text: String) { + SectionTextFooter(AnnotatedString(text)) +} + +@Composable +fun SectionTextFooter(text: AnnotatedString) { Text( text, Modifier.padding(start = DEFAULT_PADDING, end = DEFAULT_PADDING, top = DEFAULT_PADDING_HALF).fillMaxWidth(0.9F), diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/SMPServersView.kt b/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/SMPServersView.kt index 667f4798d7..d8df8db83c 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/SMPServersView.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/SMPServersView.kt @@ -3,6 +3,7 @@ package chat.simplex.app.views.usersettings import SectionDivider import SectionItemView import SectionSpacer +import SectionTextFooter import SectionView import androidx.compose.foundation.* import androidx.compose.foundation.layout.* @@ -15,6 +16,8 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalUriHandler import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.* +import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import chat.simplex.app.R import chat.simplex.app.model.* @@ -76,6 +79,7 @@ fun SMPServersView(m: ChatModel) { serversUnchanged = serversUnchanged.value, saveDisabled = saveDisabled.value, allServersDisabled = allServersDisabled.value, + m.currentUser.value, addServer = { AlertManager.shared.showAlertDialogButtonsColumn( title = generalGetString(R.string.smp_servers_add), @@ -156,6 +160,7 @@ private fun SMPServersLayout( serversUnchanged: Boolean, saveDisabled: Boolean, allServersDisabled: Boolean, + currentUser: User?, addServer: () -> Unit, testServers: () -> Unit, resetServers: () -> Unit, @@ -186,6 +191,17 @@ private fun SMPServersLayout( iconColor = if (testing) HighOrLowlight else MaterialTheme.colors.primary ) } + SectionTextFooter( + remember(currentUser?.displayName) { + buildAnnotatedString { + append(generalGetString(R.string.smp_servers_per_user) + " ") + withStyle(SpanStyle(fontWeight = FontWeight.Bold)) { + append(currentUser?.displayName ?: "") + } + append(".") + } + } + ) SectionSpacer() SectionView { SectionItemView(resetServers, disabled = serversUnchanged) { diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/UserProfileView.kt b/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/UserProfileView.kt index 3baa54ea34..905c01f3a5 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/UserProfileView.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/UserProfileView.kt @@ -94,7 +94,7 @@ fun UserProfileLayout( .padding(horizontal = DEFAULT_PADDING), horizontalAlignment = Alignment.Start ) { - AppBarTitle(stringResource(R.string.your_chat_profile), false) + AppBarTitle(stringResource(R.string.your_current_profile), false) Text( stringResource(R.string.your_profile_is_stored_on_device_and_shared_only_with_contacts_simplex_cannot_see_it), Modifier.padding(bottom = 24.dp), diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/UserProfilesView.kt b/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/UserProfilesView.kt index 94a74c2389..525e521230 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/UserProfilesView.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/UserProfilesView.kt @@ -43,7 +43,7 @@ fun UserProfilesView(m: ChatModel) { val text = buildAnnotatedString { append(generalGetString(R.string.users_delete_all_chats_deleted) + "\n\n" + generalGetString(R.string.users_delete_profile_for) + " ") withStyle(SpanStyle(fontWeight = FontWeight.Bold)) { - append(user.chatViewName) + append(user.displayName) } append(":") } diff --git a/apps/android/app/src/main/res/values/strings.xml b/apps/android/app/src/main/res/values/strings.xml index 47a3aca422..881bd76ce6 100644 --- a/apps/android/app/src/main/res/values/strings.xml +++ b/apps/android/app/src/main/res/values/strings.xml @@ -445,6 +445,7 @@ Invalid server address! Check server address and try again. Delete server + The servers for new connections of your current chat profile Install SimpleX Chat for terminal Star on GitHub Contribute @@ -511,7 +512,7 @@ Display name: "Full name: - Your chat profile + Your current profile Your profile is stored on your device and shared only with your contacts.\n\nSimpleX servers cannot see your profile. Edit image Delete image @@ -722,8 +723,9 @@ Restart the app to create a new chat profile. You must use the most recent version of your chat database on one device ONLY, otherwise you may stop receiving the messages from some contacts. Stop chat to enable database actions. - DATA - Delete files \& media + Files & media + Delete files for all chat profiles + Delete all files Delete files and media? This action cannot be undone - all received and sent files and media will be deleted. Low resolution pictures will remain. No received or sent files @@ -733,6 +735,8 @@ 1 week 1 month %s second(s) + Messages + This setting applies to messages in your current chat profile Delete messages after Enable automatic message deletion? This action cannot be undone - the messages sent and received earlier than selected will be deleted. It may take several minutes.