diff --git a/app/src/main/java/com/mxt/anitrend/model/api/converter/AniGraphConverter.kt b/app/src/main/java/com/mxt/anitrend/model/api/converter/AniGraphConverter.kt index 13d2299d..293856f4 100644 --- a/app/src/main/java/com/mxt/anitrend/model/api/converter/AniGraphConverter.kt +++ b/app/src/main/java/com/mxt/anitrend/model/api/converter/AniGraphConverter.kt @@ -1,11 +1,9 @@ package com.mxt.anitrend.model.api.converter import com.google.gson.Gson -import com.mxt.anitrend.model.api.converter.request.AniRequestConverter import com.mxt.anitrend.model.api.converter.response.AniGraphResponseConverter import io.github.wax911.library.annotation.processor.contract.AbstractGraphProcessor import io.github.wax911.library.converter.GraphConverter -import okhttp3.RequestBody import okhttp3.ResponseBody import retrofit2.Converter import retrofit2.Retrofit @@ -15,41 +13,15 @@ class AniGraphConverter( graphProcessor: AbstractGraphProcessor, gson: Gson ) : GraphConverter(graphProcessor, gson) { - /** * Response body converter delegates logic processing to a child class that handles * wrapping and deserialization of the json response data. * - * @param parameterAnnotations All the annotation applied to request parameters - * @param methodAnnotations All the annotation applied to the requesting method + * @param annotations All the annotation applied to the requesting method * @param retrofit The retrofit object representing the response - * @param type The type of the parameter of the request + * @param type The generic type declared on the method * - * @see AniRequestConverter - */ - override fun requestBodyConverter( - type: Type, - parameterAnnotations: Array, - methodAnnotations: Array, - retrofit: Retrofit - ): Converter<*, RequestBody> = AniRequestConverter( - methodAnnotations = methodAnnotations, - graphProcessor = graphProcessor, - gson = gson - ) - - /** - * Response body converter delegates logic processing to a child class that handles - * wrapping and deserialization of the json response data. * @see GraphResponseConverter - *

- * - * - * @param annotations All the annotation applied to the requesting Call method - * @see retrofit2.Call - * - * @param retrofit The retrofit object representing the response - * @param type The generic type declared on the Call method */ override fun responseBodyConverter( type: Type, diff --git a/app/src/main/java/com/mxt/anitrend/model/api/converter/request/AniGraphRequestConverter.kt b/app/src/main/java/com/mxt/anitrend/model/api/converter/request/AniGraphRequestConverter.kt deleted file mode 100644 index 24560096..00000000 --- a/app/src/main/java/com/mxt/anitrend/model/api/converter/request/AniGraphRequestConverter.kt +++ /dev/null @@ -1,44 +0,0 @@ -package com.mxt.anitrend.model.api.converter.request - -import com.google.gson.Gson -import com.mxt.anitrend.BuildConfig -import io.github.wax911.library.annotation.processor.GraphProcessor -import io.github.wax911.library.annotation.processor.contract.AbstractGraphProcessor -import io.github.wax911.library.converter.GraphConverter -import io.github.wax911.library.converter.request.GraphRequestConverter -import io.github.wax911.library.model.request.QueryContainerBuilder -import okhttp3.MediaType -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.RequestBody -import okhttp3.RequestBody.Companion.toRequestBody -import timber.log.Timber - -class AniRequestConverter( - methodAnnotations: Array, - graphProcessor: AbstractGraphProcessor, - gson: Gson -) : GraphRequestConverter(methodAnnotations, graphProcessor, gson) { - - /** - * Converter for the request body, gets the GraphQL query from the method annotation - * and constructs a GraphQL request body to send over the network. - *

- * - * @param containerBuilder The constructed builder method of your query with variables - * @return Request body - */ - override fun convert(containerBuilder: QueryContainerBuilder): RequestBody { - val rawPayload = graphProcessor.getQuery(methodAnnotations) - - /*val requestPayload = if (BuildConfig.DEBUG) rawPayload - else GraphUtil.minify(rawPayload)*/ - - val queryContainer = containerBuilder - .setQuery(rawPayload) - .build() - - val queryJson = gson.toJson(queryContainer) - - return queryJson.toRequestBody(GraphConverter.MimeType.toMediaTypeOrNull()) - } -} \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4c2d3b29..a7ef68d4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -127,7 +127,7 @@ androidx-work-test = { module = "androidx.work:work-test", version.ref = "androi anitrend-android-emoji = "com.github.anitrend:android-emojify:1.6.0-beta01" anitrend-support-markwon = "com.github.AniTrend:support-markdown:0.12.1-alpha01" -anitrend-retrofit-graphql = "com.github.anitrend:retrofit-graphql:cf428d8430" +anitrend-retrofit-graphql = "com.github.anitrend:retrofit-graphql:0.11.5" cash-turbine = "app.cash.turbine:turbine:1.2.0"