yasirkula / UnityNativeShare

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

Share to Slack #92

Open EdwardTeach68 opened 3 years ago

EdwardTeach68 commented 3 years ago

Hi there. After sharing image to slack it doesn't hide share dialogue.ShareResult also NotShared,but image was shared.How can i hide share dialogue? Testing on IOS 13.6 (iphone x)

yasirkula commented 3 years ago

Are there any error messages in Xcode console?

EdwardTeach68 commented 3 years ago

I don't see any errors in the console.

EdwardTeach68 commented 3 years ago

The app becomes non-clickable with black bars around the edges. Swiping down makes it clickable again and full screen.This issue with slack only

yasirkula commented 3 years ago

Can you see the "Shared to %@ with result: %d" log in Xcode console for Slack or any other apps? If so, does this log appear before or after the share result log that is Debug.Log'ed from Unity?

EdwardTeach68 commented 3 years ago

3dAssistant[14888:3781953] Shared to com.tinyspeck.chatlyio.share with result: 0 NotShared UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object) UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[]) UnityEngine.Logger:Log(LogType, Object) UnityEngine.Debug:Log(Object) Data.Scripts.ScreenShots.<>c:b__2_0(ShareResult, String) ShareResultCallback:Invoke(ShareResult, String) NativeShareNamespace.NSShareResultCallbackiOS:OnShareCompleted(String)

(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35) Ok,i see that after slack sharing my app is not focused,only after swiping down it showes this debug.Looks like slack does not exit from his sharing dialogue and a swipe down closes it

yasirkula commented 3 years ago

Result of 0 should actually point to ShareResult.Unknown. I'm not sure why it resolves to NotShared in your case. Can you insert Debug.Log("Share message received: " + message); to this line and see what it outputs?

P.S. I don't have any control over the shared apps' behaviours, so I don't think that we can avoid Slack's strange behaviour.

EdwardTeach68 commented 3 years ago

Yeah,its slack problem.I have shared an image from Telegram to Slack and get the same issue.Thank you for helping)

yasirkula commented 3 years ago

I'm still unsure about the cause of NotShared permission. It should've been Unknown. Did you get a chance to insert the Debug.Log line I've mentioned to the code?

EdwardTeach68 commented 3 years ago

Ok,one moment

EdwardTeach68 commented 3 years ago

Share message received: 2com.tinyspeck.chatlyio.share (show first) after shows debug.log from callback "NotShared" and Share message received: 2(null)

yasirkula commented 3 years ago

Ah, I completely forgot about the completed ? 1 : 2 line here. So the issue is that Slack is returning false as BOOL completed parameter. I haven't seen other apps having this issue, though. If you are rewarding the player in ShareResultCallback, you can query result != NativeShare.ShareResult.NotShared || !string.IsNullOrEmpty(shareTarget) for maximum compatibility. This way, you'll make sure that the user has at least selected an app from the share sheet.