Code review fixes.
This commit is contained in:
parent
45cf7dcd63
commit
4ab798f88d
@ -78,19 +78,24 @@ class OtherSessionsController @Inject constructor(
|
||||
}
|
||||
|
||||
private fun calculateDescription(device: DeviceFullInfo, formattedLastActivityDate: String): String {
|
||||
return if (device.isInactive) {
|
||||
stringProvider.getQuantityString(
|
||||
R.plurals.device_manager_other_sessions_description_inactive,
|
||||
SESSION_IS_MARKED_AS_INACTIVE_AFTER_DAYS,
|
||||
SESSION_IS_MARKED_AS_INACTIVE_AFTER_DAYS,
|
||||
formattedLastActivityDate
|
||||
)
|
||||
} else if (device.roomEncryptionTrustLevel == RoomEncryptionTrustLevel.Trusted) {
|
||||
stringProvider.getString(R.string.device_manager_other_sessions_description_verified, formattedLastActivityDate)
|
||||
} else if (device.isCurrentDevice) {
|
||||
stringProvider.getString(R.string.device_manager_other_sessions_description_unverified_current_session)
|
||||
} else {
|
||||
stringProvider.getString(R.string.device_manager_other_sessions_description_unverified, formattedLastActivityDate)
|
||||
return when {
|
||||
device.isInactive -> {
|
||||
stringProvider.getQuantityString(
|
||||
R.plurals.device_manager_other_sessions_description_inactive,
|
||||
SESSION_IS_MARKED_AS_INACTIVE_AFTER_DAYS,
|
||||
SESSION_IS_MARKED_AS_INACTIVE_AFTER_DAYS,
|
||||
formattedLastActivityDate
|
||||
)
|
||||
}
|
||||
device.roomEncryptionTrustLevel == RoomEncryptionTrustLevel.Trusted -> {
|
||||
stringProvider.getString(R.string.device_manager_other_sessions_description_verified, formattedLastActivityDate)
|
||||
}
|
||||
device.isCurrentDevice -> {
|
||||
stringProvider.getString(R.string.device_manager_other_sessions_description_unverified_current_session)
|
||||
}
|
||||
else -> {
|
||||
stringProvider.getString(R.string.device_manager_other_sessions_description_unverified, formattedLastActivityDate)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -87,4 +87,9 @@ class SecurityRecommendationView @JvmOverloads constructor(
|
||||
setDescription(viewState.description)
|
||||
setCount(viewState.sessionsCount)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
callback = null
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.annotation.StringRes
|
||||
import com.airbnb.mvrx.Mavericks
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import im.vector.app.core.extensions.addFragment
|
||||
@ -46,6 +47,7 @@ class OtherSessionsActivity : SimpleFragmentActivity() {
|
||||
companion object {
|
||||
fun newIntent(
|
||||
context: Context,
|
||||
@StringRes
|
||||
titleResourceId: Int,
|
||||
defaultFilter: DeviceManagerFilterType,
|
||||
includeCurrentSession: Boolean,
|
||||
|
@ -59,8 +59,7 @@ class OtherSessionsFragment :
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
views.otherSessionsToolbar.title = getString(args.titleResourceId)
|
||||
setupToolbar(views.otherSessionsToolbar).allowBack()
|
||||
setupToolbar(views.otherSessionsToolbar).setTitle(args.titleResourceId).allowBack()
|
||||
observeViewEvents()
|
||||
initFilterView()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user