-
-
Notifications
You must be signed in to change notification settings - Fork 655
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
compose: Don't send immediately on adding image #5474
Conversation
Chat thread about the resulting UI on Android: |
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.
Thanks @chrisbobbe! This code all looks good except the small points below.
That leaves as the interesting questions:
-
The expansion of iOS: Add-video-call button sometimes doesn't insert link #5291. I think the plan of merging the ComposeMenu refactors from the start of this branch, then going for Make "+" open an action sheet instead of row of buttons #5141, makes sense.
-
The UI that results on Android. One hopes to continue getting a nice photo-gallery-style UI, rather than a file-oriented UI.
ISTR we found that newer Android versions, including what one can get in the emulator, do better here and the file-oriented UI might be limited to older versions like in the physical test device you have.
src/compose/ComposeMenu.js
Outdated
class ComposeMenuInner extends PureComponent<Props> { | ||
static contextType = TranslationContext; | ||
context: GetText; | ||
export default function ComposeMenuInner(props: Props): Node { |
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.
nit: There's no longer a distinct "inner" vs "outer" component here, right? So this function should be called just ComposeMenu
.
(Another angle on the same thing: it's the default export, so should have the same name as the file.)
src/compose/ComposeMenu.js
Outdated
msg = _('Failed to attach your file.'); | ||
return; |
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 sets a local and then returns -- so the assignment has no effect, as nothing else can see it.
Perhaps just put the showErrorAlert
call here? It's pretty concise, not much more complex than the variable assignment.
4990e13
to
a69b623
Compare
Thanks for the review! Revision pushed. |
a69b623
to
d07845f
Compare
d07845f
to
9f61c33
Compare
Just pushed a revision fixing a rebase error in the new type Here's a video of the feature working on my iPhone: RPReplay_Final1673470049.mp4 |
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.
Thanks for the revision!
Code all looks good; small comment below.
On the UI this gets us on Android: I'm still not a fan of that file-picker-style UI when the user asks to upload a photo. The first part of this branch, the "don't send immediately", is a major functionality improvement. But "select multiple images at once" doesn't seem as necessary:
- Lots of messaging apps don't even let you send multiple images in one message.
- If you do want to send multiple images, then given the "don't send immediately" part of this branch, all you have to do is go through the selection multiple times.
So I'm not sure that that part is a good trade for the added inconvenience of the file-picker flow each time you want to send one photo.
Therefore I think what I want to do here is:
- Let's merge the first part of this branch: the "don't send immediately", plus the prep commits for "select multiple images", so in total all but the last commit.
- With that one code adjustment mentioned below.
- Then for [Android] Multiple file selection when uploading pictures. #2366… hmm, looking at it, both of the actual user requests there (the [Android] Multiple file selection when uploading pictures. #2366 OP, plus the report at https://chat.zulip.org/#narrow/stream/48-mobile/topic/Bug.20reports/near/1292530 ) are about sending multiple images at once, not selecting from the picker all at once. Moreover, both of them are really mostly about "don't send immediately, let me add some text", i.e. Don't immediately send attachment on upload #4540.
So I think it would actually be appropriate to have the "Don't immediately send" commit close [Android] Multiple file selection when uploading pictures. #2366 as well as Don't immediately send attachment on upload #4540. Then we can have a fresh issue thread for anything further we want to do here. - And if the code you've already written in that last commit gives a UX improvement on iOS, then we can follow up with a version of that commit that's tweaked to be conditional on the platform. No need to spend further effort on the Android side — I think we've already determined there's no easy solution there, and the "select multiple images at a time" functionality doesn't seem important enough to justify a bigger effort.
}); | ||
return; | ||
} | ||
|
||
dispatch(uploadFile(destinationNarrow, uri, chooseUploadImageFilename(uri, fileName))); |
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.
Looks like this was the only call site of that uploadFile
function — so let's cut that out too.
This function is designed to insert multiple attachments.
Soon, we'd like to also use the `insertAttachments` prop not just for react-native-document-picker payloads, but also for react-native-image-picker payloads. Better to define our own type that's meant to accommodate both kinds, rather than, e.g., using react-native-document-picker's type and fudging image-picker payloads to flow through that type. While we're at it, trim down the type to just what `insertAttachments` currently uses: the url [1] and a nullable name for the file. The `type` property in particular smells like something that might not be easy to make uniform across document-picker and image-picker payloads; there's no comment linking to a spec that says what the possible values of `type` mean, for example. [1] renamed from "uri"; see style guide
For why this closes zulip#2366, see Greg's explanation: zulip#5474 (review) Fixes: zulip#4540 Fixes: zulip#2366 Co-authored-by: Akash Dhiman <[email protected]>
…ehavior A skim through Sentry events matching the old error message suggests that we haven't yet had reports of firstAsset being present but with nullish `url` or `fileName`. But the types say they can be undefined, and we'll want to know if that's ever the case.
9f61c33
to
d815680
Compare
Thanks for the review! Revision pushed. |
Thanks! Looks good; merging. |
We recently completed the feature of not immediately sending messages with image uploads, in zulip#5474. With that, it became possible to send a message with multiple uploaded images in it. But you had to go through the image-selection flow once for each of your chosen images; see discussion: zulip#5474 (review) This gives a smoother experience by letting you choose multiple images in one image-selection session. Related: zulip#2366 Co-authored-by: Akash Dhiman <[email protected]>
We recently completed the feature of not immediately sending messages with image uploads, in zulip#5474. With that, it became possible to send a message with multiple uploaded images in it. But you had to go through the image-selection flow once for each of your chosen images; see discussion: zulip#5474 (review) This gives a smoother experience by letting you choose multiple images in one image-selection session. Related: zulip#2366 Co-authored-by: Akash Dhiman <[email protected]>
Thanks @AkashDhiman for your PR #5125 and your prep work for this in #4590; those were quite helpful and informative. 🙂
Marked as a draft/blocked for a reason I'll explain, but that reason doesn't affect the first three commits—
ComposeMenu [nfc]: Use our own new type definition for attachments
ComposeMenu [nfc]: Fix name of insertAttachment prop to be plural
ComposeMenu [nfc]: Convert to a function component
—and indeed those three would be good to land as prep for removing the blocker.
The blocker is that we have basically the behavior of #5291, except with the insertion of image links instead of Jitsi links. On iOS, you take or select a photo to upload, and sometimes the message text input is unchanged when you expect it to get an inserted
[Uploading …]()
link.Fixes: #2366
Fixes: #4540
Replaces: #5125