Skip to content
This repository has been archived by the owner on Mar 9, 2024. It is now read-only.

Problem with sharing apps panel #148

Open
zedescar opened this issue Aug 3, 2022 · 15 comments
Open

Problem with sharing apps panel #148

zedescar opened this issue Aug 3, 2022 · 15 comments

Comments

@zedescar
Copy link

zedescar commented Aug 3, 2022

I found a problem on several devices when executing the "Share()" in lanscape and potrait orientations:

-in potrait orientation only once did the problem appear to me and it is this panel:

WhatsApp Image 2022-08-03 at 1 00 40 PM (1)

this happens when it is not given a time before creating the new native share and executing the "Share()" function:

   private IEnumerator TakeScreenshotAndShare(string text)
   {  
        yield return new WaitForEndOfFrame();
        string filePath = MakeSampleScreenShotImage();           
        -->       yield return new WaitForSeconds(1f);      <--   // Wait time
        new NativeShare().AddFile(filePath).SetText(text).Share();
   }

Screenshot´s adding a timeout:

WhatsApp Image 2022-08-03 at 1 00 35 PM (1)
WhatsApp Image 2022-08-03 at 1 00 40 PM
WhatsApp Image 2022-08-03 at 1 00 35 PM (2)

Now my biggest problem is with the landscape orientation, since it always makes me this panel which is not good since all the necessary social network apps are not shown:

WhatsApp Image 2022-08-03 at 1 09 03 PM

A temporary but incomplete solution is to rotate the screen and/or change the rotation after taking the screenshot and return the screen to its previous state or orientation, but this brings the following problems:

-The background of the app when the panel is active is distorted or broken (as in my case).

-you have to predict a delay time in what the user shares and returns to the application to turn the screen again and/or change the orientation to its original state, but sometimes this time is not enough and the application can close.

  private IEnumerator TakeScreenshotAndShare(string text)
    {  
        yield return new WaitForEndOfFrame();
        string filePath = MakeSampleScreenShotImage();            
       -->        if (Screen.orientation == ScreenOrientation.Landscape)       <--   // Condition if it is in landscape orientation
                        {
                   -->      Screen.orientation = ScreenOrientation.Portrait;         <--   // Change orientation
                        }
        yield return new WaitForSeconds(1f);
        new NativeShare().AddFile(filePath).SetText(text).Share();
        -->         yield return new WaitForSeconds(5f);         <--       // Waiting time prediction
        -->         Screen.orientation = ScreenOrientation.AutoRotation;       <-- // Return to origin autorotation
    }

Screenshot applying the temporary solution:
(we managed to get the previous panel by applying the timeout with portrait orientation in the middle of the screen, being in landscape orientation but with the mentioned flaws)

WhatsApp Image 2022-08-03 at 1 00 35 PM

-Thank you for the time you took to explain my case, and without being more, I would like to know if there is a more complete and precise solution...

PTT:
-the android versions of the devices where this problem was tested are: 7, 8, 8.1, 9pie and 11.

-the screenshots that were presented are from android 11, I attached 3 screenshots of android 9 where the only thing that changed from the panel in landscape is the background that went from a dark color to white, after these I attached 2 screenshots of android 8.1 where in sometimes the panel with problems was shown but this time it was slideable with more apps where it could be shared, but when selecting any application it closed; the panel to share was superimposed in the last application you opened and it worked but without more...

Screenshots android 9:

WhatsApp Image 2022-08-03 at 2 40 07 PM
WhatsApp Image 2022-08-03 at 2 40 07 PM (1)
WhatsApp Image 2022-08-03 at 2 40 07 PM (2)

Screenshots android 8.1:

WhatsApp Image 2022-08-03 at 2 40 07 PM (3)

WhatsApp Image 2022-08-03 at 2 40 08 PM

@yasirkula
Copy link
Owner

