fluttercommunity / plus_plugins

Flutter Community Plus Plugins
BSD 3-Clause "New" or "Revised" License
1.61k stars 972 forks source link

[Bug]: Share plus dialog is not being closed. #1067

Open mohit-varma opened 2 years ago

mohit-varma commented 2 years ago

Platform

iPad 15.6.1

Plugin

share_plus

Version

4.1.0

Flutter SDK

2.10.1

Steps to reproduce

Hi, The share plus dialog is not being closed in case one. Suppose I opened the share plus dialog and sent a push notification on my mobile, after clicking on the notification share plus dialog should dismiss. it is not being closed.

Code Sample

No response

Logs

there is no such exceptions related share plus.

Flutter Doctor

[✓] Flutter (Channel stable, 2.10.1, on macOS 12.5.1 21G83 darwin-arm, locale en-IN)
    • Flutter version 2.10.1 at /Users/mayank/Downloads/DownloadedSoftware/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision db747aa133 (7 months ago), 2022-02-09 13:57:35 -0600
    • Engine revision ab46186b24
    • Dart version 2.16.1
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/mayank/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Users/mayank/Downloads/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Users/mayank/Downloads/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[✓] IntelliJ IDEA Community Edition (version 2021.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.67.0)
    • VS Code at /Users/mayank/Downloads/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • iPad (mobile) • 00008020-001859923AE1002E • ios            • iOS 15.6.1 19G82
    • Chrome (web)  • chrome                    • web-javascript • Google Chrome 105.0.5195.102

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
miquelbeltran commented 2 years ago

The plugin does not control the share dialog, only opens it.

I am not sure if there may be a way to dismiss the dialog from Flutter side, but that's not supported at the moment.

Changing this to feature request.

mohit-varma commented 2 years ago

Okay, thanks

DaemonChoejur commented 2 years ago

Any updates on this? @miquelbeltran

Coronon commented 2 years ago

So the notification is from the app that is already opened? I would not expect the pushed ViewController to pop, as the underlying flutter application could handle the click and change its appearance. As for manually closing the share dialogue, we could attempt to instruct the controller to dismiss, using dismissViewControllerAnimated:completion: on UIViewController. I am not sure if this would work though.

Pierre-Monier commented 3 months ago

I had to close programmatically the share intent on iOS for a project. I successfully implemented a Share.close() method that works great on iOS. My work is here. Not opening any PR because it supports only iOS for the moment. I might take some time to check what we can do on Android.

miquelbeltran commented 3 months ago

@Pierre-Monier I think we can do an exception in this case. Feel free to open the PR and we can take a look. Also, the same logic should work on the macOS implementation, no?

Pierre-Monier commented 3 months ago

Yes it should work on macOS too, but I haven't tried it. I will make a PR then

Pierre-Monier commented 3 months ago

Sadly, it doesn't work on macOS

Pierre-Monier commented 2 months ago

I have made some research on Android, sadly it is not possible. We need either root access or an Accessibility service with the related permission to accomplish that. Those solutions are clearly hacky, and I think it should not be merged in this repository.

Related SO post