Skip to content

Commit

Permalink
fix offer workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Swapnil Tripathi <[email protected]>
  • Loading branch information
swaptr committed Nov 21, 2023
1 parent b4c9b09 commit 6d07ae1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,19 @@ class AppDemoController : ViewModel() {
message
)

if (holder == null) {
Log.d("OFFER", "awaitCredentialPolling: received offer")
Log.d("MESSAGE", "$unpackedMessage.message")

if (!_state.value.offerReceived) {
Log.d("OFFER", "awaitCredentialPolling: received OFFER")
holder = createFromOffer("", unpackedMessage.message)

_state.update { it.copy(offerReceived = true) }
onOfferReceived.invoke()
} else {
Log.d("CREDENTIAL", "awaitCredentialPolling: received credential")
Log.d("CREDENTIAL", "awaitCredentialPolling: received CREDENTIAL")
holder?.processCredential(profile!!, unpackedMessage.message)

_state.update { it.copy(offerReceived = false) }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package org.hyperledger.ariesvcx

// Set your public IP address here, this endpoint will be used while communicating with the peer(agent).
const val BASE_RELAY_ENDPOINT = "https://0ecc-223-236-178-57.ngrok-free.app";
const val BASE_RELAY_ENDPOINT = "https://c0ea-2401-4900-5ae9-5941-eca0-812f-cb5f-4a86.ngrok-free.app";
const val RELAY_USER_ID = "demo-user-1";
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ fun HolderScreen(
demoController.awaitCredentialPolling()
}

LaunchedEffect(Unit) {
demoController.awaitCredentialPolling()
}

if (demoState.offerReceived) {
AlertDialog(
onDismissRequest = { },
Expand Down

0 comments on commit 6d07ae1

Please sign in to comment.