diff --git a/README.md b/README.md
index 92b9e80b70..4b21282d6b 100644
--- a/README.md
+++ b/README.md
@@ -64,7 +64,7 @@ Catalogue requests should be created at https://github.com/inorichi/tachiyomi-ex
## FAQ
[See our wiki.](https://github.com/inorichi/tachiyomi/wiki/FAQ)
-You can also reach out to us on [Discord](https://discord.gg/WrBkRk4).
+You can also reach out to us on [Discord](https://discord.gg/tachiyomi).
## License
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 6537290437..3e5f35a9b1 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -14,6 +14,7 @@
-
+
+
+
+
+
+
@@ -51,6 +57,21 @@
android:scheme="tachiyomi" />
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt
index 259e1fb8c2..1b2e6bb322 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt
@@ -15,6 +15,8 @@ object PreferenceKeys {
const val showPageNumber = "pref_show_page_number_key"
+ const val trueColor = "pref_true_color_key"
+
const val fullscreen = "fullscreen"
const val keepScreenOn = "pref_keep_screen_on_key"
@@ -105,6 +107,8 @@ object PreferenceKeys {
const val defaultCategory = "default_category"
+ const val skipRead = "skip_read"
+
const val downloadBadge = "display_download_badge"
@Deprecated("Use the preferences of the source")
diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt
index ee5b0b39e5..58ad2b0aff 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt
@@ -43,6 +43,8 @@ class PreferencesHelper(val context: Context) {
fun showPageNumber() = rxPrefs.getBoolean(Keys.showPageNumber, true)
+ fun trueColor() = rxPrefs.getBoolean(Keys.trueColor, false)
+
fun fullscreen() = rxPrefs.getBoolean(Keys.fullscreen, true)
fun keepScreenOn() = rxPrefs.getBoolean(Keys.keepScreenOn, true)
@@ -165,6 +167,8 @@ class PreferencesHelper(val context: Context) {
fun defaultCategory() = prefs.getInt(Keys.defaultCategory, -1)
+ fun skipRead() = prefs.getBoolean(Keys.skipRead, false)
+
fun migrateFlags() = rxPrefs.getInteger("migrate_flags", Int.MAX_VALUE)
fun trustedSignatures() = rxPrefs.getStringSet("trusted_signatures", emptySet())
diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackManager.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackManager.kt
index 73fa15c550..14558d1f1b 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackManager.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackManager.kt
@@ -4,6 +4,7 @@ import android.content.Context
import eu.kanade.tachiyomi.data.track.anilist.Anilist
import eu.kanade.tachiyomi.data.track.kitsu.Kitsu
import eu.kanade.tachiyomi.data.track.myanimelist.Myanimelist
+import eu.kanade.tachiyomi.data.track.shikomori.Shikomori
class TrackManager(private val context: Context) {
@@ -11,6 +12,7 @@ class TrackManager(private val context: Context) {
const val MYANIMELIST = 1
const val ANILIST = 2
const val KITSU = 3
+ const val SHIKOMORI = 4
}
val myAnimeList = Myanimelist(context, MYANIMELIST)
@@ -19,7 +21,9 @@ class TrackManager(private val context: Context) {
val kitsu = Kitsu(context, KITSU)
- val services = listOf(myAnimeList, aniList, kitsu)
+ val shikomori = Shikomori(context, SHIKOMORI)
+
+ val services = listOf(myAnimeList, aniList, kitsu, shikomori)
fun getService(id: Int) = services.find { it.id == id }
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 f871db2b2e..a83e8b9ffb 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
@@ -7,9 +7,9 @@ import eu.kanade.tachiyomi.data.database.models.Track
import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.data.track.TrackService
import eu.kanade.tachiyomi.data.track.model.TrackSearch
+import okhttp3.HttpUrl
import rx.Completable
import rx.Observable
-import java.net.URI
class Myanimelist(private val context: Context, id: Int) : TrackService(id) {
@@ -114,23 +114,23 @@ class Myanimelist(private val context: Context, id: Int) : TrackService(id) {
override fun logout() {
super.logout()
preferences.trackToken(this).delete()
- networkService.cookies.remove(URI(BASE_URL))
+ networkService.cookieManager.remove(HttpUrl.parse(BASE_URL)!!)
}
override val isLogged: Boolean
get() = !getUsername().isEmpty() &&
!getPassword().isEmpty() &&
- checkCookies(URI(BASE_URL)) &&
+ checkCookies() &&
!getCSRF().isEmpty()
private fun getCSRF(): String = preferences.trackToken(this).getOrDefault()
private fun saveCSRF(csrf: String) = preferences.trackToken(this).set(csrf)
- private fun checkCookies(uri: URI): Boolean {
+ private fun checkCookies(): Boolean {
var ckCount = 0
-
- for (ck in networkService.cookies.get(uri)) {
+ val url = HttpUrl.parse(BASE_URL)!!
+ for (ck in networkService.cookieManager.get(url)) {
if (ck.name() == USER_SESSION_COOKIE || ck.name() == LOGGED_IN_COOKIE)
ckCount++
}
diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/shikomori/OAuth.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/shikomori/OAuth.kt
new file mode 100644
index 0000000000..ad6adc18a4
--- /dev/null
+++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/shikomori/OAuth.kt
@@ -0,0 +1,13 @@
+package eu.kanade.tachiyomi.data.track.shikomori
+
+data class OAuth(
+ val access_token: String,
+ val token_type: String,
+ val created_at: Long,
+ val expires_in: Long,
+ val refresh_token: String?) {
+
+ // Access token lives 1 day
+ fun isExpired() = (System.currentTimeMillis() / 1000) > (created_at + expires_in - 3600)
+}
+
diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/shikomori/Shikomori.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/shikomori/Shikomori.kt
new file mode 100644
index 0000000000..83fee74cf4
--- /dev/null
+++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/shikomori/Shikomori.kt
@@ -0,0 +1,138 @@
+package eu.kanade.tachiyomi.data.track.shikomori
+
+import android.content.Context
+import android.graphics.Color
+import com.google.gson.Gson
+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 rx.Completable
+import rx.Observable
+import uy.kohesive.injekt.injectLazy
+
+class Shikomori(private val context: Context, id: Int) : TrackService(id) {
+
+ override fun getScoreList(): List {
+ return IntRange(0, 10).map(Int::toString)
+ }
+
+ override fun displayScore(track: Track): String {
+ return track.score.toInt().toString()
+ }
+
+ override fun add(track: Track): Observable