Skip to content

Commit

Permalink
create ext repo intent
Browse files Browse the repository at this point in the history
  • Loading branch information
az4521 committed Jan 22, 2024
1 parent 2045cd4 commit 23d4636
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
12 changes: 12 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

<!-- Deep link to add repos -->
<intent-filter android:label="@string/action_add_repo">
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="tachiyomi" />
<data android:host="add-repo" />
</intent-filter>

<!--suppress AndroidDomInspection -->
<meta-data
android:name="android.app.shortcuts"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ import reactivecircus.flowbinding.android.view.clicks
/**
* Controller to manage the categories for the users' library.
*/
class RepoController :
class RepoController() :
NucleusController<CategoriesControllerBinding, RepoPresenter>(),
ActionMode.Callback,
FlexibleAdapter.OnItemClickListener,
FlexibleAdapter.OnItemLongClickListener,
RepoCreateDialog.Listener,
UndoHelper.OnActionListener {

constructor(repoUrl: String) : this() {
createRepo(repoUrl)
}
/**
* Object used to show ActionMode toolbar.
*/
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import eu.kanade.tachiyomi.ui.base.controller.TabbedController
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
import eu.kanade.tachiyomi.ui.download.DownloadController
import eu.kanade.tachiyomi.ui.extension.ExtensionController
import eu.kanade.tachiyomi.ui.extension.repos.RepoController
import eu.kanade.tachiyomi.ui.library.LibraryController
import eu.kanade.tachiyomi.ui.manga.MangaController
import eu.kanade.tachiyomi.ui.recent.history.HistoryController
Expand Down Expand Up @@ -386,6 +387,15 @@ class MainActivity : BaseActivity<MainActivityBinding>() {
router.pushController(GlobalSearchController(query, filter).withFadeTransaction())
}
}
Intent.ACTION_VIEW -> {
// Deep link to add extension repo
if (intent.scheme == "tachiyomi" && intent.data?.host == "add-repo") {
intent.data?.getQueryParameter("url")?.let { repoUrl ->
router.popToRoot()
router.pushController(RepoController(repoUrl).withFadeTransaction())
}
}
}
else -> return false
}
return true
Expand Down

0 comments on commit 23d4636

Please sign in to comment.