Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

open card browser and search using deep links #11899

Merged
merged 3 commits into from
Aug 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions AnkiDroid/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,13 @@
android:configChanges="keyboardHidden|orientation|locale|screenSize|uiMode"
android:parentActivityName=".DeckPicker"
>
<intent-filter android:label="@string/card_browser">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "anki://x-callback-url/browser” -->
<data android:scheme="anki" android:host="x-callback-url" android:path="/browser"/>
</intent-filter>
</activity>
<activity
android:name=".ModelBrowser"
Expand Down
6 changes: 6 additions & 0 deletions AnkiDroid/src/main/java/com/ichi2/anki/CardBrowser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,12 @@ open class CardBrowser :
initNavigationDrawer(findViewById(android.R.id.content))
startLoadingCollection()

// search card using deep links
intent.data?.getQueryParameter("search")?.let {
mSearchTerms = it
searchCards()
}

// for intent coming from search query js api
intent.getStringExtra("search_query")?.let {
mSearchTerms = it
Expand Down