Skip to content

Commit 25c2526

Browse files
fix(share_plus): reset isCalledBack on android correctly after closing share-sheet
1 parent a928f67 commit 25c2526

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

packages/share_plus/share_plus/android/src/main/kotlin/dev/fluttercommunity/plus/share/MethodCallHandler.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ internal class MethodCallHandler(
4040
isWithResult,
4141
)
4242

43+
manager.signalShareSheetCalledBack()
4344
if (!isWithResult) {
4445
if (isResultRequested) {
4546
result.success("dev.fluttercommunity.plus/share/unavailable")
@@ -62,6 +63,7 @@ internal class MethodCallHandler(
6263
isWithResult,
6364
)
6465

66+
manager.signalShareSheetCalledBack()
6567
if (!isWithResult) {
6668
if (isResultRequested) {
6769
result.success("dev.fluttercommunity.plus/share/unavailable")

packages/share_plus/share_plus/android/src/main/kotlin/dev/fluttercommunity/plus/share/ShareSuccessManager.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ internal class ShareSuccessManager(private val context: Context) : ActivityResul
3434
}
3535
}
3636

37+
/**
38+
* Set the `isCalledBack` to `true`. Must be called in every share-sheet calling method
39+
* before returning.
40+
*/
41+
fun signalShareSheetCalledBack(){
42+
isCalledBack.set(true)
43+
}
44+
3745
/**
3846
* Must be called if `.startActivityForResult` is not available to avoid deadlocking.
3947
*/

0 commit comments

Comments
 (0)