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

[HOLD for payment 2023-03-01] [$1000] Allow avatar image uploads: gif on Android #14751

Closed
Beamanator opened this issue Feb 2, 2023 · 49 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@Beamanator
Copy link
Contributor

Beamanator commented Feb 2, 2023

Action Performed:

  1. Upload .gif as avatar image on Android

Expected Result:

It should upload and convert to .jpeg (the conversion can happen on the front end if needed, but we already have conversion code on the backend that works for every type of image in web)

Actual Result:

  1. Uploading GIF in Android throws console warning, isn't able to upload image

Note: Some investigation was done here, indicating this may be a problem with a library we use, RNImageManipulator

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~012d6d474213ddb534
  • Upwork Job ID: 1621106096863707136
  • Last Price Increase: 2023-02-10
@Beamanator Beamanator added Engineering Weekly KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Feb 2, 2023
@Beamanator Beamanator self-assigned this Feb 2, 2023
@melvin-bot melvin-bot bot locked and limited conversation to collaborators Feb 2, 2023
@melvin-bot melvin-bot bot unlocked this conversation Feb 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Feb 2, 2023

Triggered auto assignment to @anmurali (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot melvin-bot bot locked and limited conversation to collaborators Feb 2, 2023
@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Feb 2, 2023
@melvin-bot melvin-bot bot unlocked this conversation Feb 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Feb 2, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@melvin-bot melvin-bot bot locked and limited conversation to collaborators Feb 2, 2023
@Beamanator Beamanator added the External Added to denote the issue can be worked on by a contributor label Feb 2, 2023
@melvin-bot melvin-bot bot unlocked this conversation Feb 2, 2023
@melvin-bot melvin-bot bot changed the title Allow gif to upload on Android and bmp on iOS [$1000] Allow gif to upload on Android and bmp on iOS Feb 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Feb 2, 2023

Job added to Upwork: https://www.upwork.com/jobs/~012d6d474213ddb534

@melvin-bot
Copy link

melvin-bot bot commented Feb 2, 2023

Current assignee @anmurali is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Feb 2, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @mananjadhav (External)

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Feb 2, 2023

Current assignee @Beamanator is eligible for the External assigner, not assigning anyone new.

@Beamanator Beamanator changed the title [$1000] Allow gif to upload on Android and bmp on iOS [$1000] Allow avatar image uploads: gif on Android and bmp on iOS Feb 2, 2023
@s77rt
Copy link
Contributor

s77rt commented Feb 3, 2023

Proposal

The two mentioned issues have different root causes.

RCA

The .bmp images failing on iOS is a bug in react-native-image-picker.
The bug is that we fail to detect .bmp files as images.


The .gif images failing on Android is due to the lack of support for animated images in react-native-image-manipulator.
This is a known limitation of using Fresco's BaseBitmapDataSubscriber (that's what the lib uses).

Fix

I have raised a PR for each issue.

@s77rt
Copy link
Contributor

s77rt commented Feb 4, 2023

I have updated my proposal above to handle both issues.

@melvin-bot melvin-bot bot added the Overdue label Feb 6, 2023
@redstar504
Copy link
Contributor

redstar504 commented Feb 7, 2023

Proposal (Android GIF issue)

Modifying the upstream package with an additional dependency that decodes the entire GIF just to extract the first frame is not necessary. The existing decoder has an option built in that will capture the first frame as soon as it's available.

It is easy to implement, and saves memory that would be allocated to decoding and performing transformations on the entire animation. It can be accomplished by a simple change (in our existing react-native-image-manipulator fork):

diff --git a/android/src/main/java/com/reactnativeimagemanipulator/RNImageManipulatorModule.java b/android/src/main/java/com/reactnativeimagemanipulator/RNImageManipulatorModule.java
index 4b8ed8a..b404fa7 100644
--- a/android/src/main/java/com/reactnativeimagemanipulator/RNImageManipulatorModule.java
+++ b/android/src/main/java/com/reactnativeimagemanipulator/RNImageManipulatorModule.java
@@ -23,6 +23,7 @@ import com.facebook.react.bridge.ReactMethod;
 import com.facebook.react.bridge.ReadableArray;
 import com.facebook.react.bridge.ReadableMap;
 import com.facebook.react.bridge.WritableMap;
