react-native-share icon indicating copy to clipboard operation
react-native-share copied to clipboard

bug: reproduce forceDialog getting ignored on Android when sharing a video to instagram

Open KristineTrona opened this issue 3 years ago • 4 comments

Overview

This is not an actual PR. It is a PR only to help reproduce the problem reported in this issue

Test Plan

  1. Run the example app on Android, make sure you have Instagram installed on the device.
  2. You should see 2 new buttons "Share Video to IG with dialog" and "Share Image to IG with dialog"
  3. Pressing on "Share Image to IG with dialog" correctly presents you with the dialog prompt to choose between sharing your image to "Direct"/"Feed"/"Stories"
  4. Pressing on "Share Video to IG with dialog" however skips this step even though it also has the forceDialog set to true and proceeds directly to "Stories".
See screen recording:

https://user-images.githubusercontent.com/39855778/191030848-cf502660-3172-44ff-8753-334c6976e3ca.MOV

KristineTrona avatar Sep 19 '22 13:09 KristineTrona

https://github.com/react-native-share/react-native-share/blob/ce90026ede1afdde44f0db1c18432cf326e3da08/android/src/main/java/cl/json/social/InstagramShare.java#L47-L54

This looks might suspicious, since you specify in your reproducer that it works with image/jpeg but not video/mp4

What are the assumptions in the code? There is clearly an assumption about image types vs non-image types - why does the code make that assumption? Was there some historical restriction on types that could be shared to instagram / instagram stories? Was it simply not a use case of the original PR author? Are there any restrictions like that now and does it work without them ?

Now that the example you've made cleanly reproduces it - I think you can open the android/ folder from this repo directly in AndroidStudio (or VSCode...) and try making changes / rebuild and the dev cycle as you probe that chunk of code should be pretty speed https://react-native-share.github.io/react-native-share/docs/contributing#using-the-example-app

mikehardy avatar Sep 19 '22 14:09 mikehardy

@mikehardy Ok, thank you for your input. I am not a Java developer, so might take me some time to get the right fix, but will try to look at it sometime later in the week. :)

KristineTrona avatar Sep 19 '22 14:09 KristineTrona

Oh I would definitely still leave this open! It's useful, and can easily serve in the future for anyone needing to demonstrate instagram stuff, hopefully you don't mind if I reopen it?

Separately - I will say, the java used in this module is just about the simplest java around, if you were ever thinking of just saying "what the heck" and hacking on some Java, and you were able to make a new PR here with reproduction (not something most can/will do, and you have already done this), I'm about 99.999% sure you'll open up the java and it won't be bad to hack on at all. System.err.println("REALLYOBVIOUSTAG: my thing here"); and adb logcat |grep REALLYOBVIOUSTAG are my goto tricks for quick and dirty java hacking like this.

I feel the same way the other direction mostly (I am terrible at Objective-C, really awful) but even I can hack on react-native objective-c code, because it's normally so simple.

mikehardy avatar Sep 19 '22 14:09 mikehardy

Ok, thanks for the encouragement and tips, I will give it a try when I have some more time :)

KristineTrona avatar Sep 19 '22 14:09 KristineTrona

@mikehardy I've adjusted the PR to fix the bug

KristineTrona avatar Sep 26 '22 07:09 KristineTrona

:tada: This PR is included in version 7.9.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

MateusAndrade avatar Oct 11 '22 14:10 MateusAndrade

Nice!

mikehardy avatar Oct 12 '22 03:10 mikehardy