Skip to content

Commit

Permalink
Update to latest makepad, where PortalList item ID is a usize
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinaboos committed Jan 31, 2024
1 parent 67c3a1d commit 76099cc
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 43 deletions.
54 changes: 27 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/contacts/contacts_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ impl Widget for ContactsList {

fn draw_walk(&mut self, cx: &mut Cx2d, scope: &mut Scope, walk: Walk) -> DrawStep {
let grouped_data = self.group_by_first_letter();
let groups_count: u64 = grouped_data.len() as u64;
let groups_count = grouped_data.len();

while let Some(list_item) = self.view.draw_walk(cx, scope, walk).step(){
if let Some(mut list) = list_item.as_portal_list().borrow_mut() {
Expand Down
2 changes: 1 addition & 1 deletion src/discover/moment_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ impl Widget for MomentList {
}

fn draw_walk(&mut self, cx: &mut Cx2d, scope: &mut Scope, walk: Walk) -> DrawStep {
let moment_entries_count = self.moment_entries.len() as u64;
let moment_entries_count = self.moment_entries.len();

while let Some(item) = self.view.draw_walk(cx, scope, walk).step(){
if let Some(mut list) = item.as_portal_list().borrow_mut() {
Expand Down
23 changes: 11 additions & 12 deletions src/home/room_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ struct SavedState {
/// The ID of the first item in the timeline's PortalList that is currently visible.
///
/// TODO: expose scroll position from PortalList and use that instead, which is more accurate.
first_id: u64,
first_id: usize,
}

impl Timeline {
Expand Down Expand Up @@ -838,18 +838,17 @@ impl Widget for Timeline {
for action in actions {
let stack_view_subwidget_action = action.as_widget_action().cast();
match stack_view_subwidget_action {
// TODO: this should be `HideEnd`, but we don't currently receive any `HideEnd` events
// at all due to a presumed bug with the Stack Navigation widget.
StackNavigationTransitionAction::HideBegin => {
StackNavigationTransitionAction::HideEnd => {
self.save_state();
continue;
}
StackNavigationTransitionAction::Show => {
StackNavigationTransitionAction::ShowBegin => {
self.restore_state();
self.redraw(cx);
continue;
}
StackNavigationTransitionAction::HideEnd
StackNavigationTransitionAction::HideBegin
| StackNavigationTransitionAction::ShowDone
| StackNavigationTransitionAction::None => { }
}

Expand All @@ -874,7 +873,7 @@ impl Widget for Timeline {
let tl_items = &tl_state.items;

// Determine length of the portal list based on the number of timeline items.
let last_item_id = tl_items.len() as u64;
let last_item_id = tl_items.len();
let last_item_id = last_item_id + 1; // Add 1 for the TopSpace.

// Start the actual drawing procedure.
Expand Down Expand Up @@ -975,7 +974,7 @@ impl Widget for Timeline {
fn populate_message_view(
cx: &mut Cx,
list: &mut PortalList,
item_id: u64,
item_id: usize,
event_tl_item: &EventTimelineItem,
message: &timeline::Message,
media_cache: &mut MediaCache,
Expand Down Expand Up @@ -1082,7 +1081,7 @@ fn populate_message_view(
fn populate_redacted_message_view(
cx: &mut Cx,
list: &mut PortalList,
item_id: u64,
item_id: usize,
event_tl_item: &EventTimelineItem,
_room_id: &OwnedRoomId
) -> WidgetRef {
Expand Down Expand Up @@ -1139,7 +1138,7 @@ fn populate_redacted_message_view(
fn populate_membership_change_view(
cx: &mut Cx,
list: &mut PortalList,
item_id: u64,
item_id: usize,
event_tl_item: &EventTimelineItem,
change: &RoomMembershipChange,
) -> WidgetRef {
Expand Down Expand Up @@ -1207,7 +1206,7 @@ fn populate_membership_change_view(
fn populate_profile_change_view(
cx: &mut Cx,
list: &mut PortalList,
item_id: u64,
item_id: usize,
event_tl_item: &EventTimelineItem,
change: &MemberProfileChange,
) -> WidgetRef {
Expand Down Expand Up @@ -1254,7 +1253,7 @@ fn populate_profile_change_view(
fn populate_other_state_view(
cx: &mut Cx,
list: &mut PortalList,
item_id: u64,
item_id: usize,
event_tl_item: &EventTimelineItem,
other_state: &timeline::OtherState,
) -> WidgetRef {
Expand Down
4 changes: 2 additions & 2 deletions src/home/rooms_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ impl Widget for RoomsList {

// TODO: sort list of `all_rooms` by alphabetic, most recent message, grouped by spaces, etc

let count = self.all_rooms.len() as u64;
let count = self.all_rooms.len();
let last_item_id = count + 1; // Add 1 for the search bar up top.

// Start the actual drawing procedure.
Expand Down Expand Up @@ -315,7 +315,7 @@ impl Widget for RoomsList {
});
} else {
item.as_view().apply_over(cx, live!{
height: Fit,
// height: Fit,
label = { text: (&self.status) }
});
}
Expand Down

0 comments on commit 76099cc

Please sign in to comment.