yasirkula / UnityNativeShare

A Unity plugin to natively share files (images, videos, documents, etc.) and/or plain text on Android & iOS
MIT License
890 stars 131 forks source link

Using a callback changes the look of the sharing window #150

Closed Mortimer-Kerman closed 1 year ago

Mortimer-Kerman commented 1 year ago

Description of the bug

When I'm sharing something, if I include a callback before sharing it, the sharing popup style is not the current style of my phone but an older look

Screenshots of the expected behavior (happens if I remove the callback line) and the actual behavior (happens if I put back the callback line) Images.zip

Reproduction steps

Share something containing a callback on Android

Im my case the code I used (yes the file exists and is shared correctly, the only problem is the look of the popup)

string FilePath = Application.persistentDataPath + "/exported.json";

NativeShare ShareObject = new NativeShare();
ShareObject.AddFile(FilePath, "application/json");
ShareObject.SetCallback((NativeShare.ShareResult result, string shareTarget) => Debug.Log("Data saved in " + FilePath));
ShareObject.Share();

Platform specs

yasirkula commented 1 year ago

Hi, one of the following conditions must've become true which in turn triggers the older looking share sheet. As the comments suggest, this older looking share sheet is unfortunately necessary in certain scenarios: https://github.com/yasirkula/UnityNativeShare/blob/bfb8b4e8124ad52712f0d40d2ffa9b966d03bdbd/.github/AAR%20Source%20(Android)/java/com/yasirkula/unity/NativeShare.java#L62-L69