-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #694 from radixdlt/feature/debug-mode-profile
Inspect raw profile in debug mode
- Loading branch information
Showing
12 changed files
with
404 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
app/src/main/java/com/babylon/wallet/android/presentation/settings/debug/DebugSettingsNav.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package com.babylon.wallet.android.presentation.settings.debug | ||
|
||
import androidx.compose.animation.AnimatedContentTransitionScope | ||
import androidx.compose.animation.EnterTransition | ||
import androidx.navigation.NavController | ||
import androidx.navigation.NavGraphBuilder | ||
import androidx.navigation.compose.composable | ||
import androidx.navigation.navigation | ||
import com.babylon.wallet.android.presentation.settings.SettingsItem.DebugSettingsItem.InspectProfile | ||
import com.babylon.wallet.android.presentation.settings.debug.profile.inspectProfile | ||
|
||
const val ROUTE_DEBUG_SETTINGS_SCREEN = "settings_debug_settings_screen" | ||
const val ROUTE_DEBUG_SETTINGS_GRAPH = "settings_debug_settings_graph" | ||
|
||
fun NavController.debugSettings() { | ||
navigate(ROUTE_DEBUG_SETTINGS_SCREEN) { | ||
launchSingleTop = true | ||
} | ||
} | ||
|
||
fun NavGraphBuilder.debugSettings( | ||
navController: NavController | ||
) { | ||
navigation( | ||
startDestination = ROUTE_DEBUG_SETTINGS_SCREEN, | ||
route = ROUTE_DEBUG_SETTINGS_GRAPH | ||
) { | ||
composable( | ||
route = ROUTE_DEBUG_SETTINGS_SCREEN, | ||
enterTransition = { | ||
slideIntoContainer(AnimatedContentTransitionScope.SlideDirection.Left) | ||
}, | ||
exitTransition = { | ||
slideOutOfContainer(AnimatedContentTransitionScope.SlideDirection.Right) | ||
}, | ||
popExitTransition = { | ||
slideOutOfContainer(AnimatedContentTransitionScope.SlideDirection.Right) | ||
}, | ||
popEnterTransition = { | ||
EnterTransition.None | ||
} | ||
) { | ||
DebugSettingsScreen( | ||
onBackClick = { | ||
navController.popBackStack() | ||
}, | ||
onItemClick = { item -> | ||
when (item) { | ||
InspectProfile -> navController.inspectProfile() | ||
} | ||
} | ||
) | ||
} | ||
inspectProfile( | ||
onBackClick = { | ||
navController.popBackStack() | ||
} | ||
) | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
...c/main/java/com/babylon/wallet/android/presentation/settings/debug/DebugSettingsScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.babylon.wallet.android.presentation.settings.debug | ||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.WindowInsets | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.statusBars | ||
import androidx.compose.foundation.lazy.LazyColumn | ||
import androidx.compose.material3.HorizontalDivider | ||
import androidx.compose.material3.Scaffold | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import com.babylon.wallet.android.R | ||
import com.babylon.wallet.android.designsystem.theme.RadixTheme | ||
import com.babylon.wallet.android.presentation.settings.SettingsItem | ||
import com.babylon.wallet.android.presentation.ui.composables.DefaultSettingsItem | ||
import com.babylon.wallet.android.presentation.ui.composables.RadixCenteredTopAppBar | ||
|
||
@Composable | ||
fun DebugSettingsScreen( | ||
modifier: Modifier = Modifier, | ||
onBackClick: () -> Unit, | ||
onItemClick: (SettingsItem.DebugSettingsItem) -> Unit | ||
) { | ||
Scaffold( | ||
modifier = modifier, | ||
topBar = { | ||
RadixCenteredTopAppBar( | ||
title = stringResource(R.string.settings_debugSettings), | ||
onBackClick = onBackClick, | ||
windowInsets = WindowInsets.statusBars | ||
) | ||
}, | ||
containerColor = RadixTheme.colors.defaultBackground | ||
) { padding -> | ||
Column( | ||
modifier = Modifier.padding(padding), | ||
horizontalAlignment = Alignment.Start | ||
) { | ||
HorizontalDivider(color = RadixTheme.colors.gray5) | ||
LazyColumn(modifier = Modifier.fillMaxSize()) { | ||
SettingsItem.DebugSettingsItem.values().forEachIndexed { index, appSettingsItem -> | ||
item { | ||
DefaultSettingsItem( | ||
title = stringResource(id = appSettingsItem.descriptionRes()), | ||
icon = appSettingsItem.getIcon(), | ||
onClick = { | ||
onItemClick(appSettingsItem) | ||
} | ||
) | ||
HorizontalDivider(color = RadixTheme.colors.gray5) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
.../java/com/babylon/wallet/android/presentation/settings/debug/profile/InspectProfileNav.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.babylon.wallet.android.presentation.settings.debug.profile | ||
|
||
import androidx.compose.animation.AnimatedContentTransitionScope | ||
import androidx.hilt.navigation.compose.hiltViewModel | ||
import androidx.navigation.NavController | ||
import androidx.navigation.NavGraphBuilder | ||
import androidx.navigation.compose.composable | ||
|
||
private const val ROUTE = "inspect_profile" | ||
|
||
fun NavController.inspectProfile() { | ||
navigate(route = ROUTE) | ||
} | ||
|
||
fun NavGraphBuilder.inspectProfile( | ||
onBackClick: () -> Unit | ||
) { | ||
composable( | ||
route = ROUTE, | ||
enterTransition = { | ||
slideIntoContainer(AnimatedContentTransitionScope.SlideDirection.Left) | ||
}, | ||
exitTransition = { | ||
slideOutOfContainer(AnimatedContentTransitionScope.SlideDirection.Right) | ||
} | ||
) { | ||
InspectProfileScreen( | ||
viewModel = hiltViewModel(), | ||
onBackClick = onBackClick | ||
) | ||
} | ||
} |
Oops, something went wrong.