Minor tweaks and improvements.
This commit is contained in:
parent
ae41bd50cf
commit
27efadc218
|
@ -17,7 +17,7 @@ class SynchronizerModule {
|
|||
@Provides
|
||||
@SynchronizerScope
|
||||
fun provideSynchronizer(appContext: Context, initializer: Initializer): Synchronizer {
|
||||
return Synchronizer(appContext, initializer)
|
||||
return Synchronizer(initializer)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,10 @@ fun View.disabledIf(isDisabled: Boolean) {
|
|||
isEnabled = !isDisabled
|
||||
}
|
||||
|
||||
fun View.transparentIf(isTransparent: Boolean) {
|
||||
alpha = if (isTransparent) 0.0f else 1.0f
|
||||
}
|
||||
|
||||
fun View.onClickNavTo(navResId: Int, block: (() -> Any) = {}) {
|
||||
setOnClickListener {
|
||||
block()
|
||||
|
|
|
@ -50,7 +50,6 @@ import javax.inject.Inject
|
|||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
|
||||
|
||||
@Inject
|
||||
lateinit var feedback: Feedback
|
||||
|
||||
|
@ -324,6 +323,7 @@ class MainActivity : AppCompatActivity() {
|
|||
showSnackbar("Well, this is awkward. You denied permission for the camera.")
|
||||
}
|
||||
|
||||
// TODO: clean up this error handling
|
||||
private var ignoredErrors = 0
|
||||
private fun onProcessorError(error: Throwable?): Boolean {
|
||||
var notified = false
|
||||
|
@ -368,25 +368,25 @@ class MainActivity : AppCompatActivity() {
|
|||
}
|
||||
if (!notified) {
|
||||
ignoredErrors++
|
||||
}
|
||||
if (ignoredErrors >= ZcashSdk.RETRIES) {
|
||||
if (dialog == null) {
|
||||
notified = true
|
||||
runOnUiThread {
|
||||
dialog = MaterialAlertDialogBuilder(this)
|
||||
.setTitle("Processor Error")
|
||||
.setMessage(error?.message ?: "Critical error while processing blocks!")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("Retry") { d, _ ->
|
||||
d.dismiss()
|
||||
dialog = null
|
||||
}
|
||||
.setNegativeButton("Exit") { dialog, _ ->
|
||||
dialog.dismiss()
|
||||
throw error
|
||||
?: RuntimeException("Critical error while processing blocks and the user chose to exit.")
|
||||
}
|
||||
.show()
|
||||
if (ignoredErrors >= ZcashSdk.RETRIES) {
|
||||
if (dialog == null) {
|
||||
notified = true
|
||||
runOnUiThread {
|
||||
dialog = MaterialAlertDialogBuilder(this)
|
||||
.setTitle("Processor Error")
|
||||
.setMessage(error?.message ?: "Critical error while processing blocks!")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("Retry") { d, _ ->
|
||||
d.dismiss()
|
||||
dialog = null
|
||||
}
|
||||
.setNegativeButton("Exit") { dialog, _ ->
|
||||
dialog.dismiss()
|
||||
throw error
|
||||
?: RuntimeException("Critical error while processing blocks and the user chose to exit.")
|
||||
}
|
||||
.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ class WalletDetailFragment : BaseFragment<FragmentDetailBinding>() {
|
|||
adapter = TransactionAdapter()
|
||||
viewModel.transactions.collectWith(resumedScope) { onTransactionsUpdated(it) }
|
||||
binding.recyclerTransactions.adapter = adapter
|
||||
binding.recyclerTransactions.smoothScrollToPosition(0)
|
||||
}
|
||||
|
||||
private fun onTransactionsUpdated(transactions: PagedList<ConfirmedTransaction>) {
|
||||
|
|
|
@ -13,6 +13,7 @@ import cash.z.ecc.android.feedback.Report.MetricType
|
|||
import cash.z.ecc.android.feedback.Report.MetricType.*
|
||||
import cash.z.ecc.android.lockbox.LockBox
|
||||
import cash.z.ecc.android.ui.setup.WalletSetupViewModel
|
||||
import cash.z.ecc.android.ui.util.INCLUDE_MEMO_PREFIX
|
||||
import cash.z.wallet.sdk.Initializer
|
||||
import cash.z.wallet.sdk.Synchronizer
|
||||
import cash.z.wallet.sdk.entity.*
|
||||
|
@ -76,7 +77,7 @@ class SendViewModel @Inject constructor() : ViewModel() {
|
|||
}
|
||||
}
|
||||
|
||||
fun createMemoToSend() = if (includeFromAddress) "$memo\nsent from\n$fromAddress" else memo
|
||||
fun createMemoToSend() = if (includeFromAddress) "$memo\n$INCLUDE_MEMO_PREFIX\n$fromAddress" else memo
|
||||
|
||||
private fun reportIssues(memoToSend: String) {
|
||||
if (toAddress == fromAddress) feedback.report(Issue.SelfSend)
|
||||
|
@ -196,7 +197,6 @@ class SendViewModel @Inject constructor() : ViewModel() {
|
|||
private fun Keyed<String>.toMetricIdFor(id: Long): String = "$id.$key"
|
||||
private fun String.toRelatedMetricId(): String = "$this.related"
|
||||
private fun String.toTxId(): Long = split('.').first().toLong()
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue