Skip to content

Commit

Permalink
android: Skip sharing intent when it's reused after quitting.
Browse files Browse the repository at this point in the history
The android recents drawer is basically a log of intents. When we
finish sending a 'share' from our app, the original intent that
launched the sharing UI still appears in this log. So, detect if the
app was launched from the recents drawer after quitting, and if so,
don't show the sharing UI.

This prevents the app from showing the sharing UI when it's resumed
after completing/cancelling a share.
  • Loading branch information
agrawal-d authored and gnprice committed Jul 22, 2020
1 parent ffa1f3f commit 1ea1791
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions android/app/src/main/java/com/zulipmobile/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ open class MainActivity : ReactActivity() {
}

private fun handleSend(intent: Intent) {
// Intent is reused after quitting, skip it.
if ((getIntent().flags and Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0) {
return;
}

val params: WritableMap = try {
getParamsFromIntent(intent)
} catch (e: ShareParamsParseException) {
Expand Down

0 comments on commit 1ea1791

Please sign in to comment.