# OS integrations

Animetail parity rows A6–A10. Every platform turns its OS event into one app link string and
hands it to `AppDeepLinks` (or the bootstrap `initialDeepLink`). `DeepLinkViewModel`
(`ui/navigation/DeepLinks.kt`) handles the link the same way everywhere:

| Link | Result |
|---|---|
| `yokan://search?q=<query>[&type=manga\|anime\|novel]` | Global search with the query. Without `type` it uses the current default media type (`Navigator.itemType`). Blank queries are ignored. |
| `tachiyomi://add-repo?url=`, `mihon://add-repo?url=`, `mihon://extension-store?url=` | Manga repository, through the existing add-repo confirmation dialog. The catalog is fetched and validated before saving. |
| `aniyomi://add-repo?url=`, `animetail://add-repo?url=`, `animetail://extension-store?url=` | Anime repository, same confirmation. A foreign link without `url` opens the Repositories settings page. |
| `content://…`, `file:…` | Backup file. Opens **Settings → Data and storage**, which reads it with `DataAndStorageViewModel.openBackupFile` (password prompt for encrypted backups). Nothing changes until the user taps **Apply restore** in the restore preview. The restore targets the active profile. |
| `yokan://manga`, `anime`, `updates`, `history`, `browse` | Existing section routes, used by the launcher shortcuts. |

Animetail registers no `https` equivalents for repository links, so neither does Yokan.

## Shared text and system search (A7)

| Platform | Behavior |
|---|---|
| Android | `MainActivity` intent filters for `ACTION_SEND` (`text/plain`), `ACTION_PROCESS_TEXT` (the text-selection menu), `ACTION_SEARCH`, `ACTION_WEB_SEARCH` and the Google Assistant `SEARCH_ACTION`. `systemIntentLink` turns the text into `yokan://search?q=`. |
| iOS | `yokan://search?q=` URLs (Shortcuts app, Safari, other apps). A share extension is out of scope: it needs a separate app-extension target and an App Group handoff. |
| Desktop | `--search <query>` or `--search=<query>` launch argument (`desktopLaunchLink`). A `yokan://search?q=` argument works too. |
| Web | `?search=<query>` page parameter (`webLaunchLink`). |

## Repository deep links (A8)

| Platform | Behavior |
|---|---|
| Android | VIEW filter for the `tachiyomi`, `mihon`, `aniyomi` and `animetail` schemes on the `add-repo` and `extension-store` hosts. |
| iOS | The four schemes are added to `CFBundleURLSchemes`. SwiftUI `onOpenURL` already dispatches them. |
| Desktop | Launch argument on every OS. macOS: the packaged app registers the schemes (`CFBundleURLTypes` through `infoPlist.extraKeysRawXml`), and `Desktop.setOpenURIHandler` dispatches them while the app runs. jpackage cannot register URL protocols on Windows or Linux, so links reach a packaged build there only as arguments. This is the same limitation `yokan://` already has. |
| Web | `?link=<url-encoded app link>`, e.g. `?link=mihon%3A%2F%2Fadd-repo%3Furl%3D…`. Browsers do not route custom schemes to a web page. |

## Opening backup files (A9)

Supported formats are the ones restore already reads: `.tachibk`/`.proto.gz` (Mihon, Tachiyomi,
Aniyomi, Animetail), `.backup` (Mangayomi), `.yokanbak` (Yokan, encrypted).

| Platform | Behavior |
|---|---|
| Android | VIEW filter on `content`/`file` URIs whose path ends in `.tachibk`, `.proto.gz`, `.backup` or `.yokanbak`. The filter repeats each pattern for paths with more dots, because `PatternMatcher` cannot skip them. `AndroidSafLocalFileService.readBytes` reads the `content://` URI. Providers that hide the file name in the URI (some `document/<id>` URIs) do not match. Use the in-app picker for those. |
| iOS | `CFBundleDocumentTypes` for exported `eu.friedcutlet.yokan.encrypted-backup` (`.yokanbak`) and imported `.tachibk` / Mangayomi `.backup` types, plus gzip (`.proto.gz`) at `Alternate` rank. `LSSupportsOpeningDocumentsInPlace` is `false`: iOS copies the file into the app's `Documents/Inbox` and hands over a plain `file://` URL, so no security-scoped access is needed. `onOpenURL` dispatches it. |
| Desktop | A backup file path as a launch argument. Packaged builds associate `.tachibk`, `.yokanbak` and `.backup` (`fileAssociation` on macOS, Windows, Linux). Windows and Linux pass the path as an argument. macOS sends an open-file event, handled by `Desktop.setOpenFileHandler`. `.proto.gz` is not associated, because that would claim every `.gz` file. |
| Web | Not applicable: browsers cannot open local files into a page. Use the restore file picker. |

Plain `.json`/`.json.gz` Yokan backups are not registered, since those extensions are too generic. Restore them from the in-app picker.

## Launcher shortcuts (A6)

| Platform | Behavior |
|---|---|
| Android | Static shortcuts (`res/xml/shortcuts.xml`, attached to every launcher alias): Manga library, Anime library, Updates, History, Browse. Each opens a `yokan://` route. |
| iOS | Home-screen quick actions (`UIApplicationShortcutItems`): Manga library, Updates, History, Browse. iOS shows four static items. The item type is the `yokan://` route. `AppDelegate` dispatches it on cold launch, and `QuickActionSceneDelegate` while the app is running. |
| Desktop | Not applicable: JVM desktop apps have no launcher shortcut API. Dock and taskbar menus need native code. The tray menu already offers Open and Update library. |
| Web | Not applicable: Yokan's web build ships no web app manifest, so it has no `shortcuts` member to declare. |

## Shizuku installer (A10): not applicable

Animetail's Shizuku backend installs extension APKs system-wide without the install prompt.
Its extension manager then loads them from `PackageManager`. Yokan never installs extension
packages. The Android bridge (`vendor/yokan-ext`, `MExtensionServerLoader`) reads the APK
with `getPackageArchiveInfo` and loads it privately through a `DexClassLoader` in the app's
own storage. Yokan also never looks up installed packages for extensions. A Shizuku-installed
APK would never be seen by Yokan, and the private load already needs no prompt and no
`REQUEST_INSTALL_PACKAGES`. Yokan does not add the Shizuku dependency.
