Skip to content

Commit 59329da

Browse files
authored
Skip home screen if launched as an assist intent (#158)
1 parent 36cd5a3 commit 59329da

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

app/src/main/java/com/duckduckgo/app/home/HomeActivity.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class HomeActivity : DuckDuckGoActivity() {
5555
searchInputBox.setOnClickListener { showSearchActivity() }
5656

5757
if (savedInstanceState == null) {
58-
consumeSharedQuery(intent)
58+
consumeIntentAction(intent)
5959
}
6060
}
6161

@@ -76,14 +76,14 @@ class HomeActivity : DuckDuckGoActivity() {
7676

7777
override fun onNewIntent(intent: Intent?) {
7878
super.onNewIntent(intent)
79-
consumeSharedQuery(intent)
79+
consumeIntentAction(intent)
8080
}
8181

82-
private fun consumeSharedQuery(intent: Intent?) {
82+
private fun consumeIntentAction(intent: Intent?) {
8383

8484
if (intent == null) return
8585

86-
if (intent.hasExtra(KEY_SKIP_HOME)) {
86+
if (shouldSkipHomeActivity(intent)) {
8787
startActivity(BrowserActivity.intent(this))
8888
return
8989
}
@@ -92,6 +92,10 @@ class HomeActivity : DuckDuckGoActivity() {
9292
startActivity(BrowserActivity.intent(this, query))
9393
}
9494

95+
private fun shouldSkipHomeActivity(intent: Intent) : Boolean {
96+
return intent.hasExtra(KEY_SKIP_HOME) || intent.action == Intent.ACTION_ASSIST
97+
}
98+
9599
private fun showSearchActivity() {
96100
val intent = BrowserActivity.intent(this)
97101
val options = ActivityOptionsCompat.makeSceneTransitionAnimation(this, searchInputBox, getString(R.string.transition_url_input))

0 commit comments

Comments
 (0)