From 7894b3d81c42e95a2a8d14fef02c61ed3a22a6df Mon Sep 17 00:00:00 2001 From: Stilianos Tzouvaras Date: Fri, 1 Mar 2024 21:14:39 +0200 Subject: [PATCH] Gradle fixes for some deprecated functions, Refactor UserAuthenticationController to use BiometricController for basic operations --- .../eu/europa/ec/euidi/AndroidCompose.kt | 9 ++- .../ec/euidi/AndroidInstrumentedTests.kt | 3 +- .../businesslogic/ExampleInstrumentedTest.kt | 2 +- .../UserAuthenticationController.kt | 62 ++++++++----------- .../biometry/BiometricController.kt | 42 +++++++++---- .../security/AndroidPackageController.kt | 2 +- .../WalletCoreDocumentsController.kt | 10 +-- .../WalletCorePresentationController.kt | 10 +-- .../businesslogic/di/LogicBusinessModule.kt | 4 +- .../ec/businesslogic/model/BiometricCrypto.kt | 21 +++++++ .../commonfeature/ExampleInstrumentedTest.kt | 2 +- .../commonfeature/di/FeatureCommonModule.kt | 2 +- .../UserAuthenticationInteractor.kt | 10 +-- .../ExampleInstrumentedTest.kt | 2 +- gradle.properties | 2 +- .../ExampleInstrumentedTest.kt | 2 +- .../document/AddDocumentInteractor.kt | 8 +-- .../ui/document/add/AddDocumentViewModel.kt | 2 +- .../loginfeature/ExampleInstrumentedTest.kt | 2 +- .../ExampleInstrumentedTest.kt | 2 +- .../PresentationLoadingInteractor.kt | 10 +-- .../loading/PresentationLoadingViewModel.kt | 2 +- .../ExampleInstrumentedTest.kt | 2 +- .../interactor/ProximityLoadingInteractor.kt | 10 +-- .../ui/loading/ProximityLoadingViewModel.kt | 2 +- .../startupfeature/ExampleInstrumentedTest.kt | 2 +- 26 files changed, 132 insertions(+), 95 deletions(-) rename business-logic/src/main/java/eu/europa/ec/businesslogic/controller/{biometry => authentication}/UserAuthenticationController.kt (59%) create mode 100644 business-logic/src/main/java/eu/europa/ec/businesslogic/model/BiometricCrypto.kt diff --git a/build-logic/convention/src/main/kotlin/eu/europa/ec/euidi/AndroidCompose.kt b/build-logic/convention/src/main/kotlin/eu/europa/ec/euidi/AndroidCompose.kt index f2dd869a..6470b630 100644 --- a/build-logic/convention/src/main/kotlin/eu/europa/ec/euidi/AndroidCompose.kt +++ b/build-logic/convention/src/main/kotlin/eu/europa/ec/euidi/AndroidCompose.kt @@ -64,6 +64,7 @@ internal fun Project.configureAndroidCompose( add("testImplementation", libs.findLibrary("robolectric").get()) } + @Suppress("UnstableApiUsage") testOptions { unitTests { // For Robolectric @@ -86,7 +87,9 @@ private fun Project.buildComposeMetricsParameters(): List { val enableMetrics = (enableMetricsProvider.orNull == "true") if (enableMetrics) { - val metricsFolder = rootProject.buildDir.resolve("compose-metrics").resolve(relativePath) + val metricsFolder = + rootProject.layout.buildDirectory.get().asFile.resolve("compose-metrics") + .resolve(relativePath) metricParameters.add("-P") metricParameters.add( "plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=" + metricsFolder.absolutePath @@ -96,7 +99,9 @@ private fun Project.buildComposeMetricsParameters(): List { val enableReportsProvider = project.providers.gradleProperty("enableComposeCompilerReports") val enableReports = (enableReportsProvider.orNull == "true") if (enableReports) { - val reportsFolder = rootProject.buildDir.resolve("compose-reports").resolve(relativePath) + val reportsFolder = + rootProject.layout.buildDirectory.get().asFile.resolve("compose-reports") + .resolve(relativePath) metricParameters.add("-P") metricParameters.add( "plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" + reportsFolder.absolutePath diff --git a/build-logic/convention/src/main/kotlin/eu/europa/ec/euidi/AndroidInstrumentedTests.kt b/build-logic/convention/src/main/kotlin/eu/europa/ec/euidi/AndroidInstrumentedTests.kt index 7c0b3fd9..54edc2d2 100644 --- a/build-logic/convention/src/main/kotlin/eu/europa/ec/euidi/AndroidInstrumentedTests.kt +++ b/build-logic/convention/src/main/kotlin/eu/europa/ec/euidi/AndroidInstrumentedTests.kt @@ -27,9 +27,10 @@ import org.gradle.api.Project * * Note: this could be improved by checking other potential sourceSets based on buildTypes and flavors. */ +@Suppress("UnstableApiUsage") internal fun LibraryAndroidComponentsExtension.disableUnnecessaryAndroidTests( project: Project, ) = beforeVariants { - it.enableAndroidTest = it.enableAndroidTest + it.androidTest.enable = it.androidTest.enable && project.projectDir.resolve("src/androidTest").exists() } diff --git a/business-logic/src/androidTest/java/eu/europa/ec/businesslogic/ExampleInstrumentedTest.kt b/business-logic/src/androidTest/java/eu/europa/ec/businesslogic/ExampleInstrumentedTest.kt index 8290abbc..5f47a243 100644 --- a/business-logic/src/androidTest/java/eu/europa/ec/businesslogic/ExampleInstrumentedTest.kt +++ b/business-logic/src/androidTest/java/eu/europa/ec/businesslogic/ExampleInstrumentedTest.kt @@ -18,7 +18,7 @@ package eu.europa.ec.businesslogic import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry -import org.junit.Assert.* +import org.junit.Assert.assertEquals import org.junit.Test import org.junit.runner.RunWith diff --git a/business-logic/src/main/java/eu/europa/ec/businesslogic/controller/biometry/UserAuthenticationController.kt b/business-logic/src/main/java/eu/europa/ec/businesslogic/controller/authentication/UserAuthenticationController.kt similarity index 59% rename from business-logic/src/main/java/eu/europa/ec/businesslogic/controller/biometry/UserAuthenticationController.kt rename to business-logic/src/main/java/eu/europa/ec/businesslogic/controller/authentication/UserAuthenticationController.kt index 5975b314..971060be 100644 --- a/business-logic/src/main/java/eu/europa/ec/businesslogic/controller/biometry/UserAuthenticationController.kt +++ b/business-logic/src/main/java/eu/europa/ec/businesslogic/controller/authentication/UserAuthenticationController.kt @@ -14,22 +14,25 @@ * governing permissions and limitations under the Licence. */ -package eu.europa.ec.businesslogic.controller.biometry +package eu.europa.ec.businesslogic.controller.authentication import android.content.Context -import androidx.biometric.BiometricManager.Authenticators.BIOMETRIC_WEAK -import androidx.biometric.BiometricManager.Authenticators.DEVICE_CREDENTIAL +import androidx.biometric.BiometricManager import androidx.biometric.BiometricPrompt -import androidx.core.content.ContextCompat import androidx.fragment.app.FragmentActivity +import androidx.lifecycle.lifecycleScope +import eu.europa.ec.businesslogic.controller.biometry.BiometricController +import eu.europa.ec.businesslogic.controller.biometry.BiometricsAvailability +import eu.europa.ec.businesslogic.model.BiometricCrypto import eu.europa.ec.resourceslogic.R import eu.europa.ec.resourceslogic.provider.ResourceProvider +import kotlinx.coroutines.launch interface UserAuthenticationController { fun deviceSupportsBiometrics(listener: (BiometricsAvailability) -> Unit) fun authenticate( context: Context, - biometryCrypto: BiometryCrypto, + biometryCrypto: BiometricCrypto, userAuthenticationBiometricResult: UserAuthenticationResult ) } @@ -44,41 +47,32 @@ class UserAuthenticationControllerImpl( override fun authenticate( context: Context, - biometryCrypto: BiometryCrypto, + biometryCrypto: BiometricCrypto, userAuthenticationBiometricResult: UserAuthenticationResult ) { - context as FragmentActivity + (context as? FragmentActivity)?.let { activity -> - val prompt = BiometricPrompt( - context, - ContextCompat.getMainExecutor(context), - object : BiometricPrompt.AuthenticationCallback() { - override fun onAuthenticationError(errorCode: Int, errString: CharSequence) { - userAuthenticationBiometricResult.onAuthenticationError() - } + activity.lifecycleScope.launch { - override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) { - userAuthenticationBiometricResult.onAuthenticationSuccess() - } + val data = biometricController.authenticate( + activity = activity, + biometryCrypto = biometryCrypto, + promptInfo = BiometricPrompt.PromptInfo.Builder() + .setTitle(resourceProvider.getString(R.string.biometric_prompt_title)) + .setSubtitle(resourceProvider.getString(R.string.biometric_prompt_subtitle)) + .setAllowedAuthenticators(BiometricManager.Authenticators.BIOMETRIC_WEAK or BiometricManager.Authenticators.DEVICE_CREDENTIAL) + .build() + ) - override fun onAuthenticationFailed() { + if (data.authenticationResult != null) { + userAuthenticationBiometricResult.onAuthenticationSuccess() + } else if (data.hasError) { + userAuthenticationBiometricResult.onAuthenticationError() + } else { userAuthenticationBiometricResult.onAuthenticationFailure() } } - ) - - val builder = BiometricPrompt.PromptInfo.Builder() - .setTitle(resourceProvider.getString(R.string.biometric_prompt_title)) - .setSubtitle(resourceProvider.getString(R.string.biometric_prompt_subtitle)) - .setAllowedAuthenticators(BIOMETRIC_WEAK or DEVICE_CREDENTIAL) - .build() - - biometryCrypto.cryptoObject?.let { - prompt.authenticate( - builder, - it - ) - } ?: prompt.authenticate(builder) + } } } @@ -86,6 +80,4 @@ data class UserAuthenticationResult( val onAuthenticationSuccess: () -> Unit = {}, val onAuthenticationError: () -> Unit = {}, val onAuthenticationFailure: () -> Unit = {}, -) - -data class BiometryCrypto(val cryptoObject: BiometricPrompt.CryptoObject?) \ No newline at end of file +) \ No newline at end of file diff --git a/business-logic/src/main/java/eu/europa/ec/businesslogic/controller/biometry/BiometricController.kt b/business-logic/src/main/java/eu/europa/ec/businesslogic/controller/biometry/BiometricController.kt index 8764c087..92dcd864 100644 --- a/business-logic/src/main/java/eu/europa/ec/businesslogic/controller/biometry/BiometricController.kt +++ b/business-logic/src/main/java/eu/europa/ec/businesslogic/controller/biometry/BiometricController.kt @@ -32,6 +32,7 @@ import eu.europa.ec.businesslogic.controller.crypto.CryptoController import eu.europa.ec.businesslogic.controller.storage.PrefKeys import eu.europa.ec.businesslogic.extension.decodeFromPemBase64String import eu.europa.ec.businesslogic.extension.encodeToPemBase64String +import eu.europa.ec.businesslogic.model.BiometricCrypto import eu.europa.ec.businesslogic.model.BiometricData import eu.europa.ec.resourceslogic.R import eu.europa.ec.resourceslogic.provider.ResourceProvider @@ -50,6 +51,12 @@ enum class BiometricsAuthError(val code: Int) { interface BiometricController { fun deviceSupportsBiometrics(listener: (BiometricsAvailability) -> Unit) fun authenticate(context: Context, listener: (BiometricsAuthenticate) -> Unit) + suspend fun authenticate( + activity: FragmentActivity, + biometryCrypto: BiometricCrypto, + promptInfo: BiometricPrompt.PromptInfo + ): BiometricPromptData + fun launchBiometricSystemScreen() } @@ -88,7 +95,15 @@ class BiometricControllerImpl( return@launch } - val data = authenticate(activity = activity, cipher = cipher) + val data = authenticate( + activity = activity, + biometryCrypto = BiometricCrypto(BiometricPrompt.CryptoObject(cipher)), + promptInfo = BiometricPrompt.PromptInfo.Builder() + .setTitle(activity.getString(R.string.biometric_prompt_title)) + .setSubtitle(activity.getString(R.string.biometric_prompt_subtitle)) + .setNegativeButtonText(activity.getString(R.string.generic_cancel)) + .build() + ) if (data.authenticationResult != null) { val state = verifyCrypto( @@ -124,11 +139,12 @@ class BiometricControllerImpl( resourceProvider.provideContext().startActivity(enrollIntent) } - private suspend fun authenticate( + override suspend fun authenticate( activity: FragmentActivity, - cipher: Cipher, + biometryCrypto: BiometricCrypto, + promptInfo: BiometricPrompt.PromptInfo ): BiometricPromptData = suspendCancellableCoroutine { continuation -> - BiometricPrompt( + val prompt = BiometricPrompt( activity, ContextCompat.getMainExecutor(activity), object : BiometricPrompt.AuthenticationCallback() { @@ -152,14 +168,14 @@ class BiometricControllerImpl( } } } - ).authenticate( - BiometricPrompt.PromptInfo.Builder() - .setTitle(activity.getString(R.string.biometric_prompt_title)) - .setSubtitle(activity.getString(R.string.biometric_prompt_subtitle)) - .setNegativeButtonText(activity.getString(R.string.generic_cancel)) - .build(), - BiometricPrompt.CryptoObject(cipher) ) + + biometryCrypto.cryptoObject?.let { + prompt.authenticate( + promptInfo, + it + ) + } ?: prompt.authenticate(promptInfo) } private suspend fun retrieveCrypto(): Pair = @@ -227,4 +243,6 @@ data class BiometricPromptData( val authenticationResult: AuthenticationResult?, val errorCode: Int = -1, val errorString: CharSequence = "", -) \ No newline at end of file +) { + val hasError: Boolean get() = errorCode != -1 +} \ No newline at end of file diff --git a/business-logic/src/main/java/eu/europa/ec/businesslogic/controller/security/AndroidPackageController.kt b/business-logic/src/main/java/eu/europa/ec/businesslogic/controller/security/AndroidPackageController.kt index bbd9cdac..4341328b 100644 --- a/business-logic/src/main/java/eu/europa/ec/businesslogic/controller/security/AndroidPackageController.kt +++ b/business-logic/src/main/java/eu/europa/ec/businesslogic/controller/security/AndroidPackageController.kt @@ -25,7 +25,7 @@ import eu.europa.ec.businesslogic.controller.log.LogController import eu.europa.ec.resourceslogic.provider.ResourceProvider import java.nio.charset.StandardCharsets import java.security.MessageDigest -import java.util.* +import java.util.Arrays enum class AndroidInstaller { TRUSTED, UNKNOWN diff --git a/business-logic/src/main/java/eu/europa/ec/businesslogic/controller/walletcore/WalletCoreDocumentsController.kt b/business-logic/src/main/java/eu/europa/ec/businesslogic/controller/walletcore/WalletCoreDocumentsController.kt index fb9d4670..2c444f27 100644 --- a/business-logic/src/main/java/eu/europa/ec/businesslogic/controller/walletcore/WalletCoreDocumentsController.kt +++ b/business-logic/src/main/java/eu/europa/ec/businesslogic/controller/walletcore/WalletCoreDocumentsController.kt @@ -16,9 +16,9 @@ package eu.europa.ec.businesslogic.controller.walletcore -import eu.europa.ec.businesslogic.controller.biometry.BiometryCrypto -import eu.europa.ec.businesslogic.controller.biometry.UserAuthenticationResult +import eu.europa.ec.businesslogic.controller.authentication.UserAuthenticationResult import eu.europa.ec.businesslogic.extension.safeAsync +import eu.europa.ec.businesslogic.model.BiometricCrypto import eu.europa.ec.eudi.wallet.EudiWallet import eu.europa.ec.eudi.wallet.document.DeleteDocumentResult import eu.europa.ec.eudi.wallet.document.Document @@ -43,7 +43,7 @@ sealed class IssueDocumentPartialState { data class Success(val documentId: String) : IssueDocumentPartialState() data class Failure(val errorMessage: String) : IssueDocumentPartialState() data class UserAuthRequired( - val crypto: BiometryCrypto, + val crypto: BiometricCrypto, val resultHandler: UserAuthenticationResult ) : IssueDocumentPartialState() } @@ -52,7 +52,7 @@ sealed class OpenId4VCIIssueDocumentPartialState { data class Success(val documentId: String) : OpenId4VCIIssueDocumentPartialState() data class Failure(val errorMessage: String) : OpenId4VCIIssueDocumentPartialState() data class UserAuthRequired( - val crypto: BiometryCrypto, + val crypto: BiometricCrypto, val resultHandler: UserAuthenticationResult ) : OpenId4VCIIssueDocumentPartialState() } @@ -286,7 +286,7 @@ class WalletCoreDocumentsControllerImpl( is IssueDocumentResult.UserAuthRequired -> { trySendBlocking( OpenId4VCIIssueDocumentPartialState.UserAuthRequired( - BiometryCrypto(result.cryptoObject), + BiometricCrypto(result.cryptoObject), UserAuthenticationResult( onAuthenticationSuccess = { result.resume() }, onAuthenticationError = { result.cancel() }, diff --git a/business-logic/src/main/java/eu/europa/ec/businesslogic/controller/walletcore/WalletCorePresentationController.kt b/business-logic/src/main/java/eu/europa/ec/businesslogic/controller/walletcore/WalletCorePresentationController.kt index 5d5b66a1..d5291087 100644 --- a/business-logic/src/main/java/eu/europa/ec/businesslogic/controller/walletcore/WalletCorePresentationController.kt +++ b/business-logic/src/main/java/eu/europa/ec/businesslogic/controller/walletcore/WalletCorePresentationController.kt @@ -17,10 +17,10 @@ package eu.europa.ec.businesslogic.controller.walletcore import androidx.activity.ComponentActivity -import eu.europa.ec.businesslogic.controller.biometry.BiometryCrypto -import eu.europa.ec.businesslogic.controller.biometry.UserAuthenticationResult +import eu.europa.ec.businesslogic.controller.authentication.UserAuthenticationResult import eu.europa.ec.businesslogic.di.WalletPresentationScope import eu.europa.ec.businesslogic.extension.safeAsync +import eu.europa.ec.businesslogic.model.BiometricCrypto import eu.europa.ec.businesslogic.util.EudiWalletListenerWrapper import eu.europa.ec.eudi.iso18013.transfer.DisclosedDocuments import eu.europa.ec.eudi.iso18013.transfer.RequestDocument @@ -64,7 +64,7 @@ sealed class TransferEventPartialState { sealed class SendRequestedDocumentsPartialState { data class Failure(val error: String) : SendRequestedDocumentsPartialState() data class UserAuthenticationRequired( - val crypto: BiometryCrypto, + val crypto: BiometricCrypto, val resultHandler: UserAuthenticationResult ) : SendRequestedDocumentsPartialState() @@ -79,7 +79,7 @@ sealed class ResponseReceivedPartialState { sealed class WalletCorePartialState { data class UserAuthenticationRequired( - val crypto: BiometryCrypto, + val crypto: BiometricCrypto, val resultHandler: UserAuthenticationResult ) : WalletCorePartialState() @@ -290,7 +290,7 @@ class WalletCorePresentationControllerImpl( is ResponseResult.UserAuthRequired -> { emit( SendRequestedDocumentsPartialState.UserAuthenticationRequired( - BiometryCrypto(response.cryptoObject), + BiometricCrypto(response.cryptoObject), UserAuthenticationResult( onAuthenticationSuccess = { eudiWallet.sendResponse( diff --git a/business-logic/src/main/java/eu/europa/ec/businesslogic/di/LogicBusinessModule.kt b/business-logic/src/main/java/eu/europa/ec/businesslogic/di/LogicBusinessModule.kt index 6a7e1e77..2919c340 100644 --- a/business-logic/src/main/java/eu/europa/ec/businesslogic/di/LogicBusinessModule.kt +++ b/business-logic/src/main/java/eu/europa/ec/businesslogic/di/LogicBusinessModule.kt @@ -23,10 +23,10 @@ import eu.europa.ec.businesslogic.config.ConfigSecurityLogic import eu.europa.ec.businesslogic.config.ConfigSecurityLogicImpl import eu.europa.ec.businesslogic.config.WalletCoreConfig import eu.europa.ec.businesslogic.config.WalletCoreConfigImpl +import eu.europa.ec.businesslogic.controller.authentication.UserAuthenticationController +import eu.europa.ec.businesslogic.controller.authentication.UserAuthenticationControllerImpl import eu.europa.ec.businesslogic.controller.biometry.BiometricController import eu.europa.ec.businesslogic.controller.biometry.BiometricControllerImpl -import eu.europa.ec.businesslogic.controller.biometry.UserAuthenticationController -import eu.europa.ec.businesslogic.controller.biometry.UserAuthenticationControllerImpl import eu.europa.ec.businesslogic.controller.crypto.CryptoController import eu.europa.ec.businesslogic.controller.crypto.CryptoControllerImpl import eu.europa.ec.businesslogic.controller.crypto.KeystoreController diff --git a/business-logic/src/main/java/eu/europa/ec/businesslogic/model/BiometricCrypto.kt b/business-logic/src/main/java/eu/europa/ec/businesslogic/model/BiometricCrypto.kt new file mode 100644 index 00000000..78dce4a7 --- /dev/null +++ b/business-logic/src/main/java/eu/europa/ec/businesslogic/model/BiometricCrypto.kt @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2023 European Commission + * + * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European + * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work + * except in compliance with the Licence. + * + * You may obtain a copy of the Licence at: + * https://joinup.ec.europa.eu/software/page/eupl + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the Licence is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF + * ANY KIND, either express or implied. See the Licence for the specific language + * governing permissions and limitations under the Licence. + */ + +package eu.europa.ec.businesslogic.model + +import androidx.biometric.BiometricPrompt + +data class BiometricCrypto(val cryptoObject: BiometricPrompt.CryptoObject?) \ No newline at end of file diff --git a/common-feature/src/androidTest/java/eu/europa/ec/commonfeature/ExampleInstrumentedTest.kt b/common-feature/src/androidTest/java/eu/europa/ec/commonfeature/ExampleInstrumentedTest.kt index 25948e6b..02a42aea 100644 --- a/common-feature/src/androidTest/java/eu/europa/ec/commonfeature/ExampleInstrumentedTest.kt +++ b/common-feature/src/androidTest/java/eu/europa/ec/commonfeature/ExampleInstrumentedTest.kt @@ -18,7 +18,7 @@ package eu.europa.ec.commonfeature import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry -import org.junit.Assert.* +import org.junit.Assert.assertEquals import org.junit.Test import org.junit.runner.RunWith diff --git a/common-feature/src/main/java/eu/europa/ec/commonfeature/di/FeatureCommonModule.kt b/common-feature/src/main/java/eu/europa/ec/commonfeature/di/FeatureCommonModule.kt index 7be05538..1ed94044 100644 --- a/common-feature/src/main/java/eu/europa/ec/commonfeature/di/FeatureCommonModule.kt +++ b/common-feature/src/main/java/eu/europa/ec/commonfeature/di/FeatureCommonModule.kt @@ -16,8 +16,8 @@ package eu.europa.ec.commonfeature.di +import eu.europa.ec.businesslogic.controller.authentication.UserAuthenticationController import eu.europa.ec.businesslogic.controller.biometry.BiometricController -import eu.europa.ec.businesslogic.controller.biometry.UserAuthenticationController import eu.europa.ec.businesslogic.controller.storage.PrefKeys import eu.europa.ec.businesslogic.validator.FormValidator import eu.europa.ec.commonfeature.interactor.BiometricInteractor diff --git a/common-feature/src/main/java/eu/europa/ec/commonfeature/interactor/UserAuthenticationInteractor.kt b/common-feature/src/main/java/eu/europa/ec/commonfeature/interactor/UserAuthenticationInteractor.kt index cef18931..32a91ab9 100644 --- a/common-feature/src/main/java/eu/europa/ec/commonfeature/interactor/UserAuthenticationInteractor.kt +++ b/common-feature/src/main/java/eu/europa/ec/commonfeature/interactor/UserAuthenticationInteractor.kt @@ -17,16 +17,16 @@ package eu.europa.ec.commonfeature.interactor import android.content.Context +import eu.europa.ec.businesslogic.controller.authentication.UserAuthenticationController +import eu.europa.ec.businesslogic.controller.authentication.UserAuthenticationResult import eu.europa.ec.businesslogic.controller.biometry.BiometricsAvailability -import eu.europa.ec.businesslogic.controller.biometry.BiometryCrypto -import eu.europa.ec.businesslogic.controller.biometry.UserAuthenticationController -import eu.europa.ec.businesslogic.controller.biometry.UserAuthenticationResult +import eu.europa.ec.businesslogic.model.BiometricCrypto interface UserAuthenticationInteractor { fun getBiometricsAvailability(listener: (BiometricsAvailability) -> Unit) fun authenticateWithBiometrics( context: Context, - crypto: BiometryCrypto, + crypto: BiometricCrypto, resultHandler: UserAuthenticationResult ) } @@ -39,7 +39,7 @@ class UserAuthenticationInteractorImpl(private val userAuthenticationController: override fun authenticateWithBiometrics( context: Context, - crypto: BiometryCrypto, + crypto: BiometricCrypto, resultHandler: UserAuthenticationResult ) { userAuthenticationController.authenticate( diff --git a/dashboard-feature/src/androidTest/java/eu/europa/ec/dashboardfeature/ExampleInstrumentedTest.kt b/dashboard-feature/src/androidTest/java/eu/europa/ec/dashboardfeature/ExampleInstrumentedTest.kt index f9562f41..abb3461d 100644 --- a/dashboard-feature/src/androidTest/java/eu/europa/ec/dashboardfeature/ExampleInstrumentedTest.kt +++ b/dashboard-feature/src/androidTest/java/eu/europa/ec/dashboardfeature/ExampleInstrumentedTest.kt @@ -18,7 +18,7 @@ package eu.europa.ec.dashboardfeature import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry -import org.junit.Assert.* +import org.junit.Assert.assertEquals import org.junit.Test import org.junit.runner.RunWith diff --git a/gradle.properties b/gradle.properties index 9d4a750a..6a85e8ce 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,7 +14,7 @@ # governing permissions and limitations under the Licence. # -org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-Xmx8192m -Dfile.encoding=UTF-8 android.useAndroidX=true kotlin.code.style=official android.nonTransitiveRClass=true diff --git a/issuance-feature/src/androidTest/java/eu/europa/ec/issuancefeature/ExampleInstrumentedTest.kt b/issuance-feature/src/androidTest/java/eu/europa/ec/issuancefeature/ExampleInstrumentedTest.kt index 05b8fa7f..a50018bd 100644 --- a/issuance-feature/src/androidTest/java/eu/europa/ec/issuancefeature/ExampleInstrumentedTest.kt +++ b/issuance-feature/src/androidTest/java/eu/europa/ec/issuancefeature/ExampleInstrumentedTest.kt @@ -18,7 +18,7 @@ package eu.europa.ec.issuancefeature import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry -import org.junit.Assert.* +import org.junit.Assert.assertEquals import org.junit.Test import org.junit.runner.RunWith diff --git a/issuance-feature/src/main/java/eu/europa/ec/issuancefeature/interactor/document/AddDocumentInteractor.kt b/issuance-feature/src/main/java/eu/europa/ec/issuancefeature/interactor/document/AddDocumentInteractor.kt index 2eec7773..924500e1 100644 --- a/issuance-feature/src/main/java/eu/europa/ec/issuancefeature/interactor/document/AddDocumentInteractor.kt +++ b/issuance-feature/src/main/java/eu/europa/ec/issuancefeature/interactor/document/AddDocumentInteractor.kt @@ -17,14 +17,14 @@ package eu.europa.ec.issuancefeature.interactor.document import android.content.Context +import eu.europa.ec.businesslogic.controller.authentication.UserAuthenticationResult import eu.europa.ec.businesslogic.controller.biometry.BiometricsAvailability -import eu.europa.ec.businesslogic.controller.biometry.BiometryCrypto -import eu.europa.ec.businesslogic.controller.biometry.UserAuthenticationResult import eu.europa.ec.businesslogic.controller.walletcore.AddSampleDataPartialState import eu.europa.ec.businesslogic.controller.walletcore.IssuanceMethod import eu.europa.ec.businesslogic.controller.walletcore.IssueDocumentPartialState import eu.europa.ec.businesslogic.controller.walletcore.WalletCoreDocumentsController import eu.europa.ec.businesslogic.extension.safeAsync +import eu.europa.ec.businesslogic.model.BiometricCrypto import eu.europa.ec.commonfeature.config.IssuanceFlowUiConfig import eu.europa.ec.commonfeature.interactor.UserAuthenticationInteractor import eu.europa.ec.commonfeature.model.DocumentOptionItemUi @@ -55,7 +55,7 @@ interface AddDocumentInteractor { fun handleUserAuth( context: Context, - crypto: BiometryCrypto, + crypto: BiometricCrypto, resultHandler: UserAuthenticationResult ) } @@ -120,7 +120,7 @@ class AddDocumentInteractorImpl( override fun handleUserAuth( context: Context, - crypto: BiometryCrypto, + crypto: BiometricCrypto, resultHandler: UserAuthenticationResult ) { userAuthenticationInteractor.getBiometricsAvailability { diff --git a/issuance-feature/src/main/java/eu/europa/ec/issuancefeature/ui/document/add/AddDocumentViewModel.kt b/issuance-feature/src/main/java/eu/europa/ec/issuancefeature/ui/document/add/AddDocumentViewModel.kt index a1f14011..066e9f1e 100644 --- a/issuance-feature/src/main/java/eu/europa/ec/issuancefeature/ui/document/add/AddDocumentViewModel.kt +++ b/issuance-feature/src/main/java/eu/europa/ec/issuancefeature/ui/document/add/AddDocumentViewModel.kt @@ -18,7 +18,7 @@ package eu.europa.ec.issuancefeature.ui.document.add import android.content.Context import androidx.lifecycle.viewModelScope -import eu.europa.ec.businesslogic.controller.biometry.UserAuthenticationResult +import eu.europa.ec.businesslogic.controller.authentication.UserAuthenticationResult import eu.europa.ec.businesslogic.controller.walletcore.AddSampleDataPartialState import eu.europa.ec.businesslogic.controller.walletcore.IssuanceMethod import eu.europa.ec.businesslogic.controller.walletcore.IssueDocumentPartialState diff --git a/login-feature/src/androidTest/java/eu/europa/ec/loginfeature/ExampleInstrumentedTest.kt b/login-feature/src/androidTest/java/eu/europa/ec/loginfeature/ExampleInstrumentedTest.kt index ce3477d9..05b2e89e 100644 --- a/login-feature/src/androidTest/java/eu/europa/ec/loginfeature/ExampleInstrumentedTest.kt +++ b/login-feature/src/androidTest/java/eu/europa/ec/loginfeature/ExampleInstrumentedTest.kt @@ -18,7 +18,7 @@ package eu.europa.ec.loginfeature import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry -import org.junit.Assert.* +import org.junit.Assert.assertEquals import org.junit.Test import org.junit.runner.RunWith diff --git a/presentation-feature/src/androidTest/java/eu/europa/ec/presentationfeature/ExampleInstrumentedTest.kt b/presentation-feature/src/androidTest/java/eu/europa/ec/presentationfeature/ExampleInstrumentedTest.kt index 14275606..f31579ee 100644 --- a/presentation-feature/src/androidTest/java/eu/europa/ec/presentationfeature/ExampleInstrumentedTest.kt +++ b/presentation-feature/src/androidTest/java/eu/europa/ec/presentationfeature/ExampleInstrumentedTest.kt @@ -18,7 +18,7 @@ package eu.europa.ec.presentationfeature import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry -import org.junit.Assert.* +import org.junit.Assert.assertEquals import org.junit.Test import org.junit.runner.RunWith diff --git a/presentation-feature/src/main/java/eu/europa/ec/presentationfeature/interactor/PresentationLoadingInteractor.kt b/presentation-feature/src/main/java/eu/europa/ec/presentationfeature/interactor/PresentationLoadingInteractor.kt index 5c316a7c..e711a27d 100644 --- a/presentation-feature/src/main/java/eu/europa/ec/presentationfeature/interactor/PresentationLoadingInteractor.kt +++ b/presentation-feature/src/main/java/eu/europa/ec/presentationfeature/interactor/PresentationLoadingInteractor.kt @@ -17,11 +17,11 @@ package eu.europa.ec.presentationfeature.interactor import android.content.Context +import eu.europa.ec.businesslogic.controller.authentication.UserAuthenticationResult import eu.europa.ec.businesslogic.controller.biometry.BiometricsAvailability -import eu.europa.ec.businesslogic.controller.biometry.BiometryCrypto -import eu.europa.ec.businesslogic.controller.biometry.UserAuthenticationResult import eu.europa.ec.businesslogic.controller.walletcore.WalletCorePartialState import eu.europa.ec.businesslogic.controller.walletcore.WalletCorePresentationController +import eu.europa.ec.businesslogic.model.BiometricCrypto import eu.europa.ec.commonfeature.interactor.UserAuthenticationInteractor import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.mapNotNull @@ -29,7 +29,7 @@ import java.net.URI sealed class PresentationLoadingObserveResponsePartialState { data class UserAuthenticationRequired( - val crypto: BiometryCrypto, + val crypto: BiometricCrypto, val resultHandler: UserAuthenticationResult ) : PresentationLoadingObserveResponsePartialState() @@ -44,7 +44,7 @@ interface PresentationLoadingInteractor { fun observeResponse(): Flow fun handleUserAuthentication( context: Context, - crypto: BiometryCrypto, + crypto: BiometricCrypto, resultHandler: UserAuthenticationResult ) } @@ -82,7 +82,7 @@ class PresentationLoadingInteractorImpl( override fun handleUserAuthentication( context: Context, - crypto: BiometryCrypto, + crypto: BiometricCrypto, resultHandler: UserAuthenticationResult ) { userAuthenticationInteractor.getBiometricsAvailability { diff --git a/presentation-feature/src/main/java/eu/europa/ec/presentationfeature/ui/loading/PresentationLoadingViewModel.kt b/presentation-feature/src/main/java/eu/europa/ec/presentationfeature/ui/loading/PresentationLoadingViewModel.kt index 89709bbf..b3bae925 100644 --- a/presentation-feature/src/main/java/eu/europa/ec/presentationfeature/ui/loading/PresentationLoadingViewModel.kt +++ b/presentation-feature/src/main/java/eu/europa/ec/presentationfeature/ui/loading/PresentationLoadingViewModel.kt @@ -18,7 +18,7 @@ package eu.europa.ec.presentationfeature.ui.loading import android.content.Context import androidx.lifecycle.viewModelScope -import eu.europa.ec.businesslogic.controller.biometry.UserAuthenticationResult +import eu.europa.ec.businesslogic.controller.authentication.UserAuthenticationResult import eu.europa.ec.businesslogic.di.getOrCreatePresentationScope import eu.europa.ec.commonfeature.config.SuccessUIConfig import eu.europa.ec.commonfeature.ui.loading.Effect diff --git a/proximity-feature/src/androidTest/java/eu/europa/ec/proximityfeature/ExampleInstrumentedTest.kt b/proximity-feature/src/androidTest/java/eu/europa/ec/proximityfeature/ExampleInstrumentedTest.kt index 52e4ef56..4e2b3d2f 100644 --- a/proximity-feature/src/androidTest/java/eu/europa/ec/proximityfeature/ExampleInstrumentedTest.kt +++ b/proximity-feature/src/androidTest/java/eu/europa/ec/proximityfeature/ExampleInstrumentedTest.kt @@ -18,7 +18,7 @@ package eu.europa.ec.proximityfeature import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry -import org.junit.Assert.* +import org.junit.Assert.assertEquals import org.junit.Test import org.junit.runner.RunWith diff --git a/proximity-feature/src/main/java/eu/europa/ec/proximityfeature/interactor/ProximityLoadingInteractor.kt b/proximity-feature/src/main/java/eu/europa/ec/proximityfeature/interactor/ProximityLoadingInteractor.kt index faba22ef..7b1f2b41 100644 --- a/proximity-feature/src/main/java/eu/europa/ec/proximityfeature/interactor/ProximityLoadingInteractor.kt +++ b/proximity-feature/src/main/java/eu/europa/ec/proximityfeature/interactor/ProximityLoadingInteractor.kt @@ -17,18 +17,18 @@ package eu.europa.ec.proximityfeature.interactor import android.content.Context +import eu.europa.ec.businesslogic.controller.authentication.UserAuthenticationResult import eu.europa.ec.businesslogic.controller.biometry.BiometricsAvailability -import eu.europa.ec.businesslogic.controller.biometry.BiometryCrypto -import eu.europa.ec.businesslogic.controller.biometry.UserAuthenticationResult import eu.europa.ec.businesslogic.controller.walletcore.WalletCorePartialState import eu.europa.ec.businesslogic.controller.walletcore.WalletCorePresentationController +import eu.europa.ec.businesslogic.model.BiometricCrypto import eu.europa.ec.commonfeature.interactor.UserAuthenticationInteractor import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.mapNotNull sealed class ProximityLoadingObserveResponsePartialState { data class UserAuthenticationRequired( - val crypto: BiometryCrypto, + val crypto: BiometricCrypto, val resultHandler: UserAuthenticationResult ) : ProximityLoadingObserveResponsePartialState() @@ -42,7 +42,7 @@ interface ProximityLoadingInteractor { fun observeResponse(): Flow fun handleUserAuthentication( context: Context, - crypto: BiometryCrypto, + crypto: BiometricCrypto, resultHandler: UserAuthenticationResult ) } @@ -75,7 +75,7 @@ class ProximityLoadingInteractorImpl( override fun handleUserAuthentication( context: Context, - crypto: BiometryCrypto, + crypto: BiometricCrypto, resultHandler: UserAuthenticationResult ) { userAuthenticationInteractor.getBiometricsAvailability { diff --git a/proximity-feature/src/main/java/eu/europa/ec/proximityfeature/ui/loading/ProximityLoadingViewModel.kt b/proximity-feature/src/main/java/eu/europa/ec/proximityfeature/ui/loading/ProximityLoadingViewModel.kt index 14bbc22e..0be8e193 100644 --- a/proximity-feature/src/main/java/eu/europa/ec/proximityfeature/ui/loading/ProximityLoadingViewModel.kt +++ b/proximity-feature/src/main/java/eu/europa/ec/proximityfeature/ui/loading/ProximityLoadingViewModel.kt @@ -18,7 +18,7 @@ package eu.europa.ec.proximityfeature.ui.loading import android.content.Context import androidx.lifecycle.viewModelScope -import eu.europa.ec.businesslogic.controller.biometry.UserAuthenticationResult +import eu.europa.ec.businesslogic.controller.authentication.UserAuthenticationResult import eu.europa.ec.businesslogic.di.getOrCreatePresentationScope import eu.europa.ec.commonfeature.config.SuccessUIConfig import eu.europa.ec.commonfeature.ui.loading.Effect diff --git a/startup-feature/src/androidTest/java/eu/europa/ec/startupfeature/ExampleInstrumentedTest.kt b/startup-feature/src/androidTest/java/eu/europa/ec/startupfeature/ExampleInstrumentedTest.kt index aee694c3..1424675e 100644 --- a/startup-feature/src/androidTest/java/eu/europa/ec/startupfeature/ExampleInstrumentedTest.kt +++ b/startup-feature/src/androidTest/java/eu/europa/ec/startupfeature/ExampleInstrumentedTest.kt @@ -18,7 +18,7 @@ package eu.europa.ec.startupfeature import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry -import org.junit.Assert.* +import org.junit.Assert.assertEquals import org.junit.Test import org.junit.runner.RunWith