-
Notifications
You must be signed in to change notification settings - Fork 102
Swap Moshi for GSON to address Type erasure problems in network requests #157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,81 @@ | ||
| -keepclassmembers class co.paystack.android.api.model.** { <fields>; } | ||
| -keepclassmembers class co.paystack.android.model.AvsState { <fields>; } | ||
| -keepclassmembers class co.paystack.android.model.** { <fields>; } | ||
|
|
||
|
|
||
| # Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and | ||
| # EnclosingMethod is required to use InnerClasses. | ||
| -keepattributes Signature, InnerClasses, EnclosingMethod | ||
|
|
||
| # Retrofit does reflection on method and parameter annotations. | ||
| -keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations | ||
|
|
||
| # Retain service method parameters when optimizing. | ||
| -keepclassmembers,allowshrinking,allowobfuscation interface * { | ||
| @retrofit2.http.* <methods>; | ||
| } | ||
|
|
||
|
|
||
| ##MOSHI | ||
| # JSR 305 annotations are for embedding nullability information. | ||
| -dontwarn javax.annotation.** | ||
|
|
||
| -keepclasseswithmembers class * { | ||
| @com.squareup.moshi.* <methods>; | ||
| } | ||
|
|
||
| -keep @com.squareup.moshi.JsonQualifier interface * | ||
|
|
||
| # Enum field names are used by the integrated EnumJsonAdapter. | ||
| # Annotate enums with @JsonClass(generateAdapter = false) to use them with Moshi. | ||
| -keepclassmembers @com.squareup.moshi.JsonClass class * extends java.lang.Enum { | ||
| <fields>; | ||
| } | ||
|
|
||
| # The name of @JsonClass types is used to look up the generated adapter. | ||
| -keepnames @com.squareup.moshi.JsonClass class * | ||
|
|
||
| # Retain generated target class's synthetic defaults constructor and keep DefaultConstructorMarker's | ||
| # name. We will look this up reflectively to invoke the type's constructor. | ||
| # | ||
| # We can't _just_ keep the defaults constructor because Proguard/R8's spec doesn't allow wildcard | ||
| # matching preceding parameters. | ||
| -keepnames class kotlin.jvm.internal.DefaultConstructorMarker | ||
| -keepclassmembers @com.squareup.moshi.JsonClass @kotlin.Metadata class * { | ||
| synthetic <init>(...); | ||
| } | ||
|
|
||
| # Retain generated JsonAdapters if annotated type is retained. | ||
| -if @com.squareup.moshi.JsonClass class * | ||
| -keep class <1>JsonAdapter { | ||
| <init>(...); | ||
| <fields>; | ||
| } | ||
| -if @com.squareup.moshi.JsonClass class **$* | ||
| -keep class <1>_<2>JsonAdapter { | ||
| <init>(...); | ||
| <fields>; | ||
| } | ||
| -if @com.squareup.moshi.JsonClass class **$*$* | ||
| -keep class <1>_<2>_<3>JsonAdapter { | ||
| <init>(...); | ||
| <fields>; | ||
| } | ||
| -if @com.squareup.moshi.JsonClass class **$*$*$* | ||
| -keep class <1>_<2>_<3>_<4>JsonAdapter { | ||
| <init>(...); | ||
| <fields>; | ||
| } | ||
| -if @com.squareup.moshi.JsonClass class **$*$*$*$* | ||
| -keep class <1>_<2>_<3>_<4>_<5>JsonAdapter { | ||
| <init>(...); | ||
| <fields>; | ||
| } | ||
| -if @com.squareup.moshi.JsonClass class **$*$*$*$*$* | ||
| -keep class <1>_<2>_<3>_<4>_<5>_<6>JsonAdapter { | ||
| <init>(...); | ||
| <fields>; | ||
| } | ||
|
|
||
| -keepclassmembers class kotlin.Metadata { | ||
| public <methods>; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
paystack/src/main/java/co/paystack/android/api/model/ApiResponse.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we not be removing Jcenter? Do we need it for anything ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are couple of libraries we haven't updated to versions shipped in MavenCentral. I'm reluctant to make those changes here but we can schedule them @Peter-John-paystack
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Peter-John-paystack we're moving away from GSON because the new data access classes are all in Kotlin.
Because of Java's type erasure, GSON cannot resolve the return types for the retrofit service functions and it makes the service calls fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool happy with the Jcenter, but why Moshi and not Kotlin serialisable just out of interest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It caused quite a number of conflicts with the kotlin version that was already in the project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok cool cool, lets just make sure that we are going to do regression testing on all functionality if we are making this change please. 😊