diff --git a/README.md b/README.md index f905c30..0501149 100644 --- a/README.md +++ b/README.md @@ -220,6 +220,17 @@ The example application wraps the SDK calls in the use-case implementations in t As an example check the [InBandAuthenticationUseCaseImpl](app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/InBandAuthenticationUseCaseImpl.kt) and the [AuthenticatorSelectorImpl](app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/AuthenticatorSelectorImpl.kt) classes. +### KDoc & Dokka + +The source code is documented using [KDoc](https://kotlinlang.org/docs/kotlin-doc.html) syntax. [Dokka](https://kotlinlang.org/docs/dokka-introduction.html) is an API documentation engine for Kotlin. +Documentation can be generated by running: + +```bash +./gradlew dokkaHtml dokkaHtmlMultiModule +``` + +The output can be found in the `build/dokka/htmlMultiModule` folder. + ## Integration Notes In this section you can find hints about how the Nevis Mobile Authentication SDK is integrated into the example app. @@ -288,4 +299,4 @@ The following use cases are responsible for getting information with the help of - The [GetAuthenticatorsUseCaseImpl](app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetAuthenticatorsUseCaseImpl.kt) class obtains the authenticator information. - The [GetDeviceInformationUseCaseImpl](app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetDeviceInformationUseCaseImpl.kt) class obtains the device information. -© 2023 made with ❤ by Nevis +© 2024 made with ❤ by Nevis diff --git a/app/module.md b/app/module.md new file mode 100644 index 0000000..443046a --- /dev/null +++ b/app/module.md @@ -0,0 +1,217 @@ +# Module nevis-mobile-authentication-example-coroutines-app + +## Description + +The example app demonstrating how to use the Nevis Mobile Authentication SDK in an Android mobile application. +The Nevis Mobile Authentication SDK allows you to integrate passwordless authentication to your existing mobile app, backed by the FIDO UAF 1.1 Standard. + +Some SDK features demonstrated in this example app are: + +- Using the SDK with the Nevis Authentication Cloud +- Registering with QR code & app link URIs +- Simulating in-band authentication after registration +- Deregistering a registered account +- Changing the PIN of the PIN authenticator +- Changing the device information + +Please note that the example app only demonstrates a subset of the available SDK features. The main purpose is to demonstrate how the SDK can be used, not to cover all supported scenarios. + +# Package ch.nevis.exampleapp.coroutines.application + +This package contains a sub-class of `Application` to enable Dagger Hilt capabilities and to initialize logging. + +# Package ch.nevis.exampleapp.coroutines.common.configuration + +This package contains the configuration possibilities of the Nevis Mobile Authentication SDK. + +# Package ch.nevis.exampleapp.coroutines.common.error + +This package contains the error handling related classes. + +# Package ch.nevis.exampleapp.coroutines.common.settings + +This package contains the application settings possibilities. + +# Package ch.nevis.exampleapp.coroutines.dagger + +This package contains the main Dagger Hilt configuration module. + +# Package ch.nevis.exampleapp.coroutines.data.cache + +This package contains caching related implementations. + +# Package ch.nevis.exampleapp.coroutines.data.dataSource + +This package contains data source implementations. + +# Package ch.nevis.exampleapp.coroutines.data.dataSource + +This package contains model definitions. + +# Package ch.nevis.exampleapp.coroutines.data.repository + +This package contains repository implementations. + +# Package ch.nevis.exampleapp.coroutines.data.retrofit + +This package contains the `Retrofit` networking framework integration. + +# Package ch.nevis.exampleapp.coroutines.domain.client + +This package contains the `MobileAuthenticationClient` provider. + +# Package ch.nevis.exampleapp.coroutines.domain.interaction + +This package contains the default implementation of interaction related interfaces from the Nevis Mobile Authentication SDK, like account and authenticator selection and user verification. + +# Package ch.nevis.exampleapp.coroutines.domain.interaction.password + +This package contains the default implementation of password interaction related interfaces from the Nevis Mobile Authentication SDK, like changing, enrolling and verifying the password. + +# Package ch.nevis.exampleapp.coroutines.domain.interaction.pin + +This package contains the default implementation of PIN interaction related interfaces from the Nevis Mobile Authentication SDK, like changing, enrolling and verifying the PIN. + +# Package ch.nevis.exampleapp.coroutines.domain.log + +This package contains logging related implementations. + +# Package ch.nevis.exampleapp.coroutines.domain.model.error + +This package contains error handling related model definitions. + +# Package ch.nevis.exampleapp.coroutines.domain.model.operation + +This package contains operation related model definitions. + +# Package ch.nevis.exampleapp.coroutines.domain.model.response + +This package contains operation related response model definitions. + +# Package ch.nevis.exampleapp.coroutines.domain.model.sdk + +This package contains Nevis Mobile Authentication SDK related model definitions. + +# Package ch.nevis.exampleapp.coroutines.domain.model.state + +This package contains operation related state definitions. + +# Package ch.nevis.exampleapp.coroutines.domain.repository + +This package contains repository definitions. + +# Package ch.nevis.exampleapp.coroutines.domain.usecase + +This package contains use case definitions and implementations. + +# Package ch.nevis.exampleapp.coroutines.domain.util + +This package contains Nevis Mobile Authentication SDK related extension definitions. + +# Package ch.nevis.exampleapp.coroutines.domain.validation + +This package contains validation related logic. + +# Package ch.nevis.exampleapp.coroutines.timber + +This package contains the `Timber` logging framework integration. + +# Package ch.nevis.exampleapp.coroutines.ui.authCloudRegistration + +This package contains the view and view model definitions for the Auth Cloud API Registration operation. + +# Package ch.nevis.exampleapp.coroutines.ui.base + +This package contains the base view and view model definitions. + +# Package ch.nevis.exampleapp.coroutines.ui.changeDeviceInformation + +This package contains the view and view model definitions for the Change Device Information operation. + +# Package ch.nevis.exampleapp.coroutines.ui.credential + +This package contains the view and view model definitions for credential related operations, like change, enroll or verify a PIN or password. + +# Package ch.nevis.exampleapp.coroutines.ui.credential.model + +This package contains the model definitions for credential related operations. + +# Package ch.nevis.exampleapp.coroutines.ui.credential.parameter + +This package contains the navigation parameter definitions for credential related operations. + +# Package ch.nevis.exampleapp.coroutines.ui.error + +This package contains the view definition for error handling. + +# Package ch.nevis.exampleapp.coroutines.ui.error.parameter + +This package contains the navigation parameter definitions for error handling. + +# Package ch.nevis.exampleapp.coroutines.ui.home + +This package contains the view and view model definitions for the Home feature. + +# Package ch.nevis.exampleapp.coroutines.ui.legacyLogin + +This package contains the view and view model definitions for In-Band Registration operation. + +# Package ch.nevis.exampleapp.coroutines.ui.main + +This package contains the main activity and view model definitions. + +# Package ch.nevis.exampleapp.coroutines.ui.qrReader + +This package contains the view and view model definitions for Qr Code reading. + +# Package ch.nevis.exampleapp.coroutines.ui.result + +This package contains the view definition for displaying operation result. + +# Package ch.nevis.exampleapp.coroutines.ui.result.parameter + +This package contains the navigation parameter definitions for displaying operation result. + +# Package ch.nevis.exampleapp.coroutines.ui.selectAccount + +This package contains the view and view model definitions for account selection. + +# Package ch.nevis.exampleapp.coroutines.ui.selectAccount.parameter + +This package contains the navigation parameter definitions for account selection. + +# Package ch.nevis.exampleapp.coroutines.ui.selectAuthenticator + +This package contains the view and view model definitions for authenticator selection. + +# Package ch.nevis.exampleapp.coroutines.ui.selectAuthenticator.model + +This package contains the model definitions for authenticator selection. + +# Package ch.nevis.exampleapp.coroutines.ui.selectAuthenticator.parameter + +This package contains the navigation parameter definitions for authenticator selection. + +# Package ch.nevis.exampleapp.coroutines.ui.transactionConfirmation + +This package contains the view and view model definitions for transaction confirmation. + +# Package ch.nevis.exampleapp.coroutines.ui.transactionConfirmation.parameter + +This package contains the navigation parameter definitions for transaction confirmation. + +# Package ch.nevis.exampleapp.coroutines.ui.util + +This package contains utility methods. + +# Package ch.nevis.exampleapp.coroutines.ui.verifyUser + +This package contains the view and view model definitions for user verification. + +# Package ch.nevis.exampleapp.coroutines.ui.verifyUser.model + +This package contains the model definitions for user verification. + +# Package ch.nevis.exampleapp.coroutines.ui.verifyUser.parameter + +This package contains the navigation parameter definitions for user verification. diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/application/ExampleApplication.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/application/ExampleApplication.kt index a4bcf1e..f998dfa 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/application/ExampleApplication.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/application/ExampleApplication.kt @@ -26,10 +26,11 @@ class ExampleApplication: Application() { lateinit var sdkLogger: SdkLogger //region Application + /** @suppress */ override fun onCreate() { super.onCreate() Timber.plant(ExampleAppTree(sdkLogger)) } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/common/error/CancelErrorHandlerImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/common/error/CancelErrorHandlerImpl.kt index 4d45603..cf8a85b 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/common/error/CancelErrorHandlerImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/common/error/CancelErrorHandlerImpl.kt @@ -17,6 +17,9 @@ import timber.log.Timber /** * Implementation of [ErrorHandler] interface for cases the user cancels an operation. + * + * @constructor Creates a new instance. + * @param navController The navigation controller. */ class CancelErrorHandlerImpl( private val navController: NavController @@ -61,4 +64,4 @@ class CancelErrorHandlerImpl( } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/common/error/DefaultErrorHandlerImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/common/error/DefaultErrorHandlerImpl.kt index d7c1619..d9ac188 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/common/error/DefaultErrorHandlerImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/common/error/DefaultErrorHandlerImpl.kt @@ -18,6 +18,10 @@ import timber.log.Timber /** * Default implementation of [ErrorHandler] interface. + * + * @constructor Creates a new instance. + * @param context An Android [Context] object for [String] resource resolving. + * @param navController The navigation controller. */ class DefaultErrorHandlerImpl( private val context: Context, @@ -66,4 +70,4 @@ class DefaultErrorHandlerImpl( return throwable.message ?: throwable.stackTraceToString() } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/common/error/ErrorHandlerChainImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/common/error/ErrorHandlerChainImpl.kt index 3663227..54a5609 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/common/error/ErrorHandlerChainImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/common/error/ErrorHandlerChainImpl.kt @@ -8,6 +8,8 @@ package ch.nevis.exampleapp.coroutines.common.error /** * Default implementation of [ErrorHandlerChain] interface. + * + * @constructor Creates a new instance. */ class ErrorHandlerChainImpl : ErrorHandlerChain { @@ -37,4 +39,4 @@ class ErrorHandlerChainImpl : ErrorHandlerChain { } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/common/settings/Settings.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/common/settings/Settings.kt index ec036c5..250c618 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/common/settings/Settings.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/common/settings/Settings.kt @@ -21,6 +21,10 @@ interface Settings { * by requiring user authentication. * However in some cases it may be acceptable for the sake of end-user convenience. Allowing Class 2 * sensors will enable for instance the use of face recognition in some Samsung devices. + * + * @see ch.nevis.mobile.sdk.api.operation.authcloudapi.AuthCloudApiRegistration + * @see ch.nevis.mobile.sdk.api.operation.outofband.OutOfBandRegistration + * @see ch.nevis.mobile.sdk.api.operation.Registration.allowClass2Sensors */ val allowClass2Sensors: Boolean -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/common/settings/SettingsImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/common/settings/SettingsImpl.kt index 7d766c0..9289f33 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/common/settings/SettingsImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/common/settings/SettingsImpl.kt @@ -13,6 +13,9 @@ import javax.inject.Inject /** * Default implementation of [Settings] interface. + * + * @constructor Creates a new instance. + * @param context The Android [Context]. */ class SettingsImpl @Inject constructor( @ApplicationContext diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/dagger/ApplicationModule.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/dagger/ApplicationModule.kt index 3984fdf..ce6d6d1 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/dagger/ApplicationModule.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/dagger/ApplicationModule.kt @@ -89,6 +89,9 @@ import javax.inject.Singleton class ApplicationModule { //region Constants + /** + * Collection of constants. + */ companion object { /** * The unique name of authenticator selector implementation for Registration operation. @@ -115,6 +118,12 @@ class ApplicationModule { //endregion //region Configuration + /** + * Provides Auth Cloud specific configuration. + * + * @param application The actual Android application. + * @return The Auth Cloud specific configuration. + */ @Suppress("DEPRECATION") @SuppressLint("PackageManagerGetSignatures") @Provides @@ -132,6 +141,12 @@ class ApplicationModule { .build() } + /** + * Provides Identity Suite specific configuration. + * + * @param application The actual Android application. + * @return The Identity Suite specific configuration. + */ @Suppress("DEPRECATION") @SuppressLint("PackageManagerGetSignatures") @Provides @@ -154,6 +169,11 @@ class ApplicationModule { .build() } + /** + * Provides the list of allowed authenticators. + * + * @return The list of allowed authenticators. + */ @Provides fun provideAuthenticatorAllowlist(): List = listOf( PIN_AUTHENTICATOR_AAID, @@ -163,6 +183,12 @@ class ApplicationModule { DEVICE_PASSCODE_AUTHENTICATOR_AAID ) + /** + * Provides the configuration provider. + * + * @param application The actual Android application. + * @return The configuration provider. + */ @Provides @Singleton fun provideConfigurationProvider(application: Application): ConfigurationProvider = @@ -174,40 +200,78 @@ class ApplicationModule { //endregion //region Client + /** + * Provides the client provider. + * + * @return The client provider. + */ @Provides @Singleton fun provideClientProvider(): ClientProvider = ClientProviderImpl() //endregion //region Error Handling + /** + * Provides the error handler chain. + * + * @return The error handler chain. + */ @Provides @Singleton fun provideErrorHandlerChain(): ErrorHandlerChain = ErrorHandlerChainImpl() //endregion //region Logger + /** + * Provides the sdk logger. + * + * @return The sdk logger. + */ @Provides @Singleton fun provideSdkLogger(): SdkLogger = SdkLoggerImpl() //endregion //region Settings + /** + * Provides the application settings. + * + * @param context The Android [Context]. + * @return The application settings. + */ @Provides @Singleton fun provideSettings(@ApplicationContext context: Context): Settings = SettingsImpl(context) //endregion //region Validation + /** + * Provides the authenticator validator. + * + * @return The authenticator validator. + */ @Provides @Singleton fun provideAuthenticatorValidator(): AuthenticatorValidator = AuthenticatorValidatorImpl() + /** + * Provides the password policy. + * + * @param context The Android [Context]. + * @return The password policy. + */ @Provides fun providePasswordPolicy(@ApplicationContext context: Context): PasswordPolicy = PasswordPolicyImpl(context) //endregion //region Data Sources + /** + * Provides the login related data source. + * + * @param retrofit An instance of [Retrofit]. + * @return The login related data source. + */ @Provides fun provideLoginDataSource(retrofit: Retrofit): LoginDataSource = LoginDataSourceImpl(retrofit) @@ -215,45 +279,101 @@ class ApplicationModule { //region Caches + /** + * Provides state cache for the PIN change operation. + * + * @return The state cache for the PIN change operation. + */ @Provides fun provideChangePinOperationStateCache(): Cache = CacheImpl() + /** + * Provides state cache for the Password change operation. + * + * @return The state cache for the Password change operation. + */ @Provides fun provideChangePasswordOperationStateCache(): Cache = CacheImpl() + /** + * Provides state cache for user interaction related operations. + * + * @return The state cache for user interaction related operations. + */ @Provides fun provideUserInteractionOperationStateCache(): Cache = CacheImpl() //endregion //region Repositories + /** + * Provides state repository for the PIN change operation. + * + * @param cache The state cache for the PIN change operation. + * @return The state repository for the PIN change operation. + */ @Provides @Singleton fun provideChangePinOperationStateRepository(cache: Cache): OperationStateRepository = OperationStateRepositoryImpl(cache) + /** + * Provides state repository for the Password change operation. + * + * @param cache The state cache for the Password change operation. + * @return The state repository for the Password change operation. + */ @Provides @Singleton fun provideChangePasswordOperationStateRepository(cache: Cache): OperationStateRepository = OperationStateRepositoryImpl(cache) + /** + * Provides state repository for user interaction related operations. + * + * @param cache The state cache for interaction related operations. + * @return The state repository for user interaction related operations. + */ @Provides @Singleton fun provideUserInteractionOperationStateRepository(cache: Cache): OperationStateRepository = OperationStateRepositoryImpl(cache) + /** + * Provides repository for login feature. + * + * @param loginDataSource The login related data source implementation. + * @return The repository for login feature. + */ @Provides fun provideLoginRepository(loginDataSource: LoginDataSource): LoginRepository = LoginRepositoryImpl(loginDataSource) //endregion //region Interaction + /** + * Provides the account selector. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @return The account selector. + */ @Provides fun provideAccountSelector(stateRepository: OperationStateRepository): AccountSelector = AccountSelectorImpl(stateRepository) + /** + * Provides the authenticator selector for registration operation. + * + * @param configurationProvider An instance of a [ConfigurationProvider] interface implementation. + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @param authenticatorValidator An instance of an [AuthenticatorValidator] interface implementation. + * @param settings An instance of a [Settings] interface implementation. + * @return The authenticator selector. + */ @Provides @Named(REGISTRATION_AUTHENTICATOR_SELECTOR) fun provideRegistrationAuthenticatorSelector( @@ -270,6 +390,16 @@ class ApplicationModule { AuthenticatorSelectorOperation.REGISTRATION ) + /** + * Provides the authenticator selector for authentication operation. + * + * @param configurationProvider An instance of a [ConfigurationProvider] interface implementation. + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @param authenticatorValidator An instance of an [AuthenticatorValidator] interface implementation. + * @param settings An instance of a [Settings] interface implementation. + * @return The authenticator selector. + */ @Provides @Named(AUTHENTICATION_AUTHENTICATOR_SELECTOR) fun provideAuthenticationAuthenticatorSelector( @@ -286,18 +416,47 @@ class ApplicationModule { AuthenticatorSelectorOperation.AUTHENTICATION ) + /** + * Provides the PIN changer. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [ChangePinOperationState]. + * @return The PIN changer. + */ @Provides fun providePinChanger(stateRepository: OperationStateRepository): PinChanger = PinChangerImpl(stateRepository) + /** + * Provides the PIN user verifier. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @return The PIN user verifier. + */ @Provides fun providePinUserVerifier(stateRepository: OperationStateRepository): PinUserVerifier = PinUserVerifierImpl(stateRepository) + /** + * Provides the PIN enroller. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @return The PIN enroller. + */ @Provides fun providePinEnroller(stateRepository: OperationStateRepository): PinEnroller = PinEnrollerImpl(stateRepository) + /** + * Provides the Password changer. + * + * @param passwordPolicy An instance of [PasswordPolicy] interface implementation. + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [ChangePasswordOperationState]. + * @return The Password changer. + */ @Provides fun providePasswordChanger( passwordPolicy: PasswordPolicy, @@ -305,6 +464,14 @@ class ApplicationModule { ): PasswordChanger = PasswordChangerImpl(passwordPolicy, stateRepository) + /** + * Provides the Password enroller. + * + * @param passwordPolicy An instance of [PasswordPolicy] interface implementation. + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @return The Password enroller. + */ @Provides fun providePasswordEnroller( passwordPolicy: PasswordPolicy, @@ -312,66 +479,171 @@ class ApplicationModule { ): PasswordEnroller = PasswordEnrollerImpl(passwordPolicy, stateRepository) + /** + * Provides the Password user verifier. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @return The Password user verifier. + */ @Provides fun providePasswordUserVerifier(stateRepository: OperationStateRepository): PasswordUserVerifier = PasswordUserVerifierImpl(stateRepository) + /** + * Provides the fingerprint user verifier. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @return The fingerprint user verifier. + */ @Provides fun provideFingerprintUserVerifier(stateRepository: OperationStateRepository): FingerprintUserVerifier = FingerprintUserVerifierImpl(stateRepository) + /** + * Provides the biometric user verifier. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @return The biometric user verifier. + */ @Provides fun provideBiometricUserVerifier(stateRepository: OperationStateRepository): BiometricUserVerifier = BiometricUserVerifierImpl(stateRepository) + /** + * Provides the device passcode user verifier. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @return The device passcode user verifier. + */ @Provides fun provideDevicePasscodeUserVerifier(stateRepository: OperationStateRepository): DevicePasscodeUserVerifier = DevicePasscodeUserVerifierImpl(stateRepository) + /** + * Provides the [Consumer] for successful authentication that accepts an [AuthorizationProvider] object. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @return The [Consumer] for for successful authentication that accepts an [AuthorizationProvider] + * object. + */ @Provides fun provideOnSuccessAuthentication(stateRepository: OperationStateRepository): Consumer = OnSuccessAuthenticationImpl(stateRepository) + /** + * Provides the [Consumer] for successful authentication during deregistration that accepts an + * [AuthorizationProvider] object. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @return The [Consumer] for successful authentication during Deregistration operation. + */ @Provides fun provideOnSuccessAuthenticationForDeregistration(stateRepository: OperationStateRepository): Consumer = OnSuccessAuthenticationImpl(stateRepository, Operation.DEREGISTRATION) + /** + * Provides the [Runnable] implementation for successful user interaction operations. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @return The [Runnable] implementation for successful user interaction operations. + */ @Provides fun provideOnSuccessForUserInteractionOperation(stateRepository: OperationStateRepository): Runnable = OnSuccessImpl(stateRepository) + /** + * Provides the [Runnable] for successful PIN change operation. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [ChangePinOperationState]. + * @return The [Runnable] for successful PIN change operation. + */ @Provides fun provideOnSuccessForChangePinOperation(stateRepository: OperationStateRepository): Runnable = OnSuccessImpl(stateRepository) + /** + * Provides the [Runnable] for successful password change operation. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [ChangePasswordOperationState]. + * @return The [Runnable] for successful password change operation. + */ @Provides fun provideOnSuccessForChangePasswordOperation(stateRepository: OperationStateRepository): Runnable = OnSuccessImpl(stateRepository) + /** + * Provides the [Consumer] that accepts an [OperationError] object. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @param errorHandlerChain An instance of [ErrorHandlerChain] interface implementation. + * @return The [Consumer] that accepts an [OperationError] object. + */ @Provides fun provideOnErrorForUserInteractionOperation( stateRepository: OperationStateRepository, errorHandlerChain: ErrorHandlerChain ): Consumer = OnErrorImpl(stateRepository, errorHandlerChain) + /** + * Provides the [Consumer] that accepts a [PinChangeError] object. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [ChangePinOperationState]. + * @param errorHandlerChain An instance of [ErrorHandlerChain] interface implementation. + * @return The [Consumer] that accepts a [PinChangeError] object. + */ @Provides fun provideOnErrorForChangePinOperation( stateRepository: OperationStateRepository, errorHandlerChain: ErrorHandlerChain ): Consumer = OnErrorImpl(stateRepository, errorHandlerChain) + /** + * Provides the [Consumer] that accepts a [PasswordChangeError] object. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [ChangePasswordOperationState]. + * @param errorHandlerChain An instance of [ErrorHandlerChain] interface implementation. + * @return The [Consumer] that accepts a [PasswordChangeError] object. + */ @Provides fun provideOnErrorForChangePasswordOperation( stateRepository: OperationStateRepository, errorHandlerChain: ErrorHandlerChain ): Consumer = OnErrorImpl(stateRepository, errorHandlerChain) + /** + * Provides the [Consumer] that accepts an [AuthCloudApiError] object. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @param errorHandlerChain An instance of [ErrorHandlerChain] interface implementation. + * @return The [Consumer] that accepts an [AuthCloudApiError] object. + */ @Provides fun provideOnAuthCloudApiError( stateRepository: OperationStateRepository, errorHandlerChain: ErrorHandlerChain ): Consumer = OnErrorImpl(stateRepository, errorHandlerChain) + /** + * Provides the [Consumer] that accepts an [AuthenticationError] object. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @param errorHandlerChain An instance of [ErrorHandlerChain] interface implementation. + * @return The [Consumer] that accepts an [AuthenticationError] object. + */ @Provides fun provideOnAuthenticationError( stateRepository: OperationStateRepository, @@ -380,6 +652,13 @@ class ApplicationModule { //endregion //region Use-cases + /** + * Provides use case for [ch.nevis.mobile.sdk.api.MobileAuthenticationClient] initialization. + * + * @param clientProvider An instance of [ClientProvider] interface implementation. + * @param context An Android [Context] object used for initializing [ch.nevis.mobile.sdk.api.MobileAuthenticationClient]. + * @return The use case for initializing the client. + */ @Provides @Singleton fun provideInitializeClientUseCase( @@ -391,31 +670,82 @@ class ApplicationModule { context ) + /** + * Provides use case for retrieving the registered accounts. + * + * @param clientProvider An instance of [ClientProvider] interface implementation. + * @return The use case for retrieving the registered accounts. + */ @Provides fun provideGetAccountsUseCase(clientProvider: ClientProvider): GetAccountsUseCase = GetAccountsUseCaseImpl(clientProvider) + /** + * Provides use case for retrieving the authenticators. + * + * @param clientProvider An instance of [ClientProvider] interface implementation. + * @return The use case for retrieving the authenticators. + */ @Provides fun provideGetAuthenticatorsUseCase(clientProvider: ClientProvider): GetAuthenticatorsUseCase = GetAuthenticatorsUseCaseImpl(clientProvider) + /** + * Provides use case for delete local authenticators. + * + * @param clientProvider An instance of [ClientProvider] interface implementation. + * @return The use case for delete local authenticators. + */ @Provides fun provideDeleteAuthenticatorsUseCase(clientProvider: ClientProvider): DeleteAuthenticatorsUseCase = DeleteAuthenticatorsUseCaseImpl(clientProvider) + /** + * Provides use case for creating a new [ch.nevis.mobile.sdk.api.localdata.DeviceInformation] object. + * + * @param context The Android [Context]. + * @return The use case for creating a new [ch.nevis.mobile.sdk.api.localdata.DeviceInformation] object. + */ @Provides fun provideCreateDeviceInformationUseCase(@ApplicationContext context: Context): CreateDeviceInformationUseCase = CreateDeviceInformationUseCaseImpl(context) + /** + * Provides use case for retrieving the device information stored by the client. + * + * @param clientProvider An instance of [ClientProvider] interface implementation. + * @return The use case for retrieving the device information stored by the client. + */ @Provides fun provideGetDeviceInformationUseCase(clientProvider: ClientProvider): GetDeviceInformationUseCase = GetDeviceInformationUseCaseImpl(clientProvider) + /** + * Provides use case for starting a change device information operation. + * + * @param clientProvider An instance of [ClientProvider] interface implementation. + * @return The use case for starting a change device information operation. + */ @Provides fun provideChangeDeviceInformationUseCase( clientProvider: ClientProvider ): ChangeDeviceInformationUseCase = ChangeDeviceInformationUseCaseImpl(clientProvider) + /** + * Provides use case for starting an in-band authentication operation. + * + * @param clientProvider An instance of [ClientProvider] interface implementation. + * @param stateRepository n instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @param authenticatorSelector An instance of [AuthenticatorSelector] interface implementation. + * @param pinUserVerifier An instance of [PinUserVerifier] interface implementation. + * @param passwordUserVerifier An instance of [PasswordUserVerifier] interface implementation. + * @param fingerprintUserVerifier An instance of [FingerprintUserVerifier] interface implementation. + * @param biometricUserVerifier An instance of [BiometricUserVerifier] interface implementation. + * @param devicePasscodeUserVerifier An instance of [DevicePasscodeUserVerifier] interface implementation. + * @param onError An instance of a [Consumer] implementation that accepts an [AuthenticationError] object. + * @return The use case for starting an in-band authentication operation. + */ @Provides @Named(IN_BAND_AUTHENTICATION_USE_CASE_DEFAULT) fun provideInBandAuthenticationUseCase( @@ -442,6 +772,21 @@ class ApplicationModule { onError ) + /** + * Provides use case for in-band authentication during deregistration. + * + * @param clientProvider An instance of [ClientProvider] interface implementation. + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @param authenticatorSelector An instance of [AuthenticatorSelector] interface implementation. + * @param pinUserVerifier An instance of [PinUserVerifier] interface implementation. + * @param passwordUserVerifier An instance of [PasswordUserVerifier] interface implementation. + * @param fingerprintUserVerifier An instance of [FingerprintUserVerifier] interface implementation. + * @param biometricUserVerifier An instance of [BiometricUserVerifier] interface implementation. + * @param devicePasscodeUserVerifier An instance of [DevicePasscodeUserVerifier] interface implementation. + * @param onError An instance of a [Consumer] implementation that accepts an [AuthenticationError] object. + * @return The use case for in-band authentication during deregistration. + */ @Provides @Named(IN_BAND_AUTHENTICATION_USE_CASE_FOR_DEREGISTRATION) fun provideInBandAuthenticationUseCaseForDeregistration( @@ -468,18 +813,49 @@ class ApplicationModule { onError ) + /** + * Provides use case for selecting an account during an out-of-band authentication. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @return The use case for selecting an account during an out-of-band authentication. + */ @Provides fun provideSelectAccountUseCase(stateRepository: OperationStateRepository): SelectAccountUseCase = SelectAccountUseCaseImpl(stateRepository) + /** + * Provides use case for selecting an authenticator during an authentication or registration operation. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @return The use case for selecting an authenticator during an authentication or registration operation. + */ @Provides fun provideSelectAuthenticatorUseCase(stateRepository: OperationStateRepository): SelectAuthenticatorUseCase = SelectAuthenticatorUseCaseImpl(stateRepository) + /** + * Provides use case for setting a new PIN during a registration operation. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @return The use case for setting a new PIN during a registration operation. + */ @Provides fun provideSetPinUseCase(stateRepository: OperationStateRepository): SetPinUseCase = SetPinUseCaseImpl(stateRepository) + /** + * Provides use case for starting a change PIN operation. + * + * @param clientProvider An instance of [ClientProvider] interface implementation. + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [ChangePinOperationState]. + * @param pinChanger An instance of [PinChanger] interface implementation. + * @param onError An instance of a [Consumer] implementation that accepts a [PinChangeError] object. + * @return The use case for starting a change PIN operation. + */ @Provides fun provideStartChangePinUseCase( clientProvider: ClientProvider, @@ -494,18 +870,49 @@ class ApplicationModule { onError ) + /** + * Provides use case for completing change PIN operation. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [ChangePinOperationState]. + * @return The use case for completing change PIN operation. + */ @Provides fun provideChangePinUseCase(stateRepository: OperationStateRepository): ChangePinUseCase = ChangePinUseCaseImpl(stateRepository) + /** + * Provides use case for verifying the user using PIN authenticator. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @return The use case for verifying the user using PIN authenticator. + */ @Provides fun provideVerifyPinUseCase(stateRepository: OperationStateRepository): VerifyPinUseCase = VerifyPinUseCaseImpl(stateRepository) + /** + * Provides use case for setting a new password during a registration operation. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @return The use case for setting a new password during a registration operation. + */ @Provides fun provideSetPasswordUseCase(stateRepository: OperationStateRepository): SetPasswordUseCase = SetPasswordUseCaseImpl(stateRepository) + /** + * Provides use case for starting a change Password operation. + * + * @param clientProvider An instance of [ClientProvider] interface implementation. + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [ChangePasswordOperationState]. + * @param passwordChanger An instance of [PasswordChanger] interface implementation. + * @param onError An instance of a [Consumer] implementation that accepts a [PasswordChangeError] object. + * @return The use case for starting a change Password operation. + */ @Provides fun provideStartChangePasswordUseCase( clientProvider: ClientProvider, @@ -520,26 +927,83 @@ class ApplicationModule { onError ) + /** + * Provides use case for completing change Password operation. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may + * hold a [ChangePasswordOperationState]. + * @return The use case for completing change Password operation. + */ @Provides fun provideChangePasswordUseCase(stateRepository: OperationStateRepository): ChangePasswordUseCase = ChangePasswordUseCaseImpl(stateRepository) + /** + * Provides use case for verifying the user using Password authenticator. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @return The use case for verifying the user using Password authenticator. + */ @Provides fun provideVerifyPasswordUseCase(stateRepository: OperationStateRepository): VerifyPasswordUseCase = VerifyPasswordUseCaseImpl(stateRepository) + /** + * Provides use case for verifying the user using fingerprint authenticator. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @return The use case for verifying the user using fingerprint authenticator. + */ @Provides fun provideVerifyFingerprintUseCase(stateRepository: OperationStateRepository): VerifyFingerprintUseCase = VerifyFingerprintUseCaseImpl(stateRepository) + /** + * Provides use case for verifying the user using biometric authenticator. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @return The use case for verifying the user using biometric authenticator. + */ @Provides fun provideVerifyBiometricUseCase(stateRepository: OperationStateRepository): VerifyBiometricUseCase = VerifyBiometricUseCaseImpl(stateRepository) + /** + * Provides use case for verifying the user using device passcode authenticator. + * + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @return The use case for verifying the user using device passcode authenticator. + */ @Provides fun provideVerifyDevicePasscodeUseCase(stateRepository: OperationStateRepository): VerifyDevicePasscodeUseCase = VerifyDevicePasscodeUseCaseImpl(stateRepository) + /** + * Provides use case for starting a process out-of-band payload operation. + * + * @param clientProvider An instance of [ClientProvider] interface implementation. + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @param createDeviceInformationUseCase An instance of [CreateDeviceInformationUseCase] interface implementation. + * @param accountSelector An instance of [AccountSelector] interface implementation. + * @param registrationAuthenticatorSelector An instance of [AuthenticatorSelector] interface implementation + * for Registration operation. + * @param authenticationAuthenticatorSelector An instance of [AuthenticatorSelector] interface implementation + * for Authentication operation. + * @param pinEnroller An instance of [PinEnroller] interface implementation. + * @param passwordEnroller An instance of [PasswordEnroller] interface implementation. + * @param pinUserVerifier An instance of [PinUserVerifier] interface implementation. + * @param passwordUserVerifier An instance of [PasswordUserVerifier] interface implementation. + * @param fingerprintUserVerifier An instance of [FingerprintUserVerifier] interface implementation. + * @param biometricUserVerifier An instance of [BiometricUserVerifier] interface implementation. + * @param devicePasscodeUserVerifier An instance of [DevicePasscodeUserVerifier] interface implementation. + * @param onError An instance of a [Consumer] implementation that accepts an [OperationError] object. + * @return The use case for starting a process out-of-band payload operation. + */ @Provides fun provideProcessOutOfBandPayloadUseCase( clientProvider: ClientProvider, @@ -577,16 +1041,45 @@ class ApplicationModule { onError ) + /** + * Provides use case for decoding an out-of-band payload. + * + * @param clientProvider An instance of [ClientProvider] interface implementation. + * @return The use case for decoding an out-of-band payload. + */ @Provides fun provideDecodePayloadUseCase( clientProvider: ClientProvider ): DecodePayloadUseCase = DecodePayloadUseCaseImpl(clientProvider) + /** + * Provides use case for deregister registered accounts, authenticators. + * + * @param clientProvider An instance of [ClientProvider] interface implementation. + * @return The use case for deregister registered accounts, authenticators. + */ @Provides fun provideDeregisterUseCase(clientProvider: ClientProvider): DeregisterUseCase = DeregisterUseCaseImpl(clientProvider) + /** + * Provides use case for starting an Auth Cloud API registration operation. + * + * @param clientProvider An instance of [ClientProvider] interface implementation. + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @param createDeviceInformationUseCase An instance of [CreateDeviceInformationUseCase] interface implementation. + * @param authenticatorSelector An instance of [AuthenticatorSelector] interface implementation + * for Registration operation. + * @param pinEnroller An instance of [PinEnroller] interface implementation. + * @param passwordEnroller An instance of [PasswordEnroller] interface implementation. + * @param fingerprintUserVerifier An instance of [FingerprintUserVerifier] interface implementation. + * @param biometricUserVerifier An instance of [BiometricUserVerifier] interface implementation. + * @param devicePasscodeUserVerifier An instance of [DevicePasscodeUserVerifier] interface implementation. + * @param onError An instance of a [Consumer] implementation that accepts an [AuthCloudApiError] object. + * @return The use case for starting an Auth Cloud API registration operation. + */ @Provides fun provideAuthCloudApiRegistrationUseCase( clientProvider: ClientProvider, @@ -614,10 +1107,34 @@ class ApplicationModule { onError ) + /** + * Provides use case for login. + * + * @param loginRepository An instance of a [LoginRepository] implementation that is used for the + * login process. + * @return The use case for login. + */ @Provides fun provideLoginUseCase(loginRepository: LoginRepository): LoginUseCase = LoginUseCaseImpl(loginRepository) + /** + * Provides use case for starting an in-band registration operation. + * + * @param clientProvider An instance of [ClientProvider] interface implementation. + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @param createDeviceInformationUseCase An instance of [CreateDeviceInformationUseCase] interface implementation. + * @param authenticatorSelector An instance of [AuthenticatorSelector] interface implementation + * for Registration operation. + * @param pinEnroller An instance of [PinEnroller] interface implementation. + * @param passwordEnroller An instance of [PasswordEnroller] interface implementation. + * @param fingerprintUserVerifier An instance of [FingerprintUserVerifier] interface implementation. + * @param biometricUserVerifier An instance of [BiometricUserVerifier] interface implementation. + * @param devicePasscodeUserVerifier An instance of [DevicePasscodeUserVerifier] interface implementation. + * @param onError An instance of a [Consumer] implementation that accepts an [OperationError] object. + * @return The use case for starting an in-band registration operation. + */ @Provides fun provideInBandRegistrationUseCase( clientProvider: ClientProvider, @@ -645,26 +1162,58 @@ class ApplicationModule { onError ) + /** + * Provides use case for cancelling currently running operation. + * + * @param userInteractionOperationStateRepository An instance of an [OperationStateRepository] + * implementation that may hold an [UserInteractionOperationState]. + * @param changePinOperationStateRepository An instance of an [OperationStateRepository] + * implementation that may hold an [ChangePinOperationState]. + * @param changePasswordOperationStateRepository An instance of an [OperationStateRepository] + * implementation that may hold an [ChangePasswordOperationState]. + * @return The use case for cancelling currently running operation. + */ @Provides fun provideCancelOperationUseCase( userInteractionOperationStateRepository: OperationStateRepository, - changePinOperationStateRepository: OperationStateRepository + changePinOperationStateRepository: OperationStateRepository, + changePasswordOperationStateRepository: OperationStateRepository ): CancelOperationUseCase = CancelOperationUseCaseImpl( userInteractionOperationStateRepository, - changePinOperationStateRepository + changePinOperationStateRepository, + changePasswordOperationStateRepository ) + /** + * Provides use case for finishing any previously started operation. + * + * @param userInteractionOperationStateRepository An instance of an [OperationStateRepository] + * implementation that may hold an [UserInteractionOperationState]. + * @param changePinOperationStateRepository An instance of an [OperationStateRepository] implementation + * that may hold an [ChangePinOperationState]. + * @param changePasswordOperationStateRepository An instance of an [OperationStateRepository] + * implementation that may hold an [ChangePasswordOperationState]. + * @return The use case for finishing any previously started operation. + */ @Provides fun provideFinishOperationUseCase( userInteractionOperationStateRepository: OperationStateRepository, - changePinOperationStateRepository: OperationStateRepository + changePinOperationStateRepository: OperationStateRepository, + changePasswordOperationStateRepository: OperationStateRepository ): FinishOperationUseCase = FinishOperationUseCaseImpl( userInteractionOperationStateRepository, - changePinOperationStateRepository + changePinOperationStateRepository, + changePasswordOperationStateRepository ) //endregion //region Retrofit + /** + * Provides the [Retrofit] implementation. + * + * @param configurationProvider An instance of a [ConfigurationProvider] interface implementation. + * @return The [Retrofit] implementation. + */ @Provides fun provideRetrofit(configurationProvider: ConfigurationProvider): Retrofit = Retrofit.Builder().baseUrl(configurationProvider.configuration.baseUrl().toString()) diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/data/dataSource/LoginDataSourceImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/data/dataSource/LoginDataSourceImpl.kt index 2e583ad..3ae61a2 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/data/dataSource/LoginDataSourceImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/data/dataSource/LoginDataSourceImpl.kt @@ -16,6 +16,10 @@ import java.net.PasswordAuthentication /** * Default implementation of [LoginDataSource] interface that uses Retrofit to retrieve the credentials * from the server for the given username/password. + * + * @constructor Creates a new instance. + * @param retrofit An instance of [Retrofit]. + * */ class LoginDataSourceImpl( private val retrofit: Retrofit @@ -44,8 +48,14 @@ class LoginDataSourceImpl( //endregion //region Companion Object + /** + * Collection of constants. + */ companion object { + /** + * The `Set-Cookie` header key. + */ private const val HEADER_SET_COOKIE = "Set-Cookie" } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/data/model/LoginEndPointResponse.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/data/model/LoginEndPointResponse.kt index e139d3d..89c7793 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/data/model/LoginEndPointResponse.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/data/model/LoginEndPointResponse.kt @@ -8,6 +8,10 @@ package ch.nevis.exampleapp.coroutines.data.model /** * Data class that represents the JSON response of [ch.nevis.exampleapp.coroutines.data.retrofit.LoginEndPoint]. + * + * @constructor Creates a new instance. + * @param status Status, result of the login end-point call. + * @param extId The external identifier of the user that logged in. */ data class LoginEndPointResponse( /** diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/data/repository/LoginRepositoryImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/data/repository/LoginRepositoryImpl.kt index ffebb78..45a6dd7 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/data/repository/LoginRepositoryImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/data/repository/LoginRepositoryImpl.kt @@ -13,11 +13,11 @@ import java.net.PasswordAuthentication /** * Default implementation of [LoginRepository] interface. + * + * @constructor Creates a new instance. + * @param loginDataSource A [LoginDataSource] instance to extract the [LoginResponse] from data layer. */ class LoginRepositoryImpl( - /** - * A [LoginDataSource] instance to extract the [LoginResponse] from data layer. - */ private val loginDataSource: LoginDataSource ) : LoginRepository { @@ -30,4 +30,4 @@ class LoginRepositoryImpl( ) } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/data/repository/OperationStateRepositoryImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/data/repository/OperationStateRepositoryImpl.kt index a2f2e65..d366ea4 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/data/repository/OperationStateRepositoryImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/data/repository/OperationStateRepositoryImpl.kt @@ -12,6 +12,9 @@ import ch.nevis.exampleapp.coroutines.domain.repository.OperationStateRepository /** * Default implementation of [OperationStateRepository] interface. + * + * @constructor Creates a new instance. + * @param cache The state cache for operations. */ class OperationStateRepositoryImpl( private val cache: Cache @@ -30,4 +33,4 @@ class OperationStateRepositoryImpl( cache.reset() } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/data/retrofit/LoginEndPoint.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/data/retrofit/LoginEndPoint.kt index d8fb508..ffe84d7 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/data/retrofit/LoginEndPoint.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/data/retrofit/LoginEndPoint.kt @@ -14,7 +14,7 @@ import retrofit2.http.Headers import retrofit2.http.POST /** - * Retrofit end-point interface for legacy login. + * Retrofit end-point interface for login. */ interface LoginEndPoint { diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/client/ClientProvider.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/client/ClientProvider.kt index 92d6cce..1f739a1 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/client/ClientProvider.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/client/ClientProvider.kt @@ -31,4 +31,4 @@ interface ClientProvider { * Resets the provider, removes the stored [MobileAuthenticationClient] instance from the provider. */ fun reset() -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/client/ClientProviderImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/client/ClientProviderImpl.kt index 0ff7b89..3b3ebb5 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/client/ClientProviderImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/client/ClientProviderImpl.kt @@ -10,6 +10,8 @@ import ch.nevis.mobile.sdk.api.MobileAuthenticationClient /** * Default implementation of [ClientProvider] interface. + * + * @constructor Creates a new instance. */ class ClientProviderImpl : ClientProvider { @@ -30,4 +32,4 @@ class ClientProviderImpl : ClientProvider { client = null } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/AccountSelectorImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/AccountSelectorImpl.kt index d37f3d8..0ce4628 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/AccountSelectorImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/AccountSelectorImpl.kt @@ -23,15 +23,16 @@ import kotlin.coroutines.resume * Default implementation of [AccountSelector] interface. It stores the account selection step context * into its state and resumes the cancellableContinuation found in state with [SelectAccountResponse] * indicating that the running operation waiting for an account selection. + * + * @constructor Creates a new instance. + * @param stateRepository The state repository that stores the state of the running operation. */ class AccountSelectorImpl( - /** - * The state repository that stores the state of the running operation. - */ private val stateRepository: OperationStateRepository ) : AccountSelector { //region AccountSelector + /** @suppress */ override fun selectAccount( accountSelectionContext: AccountSelectionContext, accountSelectionHandler: AccountSelectionHandler @@ -68,6 +69,7 @@ class AccountSelectorImpl( //endregion //region Private Interface + /** @suppress */ private fun validAccounts(context: AccountSelectionContext): Set { val validAccounts = mutableSetOf() context.authenticators().forEach { authenticator -> @@ -83,4 +85,4 @@ class AccountSelectorImpl( return validAccounts } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/AuthenticatorSelectorImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/AuthenticatorSelectorImpl.kt index f76c3b2..c4c33ee 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/AuthenticatorSelectorImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/AuthenticatorSelectorImpl.kt @@ -41,33 +41,22 @@ enum class AuthenticatorSelectorOperation { /** * Default implementation of [AuthenticatorSelector] interface. - */ -class AuthenticatorSelectorImpl( - /** - * An instance of a [ConfigurationProvider] implementation. - */ + * + * @constructor Creates a new instance. + * @param configurationProvider An instance of a [ConfigurationProvider] interface implementation. + * @param authenticatorValidator An instance of a [AuthenticatorValidator] interface implementation. + * @param settings An instance of a [Settings] interface implementation. + * @param operation The current operation. + */class AuthenticatorSelectorImpl( private val configurationProvider: ConfigurationProvider, - - /** - * The state repository that stores the state of the running operation. - */ private val stateRepository: OperationStateRepository, - - /** - * An instance of an [AuthenticatorValidator] interface implementation. - */ private val authenticatorValidator: AuthenticatorValidator, - - /** - * An instance of a [Settings] interface implementation. - */ private val settings: Settings, - - /** - * The current operation. - */ private val operation: AuthenticatorSelectorOperation ) : AuthenticatorSelector { + + //region AuthenticatorSelector + /** @suppress */ override fun selectAuthenticator( context: AuthenticatorSelectionContext, handler: AuthenticatorSelectionHandler @@ -118,4 +107,5 @@ class AuthenticatorSelectorImpl( SelectAuthenticatorResponse(authenticatorItems) ) } + //endregion } diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/BiometricUserVerifierImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/BiometricUserVerifierImpl.kt index b53ace6..0a95f98 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/BiometricUserVerifierImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/BiometricUserVerifierImpl.kt @@ -22,15 +22,16 @@ import kotlin.coroutines.resume * Default implementation of [BiometricUserVerifier] interface. It stores the biometric verification step context * into its state and resumes the cancellableContinuation found in state with [VerifyBiometricResponse] * indicating that the running operation waiting for a biometric verification. + * + * @constructor Creates a new instance. + * @param stateRepository The state repository that stores the state of the running operation. */ class BiometricUserVerifierImpl( - /** - * The state repository that stores the state of the running operation. - */ private val stateRepository: OperationStateRepository ) : BiometricUserVerifier { //region BiometricUserVerifier + /** @suppress */ override fun verifyBiometric( biometricUserVerificationContext: BiometricUserVerificationContext, biometricUserVerificationHandler: BiometricUserVerificationHandler @@ -51,9 +52,10 @@ class BiometricUserVerifierImpl( ) } + /** @suppress */ override fun onValidCredentialsProvided() { Timber.asTree() .sdk("Valid credentials provided during biometric verification.") } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/DevicePasscodeUserVerifierImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/DevicePasscodeUserVerifierImpl.kt index be35520..562fc4c 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/DevicePasscodeUserVerifierImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/DevicePasscodeUserVerifierImpl.kt @@ -22,15 +22,16 @@ import kotlin.coroutines.resume * Default implementation of [DevicePasscodeUserVerifier] interface. It stores the device passcode verification * step context into its state and resumes the cancellableContinuation found in state with [VerifyDevicePasscodeResponse] * indicating that the running operation waiting for a device passcode verification. + * + * @constructor Creates a new instance. + * @param stateRepository The state repository that stores the state of the running operation. */ class DevicePasscodeUserVerifierImpl( - /** - * The state repository that stores the state of the running operation. - */ private val stateRepository: OperationStateRepository ) : DevicePasscodeUserVerifier { //region DevicePasscodeUserVerifier + /** @suppress */ override fun verifyDevicePasscode( devicePasscodeUserVerificationContext: DevicePasscodeUserVerificationContext, devicePasscodeUserVerificationHandler: DevicePasscodeUserVerificationHandler @@ -51,9 +52,10 @@ class DevicePasscodeUserVerifierImpl( ) } + /** @suppress */ override fun onValidCredentialsProvided() { Timber.asTree() .sdk("Valid credentials provided during device passcode verification.") } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/FingerprintUserVerifierImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/FingerprintUserVerifierImpl.kt index 4e26047..8cee531 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/FingerprintUserVerifierImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/FingerprintUserVerifierImpl.kt @@ -22,15 +22,16 @@ import kotlin.coroutines.resume * Default implementation of [FingerprintUserVerifier] interface. It stores the fingerprint verification step context * into its state and resumes the cancellableContinuation found in state with [VerifyFingerprintResponse] * indicating that the running operation waiting for a fingerprint verification. + * + * @constructor Creates a new instance. + * @param stateRepository The state repository that stores the state of the running operation. */ class FingerprintUserVerifierImpl( - /** - * The state repository that stores the state of the running operation. - */ private val stateRepository: OperationStateRepository ) : FingerprintUserVerifier { //region FingerprintUserVerifier + /** @suppress */ override fun verifyFingerprint( fingerprintUserVerificationContext: FingerprintUserVerificationContext, fingerprintUserVerificationHandler: FingerprintUserVerificationHandler @@ -56,9 +57,10 @@ class FingerprintUserVerifierImpl( ) } + /** @suppress */ override fun onValidCredentialsProvided() { Timber.asTree() .sdk("Valid credentials provided during fingerprint verification.") } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/OnErrorImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/OnErrorImpl.kt index 79a5375..719722b 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/OnErrorImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/OnErrorImpl.kt @@ -23,20 +23,18 @@ import kotlin.coroutines.resume * This implementation first checks if there is an active cancellableContinuation in the operation * state and if yes it will be resumed with an [ErrorResponse] object. If the cancellableContinuation * is null or not active the accepted error will be delegated to the [ErrorHandlerChain] directly. + * + * @constructor Creates a new instance. + * @param stateRepository The state repository that stores the state of the running operation. + * @param errorHandlerChain An [ErrorHandlerChain] implementation. */ class OnErrorImpl( - /** - * The state repository that stores the state of the running operation. - */ private val stateRepository: OperationStateRepository, - - /** - * An [ErrorHandlerChain] implementation. - */ private val errorHandlerChain: ErrorHandlerChain ) : Consumer { //region Consumer + /** @suppress */ override fun accept(error: E) { val operationState = stateRepository.get() ?: throw BusinessException.invalidState() val operation = operationState.operation @@ -71,4 +69,4 @@ class OnErrorImpl( } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/OnSuccessAuthenticationImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/OnSuccessAuthenticationImpl.kt index 55f5068..ffc8b46 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/OnSuccessAuthenticationImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/OnSuccessAuthenticationImpl.kt @@ -19,25 +19,24 @@ import kotlin.coroutines.resume /** * An authentication specific implementation of [Consumer] interface that accepts an [AuthorizationProvider] - * instance after the successful authentication. It resumes the cancellableContinuation found in operation state - * with [AuthenticationCompletedResponse] indicating that the running authentication operation successfully completed. + * instance after the successful authentication. It resumes the cancellableContinuation found in operation + * state with [AuthenticationCompletedResponse] indicating that the running authentication operation + * successfully completed. + * + * @constructor Creates a new instance. + * @param stateRepository The state repository that stores the state of the running operation. + * @param forOperation An optional [Operation] value the authentication started for. In some cases an + * operation needs a pre-step authentication. In these cases an instance of this class can be initialized + * with the proper operation and this value will be set to the [AuthenticationCompletedResponse] object + * the cancellableContinuation of the operation state resumed with. */ class OnSuccessAuthenticationImpl( - /** - * The state repository that stores the state of the running operation. - */ private val stateRepository: OperationStateRepository, - - /** - * An optional [Operation] value the authentication started for. In some cases an operation needs - * a pre-step authentication. In these cases an instance of this class can be initialized with the - * proper operation and this value will be set to the [AuthenticationCompletedResponse] object the - * cancellableContinuation of the operation state resumed with. - */ private val forOperation: Operation? = null ) : Consumer { //region Consumer + /** @suppress */ override fun accept(authorizationProvider: AuthorizationProvider) { val operationState = stateRepository.get() ?: throw BusinessException.invalidState() diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/OnSuccessImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/OnSuccessImpl.kt index 74b2359..a54529d 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/OnSuccessImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/OnSuccessImpl.kt @@ -18,15 +18,16 @@ import kotlin.coroutines.resume /** * Generic implementation of [Runnable] interface. It resumes the cancellableContinuation of the current * operation state with a [CompletedResponse] object and cleans-up the operation state. + * + * @constructor Creates a new instance. + * @param stateRepository The state repository that stores the state of the running operation. */ class OnSuccessImpl( - /** - * The state repository that stores the state of the running operation. - */ private val stateRepository: OperationStateRepository ) : Runnable { //region Runnable + /** @suppress */ override fun run() { val operationState = stateRepository.get() ?: throw BusinessException.invalidState() @@ -48,4 +49,4 @@ class OnSuccessImpl( ) } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/pin/PinChangerImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/pin/PinChangerImpl.kt index a966d2b..01b5528 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/pin/PinChangerImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/pin/PinChangerImpl.kt @@ -21,15 +21,16 @@ import kotlin.coroutines.resume * Default implementation of [PinChanger] interface. It stores the PIN change step context * into its state and resumes the cancellableContinuation found in state with [ChangePinResponse] * indicating that the running operation waiting for a new PIN. + * + * @constructor Creates a new instance. + * @param stateRepository The state repository that stores the state of the running operation. */ class PinChangerImpl( - /** - * The state repository that stores the state of the running operation. - */ private val stateRepository: OperationStateRepository ) : PinChanger { //region PinChanger + /** @suppress */ override fun changePin( context: PinChangeContext, handler: PinChangeHandler diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/pin/PinEnrollerImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/pin/PinEnrollerImpl.kt index 3c266a9..0f70fab 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/pin/PinEnrollerImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/pin/PinEnrollerImpl.kt @@ -21,15 +21,16 @@ import kotlin.coroutines.resume * Default implementation of [PinEnroller] interface. It stores the PIN enrollment step context * into its state and resumes the cancellableContinuation found in state with [EnrollPinResponse] * indicating that the running operation waiting for a PIN enrollment/creation. + * + * @constructor Creates a new instance. + * @param stateRepository The state repository that stores the state of the running operation. */ class PinEnrollerImpl( - /** - * The state repository that stores the state of the running operation. - */ private val stateRepository: OperationStateRepository ) : PinEnroller { //region PinEnroller + /** @suppress */ override fun enrollPin( context: PinEnrollmentContext, handler: PinEnrollmentHandler @@ -54,6 +55,7 @@ class PinEnrollerImpl( ) } + /** @suppress */ override fun onValidCredentialsProvided() { Timber.asTree().sdk("Valid credentials provided during PIN enrollment.") } diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/pin/PinUserVerifierImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/pin/PinUserVerifierImpl.kt index 0c9b19a..357b26a 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/pin/PinUserVerifierImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/interaction/pin/PinUserVerifierImpl.kt @@ -21,6 +21,9 @@ import kotlin.coroutines.resume * Default implementation of [PinUserVerifier] interface. It stores the PIN verification step context * into its state and resumes the cancellableContinuation found in state with [VerifyPinResponse] * indicating that the running operation waiting for a PIN verification. + * + * @constructor Creates a new instance. + * @param stateRepository The state repository that stores the state of the running operation. */ class PinUserVerifierImpl( /** @@ -30,6 +33,7 @@ class PinUserVerifierImpl( ) : PinUserVerifier { //region PinUserVerifier + /** @suppress */ override fun verifyPin( context: PinUserVerificationContext, handler: PinUserVerificationHandler @@ -54,6 +58,7 @@ class PinUserVerifierImpl( ) } + /** @suppress */ override fun onValidCredentialsProvided() { Timber.asTree().sdk("Valid credentials provided during PIN verification.") } diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/log/LogItem.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/log/LogItem.kt index 10947d1..93b5bd2 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/log/LogItem.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/log/LogItem.kt @@ -10,6 +10,10 @@ import java.util.* /** * A data class that represents a log item. + * + * @constructor Creates a new instance. + * @param date Date/timestamp part of the log item. + * @param message Message part of the log item. */ data class LogItem( diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/log/SdkLogReceiver.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/log/SdkLogReceiver.kt index 7398d51..6c2e9f1 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/log/SdkLogReceiver.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/log/SdkLogReceiver.kt @@ -18,4 +18,4 @@ interface SdkLogReceiver { * @param logItem The recently logged item. */ fun newLogItem(logItem: LogItem) -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/log/SdkLogger.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/log/SdkLogger.kt index a309a07..9e27b6d 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/log/SdkLogger.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/log/SdkLogger.kt @@ -28,6 +28,8 @@ interface SdkLogger { /** * Logs a new message. + * + * @param message The message to be logged. */ fun log(message: String) -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/log/SdkLoggerImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/log/SdkLoggerImpl.kt index 8f707a4..360327c 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/log/SdkLoggerImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/log/SdkLoggerImpl.kt @@ -12,6 +12,8 @@ import kotlin.collections.ArrayList /** * Default implementation of [SdkLogger] interface. It simply stores the logged messages in an [ArrayList] object. + * + * @constructor Creates a new instance. */ class SdkLoggerImpl: SdkLogger { @@ -49,4 +51,4 @@ class SdkLoggerImpl: SdkLogger { } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/error/BusinessException.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/error/BusinessException.kt index e494f87..eaf0a37 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/error/BusinessException.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/error/BusinessException.kt @@ -12,31 +12,34 @@ import ch.nevis.exampleapp.coroutines.R * Enumeration of business exception types. */ enum class BusinessExceptionType( + /** + * The resource identifier used for the description. + */ val resId: Int ) { /** - * Registered accounts not found + * Registered accounts not found. */ ACCOUNTS_NOT_FOUND(R.string.business_error_type_accounts_not_found), /** - * Client not initialized + * Client not initialized. */ CLIENT_NOT_INITIALIZED(R.string.business_error_type_client_not_initialized), /** - * Device information not found + * Device information not found. */ DEVICE_INFORMATION_NOT_FOUND(R.string.business_error_type_device_information_not_found), /** - * Invalid state + * Invalid state. */ INVALID_STATE(R.string.business_error_type_invalid_state), /** - * Legacy login failed + * Legacy login failed. */ LOGIN_FAILED(R.string.business_error_type_login_failed) } @@ -50,6 +53,9 @@ class BusinessException private constructor( */ val type: BusinessExceptionType ) : Exception() { + /** + * Collection of available [BusinessException] types. + */ companion object { /** @@ -78,4 +84,4 @@ class BusinessException private constructor( */ fun loginFailed() = BusinessException(BusinessExceptionType.LOGIN_FAILED) } -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/error/MobileAuthenticationClientException.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/error/MobileAuthenticationClientException.kt index 66528ca..a857d8b 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/error/MobileAuthenticationClientException.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/error/MobileAuthenticationClientException.kt @@ -11,6 +11,10 @@ import ch.nevis.mobile.sdk.api.MobileAuthenticationClientError /** * A sub-class of [Exception] that hold a [MobileAuthenticationClientError] and an optional [Operation] value. + * + * @constructor Creates a new instance. + * @param operation The [Operation] the error relates to or null if it cannot be determined. + * @param error The [MobileAuthenticationClientError] object that represents the error. */ class MobileAuthenticationClientException( @@ -23,4 +27,4 @@ class MobileAuthenticationClientException( * The [MobileAuthenticationClientError] object that represents the error. */ val error: MobileAuthenticationClientError -) : Exception() \ No newline at end of file +) : Exception() diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/operation/Operation.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/operation/Operation.kt index c87cd40..8cc61be 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/operation/Operation.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/operation/Operation.kt @@ -12,66 +12,69 @@ import ch.nevis.exampleapp.coroutines.R * Enumeration of a available operations. */ enum class Operation( + /** + * The resource identifier used for the description. + */ val resId: Int ) { /** - * Client initialization + * Client initialization. */ INIT_CLIENT(R.string.operation_init_client), /** - * Registration + * Registration. */ REGISTRATION(R.string.operation_registration), /** - * Authentication + * Authentication. */ AUTHENTICATION(R.string.operation_authentication), /** - * Change device information + * Change device information. */ CHANGE_DEVICE_INFORMATION(R.string.operation_change_device_information), /** - * Change PIN + * Change PIN. */ CHANGE_PIN(R.string.operation_change_pin), /** - * Change Password + * Change Password. */ CHANGE_PASSWORD(R.string.operation_change_password), /** - * Out-of-band authentication + * Out-of-band authentication. */ OUT_OF_BAND_AUTHENTICATION(R.string.operation_authentication), /** - * Out-of-band registration + * Out-of-band registration. */ OUT_OF_BAND_REGISTRATION(R.string.operation_registration), /** - * De-registration + * De-registration. */ DEREGISTRATION(R.string.operation_deregistration), /** - * Decode out-of-band payload + * Decode out-of-band payload. */ DECODE_OUT_OF_BAND_PAYLOAD(R.string.operation_decode_oob_payload), /** - * Process out-of-band payload + * Process out-of-band payload. */ PROCESS_OUT_OF_BAND_PAYLOAD(R.string.operation_process_oob_payload), /** - * Local Data + * Local Data. */ LOCAL_DATA(R.string.operation_local_data) diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/AuthenticationCompletedResponse.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/AuthenticationCompletedResponse.kt index ca861c6..d7c3e35 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/AuthenticationCompletedResponse.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/AuthenticationCompletedResponse.kt @@ -11,6 +11,11 @@ import ch.nevis.mobile.sdk.api.authorization.AuthorizationProvider /** * A [Response] class that indicates the authentication operation was successfully completed. + * + * @constructor Creates a new instance. + * @param authorizationProvider The [AuthorizationProvider] object received after the successful authentication. + * @param username The username that identifies the account object that was used during the authentication. + * @param forOperation The [Operation] that needed this authentication and the [AuthorizationProvider] object. */ data class AuthenticationCompletedResponse( /** diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/CancelledResponse.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/CancelledResponse.kt index e7013c8..c62950d 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/CancelledResponse.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/CancelledResponse.kt @@ -10,6 +10,9 @@ import ch.nevis.exampleapp.coroutines.domain.model.operation.Operation /** * Response class indicates that the user cancelled the operation, the operation stopped. + * + * @constructor Creates a new instance. + * @param operation The [Operation] that was cancelled if it can be determined otherwise null. */ class CancelledResponse( /** diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/ChangePasswordResponse.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/ChangePasswordResponse.kt index 5ae5c21..64b2a71 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/ChangePasswordResponse.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/ChangePasswordResponse.kt @@ -13,6 +13,11 @@ import ch.nevis.mobile.sdk.api.operation.password.PasswordChangeRecoverableError * A [Response] class that indicates the running change password operation waiting for a new password. * To continue the operation after this response is received [ch.nevis.exampleapp.coroutines.domain.usecase.ChangePasswordUseCase] * has to be started with the old and new password entered by the user. + * + * @constructor Creates a new instance. + * @param passwordAuthenticatorProtectionStatus The current status of the Password authenticator. + * @param lastRecoverableError The last recoverable error. It exists only if there was already a failed + * password change attempt. */ data class ChangePasswordResponse( diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/ChangePinResponse.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/ChangePinResponse.kt index aa3618e..6e916b2 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/ChangePinResponse.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/ChangePinResponse.kt @@ -13,6 +13,11 @@ import ch.nevis.mobile.sdk.api.operation.pin.PinChangeRecoverableError * A [Response] class that indicates the running change PIN operation waiting for a new PIN. * To continue the operation after this response is received [ch.nevis.exampleapp.coroutines.domain.usecase.ChangePinUseCase] * has to be started with the old and new PIN entered by the user. + * + * @constructor Creates a new instance. + * @param pinAuthenticatorProtectionStatus The current status of the PIN authenticator. + * @param lastRecoverableError The last recoverable error. It exists only if there was already a failed + * PIN change attempt. */ data class ChangePinResponse( diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/CompletedResponse.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/CompletedResponse.kt index ce7d6bd..b57a5df 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/CompletedResponse.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/CompletedResponse.kt @@ -10,10 +10,13 @@ import ch.nevis.exampleapp.coroutines.domain.model.operation.Operation /** * Response class that indicates the previously started operation successfully completed. + * + * @constructor Creates a new instance. + * @param operation The [Operation] that was successfully completed. */ class CompletedResponse( /** * The [Operation] that was successfully completed. */ val operation: Operation -) : Response \ No newline at end of file +) : Response diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/DeviceInformationResponse.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/DeviceInformationResponse.kt index 83a9025..d4d7993 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/DeviceInformationResponse.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/DeviceInformationResponse.kt @@ -10,6 +10,9 @@ import ch.nevis.mobile.sdk.api.localdata.DeviceInformation /** * A [Response] class that holds the requested [DeviceInformation] object. + * + * @constructor Creates a new instance. + * @param deviceInformation The requested [DeviceInformation] object. */ data class DeviceInformationResponse( /** diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/EnrollPasswordResponse.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/EnrollPasswordResponse.kt index f8a3525..a220143 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/EnrollPasswordResponse.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/EnrollPasswordResponse.kt @@ -12,6 +12,10 @@ import ch.nevis.mobile.sdk.api.operation.password.PasswordEnrollmentError * A [Response] class that indicates the registration operation is waiting for password enrollment. * To continue the operation after this response is received [ch.nevis.exampleapp.coroutines.domain.usecase.SetPasswordUseCase] * has to be started with the new password entered by the user. + * + * @constructor Creates a new instance. + * @param lastRecoverableError The last recoverable error. It exists only if there was already a failed + * password enrollment attempt. */ class EnrollPasswordResponse( /** diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/EnrollPinResponse.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/EnrollPinResponse.kt index 5340ec9..49a3f8a 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/EnrollPinResponse.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/EnrollPinResponse.kt @@ -12,6 +12,10 @@ import ch.nevis.mobile.sdk.api.operation.pin.PinEnrollmentError * A [Response] class that indicates the registration operation is waiting for PIN enrollment. * To continue the operation after this response is received [ch.nevis.exampleapp.coroutines.domain.usecase.SetPinUseCase] * has to be started with the new PIN entered by the user. + * + * @constructor Creates a new instance. + * @param lastRecoverableError The last recoverable error. It exists only if there was already a failed + * PIN enrollment attempt. */ class EnrollPinResponse( /** diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/ErrorResponse.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/ErrorResponse.kt index e649db8..d9ede17 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/ErrorResponse.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/ErrorResponse.kt @@ -8,10 +8,13 @@ package ch.nevis.exampleapp.coroutines.domain.model.response /** * Response class that indicates the operation stopped with an error. + * + * @constructor Creates a new instance. + * @param cause The [Throwable] object the represents the error. */ class ErrorResponse( /** * The [Throwable] object the represents the error. */ val cause: Throwable -) : Response \ No newline at end of file +) : Response diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/GetAccountsResponse.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/GetAccountsResponse.kt index 2d548dc..40fd16e 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/GetAccountsResponse.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/GetAccountsResponse.kt @@ -10,6 +10,9 @@ import ch.nevis.mobile.sdk.api.localdata.Account /** * A [Response] class that holds the requested [Account] set. + * + * @constructor Creates a new instance. + * @param accounts The requested [Account] set. */ data class GetAccountsResponse( diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/GetAuthenticatorsResponse.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/GetAuthenticatorsResponse.kt index 28ff17d..0756cdd 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/GetAuthenticatorsResponse.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/GetAuthenticatorsResponse.kt @@ -10,6 +10,9 @@ import ch.nevis.mobile.sdk.api.localdata.Authenticator /** * A [Response] class that holds the requested [Authenticator] set. + * + * @constructor Creates a new instance. + * @param authenticators The requested [Authenticator] set. */ data class GetAuthenticatorsResponse( diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/InitializeClientCompletedResponse.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/InitializeClientCompletedResponse.kt index 3e45f88..f627b8b 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/InitializeClientCompletedResponse.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/InitializeClientCompletedResponse.kt @@ -9,5 +9,7 @@ package ch.nevis.exampleapp.coroutines.domain.model.response /** * A [Response] class that indicates the [ch.nevis.mobile.sdk.api.MobileAuthenticationClient] initialization * was successfully completed. + * + * @constructor Creates a new instance. */ class InitializeClientCompletedResponse : Response diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/LoginResponse.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/LoginResponse.kt index 16ca012..25600e7 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/LoginResponse.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/LoginResponse.kt @@ -10,6 +10,11 @@ import ch.nevis.mobile.sdk.api.authorization.Cookie /** * A [Response] class that represents the result of a successful legacy login. + * + * @constructor Creates a new instance. + * @param extId External identifier of the user. + * @param cookies List of [Cookie] for further authentication, e.g. for [ch.nevis.mobile.sdk.api.authorization.AuthorizationProvider.CookieAuthorizationProvider] + * creation. */ data class LoginResponse( diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/PayloadDecodeCompletedResponse.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/PayloadDecodeCompletedResponse.kt index b049bbf..97098f4 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/PayloadDecodeCompletedResponse.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/PayloadDecodeCompletedResponse.kt @@ -12,6 +12,9 @@ import ch.nevis.mobile.sdk.api.operation.outofband.OutOfBandPayload * A [Response] class that indicates decoding of out-of-band payload was successfully completed. * Typically when this response is received a [ch.nevis.exampleapp.coroutines.domain.usecase.ProcessOutOfBandPayloadUseCase] * is started with the received payload object. + * + * @constructor Creates a new instance. + * @param payload The decoded [OutOfBandPayload] object. */ class PayloadDecodeCompletedResponse( @@ -19,4 +22,4 @@ class PayloadDecodeCompletedResponse( * The decoded [OutOfBandPayload] object. */ val payload: OutOfBandPayload -) : Response \ No newline at end of file +) : Response diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/SelectAccountResponse.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/SelectAccountResponse.kt index c679ee6..23fa513 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/SelectAccountResponse.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/SelectAccountResponse.kt @@ -14,6 +14,12 @@ import ch.nevis.mobile.sdk.api.localdata.Account * Typically the received [Account] set is shown to the user and he/she selects one of them. * After the account selection [ch.nevis.exampleapp.coroutines.domain.usecase.SelectAccountUseCase] is called * to continue the operation. + * + * @constructor Creates a new instance. + * @param operation The [Operation] the account selection requested for. + * @param accounts The set of enrolled accounts the user has to choose from. + * @param transactionConfirmationData The optional transaction data that might be sent during an + * authentication process. */ class SelectAccountResponse( @@ -31,4 +37,4 @@ class SelectAccountResponse( * The optional transaction data that might be sent during an authentication process. */ val transactionConfirmationData: ByteArray? = null -) : Response \ No newline at end of file +) : Response diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/SelectAuthenticatorResponse.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/SelectAuthenticatorResponse.kt index 24257aa..ab168e2 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/SelectAuthenticatorResponse.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/SelectAuthenticatorResponse.kt @@ -14,6 +14,9 @@ import ch.nevis.mobile.sdk.api.localdata.Authenticator * Typically the received [Authenticator] set is shown to the user and he/she selects one of them. * After the authenticator selection [ch.nevis.exampleapp.coroutines.domain.usecase.SelectAuthenticatorUseCase] is called * to continue the operation. + * + * @constructor Creates a new instance. + * @param authenticatorItems The set of available authenticators the user has to choose from. */ class SelectAuthenticatorResponse( /** diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/VerifyBiometricResponse.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/VerifyBiometricResponse.kt index ffc88d7..e840727 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/VerifyBiometricResponse.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/VerifyBiometricResponse.kt @@ -11,7 +11,11 @@ import androidx.annotation.StringRes /** * Response class that indicates the SDK operation asks the user to verify herself/himself using biometric * (face/fingerprint) authentication. - * Typically when this response is received a [ch.nevis.exampleapp.coroutines.domain.usecase.VerifyBiometricUseCase] is started. + * Typically when this response is received a [ch.nevis.exampleapp.coroutines.domain.usecase.VerifyBiometricUseCase] + * is started. + * + * @constructor Creates a new instance. + * @param authenticatorTitleResId String resource identifier of the title of the authenticator. */ class VerifyBiometricResponse( /** @@ -19,4 +23,4 @@ class VerifyBiometricResponse( */ @StringRes val authenticatorTitleResId: Int -) : Response \ No newline at end of file +) : Response diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/VerifyDevicePasscodeResponse.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/VerifyDevicePasscodeResponse.kt index b4e17f1..7f8d71b 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/VerifyDevicePasscodeResponse.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/VerifyDevicePasscodeResponse.kt @@ -12,6 +12,9 @@ import androidx.annotation.StringRes * Response class that indicates the SDK operation asks the user to verify herself/himself using device * passcode authentication. Typically when this response is received a * [ch.nevis.exampleapp.coroutines.domain.usecase.VerifyDevicePasscodeUseCase] is started. + * + * @constructor Creates a new instance. + * @param authenticatorTitleResId String resource identifier of the title of the authenticator. */ class VerifyDevicePasscodeResponse( /** @@ -19,4 +22,4 @@ class VerifyDevicePasscodeResponse( */ @StringRes val authenticatorTitleResId: Int -) : Response \ No newline at end of file +) : Response diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/VerifyFingerprintResponse.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/VerifyFingerprintResponse.kt index a7e5ef6..718cf0e 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/VerifyFingerprintResponse.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/VerifyFingerprintResponse.kt @@ -10,8 +10,14 @@ import androidx.annotation.StringRes import ch.nevis.mobile.sdk.api.operation.userverification.FingerprintUserVerificationError /** - * Response class that indicates the SDK operation asks the user to verify herself/himself using fingerprint authentication. - * Typically when this response is received a [ch.nevis.exampleapp.coroutines.domain.usecase.VerifyFingerprintUseCase] is started. + * Response class that indicates the SDK operation asks the user to verify herself/himself using fingerprint + * authentication. Typically when this response is received a [ch.nevis.exampleapp.coroutines.domain.usecase.VerifyFingerprintUseCase] + * is started. + * + * @constructor Creates a new instance. + * @param authenticatorTitleResId String resource identifier of the title of the authenticator. + * @param lastRecoverableError The last recoverable error. It exists only if there was already a failed + * fingerprint verification attempt. */ class VerifyFingerprintResponse( /** @@ -24,4 +30,4 @@ class VerifyFingerprintResponse( * The last recoverable error. It exists only if there was already a failed fingerprint verification attempt. */ val lastRecoverableError: FingerprintUserVerificationError? -) : Response \ No newline at end of file +) : Response diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/VerifyPasswordResponse.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/VerifyPasswordResponse.kt index 92954e2..1903401 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/VerifyPasswordResponse.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/VerifyPasswordResponse.kt @@ -10,8 +10,14 @@ import ch.nevis.mobile.sdk.api.operation.password.PasswordAuthenticatorProtectio import ch.nevis.mobile.sdk.api.operation.userverification.PasswordUserVerificationError /** - * Response class that indicates the SDK operation asks the user to verify herself/himself using Password authentication. - * Typically when this response is received a [ch.nevis.exampleapp.coroutines.domain.usecase.VerifyPasswordUseCase] is started. + * Response class that indicates the SDK operation asks the user to verify herself/himself using Password + * authentication. Typically when this response is received a [ch.nevis.exampleapp.coroutines.domain.usecase.VerifyPasswordUseCase] + * is started. + * + * @constructor Creates a new instance. + * @param lastRecoverableError The last recoverable error. It exists only if there was already a failed + * password verification attempt. + * @param passwordAuthenticatorProtectionStatus Status object of the Password authenticator. */ class VerifyPasswordResponse( /** diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/VerifyPinResponse.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/VerifyPinResponse.kt index 66ca97c..6b1680c 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/VerifyPinResponse.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/response/VerifyPinResponse.kt @@ -10,8 +10,14 @@ import ch.nevis.mobile.sdk.api.operation.pin.PinAuthenticatorProtectionStatus import ch.nevis.mobile.sdk.api.operation.userverification.PinUserVerificationError /** - * Response class that indicates the SDK operation asks the user to verify herself/himself using PIN authentication. - * Typically when this response is received a [ch.nevis.exampleapp.coroutines.domain.usecase.VerifyPinUseCase] is started. + * Response class that indicates the SDK operation asks the user to verify herself/himself using PIN + * authentication. Typically when this response is received a [ch.nevis.exampleapp.coroutines.domain.usecase.VerifyPinUseCase] + * is started. + * + * @constructor Creates a new instance. + * @param lastRecoverableError The last recoverable error. It exists only if there was already a failed + * PIN verification attempt. + * @param pinAuthenticatorProtectionStatus Status object of the PIN authenticator. */ class VerifyPinResponse( /** diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/state/ChangePasswordOperationState.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/state/ChangePasswordOperationState.kt index 2d99bda..78881eb 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/state/ChangePasswordOperationState.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/state/ChangePasswordOperationState.kt @@ -13,12 +13,12 @@ import kotlinx.coroutines.CancellableContinuation /** * [OperationState] implementation for change Password operation. + * + * @constructor Creates a new instance. + * @param cancellableContinuation A [CancellableContinuation] instance of a `suspendCancellableCoroutine` + * Kotlin coroutine block. */ data class ChangePasswordOperationState( - /** - * A [CancellableContinuation] instance of a `suspendCancellableCoroutine` Kotlin coroutine block. - * The [CancellableContinuation] will be resumed when the SDK finished an operation step. - */ override var cancellableContinuation: CancellableContinuation? = null ) : OperationState() { diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/state/ChangePinOperationState.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/state/ChangePinOperationState.kt index 7d27dc0..79a7fd3 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/state/ChangePinOperationState.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/state/ChangePinOperationState.kt @@ -13,12 +13,13 @@ import kotlinx.coroutines.CancellableContinuation /** * [OperationState] implementation for change PIN operation. + * + * @constructor Creates a new instance. + * @param cancellableContinuation A [CancellableContinuation] instance of a `suspendCancellableCoroutine` + * Kotlin coroutine block. The [CancellableContinuation] will be resumed when the SDK finished an + * operation step. */ data class ChangePinOperationState( - /** - * A [CancellableContinuation] instance of a `suspendCancellableCoroutine` Kotlin coroutine block. - * The [CancellableContinuation] will be resumed when the SDK finished an operation step. - */ override var cancellableContinuation: CancellableContinuation? = null ) : OperationState() { @@ -40,4 +41,4 @@ data class ChangePinOperationState( cancellableContinuation = null } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/state/OperationState.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/state/OperationState.kt index d74438c..e840c76 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/state/OperationState.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/state/OperationState.kt @@ -12,6 +12,8 @@ import kotlinx.coroutines.CancellableContinuation /** * Abstract class that represents a base operation state. + * + * @constructor Creates a new instance. */ abstract class OperationState { @@ -30,4 +32,4 @@ abstract class OperationState { * Resets the operation state. */ abstract fun reset() -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/state/UserInteractionOperationState.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/state/UserInteractionOperationState.kt index d649a0a..d90aa8f 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/state/UserInteractionOperationState.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/model/state/UserInteractionOperationState.kt @@ -22,12 +22,34 @@ import kotlinx.coroutines.CancellableContinuation /** * [OperationState] implementation for registration and authentication operations. + * + * @constructor Creates a new instance. + * @param operation The [Operation] the state relates to. + * @param username The username that is identifies the account used during the authentication if it + * can be determined, otherwise null. + * @param accountSelectionHandler [AccountSelectionHandler] object received during an out-of-band + * authentication operation. + * @param authenticatorSelectionHandler [AuthenticatorSelectionHandler] object received during an + * authentication or a registration operation. + * @param pinEnrollmentHandler [PinEnrollmentHandler] object received during a registration operation. + * @param passwordEnrollmentHandler [PasswordEnrollmentHandler] object received during a registration + * operation. + * @param pinUserVerificationHandler [PinUserVerificationHandler] object received during an authentication + * operation. + * @param passwordUserVerificationHandler [PasswordUserVerificationHandler] object received during an + * authentication operation. + * @param fingerprintUserVerificationHandler [FingerprintUserVerificationHandler] object received during + * an authentication or a registration operation. + * @param biometricUserVerificationHandler [BiometricUserVerificationHandler] object received during + * an authentication or a registration operation. + * @param devicePasscodeUserVerificationHandler [DevicePasscodeUserVerificationHandler] object received + * during an authentication or a registration operation. + * @param osAuthenticationListenHandler [OsAuthenticationListenHandler] object received during an authentication + * or a registration operation. + * @param cancellableContinuation A [CancellableContinuation] instance of a `suspendCancellableCoroutine` + * Kotlin coroutine block. */ data class UserInteractionOperationState( - - /** - * Overridden operation property. - */ override val operation: Operation, /** @@ -42,7 +64,7 @@ data class UserInteractionOperationState( var accountSelectionHandler: AccountSelectionHandler? = null, /** - * [AccountSelectionHandler] object received during an authentication or a registration operation. + * [AuthenticatorSelectionHandler] object received during an authentication or a registration operation. */ var authenticatorSelectionHandler: AuthenticatorSelectionHandler? = null, @@ -86,10 +108,6 @@ data class UserInteractionOperationState( */ var osAuthenticationListenHandler: OsAuthenticationListenHandler? = null, - /** - * A [CancellableContinuation] instance of a `suspendCancellableCoroutine` Kotlin coroutine block. - * The [CancellableContinuation] will be resumed when the SDK finished an operation step. - */ override var cancellableContinuation: CancellableContinuation? = null ) : OperationState() { override fun reset() { diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/repository/LoginRepository.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/repository/LoginRepository.kt index 90a2b66..7e1745b 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/repository/LoginRepository.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/repository/LoginRepository.kt @@ -26,4 +26,4 @@ interface LoginRepository { * @throws BusinessException If the provided username/password pair is not valid. */ suspend fun execute(passwordAuthentication: PasswordAuthentication): LoginResponse -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/repository/OperationStateRepository.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/repository/OperationStateRepository.kt index d219b1e..afaa1c7 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/repository/OperationStateRepository.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/repository/OperationStateRepository.kt @@ -32,4 +32,3 @@ interface OperationStateRepository { */ fun reset() } - diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/AuthCloudApiRegistrationUseCase.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/AuthCloudApiRegistrationUseCase.kt index 0554346..e01c2c9 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/AuthCloudApiRegistrationUseCase.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/AuthCloudApiRegistrationUseCase.kt @@ -21,4 +21,4 @@ interface AuthCloudApiRegistrationUseCase { * @return A [Response] object that indicates the result of the use-case execution. */ suspend fun execute(enrollResponse: String?, appLinkUri: String?): Response -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/AuthCloudApiRegistrationUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/AuthCloudApiRegistrationUseCaseImpl.kt index 84f92c9..4bd4d54 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/AuthCloudApiRegistrationUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/AuthCloudApiRegistrationUseCaseImpl.kt @@ -25,61 +25,33 @@ import kotlinx.coroutines.suspendCancellableCoroutine /** * Default implementation of [AuthCloudApiRegistrationUseCase] interface. + * + * @constructor Creates a new instance. + * @param clientProvider An instance of [ClientProvider] interface implementation. + * @param stateRepository An instance of a [OperationStateRepository] implementation that may hold + * an [UserInteractionOperationState]. + * @param createDeviceInformationUseCase An instance of [CreateDeviceInformationUseCase] interface implementation. + * @param authenticatorSelector An instance of [AuthenticatorSelector] interface implementation + * for Registration operation. + * @param pinEnroller An instance of [PinEnroller] interface implementation. + * @param passwordEnroller An instance of [PasswordEnroller] interface implementation. + * @param fingerprintUserVerifier An instance of [FingerprintUserVerifier] interface implementation. + * @param biometricUserVerifier An instance of [BiometricUserVerifier] interface implementation. + * @param devicePasscodeUserVerifier An instance of [DevicePasscodeUserVerifier] interface implementation. + * @param onSuccess An instance of a [Runnable] implementation. + * @param onError A [Consumer] for failed Auth Cloud API registration. */ class AuthCloudApiRegistrationUseCaseImpl( - /** - * An instance of a [ClientProvider] implementation. - */ private val clientProvider: ClientProvider, - - /** - * An instance of a [OperationStateRepository] implementation that may hold an [UserInteractionOperationState]. - */ private val stateRepository: OperationStateRepository, - - /** - * An instance of a [CreateDeviceInformationUseCase] implementation. - */ private val createDeviceInformationUseCase: CreateDeviceInformationUseCase, - - /** - * An instance of an [AuthenticatorSelector] implementation. - */ private val authenticatorSelector: AuthenticatorSelector, - - /** - * An instance of a [PinEnroller] implementation. - */ private val pinEnroller: PinEnroller, - - /** - * An instance of a [PasswordEnroller] implementation. - */ private val passwordEnroller: PasswordEnroller, - - /** - * An instance of a [FingerprintUserVerifier] implementation. - */ private val fingerprintUserVerifier: FingerprintUserVerifier, - - /** - * An instance of a [BiometricUserVerifier] implementation. - */ private val biometricUserVerifier: BiometricUserVerifier, - - /** - * An instance of a [DevicePasscodeUserVerifier] implementation. - */ private val devicePasscodeUserVerifier: DevicePasscodeUserVerifier, - - /** - * An instance of a [Runnable] implementation. - */ private val onSuccess: Runnable, - - /** - * An instance of a [Consumer] implementation that accepts a [AuthCloudApiError] object. - */ private val onError: Consumer ) : AuthCloudApiRegistrationUseCase { diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/CancelOperationUseCase.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/CancelOperationUseCase.kt index 0a1eb49..f9973e4 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/CancelOperationUseCase.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/CancelOperationUseCase.kt @@ -19,4 +19,4 @@ interface CancelOperationUseCase { * @return A [Response] object that indicates the result of the use-case execution. */ suspend fun execute(): Response -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/CancelOperationUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/CancelOperationUseCaseImpl.kt index 8eb7a14..c852bbb 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/CancelOperationUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/CancelOperationUseCaseImpl.kt @@ -8,6 +8,7 @@ package ch.nevis.exampleapp.coroutines.domain.usecase import ch.nevis.exampleapp.coroutines.domain.model.response.CancelledResponse import ch.nevis.exampleapp.coroutines.domain.model.response.Response +import ch.nevis.exampleapp.coroutines.domain.model.state.ChangePasswordOperationState import ch.nevis.exampleapp.coroutines.domain.model.state.ChangePinOperationState import ch.nevis.exampleapp.coroutines.domain.model.state.UserInteractionOperationState import ch.nevis.exampleapp.coroutines.domain.repository.OperationStateRepository @@ -17,17 +18,19 @@ import kotlin.coroutines.resume /** * Default implementation of [CancelOperationUseCase] interface that discovers all known * [OperationStateRepository] and tries to find cancel the running operation. + * + * @constructor Creates a new instance. + * @param userInteractionOperationStateRepository An instance of an [OperationStateRepository] + * implementation that may hold an [UserInteractionOperationState]. + * @param changePinOperationStateRepository An instance of an [OperationStateRepository] + * implementation that may hold an [ChangePinOperationState]. + * @param changePasswordOperationStateRepository An instance of an [OperationStateRepository] + * implementation that may hold an [ChangePasswordOperationState]. */ class CancelOperationUseCaseImpl( - /** - * An instance of an [OperationStateRepository] implementation that may hold an [UserInteractionOperationState]. - */ private val userInteractionOperationStateRepository: OperationStateRepository, - - /** - * An instance of an [OperationStateRepository] implementation that may hold an [ChangePinOperationState]. - */ - private val changePinOperationStateRepository: OperationStateRepository + private val changePinOperationStateRepository: OperationStateRepository, + private val changePasswordOperationStateRepository: OperationStateRepository ) : CancelOperationUseCase { //region CancelOperationUseCase @@ -40,6 +43,12 @@ class CancelOperationUseCaseImpl( cancelled = true } + changePasswordOperationStateRepository.get()?.let { + it.cancellableContinuation = cancellableContinuation + it.passwordChangeHandler?.cancel() + cancelled = true + } + userInteractionOperationStateRepository.get()?.let { it.cancellableContinuation = cancellableContinuation it.accountSelectionHandler?.cancel() diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ChangeDeviceInformationUseCase.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ChangeDeviceInformationUseCase.kt index 501d039..4b1387c 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ChangeDeviceInformationUseCase.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ChangeDeviceInformationUseCase.kt @@ -26,4 +26,4 @@ interface ChangeDeviceInformationUseCase { fcmRegistrationToken: String? = null, disablePushNotifications: Boolean = false ): Response -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ChangeDeviceInformationUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ChangeDeviceInformationUseCaseImpl.kt index 50f638c..9d680d7 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ChangeDeviceInformationUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ChangeDeviceInformationUseCaseImpl.kt @@ -18,11 +18,11 @@ import kotlin.coroutines.resume /** * Default implementation of [ChangeDeviceInformationUseCase] interface. + * + * @constructor Creates a new instance. + * @param clientProvider An instance of a [ClientProvider] implementation. */ class ChangeDeviceInformationUseCaseImpl( - /** - * An instance of a [ClientProvider] implementation. - */ private val clientProvider: ClientProvider ) : ChangeDeviceInformationUseCase { @@ -64,4 +64,4 @@ class ChangeDeviceInformationUseCaseImpl( } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ChangePasswordUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ChangePasswordUseCaseImpl.kt index 361c015..b048498 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ChangePasswordUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ChangePasswordUseCaseImpl.kt @@ -14,11 +14,12 @@ import kotlinx.coroutines.suspendCancellableCoroutine /** * Default implementation of [ChangePasswordUseCase] interface. + * + * @constructor Creates a new instance. + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [ChangePasswordOperationState]. */ class ChangePasswordUseCaseImpl( - /** - * An instance of an [OperationStateRepository] implementation that may hold an [ChangePasswordOperationState]. - */ private val stateRepository: OperationStateRepository ) : ChangePasswordUseCase { diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ChangePinUseCase.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ChangePinUseCase.kt index d142233..a8c2e65 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ChangePinUseCase.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ChangePinUseCase.kt @@ -9,8 +9,8 @@ package ch.nevis.exampleapp.coroutines.domain.usecase import ch.nevis.exampleapp.coroutines.domain.model.response.Response /** - * Use-case interface for completing change PIN operation. It assumes that a change PIN operation is already - * started with [StartChangePinUseCase]. + * Use-case interface for completing change PIN operation. It assumes that a change PIN operation is + * already started with [StartChangePinUseCase]. */ interface ChangePinUseCase { @@ -22,4 +22,4 @@ interface ChangePinUseCase { * @return A [Response] object that indicates the result of the use-case execution. */ suspend fun execute(oldPin: CharArray, newPin: CharArray): Response -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ChangePinUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ChangePinUseCaseImpl.kt index f5f2339..9463abf 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ChangePinUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ChangePinUseCaseImpl.kt @@ -14,11 +14,12 @@ import kotlinx.coroutines.suspendCancellableCoroutine /** * Default implementation of [ChangePinUseCase] interface. + * + * @constructor Creates a new instance. + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [ChangePinOperationState]. */ class ChangePinUseCaseImpl( - /** - * An instance of an [OperationStateRepository] implementation that may hold an [ChangePinOperationState]. - */ private val stateRepository: OperationStateRepository ) : ChangePinUseCase { diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/CreateDeviceInformationUseCase.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/CreateDeviceInformationUseCase.kt index 823951a..1673101 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/CreateDeviceInformationUseCase.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/CreateDeviceInformationUseCase.kt @@ -19,4 +19,4 @@ interface CreateDeviceInformationUseCase { * @return A [Response] object that indicates the result of the use-case execution. */ suspend fun execute(): Response -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/CreateDeviceInformationUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/CreateDeviceInformationUseCaseImpl.kt index 3bdcd13..50e9ad5 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/CreateDeviceInformationUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/CreateDeviceInformationUseCaseImpl.kt @@ -19,11 +19,11 @@ import java.util.* * Default implementation of [CreateDeviceInformationUseCase] interface. * It creates a new [DeviceInformation] using Android [Context] and returns it in a * [DeviceInformationResponse]. + * + * @constructor Creates a new instance. + * @param context The Android [Context]. */ class CreateDeviceInformationUseCaseImpl( - /** - * The Android [Context]. - */ private val context: Context ) : CreateDeviceInformationUseCase { @@ -65,4 +65,4 @@ class CreateDeviceInformationUseCaseImpl( } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/DecodePayloadUseCase.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/DecodePayloadUseCase.kt index c003be2..09086e4 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/DecodePayloadUseCase.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/DecodePayloadUseCase.kt @@ -25,4 +25,4 @@ interface DecodePayloadUseCase { * @return A [Response] object that indicates the result of the use-case execution. */ suspend fun execute(json: String?, base64UrlEncoded: String?): Response -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/DecodePayloadUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/DecodePayloadUseCaseImpl.kt index 3d5fa69..6abd0d8 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/DecodePayloadUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/DecodePayloadUseCaseImpl.kt @@ -18,11 +18,11 @@ import kotlin.coroutines.resume /** * Default implementation of [DecodePayloadUseCase] interface. + * + * @constructor Creates a new instance. + * @param clientProvider An instance of a [ClientProvider] implementation. */ class DecodePayloadUseCaseImpl( - /** - * An instance of a [ClientProvider] implementation. - */ private val clientProvider: ClientProvider ) : DecodePayloadUseCase { @@ -56,4 +56,4 @@ class DecodePayloadUseCaseImpl( } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/DeleteAuthenticatorsUseCase.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/DeleteAuthenticatorsUseCase.kt index 4eba12a..594434a 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/DeleteAuthenticatorsUseCase.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/DeleteAuthenticatorsUseCase.kt @@ -23,4 +23,4 @@ interface DeleteAuthenticatorsUseCase { suspend fun execute( accounts: Set ): Response -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/DeleteAuthenticatorsUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/DeleteAuthenticatorsUseCaseImpl.kt index 09a86c1..1d660f3 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/DeleteAuthenticatorsUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/DeleteAuthenticatorsUseCaseImpl.kt @@ -15,12 +15,16 @@ import ch.nevis.mobile.sdk.api.localdata.Account import kotlinx.coroutines.suspendCancellableCoroutine import kotlin.coroutines.resume +/** + * Default implementation of [DeleteAuthenticatorsUseCase] interface. + * + * @constructor Creates a new instance. + * @param clientProvider An instance of a [ClientProvider] implementation. + */ class DeleteAuthenticatorsUseCaseImpl( - /** - * An instance of a [ClientProvider] implementation. - */ private val clientProvider: ClientProvider ) : DeleteAuthenticatorsUseCase { + //region DeleteAuthenticatorsUseCase override suspend fun execute(accounts: Set): Response { for (account in accounts) { @@ -45,4 +49,4 @@ class DeleteAuthenticatorsUseCaseImpl( } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/DeregisterUseCase.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/DeregisterUseCase.kt index 87177f2..8d032e8 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/DeregisterUseCase.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/DeregisterUseCase.kt @@ -25,4 +25,4 @@ interface DeregisterUseCase { username: String? = null, authorizationProvider: AuthorizationProvider? = null ): Response -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/DeregisterUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/DeregisterUseCaseImpl.kt index 5313b6c..d65c5ab 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/DeregisterUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/DeregisterUseCaseImpl.kt @@ -19,11 +19,11 @@ import kotlin.coroutines.resume /** * Default implementation of [DeregisterUseCase] interface. + * + * @constructor Creates a new instance. + * @param clientProvider An instance of a [ClientProvider] implementation. */ class DeregisterUseCaseImpl( - /** - * An instance of a [ClientProvider] implementation. - */ private val clientProvider: ClientProvider ) : DeregisterUseCase { @@ -90,4 +90,4 @@ class DeregisterUseCaseImpl( } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/FinishOperationUseCase.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/FinishOperationUseCase.kt index 8137298..a9e5bff 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/FinishOperationUseCase.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/FinishOperationUseCase.kt @@ -18,4 +18,4 @@ interface FinishOperationUseCase { * Executes the use-case. */ suspend fun execute() -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/FinishOperationUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/FinishOperationUseCaseImpl.kt index 611869c..745825f 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/FinishOperationUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/FinishOperationUseCaseImpl.kt @@ -6,6 +6,7 @@ package ch.nevis.exampleapp.coroutines.domain.usecase +import ch.nevis.exampleapp.coroutines.domain.model.state.ChangePasswordOperationState import ch.nevis.exampleapp.coroutines.domain.model.state.ChangePinOperationState import ch.nevis.exampleapp.coroutines.domain.model.state.UserInteractionOperationState import ch.nevis.exampleapp.coroutines.domain.repository.OperationStateRepository @@ -13,30 +14,31 @@ import ch.nevis.exampleapp.coroutines.domain.repository.OperationStateRepository /** * Default implementation of [FinishOperationUseCase] interface that clears all [OperationStateRepository] * instances that used by the application. + * + * @constructor Creates a new instance. + * @param userInteractionOperationStateRepository An instance of an [OperationStateRepository] + * implementation that may hold an [UserInteractionOperationState]. + * @param changePinOperationStateRepository An instance of an [OperationStateRepository] implementation + * that may hold an [ChangePinOperationState]. + * @param changePasswordOperationStateRepository An instance of an [OperationStateRepository] + * implementation that may hold an [ChangePasswordOperationState]. */ class FinishOperationUseCaseImpl( - /** - * An instance of an [OperationStateRepository] implementation that may hold an [UserInteractionOperationState]. - */ private val userInteractionOperationStateRepository: OperationStateRepository, - - /** - * An instance of an [OperationStateRepository] implementation that may hold an [ChangePinOperationState]. - */ - private val changePinOperationStateRepository: OperationStateRepository + private val changePinOperationStateRepository: OperationStateRepository, + private val changePasswordOperationStateRepository: OperationStateRepository ) : FinishOperationUseCase { //region FinishOperationUseCase override suspend fun execute() { - userInteractionOperationStateRepository.get()?.let { - it.reset() - } + userInteractionOperationStateRepository.get()?.reset() userInteractionOperationStateRepository.reset() - changePinOperationStateRepository.get()?.let { - it.reset() - } + changePinOperationStateRepository.get()?.reset() changePinOperationStateRepository.reset() + + changePasswordOperationStateRepository.get()?.reset() + changePasswordOperationStateRepository.reset() } //endregion } diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetAccountsUseCase.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetAccountsUseCase.kt index 9e90274..15343a6 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetAccountsUseCase.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetAccountsUseCase.kt @@ -19,4 +19,4 @@ interface GetAccountsUseCase { * @return A [Response] object that indicates the result of the use-case execution. */ suspend fun execute(): Response -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetAccountsUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetAccountsUseCaseImpl.kt index 7e83a8f..dc3e97a 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetAccountsUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetAccountsUseCaseImpl.kt @@ -15,11 +15,11 @@ import ch.nevis.exampleapp.coroutines.domain.model.response.Response /** * Default implementation of [GetAccountsUseCase] interface that queries the registered accounts from * the client and returns them in a [GetAccountsResponse]. + * + * @constructor Creates a new instance. + * @param clientProvider An instance of [ClientProvider] interface implementation. */ class GetAccountsUseCaseImpl( - /** - * An instance of a [ClientProvider] implementation. - */ private val clientProvider: ClientProvider ) : GetAccountsUseCase { @@ -33,4 +33,4 @@ class GetAccountsUseCaseImpl( } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetAuthenticatorsUseCase.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetAuthenticatorsUseCase.kt index 0d0ea70..4b20ab8 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetAuthenticatorsUseCase.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetAuthenticatorsUseCase.kt @@ -19,4 +19,4 @@ interface GetAuthenticatorsUseCase { * @return A [Response] object that indicates the result of the use-case execution. */ suspend fun execute(): Response -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetAuthenticatorsUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetAuthenticatorsUseCaseImpl.kt index f541e66..5058b8d 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetAuthenticatorsUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetAuthenticatorsUseCaseImpl.kt @@ -15,11 +15,11 @@ import ch.nevis.exampleapp.coroutines.domain.model.response.Response /** * Default implementation of [GetAuthenticatorsUseCase] interface that queries the authenticators from * the client and returns them in a [GetAuthenticatorsResponse]. + * + * @constructor Creates a new instance. + * @param clientProvider An instance of [ClientProvider] interface implementation. */ class GetAuthenticatorsUseCaseImpl( - /** - * An instance of a [ClientProvider] implementation. - */ private val clientProvider: ClientProvider ) : GetAuthenticatorsUseCase { @@ -33,4 +33,4 @@ class GetAuthenticatorsUseCaseImpl( } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetDeviceInformationUseCase.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetDeviceInformationUseCase.kt index 5d540b5..73bc3d5 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetDeviceInformationUseCase.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetDeviceInformationUseCase.kt @@ -19,4 +19,4 @@ interface GetDeviceInformationUseCase { * @return A [Response] object that indicates the result of the use-case execution. */ suspend fun execute(): Response -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetDeviceInformationUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetDeviceInformationUseCaseImpl.kt index 2680582..a88135e 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetDeviceInformationUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/GetDeviceInformationUseCaseImpl.kt @@ -17,11 +17,11 @@ import ch.nevis.exampleapp.coroutines.domain.model.response.Response * [ch.nevis.mobile.sdk.api.localdata.DeviceInformation] from the client and returns it as a * [DeviceInformationResponse]. If there isn't any stored device information in the client an * [ErrorResponse] will be returned. + * + * @constructor Creates a new instance. + * @param clientProvider An instance of [ClientProvider] interface implementation. */ class GetDeviceInformationUseCaseImpl( - /** - * An instance of a [ClientProvider] implementation. - */ private val clientProvider: ClientProvider ) : GetDeviceInformationUseCase { @@ -46,4 +46,4 @@ class GetDeviceInformationUseCaseImpl( } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/InBandAuthenticationUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/InBandAuthenticationUseCaseImpl.kt index ad6453d..46b3f3f 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/InBandAuthenticationUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/InBandAuthenticationUseCaseImpl.kt @@ -25,57 +25,31 @@ import kotlinx.coroutines.suspendCancellableCoroutine /** * Default implementation of [InBandAuthenticationUseCase] interface. + * + * @constructor Creates a new instance. + * @param clientProvider An instance of [ClientProvider] interface implementation. + * @param stateRepository n instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @param authenticatorSelector An instance of [AuthenticatorSelector] interface implementation. + * @param pinUserVerifier An instance of [PinUserVerifier] interface implementation. + * @param passwordUserVerifier An instance of [PasswordUserVerifier] interface implementation. + * @param fingerprintUserVerifier An instance of [FingerprintUserVerifier] interface implementation. + * @param biometricUserVerifier An instance of [BiometricUserVerifier] interface implementation. + * @param devicePasscodeUserVerifier An instance of [DevicePasscodeUserVerifier] interface implementation. + * @param onSuccess An instance of a [Consumer] implementation that accepts a [AuthorizationProvider] + * object on successful authentication. + * @param onError An instance of a [Consumer] implementation that accepts an [AuthenticationError] object. */ class InBandAuthenticationUseCaseImpl( - /** - * An instance of a [ClientProvider] implementation. - */ private val clientProvider: ClientProvider, - - /** - * An instance of an [OperationStateRepository] implementation that may hold an [UserInteractionOperationState]. - */ private val stateRepository: OperationStateRepository, - - /** - * An instance of an [AuthenticatorSelector] implementation. - */ private val authenticatorSelector: AuthenticatorSelector, - - /** - * An instance of a [PinUserVerifier] implementation. - */ private val pinUserVerifier: PinUserVerifier, - - /** - * An instance of a [PasswordUserVerifier] implementation. - */ private val passwordUserVerifier: PasswordUserVerifier, - - /** - * An instance of a [FingerprintUserVerifier] implementation. - */ private val fingerprintUserVerifier: FingerprintUserVerifier, - - /** - * An instance of a [BiometricUserVerifier] implementation. - */ private val biometricUserVerifier: BiometricUserVerifier, - - /** - * An instance of a [DevicePasscodeUserVerifier] implementation. - */ private val devicePasscodeUserVerifier: DevicePasscodeUserVerifier, - - /** - * An instance of a [Consumer] implementation that accepts a [AuthorizationProvider] object on - * successful authentication. - */ private val onSuccess: Consumer, - - /** - * An instance of a [Consumer] implementation that accepts a [AuthenticationError] object. - */ private val onError: Consumer ) : InBandAuthenticationUseCase { diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/InBandRegistrationUseCase.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/InBandRegistrationUseCase.kt index a3ef230..a64398e 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/InBandRegistrationUseCase.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/InBandRegistrationUseCase.kt @@ -22,4 +22,4 @@ interface InBandRegistrationUseCase { * @return A [Response] object that indicates the result of the use-case execution. */ suspend fun execute(extId: String, authorizationProvider: AuthorizationProvider?): Response -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/InBandRegistrationUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/InBandRegistrationUseCaseImpl.kt index 2163183..8d18355 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/InBandRegistrationUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/InBandRegistrationUseCaseImpl.kt @@ -26,61 +26,33 @@ import kotlinx.coroutines.suspendCancellableCoroutine /** * Default implementation of [InBandRegistrationUseCase] interface. + * + * @constructor Creates a new instance. + * @param clientProvider An instance of [ClientProvider] interface implementation. + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @param createDeviceInformationUseCase An instance of [CreateDeviceInformationUseCase] interface implementation. + * @param authenticatorSelector An instance of [AuthenticatorSelector] interface implementation + * for Registration operation. + * @param pinEnroller An instance of [PinEnroller] interface implementation. + * @param passwordEnroller An instance of [PasswordEnroller] interface implementation. + * @param fingerprintUserVerifier An instance of [FingerprintUserVerifier] interface implementation. + * @param biometricUserVerifier An instance of [BiometricUserVerifier] interface implementation. + * @param devicePasscodeUserVerifier An instance of [DevicePasscodeUserVerifier] interface implementation. + * @param onSuccess An instance of a [Runnable] implementation. + * @param onError An instance of a [Consumer] implementation that accepts an [OperationError] object. */ class InBandRegistrationUseCaseImpl( - /** - * An instance of a [ClientProvider] implementation. - */ private val clientProvider: ClientProvider, - - /** - * An instance of an [OperationStateRepository] implementation that may hold an [UserInteractionOperationState]. - */ private val stateRepository: OperationStateRepository, - - /** - * An instance of a [CreateDeviceInformationUseCase] implementation. - */ private val createDeviceInformationUseCase: CreateDeviceInformationUseCase, - - /** - * An instance of an [AuthenticatorSelector] implementation. - */ private val authenticatorSelector: AuthenticatorSelector, - - /** - * An instance of a [PinEnroller] implementation. - */ private val pinEnroller: PinEnroller, - - /** - * An instance of a [PasswordEnroller] implementation. - */ private val passwordEnroller: PasswordEnroller, - - /** - * An instance of a [FingerprintUserVerifier] implementation. - */ private val fingerprintUserVerifier: FingerprintUserVerifier, - - /** - * An instance of a [BiometricUserVerifier] implementation. - */ private val biometricUserVerifier: BiometricUserVerifier, - - /** - * An instance of a [DevicePasscodeUserVerifier] implementation. - */ private val devicePasscodeUserVerifier: DevicePasscodeUserVerifier, - - /** - * An instance of a [Runnable] implementation. - */ private val onSuccess: Runnable, - - /** - * An instance of a [Consumer] implementation that accepts a [OperationError] object. - */ private val onError: Consumer ) : InBandRegistrationUseCase { diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/InitializeClientUseCase.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/InitializeClientUseCase.kt index 6e8f591..15e1301 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/InitializeClientUseCase.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/InitializeClientUseCase.kt @@ -21,4 +21,4 @@ interface InitializeClientUseCase { * @return A [Response] object that indicates the result of the use-case execution. */ suspend fun execute(configuration: Configuration): Response -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/InitializeClientUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/InitializeClientUseCaseImpl.kt index 7440518..e48a339 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/InitializeClientUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/InitializeClientUseCaseImpl.kt @@ -27,16 +27,13 @@ import kotlin.coroutines.resume * - Using a [Semaphore] object in this implementation. * - Only one instance must be exist of this implementation. It is ensured by injecting this implementation * as singleton by Dagger Hilt. + * + * @constructor Creates a new instance. + * @param clientProvider An instance of [ClientProvider] interface implementation. + * @param context An Android [Context] object used for initializing [ch.nevis.mobile.sdk.api.MobileAuthenticationClient]. */ class InitializeClientUseCaseImpl( - /** - * An instance of a [ClientProvider] implementation. - */ private val clientProvider: ClientProvider, - - /** - * An Android [Context] object used for initializing [ch.nevis.mobile.sdk.api.MobileAuthenticationClient]. - */ private val context: Context, ) : InitializeClientUseCase { diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/LoginUseCase.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/LoginUseCase.kt index bfe95d4..7a41d11 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/LoginUseCase.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/LoginUseCase.kt @@ -23,4 +23,4 @@ interface LoginUseCase { * @return The response of the use-case execution. */ suspend fun execute(passwordAuthentication: PasswordAuthentication): Response -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/LoginUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/LoginUseCaseImpl.kt index 61f365a..74c397d 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/LoginUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/LoginUseCaseImpl.kt @@ -15,11 +15,12 @@ import java.net.PasswordAuthentication /** * Default implementation of [LoginUseCase] interface. + * + * @constructor Creates a new instance. + * @param loginRepository An instance of a [LoginRepository] implementation that is used for the login + * process. */ class LoginUseCaseImpl( - /** - * An instance of a [LoginRepository] implementation that is used for the login process. - */ private val loginRepository: LoginRepository ) : LoginUseCase { @@ -34,4 +35,4 @@ class LoginUseCaseImpl( } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ProcessOutOfBandPayloadUseCase.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ProcessOutOfBandPayloadUseCase.kt index 9a66cbb..a77f429 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ProcessOutOfBandPayloadUseCase.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ProcessOutOfBandPayloadUseCase.kt @@ -24,4 +24,4 @@ interface ProcessOutOfBandPayloadUseCase { * @return A [Response] object that indicates the result of the use-case execution. */ suspend fun execute(payload: OutOfBandPayload): Response -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ProcessOutOfBandPayloadUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ProcessOutOfBandPayloadUseCaseImpl.kt index 43b25b3..0d14eb3 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ProcessOutOfBandPayloadUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/ProcessOutOfBandPayloadUseCaseImpl.kt @@ -40,87 +40,45 @@ import kotlin.coroutines.resume * * After the [OutOfBandPayload] is process successfully, based on the result an [OutOfBandRegistration] * or [OutOfBandAuthentication] operation is started automatically. + * + * @constructor Creates a new instance. + * @param clientProvider An instance of [ClientProvider] interface implementation. + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. + * @param createDeviceInformationUseCase An instance of [CreateDeviceInformationUseCase] interface implementation. + * @param accountSelector An instance of [AccountSelector] interface implementation. + * @param registrationAuthenticatorSelector An instance of [AuthenticatorSelector] interface implementation + * for Registration operation. + * @param authenticationAuthenticatorSelector An instance of [AuthenticatorSelector] interface implementation + * for Authentication operation. + * @param pinEnroller An instance of [PinEnroller] interface implementation. + * @param passwordEnroller An instance of [PasswordEnroller] interface implementation. + * @param pinUserVerifier An instance of [PinUserVerifier] interface implementation. + * @param passwordUserVerifier An instance of [PasswordUserVerifier] interface implementation. + * @param fingerprintUserVerifier An instance of [FingerprintUserVerifier] interface implementation. + * @param biometricUserVerifier An instance of [BiometricUserVerifier] interface implementation. + * @param devicePasscodeUserVerifier An instance of [DevicePasscodeUserVerifier] interface implementation. + * @param onAuthenticationSuccess An instance of a [Consumer] implementation that accepts an [AuthorizationProvider] + * object for successful authentication cases. + * @param onRegistrationSuccess An instance of a [Runnable] implementation for successful registration cases. + * @param onError An instance of a [Consumer] implementation that accepts an [OperationError] object. */ class ProcessOutOfBandPayloadUseCaseImpl( - /** - * An instance of a [ClientProvider] implementation. - */ private val clientProvider: ClientProvider, - - /** - * An instance of a [OperationStateRepository] implementation that may hold an [UserInteractionOperationState]. - */ private val stateRepository: OperationStateRepository, - - /** - * An instance of a [CreateDeviceInformationUseCase] implementation. - */ private val createDeviceInformationUseCase: CreateDeviceInformationUseCase, - - /** - * An instance of an [AccountSelector] implementation. - */ private val accountSelector: AccountSelector, - - /** - * An instance of an [AuthenticatorSelector] implementation for registration cases. - */ private val registrationAuthenticatorSelector: AuthenticatorSelector, - - /** - * An instance of an [AuthenticatorSelector] implementation for authentication cases. - */ private val authenticationAuthenticatorSelector: AuthenticatorSelector, - - /** - * An instance of a [PinEnroller] implementation for registration cases. - */ private val pinEnroller: PinEnroller, - - /** - * An instance of a [PasswordEnroller] implementation. - */ private val passwordEnroller: PasswordEnroller, - - /** - * An instance of a [PinUserVerifier] implementation for authentication cases. - */ private val pinUserVerifier: PinUserVerifier, - - /** - * An instance of a [PasswordUserVerifier] implementation. - */ private val passwordUserVerifier: PasswordUserVerifier, - - /** - * An instance of a [FingerprintUserVerifier] implementation. - */ private val fingerprintUserVerifier: FingerprintUserVerifier, - - /** - * An instance of a [BiometricUserVerifier] implementation. - */ private val biometricUserVerifier: BiometricUserVerifier, - - /** - * An instance of a [DevicePasscodeUserVerifier] implementation. - */ private val devicePasscodeUserVerifier: DevicePasscodeUserVerifier, - - /** - * An instance of a [Consumer] implementation that accepts a [AuthorizationProvider] object for - * successful authentication cases. - */ private val onAuthenticationSuccess: Consumer, - - /** - * An instance of a [Runnable] implementation for successful registration cases. - */ private val onRegistrationSuccess: Runnable, - - /** - * An instance of a [Consumer] implementation that accepts a [OperationError] object. - */ private val onError: Consumer ) : ProcessOutOfBandPayloadUseCase { @@ -220,6 +178,7 @@ class ProcessOutOfBandPayloadUseCaseImpl( * Sets-up and executes the given out-of-band registration. * * @param outOfBandRegistration The [OutOfBandRegistration] operation to be executed. + * @param deviceInformation The device information. * @return A [Response] object that indicates the result of the use-case execution. */ private suspend fun register( diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/SelectAccountUseCase.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/SelectAccountUseCase.kt index 2a1c96b..05b68a5 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/SelectAccountUseCase.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/SelectAccountUseCase.kt @@ -26,4 +26,4 @@ interface SelectAccountUseCase { * @return A [Response] object that indicates the result of the use-case execution. */ suspend fun execute(username: String): Response -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/SelectAccountUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/SelectAccountUseCaseImpl.kt index 0412fc2..7e8c0f0 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/SelectAccountUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/SelectAccountUseCaseImpl.kt @@ -14,11 +14,12 @@ import kotlinx.coroutines.suspendCancellableCoroutine /** * Default implementation of [SelectAccountUseCase] interface. + * + * @constructor Creates a new instance. + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. */ class SelectAccountUseCaseImpl( - /** - * An instance of an [OperationStateRepository] implementation that may hold an [UserInteractionOperationState]. - */ private val stateRepository: OperationStateRepository ) : SelectAccountUseCase { diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/SelectAuthenticatorUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/SelectAuthenticatorUseCaseImpl.kt index 10d6463..06759c1 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/SelectAuthenticatorUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/SelectAuthenticatorUseCaseImpl.kt @@ -14,11 +14,12 @@ import kotlinx.coroutines.suspendCancellableCoroutine /** * Default implementation of [SelectAuthenticatorUseCase] interface. + * + * @constructor Creates a new instance. + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. */ class SelectAuthenticatorUseCaseImpl( - /** - * An instance of an [OperationStateRepository] implementation that may hold an [UserInteractionOperationState]. - */ private val stateRepository: OperationStateRepository ) : SelectAuthenticatorUseCase { diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/SetPasswordUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/SetPasswordUseCaseImpl.kt index 86635d5..ee1ea40 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/SetPasswordUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/SetPasswordUseCaseImpl.kt @@ -14,11 +14,12 @@ import kotlinx.coroutines.suspendCancellableCoroutine /** * Default implementation of [SetPasswordUseCase] interface. + * + * @constructor Creates a new instance. + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. */ class SetPasswordUseCaseImpl( - /** - * An instance of an [OperationStateRepository] implementation that may hold an [UserInteractionOperationState]. - */ private val stateRepository: OperationStateRepository ) : SetPasswordUseCase { diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/SetPinUseCase.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/SetPinUseCase.kt index 7c7e862..601b59c 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/SetPinUseCase.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/SetPinUseCase.kt @@ -29,4 +29,4 @@ interface SetPinUseCase { * @return A [Response] object that indicates the result of the use-case execution. */ suspend fun execute(pin: CharArray): Response -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/SetPinUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/SetPinUseCaseImpl.kt index 0a55ac2..38d21ce 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/SetPinUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/SetPinUseCaseImpl.kt @@ -14,11 +14,12 @@ import kotlinx.coroutines.suspendCancellableCoroutine /** * Default implementation of [SetPinUseCase] interface. + * + * @constructor Creates a new instance. + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. */ class SetPinUseCaseImpl( - /** - * An instance of an [OperationStateRepository] implementation that may hold an [UserInteractionOperationState]. - */ private val stateRepository: OperationStateRepository ) : SetPinUseCase { diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/StartChangePasswordUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/StartChangePasswordUseCaseImpl.kt index 94eaffe..db3fd53 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/StartChangePasswordUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/StartChangePasswordUseCaseImpl.kt @@ -10,7 +10,6 @@ import ch.nevis.exampleapp.coroutines.domain.client.ClientProvider import ch.nevis.exampleapp.coroutines.domain.model.error.BusinessException import ch.nevis.exampleapp.coroutines.domain.model.response.Response import ch.nevis.exampleapp.coroutines.domain.model.state.ChangePasswordOperationState -import ch.nevis.exampleapp.coroutines.domain.model.state.UserInteractionOperationState import ch.nevis.exampleapp.coroutines.domain.repository.OperationStateRepository import ch.nevis.mobile.sdk.api.operation.password.PasswordChangeError import ch.nevis.mobile.sdk.api.operation.password.PasswordChanger @@ -20,31 +19,20 @@ import kotlinx.coroutines.suspendCancellableCoroutine /** * Default implementation of [StartChangePasswordUseCase] interface. + * + * @constructor Creates a new instance. + * @param clientProvider An instance of [ClientProvider] interface implementation. + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [ChangePasswordOperationState]. + * @param passwordChanger An instance of [PasswordChanger] interface implementation. + * @param onSuccess An instance of a [Runnable] implementation. + * @param onError An instance of a [Consumer] implementation that accepts a [PasswordChangeError] object. */ class StartChangePasswordUseCaseImpl( - /** - * An instance of a [ClientProvider] implementation. - */ private val clientProvider: ClientProvider, - - /** - * An instance of an [OperationStateRepository] implementation that may hold an [UserInteractionOperationState]. - */ private val stateRepository: OperationStateRepository, - - /** - * An instance of a [PasswordChanger] implementation. - */ private val passwordChanger: PasswordChanger, - - /** - * An instance of a [Runnable] implementation. - */ private val onSuccess: Runnable, - - /** - * An instance of a [Consumer] implementation that accepts a [PasswordChangeError] object. - */ private val onError: Consumer ) : StartChangePasswordUseCase { diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/StartChangePinUseCase.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/StartChangePinUseCase.kt index 6a36dd4..7bbc393 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/StartChangePinUseCase.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/StartChangePinUseCase.kt @@ -20,4 +20,4 @@ interface StartChangePinUseCase { * @return A [Response] object that indicates the result of the use-case execution. */ suspend fun execute(username: String): Response -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/StartChangePinUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/StartChangePinUseCaseImpl.kt index 0f6a131..7401e8f 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/StartChangePinUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/StartChangePinUseCaseImpl.kt @@ -10,7 +10,6 @@ import ch.nevis.exampleapp.coroutines.domain.client.ClientProvider import ch.nevis.exampleapp.coroutines.domain.model.error.BusinessException import ch.nevis.exampleapp.coroutines.domain.model.response.Response import ch.nevis.exampleapp.coroutines.domain.model.state.ChangePinOperationState -import ch.nevis.exampleapp.coroutines.domain.model.state.UserInteractionOperationState import ch.nevis.exampleapp.coroutines.domain.repository.OperationStateRepository import ch.nevis.mobile.sdk.api.operation.pin.PinChangeError import ch.nevis.mobile.sdk.api.operation.pin.PinChanger @@ -20,31 +19,20 @@ import kotlinx.coroutines.suspendCancellableCoroutine /** * Default implementation of [StartChangePinUseCase] interface. + * + * @constructor Creates a new instance. + * @param clientProvider An instance of [ClientProvider] interface implementation. + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [ChangePinOperationState]. + * @param pinChanger An instance of [PinChanger] interface implementation. + * @param onSuccess An instance of a [Runnable] implementation. + * @param onError An instance of a [Consumer] implementation that accepts a [PinChangeError] object. */ class StartChangePinUseCaseImpl( - /** - * An instance of a [ClientProvider] implementation. - */ private val clientProvider: ClientProvider, - - /** - * An instance of an [OperationStateRepository] implementation that may hold an [UserInteractionOperationState]. - */ private val stateRepository: OperationStateRepository, - - /** - * An instance of a [PinChanger] implementation. - */ private val pinChanger: PinChanger, - - /** - * An instance of a [Runnable] implementation. - */ private val onSuccess: Runnable, - - /** - * An instance of a [Consumer] implementation that accepts a [PinChangeError] object. - */ private val onError: Consumer ) : StartChangePinUseCase { diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyBiometricUseCase.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyBiometricUseCase.kt index 7481fb8..fa912d5 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyBiometricUseCase.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyBiometricUseCase.kt @@ -31,4 +31,4 @@ interface VerifyBiometricUseCase { * @return A [Response] object that indicates the result of the use-case execution. */ suspend fun execute(biometricPromptOptions: BiometricPromptOptions): Response -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyBiometricUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyBiometricUseCaseImpl.kt index 1c2298b..2bb04fb 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyBiometricUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyBiometricUseCaseImpl.kt @@ -15,11 +15,12 @@ import kotlinx.coroutines.suspendCancellableCoroutine /** * Default implementation of [VerifyBiometricUseCase] interface. + * + * @constructor Creates a new instance. + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. */ class VerifyBiometricUseCaseImpl( - /** - * An instance of an [OperationStateRepository] implementation that may hold an [UserInteractionOperationState]. - */ private val stateRepository: OperationStateRepository ) : VerifyBiometricUseCase { diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyDevicePasscodeUseCase.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyDevicePasscodeUseCase.kt index 96e943e..455d8a7 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyDevicePasscodeUseCase.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyDevicePasscodeUseCase.kt @@ -31,4 +31,4 @@ interface VerifyDevicePasscodeUseCase { * @return A [Response] object that indicates the result of the use-case execution. */ suspend fun execute(devicePasscodePromptOptions: DevicePasscodePromptOptions): Response -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyDevicePasscodeUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyDevicePasscodeUseCaseImpl.kt index 2178a7c..4a05ebe 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyDevicePasscodeUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyDevicePasscodeUseCaseImpl.kt @@ -15,11 +15,12 @@ import kotlinx.coroutines.suspendCancellableCoroutine /** * Default implementation of [VerifyDevicePasscodeUseCase] interface. + * + * @constructor Creates a new instance. + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. */ class VerifyDevicePasscodeUseCaseImpl( - /** - * An instance of an [OperationStateRepository] implementation that may hold an [UserInteractionOperationState]. - */ private val stateRepository: OperationStateRepository ) : VerifyDevicePasscodeUseCase { diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyFingerprintUseCase.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyFingerprintUseCase.kt index 9fda830..89cf2d3 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyFingerprintUseCase.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyFingerprintUseCase.kt @@ -28,4 +28,4 @@ interface VerifyFingerprintUseCase { * @return A [Response] object that indicates the result of the use-case execution. */ suspend fun execute(): Response -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyFingerprintUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyFingerprintUseCaseImpl.kt index 15b035b..dcd1fc5 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyFingerprintUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyFingerprintUseCaseImpl.kt @@ -14,11 +14,12 @@ import kotlinx.coroutines.suspendCancellableCoroutine /** * Default implementation of [VerifyFingerprintUseCase] interface. + * + * @constructor Creates a new instance. + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. */ class VerifyFingerprintUseCaseImpl( - /** - * An instance of an [OperationStateRepository] implementation that may hold an [UserInteractionOperationState]. - */ private val stateRepository: OperationStateRepository ) : VerifyFingerprintUseCase { diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyPasswordUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyPasswordUseCaseImpl.kt index 22ed893..eb7dce6 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyPasswordUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyPasswordUseCaseImpl.kt @@ -14,11 +14,12 @@ import kotlinx.coroutines.suspendCancellableCoroutine /** * Default implementation of [VerifyPasswordUseCase] interface. + * + * @constructor Creates a new instance. + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. */ class VerifyPasswordUseCaseImpl( - /** - * An instance of an [OperationStateRepository] implementation that may hold an [UserInteractionOperationState]. - */ private val stateRepository: OperationStateRepository ) : VerifyPasswordUseCase { diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyPinUseCaseImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyPinUseCaseImpl.kt index 5f8d116..e307cad 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyPinUseCaseImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/usecase/VerifyPinUseCaseImpl.kt @@ -14,11 +14,12 @@ import kotlinx.coroutines.suspendCancellableCoroutine /** * Default implementation of [VerifyPinUseCase] interface. + * + * @constructor Creates a new instance. + * @param stateRepository An instance of an [OperationStateRepository] implementation that may hold + * a [UserInteractionOperationState]. */ class VerifyPinUseCaseImpl( - /** - * An instance of an [OperationStateRepository] implementation that may hold an [UserInteractionOperationState]. - */ private val stateRepository: OperationStateRepository ) : VerifyPinUseCase { diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/validation/AuthenticatorValidatorImpl.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/validation/AuthenticatorValidatorImpl.kt index e72d20f..4855413 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/validation/AuthenticatorValidatorImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/domain/validation/AuthenticatorValidatorImpl.kt @@ -11,6 +11,8 @@ import ch.nevis.mobile.sdk.api.operation.selection.AuthenticatorSelectionContext /** * Default implementation of [AuthenticatorValidator] interface. + * + * @constructor Creates a new instance. */ class AuthenticatorValidatorImpl : AuthenticatorValidator { //region AuthenticatorValidator diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/timber/ExampleAppTree.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/timber/ExampleAppTree.kt index 59c4b68..e1d6665 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/timber/ExampleAppTree.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/timber/ExampleAppTree.kt @@ -11,17 +11,20 @@ import ch.nevis.exampleapp.coroutines.domain.log.SdkLogger import timber.log.Timber /** - * An example application specific sub-class of [Timber.DebugTree] that logs SDK events at a specific priority level. + * An example application specific sub-class of [Timber.DebugTree] that logs SDK events at a specific + * priority level. + * + * @constructor Creates a new instance. + * @param sdkLogger An instance of an implementation of [SdkLogger] interface. */ class ExampleAppTree( - - /** - * An instance of an implementation of [SdkLogger] interface. - */ private val sdkLogger: SdkLogger ): Timber.DebugTree() { //region Constants + /** + * Constants. + */ companion object { /** * Priority level constant for SDK events. diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/authCloudRegistration/AuthCloudRegistrationFragment.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/authCloudRegistration/AuthCloudRegistrationFragment.kt index 52cc08c..cc5bae9 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/authCloudRegistration/AuthCloudRegistrationFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/authCloudRegistration/AuthCloudRegistrationFragment.kt @@ -19,6 +19,8 @@ import dagger.hilt.android.AndroidEntryPoint * [androidx.fragment.app.Fragment] implementation of Auth Cloud API Registration view where the user * can enter an enroll response or an app link URI and send it to the Auth Cloud API as input for * a registration operation. + * + * @constructor Creates a new instance. */ @AndroidEntryPoint class AuthCloudRegistrationFragment : ResponseObserverFragment() { @@ -37,6 +39,7 @@ class AuthCloudRegistrationFragment : ResponseObserverFragment() { //endregion //region Fragment + /** @suppress */ override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -45,6 +48,7 @@ class AuthCloudRegistrationFragment : ResponseObserverFragment() { return binding.root } + /** @suppress */ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -56,9 +60,10 @@ class AuthCloudRegistrationFragment : ResponseObserverFragment() { } } + /** @suppress */ override fun onDestroyView() { super.onDestroyView() _binding = null } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/authCloudRegistration/AuthCloudRegistrationViewModel.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/authCloudRegistration/AuthCloudRegistrationViewModel.kt index be63b18..450aa2f 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/authCloudRegistration/AuthCloudRegistrationViewModel.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/authCloudRegistration/AuthCloudRegistrationViewModel.kt @@ -15,12 +15,12 @@ import javax.inject.Inject /** * View model implementation of Auth Cloud API Registration view. + * + * @constructor Creates a new instance. + * @param authCloudApiRegistrationUseCase An instance of a [AuthCloudApiRegistrationUseCase] implementation. */ @HiltViewModel class AuthCloudRegistrationViewModel @Inject constructor( - /** - * An instance of a [AuthCloudApiRegistrationUseCase] implementation. - */ private val authCloudApiRegistrationUseCase: AuthCloudApiRegistrationUseCase ) : OperationViewModel() { @@ -47,4 +47,4 @@ class AuthCloudRegistrationViewModel @Inject constructor( } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/base/CancelOperationOnBackPressedCallback.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/base/CancelOperationOnBackPressedCallback.kt index 74f3850..67bef95 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/base/CancelOperationOnBackPressedCallback.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/base/CancelOperationOnBackPressedCallback.kt @@ -11,16 +11,16 @@ import androidx.activity.OnBackPressedCallback /** * A common implementation of [OnBackPressedCallback] class that cancels * the running operation if there is any. + * + * @constructor Creates a new instance. + * @param viewModel The view model that runs/handles the cancellable operation. */ open class CancelOperationOnBackPressedCallback( - - /** - * The view model that runs/handles the cancellable operation. - */ private val viewModel: CancellableOperationViewModel ) : OnBackPressedCallback(true) { //region OnBackPressedCallback + /** @suppress */ override fun handleOnBackPressed() { viewModel.cancelOperation() } diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/base/OperationViewModel.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/base/OperationViewModel.kt index b22ba06..c24ac19 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/base/OperationViewModel.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/base/OperationViewModel.kt @@ -30,6 +30,11 @@ abstract class OperationViewModel : ViewModel() { * The [Response] objects created by business logic. */ protected val mutableResponseLiveData = SingleLiveEvent() + + /** + * A [LiveData] that can post [Response] objects for fragments those observe it. + * The [Response] objects created by business logic. + */ val responseLiveData: LiveData = mutableResponseLiveData /** @@ -75,4 +80,4 @@ abstract class OperationViewModel : ViewModel() { } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/base/ResponseObserverFragment.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/base/ResponseObserverFragment.kt index 540f19d..abcf985 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/base/ResponseObserverFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/base/ResponseObserverFragment.kt @@ -59,6 +59,7 @@ abstract class ResponseObserverFragment : Fragment() { protected lateinit var errorHandlerChain: ErrorHandlerChain //region Fragment + /** @suppress */ override fun onResume() { super.onResume() @@ -67,6 +68,7 @@ abstract class ResponseObserverFragment : Fragment() { } } + /** @suppress */ override fun onPause() { super.onPause() viewModel.responseLiveData.removeObservers(viewLifecycleOwner) diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/changeDeviceInformation/ChangeDeviceInformationFragment.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/changeDeviceInformation/ChangeDeviceInformationFragment.kt index ccf5931..e0e151a 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/changeDeviceInformation/ChangeDeviceInformationFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/changeDeviceInformation/ChangeDeviceInformationFragment.kt @@ -21,6 +21,8 @@ import dagger.hilt.android.AndroidEntryPoint * [androidx.fragment.app.Fragment] implementation of Change Device Information view where the user * can see the current device information and she/he cna enter a new device information name and send it * to the client as input for a change device information operation. + * + * @constructor Creates a new instance. */ @AndroidEntryPoint class ChangeDeviceInformationFragment : ResponseObserverFragment() { @@ -39,6 +41,7 @@ class ChangeDeviceInformationFragment : ResponseObserverFragment() { //endregion //region Fragment + /** @suppress */ override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -47,6 +50,7 @@ class ChangeDeviceInformationFragment : ResponseObserverFragment() { return binding.root } + /** @suppress */ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -57,6 +61,7 @@ class ChangeDeviceInformationFragment : ResponseObserverFragment() { } } + /** @suppress */ override fun onDestroyView() { super.onDestroyView() _binding = null @@ -72,4 +77,4 @@ class ChangeDeviceInformationFragment : ResponseObserverFragment() { } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/changeDeviceInformation/ChangeDeviceInformationViewModel.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/changeDeviceInformation/ChangeDeviceInformationViewModel.kt index 37642d5..aa6b304 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/changeDeviceInformation/ChangeDeviceInformationViewModel.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/changeDeviceInformation/ChangeDeviceInformationViewModel.kt @@ -16,17 +16,14 @@ import javax.inject.Inject /** * View model implementation of Change Device Information view. + * + * @constructor Creates a new instance. + * @param getDeviceInformationUseCase An instance of a [GetDeviceInformationUseCase] implementation. + * @param changeDeviceInformationUseCase An instance of a [ChangeDeviceInformationUseCase] implementation. */ @HiltViewModel class ChangeDeviceInformationViewModel @Inject constructor( - /** - * An instance of a [GetDeviceInformationUseCase] implementation. - */ private val getDeviceInformationUseCase: GetDeviceInformationUseCase, - - /** - * An instance of a [ChangeDeviceInformationUseCase] implementation. - */ private val changeDeviceInformationUseCase: ChangeDeviceInformationUseCase ) : OperationViewModel() { @@ -57,4 +54,4 @@ class ChangeDeviceInformationViewModel @Inject constructor( } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/credential/CredentialFragment.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/credential/CredentialFragment.kt index f0ffa37..3231706 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/credential/CredentialFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/credential/CredentialFragment.kt @@ -31,6 +31,8 @@ import dagger.hilt.android.AndroidEntryPoint /** * [androidx.fragment.app.Fragment] implementation of Credential view where the user * can set, change and verify credential (PIN or password). + * + * @constructor Creates a new instance. */ @AndroidEntryPoint class CredentialFragment : ResponseObserverFragment() { @@ -59,6 +61,7 @@ class CredentialFragment : ResponseObserverFragment() { //endregion //region Fragment + /** @suppress */ override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -67,6 +70,7 @@ class CredentialFragment : ResponseObserverFragment() { return binding.root } + /** @suppress */ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -98,6 +102,7 @@ class CredentialFragment : ResponseObserverFragment() { requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner, callback) } + /** @suppress */ override fun onDestroyView() { super.onDestroyView() _binding = null diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/credential/parameter/PasswordNavigationParameter.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/credential/parameter/PasswordNavigationParameter.kt index 8e2af6e..5309039 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/credential/parameter/PasswordNavigationParameter.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/credential/parameter/PasswordNavigationParameter.kt @@ -14,17 +14,16 @@ import kotlinx.parcelize.Parcelize /** * Navigation parameter of the Credential view in case of Password authenticator. + * + * @constructor Creates a new instance. + * @param credentialViewMode The mode, the Credential view intend to be used/initialized. + * @param lastRecoverableError The last recoverable error. It exists only if there was already a failed + * Password operation attempt. + * @param passwordAuthenticatorProtectionStatus Status object of the Password authenticator. */ @Parcelize data class PasswordNavigationParameter( - /** - * The mode, the Credential view intend to be used/initialized. - */ override val credentialViewMode: CredentialViewMode, - - /** - * The last recoverable error. It exists only if there was already a failed Password operation attempt. - */ @IgnoredOnParcel override val lastRecoverableError: RecoverableError? = null, diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/credential/parameter/PinNavigationParameter.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/credential/parameter/PinNavigationParameter.kt index e3b101c..80f54ff 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/credential/parameter/PinNavigationParameter.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/credential/parameter/PinNavigationParameter.kt @@ -14,17 +14,16 @@ import kotlinx.parcelize.Parcelize /** * Navigation parameter of the Credential view in case of PIN authenticator. + * + * @constructor Creates a new instance. + * @param credentialViewMode The mode, the Credential view intend to be used/initialized. + * @param lastRecoverableError The last recoverable error. It exists only if there was already a failed + * Password operation attempt. + * @param pinAuthenticatorProtectionStatus Status object of the PIN authenticator. */ @Parcelize data class PinNavigationParameter( - /** - * The mode, the Credential view intend to be used/initialized. - */ override val credentialViewMode: CredentialViewMode, - - /** - * The last recoverable error. It exists only if there was already a failed PIN operation attempt. - */ @IgnoredOnParcel override val lastRecoverableError: RecoverableError? = null, diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/error/ErrorFragment.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/error/ErrorFragment.kt index 5e31cbc..fdcacd2 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/error/ErrorFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/error/ErrorFragment.kt @@ -20,6 +20,8 @@ import dagger.hilt.android.AndroidEntryPoint /** * [androidx.fragment.app.Fragment] implementation of Error view. + * + * @constructor Creates a new instance. */ @AndroidEntryPoint class ErrorFragment : Fragment() { @@ -38,6 +40,7 @@ class ErrorFragment : Fragment() { //endregion //region Fragment + /** @suppress */ override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -46,6 +49,7 @@ class ErrorFragment : Fragment() { return binding.root } + /** @suppress */ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -63,9 +67,10 @@ class ErrorFragment : Fragment() { requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner, callback) } + /** @suppress */ override fun onDestroyView() { super.onDestroyView() _binding = null } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/error/parameter/ErrorNavigationParameter.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/error/parameter/ErrorNavigationParameter.kt index f2a465a..f40f658 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/error/parameter/ErrorNavigationParameter.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/error/parameter/ErrorNavigationParameter.kt @@ -11,6 +11,9 @@ import kotlinx.parcelize.Parcelize /** * Navigation parameter data class for Error view. + * + * @constructor Creates a new instance. + * @param message The error message to be displayed on Error view. */ @Parcelize data class ErrorNavigationParameter( diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/home/HomeFragment.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/home/HomeFragment.kt index 51b00da..fb37bb9 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/home/HomeFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/home/HomeFragment.kt @@ -46,6 +46,7 @@ class HomeFragment : ResponseObserverFragment() { //endregion //region Fragment + /** @suppress */ override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -54,6 +55,7 @@ class HomeFragment : ResponseObserverFragment() { return binding.root } + /** @suppress */ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) val navController = findNavController() @@ -99,11 +101,13 @@ class HomeFragment : ResponseObserverFragment() { } } + /** @suppress */ override fun onStart() { super.onStart() viewModel.initClient() } + /** @suppress */ override fun onDestroyView() { super.onDestroyView() _binding = null diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/home/HomeViewModel.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/home/HomeViewModel.kt index a04b2d3..a23b3b3 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/home/HomeViewModel.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/home/HomeViewModel.kt @@ -29,42 +29,24 @@ import javax.inject.Inject /** * View model implementation of Home view. + * + * @constructor Creates a new instance. + * @param configurationProvider An instance of a [ConfigurationProvider] implementation. + * @param initializeClientUseCase An instance of a [InitializeClientUseCase] implementation. + * @param getAccountsUseCase An instance of a [GetAccountsUseCase] implementation. + * @param getAuthenticatorsUseCase An instance of a [GetAuthenticatorsUseCase] implementation. + * @param startChangePinUseCase An instance of a [StartChangePinUseCase] implementation. + * @param startChangePasswordUseCase An instance of a [StartChangePasswordUseCase] implementation. + * @param deleteAuthenticatorsUseCase An instance of a [DeleteAuthenticatorsUseCase] implementation. */ @HiltViewModel class HomeViewModel @Inject constructor( - /** - * An instance of a [ConfigurationProvider] implementation. - */ private val configurationProvider: ConfigurationProvider, - - /** - * An instance of a [InitializeClientUseCase] implementation. - */ private val initializeClientUseCase: InitializeClientUseCase, - - /** - * An instance of a [GetAccountsUseCase] implementation. - */ private val getAccountsUseCase: GetAccountsUseCase, - - /** - * An instance of a [GetAuthenticatorsUseCase] implementation. - */ private val getAuthenticatorsUseCase: GetAuthenticatorsUseCase, - - /** - * An instance of a [StartChangePinUseCase] implementation. - */ private val startChangePinUseCase: StartChangePinUseCase, - - /** - * An instance of a [StartChangePasswordUseCase] implementation. - */ private val startChangePasswordUseCase: StartChangePasswordUseCase, - - /** - * An instance of a [DeleteAuthenticatorsUseCase] implementation. - */ private val deleteAuthenticatorsUseCase: DeleteAuthenticatorsUseCase, ) : OutOfBandOperationViewModel() { diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/legacyLogin/LegacyLoginFragment.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/legacyLogin/LegacyLoginFragment.kt index de0c415..9efc0f0 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/legacyLogin/LegacyLoginFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/legacyLogin/LegacyLoginFragment.kt @@ -22,6 +22,8 @@ import java.net.PasswordAuthentication * [androidx.fragment.app.Fragment] implementation of Legacy Login view where the user * can enter a username and password and send it to start a legacy login process. If the login was * successful an in-band registration operation is started automatically. + * + * @constructor Creates a new instance. */ @AndroidEntryPoint class LegacyLoginFragment : ResponseObserverFragment() { @@ -40,6 +42,7 @@ class LegacyLoginFragment : ResponseObserverFragment() { //endregion //region Fragment + /** @suppress */ override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -48,6 +51,7 @@ class LegacyLoginFragment : ResponseObserverFragment() { return binding.root } + /** @suppress */ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -60,6 +64,7 @@ class LegacyLoginFragment : ResponseObserverFragment() { } } + /** @suppress */ override fun onDestroyView() { super.onDestroyView() _binding = null @@ -76,4 +81,4 @@ class LegacyLoginFragment : ResponseObserverFragment() { } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/legacyLogin/LegacyLoginViewModel.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/legacyLogin/LegacyLoginViewModel.kt index 392945d..d472dbf 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/legacyLogin/LegacyLoginViewModel.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/legacyLogin/LegacyLoginViewModel.kt @@ -19,17 +19,14 @@ import javax.inject.Inject /** * View model implementation of Legacy Login view. + * + * @constructor Creates a new instance. + * @param loginUseCase An instance of a [LoginUseCase] implementation. + * @param inBandRegistrationUseCase An instance of a [InBandRegistrationUseCase] implementation. */ @HiltViewModel class LegacyLoginViewModel @Inject constructor( - /** - * An instance of a [LoginUseCase] implementation. - */ private val loginUseCase: LoginUseCase, - - /** - * An instance of a [InBandRegistrationUseCase] implementation. - */ private val inBandRegistrationUseCase: InBandRegistrationUseCase ) : OperationViewModel() { @@ -62,4 +59,4 @@ class LegacyLoginViewModel @Inject constructor( } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/main/LogRecyclerViewAdapter.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/main/LogRecyclerViewAdapter.kt index 1b8eed1..b6f45ca 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/main/LogRecyclerViewAdapter.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/main/LogRecyclerViewAdapter.kt @@ -19,11 +19,12 @@ import java.text.SimpleDateFormat /** * An implementation of [RecyclerView.Adapter] abstract class that renders [LogItem] objects into recycler items. + * + * @constructor Creates a new instance. + * @param context An Android [Context] object for resolving resources and to obtain a [LayoutInflater] + * instance. */ class LogRecyclerViewAdapter( - /** - * An Android [Context] object for resolving resources and to obtain a [LayoutInflater] instance. - */ private val context: Context ): RecyclerView.Adapter() { @@ -58,10 +59,12 @@ class LogRecyclerViewAdapter( //endregion //region RecyclerView.Adapter + /** @suppress */ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): LogViewHolder { return LogViewHolder(layoutInflater.inflate(R.layout.item_log, parent, false)) } + /** @suppress */ override fun onBindViewHolder(holder: LogViewHolder, position: Int) { holder.messageTextView.text = null @@ -71,17 +74,18 @@ class LogRecyclerViewAdapter( } } + /** @suppress */ override fun getItemCount() = log.size //endregion //region AuthenticatorViewHolder /** * A [RecyclerView.ViewHolder] implementation that represents a log item. It holds only a [TextView] the log message will be set into. + * + * @constructor Creates a new instance. + * @param itemView The item view provided by recycler view. */ inner class LogViewHolder( - /** - * The item view provided by recycler view. - */ itemView: View ) : RecyclerView.ViewHolder(itemView) { @@ -98,4 +102,4 @@ class LogRecyclerViewAdapter( //endregion } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/main/MainActivity.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/main/MainActivity.kt index 14077e7..c0144c9 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/main/MainActivity.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/main/MainActivity.kt @@ -47,6 +47,9 @@ class MainActivity : AppCompatActivity() { */ private lateinit var logRecyclerViewAdapter: LogRecyclerViewAdapter + /** + * An instance of an [ErrorHandlerChain] implementation. + */ @Inject lateinit var errorHandlerChain: ErrorHandlerChain //endregion @@ -141,4 +144,4 @@ class MainActivity : AppCompatActivity() { } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/main/MainActivityViewModel.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/main/MainActivityViewModel.kt index 7f644e3..2ef667d 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/main/MainActivityViewModel.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/main/MainActivityViewModel.kt @@ -17,13 +17,12 @@ import javax.inject.Inject /** * View model implementation of Main activity. + * + * @constructor Creates a new instance. + * @param sdkLogger An injected instance of an implementation of [SdkLogger] interface. */ @HiltViewModel class MainActivityViewModel @Inject constructor( - - /** - * An injected instance of an implementation of [SdkLogger] interface. - */ private val sdkLogger: SdkLogger ): ViewModel(), SdkLogReceiver { @@ -42,6 +41,10 @@ class MainActivityViewModel @Inject constructor( * Log [LiveData] that is used to post new [LogItem] objects to observers. */ private val _log = MutableLiveData() + + /** + * Log [LiveData] that is used to post new [LogItem] objects to observers. + */ val log: LiveData = _log //endregion @@ -59,4 +62,4 @@ class MainActivityViewModel @Inject constructor( _log.postValue(logItem) } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/qrReader/BarcodesReceivedListener.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/qrReader/BarcodesReceivedListener.kt index a00c841..d43772e 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/qrReader/BarcodesReceivedListener.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/qrReader/BarcodesReceivedListener.kt @@ -20,4 +20,4 @@ interface BarcodesReceivedListener { * @param barcodes The read/received barcode(s). */ fun onBarcodesReceived(barcodes: List) -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/qrReader/QrCodeAnalyzer.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/qrReader/QrCodeAnalyzer.kt index 71f6272..23f2517 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/qrReader/QrCodeAnalyzer.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/qrReader/QrCodeAnalyzer.kt @@ -15,11 +15,12 @@ import com.google.mlkit.vision.common.InputImage /** * A [ImageAnalysis.Analyzer] implementation for QR Reader view to process images as barcodes. + * + * @constructor Creates a new instance. + * @param barcodesReceivedListener A [BarcodesReceivedListener] implementation that will be notified + * when barcode(s) are read/received. */ class QrCodeAnalyzer( - /** - * A [BarcodesReceivedListener] implementation that will be notified when barcode(s) are read/received. - */ private val barcodesReceivedListener: BarcodesReceivedListener ) : ImageAnalysis.Analyzer { @@ -41,6 +42,7 @@ class QrCodeAnalyzer( //endregion //region ImageAnalysis.Analyzer + /** @suppress */ @androidx.annotation.OptIn(androidx.camera.core.ExperimentalGetImage::class) override fun analyze(imageProxy: ImageProxy) { imageProxy.image?.let { @@ -54,4 +56,4 @@ class QrCodeAnalyzer( } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/qrReader/QrReaderFragment.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/qrReader/QrReaderFragment.kt index 5241db0..33ba96a 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/qrReader/QrReaderFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/qrReader/QrReaderFragment.kt @@ -36,6 +36,8 @@ import java.util.concurrent.Executors /** * [androidx.fragment.app.Fragment] implementation of QR Reader view where the user can scan a QR code. + * + * @constructor Creates a new instance. */ @AndroidEntryPoint class QrReaderFragment : ResponseObserverFragment(), BarcodesReceivedListener { @@ -69,6 +71,7 @@ class QrReaderFragment : ResponseObserverFragment(), BarcodesReceivedListener { //endregion //region Fragment + /** @suppress */ override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -77,6 +80,7 @@ class QrReaderFragment : ResponseObserverFragment(), BarcodesReceivedListener { return binding.root } + /** @suppress */ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -101,6 +105,7 @@ class QrReaderFragment : ResponseObserverFragment(), BarcodesReceivedListener { } } + /** @suppress */ override fun onDestroyView() { super.onDestroyView() _binding = null @@ -228,6 +233,9 @@ class QrReaderFragment : ResponseObserverFragment(), BarcodesReceivedListener { //endregion //region Companion Object + /** + * Constants. + */ companion object { /** * List of necessary permissions for camera usage. @@ -238,4 +246,4 @@ class QrReaderFragment : ResponseObserverFragment(), BarcodesReceivedListener { ).toTypedArray() } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/qrReader/QrReaderViewModel.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/qrReader/QrReaderViewModel.kt index 938c21e..de75863 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/qrReader/QrReaderViewModel.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/qrReader/QrReaderViewModel.kt @@ -12,6 +12,8 @@ import javax.inject.Inject /** * View model implementation of QR Reader view. + * + * @constructor Creates a new instance. */ @HiltViewModel -class QrReaderViewModel @Inject constructor() : OutOfBandOperationViewModel() \ No newline at end of file +class QrReaderViewModel @Inject constructor() : OutOfBandOperationViewModel() diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/result/ResultFragment.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/result/ResultFragment.kt index f73d0ae..66fe651 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/result/ResultFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/result/ResultFragment.kt @@ -25,6 +25,8 @@ import dagger.hilt.android.AndroidEntryPoint * This view shows the result data received via navigation parameter and * if the user presses OS back button or the confirm button on this view * then the application navigates back to Home view. + * + * @constructor Creates a new instance. */ @AndroidEntryPoint class ResultFragment : Fragment() { @@ -43,6 +45,7 @@ class ResultFragment : Fragment() { //endregion //region Fragment + /** @suppress */ override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -51,6 +54,7 @@ class ResultFragment : Fragment() { return binding.root } + /** @suppress */ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -72,9 +76,10 @@ class ResultFragment : Fragment() { requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner, callback) } + /** @suppress */ override fun onDestroyView() { super.onDestroyView() _binding = null } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/result/parameter/ResultNavigationParameter.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/result/parameter/ResultNavigationParameter.kt index cac3738..4aece85 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/result/parameter/ResultNavigationParameter.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/result/parameter/ResultNavigationParameter.kt @@ -14,6 +14,10 @@ import kotlinx.parcelize.Parcelize /** * Navigation parameter data class for Result view. + * + * @constructor Creates a new instance. + * @param titleResId String resource identifier of the title of Result screen. + * @param operation The related operation if there is any. */ @Parcelize data class ResultNavigationParameter( @@ -30,6 +34,9 @@ data class ResultNavigationParameter( ) : Parcelable { //region Public Static Interface + /** + * Collection of public static methods. + */ companion object { /** diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAccount/AccountSelectedListener.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAccount/AccountSelectedListener.kt index 8579db6..5fa5709 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAccount/AccountSelectedListener.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAccount/AccountSelectedListener.kt @@ -8,10 +8,9 @@ package ch.nevis.exampleapp.coroutines.ui.selectAccount import ch.nevis.mobile.sdk.api.localdata.Account - /** - * Interface declaration of a listener that is used by [AccountsRecyclerViewAdapter] to notify the implementations - * of this interface about account selection. + * Interface declaration of a listener that is used by [AccountsRecyclerViewAdapter] to notify the + * implementations of this interface about account selection. */ interface AccountSelectedListener { @@ -21,4 +20,4 @@ interface AccountSelectedListener { * @param account The selected account. */ fun onAccountSelected(account: Account) -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAccount/AccountsRecyclerViewAdapter.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAccount/AccountsRecyclerViewAdapter.kt index 03654d1..e01e892 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAccount/AccountsRecyclerViewAdapter.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAccount/AccountsRecyclerViewAdapter.kt @@ -13,28 +13,28 @@ import ch.nevis.exampleapp.coroutines.databinding.ItemAccountBinding import ch.nevis.mobile.sdk.api.localdata.Account /** - * An implementation of [RecyclerView.Adapter] abstract class that renders [Account] objects into recycler items. + * An implementation of [RecyclerView.Adapter] abstract class that renders [Account] objects into + * recycler items. + * + * @constructor Creates a new instance. + * @param accounts An [Array] that holds accounts those will be rendered by this adapter. + * @param accountSelectedListener Reference for the listener implementation that will be notified about + * account selection. */ class AccountsRecyclerViewAdapter( - - /** - * An [Array] that holds accounts those will be rendered by this adapter. - */ private val accounts: Array, - - /** - * Reference for the listener implementation that will be notified about account selection. - */ private val accountSelectedListener: AccountSelectedListener ) : RecyclerView.Adapter() { //region RecyclerView.Adapter + /** @suppress */ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AccountViewHolder { val binding = ItemAccountBinding.inflate(LayoutInflater.from(parent.context), parent, false) return AccountViewHolder(binding) } + /** @suppress */ override fun onBindViewHolder(holder: AccountViewHolder, position: Int) { holder.binding.accountSelectedListener = accountSelectedListener accounts[position].let { account: Account -> @@ -42,13 +42,17 @@ class AccountsRecyclerViewAdapter( } } + /** @suppress */ override fun getItemCount() = accounts.size //endregion //region AccountViewHolder /** * A [RecyclerView.ViewHolder] implementation that represents an account. + * + * @constructor Creates a new instance. + * @param binding The binding. */ class AccountViewHolder(val binding: ItemAccountBinding) : RecyclerView.ViewHolder(binding.root) //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAccount/SelectAccountFragment.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAccount/SelectAccountFragment.kt index e485027..b1cf3f3 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAccount/SelectAccountFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAccount/SelectAccountFragment.kt @@ -22,6 +22,8 @@ import dagger.hilt.android.AndroidEntryPoint /** * [androidx.fragment.app.Fragment] implementation of Select Account view where the user * can one of her/his registered accounts for an operation. + * + * @constructor Creates a new instance. */ @AndroidEntryPoint class SelectAccountFragment : ResponseObserverFragment(), @@ -51,6 +53,7 @@ class SelectAccountFragment : ResponseObserverFragment(), //endregion //region Fragment + /** @suppress */ override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -59,6 +62,7 @@ class SelectAccountFragment : ResponseObserverFragment(), return binding.root } + /** @suppress */ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) val context = context ?: return @@ -76,6 +80,7 @@ class SelectAccountFragment : ResponseObserverFragment(), ) } + /** @suppress */ override fun onDestroyView() { super.onDestroyView() _binding = null @@ -90,4 +95,4 @@ class SelectAccountFragment : ResponseObserverFragment(), ) } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAccount/SelectAccountViewModel.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAccount/SelectAccountViewModel.kt index be111da..c5fa4f8 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAccount/SelectAccountViewModel.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAccount/SelectAccountViewModel.kt @@ -19,35 +19,23 @@ import javax.inject.Named /** * View model implementation for Select Account view. + * + * @constructor Creates a new instance. + * @param startChangePinUseCase An instance of a [StartChangePinUseCase] implementation. + * @param startChangePasswordUseCase An instance of a [StartChangePasswordUseCase] implementation. + * @param inBandAuthenticationUseCase An instance of an [InBandAuthenticationUseCase] implementation. + * @param inBandAuthenticationForDeregistrationUseCase An instance of a [InBandAuthenticationUseCase] + * implementation for the cases deregistration must be started right after a successful in-band authentication. + * @param selectAccountUseCase An instance of a [SelectAccountUseCase] implementation. */ @HiltViewModel class SelectAccountViewModel @Inject constructor( - /** - * An instance of a [StartChangePinUseCase] implementation. - */ private val startChangePinUseCase: StartChangePinUseCase, - - /** - * An instance of a [StartChangePasswordUseCase] implementation. - */ private val startChangePasswordUseCase: StartChangePasswordUseCase, - - /** - * An instance of a [InBandAuthenticationUseCase] implementation. - */ @Named(ApplicationModule.IN_BAND_AUTHENTICATION_USE_CASE_DEFAULT) private val inBandAuthenticationUseCase: InBandAuthenticationUseCase, - - /** - * An instance of a [InBandAuthenticationUseCase] implementation for the cases deregistration - * must be started right after a successful in-band authentication. - */ @Named(ApplicationModule.IN_BAND_AUTHENTICATION_USE_CASE_FOR_DEREGISTRATION) private val inBandAuthenticationForDeregistrationUseCase: InBandAuthenticationUseCase, - - /** - * An instance of a [SelectAccountUseCase] implementation. - */ private val selectAccountUseCase: SelectAccountUseCase ) : CancellableOperationViewModel() { diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAccount/parameter/SelectAccountNavigationParameter.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAccount/parameter/SelectAccountNavigationParameter.kt index 30f4b1b..15047f7 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAccount/parameter/SelectAccountNavigationParameter.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAccount/parameter/SelectAccountNavigationParameter.kt @@ -14,6 +14,10 @@ import kotlinx.parcelize.Parcelize /** * Navigation parameter class for Select Account view. + * + * @constructor Creates a new instance. + * @param operation The operation type the account was selection requested for. + * @param accounts The list of available accounts the user can select from. */ @Parcelize data class SelectAccountNavigationParameter( @@ -28,4 +32,4 @@ data class SelectAccountNavigationParameter( */ @IgnoredOnParcel val accounts: Set? = null -) : Parcelable \ No newline at end of file +) : Parcelable diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAuthenticator/AuthenticatorSelectedListener.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAuthenticator/AuthenticatorSelectedListener.kt index 3e1ea10..4a2436b 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAuthenticator/AuthenticatorSelectedListener.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAuthenticator/AuthenticatorSelectedListener.kt @@ -6,10 +6,9 @@ package ch.nevis.exampleapp.coroutines.ui.selectAuthenticator - /** - * Interface declaration of a listener that is used by [AuthenticatorsRecyclerViewAdapter] to notify the implementations - * of this interface about authentication selection. + * Interface declaration of a listener that is used by [AuthenticatorsRecyclerViewAdapter] to notify + * the implementations of this interface about authentication selection. */ interface AuthenticatorSelectedListener { @@ -19,4 +18,4 @@ interface AuthenticatorSelectedListener { * @param aaid The AAID of selected authenticator. */ fun onAuthenticatorSelected(aaid: String) -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAuthenticator/AuthenticatorsRecyclerViewAdapter.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAuthenticator/AuthenticatorsRecyclerViewAdapter.kt index 1432eb9..1fe5496 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAuthenticator/AuthenticatorsRecyclerViewAdapter.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAuthenticator/AuthenticatorsRecyclerViewAdapter.kt @@ -15,28 +15,28 @@ import ch.nevis.exampleapp.coroutines.ui.selectAuthenticator.model.Authenticator import ch.nevis.mobile.sdk.api.localdata.Authenticator /** - * An implementation of [RecyclerView.Adapter] abstract class that renders [Authenticator] objects into recycler items. + * An implementation of [RecyclerView.Adapter] abstract class that renders [Authenticator] objects + * into recycler items. + * + * @constructor Creates a new instance. + * @param authenticatorItems An [Array] that holds authenticator items those will be rendered by this adapter. + * @param authenticatorSelectedListener Reference for the listener implementation that will be notified + * about authenticator selection. */ class AuthenticatorsRecyclerViewAdapter( - - /** - * An [Array] that holds authenticator items those will be rendered by this adapter. - */ private val authenticatorItems: Array, - - /** - * Reference for the listener implementation that will be notified about authenticator selection. - */ private val authenticatorSelectedListener: AuthenticatorSelectedListener ) : RecyclerView.Adapter() { //region RecyclerView.Adapter + /** @suppress */ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AuthenticatorViewHolder { val binding = ItemAuthenticatorBinding.inflate(LayoutInflater.from(parent.context), parent, false) return AuthenticatorViewHolder(binding) } + /** @suppress */ override fun onBindViewHolder(holder: AuthenticatorViewHolder, position: Int) { holder.binding.authenticatorSelectedListener = authenticatorSelectedListener val authenticatorItem = authenticatorItems[position] @@ -58,14 +58,18 @@ class AuthenticatorsRecyclerViewAdapter( } } + /** @suppress */ override fun getItemCount() = authenticatorItems.size //endregion //region AuthenticatorViewHolder /** * A [RecyclerView.ViewHolder] implementation that represents a authenticator. + * + * @constructor Creates a new instance. + * @param binding The binding. */ class AuthenticatorViewHolder(val binding: ItemAuthenticatorBinding) : RecyclerView.ViewHolder(binding.root) //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAuthenticator/SelectAuthenticatorFragment.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAuthenticator/SelectAuthenticatorFragment.kt index 32ddc43..6dfa58c 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAuthenticator/SelectAuthenticatorFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAuthenticator/SelectAuthenticatorFragment.kt @@ -24,6 +24,8 @@ import dagger.hilt.android.AndroidEntryPoint * This view renders the available authenticators as a list and the user * can select one of them. The selected authenticator will be sent back * to previous view in the backstack. + * + * @constructor Creates a new instance. */ @AndroidEntryPoint class SelectAuthenticatorFragment : ResponseObserverFragment(), @@ -53,6 +55,7 @@ class SelectAuthenticatorFragment : ResponseObserverFragment(), //endregion //region Fragment + /** @suppress */ override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -61,6 +64,7 @@ class SelectAuthenticatorFragment : ResponseObserverFragment(), return binding.root } + /** @suppress */ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) val context = context ?: return @@ -78,6 +82,7 @@ class SelectAuthenticatorFragment : ResponseObserverFragment(), ) } + /** @suppress */ override fun onDestroyView() { super.onDestroyView() _binding = null @@ -89,4 +94,4 @@ class SelectAuthenticatorFragment : ResponseObserverFragment(), viewModel.selectAuthenticator(aaid) } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAuthenticator/SelectAuthenticatorViewModel.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAuthenticator/SelectAuthenticatorViewModel.kt index 6dbc3c3..84bf760 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAuthenticator/SelectAuthenticatorViewModel.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAuthenticator/SelectAuthenticatorViewModel.kt @@ -15,12 +15,12 @@ import javax.inject.Inject /** * View model implementation for Select Authenticator view. + * + * @constructor Creates a new instance. An instance of a [SelectAuthenticatorUseCase] implementation. + * @param selectAuthenticatorUseCase */ @HiltViewModel class SelectAuthenticatorViewModel @Inject constructor( - /** - * An instance of a [SelectAuthenticatorUseCase] implementation. - */ private val selectAuthenticatorUseCase: SelectAuthenticatorUseCase ) : CancellableOperationViewModel() { @@ -37,4 +37,4 @@ class SelectAuthenticatorViewModel @Inject constructor( } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAuthenticator/model/AuthenticatorItem.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAuthenticator/model/AuthenticatorItem.kt index d4ae5d0..0334b4f 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAuthenticator/model/AuthenticatorItem.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAuthenticator/model/AuthenticatorItem.kt @@ -12,6 +12,11 @@ import ch.nevis.mobile.sdk.api.localdata.Authenticator /** * Represents an authenticator that is listed and can be selected by the user on select authenticator view. * + * @constructor Creates a new instance. + * @param aaid The AAID of the authenticator. + * @param isPolicyCompliant The flag that tells whether the authenticator is server policy compliant. + * @param isUserEnrolled The flag that tells whether the user already enrolled the authenticator. + * @param titleResId String resource identifier of the title of the authenticator. * @throws IllegalArgumentException when an unknown AAID is used. */ data class AuthenticatorItem( diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAuthenticator/parameter/SelectAuthenticatorNavigationParameter.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAuthenticator/parameter/SelectAuthenticatorNavigationParameter.kt index ce56d50..314500c 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAuthenticator/parameter/SelectAuthenticatorNavigationParameter.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/selectAuthenticator/parameter/SelectAuthenticatorNavigationParameter.kt @@ -13,6 +13,9 @@ import kotlinx.parcelize.Parcelize /** * Navigation parameter data class for select authenticator view. + * + * @constructor Creates a new instance. + * @param authenticatorItems The list of available authenticator items the user can select from. */ @Parcelize data class SelectAuthenticatorNavigationParameter( @@ -21,4 +24,4 @@ data class SelectAuthenticatorNavigationParameter( */ @IgnoredOnParcel val authenticatorItems: Set? = null -) : Parcelable \ No newline at end of file +) : Parcelable diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/transactionConfirmation/TransactionConfirmationFragment.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/transactionConfirmation/TransactionConfirmationFragment.kt index 125a00a..182b357 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/transactionConfirmation/TransactionConfirmationFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/transactionConfirmation/TransactionConfirmationFragment.kt @@ -20,6 +20,8 @@ import dagger.hilt.android.AndroidEntryPoint /** * [androidx.fragment.app.Fragment] implementation of Transaction Confirmation view where the user * can allow or deny further processing of the operation based on the displayed transaction data. + * + * @constructor Creates a new instance. */ @AndroidEntryPoint class TransactionConfirmationFragment : ResponseObserverFragment() { @@ -43,6 +45,7 @@ class TransactionConfirmationFragment : ResponseObserverFragment() { //endregion //region Fragment + /** @suppress */ override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View { @@ -50,6 +53,7 @@ class TransactionConfirmationFragment : ResponseObserverFragment() { return binding.root } + /** @suppress */ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -73,9 +77,10 @@ class TransactionConfirmationFragment : ResponseObserverFragment() { ) } + /** @suppress */ override fun onDestroyView() { super.onDestroyView() _binding = null } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/transactionConfirmation/TransactionConfirmationViewModel.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/transactionConfirmation/TransactionConfirmationViewModel.kt index e2076b2..ab955bf 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/transactionConfirmation/TransactionConfirmationViewModel.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/transactionConfirmation/TransactionConfirmationViewModel.kt @@ -18,13 +18,12 @@ import javax.inject.Inject /** * View model implementation of Transaction Confirmation view. + * + * @constructor Creates a new instance. + * @param selectAccountUseCase An instance of a [SelectAccountUseCase] implementation. */ @HiltViewModel class TransactionConfirmationViewModel @Inject constructor( - - /** - * An instance of a [SelectAccountUseCase] implementation. - */ private val selectAccountUseCase: SelectAccountUseCase ) : CancellableOperationViewModel() { @@ -56,4 +55,4 @@ class TransactionConfirmationViewModel @Inject constructor( cancelOperation() } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/transactionConfirmation/parameter/TransactionConfirmationNavigationParameter.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/transactionConfirmation/parameter/TransactionConfirmationNavigationParameter.kt index 37b0a68..32ee175 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/transactionConfirmation/parameter/TransactionConfirmationNavigationParameter.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/transactionConfirmation/parameter/TransactionConfirmationNavigationParameter.kt @@ -14,6 +14,12 @@ import kotlinx.parcelize.Parcelize /** * Navigation parameter class for Transaction Confirmation view. + * + * @constructor Creates a new instance. + * @param operation The operation the account selection was requested for. + * @param accounts The list of available accounts the user can select from. + * @param transactionConfirmationData The transaction confirmation data/message that should be displayed + * on Transaction Confirmation view. */ @Parcelize data class TransactionConfirmationNavigationParameter( @@ -33,4 +39,4 @@ data class TransactionConfirmationNavigationParameter( * The transaction confirmation data as a [String]. */ val transactionConfirmationData: String -) : Parcelable \ No newline at end of file +) : Parcelable diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/util/SingleLiveEvent.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/util/SingleLiveEvent.kt index 22cc3a4..08b4cba 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/util/SingleLiveEvent.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/util/SingleLiveEvent.kt @@ -15,6 +15,8 @@ import java.util.concurrent.atomic.AtomicBoolean */ class SingleLiveEvent : MutableLiveData() { private val mPending = AtomicBoolean(false) + + /** @suppress */ override fun observe(owner: LifecycleOwner, observer: Observer) { if (hasActiveObservers()) { Timber.w("Multiple observers registered but only one will be notified of changes.") @@ -28,6 +30,7 @@ class SingleLiveEvent : MutableLiveData() { }) } + /** @suppress */ @MainThread override fun setValue(t: T?) { mPending.set(true) @@ -41,4 +44,4 @@ class SingleLiveEvent : MutableLiveData() { fun call() { value = null } -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/verifyUser/VerifyUserFragment.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/verifyUser/VerifyUserFragment.kt index d2cd402..7a334b5 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/verifyUser/VerifyUserFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/verifyUser/VerifyUserFragment.kt @@ -26,6 +26,8 @@ import dagger.hilt.android.AndroidEntryPoint /** * Fragment implementation of Verify User view where the user can verify her-/himself with * fingerprint, face ID or device passcode. + * + * @constructor Creates a new instance. */ @AndroidEntryPoint class VerifyUserFragment : ResponseObserverFragment() { @@ -49,6 +51,7 @@ class VerifyUserFragment : ResponseObserverFragment() { //endregion //region Fragment + /** @suppress */ override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -57,6 +60,7 @@ class VerifyUserFragment : ResponseObserverFragment() { return binding.root } + /** @suppress */ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -94,6 +98,7 @@ class VerifyUserFragment : ResponseObserverFragment() { ) } + /** @suppress */ override fun onDestroyView() { super.onDestroyView() _binding = null @@ -113,4 +118,4 @@ class VerifyUserFragment : ResponseObserverFragment() { } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/verifyUser/VerifyUserViewModel.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/verifyUser/VerifyUserViewModel.kt index aaa2b0e..0f9a1fb 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/verifyUser/VerifyUserViewModel.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/verifyUser/VerifyUserViewModel.kt @@ -20,25 +20,23 @@ import javax.inject.Inject /** * View model implementation for Verify User view. + * + * @constructor Creates a new instance. + * @param verifyBiometricUseCase An instance of a [VerifyBiometricUseCase] implementation. + * @param verifyDevicePasscodeUseCase An instance of a [VerifyDevicePasscodeUseCase] implementation. + * @param verifyFingerprintUseCase An instance of a [VerifyFingerprintUseCase] implementation. */ @HiltViewModel class VerifyUserViewModel @Inject constructor( - /** - * An instance of a [VerifyBiometricUseCase] implementation. - */ private val verifyBiometricUseCase: VerifyBiometricUseCase, - - /** - * An instance of a [VerifyDevicePasscodeUseCase] implementation. - */ private val verifyDevicePasscodeUseCase: VerifyDevicePasscodeUseCase, - - /** - * An instance of a [VerifyFingerprintUseCase] implementation. - */ private val verifyFingerprintUseCase: VerifyFingerprintUseCase ) : CancellableOperationViewModel() { + //region Properties + /** + * The mode, the Verify User view intend to be used/initialized. + */ private lateinit var verifyUserViewMode: VerifyUserViewMode /** @@ -52,6 +50,7 @@ class VerifyUserViewModel @Inject constructor( * the dialog shown by the OS. */ private lateinit var devicePasscodePromptOptions: DevicePasscodePromptOptions + //endregion //region Public Interface /** @@ -126,4 +125,4 @@ class VerifyUserViewModel @Inject constructor( } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/verifyUser/parameter/VerifyUserNavigationParameter.kt b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/verifyUser/parameter/VerifyUserNavigationParameter.kt index db8da85..ecd56d2 100644 --- a/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/verifyUser/parameter/VerifyUserNavigationParameter.kt +++ b/app/src/main/java/ch/nevis/exampleapp/coroutines/ui/verifyUser/parameter/VerifyUserNavigationParameter.kt @@ -13,6 +13,10 @@ import kotlinx.parcelize.Parcelize /** * Navigation parameter data class for Verify User view. + * + * @constructor Creates a new instance. + * @param verifyUserViewMode The mode, the Verify User view intend to be used/initialized. + * @param authenticatorTitleResId String resource identifier of the title of the authenticator. */ @Parcelize data class VerifyUserNavigationParameter( diff --git a/build.gradle b/build.gradle index fe24db5..c2ef358 100644 --- a/build.gradle +++ b/build.gradle @@ -4,6 +4,9 @@ buildscript { ext.gradle_version = '7.3.1' ext.kotlin_version = "1.8.10" ext.navigation_version = "2.5.3" + ext.dokka_version = "1.9.20" + ext.customFooterMessage = "© 2024 made with ❤️ by Nevis" + ext.customLogoFile = projectDir.toString() + "/logo-style.css" repositories { google() @@ -15,9 +18,14 @@ buildscript { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "com.google.dagger:hilt-android-gradle-plugin:$dagger_hilt_version" classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigation_version" + classpath "org.jetbrains.dokka:dokka-gradle-plugin:${dokka_version}" } } +plugins { + id 'org.jetbrains.dokka' version "${dokka_version}" apply true +} + ext.getConfig = { String name -> File localPropertiesFile = project.rootProject.file('local.properties') if (localPropertiesFile?.exists()) { @@ -66,6 +74,78 @@ allprojects { } } +subprojects { + apply plugin: "org.jetbrains.dokka" + + tasks.named("dokkaHtml") { + moduleName.set("$rootProject.name-$project.name") + outputDirectory.set(file("build/dokka/$project.name")) + failOnWarning.set(false) + suppressInheritedMembers.set(true) + suppressObviousFunctions.set(true) + + dokkaSourceSets { + configureEach { + reportUndocumented.set(true) + includes.from("module.md") + externalDocumentationLink { + url.set(new URL("https://docs.nevis.net/mobilesdk/${getConfig("VERSION_NAME")}/api-references/javadoc/")) + packageListUrl.set(new URL("https://docs.nevis.net/mobilesdk/${getConfig("VERSION_NAME")}/api-references/javadoc/element-list")) + } + } + } + + pluginsMapConfiguration.set( + [ + "org.jetbrains.dokka.base.DokkaBase": """{ + "customStyleSheets": ["$customLogoFile"], + "footerMessage": "$customFooterMessage" + }""" + ] + ) + } + + tasks.named("dokkaHtmlPartial") { + moduleName.set("$rootProject.name-$project.name") + failOnWarning.set(false) + suppressInheritedMembers.set(true) + suppressObviousFunctions.set(true) + + dokkaSourceSets { + configureEach { + reportUndocumented.set(true) + includes.from("module.md") + externalDocumentationLink { + url.set(new URL("https://docs.nevis.net/mobilesdk/${getConfig("VERSION_NAME")}/api-references/javadoc/")) + packageListUrl.set(new URL("https://docs.nevis.net/mobilesdk/${getConfig("VERSION_NAME")}/api-references/javadoc/element-list")) + } + } + } + + pluginsMapConfiguration.set( + [ + "org.jetbrains.dokka.base.DokkaBase": """{ + "customStyleSheets": ["$customLogoFile"], + "footerMessage": "$customFooterMessage" + }""" + ] + ) + } +} + +afterEvaluate { + tasks.named("dokkaHtmlMultiModule") { + pluginsMapConfiguration.set( + [ + "org.jetbrains.dokka.base.DokkaBase": """{ + "customStyleSheets": ["$customLogoFile"], + "footerMessage": "$customFooterMessage" + }""" + ] + ) + } +} + tasks.register('clean', Delete) { delete rootProject.buildDir } diff --git a/logo-style.css b/logo-style.css new file mode 100644 index 0000000..b8ec749 --- /dev/null +++ b/logo-style.css @@ -0,0 +1,16 @@ +.library-name a { + position: relative; + --logo-width: 168px; + margin-left: calc(var(--logo-width) + 5px); +} + +.library-name a::before { + content: ''; + background: url("https://www.nevis.net/hubfs/Nevis/images/logotype.svg") center no-repeat #FFF; + background-size: contain; + position: absolute; + width: var(--logo-width); + height: 54px; + top: -16px; + left: calc(-1 * var(--logo-width) - 5px); +} diff --git a/settings.gradle b/settings.gradle index a7d5c11..6dcf56f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1,2 @@ -rootProject.name = "Nevis Mobile Authentication Example App" +rootProject.name = "nevis-mobile-authentication-example-coroutines" include ':app'