-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Added attachment size check for videos on native #6588
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
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 great, tests well on native devices! 👍 Just one quick question
Also interested in your review @parasharrajat when you have time 👍 |
I will do that today. It's on my list. |
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.
There are a few suggestions otherwise looks good.
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.
NAB: But https://github.com/Expensify/App/pull/6588/files#R244 completeAttachmentSelection
is very confusing.
This function should be just initialized on the constructor as noop.
this.completeAttachmentSelection = () => {}
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.
NAB: another very confusing code is isValidSize
in AttachementModal.js
App/src/components/AttachmentModal.js
Lines 116 to 118 in 04d28af
isValidSize(file) { | |
return !file || lodashGet(file, 'size', 0) < CONST.API_MAX_ATTACHMENT_SIZE; | |
} |
it returns true when file is not present.
@parasharrajat @Beamanator I've updated PR as per comments. I am not sure about |
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 better but one more suggestion before I will test it on platforms.
OK. let's leave it then. In theory, the file will never be null for this function. |
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.
The code looks good now. Thanks for the changes. cc: @Beamanator
NAB: The only thing I found confusing is that the #6588 (files) completeAttachmentSelection is very confusing.
We should remove this function definition. It is never used. It also uses an unused state variable result
which is not consumed anywhere. In action, completeAttachmentSelection
is replaced on runtime at L256. I leave this up to you @Beamanator to decide.
/**
* Opens the attachment modal
*
* @param {function} onPicked A callback that will be called with the selected attachment
*/
open(onPicked) {
this.completeAttachmentSelection = onPicked;
this.setState({isVisible: true});
}
@@ -111,13 +121,15 @@ class AttachmentPicker extends Component { | |||
|
|||
this.close = this.close.bind(this); | |||
this.pickAttachment = this.pickAttachment.bind(this); | |||
this.completeAttachmentSelection = () => {}; |
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'd say we should not add this for now, but make a separate issue to clean up completeAttachmentSelection
- as you said, it looks pretty horrible in this file, but that's not the point of this PR
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.
@akshayasalvi Could you please remove this line based on the request above?
Added Promise for jsdoc Co-authored-by: Alex Beaman <[email protected]>
…p into attachment-size-err
@parasharrajat @Beamanator PR updated with the changes. Thanks for the feedback and helping improve the code. |
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 think you missed one pointer.
@@ -111,13 +121,15 @@ class AttachmentPicker extends Component { | |||
|
|||
this.close = this.close.bind(this); | |||
this.pickAttachment = this.pickAttachment.bind(this); | |||
this.completeAttachmentSelection = () => {}; |
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.
@akshayasalvi Could you please remove this line based on the request above?
@parasharrajat Done |
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.
LGTM.
cc: @Beamanator
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.
Awesome 👍 Nice work @akshayasalvi and thanks for the helpful reviews @parasharrajat 👍
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by @Beamanator in version: 1.1.19-5 🚀
|
🚀 Deployed to production by @Julesssss in version: 1.1.21-1 🚀
|
Details
Fixed Issues
$ #5918
Tests
QA Steps
Tested On
Screenshots
Web
Mobile Web
Desktop
iOS
Android