mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 20:06:51 +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="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_verified">Verified session</string>
|
||||||
<string name="device_manager_verification_status_unverified">Unverified 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_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_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_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_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_verify_session">Verify Session</string>
|
||||||
<string name="device_manager_view_details">View Details</string>
|
<string name="device_manager_view_details">View Details</string>
|
||||||
<string name="device_manager_other_sessions_view_all">View All (%1$d)</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 ->
|
data.forEach { device ->
|
||||||
val dateFormatKind = if (device.isInactive) DateFormatKind.TIMELINE_DAY_DIVIDER else DateFormatKind.DEFAULT_DATE_AND_TIME
|
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 formattedLastActivityDate = host.dateFormatter.format(device.deviceInfo.lastSeenTs, dateFormatKind)
|
||||||
val description = calculateDescription(device, formattedLastActivityDate)
|
val description = buildDescription(device, formattedLastActivityDate)
|
||||||
val descriptionColor = if (device.isCurrentDevice) {
|
val descriptionColor = if (device.isCurrentDevice) {
|
||||||
host.colorProvider.getColorFromAttribute(R.attr.colorError)
|
host.colorProvider.getColorFromAttribute(R.attr.colorError)
|
||||||
} else {
|
} 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 {
|
return when {
|
||||||
device.isInactive -> {
|
device.isInactive -> {
|
||||||
stringProvider.getQuantityString(
|
stringProvider.getQuantityString(
|
||||||
|
@ -93,6 +93,9 @@ class OtherSessionsController @Inject constructor(
|
||||||
device.isCurrentDevice -> {
|
device.isCurrentDevice -> {
|
||||||
stringProvider.getString(R.string.device_manager_other_sessions_description_unverified_current_session)
|
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 -> {
|
else -> {
|
||||||
stringProvider.getString(R.string.device_manager_other_sessions_description_unverified, formattedLastActivityDate)
|
stringProvider.getString(R.string.device_manager_other_sessions_description_unverified, formattedLastActivityDate)
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,10 +90,11 @@ class SessionInfoView @JvmOverloads constructor(
|
||||||
isVerifyButtonVisible: Boolean,
|
isVerifyButtonVisible: Boolean,
|
||||||
) {
|
) {
|
||||||
views.sessionInfoVerificationStatusImageView.render(encryptionTrustLevel)
|
views.sessionInfoVerificationStatusImageView.render(encryptionTrustLevel)
|
||||||
if (encryptionTrustLevel == RoomEncryptionTrustLevel.Trusted) {
|
when {
|
||||||
renderCrossSigningVerified(isCurrentSession)
|
encryptionTrustLevel == RoomEncryptionTrustLevel.Trusted -> renderCrossSigningVerified(isCurrentSession)
|
||||||
} else {
|
encryptionTrustLevel == RoomEncryptionTrustLevel.Default && !isCurrentSession -> renderCrossSigningUnknown()
|
||||||
renderCrossSigningUnverified(isCurrentSession, isVerifyButtonVisible)
|
else -> renderCrossSigningUnverified(isCurrentSession, isVerifyButtonVisible)
|
||||||
|
|
||||||
}
|
}
|
||||||
if (hasLearnMoreLink) {
|
if (hasLearnMoreLink) {
|
||||||
appendLearnMoreToVerificationStatus()
|
appendLearnMoreToVerificationStatus()
|
||||||
|
@ -142,6 +143,12 @@ class SessionInfoView @JvmOverloads constructor(
|
||||||
views.sessionInfoVerifySessionButton.isVisible = isVerifyButtonVisible
|
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) {
|
private fun renderDeviceInfo(sessionName: String, deviceType: DeviceType, stringProvider: StringProvider) {
|
||||||
setDeviceTypeIconUseCase.execute(deviceType, views.sessionInfoDeviceTypeImageView, stringProvider)
|
setDeviceTypeIconUseCase.execute(deviceType, views.sessionInfoDeviceTypeImageView, stringProvider)
|
||||||
views.sessionInfoNameTextView.text = sessionName
|
views.sessionInfoNameTextView.text = sessionName
|
||||||
|
|
Loading…
Reference in a new issue