Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,15 @@ internal class AuthenticatorViewModel(
moveTo(newState)
}
AuthSignUpStep.DONE -> handleSignedUp(username, password)
else -> {
// Generic error for any other next steps that may be added in the future
val exception = AuthException(
"Unsupported next step ${result.nextStep.signUpStep}.",
"Authenticator does not support this Authentication flow, disable it to use Authenticator."
)
logger.error("Unsupported next step ${result.nextStep.signUpStep}", exception)
sendMessage(UnknownErrorMessage(exception))
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package com.amplifyframework.ui.authenticator

import com.amplifyframework.auth.AuthCodeDeliveryDetails
import com.amplifyframework.auth.AuthException
import com.amplifyframework.auth.AuthFactorType
import com.amplifyframework.auth.AuthSession
import com.amplifyframework.auth.AuthUser
import com.amplifyframework.auth.AuthUserAttribute
Expand Down Expand Up @@ -71,19 +72,12 @@ internal fun mockAuthException(
cause = cause
)

internal fun mockAuthSession(
isSignedIn: Boolean = false
) = AuthSession(isSignedIn)
internal fun mockAuthSession(isSignedIn: Boolean = false) = AuthSession(isSignedIn)

internal fun mockAuthUser(
userId: String = "userId",
username: String = "username"
) = AuthUser(userId, username)
internal fun mockAuthUser(userId: String = "userId", username: String = "username") = AuthUser(userId, username)

internal fun mockSignInResult(
isSignedIn: Boolean = true,
nextSignInStep: AuthNextSignInStep = mockNextSignInStep()
) = AuthSignInResult(isSignedIn, nextSignInStep)
internal fun mockSignInResult(isSignedIn: Boolean = true, nextSignInStep: AuthNextSignInStep = mockNextSignInStep()) =
AuthSignInResult(isSignedIn, nextSignInStep)

internal fun mockSignInResult(
signInStep: AuthSignInStep = AuthSignInStep.DONE,
Expand All @@ -107,14 +101,18 @@ internal fun mockNextSignInStep(
additionalInfo: Map<String, String> = emptyMap(),
codeDeliveryDetails: AuthCodeDeliveryDetails? = null,
totpSetupDetails: TOTPSetupDetails? = null,
allowedMFATypes: Set<MFAType>? = null
) = AuthNextSignInStep(signInStep, additionalInfo, codeDeliveryDetails, totpSetupDetails, allowedMFATypes)
allowedMFATypes: Set<MFAType>? = null,
availableFactors: Set<AuthFactorType>? = null
) = AuthNextSignInStep(
signInStep,
additionalInfo,
codeDeliveryDetails,
totpSetupDetails,
allowedMFATypes,
availableFactors
)

internal fun mockUserAttributes(
vararg attribute: Pair<AuthUserAttributeKey, String>
) = attribute.map { AuthUserAttribute(it.first, it.second) }
internal fun mockUserAttributes(vararg attribute: Pair<AuthUserAttributeKey, String>) =
attribute.map { AuthUserAttribute(it.first, it.second) }

internal fun mockUser(
userId: String = "userId",
username: String = "username"
) = AuthUser(userId, username)
internal fun mockUser(userId: String = "userId", username: String = "username") = AuthUser(userId, username)
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
agp = "8.1.4"
amplify = "2.24.0"
amplify = "2.27.0"
binary-compatibility = "0.14.0"
cameraX = "1.2.0"
compose = "1.5.4"
Expand Down
2 changes: 1 addition & 1 deletion samples/authenticator/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ android {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.4.3'
kotlinCompilerExtensionVersion "1.5.3"
}
packagingOptions {
resources {
Expand Down
2 changes: 1 addition & 1 deletion samples/authenticator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ buildscript {
plugins {
id 'com.android.application' version '8.1.4' apply false
id 'com.android.library' version '8.1.4' apply false
id 'org.jetbrains.kotlin.android' version '1.8.10' apply false
id 'org.jetbrains.kotlin.android' version '1.9.10' apply false
}