-
Notifications
You must be signed in to change notification settings - Fork 731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Devices Management] Session overview screen (PSG-691, PSG-693) #7005
Conversation
|
This is due to the fact I had to do many small renamings and extract reusable use cases to reduce the existing technical debt on this area. So the PR is large but modifications are not complex. I am not sure how to split it without rewriting the whole history into different branches... |
eb59a53
to
682905d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
SonarCloud Quality Gate failed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Some post merge remarks, feel free to handle them in a quick PR or ignore, the goal is also to give you some feedback. Thanks!
@@ -1,7 +1,7 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<resources> | |||
|
|||
<declare-styleable name="DevicesListHeaderView"> | |||
<declare-styleable name="SessionsListHeaderView"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rename the file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I renamed it in a following PR 😄
|
||
fun getDeviceInfo(deviceId: String, callback: MatrixCallback<DeviceInfo>) | ||
fun getMyDevicesInfoLive(deviceId: String): LiveData<Optional<DeviceInfo>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a changelog with .sdk
extension is required when there are changes in the API (especially SDK Services)
Also in this case, I think the fun should be named getMyDeviceInfoLive
(no s
on Devices
)
fun getDeviceInfo(userId: String, deviceId: String?): CryptoDeviceInfo? | ||
fun getCryptoDeviceInfo(userId: String, deviceId: String?): CryptoDeviceInfo? | ||
|
||
fun getCryptoDeviceInfo(deviceId: String, callback: MatrixCallback<DeviceInfo>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've got 2 models: CryptoDeviceInfo
and DeviceInfo
. I think the fun name should match the model. This is not the case here.
|
||
fun getLiveCryptoDeviceInfoWithId(deviceId: String): LiveData<Optional<CryptoDeviceInfo>> | ||
|
||
fun getLiveCryptoDeviceInfo(userId: String): LiveData<List<CryptoDeviceInfo>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rename to getLiveCryptoDeviceInfos
(plurals)
|
||
fun getCryptoDeviceInfo(userId: String): List<CryptoDeviceInfo> | ||
|
||
fun getLiveCryptoDeviceInfo(): LiveData<List<CryptoDeviceInfo>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rename to getLiveCryptoDeviceInfos
(plurals), or maybe more English correct getLiveCryptoDevicesInfo
private fun appendLearnMoreToVerificationStatus() { | ||
val status = views.sessionInfoVerificationStatusDetailTextView.text | ||
val learnMore = context.getString(R.string.action_learn_more) | ||
val stringBuilder = StringBuilder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Kotlin stdlib provides a handy buildString {}
which can be nice to use in such case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know this method. Thanks, I will update.
} | ||
?: run { | ||
views.sessionInfoLastIPAddressTextView.isGone = true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be rewrite to shorter version using setTextOrHide
:
views.sessionInfoLastIPAddressTextView.setTextOrHide(deviceInfo.lastSeenIp?.takeIf { isLastSeenDetailsVisible })
* Display the overview info about a Session. | ||
*/ | ||
@AndroidEntryPoint | ||
class SessionOverviewActivity : SimpleFragmentActivity() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About the naming, the convention in the project would dictate to name this class SessionDetailActivity
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will have in a next PR another screen for "Session details" which will be named SessionDetailsActivity
. It will be accessed from this "Session overview" screen.
|
||
private fun observeSessionInfo(deviceId: String) { | ||
getDeviceFullInfoUseCase.execute(deviceId) | ||
.mapNotNull { it.getOrNull() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could replace by .unwrap()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see there was this extension method. I will use it inside the getDeviceFullInfoUseCase
.
@@ -0,0 +1,20 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have used a ScrollView here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it might be a good idea for small devices. It will be done in a next PR (session details screen).
Thanks for the feedbacks, I will handle some of them in a dedicated future PR. |
Type of change
Content
SessionInfoView
which can be reused for current session or any session.Motivation and context
Closes #6961
Screenshots / GIFs
Tests
Tested devices
Checklist