Skip to content

Commit

Permalink
[#1082] Remove Side Navigation Drawer menu
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
HonzaR committed Dec 4, 2023
1 parent ff0757b commit 671b509
Show file tree
Hide file tree
Showing 14 changed files with 97 additions and 333 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -64,7 +46,6 @@ class HomeTestSetup(
@Composable
@Suppress("TestFunctionName")
fun DefaultContent() {
val drawerValues = drawerBackHandler()
Home(
walletSnapshot,
isUpdateAvailable = false,
Expand All @@ -74,15 +55,6 @@ class HomeTestSetup(
goSettings = {
onSettingsCount.incrementAndGet()
},
goSeedPhrase = {
onSeedCount.incrementAndGet()
},
goSupport = {
onSupportCount.incrementAndGet()
},
goAbout = {
onAboutCount.incrementAndGet()
},
goReceive = {
onReceiveCount.incrementAndGet()
},
Expand All @@ -92,8 +64,6 @@ class HomeTestSetup(
goHistory = {
onHistoryCount.incrementAndGet()
},
drawerState = drawerValues.drawerState,
scope = drawerValues.scope
)
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -133,70 +133,18 @@ 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() {
val testSetup = newTestSetup()

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,
Expand All @@ -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()
}
Expand Down
14 changes: 11 additions & 3 deletions ui-lib/src/main/java/co/electriccoin/zcash/ui/Navigation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down Expand Up @@ -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
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Loading

0 comments on commit 671b509

Please sign in to comment.