@@ -715,14 +715,15 @@ live_design! {
715
715
draw_bg: {
716
716
color: ( COLOR_SECONDARY )
717
717
}
718
-
718
+
719
719
room_screen_wrapper = <View > {
720
720
width: Fill , height: Fill ,
721
721
flow: Overlay ,
722
722
show_bg: true
723
723
draw_bg: {
724
724
color: ( COLOR_PRIMARY_DARKER )
725
725
}
726
+ // Used to retreive the list of loaded rooms.
726
727
<CachedWidget > {
727
728
width: 0 , height: 0 ,
728
729
rooms_list = <RoomsList > { }
@@ -934,10 +935,6 @@ pub struct RoomScreen {
934
935
#[ rust] room_name : String ,
935
936
/// The persistent UI-relevant states for the room that this widget is currently displaying.
936
937
#[ rust] tl_state : Option < TimelineUiState > ,
937
- /// The status of this room being restored from previously-saved data in storage.
938
- /// If `Pending` or `AllRoomsLoaded`, this RoomScreen will display a message;
939
- /// otherwise, the regular RoomScreen content (the room timeline) will be shown.
940
- #[ rust] restore_status : RoomsPanelRestoreAction ,
941
938
}
942
939
impl Drop for RoomScreen {
943
940
fn drop ( & mut self ) {
@@ -961,6 +958,23 @@ impl Widget for RoomScreen {
961
958
// Currently, a Signal event is only used to tell this widget
962
959
// that its timeline events have been updated in the background.
963
960
if let Event :: Signal = event {
961
+ if let Some ( room_id) = & self . room_id {
962
+ if !self . rooms_list ( id ! ( rooms_list) ) . is_room_loaded ( room_id) {
963
+ if self . rooms_list ( id ! ( rooms_list) ) . all_known_rooms_loaded ( ) {
964
+ self . view
965
+ . label ( id ! ( restore_status_label) )
966
+ . set_text ( cx, & format ! (
967
+ "Room {} was not found in the homeserver's list of all rooms." ,
968
+ self . room_name
969
+ ) ) ;
970
+ } else {
971
+ self . view
972
+ . label ( id ! ( restore_status_label) )
973
+ . set_text ( cx, "[Placeholder for Spinner]" ) ;
974
+ }
975
+ return ;
976
+ }
977
+ }
964
978
self . process_timeline_updates ( cx, & portal_list) ;
965
979
966
980
// Ideally we would do this elsewhere on the main thread, because it's not room-specific,
@@ -969,6 +983,7 @@ impl Widget for RoomScreen {
969
983
// and wrap it in a `if let Event::Signal` conditional.
970
984
user_profile_cache:: process_user_profile_updates ( cx) ;
971
985
avatar_cache:: process_avatar_updates ( cx) ;
986
+
972
987
}
973
988
974
989
if let Event :: Actions ( actions) = event {
@@ -1041,10 +1056,11 @@ impl Widget for RoomScreen {
1041
1056
match action. downcast_ref ( ) {
1042
1057
Some ( RoomsPanelRestoreAction :: Success ( room_id) ) => {
1043
1058
if self . room_id . as_ref ( ) . is_some_and ( |r| r == room_id) {
1044
- self . set_restore_status ( cx, RoomsPanelRestoreAction :: Success ( room_id. clone ( ) ) ) ;
1045
1059
// Reset room_id before displaying room.
1046
1060
self . room_id = None ;
1047
1061
self . set_displayed_room ( cx, room_id. clone ( ) , self . room_name . clone ( ) ) ;
1062
+ self . view
1063
+ . label ( id ! ( restore_status_label) ) . set_text ( cx, "" ) ;
1048
1064
return ;
1049
1065
}
1050
1066
}
@@ -1298,28 +1314,9 @@ impl Widget for RoomScreen {
1298
1314
fn draw_walk ( & mut self , cx : & mut Cx2d , scope : & mut Scope , walk : Walk ) -> DrawStep {
1299
1315
if let Some ( room_id) = & self . room_id {
1300
1316
if !self . rooms_list ( id ! ( rooms_list) ) . is_room_loaded ( room_id) {
1301
- if self . rooms_list ( id ! ( rooms_list) ) . all_known_rooms_loaded ( ) {
1302
- self . view
1303
- . label ( id ! ( restore_status_label) )
1304
- . set_text ( cx, & format ! (
1305
- "Room {} was not found in the homeserver's list of all rooms." ,
1306
- self . room_name
1307
- ) ) ;
1308
- return self . view . draw_walk ( cx, scope, walk) ;
1309
- } else {
1310
- self . view
1311
- . label ( id ! ( restore_status_label) )
1312
- . set_text ( cx, "[Placeholder for Spinner]" ) ;
1313
- return self . view . draw_walk ( cx, scope, walk) ;
1314
- }
1317
+ return self . view . draw_walk ( cx, scope, walk) ;
1315
1318
}
1316
1319
}
1317
- // if matches!(
1318
- // &self.restore_status,
1319
- // RoomsPanelRestoreAction::Pending(_)) || self.rooms_list(id!(rooms_list)).all_known_rooms_loaded()
1320
- // {
1321
- // return self.view.draw_walk(cx, scope, walk);
1322
- // }
1323
1320
1324
1321
if self . tl_state . is_none ( ) {
1325
1322
// Tl_state may not be ready after dock loading.
@@ -2299,11 +2296,6 @@ impl RoomScreen {
2299
2296
fn show_timeline ( & mut self , cx : & mut Cx ) {
2300
2297
let room_id = self . room_id . clone ( )
2301
2298
. expect ( "BUG: Timeline::show_timeline(): no room_id was set." ) ;
2302
- // just an optional sanity check
2303
- assert ! ( self . tl_state. is_none( ) ,
2304
- "BUG: tried to show_timeline() into a timeline with existing state. \
2305
- Did you forget to save the timeline state back to the global map of states?",
2306
- ) ;
2307
2299
2308
2300
// Obtain the current user's power levels for this room.
2309
2301
submit_async_request ( MatrixRequest :: GetRoomPowerLevels { room_id : room_id. clone ( ) } ) ;
@@ -2313,7 +2305,6 @@ impl RoomScreen {
2313
2305
( existing, false )
2314
2306
} else {
2315
2307
let Some ( ( update_sender, update_receiver, request_sender) ) = take_timeline_endpoints ( & room_id) else {
2316
- self . set_restore_status ( cx, RoomsPanelRestoreAction :: Pending ( room_id. clone ( ) ) ) ;
2317
2308
return ;
2318
2309
} ;
2319
2310
let new_tl_state = TimelineUiState {
@@ -2502,25 +2493,6 @@ impl RoomScreen {
2502
2493
self . show_timeline ( cx) ;
2503
2494
}
2504
2495
2505
- /// This sets the RoomScreen widget to display a text label in place of the timeline.
2506
- pub fn set_restore_status ( & mut self , cx : & mut Cx , status : RoomsPanelRestoreAction ) {
2507
- match & status {
2508
- RoomsPanelRestoreAction :: Pending ( room_id) => {
2509
- // Set this RoomScreen's room_id such that it can handle a `RoomsPanelRestoreAction::Success` action.
2510
- self . room_id = Some ( room_id. clone ( ) ) ;
2511
- self . view
2512
- . label ( id ! ( restore_status_label) )
2513
- . set_text ( cx, "[Placeholder for Spinner]" ) ;
2514
- self . restore_status = status;
2515
- }
2516
- _ => {
2517
- self . view . label ( id ! ( restore_status_label) ) . set_text ( cx, "" ) ;
2518
- self . restore_status = status;
2519
- }
2520
- }
2521
- self . redraw ( cx) ;
2522
- }
2523
-
2524
2496
/// Sends read receipts based on the current scroll position of the timeline.
2525
2497
fn send_user_read_receipts_based_on_scroll_pos (
2526
2498
& mut self ,
@@ -2631,13 +2603,6 @@ impl RoomScreenRef {
2631
2603
let Some ( mut inner) = self . borrow_mut ( ) else { return } ;
2632
2604
inner. set_displayed_room ( cx, room_id, room_name) ;
2633
2605
}
2634
-
2635
- /// See [`RoomScreen::set_restore_status()`].
2636
- pub fn set_restore_status ( & self , cx : & mut Cx , status : RoomsPanelRestoreAction ) {
2637
- if let Some ( mut inner) = self . borrow_mut ( ) {
2638
- inner. set_restore_status ( cx, status) ;
2639
- }
2640
- }
2641
2606
}
2642
2607
2643
2608
/// Actions for the room screen's tooltip.
0 commit comments