From f0c4083f24fa647ed59c8a3034f623b5c3c25b85 Mon Sep 17 00:00:00 2001 From: Alessandro Jean Date: Wed, 28 Apr 2021 18:21:27 -0300 Subject: [PATCH] Update kotlinx-serialization-protobuf to match Kotlin version at MangaPlus (#6747) * Update kotlinx-serialization-protobuf to match Kotlin version. * Removed unused import. * Removed unused serializer. --- src/all/mangaplus/build.gradle | 4 ++-- .../tachiyomi/extension/all/mangaplus/MangaPlus.kt | 9 +++++---- .../tachiyomi/extension/all/mangaplus/MangaPlusApi.kt | 4 ---- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/all/mangaplus/build.gradle b/src/all/mangaplus/build.gradle index b35174d9b..0ab74f10b 100644 --- a/src/all/mangaplus/build.gradle +++ b/src/all/mangaplus/build.gradle @@ -6,12 +6,12 @@ ext { extName = 'MANGA Plus by SHUEISHA' pkgNameSuffix = 'all.mangaplus' extClass = '.MangaPlusFactory' - extVersionCode = 16 + extVersionCode = 17 libVersion = '1.2' } dependencies { - implementation 'org.jetbrains.kotlinx:kotlinx-serialization-protobuf:1.0.1' + implementation 'org.jetbrains.kotlinx:kotlinx-serialization-protobuf:1.2.0' } apply from: "$rootDir/common.gradle" diff --git a/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlus.kt b/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlus.kt index a84f35db0..cc0a7890f 100644 --- a/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlus.kt +++ b/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlus.kt @@ -14,6 +14,7 @@ import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.online.HttpSource +import kotlinx.serialization.decodeFromByteArray import kotlinx.serialization.protobuf.ProtoBuf import okhttp3.Headers import okhttp3.HttpUrl.Companion.toHttpUrlOrNull @@ -422,11 +423,11 @@ abstract class MangaPlus( private fun Response.asProto(): MangaPlusResponse { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) - return ProtoBuf.decodeFromByteArray(MangaPlusSerializer, body!!.bytes()) + return ProtoBuf.decodeFromByteArray(body!!.bytes()) // The kotlinx.serialization library eventually always have some issues with - // devices with Android version below Nougat. So, if the device is running Marshmallow - // or lower, the deserialization is done using ProtobufJS + Duktape + Gson. + // devices with Android version below Nougat. So, if the device is running Android 6.x, + // the deserialization is done using ProtobufJS + Duktape + Gson. val bytes = body!!.bytes() val messageBytes = "var BYTE_ARR = new Uint8Array([${bytes.joinToString()}]);" @@ -445,7 +446,7 @@ abstract class MangaPlus( companion object { private const val API_URL = "https://jumpg-webapi.tokyo-cdn.com/api" private const val USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) " + - "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36" + "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36" private val HEX_GROUP = "(.{1,2})".toRegex() diff --git a/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlusApi.kt b/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlusApi.kt index 1586ea828..b99d63be1 100644 --- a/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlusApi.kt +++ b/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlusApi.kt @@ -2,12 +2,8 @@ package eu.kanade.tachiyomi.extension.all.mangaplus import com.google.gson.annotations.SerializedName import kotlinx.serialization.Serializable -import kotlinx.serialization.Serializer import kotlinx.serialization.protobuf.ProtoNumber -@Serializer(forClass = MangaPlusResponse::class) -object MangaPlusSerializer - @Serializable data class MangaPlusResponse( @ProtoNumber(1) val success: SuccessResult? = null,