@@ -29,9 +29,9 @@ use crate::{
2929 user_profile:: { ShowUserProfileAction , UserProfile , UserProfileAndRoomId , UserProfilePaneInfo , UserProfileSlidingPaneRef , UserProfileSlidingPaneWidgetExt } ,
3030 user_profile_cache,
3131 } ,
32- room:: { BasicRoomDetails , room_input_bar:: RoomInputBarState , typing_notice:: TypingNoticeWidgetExt } ,
32+ room:: { BasicRoomDetails , loading_screen :: RoomLoadingScreenWidgetExt , room_input_bar:: RoomInputBarState , typing_notice:: TypingNoticeWidgetExt } ,
3333 shared:: {
34- avatar:: { AvatarState , AvatarWidgetRefExt } , callout_tooltip:: { CalloutTooltipOptions , TooltipAction , TooltipPosition } , confirmation_modal:: ConfirmationModalContent , html_or_plaintext:: { HtmlOrPlaintextRef , HtmlOrPlaintextWidgetRefExt , RobrixHtmlLinkAction } , image_viewer:: { ImageViewerAction , ImageViewerMetaData , LoadState } , jump_to_bottom_button:: { JumpToBottomButtonWidgetExt , UnreadMessageCount } , popup_list:: { PopupItem , PopupKind , enqueue_popup_notification} , restore_status_view :: RestoreStatusViewWidgetExt , styles:: * , text_or_image:: { TextOrImageAction , TextOrImageRef , TextOrImageWidgetRefExt } , timestamp:: TimestampWidgetRefExt
34+ avatar:: { AvatarState , AvatarWidgetRefExt } , callout_tooltip:: { CalloutTooltipOptions , TooltipAction , TooltipPosition } , confirmation_modal:: ConfirmationModalContent , html_or_plaintext:: { HtmlOrPlaintextRef , HtmlOrPlaintextWidgetRefExt , RobrixHtmlLinkAction } , image_viewer:: { ImageViewerAction , ImageViewerMetaData , LoadState } , jump_to_bottom_button:: { JumpToBottomButtonWidgetExt , UnreadMessageCount } , popup_list:: { PopupItem , PopupKind , enqueue_popup_notification} , styles:: * , text_or_image:: { TextOrImageAction , TextOrImageRef , TextOrImageWidgetRefExt } , timestamp:: TimestampWidgetRefExt
3535 } ,
3636 sliding_sync:: { BackwardsPaginateUntilEventRequest , MatrixRequest , PaginationDirection , TimelineEndpoints , TimelineRequestSender , UserPowerLevels , get_client, submit_async_request, take_timeline_endpoints} , utils:: { self , ImageFormat , MEDIA_THUMBNAIL_FORMAT , RoomNameId , unix_time_millis_to_datetime}
3737} ;
@@ -78,7 +78,7 @@ live_design! {
7878 use crate :: room:: typing_notice:: * ;
7979 use crate :: home:: room_read_receipt:: * ;
8080 use crate :: rooms_list:: * ;
81- use crate :: shared :: restore_status_view :: * ;
81+ use crate :: room :: loading_screen :: RoomLoadingScreen ;
8282 use crate :: home:: link_preview:: LinkPreview ;
8383 use link:: tsp_link:: TspSignIndicator ;
8484
@@ -516,7 +516,7 @@ live_design! {
516516 color: ( COLOR_PRIMARY_DARKER )
517517 }
518518
519- restore_status_view = <RestoreStatusView > { }
519+ loading_screen = <RoomLoadingScreen > { visible : false }
520520
521521 // Widgets within this view will get shifted upwards when the on-screen keyboard is shown.
522522 keyboard_view = <KeyboardView > {
@@ -976,15 +976,16 @@ impl Widget for RoomScreen {
976976
977977
978978 fn draw_walk ( & mut self , cx : & mut Cx2d , scope : & mut Scope , walk : Walk ) -> DrawStep {
979- // If the room isn't loaded yet, we show the restore status label only.
979+ // If the room isn't loaded yet, we show the loading screen only.
980980 if !self . is_loaded {
981981 let Some ( room_name) = & self . room_name_id else {
982982 // No room selected yet, nothing to show.
983983 return DrawStep :: done ( ) ;
984984 } ;
985- let mut restore_status_view = self . view . restore_status_view ( ids ! ( restore_status_view) ) ;
986- restore_status_view. set_content ( cx, self . all_rooms_loaded , room_name) ;
987- return restore_status_view. draw ( cx, scope) ;
985+ let mut loading_screen = self . view . room_loading_screen ( ids ! ( loading_screen) ) ;
986+ let ( title, details) = self . loading_screen_content ( room_name) ;
987+ loading_screen. show ( cx, Some ( & title) , details. as_deref ( ) ) ;
988+ return loading_screen. draw ( cx, scope) ;
988989 }
989990 if self . tl_state . is_none ( ) {
990991 // Tl_state may not be ready after dock loading.
@@ -1166,6 +1167,36 @@ impl RoomScreen {
11661167 self . room_name_id . as_ref ( ) . map ( |r| r. room_id ( ) )
11671168 }
11681169
1170+ fn loading_screen_content ( & self , room_name : & RoomNameId ) -> ( String , Option < String > ) {
1171+ if self . all_rooms_loaded {
1172+ (
1173+ format ! (
1174+ "Room {room_name} was not found in the homeserver's list of all rooms."
1175+ ) ,
1176+ Some ( "You may close this screen." . to_owned ( ) ) ,
1177+ )
1178+ } else {
1179+ (
1180+ "Waiting for this room to be loaded from the homeserver" . to_owned ( ) ,
1181+ None ,
1182+ )
1183+ }
1184+ }
1185+
1186+ fn update_loading_screen ( & mut self , cx : & mut Cx ) {
1187+ let loading_screen = self . view . room_loading_screen ( ids ! ( loading_screen) ) ;
1188+ if self . is_loaded {
1189+ loading_screen. hide ( cx) ;
1190+ return ;
1191+ }
1192+ let Some ( room_name) = & self . room_name_id else {
1193+ loading_screen. hide ( cx) ;
1194+ return ;
1195+ } ;
1196+ let ( title, details) = self . loading_screen_content ( room_name) ;
1197+ loading_screen. show ( cx, Some ( & title) , details. as_deref ( ) ) ;
1198+ }
1199+
11691200 /// Processes all pending background updates to the currently-shown timeline.
11701201 ///
11711202 /// Redraws this RoomScreen view if any updates were applied.
@@ -2154,7 +2185,7 @@ impl RoomScreen {
21542185 self . is_loaded = is_loaded_now;
21552186 }
21562187
2157- self . view . restore_status_view ( ids ! ( restore_status_view ) ) . set_visible ( cx , ! self . is_loaded ) ;
2188+ self . update_loading_screen ( cx ) ;
21582189
21592190 // Kick off a back pagination request if it's the first time loading this room,
21602191 // because we want to show the user some messages as soon as possible
0 commit comments