Skip to content

Conversation

@fedrunov
Copy link
Contributor

@fedrunov fedrunov commented Sep 1, 2022

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

new invites screen should also present empty state

Motivation and context

closes #6876
part of #6502

Screenshots / GIFs

Ligh Dark Black
light dark black

output-optimised

@fedrunov fedrunov requested review from a team and ouchadam and removed request for a team September 1, 2022 12:43
@fedrunov fedrunov added the Z-NextRelease For issues and PRs which should be included in the NextRelease. label Sep 1, 2022
}
pagedList.asFlow()
.map {
if (it.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of interest, is an empty result only returned after the pagedList has finished loading?

or is it possible for it to emit an empty state instantly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

up to my tests it emits empty list only when there are no invites

is InvitesContentState.Content -> {
views.invitesStateView.state = StateView.State.Content
Suppress("UNCHECKED_CAST")
controller.submitList(it.content as? PagedList<RoomSummary>)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this cast (and suppress) needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, it's a leftover from attempt to make solution more generic

@fedrunov fedrunov requested a review from bmarty September 5, 2022 14:50
Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, some minor remarks though.

message = stringProvider.getString(R.string.invites_empty_message)
)
} else {
invitesCount = it.loadedCount
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will work since we will test only if this is equal to 1, but I think it's more correct to use it.size()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it.size() will also return placeholders (if there are any), while here we are interested in exact count without them

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from my understanding, the exact count is returned by size(). loadedCount does not include placeholders (= not loaded data, but which exist). If we have for instance 120 invites, there is maybe a risk that loadedCount return 0, or 1 (and so we have a bug), while size() returns 120, during the time the data are not yet loaded.
Anyway the risk is very low I think, and probably temporary, since more data will be loaded to be displayed.

android:fastScrollEnabled="true"
android:overScrollMode="always"
android:scrollbars="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To double check, is it OK to remove this layout_behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we don't need it for state view

@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 6, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@fedrunov fedrunov requested a review from bmarty September 6, 2022 12:42
@bmarty
Copy link
Member

bmarty commented Sep 6, 2022

Test provideVoiceRecorderOnAndroidQReturnsQRecorder will be fixed separately.

Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bmarty bmarty merged commit 1c35e5a into develop Sep 6, 2022
@bmarty bmarty deleted the feature/nfe/invites_empty_state branch September 6, 2022 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Z-NextRelease For issues and PRs which should be included in the NextRelease.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AppLayout: Invites Empty States

5 participants