Show MAL relogin message on update, localize error message

This commit is contained in:
arkon 2020-12-13 17:52:21 -05:00
parent 5901978889
commit 2cb3984d68
3 changed files with 8 additions and 2 deletions

View File

@ -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>()
if (trackManager.myAnimeList.isLogged) {
trackManager.myAnimeList.logout()
context.toast(R.string.myanimelist_relogin)
}
}
return true
}

View File

@ -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() {

View File

@ -569,6 +569,8 @@
<string name="track_type">Type</string>
<string name="track_author">Author</string>
<string name="error_invalid_date_supplied">Invalid date supplied</string>
<string name="myanimelist_creds_missing">MAL login credentials not found</string>
<string name="myanimelist_relogin">Please login to MAL again</string>
<!-- Category activity -->
<string name="error_category_exists">A category with this name already exists!</string>