-
Notifications
You must be signed in to change notification settings - Fork 84
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
Conversation
if (c.position >= chat.position+1): | ||
community.chats[i].position = c.position + 1 | ||
|
||
i = i + 1 |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)
Closing for now |
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:
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.