Skip to content

WIP: enable cross category drag and drop #3676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

0x-r4bbit
Copy link
Member

This depends on status-im/StatusQ#424 and also has a bug because of status-im/status-go#2376 (still waiting for verification on that one).

Anyways, with this PR, drag and drop across categories works. Few things left to be done:

  1. The bug in status-go (if confirmed) causes unexpected order of chat items if an item of one category is moved to a different category at the same position. Not a huge issue but a bug. See the linked issue for more details.
  2. There's no visual update in the category lists after the drop and before the signal to backend. I was fiddling around with that by updating the position properties of all related chat items in memory, but couldn't get it to work nicely. I probably need some help with that. One easy option to "fix" this: Render a rectangle with loading over the entire community after drop until communities chat update happens. That way users won't see a "flicker" when chat item positions are updated.

if (c.position >= chat.position+1):
community.chats[i].position = c.position + 1

i = i + 1
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a WIP attempt to update the chat item positions until we get a response from status-go.

This is the part I need help with.

# position so we don't get a funny flicker effect once the position
# was updated in the backend.
#ensureCorrectChatPositions(community, newChat)
#else:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the time being I've commented it out to ensure drag and drop works otherwise.


for c in community.chats:
if c.categoryId == cat.id:
echo "-> ", c.name, ": ", c.position
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just debugging output which can be ignored and will be removed before merge.

Helps inspecting what chat items belong to which categories when we get an update from status-go.

That's how I verified the bug reported in status-im/status-go#2376


# Update chat object and persist new position in memory until
# backend has been updated with new chat position.
self.updateCommunityChat(chat, true)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is part of visually updating the new order in QML, but before we the reorder signal was sent to status-go.

updateCommunityChat performs updateChats eventually, which is what we need. We just need to make sure that the positions of each chat item is updated correctly before that (see comment above).

@@ -95,7 +95,7 @@ Item {
ScrollView {
id: chatGroupsContainer
anchors.top: membershipRequests.bottom
anchors.topMargin: Style.current.padding
anchors.topMargin: Style.current.padding - 8
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added this because, with the new drag and drop capabilities, users can drag out of a category, To make that work, there's an additional 8px space at the top of the StatusChatListAndCategories component, so I'm substracting it here.

We actually need to check whether the "uncategorized" chat list is indeed empty and only then substract the height here (because only then the new drop area is active and visible)

@status-im-auto
Copy link
Member

status-im-auto commented Sep 23, 2021

Jenkins Builds

Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ e74f249 #1 2021-09-23 12:10:53 ~11 min macos 📦dmg
✔️ e74f249 #1 2021-09-23 12:15:15 ~16 min linux 📦tgz
✔️ e74f249 #1 2021-09-23 12:21:10 ~21 min windows 📦exe

@0x-r4bbit
Copy link
Member Author

Closing for now

@0x-r4bbit 0x-r4bbit closed this Nov 11, 2021
@anastasiyaig anastasiyaig deleted the wip/cross-cat-dnd branch June 28, 2024 12:11
@anastasiyaig anastasiyaig restored the wip/cross-cat-dnd branch June 28, 2024 12:11
@anastasiyaig anastasiyaig deleted the wip/cross-cat-dnd branch August 28, 2024 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants