-
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 #1106 from radixdlt/feature/persona-label-name-limit
Add persona label length limit
- Loading branch information
Showing
11 changed files
with
71 additions
and
71 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
27 changes: 23 additions & 4 deletions
27
...main/java/com/babylon/wallet/android/presentation/model/PersonaDisplayNameFieldWrapper.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 |
---|---|---|
@@ -1,9 +1,28 @@ | ||
package com.babylon.wallet.android.presentation.model | ||
|
||
import com.babylon.wallet.android.utils.Constants | ||
|
||
data class PersonaDisplayNameFieldWrapper( | ||
val value: String = "", | ||
val valid: Boolean? = null, | ||
val required: Boolean = false, | ||
val wasEdited: Boolean = false, | ||
val shouldDisplayValidationError: Boolean = false | ||
) | ||
val wasEdited: Boolean = false | ||
) { | ||
val validationState: ValidationState | ||
get() { | ||
val valueTrimmed = value.trim() | ||
return when { | ||
valueTrimmed.isEmpty() -> ValidationState.Empty | ||
valueTrimmed.length > Constants.ENTITY_NAME_MAX_LENGTH -> ValidationState.TooLong | ||
else -> ValidationState.Valid | ||
} | ||
} | ||
|
||
val isValid: Boolean | ||
get() = validationState == ValidationState.Valid | ||
|
||
enum class ValidationState { | ||
Valid, | ||
Empty, | ||
TooLong | ||
} | ||
} |
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
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
Oops, something went wrong.