From a3bad758992b46d4b88af1dd1bc317c222879187 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 12 Dec 2020 11:26:42 -0500 Subject: [PATCH] Force MAL logout on update --- app/src/main/java/eu/kanade/tachiyomi/Migrations.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt b/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt index 8182dc71fb..71fc3601d5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt @@ -6,10 +6,13 @@ import eu.kanade.tachiyomi.data.backup.BackupCreatorJob import eu.kanade.tachiyomi.data.library.LibraryUpdateJob import eu.kanade.tachiyomi.data.preference.PreferenceKeys import eu.kanade.tachiyomi.data.preference.PreferencesHelper +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.widget.ExtendedNavigationView +import uy.kohesive.injekt.Injekt +import uy.kohesive.injekt.api.get import java.io.File object Migrations { @@ -22,13 +25,13 @@ object Migrations { */ fun upgrade(preferences: PreferencesHelper): Boolean { val context = preferences.context - val oldVersion = preferences.lastVersionCode().get() // Cancel app updater job for debug builds that don't include it if (BuildConfig.DEBUG && !BuildConfig.INCLUDE_UPDATER) { UpdaterJob.cancelTask(context) } + val oldVersion = preferences.lastVersionCode().get() if (oldVersion < BuildConfig.VERSION_CODE) { preferences.lastVersionCode().set(BuildConfig.VERSION_CODE) @@ -111,9 +114,14 @@ object Migrations { putInt(PreferenceKeys.filterCompleted, convertBooleanPrefToTriState("pref_filter_completed_key")) remove("pref_filter_completed_key") } + + // Force MAL log out due to login flow change + val trackManager = Injekt.get() + trackManager.myAnimeList.logout() } return true } + return false } }