diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/usernamelinks/main/UsernameLinkSettingsFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/usernamelinks/main/UsernameLinkSettingsFragment.kt index 0513a0e3a3..f6629e5d09 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/usernamelinks/main/UsernameLinkSettingsFragment.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/usernamelinks/main/UsernameLinkSettingsFragment.kt @@ -357,7 +357,7 @@ private fun previewPermissionState(): PermissionState { private val previewLifecycleOwner: LifecycleOwner = object : LifecycleOwner { override val lifecycle: Lifecycle - get() = TODO("Not yet implemented") + get() = throw UnsupportedOperationException("Only for tests") } private fun shareQrBadge(activity: Activity, badge: Bitmap?) { diff --git a/app/src/main/java/org/thoughtcrime/securesms/recipients/ui/findby/FindByActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/recipients/ui/findby/FindByActivity.kt index 6936570bdd..603b4e882c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/recipients/ui/findby/FindByActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/recipients/ui/findby/FindByActivity.kt @@ -7,6 +7,7 @@ package org.thoughtcrime.securesms.recipients.ui.findby import android.content.Context import android.content.Intent +import android.content.res.Configuration import android.os.Bundle import androidx.activity.compose.setContent import androidx.activity.result.contract.ActivityResultContract @@ -124,7 +125,7 @@ class FindByActivity : PassphraseRequiredActivity() { navigationIconPainter = painterResource(id = R.drawable.symbol_arrow_left_24) ) { val context = LocalContext.current - FindByContent( + Content( paddingValues = it, state = state, onUserEntryChanged = viewModel::onUserEntryChanged, @@ -265,25 +266,8 @@ class FindByActivity : PassphraseRequiredActivity() { } } -@Preview @Composable -private fun FindByContentPreview() { - Previews.Preview { - FindByContent( - paddingValues = PaddingValues(0.dp), - state = FindByState( - mode = FindByMode.PHONE_NUMBER, - userEntry = "" - ), - onUserEntryChanged = {}, - onNextClick = {}, - onSelectCountryPrefixClick = {} - ) - } -} - -@Composable -private fun FindByContent( +private fun Content( paddingValues: PaddingValues, state: FindByState, onUserEntryChanged: (String) -> Unit, @@ -368,7 +352,7 @@ private fun FindByContent( if (state.mode == FindByMode.USERNAME) { Text( - text = stringResource(id = R.string.FindByActivity__enter_a_full_username), + text = stringResource(id = R.string.FindByActivity__enter_username_description), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier @@ -436,20 +420,6 @@ private fun PhoneNumberEntryPrefix( } } -@Preview -@Composable -private fun SelectCountryScreenPreview() { - Previews.Preview { - SelectCountryScreen( - paddingValues = PaddingValues(0.dp), - searchEntry = "", - onSearchEntryChanged = {}, - supportedCountryPrefixes = FindByState(mode = FindByMode.PHONE_NUMBER).supportedCountryPrefixes, - onCountryPrefixSelected = {} - ) - } -} - @Composable private fun SelectCountryScreen( paddingValues: PaddingValues, @@ -556,3 +526,54 @@ private fun CountryPrefixRowItem( ) } } + +@Preview(name = "Light Theme", group = "content", uiMode = Configuration.UI_MODE_NIGHT_NO) +@Preview(name = "Dark Theme", group = "content", uiMode = Configuration.UI_MODE_NIGHT_YES) +@Composable +private fun ContentPreviewPhoneNumber() { + Previews.Preview { + Content( + paddingValues = PaddingValues(0.dp), + state = FindByState( + mode = FindByMode.PHONE_NUMBER, + userEntry = "" + ), + onUserEntryChanged = {}, + onNextClick = {}, + onSelectCountryPrefixClick = {} + ) + } +} + +@Preview(name = "Light Theme", group = "content", uiMode = Configuration.UI_MODE_NIGHT_NO) +@Preview(name = "Dark Theme", group = "content", uiMode = Configuration.UI_MODE_NIGHT_YES) +@Composable +private fun ContentPreviewUsername() { + Previews.Preview { + Content( + paddingValues = PaddingValues(0.dp), + state = FindByState( + mode = FindByMode.USERNAME, + userEntry = "" + ), + onUserEntryChanged = {}, + onNextClick = {}, + onSelectCountryPrefixClick = {} + ) + } +} + +@Preview(name = "Light Theme", group = "select country", uiMode = Configuration.UI_MODE_NIGHT_NO) +@Preview(name = "Dark Theme", group = "select country", uiMode = Configuration.UI_MODE_NIGHT_YES) +@Composable +private fun SelectCountryScreenPreview() { + Previews.Preview { + SelectCountryScreen( + paddingValues = PaddingValues(0.dp), + searchEntry = "", + onSearchEntryChanged = {}, + supportedCountryPrefixes = FindByState(mode = FindByMode.PHONE_NUMBER).supportedCountryPrefixes, + onCountryPrefixSelected = {} + ) + } +} diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 98e325777b..aed8c9a792 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -6566,7 +6566,7 @@ Phone number - Enter a full username with its pair of digits. + Enter a username followed by a dot and its set of numbers. Next