diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d11579ed8..d6a848e13 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -180,6 +180,7 @@ + diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsTrackingScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsTrackingScreen.kt index 021f0ceb2..4a45a566c 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsTrackingScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsTrackingScreen.kt @@ -47,6 +47,7 @@ import eu.kanade.tachiyomi.data.track.Tracker import eu.kanade.tachiyomi.data.track.TrackerManager import eu.kanade.tachiyomi.data.track.anilist.AnilistApi import eu.kanade.tachiyomi.data.track.bangumi.BangumiApi +import eu.kanade.tachiyomi.data.track.hikka.HikkaApi import eu.kanade.tachiyomi.data.track.myanimelist.MyAnimeListApi import eu.kanade.tachiyomi.data.track.shikimori.ShikimoriApi import eu.kanade.tachiyomi.util.system.openInBrowser @@ -164,6 +165,12 @@ object SettingsTrackingScreen : SearchableSettings { login = { context.openInBrowser(BangumiApi.authUrl(), forceDefaultBrowser = true) }, logout = { dialog = LogoutDialog(trackerManager.bangumi) }, ), + Preference.PreferenceItem.TrackerPreference( + title = trackerManager.hikka.name, + tracker = trackerManager.hikka, + login = { context.openInBrowser(HikkaApi.authUrl(), forceDefaultBrowser = true) }, + logout = { dialog = LogoutDialog(trackerManager.hikka) }, + ), Preference.PreferenceItem.InfoPreference(stringResource(MR.strings.tracking_info)), ), ), diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackerManager.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackerManager.kt index 1071fa7ee..1935a6b1e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackerManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackerManager.kt @@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.data.track import eu.kanade.tachiyomi.data.track.anilist.Anilist import eu.kanade.tachiyomi.data.track.bangumi.Bangumi +import eu.kanade.tachiyomi.data.track.hikka.Hikka import eu.kanade.tachiyomi.data.track.kavita.Kavita import eu.kanade.tachiyomi.data.track.kitsu.Kitsu import eu.kanade.tachiyomi.data.track.komga.Komga @@ -28,8 +29,9 @@ class TrackerManager { val mangaUpdates = MangaUpdates(7L) val kavita = Kavita(KAVITA) val suwayomi = Suwayomi(9L) + val hikka = Hikka(10L) - val trackers = listOf(myAnimeList, aniList, kitsu, shikimori, bangumi, komga, mangaUpdates, kavita, suwayomi) + val trackers = listOf(myAnimeList, aniList, kitsu, shikimori, bangumi, komga, mangaUpdates, kavita, suwayomi, hikka) fun loggedInTrackers() = trackers.filter { it.isLoggedIn } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/track/TrackLoginActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/track/TrackLoginActivity.kt index 3f742cfe0..5f1ef2c69 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/track/TrackLoginActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/track/TrackLoginActivity.kt @@ -12,6 +12,7 @@ class TrackLoginActivity : BaseOAuthLoginActivity() { "bangumi-auth" -> handleBangumi(data) "myanimelist-auth" -> handleMyAnimeList(data) "shikimori-auth" -> handleShikimori(data) + "hikka-auth" -> handleHikka(data) } } @@ -67,4 +68,17 @@ class TrackLoginActivity : BaseOAuthLoginActivity() { returnToSettings() } } + + private fun handleHikka(data: Uri) { + val code = data.getQueryParameter("code") + if (code != null) { + lifecycleScope.launchIO { + trackerManager.hikka.login(code) + returnToSettings() + } + } else { + trackerManager.hikka.logout() + returnToSettings() + } + } }