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

View File

@ -39,8 +39,8 @@ class CurrentSessionView @JvmOverloads constructor(
views = ViewCurrentSessionBinding.bind(this) views = ViewCurrentSessionBinding.bind(this)
} }
fun update(accountCrossSigningIsTrusted: Boolean, legacyMode: Boolean) { fun update(accountCrossSigningIsTrusted: Boolean, legacyMode: Boolean, sessionName: String) {
renderDeviceType() renderDeviceInfo(sessionName)
renderVerificationStatus(accountCrossSigningIsTrusted, legacyMode) renderVerificationStatus(accountCrossSigningIsTrusted, legacyMode)
} }
@ -75,9 +75,9 @@ class CurrentSessionView @JvmOverloads constructor(
} }
// TODO. We don't have this info yet. Update later accordingly. // 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.setImageResource(R.drawable.ic_device_type_mobile)
views.currentSessionDeviceTypeImageView.contentDescription = context.getString(R.string.a11y_device_manager_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_mobile">Mobile</string>
<string name="a11y_device_manager_device_type_web" tools:ignore="UnusedResources">Web</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="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_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_detail_verified">Your current session is ready for secure messaging.</string> <string name="device_manager_verification_status_detail_verified">Your current session is ready for secure messaging.</string>