Clean files and update CHANGES
This commit is contained in:
parent
0ff28c4f50
commit
c6178e504f
|
@ -5,7 +5,7 @@ Features ✨:
|
|||
-
|
||||
|
||||
Improvements 🙌:
|
||||
-
|
||||
- Handle date formatting properly (show time am/pm if needed, display year when needed)
|
||||
|
||||
Bugfix 🐛:
|
||||
-
|
||||
|
|
|
@ -164,7 +164,7 @@ Formatter\.formatShortFileSize===1
|
|||
# android\.text\.TextUtils
|
||||
|
||||
### This is not a rule, but a warning: the number of "enum class" has changed. For Json classes, it is mandatory that they have `@JsonClass(generateAdapter = false)`. If it is ok, change the value in file forbidden_strings_in_code.txt
|
||||
enum class===76
|
||||
enum class===77
|
||||
|
||||
### Do not import temporary legacy classes
|
||||
import org.matrix.android.sdk.internal.legacy.riot===3
|
||||
|
|
|
@ -24,4 +24,3 @@ interface DateFormatterProvider {
|
|||
|
||||
val dateWithYearFormatter: DateTimeFormatter
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ class VectorDateFormatter @Inject constructor(private val context: Context,
|
|||
|
||||
private val hourFormatter by lazy {
|
||||
if (DateFormat.is24HourFormat(context)) {
|
||||
DateTimeFormatter.ofPattern("H:mm", localeProvider.current())
|
||||
DateTimeFormatter.ofPattern("HH:mm", localeProvider.current())
|
||||
} else {
|
||||
DateTimeFormatter.ofPattern("h:mm a", localeProvider.current())
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class VectorDateFormatter @Inject constructor(private val context: Context,
|
|||
|
||||
private val fullDateFormatter by lazy {
|
||||
val pattern = if (DateFormat.is24HourFormat(context)) {
|
||||
DateFormat.getBestDateTimePattern(localeProvider.current(), "EEE, d MMM yyyy H:mm")
|
||||
DateFormat.getBestDateTimePattern(localeProvider.current(), "EEE, d MMM yyyy HH:mm")
|
||||
} else {
|
||||
DateFormat.getBestDateTimePattern(localeProvider.current(), "EEE, d MMM yyyy h:mm a")
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ class VectorDateFormatter @Inject constructor(private val context: Context,
|
|||
* @return the formatted date as string.
|
||||
*/
|
||||
fun format(ts: Long?, dateFormatKind: DateFormatKind): String {
|
||||
if (ts == null) return ""
|
||||
if (ts == null) return "-"
|
||||
val localDateTime = DateProvider.toLocalDateTime(ts)
|
||||
return when (dateFormatKind) {
|
||||
DateFormatKind.DEFAULT_DATE_AND_TIME -> formatDateAndTime(ts)
|
||||
|
|
|
@ -44,4 +44,3 @@ object DateProvider {
|
|||
}
|
||||
|
||||
fun LocalDateTime.toTimestamp(): Long = DateProvider.toTimestamp(this)
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@ package im.vector.app.features.crypto.keysrequest
|
|||
|
||||
import android.content.Context
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.date.DateFormatKind
|
||||
import im.vector.app.core.date.VectorDateFormatter
|
||||
import im.vector.app.features.popup.DefaultVectorAlert
|
||||
import im.vector.app.features.popup.PopupAlertManager
|
||||
import org.matrix.android.sdk.api.MatrixCallback
|
||||
|
@ -38,10 +40,6 @@ import org.matrix.android.sdk.internal.crypto.model.CryptoDeviceInfo
|
|||
import org.matrix.android.sdk.internal.crypto.model.MXUsersDevicesMap
|
||||
import org.matrix.android.sdk.internal.crypto.model.rest.DeviceInfo
|
||||
import timber.log.Timber
|
||||
import java.text.DateFormat
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
|
@ -54,8 +52,11 @@ import javax.inject.Singleton
|
|||
*/
|
||||
|
||||
@Singleton
|
||||
class KeyRequestHandler @Inject constructor(private val context: Context, private val popupAlertManager: PopupAlertManager)
|
||||
: GossipingRequestListener,
|
||||
class KeyRequestHandler @Inject constructor(
|
||||
private val context: Context,
|
||||
private val popupAlertManager: PopupAlertManager,
|
||||
private val dateFormatter: VectorDateFormatter
|
||||
) : GossipingRequestListener,
|
||||
VerificationService.Listener {
|
||||
|
||||
private val alertsToRequests = HashMap<String, ArrayList<IncomingRoomKeyRequest>>()
|
||||
|
@ -156,16 +157,7 @@ class KeyRequestHandler @Inject constructor(private val context: Context, privat
|
|||
moreInfo.lastSeenIp
|
||||
}
|
||||
|
||||
val lastSeenTime = moreInfo.lastSeenTs?.let { ts ->
|
||||
val dateFormatTime = SimpleDateFormat("HH:mm:ss", Locale.getDefault())
|
||||
val date = Date(ts)
|
||||
|
||||
val time = dateFormatTime.format(date)
|
||||
val dateFormat = DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault())
|
||||
|
||||
dateFormat.format(date) + ", " + time
|
||||
} ?: "-"
|
||||
|
||||
val lastSeenTime = dateFormatter.format(moreInfo.lastSeenTs, DateFormatKind.DEFAULT_DATE_AND_TIME)
|
||||
val lastSeenInfo = context.getString(R.string.devices_details_last_seen_format, lastSeenIp, lastSeenTime)
|
||||
dialogText = if (wasNewDevice) {
|
||||
context.getString(R.string.you_added_a_new_device_with_info, deviceName, lastSeenInfo)
|
||||
|
|
|
@ -30,7 +30,6 @@ import im.vector.app.core.date.VectorDateFormatter
|
|||
import im.vector.app.core.epoxy.LoadingItem_
|
||||
import im.vector.app.core.extensions.localDateTime
|
||||
import im.vector.app.core.extensions.nextOrNull
|
||||
import im.vector.app.core.resources.DateProvider
|
||||
import im.vector.app.features.home.room.detail.RoomDetailAction
|
||||
import im.vector.app.features.home.room.detail.RoomDetailViewState
|
||||
import im.vector.app.features.home.room.detail.UnreadState
|
||||
|
|
|
@ -22,10 +22,6 @@ import com.airbnb.mvrx.Uninitialized
|
|||
import im.vector.app.core.extensions.canReact
|
||||
import im.vector.app.features.home.room.detail.timeline.item.MessageInformationData
|
||||
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
|
||||
import java.text.SimpleDateFormat
|
||||
import java.time.LocalDateTime
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
|
||||
/**
|
||||
* Quick reactions state
|
||||
|
|
|
@ -21,7 +21,6 @@ import android.view.View
|
|||
import androidx.core.view.isVisible
|
||||
import im.vector.app.core.date.DateFormatKind
|
||||
import im.vector.app.core.date.VectorDateFormatter
|
||||
import im.vector.app.core.extensions.localDateTime
|
||||
import im.vector.lib.attachmentviewer.AttachmentInfo
|
||||
import org.matrix.android.sdk.api.MatrixCallback
|
||||
import org.matrix.android.sdk.api.session.events.model.isVideoMessage
|
||||
|
|
|
@ -22,6 +22,7 @@ import androidx.core.content.edit
|
|||
import androidx.preference.PreferenceManager
|
||||
import im.vector.app.BuildConfig
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.resources.LocaleProvider
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import timber.log.Timber
|
||||
|
@ -57,7 +58,7 @@ object VectorLocale {
|
|||
/**
|
||||
* Init this object
|
||||
*/
|
||||
fun init(context: Context) {
|
||||
fun init(context: Context, localeProvider: LocaleProvider) {
|
||||
this.context = context
|
||||
val preferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
|
|
|
@ -31,10 +31,6 @@ import im.vector.app.core.epoxy.VectorEpoxyModel
|
|||
import im.vector.app.core.resources.ColorProvider
|
||||
import im.vector.app.core.utils.DimensionConverter
|
||||
import me.gujun.android.span.span
|
||||
import java.text.DateFormat
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
|
||||
/**
|
||||
* A list item for Device.
|
||||
|
|
Loading…
Reference in New Issue