Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix navigation on the Menu screen #264

Merged
merged 2 commits into from
Mar 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ package com.goldenraven.padawanwallet.ui.settings

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.*
Expand All @@ -20,25 +17,23 @@ import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.unit.dp
import androidx.navigation.NavHostController
import com.goldenraven.padawanwallet.R
import com.goldenraven.padawanwallet.theme.*
import com.goldenraven.padawanwallet.ui.PadawanAppBar

@Composable
internal fun AboutScreen() {
internal fun AboutScreen(
navController: NavHostController
) {
val scrollState = rememberScrollState()
Column(
Modifier
.verticalScroll(state = scrollState)
.background(padawan_theme_background_secondary)
.padding(bottom = 12.dp)
) {
Text(
text = "About Padawan",
style = PadawanTypography.headlineSmall,
color = padawan_theme_text_headline,
modifier = Modifier
.padding(top = 48.dp, start = 24.dp, end = 24.dp, bottom = 32.dp)
)
PadawanAppBar(navController = navController, title = "About Padawan")
Text(
text = stringResource(R.string.about_text),
modifier = Modifier.padding(start = 24.dp, end = 24.dp),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.navigation.NavHostController
import com.goldenraven.padawanwallet.data.WalletRepository
import com.goldenraven.padawanwallet.theme.PadawanTypography
import com.goldenraven.padawanwallet.theme.padawan_theme_background_secondary
import com.goldenraven.padawanwallet.theme.padawan_theme_text_headline
import com.goldenraven.padawanwallet.ui.PadawanAppBar
import com.goldenraven.padawanwallet.ui.standardBorder

@OptIn(ExperimentalMaterial3Api::class)
@Composable
internal fun RecoveryPhraseScreen() {
internal fun RecoveryPhraseScreen(
navController: NavHostController
) {
val scrollState = rememberScrollState()
val seedPhrase: String = WalletRepository.getMnemonic()
val wordList: List<String> = seedPhrase.split(" ")
Expand All @@ -35,13 +37,7 @@ internal fun RecoveryPhraseScreen() {
.fillMaxSize()
.verticalScroll(state = scrollState)
){
Text(
text = "Your wallet recovery phrase",
style = PadawanTypography.headlineSmall,
color = padawan_theme_text_headline,
modifier = Modifier
.padding(top = 48.dp, start = 24.dp, end = 24.dp, bottom = 32.dp)
)
PadawanAppBar(navController = navController, title = "Your wallet recovery phrase")
wordList.forEachIndexed { index, item ->
Row(
horizontalArrangement = Arrangement.Center,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,17 @@ import androidx.compose.ui.text.PlaceholderVerticalAlign
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavHostController
import com.goldenraven.padawanwallet.R
import com.goldenraven.padawanwallet.theme.*
import com.goldenraven.padawanwallet.ui.PadawanAppBar
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch

@Composable
internal fun SendCoinsBackScreen() {
internal fun SendCoinsBackScreen(
navController: NavHostController
) {
val scrollState = rememberScrollState()
val context = LocalContext.current
val scope = rememberCoroutineScope()
Expand Down Expand Up @@ -68,13 +72,7 @@ internal fun SendCoinsBackScreen() {
.background(padawan_theme_background_secondary)
.padding(padding)
) {
Text(
text = "Send your coins back to us!",
style = PadawanTypography.headlineSmall,
color = padawan_theme_text_headline,
modifier = Modifier
.padding(top = 48.dp, start = 24.dp, end = 24.dp, bottom = 32.dp)
)
PadawanAppBar(navController = navController, title = "Send your coins back to us!")
Image(
painterResource(R.drawable.return_sats_faucet_address),
contentDescription = "Return sats faucet address image",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,7 @@ internal fun SettingsRootScreen(

Button(
onClick = {
navController.navigate(Screen.RecoveryPhraseScreen.route) {
navController.graph.startDestinationRoute?.let { route ->
popUpTo(route)
}
launchSingleTop = true
}
navController.navigate(Screen.RecoveryPhraseScreen.route)
},
colors = ButtonDefaults.buttonColors(containerColor = Color(0xffffffff)),
shape = RoundedCornerShape(8.dp),
Expand All @@ -95,12 +90,7 @@ internal fun SettingsRootScreen(

Button(
onClick = {
navController.navigate(Screen.SendCoinsBackScreen.route) {
navController.graph.startDestinationRoute?.let { route ->
popUpTo(route)
}
launchSingleTop = true
}
navController.navigate(Screen.SendCoinsBackScreen.route)
},
colors = ButtonDefaults.buttonColors(containerColor = Color(0xffffffff)),
shape = RoundedCornerShape(8.dp),
Expand All @@ -125,12 +115,7 @@ internal fun SettingsRootScreen(

Button(
onClick = {
navController.navigate(Screen.AboutScreen.route) {
navController.graph.startDestinationRoute?.let { route ->
popUpTo(route)
}
launchSingleTop = true
}
navController.navigate(Screen.AboutScreen.route)
},
colors = ButtonDefaults.buttonColors(containerColor = Color(0xffffffff)),
shape = RoundedCornerShape(8.dp),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ fun WalletNavigation(
popExitTransition = {
slideOutOfContainer(AnimatedContentScope.SlideDirection.Down, animationSpec = tween(animationDuration))
}
) { AboutScreen() }
) { AboutScreen(navController = navControllerWalletNavigation) }


// Recovery phrase
Expand All @@ -287,7 +287,7 @@ fun WalletNavigation(
popExitTransition = {
slideOutOfContainer(AnimatedContentScope.SlideDirection.Down, animationSpec = tween(animationDuration))
}
) { RecoveryPhraseScreen() }
) { RecoveryPhraseScreen(navController = navControllerWalletNavigation) }


// Send coins back
Expand All @@ -305,6 +305,6 @@ fun WalletNavigation(
popExitTransition = {
slideOutOfContainer(AnimatedContentScope.SlideDirection.Down, animationSpec = tween(animationDuration))
}
) { SendCoinsBackScreen() }
) { SendCoinsBackScreen(navController = navControllerWalletNavigation) }
}
}