Code freeze fixes

This commit is contained in:
Kevin Gorham 2020-01-13 20:58:09 -05:00
parent f7e438431d
commit f8603d424a
No known key found for this signature in database
GPG Key ID: CCA55602DF49FC38
9 changed files with 63 additions and 35 deletions

View File

@ -11,7 +11,7 @@ apply plugin: 'com.google.firebase.firebase-perf'
archivesBaseName = 'zcash-android-wallet'
group = 'cash.z.ecc.android'
version = '1.0.0-alpha08'
version = '1.0.0-alpha09'
android {
compileSdkVersion Deps.compileSdkVersion
@ -21,7 +21,7 @@ android {
applicationId 'cash.z.ecc.android'
minSdkVersion Deps.minSdkVersion
targetSdkVersion Deps.targetSdkVersion
versionCode = 1_00_00_008
versionCode = 1_00_00_009
// last digits are alpha(0XX) beta(2XX) rc(4XX) release(8XX). Ex: 1_08_04_401 is an release candidate build of version 1.8.4 and 1_08_04_800 would be the final release.
versionName = "$version"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'

View File

@ -291,18 +291,27 @@ twig("onModelUpdated (G) sendEnabled? ${new.isSendEnabled}")
when (action) {
FUND_NOW -> {
MaterialAlertDialogBuilder(activity)
.setMessage("To make full use of this wallet, deposit funds to your address or tap the faucet to trigger a tiny automatic deposit.\n\nFaucet funds are made available for the community by the community for testing. So please be kind enough to return what you borrow!")
.setMessage("To make full use of this wallet, deposit funds to your address.")
.setTitle("No Balance")
.setCancelable(true)
.setPositiveButton("Tap Faucet") { dialog, _ ->
dialog.dismiss()
setBanner("Tapping faucet...", CANCEL)
}
.setNegativeButton("View Address") { dialog, _ ->
.setPositiveButton("View Address") { dialog, _ ->
dialog.dismiss()
mainActivity?.navController?.navigate(R.id.action_nav_home_to_nav_receive)
}
.show()
// MaterialAlertDialogBuilder(activity)
// .setMessage("To make full use of this wallet, deposit funds to your address or tap the faucet to trigger a tiny automatic deposit.\n\nFaucet funds are made available for the community by the community for testing. So please be kind enough to return what you borrow!")
// .setTitle("No Balance")
// .setCancelable(true)
// .setPositiveButton("Tap Faucet") { dialog, _ ->
// dialog.dismiss()
// setBanner("Tapping faucet...", CANCEL)
// }
// .setNegativeButton("View Address") { dialog, _ ->
// dialog.dismiss()
// mainActivity?.navController?.navigate(R.id.action_nav_home_to_nav_receive)
// }
// .show()
}
CANCEL -> {
// TODO: trigger banner / balance update

View File

@ -83,7 +83,7 @@ class HomeViewModel @Inject constructor() : ViewModel() {
) {
// Note: the wallet is effectively empty if it cannot cover the miner's fee
val hasFunds: Boolean get() = availableBalance > (MINERS_FEE_ZATOSHI.toDouble() / ZATOSHI_PER_ZEC) // 0.0001
val hasBalance: Boolean get() = totalBalance > (MINERS_FEE_ZATOSHI.toDouble() / ZATOSHI_PER_ZEC) // 0.0001
val hasBalance: Boolean get() = totalBalance > 0
val isSynced: Boolean get() = status == SYNCED
val isSendEnabled: Boolean get() = isSynced && hasFunds

View File

@ -65,7 +65,12 @@ class SendAddressFragment : BaseFragment<FragmentSendAddressBinding>(),
binding.inputZcashAddress.apply {
doAfterTextChanged {
onAddressChanged(text.toString())
val trim = text.toString().trim()
if (text.toString() != trim) {
binding.inputZcashAddress
.findViewById<EditText>(R.id.input_zcash_address).setText(trim)
}
onAddressChanged(trim)
}
}
@ -108,7 +113,7 @@ class SendAddressFragment : BaseFragment<FragmentSendAddressBinding>(),
private fun onMax() {
if (maxZatoshi != null) {
binding.inputZcashAmount.apply {
setText(maxZatoshi.convertZatoshiToZecString())
setText(maxZatoshi.convertZatoshiToZecString(8))
postDelayed({
requestFocus()
setSelection(text?.length ?: 0)

View File

@ -14,6 +14,7 @@ import cash.z.wallet.sdk.entity.*
import cash.z.wallet.sdk.ext.toAbbreviatedAddress
import cash.z.wallet.sdk.ext.convertZatoshiToZecString
import cash.z.wallet.sdk.ext.twig
import com.crashlytics.android.Crashlytics
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.launchIn
@ -69,28 +70,34 @@ class SendFinalFragment : BaseFragment<FragmentSendFinalBinding>() {
}
private fun onPendingTxUpdated(pendingTransaction: PendingTransaction?) {
val id = pendingTransaction?.id ?: -1
var isSending = true
val message = when {
pendingTransaction == null -> "Transaction not found"
pendingTransaction.isMined() -> "Transaction Mined (id: $id)!\n\nSEND COMPLETE".also { isSending = false }
pendingTransaction.isSubmitSuccess() -> "Successfully submitted transaction!\nAwaiting confirmation . . ."
pendingTransaction.isFailedEncoding() -> "ERROR: failed to encode transaction! (id: $id)".also { isSending = false }
pendingTransaction.isFailedSubmit() -> "ERROR: failed to submit transaction! (id: $id)".also { isSending = false }
pendingTransaction.isCreated() -> "Transaction creation complete! (id: $id)"
pendingTransaction.isCreating() -> "Creating transaction . . ."
else -> "Transaction updated!".also { twig("Unhandled TX state: $pendingTransaction") }
}
twig("Pending TX Updated: $message")
binding.textStatus.apply {
text = "$text\n$message"
}
binding.backButton.goneIf(!binding.textStatus.text.toString().contains("Awaiting"))
binding.buttonNext.goneIf(isSending)
binding.progressHorizontal.goneIf(!isSending)
try {
val id = pendingTransaction?.id ?: -1
var isSending = true
val message = when {
pendingTransaction == null -> "Transaction not found"
pendingTransaction.isMined() -> "Transaction Mined (id: $id)!\n\nSEND COMPLETE".also { isSending = false }
pendingTransaction.isSubmitSuccess() -> "Successfully submitted transaction!\nAwaiting confirmation . . ."
pendingTransaction.isFailedEncoding() -> "ERROR: failed to encode transaction! (id: $id)".also { isSending = false }
pendingTransaction.isFailedSubmit() -> "ERROR: failed to submit transaction! (id: $id)".also { isSending = false }
pendingTransaction.isCreated() -> "Transaction creation complete! (id: $id)"
pendingTransaction.isCreating() -> "Creating transaction . . ."
else -> "Transaction updated!".also { twig("Unhandled TX state: $pendingTransaction") }
}
twig("Pending TX Updated: $message")
binding.textStatus.apply {
text = "$message"
}
binding.backButton.goneIf(!binding.textStatus.text.toString().contains("Awaiting"))
binding.buttonNext.goneIf((pendingTransaction?.isSubmitSuccess() != true) && (pendingTransaction?.isCreated() != true))
binding.buttonNext.text = if (isSending) "Done" else "Finished"
binding.progressHorizontal.goneIf(!isSending)
if (pendingTransaction?.isSubmitSuccess() == true) {
sendViewModel.reset()
if (pendingTransaction?.isSubmitSuccess() == true) {
sendViewModel.reset()
}
} catch(t: Throwable) {
twig("ERROR: error while handling pending transaction update! $t")
Crashlytics.logException(t)
}
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false" android:color="@color/text_light_dimmed"/>
<item android:state_pressed="true" android:color="@color/text_dark" />
</selector>

View File

@ -162,6 +162,7 @@
style="@style/TextAppearance.AppCompat.Body1"
android:textSize="16sp"
android:text="See Application Log"
android:textColor="@color/selector_button_text_light_dimmed"
app:layout_constraintTop_toBottomOf="@id/button_backup"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />

View File

@ -81,6 +81,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:text="Tap\nto send ZEC"
android:padding="12dp"
android:textColor="@color/text_dark"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"

View File

@ -45,9 +45,9 @@
<color name="zcashBlue">#26DAB6</color>
<!-- yellows -->
<color name="zcashYellow_light">#FFD649</color>
<color name="zcashYellow">#FFB727</color>
<color name="zcashYellow_dark">#FFA918</color>
<color name="zcashYellow_light">#FFCF4A</color>
<color name="zcashYellow">#FFB900</color>
<color name="zcashYellow_dark">#FFAA17</color>
<!-- -->