mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 11:59:12 +03:00
Updating descriptions when unknown verification status
This commit is contained in:
parent
b18b95d1a7
commit
ea0c99011f
3 changed files with 18 additions and 6 deletions
|
@ -3250,10 +3250,12 @@
|
|||
<string name="a11y_device_manager_device_type_unknown">Unknown device type</string>
|
||||
<string name="device_manager_verification_status_verified">Verified session</string>
|
||||
<string name="device_manager_verification_status_unverified">Unverified session</string>
|
||||
<string name="device_manager_verification_status_unknown">Unknown verification status</string>
|
||||
<string name="device_manager_verification_status_detail_current_session_verified">Your current session is ready for secure messaging.</string>
|
||||
<string name="device_manager_verification_status_detail_other_session_verified">This session is ready for secure messaging.</string>
|
||||
<string name="device_manager_verification_status_detail_current_session_unverified">Verify your current session for enhanced secure messaging.</string>
|
||||
<string name="device_manager_verification_status_detail_other_session_unverified">Verify or sign out from this session for best security and reliability.</string>
|
||||
<string name="device_manager_verification_status_detail_other_session_unknown">Verify your current session to reveal this session\'s verification status.</string>
|
||||
<string name="device_manager_verify_session">Verify Session</string>
|
||||
<string name="device_manager_view_details">View Details</string>
|
||||
<string name="device_manager_other_sessions_view_all">View All (%1$d)</string>
|
||||
|
|
|
@ -53,7 +53,7 @@ class OtherSessionsController @Inject constructor(
|
|||
data.forEach { device ->
|
||||
val dateFormatKind = if (device.isInactive) DateFormatKind.TIMELINE_DAY_DIVIDER else DateFormatKind.DEFAULT_DATE_AND_TIME
|
||||
val formattedLastActivityDate = host.dateFormatter.format(device.deviceInfo.lastSeenTs, dateFormatKind)
|
||||
val description = calculateDescription(device, formattedLastActivityDate)
|
||||
val description = buildDescription(device, formattedLastActivityDate)
|
||||
val descriptionColor = if (device.isCurrentDevice) {
|
||||
host.colorProvider.getColorFromAttribute(R.attr.colorError)
|
||||
} else {
|
||||
|
@ -77,7 +77,7 @@ class OtherSessionsController @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun calculateDescription(device: DeviceFullInfo, formattedLastActivityDate: String): String {
|
||||
private fun buildDescription(device: DeviceFullInfo, formattedLastActivityDate: String): String {
|
||||
return when {
|
||||
device.isInactive -> {
|
||||
stringProvider.getQuantityString(
|
||||
|
@ -93,6 +93,9 @@ class OtherSessionsController @Inject constructor(
|
|||
device.isCurrentDevice -> {
|
||||
stringProvider.getString(R.string.device_manager_other_sessions_description_unverified_current_session)
|
||||
}
|
||||
device.roomEncryptionTrustLevel == RoomEncryptionTrustLevel.Default -> {
|
||||
stringProvider.getString(R.string.device_manager_session_last_activity, formattedLastActivityDate)
|
||||
}
|
||||
else -> {
|
||||
stringProvider.getString(R.string.device_manager_other_sessions_description_unverified, formattedLastActivityDate)
|
||||
}
|
||||
|
|
|
@ -90,10 +90,11 @@ class SessionInfoView @JvmOverloads constructor(
|
|||
isVerifyButtonVisible: Boolean,
|
||||
) {
|
||||
views.sessionInfoVerificationStatusImageView.render(encryptionTrustLevel)
|
||||
if (encryptionTrustLevel == RoomEncryptionTrustLevel.Trusted) {
|
||||
renderCrossSigningVerified(isCurrentSession)
|
||||
} else {
|
||||
renderCrossSigningUnverified(isCurrentSession, isVerifyButtonVisible)
|
||||
when {
|
||||
encryptionTrustLevel == RoomEncryptionTrustLevel.Trusted -> renderCrossSigningVerified(isCurrentSession)
|
||||
encryptionTrustLevel == RoomEncryptionTrustLevel.Default && !isCurrentSession -> renderCrossSigningUnknown()
|
||||
else -> renderCrossSigningUnverified(isCurrentSession, isVerifyButtonVisible)
|
||||
|
||||
}
|
||||
if (hasLearnMoreLink) {
|
||||
appendLearnMoreToVerificationStatus()
|
||||
|
@ -142,6 +143,12 @@ class SessionInfoView @JvmOverloads constructor(
|
|||
views.sessionInfoVerifySessionButton.isVisible = isVerifyButtonVisible
|
||||
}
|
||||
|
||||
private fun renderCrossSigningUnknown() {
|
||||
views.sessionInfoVerificationStatusTextView.text = context.getString(R.string.device_manager_verification_status_unknown)
|
||||
views.sessionInfoVerificationStatusDetailTextView.text = context.getString(R.string.device_manager_verification_status_detail_other_session_unknown)
|
||||
views.sessionInfoVerifySessionButton.isVisible = false
|
||||
}
|
||||
|
||||
private fun renderDeviceInfo(sessionName: String, deviceType: DeviceType, stringProvider: StringProvider) {
|
||||
setDeviceTypeIconUseCase.execute(deviceType, views.sessionInfoDeviceTypeImageView, stringProvider)
|
||||
views.sessionInfoNameTextView.text = sessionName
|
||||
|
|
Loading…
Reference in a new issue