Final improvements before beta release.
This commit is contained in:
parent
64461197b6
commit
b72b1434ac
|
@ -11,7 +11,7 @@ apply plugin: 'com.google.firebase.firebase-perf'
|
|||
|
||||
archivesBaseName = 'zcash-android-wallet'
|
||||
group = 'cash.z.ecc.android'
|
||||
version = '1.0.0-alpha09'
|
||||
version = '1.0.0-alpha10'
|
||||
|
||||
android {
|
||||
compileSdkVersion Deps.compileSdkVersion
|
||||
|
@ -21,7 +21,7 @@ android {
|
|||
applicationId 'cash.z.ecc.android'
|
||||
minSdkVersion Deps.minSdkVersion
|
||||
targetSdkVersion Deps.targetSdkVersion
|
||||
versionCode = 1_00_00_009
|
||||
versionCode = 1_00_00_010
|
||||
// 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'
|
||||
|
@ -164,6 +164,8 @@ dependencies {
|
|||
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
testImplementation Deps.Test.JUNIT
|
||||
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
|
||||
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.3'
|
||||
androidTestImplementation Deps.Test.Android.JUNIT
|
||||
androidTestImplementation Deps.Test.Android.ESPRESSO
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import androidx.camera.core.CameraXConfig
|
|||
import cash.z.ecc.android.di.component.AppComponent
|
||||
import cash.z.ecc.android.di.component.DaggerAppComponent
|
||||
import cash.z.ecc.android.feedback.FeedbackCoordinator
|
||||
import cash.z.wallet.sdk.ext.SilentTwig
|
||||
import cash.z.wallet.sdk.ext.TroubleshootingTwig
|
||||
import cash.z.wallet.sdk.ext.Twig
|
||||
import cash.z.wallet.sdk.ext.twig
|
||||
|
@ -36,7 +37,7 @@ class ZcashWalletApp : Application(), CameraXConfig.Provider {
|
|||
|
||||
override fun onCreate() {
|
||||
Thread.setDefaultUncaughtExceptionHandler(ExceptionReporter(Thread.getDefaultUncaughtExceptionHandler()))
|
||||
Twig.plant(TroubleshootingTwig())
|
||||
Twig.plant(SilentTwig())
|
||||
creationTime = System.currentTimeMillis()
|
||||
instance = this
|
||||
// Setup handler for uncaught exceptions.
|
||||
|
|
|
@ -9,6 +9,9 @@ import cash.z.ecc.android.R
|
|||
import cash.z.ecc.android.databinding.FragmentSendFinalBinding
|
||||
import cash.z.ecc.android.di.viewmodel.activityViewModel
|
||||
import cash.z.ecc.android.ext.goneIf
|
||||
import cash.z.ecc.android.feedback.Feedback
|
||||
import cash.z.ecc.android.feedback.Report
|
||||
import cash.z.ecc.android.feedback.Report.MetricType.*
|
||||
import cash.z.ecc.android.ui.base.BaseFragment
|
||||
import cash.z.wallet.sdk.entity.*
|
||||
import cash.z.wallet.sdk.ext.toAbbreviatedAddress
|
||||
|
@ -33,6 +36,9 @@ class SendFinalFragment : BaseFragment<FragmentSendFinalBinding>() {
|
|||
binding.buttonNext.setOnClickListener {
|
||||
onExit()
|
||||
}
|
||||
binding.buttonRetry.setOnClickListener {
|
||||
onRetry()
|
||||
}
|
||||
binding.backButtonHitArea.setOnClickListener {
|
||||
onExit()
|
||||
}
|
||||
|
@ -71,27 +77,31 @@ class SendFinalFragment : BaseFragment<FragmentSendFinalBinding>() {
|
|||
|
||||
private fun onPendingTxUpdated(pendingTransaction: PendingTransaction?) {
|
||||
try {
|
||||
if (pendingTransaction != null) sendViewModel.updateMetrics(pendingTransaction)
|
||||
val id = pendingTransaction?.id ?: -1
|
||||
var isSending = true
|
||||
var isFailure = false
|
||||
val message = when {
|
||||
pendingTransaction == null -> "Transaction not found"
|
||||
pendingTransaction.isMined() -> "Transaction Mined (id: $id)!\n\nSEND COMPLETE".also { isSending = false }
|
||||
pendingTransaction.isMined() -> "Transaction Mined!\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.isFailedEncoding() -> "ERROR: failed to encode transaction! (id: $id)".also { isSending = false; isFailure = true }
|
||||
pendingTransaction.isFailedSubmit() -> "ERROR: failed to submit transaction! (id: $id)".also { isSending = false; isFailure = true }
|
||||
pendingTransaction.isCreated() -> "Transaction creation complete!"
|
||||
pendingTransaction.isCreating() -> "Creating transaction . . ."
|
||||
else -> "Transaction updated!".also { twig("Unhandled TX state: $pendingTransaction") }
|
||||
}
|
||||
twig("Pending TX Updated: $message")
|
||||
twig("Pending TX (id: ${pendingTransaction?.id} Updated with message: $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.goneIf((pendingTransaction?.isSubmitSuccess() != true) && (pendingTransaction?.isCreated() != true) && !isFailure)
|
||||
binding.buttonNext.text = if (isSending) "Done" else "Finished"
|
||||
binding.buttonRetry.goneIf(!isFailure)
|
||||
binding.progressHorizontal.goneIf(!isSending)
|
||||
|
||||
|
||||
if (pendingTransaction?.isSubmitSuccess() == true) {
|
||||
sendViewModel.reset()
|
||||
}
|
||||
|
@ -104,4 +114,9 @@ class SendFinalFragment : BaseFragment<FragmentSendFinalBinding>() {
|
|||
private fun onExit() {
|
||||
mainActivity?.navController?.popBackStack(R.id.nav_home, false)
|
||||
}
|
||||
}
|
||||
|
||||
private fun onRetry() {
|
||||
mainActivity?.navController?.popBackStack(R.id.nav_send_address, false)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.065"
|
||||
android:visibility="gone"
|
||||
app:srcCompat="@drawable/ic_close_black_24dp" />
|
||||
|
||||
<View
|
||||
|
@ -72,7 +73,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/text_dark"
|
||||
tools:text="Creating transaction..."
|
||||
android:textSize="16dp"
|
||||
android:gravity="center"
|
||||
android:textSize="20dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/radio_include_address"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
@ -104,6 +106,21 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/text_confirmation" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/button_retry"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
style="@style/Zcash.Button.OutlinedButton"
|
||||
app:strokeColor="@color/text_dark"
|
||||
android:padding="12dp"
|
||||
android:text="Retry"
|
||||
android:visibility="gone"
|
||||
android:textColor="@color/text_dark"
|
||||
app:layout_constraintEnd_toEndOf="@id/guide_keys"
|
||||
app:layout_constraintStart_toStartOf="@id/guide_keys"
|
||||
app:layout_constraintBottom_toTopOf="@id/button_next"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/button_next"
|
||||
android:layout_width="0dp"
|
||||
|
@ -113,6 +130,7 @@
|
|||
app:strokeColor="@color/text_dark"
|
||||
android:padding="12dp"
|
||||
android:text="Finished"
|
||||
android:visibility="gone"
|
||||
android:textColor="@color/text_dark"
|
||||
app:layout_constraintEnd_toEndOf="@id/guide_keys"
|
||||
app:layout_constraintStart_toStartOf="@id/guide_keys"
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
android:elevation="6dp"
|
||||
android:gravity="top"
|
||||
android:hint="Add a memo here"
|
||||
android:maxLines="3"
|
||||
android:imeActionLabel="add memo"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="textImeMultiLine"
|
||||
|
@ -208,5 +209,5 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:constraint_referenced_ids="input_memo, check_include_address, text_included_address, text_info_shielded"
|
||||
tools:visibility="gone" />
|
||||
tools:visibility="visible" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -174,8 +174,8 @@ class Feedback(capacity: Int = 256) {
|
|||
}
|
||||
|
||||
|
||||
interface Metric : Mappable<String, Any> {
|
||||
val key: String
|
||||
interface Metric : Mappable<String, Any>, Keyed<String> {
|
||||
override val key: String
|
||||
val startTime: Long?
|
||||
val endTime: Long?
|
||||
val elapsedTime: Long?
|
||||
|
@ -192,13 +192,17 @@ class Feedback(capacity: Int = 256) {
|
|||
}
|
||||
}
|
||||
|
||||
interface Action : Feedback.Mappable<String, Any> {
|
||||
val key: String
|
||||
interface Action : Feedback.Mappable<String, Any>, Keyed<String> {
|
||||
override val key: String
|
||||
override fun toMap(): Map<String, Any> {
|
||||
return mapOf("key" to key)
|
||||
}
|
||||
}
|
||||
|
||||
interface Keyed<T> {
|
||||
val key: T
|
||||
}
|
||||
|
||||
interface Mappable<K, V> {
|
||||
fun toMap(): Map<K, V>
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue