-
Notifications
You must be signed in to change notification settings - Fork 1k
PM-42849: Feat: Update Debug menu UI #7338
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
Merged
+444
β200
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
428 changes: 239 additions & 189 deletions
428
app/src/main/kotlin/com/x8bit/bitwarden/ui/platform/feature/debugmenu/DebugMenuScreen.kt
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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
104 changes: 104 additions & 0 deletions
104
...main/kotlin/com/x8bit/bitwarden/ui/platform/feature/debugmenu/handler/DebugMenuHandler.kt
This file contains hidden or 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,104 @@ | ||
| package com.x8bit.bitwarden.ui.platform.feature.debugmenu.handler | ||
|
|
||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.runtime.remember | ||
| import com.bitwarden.core.data.manager.model.FlagKey | ||
| import com.x8bit.bitwarden.ui.platform.feature.debugmenu.DebugMenuAction | ||
| import com.x8bit.bitwarden.ui.platform.feature.debugmenu.DebugMenuState | ||
| import com.x8bit.bitwarden.ui.platform.feature.debugmenu.DebugMenuViewModel | ||
|
|
||
| /** | ||
| * Handler for the debug menu screen lambda invocations. | ||
| */ | ||
| @Suppress("LongParameterList") | ||
| class DebugMenuHandler( | ||
| val onNavigateBack: () -> Unit, | ||
| val onMainTypeOptionClick: (option: DebugMenuState.MainTypeOption) -> Unit, | ||
| val onUpdateFeatureFlag: (flagKey: FlagKey<Any>, newValue: Any) -> Unit, | ||
| val onResetFeatureFlagValues: () -> Unit, | ||
| val onRestartOnboarding: () -> Unit, | ||
| val onRestartOnboardingCarousel: () -> Unit, | ||
| val onResetAccessibilityDisclaimer: () -> Unit, | ||
| val onResetCoachMarkTourStatuses: () -> Unit, | ||
| val onTriggerCookieAcquisition: () -> Unit, | ||
| val onClearSsoCookies: () -> Unit, | ||
| val onResetPremiumUpgradeBanner: () -> Unit, | ||
| val onShowUpgradedToPremiumCard: () -> Unit, | ||
| val onGenerateErrorReportClick: () -> Unit, | ||
| val onGenerateCrashClick: () -> Unit, | ||
| ) { | ||
| @Suppress("UndocumentedPublicClass") | ||
| companion object { | ||
| /** | ||
| * Create [DebugMenuHandler] with the given [viewModel] to send actions to. | ||
| */ | ||
|
david-livefront marked this conversation as resolved.
|
||
| fun create(viewModel: DebugMenuViewModel): DebugMenuHandler = DebugMenuHandler( | ||
| onNavigateBack = { viewModel.trySendAction(DebugMenuAction.NavigateBack) }, | ||
| onMainTypeOptionClick = { | ||
| viewModel.trySendAction(DebugMenuAction.MainTypeOptionClick(it)) | ||
| }, | ||
| onUpdateFeatureFlag = { key, value -> | ||
| viewModel.trySendAction(DebugMenuAction.UpdateFeatureFlag(key, value)) | ||
| }, | ||
| onResetFeatureFlagValues = { | ||
| viewModel.trySendAction(DebugMenuAction.ResetFeatureFlagValues) | ||
| }, | ||
| onRestartOnboarding = { viewModel.trySendAction(DebugMenuAction.RestartOnboarding) }, | ||
| onRestartOnboardingCarousel = { | ||
| viewModel.trySendAction(DebugMenuAction.RestartOnboardingCarousel) | ||
| }, | ||
| onResetAccessibilityDisclaimer = { | ||
| viewModel.trySendAction(DebugMenuAction.ResetAccessibilityDisclaimer) | ||
| }, | ||
| onResetCoachMarkTourStatuses = { | ||
| viewModel.trySendAction(DebugMenuAction.ResetCoachMarkTourStatuses) | ||
| }, | ||
| onTriggerCookieAcquisition = { | ||
| viewModel.trySendAction(DebugMenuAction.TriggerCookieAcquisition) | ||
| }, | ||
| onClearSsoCookies = { viewModel.trySendAction(DebugMenuAction.ClearSsoCookies) }, | ||
| onResetPremiumUpgradeBanner = { | ||
| viewModel.trySendAction(DebugMenuAction.ResetPremiumUpgradeBanner) | ||
| }, | ||
| onShowUpgradedToPremiumCard = { | ||
| viewModel.trySendAction(DebugMenuAction.ShowUpgradedToPremiumCard) | ||
| }, | ||
| onGenerateErrorReportClick = { | ||
| viewModel.trySendAction(DebugMenuAction.GenerateErrorReportClick) | ||
| }, | ||
| onGenerateCrashClick = { viewModel.trySendAction(DebugMenuAction.GenerateCrashClick) }, | ||
| ) | ||
|
|
||
| /** | ||
| * Create [DebugMenuHandler] with all empty callbacks. This should only be used for | ||
| * previews. | ||
| */ | ||
| fun createEmpty(): DebugMenuHandler = DebugMenuHandler( | ||
| onNavigateBack = { }, | ||
| onMainTypeOptionClick = { }, | ||
| onUpdateFeatureFlag = { _, _ -> }, | ||
| onResetFeatureFlagValues = { }, | ||
| onRestartOnboarding = { }, | ||
| onRestartOnboardingCarousel = { }, | ||
| onResetAccessibilityDisclaimer = { }, | ||
| onResetCoachMarkTourStatuses = { }, | ||
| onTriggerCookieAcquisition = { }, | ||
| onClearSsoCookies = { }, | ||
| onResetPremiumUpgradeBanner = { }, | ||
| onShowUpgradedToPremiumCard = { }, | ||
| onGenerateErrorReportClick = { }, | ||
| onGenerateCrashClick = { }, | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Remember [DebugMenuHandler] with the given [viewModel] within a [Composable] scope. | ||
| */ | ||
| @Composable | ||
| fun rememberDebugMenuHandler( | ||
| viewModel: DebugMenuViewModel, | ||
| ): DebugMenuHandler = | ||
| remember(viewModel) { | ||
| DebugMenuHandler.create(viewModel = viewModel) | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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
27 changes: 27 additions & 0 deletions
27
ui/src/main/kotlin/com/bitwarden/ui/platform/components/segment/transition/TransitionUtil.kt
This file contains hidden or 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,27 @@ | ||
| package com.bitwarden.ui.platform.components.segment.transition | ||
|
|
||
| import androidx.compose.animation.AnimatedContentTransitionScope | ||
| import androidx.compose.animation.ContentTransform | ||
| import androidx.compose.animation.core.tween | ||
| import androidx.compose.animation.fadeIn | ||
| import androidx.compose.animation.fadeOut | ||
| import androidx.compose.animation.slideInHorizontally | ||
| import androidx.compose.animation.slideOutHorizontally | ||
| import androidx.compose.animation.togetherWith | ||
|
|
||
| private const val TWEEN_DURATION_MS: Int = 300 | ||
|
|
||
| /** | ||
| * A standard [ContentTransform] to be used when animating to different content states of a | ||
| * segmented control indicated by the [Enum]. | ||
| */ | ||
| fun <T : Enum<T>> AnimatedContentTransitionScope<T>.segmentedContentTransform(): ContentTransform { | ||
| // Slide in from right if moving forward, from left if moving backward | ||
| return if (targetState.ordinal > initialState.ordinal) { | ||
| (slideInHorizontally { width -> width } + fadeIn(tween(TWEEN_DURATION_MS))) togetherWith | ||
| slideOutHorizontally { width -> -width } + fadeOut(tween(TWEEN_DURATION_MS)) | ||
| } else { | ||
| (slideInHorizontally { width -> -width } + fadeIn(tween(TWEEN_DURATION_MS))) togetherWith | ||
| slideOutHorizontally { width -> width } + fadeOut(tween(TWEEN_DURATION_MS)) | ||
| } | ||
| } |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.