Fix current session device name.

This commit is contained in:
Onuray Sahin 2022-08-23 17:20:01 +03:00
parent 2648771196
commit ec5d950b7b
3 changed files with 9 additions and 9 deletions

View File

@ -130,7 +130,7 @@ class VectorSettingsDevicesFragment @Inject constructor() : VectorBaseFragment<F
}
if (state.devices is Success && currentDeviceInfo != null) {
renderCurrentDevice(state)
renderCurrentDevice(state.accountCrossSigningIsTrusted, !state.hasAccountCrossSigning, currentDeviceInfo.deviceInfo.displayName ?: "")
} else {
hideCurrentSessionView()
}
@ -143,12 +143,13 @@ class VectorSettingsDevicesFragment @Inject constructor() : VectorBaseFragment<F
views.deviceListCurrentSession.isVisible = false
}
private fun renderCurrentDevice(state: DevicesViewState) {
private fun renderCurrentDevice(accountCrossSigningIsTrusted: Boolean, legacyMode: Boolean, sessionName: String) {
views.deviceListHeaderSectionCurrent.isVisible = true
views.deviceListCurrentSession.isVisible = true
views.deviceListCurrentSession.update(
accountCrossSigningIsTrusted = state.accountCrossSigningIsTrusted,
legacyMode = !state.hasAccountCrossSigning
accountCrossSigningIsTrusted = accountCrossSigningIsTrusted,
legacyMode = legacyMode,
sessionName = sessionName
)
}

View File

@ -39,8 +39,8 @@ class CurrentSessionView @JvmOverloads constructor(
views = ViewCurrentSessionBinding.bind(this)
}
fun update(accountCrossSigningIsTrusted: Boolean, legacyMode: Boolean) {
renderDeviceType()
fun update(accountCrossSigningIsTrusted: Boolean, legacyMode: Boolean, sessionName: String) {
renderDeviceInfo(sessionName)
renderVerificationStatus(accountCrossSigningIsTrusted, legacyMode)
}
@ -75,9 +75,9 @@ class CurrentSessionView @JvmOverloads constructor(
}
// TODO. We don't have this info yet. Update later accordingly.
private fun renderDeviceType() {
private fun renderDeviceInfo(sessionName: String) {
views.currentSessionDeviceTypeImageView.setImageResource(R.drawable.ic_device_type_mobile)
views.currentSessionDeviceTypeImageView.contentDescription = context.getString(R.string.a11y_device_manager_device_type_mobile)
views.currentSessionDeviceTypeTextView.text = context.getString(R.string.device_manager_device_type_android)
views.currentSessionNameTextView.text = sessionName
}
}

View File

@ -3209,7 +3209,6 @@
<string name="a11y_device_manager_device_type_mobile">Mobile</string>
<string name="a11y_device_manager_device_type_web" tools:ignore="UnusedResources">Web</string>
<string name="a11y_device_manager_device_type_desktop" tools:ignore="UnusedResources">Desktop</string>
<string name="device_manager_device_type_android">${app_name} Mobile: Android</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_detail_verified">Your current session is ready for secure messaging.</string>