Replacing error prone takeIf structure
This commit is contained in:
parent
7be958e6a5
commit
7ce56ced4d
|
@ -162,9 +162,8 @@ class SessionInfoView @JvmOverloads constructor(
|
|||
drawableProvider: DrawableProvider,
|
||||
colorProvider: ColorProvider,
|
||||
) {
|
||||
deviceInfo.lastSeenTs
|
||||
?.takeIf { isLastSeenDetailsVisible }
|
||||
?.let { timestamp ->
|
||||
if (deviceInfo.lastSeenTs != null && isLastSeenDetailsVisible) {
|
||||
val timestamp = deviceInfo.lastSeenTs
|
||||
views.sessionInfoLastActivityTextView.isVisible = true
|
||||
views.sessionInfoLastActivityTextView.text = if (isInactive) {
|
||||
val formattedTs = dateFormatter.format(timestamp, DateFormatKind.TIMELINE_DAY_DIVIDER)
|
||||
|
@ -185,11 +184,9 @@ class SessionInfoView @JvmOverloads constructor(
|
|||
null
|
||||
}
|
||||
views.sessionInfoLastActivityTextView.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null)
|
||||
}
|
||||
?: run {
|
||||
} else {
|
||||
views.sessionInfoLastActivityTextView.isGone = true
|
||||
}
|
||||
|
||||
views.sessionInfoLastIPAddressTextView.setTextOrHide(deviceInfo.lastSeenIp?.takeIf { isLastSeenDetailsVisible })
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue