diff --git a/.github/workflows/dashpay.yml b/.github/workflows/dashpay.yml index 35cd822f17..af53d63a9f 100644 --- a/.github/workflows/dashpay.yml +++ b/.github/workflows/dashpay.yml @@ -42,7 +42,7 @@ jobs: run: bash .deploy/checksum.sh checksum.txt - name: Gem caching - uses: actions/cache@v2 + uses: actions/cache@v4 continue-on-error: true with: path: vendor/bundle @@ -58,7 +58,7 @@ jobs: bundle install --jobs 4 --retry 3 - name: Cache Gradle packages - uses: actions/cache@v2 + uses: actions/cache@v4 continue-on-error: true with: path: | diff --git a/.github/workflows/dashwallet.yml b/.github/workflows/dashwallet.yml index fcf637cb11..5ed01d6c8a 100644 --- a/.github/workflows/dashwallet.yml +++ b/.github/workflows/dashwallet.yml @@ -42,7 +42,7 @@ jobs: run: bash .deploy/checksum.sh checksum.txt - name: Gem caching - uses: actions/cache@v2 + uses: actions/cache@v4 continue-on-error: true with: path: vendor/bundle @@ -58,7 +58,7 @@ jobs: bundle install --jobs 4 --retry 3 - name: Cache Gradle packages - uses: actions/cache@v2 + uses: actions/cache@v4 continue-on-error: true with: path: | diff --git a/.github/workflows/manual_distribution.yml b/.github/workflows/manual_distribution.yml index 18dc12bf80..c2de4bc37b 100644 --- a/.github/workflows/manual_distribution.yml +++ b/.github/workflows/manual_distribution.yml @@ -74,7 +74,7 @@ jobs: run: bash .deploy/checksum.sh checksum.txt - name: Gem caching - uses: actions/cache@v2 + uses: actions/cache@v4 continue-on-error: true with: path: vendor/bundle @@ -90,7 +90,7 @@ jobs: bundle install --jobs 4 --retry 3 - name: Cache Gradle packages - uses: actions/cache@v2 + uses: actions/cache@v4 continue-on-error: true with: path: | diff --git a/.gitignore b/.gitignore index a66c50b8e3..bde575eb47 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ local.properties.osx .project .settings/ .idea/ +.kotlin/ *.iml bin/ gen/ @@ -35,4 +36,4 @@ wallet/assets/explore/*.db .deploy/*.json *.keystore .java-version # used by jenv for choosing java version at the command line -.bundle/config \ No newline at end of file +.bundle/config diff --git a/Gemfile b/Gemfile index fc76deac4e..fc04b99b0c 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } # gem "rails" -gem "fastlane", "~> 2.216.0" +gem "fastlane", "~> 2.227.1" plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') eval_gemfile(plugins_path) if File.exist?(plugins_path) diff --git a/Gemfile.lock b/Gemfile.lock index 752dee14bd..c671ad195d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,43 +1,48 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.6) + CFPropertyList (3.0.7) + base64 + nkf rexml - addressable (2.8.5) - public_suffix (>= 2.0.2, < 6.0) - artifactory (3.0.15) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + artifactory (3.0.17) atomos (0.1.3) - aws-eventstream (1.2.0) - aws-partitions (1.830.0) - aws-sdk-core (3.184.0) - aws-eventstream (~> 1, >= 1.0.2) - aws-partitions (~> 1, >= 1.651.0) - aws-sigv4 (~> 1.5) + aws-eventstream (1.3.2) + aws-partitions (1.1087.0) + aws-sdk-core (3.222.1) + aws-eventstream (~> 1, >= 1.3.0) + aws-partitions (~> 1, >= 1.992.0) + aws-sigv4 (~> 1.9) + base64 jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.72.0) - aws-sdk-core (~> 3, >= 3.184.0) - aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.136.0) - aws-sdk-core (~> 3, >= 3.181.0) + logger + aws-sdk-kms (1.99.0) + aws-sdk-core (~> 3, >= 3.216.0) + aws-sigv4 (~> 1.5) + aws-sdk-s3 (1.183.0) + aws-sdk-core (~> 3, >= 3.216.0) aws-sdk-kms (~> 1) - aws-sigv4 (~> 1.6) - aws-sigv4 (1.6.0) + aws-sigv4 (~> 1.5) + aws-sigv4 (1.11.0) aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) + base64 (0.2.0) claide (1.1.0) colored (1.2) colored2 (3.1.2) commander (4.6.0) highline (~> 2.0.0) declarative (0.0.20) - digest-crc (0.6.5) + digest-crc (0.7.0) rake (>= 12.0.0, < 14.0.0) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) dotenv (2.8.1) emoji_regex (3.2.3) - excon (0.103.0) - faraday (1.10.3) + excon (0.109.0) + faraday (1.10.4) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) @@ -56,24 +61,24 @@ GEM faraday-em_synchrony (1.0.0) faraday-excon (1.1.0) faraday-httpclient (1.0.1) - faraday-multipart (1.0.4) - multipart-post (~> 2) - faraday-net_http (1.0.1) + faraday-multipart (1.1.0) + multipart-post (~> 2.0) + faraday-net_http (1.0.2) faraday-net_http_persistent (1.2.0) faraday-patron (1.0.0) faraday-rack (1.0.0) faraday-retry (1.0.3) - faraday_middleware (1.2.0) + faraday_middleware (1.2.1) faraday (~> 1.0) - fastimage (2.2.7) - fastlane (2.216.0) + fastimage (2.4.0) + fastlane (2.227.1) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.8, < 3.0.0) artifactory (~> 3.0) aws-sdk-s3 (~> 1.0) babosa (>= 1.0.3, < 2.0.0) bundler (>= 1.12.0, < 3.0.0) - colored + colored (~> 1.2) commander (~> 4.6) dotenv (>= 2.1.1, < 3.0.0) emoji_regex (>= 0.1, < 4.0) @@ -82,9 +87,11 @@ GEM faraday-cookie_jar (~> 0.0.6) faraday_middleware (~> 1.0) fastimage (>= 2.1.0, < 3.0.0) + fastlane-sirp (>= 1.0.0) gh_inspector (>= 1.1.2, < 2.0.0) google-apis-androidpublisher_v3 (~> 0.3) google-apis-playcustomapp_v1 (~> 0.1) + google-cloud-env (>= 1.6.0, < 2.0.0) google-cloud-storage (~> 1.31) highline (~> 2.0) http-cookie (~> 1.0.5) @@ -93,10 +100,10 @@ GEM mini_magick (>= 4.9.4, < 5.0.0) multipart-post (>= 2.0.0, < 3.0.0) naturally (~> 2.2) - optparse (~> 0.1.1) + optparse (>= 0.1.1, < 1.0.0) plist (>= 3.1.0, < 4.0.0) rubyzip (>= 2.0.0, < 3.0.0) - security (= 0.1.3) + security (= 0.1.5) simctl (~> 1.6.3) terminal-notifier (>= 2.0.0, < 3.0.0) terminal-table (~> 3) @@ -104,14 +111,17 @@ GEM tty-spinner (>= 0.8.0, < 1.0.0) word_wrap (~> 1.0.0) xcodeproj (>= 1.13.0, < 2.0.0) - xcpretty (~> 0.3.0) - xcpretty-travis-formatter (>= 0.0.3) - fastlane-plugin-firebase_app_distribution (0.7.4) + xcpretty (~> 0.4.1) + xcpretty-travis-formatter (>= 0.0.3, < 2.0.0) + fastlane-plugin-firebase_app_distribution (0.10.1) google-apis-firebaseappdistribution_v1 (~> 0.3.0) + google-apis-firebaseappdistribution_v1alpha (~> 0.2.0) + fastlane-sirp (1.0.0) + sysrandom (~> 1.0) gh_inspector (1.1.3) - google-apis-androidpublisher_v3 (0.50.0) + google-apis-androidpublisher_v3 (0.54.0) google-apis-core (>= 0.11.0, < 2.a) - google-apis-core (0.11.1) + google-apis-core (0.11.3) addressable (~> 2.5, >= 2.5.1) googleauth (>= 0.16.2, < 2.a) httpclient (>= 2.8.1, < 3.a) @@ -119,26 +129,27 @@ GEM representable (~> 3.0) retriable (>= 2.0, < 4.a) rexml - webrick google-apis-firebaseappdistribution_v1 (0.3.0) google-apis-core (>= 0.11.0, < 2.a) + google-apis-firebaseappdistribution_v1alpha (0.2.0) + google-apis-core (>= 0.11.0, < 2.a) google-apis-iamcredentials_v1 (0.17.0) google-apis-core (>= 0.11.0, < 2.a) google-apis-playcustomapp_v1 (0.13.0) google-apis-core (>= 0.11.0, < 2.a) - google-apis-storage_v1 (0.19.0) - google-apis-core (>= 0.9.0, < 2.a) - google-cloud-core (1.6.0) - google-cloud-env (~> 1.0) + google-apis-storage_v1 (0.29.0) + google-apis-core (>= 0.11.0, < 2.a) + google-cloud-core (1.6.1) + google-cloud-env (>= 1.0, < 3.a) google-cloud-errors (~> 1.0) google-cloud-env (1.6.0) faraday (>= 0.17.3, < 3.0) google-cloud-errors (1.3.1) - google-cloud-storage (1.44.0) + google-cloud-storage (1.45.0) addressable (~> 2.8) digest-crc (~> 0.4) google-apis-iamcredentials_v1 (~> 0.1) - google-apis-storage_v1 (~> 0.19.0) + google-apis-storage_v1 (~> 0.29.0) google-cloud-core (~> 1.6) googleauth (>= 0.16.2, < 2.a) mini_mime (~> 1.0) @@ -149,33 +160,38 @@ GEM os (>= 0.9, < 2.0) signet (>= 0.16, < 2.a) highline (2.0.3) - http-cookie (1.0.5) + http-cookie (1.0.8) domain_name (~> 0.5) - httpclient (2.8.3) + httpclient (2.9.0) + mutex_m jmespath (1.6.2) - json (2.6.3) - jwt (2.7.1) - mini_magick (4.12.0) + json (2.7.6) + jwt (2.10.1) + base64 + logger (1.7.0) + mini_magick (4.13.2) mini_mime (1.1.5) multi_json (1.15.0) - multipart-post (2.3.0) - nanaimo (0.3.0) + multipart-post (2.4.1) + mutex_m (0.3.0) + nanaimo (0.4.0) naturally (2.2.1) - optparse (0.1.1) + nkf (0.2.0) + optparse (0.6.0) os (1.1.4) - plist (3.7.0) - public_suffix (5.0.3) - rake (13.0.6) + plist (3.7.2) + public_suffix (5.1.1) + rake (13.2.1) representable (3.2.0) declarative (< 0.1.0) trailblazer-option (>= 0.1.1, < 0.2.0) uber (< 0.2.0) retriable (3.1.2) - rexml (3.2.6) - rouge (2.0.7) + rexml (3.4.1) + rouge (3.28.0) ruby2_keywords (0.0.5) - rubyzip (2.3.2) - security (0.1.3) + rubyzip (2.4.1) + security (0.1.5) signet (0.18.0) addressable (~> 2.8) faraday (>= 0.17.5, < 3.a) @@ -184,30 +200,28 @@ GEM simctl (1.6.10) CFPropertyList naturally + sysrandom (1.0.5) terminal-notifier (2.0.0) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) trailblazer-option (0.1.2) tty-cursor (0.7.1) - tty-screen (0.8.1) + tty-screen (0.8.2) tty-spinner (0.9.3) tty-cursor (~> 0.7) uber (0.1.0) - unf (0.1.4) - unf_ext - unf_ext (0.0.8.2) - unicode-display_width (2.4.2) - webrick (1.8.1) + unf (0.2.0) + unicode-display_width (2.6.0) word_wrap (1.0.0) - xcodeproj (1.23.0) + xcodeproj (1.27.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) - nanaimo (~> 0.3.0) - rexml (~> 3.2.4) - xcpretty (0.3.0) - rouge (~> 2.0.7) + nanaimo (~> 0.4.0) + rexml (>= 3.3.6, < 4.0) + xcpretty (0.4.1) + rouge (~> 3.28.0) xcpretty-travis-formatter (1.0.1) xcpretty (~> 0.2, >= 0.0.7) @@ -218,7 +232,7 @@ PLATFORMS x86_64-linux DEPENDENCIES - fastlane (~> 2.216.0) + fastlane (~> 2.227.1) fastlane-plugin-firebase_app_distribution BUNDLED WITH diff --git a/build.gradle b/build.gradle index c562f63be7..e55c29a46d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,13 @@ buildscript { ext { - kotlin_version = '1.9.24' + kotlin_version = '2.1.0' coroutinesVersion = '1.6.4' ok_http_version = '4.9.1' - dashjVersion = '21.1.6' - dppVersion = "1.7.3" - hiltVersion = '2.51' + dashjVersion = '21.1.7' + dppVersion = "1.7.4" + hiltVersion = '2.53' hiltCompilerVersion = '1.2.0' - hiltWorkVersion = '1.0.0' + hiltWorkVersion = '1.2.0' workRuntimeVersion='2.7.1' firebaseVersion = '32.1.1' roomVersion = '2.5.2' @@ -18,7 +18,6 @@ buildscript { lifecycleVersion = '2.5.1' navigationVersion = '2.6.0' datastoreVersion = "1.0.0" - hiltWorkVersion = '1.0.0' serializationVersion = '1.0.1' preferenceVersion = '1.2.0' @@ -64,7 +63,8 @@ buildscript { } plugins { - id 'com.google.devtools.ksp' version '1.9.24-1.0.20' apply false + id 'com.google.devtools.ksp' version '2.1.0-1.0.29' apply false + id("org.jetbrains.kotlin.plugin.compose") version "$kotlin_version" apply false } allprojects { diff --git a/common/build.gradle b/common/build.gradle index df5a081210..4ae7e37554 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -3,6 +3,7 @@ apply plugin: 'kotlin-android' apply plugin: 'com.google.devtools.ksp' apply plugin: 'kotlin-parcelize' apply plugin: 'dagger.hilt.android.plugin' +apply plugin: 'org.jetbrains.kotlin.plugin.compose' android { @@ -38,9 +39,6 @@ android { viewBinding true compose = true } - composeOptions { - kotlinCompilerExtensionVersion = "1.5.14" - } tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { kotlinOptions { freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn" @@ -80,7 +78,7 @@ dependencies { implementation "androidx.room:room-ktx:$roomVersion" implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:$serializationVersion" - implementation(platform("androidx.compose:compose-bom:2023.03.00")) + implementation(platform("androidx.compose:compose-bom:2024.03.00")) implementation("androidx.compose.ui:ui") implementation("androidx.compose.ui:ui-tooling-preview") implementation("androidx.compose.material3:material3") diff --git a/common/src/main/java/org/dash/wallet/common/Configuration.java b/common/src/main/java/org/dash/wallet/common/Configuration.java index 622ae7c790..db6467cc93 100644 --- a/common/src/main/java/org/dash/wallet/common/Configuration.java +++ b/common/src/main/java/org/dash/wallet/common/Configuration.java @@ -23,7 +23,6 @@ import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; -import android.content.res.Resources; import android.net.Uri; import android.text.format.DateUtils; @@ -46,12 +45,10 @@ public class Configuration { public final int lastVersionCode; private final SharedPreferences prefs; - private final Resources res; public static final String PREFS_KEY_CONNECTIVITY_NOTIFICATION = "connectivity_notification"; public static final String PREFS_KEY_TRUSTED_PEER = "trusted_peer"; public static final String PREFS_KEY_TRUSTED_PEER_ONLY = "trusted_peer_only"; - public static final String PREFS_KEY_BLOCK_EXPLORER = "block_explorer"; public static final String PREFS_KEY_REMIND_BALANCE = "remind_balance"; public static final String PREFS_KEY_REMIND_BALANCE_TIME = "remind_balance_time"; private static final String PREFS_KEY_PREVIOUS_VERSION = "previous_version"; @@ -68,7 +65,6 @@ public class Configuration { private static final String PREFS_KEY_LAST_BACKUP = "last_backup"; public static final String PREFS_KEY_REMIND_BACKUP_SEED = "remind_backup_seed"; private static final String PREFS_KEY_LAST_BACKUP_SEED_TIME = "last_backup_seed_time"; - private static final String PREFS_KEY_LAST_RESTORE = "last_restore"; private static final String PREFS_KEY_LAST_ENCRYPT_KEYS = "last_encrypt_keys"; private static final String PREFS_KEY_LAST_BLOCKCHAIN_RESET = "last_blockchain_reset"; @@ -79,7 +75,6 @@ public class Configuration { public static final String PREFS_PIN_LENGTH = "pin_length"; private static final String PREFS_IMGUR_DELETE_HASH = "imgur_delete_hash"; private static final String PREFS_UPLOAD_POLICY = "upload_policy_accepted_"; - private static final String PREFS_DEV_MODE = "developer_mode"; private static final String PREFS_INVITER = "inviter"; private static final String PREFS_INVITER_CONTACT_REQUEST_SENT_INFO = "inviter_contact_request_sent_info"; private static final String PREFS_ONBOARDING_STAGE = "onboarding_state"; @@ -105,10 +100,8 @@ public class Configuration { private static final Logger log = LoggerFactory.getLogger(Configuration.class); - public Configuration(final SharedPreferences prefs, final Resources res) { + public Configuration(final SharedPreferences prefs) { this.prefs = prefs; - this.res = res; - this.lastVersionCode = prefs.getInt(PREFS_KEY_LAST_VERSION, 0); } @@ -160,10 +153,6 @@ public boolean getTrustedPeerOnly() { return prefs.getBoolean(PREFS_KEY_TRUSTED_PEER_ONLY, false); } - public Uri getBlockExplorer(int defValueResValue) { - return Uri.parse(prefs.getString(PREFS_KEY_BLOCK_EXPLORER, res.getStringArray(defValueResValue)[0])); - } - public boolean remindBalance() { return prefs.getBoolean(PREFS_KEY_REMIND_BALANCE, true); } @@ -233,14 +222,6 @@ public boolean getRemindBackupSeed() { return prefs.getBoolean(PREFS_KEY_REMIND_BACKUP_SEED, true); } - public void setLastRestoreTime() { - prefs.edit().putLong(PREFS_KEY_LAST_RESTORE, System.currentTimeMillis()); - } - - public long getLastRestoreTime() { - return prefs.getLong(PREFS_KEY_LAST_RESTORE, 0); - } - public boolean lastBackupSeedReminderMoreThan24hAgo() { long lastReminder = prefs.getLong(PREFS_KEY_LAST_BACKUP_SEED_TIME, 0); if (lastReminder > 0) { @@ -392,14 +373,6 @@ public void setAcceptedUploadPolicy(String service, Boolean accepted) { prefs.edit().putBoolean(PREFS_UPLOAD_POLICY + service, accepted).apply(); } - public Boolean getDeveloperMode() { - return BuildConfig.DEBUG || prefs.getBoolean(PREFS_DEV_MODE, false); - } - - public void setDeveloperMode(boolean activate) { - prefs.edit().putBoolean(PREFS_DEV_MODE, activate).apply(); - } - public String getInviter() { return prefs.getString(PREFS_INVITER, null); } diff --git a/common/src/main/java/org/dash/wallet/common/WalletDataProvider.kt b/common/src/main/java/org/dash/wallet/common/WalletDataProvider.kt index f39ef2474c..6dd4d80195 100644 --- a/common/src/main/java/org/dash/wallet/common/WalletDataProvider.kt +++ b/common/src/main/java/org/dash/wallet/common/WalletDataProvider.kt @@ -51,6 +51,8 @@ interface WalletDataProvider { coinSelector: CoinSelector? = null ): Flow + fun observeSpendableBalance(): Flow + fun canAffordIdentityCreation(): Boolean // Treat @withConfidence with care - it may produce a lot of events and affect performance. diff --git a/common/src/main/java/org/dash/wallet/common/data/BaseConfig.kt b/common/src/main/java/org/dash/wallet/common/data/BaseConfig.kt index cc0394194a..c792306b03 100644 --- a/common/src/main/java/org/dash/wallet/common/data/BaseConfig.kt +++ b/common/src/main/java/org/dash/wallet/common/data/BaseConfig.kt @@ -33,7 +33,6 @@ import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.map import kotlinx.coroutines.launch -import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.decodeFromString import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json @@ -41,7 +40,6 @@ import org.dash.wallet.common.WalletDataProvider import org.dash.wallet.common.util.security.EncryptionProvider import java.io.IOException -@OptIn(ExperimentalSerializationApi::class) abstract class BaseConfig( private val context: Context, private val name: String, diff --git a/common/src/main/java/org/dash/wallet/common/data/ExchangeRatesConfig.kt b/common/src/main/java/org/dash/wallet/common/data/ExchangeRatesConfig.kt index 5dd70b7235..56172d5659 100644 --- a/common/src/main/java/org/dash/wallet/common/data/ExchangeRatesConfig.kt +++ b/common/src/main/java/org/dash/wallet/common/data/ExchangeRatesConfig.kt @@ -5,7 +5,9 @@ import androidx.datastore.preferences.core.booleanPreferencesKey import androidx.datastore.preferences.core.longPreferencesKey import org.dash.wallet.common.WalletDataProvider import javax.inject.Inject +import javax.inject.Singleton +@Singleton class ExchangeRatesConfig @Inject constructor( diff --git a/common/src/main/java/org/dash/wallet/common/data/ServiceName.kt b/common/src/main/java/org/dash/wallet/common/data/ServiceName.kt index 40a4794ee8..44927f5586 100644 --- a/common/src/main/java/org/dash/wallet/common/data/ServiceName.kt +++ b/common/src/main/java/org/dash/wallet/common/data/ServiceName.kt @@ -4,6 +4,6 @@ object ServiceName { const val CrowdNode = "crowdnode" const val Uphold = "uphold" const val Coinbase = "coinbase" - const val DashDirect = "dashdirect" + const val CTXSpend = "ctxspend" const val Unknown = "unknown" } diff --git a/common/src/main/java/org/dash/wallet/common/services/BlockchainStateProvider.kt b/common/src/main/java/org/dash/wallet/common/services/BlockchainStateProvider.kt index 232bf69557..5cc0ed0920 100644 --- a/common/src/main/java/org/dash/wallet/common/services/BlockchainStateProvider.kt +++ b/common/src/main/java/org/dash/wallet/common/services/BlockchainStateProvider.kt @@ -36,8 +36,8 @@ import org.dash.wallet.common.data.NetworkStatus interface BlockchainStateProvider { suspend fun getState(): BlockchainState? fun observeState() : Flow - fun getMasternodeAPY(): Double - fun getLastMasternodeAPY(): Double + suspend fun getMasternodeAPY(): Double + suspend fun getLastMasternodeAPY(): Double fun getNetworkStatus(): NetworkStatus fun observeNetworkStatus(): Flow diff --git a/common/src/main/java/org/dash/wallet/common/services/SendPaymentService.kt b/common/src/main/java/org/dash/wallet/common/services/SendPaymentService.kt index d6791815e3..964ad5cbdd 100644 --- a/common/src/main/java/org/dash/wallet/common/services/SendPaymentService.kt +++ b/common/src/main/java/org/dash/wallet/common/services/SendPaymentService.kt @@ -21,7 +21,10 @@ import org.bitcoinj.core.Address import org.bitcoinj.core.Coin import org.bitcoinj.core.InsufficientMoneyException import org.bitcoinj.core.Transaction +import org.bitcoinj.core.TransactionOutput import org.bitcoinj.wallet.CoinSelector +import java.util.function.Consumer +import java.util.function.Predicate class LeftoverBalanceException(missing: Coin, message: String) : InsufficientMoneyException(missing, message) class DirectPayException(message: String) : Exception(message) @@ -33,7 +36,9 @@ interface SendPaymentService { amount: Coin, coinSelector: CoinSelector? = null, emptyWallet: Boolean = false, - checkBalanceConditions: Boolean = true + checkBalanceConditions: Boolean = true, + beforeSending: Consumer? = null, + canSendLockedOutput: Predicate? = null ): Transaction suspend fun estimateNetworkFee( diff --git a/common/src/main/java/org/dash/wallet/common/services/TransactionMetadataProvider.kt b/common/src/main/java/org/dash/wallet/common/services/TransactionMetadataProvider.kt index 9fe9fb55fd..c088d90dd7 100644 --- a/common/src/main/java/org/dash/wallet/common/services/TransactionMetadataProvider.kt +++ b/common/src/main/java/org/dash/wallet/common/services/TransactionMetadataProvider.kt @@ -57,7 +57,7 @@ interface TransactionMetadataProvider { fun observeTransactionMetadata(txId: Sha256Hash): Flow /** - * Mark a transaction as DashDirect gift card expense with an icon + * Mark a transaction as DashSpend gift card expense with an icon */ suspend fun markGiftCardTransaction(txId: Sha256Hash, iconUrl: String?) suspend fun updateGiftCardMetadata(giftCard: GiftCard) diff --git a/common/src/main/java/org/dash/wallet/common/services/analytics/AnalyticsConstants.kt b/common/src/main/java/org/dash/wallet/common/services/analytics/AnalyticsConstants.kt index 112899d225..167b4092c0 100644 --- a/common/src/main/java/org/dash/wallet/common/services/analytics/AnalyticsConstants.kt +++ b/common/src/main/java/org/dash/wallet/common/services/analytics/AnalyticsConstants.kt @@ -79,8 +79,8 @@ object AnalyticsConstants { const val IMPORT_PRIVATE_KEY = "tools_import_private_key" const val NETWORK_MONITORING = "tools_network_monitoring" const val LOCAL_CURRENCY = "settings_local_currency" - const val RESCAN_BLOCKCHAIN_RESET = "settings_rescan_blockchain_reset" - const val RESCAN_BLOCKCHAIN_DISMISS = "settings_rescan_blockchain_dismiss" + const val RESCAN_BLOCKCHAIN_RESET = "settings_rescan_btn_rescan" + const val RESCAN_BLOCKCHAIN_DISMISS = "settings_rescan" const val ABOUT = "settings_about" const val ABOUT_SUPPORT = "settings_about_contact_support" const val COINJOIN = "settings_coinjoin" @@ -95,6 +95,8 @@ object AnalyticsConstants { const val COPY_ADDRESS = "receive_copy_address" const val SPECIFY_AMOUNT = "receive_specify_amount" const val SHARE = "receive_tab_share" + const val IMPORT_PRIVATE_KEY = "receive_btn_import_private_key" + const val IMPORT_PRIVATE_KEY_SUCCESS = "receive_btn_import_private_key_success" const val ENTER_AMOUNT_MAX = "enter_amount_max" const val ENTER_AMOUNT_DASH = "enter_amount_dash_amount" const val ENTER_AMOUNT_FIAT = "enter_amount_fiat_amount" @@ -102,6 +104,10 @@ object AnalyticsConstants { const val ENTER_AMOUNT_RECEIVE = "enter_amount_receive" const val ENTER_AMOUNT_SHOW_BALANCE = "enter_amount_show_balance" const val ENTER_AMOUNT_HIDE_BALANCE = "enter_amount_hide_balance" + const val SEND_SUCCESS = "send_address_success" + const val SEND_ERROR = "send_address_error" + const val SEND_USERNAME_SUCCESS = "send_username_success" + const val SEND_USERNAME_ERROR = "send_username_error" } object AddressInput { @@ -127,14 +133,12 @@ object AnalyticsConstants { const val TRANSACTION_DETAILS = "home_transaction_details" const val TRANSACTION_FILTER = "home_transaction_filter" const val SEND_RECEIVE_BUTTON = "bottom_nav_payments" - const val NO_ADDRESS_COPIED = "shortcut_send_no_address_copied" const val AVATAR = "home_avatar" const val NOTIFICATIONS = "home_notifications" } object Invites { const val ERROR_USERNAME_TAKEN = "invite_username_already_found" - const val INVITE_CONTACTS = "invite_from_contacts" const val CREATE_MORE = "invite_create_from_more_menu" const val INVITE_FRIEND = "invite_friend" const val ERROR_CREATE = "invite_error_creating" @@ -184,6 +188,11 @@ object AnalyticsConstants { const val PROFILE_CHANGE_PICTURE_GALLERY = "profile_change_picture_gallery" const val TAB_SEND_TO_CONTACT = "send_tab_send_to_contact" const val SHORTCUT_SEND_TO_CONTACT = "shortcut_send_to_contact" + const val INVITE_CONTACTS = "contacts_btn_invite" + const val INVITE_CONTACTS_CREATE = "contacts_btn_invite_btn_create" + const val INVITE_CONTACTS_CREATE_PAY = "contacts_btn_invite_btn_create_btn_pay" + const val INVITE_CONTACTS_CREATE_SUCCESS = "contacts_invitation_created_success" + const val INVITE_CONTACTS_CREATE_FAIL = "contacts_invitation_created_fail" } object Process { @@ -205,29 +214,17 @@ object AnalyticsConstants { } object Explore { - const val LEARN_MORE = "explore_info_learn_more" - const val CONTINUE = "explore_info_continue" const val ONLINE_MERCHANTS = "explore_online_merchants" const val NEARBY_MERCHANTS = "explore_nearby_merchants" const val ALL_MERCHANTS = "explore_all_merchants" const val FILTER_MERCHANTS_TOP = "explore_filter_merchants_top" - const val FILTER_MERCHANTS_BOTTOM = "explore_filter_merchants_bottom" - const val SELECT_MERCHANT_LOCATION = "explore_select_merchant_location" - const val SELECT_MERCHANT_MARKER = "explore_select_merchant_marker" - const val INFO_EXPLORE_MERCHANT = "explore_info_search" - const val PAN_MERCHANT_MAP = "explore_pan_merchant_map" - const val ZOOM_MERCHANT_MAP = "explore_zoom_merchant_map" const val ALL_ATM = "explore_all_atm" const val BUY_ATM = "explore_buy_atm" const val SELL_ATM = "explore_sell_atm" const val BUY_SELL_ATM = "explore_buy_sell_atm" - const val FILTER_ATM_BOTTOM = "explore_filter_atm_bottom" const val FILTER_ATM_TOP = "explore_filter_atm_top" - const val SELECT_ATM_MARKER = "explore_select_atm_marker" const val SELECT_ATM_LOCATION = "explore_select_atm_location" - const val PAN_ATM_MAP = "explore_pan_atm_map" - const val ZOOM_ATM_MAP = "explore_zoom_atm_map" const val FILTER_MERCHANT_SELECT_DASH = "explore_filter_merch_select_dash" const val FILTER_MERCHANT_SELECT_GIFT_CARD = "explore_filter_merch_select_gift_card" @@ -242,8 +239,6 @@ object AnalyticsConstants { const val FILTER_MERCHANT_LOCATION_ALLOWED = "explore_filter_merch_location_allowed" const val FILTER_MERCHANT_LOCATION_DENIED = "explore_filter_merch_location_denied" const val FILTER_MERCHANT_APPLY_ACTION = "explore_filter_merch_apply_action" - const val FILTER_MERCHANT_CANCEL_ACTION = "explore_filter_merch_cancel_action" - const val FILTER_MERCHANT_SWIPE_ACTION = "explore_filter_merch_swipe_action" const val FILTER_ATM_SORT_BY_NAME = "explore_filter_atm_sort_by_name" const val FILTER_ATM_SORT_BY_DISTANCE = "explore_filter_atm_sort_by_distance" @@ -256,31 +251,26 @@ object AnalyticsConstants { const val FILTER_ATM_LOCATION_ALLOWED = "explore_filter_atm_location_allowed" const val FILTER_ATM_LOCATION_DENIED = "explore_filter_atm_location_denied" const val FILTER_ATM_APPLY_ACTION = "explore_filter_atm_apply_action" - const val FILTER_ATM_CANCEL_ACTION = "explore_filter_atm_cancel_action" - const val FILTER_ATM_SWIPE_ACTION = "explore_filter_atm_swipe_action" - const val MERCHANT_DETAILS_SHOW_ALL_LOCATIONS = "explore_merchant_details_go_to_all" - const val MERCHANT_DETAILS_NAVIGATION = "explore_merchant_details_navigation" const val MERCHANT_DETAILS_DIAL_PHONE_CALL = "explore_merchant_details_dial_phone" const val MERCHANT_DETAILS_OPEN_WEBSITE = "explore_merchant_details_open_website" const val MERCHANT_DETAILS_BUY_GIFT_CARD = "explore_merchant_details_buy_gift_card" - const val MERCHANT_DETAILS_BACK_FROM_ALL_LOCATIONS = "explore_merchant_details_back_from_all" - const val MERCHANT_DETAILS_BACK_TOP = "explore_merchant_details_back_top" - const val MERCHANT_DETAILS_BACK_BOTTOM = "explore_merchant_details_back_bottom" const val MERCHANT_DETAILS_PAY_WITH_DASH = "explore_merchant_details_pay_with_dash" - const val MERCHANT_DETAILS_SCROLL_UP = "explore_merchant_details_scroll_up" + + const val PAY_WITH_DASH_SUCCESS = "explore_merchant_pay_with_dash_success" + const val PAY_WITH_DASH_ERROR = "explore_merchant_pay_with_dash_error" } - object DashDirect { - const val CREATE_ACCOUNT = "dashdirect_btn_create" - const val LOGIN = "dashdirect_btn_login" - const val SUCCESSFUL_LOGIN = "dashdirect_success_login" - const val UNSUCCESSFUL_LOGIN = "dashdirect_not_success_login" - const val SUCCESSFUL_PURCHASE = "dashdirect_success_purchase" - const val PURCHASE_AMOUNT = "dashdirect_purchase_amount" - const val DISCOUNT_AMOUNT = "dashdirect_discount_amount" - const val MERCHANT_NAME = "dashdirect_merchant_name" - const val HOW_TO_USE = "dashdirect_btn_how_to_use" + object DashSpend { + const val CREATE_ACCOUNT = "dashspend__btn_create_new_account" + const val LOGIN = "dashspend__btn_login" + const val SUCCESSFUL_LOGIN = "dashspend__success_login" + const val UNSUCCESSFUL_LOGIN = "dashspend__not_success_login" + const val SUCCESSFUL_PURCHASE = "dashspend__success_purchase" + const val PURCHASE_AMOUNT = "dashspend__purchase_amount" + const val DISCOUNT_AMOUNT = "dashspend__discount_amount" + const val MERCHANT_NAME = "dashspend__merchant_name" + const val HOW_TO_USE = "dashspend__btn_how_to_use" const val FILTER_GIFT_CARD = "home_transaction_filter_gift_card" const val DETAILS_GIFT_CARD = "home_transaction_details_gift_card" } @@ -291,22 +281,21 @@ object AnalyticsConstants { const val WELCOME_DIALOG_CONTINUE = "staking_cn__welcome_modal__b_continue" const val CREATE_NEW_ACCOUNT = "staking_cn__b_create_acc" const val CREATE_ACCOUNT_BUTTON = "staking_cn__new_acc__b_create_acc" - const val NOTIFY_WHEN_CREATED = "staking_cn__new_acc__b_close_notify" const val CREATE_ACCOUNT_ERROR_RETRY = "staking_cn__new_acc__dialogue_b_retry" - const val CREATE_ACCOUNT_ERROR_CLOSE = "staking_cn__new_acc__dialogue_b_close" + const val CREATE_ACCOUNT_SUCCESS = "staking_cn__new_account_created" const val LINK_EXISTING = "staking_cn__b_link_acc" const val LINK_EXISTING_LOGIN_BUTTON = "staking_cn__link_acc__b_login" - const val LINK_EXISTING_HOW_TO_CONFIRM = "staking_cn__link_acc__b_how_confirm_api" - const val LINK_EXISTING_SHOW_QR = "staking_cn__link_acc__b_show_qr" - const val LINK_EXISTING_SHARE_BUTTON = "staking_cn__link_acc__b_share" const val PORTAL_DEPOSIT = "staking_cn__b_deposit" + const val PORTAL_DEPOSIT_SUCCESS = "staking_cn_deposit_success" + const val PORTAL_DEPOSIT_ERROR = "staking_cn_deposit_error" const val PORTAL_WITHDRAW = "staking_cn__b_withdraw" const val PORTAL_WITHDRAW_CANCEL = "staking_cn__withdraw__m_b_cancel" + const val PORTAL_WITHDRAW_SUCCESS = "staking_cn_withdraw_success" + const val PORTAL_WITHDRAW_ERROR = "staking_cn_withdraw_error" const val PORTAL_WITHDRAW_BUY = "staking_cn__withdraw__m_b_buy" const val PORTAL_CREATE_ONLINE_ACCOUNT = "staking_cn__b_create_online_acc" - const val PORTAL_INFO_BUTTON = "staking_cn__b_info" const val PORTAL_VERIFY = "staking_cn__b_verify" const val CREATE_ONLINE_CONTINUE = "staking_cn__online__b_continue" @@ -324,55 +313,22 @@ object AnalyticsConstants { const val BUY_DASH = "coinbase_buy_dash" const val CONVERT_DASH = "coinbase_convert_dash" const val TRANSFER_DASH = "coinbase_transfer_dash" + const val NEW_CONNECTION = "coinbase_new_connection" const val DISCONNECT = "coinbase_disconnect" const val BUY_CREATE_ACCOUNT = "coinbase_buy_b_create_dash_acc" const val BUY_ADD_PAYMENT_METHOD = "coinbase_buy_b_add_payment_method" - const val BUY_CHANGE_PAYMENT_METHOD = "coinbase_buy_b_change_p_method" - const val BUY_PAYMENT_METHOD = "coinbase_buy_p_method" const val BUY_ENTER_FIAT = "coinbase_buy_enter_amount_fiat" const val BUY_ENTER_DASH = "coinbase_buy_enter_amount_dash" - - // Currency selector isn't shown in Coinbase. - const val BUY_CHANGE_FIAT_CURRENCY = "coinbase_buy_b_change_fiat_currency" const val BUY_CONTINUE = "coinbase_buy_b_continue" const val BUY_AUTH_LIMIT = "coinbase_buy_b_auth_limit" - - const val BUY_QUOTE_TOP_BACK = "coinbase_buy_quote_b_back" - const val BUY_QUOTE_ANDROID_BACK = "coinbase_buy_quote_b_back_android" - const val BUY_QUOTE_CANCEL = "coinbase_buy_quote_b_cancel" - const val BUY_QUOTE_CANCEL_NO = "coinbase_buy_quote_modal_b_no" - const val BUY_QUOTE_CANCEL_YES = "coinbase_buy_quote_modal_b_yes" - const val BUY_QUOTE_CONFIRM = "coinbase_buy_quote_b_confirm" - const val BUY_QUOTE_RETRY = "coinbase_buy_quote_b_retry" const val BUY_QUOTE_FEE_INFO = "coinbase_buy_quote_b_fee_info" + const val BUY_QUOTE_RETRY = "coinbase_buy_quote_b_retry" // TODO: no retry in the Buy Quote screen const val BUY_SUCCESS_CLOSE = "coinbase_buy_success" const val BUY_ERROR_RETRY = "coinbase_buy_error_b_retry" const val BUY_ERROR_CLOSE = "coinbase_buy_error_b_close" - - // ----------------- TODO: NMA-1209 - const val SELL_DASH = "coinbase_sell_dash" - const val SELL_CREATE_ACCOUNT = "coinbase_sell_b_create_dash_acc" - const val SELL_ADD_PAYMENT_METHOD = "coinbase_sell_b_add_p_method" - const val SELL_MAX = "coinbase_sell_b_max" - const val SELL_CONTINUE = "coinbase_sell_b_get_quote" - const val SELL_ENTER_AMOUNT_FIAT = "coinbase_sell_enter_amount_fiat" - const val SELL_ENTER_AMOUNT_DASH = "coinbase_sell_enter_amount_dash" - - const val SELL_QUOTE_TOP_BACK = "coinbase_sell_b_back" - const val SELL_QUOTE_ANDROID_BACK = "coinbase_sell_b_back_android" - const val SELL_QUOTE_CANCEL = "coinbase_sell_preview_b_cancel" - const val SELL_QUOTE_CANCEL_NO = "coinbase_sell_preview_modal_b_no" - const val SELL_QUOTE_CANCEL_YES = "coinbase_sell_preview_modal_b_yes" - const val SELL_QUOTE_CONFIRM = "coinbase_sell_preview_b_confirm" - const val SELL_QUOTE_RETRY = "coinbase_sell_preview_b_retry" - const val SELL_QUOTE_FEE_INFO = "coinbase_sell_preview_b_fee_info" - - const val SELL_ERROR_RETRY = "coinbase_sell_error_b_retry" - const val SELL_ERROR_CLOSE = "coinbase_sell_error_b_close" - const val SELL_SUCCESS_CLOSE = "coinbase_sell_success_b_close" - // ------------------ + const val BUY_ERROR = "coinbase_buy_error" const val CONVERT_SELECT_COIN = "coinbase_convert_b_select_coin" const val CONVERT_BUY_ON_COINBASE = "coinbase_convert_b_buy_on_coinbase" @@ -394,24 +350,29 @@ object AnalyticsConstants { const val CONVERT_ERROR_RETRY = "coinbase_convert_error_b_retry" const val CONVERT_ERROR_CLOSE = "coinbase_convert_error_b_close" - const val TRANSFER_CONTINUE = "coinbase_transfer_b_transfer" + const val TRANSFER_CONTINUE = "coinbase_transfer_dash_btn_transfer" const val TRANSFER_ENTER_DASH = "coinbase_transfer_enter_amount_dash" const val TRANSFER_ENTER_FIAT = "coinbase_transfer_enter_amount_fiat" - const val TRANSFER_AUTH_LIMIT = "coinbase_transfer_b_auth_balance" + const val TRANSFER_SUCCESS = "coinbase_transfer_success" const val TRANSFER_SUCCESS_CLOSE = "coinbase_transfer_success_b_close" + const val TRANSFER_ERROR = "coinbase_transfer_error" const val TRANSFER_ERROR_RETRY = "coinbase_transfer_error_b_retry" const val TRANSFER_ERROR_CLOSE = "coinbase_transfer_error_b_close" + + const val QUOTE_CONFIRM = "coinbase_buy_quote_b_confirm" } object CoinJoinPrivacy { const val COINJOIN_START_MIXING = "settings_coinjoin_btn_start_mixing" const val COINJOIN_STOP_MIXING = "settings_coinjoin_btn_stop_mixing" + const val COINJOIN_MIXING_SUCCESS = "settings_coinjoin_mixed_success" + const val COINJOIN_MIXING_FAIL = "settings_coinjoin_mixed_fail" const val USERNAME_PRIVACY_BTN_CONTINUE = "username_privacy_btn_continue" const val USERNAME_PRIVACY_WIFI_BTN_CONTINUE = "username_privacy_wifi_btn_continue" const val USERNAME_PRIVACY_WIFI_BTN_CANCEL = "username_privacy_wifi_btn_cancel" - const val USERNAME_PRIVACY_CONFIRMATION_BTN_CONFIRM = "username_privacy_confirmation_btn_confirm" - const val USERNAME_PRIVACY_CONFIRMATION_BTN_CANCEL = "username_privacy_confirmation_btn_cancel" + const val USERNAME_PRIVACY_CONFIRMATION_BTN_CONFIRM = "username_privacy_confirm_btn_confirm" + const val USERNAME_PRIVACY_CONFIRMATION_BTN_CANCEL = "username_privacy_confirm_btn_cancel" } object UsernameVoting { @@ -420,6 +381,31 @@ object AnalyticsConstants { const val VOTE = "username_voting_details_btn_vote" const val VOTE_SUCCESS = "username_voting_details_btn_vote_success" const val VOTE_ERROR = "username_voting_details_btn_vote_fail" - const val VOTE_CANCEL = "username_voting_details_btn_vote_fail" + const val VOTE_CANCEL = "username_voting_details_btn_vote_cancel" + } + + object Onboarding { + const val SKIP = "start_btn_skip" + const val GET_STARTED = "start_btn_get_started" + const val NEW_WALLET = "start_btn_create_new_wallet" + const val NEW_WALLET_SUCCESS = "start_btn_create_new_wallet_success" + const val RECOVERY = "start_btn_restore_recovery_phrase" + const val RECOVERY_SUCCESS = "start_btn_recovery_phrase_success" + const val RESTORE_FROM_FILE = "start_btn_restore_file" + const val RESTORE_FROM_FILE_SUCCESS = "start_btn_restore_file_finish_success" + } + + object LockScreen { + const val QUICK_RECEIVE = "locked_screen_btn_quick_receive" + const val QUICK_RECEIVE_SUCCESS = "locked_screen_btn_quick_receive_success" // TODO: need to track received coins; moved to a separate story + const val QUICK_RECEIVE_AMOUNT = "locked_screen_btb_quick_receive_amount" + const val SCAN_TO_SEND = "locked_screen_btn_scan_to_send" + const val SCAN_TO_SEND_SEND = "locked_screen_btn_scan_to_send_btn_send" + const val SCAN_TO_SEND_SUCCESS = "locked_screen_btn_scan_to_send_success" + } + + object BlockchainExplorer { + const val INSIGHT_PICKED = "blockchain_explorer_insight_picked" + const val BLOCKCHAIR_PICKED = "blockchain_explorer_blockchair_picked" } } diff --git a/common/src/main/java/org/dash/wallet/common/transactions/TransactionUtils.kt b/common/src/main/java/org/dash/wallet/common/transactions/TransactionUtils.kt index 56094f6001..dd9fc0a025 100644 --- a/common/src/main/java/org/dash/wallet/common/transactions/TransactionUtils.kt +++ b/common/src/main/java/org/dash/wallet/common/transactions/TransactionUtils.kt @@ -19,7 +19,6 @@ package org.dash.wallet.common.transactions -import android.util.Log import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter diff --git a/common/src/main/java/org/dash/wallet/common/ui/avatar/UserAvatarPlaceholderDrawable.kt b/common/src/main/java/org/dash/wallet/common/ui/avatar/UserAvatarPlaceholderDrawable.kt index cbb4414149..050e3bdd62 100644 --- a/common/src/main/java/org/dash/wallet/common/ui/avatar/UserAvatarPlaceholderDrawable.kt +++ b/common/src/main/java/org/dash/wallet/common/ui/avatar/UserAvatarPlaceholderDrawable.kt @@ -31,7 +31,7 @@ class UserAvatarPlaceholderDrawable { val hsv = FloatArray(3) //Ascii codes for A: 65 - Z: 90, 0: 48 - 9: 57 //Ascii codes for A: 65 - Z: 90, 0: 48 - 9: 57 - val firstChar: Float = usernameFirstChar.toUpperCase().toFloat() + val firstChar: Float = usernameFirstChar.uppercaseChar().toFloat() val charIndex: Float charIndex = if (firstChar <= 57) { //57 == '9' in Ascii table (firstChar - 48f) / 36f // 48 == '0', 36 == total count of supported @@ -45,7 +45,7 @@ class UserAvatarPlaceholderDrawable { return TextDrawable.builder().beginConfig().textColor(Color.WHITE) .useFont(ResourcesCompat.getFont(context, R.font.inter_regular)) .fontSize(fontSize) - .endConfig().buildRound(usernameFirstChar.toString().toUpperCase(), bgColor) + .endConfig().buildRound(usernameFirstChar.toString().uppercase(), bgColor) } } } \ No newline at end of file diff --git a/common/src/main/java/org/dash/wallet/common/ui/dialogs/AdaptiveDialog.kt b/common/src/main/java/org/dash/wallet/common/ui/dialogs/AdaptiveDialog.kt index 4241193a70..c44172e387 100644 --- a/common/src/main/java/org/dash/wallet/common/ui/dialogs/AdaptiveDialog.kt +++ b/common/src/main/java/org/dash/wallet/common/ui/dialogs/AdaptiveDialog.kt @@ -190,16 +190,6 @@ open class AdaptiveDialog(@LayoutRes private val layout: Int): DialogFragment() if (isMessageShown) { messageView?.post { messageView.setTextIsSelectable(isMessageSelectable) - - if (messageView.lineCount > 3) { - titleView?.gravity = Gravity.START - messageView.gravity = Gravity.START - if (iconView?.layoutParams is LinearLayout.LayoutParams) { - iconView.updateLayoutParams { - gravity = Gravity.START - } - } - } } } diff --git a/common/src/main/java/org/dash/wallet/common/ui/dialogs/ExtraActionDialog.kt b/common/src/main/java/org/dash/wallet/common/ui/dialogs/ExtraActionDialog.kt index cbb502db34..2749cdc634 100644 --- a/common/src/main/java/org/dash/wallet/common/ui/dialogs/ExtraActionDialog.kt +++ b/common/src/main/java/org/dash/wallet/common/ui/dialogs/ExtraActionDialog.kt @@ -92,7 +92,7 @@ class ExtraActionDialog( show(activity.supportFragmentManager, "extra_action_dialog") } - private fun onExtraMessageAction(){ + private fun onExtraMessageAction() { onExtraMessageListener?.invoke() onExtraMessageListener = null dismiss() diff --git a/common/src/main/java/org/dash/wallet/common/util/GenericUtils.kt b/common/src/main/java/org/dash/wallet/common/util/GenericUtils.kt index ef5324d620..c6fa25f574 100644 --- a/common/src/main/java/org/dash/wallet/common/util/GenericUtils.kt +++ b/common/src/main/java/org/dash/wallet/common/util/GenericUtils.kt @@ -17,7 +17,6 @@ package org.dash.wallet.common.util -import android.os.Build import android.os.LocaleList import java.math.RoundingMode import java.text.NumberFormat @@ -95,11 +94,11 @@ object GenericUtils { /** * - * @param percent The number as a double where 1.00 is 1.00% + * @param percent The number as a double where 0.01 is 1.00% * @return */ - fun formatPercent(percent: Double): String? { + fun formatPercent(fraction: Double): String? { // the formatter translates 0.01 to 1.00% - return percentFormat.format(percent / 100) + return percentFormat.format(fraction) } } diff --git a/common/src/main/java/org/dash/wallet/common/util/MonetaryExt.kt b/common/src/main/java/org/dash/wallet/common/util/MonetaryExt.kt index 34a6fbf097..57421ac6f9 100644 --- a/common/src/main/java/org/dash/wallet/common/util/MonetaryExt.kt +++ b/common/src/main/java/org/dash/wallet/common/util/MonetaryExt.kt @@ -85,5 +85,5 @@ fun Fiat.toFormattedStringNoCode(): String { return format.format(this).toString() } -fun Fiat.discountBy(percentage: Double): Fiat = - Fiat.valueOf(currencyCode, (value * (100.0 - percentage) / 100).toLong()) +fun Fiat.discountBy(fraction: Double): Fiat = + Fiat.valueOf(currencyCode, (value * (1.0 - fraction)).toLong()) diff --git a/common/src/main/java/org/dash/wallet/common/util/NavigationExtensions.kt b/common/src/main/java/org/dash/wallet/common/util/NavigationExtensions.kt index 8df9de70c7..e0de2e2fa5 100644 --- a/common/src/main/java/org/dash/wallet/common/util/NavigationExtensions.kt +++ b/common/src/main/java/org/dash/wallet/common/util/NavigationExtensions.kt @@ -21,6 +21,7 @@ import android.net.Uri import androidx.fragment.app.DialogFragment import androidx.fragment.app.Fragment import androidx.navigation.NavDirections +import androidx.navigation.NavOptions import androidx.navigation.fragment.DialogFragmentNavigator import androidx.navigation.fragment.FragmentNavigator import androidx.navigation.fragment.findNavController @@ -51,8 +52,8 @@ fun DialogFragment.dialogSafeNavigate(directions: NavDirections) { } sealed class DeepLinkDestination(val deepLink: Uri) { - object ReceiveDash : DeepLinkDestination(Uri.parse("${Constants.DEEP_LINK_PREFIX}/payments/0")) - object SendDash : DeepLinkDestination(Uri.parse("${Constants.DEEP_LINK_PREFIX}/payments/1")) + data class ReceiveDash(val source: String) : DeepLinkDestination(Uri.parse("${Constants.DEEP_LINK_PREFIX}/payments/0/$source")) + data class SendDash(val source: String) : DeepLinkDestination(Uri.parse("${Constants.DEEP_LINK_PREFIX}/payments/1/$source")) data class Transaction(val txId: String) : DeepLinkDestination(Uri.parse("${Constants.DEEP_LINK_PREFIX}/transactions/$txId")) } diff --git a/common/src/main/java/org/dash/wallet/common/util/TextViewExt.kt b/common/src/main/java/org/dash/wallet/common/util/TextViewExt.kt index 3adaf6f94d..0e25d9a385 100644 --- a/common/src/main/java/org/dash/wallet/common/util/TextViewExt.kt +++ b/common/src/main/java/org/dash/wallet/common/util/TextViewExt.kt @@ -44,8 +44,8 @@ fun TextView.makeLinks(vararg links: Pair, @ColorR } } - startIndexOfLink = this.text.toString().toLowerCase(Locale.getDefault()).indexOf( - link.first.toLowerCase( + startIndexOfLink = this.text.toString().lowercase(Locale.getDefault()).indexOf( + link.first.lowercase( Locale.getDefault() ), startIndexOfLink + 1 diff --git a/common/src/main/res/drawable-v21/dark_gray_button_background.xml b/common/src/main/res/drawable-v21/dark_gray_button_background.xml new file mode 100644 index 0000000000..61c9f6aec4 --- /dev/null +++ b/common/src/main/res/drawable-v21/dark_gray_button_background.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/ic_info_blue.xml b/common/src/main/res/drawable/ic_info_blue.xml index a340936cce..cab6f7bfb9 100644 --- a/common/src/main/res/drawable/ic_info_blue.xml +++ b/common/src/main/res/drawable/ic_info_blue.xml @@ -15,67 +15,14 @@ ~ along with this program. If not, see . --> + android:width="47dp" + android:height="46dp" + android:viewportWidth="47" + android:viewportHeight="46"> - - - - - - - + android:pathData="M0.5,23C0.5,10.297 10.797,0 23.5,0V0C36.202,0 46.5,10.297 46.5,23V23C46.5,35.702 36.202,46 23.5,46V46C10.797,46 0.5,35.702 0.5,23V23Z" + android:fillColor="#008DE4"/> - - - - - - - - - - - - - - - - - - - - - - - + android:pathData="M18.28,30.975C18.272,30.521 18.409,30.162 18.69,29.896C18.979,29.631 19.366,29.498 19.85,29.498H22.241V22.959H20.178C19.701,22.959 19.319,22.83 19.03,22.572C18.748,22.307 18.604,21.951 18.596,21.506C18.588,21.06 18.729,20.709 19.018,20.451C19.307,20.185 19.694,20.053 20.178,20.053H23.834C24.287,20.053 24.651,20.185 24.924,20.451C25.198,20.717 25.334,21.08 25.334,21.541V29.498H27.139C27.631,29.498 28.018,29.631 28.299,29.896C28.588,30.162 28.729,30.521 28.721,30.975C28.713,31.412 28.569,31.764 28.287,32.029C28.006,32.287 27.623,32.416 27.139,32.416H19.85C19.373,32.416 18.994,32.287 18.713,32.029C18.432,31.764 18.287,31.412 18.28,30.975ZM21.338,15.611C21.338,15.041 21.534,14.561 21.924,14.17C22.315,13.779 22.791,13.584 23.354,13.584C23.924,13.584 24.401,13.779 24.784,14.17C25.174,14.561 25.369,15.041 25.369,15.611C25.369,16.174 25.174,16.654 24.784,17.053C24.401,17.443 23.924,17.639 23.354,17.639C22.791,17.639 22.315,17.443 21.924,17.053C21.534,16.654 21.338,16.174 21.338,15.611Z" + android:fillColor="#ffffff"/> diff --git a/features/exploredash/src/main/res/drawable/ic_open_link.xml b/common/src/main/res/drawable/ic_open_link.xml similarity index 100% rename from features/exploredash/src/main/res/drawable/ic_open_link.xml rename to common/src/main/res/drawable/ic_open_link.xml diff --git a/common/src/main/res/drawable/triangle_black_70.xml b/common/src/main/res/drawable/triangle_black_70.xml new file mode 100644 index 0000000000..b3deb6bd24 --- /dev/null +++ b/common/src/main/res/drawable/triangle_black_70.xml @@ -0,0 +1,10 @@ + + + diff --git a/common/src/main/res/layout/dialog_extra_action.xml b/common/src/main/res/layout/dialog_extra_action.xml index 6d15561cc7..1e1f918412 100644 --- a/common/src/main/res/layout/dialog_extra_action.xml +++ b/common/src/main/res/layout/dialog_extra_action.xml @@ -49,17 +49,20 @@ android:gravity="center" android:textAlignment="gravity" android:layout_weight="1" - android:layout_marginHorizontal="16dp" app:layout_constraintTop_toTopOf="@id/title" tools:text="If you reset your wallet you will lose all your funds if you have not backed up your recovery phrase." />