diff --git a/README.md b/README.md index baa8723..9562fe7 100644 --- a/README.md +++ b/README.md @@ -186,6 +186,17 @@ The application is written in [Kotlin](https://developer.android.com/kotlin). [Timber](https://github.com/JakeWharton/timber) is used to display logs describing the steps of the operations. The logs are presented to help understand the flow of the operations managed by the SDK. +### 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. @@ -248,4 +259,4 @@ The change Password operation is implemented in the [HomeViewModel](app/src/main During registration, the device information can be provided that contains the name identifying your device, and also the Firebase Cloud Messaging registration token. Updating both the name and the token is implemented in the [ChangeDeviceInformationViewModel](app/src/main/java/ch/nevis/exampleapp/ui/changeDeviceInformation/ChangeDeviceInformationViewModel.kt) class. -© 2023 made with ❤ by Nevis +© 2024 made with ❤ by Nevis diff --git a/app/build.gradle b/app/build.gradle index d3c1532..c473fda 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -107,4 +107,4 @@ dependencies { def retrofit_version = "2.9.0" implementation "com.squareup.retrofit2:retrofit:$retrofit_version" implementation "com.squareup.retrofit2:converter-gson:$retrofit_version" -} \ No newline at end of file +} diff --git a/app/module.md b/app/module.md new file mode 100644 index 0000000..2b72784 --- /dev/null +++ b/app/module.md @@ -0,0 +1,217 @@ +# Module nevis-mobile-authentication-example-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.application + +This package contains a sub-class of `Application` to enable Dagger Hilt capabilities and to initialize logging. + +# Package ch.nevis.exampleapp.common.configuration + +This package contains the configuration possibilities of the Nevis Mobile Authentication SDK. + +# Package ch.nevis.exampleapp.common.error + +This package contains the error handling related classes. + +# Package ch.nevis.exampleapp.common.settings + +This package contains the application settings possibilities. + +# Package ch.nevis.exampleapp.dagger + +This package contains the main Dagger Hilt configuration module. + +# Package ch.nevis.exampleapp.domain.client + +This package contains the `MobileAuthenticationClient` provider. + +# Package ch.nevis.exampleapp.domain.deviceInformation + +This package contains the `DeviceInformation` factory. + +# Package ch.nevis.exampleapp.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.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.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.domain.log + +This package contains logging related implementations. + +# Package ch.nevis.exampleapp.domain.model.error + +This package contains error handling related model definitions. + +# Package ch.nevis.exampleapp.domain.model.operation + +This package contains operation related model definitions. + +# Package ch.nevis.exampleapp.domain.model.sdk + +This package contains Nevis Mobile Authentication SDK related model definitions. + +# Package ch.nevis.exampleapp.domain.util + +This package contains Nevis Mobile Authentication SDK related extension definitions. + +# Package ch.nevis.exampleapp.domain.validation + +This package contains validation related logic. + +# Package ch.nevis.exampleapp.logging + +This package contains the `Timber` logging framework integration. + +# Package ch.nevis.exampleapp.retrofit + +This package contains the `Retrofit` networking framework integration. + +# Package ch.nevis.exampleapp.retrofit.model + +This package contains the `Retrofit` model definitions. + +# Package ch.nevis.exampleapp.ui.authCloudRegistration + +This package contains the view and view model definitions for the Auth Cloud API Registration operation. + +# Package ch.nevis.exampleapp.ui.base + +This package contains the base view and view model definitions. + +# Package ch.nevis.exampleapp.ui.base.model + +This package contains the base navigation parameter and view data definitions. + +# Package ch.nevis.exampleapp.ui.changeDeviceInformation + +This package contains the view and view model definitions for the Change Device Information operation. + +# Package ch.nevis.exampleapp.ui.changeDeviceInformation.model + +This package contains the model definitions for the Change Device Information operation. + +# Package ch.nevis.exampleapp.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.ui.credential.model + +This package contains the model definitions for credential related operations. + +# Package ch.nevis.exampleapp.ui.credential.parameter + +This package contains the navigation parameter definitions for credential related operations. + +# Package ch.nevis.exampleapp.ui.error + +This package contains the view definition for error handling. + +# Package ch.nevis.exampleapp.ui.error.parameter + +This package contains the navigation parameter definitions for error handling. + +# Package ch.nevis.exampleapp.ui.home + +This package contains the view and view model definitions for the Home feature. + +# Package ch.nevis.exampleapp.ui.home.model + +This package contains the model definitions for the Home feature. + +# Package ch.nevis.exampleapp.ui.main + +This package contains the main activity and view model definitions. + +# Package ch.nevis.exampleapp.ui.navigation + +This package contains the navigation implementation. + +# Package ch.nevis.exampleapp.ui.outOfBand + +This package contains the base view model definition for Out-of-Band operations. + +# Package ch.nevis.exampleapp.ui.qrReader + +This package contains the view and view model definitions for Qr Code reading. + +# Package ch.nevis.exampleapp.ui.result + +This package contains the view definition for displaying operation result. + +# Package ch.nevis.exampleapp.ui.result.parameter + +This package contains the navigation parameter definitions for displaying operation result. + +# Package ch.nevis.exampleapp.ui.selectAccount + +This package contains the view and view model definitions for account selection. + +# Package ch.nevis.exampleapp.ui.selectAccount.parameter + +This package contains the navigation parameter definitions for account selection. + +# Package ch.nevis.exampleapp.ui.selectAuthenticator + +This package contains the view and view model definitions for authenticator selection. + +# Package ch.nevis.exampleapp.ui.selectAuthenticator.model + +This package contains the model definitions for authenticator selection. + +# Package ch.nevis.exampleapp.ui.selectAuthenticator.parameter + +This package contains the navigation parameter definitions for authenticator selection. + +# Package ch.nevis.exampleapp.ui.transactionConfirmation + +This package contains the view and view model definitions for transaction confirmation. + +# Package ch.nevis.exampleapp.ui.transactionConfirmation.model + +This package contains the model definitions for transaction confirmation. + +# Package ch.nevis.exampleapp.ui.transactionConfirmation.parameter + +This package contains the navigation parameter definitions for transaction confirmation. + +# Package ch.nevis.exampleapp.ui.userNamePasswordLogin + +This package contains the view and view model definitions for In-Band Registration operation. + +# Package ch.nevis.exampleapp.ui.util + +This package contains utility methods. + +# Package ch.nevis.exampleapp.ui.verifyUser + +This package contains the view and view model definitions for user verification. + +# Package ch.nevis.exampleapp.ui.verifyUser.model + +This package contains the model definitions for user verification. + +# Package ch.nevis.exampleapp.ui.verifyUser.parameter + +This package contains the navigation parameter definitions for user verification. diff --git a/app/src/main/java/ch/nevis/exampleapp/application/ExampleApplication.kt b/app/src/main/java/ch/nevis/exampleapp/application/ExampleApplication.kt index db9eb34..2ee4a70 100644 --- a/app/src/main/java/ch/nevis/exampleapp/application/ExampleApplication.kt +++ b/app/src/main/java/ch/nevis/exampleapp/application/ExampleApplication.kt @@ -26,6 +26,7 @@ class ExampleApplication : Application() { lateinit var sdkLogger: SdkLogger //region Application + /** @suppress */ override fun onCreate() { super.onCreate() diff --git a/app/src/main/java/ch/nevis/exampleapp/common/error/CancelErrorHandlerImpl.kt b/app/src/main/java/ch/nevis/exampleapp/common/error/CancelErrorHandlerImpl.kt index 9b31b6e..2077a28 100644 --- a/app/src/main/java/ch/nevis/exampleapp/common/error/CancelErrorHandlerImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/common/error/CancelErrorHandlerImpl.kt @@ -17,11 +17,11 @@ import timber.log.Timber /** * Implementation of [ErrorHandler] interface for cases the user cancels an operation. + * + * @constructor Creates a new instance. + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. */ class CancelErrorHandlerImpl( - /** - * An instance of a [NavigationDispatcher] interface implementation. - */ private val navigationDispatcher: NavigationDispatcher ) : ErrorHandler { diff --git a/app/src/main/java/ch/nevis/exampleapp/common/error/ChainErrorHandlerImpl.kt b/app/src/main/java/ch/nevis/exampleapp/common/error/ChainErrorHandlerImpl.kt index 5ef5618..9c0fd62 100644 --- a/app/src/main/java/ch/nevis/exampleapp/common/error/ChainErrorHandlerImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/common/error/ChainErrorHandlerImpl.kt @@ -9,14 +9,14 @@ package ch.nevis.exampleapp.common.error /** * Main implementation of the [ErrorHandler] interface that can delegate the handling of the errors to * other configured [ErrorHandler] instances. + * + * @constructor Creates a new instance. + * @param errorHandlerChain A [List] of [ErrorHandler] instances those can handle or bypass the given + * error when [ErrorHandler.handle] is called. If the error is handled by an + * [ErrorHandler], the error processing will be ended, the error will not be delegated to further + * elements of the chain. */ class ChainErrorHandlerImpl( - - /** - * A [List] of [ErrorHandler] instances those can handle or bypass the given error when - * [ErrorHandler.handle] is called. If the error is handled by an [ErrorHandler], the error - * processing will be ended, the error will not be delegated to further elements of the chain. - */ private val errorHandlerChain: List ) : ErrorHandler { @@ -31,4 +31,4 @@ class ChainErrorHandlerImpl( return true } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/common/error/DefaultErrorHandlerImpl.kt b/app/src/main/java/ch/nevis/exampleapp/common/error/DefaultErrorHandlerImpl.kt index ab09a3c..89f5175 100644 --- a/app/src/main/java/ch/nevis/exampleapp/common/error/DefaultErrorHandlerImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/common/error/DefaultErrorHandlerImpl.kt @@ -18,16 +18,13 @@ 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 navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. */ class DefaultErrorHandlerImpl( - /** - * An Android [Context] object for [String] resource resolving. - */ private val context: Context, - - /** - * An instance of a [NavigationDispatcher] interface implementation. - */ private val navigationDispatcher: NavigationDispatcher ) : ErrorHandler { @@ -73,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/common/settings/Settings.kt b/app/src/main/java/ch/nevis/exampleapp/common/settings/Settings.kt index 3813f75..4c4f4f8 100644 --- a/app/src/main/java/ch/nevis/exampleapp/common/settings/Settings.kt +++ b/app/src/main/java/ch/nevis/exampleapp/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/common/settings/SettingsImpl.kt b/app/src/main/java/ch/nevis/exampleapp/common/settings/SettingsImpl.kt index f5abaf4..012b7f8 100644 --- a/app/src/main/java/ch/nevis/exampleapp/common/settings/SettingsImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/common/settings/SettingsImpl.kt @@ -13,11 +13,11 @@ import javax.inject.Inject /** * Default implementation of [Settings] interface. + * + * @constructor Creates a new instance. + * @param context The Android [Context]. */ class SettingsImpl @Inject constructor( - /** - * The Android [Context]. - */ @ApplicationContext private val context: Context ) : Settings { diff --git a/app/src/main/java/ch/nevis/exampleapp/dagger/ApplicationModule.kt b/app/src/main/java/ch/nevis/exampleapp/dagger/ApplicationModule.kt index 14d2529..ab72dbf 100644 --- a/app/src/main/java/ch/nevis/exampleapp/dagger/ApplicationModule.kt +++ b/app/src/main/java/ch/nevis/exampleapp/dagger/ApplicationModule.kt @@ -67,6 +67,9 @@ import javax.inject.Singleton class ApplicationModule { //region Constants + /** + * Collection of constants. + */ companion object { /** * The unique name of authenticator selector implementation for Registration operation. @@ -81,6 +84,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 @@ -98,6 +107,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 @@ -120,6 +135,11 @@ class ApplicationModule { .build() } + /** + * Provides the list of allowed authenticators. + * + * @return The list of allowed authenticators. + */ @Provides fun provideAuthenticatorAllowlist(): List = listOf( PIN_AUTHENTICATOR_AAID, @@ -129,6 +149,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 = @@ -140,12 +166,24 @@ 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. + * + * @param context The Android [Context]. + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. + * @return The error handler. + */ @Provides @Singleton fun provideErrorHandler( @@ -160,36 +198,77 @@ class ApplicationModule { //endregion //region Navigator + /** + * Provides the navigation dispatcher. + * + * @return The navigation dispatcher. + */ @Provides @Singleton fun provideNavigator(): NavigationDispatcher = NavigationDispatcherImpl() //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() //endregion //region Interaction + /** + * Provides the biometric user verifier. + * + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. + * @return The biometric user verifier. + */ @Provides fun provideBiometricUserVerifier(navigationDispatcher: NavigationDispatcher): BiometricUserVerifier = BiometricUserVerifierImpl(navigationDispatcher) + /** + * Provides the device passcode user verifier. + * + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. + * @return The device passcode user verifier. + */ @Provides fun provideDevicePasscodeUserVerifier(navigationDispatcher: NavigationDispatcher): DevicePasscodeUserVerifier = DevicePasscodeUserVerifierImpl(navigationDispatcher) + /** + * Provides the fingerprint user verifier. + * + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. + * @return The fingerprint user verifier. + */ @Provides fun provideFingerprintUserVerifier(navigationDispatcher: NavigationDispatcher): FingerprintUserVerifier = FingerprintUserVerifierImpl(navigationDispatcher) + /** + * Provides the account selector. + * + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. + * @param errorHandler An instance of a [ErrorHandler] interface implementation. + * @return The account selector. + */ @Provides fun provideAccountSelector( navigationDispatcher: NavigationDispatcher, @@ -197,6 +276,15 @@ class ApplicationModule { ): AccountSelector = AccountSelectorImpl(navigationDispatcher, errorHandler) + /** + * Provides the authenticator selector for registration operation. + * + * @param configurationProvider An instance of a [ConfigurationProvider] interface implementation. + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. + * @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( @@ -213,6 +301,15 @@ class ApplicationModule { AuthenticatorSelectorOperation.REGISTRATION ) + /** + * Provides the authenticator selector for authentication operation. + * + * @param configurationProvider An instance of a [ConfigurationProvider] interface implementation. + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. + * @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( @@ -229,18 +326,42 @@ class ApplicationModule { AuthenticatorSelectorOperation.AUTHENTICATION ) + /** + * Provides the PIN changer. + * + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. + * @return The PIN changer. + */ @Provides fun providePinChanger(navigationDispatcher: NavigationDispatcher): PinChanger = PinChangerImpl(navigationDispatcher) + /** + * Provides the PIN enroller. + * + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. + * @return The PIN enroller. + */ @Provides fun providePinEnroller(navigationDispatcher: NavigationDispatcher): PinEnroller = PinEnrollerImpl(navigationDispatcher) + /** + * Provides the PIN user verifier. + * + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. + * @return The PIN user verifier. + */ @Provides fun providePinUserVerifier(navigationDispatcher: NavigationDispatcher): PinUserVerifier = PinUserVerifierImpl(navigationDispatcher) + /** + * Provides the Password changer. + * + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. + * @return The Password changer. + */ @Provides fun providePasswordChanger( passwordPolicy: PasswordPolicy, @@ -248,6 +369,12 @@ class ApplicationModule { ): PasswordChanger = PasswordChangerImpl(passwordPolicy, navigationDispatcher) + /** + * Provides the Password enroller. + * + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. + * @return The Password enroller. + */ @Provides fun providePasswordEnroller( passwordPolicy: PasswordPolicy, @@ -255,22 +382,45 @@ class ApplicationModule { ): PasswordEnroller = PasswordEnrollerImpl(passwordPolicy, navigationDispatcher) + /** + * Provides the Password user verifier. + * + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. + * @return The Password user verifier. + */ @Provides fun providePasswordUserVerifier(navigationDispatcher: NavigationDispatcher): PasswordUserVerifier = PasswordUserVerifierImpl(navigationDispatcher) + /** + * Provides the password policy. + * + * @param context The Android [Context]. + * @return The password policy. + */ @Provides fun providePasswordPolicy(@ApplicationContext context: Context): PasswordPolicy = PasswordPolicyImpl(context) //endregion //region Logger + /** + * Provides the sdk logger. + * + * @return The sdk logger. + */ @Provides @Singleton fun provideSdkLogger(): SdkLogger = SdkLoggerImpl() //endregion //region Factory + /** + * Provides the device information factory. + * + * @param context The Android [Context]. + * @return The device information factory. + */ @Provides @Singleton fun provideDeviceInformationFactory(@ApplicationContext context: Context): DeviceInformationFactory = @@ -278,6 +428,12 @@ class ApplicationModule { //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/domain/client/ClientProvider.kt b/app/src/main/java/ch/nevis/exampleapp/domain/client/ClientProvider.kt index 13b0e8f..7078299 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/client/ClientProvider.kt +++ b/app/src/main/java/ch/nevis/exampleapp/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/domain/client/ClientProviderImpl.kt b/app/src/main/java/ch/nevis/exampleapp/domain/client/ClientProviderImpl.kt index 4f3b6b0..eee37a0 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/client/ClientProviderImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/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/domain/deviceInformation/DeviceInformationFactory.kt b/app/src/main/java/ch/nevis/exampleapp/domain/deviceInformation/DeviceInformationFactory.kt index b1e0946..a3951eb 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/deviceInformation/DeviceInformationFactory.kt +++ b/app/src/main/java/ch/nevis/exampleapp/domain/deviceInformation/DeviceInformationFactory.kt @@ -18,4 +18,4 @@ interface DeviceInformationFactory { * @return The [DeviceInformation] instance. */ fun create(): DeviceInformation -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/domain/deviceInformation/DeviceInformationFactoryImpl.kt b/app/src/main/java/ch/nevis/exampleapp/domain/deviceInformation/DeviceInformationFactoryImpl.kt index e197380..3138f98 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/deviceInformation/DeviceInformationFactoryImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/domain/deviceInformation/DeviceInformationFactoryImpl.kt @@ -16,11 +16,11 @@ import java.util.* /** * Default implementation of [DeviceInformationFactory] interface. * It creates a new [DeviceInformation] using Android [Context] and returns it. + * + * @constructor Creates a new instance. + * @param context The Android [Context]. */ class DeviceInformationFactoryImpl( - /** - * The Android [Context]. - */ private val context: Context ) : DeviceInformationFactory { @@ -60,4 +60,4 @@ class DeviceInformationFactoryImpl( } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/domain/interaction/AccountSelectorImpl.kt b/app/src/main/java/ch/nevis/exampleapp/domain/interaction/AccountSelectorImpl.kt index bac1084..97f2fa7 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/interaction/AccountSelectorImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/domain/interaction/AccountSelectorImpl.kt @@ -25,22 +25,18 @@ import timber.log.Timber * transaction confirmation data received in the [AccountSelectionContext] object and decides * if the next step is transaction confirmation or account selection. As an addition it also showcases * how to skip account selection if the received account list set has only one element. + * + * @constructor Creates a new instance. + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. + * @param errorHandler An instance of an [ErrorHandler] interface implementation. */ class AccountSelectorImpl( - - /** - * An instance of a [NavigationDispatcher] interface implementation. - */ private val navigationDispatcher: NavigationDispatcher, - - /** - * An instance of an [ErrorHandler] interface implementation. Received errors will be passed to this error - * handler instance. - */ private val errorHandler: ErrorHandler ) : AccountSelector { //region AccountSelector + /** @suppress */ override fun selectAccount( context: AccountSelectionContext, handler: AccountSelectionHandler @@ -91,6 +87,12 @@ class AccountSelectorImpl( //endregion //region Private Interface + /** + * Validates the list of [Account]s. + * + * @param context The context containing the list of [Account]s. + * @return The list of valid [Account]s. + */ private fun validAccounts(context: AccountSelectionContext): Set { val validAccounts = mutableSetOf() context.authenticators().forEach { authenticator -> diff --git a/app/src/main/java/ch/nevis/exampleapp/domain/interaction/AuthenticatorSelectorImpl.kt b/app/src/main/java/ch/nevis/exampleapp/domain/interaction/AuthenticatorSelectorImpl.kt index fd01e30..0adba7a 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/interaction/AuthenticatorSelectorImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/domain/interaction/AuthenticatorSelectorImpl.kt @@ -39,33 +39,24 @@ enum class AuthenticatorSelectorOperation { /** * Default implementation of [AuthenticatorSelector] interface. + * + * @constructor Creates a new instance. + * @param configurationProvider An instance of a [ConfigurationProvider] interface implementation. + * @param navigationDispatcher An instance of a [NavigationDispatcher] 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( - /** - * An instance of a [ConfigurationProvider] implementation. - */ private val configurationProvider: ConfigurationProvider, - - /** - * An instance of a [NavigationDispatcher] interface implementation. - */ private val navigationDispatcher: NavigationDispatcher, - - /** - * 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 @@ -113,4 +104,5 @@ class AuthenticatorSelectorImpl( ) ) } + //endregion } diff --git a/app/src/main/java/ch/nevis/exampleapp/domain/interaction/BiometricUserVerifierImpl.kt b/app/src/main/java/ch/nevis/exampleapp/domain/interaction/BiometricUserVerifierImpl.kt index 41066b6..67c2f62 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/interaction/BiometricUserVerifierImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/domain/interaction/BiometricUserVerifierImpl.kt @@ -20,16 +20,16 @@ import timber.log.Timber /** * Default implementation of [BiometricUserVerifier] interface. It navigates to the Verify User * view with the received [BiometricUserVerificationHandler] object. + * + * @constructor Creates a new instance. + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. */ class BiometricUserVerifierImpl( - - /** - * An instance of a [NavigationDispatcher] interface implementation. - */ private val navigationDispatcher: NavigationDispatcher ) : BiometricUserVerifier { //region BiometricUserVerifier + /** @suppress */ override fun verifyBiometric( context: BiometricUserVerificationContext, handler: BiometricUserVerificationHandler @@ -46,6 +46,7 @@ class BiometricUserVerifierImpl( ) } + /** @suppress */ override fun onValidCredentialsProvided() { Timber.asTree() .sdk("Valid credentials provided during biometric verification.") diff --git a/app/src/main/java/ch/nevis/exampleapp/domain/interaction/DevicePasscodeUserVerifierImpl.kt b/app/src/main/java/ch/nevis/exampleapp/domain/interaction/DevicePasscodeUserVerifierImpl.kt index 211ce7e..87f2f0b 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/interaction/DevicePasscodeUserVerifierImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/domain/interaction/DevicePasscodeUserVerifierImpl.kt @@ -20,16 +20,16 @@ import timber.log.Timber /** * Default implementation of [DevicePasscodeUserVerifier] interface. It navigates to the Verify User * view with the received [DevicePasscodeUserVerificationHandler] object. + * + * @constructor Creates a new instance. + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. */ class DevicePasscodeUserVerifierImpl( - - /** - * An instance of a [NavigationDispatcher] interface implementation. - */ private val navigationDispatcher: NavigationDispatcher ) : DevicePasscodeUserVerifier { //region DevicePasscodeUserVerifier + /** @suppress */ override fun verifyDevicePasscode( context: DevicePasscodeUserVerificationContext, handler: DevicePasscodeUserVerificationHandler @@ -46,6 +46,7 @@ class DevicePasscodeUserVerifierImpl( ) } + /** @suppress */ override fun onValidCredentialsProvided() { Timber.asTree() .sdk("Valid credentials provided during device passcode verification.") diff --git a/app/src/main/java/ch/nevis/exampleapp/domain/interaction/FingerprintUserVerifierImpl.kt b/app/src/main/java/ch/nevis/exampleapp/domain/interaction/FingerprintUserVerifierImpl.kt index 7d1c457..8b4299d 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/interaction/FingerprintUserVerifierImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/domain/interaction/FingerprintUserVerifierImpl.kt @@ -20,16 +20,16 @@ import timber.log.Timber /** * Default implementation of [FingerprintUserVerifier] interface. It navigates to the Verify User * view with the received [FingerprintUserVerificationHandler] object. + * + * @constructor Creates a new instance. + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. */ class FingerprintUserVerifierImpl( - - /** - * An instance of a [NavigationDispatcher] interface implementation. - */ private val navigationDispatcher: NavigationDispatcher ) : FingerprintUserVerifier { //region FingerprintUserVerifier + /** @suppress */ override fun verifyFingerprint( context: FingerprintUserVerificationContext, handler: FingerprintUserVerificationHandler @@ -53,6 +53,7 @@ class FingerprintUserVerifierImpl( ) } + /** @suppress */ override fun onValidCredentialsProvided() { Timber.asTree() .sdk("Valid credentials provided during fingerprint verification.") diff --git a/app/src/main/java/ch/nevis/exampleapp/domain/interaction/OnErrorImpl.kt b/app/src/main/java/ch/nevis/exampleapp/domain/interaction/OnErrorImpl.kt index 0382203..0470ee7 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/interaction/OnErrorImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/domain/interaction/OnErrorImpl.kt @@ -16,16 +16,17 @@ import ch.nevis.mobile.sdk.api.util.Consumer * A [MobileAuthenticationClientError] specific implementation of [Consumer] interface that is used as * a general client error consumer. It accepts [MobileAuthenticationClientError] objects wraps them into * [MobileAuthenticationClientException] objects and passes them to the [ErrorHandler]. + * + * @constructor Creates a new instance. + * @param operation The ongoing [Operation]. + * @param errorHandler An instance of an [ErrorHandler] interface implementation. Received errors will + * be passed to this error handler instance. */ class OnErrorImpl( private val operation: Operation, - - /** - * An instance of an [ErrorHandler] interface implementation. Received errors will be passed to this error - * handler instance. - */ private val errorHandler: ErrorHandler ) : Consumer { + /** @suppress */ override fun accept(error: E) { errorHandler.handle( MobileAuthenticationClientException( @@ -34,4 +35,4 @@ class OnErrorImpl( ) ) } -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/domain/interaction/password/PasswordChangerImpl.kt b/app/src/main/java/ch/nevis/exampleapp/domain/interaction/password/PasswordChangerImpl.kt index 082df1e..5f8887f 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/interaction/password/PasswordChangerImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/domain/interaction/password/PasswordChangerImpl.kt @@ -21,20 +21,18 @@ import timber.log.Timber * Default implementation of [PasswordChanger] interface. Navigates to Credential view with the received * [PasswordChangeHandler], [ch.nevis.mobile.sdk.api.operation.password.PasswordAuthenticatorProtectionStatus] * and [ch.nevis.mobile.sdk.api.operation.password.PasswordChangeRecoverableError] objects. + * + * @constructor Creates a new instance. + * @param policy An instance of a [PasswordPolicy] interface implementation. + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. */ class PasswordChangerImpl( - /** - * An instance of a [PasswordPolicy] interface implementation. - */ private val policy: PasswordPolicy, - - /** - * An instance of a [NavigationDispatcher] interface implementation. - */ private val navigationDispatcher: NavigationDispatcher ) : PasswordChanger { //region PasswordChanger + /** @suppress */ override fun changePassword( context: PasswordChangeContext, handler: PasswordChangeHandler @@ -58,6 +56,7 @@ class PasswordChangerImpl( } // You can add custom password policy by overriding the `passwordPolicy` getter + /** @suppress */ override fun passwordPolicy(): PasswordPolicy = policy //endregion } diff --git a/app/src/main/java/ch/nevis/exampleapp/domain/interaction/password/PasswordEnrollerImpl.kt b/app/src/main/java/ch/nevis/exampleapp/domain/interaction/password/PasswordEnrollerImpl.kt index a56ba2a..06cfe66 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/interaction/password/PasswordEnrollerImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/domain/interaction/password/PasswordEnrollerImpl.kt @@ -21,20 +21,18 @@ import timber.log.Timber * Default implementation of [PasswordEnroller] interface. Navigates to Credential view with the * received [PasswordEnrollmentHandler] and [ch.nevis.mobile.sdk.api.operation.password.PasswordEnrollmentError] * objects. + * + * @constructor Creates a new instance. + * @param policy An instance of a [PasswordPolicy] interface implementation. + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. */ class PasswordEnrollerImpl( - /** - * An instance of a [PasswordPolicy] interface implementation. - */ private val policy: PasswordPolicy, - - /** - * An instance of a [NavigationDispatcher] interface implementation. - */ private val navigationDispatcher: NavigationDispatcher ) : PasswordEnroller { //region PasswordEnroller + /** @suppress */ override fun enrollPassword( context: PasswordEnrollmentContext, handler: PasswordEnrollmentHandler @@ -56,11 +54,13 @@ class PasswordEnrollerImpl( ) } + /** @suppress */ override fun onValidCredentialsProvided() { Timber.asTree().sdk("Valid credentials provided during Password enrollment.") } // You can add custom password policy by overriding the `passwordPolicy` getter + /** @suppress */ override fun passwordPolicy(): PasswordPolicy = policy //endregion } diff --git a/app/src/main/java/ch/nevis/exampleapp/domain/interaction/password/PasswordUserVerifierImpl.kt b/app/src/main/java/ch/nevis/exampleapp/domain/interaction/password/PasswordUserVerifierImpl.kt index b27267a..3b81aac 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/interaction/password/PasswordUserVerifierImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/domain/interaction/password/PasswordUserVerifierImpl.kt @@ -20,16 +20,16 @@ import timber.log.Timber * Default implementation of [PasswordUserVerifier] interface. Navigates to Credential view with the * received [PasswordUserVerificationHandler], [ch.nevis.mobile.sdk.api.operation.password.PasswordAuthenticatorProtectionStatus] * and [ch.nevis.mobile.sdk.api.operation.userverification.PasswordUserVerificationError] objects. + * + * @constructor Creates a new instance. + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. */ class PasswordUserVerifierImpl( - - /** - * An instance of a [NavigationDispatcher] interface implementation. - */ private val navigationDispatcher: NavigationDispatcher ) : PasswordUserVerifier { //region PasswordUserVerifier + /** @suppress */ override fun verifyPassword( context: PasswordUserVerificationContext, handler: PasswordUserVerificationHandler @@ -52,6 +52,7 @@ class PasswordUserVerifierImpl( ) } + /** @suppress */ override fun onValidCredentialsProvided() { Timber.asTree().sdk("Valid credentials provided during Password verification.") } diff --git a/app/src/main/java/ch/nevis/exampleapp/domain/interaction/pin/PinChangerImpl.kt b/app/src/main/java/ch/nevis/exampleapp/domain/interaction/pin/PinChangerImpl.kt index f597f3e..bb339e4 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/interaction/pin/PinChangerImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/domain/interaction/pin/PinChangerImpl.kt @@ -20,14 +20,16 @@ import timber.log.Timber * Default implementation of [PinChanger] interface. Navigates to Credential view with the received * [PinChangeHandler], [ch.nevis.mobile.sdk.api.operation.pin.PinAuthenticatorProtectionStatus] and * [ch.nevis.mobile.sdk.api.operation.pin.PinChangeRecoverableError] objects. + * + * @constructor Creates a new instance. + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. */ class PinChangerImpl( - - /** - * An instance of a [NavigationDispatcher] interface implementation. - */ private val navigationDispatcher: NavigationDispatcher ) : PinChanger { + + //region PinChanger + /** @suppress */ override fun changePin( context: PinChangeContext, handler: PinChangeHandler @@ -49,4 +51,5 @@ class PinChangerImpl( ) ) } + //endregion } diff --git a/app/src/main/java/ch/nevis/exampleapp/domain/interaction/pin/PinEnrollerImpl.kt b/app/src/main/java/ch/nevis/exampleapp/domain/interaction/pin/PinEnrollerImpl.kt index b06d879..14a56d0 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/interaction/pin/PinEnrollerImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/domain/interaction/pin/PinEnrollerImpl.kt @@ -19,16 +19,16 @@ import timber.log.Timber /** * Default implementation of [PinEnroller] interface. Navigates to Credential view with the received * [PinEnrollmentHandler] and [ch.nevis.mobile.sdk.api.operation.pin.PinEnrollmentError] objects. + * + * @constructor Creates a new instance. + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. */ class PinEnrollerImpl( - - /** - * An instance of a [NavigationDispatcher] interface implementation. - */ private val navigationDispatcher: NavigationDispatcher ) : PinEnroller { //region PinEnroller + /** @suppress */ override fun enrollPin( context: PinEnrollmentContext, handler: PinEnrollmentHandler @@ -50,6 +50,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/domain/interaction/pin/PinUserVerifierImpl.kt b/app/src/main/java/ch/nevis/exampleapp/domain/interaction/pin/PinUserVerifierImpl.kt index 2b3d67c..77f537e 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/interaction/pin/PinUserVerifierImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/domain/interaction/pin/PinUserVerifierImpl.kt @@ -20,16 +20,16 @@ import timber.log.Timber * Default implementation of [PinUserVerifier] interface. Navigates to Credential view with the received * [PinUserVerificationHandler], [ch.nevis.mobile.sdk.api.operation.pin.PinAuthenticatorProtectionStatus] and * [ch.nevis.mobile.sdk.api.operation.userverification.PinUserVerificationError] objects. + * + * @constructor Creates a new instance. + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. */ class PinUserVerifierImpl( - - /** - * An instance of a [NavigationDispatcher] interface implementation. - */ private val navigationDispatcher: NavigationDispatcher ) : PinUserVerifier { //region PinUserVerifier + /** @suppress */ override fun verifyPin( context: PinUserVerificationContext, handler: PinUserVerificationHandler @@ -52,6 +52,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/domain/log/LogItem.kt b/app/src/main/java/ch/nevis/exampleapp/domain/log/LogItem.kt index 5c4e62b..757b14a 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/log/LogItem.kt +++ b/app/src/main/java/ch/nevis/exampleapp/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/domain/log/SdkLogger.kt b/app/src/main/java/ch/nevis/exampleapp/domain/log/SdkLogger.kt index 9c7e811..d863987 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/log/SdkLogger.kt +++ b/app/src/main/java/ch/nevis/exampleapp/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/domain/log/SdkLoggerImpl.kt b/app/src/main/java/ch/nevis/exampleapp/domain/log/SdkLoggerImpl.kt index 70fefe5..b146164 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/log/SdkLoggerImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/domain/log/SdkLoggerImpl.kt @@ -10,7 +10,9 @@ import java.lang.ref.WeakReference import java.util.* /** - * Default implementation of [SdkLogger] interface. It simply stores the logged messages in an [ArrayList] object. + * Default implementation of [SdkLogger] interface. It stores the logged messages in an [ArrayList] object. + * + * @constructor Creates a new instance. */ class SdkLoggerImpl: SdkLogger { diff --git a/app/src/main/java/ch/nevis/exampleapp/domain/model/error/BusinessException.kt b/app/src/main/java/ch/nevis/exampleapp/domain/model/error/BusinessException.kt index 8f64594..db93617 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/model/error/BusinessException.kt +++ b/app/src/main/java/ch/nevis/exampleapp/domain/model/error/BusinessException.kt @@ -12,6 +12,9 @@ import ch.nevis.exampleapp.R * Enumeration of business exception types. */ enum class BusinessExceptionType( + /** + * The resource identifier used for the description. + */ val resId: Int ) { @@ -60,6 +63,9 @@ class BusinessException private constructor( */ val type: BusinessExceptionType ) : Exception() { + /** + * Collection of available [BusinessException] types. + */ companion object { /** diff --git a/app/src/main/java/ch/nevis/exampleapp/domain/model/error/MobileAuthenticationClientException.kt b/app/src/main/java/ch/nevis/exampleapp/domain/model/error/MobileAuthenticationClientException.kt index 6edd42d..b62d717 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/model/error/MobileAuthenticationClientException.kt +++ b/app/src/main/java/ch/nevis/exampleapp/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/domain/model/operation/Operation.kt b/app/src/main/java/ch/nevis/exampleapp/domain/model/operation/Operation.kt index 4613582..ee08aa7 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/model/operation/Operation.kt +++ b/app/src/main/java/ch/nevis/exampleapp/domain/model/operation/Operation.kt @@ -12,66 +12,69 @@ import ch.nevis.exampleapp.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/domain/model/sdk/PasswordAuthenticatorProtectionStatusLastAttemptFailedImpl.kt b/app/src/main/java/ch/nevis/exampleapp/domain/model/sdk/PasswordAuthenticatorProtectionStatusLastAttemptFailedImpl.kt index ba62994..6dfe944 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/model/sdk/PasswordAuthenticatorProtectionStatusLastAttemptFailedImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/domain/model/sdk/PasswordAuthenticatorProtectionStatusLastAttemptFailedImpl.kt @@ -10,12 +10,31 @@ import ch.nevis.mobile.sdk.api.operation.password.PasswordAuthenticatorProtectio /** * Implementation of [PasswordAuthenticatorProtectionStatus.LastAttemptFailed] interface. + * + * @constructor Creates a new instance. + * @param remainingRetries The number of remaining retries available. + * @param coolDownTimeInSeconds The time that must be passed before the user can try to provide credentials + * again. */ data class PasswordAuthenticatorProtectionStatusLastAttemptFailedImpl( + /** + * The number of remaining retries available. + */ val remainingRetries: Int, + + /** + * The time that must be passed before the user can try to provide credentials again. + * If the value is 0, it means that no cool-down is required, and that a new password can be provided + * immediately. + */ val coolDownTimeInSeconds: Long ) : PasswordAuthenticatorProtectionStatus.LastAttemptFailed { + + //region PasswordAuthenticatorProtectionStatus.LastAttemptFailed + /** @suppress */ override fun remainingRetries(): Int = remainingRetries + /** @suppress */ override fun coolDownTimeInSeconds(): Long = coolDownTimeInSeconds + //endregion } diff --git a/app/src/main/java/ch/nevis/exampleapp/domain/model/sdk/PinAuthenticatorProtectionStatusLastAttemptFailedImpl.kt b/app/src/main/java/ch/nevis/exampleapp/domain/model/sdk/PinAuthenticatorProtectionStatusLastAttemptFailedImpl.kt index 505e8c2..d91bcff 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/model/sdk/PinAuthenticatorProtectionStatusLastAttemptFailedImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/domain/model/sdk/PinAuthenticatorProtectionStatusLastAttemptFailedImpl.kt @@ -10,12 +10,31 @@ import ch.nevis.mobile.sdk.api.operation.pin.PinAuthenticatorProtectionStatus /** * Implementation of [PinAuthenticatorProtectionStatus.LastAttemptFailed] interface. + * + * @constructor Creates a new instance. + * @param remainingRetries The number of remaining retries available. + * @param coolDownTimeInSeconds The time that must be passed before the user can try to provide credentials + * again. */ data class PinAuthenticatorProtectionStatusLastAttemptFailedImpl( + /** + * The number of remaining retries available. + */ val remainingRetries: Int, + + /** + * The time that must be passed before the user can try to provide credentials again. + * If the value is 0, it means that no cool-down is required, and that a new password can be provided + * immediately. + */ val coolDownTimeInSeconds: Long ) : PinAuthenticatorProtectionStatus.LastAttemptFailed { + + //region PinAuthenticatorProtectionStatus.LastAttemptFailed + /** @suppress */ override fun remainingRetries(): Int = remainingRetries + /** @suppress */ override fun coolDownTimeInSeconds(): Long = coolDownTimeInSeconds + //endregion } diff --git a/app/src/main/java/ch/nevis/exampleapp/domain/validation/AuthenticatorValidatorImpl.kt b/app/src/main/java/ch/nevis/exampleapp/domain/validation/AuthenticatorValidatorImpl.kt index 7fddfa8..7fbef28 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/validation/AuthenticatorValidatorImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/domain/validation/AuthenticatorValidatorImpl.kt @@ -11,8 +11,11 @@ import ch.nevis.mobile.sdk.api.operation.selection.AuthenticatorSelectionContext /** * Default implementation of [AuthenticatorValidator] interface. + * + * @constructor Creates a new instance. */ class AuthenticatorValidatorImpl : AuthenticatorValidator { + //region AuthenticatorValidator override fun validateForRegistration( context: AuthenticatorSelectionContext, diff --git a/app/src/main/java/ch/nevis/exampleapp/domain/validation/PasswordPolicyImpl.kt b/app/src/main/java/ch/nevis/exampleapp/domain/validation/PasswordPolicyImpl.kt index d2b881a..63b33a8 100644 --- a/app/src/main/java/ch/nevis/exampleapp/domain/validation/PasswordPolicyImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/domain/validation/PasswordPolicyImpl.kt @@ -17,15 +17,16 @@ import ch.nevis.mobile.sdk.api.util.Consumer * Implementation of [PasswordPolicy] interface. * This policy validates the password entered by the user during registration or password changing, * and allows only password that are different from the string `password`. + * + * @constructor Creates a new instance. + * @param context An Android [Context] object for [String] resource resolving. */ class PasswordPolicyImpl( - /** - * An Android [Context] object for [String] resource resolving. - */ private val context: Context, ) : PasswordPolicy { //region PasswordPolicy + /** @suppress */ override fun validatePasswordForEnrollment( password: CharArray, onSuccess: Runnable, @@ -41,6 +42,7 @@ class PasswordPolicyImpl( } } + /** @suppress */ override fun validatePasswordForPasswordChange( password: CharArray, onSuccess: Runnable, @@ -58,7 +60,6 @@ class PasswordPolicyImpl( //endregion //region Private Interface - /** * Validates the password. * diff --git a/app/src/main/java/ch/nevis/exampleapp/logging/ExampleAppTimberDebugTree.kt b/app/src/main/java/ch/nevis/exampleapp/logging/ExampleAppTimberDebugTree.kt index 22d2be8..043685f 100644 --- a/app/src/main/java/ch/nevis/exampleapp/logging/ExampleAppTimberDebugTree.kt +++ b/app/src/main/java/ch/nevis/exampleapp/logging/ExampleAppTimberDebugTree.kt @@ -12,16 +12,18 @@ import timber.log.Timber /** * 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 ExampleAppTimberDebugTree( - - /** - * 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/retrofit/model/LoginEndPointResponse.kt b/app/src/main/java/ch/nevis/exampleapp/retrofit/model/LoginEndPointResponse.kt index 6dab9c9..1a6f027 100644 --- a/app/src/main/java/ch/nevis/exampleapp/retrofit/model/LoginEndPointResponse.kt +++ b/app/src/main/java/ch/nevis/exampleapp/retrofit/model/LoginEndPointResponse.kt @@ -8,6 +8,10 @@ package ch.nevis.exampleapp.retrofit.model /** * Data class that represents the JSON response of [ch.nevis.exampleapp.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/ui/authCloudRegistration/AuthCloudRegistrationFragment.kt b/app/src/main/java/ch/nevis/exampleapp/ui/authCloudRegistration/AuthCloudRegistrationFragment.kt index 31881df..3692d91 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/authCloudRegistration/AuthCloudRegistrationFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/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 : BaseFragment() { @@ -37,6 +39,7 @@ class AuthCloudRegistrationFragment : BaseFragment() { //endregion //region Fragment + /** @suppress */ override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -45,6 +48,7 @@ class AuthCloudRegistrationFragment : BaseFragment() { return binding.root } + /** @suppress */ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -56,9 +60,10 @@ class AuthCloudRegistrationFragment : BaseFragment() { } } + /** @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/ui/authCloudRegistration/AuthCloudRegistrationViewModel.kt b/app/src/main/java/ch/nevis/exampleapp/ui/authCloudRegistration/AuthCloudRegistrationViewModel.kt index de5f35b..a3f4024 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/authCloudRegistration/AuthCloudRegistrationViewModel.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/authCloudRegistration/AuthCloudRegistrationViewModel.kt @@ -30,64 +30,34 @@ import javax.inject.Named /** * View model implementation of Auth Cloud API Registration view. + * + * @constructor Creates a new instance. + * @param clientProvider An instance of a [ClientProvider] implementation. + * @param deviceInformationFactory An instance of a [DeviceInformationFactory] implementation. + * @param navigationDispatcher An instance of a [NavigationDispatcher] implementation. + * @param settings An instance of a [Settings] implementation. + * @param authenticatorSelector An instance of an [AuthenticatorSelector] interface implementation + * used during registration. + * @param pinEnroller An instance of a [PinEnroller] implementation. + * @param passwordEnroller An instance of a [PasswordEnroller] implementation. + * @param biometricUserVerifier An instance of a [BiometricUserVerifier] implementation. + * @param devicePasscodeUserVerifier An instance of a [DevicePasscodeUserVerifier] implementation. + * @param fingerprintUserVerifier An instance of a [FingerprintUserVerifier] implementation. + * @param errorHandler An instance of a [ErrorHandler] implementation. */ @HiltViewModel class AuthCloudRegistrationViewModel @Inject constructor( - /** - * An instance of a [ClientProvider] implementation. - */ private val clientProvider: ClientProvider, - - /** - * An instance of a [DeviceInformationFactory] implementation. - */ private val deviceInformationFactory: DeviceInformationFactory, - - /** - * An instance of a [NavigationDispatcher] interface implementation. - */ private val navigationDispatcher: NavigationDispatcher, - - /** - * An instance of a [Settings] interface implementation. - */ private val settings: Settings, - - /** - * An instance of an [AuthenticatorSelector] interface implementation used during registration. - */ @Named(ApplicationModule.REGISTRATION_AUTHENTICATOR_SELECTOR) private val authenticatorSelector: AuthenticatorSelector, - - /** - * An instance of a [PinEnroller] interface implementation. - */ private val pinEnroller: PinEnroller, - - /** - * An instance of a [PasswordEnroller] interface implementation. - */ private val passwordEnroller: PasswordEnroller, - - /** - * An instance of a [BiometricUserVerifier] interface implementation. - */ private val biometricUserVerifier: BiometricUserVerifier, - - /** - * An instance of a [DevicePasscodeUserVerifier] interface implementation. - */ private val devicePasscodeUserVerifier: DevicePasscodeUserVerifier, - - /** - * An instance of a [FingerprintUserVerifier] interface implementation. - */ private val fingerprintUserVerifier: FingerprintUserVerifier, - - /** - * An instance of an [ErrorHandler] interface implementation. Received errors will be passed to this error - * handler instance. - */ private val errorHandler: ErrorHandler ) : BaseViewModel() { diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/base/BaseFragment.kt b/app/src/main/java/ch/nevis/exampleapp/ui/base/BaseFragment.kt index b8650cf..57fd1e7 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/base/BaseFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/base/BaseFragment.kt @@ -33,10 +33,15 @@ import javax.inject.Inject * the view data was changed and the view must be updated. Once a [ViewData] is posted by the view model * the [BaseFragment.updateView] method is called and the view may run the necessary code that updates * the view. + * + * @constructor Creates a new instance. */ abstract class BaseFragment : Fragment() { //region Companion Object + /** + * Constants. + */ companion object { /** * Commonly used argument name that is used for navigation parameters during navigation. @@ -59,6 +64,7 @@ abstract class BaseFragment : Fragment() { //endregion //region Fragment + /** @suppress */ override fun onResume() { super.onResume() @@ -71,6 +77,7 @@ abstract class BaseFragment : Fragment() { } } + /** @suppress */ override fun onPause() { super.onPause() navigationDispatcher.unsubscribe(viewLifecycleOwner) diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/base/BaseViewModel.kt b/app/src/main/java/ch/nevis/exampleapp/ui/base/BaseViewModel.kt index 0626d55..e07e828 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/base/BaseViewModel.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/base/BaseViewModel.kt @@ -16,10 +16,12 @@ import ch.nevis.exampleapp.ui.util.SingleLiveEvent * It provides a mechanism that ease the way how a view model may indicate to its owner view * that the view data was changed and the view should be updated based on the new [ViewData] object * that posted by the view model. + * + * @constructor Creates a new instance. */ abstract class BaseViewModel : ViewModel() { - //region Properties. + //region Properties /** * Private, mutable backing property of the public [LiveData] property. */ @@ -42,4 +44,4 @@ abstract class BaseViewModel : ViewModel() { _viewData.postValue(viewData) } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/base/CancelOperationOnBackPressedCallback.kt b/app/src/main/java/ch/nevis/exampleapp/ui/base/CancelOperationOnBackPressedCallback.kt index 7618498..b0732fa 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/base/CancelOperationOnBackPressedCallback.kt +++ b/app/src/main/java/ch/nevis/exampleapp/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/ui/changeDeviceInformation/ChangeDeviceInformationFragment.kt b/app/src/main/java/ch/nevis/exampleapp/ui/changeDeviceInformation/ChangeDeviceInformationFragment.kt index a1f42d6..51e8ad1 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/changeDeviceInformation/ChangeDeviceInformationFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/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 : BaseFragment() { @@ -39,6 +41,7 @@ class ChangeDeviceInformationFragment : BaseFragment() { //endregion //region Fragment + /** @suppress */ override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -47,6 +50,7 @@ class ChangeDeviceInformationFragment : BaseFragment() { return binding.root } + /** @suppress */ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -57,6 +61,7 @@ class ChangeDeviceInformationFragment : BaseFragment() { } } + /** @suppress */ override fun onDestroyView() { super.onDestroyView() _binding = null diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/changeDeviceInformation/ChangeDeviceInformationViewModel.kt b/app/src/main/java/ch/nevis/exampleapp/ui/changeDeviceInformation/ChangeDeviceInformationViewModel.kt index 1611bcc..00b41e0 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/changeDeviceInformation/ChangeDeviceInformationViewModel.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/changeDeviceInformation/ChangeDeviceInformationViewModel.kt @@ -21,23 +21,16 @@ import javax.inject.Inject /** * View model implementation of Change Device Information view. + * + * @constructor Creates a new instance. + * @param clientProvider An instance of a [ClientProvider] interface implementation. + * @param errorHandler An instance of an [ErrorHandler] interface implementation. + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. */ @HiltViewModel class ChangeDeviceInformationViewModel @Inject constructor( - /** - * An instance of a [ClientProvider] interface implementation. - */ private val clientProvider: ClientProvider, - - /** - * An instance of an [ErrorHandler] interface implementation. Received errors will be passed to this error - * handler instance. - */ private val errorHandler: ErrorHandler, - - /** - * An instance of a [NavigationDispatcher] interface implementation. - */ private val navigationDispatcher: NavigationDispatcher ) : BaseViewModel() { @@ -100,4 +93,4 @@ class ChangeDeviceInformationViewModel @Inject constructor( } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/changeDeviceInformation/model/ChangeDeviceInformationViewData.kt b/app/src/main/java/ch/nevis/exampleapp/ui/changeDeviceInformation/model/ChangeDeviceInformationViewData.kt index d8ecc05..affad5e 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/changeDeviceInformation/model/ChangeDeviceInformationViewData.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/changeDeviceInformation/model/ChangeDeviceInformationViewData.kt @@ -14,6 +14,9 @@ import ch.nevis.mobile.sdk.api.localdata.DeviceInformation * an instance of this [ChangeDeviceInformationViewData] class after the current [DeviceInformation] was queried * from the [ch.nevis.mobile.sdk.api.MobileAuthenticationClient] and posts it to the Change Device Information * view to indicate that the view related data changed the view should be updated. + * + * @constructor Creates a new instance. + * @param deviceInformation The current [DeviceInformation] was queried from the [ch.nevis.mobile.sdk.api.MobileAuthenticationClient]. */ data class ChangeDeviceInformationViewData( diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/credential/CredentialFragment.kt b/app/src/main/java/ch/nevis/exampleapp/ui/credential/CredentialFragment.kt index 4e31aef..05c55c6 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/credential/CredentialFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/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 enroll, change and verify credential (PIN or password). + * + * @constructor Creates a new instance. */ @AndroidEntryPoint class CredentialFragment : BaseFragment() { @@ -59,6 +61,7 @@ class CredentialFragment : BaseFragment() { //endregion //region Fragment + /** @suppress */ override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -67,6 +70,7 @@ class CredentialFragment : BaseFragment() { return binding.root } + /** @suppress */ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -98,6 +102,7 @@ class CredentialFragment : BaseFragment() { requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner, callback) } + /** @suppress */ override fun onDestroyView() { super.onDestroyView() _binding = null diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/credential/CredentialViewModel.kt b/app/src/main/java/ch/nevis/exampleapp/ui/credential/CredentialViewModel.kt index 183fe42..3333399 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/credential/CredentialViewModel.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/credential/CredentialViewModel.kt @@ -35,19 +35,15 @@ import javax.inject.Inject /** * View model implementation of Credential view. + * + * @constructor Creates a new instance. + * @param context An Android [Context] object for [String] resource resolving. + * @param errorHandler An instance of an [ErrorHandler] interface implementation. */ @HiltViewModel class CredentialViewModel @Inject constructor( - /** - * An Android [Context] object for [String] resource resolving. - */ @ApplicationContext private val context: Context, - - /** - * An instance of an [ErrorHandler] interface implementation. Received errors will be passed to - * this error handler instance. - */ private val errorHandler: ErrorHandler ) : CancellableOperationViewModel() { diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/credential/model/CredentialProtectionInformation.kt b/app/src/main/java/ch/nevis/exampleapp/ui/credential/model/CredentialProtectionInformation.kt index 407c15f..3bc6498 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/credential/model/CredentialProtectionInformation.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/credential/model/CredentialProtectionInformation.kt @@ -8,6 +8,12 @@ package ch.nevis.exampleapp.ui.credential.model /** * Represents the protection related information of a credential that is used by the Credential view. + * + * @constructor Creates a new instance. + * @param isLocked Specifies whether the given authenticator is locked. + * @param remainingRetries The number of remaining retries available. + * @param coolDownTime The time that must be passed before the user can try to provide credentials again. + * @param message The protection related message. */ data class CredentialProtectionInformation( /** diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/credential/model/CredentialViewData.kt b/app/src/main/java/ch/nevis/exampleapp/ui/credential/model/CredentialViewData.kt index c83f11f..710114e 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/credential/model/CredentialViewData.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/credential/model/CredentialViewData.kt @@ -17,6 +17,13 @@ import kotlinx.parcelize.IgnoredOnParcel * [ViewData] implementation for Credential view and its view model. The view model composes an instance * of this [CredentialViewData] class and posts it to the Credential view to indicate that the view related * data changed the view should be updated. + * + * @constructor Creates a new instance. + * @param credentialViewMode The mode, the Credential view intend to be used/initialized. + * @param credentialType The type of the credential. + * @param protectionInformation Authenticator protection information. + * @param lastRecoverableError The last recoverable error. It exists only if there was already a failed + * PIN or Password operation attempt. */ data class CredentialViewData( /** @@ -35,7 +42,8 @@ data class CredentialViewData( val protectionInformation: CredentialProtectionInformation?, /** - * The last recoverable error. It exists only if there was already a failed PIN operation attempt. + * The last recoverable error. It exists only if there was already a failed PIN or Password operation + * attempt. */ @IgnoredOnParcel val lastRecoverableError: RecoverableError? = null diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/credential/parameter/PasswordNavigationParameter.kt b/app/src/main/java/ch/nevis/exampleapp/ui/credential/parameter/PasswordNavigationParameter.kt index 2aec94f..c3cc1f2 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/credential/parameter/PasswordNavigationParameter.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/credential/parameter/PasswordNavigationParameter.kt @@ -17,17 +17,19 @@ 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. + * @param passwordChangeHandler An instance of a [PasswordChangeHandler] implementation. + * @param passwordEnrollmentHandler An instance of a [PasswordEnrollmentHandler] implementation. + * @param passwordUserVerificationHandler An instance of a [PasswordUserVerificationHandler] implementation. */ @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/ui/credential/parameter/PinNavigationParameter.kt b/app/src/main/java/ch/nevis/exampleapp/ui/credential/parameter/PinNavigationParameter.kt index d654fa9..927a179 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/credential/parameter/PinNavigationParameter.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/credential/parameter/PinNavigationParameter.kt @@ -17,17 +17,19 @@ 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. + * @param pinChangeHandler An instance of a [PinChangeHandler] implementation. + * @param pinEnrollmentHandler An instance of a [PinEnrollmentHandler] implementation. + * @param pinUserVerificationHandler An instance of a [PinUserVerificationHandler] implementation. */ @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/ui/error/ErrorFragment.kt b/app/src/main/java/ch/nevis/exampleapp/ui/error/ErrorFragment.kt index 7ad53a6..87bd29c 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/error/ErrorFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/error/ErrorFragment.kt @@ -24,6 +24,8 @@ import dagger.hilt.android.AndroidEntryPoint * This view shows the related error message in case of failed operations. * 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 ErrorFragment : Fragment() { @@ -42,6 +44,7 @@ class ErrorFragment : Fragment() { //endregion //region Fragment + /** @suppress */ override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -50,6 +53,7 @@ class ErrorFragment : Fragment() { return binding.root } + /** @suppress */ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -67,9 +71,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/ui/error/parameter/ErrorNavigationParameter.kt b/app/src/main/java/ch/nevis/exampleapp/ui/error/parameter/ErrorNavigationParameter.kt index 0d3f65e..811a4cc 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/error/parameter/ErrorNavigationParameter.kt +++ b/app/src/main/java/ch/nevis/exampleapp/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/ui/home/HomeFragment.kt b/app/src/main/java/ch/nevis/exampleapp/ui/home/HomeFragment.kt index d14eeb9..7954a26 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/home/HomeFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/home/HomeFragment.kt @@ -26,6 +26,8 @@ import dagger.hilt.android.AndroidEntryPoint * [androidx.fragment.app.Fragment] implementation of home view. This view is the start/home view of the application. * It can handle an out-of-band payload or Auth Cloud API registration, in-band authentication, * in-band registration. change PIN, change device information, or deregistration can be started from here. + * + * @constructor Creates a new instance. */ @AndroidEntryPoint class HomeFragment : BaseFragment() { @@ -44,6 +46,7 @@ class HomeFragment : BaseFragment() { //endregion //region Fragment + /** @suppress */ override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -52,6 +55,7 @@ class HomeFragment : BaseFragment() { return binding.root } + /** @suppress */ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) val navController = findNavController() @@ -97,11 +101,13 @@ class HomeFragment : BaseFragment() { } } + /** @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/ui/home/HomeViewModel.kt b/app/src/main/java/ch/nevis/exampleapp/ui/home/HomeViewModel.kt index 955e46f..bb5d274 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/home/HomeViewModel.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/home/HomeViewModel.kt @@ -52,106 +52,52 @@ import kotlin.coroutines.resume /** * View model implementation of Home view. + * + * @constructor Creates a new instance. + * @param context An Android [Context] object used for initializing [ch.nevis.mobile.sdk.api.MobileAuthenticationClient]. + * @param configurationProvider An instance of a [ConfigurationProvider] implementation. + * @param clientProvider An instance of a [ClientProvider] implementation. + * @param pinChanger An instance of a [PinChanger] implementation. + * @param passwordChanger An instance of a [PasswordChanger] implementation. + * @param navigationDispatcher An instance of a [NavigationDispatcher] implementation. + * @param settings An instance of a [Settings] implementation. + * @param deviceInformationFactory An instance of a [DeviceInformationFactory] implementation. + * @param accountSelector An instance of a [AccountSelector] implementation. + * @param registrationAuthenticatorSelector An instance of an [AuthenticatorSelector] interface implementation + * used during registration. + * @param authenticationAuthenticatorSelector An instance of an [AuthenticatorSelector] interface implementation + * used during authentication. + * @param pinEnroller An instance of a [PinEnroller] implementation. + * @param pinUserVerifier An instance of a [PinUserVerifier] implementation. + * @param passwordUserVerifier An instance of a [PasswordUserVerifier] implementation. + * @param biometricUserVerifier An instance of a [BiometricUserVerifier] implementation. + * @param devicePasscodeUserVerifier An instance of a [DevicePasscodeUserVerifier] implementation. + * @param fingerprintUserVerifier An instance of a [FingerprintUserVerifier] implementation. + * @param errorHandler An instance of a [ErrorHandler] implementation. */ @HiltViewModel class HomeViewModel @Inject constructor( - /** - * An Android [Context] object used for initializing [ch.nevis.mobile.sdk.api.MobileAuthenticationClient]. - */ @ApplicationContext private val context: Context, - - /** - * An instance of a [ConfigurationProvider] implementation. - */ private val configurationProvider: ConfigurationProvider, - - /** - * An instance of a [ClientProvider] implementation. - */ private val clientProvider: ClientProvider, - - /** - * An instance of a [PinChanger] interface implementation. - */ private val pinChanger: PinChanger, - - /** - * An instance of a [PasswordChanger] interface implementation. - */ private val passwordChanger: PasswordChanger, - - /** - * An instance of a [NavigationDispatcher] interface implementation. - */ private val navigationDispatcher: NavigationDispatcher, - - /** - * An instance of a [Settings] interface implementation. - */ settings: Settings, - - /** - * An instance of a [DeviceInformationFactory] implementation. - */ deviceInformationFactory: DeviceInformationFactory, - - /** - * An instance of an [AccountSelector] interface implementation. - */ accountSelector: AccountSelector, - - /** - * An instance of an [AuthenticatorSelector] interface implementation used during registration. - */ @Named(ApplicationModule.REGISTRATION_AUTHENTICATOR_SELECTOR) registrationAuthenticatorSelector: AuthenticatorSelector, - - /** - * An instance of an [AuthenticatorSelector] interface implementation used during authentication. - */ @Named(ApplicationModule.AUTHENTICATION_AUTHENTICATOR_SELECTOR) authenticationAuthenticatorSelector: AuthenticatorSelector, - - /** - * An instance of a [PinEnroller] interface implementation. - */ pinEnroller: PinEnroller, - - /** - * An instance of a [PasswordEnroller] interface implementation. - */ passwordEnroller: PasswordEnroller, - - /** - * An instance of a [PinUserVerifier] interface implementation. - */ pinUserVerifier: PinUserVerifier, - - /** - * An instance of a [PasswordUserVerifier] interface implementation. - */ passwordUserVerifier: PasswordUserVerifier, - - /** - * An instance of a [BiometricUserVerifier] interface implementation. - */ biometricUserVerifier: BiometricUserVerifier, - - /** - * An instance of a [DevicePasscodeUserVerifier] interface implementation. - */ devicePasscodeUserVerifier: DevicePasscodeUserVerifier, - - /** - * An instance of a [FingerprintUserVerifier] interface implementation. - */ fingerprintUserVerifier: FingerprintUserVerifier, - - /** - * An instance of an [ErrorHandler] interface implementation. Received errors will be passed to this error - * handler instance. - */ private val errorHandler: ErrorHandler ) : OutOfBandViewModel( clientProvider, diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/home/model/HomeViewData.kt b/app/src/main/java/ch/nevis/exampleapp/ui/home/model/HomeViewData.kt index 0d30e2d..37bebb5 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/home/model/HomeViewData.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/home/model/HomeViewData.kt @@ -13,6 +13,9 @@ import ch.nevis.exampleapp.ui.base.model.ViewData * an instance of this [HomeViewData] class after the [ch.nevis.mobile.sdk.api.MobileAuthenticationClient] * initialization and posts it to the Home view to indicate that the view related data changed the view * should be updated. + * + * @constructor Creates a new instance. + * @param numberOfRegisteredAccounts The number of registered accounts known by [ch.nevis.mobile.sdk.api.MobileAuthenticationClient]. */ data class HomeViewData( /** diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/main/LogRecyclerViewAdapter.kt b/app/src/main/java/ch/nevis/exampleapp/ui/main/LogRecyclerViewAdapter.kt index ba78cbe..04aa0c1 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/main/LogRecyclerViewAdapter.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/main/LogRecyclerViewAdapter.kt @@ -18,12 +18,14 @@ import ch.nevis.exampleapp.domain.log.LogItem import java.text.SimpleDateFormat /** - * An implementation of [RecyclerView.Adapter] abstract class that renders [LogItem] objects into recycler items. + * 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 +60,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 @@ -75,17 +79,19 @@ 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. + * 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) { @@ -102,4 +108,4 @@ class LogRecyclerViewAdapter( //endregion } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/main/MainActivityViewModel.kt b/app/src/main/java/ch/nevis/exampleapp/ui/main/MainActivityViewModel.kt index 83022f0..b60cb94 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/main/MainActivityViewModel.kt +++ b/app/src/main/java/ch/nevis/exampleapp/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/ui/navigation/NavigationDispatcherImpl.kt b/app/src/main/java/ch/nevis/exampleapp/ui/navigation/NavigationDispatcherImpl.kt index f4edf20..be014b5 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/navigation/NavigationDispatcherImpl.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/navigation/NavigationDispatcherImpl.kt @@ -13,6 +13,8 @@ import ch.nevis.exampleapp.ui.util.SingleLiveEvent /** * Default implementation of [NavigationDispatcher] interface. + * + * @constructor Creates a new instance. */ class NavigationDispatcherImpl : NavigationDispatcher { @@ -44,4 +46,4 @@ class NavigationDispatcherImpl : NavigationDispatcher { navigation.removeObservers(viewLifecycleOwner) } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/outOfBand/OutOfBandViewModel.kt b/app/src/main/java/ch/nevis/exampleapp/ui/outOfBand/OutOfBandViewModel.kt index f464350..f8e2ed4 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/outOfBand/OutOfBandViewModel.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/outOfBand/OutOfBandViewModel.kt @@ -34,82 +34,39 @@ import ch.nevis.mobile.sdk.api.operation.userverification.PinUserVerifier * Abstract, base class that provides out-of-band payload decoding, processing and out-of-band * authentication, registration operation execution related common code for view model sub-classes * those deal with out-of-band operations. - */ + * + * @constructor Creates a new instance. + * @param clientProvider An instance of a [ClientProvider] implementation. + * @param deviceInformationFactory An instance of a [DeviceInformationFactory] implementation. + * @param navigationDispatcher An instance of a [NavigationDispatcher] implementation. + * @param settings An instance of a [Settings] implementation. + * @param accountSelector An instance of a [AccountSelector] implementation. + * @param registrationAuthenticatorSelector An instance of an [AuthenticatorSelector] interface implementation + * used during registration. + * @param authenticationAuthenticatorSelector An instance of an [AuthenticatorSelector] interface implementation + * used during authentication. + * @param pinEnroller An instance of a [PinEnroller] implementation. + * @param pinUserVerifier An instance of a [PinUserVerifier] implementation. + * @param passwordUserVerifier An instance of a [PasswordUserVerifier] implementation. + * @param biometricUserVerifier An instance of a [BiometricUserVerifier] implementation. + * @param devicePasscodeUserVerifier An instance of a [DevicePasscodeUserVerifier] implementation. + * @param fingerprintUserVerifier An instance of a [FingerprintUserVerifier] implementation. + * @param errorHandler An instance of a [ErrorHandler] implementation. */ abstract class OutOfBandViewModel( - /** - * An instance of a [ClientProvider] interface implementation. - */ private val clientProvider: ClientProvider, - - /** - * An instance of a [DeviceInformationFactory] interface implementation. - */ private val deviceInformationFactory: DeviceInformationFactory, - - /** - * An instance of a [NavigationDispatcher] interface implementation. - */ private val navigationDispatcher: NavigationDispatcher, - - /** - * An instance of a [Settings] interface implementation. - */ private val settings: Settings, - - /** - * An instance of a [AccountSelector] interface implementation. - */ private val accountSelector: AccountSelector, - - /** - * An instance of a [AuthenticatorSelector] interface implementation. - */ private val registrationAuthenticatorSelector: AuthenticatorSelector, - - /** - * An instance of a [AuthenticatorSelector] interface implementation. - */ private val authenticationAuthenticatorSelector: AuthenticatorSelector, - - /** - * An instance of a [PinEnroller] interface implementation. - */ private val pinEnroller: PinEnroller, - - /** - * An instance of a [PasswordEnroller] interface implementation. - */ private val passwordEnroller: PasswordEnroller, - - /** - * An instance of a [PinUserVerifier] interface implementation. - */ private val pinUserVerifier: PinUserVerifier, - - /** - * An instance of a [PasswordUserVerifier] interface implementation. - */ private val passwordUserVerifier: PasswordUserVerifier, - - /** - * An instance of a [BiometricUserVerifier] interface implementation. - */ private val biometricUserVerifier: BiometricUserVerifier, - - /** - * An instance of a [DevicePasscodeUserVerifier] interface implementation. - */ private val devicePasscodeUserVerifier: DevicePasscodeUserVerifier, - - /** - * An instance of a [FingerprintUserVerifier] interface implementation. - */ private val fingerprintUserVerifier: FingerprintUserVerifier, - - /** - * An instance of an [ErrorHandler] interface implementation. Received errors will be passed to this error - * handler instance. - */ private val errorHandler: ErrorHandler ) : BaseViewModel() { diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/qrReader/QrCodeAnalyzer.kt b/app/src/main/java/ch/nevis/exampleapp/ui/qrReader/QrCodeAnalyzer.kt index a80f706..f9910ee 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/qrReader/QrCodeAnalyzer.kt +++ b/app/src/main/java/ch/nevis/exampleapp/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/ui/qrReader/QrReaderFragment.kt b/app/src/main/java/ch/nevis/exampleapp/ui/qrReader/QrReaderFragment.kt index d80cf12..b5decdf 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/qrReader/QrReaderFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/qrReader/QrReaderFragment.kt @@ -36,6 +36,8 @@ import javax.inject.Inject /** * [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 : BaseFragment(), BarcodesReceivedListener { @@ -76,6 +78,7 @@ class QrReaderFragment : BaseFragment(), BarcodesReceivedListener { //endregion //region Fragment + /** @suppress */ override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -84,6 +87,7 @@ class QrReaderFragment : BaseFragment(), BarcodesReceivedListener { return binding.root } + /** @suppress */ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -108,6 +112,7 @@ class QrReaderFragment : BaseFragment(), BarcodesReceivedListener { } } + /** @suppress */ override fun onDestroyView() { super.onDestroyView() _binding = null @@ -224,6 +229,9 @@ class QrReaderFragment : BaseFragment(), BarcodesReceivedListener { //endregion //region Companion Object + /** + * Constants. + */ companion object { /** * List of necessary permissions for camera usage. @@ -234,4 +242,4 @@ class QrReaderFragment : BaseFragment(), BarcodesReceivedListener { ).toTypedArray() } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/qrReader/QrReaderViewModel.kt b/app/src/main/java/ch/nevis/exampleapp/ui/qrReader/QrReaderViewModel.kt index 68c8d5b..9c9b6cf 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/qrReader/QrReaderViewModel.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/qrReader/QrReaderViewModel.kt @@ -28,86 +28,42 @@ import javax.inject.Named /** * View model implementation of QR Reader view. - */ + * + * @constructor Creates a new instance. + * @param clientProvider An instance of a [ClientProvider] implementation. + * @param navigationDispatcher An instance of a [NavigationDispatcher] implementation. + * @param settings An instance of a [Settings] implementation. + * @param deviceInformationFactory An instance of a [DeviceInformationFactory] implementation. + * @param accountSelector An instance of a [AccountSelector] implementation. + * @param registrationAuthenticatorSelector An instance of an [AuthenticatorSelector] interface implementation + * used during registration. + * @param authenticationAuthenticatorSelector An instance of an [AuthenticatorSelector] interface implementation + * used during authentication. + * @param pinEnroller An instance of a [PinEnroller] implementation. + * @param pinUserVerifier An instance of a [PinUserVerifier] implementation. + * @param passwordUserVerifier An instance of a [PasswordUserVerifier] implementation. + * @param biometricUserVerifier An instance of a [BiometricUserVerifier] implementation. + * @param devicePasscodeUserVerifier An instance of a [DevicePasscodeUserVerifier] implementation. + * @param fingerprintUserVerifier An instance of a [FingerprintUserVerifier] implementation. + * @param errorHandler An instance of a [ErrorHandler] implementation. */ @HiltViewModel class QrReaderViewModel @Inject constructor( - - /** - * An instance of a [ClientProvider] interface implementation. - */ clientProvider: ClientProvider, - - /** - * An instance of a [NavigationDispatcher] interface implementation. - */ navigationDispatcher: NavigationDispatcher, - - /** - * An instance of a [Settings] interface implementation. - */ settings: Settings, - - /** - * An instance of a [DeviceInformationFactory] interface implementation. - */ deviceInformationFactory: DeviceInformationFactory, - - /** - * An instance of an [AccountSelector] interface implementation. - */ accountSelector: AccountSelector, - - /** - * An instance of an [AuthenticatorSelector] interface implementation used during registration. - */ @Named(ApplicationModule.REGISTRATION_AUTHENTICATOR_SELECTOR) registrationAuthenticatorSelector: AuthenticatorSelector, - - /** - * An instance of a [AuthenticatorSelector] interface implementation used during authentication. - */ @Named(ApplicationModule.AUTHENTICATION_AUTHENTICATOR_SELECTOR) authenticationAuthenticatorSelector: AuthenticatorSelector, - - /** - * An instance of a [PinEnroller] interface implementation. - */ pinEnroller: PinEnroller, - - /** - * An instance of a [PasswordEnroller] interface implementation. - */ passwordEnroller: PasswordEnroller, - - /** - * An instance of a [PinUserVerifier] interface implementation. - */ pinUserVerifier: PinUserVerifier, - - /** - * An instance of a [PasswordUserVerifier] interface implementation. - */ passwordUserVerifier: PasswordUserVerifier, - - /** - * An instance of a [BiometricUserVerifier] interface implementation. - */ biometricUserVerifier: BiometricUserVerifier, - - /** - * An instance of a [DevicePasscodeUserVerifier] interface implementation. - */ devicePasscodeUserVerifier: DevicePasscodeUserVerifier, - - /** - * An instance of a [FingerprintUserVerifier] interface implementation. - */ fingerprintUserVerifier: FingerprintUserVerifier, - - /** - * An instance of an [ErrorHandler] implementation. Received errors will be passed to this error - * handler instance. - */ errorHandler: ErrorHandler ) : OutOfBandViewModel( clientProvider, diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/result/ResultFragment.kt b/app/src/main/java/ch/nevis/exampleapp/ui/result/ResultFragment.kt index 87e9be2..0f996ef 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/result/ResultFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/result/ResultFragment.kt @@ -27,6 +27,8 @@ import dagger.hilt.android.AndroidEntryPoint * used. * 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() { @@ -45,6 +47,7 @@ class ResultFragment : Fragment() { //endregion //region Fragment + /** @suppress */ override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -53,6 +56,7 @@ class ResultFragment : Fragment() { return binding.root } + /** @suppress */ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -74,9 +78,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/ui/result/parameter/ResultNavigationParameter.kt b/app/src/main/java/ch/nevis/exampleapp/ui/result/parameter/ResultNavigationParameter.kt index 7335097..60a38bf 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/result/parameter/ResultNavigationParameter.kt +++ b/app/src/main/java/ch/nevis/exampleapp/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( ) : NavigationParameter { //region Public Static Interface + /** + * Collection of public static methods. + */ companion object { /** diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/selectAccount/AccountsRecyclerViewAdapter.kt b/app/src/main/java/ch/nevis/exampleapp/ui/selectAccount/AccountsRecyclerViewAdapter.kt index 873eb80..1db12a5 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/selectAccount/AccountsRecyclerViewAdapter.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/selectAccount/AccountsRecyclerViewAdapter.kt @@ -13,27 +13,27 @@ import ch.nevis.exampleapp.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 -> @@ -41,13 +41,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/ui/selectAccount/SelectAccountFragment.kt b/app/src/main/java/ch/nevis/exampleapp/ui/selectAccount/SelectAccountFragment.kt index 939da0b..b537b96 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/selectAccount/SelectAccountFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/selectAccount/SelectAccountFragment.kt @@ -25,6 +25,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 : BaseFragment(), @@ -54,6 +56,7 @@ class SelectAccountFragment : BaseFragment(), //endregion //region Fragment + /** @suppress */ override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -62,6 +65,7 @@ class SelectAccountFragment : BaseFragment(), return binding.root } + /** @suppress */ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) val context = context ?: return @@ -84,6 +88,7 @@ class SelectAccountFragment : BaseFragment(), } } + /** @suppress */ override fun onDestroyView() { super.onDestroyView() _binding = null @@ -108,4 +113,4 @@ class SelectAccountFragment : BaseFragment(), return false } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/selectAccount/SelectAccountViewModel.kt b/app/src/main/java/ch/nevis/exampleapp/ui/selectAccount/SelectAccountViewModel.kt index 5856365..384adbf 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/selectAccount/SelectAccountViewModel.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/selectAccount/SelectAccountViewModel.kt @@ -32,65 +32,32 @@ import javax.inject.Named /** * View model implementation for Select Account view. - */ + * + * @constructor Creates a new instance. + * @param clientProvider An instance of a [ClientProvider] implementation. + * @param navigationDispatcher An instance of a [NavigationDispatcher] implementation. + * @param authenticatorSelector An instance of an [AuthenticatorSelector] interface implementation. + * @param pinUserVerifier An instance of a [PinUserVerifier] implementation. + * @param passwordUserVerifier An instance of a [PasswordUserVerifier] implementation. + * @param biometricUserVerifier An instance of a [BiometricUserVerifier] implementation. + * @param devicePasscodeUserVerifier An instance of a [DevicePasscodeUserVerifier] implementation. + * @param fingerprintUserVerifier An instance of a [FingerprintUserVerifier] implementation. + * @param pinChanger An instance of a [PinChanger] implementation. + * @param passwordChanger An instance of a [PasswordChanger] implementation. + * @param errorHandler An instance of a [ErrorHandler] implementation. */ @HiltViewModel class SelectAccountViewModel @Inject constructor( - - /** - * An instance of a [ClientProvider] interface implementation. - */ private val clientProvider: ClientProvider, - - /** - * An instance of a [NavigationDispatcher] interface implementation. - */ private val navigationDispatcher: NavigationDispatcher, - - /** - * An instance of an [AuthenticatorSelector] interface implementation used during authentication. - */ @Named(ApplicationModule.AUTHENTICATION_AUTHENTICATOR_SELECTOR) private val authenticatorSelector: AuthenticatorSelector, - - /** - * An instance of a [PinUserVerifier] interface implementation. - */ private val pinUserVerifier: PinUserVerifier, - - /** - * An instance of a [PasswordUserVerifier] interface implementation. - */ private val passwordUserVerifier: PasswordUserVerifier, - - /** - * An instance of a [BiometricUserVerifier] interface implementation. - */ private val biometricUserVerifier: BiometricUserVerifier, - - /** - * An instance of a [DevicePasscodeUserVerifier] interface implementation. - */ private val devicePasscodeUserVerifier: DevicePasscodeUserVerifier, - - /** - * An instance of a [FingerprintUserVerifier] interface implementation. - */ private val fingerprintUserVerifier: FingerprintUserVerifier, - - /** - * An instance of a [PinChanger] interface implementation. - */ private val pinChanger: PinChanger, - - /** - * An instance of a [PasswordChanger] interface implementation. - */ private val passwordChanger: PasswordChanger, - - /** - * An instance of an [ErrorHandler] interface implementation. Received errors will be passed to this error - * handler instance. - */ private val errorHandler: ErrorHandler ) : CancellableOperationViewModel() { @@ -115,7 +82,8 @@ class SelectAccountViewModel @Inject constructor( /** * Selects account for the given operation and user. The supported operations are - * [Operation.AUTHENTICATION], [Operation.DEREGISTRATION], [Operation.CHANGE_PIN], [Operation.OUT_OF_BAND_AUTHENTICATION]. + * [Operation.AUTHENTICATION], [Operation.DEREGISTRATION], [Operation.CHANGE_PIN], + * [Operation.CHANGE_PASSWORD] and [Operation.OUT_OF_BAND_AUTHENTICATION]. * * @param operation The operation the account selected for. * @param username The username assigned to the selected account. diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/selectAccount/parameter/SelectAccountNavigationParameter.kt b/app/src/main/java/ch/nevis/exampleapp/ui/selectAccount/parameter/SelectAccountNavigationParameter.kt index d59080a..6381450 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/selectAccount/parameter/SelectAccountNavigationParameter.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/selectAccount/parameter/SelectAccountNavigationParameter.kt @@ -15,6 +15,11 @@ import kotlinx.parcelize.Parcelize /** * Navigation parameter class for Select Account view. + * + * @constructor Creates a new instance. + * @param operation The operation type the account selection was requested for. + * @param accounts The list of available accounts the user can select from. + * @param accountSelectionHandler An instance of an [AccountSelectionHandler] implementation. */ @Parcelize data class SelectAccountNavigationParameter( @@ -37,4 +42,4 @@ data class SelectAccountNavigationParameter( */ @IgnoredOnParcel val accountSelectionHandler: AccountSelectionHandler? = null -) : NavigationParameter \ No newline at end of file +) : NavigationParameter diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/selectAuthenticator/AuthenticatorSelectedListener.kt b/app/src/main/java/ch/nevis/exampleapp/ui/selectAuthenticator/AuthenticatorSelectedListener.kt index bfe5266..acfcc8b 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/selectAuthenticator/AuthenticatorSelectedListener.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/selectAuthenticator/AuthenticatorSelectedListener.kt @@ -6,12 +6,9 @@ package ch.nevis.exampleapp.ui.selectAuthenticator -import ch.nevis.mobile.sdk.api.localdata.Authenticator - - /** - * Interface declaration of a listener that is used by [AuthenticatorsRecyclerViewAdapter] to notify the implementations - * of this interface about authenticator selection. + * Interface declaration of a listener that is used by [AuthenticatorsRecyclerViewAdapter] to notify + * the implementations of this interface about authenticator selection. */ interface AuthenticatorSelectedListener { @@ -21,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/ui/selectAuthenticator/AuthenticatorsRecyclerViewAdapter.kt b/app/src/main/java/ch/nevis/exampleapp/ui/selectAuthenticator/AuthenticatorsRecyclerViewAdapter.kt index 6b2f2e3..5d0d4aa 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/selectAuthenticator/AuthenticatorsRecyclerViewAdapter.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/selectAuthenticator/AuthenticatorsRecyclerViewAdapter.kt @@ -14,28 +14,28 @@ import ch.nevis.exampleapp.databinding.ItemAuthenticatorBinding import ch.nevis.exampleapp.ui.selectAuthenticator.model.AuthenticatorItem /** - * An implementation of [RecyclerView.Adapter] abstract class that renders [AuthenticatorItem] objects into recycler items. + * An implementation of [RecyclerView.Adapter] abstract class that renders [AuthenticatorItem] 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] @@ -57,14 +57,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/ui/selectAuthenticator/SelectAuthenticatorFragment.kt b/app/src/main/java/ch/nevis/exampleapp/ui/selectAuthenticator/SelectAuthenticatorFragment.kt index 6a929d8..6064947 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/selectAuthenticator/SelectAuthenticatorFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/selectAuthenticator/SelectAuthenticatorFragment.kt @@ -25,6 +25,8 @@ import dagger.hilt.android.AndroidEntryPoint * * This view renders the available authenticators as a list and the user * can select one of them. + * + * @constructor Creates a new instance. */ @AndroidEntryPoint class SelectAuthenticatorFragment : BaseFragment(), AuthenticatorSelectedListener { @@ -53,6 +55,7 @@ class SelectAuthenticatorFragment : BaseFragment(), AuthenticatorSelectedListene //endregion //region Fragment + /** @suppress */ override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -61,6 +64,7 @@ class SelectAuthenticatorFragment : BaseFragment(), AuthenticatorSelectedListene return binding.root } + /** @suppress */ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) val context = context ?: return @@ -81,6 +85,7 @@ class SelectAuthenticatorFragment : BaseFragment(), AuthenticatorSelectedListene ) } + /** @suppress */ override fun onDestroyView() { super.onDestroyView() _binding = null @@ -102,4 +107,4 @@ class SelectAuthenticatorFragment : BaseFragment(), AuthenticatorSelectedListene return false } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/selectAuthenticator/SelectAuthenticatorViewModel.kt b/app/src/main/java/ch/nevis/exampleapp/ui/selectAuthenticator/SelectAuthenticatorViewModel.kt index e9c5161..b8ebfd5 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/selectAuthenticator/SelectAuthenticatorViewModel.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/selectAuthenticator/SelectAuthenticatorViewModel.kt @@ -16,14 +16,12 @@ import javax.inject.Inject /** * View model implementation for Select Authenticator view. + * + * @constructor Creates a new instance. + * @param errorHandler An instance of an [ErrorHandler] interface implementation. */ @HiltViewModel class SelectAuthenticatorViewModel @Inject constructor( - - /** - * An instance of an [ErrorHandler] interface implementation. Received errors will be passed to this error - * handler instance. - */ val errorHandler: ErrorHandler ) : CancellableOperationViewModel() { @@ -69,4 +67,4 @@ class SelectAuthenticatorViewModel @Inject constructor( authenticatorSelectionHandler = null } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/selectAuthenticator/model/AuthenticatorItem.kt b/app/src/main/java/ch/nevis/exampleapp/ui/selectAuthenticator/model/AuthenticatorItem.kt index a72e54d..12e9b71 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/selectAuthenticator/model/AuthenticatorItem.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/selectAuthenticator/model/AuthenticatorItem.kt @@ -12,7 +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. * - * @throws IllegalArgumentException when an unknown AAID is used. + * @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. */ data class AuthenticatorItem( /** @@ -21,12 +25,12 @@ data class AuthenticatorItem( val aaid: String, /** - * The flag that tells whether the authenticator is server policy compliant or not. + * The flag that tells whether the authenticator is server policy compliant. */ val isPolicyCompliant: Boolean, /** - * The flag that tells whether the user already enrolled the authenticator or not. + * The flag that tells whether the user already enrolled the authenticator. */ val isUserEnrolled: Boolean, @@ -38,7 +42,10 @@ data class AuthenticatorItem( ) { /** * Tells that if this authenticator item is selectable on select authenticator view or not. - * The value is calculated based on [AuthenticatorItem.isPolicyCompliant] and [AuthenticatorItem.isUserEnrolled] flags. + * The value is calculated based on [AuthenticatorItem.isPolicyCompliant] and [AuthenticatorItem.isUserEnrolled] + * flags. + * + * @return A flag that tells whether the item is selectable. */ fun isEnabled(): Boolean { return isPolicyCompliant && ( diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/selectAuthenticator/parameter/SelectAuthenticatorNavigationParameter.kt b/app/src/main/java/ch/nevis/exampleapp/ui/selectAuthenticator/parameter/SelectAuthenticatorNavigationParameter.kt index 2a1e89c..3d589e6 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/selectAuthenticator/parameter/SelectAuthenticatorNavigationParameter.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/selectAuthenticator/parameter/SelectAuthenticatorNavigationParameter.kt @@ -14,6 +14,10 @@ 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. + * @param authenticatorSelectionHandler An instance of an [AuthenticatorSelectionHandler] implementation. */ @Parcelize data class SelectAuthenticatorNavigationParameter( diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/transactionConfirmation/TransactionConfirmationFragment.kt b/app/src/main/java/ch/nevis/exampleapp/ui/transactionConfirmation/TransactionConfirmationFragment.kt index 59877d5..0b29b32 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/transactionConfirmation/TransactionConfirmationFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/transactionConfirmation/TransactionConfirmationFragment.kt @@ -30,6 +30,8 @@ import dagger.hilt.android.AndroidEntryPoint * passed to transaction confirmation as well view to be able to continue the operation with the account * selection. Select Account view itself is not out-of-band authentication specific and supports * multiple operations. + * + * @constructor Creates a new instance. */ @AndroidEntryPoint class TransactionConfirmationFragment : BaseFragment() { @@ -53,6 +55,7 @@ class TransactionConfirmationFragment : BaseFragment() { //endregion //region Fragment + /** @suppress */ override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View { @@ -60,6 +63,7 @@ class TransactionConfirmationFragment : BaseFragment() { return binding.root } + /** @suppress */ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -79,6 +83,7 @@ class TransactionConfirmationFragment : BaseFragment() { ) } + /** @suppress */ override fun onDestroyView() { super.onDestroyView() _binding = null @@ -101,4 +106,4 @@ class TransactionConfirmationFragment : BaseFragment() { } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/transactionConfirmation/TransactionConfirmationViewModel.kt b/app/src/main/java/ch/nevis/exampleapp/ui/transactionConfirmation/TransactionConfirmationViewModel.kt index f663006..294d675 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/transactionConfirmation/TransactionConfirmationViewModel.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/transactionConfirmation/TransactionConfirmationViewModel.kt @@ -28,19 +28,14 @@ import javax.inject.Inject * passed to transaction confirmation as well view to be able to continue the operation with the account * selection. Select Account view itself is not out-of-band authentication specific and supports * multiple operations. + * + * @constructor Creates a new instance. + * @param navigationDispatcher An instance of a [NavigationDispatcher] interface implementation. + * @param errorHandler An instance of a [ErrorHandler] interface implementation. */ @HiltViewModel class TransactionConfirmationViewModel @Inject constructor( - - /** - * An instance of a [NavigationDispatcher] interface implementation. - */ private val navigationDispatcher: NavigationDispatcher, - - /** - * An instance of an [ErrorHandler] interface implementation. Received errors will be passed to this error - * handler instance. - */ private val errorHandler: ErrorHandler ) : CancellableOperationViewModel() { @@ -124,4 +119,4 @@ class TransactionConfirmationViewModel @Inject constructor( accountSelectionHandler = null } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/transactionConfirmation/model/TransactionConfirmationViewData.kt b/app/src/main/java/ch/nevis/exampleapp/ui/transactionConfirmation/model/TransactionConfirmationViewData.kt index 2f7ba1d..1d867fb 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/transactionConfirmation/model/TransactionConfirmationViewData.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/transactionConfirmation/model/TransactionConfirmationViewData.kt @@ -9,9 +9,13 @@ package ch.nevis.exampleapp.ui.transactionConfirmation.model import ch.nevis.exampleapp.ui.base.model.ViewData /** - * [ViewData] implementation for Transaction Confirmation view and its view model. The view model composes - * an instance of this [TransactionConfirmationViewData] class and posts it to the Transaction Confirmation view to - * indicate that the view related data changed the view should be updated. + * [ViewData] implementation for Transaction Confirmation view and its view model. The view model + * composes an instance of this [TransactionConfirmationViewData] class and posts it to the Transaction + * Confirmation view to indicate that the view related data changed the view should be updated. + * + * @constructor Creates a new instance. + * @param transactionConfirmationData The transaction confirmation data/message that should be displayed + * on Transaction Confirmation view. */ data class TransactionConfirmationViewData( /** diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/transactionConfirmation/parameter/TransactionConfirmationNavigationParameter.kt b/app/src/main/java/ch/nevis/exampleapp/ui/transactionConfirmation/parameter/TransactionConfirmationNavigationParameter.kt index f0b4b00..e5d9bc9 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/transactionConfirmation/parameter/TransactionConfirmationNavigationParameter.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/transactionConfirmation/parameter/TransactionConfirmationNavigationParameter.kt @@ -21,6 +21,13 @@ import kotlinx.parcelize.Parcelize * passed to transaction confirmation as well view to be able to continue the operation with the account * selection. Select Account view itself is not out-of-band authentication specific and supports * multiple operations. + * + * @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. + * @param accountSelectionHandler An instance of an [AccountSelectionHandler] implementation. */ @Parcelize data class TransactionConfirmationNavigationParameter( @@ -51,4 +58,4 @@ data class TransactionConfirmationNavigationParameter( */ @IgnoredOnParcel val accountSelectionHandler: AccountSelectionHandler? = null -) : NavigationParameter \ No newline at end of file +) : NavigationParameter diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/userNamePasswordLogin/UserNamePasswordLoginFragment.kt b/app/src/main/java/ch/nevis/exampleapp/ui/userNamePasswordLogin/UserNamePasswordLoginFragment.kt index 52f64db..1f50f00 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/userNamePasswordLogin/UserNamePasswordLoginFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/userNamePasswordLogin/UserNamePasswordLoginFragment.kt @@ -20,6 +20,8 @@ import java.net.PasswordAuthentication * [androidx.fragment.app.Fragment] implementation of Username and Password Login view where the user * can enter a username and password and send it to start a login process. If the login was successful * an in-band registration operation is started automatically. + * + * @constructor Creates a new instance. */ @AndroidEntryPoint class UserNamePasswordLoginFragment : BaseFragment() { @@ -38,6 +40,7 @@ class UserNamePasswordLoginFragment : BaseFragment() { //endregion //region Fragment + /** @suppress */ override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -46,6 +49,7 @@ class UserNamePasswordLoginFragment : BaseFragment() { return binding.root } + /** @suppress */ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -58,9 +62,10 @@ class UserNamePasswordLoginFragment : BaseFragment() { } } + /** @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/ui/userNamePasswordLogin/UserNamePasswordLoginViewModel.kt b/app/src/main/java/ch/nevis/exampleapp/ui/userNamePasswordLogin/UserNamePasswordLoginViewModel.kt index 7b72100..3f9ac94 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/userNamePasswordLogin/UserNamePasswordLoginViewModel.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/userNamePasswordLogin/UserNamePasswordLoginViewModel.kt @@ -38,73 +38,42 @@ import javax.inject.Named /** * View model implementation of UserName and Password Login view. - */ + * + * @constructor Creates a new instance. + * @param clientProvider An instance of a [ClientProvider] implementation. + * @param retrofit A [Retrofit] instance. + * @param deviceInformationFactory An instance of a [DeviceInformationFactory] implementation. + * used during authentication. + * @param navigationDispatcher An instance of a [NavigationDispatcher] implementation. + * @param settings An instance of a [Settings] implementation. + * @param authenticatorSelector An instance of an [AuthenticatorSelector] interface implementation + * used during registration. + * @param pinEnroller An instance of a [PinEnroller] implementation. + * @param biometricUserVerifier An instance of a [BiometricUserVerifier] implementation. + * @param devicePasscodeUserVerifier An instance of a [DevicePasscodeUserVerifier] implementation. + * @param fingerprintUserVerifier An instance of a [FingerprintUserVerifier] implementation. + * @param errorHandler An instance of a [ErrorHandler] implementation. */ @HiltViewModel class UserNamePasswordLoginViewModel @Inject constructor( - /** - * An instance of a [ClientProvider] implementation. - */ private val clientProvider: ClientProvider, - - /** - * A [Retrofit] instance. - */ private val retrofit: Retrofit, - - /** - * An instance of a [DeviceInformationFactory] implementation. - */ private val deviceInformationFactory: DeviceInformationFactory, - - /** - * An instance of a [NavigationDispatcher] interface implementation. - */ private val navigationDispatcher: NavigationDispatcher, - - /** - * An instance of a [Settings] interface implementation. - */ private val settings: Settings, - - /** - * An instance of an [AuthenticatorSelector] interface implementation used during registration. - */ @Named(ApplicationModule.REGISTRATION_AUTHENTICATOR_SELECTOR) private val authenticatorSelector: AuthenticatorSelector, - - /** - * An instance of a [PinEnroller] interface implementation. - */ private val pinEnroller: PinEnroller, - - /** - * An instance of a [PasswordEnroller] interface implementation. - */ private val passwordEnroller: PasswordEnroller, - - /** - * An instance of a [BiometricUserVerifier] interface implementation. - */ private val biometricUserVerifier: BiometricUserVerifier, - - /** - * An instance of a [DevicePasscodeUserVerifier] interface implementation. - */ private val devicePasscodeUserVerifier: DevicePasscodeUserVerifier, - - /** - * An instance of a [FingerprintUserVerifier] interface implementation. - */ private val fingerprintUserVerifier: FingerprintUserVerifier, - - /** - * An instance of an [ErrorHandler] interface implementation. Received errors will be passed to this error - * handler instance. - */ private val errorHandler: ErrorHandler ) : BaseViewModel() { //region Companion Object + /** + * Constants. + */ companion object { private const val HEADER_SET_COOKIE = "Set-Cookie" } diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/util/SingleLiveEvent.kt b/app/src/main/java/ch/nevis/exampleapp/ui/util/SingleLiveEvent.kt index cc5744a..bd4928d 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/util/SingleLiveEvent.kt +++ b/app/src/main/java/ch/nevis/exampleapp/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/ui/verifyUser/VerifyUserFragment.kt b/app/src/main/java/ch/nevis/exampleapp/ui/verifyUser/VerifyUserFragment.kt index c6c98f1..f45ddfc 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/verifyUser/VerifyUserFragment.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/verifyUser/VerifyUserFragment.kt @@ -27,6 +27,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 : BaseFragment() { @@ -62,6 +64,7 @@ class VerifyUserFragment : BaseFragment() { //endregion //region Fragment + /** @suppress */ override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -70,6 +73,7 @@ class VerifyUserFragment : BaseFragment() { return binding.root } + /** @suppress */ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -105,16 +109,19 @@ class VerifyUserFragment : BaseFragment() { ) } + /** @suppress */ override fun onResume() { super.onResume() viewModel.resumeOsListening() } + /** @suppress */ override fun onPause() { super.onPause() viewModel.pauseOsListening() } + /** @suppress */ override fun onDestroyView() { super.onDestroyView() _binding = null @@ -143,4 +150,4 @@ class VerifyUserFragment : BaseFragment() { } } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/verifyUser/VerifyUserViewModel.kt b/app/src/main/java/ch/nevis/exampleapp/ui/verifyUser/VerifyUserViewModel.kt index 2dc0154..dc44457 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/verifyUser/VerifyUserViewModel.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/verifyUser/VerifyUserViewModel.kt @@ -23,14 +23,12 @@ import javax.inject.Inject /** * View model implementation of Verify User view. + * + * @constructor Creates a new instance. + * @param errorHandler An instance of an [ErrorHandler] interface implementation. */ @HiltViewModel class VerifyUserViewModel @Inject constructor( - - /** - * An instance of an [ErrorHandler] interface implementation. Received errors will be passed to this error - * handler instance. - */ private val errorHandler: ErrorHandler ) : CancellableOperationViewModel() { @@ -207,4 +205,4 @@ class VerifyUserViewModel @Inject constructor( biometricUserVerificationHandler = null } //endregion -} \ No newline at end of file +} diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/verifyUser/model/VerifyUserViewData.kt b/app/src/main/java/ch/nevis/exampleapp/ui/verifyUser/model/VerifyUserViewData.kt index 2e0ec05..4d5f55c 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/verifyUser/model/VerifyUserViewData.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/verifyUser/model/VerifyUserViewData.kt @@ -12,6 +12,10 @@ import ch.nevis.exampleapp.ui.base.model.ViewData * [ViewData] implementation for Verify User view and its view model. The view model composes * an instance of this [VerifyUserViewData] class and posts it to the Verify User view to * indicate that the view related data changed the view should be updated. + * + * @constructor Creates a new instance. + * @param errorMessage The error message that should be displayed on Verify User view. + * @param isFingerPrintVerification Flag that tells whether fingerprint verification is in progress. */ data class VerifyUserViewData( diff --git a/app/src/main/java/ch/nevis/exampleapp/ui/verifyUser/parameter/VerifyUserNavigationParameter.kt b/app/src/main/java/ch/nevis/exampleapp/ui/verifyUser/parameter/VerifyUserNavigationParameter.kt index f896534..931e1c5 100644 --- a/app/src/main/java/ch/nevis/exampleapp/ui/verifyUser/parameter/VerifyUserNavigationParameter.kt +++ b/app/src/main/java/ch/nevis/exampleapp/ui/verifyUser/parameter/VerifyUserNavigationParameter.kt @@ -18,6 +18,15 @@ 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. + * @param biometricUserVerificationHandler An instance of a [BiometricUserVerificationHandler] implementation. + * @param devicePasscodeUserVerificationHandler An instance of a [DevicePasscodeUserVerificationHandler] implementation. + * @param fingerprintUserVerificationHandler An instance of a [FingerprintUserVerificationHandler] implementation. + * @param fingerprintUserVerificationError A [FingerprintUserVerificationError] error object that may + * occur during fingerprint user verification. */ @Parcelize data class VerifyUserNavigationParameter( diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 06bf463..5623e8d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -86,7 +86,7 @@ Delete Authenticators In-band Registration - [%s] %s + [%1$s] %2$s HH:mm:ss Show log diff --git a/build.gradle b/build.gradle index f7f5ebd..530d911 100644 --- a/build.gradle +++ b/build.gradle @@ -4,6 +4,13 @@ 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" + + dependencies { + classpath "org.jetbrains.dokka:dokka-gradle-plugin:${dokka_version}" + } } plugins { @@ -11,6 +18,7 @@ plugins { id 'com.android.application' version "${gradle_version}" apply false id 'com.google.dagger.hilt.android' version "${dagger_hilt_version}" apply false id 'org.jetbrains.kotlin.android' version "${kotlin_version}" apply false + id 'org.jetbrains.dokka' version "${dokka_version}" apply true } ext.getConfig = { String name -> @@ -60,3 +68,75 @@ 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" + }""" + ] + ) + } +} 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 0baf978..f69c962 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,5 +6,5 @@ pluginManagement { } } -rootProject.name = "Nevis Mobile Authentication Example App" +rootProject.name = "nevis-mobile-authentication-example" include ':app'