parent
af92f1b52f
commit
0d3d0c4d19
|
@ -31,6 +31,7 @@ directly impact users rather than highlighting other key architectural updates.*
|
||||||
- The error dialog contains an error description now. It's useful for tracking down the failure cause.
|
- The error dialog contains an error description now. It's useful for tracking down the failure cause.
|
||||||
- A small circular progress indicator is displayed when the app runs block synchronization, and the available balance
|
- A small circular progress indicator is displayed when the app runs block synchronization, and the available balance
|
||||||
is zero instead of reflecting a result value.
|
is zero instead of reflecting a result value.
|
||||||
|
- Block synchronization statuses have been simplified to Syncing, Synced, and Error states only
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Button sizing has been updated to align with the design guidelines and preserve stretching if necessary
|
- Button sizing has been updated to align with the design guidelines and preserve stretching if necessary
|
||||||
|
|
|
@ -35,6 +35,7 @@ class BalancesTestSetup(
|
||||||
onSettings = {
|
onSettings = {
|
||||||
onSettingsCount.incrementAndGet()
|
onSettingsCount.incrementAndGet()
|
||||||
},
|
},
|
||||||
|
isDetailedStatus = false,
|
||||||
isFiatConversionEnabled = isShowFiatConversion,
|
isFiatConversionEnabled = isShowFiatConversion,
|
||||||
isUpdateAvailable = false,
|
isUpdateAvailable = false,
|
||||||
isShowingErrorDialog = false,
|
isShowingErrorDialog = false,
|
||||||
|
|
|
@ -29,9 +29,10 @@ class WalletDisplayValuesTest {
|
||||||
)
|
)
|
||||||
val values =
|
val values =
|
||||||
WalletDisplayValues.getNextValues(
|
WalletDisplayValues.getNextValues(
|
||||||
getAppContext(),
|
context = getAppContext(),
|
||||||
walletSnapshot,
|
walletSnapshot = walletSnapshot,
|
||||||
false
|
isUpdateAvailable = false,
|
||||||
|
isDetailedStatus = false
|
||||||
)
|
)
|
||||||
|
|
||||||
assertNotNull(values)
|
assertNotNull(values)
|
||||||
|
|
|
@ -5,6 +5,7 @@ import androidx.lifecycle.AndroidViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import co.electriccoin.zcash.configuration.AndroidConfigurationFactory
|
import co.electriccoin.zcash.configuration.AndroidConfigurationFactory
|
||||||
import co.electriccoin.zcash.configuration.model.map.Configuration
|
import co.electriccoin.zcash.configuration.model.map.Configuration
|
||||||
|
import co.electriccoin.zcash.preference.model.entry.BooleanPreferenceDefault
|
||||||
import co.electriccoin.zcash.ui.common.ANDROID_STATE_FLOW_TIMEOUT
|
import co.electriccoin.zcash.ui.common.ANDROID_STATE_FLOW_TIMEOUT
|
||||||
import co.electriccoin.zcash.ui.preference.StandardPreferenceKeys
|
import co.electriccoin.zcash.ui.preference.StandardPreferenceKeys
|
||||||
import co.electriccoin.zcash.ui.preference.StandardPreferenceSingleton
|
import co.electriccoin.zcash.ui.preference.StandardPreferenceSingleton
|
||||||
|
@ -12,6 +13,7 @@ import co.electriccoin.zcash.ui.screen.home.HomeScreenIndex
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.SharingStarted
|
import kotlinx.coroutines.flow.SharingStarted
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
|
import kotlinx.coroutines.flow.WhileSubscribed
|
||||||
import kotlinx.coroutines.flow.emitAll
|
import kotlinx.coroutines.flow.emitAll
|
||||||
import kotlinx.coroutines.flow.flow
|
import kotlinx.coroutines.flow.flow
|
||||||
import kotlinx.coroutines.flow.stateIn
|
import kotlinx.coroutines.flow.stateIn
|
||||||
|
@ -24,13 +26,31 @@ class HomeViewModel(application: Application) : AndroidViewModel(application) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A flow of whether background sync is enabled
|
* A flow of whether background sync is enabled
|
||||||
* Current Home sub-screen index in flow.
|
|
||||||
*/
|
*/
|
||||||
val isBackgroundSyncEnabled: StateFlow<Boolean?> =
|
val isBackgroundSyncEnabled: StateFlow<Boolean?> =
|
||||||
flow {
|
booleanStateFlow(StandardPreferenceKeys.IS_BACKGROUND_SYNC_ENABLED)
|
||||||
val preferenceProvider = StandardPreferenceSingleton.getInstance(application)
|
|
||||||
emitAll(StandardPreferenceKeys.IS_BACKGROUND_SYNC_ENABLED.observe(preferenceProvider))
|
/**
|
||||||
}.stateIn(viewModelScope, SharingStarted.WhileSubscribed(ANDROID_STATE_FLOW_TIMEOUT.inWholeMilliseconds), null)
|
* A flow of whether keep screen on while syncing is on or off
|
||||||
|
*/
|
||||||
|
val isKeepScreenOnWhileSyncing: StateFlow<Boolean?> =
|
||||||
|
booleanStateFlow(StandardPreferenceKeys.IS_KEEP_SCREEN_ON_DURING_SYNC)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A flow of whether the app uses simple or detailed block synchronization status information for the UI
|
||||||
|
*/
|
||||||
|
val isDetailedSyncStatus: StateFlow<Boolean?> =
|
||||||
|
booleanStateFlow(StandardPreferenceKeys.IS_DETAILED_SYNC_STATUS)
|
||||||
|
|
||||||
|
private fun booleanStateFlow(default: BooleanPreferenceDefault): StateFlow<Boolean?> =
|
||||||
|
flow<Boolean?> {
|
||||||
|
val preferenceProvider = StandardPreferenceSingleton.getInstance(getApplication())
|
||||||
|
emitAll(default.observe(preferenceProvider))
|
||||||
|
}.stateIn(
|
||||||
|
viewModelScope,
|
||||||
|
SharingStarted.WhileSubscribed(ANDROID_STATE_FLOW_TIMEOUT),
|
||||||
|
null
|
||||||
|
)
|
||||||
|
|
||||||
val configurationFlow: StateFlow<Configuration?> =
|
val configurationFlow: StateFlow<Configuration?> =
|
||||||
AndroidConfigurationFactory.getInstance(application).getConfigurationFlow()
|
AndroidConfigurationFactory.getInstance(application).getConfigurationFlow()
|
||||||
|
|
|
@ -26,13 +26,14 @@ object StandardPreferenceKeys {
|
||||||
WalletRestoringState.RESTORING.toNumber()
|
WalletRestoringState.RESTORING.toNumber()
|
||||||
)
|
)
|
||||||
|
|
||||||
// Default to true until https://github.com/Electric-Coin-Company/zashi-android/issues/304
|
|
||||||
val IS_ANALYTICS_ENABLED = BooleanPreferenceDefault(PreferenceKey("is_analytics_enabled"), true)
|
val IS_ANALYTICS_ENABLED = BooleanPreferenceDefault(PreferenceKey("is_analytics_enabled"), true)
|
||||||
|
|
||||||
val IS_BACKGROUND_SYNC_ENABLED = BooleanPreferenceDefault(PreferenceKey("is_background_sync_enabled"), true)
|
val IS_BACKGROUND_SYNC_ENABLED = BooleanPreferenceDefault(PreferenceKey("is_background_sync_enabled"), true)
|
||||||
|
|
||||||
val IS_KEEP_SCREEN_ON_DURING_SYNC = BooleanPreferenceDefault(PreferenceKey("is_keep_screen_on_during_sync"), true)
|
val IS_KEEP_SCREEN_ON_DURING_SYNC = BooleanPreferenceDefault(PreferenceKey("is_keep_screen_on_during_sync"), true)
|
||||||
|
|
||||||
|
val IS_DETAILED_SYNC_STATUS = BooleanPreferenceDefault(PreferenceKey("is_detailed_sync_status"), false)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The fiat currency that the user prefers.
|
* The fiat currency that the user prefers.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -37,6 +37,7 @@ import org.jetbrains.annotations.VisibleForTesting
|
||||||
@Composable
|
@Composable
|
||||||
internal fun WrapBalances(
|
internal fun WrapBalances(
|
||||||
activity: ComponentActivity,
|
activity: ComponentActivity,
|
||||||
|
isDetailedSyncStatus: Boolean,
|
||||||
goSettings: () -> Unit,
|
goSettings: () -> Unit,
|
||||||
goMultiTrxSubmissionFailure: () -> Unit,
|
goMultiTrxSubmissionFailure: () -> Unit,
|
||||||
) {
|
) {
|
||||||
|
@ -63,10 +64,11 @@ internal fun WrapBalances(
|
||||||
|
|
||||||
WrapBalances(
|
WrapBalances(
|
||||||
balanceState = balanceState,
|
balanceState = balanceState,
|
||||||
checkUpdateViewModel = checkUpdateViewModel,
|
|
||||||
createTransactionsViewModel = createTransactionsViewModel,
|
createTransactionsViewModel = createTransactionsViewModel,
|
||||||
|
checkUpdateViewModel = checkUpdateViewModel,
|
||||||
goSettings = goSettings,
|
goSettings = goSettings,
|
||||||
goMultiTrxSubmissionFailure = goMultiTrxSubmissionFailure,
|
goMultiTrxSubmissionFailure = goMultiTrxSubmissionFailure,
|
||||||
|
isDetailedSyncStatus = isDetailedSyncStatus,
|
||||||
spendingKey = spendingKey,
|
spendingKey = spendingKey,
|
||||||
synchronizer = synchronizer,
|
synchronizer = synchronizer,
|
||||||
walletSnapshot = walletSnapshot,
|
walletSnapshot = walletSnapshot,
|
||||||
|
@ -85,6 +87,7 @@ internal fun WrapBalances(
|
||||||
createTransactionsViewModel: CreateTransactionsViewModel,
|
createTransactionsViewModel: CreateTransactionsViewModel,
|
||||||
goSettings: () -> Unit,
|
goSettings: () -> Unit,
|
||||||
goMultiTrxSubmissionFailure: () -> Unit,
|
goMultiTrxSubmissionFailure: () -> Unit,
|
||||||
|
isDetailedSyncStatus: Boolean,
|
||||||
spendingKey: UnifiedSpendingKey?,
|
spendingKey: UnifiedSpendingKey?,
|
||||||
synchronizer: Synchronizer?,
|
synchronizer: Synchronizer?,
|
||||||
walletSnapshot: WalletSnapshot?,
|
walletSnapshot: WalletSnapshot?,
|
||||||
|
@ -129,10 +132,11 @@ internal fun WrapBalances(
|
||||||
} else {
|
} else {
|
||||||
Balances(
|
Balances(
|
||||||
balanceState = balanceState,
|
balanceState = balanceState,
|
||||||
onSettings = goSettings,
|
|
||||||
isFiatConversionEnabled = isFiatConversionEnabled,
|
isFiatConversionEnabled = isFiatConversionEnabled,
|
||||||
isUpdateAvailable = isUpdateAvailable,
|
isUpdateAvailable = isUpdateAvailable,
|
||||||
isShowingErrorDialog = isShowingErrorDialog,
|
isShowingErrorDialog = isShowingErrorDialog,
|
||||||
|
isDetailedStatus = isDetailedSyncStatus,
|
||||||
|
onSettings = goSettings,
|
||||||
setShowErrorDialog = setShowErrorDialog,
|
setShowErrorDialog = setShowErrorDialog,
|
||||||
onShielding = {
|
onShielding = {
|
||||||
scope.launch {
|
scope.launch {
|
||||||
|
|
|
@ -26,7 +26,8 @@ data class WalletDisplayValues(
|
||||||
internal fun getNextValues(
|
internal fun getNextValues(
|
||||||
context: Context,
|
context: Context,
|
||||||
walletSnapshot: WalletSnapshot,
|
walletSnapshot: WalletSnapshot,
|
||||||
updateAvailable: Boolean = false
|
isUpdateAvailable: Boolean = false,
|
||||||
|
isDetailedStatus: Boolean = false,
|
||||||
): WalletDisplayValues {
|
): WalletDisplayValues {
|
||||||
var progress = PercentDecimal.ZERO_PERCENT
|
var progress = PercentDecimal.ZERO_PERCENT
|
||||||
val zecAmountText = walletSnapshot.totalBalance().toZecString()
|
val zecAmountText = walletSnapshot.totalBalance().toZecString()
|
||||||
|
@ -59,32 +60,47 @@ data class WalletDisplayValues(
|
||||||
}
|
}
|
||||||
Synchronizer.Status.SYNCED -> {
|
Synchronizer.Status.SYNCED -> {
|
||||||
statusText =
|
statusText =
|
||||||
if (updateAvailable) {
|
if (isUpdateAvailable) {
|
||||||
context.getString(R.string.balances_status_update)
|
context.getString(
|
||||||
|
R.string.balances_status_update,
|
||||||
|
context.getString(R.string.app_name)
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
context.getString(R.string.balances_status_synced)
|
context.getString(R.string.balances_status_synced)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Synchronizer.Status.DISCONNECTED -> {
|
Synchronizer.Status.DISCONNECTED -> {
|
||||||
statusText =
|
if (isDetailedStatus) {
|
||||||
context.getString(
|
statusText =
|
||||||
R.string.balances_status_error,
|
context.getString(
|
||||||
context.getString(R.string.balances_status_error_connection)
|
R.string.balances_status_error_detailed,
|
||||||
)
|
context.getString(R.string.balances_status_error_detailed_connection)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
statusText = context.getString(R.string.balances_status_error_simple)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Synchronizer.Status.STOPPED -> {
|
Synchronizer.Status.STOPPED -> {
|
||||||
statusText = context.getString(R.string.balances_status_stopped)
|
if (isDetailedStatus) {
|
||||||
|
statusText = context.getString(R.string.balances_status_stopped)
|
||||||
|
} else {
|
||||||
|
statusText = context.getString(R.string.balances_status_syncing)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// More detailed error message
|
// More detailed error message
|
||||||
walletSnapshot.synchronizerError?.let {
|
walletSnapshot.synchronizerError?.let {
|
||||||
statusText =
|
if (isDetailedStatus) {
|
||||||
context.getString(
|
statusText =
|
||||||
R.string.balances_status_error,
|
context.getString(
|
||||||
walletSnapshot.synchronizerError.getCauseMessage()
|
R.string.balances_status_error_detailed,
|
||||||
?: context.getString(R.string.balances_status_error_unknown)
|
walletSnapshot.synchronizerError.getCauseMessage()
|
||||||
)
|
?: context.getString(R.string.balances_status_error_detailed_unknown)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
statusText = context.getString(R.string.balances_status_error_simple)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return WalletDisplayValues(
|
return WalletDisplayValues(
|
||||||
|
|
|
@ -86,6 +86,7 @@ private fun ComposableBalancesPreview() {
|
||||||
GradientSurface {
|
GradientSurface {
|
||||||
Balances(
|
Balances(
|
||||||
onSettings = {},
|
onSettings = {},
|
||||||
|
isDetailedStatus = false,
|
||||||
isFiatConversionEnabled = false,
|
isFiatConversionEnabled = false,
|
||||||
isUpdateAvailable = false,
|
isUpdateAvailable = false,
|
||||||
isShowingErrorDialog = false,
|
isShowingErrorDialog = false,
|
||||||
|
@ -94,7 +95,7 @@ private fun ComposableBalancesPreview() {
|
||||||
shieldState = ShieldState.Available,
|
shieldState = ShieldState.Available,
|
||||||
walletSnapshot = WalletSnapshotFixture.new(),
|
walletSnapshot = WalletSnapshotFixture.new(),
|
||||||
walletRestoringState = WalletRestoringState.NONE,
|
walletRestoringState = WalletRestoringState.NONE,
|
||||||
balanceState = BalanceStateFixture.new()
|
balanceState = BalanceStateFixture.new(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,6 +108,7 @@ private fun ComposableBalancesShieldFailurePreview() {
|
||||||
GradientSurface {
|
GradientSurface {
|
||||||
Balances(
|
Balances(
|
||||||
onSettings = {},
|
onSettings = {},
|
||||||
|
isDetailedStatus = false,
|
||||||
isFiatConversionEnabled = false,
|
isFiatConversionEnabled = false,
|
||||||
isUpdateAvailable = false,
|
isUpdateAvailable = false,
|
||||||
isShowingErrorDialog = true,
|
isShowingErrorDialog = true,
|
||||||
|
@ -115,7 +117,7 @@ private fun ComposableBalancesShieldFailurePreview() {
|
||||||
shieldState = ShieldState.Available,
|
shieldState = ShieldState.Available,
|
||||||
walletSnapshot = WalletSnapshotFixture.new(),
|
walletSnapshot = WalletSnapshotFixture.new(),
|
||||||
walletRestoringState = WalletRestoringState.NONE,
|
walletRestoringState = WalletRestoringState.NONE,
|
||||||
balanceState = BalanceStateFixture.new()
|
balanceState = BalanceStateFixture.new(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,6 +127,7 @@ private fun ComposableBalancesShieldFailurePreview() {
|
||||||
@Composable
|
@Composable
|
||||||
fun Balances(
|
fun Balances(
|
||||||
onSettings: () -> Unit,
|
onSettings: () -> Unit,
|
||||||
|
isDetailedStatus: Boolean,
|
||||||
isFiatConversionEnabled: Boolean,
|
isFiatConversionEnabled: Boolean,
|
||||||
isUpdateAvailable: Boolean,
|
isUpdateAvailable: Boolean,
|
||||||
isShowingErrorDialog: Boolean,
|
isShowingErrorDialog: Boolean,
|
||||||
|
@ -146,6 +149,7 @@ fun Balances(
|
||||||
} else {
|
} else {
|
||||||
BalancesMainContent(
|
BalancesMainContent(
|
||||||
balanceState = balanceState,
|
balanceState = balanceState,
|
||||||
|
isDetailedStatus = isDetailedStatus,
|
||||||
isFiatConversionEnabled = isFiatConversionEnabled,
|
isFiatConversionEnabled = isFiatConversionEnabled,
|
||||||
isUpdateAvailable = isUpdateAvailable,
|
isUpdateAvailable = isUpdateAvailable,
|
||||||
onShielding = onShielding,
|
onShielding = onShielding,
|
||||||
|
@ -235,6 +239,7 @@ private fun BalancesTopAppBar(
|
||||||
@Composable
|
@Composable
|
||||||
private fun BalancesMainContent(
|
private fun BalancesMainContent(
|
||||||
balanceState: BalanceState,
|
balanceState: BalanceState,
|
||||||
|
isDetailedStatus: Boolean,
|
||||||
isFiatConversionEnabled: Boolean,
|
isFiatConversionEnabled: Boolean,
|
||||||
isUpdateAvailable: Boolean,
|
isUpdateAvailable: Boolean,
|
||||||
onShielding: () -> Unit,
|
onShielding: () -> Unit,
|
||||||
|
@ -287,6 +292,7 @@ private fun BalancesMainContent(
|
||||||
SyncStatus(
|
SyncStatus(
|
||||||
walletSnapshot = walletSnapshot,
|
walletSnapshot = walletSnapshot,
|
||||||
isUpdateAvailable = isUpdateAvailable,
|
isUpdateAvailable = isUpdateAvailable,
|
||||||
|
isDetailedStatus = isDetailedStatus,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -465,9 +471,10 @@ fun BalancesOverview(
|
||||||
if (isFiatConversionEnabled) {
|
if (isFiatConversionEnabled) {
|
||||||
val walletDisplayValues =
|
val walletDisplayValues =
|
||||||
WalletDisplayValues.getNextValues(
|
WalletDisplayValues.getNextValues(
|
||||||
LocalContext.current,
|
context = LocalContext.current,
|
||||||
walletSnapshot,
|
walletSnapshot = walletSnapshot,
|
||||||
false
|
isUpdateAvailable = false,
|
||||||
|
isDetailedStatus = false
|
||||||
)
|
)
|
||||||
|
|
||||||
Column(Modifier.testTag(BalancesTag.FIAT_CONVERSION)) {
|
Column(Modifier.testTag(BalancesTag.FIAT_CONVERSION)) {
|
||||||
|
@ -606,13 +613,15 @@ fun PendingTransactionsRow(walletSnapshot: WalletSnapshot) {
|
||||||
@Composable
|
@Composable
|
||||||
fun SyncStatus(
|
fun SyncStatus(
|
||||||
isUpdateAvailable: Boolean,
|
isUpdateAvailable: Boolean,
|
||||||
|
isDetailedStatus: Boolean,
|
||||||
walletSnapshot: WalletSnapshot,
|
walletSnapshot: WalletSnapshot,
|
||||||
) {
|
) {
|
||||||
val walletDisplayValues =
|
val walletDisplayValues =
|
||||||
WalletDisplayValues.getNextValues(
|
WalletDisplayValues.getNextValues(
|
||||||
LocalContext.current,
|
context = LocalContext.current,
|
||||||
walletSnapshot,
|
walletSnapshot = walletSnapshot,
|
||||||
isUpdateAvailable
|
isUpdateAvailable = isUpdateAvailable,
|
||||||
|
isDetailedStatus = isDetailedStatus
|
||||||
)
|
)
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
|
@ -621,7 +630,8 @@ fun SyncStatus(
|
||||||
if (walletDisplayValues.statusText.isNotEmpty()) {
|
if (walletDisplayValues.statusText.isNotEmpty()) {
|
||||||
BodySmall(
|
BodySmall(
|
||||||
text = walletDisplayValues.statusText,
|
text = walletDisplayValues.statusText,
|
||||||
modifier = Modifier.testTag(BalancesTag.STATUS)
|
modifier = Modifier.testTag(BalancesTag.STATUS),
|
||||||
|
textAlign = TextAlign.Center
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(ZcashTheme.dimens.spacingSmall))
|
Spacer(modifier = Modifier.height(ZcashTheme.dimens.spacingSmall))
|
||||||
|
|
|
@ -13,6 +13,7 @@ import cash.z.ecc.android.sdk.model.ZecSend
|
||||||
import co.electriccoin.zcash.ui.MainActivity
|
import co.electriccoin.zcash.ui.MainActivity
|
||||||
import co.electriccoin.zcash.ui.R
|
import co.electriccoin.zcash.ui.R
|
||||||
import co.electriccoin.zcash.ui.common.compose.RestoreScreenBrightness
|
import co.electriccoin.zcash.ui.common.compose.RestoreScreenBrightness
|
||||||
|
import co.electriccoin.zcash.ui.common.model.VersionInfo
|
||||||
import co.electriccoin.zcash.ui.common.model.WalletRestoringState
|
import co.electriccoin.zcash.ui.common.model.WalletRestoringState
|
||||||
import co.electriccoin.zcash.ui.common.model.WalletSnapshot
|
import co.electriccoin.zcash.ui.common.model.WalletSnapshot
|
||||||
import co.electriccoin.zcash.ui.common.viewmodel.HomeViewModel
|
import co.electriccoin.zcash.ui.common.viewmodel.HomeViewModel
|
||||||
|
@ -25,7 +26,6 @@ import co.electriccoin.zcash.ui.screen.home.view.Home
|
||||||
import co.electriccoin.zcash.ui.screen.receive.WrapReceive
|
import co.electriccoin.zcash.ui.screen.receive.WrapReceive
|
||||||
import co.electriccoin.zcash.ui.screen.send.WrapSend
|
import co.electriccoin.zcash.ui.screen.send.WrapSend
|
||||||
import co.electriccoin.zcash.ui.screen.send.model.SendArguments
|
import co.electriccoin.zcash.ui.screen.send.model.SendArguments
|
||||||
import co.electriccoin.zcash.ui.screen.settings.viewmodel.SettingsViewModel
|
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
import kotlinx.collections.immutable.persistentListOf
|
||||||
import kotlinx.coroutines.channels.BufferOverflow
|
import kotlinx.coroutines.channels.BufferOverflow
|
||||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||||
|
@ -44,11 +44,16 @@ internal fun MainActivity.WrapHome(
|
||||||
|
|
||||||
val walletViewModel by viewModels<WalletViewModel>()
|
val walletViewModel by viewModels<WalletViewModel>()
|
||||||
|
|
||||||
val settingsViewModel by viewModels<SettingsViewModel>()
|
|
||||||
|
|
||||||
val homeScreenIndex = homeViewModel.screenIndex.collectAsStateWithLifecycle().value
|
val homeScreenIndex = homeViewModel.screenIndex.collectAsStateWithLifecycle().value
|
||||||
|
|
||||||
val isKeepScreenOnWhileSyncing = settingsViewModel.isKeepScreenOnWhileSyncing.collectAsStateWithLifecycle().value
|
val isKeepScreenOnWhileSyncing = homeViewModel.isKeepScreenOnWhileSyncing.collectAsStateWithLifecycle().value
|
||||||
|
|
||||||
|
// Detailed sync status info is used if set in configuration or if the app is built as debuggable
|
||||||
|
// (i.e. mainly in development)
|
||||||
|
val isDetailedSyncStatus =
|
||||||
|
homeViewModel.isDetailedSyncStatus.collectAsStateWithLifecycle().value.run {
|
||||||
|
this ?: false || VersionInfo.new(this@WrapHome).isDebuggable
|
||||||
|
}
|
||||||
|
|
||||||
val walletSnapshot = walletViewModel.walletSnapshot.collectAsStateWithLifecycle().value
|
val walletSnapshot = walletViewModel.walletSnapshot.collectAsStateWithLifecycle().value
|
||||||
|
|
||||||
|
@ -67,6 +72,7 @@ internal fun MainActivity.WrapHome(
|
||||||
goSettings = goSettings,
|
goSettings = goSettings,
|
||||||
goMultiTrxSubmissionFailure = goMultiTrxSubmissionFailure,
|
goMultiTrxSubmissionFailure = goMultiTrxSubmissionFailure,
|
||||||
homeScreenIndex = homeScreenIndex,
|
homeScreenIndex = homeScreenIndex,
|
||||||
|
isDetailedSyncStatus = isDetailedSyncStatus,
|
||||||
isKeepScreenOnWhileSyncing = isKeepScreenOnWhileSyncing,
|
isKeepScreenOnWhileSyncing = isKeepScreenOnWhileSyncing,
|
||||||
onPageChange = {
|
onPageChange = {
|
||||||
homeViewModel.screenIndex.value = it
|
homeViewModel.screenIndex.value = it
|
||||||
|
@ -86,6 +92,7 @@ internal fun WrapHome(
|
||||||
goScan: () -> Unit,
|
goScan: () -> Unit,
|
||||||
goSendConfirmation: (ZecSend) -> Unit,
|
goSendConfirmation: (ZecSend) -> Unit,
|
||||||
homeScreenIndex: HomeScreenIndex,
|
homeScreenIndex: HomeScreenIndex,
|
||||||
|
isDetailedSyncStatus: Boolean,
|
||||||
isKeepScreenOnWhileSyncing: Boolean?,
|
isKeepScreenOnWhileSyncing: Boolean?,
|
||||||
onPageChange: (HomeScreenIndex) -> Unit,
|
onPageChange: (HomeScreenIndex) -> Unit,
|
||||||
sendArguments: SendArguments,
|
sendArguments: SendArguments,
|
||||||
|
@ -166,6 +173,7 @@ internal fun WrapHome(
|
||||||
screenContent = {
|
screenContent = {
|
||||||
WrapBalances(
|
WrapBalances(
|
||||||
activity = activity,
|
activity = activity,
|
||||||
|
isDetailedSyncStatus = isDetailedSyncStatus,
|
||||||
goSettings = goSettings,
|
goSettings = goSettings,
|
||||||
goMultiTrxSubmissionFailure = goMultiTrxSubmissionFailure
|
goMultiTrxSubmissionFailure = goMultiTrxSubmissionFailure
|
||||||
)
|
)
|
||||||
|
|
|
@ -319,10 +319,6 @@ private fun RestoreSeedBirthdayTopAppBar(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO [#672]: Implement custom seed phrase pasting for wallet import
|
|
||||||
// TODO [#672]: https://github.com/Electric-Coin-Company/zashi-android/issues/672
|
|
||||||
// TODO [#1060]: https://github.com/Electric-Coin-Company/zashi-android/issues/1060
|
|
||||||
|
|
||||||
@OptIn(ExperimentalComposeUiApi::class)
|
@OptIn(ExperimentalComposeUiApi::class)
|
||||||
@Suppress("UNUSED_PARAMETER", "LongParameterList", "LongMethod")
|
@Suppress("UNUSED_PARAMETER", "LongParameterList", "LongMethod")
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
@ -18,17 +18,12 @@
|
||||||
<string name="balances_status_syncing_percentage" formatted="true"><xliff:g id="synced_percent" example="50.25">
|
<string name="balances_status_syncing_percentage" formatted="true"><xliff:g id="synced_percent" example="50.25">
|
||||||
%1$s</xliff:g>%%</string> <!-- double %% for escaping -->
|
%1$s</xliff:g>%%</string> <!-- double %% for escaping -->
|
||||||
<string name="balances_status_synced">Synced</string>
|
<string name="balances_status_synced">Synced</string>
|
||||||
<string name="balances_status_sending_format" formatted="true">Sending <xliff:g id="sending_amount" example=".023">%1$s</xliff:g></string>
|
<string name="balances_status_update">Please update <xliff:g id="app_name" example="Zashi">%1$s</xliff:g> using Google Play</string>
|
||||||
<string name="balances_status_receiving_format" formatted="true">Receiving <xliff:g id="receiving_amount" example=".023">%1$s</xliff:g> ZEC</string>
|
<string name="balances_status_error_simple"><xliff:g id="app_name" example="Zashi">%1$s</xliff:g> encountered an error while syncing, attempting to resolve…</string>
|
||||||
<string name="balances_status_shielding_format" formatted="true">Shielding <xliff:g id="shielding_amount" example=".023">%1$s</xliff:g> ZEC</string>
|
<string name="balances_status_error_detailed" formatted="true">Error: <xliff:g id="error_type" example="Lost connection">%1$s</xliff:g></string>
|
||||||
<string name="balances_status_update">Please Update via Play Store</string>
|
<string name="balances_status_error_detailed_connection">Disconnected</string>
|
||||||
<string name="balances_status_error" formatted="true">Error: <xliff:g id="error_type" example="Lost connection">%1$s</xliff:g></string>
|
<string name="balances_status_error_detailed_unknown">Unknown cause</string>
|
||||||
<string name="balances_status_error_connection">Disconnected</string>
|
|
||||||
<string name="balances_status_error_unknown">Unknown cause</string>
|
|
||||||
<string name="balances_status_stopped">Synchronizer stopped</string>
|
<string name="balances_status_stopped">Synchronizer stopped</string>
|
||||||
<string name="balances_status_updating_blockheight">Updating blockheight</string>
|
|
||||||
<string name="balances_status_fiat_currency_price_out_of_date" formatted="true"><xliff:g id="fiat_currency" example="USD">%1$s</xliff:g> price out-of-date</string>
|
|
||||||
<string name="balances_status_spendable" formatted="true">Fully spendable in <xliff:g id="spendable_time" example="2 minutes">%1$s</xliff:g></string>
|
|
||||||
|
|
||||||
<string name="balances_shielding_dialog_error_title">Failed to shield funds</string>
|
<string name="balances_shielding_dialog_error_title">Failed to shield funds</string>
|
||||||
<string name="balances_shielding_dialog_error_text">Error: The attempt to shield the transparent funds failed. Try it again, please.</string>
|
<string name="balances_shielding_dialog_error_text">Error: The attempt to shield the transparent funds failed. Try it again, please.</string>
|
||||||
|
|
Loading…
Reference in New Issue