Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected behaviour of reset method on Android #274

Open
martinogarrizzo5 opened this issue Jan 26, 2024 · 2 comments
Open

Unexpected behaviour of reset method on Android #274

martinogarrizzo5 opened this issue Jan 26, 2024 · 2 comments

Comments

@martinogarrizzo5
Copy link

It seems that the reset method of the library doesn't really resets the state of ReceiveSharingIntent.getInitialMedia(). So each time I navigate to my loading screen I re-execute this action obtaining an old recycled value instead of getting a null value

@KasemJaffer
Copy link
Owner

I just tested this and its working for me.

@martinogarrizzo5
Copy link
Author

I called the reset method in my loading screen in this way:

    final sharedFiles = await ReceiveSharingIntent.getInitialMedia();
    if (sharedFiles.isNotEmpty) {
      ReceiveSharingIntent.reset(); // prevent recycling of the same files
      debugPrint("Received ${sharedFiles.length} files");
      await FileShareUtils.handleSharedFiles(sharedFiles, router);
    }

It usually works fine but there is a case where it doesn't seem to be as expected. With the app closed I went to the image gallery and choosed one or more images and shared them to the app. This opened successfully the app with the desired images. Then I swiped from the left (I have a Pixel phone) to exit from the app putting it in background state. When I recovered the app from the opened tabs the app reloaded the loading screen that contains the provided lines of code and it resulted that the old images were recycled unexpectedly.
Can you check this case?
Thanks

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

No branches or pull requests

2 participants