mirror of
https://github.com/bitwarden/android.git
synced 2024-11-29 14:28:55 +03:00
Add helper handle methods for MainType and Internal actions (#989)
This commit is contained in:
parent
c3724605b8
commit
5a6be93644
1 changed files with 42 additions and 49 deletions
|
@ -105,33 +105,22 @@ class GeneratorViewModel @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("MaxLineLength", "LongMethod")
|
|
||||||
override fun handleAction(action: GeneratorAction) {
|
override fun handleAction(action: GeneratorAction) {
|
||||||
when (action) {
|
when (action) {
|
||||||
is GeneratorAction.PasswordHistoryClick -> {
|
is GeneratorAction.PasswordHistoryClick -> handlePasswordHistoryClick()
|
||||||
handlePasswordHistoryClick()
|
is GeneratorAction.CloseClick -> handleCloseClick()
|
||||||
}
|
is GeneratorAction.SelectClick -> handleSelectClick()
|
||||||
|
is GeneratorAction.RegenerateClick -> handleRegenerationClick()
|
||||||
is GeneratorAction.CloseClick -> {
|
is GeneratorAction.CopyClick -> handleCopyClick()
|
||||||
handleCloseClick()
|
is GeneratorAction.MainTypeOptionSelect -> handleMainTypeOptionSelect(action)
|
||||||
}
|
is GeneratorAction.MainType -> handleMainTypeAction(action)
|
||||||
|
is GeneratorAction.Internal -> handleInternalAction(action)
|
||||||
is GeneratorAction.SelectClick -> {
|
}
|
||||||
handleSelectClick()
|
}
|
||||||
}
|
|
||||||
|
|
||||||
is GeneratorAction.RegenerateClick -> {
|
|
||||||
handleRegenerationClick()
|
|
||||||
}
|
|
||||||
|
|
||||||
is GeneratorAction.CopyClick -> {
|
|
||||||
handleCopyClick()
|
|
||||||
}
|
|
||||||
|
|
||||||
is GeneratorAction.MainTypeOptionSelect -> {
|
|
||||||
handleMainTypeOptionSelect(action)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@Suppress("MaxLineLength")
|
||||||
|
private fun handleMainTypeAction(action: GeneratorAction.MainType) {
|
||||||
|
when (action) {
|
||||||
is GeneratorAction.MainType.Passcode.PasscodeTypeOptionSelect -> {
|
is GeneratorAction.MainType.Passcode.PasscodeTypeOptionSelect -> {
|
||||||
handlePasscodeTypeOptionSelect(action)
|
handlePasscodeTypeOptionSelect(action)
|
||||||
}
|
}
|
||||||
|
@ -144,30 +133,6 @@ class GeneratorViewModel @Inject constructor(
|
||||||
handlePassphraseSpecificAction(action)
|
handlePassphraseSpecificAction(action)
|
||||||
}
|
}
|
||||||
|
|
||||||
is GeneratorAction.Internal.UpdateGeneratedPasswordResult -> {
|
|
||||||
handleUpdateGeneratedPasswordResult(action)
|
|
||||||
}
|
|
||||||
|
|
||||||
is GeneratorAction.Internal.UpdateGeneratedPassphraseResult -> {
|
|
||||||
handleUpdateGeneratedPassphraseResult(action)
|
|
||||||
}
|
|
||||||
|
|
||||||
is GeneratorAction.Internal.UpdateGeneratedPlusAddessedUsernameResult -> {
|
|
||||||
handleUpdatePlusAddressedGeneratedUsernameResult(action)
|
|
||||||
}
|
|
||||||
|
|
||||||
is GeneratorAction.Internal.UpdateGeneratedCatchAllUsernameResult -> {
|
|
||||||
handleUpdateCatchAllGeneratedUsernameResult(action)
|
|
||||||
}
|
|
||||||
|
|
||||||
is GeneratorAction.Internal.UpdateGeneratedRandomWordUsernameResult -> {
|
|
||||||
handleUpdateRandomWordGeneratedUsernameResult(action)
|
|
||||||
}
|
|
||||||
|
|
||||||
is GeneratorAction.Internal.UpdateGeneratedForwardedServiceUsernameResult -> {
|
|
||||||
handleUpdateForwardedServiceGeneratedUsernameResult(action)
|
|
||||||
}
|
|
||||||
|
|
||||||
is GeneratorAction.MainType.Username.UsernameTypeOptionSelect -> {
|
is GeneratorAction.MainType.Username.UsernameTypeOptionSelect -> {
|
||||||
handleUsernameTypeOptionSelect(action)
|
handleUsernameTypeOptionSelect(action)
|
||||||
}
|
}
|
||||||
|
@ -214,6 +179,34 @@ class GeneratorViewModel @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun handleInternalAction(action: GeneratorAction.Internal) {
|
||||||
|
when (action) {
|
||||||
|
is GeneratorAction.Internal.UpdateGeneratedPasswordResult -> {
|
||||||
|
handleUpdateGeneratedPasswordResult(action)
|
||||||
|
}
|
||||||
|
|
||||||
|
is GeneratorAction.Internal.UpdateGeneratedPassphraseResult -> {
|
||||||
|
handleUpdateGeneratedPassphraseResult(action)
|
||||||
|
}
|
||||||
|
|
||||||
|
is GeneratorAction.Internal.UpdateGeneratedPlusAddessedUsernameResult -> {
|
||||||
|
handleUpdatePlusAddressedGeneratedUsernameResult(action)
|
||||||
|
}
|
||||||
|
|
||||||
|
is GeneratorAction.Internal.UpdateGeneratedCatchAllUsernameResult -> {
|
||||||
|
handleUpdateCatchAllGeneratedUsernameResult(action)
|
||||||
|
}
|
||||||
|
|
||||||
|
is GeneratorAction.Internal.UpdateGeneratedRandomWordUsernameResult -> {
|
||||||
|
handleUpdateRandomWordGeneratedUsernameResult(action)
|
||||||
|
}
|
||||||
|
|
||||||
|
is GeneratorAction.Internal.UpdateGeneratedForwardedServiceUsernameResult -> {
|
||||||
|
handleUpdateForwardedServiceGeneratedUsernameResult(action)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//endregion Initialization and Overrides
|
//endregion Initialization and Overrides
|
||||||
|
|
||||||
//region Top Level Handlers
|
//region Top Level Handlers
|
||||||
|
@ -2111,7 +2104,7 @@ sealed class GeneratorAction {
|
||||||
/**
|
/**
|
||||||
* Represents the action to learn more.
|
* Represents the action to learn more.
|
||||||
*/
|
*/
|
||||||
data object TooltipClick : GeneratorAction()
|
data object TooltipClick : UsernameType()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents actions specifically related to Forwarded Email Alias.
|
* Represents actions specifically related to Forwarded Email Alias.
|
||||||
|
|
Loading…
Reference in a new issue