Skip to content

Commit

Permalink
fixed proguard minification issue
Browse files Browse the repository at this point in the history
  • Loading branch information
LivingWithHippos committed Dec 8, 2023
1 parent 6f56048 commit d22393e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
18 changes: 7 additions & 11 deletions app/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,11 @@
<fields>;
}

-dontwarn org.bouncycastle.jsse.BCSSLParameters
-dontwarn org.bouncycastle.jsse.BCSSLSocket
-dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
-dontwarn org.conscrypt.*
-dontwarn org.openjsse.javax.net.ssl.SSLParameters
-dontwarn org.openjsse.javax.net.ssl.SSLSocket
-dontwarn org.openjsse.net.ssl.OpenJSSE
# https://github.com/square/retrofit#r8--proguard
# With R8 full mode generic signatures are stripped for classes that are not
# kept. Suspend functions are wrapped in continuations where the type argument
# is used.
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation

-dontwarn javax.lang.model.element.Modifier
-dontwarn org.jspecify.annotations.NullMarked

-keepclassmembers class com.github.livingwithhippos.unchained.data.** { *; }
# With R8 full mode generic signatures are stripped for classes that are not kept.
-keep,allowobfuscation,allowshrinking class retrofit2.Response
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.github.livingwithhippos.unchained.data.model

import androidx.annotation.Keep
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass

@Keep
@JsonClass(generateAdapter = true)
data class User(
@Json(name = "id") val id: Int,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.github.livingwithhippos.unchained.data.remote

import androidx.annotation.Keep
import retrofit2.Response
import retrofit2.http.GET
import retrofit2.http.Header

@Keep
/** This interface is used by Retrofit to manage various api calls not fitting elsewhere */
interface VariousApi {
/** Disable the current access token */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ open class BaseRepository(private val protoStore: ProtoStore) {
try {
call.invoke()
} catch (e: Exception) {
Timber.e(e, "Error Occurred while getting api result")
return@withContext EitherResult.Failure(NetworkError(-1, errorMessage))
}
val code = response.code()
Expand All @@ -95,6 +96,7 @@ open class BaseRepository(private val protoStore: ProtoStore) {
return@withContext if (error != null) EitherResult.Failure(error)
else EitherResult.Failure(ApiConversionError(-1))
} catch (e: IOException) {
Timber.e(e, "Error parsing error body")
// todo: analyze error to return code
return@withContext EitherResult.Failure(
NetworkError(-1, "$errorMessage, http code $code")
Expand Down

0 comments on commit d22393e

Please sign in to comment.