diff --git a/lib/app/shared/enum/message/response_string/response_string.dart b/lib/app/shared/enum/message/response_string/response_string.dart index 0c66ebff2..f150ac1d9 100644 --- a/lib/app/shared/enum/message/response_string/response_string.dart +++ b/lib/app/shared/enum/message/response_string/response_string.dart @@ -155,4 +155,7 @@ enum ResponseString { RESPONSE_STRING_theCredentialOfferIsInvalid, RESPONSE_STRING_theServiceIsNotAvailable, RESPONSE_STRING_theIssuanceOfThisCredentialIsPending, + RESPONSE_STRING_successfullyAddedEnterpriseAccount, + + RESPONSE_STRING_successfullyUpdatedEnterpriseAccount, } diff --git a/lib/app/shared/enum/message/response_string/response_string_extension.dart b/lib/app/shared/enum/message/response_string/response_string_extension.dart index 2bd7cedbc..90b6d7e26 100644 --- a/lib/app/shared/enum/message/response_string/response_string_extension.dart +++ b/lib/app/shared/enum/message/response_string/response_string_extension.dart @@ -490,6 +490,13 @@ extension ResponseStringX on ResponseString { case ResponseString.RESPONSE_STRING_theIssuanceOfThisCredentialIsPending: return globalMessage .RESPONSE_STRING_theIssuanceOfThisCredentialIsPending; + + case ResponseString.RESPONSE_STRING_successfullyAddedEnterpriseAccount: + return globalMessage.RESPONSE_STRING_successfullyAddedEnterpriseAccount; + + case ResponseString.RESPONSE_STRING_successfullyUpdatedEnterpriseAccount: + return globalMessage + .RESPONSE_STRING_successfullyUpdatedEnterpriseAccount; } } } diff --git a/lib/app/shared/message_handler/global_message.dart b/lib/app/shared/message_handler/global_message.dart index 12fd1be28..b6bc96a76 100644 --- a/lib/app/shared/message_handler/global_message.dart +++ b/lib/app/shared/message_handler/global_message.dart @@ -384,4 +384,8 @@ class GlobalMessage { l10n.theServiceIsNotAvailable; String get RESPONSE_STRING_theIssuanceOfThisCredentialIsPending => l10n.theIssuanceOfThisCredentialIsPending; + String get RESPONSE_STRING_successfullyAddedEnterpriseAccount => + l10n.successfullyAddedEnterpriseAccount; + String get RESPONSE_STRING_successfullyUpdatedEnterpriseAccount => + l10n.successfullyUpdatedEnterpriseAccount; } diff --git a/lib/app/shared/message_handler/response_message.dart b/lib/app/shared/message_handler/response_message.dart index 6bf827389..cae348f84 100644 --- a/lib/app/shared/message_handler/response_message.dart +++ b/lib/app/shared/message_handler/response_message.dart @@ -752,6 +752,19 @@ class ResponseMessage with MessageHandler { .RESPONSE_STRING_theIssuanceOfThisCredentialIsPending.localise( context, ); + + case ResponseString.RESPONSE_STRING_successfullyAddedEnterpriseAccount: + return ResponseString + .RESPONSE_STRING_successfullyAddedEnterpriseAccount.localise( + context, + ); + + case ResponseString + .RESPONSE_STRING_successfullyUpdatedEnterpriseAccount: + return ResponseString + .RESPONSE_STRING_successfullyUpdatedEnterpriseAccount.localise( + context, + ); } } return ''; diff --git a/lib/enterprise/cubit/enterprise_cubit.dart b/lib/enterprise/cubit/enterprise_cubit.dart index 175339de6..5819f6952 100644 --- a/lib/enterprise/cubit/enterprise_cubit.dart +++ b/lib/enterprise/cubit/enterprise_cubit.dart @@ -46,6 +46,16 @@ class EnterpriseCubit extends Cubit { ); } + final savedEmail = await profileCubit.secureStorageProvider.get( + SecureStorageKeys.enterpriseEmail, + ); + + if (savedEmail != null && email == savedEmail) { + /// if email is matched then update the configuration + await updateTheConfiguration(); + return; + } + /// get vc and store it in the wallet final walletAttestationData = await getWalletAttestationData(url); @@ -79,8 +89,11 @@ class EnterpriseCubit extends Cubit { emit( state.copyWith( - message: const StateMessage.success( - stringMessage: 'Successfully upgraded to enterprise account!', + message: StateMessage.success( + messageHandler: ResponseMessage( + message: ResponseString + .RESPONSE_STRING_successfullyAddedEnterpriseAccount, + ), ), ), ); @@ -274,23 +287,6 @@ class EnterpriseCubit extends Cubit { try { emit(state.loading()); - // final email = await profileCubit.secureStorageProvider.get( - // SecureStorageKeys.enterpriseEmail, - // ); - - // final password = await profileCubit.secureStorageProvider.get( - // SecureStorageKeys.enterprisePassword, - // ); - - // if (email == null || password == null) { - // throw ResponseMessage( - // data: { - // 'error': 'invalid_request', - // 'error_description': 'The email or password is missing.', - // }, - // ); - // } - final provider = await profileCubit.secureStorageProvider.get( SecureStorageKeys.enterpriseWalletProvider, ); @@ -375,8 +371,11 @@ class EnterpriseCubit extends Cubit { emit( state.copyWith( status: AppStatus.success, - message: const StateMessage.success( - stringMessage: 'Successfully upgdated enterprise account!', + message: StateMessage.success( + messageHandler: ResponseMessage( + message: ResponseString + .RESPONSE_STRING_successfullyUpdatedEnterpriseAccount, + ), ), ), ); diff --git a/lib/l10n/arb/app_en.arb b/lib/l10n/arb/app_en.arb index 90b020b01..77491cce6 100644 --- a/lib/l10n/arb/app_en.arb +++ b/lib/l10n/arb/app_en.arb @@ -1038,5 +1038,7 @@ "thisTypeProofCannotBeUsedWithThisVCFormat": "This type proof cannot be used with this VC Format.", "enterprise": "Enterprise", "oWFBaselineProfile": "OWF Baseline Profile", - "defaultProfile":"Default" + "defaultProfile":"Default", + "successfullyAddedEnterpriseAccount": "Successfully added enterprise account!", + "successfullyUpdatedEnterpriseAccount": "Successfully updated enterprise account!" } diff --git a/lib/l10n/untranslated.json b/lib/l10n/untranslated.json index 187263aba..ee69cdb37 100644 --- a/lib/l10n/untranslated.json +++ b/lib/l10n/untranslated.json @@ -943,7 +943,9 @@ "thisTypeProofCannotBeUsedWithThisVCFormat", "enterprise", "oWFBaselineProfile", - "defaultProfile" + "defaultProfile", + "successfullyAddedEnterpriseAccount", + "successfullyUpdatedEnterpriseAccount" ], "es": [ @@ -1890,12 +1892,16 @@ "thisTypeProofCannotBeUsedWithThisVCFormat", "enterprise", "oWFBaselineProfile", - "defaultProfile" + "defaultProfile", + "successfullyAddedEnterpriseAccount", + "successfullyUpdatedEnterpriseAccount" ], "fr": [ "blockchainCardsDiscoverTitle", - "blockchainCardsDiscoverSubtitle" + "blockchainCardsDiscoverSubtitle", + "successfullyAddedEnterpriseAccount", + "successfullyUpdatedEnterpriseAccount" ], "it": [ @@ -2842,6 +2848,8 @@ "thisTypeProofCannotBeUsedWithThisVCFormat", "enterprise", "oWFBaselineProfile", - "defaultProfile" + "defaultProfile", + "successfullyAddedEnterpriseAccount", + "successfullyUpdatedEnterpriseAccount" ] }