Skip to content

Commit

Permalink
sharing: Move FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY check to onCreate.
Browse files Browse the repository at this point in the history
This conditional existed to fix a bug where a quit app, that originally
was started with SEND_INTENT, when restarted from the recent app drawer
reused the SEND_INTENT (thereby opening on sharing ui once again).

introduced at: 70e9ad9

`onCreate` seems like a good place to have it compared to `handleSend`
as it simplifies the code and we avoid the cases where we need to check
for intents coming from other places (such as `onNewIntent`).
  • Loading branch information
AkashDhiman authored and gnprice committed May 20, 2021
1 parent 97d8d5a commit 1a20529
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions android/app/src/main/java/com/zulipmobile/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ open class MainActivity : ReactActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
WebView.setWebContentsDebuggingEnabled(true)

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

Expand All @@ -63,11 +68,6 @@ open class MainActivity : ReactActivity() {
}

private fun handleSend(intent: Intent) {
// Intent is reused after quitting, skip it.
if ((intent.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 1a20529

Please sign in to comment.