Skip to content

Commit ec07a6a

Browse files
authored
fix(authenticator): Upgrade Amplify dependency to 2.27.0 (#213)
1 parent 561fb3e commit ec07a6a

File tree

5 files changed

+30
-23
lines changed

5 files changed

+30
-23
lines changed

authenticator/src/main/java/com/amplifyframework/ui/authenticator/AuthenticatorViewModel.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,15 @@ internal class AuthenticatorViewModel(
229229
moveTo(newState)
230230
}
231231
AuthSignUpStep.DONE -> handleSignedUp(username, password)
232+
else -> {
233+
// Generic error for any other next steps that may be added in the future
234+
val exception = AuthException(
235+
"Unsupported next step ${result.nextStep.signUpStep}.",
236+
"Authenticator does not support this Authentication flow, disable it to use Authenticator."
237+
)
238+
logger.error("Unsupported next step ${result.nextStep.signUpStep}", exception)
239+
sendMessage(UnknownErrorMessage(exception))
240+
}
232241
}
233242
}
234243

authenticator/src/test/java/com/amplifyframework/ui/authenticator/MockAuthenticatorData.kt

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package com.amplifyframework.ui.authenticator
1717

1818
import com.amplifyframework.auth.AuthCodeDeliveryDetails
1919
import com.amplifyframework.auth.AuthException
20+
import com.amplifyframework.auth.AuthFactorType
2021
import com.amplifyframework.auth.AuthSession
2122
import com.amplifyframework.auth.AuthUser
2223
import com.amplifyframework.auth.AuthUserAttribute
@@ -71,19 +72,12 @@ internal fun mockAuthException(
7172
cause = cause
7273
)
7374

74-
internal fun mockAuthSession(
75-
isSignedIn: Boolean = false
76-
) = AuthSession(isSignedIn)
75+
internal fun mockAuthSession(isSignedIn: Boolean = false) = AuthSession(isSignedIn)
7776

78-
internal fun mockAuthUser(
79-
userId: String = "userId",
80-
username: String = "username"
81-
) = AuthUser(userId, username)
77+
internal fun mockAuthUser(userId: String = "userId", username: String = "username") = AuthUser(userId, username)
8278

83-
internal fun mockSignInResult(
84-
isSignedIn: Boolean = true,
85-
nextSignInStep: AuthNextSignInStep = mockNextSignInStep()
86-
) = AuthSignInResult(isSignedIn, nextSignInStep)
79+
internal fun mockSignInResult(isSignedIn: Boolean = true, nextSignInStep: AuthNextSignInStep = mockNextSignInStep()) =
80+
AuthSignInResult(isSignedIn, nextSignInStep)
8781

8882
internal fun mockSignInResult(
8983
signInStep: AuthSignInStep = AuthSignInStep.DONE,
@@ -107,14 +101,18 @@ internal fun mockNextSignInStep(
107101
additionalInfo: Map<String, String> = emptyMap(),
108102
codeDeliveryDetails: AuthCodeDeliveryDetails? = null,
109103
totpSetupDetails: TOTPSetupDetails? = null,
110-
allowedMFATypes: Set<MFAType>? = null
111-
) = AuthNextSignInStep(signInStep, additionalInfo, codeDeliveryDetails, totpSetupDetails, allowedMFATypes)
104+
allowedMFATypes: Set<MFAType>? = null,
105+
availableFactors: Set<AuthFactorType>? = null
106+
) = AuthNextSignInStep(
107+
signInStep,
108+
additionalInfo,
109+
codeDeliveryDetails,
110+
totpSetupDetails,
111+
allowedMFATypes,
112+
availableFactors
113+
)
112114

113-
internal fun mockUserAttributes(
114-
vararg attribute: Pair<AuthUserAttributeKey, String>
115-
) = attribute.map { AuthUserAttribute(it.first, it.second) }
115+
internal fun mockUserAttributes(vararg attribute: Pair<AuthUserAttributeKey, String>) =
116+
attribute.map { AuthUserAttribute(it.first, it.second) }
116117

117-
internal fun mockUser(
118-
userId: String = "userId",
119-
username: String = "username"
120-
) = AuthUser(userId, username)
118+
internal fun mockUser(userId: String = "userId", username: String = "username") = AuthUser(userId, username)

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[versions]
22
agp = "8.1.4"
3-
amplify = "2.24.0"
3+
amplify = "2.27.0"
44
binary-compatibility = "0.14.0"
55
cameraX = "1.2.0"
66
compose = "1.5.4"

samples/authenticator/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ android {
3535
compose true
3636
}
3737
composeOptions {
38-
kotlinCompilerExtensionVersion '1.4.3'
38+
kotlinCompilerExtensionVersion "1.5.3"
3939
}
4040
packagingOptions {
4141
resources {

samples/authenticator/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ buildscript {
1010
plugins {
1111
id 'com.android.application' version '8.1.4' apply false
1212
id 'com.android.library' version '8.1.4' apply false
13-
id 'org.jetbrains.kotlin.android' version '1.8.10' apply false
13+
id 'org.jetbrains.kotlin.android' version '1.9.10' apply false
1414
}

0 commit comments

Comments
 (0)