I'm guessing these devices use MIUI. It has an issue on landscape orientations which is why I'm creating my own user interface that you're seeing in landscape orientation. As far as I understand, the only issue here is that some apps aren't included in that user interface but I couldn't figure out which ones were missing since there were multiple screenshots from different devices.

@zedescar
Copy link
Author

zedescar commented Aug 4, 2022

Supongo que estos dispositivos usan MIUI. Tiene un problema con las orientaciones horizontales, por lo que estoy creando mi propia interfaz de usuario que está viendo en la orientación horizontal. Según tengo entendido, el único problema aquí es que algunas aplicaciones no están incluidas en esa interfaz de usuario, pero no pude averiguar cuáles faltaban ya que había varias capturas de pantalla de diferentes dispositivos.

The screenshot 1 of the post to screenshot 6 are from android 11, that device uses MIUI, there you can see both the custom and native panels and their differences in apps and methods to share

@yasirkula
Copy link
Owner

Does <queries> element still exist in AndroidManifest?

@zedescar
Copy link
Author

zedescar commented Aug 4, 2022

yes, I had tried it and I just tried it but only this panel is shown:

image

not even my temporary solution works by removing the from the android manifest.
the plugin without the download it from here: #138

@zedescar
Copy link
Author

zedescar commented Aug 4, 2022

In a version that I remove from an app, when I get the native panel with my temporary solution, if I cancel and press the share button again, I get this panel.... but this time with more apps, I don't understand why.
WhatsApp Image 2022-08-04 at 12 23 59 PM
WhatsApp Image 2022-08-04 at 12 24 20 PM

@yasirkula
Copy link
Owner

The last case doesn't make any sense to me either. Are you sure you're calling NativeShare.Share with the same parameters? With the same files, text, etc.? And BTW you shouldn't remove queries from AndroidManifest, removing it can cause this kind of problem.

@zedescar
Copy link
Author

zedescar commented Aug 4, 2022

If the native share, I will return it to how I had it because this panel is not optimal and I prefer to use the native one, which is the complete one.

-in the post I published part of my code of how I am calling the function and the times that I am adding to it so that it works with landscape orientation

-I also managed to capture your panel correctly, which came out after showing the native panel, it seems like two calls were made at the same time and the fastest one would be shown first...

https://youtu.be/9z4tV21D-oM

@yasirkula
Copy link
Owner

I haven't provided an option to always use the native dialog for this reason.

I'm still confused about the latest screenshots you've provided. Is it possible that your screenshot function is asynchronous and in some cases, it doesn't finish before NativeShare is called and hence, results in different apps in the share sheet?

Can you replace NativeShare.aar with this one (unzip first) and see if it resolves the missing apps issue?

@zedescar
Copy link
Author

zedescar commented Aug 4, 2022

replace NativeShare.aar but this time it doesn't show anything, neither using my solution nor using the tool originally...

and in response to the doubt, that is why I added a few times in the code and with those waits is that it manages to show the native panel, since without these waits only the incomplete panel is shown, now the captures are made correctly as shown in the video, and with the wrong panel the capture is also taken well, only as the only test option I have facebook and there only the screenshot is taken to share but not the text (but I understand that it is for a topic of using their own SDKs)

@yasirkula
Copy link
Owner

How about this AAR? Can you also share your MakeSampleScreenShotImage function?

@zedescar
Copy link
Author

zedescar commented Aug 5, 2022

I just did the test on two devices and it doesn't work again... is there any way to call the native panel in landscape without having to do the rotation that I'm doing by code?

@yasirkula
Copy link
Owner

NativeShare.zip

@zedescar
Copy link
Author

zedescar commented Aug 6, 2022

Owner

doesn't work either

@yasirkula
Copy link
Owner

I had removed the custom share dialog completely in the latest AAR. If that didn't work, honestly nothing will :/

@zedescar
Copy link
Author

zedescar commented Aug 6, 2022

I understand... that's weird, I'm going to do some custom tests with that last year; If the tests are successful, I'll share the results with you :D

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants