From 04b8f20c095e84ada0de19d873161db0119f77cb Mon Sep 17 00:00:00 2001 From: Swapnil Tripathi Date: Sun, 12 Nov 2023 00:52:34 +0530 Subject: [PATCH] allow repeated dialogs Signed-off-by: Swapnil Tripathi --- .../org/hyperledger/ariesvcx/AppDemoController.kt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/uniffi_aries_vcx/demo/app/src/main/java/org/hyperledger/ariesvcx/AppDemoController.kt b/uniffi_aries_vcx/demo/app/src/main/java/org/hyperledger/ariesvcx/AppDemoController.kt index 09540f9808..fc20b908ca 100644 --- a/uniffi_aries_vcx/demo/app/src/main/java/org/hyperledger/ariesvcx/AppDemoController.kt +++ b/uniffi_aries_vcx/demo/app/src/main/java/org/hyperledger/ariesvcx/AppDemoController.kt @@ -40,6 +40,10 @@ class AppDemoController : ViewModel() { private val _state = MutableStateFlow(AppUiState()) val states: StateFlow = _state.asStateFlow() + fun getHolder (): Holder? { + return holder + } + private val walletConfig = WalletConfig( walletName = "test_create_wallet_add_uuid_here", walletKey = "8dvfYSt5d1taSd6yJdpjq4emkwsPDDLYxkNFysFD2cZY", @@ -126,6 +130,8 @@ class AppDemoController : ViewModel() { holder?.prepareCredentialRequest(profile!!, "4xE68b6S5VRFrKMMG1U95M") val message = holder?.getMsgCredentialRequest() connection?.sendMessage(profile!!, message!!) + + _state.update { it.copy(offerReceived = false) } } suspend fun awaitCredentialPolling() { @@ -146,13 +152,13 @@ class AppDemoController : ViewModel() { if (holder == null) { Log.d("OFFER", "awaitCredentialPolling: received offer") holder = createFromOffer("", unpackedMessage.message) - _state.update { it.copy(offerReceived = true) } - onOfferReceived.invoke() - processOfferRequest() } else { Log.d("CREDENTIAL", "awaitCredentialPolling: received credential") holder?.processCredential(profile!!, unpackedMessage.message) } + + _state.update { it.copy(offerReceived = true) } + onOfferReceived.invoke() } } }