+import com.facebook.imagepipeline.common.ImageDecodeOptions;
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
@@ -53,6 +54,10 @@ public class RNImageManipulatorModule extends ReactContextBaseJavaModule {
         ImageRequestBuilder
             .newBuilderWithSource(Uri.parse(uriString))
             .setRotationOptions(RotationOptions.autoRotate())
+            .setImageDecodeOptions(
+                    ImageDecodeOptions.newBuilder()
+                            .setForceStaticImage(true)
+                            .build())
             .build();
     final DataSource<CloseableReference<CloseableImage>> dataSource
         = Fresco.getImagePipeline().fetchDecodedImage(imageRequest, getReactApplicationContext());

@melvin-bot melvin-bot bot added the Awaiting Payment Auto-added when associated PR is deployed to production label Feb 22, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Allow avatar image uploads: gif on Android [HOLD for payment 2023-03-01] [$1000] Allow avatar image uploads: gif on Android Feb 22, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Feb 22, 2023
@MelvinBot
Copy link

Reviewing label has been removed, please complete the "BugZero Checklist".

@MelvinBot
Copy link

MelvinBot commented Feb 22, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.2.75-0 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-03-01. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@MelvinBot

This comment was marked as off-topic.

@MelvinBot
Copy link

MelvinBot commented Feb 22, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@mananjadhav / @Beamanator] The PR that introduced the bug has been identified. Link to the PR:
    • Bug was in an external library, no PR regression to link
  • [@mananjadhav / @Beamanator] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
    • Similar as above
  • [@mananjadhav / @Beamanator] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
    • N/A
  • [@redstar504] Propose regression test steps to ensure the same bug will not reach production again.
  • [@trjExpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon: https://github.com/Expensify/Expensify/issues/265438

@mananjadhav
Copy link
Collaborator

@Beamanator @trjExpensify @redstar504 I think we're good to use the QA steps in the PR for the regression test proposal?

@redstar504
Copy link
Contributor

redstar504 commented Feb 25, 2023

@mananjadhav Yes, I will paste them here for reference:

  1. Add an animated GIF image to an Android simulator or device
  2. Log in to the app, and navigate to the profile screen
  3. Press on the current avatar to change it, and press "Upload photo"
  4. Press "Choose from gallery" and select the GIF image on your device
  5. Proceed to crop, rotate, and zoom the avatar as desired
  6. Press "Save" to finish uploading the avatar
  7. Observe that the avatar was uploaded successfully
  8. Observe that the saved avatar is a static image that only contains the first frame of the animation

#15121

@mananjadhav
Copy link
Collaborator

Thanks @redstar504. Quick bump @Beamanator @trjExpensify

@Beamanator
Copy link
Contributor Author

Those test steps look great! I'd say one thing to change is: don't mention the particular environment that the tests will be run in please 🙏

@redstar504
Copy link
Contributor

@Beamanator Good catch. Edited.

@trjExpensify
Copy link
Contributor

Do we want to test this specific file format on Android-only with every regression test? I.e why not across all platforms? Also, we don't have any file type specifics for avatar uploads in our regression suite atm, should we couple this with the most common? I.e JPEG, PNG, GIF, SVG?

@Beamanator reference being somewhat similar to this "other" regression test case for attachment uploads.

@Beamanator
Copy link
Contributor Author

@trjExpensify Ooh good points! I think it's fair to make sure all of those types work across all platforms to prevent any bugs leaking through 👍

@trjExpensify
Copy link
Contributor

Okay, so I think we add GIF, PNG and SVG to this test case under a new sub-header:

GIF, SVG and PNG

  1. Repeat the steps to upload an avatar, but now choose a PNG file within the file size limits
  2. Verify that the avatar uploads successfully
  3. Repeat the steps to upload an avatar, but now choose an SVG file
  4. Verify that the avatar uploads successfully
  5. Repeat the steps to upload an avatar, but now choose a GIF file
  6. Verify that the avatar uploads successfully
  7. Verify that the saved avatar is a static image that only contains the first frame of the animation

Let me know if you agree, and I'll create the GH.

@mananjadhav
Copy link
Collaborator

The test looks good.

within the file size limits

I don't have access to the Testrail but do we have this limit specified somewhere?


@trjExpensify @Beamanator This is ready for payout today but I have a questions. While the review was done within the timelines (it had 2 PRs), it was merged a week later. Will the timeline bonus be affected with this?

@trjExpensify
Copy link
Contributor

I don't have access to the Testrail but do we have this limit specified somewhere?

Ah yeah, the earlier part of this test script is about file size/limits, so here I'm not rehashing that:

image

@mananjadhav
Copy link
Collaborator

thanks for posting the testcase.

@trjExpensify
Copy link
Contributor

@trjExpensify @Beamanator This is ready for payout today but I have a questions. While the review was done within the timelines (it had 2 PRs), it was merged a week later. Will the timeline bonus be affected with this?

Hey @mananjadhav, the bonus won't apply on this issue because the review wasn't completed until 4 days later. I see you approved the PR on the 16th, but the checklist wasn't completed until the 17th. Those two actions should come together for a review to be deemed complete.

I've gone ahead and settled up the contracts. I'll create the regression test issue for Applause now and close this issue out. Thanks everyone!

@trjExpensify
Copy link
Contributor

Regression test here: https://github.com/Expensify/Expensify/issues/265438

@mananjadhav
Copy link
Collaborator

mananjadhav commented Mar 1, 2023

Thanks for confirmation @trjExpensify , but I had some questions on how we calculate timeline, so I've raised a question in the slack thread here.

@kbecciv
Copy link

kbecciv commented Apr 7, 2023

@trjExpensify Can you please create the regression test issue or I can create one, please let me know.
QA team is unable to update GIF file in avatar on Android, Save button is not responding.

video_21.mp4

@trjExpensify
Copy link
Contributor

Hey @kbecciv, sorry for the slight delay, I've been OoO. The regression test issue was created a while back here, is that what you're looking for?

@kbecciv
Copy link

kbecciv commented Apr 11, 2023

@trjExpensify Correct, steps are added in TR. QA team is having issue to update GIF file in avatar on Android device. "Save" button is not responding. Do you want me to create a separate GH issue?

@trjExpensify
Copy link
Contributor

Yep, please create a bug report for that 👍

@kbecciv
Copy link

kbecciv commented Apr 27, 2023

@trjExpensify Logged separate issue #18088

@trjExpensify
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests

8 participants