diff --git a/app/build.gradle.kts b/app/build.gradle.kts index e4d8347..d6020e5 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -50,6 +50,19 @@ android { versionNameSuffix = ".debug" } } + + flavorDimensions += "version" + productFlavors { + create("real") { + dimension = "version" + } + create("mock") { + dimension = "version" + applicationIdSuffix = ".mock" + versionNameSuffix = "-mock" + } + } + compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 diff --git a/app/src/main/java/by/alexandr7035/affinidi_id/di/DataModule.kt b/app/src/main/java/by/alexandr7035/affinidi_id/di/DataModule.kt index 4f9af92..4f61bbe 100644 --- a/app/src/main/java/by/alexandr7035/affinidi_id/di/DataModule.kt +++ b/app/src/main/java/by/alexandr7035/affinidi_id/di/DataModule.kt @@ -2,6 +2,7 @@ package by.alexandr7035.affinidi_id.di import android.content.Context import androidx.room.Room +import by.alexandr7035.affinidi_id.BuildConfig import by.alexandr7035.affinidi_id.domain.repository.* import by.alexandr7035.affinidi_id.presentation.common.validation.InputValidationHelper import by.alexandr7035.affinidi_id.presentation.common.validation.InputValidationHelperImpl @@ -28,7 +29,14 @@ import by.alexandr7035.data.helpers.vc_mapping.CredentialSubjectCasterImpl import by.alexandr7035.data.helpers.vc_mapping.SignedCredentialToDomainMapper import by.alexandr7035.data.helpers.vc_mapping.SignedCredentialToDomainMapperImpl import by.alexandr7035.data.repository.* -import com.cioccarellia.ksprefs.BuildConfig +import by.alexandr7035.data.repository_mock.ChangeProfileRepositoryMock +import by.alexandr7035.data.repository_mock.IssueCredentialsRepositoryMock +import by.alexandr7035.data.repository_mock.LoginRepositoryMock +import by.alexandr7035.data.repository_mock.ProfileRepositoryMock +import by.alexandr7035.data.repository_mock.RegistrationRepositoryMock +import by.alexandr7035.data.repository_mock.ResetPasswordRepositoryMock +import by.alexandr7035.data.repository_mock.StoredCredentialsRepositoryMock +import by.alexandr7035.data.repository_mock.VerificationRepositoryMock import com.cioccarellia.ksprefs.KsPrefs import com.cioccarellia.ksprefs.config.EncryptionType import com.cioccarellia.ksprefs.config.model.AutoSavePolicy @@ -80,12 +88,6 @@ object DataModule { return ApiCallHelperImpl() } - @Provides - @Singleton - fun provideProfileRepository(appSettings: AppSettings): ProfileRepository { - return ProfileRepositoryImpl(appSettings) - } - @Provides @Singleton fun provideAvatarsHelper(): DicebearAvatarsHelper { @@ -104,6 +106,19 @@ object DataModule { return retrofit.create(CredentialsApiService::class.java) } + @Provides + @Singleton + fun provideProfileRepository( + appSettings: AppSettings, + avatarsHelper: DicebearAvatarsHelper + ): ProfileRepository { + return if (isMockBuild()) { + ProfileRepositoryMock(avatarsHelper) + } else { + ProfileRepositoryImpl(appSettings) + } + } + @Provides @Singleton fun provideLoginRepository( @@ -112,7 +127,11 @@ object DataModule { appSettings: AppSettings, credentialsCacheDataSource: CredentialsCacheDataSource ): LoginRepository { - return LoginRepositoryImpl(userApiService, apiCallHelper, appSettings, credentialsCacheDataSource) + return if (isMockBuild()) { + LoginRepositoryMock(appSettings) + } else { + LoginRepositoryImpl(userApiService, apiCallHelper, appSettings, credentialsCacheDataSource) + } } @Provides @@ -120,13 +139,22 @@ object DataModule { fun provideRegistrationRepository( userApiService: UserApiService, apiCallHelper: ApiCallHelper, appSettings: AppSettings ): RegistrationRepository { - return RegistrationRepositoryImpl(userApiService, apiCallHelper, appSettings) + + return if (isMockBuild()) { + RegistrationRepositoryMock() + } else { + RegistrationRepositoryImpl(userApiService, apiCallHelper, appSettings) + } } @Provides @Singleton fun provideResetPasswordRepository(userApiService: UserApiService, apiCallHelper: ApiCallHelper): ResetPasswordRepository { - return ResetPasswordRepositoryImpl(userApiService, apiCallHelper) + return if (isMockBuild()) { + ResetPasswordRepositoryMock() + } else { + ResetPasswordRepositoryImpl(userApiService, apiCallHelper) + } } @Provides @@ -134,7 +162,11 @@ object DataModule { fun provideChangeProfileRepository( userApiService: UserApiService, apiCallHelper: ApiCallHelper, appSettings: AppSettings ): ChangeProfileRepository { - return ChangeProfileRepositoryImpl(userApiService, apiCallHelper, appSettings) + return if (isMockBuild()) { + ChangeProfileRepositoryMock() + } else { + ChangeProfileRepositoryImpl(userApiService, apiCallHelper, appSettings) + } } @Provides @@ -175,14 +207,19 @@ object DataModule { credentialToDomainMapper: SignedCredentialToDomainMapper, appSettings: AppSettings, ): StoredCredentialsRepository { - return StoredCredentialsRepositoryImpl( - credentialsApiService, - apiCallHelper, - credentialsCloudDataSource, - credentialsCacheDataSource, - credentialToDomainMapper, - appSettings - ) + + return if (isMockBuild()) { + StoredCredentialsRepositoryMock() + } else { + StoredCredentialsRepositoryImpl( + credentialsApiService, + apiCallHelper, + credentialsCloudDataSource, + credentialsCacheDataSource, + credentialToDomainMapper, + appSettings + ) + } } @Provides @@ -200,7 +237,11 @@ object DataModule { @Provides @Singleton fun provideIssueCredentialsRepository(vcIssuanceHelper: VCIssuanceHelper): IssueCredentialsRepository { - return IssueCredentialsRepositoryImpl(vcIssuanceHelper) + return if (isMockBuild()) { + IssueCredentialsRepositoryMock() + } else { + IssueCredentialsRepositoryImpl(vcIssuanceHelper) + } } @Provides @@ -211,7 +252,11 @@ object DataModule { signedCredentialToDomainMapper: SignedCredentialToDomainMapper, gson: Gson ): VerificationRepository { - return VerificationRepositoryImpl(credentialsApiService, apiCallHelper, signedCredentialToDomainMapper, gson) + return if (isMockBuild()) { + VerificationRepositoryMock() + } else { + VerificationRepositoryImpl(credentialsApiService, apiCallHelper, signedCredentialToDomainMapper, gson) + } } @Provides @@ -248,4 +293,8 @@ object DataModule { fun provideAppSettings(prefs: KsPrefs, avatarsHelper: DicebearAvatarsHelper): AppSettings { return AppSettingsImpl(prefs, avatarsHelper) } + + private fun isMockBuild(): Boolean { + return BuildConfig.FLAVOR == "mock" + } } \ No newline at end of file diff --git a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/common/credentials/credential_card/CredentialCardMapperImpl.kt b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/common/credentials/credential_card/CredentialCardMapperImpl.kt index 417122e..3b067ce 100644 --- a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/common/credentials/credential_card/CredentialCardMapperImpl.kt +++ b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/common/credentials/credential_card/CredentialCardMapperImpl.kt @@ -47,11 +47,14 @@ class CredentialCardMapperImpl @Inject constructor( val formattedHolderDid = credential.holderDid.split(";").first() val prettifiedHolderDid = formattedHolderDid.getPrettifiedDid() + val formattedIssuerDid = credential.issuerDid.split(";").first() + val prettifiedIssuerDid = formattedIssuerDid.getPrettifiedDid() + val credentialStatusUi = credentialStatusMapper.map(credential.credentialStatus) return CredentialCardUi( id = credential.id, - issuerDid = prettifiedHolderDid, + issuerDid = prettifiedIssuerDid, holderDid = prettifiedHolderDid, issuanceDateText = issuanceDate, credentialStatusUi = credentialStatusUi, diff --git a/data/src/main/java/by/alexandr7035/data/repository_mock/ChangeProfileRepositoryMock.kt b/data/src/main/java/by/alexandr7035/data/repository_mock/ChangeProfileRepositoryMock.kt new file mode 100644 index 0000000..46b81d6 --- /dev/null +++ b/data/src/main/java/by/alexandr7035/data/repository_mock/ChangeProfileRepositoryMock.kt @@ -0,0 +1,19 @@ +package by.alexandr7035.data.repository_mock + +import by.alexandr7035.affinidi_id.domain.core.ErrorType +import by.alexandr7035.affinidi_id.domain.model.profile.change_password.ChangePasswordReqModel +import by.alexandr7035.affinidi_id.domain.model.profile.change_password.ChangePasswordResModel +import by.alexandr7035.affinidi_id.domain.repository.ChangeProfileRepository +import kotlinx.coroutines.delay + +class ChangeProfileRepositoryMock : ChangeProfileRepository { + override suspend fun changePassword(changePasswordReqModel: ChangePasswordReqModel): ChangePasswordResModel { + delay(MockConstants.MOCK_REQ_DELAY_MILLS) + + return if (changePasswordReqModel.oldPassword == MockConstants.MOCK_PASSWORD) { + ChangePasswordResModel.Success + } else { + ChangePasswordResModel.Fail(ErrorType.WRONG_CURRENT_PASSWORD) + } + } +} \ No newline at end of file diff --git a/data/src/main/java/by/alexandr7035/data/repository_mock/IssueCredentialsRepositoryMock.kt b/data/src/main/java/by/alexandr7035/data/repository_mock/IssueCredentialsRepositoryMock.kt new file mode 100644 index 0000000..dcb6e7d --- /dev/null +++ b/data/src/main/java/by/alexandr7035/data/repository_mock/IssueCredentialsRepositoryMock.kt @@ -0,0 +1,14 @@ +package by.alexandr7035.data.repository_mock + +import by.alexandr7035.affinidi_id.domain.core.ErrorType +import by.alexandr7035.affinidi_id.domain.model.credentials.issue_vc.IssueCredentialReqModel +import by.alexandr7035.affinidi_id.domain.model.credentials.issue_vc.IssueCredentialResModel +import by.alexandr7035.affinidi_id.domain.repository.IssueCredentialsRepository +import kotlinx.coroutines.delay + +class IssueCredentialsRepositoryMock: IssueCredentialsRepository { + override suspend fun issueCredential(issueCredentialReqModel: IssueCredentialReqModel): IssueCredentialResModel { + delay(MockConstants.MOCK_REQ_DELAY_MILLS) + return IssueCredentialResModel.Fail(ErrorType.ALREADY_HAVE_CREDENTIAL) + } +} \ No newline at end of file diff --git a/data/src/main/java/by/alexandr7035/data/repository_mock/LoginRepositoryMock.kt b/data/src/main/java/by/alexandr7035/data/repository_mock/LoginRepositoryMock.kt new file mode 100644 index 0000000..00aa26d --- /dev/null +++ b/data/src/main/java/by/alexandr7035/data/repository_mock/LoginRepositoryMock.kt @@ -0,0 +1,51 @@ +package by.alexandr7035.data.repository_mock + +import by.alexandr7035.affinidi_id.domain.core.ErrorType +import by.alexandr7035.affinidi_id.domain.core.GenericRes +import by.alexandr7035.affinidi_id.domain.model.login.AuthCredentials +import by.alexandr7035.affinidi_id.domain.model.login.LogOutModel +import by.alexandr7035.affinidi_id.domain.repository.AppSettings +import by.alexandr7035.affinidi_id.domain.repository.LoginRepository +import kotlinx.coroutines.delay + +class LoginRepositoryMock( + private val appSettings: AppSettings +): LoginRepository { + override suspend fun signIn(userName: String, password: String): GenericRes { + delay(MockConstants.MOCK_REQ_DELAY_MILLS) + + return if (userName == MockConstants.MOCK_LOGIN && password == MockConstants.MOCK_PASSWORD) { + appSettings.setAuthCredentials( + AuthCredentials( + userDid = MockConstants.MOCK_DID, + userEmail = MockConstants.MOCK_LOGIN, + accessToken = "access_token_mock", + refreshToken = "refresh_token_mock", + accessTokenObtained = System.currentTimeMillis() + ) + ) + + GenericRes.Success(Unit) + } else { + GenericRes.Fail(ErrorType.WRONG_USERNAME_OR_PASSWORD) + } + } + + override suspend fun signInWithRefreshToken(): GenericRes { + delay(MockConstants.MOCK_REQ_DELAY_MILLS) + + appSettings.updateAuthCredentials( + accessToken = "access_token_mock", + accessTokenRefreshedDate = System.currentTimeMillis() + ) + + return GenericRes.Success(Unit) + } + + override suspend fun logOut(): LogOutModel { + delay(MockConstants.MOCK_REQ_DELAY_MILLS) + + appSettings.clearSettings() + return LogOutModel.Success + } +} \ No newline at end of file diff --git a/data/src/main/java/by/alexandr7035/data/repository_mock/MockConstants.kt b/data/src/main/java/by/alexandr7035/data/repository_mock/MockConstants.kt new file mode 100644 index 0000000..b9cac71 --- /dev/null +++ b/data/src/main/java/by/alexandr7035/data/repository_mock/MockConstants.kt @@ -0,0 +1,77 @@ +package by.alexandr7035.data.repository_mock + +import by.alexandr7035.affinidi_id.domain.model.credentials.stored_credentials.Credential +import by.alexandr7035.affinidi_id.domain.model.credentials.stored_credentials.CredentialProof +import by.alexandr7035.affinidi_id.domain.model.credentials.stored_credentials.CredentialStatus + +object MockConstants { + const val MOCK_LOGIN = "test@mail.com" + const val MOCK_PASSWORD = "1234567Ab" + const val MOCK_DID = "did:mock:1234567abcd" + const val MOCK_ISSUER_DID = "did:mock:45678910abcd" + const val MOCK_REQ_DELAY_MILLS = 1000L + + const val MOCK_QR_CODE = "iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAIAAAAiOjnJAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAgAElEQVR4nO19b4xWR/X/3O6fwqJd2BZWCJV0KQ10DTQVXwDBjWIhDSaGWFcTm8a0TcTYtJKNNWi0lVgJaU3QpO0aUdPa1KpVooLJRq20hta1QFnMkq5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uk3NmJdPXOSSE6zj7NiVbEzgpmnzChzVWTGErcuB9tzCd9j4zLtRF7fzgZwnNLjQ3TOFQUaoQB+LFSMCbtczTowCDTNka0avcIsV47wPDQ2dP3++WDlYTExMOP7LWhSEefPmXXPNNahwdHT02LFjLD0yLbYR7+zspGc3tLS0UMqRkZH//e9/qHBycpLeML7uuutsYsDyVBWWLl1Kzx8MwsDAACphP+5ig18XLdEitiI1Bfh0g4nMC3m6wZZfcAwR+xkVc8G+TJE+3cA2YeNG35jQXBrC/XCEIZY/3cDi3fzJE4SiAiXW53BE+6iKqSiRhzahQeYFimGLimC5oTRTC90PJGrYuERhqiqWLs050MROp/PkJlCcM0QpbZypOtpaYX8inaNjop1+cBmYqooVuvi8cwx5UmJHXMYqt0Q8aG9ocMOKYUrc3UFkrKqVjamqWEKTYCDfmzR3Hq5tRlPKUGHccrJioJ3OESSye3Hhpt3b2amqWNHT6aC3pUsUsVgsk/xZEpt/5uCJtmmV1XVbuxWAJ92Q82ZnqUAT2djYSKWlj/0nSdLQ0EApTQl0mR3bHOuqa5KnYKVqbGxkd0Cb544aZS9gXeSna5I7ZEdAjubmZq/9k76iHmpIaRVJSWUQ2i6dmDzV4/jYvHuHYDQwlJhkd2flMW/NfZmzjncHpqqPVUeNo65YdZSCumLVUQrqilVHKagrVh2loK5YdZSCumLVUQrqilVHKagrVh2l4P8ARyM/iiIYIQcAAAAASUVORK5CYII=" + + val CREDENTIALS = listOf( + Credential( + vcType = "Proof of E-mail", + vcSchema = "http//exampleschemas.com/email.json", + credentialStatus = CredentialStatus.Active, + credentialSubjectData = "{\"email\":\"${MOCK_LOGIN}\"}", + expirationDate = 1735689600000L, + issuanceDate = 1672531200000L, + issuerDid = MOCK_ISSUER_DID, + id = "claimid:123", + holderDid = MOCK_DID, + credentialProof = CredentialProof( + creationDate = 1672531200000L, + proofPurpose = "assertionMethod", + verificationMethod = "${MOCK_DID}#primary", + jws = "JTrUe7GOobRsZf5w+djg4qaAWDdukc4dg+kog3CwoiA9vJqqgUAhrTkashDrvxaFksR6Ngx1Cib+RV9X1XC/HccfoBTMMdkSe9t/IVhDBD/i9rAtEW/lWNWJw", + type = "EcdsaSecp256k1Signature2019" + ), + rawVCData = "{}" + ), + + Credential( + vcType = "Proof of GitHub", + vcSchema = "http//exampleschemas.com/githubl.json", + credentialStatus = CredentialStatus.Active, + credentialSubjectData = "{\"username\":\"@user123\", \"stars\":\"200\", \"forks\":\"10\"}", + expirationDate = 1735689600000L, + issuanceDate = 1672531200000L, + issuerDid = MOCK_ISSUER_DID, + id = "claimid:456", + holderDid = MOCK_DID, + credentialProof = CredentialProof( + creationDate = 1672531200000L, + proofPurpose = "assertionMethod", + verificationMethod = "${MOCK_DID}#primary", + jws = "JTrUe7GOobRsZf5w+djg4qaAWDdukc4dg+kog3CwoiA9vJqqgUAhrTkashDrvxaFksR6Ngx1Cib+RV9X1XC/HccfoBTMMdkSe9t/IVhDBD/i9rAtEW/lWNWJw", + type = "EcdsaSecp256k1Signature2019" + ), + rawVCData = "{}" + ), + + Credential( + vcType = "Proof of E-mail", + vcSchema = "http//exampleschemas.com/email.json", + credentialStatus = CredentialStatus.Expired, + credentialSubjectData = "{\"email\":\"${MOCK_LOGIN}\"}", + expirationDate = 1685635468000L, + issuanceDate = 1672531200000L, + issuerDid = MOCK_ISSUER_DID, + id = "claimid:789", + holderDid = MOCK_DID, + credentialProof = CredentialProof( + creationDate = 1672531200000L, + proofPurpose = "assertionMethod", + verificationMethod = "${MOCK_DID}#primary", + jws = "JTrUe7GOobRsZf5w+djg4qaAWDdukc4dg+kog3CwoiA9vJqqgUAhrTkashDrvxaFksR6Ngx1Cib+RV9X1XC/HccfoBTMMdkSe9t/IVhDBD/i9rAtEW/lWNWJw", + type = "EcdsaSecp256k1Signature2019" + ), + rawVCData = "{}" + ), + ) +} \ No newline at end of file diff --git a/data/src/main/java/by/alexandr7035/data/repository_mock/ProfileRepositoryMock.kt b/data/src/main/java/by/alexandr7035/data/repository_mock/ProfileRepositoryMock.kt new file mode 100644 index 0000000..0874370 --- /dev/null +++ b/data/src/main/java/by/alexandr7035/data/repository_mock/ProfileRepositoryMock.kt @@ -0,0 +1,22 @@ +package by.alexandr7035.data.repository_mock + +import by.alexandr7035.affinidi_id.domain.model.profile.UserProfile +import by.alexandr7035.affinidi_id.domain.repository.ProfileRepository +import by.alexandr7035.data.helpers.profile_avatars.DicebearAvatarsHelper +import by.alexandr7035.data.helpers.profile_avatars.DicebearImageType + +class ProfileRepositoryMock( + private val avatarsHelper: DicebearAvatarsHelper +): ProfileRepository { + override fun getProfile(): UserProfile { + return UserProfile( + userDid = MockConstants.MOCK_DID, + userName = MockConstants.MOCK_LOGIN, + imageUrl = avatarsHelper.getImageUrl( + imageSize = 1, + imageType = DicebearImageType.AVATAR_IDENTICON, + dataString = MockConstants.MOCK_DID + ) + ) + } +} \ No newline at end of file diff --git a/data/src/main/java/by/alexandr7035/data/repository_mock/RegistrationRepositoryMock.kt b/data/src/main/java/by/alexandr7035/data/repository_mock/RegistrationRepositoryMock.kt new file mode 100644 index 0000000..e2435b8 --- /dev/null +++ b/data/src/main/java/by/alexandr7035/data/repository_mock/RegistrationRepositoryMock.kt @@ -0,0 +1,29 @@ +package by.alexandr7035.data.repository_mock + +import by.alexandr7035.affinidi_id.domain.model.signup.ConfirmSignUpRequestModel +import by.alexandr7035.affinidi_id.domain.model.signup.ConfirmSignUpResponseModel +import by.alexandr7035.affinidi_id.domain.model.signup.SignUpRequestModel +import by.alexandr7035.affinidi_id.domain.model.signup.SignUpResponseModel +import by.alexandr7035.affinidi_id.domain.repository.RegistrationRepository +import kotlinx.coroutines.delay + +// TODO use generic res +class RegistrationRepositoryMock: RegistrationRepository { + override suspend fun signUp(signUpRequestModel: SignUpRequestModel): SignUpResponseModel { + delay(MockConstants.MOCK_REQ_DELAY_MILLS) + + return SignUpResponseModel.Success( + confirmSignUpToken = "token", + userName = MockConstants.MOCK_LOGIN + ) + } + + override suspend fun confirmSignUp(confirmSignUpRequestModel: ConfirmSignUpRequestModel): ConfirmSignUpResponseModel { + delay(MockConstants.MOCK_REQ_DELAY_MILLS) + + return ConfirmSignUpResponseModel.Success( + accessToken = "token", + userDid = MockConstants.MOCK_DID + ) + } +} \ No newline at end of file diff --git a/data/src/main/java/by/alexandr7035/data/repository_mock/ResetPasswordRepositoryMock.kt b/data/src/main/java/by/alexandr7035/data/repository_mock/ResetPasswordRepositoryMock.kt new file mode 100644 index 0000000..4779c5e --- /dev/null +++ b/data/src/main/java/by/alexandr7035/data/repository_mock/ResetPasswordRepositoryMock.kt @@ -0,0 +1,33 @@ +package by.alexandr7035.data.repository_mock + +import by.alexandr7035.affinidi_id.domain.core.ErrorType +import by.alexandr7035.affinidi_id.domain.model.reset_password.ConfirmPasswordResetRequestModel +import by.alexandr7035.affinidi_id.domain.model.reset_password.ConfirmPasswordResetResponseModel +import by.alexandr7035.affinidi_id.domain.model.reset_password.InitializePasswordResetRequestModel +import by.alexandr7035.affinidi_id.domain.model.reset_password.InitializePasswordResetResponseModel +import by.alexandr7035.affinidi_id.domain.repository.ResetPasswordRepository +import kotlinx.coroutines.delay + +class ResetPasswordRepositoryMock : ResetPasswordRepository { + override suspend fun initializePasswordReset( + initializePasswordResetRequestModel: InitializePasswordResetRequestModel + ): InitializePasswordResetResponseModel { + delay(MockConstants.MOCK_REQ_DELAY_MILLS) + + return if (initializePasswordResetRequestModel.userName == MockConstants.MOCK_LOGIN) { + InitializePasswordResetResponseModel.Success(MockConstants.MOCK_LOGIN) + } else { + InitializePasswordResetResponseModel.Fail(ErrorType.USER_DOES_NOT_EXIST) + } + } + + override suspend fun confirmResetPassword( + confirmPasswordResetRequestModel: ConfirmPasswordResetRequestModel + ): ConfirmPasswordResetResponseModel { + return if (confirmPasswordResetRequestModel.userName === MockConstants.MOCK_LOGIN) { + ConfirmPasswordResetResponseModel.Success + } else { + ConfirmPasswordResetResponseModel.Fail(ErrorType.WRONG_USERNAME_OR_PASSWORD) + } + } +} \ No newline at end of file diff --git a/data/src/main/java/by/alexandr7035/data/repository_mock/StoredCredentialsRepositoryMock.kt b/data/src/main/java/by/alexandr7035/data/repository_mock/StoredCredentialsRepositoryMock.kt new file mode 100644 index 0000000..0a2697d --- /dev/null +++ b/data/src/main/java/by/alexandr7035/data/repository_mock/StoredCredentialsRepositoryMock.kt @@ -0,0 +1,54 @@ +package by.alexandr7035.data.repository_mock + +import by.alexandr7035.affinidi_id.domain.model.credentials.check_if_have_vc.CheckIfHaveVcReqModel +import by.alexandr7035.affinidi_id.domain.model.credentials.check_if_have_vc.CheckIfHaveVcResModel +import by.alexandr7035.affinidi_id.domain.model.credentials.delete_vc.DeleteVcReqModel +import by.alexandr7035.affinidi_id.domain.model.credentials.delete_vc.DeleteVcResModel +import by.alexandr7035.affinidi_id.domain.model.credentials.share.ShareCredentialReqModel +import by.alexandr7035.affinidi_id.domain.model.credentials.share.ShareCredentialResModel +import by.alexandr7035.affinidi_id.domain.model.credentials.stored_credentials.CredentialsListResModel +import by.alexandr7035.affinidi_id.domain.model.credentials.stored_credentials.GetCredentialByIdReqModel +import by.alexandr7035.affinidi_id.domain.model.credentials.stored_credentials.GetCredentialByIdResModel +import by.alexandr7035.affinidi_id.domain.repository.StoredCredentialsRepository +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.delay +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.flow +import kotlinx.coroutines.flow.flowOn + +class StoredCredentialsRepositoryMock: StoredCredentialsRepository { + override suspend fun getAllCredentials(): Flow { + return flow { + emit(CredentialsListResModel.Loading) + emit(CredentialsListResModel.Success(MockConstants.CREDENTIALS)) + }.flowOn(Dispatchers.IO) + } + + override suspend fun deleteCredential(deleteVcReqModel: DeleteVcReqModel): DeleteVcResModel { + return DeleteVcResModel.Success + } + + override suspend fun getCredentialById(getCredentialByIdReqModel: GetCredentialByIdReqModel): Flow { + return flow { + emit(GetCredentialByIdResModel.Loading) + + val vc = MockConstants.CREDENTIALS.findLast { + it.id == getCredentialByIdReqModel.credentialId + } + + vc?.let { + emit(GetCredentialByIdResModel.Success(it)) + } + + }.flowOn(Dispatchers.IO) + } + + override suspend fun shareCredential(shareVcReq: ShareCredentialReqModel): ShareCredentialResModel { + delay(MockConstants.MOCK_REQ_DELAY_MILLS) + return ShareCredentialResModel.Success(base64QrCode = MockConstants.MOCK_QR_CODE) + } + + override suspend fun checkIfHaveCredentialInCache(checkIfHaveVcReqModel: CheckIfHaveVcReqModel): CheckIfHaveVcResModel { + return CheckIfHaveVcResModel(haveCredential = true) + } +} \ No newline at end of file diff --git a/data/src/main/java/by/alexandr7035/data/repository_mock/VerificationRepositoryMock.kt b/data/src/main/java/by/alexandr7035/data/repository_mock/VerificationRepositoryMock.kt new file mode 100644 index 0000000..a1a7e8b --- /dev/null +++ b/data/src/main/java/by/alexandr7035/data/repository_mock/VerificationRepositoryMock.kt @@ -0,0 +1,23 @@ +package by.alexandr7035.data.repository_mock + +import by.alexandr7035.affinidi_id.domain.model.credentials.get_from_qr_code.ObtainVcFromQrCodeReqModel +import by.alexandr7035.affinidi_id.domain.model.credentials.get_from_qr_code.ObtainVcFromQrCodeResModel +import by.alexandr7035.affinidi_id.domain.model.credentials.verify_vc.VerifyVcReqModel +import by.alexandr7035.affinidi_id.domain.model.credentials.verify_vc.VerifyVcResModel +import by.alexandr7035.affinidi_id.domain.repository.VerificationRepository +import kotlinx.coroutines.delay + +class VerificationRepositoryMock: VerificationRepository { + override suspend fun obtainCredentialFromQrCode(obtainVcFromQrCodeReq: ObtainVcFromQrCodeReqModel): ObtainVcFromQrCodeResModel { + delay(MockConstants.MOCK_REQ_DELAY_MILLS) + + return ObtainVcFromQrCodeResModel.Success( + credential = MockConstants.CREDENTIALS[0] + ) + } + + override suspend fun verifyCredential(verifyVcReqModel: VerifyVcReqModel): VerifyVcResModel { + delay(MockConstants.MOCK_REQ_DELAY_MILLS) + return VerifyVcResModel.Success(isValid = true) + } +} \ No newline at end of file