mirror of
https://git.mihon.tech/mihonapp/mihon
synced 2024-11-28 02:28:46 +03:00
Require Komga to be installed when attempting to setup tracker (closes #5491)
This commit is contained in:
parent
697b082591
commit
a69a833716
4 changed files with 13 additions and 5 deletions
|
@ -1,7 +1,6 @@
|
||||||
package eu.kanade.tachiyomi.data.track
|
package eu.kanade.tachiyomi.data.track
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||||
import eu.kanade.tachiyomi.data.track.komga.Komga
|
|
||||||
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
||||||
import eu.kanade.tachiyomi.source.Source
|
import eu.kanade.tachiyomi.source.Source
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ import eu.kanade.tachiyomi.data.track.EnhancedTrackService
|
||||||
import eu.kanade.tachiyomi.data.track.NoLoginTrackService
|
import eu.kanade.tachiyomi.data.track.NoLoginTrackService
|
||||||
import eu.kanade.tachiyomi.data.track.TrackService
|
import eu.kanade.tachiyomi.data.track.TrackService
|
||||||
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
||||||
import eu.kanade.tachiyomi.source.Source
|
|
||||||
import okhttp3.Dns
|
import okhttp3.Dns
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,10 @@ import android.app.Activity
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.MenuInflater
|
import android.view.MenuInflater
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
|
import android.widget.Toast
|
||||||
import androidx.preference.PreferenceGroup
|
import androidx.preference.PreferenceGroup
|
||||||
import androidx.preference.PreferenceScreen
|
import androidx.preference.PreferenceScreen
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.track.EnhancedTrackService
|
|
||||||
import eu.kanade.tachiyomi.data.track.NoLoginTrackService
|
import eu.kanade.tachiyomi.data.track.NoLoginTrackService
|
||||||
import eu.kanade.tachiyomi.data.track.TrackManager
|
import eu.kanade.tachiyomi.data.track.TrackManager
|
||||||
import eu.kanade.tachiyomi.data.track.TrackService
|
import eu.kanade.tachiyomi.data.track.TrackService
|
||||||
|
@ -27,6 +27,7 @@ import eu.kanade.tachiyomi.util.preference.preferenceCategory
|
||||||
import eu.kanade.tachiyomi.util.preference.switchPreference
|
import eu.kanade.tachiyomi.util.preference.switchPreference
|
||||||
import eu.kanade.tachiyomi.util.preference.titleRes
|
import eu.kanade.tachiyomi.util.preference.titleRes
|
||||||
import eu.kanade.tachiyomi.util.system.openInBrowser
|
import eu.kanade.tachiyomi.util.system.openInBrowser
|
||||||
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
import eu.kanade.tachiyomi.widget.preference.LoginPreference
|
import eu.kanade.tachiyomi.widget.preference.LoginPreference
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
||||||
|
@ -82,8 +83,16 @@ class SettingsTrackingController :
|
||||||
}
|
}
|
||||||
|
|
||||||
trackPreference(trackManager.komga) {
|
trackPreference(trackManager.komga) {
|
||||||
trackManager.komga.loginNoop()
|
val acceptedSources = trackManager.komga.getAcceptedSources()
|
||||||
updatePreference(trackManager.komga.id)
|
val hasValidSourceInstalled = sourceManager.getCatalogueSources()
|
||||||
|
.any { it::class.qualifiedName in acceptedSources }
|
||||||
|
|
||||||
|
if (hasValidSourceInstalled) {
|
||||||
|
trackManager.komga.loginNoop()
|
||||||
|
updatePreference(trackManager.komga.id)
|
||||||
|
} else {
|
||||||
|
context.toast(R.string.tracker_komga_warning, Toast.LENGTH_LONG)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
infoPreference(R.string.enhanced_tracking_info)
|
infoPreference(R.string.enhanced_tracking_info)
|
||||||
|
|
|
@ -586,6 +586,7 @@
|
||||||
<string name="tracker_myanimelist" translatable="false">MyAnimeList</string>
|
<string name="tracker_myanimelist" translatable="false">MyAnimeList</string>
|
||||||
<string name="tracker_kitsu" translatable="false">Kitsu</string>
|
<string name="tracker_kitsu" translatable="false">Kitsu</string>
|
||||||
<string name="tracker_komga" translatable="false">Komga</string>
|
<string name="tracker_komga" translatable="false">Komga</string>
|
||||||
|
<string name="tracker_komga_warning">This tracker is only compatible with the Komga source.</string>
|
||||||
<string name="tracker_bangumi" translatable="false">Bangumi</string>
|
<string name="tracker_bangumi" translatable="false">Bangumi</string>
|
||||||
<string name="tracker_shikimori" translatable="false">Shikimori</string>
|
<string name="tracker_shikimori" translatable="false">Shikimori</string>
|
||||||
<string name="manga_tracking_tab">Tracking</string>
|
<string name="manga_tracking_tab">Tracking</string>
|
||||||
|
|
Loading…
Reference in a new issue