diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 19800e17c9..cb1177a701 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -96,7 +96,18 @@
+ android:label="MyAnimeList">
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackService.kt
index 8c2c54da85..5e26119425 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackService.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackService.kt
@@ -1,6 +1,7 @@
package eu.kanade.tachiyomi.data.track
import androidx.annotation.CallSuper
+import androidx.annotation.ColorInt
import androidx.annotation.DrawableRes
import eu.kanade.tachiyomi.data.database.models.Track
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
@@ -28,6 +29,7 @@ abstract class TrackService(val id: Int) {
@DrawableRes
abstract fun getLogo(): Int
+ @ColorInt
abstract fun getLogoColor(): Int
abstract fun getStatusList(): List
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 9559e4de75..bcfe729207 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
@@ -6,9 +6,17 @@ import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Track
import eu.kanade.tachiyomi.data.track.TrackService
import eu.kanade.tachiyomi.data.track.model.TrackSearch
-import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.runBlocking
+import kotlinx.serialization.decodeFromString
+import kotlinx.serialization.encodeToString
+import kotlinx.serialization.json.Json
import rx.Completable
import rx.Observable
+import rx.android.schedulers.AndroidSchedulers
+import rx.schedulers.Schedulers
+import timber.log.Timber
+import uy.kohesive.injekt.injectLazy
class MyAnimeList(private val context: Context, id: Int) : TrackService(id) {
@@ -18,29 +26,23 @@ class MyAnimeList(private val context: Context, id: Int) : TrackService(id) {
const val ON_HOLD = 3
const val DROPPED = 4
const val PLAN_TO_READ = 6
-
- const val DEFAULT_STATUS = READING
- const val DEFAULT_SCORE = 0
-
- const val BASE_URL = "https://myanimelist.net"
- const val USER_SESSION_COOKIE = "MALSESSIONID"
- const val LOGGED_IN_COOKIE = "is_logged_in"
+ const val REREADING = 7
}
- private val interceptor by lazy { MyAnimeListInterceptor(this) }
+ private val json: Json by injectLazy()
+
+ private val interceptor by lazy { MyAnimeListInterceptor(this, getPassword()) }
private val api by lazy { MyAnimeListApi(client, interceptor) }
override val name: String
get() = "MyAnimeList"
- override val supportsReadingDates: Boolean = true
-
override fun getLogo() = R.drawable.ic_tracker_mal
override fun getLogoColor() = Color.rgb(46, 81, 162)
override fun getStatusList(): List {
- return listOf(READING, COMPLETED, ON_HOLD, DROPPED, PLAN_TO_READ)
+ return listOf(READING, COMPLETED, ON_HOLD, DROPPED, PLAN_TO_READ, REREADING)
}
override fun getStatus(status: Int): String = with(context) {
@@ -50,6 +52,7 @@ class MyAnimeList(private val context: Context, id: Int) : TrackService(id) {
ON_HOLD -> getString(R.string.on_hold)
DROPPED -> getString(R.string.dropped)
PLAN_TO_READ -> getString(R.string.plan_to_read)
+ REREADING -> getString(R.string.repeating)
else -> ""
}
}
@@ -65,76 +68,62 @@ class MyAnimeList(private val context: Context, id: Int) : TrackService(id) {
}
override fun add(track: Track): Observable