mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-14 12:10:36 +01:00
Upgrade compose bom.
Co-authored-by: Greyson Parrelli <greyson@signal.org>
This commit is contained in:
committed by
Greyson Parrelli
parent
011dc3495f
commit
c83054906b
@@ -333,9 +333,10 @@ private fun BackupFailedBody() {
|
||||
append(stringResource(id = R.string.BackupAlertBottomSheet__an_error_occurred))
|
||||
append(" ")
|
||||
|
||||
val link = stringResource(R.string.remote_backup_support_url)
|
||||
withLink(
|
||||
LinkAnnotation.Clickable(tag = "learn-more") {
|
||||
CommunicationActions.openBrowserLink(context, context.getString(R.string.remote_backup_support_url))
|
||||
CommunicationActions.openBrowserLink(context, link)
|
||||
}
|
||||
) {
|
||||
withStyle(SpanStyle(color = MaterialTheme.colorScheme.primary)) {
|
||||
|
||||
+2
-1
@@ -31,10 +31,11 @@ class NoRemoteStorageSpaceAvailableBottomSheet : ComposeBottomSheetDialogFragmen
|
||||
@Composable
|
||||
override fun SheetContent() {
|
||||
val context = LocalContext.current
|
||||
val supportUrl = stringResource(R.string.remote_backup_support_url)
|
||||
|
||||
NoRemoteStorageSpaceAvailableBottomSheetContent(
|
||||
onLearnMoreClick = {
|
||||
CommunicationActions.openBrowserLink(context, context.getString(R.string.remote_backup_support_url))
|
||||
CommunicationActions.openBrowserLink(context, supportUrl)
|
||||
},
|
||||
onContactSupportClick = {
|
||||
ContactSupportDialogFragment.create(
|
||||
|
||||
+4
-4
@@ -20,6 +20,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalLocale
|
||||
import androidx.compose.ui.res.dimensionResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.AnnotatedString.Builder
|
||||
@@ -37,7 +38,6 @@ import org.signal.core.ui.compose.Previews
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.keyvalue.BackupValues
|
||||
import org.thoughtcrime.securesms.util.DateUtils
|
||||
import java.util.Locale
|
||||
import kotlin.time.Duration.Companion.days
|
||||
import org.signal.core.ui.R as CoreUiR
|
||||
|
||||
@@ -53,7 +53,7 @@ fun BackupCreateErrorRow(
|
||||
onLearnMoreClick: () -> Unit = {}
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val locale = Locale.getDefault()
|
||||
val locale = LocalLocale.current
|
||||
|
||||
when (error) {
|
||||
BackupValues.BackupCreationError.TRANSIENT -> {
|
||||
@@ -82,7 +82,7 @@ fun BackupCreateErrorRow(
|
||||
BackupValues.BackupCreationError.BACKUP_FILE_TOO_LARGE -> {
|
||||
BackupAlertText {
|
||||
if (lastMessageCutoffTime > 0) {
|
||||
append(stringResource(R.string.BackupStatusRow__not_backing_up_old_messages, DateUtils.getDayPrecisionTimeString(context, locale, lastMessageCutoffTime)))
|
||||
append(stringResource(R.string.BackupStatusRow__not_backing_up_old_messages, DateUtils.getDayPrecisionTimeString(context, locale.platformLocale, lastMessageCutoffTime)))
|
||||
} else {
|
||||
append(stringResource(R.string.BackupStatusRow__backup_file_too_large))
|
||||
}
|
||||
@@ -91,7 +91,7 @@ fun BackupCreateErrorRow(
|
||||
|
||||
BackupValues.BackupCreationError.NOT_ENOUGH_DISK_SPACE -> {
|
||||
BackupAlertText {
|
||||
append(stringResource(R.string.BackupStatusRow__not_enough_disk_space, DateUtils.getDayPrecisionTimeString(context, locale, lastMessageCutoffTime)))
|
||||
append(stringResource(R.string.BackupStatusRow__not_enough_disk_space, DateUtils.getDayPrecisionTimeString(context, locale.platformLocale, lastMessageCutoffTime)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -108,9 +108,10 @@ fun VerifyBackupPinScreen(
|
||||
append(stringResource(id = R.string.VerifyBackupPinScreen__enter_the_backup_key_that_you_recorded))
|
||||
append(" ")
|
||||
|
||||
val supportUrl = stringResource(R.string.remote_backup_support_url)
|
||||
withLink(
|
||||
LinkAnnotation.Clickable(tag = "learn-more") {
|
||||
CommunicationActions.openBrowserLink(context, context.getString(R.string.remote_backup_support_url))
|
||||
CommunicationActions.openBrowserLink(context, supportUrl)
|
||||
}
|
||||
) {
|
||||
withStyle(SpanStyle(color = MaterialTheme.colorScheme.primary)) {
|
||||
|
||||
@@ -25,7 +25,6 @@ import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.res.vectorResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -214,7 +213,8 @@ private fun UserMessagesHost(
|
||||
onDismiss: (UserMessage) -> Unit,
|
||||
snackbarHostState: SnackbarHostState
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val youAreAlreadyInACall = stringResource(R.string.CommunicationActions__you_are_already_in_a_call)
|
||||
val errorRetrievingContacts = stringResource(R.string.ContactSelectionListFragment_error_retrieving_contacts_check_your_network_connection)
|
||||
|
||||
when (userMessage) {
|
||||
null -> {}
|
||||
@@ -228,14 +228,14 @@ private fun UserMessagesHost(
|
||||
|
||||
is UserMessage.UserAlreadyInAnotherCall -> LaunchedEffect(userMessage) {
|
||||
snackbarHostState.showSnackbar(
|
||||
message = context.getString(R.string.CommunicationActions__you_are_already_in_a_call)
|
||||
message = youAreAlreadyInACall
|
||||
)
|
||||
onDismiss(userMessage)
|
||||
}
|
||||
|
||||
is UserMessage.ContactsRefreshFailed -> LaunchedEffect(userMessage) {
|
||||
snackbarHostState.showSnackbar(
|
||||
message = context.getString(R.string.ContactSelectionListFragment_error_retrieving_contacts_check_your_network_connection)
|
||||
message = errorRetrievingContacts
|
||||
)
|
||||
onDismiss(userMessage)
|
||||
}
|
||||
|
||||
+4
-2
@@ -69,12 +69,14 @@ fun <Reason> SendSupportEmailEffect(
|
||||
filterRes: ContactSupportCallbacks.StringForReason<Reason>,
|
||||
hide: () -> Unit
|
||||
) {
|
||||
val subject = stringResource(subjectRes(contactSupportState.reason))
|
||||
val helpDebugLog = stringResource(R.string.HelpFragment__debug_log)
|
||||
|
||||
val context = LocalContext.current
|
||||
LaunchedEffect(contactSupportState.sendEmail) {
|
||||
if (contactSupportState.sendEmail) {
|
||||
val subject = context.getString(subjectRes(contactSupportState.reason))
|
||||
val prefix = if (contactSupportState.debugLogUrl != null) {
|
||||
"\n${context.getString(R.string.HelpFragment__debug_log)} ${contactSupportState.debugLogUrl}\n\n"
|
||||
"\n$helpDebugLog ${contactSupportState.debugLogUrl}\n\n"
|
||||
} else {
|
||||
""
|
||||
}
|
||||
|
||||
+4
-2
@@ -31,6 +31,7 @@ import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalLocale
|
||||
import androidx.compose.ui.res.dimensionResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.res.vectorResource
|
||||
@@ -507,6 +508,7 @@ private fun ActiveBackupsRow(
|
||||
style = MaterialTheme.typography.bodyLarge
|
||||
)
|
||||
|
||||
val locale = LocalLocale.current.platformLocale
|
||||
when (val type = backupState.messageBackupsType) {
|
||||
is MessageBackupsType.Paid -> {
|
||||
val body = if (backupState is BackupState.Canceled) {
|
||||
@@ -514,13 +516,13 @@ private fun ActiveBackupsRow(
|
||||
} else if (type.pricePerMonth.amount == BigDecimal.ZERO) {
|
||||
stringResource(
|
||||
R.string.BackupsSettingsFragment_renews_s,
|
||||
DateUtils.formatDateWithYear(Locale.getDefault(), backupState.renewalTime.inWholeMilliseconds)
|
||||
DateUtils.formatDateWithYear(locale, backupState.renewalTime.inWholeMilliseconds)
|
||||
)
|
||||
} else {
|
||||
stringResource(
|
||||
R.string.BackupsSettingsFragment_s_month_renews_s,
|
||||
FiatMoneyUtil.format(LocalContext.current.resources, type.pricePerMonth),
|
||||
DateUtils.formatDateWithYear(Locale.getDefault(), backupState.renewalTime.inWholeMilliseconds)
|
||||
DateUtils.formatDateWithYear(locale, backupState.renewalTime.inWholeMilliseconds)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
package org.thoughtcrime.securesms.components.settings.app.backups.local
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.widget.Toast
|
||||
@@ -176,6 +177,7 @@ class LocalBackupsFragment : ComposeFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("LocalContextGetResourceValueCall")
|
||||
@Composable
|
||||
private fun rememberChooseBackupLocationLauncher(backStack: NavBackStack<NavKey>): ActivityResultLauncher<Uri?> {
|
||||
val context = LocalContext.current
|
||||
|
||||
+6
-2
@@ -54,6 +54,7 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalLocale
|
||||
import androidx.compose.ui.res.colorResource
|
||||
import androidx.compose.ui.res.dimensionResource
|
||||
import androidx.compose.ui.res.painterResource
|
||||
@@ -1051,9 +1052,10 @@ private fun BackupCard(
|
||||
else -> error("Not supported here.")
|
||||
}
|
||||
|
||||
val locale = LocalLocale.current.platformLocale
|
||||
if (backupState.renewalTime > 0.seconds) {
|
||||
Text(
|
||||
text = stringResource(resource, DateUtils.formatDateWithYear(Locale.getDefault(), backupState.renewalTime.inWholeMilliseconds))
|
||||
text = stringResource(resource, DateUtils.formatDateWithYear(locale, backupState.renewalTime.inWholeMilliseconds))
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1873,8 +1875,10 @@ private fun ErrorCardPreview() {
|
||||
@Composable
|
||||
private fun PendingCardPreview() {
|
||||
Previews.Preview {
|
||||
val locale = LocalLocale.current.platformLocale
|
||||
|
||||
PendingCard(
|
||||
price = FiatMoney(BigDecimal.TEN, Currency.getInstance(Locale.getDefault()))
|
||||
price = FiatMoney(BigDecimal.TEN, Currency.getInstance(locale))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+12
-11
@@ -100,15 +100,16 @@ class MuteUntilTimePickerBottomSheet : ComposeBottomSheetDialogFragment() {
|
||||
}
|
||||
|
||||
val zonedDateTime = remember { ZonedDateTime.now() }
|
||||
val timezoneDisclaimer = remember {
|
||||
val zoneOffsetFormatter = DateTimeFormatter.ofPattern("OOOO")
|
||||
val zoneNameFormatter = DateTimeFormatter.ofPattern("zzzz")
|
||||
context.getString(
|
||||
R.string.MuteUntilTimePickerBottomSheet__timezone_disclaimer,
|
||||
zoneOffsetFormatter.format(zonedDateTime),
|
||||
zoneNameFormatter.format(zonedDateTime)
|
||||
)
|
||||
}
|
||||
val zoneOffset = remember { DateTimeFormatter.ofPattern("OOOO").format(zonedDateTime) }
|
||||
val zoneName = remember { DateTimeFormatter.ofPattern("zzzz").format(zonedDateTime) }
|
||||
val timezoneDisclaimer = stringResource(
|
||||
R.string.MuteUntilTimePickerBottomSheet__timezone_disclaimer,
|
||||
zoneOffset,
|
||||
zoneName
|
||||
)
|
||||
|
||||
val selectDateTitle = stringResource(R.string.MuteUntilTimePickerBottomSheet__select_date_title)
|
||||
val selectTimeTitle = stringResource(R.string.MuteUntilTimePickerBottomSheet__select_time_title)
|
||||
|
||||
MuteUntilSheetContent(
|
||||
dateText = dateText,
|
||||
@@ -117,7 +118,7 @@ class MuteUntilTimePickerBottomSheet : ComposeBottomSheetDialogFragment() {
|
||||
onDateClick = {
|
||||
val local = LocalDateTime.now().atMidnight().atUTC().toMillis()
|
||||
val datePicker = MaterialDatePicker.Builder.datePicker()
|
||||
.setTitleText(context.getString(R.string.MuteUntilTimePickerBottomSheet__select_date_title))
|
||||
.setTitleText(selectDateTitle)
|
||||
.setSelection(selectedDate)
|
||||
.setCalendarConstraints(CalendarConstraints.Builder().setStart(local).setValidator(DateValidatorPointForward.now()).build())
|
||||
.build()
|
||||
@@ -138,7 +139,7 @@ class MuteUntilTimePickerBottomSheet : ComposeBottomSheetDialogFragment() {
|
||||
.setTimeFormat(timeFormat)
|
||||
.setHour(selectedHour)
|
||||
.setMinute(selectedMinute)
|
||||
.setTitleText(context.getString(R.string.MuteUntilTimePickerBottomSheet__select_time_title))
|
||||
.setTitleText(selectTimeTitle)
|
||||
.build()
|
||||
|
||||
timePicker.addOnDismissListener {
|
||||
|
||||
+6
-8
@@ -653,6 +653,10 @@ private fun InfoOverlay(
|
||||
if (!renderInPip) {
|
||||
Spacer(modifier = Modifier.size(12.dp))
|
||||
|
||||
val shortDisplayName = rememberRecipientField(recipient) { getShortDisplayName(context) }
|
||||
val sIsBlocked = stringResource(R.string.CallParticipantView__s_is_blocked, shortDisplayName)
|
||||
val canNotReceiveAudio = stringResource(R.string.CallParticipantView__cant_receive_audio_video_from_s, shortDisplayName)
|
||||
|
||||
// Use AndroidView for EmojiTextView
|
||||
AndroidView(
|
||||
factory = { ctx ->
|
||||
@@ -670,15 +674,9 @@ private fun InfoOverlay(
|
||||
},
|
||||
update = { view ->
|
||||
view.text = if (isBlocked) {
|
||||
context.getString(
|
||||
R.string.CallParticipantView__s_is_blocked,
|
||||
recipient.getShortDisplayName(context)
|
||||
)
|
||||
sIsBlocked
|
||||
} else {
|
||||
context.getString(
|
||||
R.string.CallParticipantView__cant_receive_audio_video_from_s,
|
||||
recipient.getShortDisplayName(context)
|
||||
)
|
||||
canNotReceiveAudio
|
||||
}
|
||||
},
|
||||
modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp)
|
||||
|
||||
+20
-12
@@ -29,6 +29,7 @@ import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalResources
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.res.vectorResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -333,20 +334,21 @@ private fun UserMessagesHost(
|
||||
snackbarHostState: SnackbarHostState
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val resources = LocalResources.current
|
||||
|
||||
when (userMessage) {
|
||||
null -> {}
|
||||
|
||||
is UserMessage.Info.RecipientRemoved -> LaunchedEffect(userMessage) {
|
||||
snackbarHostState.showSnackbar(
|
||||
message = context.getString(R.string.NewConversationActivity__s_has_been_removed, userMessage.recipient.getDisplayName(context))
|
||||
message = resources.getString(R.string.NewConversationActivity__s_has_been_removed, userMessage.recipient.getDisplayName(context))
|
||||
)
|
||||
onDismiss(userMessage)
|
||||
}
|
||||
|
||||
is UserMessage.Info.RecipientBlocked -> LaunchedEffect(userMessage) {
|
||||
snackbarHostState.showSnackbar(
|
||||
message = context.getString(R.string.NewConversationActivity__s_has_been_blocked, userMessage.recipient.getDisplayName(context))
|
||||
message = resources.getString(R.string.NewConversationActivity__s_has_been_blocked, userMessage.recipient.getDisplayName(context))
|
||||
)
|
||||
onDismiss(userMessage)
|
||||
}
|
||||
@@ -358,18 +360,24 @@ private fun UserMessagesHost(
|
||||
)
|
||||
}
|
||||
|
||||
is UserMessage.Info.UserAlreadyInAnotherCall -> LaunchedEffect(userMessage) {
|
||||
snackbarHostState.showSnackbar(
|
||||
message = context.getString(R.string.CommunicationActions__you_are_already_in_a_call)
|
||||
)
|
||||
onDismiss(userMessage)
|
||||
is UserMessage.Info.UserAlreadyInAnotherCall -> {
|
||||
val youAreAlreadyInACall = stringResource(R.string.CommunicationActions__you_are_already_in_a_call)
|
||||
LaunchedEffect(userMessage) {
|
||||
snackbarHostState.showSnackbar(
|
||||
message = youAreAlreadyInACall
|
||||
)
|
||||
onDismiss(userMessage)
|
||||
}
|
||||
}
|
||||
|
||||
is UserMessage.Info.ContactsRefreshFailed -> LaunchedEffect(userMessage) {
|
||||
snackbarHostState.showSnackbar(
|
||||
message = context.getString(R.string.ContactSelectionListFragment_error_retrieving_contacts_check_your_network_connection)
|
||||
)
|
||||
onDismiss(userMessage)
|
||||
is UserMessage.Info.ContactsRefreshFailed -> {
|
||||
val errorRetrievingContacts = stringResource(R.string.ContactSelectionListFragment_error_retrieving_contacts_check_your_network_connection)
|
||||
LaunchedEffect(userMessage) {
|
||||
snackbarHostState.showSnackbar(
|
||||
message = errorRetrievingContacts
|
||||
)
|
||||
onDismiss(userMessage)
|
||||
}
|
||||
}
|
||||
|
||||
is UserMessage.Prompt.ConfirmRemoveRecipient -> Dialogs.SimpleAlertDialog(
|
||||
|
||||
@@ -20,7 +20,6 @@ import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.TextRange
|
||||
import androidx.compose.ui.text.input.KeyboardCapitalization
|
||||
@@ -38,7 +37,6 @@ import org.signal.core.ui.compose.Previews
|
||||
import org.signal.core.ui.compose.Scaffolds
|
||||
import org.signal.core.ui.compose.SignalIcons
|
||||
import org.signal.core.util.isNotNullOrBlank
|
||||
import org.signal.core.util.logging.Log
|
||||
import org.thoughtcrime.securesms.R
|
||||
|
||||
/**
|
||||
@@ -47,7 +45,6 @@ import org.thoughtcrime.securesms.R
|
||||
class EditDeviceNameFragment : ComposeFragment() {
|
||||
|
||||
companion object {
|
||||
private val TAG = Log.tag(EditDeviceNameFragment::class)
|
||||
const val MAX_LENGTH = 50
|
||||
}
|
||||
|
||||
@@ -57,16 +54,15 @@ class EditDeviceNameFragment : ComposeFragment() {
|
||||
override fun FragmentContent() {
|
||||
val state by viewModel.state.collectAsStateWithLifecycle()
|
||||
val navController: NavController by remember { mutableStateOf(findNavController()) }
|
||||
val context = LocalContext.current
|
||||
|
||||
LaunchedEffect(state.oneTimeEvent) {
|
||||
when (state.oneTimeEvent) {
|
||||
LinkDeviceSettingsState.OneTimeEvent.SnackbarNameChangeSuccess -> {
|
||||
Snackbar.make(requireView(), context.getString(R.string.EditDeviceNameFragment__device_name_updated), Snackbar.LENGTH_LONG).show()
|
||||
Snackbar.make(requireView(), getString(R.string.EditDeviceNameFragment__device_name_updated), Snackbar.LENGTH_LONG).show()
|
||||
navController.popBackStack()
|
||||
}
|
||||
LinkDeviceSettingsState.OneTimeEvent.SnackbarNameChangeFailure -> {
|
||||
Snackbar.make(requireView(), context.getString(R.string.EditDeviceNameFragment__unable_to_change), Snackbar.LENGTH_LONG).show()
|
||||
Snackbar.make(requireView(), getString(R.string.EditDeviceNameFragment__unable_to_change), Snackbar.LENGTH_LONG).show()
|
||||
}
|
||||
LinkDeviceSettingsState.OneTimeEvent.HideFinishedSheet,
|
||||
LinkDeviceSettingsState.OneTimeEvent.LaunchQrCodeScanner,
|
||||
|
||||
@@ -42,6 +42,7 @@ import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalLocale
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.AnnotatedString
|
||||
@@ -75,7 +76,6 @@ import org.thoughtcrime.securesms.util.CommunicationActions
|
||||
import org.thoughtcrime.securesms.util.DateUtils
|
||||
import org.thoughtcrime.securesms.util.SupportEmailUtil
|
||||
import org.thoughtcrime.securesms.util.navigation.safeNavigate
|
||||
import java.util.Locale
|
||||
|
||||
private const val PLACEHOLDER = "__ICON_PLACEHOLDER__"
|
||||
|
||||
@@ -149,16 +149,16 @@ class LinkDeviceFragment : ComposeFragment() {
|
||||
Unit
|
||||
}
|
||||
is LinkDeviceSettingsState.OneTimeEvent.ToastLinked -> {
|
||||
Toast.makeText(context, context.getString(R.string.LinkDeviceFragment__s_linked, event.name), Toast.LENGTH_LONG).show()
|
||||
Toast.makeText(requireContext(), getString(R.string.LinkDeviceFragment__s_linked, event.name), Toast.LENGTH_LONG).show()
|
||||
}
|
||||
is LinkDeviceSettingsState.OneTimeEvent.ToastUnlinked -> {
|
||||
Toast.makeText(context, context.getString(R.string.LinkDeviceFragment__s_unlinked, event.name), Toast.LENGTH_LONG).show()
|
||||
Toast.makeText(requireContext(), getString(R.string.LinkDeviceFragment__s_unlinked, event.name), Toast.LENGTH_LONG).show()
|
||||
}
|
||||
LinkDeviceSettingsState.OneTimeEvent.SnackbarLinkCancelled -> {
|
||||
Snackbar.make(requireView(), context.getString(R.string.LinkDeviceFragment__linking_cancelled), Snackbar.LENGTH_LONG).show()
|
||||
Snackbar.make(requireView(), getString(R.string.LinkDeviceFragment__linking_cancelled), Snackbar.LENGTH_LONG).show()
|
||||
}
|
||||
LinkDeviceSettingsState.OneTimeEvent.ToastNetworkFailed -> {
|
||||
Toast.makeText(context, context.getString(R.string.DeviceListActivity_network_failed), Toast.LENGTH_LONG).show()
|
||||
Toast.makeText(requireContext(), getString(R.string.DeviceListActivity_network_failed), Toast.LENGTH_LONG).show()
|
||||
}
|
||||
LinkDeviceSettingsState.OneTimeEvent.LaunchQrCodeScanner -> {
|
||||
navController.navigateToQrScannerIfAuthed()
|
||||
@@ -352,7 +352,8 @@ fun DeviceListScreen(
|
||||
)
|
||||
}
|
||||
is DialogState.DeviceUnlinked -> {
|
||||
val createdAt = DateUtils.getDateTimeString(LocalContext.current, Locale.getDefault(), state.dialogState.deviceCreatedAt)
|
||||
val locale = LocalLocale.current.platformLocale
|
||||
val createdAt = DateUtils.getDateTimeString(LocalContext.current, locale, state.dialogState.deviceCreatedAt)
|
||||
Dialogs.SimpleMessageDialog(
|
||||
title = stringResource(id = R.string.LinkDeviceFragment__device_unlinked),
|
||||
message = stringResource(id = R.string.LinkDeviceFragment__the_device_that_was, createdAt),
|
||||
@@ -494,8 +495,8 @@ fun DeviceListScreen(
|
||||
@Composable
|
||||
fun DeviceRow(device: Device, isInternalUser: Boolean, setDeviceToRemove: (Device) -> Unit, onEditDevice: (Device) -> Unit) {
|
||||
val titleString = if (device.name.isNullOrEmpty()) stringResource(R.string.DeviceListItem_unnamed_device) else device.name
|
||||
val linkedDate = device.createdMillis?.let { DateUtils.getDayPrecisionTimeSpanString(LocalContext.current, Locale.getDefault(), device.createdMillis) }
|
||||
val lastActive = DateUtils.getDayPrecisionTimeSpanString(LocalContext.current, Locale.getDefault(), device.lastSeenMillis)
|
||||
val linkedDate = device.createdMillis?.let { DateUtils.getDayPrecisionTimeSpanString(LocalContext.current, LocalLocale.current.platformLocale, device.createdMillis) }
|
||||
val lastActive = DateUtils.getDayPrecisionTimeSpanString(LocalContext.current, LocalLocale.current.platformLocale, device.lastSeenMillis)
|
||||
val menuController = remember { DropdownMenus.MenuController() }
|
||||
Row(
|
||||
modifier = Modifier
|
||||
|
||||
+3
-2
@@ -22,6 +22,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalLocale
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
@@ -34,7 +35,6 @@ import org.signal.core.ui.compose.horizontalGutters
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.registration.olddevice.QuickTransferOldDeviceState
|
||||
import org.thoughtcrime.securesms.util.DateUtils
|
||||
import java.util.Locale
|
||||
import org.signal.core.ui.R as CoreUiR
|
||||
|
||||
@Composable
|
||||
@@ -82,8 +82,9 @@ fun PrepareDeviceScreen(
|
||||
|
||||
if (state.lastBackupTimestamp > 0) {
|
||||
val context = LocalContext.current
|
||||
val locale = LocalLocale.current.platformLocale
|
||||
|
||||
val dateString = DateUtils.getDateTimeString(context, Locale.getDefault(), state.lastBackupTimestamp)
|
||||
val dateString = DateUtils.getDateTimeString(context, locale, state.lastBackupTimestamp)
|
||||
|
||||
Text(
|
||||
text = stringResource(R.string.PrepareDevice_last_backup_description, dateString),
|
||||
|
||||
+4
-3
@@ -38,6 +38,7 @@ import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalLocale
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.AnnotatedString
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
@@ -87,7 +88,6 @@ import org.thoughtcrime.securesms.util.DateUtils
|
||||
import org.thoughtcrime.securesms.util.PlayStoreUtil
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences
|
||||
import org.thoughtcrime.securesms.util.viewModel
|
||||
import java.util.Locale
|
||||
import kotlin.time.Duration
|
||||
|
||||
/**
|
||||
@@ -326,17 +326,18 @@ private fun BackupAvailableContent(
|
||||
onUpdateSignal: () -> Unit,
|
||||
onContactSupport: () -> Unit
|
||||
) {
|
||||
val locale = LocalLocale.current.platformLocale
|
||||
val subtitle = if (state.backupSize.bytes > 0) {
|
||||
stringResource(
|
||||
id = R.string.RemoteRestoreActivity__backup_created_at_with_size,
|
||||
DateUtils.formatDateWithoutDayOfWeek(Locale.getDefault(), state.backupTime),
|
||||
DateUtils.formatDateWithoutDayOfWeek(locale, state.backupTime),
|
||||
DateUtils.getOnlyTimeString(LocalContext.current, state.backupTime),
|
||||
state.backupSize.toUnitString()
|
||||
)
|
||||
} else {
|
||||
stringResource(
|
||||
id = R.string.RemoteRestoreActivity__backup_created_at,
|
||||
DateUtils.formatDateWithoutDayOfWeek(Locale.getDefault(), state.backupTime),
|
||||
DateUtils.formatDateWithoutDayOfWeek(locale, state.backupTime),
|
||||
DateUtils.getOnlyTimeString(LocalContext.current, state.backupTime)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalResources
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.res.vectorResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -75,6 +76,7 @@ class SearchFilterBottomSheet : ComposeBottomSheetDialogFragment() {
|
||||
@Composable
|
||||
override fun SheetContent() {
|
||||
val context = LocalContext.current
|
||||
val resources = LocalResources.current
|
||||
val args = requireArguments()
|
||||
|
||||
var startDate by remember {
|
||||
@@ -96,12 +98,12 @@ class SearchFilterBottomSheet : ComposeBottomSheetDialogFragment() {
|
||||
|
||||
val startDateText = remember(startDate) {
|
||||
startDate?.let { DateUtils.getDayPrecisionTimeString(context, Locale.getDefault(), it) }
|
||||
?: context.getString(R.string.SearchFilterBottomSheet__not_set)
|
||||
?: resources.getString(R.string.SearchFilterBottomSheet__not_set)
|
||||
}
|
||||
|
||||
val endDateText = remember(endDate) {
|
||||
endDate?.let { DateUtils.getDayPrecisionTimeString(context, Locale.getDefault(), it) }
|
||||
?: context.getString(R.string.SearchFilterBottomSheet__not_set)
|
||||
?: resources.getString(R.string.SearchFilterBottomSheet__not_set)
|
||||
}
|
||||
|
||||
SearchFilterSheetContent(
|
||||
@@ -110,7 +112,7 @@ class SearchFilterBottomSheet : ComposeBottomSheetDialogFragment() {
|
||||
authorName = authorName ?: stringResource(R.string.SearchFilterBottomSheet__anyone),
|
||||
onStartDateClick = {
|
||||
val datePicker = MaterialDatePicker.Builder.datePicker()
|
||||
.setTitleText(context.getString(R.string.SearchFilterBottomSheet__select_date))
|
||||
.setTitleText(resources.getString(R.string.SearchFilterBottomSheet__select_date))
|
||||
.apply {
|
||||
startDate?.let { setSelection(it) }
|
||||
}
|
||||
@@ -123,7 +125,7 @@ class SearchFilterBottomSheet : ComposeBottomSheetDialogFragment() {
|
||||
},
|
||||
onEndDateClick = {
|
||||
val datePicker = MaterialDatePicker.Builder.datePicker()
|
||||
.setTitleText(context.getString(R.string.SearchFilterBottomSheet__select_date))
|
||||
.setTitleText(resources.getString(R.string.SearchFilterBottomSheet__select_date))
|
||||
.apply {
|
||||
endDate?.let { setSelection(it) }
|
||||
}
|
||||
|
||||
@@ -74,8 +74,8 @@ class SelfVerificationFailureSheet : ComposeBottomSheetDialogFragment() {
|
||||
|
||||
LaunchedEffect(state.sendEmail) {
|
||||
if (state.sendEmail && state.debugLogUrl != null) {
|
||||
val subject = context.getString(R.string.SelfVerificationFailureSheet__email_subject)
|
||||
val prefix = "\n${context.getString(R.string.HelpFragment__debug_log)} ${state.debugLogUrl}\n\n"
|
||||
val subject = getString(R.string.SelfVerificationFailureSheet__email_subject)
|
||||
val prefix = "\n${getString(R.string.HelpFragment__debug_log)} ${state.debugLogUrl}\n\n"
|
||||
val body = SupportEmailUtil.generateSupportEmailBody(context, R.string.SelfVerificationFailureSheet__email_filter, prefix, null)
|
||||
CommunicationActions.openEmail(context, SupportEmailUtil.getSupportEmailAddress(context), subject, body)
|
||||
dismissAllowingStateLoss()
|
||||
|
||||
@@ -128,7 +128,7 @@ fun AnimatedFlowRow(
|
||||
val hasExistingItems = knownKeys.isNotEmpty()
|
||||
|
||||
newKeys.forEach { key ->
|
||||
alphaAnimatables[key] = if (hasExistingItems) Animatable(0f) else Animatable(1f)
|
||||
alphaAnimatables[key] = if (hasExistingItems) remember(key) { Animatable(0f) } else remember(key) { Animatable(1f) }
|
||||
knownKeys.add(key)
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ import androidx.compose.ui.platform.LocalConfiguration
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.platform.LocalViewConfiguration
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -400,7 +401,7 @@ private fun CameraSwitchButton(
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
val contentDescription = if (stringResources.switchCamera != 0) {
|
||||
LocalContext.current.getString(stringResources.switchCamera)
|
||||
stringResource(stringResources.switchCamera)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
@@ -428,8 +429,6 @@ private fun FlashToggleButton(
|
||||
stringResources: StringResources,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
|
||||
val icon = when (flashMode) {
|
||||
FlashMode.Off -> SignalIcons.FlashOff
|
||||
FlashMode.On -> SignalIcons.FlashOn
|
||||
@@ -443,7 +442,7 @@ private fun FlashToggleButton(
|
||||
}
|
||||
|
||||
val contentDescription = if (contentDescriptionRes != 0) {
|
||||
context.getString(contentDescriptionRes)
|
||||
stringResource(contentDescriptionRes)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
@@ -478,7 +477,7 @@ private fun MediaCountIndicator(
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
val contentDescription = if (stringResources.send != 0) {
|
||||
LocalContext.current.getString(stringResources.send)
|
||||
stringResource(stringResources.send)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ android-application = { module = "com.android.application:com.android.applicatio
|
||||
androidx-benchmark-gradle-plugin = "androidx.benchmark:benchmark-gradle-plugin:1.3.3"
|
||||
|
||||
# Compose
|
||||
androidx-compose-bom = "androidx.compose:compose-bom:2025.11.01"
|
||||
androidx-compose-bom = "androidx.compose:compose-bom:2026.04.01"
|
||||
androidx-compose-material3 = { module = "androidx.compose.material3:material3" }
|
||||
androidx-compose-material3-adaptive = { module = "androidx.compose.material3.adaptive:adaptive"}
|
||||
androidx-compose-material3-adaptive-layout = { module = "androidx.compose.material3.adaptive:adaptive-layout"}
|
||||
@@ -65,7 +65,7 @@ androidx-compose-ui-tooling-core = { module = "androidx.compose.ui:ui-tooling" }
|
||||
androidx-compose-ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest" }
|
||||
androidx-compose-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4" }
|
||||
androidx-compose-runtime-livedata = { module = "androidx.compose.runtime:runtime-livedata" }
|
||||
androidx-compose-rxjava3 = "androidx.compose.runtime:runtime-rxjava3:1.9.2"
|
||||
androidx-compose-rxjava3 = "androidx.compose.runtime:runtime-rxjava3:1.11.0"
|
||||
|
||||
# Accompanist
|
||||
accompanist-permissions = { module = "com.google.accompanist:accompanist-permissions", version.ref = "accompanist" }
|
||||
|
||||
+417
-9764
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user