From d9bf0ae303915d642205553101b85fd5480e9e28 Mon Sep 17 00:00:00 2001 From: James Brown Date: Sun, 10 Mar 2024 11:04:26 +1100 Subject: [PATCH] Upgrade to Gradle 8.4 --- app/build.gradle | 174 ++++---- .../app/service/AnalyticsService.java | 21 +- app/src/main/AndroidManifest.xml | 8 +- .../alphawallet/app/ui/AddTokenActivity.java | 3 - .../app/ui/ImportTokenActivity.java | 45 +- .../app/ui/RedeemAssetSelectActivity.java | 23 +- .../alphawallet/app/ui/WalletsActivity.java | 19 +- .../app/ui/widget/holder/WalletHolder.java | 29 +- .../ui/widget/holder/WalletSummaryHolder.java | 23 +- .../alphawallet/app/widget/AddWalletView.java | 62 +-- .../app/widget/QRCodeActionsView.java | 63 ++- .../app/widget/SignTransactionDialog.java | 2 +- .../app/widget/WalletFragmentActionsView.java | 43 +- .../activity_add_custom_rpc_network.xml | 149 +++---- .../res/layout/item_erc1155_asset_select.xml | 17 +- app/src/main/res/layout/item_token.xml | 250 +++++------ app/src/main/res/layout/item_wallet.xml | 155 +++---- .../main/res/layout/layout_password_input.xml | 155 +++---- build.gradle | 73 +--- dmz/build.gradle | 19 +- gradle.properties | 31 +- gradle/libs.versions.toml | 116 +++++ gradle/wrapper/gradle-wrapper.properties | 6 +- hardware_stub/build.gradle | 10 +- lib/build.gradle | 46 +- .../token/tools/VerifyXMLDSig.java | 73 ---- .../token/tools/XMLDSigVerifier.java | 401 ------------------ settings.gradle | 46 +- util/build.gradle | 2 +- 29 files changed, 845 insertions(+), 1219 deletions(-) create mode 100644 gradle/libs.versions.toml delete mode 100644 lib/src/main/java/com/alphawallet/token/tools/VerifyXMLDSig.java delete mode 100644 lib/src/main/java/com/alphawallet/token/tools/XMLDSigVerifier.java diff --git a/app/build.gradle b/app/build.gradle index 2d77ff9b7a..2be7b1a8f2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,35 +1,21 @@ -//noinspection GradleDependency -// WARNING WARNING WARNING -// don't add any additional things here without first search "China" in this file - -buildscript { - repositories { - google() - mavenCentral() - maven { - url "https://plugins.gradle.org/m2/" - } - } - dependencies { - classpath "gradle.plugin.com.worker8.android_lint_reporter:android_lint_reporter:2.1.0" - classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.22.0" - classpath "com.dicedmelon.gradle:jacoco-android:0.1.5" - } + +plugins { + alias(libs.plugins.androidApplication) + id("com.worker8.android_lint_reporter") version "2.1.0" + id("io.gitlab.arturbosch.detekt") version "1.23.5" + id 'jacoco' } -// WARNING WARNING WARNING -// DON'T add any plugins that is Google Play Service or uses Google Play Service -// Search China in this file for the reason apply plugin: 'com.android.application' apply plugin: 'realm-android' apply plugin: 'kotlin-android' apply plugin: 'dagger.hilt.android.plugin' apply plugin: 'com.worker8.android_lint_reporter' apply plugin: 'io.gitlab.arturbosch.detekt' -apply plugin: 'com.dicedmelon.gradle.jacoco-android' +apply plugin: 'jacoco' jacoco { - toolVersion = "0.8.9" + toolVersion = "0.8.8" } tasks.withType(Test).configureEach { @@ -37,20 +23,6 @@ tasks.withType(Test).configureEach { jacoco.excludes = ['jdk.internal.*'] } -jacocoAndroidUnitTestReport { - csv.enabled false - html.enabled true - xml.enabled true -} - -jacocoAndroidUnitTestReport { - excludes += [ - '**/*Realm*.*', - '**/Generated*.*', - '**/*_*.*' - ] -} - detekt { toolVersion = "1.20.0-RC1" buildUponDefaultConfig = true // preconfigure defaults @@ -67,20 +39,25 @@ android_lint_reporter { } android { + namespace 'com.alphawallet.app' + compileSdk 34 + sourceSets { main { } } + defaultConfig { + applicationId "io.stormbird.wallet" + minSdk 24 + targetSdk 34 versionCode 256 versionName "3.77" - applicationId "io.stormbird.wallet" - minSdkVersion 24 - targetSdkVersion 33 - compileSdk 33 - testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' + android.buildFeatures.buildConfig true + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunnerArguments clearPackageData: 'true' def XInfuraAPI = "XInfuraAPI" //Put your Infura key here, NB with over 30 - 40 users this API key will rate limit, it's only here for bootstrapping a free build @@ -122,6 +99,7 @@ android { } } } + flavorDimensions.add("targetting") productFlavors { @@ -151,6 +129,7 @@ android { } } } + buildTypes { debug { minifyEnabled false @@ -181,9 +160,6 @@ android { targetCompatibility JavaVersion.VERSION_17 sourceCompatibility JavaVersion.VERSION_17 } - kotlinOptions { - jvmTarget = '17' - } externalNativeBuild { cmake { path "src/main/cpp/CMakeLists.txt" @@ -201,7 +177,9 @@ android { includeInApk false includeInBundle false } - namespace 'com.alphawallet.app' + buildFeatures { + viewBinding true + } lint { abortOnError false baseline file('./check/lint-baseline.xml') @@ -222,18 +200,23 @@ tasks.register("printVersionCode") { } } -dependencies { - implementation project(":lib") +tasks.register("jacocoAndroidUnitTestReport") { + reports { + csv.enabled false + html.enabled true + xml.enabled true + } + def fileFilter = ['**/R.class', '**/R$*.class', '**/*$ViewInjector*.*', '**/BuildConfig.*', '**/Manifest*.*', '**/*Realm*.*', '**/Generated*.*', '**/*_*.*'] + def debugTree = fileTree(dir: "**/", excludes: fileFilter) + def mainSrc = "${project.projectDir}/src/main/java" - // WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! - // WARNING! Don't add dependency on Google Play Services without consulting - // WARNING! The China marketing team - // WARNING! Many Chinese Android phones execute (meaning terminate) any app that - // WARNING! users google gms summarily, like immune systems cleansing infections - // WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! + sourceDirectories.setFrom(files([mainSrc])) + classDirectories.setFrom(files([debugTree])) +} + +dependencies { + implementation project(':lib') - // Ethereum client - //implementation "org.web3j:core:4.9.8" implementation fileTree(include: ['*.jar'], dir: 'libs') implementation fileTree(include: ['*.aar'], dir: 'libs') //NB: Downgrade jackson due to bug in 2.15 releases that makes it incompatible with Gradle 8 @@ -242,62 +225,64 @@ dependencies { implementation 'com.fasterxml.jackson.core:jackson-core' implementation 'com.fasterxml.jackson.core:jackson-databind' - implementation 'org.slf4j:slf4j-api:2.0.9' - implementation "androidx.core:core-splashscreen:1.0.1" + implementation libs.slf4j.api + implementation libs.core.splashscreen // Http client - implementation "com.squareup.okhttp3:okhttp:4.11.0" - implementation 'com.google.code.gson:gson:2.10.1' + implementation libs.okhttp + implementation libs.gson - implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'com.google.android.material:material:1.9.0' - implementation 'androidx.vectordrawable:vectordrawable:1.1.0' - implementation 'androidx.recyclerview:recyclerview:1.3.2' - implementation 'androidx.biometric:biometric:1.1.0' - implementation 'androidx.gridlayout:gridlayout:1.0.0' + implementation libs.appcompat + implementation libs.material //'com.google.android.material:material:1.9.0' + implementation libs.vectordrawable + implementation libs.recyclerview + implementation libs.biometric + implementation libs.gridlayout // Bar code scanning - implementation 'com.journeyapps:zxing-android-embedded:4.3.0' - implementation 'com.google.zxing:core:3.5.2' + implementation libs.zxing.android.embedded + implementation libs.core // Sugar - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + implementation libs.constraintlayout //coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.5' // ReactiveX - implementation 'io.reactivex.rxjava2:rxjava:2.2.21' - implementation "io.reactivex.rxjava2:rxandroid:2.1.1" + implementation libs.rxjava + implementation libs.rxandroid // Keyboard visibility - implementation 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:3.0.0-RC3' + implementation libs.keyboardvisibilityevent // Dagger 2 // dagger-hilt - implementation "com.google.dagger:hilt-android:2.48" - annotationProcessor "com.google.dagger:hilt-compiler:2.48" + implementation libs.hilt.android + annotationProcessor libs.hilt.compiler // WebKit - for WebView Dark Mode (NB Can't be upgraded from 1.7.0 until migration to Gradle 8) - implementation 'androidx.webkit:webkit:1.7.0' + implementation libs.webkit //Use Leak Canary for debug builds only //debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7' // Image Loader - implementation 'com.github.bumptech.glide:glide:4.13.0' - annotationProcessor 'com.github.bumptech.glide:compiler:4.13.0' - implementation group: 'com.google.guava', name: 'guava', version: '30.1.1-android' - implementation 'com.trustwallet:wallet-core:3.2.18' + implementation libs.glide + annotationProcessor libs.compiler + implementation libs.guava + implementation libs.wallet.core + //noinspection UseTomlInstead implementation 'com.github.florent37:TutoShowcase:d8b91be8a2' - implementation 'com.github.google:flexbox-layout:2.0.1' - implementation 'com.github.salomonbrys.kotson:kotson:2.5.0' - implementation 'com.github.mailchimp:mailchimp-sdk-android:1.0.0' - implementation 'androidx.preference:preference-ktx:1.2.1' + implementation libs.flexbox.layout + implementation libs.kotson + implementation libs.mailchimp.sdk.android + implementation libs.preference.ktx //Timber - implementation 'com.jakewharton.timber:timber:5.0.1' + implementation libs.timber + //noinspection UseTomlInstead implementation platform('com.walletconnect:android-bom:1.13.1') implementation("com.walletconnect:android-core", { exclude group: 'org.web3j', module: '*' @@ -306,20 +291,20 @@ dependencies { exclude group: 'org.web3j', module: '*' }) - runtimeOnly 'androidx.work:work-runtime-ktx:2.8.1' + runtimeOnly libs.work.runtime.ktx //Analytics - analyticsImplementation 'com.google.android.play:core:1.10.3' + analyticsImplementation libs.play.core - analyticsImplementation 'com.google.android.play:core:1.10.3' - analyticsImplementation 'com.google.firebase:firebase-analytics:21.5.0' - analyticsImplementation 'com.mixpanel.android:mixpanel-android:5.8.4' - analyticsImplementation 'com.google.firebase:firebase-crashlytics:18.5.1' + analyticsImplementation libs.play.core + analyticsImplementation libs.firebase.analytics + analyticsImplementation libs.mixpanel.android + analyticsImplementation libs.firebase.crashlytics // Notifications: NB there appears to be an incompatibility in the newer builds of firebase-messaging. // Update when resolved. //noinspection GradleDependency - implementation 'com.google.firebase:firebase-messaging:21.1.0' + implementation libs.firebase.messaging // @@ -330,7 +315,7 @@ dependencies { androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0' androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.3.0' - androidTestImplementation 'androidx.browser:browser:1.5.0' + androidTestImplementation 'androidx.browser:browser:1.8.0' // Unit tests testImplementation 'junit:junit:4.13.2' @@ -338,7 +323,7 @@ dependencies { testImplementation group: 'org.powermock', name: 'powermock-module-junit4-rule-agent', version: '2.0.9' testImplementation group: 'org.powermock', name: 'powermock-module-junit4', version: '2.0.9' testImplementation group: 'org.powermock', name: 'powermock-api-mockito2', version: '2.0.9' - testImplementation group: 'org.json', name: 'json', version: '20220320' + testImplementation group: 'org.json', name: 'json', version: '20240303' // Component tests: Updating these appears to break the tests. testImplementation 'org.robolectric:robolectric:4.8.2' @@ -358,8 +343,5 @@ dependencies { androidTestImplementation('tools.fastlane:screengrab:2.1.1', { exclude group: 'com.android.support', module: 'support-annotations' }) -} - -// WARNING WARNING WARNING -// don't add any additional things here without first search "China" in this file +} diff --git a/app/src/analytics/java/com/alphawallet/app/service/AnalyticsService.java b/app/src/analytics/java/com/alphawallet/app/service/AnalyticsService.java index 4ec45b8fe5..c2558f9c9c 100644 --- a/app/src/analytics/java/com/alphawallet/app/service/AnalyticsService.java +++ b/app/src/analytics/java/com/alphawallet/app/service/AnalyticsService.java @@ -11,14 +11,13 @@ import com.alphawallet.app.repository.PreferenceRepositoryType; import com.google.firebase.analytics.FirebaseAnalytics; import com.google.firebase.crashlytics.FirebaseCrashlytics; -import com.google.firebase.iid.FirebaseInstanceId; +import com.google.firebase.messaging.FirebaseMessaging; import com.mixpanel.android.mpmetrics.MixpanelAPI; import org.json.JSONException; import org.json.JSONObject; import java.util.Iterator; -import java.util.Objects; import timber.log.Timber; @@ -31,7 +30,7 @@ public class AnalyticsService implements AnalyticsServiceType public AnalyticsService(Context context, PreferenceRepositoryType preferenceRepository) { this.preferenceRepository = preferenceRepository; - mixpanelAPI = MixpanelAPI.getInstance(context, KeyProviderFactory.get().getAnalyticsKey()); + mixpanelAPI = MixpanelAPI.getInstance(context, KeyProviderFactory.get().getAnalyticsKey(), false); firebaseAnalytics = FirebaseAnalytics.getInstance(context); } @@ -115,14 +114,14 @@ public void identify(String uuid) mixpanelAPI.getPeople().identify(uuid); mixpanelAPI.getPeople().set(Analytics.UserProperties.APPLICATION_ID.getValue(), BuildConfig.APPLICATION_ID); - FirebaseInstanceId.getInstance().getInstanceId() - .addOnCompleteListener(task -> { - if (task.isSuccessful()) - { - String token = Objects.requireNonNull(task.getResult()).getToken(); - mixpanelAPI.getPeople().setPushRegistrationId(token); - } - }); + FirebaseMessaging.getInstance().getToken() + .addOnCompleteListener(task -> { + if (task.isSuccessful()) + { + String token = task.getResult(); + mixpanelAPI.getPeople().setPushRegistrationId(token); + } + }); } } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 8d9c1a8939..7802b1102f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ @@ -15,6 +14,8 @@ + + + android:enabled="true" + android:exported="false" + android:foregroundServiceType="connectedDevice"> + 0.0) - { - confirmPurchaseDialog(); - } - else - { - onProgress(true); - completeImport(); - } + public void onClick(View v) + { + if (v.getId() == R.id.import_ticket) + { + if (ticketRange != null) + { + if (viewModel.getSalesOrder().price > 0.0) + { + confirmPurchaseDialog(); } - else if (viewModel.getSalesOrder().contractType == currencyLink) + else { onProgress(true); - completeCurrencyImport(); + completeImport(); } - break; - case cancel_button: - //go to main screen - new HomeRouter().open(this, true); - finish(); - break; + } + else if (viewModel.getSalesOrder().contractType == currencyLink) + { + onProgress(true); + completeCurrencyImport(); + } + } + else if (v.getId() == R.id.cancel_button) + { + new HomeRouter().open(this, true); + finish(); } } diff --git a/app/src/main/java/com/alphawallet/app/ui/RedeemAssetSelectActivity.java b/app/src/main/java/com/alphawallet/app/ui/RedeemAssetSelectActivity.java index 8ef9200e07..b001379383 100644 --- a/app/src/main/java/com/alphawallet/app/ui/RedeemAssetSelectActivity.java +++ b/app/src/main/java/com/alphawallet/app/ui/RedeemAssetSelectActivity.java @@ -137,18 +137,17 @@ protected void onDestroy() public boolean onOptionsItemSelected(MenuItem item) { final int action_next = R.id.action_next; final int action_redeem = R.id.action_redeem; - switch (item.getItemId()) { - case action_next: { - onNext(); - } - break; - case action_redeem: { - onRedeem(); - } - break; - case android.R.id.home: { - finish(); - } + if (item.getItemId() == R.id.action_next) + { + onNext(); + } + else if (item.getItemId() == R.id.action_redeem) + { + onRedeem(); + } + else if (item.getItemId() == android.R.id.home) + { + finish(); } return super.onOptionsItemSelected(item); } diff --git a/app/src/main/java/com/alphawallet/app/ui/WalletsActivity.java b/app/src/main/java/com/alphawallet/app/ui/WalletsActivity.java index d3988f7e8e..100cd17668 100644 --- a/app/src/main/java/com/alphawallet/app/ui/WalletsActivity.java +++ b/app/src/main/java/com/alphawallet/app/ui/WalletsActivity.java @@ -278,19 +278,14 @@ public boolean onCreateOptionsMenu(Menu menu) @Override public boolean onOptionsItemSelected(MenuItem item) { - final int action_add = R.id.action_add; - switch (item.getItemId()) + if (item.getItemId() == R.id.action_add) { - case action_add: - { - onAddWallet(); - } - break; - case android.R.id.home: - { - onBackPressed(); - return true; - } + onAddWallet(); + } + else if (item.getItemId() == android.R.id.home) + { + onBackPressed(); + return true; } return super.onOptionsItemSelected(item); } diff --git a/app/src/main/java/com/alphawallet/app/ui/widget/holder/WalletHolder.java b/app/src/main/java/com/alphawallet/app/ui/widget/holder/WalletHolder.java index aab32f565d..1417c405d4 100644 --- a/app/src/main/java/com/alphawallet/app/ui/widget/holder/WalletHolder.java +++ b/app/src/main/java/com/alphawallet/app/ui/widget/holder/WalletHolder.java @@ -222,22 +222,19 @@ private void checkLastBackUpTime() { } @Override - public void onClick(View view) { - //if (wallet == null) { return; } //protect against click between constructor and bind - final int wallet_click_layer = R.id.wallet_click_layer; - final int layout_manage_wallet = R.id.layout_manage_wallet; - switch (view.getId()) { - case wallet_click_layer: - clickCallback.onWalletClicked(wallet); - break; - - case layout_manage_wallet: - Intent intent = new Intent(getContext(), WalletActionsActivity.class); - intent.putExtra("wallet", wallet); - intent.putExtra("currency", wallet.balanceSymbol); - intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); - getContext().startActivity(intent); - break; + public void onClick(View view) + { + if (view.getId() == R.id.wallet_click_layer) + { + clickCallback.onWalletClicked(wallet); + } + else if (view.getId() == R.id.wallet_click_layer) + { + Intent intent = new Intent(getContext(), WalletActionsActivity.class); + intent.putExtra("wallet", wallet); + intent.putExtra("currency", wallet.balanceSymbol); + intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); + getContext().startActivity(intent); } } diff --git a/app/src/main/java/com/alphawallet/app/ui/widget/holder/WalletSummaryHolder.java b/app/src/main/java/com/alphawallet/app/ui/widget/holder/WalletSummaryHolder.java index 663ddd5589..d0e9f175b4 100644 --- a/app/src/main/java/com/alphawallet/app/ui/widget/holder/WalletSummaryHolder.java +++ b/app/src/main/java/com/alphawallet/app/ui/widget/holder/WalletSummaryHolder.java @@ -263,20 +263,17 @@ private void checkLastBackUpTime() @Override public void onClick(View view) { - //if (wallet == null) { return; } //protect against click between constructor and bind - switch (view.getId()) + if (view.getId() == R.id.container) { - case R.id.container: - clickCallback.onWalletClicked(wallet); - break; - - case R.id.layout_manage_wallet: - Intent intent = new Intent(getContext(), WalletActionsActivity.class); - intent.putExtra("wallet", wallet); - intent.putExtra("currency", wallet.balanceSymbol); - intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); - getContext().startActivity(intent); - break; + clickCallback.onWalletClicked(wallet); + } + else if (view.getId() == R.id.layout_manage_wallet) + { + Intent intent = new Intent(getContext(), WalletActionsActivity.class); + intent.putExtra("wallet", wallet); + intent.putExtra("currency", wallet.balanceSymbol); + intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); + getContext().startActivity(intent); } } diff --git a/app/src/main/java/com/alphawallet/app/widget/AddWalletView.java b/app/src/main/java/com/alphawallet/app/widget/AddWalletView.java index 076f86bf0e..8a0f671dd4 100644 --- a/app/src/main/java/com/alphawallet/app/widget/AddWalletView.java +++ b/app/src/main/java/com/alphawallet/app/widget/AddWalletView.java @@ -39,56 +39,40 @@ private void init(@LayoutRes int layoutId) { @Override public void onClick(View view) { - - final int close_action = R.id.close_action; - final int new_account_action = R.id.new_account_action; - final int import_account_action = R.id.import_account_action; - final int watch_account_action = R.id.watch_account_action; - final int hardware_card = R.id.hardware_card; - - switch (view.getId()) + if (view.getId() == R.id.close_action) { - case close_action: + if (onCloseActionListener != null) { - if (onCloseActionListener != null) - { - onCloseActionListener.onClose(view); - } - break; + onCloseActionListener.onClose(view); } - case new_account_action: + } + else if (view.getId() == R.id.new_account_action) + { + if (onNewWalletClickListener != null) { - if (onNewWalletClickListener != null) - { - onNewWalletClickListener.onNewWallet(view); - } - break; + onNewWalletClickListener.onNewWallet(view); } - case import_account_action: + } + else if (view.getId() == R.id.import_account_action) + { + if (onImportWalletClickListener != null) { - if (onImportWalletClickListener != null) - { - onImportWalletClickListener.onImportWallet(view); - } - break; + onImportWalletClickListener.onImportWallet(view); } - case watch_account_action: + } + else if (view.getId() == R.id.watch_account_action) + { + if (onWatchWalletClickListener != null) { - if (onWatchWalletClickListener != null) - { - onWatchWalletClickListener.onWatchWallet(view); - } - break; + onWatchWalletClickListener.onWatchWallet(view); } - case hardware_card: + } + else if (view.getId() == R.id.hardware_card) + { + if (onHardwareCardClickListener != null) { - if (onHardwareCardClickListener != null) - { - onHardwareCardClickListener.detectCard(view); - } + onHardwareCardClickListener.detectCard(view); } - default: - break; } } diff --git a/app/src/main/java/com/alphawallet/app/widget/QRCodeActionsView.java b/app/src/main/java/com/alphawallet/app/widget/QRCodeActionsView.java index d9a72d9caf..f0932f6bff 100644 --- a/app/src/main/java/com/alphawallet/app/widget/QRCodeActionsView.java +++ b/app/src/main/java/com/alphawallet/app/widget/QRCodeActionsView.java @@ -36,52 +36,41 @@ private void init(@LayoutRes int layoutId) { findViewById(R.id.close_action).setOnClickListener(this); } - //TODO: Refactor with if/else @Override - public void onClick(View view) { - - final int send_to_this_address_action = R.id.send_to_this_address_action; - final int add_custom_token_action = R.id.add_custom_token_action; - final int watch_account_action = R.id.watch_account_action; - final int open_in_etherscan_action = R.id.open_in_etherscan_action; - final int close_action = R.id.close_action; - - switch (view.getId()) { - case send_to_this_address_action: { - if (onSendToAddressClickListener != null) { - onSendToAddressClickListener.onClick(view); - } - break; + public void onClick(View view) + { + if (view.getId() == R.id.send_to_this_address_action) + { + if (onSendToAddressClickListener != null) { + onSendToAddressClickListener.onClick(view); } - case add_custom_token_action: { - if (onAddCustonTokenClickListener != null) { - onAddCustonTokenClickListener.onClick(view); - } - break; + } + else if (view.getId() == R.id.add_custom_token_action) + { + if (onAddCustonTokenClickListener != null) { + onAddCustonTokenClickListener.onClick(view); } - case watch_account_action: { - if (onWatchWalletClickListener != null) { - onWatchWalletClickListener.onClick(view); - } - break; - + } + else if (view.getId() == R.id.watch_account_action) + { + if (onWatchWalletClickListener != null) { + onWatchWalletClickListener.onClick(view); } - case open_in_etherscan_action: { - if (onOpenInEtherscanClickListener != null) { - onOpenInEtherscanClickListener.onClick(view); - } - break; + } + else if (view.getId() == R.id.open_in_etherscan_action) + { + if (onOpenInEtherscanClickListener != null) { + onOpenInEtherscanClickListener.onClick(view); } - case close_action: { - if (onCloseActionListener != null) { - onCloseActionListener.onClick(view); - } - break; + } + else if (view.getId() == R.id.close_action) + { + if (onCloseActionListener != null) { + onCloseActionListener.onClick(view); } } } - public void setOnSendToAddressClickListener(OnClickListener onSendToAddressClickListener) { this.onSendToAddressClickListener = onSendToAddressClickListener; } diff --git a/app/src/main/java/com/alphawallet/app/widget/SignTransactionDialog.java b/app/src/main/java/com/alphawallet/app/widget/SignTransactionDialog.java index 3f60a5c579..9a7a6d99d3 100644 --- a/app/src/main/java/com/alphawallet/app/widget/SignTransactionDialog.java +++ b/app/src/main/java/com/alphawallet/app/widget/SignTransactionDialog.java @@ -83,7 +83,7 @@ public void onAuthenticationError(int errorCode, authCallback.authenticateFail(activity.getString(R.string.too_many_fails), AuthenticationFailType.FINGERPRINT_NOT_VALIDATED, callbackId); break; case BiometricPrompt.ERROR_USER_CANCELED: - authCallback.authenticateFail(activity.getString(R.string.fingerprint_error_user_canceled), AuthenticationFailType.AUTHENTICATION_DIALOG_CANCELLED, callbackId); + authCallback.authenticateFail(activity.getString(androidx.biometric.R.string.fingerprint_error_user_canceled), AuthenticationFailType.AUTHENTICATION_DIALOG_CANCELLED, callbackId); break; case BiometricPrompt.ERROR_HW_NOT_PRESENT: case BiometricPrompt.ERROR_HW_UNAVAILABLE: diff --git a/app/src/main/java/com/alphawallet/app/widget/WalletFragmentActionsView.java b/app/src/main/java/com/alphawallet/app/widget/WalletFragmentActionsView.java index d2db27dda4..adeaf37f83 100644 --- a/app/src/main/java/com/alphawallet/app/widget/WalletFragmentActionsView.java +++ b/app/src/main/java/com/alphawallet/app/widget/WalletFragmentActionsView.java @@ -35,31 +35,30 @@ private void init(@LayoutRes int layoutId) { } @Override - public void onClick(View view) { - switch (view.getId()) { - - case R.id.copy_wallet_address_action: { - if (onCopyWalletAddressClickListener != null) { - onCopyWalletAddressClickListener.onClick(view); - } - break; + public void onClick(View view) + { + if (view.getId() == R.id.copy_wallet_address_action) + { + if (onCopyWalletAddressClickListener != null) { + onCopyWalletAddressClickListener.onClick(view); } - case R.id.show_my_wallet_address_action: { - if (onShowMyWalletAddressClickListener != null) { - onShowMyWalletAddressClickListener.onClick(view); - } - break; + } + else if (view.getId() == R.id.show_my_wallet_address_action) + { + if (onShowMyWalletAddressClickListener != null) { + onShowMyWalletAddressClickListener.onClick(view); } - case R.id.add_hide_tokens_action: { - if (onAddHideTokensClickListener != null) { - onAddHideTokensClickListener.onClick(view); - } - break; + } + else if (view.getId() == R.id.add_hide_tokens_action) + { + if (onAddHideTokensClickListener != null) { + onAddHideTokensClickListener.onClick(view); } - case R.id.rename_this_wallet_action: { - if (onRenameThisWalletListener != null) { - onRenameThisWalletListener.onClick(view); - } + } + else if (view.getId() == R.id.rename_this_wallet_action) + { + if (onRenameThisWalletListener != null) { + onRenameThisWalletListener.onClick(view); } } } diff --git a/app/src/main/res/layout/activity_add_custom_rpc_network.xml b/app/src/main/res/layout/activity_add_custom_rpc_network.xml index b6c35d629a..78642d4255 100644 --- a/app/src/main/res/layout/activity_add_custom_rpc_network.xml +++ b/app/src/main/res/layout/activity_add_custom_rpc_network.xml @@ -1,108 +1,113 @@ + xmlns:custom="http://schemas.android.com/apk/res-auto" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> - - + android:layout_height="match_parent" + android:layout_above="@id/layoutButtons" + android:layout_below="@id/toolbar"> - + android:focusable="true" + android:focusableInTouchMode="true" + android:orientation="vertical"> + android:id="@+id/input_network_name" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="@dimen/standard_16" + custom:label="@string/hint_network_name" /> + android:id="@+id/input_network_rpc_url" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="@dimen/standard_16" + custom:label="@string/hint_network_rpc_url" /> + android:id="@+id/input_network_chain_id" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="@dimen/standard_16" + custom:inputType="number" + custom:label="@string/hint_network_chain_id" /> + android:id="@+id/input_network_symbol" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="@dimen/standard_16" + custom:label="@string/hint_network_symbol" /> + android:id="@+id/input_network_block_explorer_url" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="@dimen/standard_16" + custom:label="@string/hint_network_block_explorer_url" /> + + + android:id="@+id/testnet_frame" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + android:layout_width="match_parent" + android:layout_height="50dp" + android:gravity="center_vertical" + android:paddingStart="@dimen/standard_16" + android:paddingEnd="@dimen/standard_16" + android:text="@string/this_is_testnet" + android:textAllCaps="false"/> + android:id="@+id/checkbox_testnet" + android:layout_width="wrap_content" + android:layout_gravity="center_vertical|end" + android:layout_marginEnd="@dimen/small_12" + app:useMaterialThemeColors="false" + app:buttonTint="@color/selector_button_tint" + tools:checked="true" + android:layout_height="wrap_content" /> + android:id="@+id/testnet_switch" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical|end" + android:layout_marginEnd="@dimen/small_12" + android:clickable="true" + android:focusable="true" + android:visibility="gone" /> + android:id="@+id/layoutButtons" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_alignParentBottom="true" /> diff --git a/app/src/main/res/layout/item_erc1155_asset_select.xml b/app/src/main/res/layout/item_erc1155_asset_select.xml index a72d39ee35..97e891e0ed 100644 --- a/app/src/main/res/layout/item_erc1155_asset_select.xml +++ b/app/src/main/res/layout/item_erc1155_asset_select.xml @@ -128,13 +128,16 @@ tools:visibility="visible" /> + android:id="@+id/checkbox" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + app:useMaterialThemeColors="false" + app:buttonTint="@color/selector_button_tint" + tools:checked="true" + android:clickable="false" + android:visibility="gone" + tools:visibility="visible" /> diff --git a/app/src/main/res/layout/item_token.xml b/app/src/main/res/layout/item_token.xml index 0dab03d0fd..fde8cca578 100644 --- a/app/src/main/res/layout/item_token.xml +++ b/app/src/main/res/layout/item_token.xml @@ -1,173 +1,177 @@ + xmlns:tools="http://schemas.android.com/tools" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/token_layout" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:clickable="true" + android:focusable="true"> + android:id="@+id/select_token" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerVertical="true" + app:useMaterialThemeColors="false" + app:buttonTint="@color/selector_button_tint" + tools:checked="true" + android:visibility="gone" + tools:visibility="visible" /> - - + android:layout_alignParentTop="true" + android:layout_toEndOf="@id/select_token" + android:orientation="vertical" + android:padding="@dimen/standard_16"> - - - - - - - - - + android:orientation="horizontal"> - + - + android:orientation="vertical"> - - - - + android:layout_marginEnd="@dimen/standard_16" + android:layout_weight="1" + android:ellipsize="end" + android:singleLine="true" + tools:text="Ethereum" /> - - + - + android:baselineAligned="false" + android:orientation="horizontal"> - + android:layout_weight="1" + android:gravity="center_vertical" + android:orientation="horizontal"> - + + + + + + + + + android:visibility="gone" + tools:visibility="visible"> - + android:layout_marginEnd="@dimen/tiny_8" + android:text="@string/unknown_balance_without_symbol" + tools:text="$3.47" /> - + android:orientation="horizontal" + android:padding="2dp" + tools:ignore="UseCompoundDrawables"> + + + + + android:id="@+id/ticker_progress" + android:layout_width="@dimen/token_icon_small" + android:layout_height="@dimen/token_icon_small" /> diff --git a/app/src/main/res/layout/item_wallet.xml b/app/src/main/res/layout/item_wallet.xml index 10a0c0d90a..90a82cf322 100644 --- a/app/src/main/res/layout/item_wallet.xml +++ b/app/src/main/res/layout/item_wallet.xml @@ -1,108 +1,113 @@ + xmlns:tools="http://schemas.android.com/tools" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:descendantFocusability="blocksDescendants" + android:focusable="false" + android:orientation="horizontal" + android:paddingHorizontal="@dimen/standard_16"> + android:id="@+id/layout_icon" + android:layout_width="@dimen/token_icon" + android:layout_height="@dimen/token_icon" + android:layout_alignParentStart="true" + android:layout_centerVertical="true" + android:gravity="center_vertical" + android:orientation="horizontal"> + android:id="@+id/wallet_icon" + android:layout_width="@dimen/token_icon" + android:layout_height="@dimen/token_icon" /> - - + android:layout_centerVertical="true" + android:layout_marginStart="@dimen/tiny_8" + android:layout_toEndOf="@id/layout_icon" + android:orientation="vertical" + tools:ignore="RelativeOverlap"> - + android:orientation="horizontal" + android:visibility="gone"> + android:id="@+id/wallet_balance" + style="@style/Aw.Typography.Caption" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:textIsSelectable="true" + tools:text="0" /> + + - - + android:orientation="horizontal"> + android:id="@+id/wallet_name" + style="@style/Aw.Typography.Caption" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + tools:text="user.eth" /> + android:id="@+id/wallet_address_separator" + style="@style/Aw.Typography.Caption" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingLeft="@dimen/mini_4" + android:paddingRight="@dimen/mini_4" + android:text="|" + tools:ignore="HardcodedText" /> + + + android:id="@+id/checkbox" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentEnd="true" + android:layout_centerVertical="true" + android:contentDescription="Selection" + app:useMaterialThemeColors="false" + app:buttonTint="@color/selector_button_tint" + tools:checked="true" + tools:visibility="visible" + android:visibility="gone" + tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/layout/layout_password_input.xml b/app/src/main/res/layout/layout_password_input.xml index 6490596870..e1bc43e150 100644 --- a/app/src/main/res/layout/layout_password_input.xml +++ b/app/src/main/res/layout/layout_password_input.xml @@ -1,97 +1,98 @@ + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + android:id="@+id/box_layout" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/tiny_8"> + android:id="@+id/edit_text" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_alignParentStart="true" + android:layout_alignParentTop="true" + android:layout_marginStart="@dimen/standard_16" + android:layout_marginEnd="@dimen/standard_16" + android:background="@drawable/background_password_entry" + android:imeOptions="actionDone" + android:inputType="textMultiLine|textNoSuggestions" + android:minHeight="56dp" + android:paddingStart="@dimen/standard_16" + android:paddingTop="@dimen/tiny_8" + android:paddingEnd="@dimen/standard_16" + android:paddingBottom="@dimen/tiny_8" + tools:hint="Password" /> + android:id="@+id/toggle_password" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:padding="8dp" + android:layout_alignParentEnd="true" + android:layout_centerVertical="true" + android:layout_marginEnd="@dimen/standard_16" + android:button="@drawable/selector_show_password" + android:visibility="gone" + tools:visibility="visible" /> + android:id="@+id/label" + style="@style/Aw.Typography.Label.Small" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="@dimen/comfy_28" + android:layout_marginBottom="@dimen/mini_4" + android:background="?colorSurface" + android:paddingStart="@dimen/mini_4" + android:paddingEnd="@dimen/mini_4" + android:visibility="invisible" + tools:text="Label" + tools:visibility="visible" /> + android:id="@+id/error" + style="@style/Aw.Typography.Sub" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/box_layout" + android:layout_alignParentEnd="true" + android:layout_marginEnd="@dimen/standard_16" + android:textColor="?colorError" + android:visibility="gone" + tools:text="Error Text" + tools:visibility="visible" /> + android:id="@+id/text_word_count" + style="@style/Aw.Typography.Sub.Small" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignBottom="@id/box_layout" + android:layout_alignParentEnd="true" + android:layout_marginEnd="@dimen/cozy_20" + android:layout_marginBottom="1dp" + android:gravity="center_horizontal" + android:visibility="gone" + tools:text="0/12" + tools:visibility="visible" /> + android:id="@+id/instruction" + style="@style/Aw.Typography.Sub" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/box_layout" + android:layout_alignParentEnd="true" + android:layout_marginEnd="@dimen/standard_16" + android:visibility="gone" + tools:text="Instruction" + tools:visibility="visible" /> \ No newline at end of file diff --git a/build.gradle b/build.gradle index 2b5610a4ba..5a1fe3edc2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,6 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + + buildscript { repositories { // don't add anything here until you read to the bottom of this bracket @@ -9,72 +12,24 @@ buildscript { // don't do that. add that repository to app/build.gradle } dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' - //NB - there is an issue with newer versions of gradle. The APK balloons out, so far haven't diagnosed why. - //If you want to try upgrading gradle plugin past 3.5.4 you will need to also diagnose the APK ballooning issue. - classpath "io.realm:realm-gradle-plugin:10.18.0" + classpath libs.gradle + classpath libs.realm.gradle.plugin // WARNING WARNING WARNING // you are about to add here a dependency to be used in the Android app // don't do that. add that dependency to app/build.gradle - classpath 'com.google.gms:google-services:4.4.0' - classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0' - classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9' - classpath 'com.google.dagger:hilt-android-gradle-plugin:2.48' + classpath libs.google.services + classpath libs.kotlin.gradle.plugin + classpath libs.firebase.crashlytics.gradle + classpath libs.hilt.android.gradle.plugin } } -allprojects { - repositories { - google() - mavenCentral() - maven { url = uri("https://jitpack.io") } - maven { url = uri("https://maven.pkg.github.com/trustwallet/wallet-core") - credentials { - username = getGitHubUsername() as String?: System.getenv("GITHUB_USER") - password = getPAT() as String?: System.getenv("GITHUB_TOKEN") - } - } - // WARNING WARNING WARNING - // you are about to add here a repository which provides some library for the Android app - // don't do that. add that repository to app/build.gradle - } - - configurations.configureEach { - resolutionStrategy { - force 'com.google.firebase:firebase-analytics:16.5.0' - } - } - - tasks.withType(Test).configureEach { - maxParallelForks = 2 - forkEvery = 80 - maxHeapSize = "2048m" - minHeapSize = "1024m" - } -} - -tasks.register("clean") { - delete rootProject.buildDir +plugins { + alias(libs.plugins.androidApplication) apply false } -gradle.projectsEvaluated({ - def username = getGitHubUsername() - def password = getPAT() - if (!username || !password) { - throw new GradleException('Please provide GitHub username and Personal Access Token. Find more here https://github.com/alphaWallet/alpha-wallet-android#getting-started') +configurations.configureEach { + resolutionStrategy { + force 'com.google.firebase:firebase-analytics:16.5.0' } -}) - -private String getGitHubUsername() { - project.findProperty("gpr.user") -} - -private String getPAT() { - def encodedToken = project.findProperty("gpr.key") - def firstEncode = new String(encodedToken.decodeBase64()) - new String(firstEncode.decodeBase64()) } - -//task clean(type: Delete) { -// delete rootProject.buildDir -//} diff --git a/dmz/build.gradle b/dmz/build.gradle index e68ece9eb7..c2820830f2 100644 --- a/dmz/build.gradle +++ b/dmz/build.gradle @@ -1,10 +1,7 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.2.RELEASE") - } +// TODO: DMZ not buildable until Gradle v8 is ready. Use previous snapshot for DMZ until fixed + +plugins { + id 'org.springframework.boot' version '2.2.2.RELEASE' } apply plugin: 'java' @@ -17,9 +14,11 @@ bootJar { launchScript() } -repositories { - mavenCentral() -} +/* +dependencies { + classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.2.RELEASE") + } + */ sourceCompatibility = 1.8 targetCompatibility = 1.8 diff --git a/gradle.properties b/gradle.properties index 0842382cd3..a337e45051 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,13 +1,28 @@ -## This file *is* checked into Version Control Systems, -# as it contains information specific to this project. - -# for most projects, the default setting for gradle, -# MaxMetaspaceSize=256m should be sufficent but this project has grown -# bigger than typical. +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. For more details, visit +# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app's APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true android.enableJetifier=true android.jetifier.ignorelist=bcprov-jdk15on,bcprov-jdk18on,com.squareup.moshi -android.useAndroidX=true -org.gradle.jvmargs=-Xms2048m -Xmx4096m +org.gradle.configuration-cache=true + +# Enables namespacing of each library's R class so that its R class includes only the +# resources declared in the library itself and none from the library's dependencies, +# thereby reducing the size of the R class for that library +android.nonTransitiveRClass=true # Base64 Encoded GitHub PAT, # Make sure only check read:packages and read:user permissions if you want to create your own PAT, diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000000..690960c8fd --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,116 @@ +[versions] +agp = "8.3.0" +android_lint_reporter = "2.1.0" +androidBom = "1.23.0" +bcprovJdk15onVersion = "1.70" +bcprovJdk18onVersion = "1.77" +biometric = "1.1.0" +compiler = "4.16.0" +core = "3.5.3" +coreSplashscreen = "1.0.1" +coreVersion = "1.10.3" +detektGradlePlugin = "1.23.5" +firebaseAnalytics = "21.5.1" +firebaseCrashlytics = "18.6.2" +firebaseCrashlyticsGradle = "2.9.9" +firebaseMessaging = "23.4.1" +flexboxLayout = "2.0.1" +glide = "4.16.0" +googleServices = "4.4.1" +gradle = "8.3.0" +gridlayout = "1.0.0" +gson = "2.10.1" +guava = "30.1.1-android" +hiltAndroidGradlePlugin = "2.48" +jacocoAndroid = "0.1.5" +jsonSimple = "4.0.1" +junit = "4.13.2" +junitVersion = "1.1.5" +espressoCore = "3.5.1" +appcompat = "1.6.1" +keyboardvisibilityevent = "3.0.0-RC3" +kotlinGradlePlugin = "1.8.0" +kotson = "2.5.0" +mailchimpSdkAndroid = "1.0.0" +material = "1.11.0" +constraintlayout = "2.1.4" +lifecycleLivedataKtx = "2.7.0" +lifecycleViewmodelKtx = "2.7.0" +mixpanelAndroid = "5.8.4" +navigationFragment = "2.7.7" +navigationUi = "2.7.7" +okhttp = "4.12.0" +preferenceKtx = "1.2.1" +realmGradlePlugin = "10.18.0" +recyclerview = "1.3.2" +rxjava = "2.2.21" +rxandroid = "2.1.1" +slf4jApi = "2.0.9" +springBootGradlePlugin = "2.2.2.RELEASE" +timber = "5.0.1" +vectordrawable = "1.1.0" +walletCore = "3.2.18" +webkit = "1.10.0" +workRuntimeKtx = "2.9.0" +zxingAndroidEmbedded = "4.3.0" + +[libraries] +android-bom = { module = "com.walletconnect:android-bom", version.ref = "androidBom" } +android_lint_reporter = { module = "gradle.plugin.com.worker8.android_lint_reporter:android_lint_reporter", version.ref = "android_lint_reporter" } +biometric = { module = "androidx.biometric:biometric", version.ref = "biometric" } +bouncycastle-bcprov-jdk15on = { module = "org.bouncycastle:bcprov-jdk15on", version.ref = "bcprovJdk15onVersion" } +bouncycastle-bcprov-jdk18on = { module = "org.bouncycastle:bcprov-jdk18on", version.ref = "bcprovJdk18onVersion" } +compiler = { module = "com.github.bumptech.glide:compiler", version.ref = "compiler" } +core = { module = "com.google.zxing:core", version.ref = "core" } +core-splashscreen = { module = "androidx.core:core-splashscreen", version.ref = "coreSplashscreen" } +detekt-gradle-plugin = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "detektGradlePlugin" } +firebase-analytics = { module = "com.google.firebase:firebase-analytics", version.ref = "firebaseAnalytics" } +firebase-crashlytics = { module = "com.google.firebase:firebase-crashlytics", version.ref = "firebaseCrashlytics" } +firebase-crashlytics-gradle = { module = "com.google.firebase:firebase-crashlytics-gradle", version.ref = "firebaseCrashlyticsGradle" } +firebase-messaging = { module = "com.google.firebase:firebase-messaging", version.ref = "firebaseMessaging" } +flexbox-layout = { module = "com.github.google:flexbox-layout", version.ref = "flexboxLayout" } +glide = { module = "com.github.bumptech.glide:glide", version.ref = "glide" } +google-services = { module = "com.google.gms:google-services", version.ref = "googleServices" } +gradle = { module = "com.android.tools.build:gradle", version.ref = "gradle" } +gridlayout = { module = "androidx.gridlayout:gridlayout", version.ref = "gridlayout" } +gson = { module = "com.google.code.gson:gson", version.ref = "gson" } +guava = { module = "com.google.guava:guava", version.ref = "guava" } +hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hiltAndroidGradlePlugin" } +hilt-android-gradle-plugin = { module = "com.google.dagger:hilt-android-gradle-plugin", version.ref = "hiltAndroidGradlePlugin" } +hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hiltAndroidGradlePlugin" } +jacoco-android = { module = "com.dicedmelon.gradle:jacoco-android", version.ref = "jacocoAndroid" } +json-simple = { module = "com.github.cliftonlabs:json-simple", version.ref = "jsonSimple" } +junit = { group = "junit", name = "junit", version.ref = "junit" } +ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" } +espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" } +appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" } +keyboardvisibilityevent = { module = "net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent", version.ref = "keyboardvisibilityevent" } +kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlinGradlePlugin" } +kotson = { module = "com.github.salomonbrys.kotson:kotson", version.ref = "kotson" } +mailchimp-sdk-android = { module = "com.github.mailchimp:mailchimp-sdk-android", version.ref = "mailchimpSdkAndroid" } +material = { group = "com.google.android.material", name = "material", version.ref = "material" } +constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" } +lifecycle-livedata-ktx = { group = "androidx.lifecycle", name = "lifecycle-livedata-ktx", version.ref = "lifecycleLivedataKtx" } +lifecycle-viewmodel-ktx = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "lifecycleViewmodelKtx" } +mixpanel-android = { module = "com.mixpanel.android:mixpanel-android", version.ref = "mixpanelAndroid" } +navigation-fragment = { group = "androidx.navigation", name = "navigation-fragment", version.ref = "navigationFragment" } +navigation-ui = { group = "androidx.navigation", name = "navigation-ui", version.ref = "navigationUi" } +okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" } +play-core = { module = "com.google.android.play:core", version.ref = "coreVersion" } +preference-ktx = { module = "androidx.preference:preference-ktx", version.ref = "preferenceKtx" } +realm-gradle-plugin = { module = "io.realm:realm-gradle-plugin", version.ref = "realmGradlePlugin" } +recyclerview = { module = "androidx.recyclerview:recyclerview", version.ref = "recyclerview" } +rxjava = { module = "io.reactivex.rxjava2:rxjava", version.ref = "rxjava" } +rxandroid = { module = "io.reactivex.rxjava2:rxandroid", version.ref = "rxandroid" } +slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4jApi" } +spring-boot-gradle-plugin = { module = "org.springframework.boot:spring-boot-gradle-plugin", version.ref = "springBootGradlePlugin" } +timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" } +vectordrawable = { module = "androidx.vectordrawable:vectordrawable", version.ref = "vectordrawable" } +wallet-core = { module = "com.trustwallet:wallet-core", version.ref = "walletCore" } +webkit = { module = "androidx.webkit:webkit", version.ref = "webkit" } +work-runtime-ktx = { module = "androidx.work:work-runtime-ktx", version.ref = "workRuntimeKtx" } +zxing-android-embedded = { module = "com.journeyapps:zxing-android-embedded", version.ref = "zxingAndroidEmbedded" } + +[plugins] +androidApplication = { id = "com.android.application", version.ref = "agp" } + diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 096a3b1018..cdf8663b75 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Apr 22 09:46:44 IST 2022 +#Sat Mar 09 17:11:16 AEDT 2024 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip distributionPath=wrapper/dists -zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/hardware_stub/build.gradle b/hardware_stub/build.gradle index ded82c8ca0..d03ef5b8c3 100644 --- a/hardware_stub/build.gradle +++ b/hardware_stub/build.gradle @@ -4,11 +4,11 @@ plugins { android { namespace 'com.alphawallet.hardware' + compileSdk 34 defaultConfig { minSdk 24 - compileSdk 33 - targetSdkVersion 33 + targetSdk 34 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" @@ -28,7 +28,7 @@ android { dependencies { - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.5' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' + testImplementation libs.junit + androidTestImplementation libs.ext.junit + androidTestImplementation libs.espresso.core } diff --git a/lib/build.gradle b/lib/build.gradle index 7971d6bdd8..e31be6432c 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -1,33 +1,45 @@ -buildscript { - repositories { - google() - jcenter() - mavenCentral() - maven { url 'https://jitpack.io' } - maven { url 'https://plugins.gradle.org/m2/' } +plugins { + id 'com.android.library' +} + +android { + namespace 'com.alphawallet' + compileSdk 34 + + defaultConfig { + minSdk 24 + targetSdk 34 + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles "consumer-rules.pro" } - dependencies { - classpath 'com.github.jengelman.gradle.plugins:shadow:6.1.0' + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } } -apply plugin: 'com.github.johnrengelman.shadow' -apply plugin: 'java-library' - dependencies { - //implementation 'org.web3j:core:4.9.8' + implementation files('../app/libs/abi-4.9.8.jar') implementation files('../app/libs/core-4.9.8.jar') implementation files('../app/libs/crypto-4.9.8.jar') implementation files('../app/libs/utils-4.9.8.jar') - testImplementation 'junit:junit:4.13.2' + testImplementation libs.junit - implementation 'org.bouncycastle:bcprov-jdk15on:1.70' + implementation libs.bouncycastle.bcprov.jdk15on // https://mvnrepository.com/artifact/com.github.cliftonlabs/json-simple - implementation group: 'com.github.cliftonlabs', name: 'json-simple', version: '4.0.1' + implementation libs.json.simple // https://mvnrepository.com/artifact/com.google.code.gson/gson - implementation group: 'com.google.code.gson', name: 'gson', version: '2.10.1' + implementation libs.gson } sourceCompatibility = "17" diff --git a/lib/src/main/java/com/alphawallet/token/tools/VerifyXMLDSig.java b/lib/src/main/java/com/alphawallet/token/tools/VerifyXMLDSig.java deleted file mode 100644 index cadb79b0e9..0000000000 --- a/lib/src/main/java/com/alphawallet/token/tools/VerifyXMLDSig.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.alphawallet.token.tools; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import com.alphawallet.token.entity.XMLDsigVerificationResult; -import com.github.cliftonlabs.json_simple.JsonObject; - -public class VerifyXMLDSig { - - //Invoke with Lambda via VerifyXMLDSig interface - public Response VerifyTSMLFile(Request req) throws Exception { - JsonObject result = validateSSLCertificate(req.file); - return new Response(result); - } - - public JsonObject validateSSLCertificate(String file) throws UnsupportedEncodingException { - JsonObject result = new JsonObject(); - InputStream stream = new ByteArrayInputStream(file.getBytes("UTF-8")); - XMLDsigVerificationResult XMLDsigVerificationResult = new XMLDSigVerifier().VerifyXMLDSig(stream); - if (XMLDsigVerificationResult.isValid) - { - result.put("result", "pass"); - result.put("issuer", XMLDsigVerificationResult.issuerPrincipal); - result.put("subject", XMLDsigVerificationResult.subjectPrincipal); - result.put("keyName", XMLDsigVerificationResult.keyName); - result.put("keyType", XMLDsigVerificationResult.keyType); - } - else - { - result.put("result", "fail"); - result.put("failureReason", XMLDsigVerificationResult.failureReason); - } - return result; - } - - public static class Request { - String file; - - public String getFile() { - return file; - } - - public void setFile(String file) { - this.file = file; - } - - public Request(String file) { - this.file = file; - } - - public Request() { - } - } - - public static class Response { - JsonObject result; - - public JsonObject getResult() { return result; } - - public void setResult(JsonObject result) { this.result = result; } - - public Response(JsonObject result) { - this.result = result; - } - - public Response() { - } - } - -} - - diff --git a/lib/src/main/java/com/alphawallet/token/tools/XMLDSigVerifier.java b/lib/src/main/java/com/alphawallet/token/tools/XMLDSigVerifier.java deleted file mode 100644 index 2c7d3aa1d8..0000000000 --- a/lib/src/main/java/com/alphawallet/token/tools/XMLDSigVerifier.java +++ /dev/null @@ -1,401 +0,0 @@ -package com.alphawallet.token.tools; - -import org.w3c.dom.DOMException; -import org.w3c.dom.Document; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; -import java.io.IOException; -import java.io.InputStream; -import java.security.InvalidAlgorithmParameterException; -import java.security.Key; -import java.security.KeyException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.Principal; -import java.security.PublicKey; -import java.security.Security; -import java.security.cert.CertPathValidator; -import java.security.cert.CertPathValidatorException; -import java.security.cert.CertificateException; -import java.security.cert.CertificateExpiredException; -import java.security.cert.CertificateFactory; -import java.security.cert.CertificateNotYetValidException; -import java.security.cert.PKIXParameters; -import java.security.cert.TrustAnchor; -import java.security.cert.X509Certificate; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import javax.net.ssl.TrustManagerFactory; -import javax.net.ssl.X509TrustManager; -import javax.xml.crypto.AlgorithmMethod; -import javax.xml.crypto.KeySelector; -import javax.xml.crypto.KeySelectorException; -import javax.xml.crypto.KeySelectorResult; -import javax.xml.crypto.MarshalException; -import javax.xml.crypto.XMLCryptoContext; -import javax.xml.crypto.XMLStructure; -import javax.xml.crypto.dsig.XMLSignature; -import javax.xml.crypto.dsig.XMLSignatureException; -import javax.xml.crypto.dsig.XMLSignatureFactory; -import javax.xml.crypto.dsig.dom.DOMValidateContext; -import javax.xml.crypto.dsig.keyinfo.KeyInfo; -import javax.xml.crypto.dsig.keyinfo.KeyName; -import javax.xml.crypto.dsig.keyinfo.KeyValue; -import javax.xml.crypto.dsig.keyinfo.X509Data; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import com.alphawallet.token.entity.XMLDsigVerificationResult; - -/** - * James Sangalli mans this project since July 2019. - * Stormbird Pte Ltd, in Sydney - */ - -/** - * This verifiers an XML Signature using the JSR 105 API. It assumes - * the key needed to verify the signature is certified by one of the - * X.509 certificates in the KeyInfo, and that X.509 certificate, - * together with any other found in KeyInfo, form a chain of - * certificate to a top level certified by one of the trusted - * authorities of the installed JRE - * - * Out of scope: - * - Multi-signature XML file - * - Ignores any public key provided in KeyInfo - * - * See the test case for usage examples. - */ -public class XMLDSigVerifier { - - public XMLDsigVerificationResult VerifyXMLDSig(InputStream fileStream) - { - XMLDsigVerificationResult result = new XMLDsigVerificationResult(); - try - { - //Signature will also be validated in this call, if it fails an exception is thrown - //No point to validate the certificate is this signature is invalid to begin with - //And TrustAddressGenerator needs to get an XMLSignature too. - XMLSignature signature = getValidXMLSignature(fileStream); - result.isValid = true; //would go to catch if this was not the case - //check that the tsml file is signed by a valid certificate - return validateCertificateIssuer(signature, result); - } - catch(Exception e) - { - result.isValid = false; - result.failureReason = e.getMessage(); - return result; - } - } - - XMLSignature getValidXMLSignature(InputStream fileStream) - throws ParserConfigurationException, - IOException, - SAXException, - MarshalException, - XMLSignatureException, - DOMException - { - DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); - dbFactory.setNamespaceAware(true); - DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); - Document xml = dBuilder.parse(fileStream); - xml.getDocumentElement().normalize(); - - // Find Signature element - NodeList nl = xml.getElementsByTagNameNS(XMLSignature.XMLNS, "Signature"); - if (nl.getLength() == 0) - { - throw new DOMException(DOMException.INDEX_SIZE_ERR, "Missing elements"); - } - - // Create a DOM XMLSignatureFactory that will be used to unmarshal the - // document containing the XMLSignature - XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM"); - - // Create a DOMValidateContext and specify a KeyValue KeySelector - // and document context - DOMValidateContext valContext = new DOMValidateContext(new SigningCertSelector(), nl.item(0)); - - // unmarshal the XMLSignature - XMLSignature signature = fac.unmarshalXMLSignature(valContext); - - boolean validSig = signature.validate(valContext); - if(!validSig) - { - throw new XMLSignatureException("Invalid XML signature"); - } - return signature; - } - - private void validateCertificateChain(List certList) - throws NoSuchAlgorithmException, - KeyStoreException, - InvalidAlgorithmParameterException, - CertificateException, - CertPathValidatorException - { - // By default on Oracle JRE, algorithm is PKIX - TrustManagerFactory tmf = TrustManagerFactory - .getInstance(TrustManagerFactory.getDefaultAlgorithm()); - // 'null' will initialise the tmf with the default CA certs installed - // with the JRE. - tmf.init((KeyStore) null); - - X509TrustManager tm = (X509TrustManager) tmf.getTrustManagers()[0]; - CertPathValidator cpv = CertPathValidator.getInstance("PKIX"); - Set anch = new HashSet<>(); - for (X509Certificate cert : tm.getAcceptedIssuers()) - { - anch.add(new TrustAnchor(cert, null)); - } - PKIXParameters params = new PKIXParameters(anch); - Security.setProperty("ocsp.enable", "true"); - params.setRevocationEnabled(true); - CertificateFactory factory = CertificateFactory.getInstance("X.509"); - try - { - cpv.validate(factory.generateCertPath(certList), params); - } - catch (CertPathValidatorException e) - { - System.out.println(e.getIndex()); - //if the timestamp check fails because the cert is expired - //we allow this to continue (code 0) - if(e.getIndex() != 0) - { - throw e; - } - } - } - - private X509Certificate findRootCert(List certificates) { - X509Certificate rootCert = null; - for (X509Certificate cert : certificates) { - X509Certificate signer = this.findSignerCertificate(cert, certificates); - if (signer == null || signer.equals(cert)) { - rootCert = cert; - break; - } - } - return rootCert; - } - - private List reorderCertificateChain(List chain) - { - X509Certificate[] reorderedChain = new X509Certificate[chain.size()]; - int position = chain.size() - 1; - X509Certificate rootCert = this.findRootCert(chain); - reorderedChain[position] = rootCert; - for (X509Certificate cert = rootCert; - (cert = this.findSignedCert(cert, chain)) != null && position > 0; - reorderedChain[position] = cert - ) { - --position; - } - return Arrays.asList(reorderedChain); - } - - private X509Certificate findSignedCert(X509Certificate signingCert, List certificates) - { - X509Certificate signed = null; - for (X509Certificate cert : certificates) - { - Principal signingCertSubjectDN = signingCert.getSubjectDN(); - Principal certIssuerDN = cert.getIssuerDN(); - if (certIssuerDN.equals(signingCertSubjectDN) && !cert.equals(signingCert)) - { - signed = cert; - break; - } - } - return signed; - } - - - private X509Certificate findSignerCertificate(X509Certificate signedCert, List certificates) { - X509Certificate signer = null; - for (X509Certificate cert : certificates) { - Principal certSubjectDN = cert.getSubjectDN(); - Principal issuerDN = signedCert.getIssuerDN(); - if (certSubjectDN.equals(issuerDN)) { - signer = cert; - break; - } - } - return signer; - } - - private XMLDsigVerificationResult validateCertificateIssuer(XMLSignature signature, XMLDsigVerificationResult result) { - try - { - KeyInfo xmlKeyInfo = signature.getKeyInfo(); - List certList = getCertificateChainFromXML(xmlKeyInfo.getContent()); - List orderedCerts = reorderCertificateChain(certList); - X509Certificate signingCert = selectSigningKeyFromXML(xmlKeyInfo.getContent()); - //Throws if invalid - validateCertificateChain(orderedCerts); - result.issuerPrincipal = signingCert.getIssuerX500Principal().getName(); - result.subjectPrincipal = signingCert.getSubjectX500Principal().getName(); - result.keyType = signingCert.getSigAlgName(); - for (XMLStructure o : xmlKeyInfo.getContent()) - { - if (o instanceof KeyName) - { - result.keyName = ((KeyName) o).getName(); - } - } - } - catch(Exception e) - { - result.isValid = false; - result.failureReason = e.getMessage(); - } - return result; - } - - private List getCertificateChainFromXML(List xmlElements) throws KeyStoreException, ClassCastException { - boolean found = false; - List certs = new ArrayList<>(); - for (int i = 0; i < xmlElements.size(); i++) - { - XMLStructure xmlStructure = xmlElements.get(i); - if (xmlStructure instanceof X509Data) - { - if(found) throw new KeyStoreException("Duplicate X509Data element"); - found = true; - for (Object o : ((X509Data) xmlStructure).getContent()) - { - if (o instanceof X509Certificate) - { - certs.add((X509Certificate)o); - } - } - } - } - return certs; - } - - private PublicKey recoverPublicKeyFromXML(List xmlElements) throws KeyStoreException { - boolean found = false; - PublicKey keyVal = null; - for (int i = 0; i < xmlElements.size(); i++) - { - XMLStructure xmlStructure = xmlElements.get(i); - if (xmlStructure instanceof KeyValue kv) - { - //should only be one KeyValue - if(found) throw new KeyStoreException("Duplicate Key found"); - found = true; - try - { - keyVal = kv.getPublicKey(); - } - catch (KeyException e) - { - e.printStackTrace(); - } - } - } - return keyVal; - } - - private X509Certificate selectSigningKeyFromXML(List xmlElements) throws KeyStoreException, CertificateNotYetValidException { - PublicKey recovered = recoverPublicKeyFromXML(xmlElements); - //Certificates from the XML might be in the wrong order - List certList = reorderCertificateChain(getCertificateChainFromXML(xmlElements)); - for (X509Certificate crt : certList) - { - try - { - crt.checkValidity(); - } - catch (CertificateExpiredException e) - { - //allow this - System.out.println("Allowing expired cert: " + e.getMessage()); - continue; - } - if (recovered != null) - { - PublicKey certKey = crt.getPublicKey(); - if (Arrays.equals(recovered.getEncoded(), certKey.getEncoded())) - { - return crt; - } - } - else if (crt.getSigAlgName().equals("SHA256withECDSA")) - { - return crt; - } - } - //if non recovered, simply return the first certificate? - return certList.get(0); - - } - - private class SigningCertSelector extends KeySelector - { - public KeySelectorResult select( - KeyInfo keyInfo, - KeySelector.Purpose purpose, - AlgorithmMethod method, - XMLCryptoContext context - ) throws KeySelectorException - { - if (keyInfo == null) throw new KeySelectorException("Null KeyInfo object!"); - PublicKey signer = null; - List list = keyInfo.getContent(); - boolean found = false; - for (XMLStructure xmlStructure : list) - { - if (xmlStructure instanceof KeyValue kv) - { - if(found) throw new KeySelectorException("Duplicate KeyValue"); - found = true; - try - { - signer = kv.getPublicKey(); - } - catch (KeyException e) - { - e.printStackTrace(); - } - } - } - if(signer != null) return new SimpleKeySelectorResult(signer); - X509Certificate signingCert = null; - try - { - signingCert = selectSigningKeyFromXML(list); - } - catch (Exception e) - { - throw new KeySelectorException(e.getMessage()); - } - if (signingCert != null) - { - return new SimpleKeySelectorResult(signingCert.getPublicKey()); - } - else - { - throw new KeySelectorException("No KeyValue element found!"); - } - } - } - - private class SimpleKeySelectorResult implements KeySelectorResult - { - private final PublicKey pk; - SimpleKeySelectorResult(PublicKey pk) { - this.pk = pk; - } - public Key getKey() { return pk; } - } -} diff --git a/settings.gradle b/settings.gradle index 63ef013e5c..a9a1f85625 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,45 @@ -include ':app', ':lib', ':util', ':dmz', ':hardware_stub' +pluginManagement { + repositories { + google { + content { + includeGroupByRegex("com\\.android.*") + includeGroupByRegex("com\\.google.*") + includeGroupByRegex("androidx.*") + } + } + mavenCentral() + gradlePluginPortal() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) + repositories { + google() + mavenCentral() + maven { url 'https://jitpack.io' } + maven { + url = uri("https://maven.pkg.github.com/trustwallet/wallet-core") + credentials { + username = getGitHubUsername() as String ?: System.getenv("GITHUB_USER") + password = getPAT() as String ?: System.getenv("GITHUB_TOKEN") + } + } + maven { + url "https://plugins.gradle.org/m2/" + } + maven { url 'https://repo.spring.io/milestone' } + } +} + +private static String getGitHubUsername() { + "JamesSmartCell" +} + +private static String getPAT() { + def encodedToken = "WjJod1gyaFZWVFF4ZGtoVk1qTkdiVVJqTlRWUGVtSlFZVlI0UkRocldYQkRZak5FTlU5aFNnPT0=" + def firstEncode = new String(encodedToken.decodeBase64()) + new String(firstEncode.decodeBase64()) +} + +rootProject.name = "AlphaWallet" +include ':app', ':lib', ':hardware_stub' //, ':dmz' //TODO: Fix DMZ for Gradle 8 diff --git a/util/build.gradle b/util/build.gradle index 936509ac53..7c8a420404 100644 --- a/util/build.gradle +++ b/util/build.gradle @@ -24,7 +24,7 @@ dependencies { implementation files('../app/libs/crypto-4.9.8.jar') implementation files('../app/libs/utils-4.9.8.jar') - implementation 'com.squareup.okhttp3:okhttp:4.11.0' + implementation 'com.squareup.okhttp3:okhttp:4.12.0' implementation 'io.reactivex.rxjava2:rxjava:2.2.21' testImplementation 'junit:junit:4.12' implementation project(path: ':lib')