From 2cb3984d68ef94605fd65a7e88c51d4f3c1c71f6 Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 13 Dec 2020 17:52:21 -0500 Subject: [PATCH] Show MAL relogin message on update, localize error message --- app/src/main/java/eu/kanade/tachiyomi/Migrations.kt | 6 +++++- .../kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt | 2 +- app/src/main/res/values/strings.xml | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt b/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt index 3d7de4a20b..d5fbe83a9f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt @@ -10,6 +10,7 @@ import eu.kanade.tachiyomi.data.track.TrackManager import eu.kanade.tachiyomi.data.updater.UpdaterJob import eu.kanade.tachiyomi.extension.ExtensionUpdateJob import eu.kanade.tachiyomi.ui.library.LibrarySort +import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.widget.ExtendedNavigationView import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get @@ -118,7 +119,10 @@ object Migrations { // Force MAL log out due to login flow change val trackManager = Injekt.get() - trackManager.myAnimeList.logout() + if (trackManager.myAnimeList.isLogged) { + trackManager.myAnimeList.logout() + context.toast(R.string.myanimelist_relogin) + } } return true } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt index 23ecc232d5..9559e4de75 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt @@ -111,7 +111,7 @@ class MyAnimeList(private val context: Context, id: Int) : TrackService(id) { fun ensureLoggedIn() { if (isAuthorized) return - if (!isLogged) throw Exception("MAL login credentials not found") + if (!isLogged) throw Exception(context.getString(R.string.myanimelist_creds_missing)) } override fun logout() { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a1dab031cf..0c1018d942 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -569,6 +569,8 @@ Type Author Invalid date supplied + MAL login credentials not found + Please login to MAL again A category with this name already exists!