Code cleanup

This commit is contained in:
Milan Cerovsky 2024-12-01 07:55:43 +01:00
parent f89afbfb47
commit 088b2c82a5
8 changed files with 16 additions and 18 deletions

View File

@ -450,7 +450,7 @@ private fun MainActivity.NavigationHome(
val isEnoughSpace by storageCheckViewModel.isEnoughSpace.collectAsStateWithLifecycle()
val sdkStatus = walletViewModel.walletSnapshot.collectAsStateWithLifecycle().value?.status
val sdkStatus = walletViewModel.currentWalletSnapshot.collectAsStateWithLifecycle().value?.status
if (isEnoughSpace == false) {
Twig.info { "Not enough free space" }

View File

@ -81,11 +81,11 @@ class WalletViewModel(
val secretState: StateFlow<SecretState> = walletRepository.secretState
// This needs to be refactored once we support pin lock
val spendingKey = walletRepository.zashiSpendingKey
val zashiSpendingKey = walletRepository.zashiSpendingKey
val walletSnapshot: StateFlow<WalletSnapshot?> = walletRepository.currentWalletSnapshot
val currentWalletSnapshot: StateFlow<WalletSnapshot?> = walletRepository.currentWalletSnapshot
val addresses: StateFlow<WalletAddresses?> = walletRepository.currentAddresses
val currentAddresses: StateFlow<WalletAddresses?> = walletRepository.currentAddresses
@OptIn(ExperimentalCoroutinesApi::class)
val transactionHistoryState =

View File

@ -68,7 +68,7 @@ internal fun WrapAccount(goBalances: () -> Unit) {
val balanceState = walletViewModel.balanceState.collectAsStateWithLifecycle().value
val walletSnapshot = walletViewModel.walletSnapshot.collectAsStateWithLifecycle().value
val walletSnapshot = walletViewModel.currentWalletSnapshot.collectAsStateWithLifecycle().value
val isHideBalances = homeViewModel.isHideBalances.collectAsStateWithLifecycle().value ?: false

View File

@ -61,9 +61,9 @@ internal fun WrapBalances(goMultiTrxSubmissionFailure: () -> Unit) {
val synchronizer = walletViewModel.synchronizer.collectAsStateWithLifecycle().value
val walletSnapshot = walletViewModel.walletSnapshot.collectAsStateWithLifecycle().value
val walletSnapshot = walletViewModel.currentWalletSnapshot.collectAsStateWithLifecycle().value
val spendingKey = walletViewModel.spendingKey.collectAsStateWithLifecycle(null).value
val spendingKey = walletViewModel.zashiSpendingKey.collectAsStateWithLifecycle(null).value
val walletRestoringState = walletViewModel.walletRestoringState.collectAsStateWithLifecycle().value

View File

@ -52,7 +52,7 @@ internal fun WrapHome(
val isKeepScreenOnWhileSyncing = homeViewModel.isKeepScreenOnWhileSyncing.collectAsStateWithLifecycle().value
val walletSnapshot = walletViewModel.walletSnapshot.collectAsStateWithLifecycle().value
val walletSnapshot = walletViewModel.currentWalletSnapshot.collectAsStateWithLifecycle().value
val walletRestoringState = walletViewModel.walletRestoringState.collectAsStateWithLifecycle().value

View File

@ -10,7 +10,6 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.platform.LocalContext
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import cash.z.ecc.android.sdk.Synchronizer
@ -67,9 +66,9 @@ internal fun WrapSend(
val synchronizer = walletViewModel.synchronizer.collectAsStateWithLifecycle().value
val walletSnapshot = walletViewModel.walletSnapshot.collectAsStateWithLifecycle().value
val walletSnapshot = walletViewModel.currentWalletSnapshot.collectAsStateWithLifecycle().value
val spendingKey = walletViewModel.spendingKey.collectAsStateWithLifecycle(null).value
val spendingKey = walletViewModel.zashiSpendingKey.collectAsStateWithLifecycle(null).value
val monetarySeparators = MonetarySeparators.current(Locale.getDefault())

View File

@ -8,7 +8,6 @@ import androidx.annotation.VisibleForTesting
import androidx.compose.material3.SnackbarHostState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@ -69,7 +68,7 @@ internal fun MainActivity.WrapSendConfirmation(
val synchronizer = walletViewModel.synchronizer.collectAsStateWithLifecycle().value
val spendingKey = walletViewModel.spendingKey.collectAsStateWithLifecycle(null).value
val spendingKey = walletViewModel.zashiSpendingKey.collectAsStateWithLifecycle(null).value
val supportMessage = supportViewModel.supportInfo.collectAsStateWithLifecycle().value

View File

@ -274,7 +274,7 @@ class ScreenshotTest : UiTestPrerequisites() {
}
composeTestRule.waitUntil(DEFAULT_TIMEOUT_MILLISECONDS) {
composeTestRule.activity.walletViewModel.walletSnapshot.value != null
composeTestRule.activity.walletViewModel.currentWalletSnapshot.value != null
}
composeTestRule.waitUntilDoesNotExist(hasTestTag(ACKNOWLEDGE_CHECKBOX_TAG), DEFAULT_TIMEOUT_MILLISECONDS)
@ -452,7 +452,7 @@ private fun accountScreenshots(
composeTestRule.activity.walletViewModel.secretState.value is SecretState.Ready
}
composeTestRule.waitUntil(DEFAULT_TIMEOUT_MILLISECONDS) {
composeTestRule.activity.walletViewModel.walletSnapshot.value != null
composeTestRule.activity.walletViewModel.currentWalletSnapshot.value != null
}
composeTestRule.onNodeWithTag(AccountTag.BALANCE_VIEWS).also {
@ -495,7 +495,7 @@ private fun receiveZecScreenshots(
composeTestRule: AndroidComposeTestRule<ActivityScenarioRule<MainActivity>, MainActivity>
) {
composeTestRule.waitUntil(DEFAULT_TIMEOUT_MILLISECONDS) {
composeTestRule.activity.walletViewModel.addresses.value != null
composeTestRule.activity.walletViewModel.currentAddresses.value != null
}
composeTestRule.onNode(
@ -520,11 +520,11 @@ private fun sendZecScreenshots(
}
composeTestRule.waitUntil(DEFAULT_TIMEOUT_MILLISECONDS) {
runBlocking {
composeTestRule.activity.walletViewModel.spendingKey.first() != null
composeTestRule.activity.walletViewModel.zashiSpendingKey.first() != null
}
}
composeTestRule.waitUntil(DEFAULT_TIMEOUT_MILLISECONDS) {
composeTestRule.activity.walletViewModel.walletSnapshot.value != null
composeTestRule.activity.walletViewModel.currentWalletSnapshot.value != null
}
composeTestRule.onNode(hasText(resContext.getString(R.string.send_stage_send_title))).also {