facebook / facebook-android-sdk

Used to integrate Android apps with Facebook Platform.
https://developers.facebook.com/docs/android
Other
6.17k stars 3.66k forks source link

Share to Facebook Story from landscape app distorts image and background #1188

Open mitchell-ibarra opened 1 year ago

mitchell-ibarra commented 1 year ago

Checklist before submitting a bug report

Java version

11

Android version

13

Android SDK version

16.0.1

Installation platform & version

Gradle 7.4.0

Package

Share

Goals

I want to be able to share a sticker asset to a Facebook Story and have the image show up correctly regardless of my app's orientation prior to launching the activity for the ADD_TO_STORY intent.

Right now, when my app is in portrait mode and I launch the share activity for Facebook Story, the image shows correctly when editing the sticker. However, when I launch the share activity when my app is in landscape, it does not look as expected.

I could reproduce this with a few different apps and have attached a video of this with the Spotify app.

Expected results

Image for the sticker asset and the background look the same for portrait and landscape.

Actual results

Sticker and background when launched from portrait looks good but when launched from landscape it gets distorted.

Steps to reproduce

https://github.com/facebook/facebook-android-sdk/assets/73446624/6e81ccf2-d8f1-4a7e-bc0d-2070cb100a95

Code samples & details

// INSERT YOUR CODE HERE

val intent = Intent("com.facebook.stories.ADD_TO_STORY").apply {
            type = "image/*"
            putExtra("com.facebook.platform.extra.APPLICATION_ID", appId)
            putExtra("interactive_asset_uri", stickerUri)
            putExtra("content_url", attributionLinkUrl)
            putExtra("top_background_color", color ?: defaultTopColor)
            putExtra("bottom_background_color", color ?: defaultBottomColor)
        }

        activity.grantUriPermission(
            "com.facebook.katana",
            stickerUri,
            Intent.FLAG_GRANT_READ_URI_PERMISSION,
        )

        activity.startActivityForResult(
            intent,
            requestCode = FB_STORY_REQUEST_CODE,
            onSuccess = { },
            onFailure = { publishEvents(ShareDialogEvent.ShowMessage("Error, failed to share to Facebook)) },
        )