Commit 7e15e37
committed
in conv list: show loading spinner as long as request is running
Problem
The shimmer loading skeleton (and the pull-to-refresh spinner) were dismissed after the first emission from the local Room database — even if that emission was an empty list. The network fetch still running in the background was invisible to the user, causing an empty-state flash followed by the actual data appearing.
Changes
ConversationsListViewModel.kt
Removed _isShimmerVisible: MutableStateFlow(true) (which was toggled off prematurely on any DB emission).
Added _isLoadingRooms: MutableStateFlow(true) — set to true when getRooms() starts, false only after the repository Job fully completes (both local DB and network sync are done).
isShimmerVisible is now a combine of _isLoadingRooms and getRoomsStateFlow: shimmer is visible while loading is in progress AND the room list is still empty. This means:
Initial load with no cached data → shimmer stays until the network fetch finishes.
Subsequent pull-to-refresh with existing data → shimmer doesn't re-appear (list isn't empty), but the swipe indicator handles that.
Moved getRoomsStateFlow declaration before isShimmerVisible to fix initialization order.
ConversationsListActivity.kt
Removed isRefreshingState.value = false from the GetRoomsSuccessState branch (which fired too early, after the first DB emission).
Added a isLoadingRooms collector: isRefreshingState is set to false only when isLoadingRooms becomes false, i.e. after the full load cycle completes.
AI-assistant: Github Copilot 1.8.2-243 (Claude Sonnet 4.6)
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>1 parent dfdd453 commit 7e15e37
2 files changed
Lines changed: 30 additions & 11 deletions
File tree
- app/src/main/java/com/nextcloud/talk/conversationlist
- viewmodels
Lines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
384 | 384 | | |
385 | 385 | | |
386 | 386 | | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | 387 | | |
392 | 388 | | |
393 | 389 | | |
| |||
397 | 393 | | |
398 | 394 | | |
399 | 395 | | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
400 | 404 | | |
401 | 405 | | |
402 | 406 | | |
| |||
Lines changed: 22 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
146 | | - | |
147 | | - | |
| 145 | + | |
| 146 | + | |
148 | 147 | | |
149 | | - | |
| 148 | + | |
150 | 149 | | |
151 | 150 | | |
152 | 151 | | |
153 | | - | |
154 | 152 | | |
155 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
156 | 166 | | |
157 | 167 | | |
158 | 168 | | |
| |||
406 | 416 | | |
407 | 417 | | |
408 | 418 | | |
409 | | - | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
410 | 425 | | |
411 | 426 | | |
412 | 427 | | |
| |||
0 commit comments