Fix Crashlytics proguard rules.

- Fixed crashlytics Retrofit models proguard rules.
- Updated the Gradle plugin version.
- Improved readability of Asset and TransferDetail DAOs (Database Data Access Objects).
This commit is contained in:
Severiano Jaramillo 2019-08-21 13:34:49 -05:00
parent 6df56b068b
commit 54c8bbce19
5 changed files with 83 additions and 12 deletions

View file

@ -28,6 +28,7 @@
-dontobfuscate -dontobfuscate
-verbose -verbose
##--------------- proguard configuration for ITextPDF ---------- ##--------------- proguard configuration for ITextPDF ----------
-dontwarn com.itextpdf.** -dontwarn com.itextpdf.**
@ -88,6 +89,9 @@
-if interface * { @retrofit2.http.* <methods>; } -if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface <1> -keep,allowobfuscation interface <1>
# Additional rules to avoid removing models
-keep public class cy.agorise.bitsybitshareswallet.models.** { *; }
##--------------- proguard configuration for OkHttp ---------- ##--------------- proguard configuration for OkHttp ----------
# JSR 305 annotations are for embedding nullability information. # JSR 305 annotations are for embedding nullability information.
@ -127,14 +131,27 @@
##--------------- proguard configuration for Crashlytics ---------- ##--------------- proguard configuration for Crashlytics ----------
# source https://stackoverflow.com/a/34751033/5428997 # source https://firebase.google.com/docs/crashlytics/get-deobfuscated-reports?platform=android
-keep class com.crashlytics.** { *; } -keepattributes *Annotation* # Keep Crashlytics annotations
-dontwarn com.crashlytics.** -keepattributes SourceFile,LineNumberTable # Keep file names/line numbers
-keepattributes SourceFile,LineNumberTable,*Annotation* -keep public class * extends java.lang.Exception # Keep custom exceptions (opt)
-keep class com.crashlytics.android.**
##--------------- proguard configuration for Coroutines ----------
# ServiceLoader support
-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}
-keepnames class kotlinx.coroutines.android.AndroidExceptionPreHandler {}
-keepnames class kotlinx.coroutines.android.AndroidDispatcherFactory {}
# Most of volatile fields are updated with AFU and should not be mangled
-keepclassmembernames class kotlinx.** {
volatile <fields>;
}
##--------------- other ---------- ##--------------- other ----------
-dontwarn org.slf4j.LoggerFactory -dontwarn org.slf4j.LoggerFactory
-dontwarn org.slf4j.MDC -dontwarn org.slf4j.MDC
-dontwarn org.slf4j.MarkerFactory -dontwarn org.slf4j.MarkerFactory
-keep public class cy.agorise.graphenej.** { *; }

View file

