Skip to content

Commit

Permalink
Fix: allow the app shortcuts works if the app is not fully closed (#4321
Browse files Browse the repository at this point in the history
)

* Fix: allow the app shortcuts works if the app is not fully closed

* Add a proper flag for shortcuts intents

---------

Co-authored-by: Dmitry Brant <[email protected]>
  • Loading branch information
cooltey and dbrant authored Dec 11, 2023
1 parent 20917ae commit e92f9b1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/src/main/java/org/wikipedia/appshortcuts/AppShortcuts.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class AppShortcuts {
.setIcon(IconCompat.createWithResource(app, R.drawable.appshortcut_ic_search))
.setIntent(
Intent(ACTION_APP_SHORTCUT, Uri.EMPTY, app, MainActivity::class.java)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK)
.putExtra(APP_SHORTCUT_ID, APP_SHORTCUT_ID_SEARCH)
.putExtra(Constants.INTENT_APP_SHORTCUT_SEARCH, true))
.build()
Expand All @@ -54,7 +54,7 @@ class AppShortcuts {
.setIcon(IconCompat.createWithResource(app, R.drawable.appshortcut_ic_random))
.setIntent(
Intent(ACTION_APP_SHORTCUT, Uri.EMPTY, app, MainActivity::class.java)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK)
.putExtra(APP_SHORTCUT_ID, APP_SHORTCUT_ID_RANDOM)
.putExtra(Constants.INTENT_APP_SHORTCUT_RANDOMIZER, true))
.build()
Expand All @@ -67,7 +67,7 @@ class AppShortcuts {
.setIcon(IconCompat.createWithResource(app, R.drawable.appshortcut_ic_continue_reading))
.setIntent(
Intent(ACTION_APP_SHORTCUT, Uri.EMPTY, app, MainActivity::class.java)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK)
.putExtra(APP_SHORTCUT_ID, APP_SHORTCUT_ID_CONTINUE_READING)
.putExtra(Constants.INTENT_APP_SHORTCUT_CONTINUE_READING, true))
.build()
Expand Down

0 comments on commit e92f9b1

Please sign in to comment.