Aggiunte definizioni di @SerializedName per evitare minify di Proguard

This commit is contained in:
Giuseppe Scorrano 2025-05-28 12:50:21 +02:00
parent 00067ca1c9
commit eead844ac1
9 changed files with 86 additions and 2 deletions

View File

@ -51,9 +51,12 @@ android {
buildTypes { buildTypes {
debug { debug {
ext.enableCrashlytics = false ext.enableCrashlytics = false
// minifyEnabled true // Abilita la minimizzazione del codice
// shrinkResources true // Rimuove risorse non utilizzate
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
} }
release { release {
minifyEnabled true // Abilita la minimizzazione del codice // minifyEnabled true // Abilita la minimizzazione del codice
shrinkResources true // Rimuove risorse non utilizzate shrinkResources true // Rimuove risorse non utilizzate
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release signingConfig signingConfigs.release

View File

@ -23,3 +23,20 @@
# If you keep the line number information, uncomment this to # If you keep the line number information, uncomment this to
# hide the original source file name. # hide the original source file name.
#-renamesourcefileattribute SourceFile #-renamesourcefileattribute SourceFile
# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * extends com.google.gson.TypeAdapter
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer
# Prevent R8 from leaving Data object members always null
-keepclasseswithmembers class * {
<init>(...);
@com.google.gson.annotations.SerializedName <fields>;
}
# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
-keep class it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse { *; }
-keep class * extends it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse { *; }

View File

@ -1,11 +1,17 @@
package it.integry.integrywmsnative.gest.login.dto; package it.integry.integrywmsnative.gest.login.dto;
import com.google.gson.annotations.SerializedName;
import java.util.HashMap; import java.util.HashMap;
public class AuthTokenClaimsDTO { public class AuthTokenClaimsDTO {
@SerializedName("deviceId")
private long deviceId; private long deviceId;
@SerializedName("userDTO")
private User userDTO; private User userDTO;
@SerializedName("profilesData")
private HashMap<String, AuthTokenProfileDetails> profilesData; private HashMap<String, AuthTokenProfileDetails> profilesData;
public long getDeviceId() { public long getDeviceId() {
@ -36,11 +42,22 @@ public class AuthTokenClaimsDTO {
} }
public class User { public class User {
@SerializedName("username")
private String username; private String username;
@SerializedName("email")
private Object email; private Object email;
@SerializedName("fullname")
private String fullname; private String fullname;
@SerializedName("keyGroup")
private int keyGroup; private int keyGroup;
@SerializedName("attivo")
private boolean attivo; private boolean attivo;
@SerializedName("type")
private String type; private String type;
public String getUsername() { public String getUsername() {
@ -99,6 +116,7 @@ public class AuthTokenClaimsDTO {
} }
public static class AuthTokenProfileDetails { public static class AuthTokenProfileDetails {
@SerializedName("defaultDepo")
private AuthTokenDepoDetails defaultDepo; private AuthTokenDepoDetails defaultDepo;
public AuthTokenDepoDetails getDefaultDepo() { public AuthTokenDepoDetails getDefaultDepo() {
@ -112,8 +130,13 @@ public class AuthTokenClaimsDTO {
} }
public static class AuthTokenDepoDetails { public static class AuthTokenDepoDetails {
@SerializedName("codMdep")
private String codMdep; private String codMdep;
@SerializedName("descrizione")
private String descrizione; private String descrizione;
@SerializedName("codJfas")
private String codJfas; private String codJfas;
public String getCodMdep() { public String getCodMdep() {

View File

@ -1,12 +1,20 @@
package it.integry.integrywmsnative.gest.login.dto; package it.integry.integrywmsnative.gest.login.dto;
import com.google.gson.annotations.SerializedName;
import java.time.LocalDateTime; import java.time.LocalDateTime;
public class AuthenticationJwtResponseDTO { public class AuthenticationJwtResponseDTO {
@SerializedName("accessToken")
private String accessToken; private String accessToken;
@SerializedName("refreshToken")
private String refreshToken; private String refreshToken;
@SerializedName("expiryDate")
private LocalDateTime expiryDate; private LocalDateTime expiryDate;
@SerializedName("expireIn")
private long expireIn; private long expireIn;

View File

@ -1,11 +1,22 @@
package it.integry.integrywmsnative.gest.login.dto; package it.integry.integrywmsnative.gest.login.dto;
import com.google.gson.annotations.SerializedName;
public class LoginAziendaDTO { public class LoginAziendaDTO {
@SerializedName("profileDb")
private String profileDb; private String profileDb;
@SerializedName("endpointRestApi")
private String endpointRestApi; private String endpointRestApi;
@SerializedName("phpApi")
private String phpApi; private String phpApi;
@SerializedName("repoPhoto")
private String repoPhoto; private String repoPhoto;
@SerializedName("endpointPvm")
private String endpointPvm; private String endpointPvm;
public String getProfileDb() { public String getProfileDb() {

View File

@ -1,9 +1,16 @@
package it.integry.integrywmsnative.gest.login.dto; package it.integry.integrywmsnative.gest.login.dto;
import com.google.gson.annotations.SerializedName;
public class LoginRequestDTO { public class LoginRequestDTO {
@SerializedName("username")
private String username; private String username;
@SerializedName("password")
private String password; private String password;
@SerializedName("deviceId")
private String deviceId; private String deviceId;
public String getUsername() { public String getUsername() {

View File

@ -1,12 +1,15 @@
package it.integry.integrywmsnative.gest.login.dto; package it.integry.integrywmsnative.gest.login.dto;
import com.google.gson.annotations.SerializedName;
import java.util.List; import java.util.List;
public class LoginResponseDTO { public class LoginResponseDTO {
@SerializedName("fullName")
private String fullName; private String fullName;
private List<String> availableProfiles;
@SerializedName("availableProfiles")
private List<String> availableProfiles;
public String getFullName() { public String getFullName() {
return fullName; return fullName;

View File

@ -1,6 +1,9 @@
package it.integry.integrywmsnative.gest.login.dto; package it.integry.integrywmsnative.gest.login.dto;
import com.google.gson.annotations.SerializedName;
public class RefreshRequestDTO { public class RefreshRequestDTO {
@SerializedName("refreshToken")
private String refreshToken; private String refreshToken;
public String getRefreshToken() { public String getRefreshToken() {

View File

@ -2,14 +2,23 @@ package it.integry.integrywmsnative.view.dialogs.tracciamento_imballi;
import androidx.databinding.ObservableBoolean; import androidx.databinding.ObservableBoolean;
import androidx.databinding.ObservableField; import androidx.databinding.ObservableField;
import com.google.gson.annotations.SerializedName;
public class TracciamentoImballoDTO { public class TracciamentoImballoDTO {
@SerializedName("codTcol")
private final ObservableField<String> codTcol = new ObservableField<>(); private final ObservableField<String> codTcol = new ObservableField<>();
@SerializedName("descrizione")
private final ObservableField<String> descrizione = new ObservableField<>(); private final ObservableField<String> descrizione = new ObservableField<>();
@SerializedName("codMart")
private final ObservableField<String> codMart = new ObservableField<>(); private final ObservableField<String> codMart = new ObservableField<>();
@SerializedName("qta")
private final ObservableField<Integer> qta = new ObservableField<>(); private final ObservableField<Integer> qta = new ObservableField<>();
@SerializedName("editable")
private final ObservableBoolean editable = new ObservableBoolean(true); private final ObservableBoolean editable = new ObservableBoolean(true);
public ObservableField<String> getCodTcol() { public ObservableField<String> getCodTcol() {