[#1082] Remove Side Navigation Drawer menu
- Closes #1082 - Closes #1086 - Added TODO links to the missing Settings actions - Fixed About screen versionCode displaying - Added app name to the About screen debug menu, as the Home screen does not contain it anymore - Changelog updated
This commit is contained in:
parent
ff0757b818
commit
f67c3fde8f
|
@ -9,6 +9,9 @@ directly impact users rather than highlighting other key architectural updates.*
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
### Removed
|
||||
- Home screen side menu navigation was removed in favor of the Settings screen
|
||||
|
||||
## [2.0.2 (491)] - 2023-12-01
|
||||
|
||||
### Changed
|
||||
|
|
|
@ -13,34 +13,16 @@ class HomeTestSetup(
|
|||
private val isShowFiatConversion: Boolean,
|
||||
private val isCircularProgressBar: Boolean
|
||||
) {
|
||||
private val onAboutCount = AtomicInteger(0)
|
||||
private val onSeedCount = AtomicInteger(0)
|
||||
private val onSettingsCount = AtomicInteger(0)
|
||||
private val onSupportCount = AtomicInteger(0)
|
||||
private val onReceiveCount = AtomicInteger(0)
|
||||
private val onSendCount = AtomicInteger(0)
|
||||
private val onHistoryCount = AtomicInteger(0)
|
||||
|
||||
fun getOnAboutCount(): Int {
|
||||
composeTestRule.waitForIdle()
|
||||
return onAboutCount.get()
|
||||
}
|
||||
|
||||
fun getOnSettingsCount(): Int {
|
||||
composeTestRule.waitForIdle()
|
||||
return onSettingsCount.get()
|
||||
}
|
||||
|
||||
fun getOnSupportCount(): Int {
|
||||
composeTestRule.waitForIdle()
|
||||
return onSupportCount.get()
|
||||
}
|
||||
|
||||
fun getOnSeedCount(): Int {
|
||||
composeTestRule.waitForIdle()
|
||||
return onSeedCount.get()
|
||||
}
|
||||
|
||||
fun getOnReceiveCount(): Int {
|
||||
composeTestRule.waitForIdle()
|
||||
return onReceiveCount.get()
|
||||
|
@ -64,7 +46,6 @@ class HomeTestSetup(
|
|||
@Composable
|
||||
@Suppress("TestFunctionName")
|
||||
fun DefaultContent() {
|
||||
val drawerValues = drawerBackHandler()
|
||||
Home(
|
||||
walletSnapshot,
|
||||
isUpdateAvailable = false,
|
||||
|
@ -74,15 +55,6 @@ class HomeTestSetup(
|
|||
goSettings = {
|
||||
onSettingsCount.incrementAndGet()
|
||||
},
|
||||
goSeedPhrase = {
|
||||
onSeedCount.incrementAndGet()
|
||||
},
|
||||
goSupport = {
|
||||
onSupportCount.incrementAndGet()
|
||||
},
|
||||
goAbout = {
|
||||
onAboutCount.incrementAndGet()
|
||||
},
|
||||
goReceive = {
|
||||
onReceiveCount.incrementAndGet()
|
||||
},
|
||||
|
@ -92,8 +64,6 @@ class HomeTestSetup(
|
|||
goHistory = {
|
||||
onHistoryCount.incrementAndGet()
|
||||
},
|
||||
drawerState = drawerValues.drawerState,
|
||||
scope = drawerValues.scope
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
package co.electriccoin.zcash.ui.screen.home.integration
|
||||
|
||||
import androidx.compose.ui.test.assertIsDisplayed
|
||||
import androidx.compose.ui.test.assertIsNotDisplayed
|
||||
import androidx.compose.ui.test.junit4.createAndroidComposeRule
|
||||
import androidx.compose.ui.test.onNodeWithTag
|
||||
import androidx.compose.ui.test.performClick
|
||||
import androidx.test.espresso.Espresso
|
||||
import androidx.test.filters.MediumTest
|
||||
import cash.z.ecc.android.sdk.Synchronizer
|
||||
import cash.z.ecc.android.sdk.model.PercentDecimal
|
||||
import co.electriccoin.zcash.test.UiTestPrerequisites
|
||||
import co.electriccoin.zcash.ui.common.UiTestingActivity
|
||||
import co.electriccoin.zcash.ui.fixture.WalletSnapshotFixture
|
||||
import co.electriccoin.zcash.ui.screen.home.HomeTag
|
||||
import co.electriccoin.zcash.ui.screen.home.HomeTestSetup
|
||||
import co.electriccoin.zcash.ui.screen.home.model.WalletSnapshot
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
||||
class HomeActivityTest : UiTestPrerequisites() {
|
||||
|
||||
@get:Rule
|
||||
val composeTestRule = createAndroidComposeRule<UiTestingActivity>()
|
||||
|
||||
private fun newTestSetup(walletSnapshot: WalletSnapshot) = HomeTestSetup(
|
||||
composeTestRule,
|
||||
walletSnapshot,
|
||||
isShowFiatConversion = false,
|
||||
isCircularProgressBar = false
|
||||
)
|
||||
|
||||
@Test
|
||||
@MediumTest
|
||||
fun open_close_drawer_menu_test() {
|
||||
val walletSnapshot = WalletSnapshotFixture.new(
|
||||
status = Synchronizer.Status.SYNCING,
|
||||
progress = PercentDecimal(0.5f)
|
||||
)
|
||||
val testSetup = newTestSetup(walletSnapshot)
|
||||
testSetup.setDefaultContent()
|
||||
|
||||
composeTestRule.onNodeWithTag(HomeTag.DRAWER_MENU).also {
|
||||
it.assertIsNotDisplayed()
|
||||
}
|
||||
composeTestRule.onNodeWithTag(HomeTag.DRAWER_MENU_OPEN_BUTTON).also {
|
||||
it.assertIsDisplayed()
|
||||
it.performClick()
|
||||
}
|
||||
|
||||
composeTestRule.waitForIdle()
|
||||
|
||||
composeTestRule.onNodeWithTag(HomeTag.DRAWER_MENU).also {
|
||||
it.assertIsDisplayed()
|
||||
}
|
||||
|
||||
Espresso.pressBack()
|
||||
|
||||
composeTestRule.waitForIdle()
|
||||
|
||||
composeTestRule.onNodeWithTag(HomeTag.DRAWER_MENU).also {
|
||||
it.assertIsNotDisplayed()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -133,22 +133,6 @@ class HomeViewTest : UiTestPrerequisites() {
|
|||
assertEquals(1, testSetup.getOnHistoryCount())
|
||||
}
|
||||
|
||||
@Test
|
||||
@MediumTest
|
||||
fun hamburger_seed() {
|
||||
val testSetup = newTestSetup()
|
||||
|
||||
assertEquals(0, testSetup.getOnReceiveCount())
|
||||
|
||||
composeTestRule.openNavigationDrawer()
|
||||
|
||||
composeTestRule.onNodeWithText(getStringResource(R.string.home_menu_seed_phrase)).also {
|
||||
it.performClick()
|
||||
}
|
||||
|
||||
assertEquals(1, testSetup.getOnSeedCount())
|
||||
}
|
||||
|
||||
@Test
|
||||
@MediumTest
|
||||
fun hamburger_settings() {
|
||||
|
@ -156,47 +140,11 @@ class HomeViewTest : UiTestPrerequisites() {
|
|||
|
||||
assertEquals(0, testSetup.getOnReceiveCount())
|
||||
|
||||
composeTestRule.openNavigationDrawer()
|
||||
|
||||
composeTestRule.onNodeWithText(getStringResource(R.string.home_menu_settings)).also {
|
||||
it.performClick()
|
||||
}
|
||||
composeTestRule.openSettings()
|
||||
|
||||
assertEquals(1, testSetup.getOnSettingsCount())
|
||||
}
|
||||
|
||||
@Test
|
||||
@MediumTest
|
||||
fun hamburger_support() {
|
||||
val testSetup = newTestSetup()
|
||||
|
||||
assertEquals(0, testSetup.getOnReceiveCount())
|
||||
|
||||
composeTestRule.openNavigationDrawer()
|
||||
|
||||
composeTestRule.onNodeWithText(getStringResource(R.string.home_menu_support)).also {
|
||||
it.performClick()
|
||||
}
|
||||
|
||||
assertEquals(1, testSetup.getOnSupportCount())
|
||||
}
|
||||
|
||||
@Test
|
||||
@MediumTest
|
||||
fun hamburger_about() {
|
||||
val testSetup = newTestSetup()
|
||||
|
||||
assertEquals(0, testSetup.getOnReceiveCount())
|
||||
|
||||
composeTestRule.openNavigationDrawer()
|
||||
|
||||
composeTestRule.onNodeWithText(getStringResource(R.string.home_menu_about)).also {
|
||||
it.performClick()
|
||||
}
|
||||
|
||||
assertEquals(1, testSetup.getOnAboutCount())
|
||||
}
|
||||
|
||||
private fun newTestSetup(
|
||||
isShowFiatConversion: Boolean = true,
|
||||
isCircularProgressBar: Boolean = true,
|
||||
|
@ -211,7 +159,7 @@ class HomeViewTest : UiTestPrerequisites() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun ComposeContentTestRule.openNavigationDrawer() {
|
||||
private fun ComposeContentTestRule.openSettings() {
|
||||
onNodeWithContentDescription(getStringResource(R.string.home_menu_content_description)).also {
|
||||
it.performClick()
|
||||
}
|
||||
|
|
|
@ -52,13 +52,10 @@ internal fun MainActivity.Navigation() {
|
|||
NavHost(navController = navController, startDestination = HOME) {
|
||||
composable(HOME) {
|
||||
WrapHome(
|
||||
goAbout = { navController.navigateJustOnce(ABOUT) },
|
||||
goHistory = { navController.navigateJustOnce(HISTORY) },
|
||||
goReceive = { navController.navigateJustOnce(RECEIVE) },
|
||||
goSeedPhrase = { navController.navigateJustOnce(SEED_RECOVERY) },
|
||||
goSend = { navController.navigateJustOnce(SEND) },
|
||||
goSettings = { navController.navigateJustOnce(SETTINGS) },
|
||||
goSupport = { navController.navigateJustOnce(SUPPORT) },
|
||||
)
|
||||
|
||||
if (ConfigurationEntries.IS_APP_UPDATE_CHECK_ENABLED.getValue(RemoteConfig.current)) {
|
||||
|
@ -80,9 +77,20 @@ internal fun MainActivity.Navigation() {
|
|||
goBack = {
|
||||
navController.popBackStackJustOnce(SETTINGS)
|
||||
},
|
||||
goDocumentation = {
|
||||
// TODO [#1084]: Documentation screen
|
||||
// TODO [#1084]: https://github.com/Electric-Coin-Company/zashi-android/issues/1084
|
||||
},
|
||||
goExportPrivateData = {
|
||||
navController.navigateJustOnce(EXPORT_PRIVATE_DATA)
|
||||
},
|
||||
goFeedback = {
|
||||
navController.navigateJustOnce(SUPPORT)
|
||||
},
|
||||
goPrivacyPolicy = {
|
||||
// TODO [#1083]: Privacy Policy screen
|
||||
// TODO [#1083]: https://github.com/Electric-Coin-Company/zashi-android/issues/1083
|
||||
},
|
||||
goSeedRecovery = {
|
||||
navController.navigateJustOnce(SEED_RECOVERY)
|
||||
}
|
||||
|
|
|
@ -122,6 +122,12 @@ private fun DebugMenu(
|
|||
DropdownMenuItem(
|
||||
text = {
|
||||
Column {
|
||||
Text(
|
||||
stringResource(
|
||||
id = R.string.about_debug_menu_app_name,
|
||||
stringResource(id = R.string.app_name)
|
||||
)
|
||||
)
|
||||
Text(stringResource(R.string.about_debug_menu_build, versionInfo.gitSha))
|
||||
Text(configInfo.toSupportString())
|
||||
}
|
||||
|
@ -167,8 +173,7 @@ fun AboutMainContent(
|
|||
Text(
|
||||
text = stringResource(
|
||||
R.string.about_version_format,
|
||||
versionInfo.versionName,
|
||||
versionInfo.versionCode
|
||||
versionInfo.versionName
|
||||
),
|
||||
style = ZcashTheme.typography.primary.titleSmall
|
||||
)
|
||||
|
|
|
@ -26,20 +26,14 @@ import kotlinx.coroutines.CoroutineScope
|
|||
@Composable
|
||||
@Suppress("LongParameterList")
|
||||
internal fun MainActivity.WrapHome(
|
||||
goSeedPhrase: () -> Unit,
|
||||
goSettings: () -> Unit,
|
||||
goSupport: () -> Unit,
|
||||
goAbout: () -> Unit,
|
||||
goReceive: () -> Unit,
|
||||
goSend: () -> Unit,
|
||||
goHistory: () -> Unit
|
||||
) {
|
||||
WrapHome(
|
||||
this,
|
||||
goSeedPhrase = goSeedPhrase,
|
||||
goSettings = goSettings,
|
||||
goSupport = goSupport,
|
||||
goAbout = goAbout,
|
||||
goReceive = goReceive,
|
||||
goSend = goSend,
|
||||
goHistory = goHistory,
|
||||
|
@ -50,10 +44,7 @@ internal fun MainActivity.WrapHome(
|
|||
@Suppress("LongParameterList")
|
||||
internal fun WrapHome(
|
||||
activity: ComponentActivity,
|
||||
goSeedPhrase: () -> Unit,
|
||||
goSettings: () -> Unit,
|
||||
goSupport: () -> Unit,
|
||||
goAbout: () -> Unit,
|
||||
goReceive: () -> Unit,
|
||||
goSend: () -> Unit,
|
||||
goHistory: () -> Unit,
|
||||
|
@ -82,23 +73,16 @@ internal fun WrapHome(
|
|||
if (null == walletSnapshot) {
|
||||
// Display loading indicator
|
||||
} else {
|
||||
val drawerValues = drawerBackHandler()
|
||||
|
||||
Home(
|
||||
walletSnapshot = walletSnapshot,
|
||||
isUpdateAvailable = updateAvailable,
|
||||
isKeepScreenOnDuringSync = isKeepScreenOnWhileSyncing,
|
||||
isFiatConversionEnabled = isFiatConversionEnabled,
|
||||
isCircularProgressBarEnabled = isCircularProgressBarEnabled,
|
||||
goSeedPhrase = goSeedPhrase,
|
||||
goSettings = goSettings,
|
||||
goSupport = goSupport,
|
||||
goAbout = goAbout,
|
||||
goReceive = goReceive,
|
||||
goSend = goSend,
|
||||
goHistory = goHistory,
|
||||
drawerState = drawerValues.drawerState,
|
||||
scope = drawerValues.scope
|
||||
goHistory = goHistory
|
||||
)
|
||||
|
||||
activity.reportFullyDrawn()
|
||||
|
|
|
@ -8,6 +8,5 @@ object HomeTag {
|
|||
const val PROGRESS = "progress_bar"
|
||||
const val SINGLE_LINE_TEXT = "single_line_text"
|
||||
const val FIAT_CONVERSION = "fiat_conversion"
|
||||
const val DRAWER_MENU = "drawer_menu"
|
||||
const val DRAWER_MENU_OPEN_BUTTON = "drawer_menu_open_button"
|
||||
const val SETTINGS_TOP_BAR_BUTTON = "settings_top_bar_button"
|
||||
}
|
||||
|
|
|
@ -14,34 +14,18 @@ import androidx.compose.foundation.layout.padding
|
|||
import androidx.compose.foundation.layout.wrapContentSize
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.ContactSupport
|
||||
import androidx.compose.material.icons.filled.Info
|
||||
import androidx.compose.material.icons.filled.Menu
|
||||
import androidx.compose.material.icons.filled.Password
|
||||
import androidx.compose.material.icons.filled.Settings
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
import androidx.compose.material3.DrawerState
|
||||
import androidx.compose.material3.DrawerValue
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.ModalDrawerSheet
|
||||
import androidx.compose.material3.ModalNavigationDrawer
|
||||
import androidx.compose.material3.NavigationDrawerItem
|
||||
import androidx.compose.material3.NavigationDrawerItemDefaults
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.rememberDrawerState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalConfiguration
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
@ -50,21 +34,19 @@ import cash.z.ecc.android.sdk.model.FiatCurrencyConversionRateState
|
|||
import cash.z.ecc.android.sdk.model.PercentDecimal
|
||||
import co.electriccoin.zcash.ui.R
|
||||
import co.electriccoin.zcash.ui.common.DisableScreenTimeout
|
||||
import co.electriccoin.zcash.ui.common.closeDrawerMenu
|
||||
import co.electriccoin.zcash.ui.common.openDrawerMenu
|
||||
import co.electriccoin.zcash.ui.design.MINIMAL_WEIGHT
|
||||
import co.electriccoin.zcash.ui.design.component.Body
|
||||
import co.electriccoin.zcash.ui.design.component.BodyWithFiatCurrencySymbol
|
||||
import co.electriccoin.zcash.ui.design.component.GradientSurface
|
||||
import co.electriccoin.zcash.ui.design.component.HeaderWithZecIcon
|
||||
import co.electriccoin.zcash.ui.design.component.PrimaryButton
|
||||
import co.electriccoin.zcash.ui.design.component.SmallTopAppBar
|
||||
import co.electriccoin.zcash.ui.design.component.TertiaryButton
|
||||
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
|
||||
import co.electriccoin.zcash.ui.fixture.WalletSnapshotFixture
|
||||
import co.electriccoin.zcash.ui.screen.home.HomeTag
|
||||
import co.electriccoin.zcash.ui.screen.home.model.WalletDisplayValues
|
||||
import co.electriccoin.zcash.ui.screen.home.model.WalletSnapshot
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
|
||||
@Preview("Home")
|
||||
@Composable
|
||||
|
@ -77,15 +59,10 @@ private fun ComposablePreview() {
|
|||
isKeepScreenOnDuringSync = false,
|
||||
isFiatConversionEnabled = false,
|
||||
isCircularProgressBarEnabled = false,
|
||||
goSeedPhrase = {},
|
||||
goSettings = {},
|
||||
goSupport = {},
|
||||
goAbout = {},
|
||||
goReceive = {},
|
||||
goSend = {},
|
||||
goHistory = {},
|
||||
drawerState = rememberDrawerState(DrawerValue.Closed),
|
||||
scope = rememberCoroutineScope()
|
||||
goHistory = {}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -99,130 +76,53 @@ fun Home(
|
|||
isKeepScreenOnDuringSync: Boolean?,
|
||||
isFiatConversionEnabled: Boolean,
|
||||
isCircularProgressBarEnabled: Boolean,
|
||||
goSeedPhrase: () -> Unit,
|
||||
goSettings: () -> Unit,
|
||||
goSupport: () -> Unit,
|
||||
goAbout: () -> Unit,
|
||||
goReceive: () -> Unit,
|
||||
goSend: () -> Unit,
|
||||
goHistory: () -> Unit,
|
||||
drawerState: DrawerState,
|
||||
scope: CoroutineScope
|
||||
goHistory: () -> Unit
|
||||
) {
|
||||
ModalNavigationDrawer(
|
||||
drawerState = drawerState,
|
||||
drawerContent = {
|
||||
HomeDrawer(
|
||||
onCloseDrawer = { drawerState.closeDrawerMenu(scope) },
|
||||
goSeedPhrase = goSeedPhrase,
|
||||
goSettings = goSettings,
|
||||
goSupport = goSupport,
|
||||
goAbout = goAbout
|
||||
Scaffold(topBar = {
|
||||
HomeTopAppBar(onSettings = goSettings)
|
||||
}) { paddingValues ->
|
||||
HomeMainContent(
|
||||
walletSnapshot = walletSnapshot,
|
||||
isUpdateAvailable = isUpdateAvailable,
|
||||
isKeepScreenOnDuringSync = isKeepScreenOnDuringSync,
|
||||
isFiatConversionEnabled = isFiatConversionEnabled,
|
||||
isCircularProgressBarEnabled = isCircularProgressBarEnabled,
|
||||
goReceive = goReceive,
|
||||
goSend = goSend,
|
||||
goHistory = goHistory,
|
||||
modifier = Modifier.padding(
|
||||
top = paddingValues.calculateTopPadding() + ZcashTheme.dimens.spacingDefault,
|
||||
bottom = paddingValues.calculateBottomPadding() + ZcashTheme.dimens.spacingHuge,
|
||||
start = ZcashTheme.dimens.screenHorizontalSpacing,
|
||||
end = ZcashTheme.dimens.screenHorizontalSpacing
|
||||
)
|
||||
},
|
||||
content = {
|
||||
Scaffold(topBar = {
|
||||
HomeTopAppBar(
|
||||
openDrawer = { drawerState.openDrawerMenu(scope) }
|
||||
)
|
||||
}) { paddingValues ->
|
||||
HomeMainContent(
|
||||
walletSnapshot = walletSnapshot,
|
||||
isUpdateAvailable = isUpdateAvailable,
|
||||
isKeepScreenOnDuringSync = isKeepScreenOnDuringSync,
|
||||
isFiatConversionEnabled = isFiatConversionEnabled,
|
||||
isCircularProgressBarEnabled = isCircularProgressBarEnabled,
|
||||
goReceive = goReceive,
|
||||
goSend = goSend,
|
||||
goHistory = goHistory,
|
||||
modifier = Modifier.padding(
|
||||
top = paddingValues.calculateTopPadding() + ZcashTheme.dimens.spacingDefault,
|
||||
bottom = paddingValues.calculateBottomPadding() + ZcashTheme.dimens.spacingHuge,
|
||||
start = ZcashTheme.dimens.screenHorizontalSpacing,
|
||||
end = ZcashTheme.dimens.screenHorizontalSpacing
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
private fun HomeTopAppBar(
|
||||
openDrawer: () -> Unit
|
||||
) {
|
||||
TopAppBar(
|
||||
title = { Text(text = stringResource(id = R.string.app_name)) },
|
||||
navigationIcon = {
|
||||
IconButton(
|
||||
onClick = openDrawer,
|
||||
modifier = Modifier.testTag(HomeTag.DRAWER_MENU_OPEN_BUTTON)
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Filled.Menu,
|
||||
contentDescription = stringResource(R.string.home_menu_content_description)
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun HomeDrawer(
|
||||
onCloseDrawer: () -> Unit,
|
||||
goSeedPhrase: () -> Unit,
|
||||
goSettings: () -> Unit,
|
||||
goSupport: () -> Unit,
|
||||
goAbout: () -> Unit,
|
||||
) {
|
||||
ModalDrawerSheet(
|
||||
modifier = Modifier.testTag(HomeTag.DRAWER_MENU)
|
||||
) {
|
||||
Spacer(Modifier.height(ZcashTheme.dimens.spacingDefault))
|
||||
NavigationDrawerItem(
|
||||
icon = { Icon(Icons.Default.Password, contentDescription = null) },
|
||||
label = { Text(stringResource(id = R.string.home_menu_seed_phrase)) },
|
||||
selected = false,
|
||||
onClick = {
|
||||
onCloseDrawer()
|
||||
goSeedPhrase()
|
||||
},
|
||||
modifier = Modifier.padding(NavigationDrawerItemDefaults.ItemPadding)
|
||||
)
|
||||
NavigationDrawerItem(
|
||||
icon = { Icon(Icons.Default.Settings, contentDescription = null) },
|
||||
label = { Text(stringResource(id = R.string.home_menu_settings)) },
|
||||
selected = false,
|
||||
onClick = {
|
||||
onCloseDrawer()
|
||||
goSettings()
|
||||
},
|
||||
modifier = Modifier.padding(NavigationDrawerItemDefaults.ItemPadding)
|
||||
)
|
||||
NavigationDrawerItem(
|
||||
icon = { Icon(Icons.Default.ContactSupport, contentDescription = null) },
|
||||
label = { Text(stringResource(id = R.string.home_menu_support)) },
|
||||
selected = false,
|
||||
onClick = {
|
||||
onCloseDrawer()
|
||||
goSupport()
|
||||
},
|
||||
modifier = Modifier.padding(NavigationDrawerItemDefaults.ItemPadding)
|
||||
)
|
||||
NavigationDrawerItem(
|
||||
icon = { Icon(Icons.Default.Info, contentDescription = null) },
|
||||
label = { Text(stringResource(id = R.string.home_menu_about)) },
|
||||
selected = false,
|
||||
onClick = {
|
||||
onCloseDrawer()
|
||||
goAbout()
|
||||
},
|
||||
modifier = Modifier.padding(NavigationDrawerItemDefaults.ItemPadding)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun HomeTopAppBar(
|
||||
onSettings: () -> Unit
|
||||
) {
|
||||
SmallTopAppBar(
|
||||
showTitleLogo = true,
|
||||
hamburgerMenuActions = {
|
||||
IconButton(
|
||||
onClick = onSettings,
|
||||
modifier = Modifier.testTag(HomeTag.SETTINGS_TOP_BAR_BUTTON)
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(id = co.electriccoin.zcash.ui.design.R.drawable.hamburger_menu_icon),
|
||||
contentDescription = stringResource(id = R.string.home_menu_content_description)
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@Suppress("LongParameterList")
|
||||
@Composable
|
||||
private fun HomeMainContent(
|
||||
|
|
|
@ -16,27 +16,38 @@ import co.electriccoin.zcash.ui.screen.settings.view.Settings
|
|||
import co.electriccoin.zcash.ui.screen.settings.viewmodel.SettingsViewModel
|
||||
|
||||
@Composable
|
||||
@Suppress("LongParameterList")
|
||||
internal fun MainActivity.WrapSettings(
|
||||
goAbout: () -> Unit,
|
||||
goBack: () -> Unit,
|
||||
goDocumentation: () -> Unit,
|
||||
goExportPrivateData: () -> Unit,
|
||||
goFeedback: () -> Unit,
|
||||
goPrivacyPolicy: () -> Unit,
|
||||
goSeedRecovery: () -> Unit,
|
||||
) {
|
||||
WrapSettings(
|
||||
activity = this,
|
||||
goAbout = goAbout,
|
||||
goBack = goBack,
|
||||
goDocumentation = goDocumentation,
|
||||
goExportPrivateData = goExportPrivateData,
|
||||
goFeedback = goFeedback,
|
||||
goPrivacyPolicy = goPrivacyPolicy,
|
||||
goSeedRecovery = goSeedRecovery
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Suppress("LongParameterList")
|
||||
private fun WrapSettings(
|
||||
activity: ComponentActivity,
|
||||
goBack: () -> Unit,
|
||||
goAbout: () -> Unit,
|
||||
goBack: () -> Unit,
|
||||
goDocumentation: () -> Unit,
|
||||
goExportPrivateData: () -> Unit,
|
||||
goFeedback: () -> Unit,
|
||||
goPrivacyPolicy: () -> Unit,
|
||||
goSeedRecovery: () -> Unit,
|
||||
) {
|
||||
val walletViewModel by activity.viewModels<WalletViewModel>()
|
||||
|
@ -67,9 +78,9 @@ private fun WrapSettings(
|
|||
),
|
||||
onBack = goBack,
|
||||
onSeedRecovery = goSeedRecovery,
|
||||
onDocumentation = {},
|
||||
onPrivacyPolicy = {},
|
||||
onFeedback = {},
|
||||
onDocumentation = goDocumentation,
|
||||
onPrivacyPolicy = goPrivacyPolicy,
|
||||
onFeedback = goFeedback,
|
||||
onAbout = goAbout,
|
||||
onExportPrivateData = goExportPrivateData,
|
||||
onRescanWallet = {
|
||||
|
|
|
@ -6,7 +6,7 @@ import kotlinx.datetime.Instant
|
|||
data class ConfigInfo(val configurationUpdatedAt: Instant?) {
|
||||
|
||||
fun toSupportString() = buildString {
|
||||
appendLine("Configuration: $configurationUpdatedAt")
|
||||
append("Configuration: $configurationUpdatedAt")
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
<string name="about_back">Back</string>
|
||||
<string name="about_back_content_description">Back</string>
|
||||
<string name="about_version_format" formatted="true">Version <xliff:g example="1.0" id="version_name">%1$s
|
||||
</xliff:g> (<xliff:g example="1.0" id="version_code">%2$d</xliff:g>)</string>
|
||||
</xliff:g></string>
|
||||
<string name="about_debug_menu_app_name">App name:
|
||||
<xliff:g example="Zashi (D)" id="app_name">%1$s</xliff:g></string>
|
||||
<string name="about_debug_menu_build">Build: <xliff:g example="635dac0eb9ddc2bc6da5177f0dd495d8b76af4dc"
|
||||
id="git_commit_hash">%1$s</xliff:g></string>
|
||||
<string name="about_description">Send and receive ZEC on Zashi! Zashi is a minimal-design, self-custody, ZEC-only
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<string name="home_menu_content_description">Open menu</string>
|
||||
<string name="home_menu_content_description">Open Settings</string>
|
||||
<string name="home_button_receive">Receive</string>
|
||||
<string name="home_button_send">Send</string>
|
||||
<string name="home_button_history">Transaction History</string>
|
||||
|
||||
<string name="home_menu_seed_phrase">My secret phrase</string>
|
||||
<string name="home_menu_settings">Settings</string>
|
||||
<string name="home_menu_about">About</string>
|
||||
<string name="home_menu_support">Contact support</string>
|
||||
|
||||
<string name="home_status_syncing_format" formatted="true">Syncing - <xliff:g id="synced_percent" example="50.25">
|
||||
%1$s</xliff:g>%%</string> <!-- double %% for escaping -->
|
||||
<string name="home_status_syncing_catchup">Syncing</string>
|
||||
|
|
|
@ -7,7 +7,6 @@ import android.os.Build
|
|||
import android.os.LocaleList
|
||||
import androidx.activity.viewModels
|
||||
import androidx.compose.ui.test.assertIsEnabled
|
||||
import androidx.compose.ui.test.hasContentDescription
|
||||
import androidx.compose.ui.test.hasTestTag
|
||||
import androidx.compose.ui.test.hasText
|
||||
import androidx.compose.ui.test.junit4.AndroidComposeTestRule
|
||||
|
@ -262,25 +261,28 @@ class ScreenshotTest : UiTestPrerequisites() {
|
|||
navigateTo(NavigationTargets.RECEIVE)
|
||||
receiveZecScreenshots(resContext, tag, composeTestRule)
|
||||
|
||||
// These are the hamburger menu items
|
||||
// We could manually click on each one, which is a better integration test but a worse screenshot test
|
||||
navigateTo(NavigationTargets.SEED_RECOVERY)
|
||||
seedScreenshots(resContext, tag, composeTestRule)
|
||||
|
||||
navigateTo(NavigationTargets.SETTINGS)
|
||||
settingsScreenshots(tag, composeTestRule)
|
||||
|
||||
navigateTo(NavigationTargets.SUPPORT)
|
||||
supportScreenshots(resContext, tag, composeTestRule)
|
||||
|
||||
navigateTo(NavigationTargets.ABOUT)
|
||||
aboutScreenshots(resContext, tag, composeTestRule)
|
||||
|
||||
navigateTo(NavigationTargets.WALLET_ADDRESS_DETAILS)
|
||||
addressDetailsScreenshots(resContext, tag, composeTestRule)
|
||||
|
||||
navigateTo(NavigationTargets.HISTORY)
|
||||
transactionHistoryScreenshots(resContext, tag, composeTestRule)
|
||||
|
||||
navigateTo(NavigationTargets.SETTINGS)
|
||||
settingsScreenshots(tag, composeTestRule)
|
||||
|
||||
// These are the Settings screen items
|
||||
// We could manually click on each one, which is a better integration test but a worse screenshot test
|
||||
navigateTo(NavigationTargets.SEED_RECOVERY)
|
||||
seedScreenshots(resContext, tag, composeTestRule)
|
||||
|
||||
navigateTo(NavigationTargets.SUPPORT)
|
||||
supportScreenshots(resContext, tag, composeTestRule)
|
||||
|
||||
navigateTo(NavigationTargets.EXPORT_PRIVATE_DATA)
|
||||
exportPrivateDataScreenshots(resContext, tag, composeTestRule)
|
||||
|
||||
navigateTo(NavigationTargets.ABOUT)
|
||||
aboutScreenshots(resContext, tag, composeTestRule)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -361,12 +363,6 @@ private fun homeScreenshots(
|
|||
it.assertExists()
|
||||
ScreenshotTest.takeScreenshot(tag, "Home 1")
|
||||
}
|
||||
|
||||
composeTestRule.onNode(hasContentDescription(resContext.getString(R.string.home_menu_content_description))).also {
|
||||
it.assertExists()
|
||||
it.performClick()
|
||||
ScreenshotTest.takeScreenshot(tag, "Home 2 - Menu")
|
||||
}
|
||||
}
|
||||
|
||||
private fun settingsScreenshots(tag: String, composeTestRule: ComposeTestRule) {
|
||||
|
@ -506,6 +502,14 @@ private fun supportScreenshots(resContext: Context, tag: String, composeTestRule
|
|||
ScreenshotTest.takeScreenshot(tag, "Support 1")
|
||||
}
|
||||
|
||||
private fun exportPrivateDataScreenshots(resContext: Context, tag: String, composeTestRule: ComposeTestRule) {
|
||||
composeTestRule.onNode(hasText(resContext.getString(R.string.export_data_header))).also {
|
||||
it.assertExists()
|
||||
}
|
||||
|
||||
ScreenshotTest.takeScreenshot(tag, "Export Private Data 1")
|
||||
}
|
||||
|
||||
private fun aboutScreenshots(resContext: Context, tag: String, composeTestRule: ComposeTestRule) {
|
||||
composeTestRule.onNode(
|
||||
hasText(resContext.getString(R.string.about_title).uppercase())
|
||||
|
|
Loading…
Reference in New Issue