Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4136968d authored by Mike Schneider's avatar Mike Schneider
Browse files

Fix naming of Pin per style guide

https://developer.android.com/kotlin/style-guide#naming_2

Acronyms are only the first letter capitalized.

Bug: 282730134
Test: Compiles
Change-Id: Icecce84f96d2c4ff4f3551894f6dd466d6942a18
parent 8c50659a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ class AuthenticationRepositoryImpl @Inject constructor() : AuthenticationReposit
    override val isUnlocked: StateFlow<Boolean> = _isUnlocked.asStateFlow()

    private val _authenticationMethod =
        MutableStateFlow<AuthenticationMethodModel>(AuthenticationMethodModel.PIN(1234))
        MutableStateFlow<AuthenticationMethodModel>(AuthenticationMethodModel.Pin(1234))
    override val authenticationMethod: StateFlow<AuthenticationMethodModel> =
        _authenticationMethod.asStateFlow()

+1 −1
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ constructor(
    fun authenticate(input: List<Any>): Boolean {
        val isSuccessful =
            when (val authMethod = this.authenticationMethod.value) {
                is AuthenticationMethodModel.PIN -> input.asCode() == authMethod.code
                is AuthenticationMethodModel.Pin -> input.asCode() == authMethod.code
                is AuthenticationMethodModel.Password -> input.asPassword() == authMethod.password
                is AuthenticationMethodModel.Pattern -> input.asPattern() == authMethod.coordinates
                else -> true
+1 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ sealed class AuthenticationMethodModel(
    /** The most basic authentication method. The lock screen can be swiped away when displayed. */
    object Swipe : AuthenticationMethodModel(isSecure = false)

    data class PIN(val code: Int) : AuthenticationMethodModel(isSecure = true)
    data class Pin(val code: Int) : AuthenticationMethodModel(isSecure = true)

    data class Password(val password: String) : AuthenticationMethodModel(isSecure = true)

+2 −2
Original line number Diff line number Diff line
@@ -197,7 +197,7 @@ constructor(

    private fun promptMessage(authMethod: AuthenticationMethodModel): String {
        return when (authMethod) {
            is AuthenticationMethodModel.PIN ->
            is AuthenticationMethodModel.Pin ->
                applicationContext.getString(R.string.keyguard_enter_your_pin)
            is AuthenticationMethodModel.Password ->
                applicationContext.getString(R.string.keyguard_enter_your_password)
@@ -209,7 +209,7 @@ constructor(

    private fun errorMessage(authMethod: AuthenticationMethodModel): String {
        return when (authMethod) {
            is AuthenticationMethodModel.PIN -> applicationContext.getString(R.string.kg_wrong_pin)
            is AuthenticationMethodModel.Pin -> applicationContext.getString(R.string.kg_wrong_pin)
            is AuthenticationMethodModel.Password ->
                applicationContext.getString(R.string.kg_wrong_password)
            is AuthenticationMethodModel.Pattern ->
+2 −2
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ constructor(
                .map { model ->
                    model?.let {
                        when (interactor.authenticationMethod.value) {
                            is AuthenticationMethodModel.PIN ->
                            is AuthenticationMethodModel.Pin ->
                                R.string.kg_too_many_failed_pin_attempts_dialog_message
                            is AuthenticationMethodModel.Password ->
                                R.string.kg_too_many_failed_password_attempts_dialog_message
@@ -165,7 +165,7 @@ constructor(
        authMethod: AuthenticationMethodModel,
    ): AuthMethodBouncerViewModel? {
        return when (authMethod) {
            is AuthenticationMethodModel.PIN -> pin
            is AuthenticationMethodModel.Pin -> pin
            is AuthenticationMethodModel.Password -> password
            is AuthenticationMethodModel.Pattern -> pattern
            else -> null
Loading