@ -15,7 +15,21 @@ interface AssetDao {
@Insert(onConflict = OnConflictStrategy.REPLACE) @Insert(onConflict = OnConflictStrategy.REPLACE)
fun insertAll(assets: List<Asset>) fun insertAll(assets: List<Asset>)
@Query("SELECT id, symbol, precision, description, issuer FROM assets INNER JOIN balances WHERE assets.id = balances.asset_id AND balances.asset_amount > 0") @Query("""
SELECT
id,
symbol,
precision,
description,
issuer
FROM
assets
INNER JOIN
balances
WHERE
assets.id = balances.asset_id AND
balances.asset_amount > 0
""")
fun getAllNonZero(): LiveData<List<Asset>> fun getAllNonZero(): LiveData<List<Asset>>
@Query("SELECT * FROM assets WHERE id = :assetId") @Query("SELECT * FROM assets WHERE id = :assetId")

View file

@ -7,9 +7,49 @@ import androidx.room.Query
@Dao @Dao
interface TransferDetailDao { interface TransferDetailDao {
@Query("SELECT transfers.id, (SELECT name FROM user_accounts WHERE user_accounts.id=transfers.source) AS `from`, (SELECT name FROM user_accounts WHERE user_accounts.id=transfers.destination) AS `to`, (CASE WHEN destination=:userId THEN 1 ELSE 0 END) AS `direction`, transfers.memo AS `memo`, transfers.timestamp AS `date`, transfers.transfer_amount AS `assetAmount`, assets.precision AS `assetPrecision`, assets.symbol AS `assetSymbol`, assets.issuer as `assetIssuer`, (SELECT value FROM equivalent_values WHERE equivalent_values.transfer_id=transfers.id) AS `fiatAmount`, (SELECT symbol FROM equivalent_values WHERE equivalent_values.transfer_id=transfers.id) AS `fiatSymbol` FROM transfers INNER JOIN assets WHERE transfers.id=:transferId AND transfers.transfer_asset_id = assets.id") @Query("""
SELECT
transfers.id,
(SELECT name FROM user_accounts WHERE user_accounts.id=transfers.source) AS `from`,
(SELECT name FROM user_accounts WHERE user_accounts.id=transfers.destination) AS `to`,
(CASE WHEN destination=:userId THEN 1 ELSE 0 END) AS `direction`,
transfers.memo AS `memo`, transfers.timestamp AS `date`,
transfers.transfer_amount AS `assetAmount`,
assets.precision AS `assetPrecision`,
assets.symbol AS `assetSymbol`,
assets.issuer as `assetIssuer`,
(SELECT value FROM equivalent_values WHERE equivalent_values.transfer_id=transfers.id) AS `fiatAmount`,
(SELECT symbol FROM equivalent_values WHERE equivalent_values.transfer_id=transfers.id) AS `fiatSymbol`
FROM
transfers
INNER JOIN
assets
WHERE
transfers.id=:transferId AND
transfers.transfer_asset_id = assets.id
""")
fun get(userId: String, transferId: String): LiveData<TransferDetail> fun get(userId: String, transferId: String): LiveData<TransferDetail>
@Query("SELECT transfers.id, (SELECT name FROM user_accounts WHERE user_accounts.id=transfers.source) AS `from`, (SELECT name FROM user_accounts WHERE user_accounts.id=transfers.destination) AS `to`, (CASE WHEN destination=:userId THEN 1 ELSE 0 END) AS `direction`, transfers.memo AS `memo`, transfers.timestamp AS `date`, transfers.transfer_amount AS `assetAmount`, assets.precision AS `assetPrecision`, assets.symbol AS `assetSymbol`, assets.issuer as `assetIssuer`, (SELECT value FROM equivalent_values WHERE equivalent_values.transfer_id=transfers.id) AS `fiatAmount`, (SELECT symbol FROM equivalent_values WHERE equivalent_values.transfer_id=transfers.id) AS `fiatSymbol` FROM transfers INNER JOIN assets WHERE transfers.transfer_asset_id = assets.id") @Query("""
SELECT
transfers.id,
(SELECT name FROM user_accounts WHERE user_accounts.id=transfers.source) AS `from`,
(SELECT name FROM user_accounts WHERE user_accounts.id=transfers.destination) AS `to`,
(CASE WHEN destination=:userId THEN 1 ELSE 0 END) AS `direction`,
transfers.memo AS `memo`,
transfers.timestamp AS `date`,
transfers.transfer_amount AS `assetAmount`,
assets.precision AS `assetPrecision`,
assets.symbol AS `assetSymbol`,
assets.issuer as `assetIssuer`,
(SELECT value FROM equivalent_values WHERE equivalent_values.transfer_id=transfers.id) AS `fiatAmount`,
(SELECT symbol FROM equivalent_values WHERE equivalent_values.transfer_id=transfers.id) AS `fiatSymbol`
FROM
transfers
INNER JOIN
assets
WHERE
transfers.transfer_asset_id = assets.id
""")
fun getAll(userId: String): LiveData<List<TransferDetail>> fun getAll(userId: String): LiveData<List<TransferDetail>>
} }

View file

@ -17,7 +17,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.4.0' classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version" classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
classpath 'com.google.gms:google-services:4.2.0' classpath 'com.google.gms:google-services:4.2.0'

View file

@ -1,6 +1,6 @@
#Thu Apr 25 15:01:42 CDT 2019 #Wed Aug 21 13:23:20 CDT 2019
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip