mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-27 21:24:42 +00:00
Add date to unlinked dialog.
This commit is contained in:
committed by
Greyson Parrelli
parent
5a4c8a6f9a
commit
71c21eeba6
@@ -325,7 +325,7 @@ fun DeviceListScreen(
|
||||
)
|
||||
}
|
||||
is DialogState.DeviceUnlinked -> {
|
||||
val createdAt = DateUtils.getOnlyTimeString(LocalContext.current, state.dialogState.deviceCreatedAt)
|
||||
val createdAt = DateUtils.getDateTimeString(LocalContext.current, Locale.getDefault(), state.dialogState.deviceCreatedAt)
|
||||
Dialogs.SimpleMessageDialog(
|
||||
title = stringResource(id = R.string.LinkDeviceFragment__device_unlinked),
|
||||
message = stringResource(id = R.string.LinkDeviceFragment__the_device_that_was, createdAt),
|
||||
|
||||
@@ -181,6 +181,17 @@ object DateUtils : android.text.format.DateUtils() {
|
||||
return timestamp.toDateString(format.toString(), locale)
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the timestamp as a date, without the year, followed by the time
|
||||
* eg. Jan 15 at 9:00pm
|
||||
*/
|
||||
@JvmStatic
|
||||
fun getDateTimeString(context: Context, locale: Locale, timestamp: Long): String {
|
||||
val date = timestamp.toDateString("MMM d", locale)
|
||||
val time = timestamp.toLocalTime().formatHours(context)
|
||||
return context.getString(R.string.DateUtils_date_at, date, time)
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the passed timestamp based on the current time at a day precision.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user