diff --git a/app/build.gradle b/app/build.gradle index 96a41a18..6f811086 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,5 +1,5 @@ plugins { - id "io.gitlab.arturbosch.detekt" version "$detekt_version" + id "io.gitlab.arturbosch.detekt" version(libs.versions.detekt) id "com.android.application" id "com.google.gms.google-services" id "com.google.firebase.crashlytics" @@ -169,94 +169,89 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${libVersions.coroutines}" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${libVersions.coroutines}" + implementation libs.kotlinx.coroutines.core + implementation libs.kotlinx.coroutines.android - implementation "com.google.android.material:material:${libVersions.material}" - implementation "com.google.android.flexbox:flexbox:${libVersions.flexbox}" - implementation "androidx.appcompat:appcompat:${libVersions.appCompat}" - implementation "androidx.legacy:legacy-support-v4:${libVersions.legacySupport}" - implementation "androidx.lifecycle:lifecycle-extensions:${libVersions.lifecycleExt}" - implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:${libVersions.lifecycle}" - implementation "androidx.lifecycle:lifecycle-common-java8:${libVersions.lifecycle}" - implementation "androidx.constraintlayout:constraintlayout:${libVersions.constraintLayout}" - implementation "androidx.core:core-ktx:${libVersions.coreKtx}" + implementation libs.material + implementation libs.flexbox + implementation libs.appcompat + implementation libs.legacy.support.v4 + implementation libs.lifecycle.extensions + implementation libs.lifecycle.viewmodel.ktx + implementation libs.lifecycle.common.java8 + implementation libs.constraintlayout + implementation libs.core.ktx - implementation platform("com.google.firebase:firebase-bom:${libVersions.firebaseBom}") + implementation platform(libs.firebase.bom) + implementation libs.bundles.firebase - implementation "com.google.firebase:firebase-analytics" - implementation "com.google.firebase:firebase-messaging" - implementation "com.google.firebase:firebase-crashlytics" - implementation "com.google.firebase:firebase-perf" + implementation libs.biometric - implementation "androidx.biometric:biometric:${libVersions.biometric}" + implementation libs.zxing.android.embedded - implementation "com.journeyapps:zxing-android-embedded:${libVersions.zxing}" + implementation libs.room.runtime + implementation libs.room.ktx + kapt libs.room.compiler - implementation "androidx.room:room-runtime:${libVersions.room}" - implementation "androidx.room:room-ktx:${libVersions.room}" - kapt "androidx.room:room-compiler:${libVersions.room}" + implementation libs.navigation.fragment.ktx + implementation libs.navigation.ui.ktx - implementation "androidx.navigation:navigation-fragment-ktx:${libVersions.navigation}" - implementation "androidx.navigation:navigation-ui-ktx:${libVersions.navigation}" + implementation libs.ble - implementation "no.nordicsemi.android:ble-ktx:${libVersions.ble}" + implementation libs.fragment.ktx - implementation "androidx.fragment:fragment-ktx:${libVersions.fragment}" + implementation libs.multidex - implementation "androidx.multidex:multidex:${libVersions.multidex}" + implementation libs.browser - implementation "androidx.browser:browser:${libVersions.browser}" + implementation libs.paging.runtime.ktx - implementation "androidx.paging:paging-runtime-ktx:${libVersions.paging}" + implementation libs.tink.android - implementation "com.google.crypto.tink:tink-android:${libVersions.tink}" + implementation libs.review.ktx - implementation "com.google.android.play:review-ktx:${libVersions.review}" + implementation libs.hilt.android.dagger + kapt libs.hilt.android.compiler + kapt libs.hilt.androidx - implementation "com.google.dagger:hilt-android:$dagger_gradle_version" - kapt "com.google.dagger:hilt-android-compiler:$dagger_gradle_version" + implementation libs.glide.image + kapt libs.glide.compiler - kapt "androidx.hilt:hilt-compiler:${libVersions.hiltCompiler}" + implementation libs.lottie - implementation "com.github.bumptech.glide:glide:${libVersions.glide}" - kapt "com.github.bumptech.glide:compiler:${libVersions.glide}" - - implementation "com.airbnb.android:lottie:${libVersions.lottie}" - - implementation "com.squareup.retrofit2:retrofit:${libVersions.retrofit}" - implementation "com.squareup.retrofit2:converter-gson:${libVersions.retrofit}" - implementation "com.squareup.okhttp3:logging-interceptor:${libVersions.okhttp}" + implementation libs.retrofit + implementation libs.converter.gson + implementation libs.logging.interceptor // Chart - implementation "com.github.PhilJay:MPAndroidChart:${libVersions.mpAndroidChart}" + implementation libs.mpandroidchart - coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:${libVersions.desugar}" + coreLibraryDesugaring libs.desugar.jdk // Wallet Connect v1 - implementation "org.java-websocket:Java-WebSocket:${libVersions.javaWebSocket}" - implementation "com.github.komputing:khex:${libVersions.khex}" - implementation "com.squareup.moshi:moshi:${libVersions.moshi}" - implementation "com.squareup.moshi:moshi-kotlin:${libVersions.moshi}" + implementation libs.java.websocket + implementation libs.khex + implementation libs.moshi.core + implementation libs.moshi.kotlin // Wallet Connect v2 - implementation(platform("com.walletconnect:android-bom:${libVersions.walletConnectBom}")) - implementation("com.walletconnect:android-core") { + implementation(platform(libs.walletconnect)) + implementation(libs.android.core) { exclude group: 'com.jakewharton.timber', module: 'timber' } - implementation "com.walletconnect:sign" - implementation "com.walletconnect:web3wallet" + implementation libs.sign + implementation libs.web3wallet // ExoPlayer - implementation "com.google.android.exoplayer:exoplayer:${libVersions.exoPlayer}" + implementation libs.exoplayer implementation(libs.algosdk) { exclude group: 'org.bouncycastle' } // Test - testImplementation "junit:junit:${testLibVersions.junit}" - androidTestImplementation "androidx.room:room-testing:${libVersions.room}" - androidTestImplementation "androidx.test:runner:${testLibVersions.runner}" - androidTestImplementation "androidx.test.espresso:espresso-core:${testLibVersions.espresso}" + testImplementation libs.junit + androidTestImplementation libs.room.testing + androidTestImplementation libs.runner + androidTestImplementation libs.espresso.core } diff --git a/app/src/main/java/com/algorand/android/usecase/AccountDetailUseCase.kt b/app/src/main/java/com/algorand/android/usecase/AccountDetailUseCase.kt index a27363cf..3122382a 100644 --- a/app/src/main/java/com/algorand/android/usecase/AccountDetailUseCase.kt +++ b/app/src/main/java/com/algorand/android/usecase/AccountDetailUseCase.kt @@ -108,11 +108,9 @@ class AccountDetailUseCase @Inject constructor( } fun isAssetBalanceZero(publicKey: String, assetId: Long): Boolean? { - getCachedAccountDetail(publicKey)?.let { account -> - account.data?.getAssetHoldingOrNull(assetId)?.let { - return it.amount == BigInteger.ZERO - } - } ?: return null + val account = getCachedAccountDetail(publicKey) ?: return null + val assetHolding = account.data?.getAssetHoldingOrNull(assetId) ?: return null + return assetHolding.amount == BigInteger.ZERO } fun isAssetOwnedByAnyAccount(assetId: Long): Boolean { diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 34ec84fd..00000000 --- a/build.gradle +++ /dev/null @@ -1,43 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. - -buildscript { - ext.kotlin_version = '1.9.24' - ext.safeargs_gradle_version = '2.7.6' - ext.gradle_version = '8.2.1' - ext.firebase_crashlytics_version = '2.9.9' - ext.google_services_version = '4.4.0' - ext.dagger_gradle_version = '2.50' - ext.firebase_performance_version = '1.4.2' - ext.detekt_version = '1.23.4' - repositories { - google() - mavenCentral() - jcenter() - } - dependencies { - classpath "com.android.tools.build:gradle:$gradle_version" - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$safeargs_gradle_version" - classpath "com.google.gms:google-services:$google_services_version" - classpath "com.google.firebase:firebase-crashlytics-gradle:$firebase_crashlytics_version" - classpath "com.google.dagger:hilt-android-gradle-plugin:$dagger_gradle_version" - classpath "com.google.firebase:perf-plugin:$firebase_performance_version" - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files - } -} - -apply from: 'versions.gradle' - -allprojects { - repositories { - google() - mavenCentral() - maven { url 'https://jitpack.io' } - jcenter() - } -} - -tasks.register('clean', Delete) { - delete rootProject.buildDir -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 00000000..9dc2a84d --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,34 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + google() + mavenCentral() + } + + dependencies { + classpath(libs.gradle) + classpath(libs.kotlin.gradle.plugin) + classpath(libs.navigation.safe.args.gradle.plugin) + classpath(libs.google.services) + classpath(libs.firebase.crashlytics.gradle) + classpath(libs.hilt.android.gradle.plugin) + classpath(libs.perf.plugin) + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +apply(from = "versions.gradle") + +allprojects { + repositories { + google() + mavenCentral() + maven(url = "https://jitpack.io") + } +} + +tasks.register("clean") { + delete(rootProject.buildDir) +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3cfb7f7e..debab5e4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,9 +1,116 @@ [versions] algosdk = "2.5.0" +appCompat = "1.7.0" +biometric = "1.1.0" +ble = "2.7.5" +browser = "1.8.0" +constraintLayout = "2.1.4" +converterGson = "2.11.0" +coreKtx = "1.13.1" +coroutines = "1.8.1" +dagger = "2.50" +desugar = "2.1.2" +detekt = "1.23.7" +espresso = "3.6.1" +exoPlayer = "2.19.1" +firebaseBom = "33.5.1" +firebaseCrashlyticsGradle = "3.0.2" +firebasePerformance = "1.4.2" +flexbox = "3.0.0" +fragmentKtx = "1.8.4" +glide = "4.16.0" +googleServicesVersion = "4.4.2" +gradleVersion = "8.7.1" +hiltCompiler = "1.2.0" +javaWebSocket = "1.5.6" +junit = "4.13.2" +khex = "1.1.2" +kotlin = "1.9.24" +legacySupport = "1.0.0" +lifecycle = "2.8.6" +lifecycleExt = "2.2.0" +lottie = "6.4.1" +material = "1.12.0" +moshi = "1.15.1" +mpAndroidChart = "3.1.0" +multidex = "2.0.1" +navigation = "2.8.3" +okhttp = "4.12.0" +paging = "3.3.2" +retrofit = "2.11.0" +review = "2.0.2" +room = "2.6.1" +runner = "1.6.2" +safeargs = "2.8.3" +tink = "1.14.0" +walletConnectBom = "1.34.1" +zxing = "4.3.0" [libraries] algosdk = { module = "com.algorand:algosdk", version.ref = "algosdk" } +android-core = { module = "com.walletconnect:android-core" } +appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appCompat" } +biometric = { module = "androidx.biometric:biometric", version.ref = "biometric" } +ble = { module = "no.nordicsemi.android:ble", version.ref = "ble" } +browser = { module = "androidx.browser:browser", version.ref = "browser" } +constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintLayout" } +converter-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "converterGson" } +core-ktx = { module = "androidx.core:core-ktx", version.ref = "coreKtx" } +desugar-jdk = { module = "com.android.tools:desugar_jdk_libs", version.ref = "desugar" } +espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espresso" } +exoplayer = { module = "com.google.android.exoplayer:exoplayer", version.ref = "exoPlayer" } +firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "firebaseBom" } +firebase-analytics = { module = "com.google.firebase:firebase-analytics" } +firebase-crashlytics = { module = "com.google.firebase:firebase-crashlytics" } +firebase-crashlytics-gradle = { module = "com.google.firebase:firebase-crashlytics-gradle", version.ref = "firebaseCrashlyticsGradle" } +firebase-messaging = { module = "com.google.firebase:firebase-messaging" } +firebase-perf = { module = "com.google.firebase:firebase-perf" } +flexbox = { module = "com.google.android.flexbox:flexbox", version.ref = "flexbox" } +fragment-ktx = { module = "androidx.fragment:fragment-ktx", version.ref = "fragmentKtx" } +glide-image = { module = "com.github.bumptech.glide:glide", version.ref = "glide" } +glide-compiler = { module = "com.github.bumptech.glide:compiler", version.ref = "glide" } +google-services = { module = "com.google.gms:google-services", version.ref = "googleServicesVersion" } +gradle = { module = "com.android.tools.build:gradle", version.ref = "gradleVersion" } +hilt-android-dagger = { module = "com.google.dagger:hilt-android", version.ref = "dagger" } +hilt-android-compiler = { module = "com.google.dagger:hilt-android-compiler", version.ref = "dagger" } +hilt-android-gradle-plugin = { module = "com.google.dagger:hilt-android-gradle-plugin", version.ref = "dagger" } +hilt-androidx = { module = "androidx.hilt:hilt-compiler", version.ref = "hiltCompiler" } +java-websocket = { module = "org.java-websocket:Java-WebSocket", version.ref = "javaWebSocket" } +junit = { module = "junit:junit", version.ref = "junit" } +khex = { module = "com.github.komputing:khex", version.ref = "khex" } +kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } +kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" } +kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines" } +legacy-support-v4 = { module = "androidx.legacy:legacy-support-v4", version.ref = "legacySupport" } +lifecycle-common-java8 = { module = "androidx.lifecycle:lifecycle-common-java8", version.ref = "lifecycle" } +lifecycle-extensions = { module = "androidx.lifecycle:lifecycle-extensions", version.ref = "lifecycleExt" } +lifecycle-viewmodel-ktx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "lifecycle" } +logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp" } +lottie = { module = "com.airbnb.android:lottie", version.ref = "lottie" } +material = { module = "com.google.android.material:material", version.ref = "material" } +moshi-core = { module = "com.squareup.moshi:moshi", version.ref = "moshi" } +moshi-kotlin = { module = "com.squareup.moshi:moshi-kotlin", version.ref = "moshi" } +mpandroidchart = { module = "com.github.PhilJay:MPAndroidChart", version.ref = "mpAndroidChart" } +multidex = { module = "androidx.multidex:multidex", version.ref = "multidex" } +navigation-fragment-ktx = { module = "androidx.navigation:navigation-fragment-ktx", version.ref = "navigation" } +navigation-safe-args-gradle-plugin = { module = "androidx.navigation:navigation-safe-args-gradle-plugin", version.ref = "safeargs" } +navigation-ui-ktx = { module = "androidx.navigation:navigation-ui-ktx", version.ref = "navigation" } +paging-runtime-ktx = { module = "androidx.paging:paging-runtime-ktx", version.ref = "paging" } +perf-plugin = { module = "com.google.firebase:perf-plugin", version.ref = "firebasePerformance" } +retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } +review-ktx = { module = "com.google.android.play:review-ktx", version.ref = "review" } +room-ktx = { module = "androidx.room:room-ktx", version.ref = "room" } +room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" } +room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" } +room-testing = { module = "androidx.room:room-testing", version.ref = "room" } +runner = { module = "androidx.test:runner", version.ref = "runner" } +sign = { module = "com.walletconnect:sign" } +tink-android = { module = "com.google.crypto.tink:tink-android", version.ref = "tink" } +walletconnect = { module = "com.walletconnect:android-bom", version.ref = "walletConnectBom" } +web3wallet = { module = "com.walletconnect:web3wallet" } +zxing-android-embedded = { module = "com.journeyapps:zxing-android-embedded", version.ref = "zxing" } [bundles] +firebase = ["firebase-analytics", "firebase-crashlytics", "firebase-messaging", "firebase-perf"] [plugins] diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 95251d0e..37ca6fa6 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Mon Jan 22 14:01:57 CET 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/versions.gradle b/versions.gradle index 994eb57c..b0c5c3e7 100644 --- a/versions.gradle +++ b/versions.gradle @@ -9,54 +9,11 @@ ext { applicationId: 'com.algorand.android' ] - libVersions = [ - coroutines : '1.8.1', - material : '1.12.0', - appCompat : '1.7.0', - legacySupport : '1.0.0', - lifecycle : '2.8.3', - lifecycleExt : '2.2.0', - constraintLayout: '2.1.4', - fragment : '1.8.1', - coreKtx : '1.13.1', - navigation : '2.7.7', - paging : '3.3.0', - retrofit : '2.11.0', - okhttp : '4.12.0', - hiltCompiler : '1.2.0', - biometric : '1.1.0', - flexbox : '3.0.0', - zxing : '4.3.0', - room : '2.6.1', - glide : '4.16.0', - multidex : '2.0.1', - tink : '1.14.0', - mpChart : '3.1.0', - browser : '1.8.0', - review : '2.0.1', - ble : '2.8.0', - lottie : '6.4.1', - desugar : '2.0.4', - mpAndroidChart : '3.1.0', - javaWebSocket : '1.5.6', - khex : '1.1.2', - walletConnectBom: '1.34.1', - moshi : '1.15.1', - exoPlayer : '2.19.1', - firebaseBom : '33.1.1' - ] - discoverVersions = [ staging: 4, prod : 4 ] - testLibVersions = [ - junit : '4.13.2', - runner : '1.5.2', - espresso: '3.5.1' - ] - peraApplication = [ versionCode: 121, versionName: "5.11.0"