Skip to content
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

Allow drag n drop & fix a few issues with file sharing #572

Merged
merged 4 commits into from
Feb 2, 2024

Conversation

oakkitten
Copy link
Collaborator

See individual commits.

For drag n drop, the entire buffer fragment acts like a drop target.

I'm not sure whether or not we need drag-n-drop indicators, like the ones you see in Gmail. One one hand, we normally only show a single buffer. On the other, it might be somewhat useful to indicate that the buffer list or the title bar are not targets for dropping files. I decided to not do any indicators because I am lazy and who even drags and drops files on Android anyway.

Also “bump” language level to allow `..<`
We are using Glide to load thumbnails for all shares. If the request fails,
Glide will re-attempt to fetch the image when the activity is resumed, e.g.
when you switch to another app and back.

This fixes the issue by cancelling the request on failure.
When inserting images & other media into the chat input, we add spaces
around it to make sure the text doesn't touch the resulting URL. But if the
user edits the text after, the text might touch the image again. This
sometimes is hard to see, especially if the thumbnail and the text are on
separate lines.

To overcome this, also insert spaces around the URL when textifying.
In buffer fragments, we are saving input for parallel fragments
(i.e. bubbles) on pause and restoring it on resume. On some systems,
particularly on API 27, it's possible that, when dragging from another app,
the target activity isn't actually resumed, hence this input change may fail
to be recorded. To prevent this, explicitly record the change after loading
the thumbnails.

This includes a long-postponed conversion of thumbnail logic to coroutines.
This facilitates waiting until the thumbnails are actually loaded and
applied to the string.
@oakkitten
Copy link
Collaborator Author

Please review, paying attention to the last commit. Coroutines can be deceiving

Copy link
Collaborator

@mhoran mhoran left a comment

Choose a reason for hiding this comment

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

LGTM! Tested a few more scenarios based on the last commit and all is good.

@oakkitten oakkitten merged commit 8d3f959 into master Feb 2, 2024
9 of 10 checks passed
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