checkpoint: verifying non-mock behavior, prior to major changes
This commit is contained in:
parent
4d802828ed
commit
d66ead2e24
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -49,7 +49,14 @@ internal object SynchronizerModule {
|
|||
@Provides
|
||||
@Singleton
|
||||
fun provideWallet(application: ZcashWalletApplication, converter: JniConverter): Wallet {
|
||||
return Wallet(converter, application.getDatabasePath(SampleProperties.wallet.dataDbName).absolutePath, "${application.cacheDir.absolutePath}/params", seedProvider = SampleProperties.wallet.seedProvider, spendingKeyProvider = SampleProperties.wallet.spendingKeyProvider)
|
||||
return Wallet(
|
||||
context = application,
|
||||
converter = converter,
|
||||
dbDataPath = application.getDatabasePath(SampleProperties.wallet.dataDbName).absolutePath,
|
||||
paramDestinationDir = "${application.cacheDir.absolutePath}/params",
|
||||
seedProvider = SampleProperties.wallet.seedProvider,
|
||||
spendingKeyProvider = SampleProperties.wallet.spendingKeyProvider
|
||||
)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
|
@ -78,7 +85,15 @@ internal object SynchronizerModule {
|
|||
manager: ActiveTransactionManager,
|
||||
wallet: Wallet
|
||||
): Synchronizer {
|
||||
return SdkSynchronizer(downloader, processor, repository, manager, wallet, blockPollFrequency = 500_000L)
|
||||
return SdkSynchronizer(
|
||||
downloader,
|
||||
processor,
|
||||
repository,
|
||||
manager,
|
||||
wallet,
|
||||
batchSize = 100,
|
||||
blockPollFrequency = 50_000L
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ object AliceWallet {
|
|||
const val name = "test.reference.alice"
|
||||
val seedProvider = SampleSeedProvider(name)
|
||||
val spendingKeyProvider = SampleSpendingKeySharedPref(name)
|
||||
const val cacheDbName = "testalice_cache_perfection.db"
|
||||
const val dataDbName = "testalice_data_perfection.db"
|
||||
const val cacheDbName = "testalice_cache_emulator4.db"
|
||||
const val dataDbName = "testalice_data_emulator3.db"
|
||||
const val defaultSendAddress = "ztestsapling1wcp9fu5d3q945nwwyqxtf0dtn6pv22hmjxa39z0034ap734mvxkqz8kug4r2u2df2keekcne322" // bob's address
|
||||
}
|
||||
|
||||
|
@ -18,8 +18,8 @@ object BobWallet {
|
|||
val seedProvider =
|
||||
SampleSeedProvider(name)
|
||||
val spendingKeyProvider = SampleSpendingKeySharedPref(name)
|
||||
const val cacheDbName = "testbob_cache9.db"
|
||||
const val dataDbName = "testbob_data.db"
|
||||
const val cacheDbName = "testbob_cache_pixel.db"
|
||||
const val dataDbName = "testbob_data_pixel.db"
|
||||
const val defaultSendAddress = "ztestsapling1yv696xtjn3jykdej2pqx0999eydvvyfphnw97ddk2h5luyedpqzud3r87aq0d7qna3jzjqqdcvw" // alice's address
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ enum class Servers(val host: String) {
|
|||
|
||||
// TODO: load most of these properties in later, perhaps from settings
|
||||
object SampleProperties {
|
||||
val COMPACT_BLOCK_SERVER = Servers.EMULATOR.host
|
||||
val COMPACT_BLOCK_SERVER = Servers.WLAN.host
|
||||
const val COMPACT_BLOCK_PORT = 9067
|
||||
val wallet = AliceWallet
|
||||
// TODO: placeholder until we have a network service for this
|
||||
|
|
|
@ -13,6 +13,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import cash.z.android.wallet.R
|
||||
import cash.z.android.wallet.extention.toAppColor
|
||||
import cash.z.android.wallet.extention.toRelativeTimeString
|
||||
import cash.z.android.wallet.extention.truncate
|
||||
import cash.z.wallet.sdk.ext.convertZatoshiToZec
|
||||
import cash.z.wallet.sdk.ext.toZec
|
||||
import java.text.SimpleDateFormat
|
||||
|
@ -49,7 +50,7 @@ class TransactionViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView)
|
|||
val transactionIcon = if (tx.isSend) R.drawable.ic_sent_transaction else R.drawable.ic_received_transaction
|
||||
val zecAbsoluteValue = tx.value.absoluteValue.convertZatoshiToZec(3)
|
||||
val toOrFrom = if (tx.isSend) "to" else "from"
|
||||
val srcOrDestination = address ?: "from shielded mystery person"
|
||||
val srcOrDestination = tx.address?.truncate() ?: "shielded mystery person"
|
||||
timestamp.text = if (!tx.isMined || tx.timeInSeconds == 0L) "Pending" else (tx.timeInSeconds * 1000L).toRelativeTimeString() //formatter.format(tx.timeInSeconds * 1000)
|
||||
amount.text = "$sign$zecAbsoluteValue"
|
||||
amount.setTextColor(amountColor.toAppColor())
|
||||
|
|
|
@ -28,7 +28,6 @@ import cash.z.android.wallet.sample.SampleProperties
|
|||
import cash.z.android.wallet.ui.adapter.TransactionAdapter
|
||||
import cash.z.android.wallet.ui.presenter.HomePresenter
|
||||
import cash.z.android.wallet.ui.presenter.HomePresenterModule
|
||||
import cash.z.android.wallet.ui.presenter.Presenter
|
||||
import cash.z.android.wallet.ui.util.AlternatingRowColorDecoration
|
||||
import cash.z.android.wallet.ui.util.LottieLooper
|
||||
import cash.z.android.wallet.ui.util.TopAlignedSpan
|
||||
|
@ -40,7 +39,6 @@ import cash.z.wallet.sdk.data.twig
|
|||
import cash.z.wallet.sdk.ext.*
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.leinardi.android.speeddial.SpeedDialActionItem
|
||||
import dagger.Binds
|
||||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import kotlinx.coroutines.launch
|
||||
|
@ -271,7 +269,7 @@ class HomeFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener, HomeP
|
|||
binding.includeContent.lottieActiveTransaction.setAnimation(R.raw.lottie_send_success)
|
||||
binding.includeContent.lottieActiveTransaction.playAnimation()
|
||||
title = "ZEC Sent"
|
||||
subtitle = transactionState.timestamp.toRelativeTimeString()
|
||||
subtitle = "awaiting network confirmation..."
|
||||
binding.includeContent.textActiveTransactionValue.text = transaction.value.convertZatoshiToZecString(3)
|
||||
binding.includeContent.textActiveTransactionValue.visibility = View.VISIBLE
|
||||
binding.includeContent.buttonActiveTransactionCancel.visibility = View.GONE
|
||||
|
@ -281,7 +279,7 @@ class HomeFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener, HomeP
|
|||
} else {
|
||||
title = "Confirmation Received"
|
||||
subtitle = transactionState.timestamp.toRelativeTimeString()
|
||||
isShown = false;
|
||||
isShown = false
|
||||
isShownDelay = 5_000L
|
||||
// take it out of the list in a bit and skip counting confirmation animation for now (i.e. one is enough)
|
||||
}
|
||||
|
@ -425,15 +423,20 @@ class HomeFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener, HomeP
|
|||
* But don't do either of these things if the situation has not changed.
|
||||
*/
|
||||
private fun onContentRefreshComplete(isEmpty: Boolean) {
|
||||
val isAdapterEmpty = (binding.includeContent.recyclerTransactions.adapter?.itemCount ?: 0) == 0
|
||||
val isBalanceZero = binding.includeHeader.textBalanceZec.text.toString() == "0"
|
||||
val isActiveHidden = binding.includeContent.groupActiveTransactionItems.visibility != View.VISIBLE
|
||||
val isActuallyEmpty = isEmpty && isAdapterEmpty && isBalanceZero && isActiveHidden
|
||||
|
||||
// wasEmpty isn't enough info. it must be considered along with whether these views were ever initialized
|
||||
val wasEmpty = binding.includeContent.groupEmptyViewItems.visibility == View.VISIBLE
|
||||
// situation has changed when we weren't initialized but now we have a balance or emptiness has changed
|
||||
val situationHasChanged = !viewsInitialized || (isEmpty != wasEmpty)
|
||||
val situationHasChanged = !viewsInitialized || (isActuallyEmpty != wasEmpty)
|
||||
|
||||
twig("onContentRefreshComplete called initialized: $viewsInitialized isEmpty: $isEmpty wasEmpty: $wasEmpty")
|
||||
twig("onContentRefreshComplete called initialized: $viewsInitialized isEmpty: $isActuallyEmpty wasEmpty: $wasEmpty")
|
||||
if (situationHasChanged) {
|
||||
twig("The situation has changed! toggling views!")
|
||||
setContentViewShown(!isEmpty)
|
||||
setContentViewShown(!isActuallyEmpty)
|
||||
}
|
||||
|
||||
setRefreshAnimationPlaying(false).also { twig("refresh false from onContentRefreshComplete") }
|
||||
|
|
|
@ -52,5 +52,6 @@ class ProgressPresenter @Inject constructor(
|
|||
private fun bind(progress: Int) = view.launch {
|
||||
twig("binding progress of $progress on thread ${Thread.currentThread().name}!")
|
||||
view.showProgress(progress)
|
||||
twig("done binding progress of $progress on thread ${Thread.currentThread().name}!")
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue