mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Avoid flashing the room list skeletons on launch
On a cold launch the home screen appeared just before the cached rooms published, briefly showing skeletons that were immediately replaced. The home screen now starts in a new awaitingCachedRooms mode, keeping the list blank while a cached room list is about to publish and falling back to the skeletons after 500ms. Without a cache the skeletons show straight away as before.
This commit is contained in:
@@ -53,12 +53,16 @@ enum HomeScreenViewAction {
|
||||
}
|
||||
|
||||
enum HomeScreenRoomListMode: CustomStringConvertible {
|
||||
/// Shows nothing briefly on launch as the cached rooms usually publish in time to go straight to them.
|
||||
case awaitingCachedRooms
|
||||
case skeletons
|
||||
case empty
|
||||
case rooms
|
||||
|
||||
var description: String {
|
||||
switch self {
|
||||
case .awaitingCachedRooms:
|
||||
return "Awaiting cached rooms"
|
||||
case .skeletons:
|
||||
return "Showing placeholders"
|
||||
case .empty:
|
||||
@@ -96,7 +100,7 @@ struct HomeScreenViewState: BindableState {
|
||||
var shouldShowNewSoundBanner = false
|
||||
|
||||
var rooms: [HomeScreenRoom] = []
|
||||
var roomListMode: HomeScreenRoomListMode = .skeletons
|
||||
var roomListMode: HomeScreenRoomListMode = .awaitingCachedRooms
|
||||
|
||||
var hasPendingInvitations = false
|
||||
|
||||
@@ -113,7 +117,7 @@ struct HomeScreenViewState: BindableState {
|
||||
var isRoomListSearchEnabled = true
|
||||
|
||||
var visibleRooms: [HomeScreenRoom] {
|
||||
if roomListMode == .skeletons {
|
||||
if roomListMode == .skeletons || roomListMode == .awaitingCachedRooms {
|
||||
return placeholderRooms
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user