diff --git a/uniffi_aries_vcx/README.md b/uniffi_aries_vcx/README.md index 7dd77f0b0c..99dc4d0bd2 100644 --- a/uniffi_aries_vcx/README.md +++ b/uniffi_aries_vcx/README.md @@ -58,13 +58,10 @@ Aries-VCX supports connection to [tools/simple_message_relay](/tools/simple_mess The demo app needs this endpoint to establish communication with the peer. -Update [serviceEndpoint](./demo/app/src/main/res/values/strings.xml) to reflect the public IP. +Update [BASE_RELAY_ENDPOINT](./demo/app/src/main/java/org/hyperledger/ariesvcx/Constants.kt) to reflect the public IP. -```xml - - ... - {YOUR_PUBLIC_IP} - +```kt +const val BASE_RELAY_ENDPOINT = ; ``` Now you are ready to start communicating. Use the QR scanner in the app to establish connection with the peer. diff --git a/uniffi_aries_vcx/core/src/core/unpack_message.rs b/uniffi_aries_vcx/core/src/core/unpack_message.rs index 4857f13488..a68d9a4675 100644 --- a/uniffi_aries_vcx/core/src/core/unpack_message.rs +++ b/uniffi_aries_vcx/core/src/core/unpack_message.rs @@ -13,7 +13,10 @@ pub struct UnpackMessage { pub sender_verkey: Option, } -pub fn unpack_message(profile_holder: Arc, packed_msg: String) -> VcxUniFFIResult { +pub fn unpack_message( + profile_holder: Arc, + packed_msg: String, +) -> VcxUniFFIResult { block_on(async { let packed_bytes = packed_msg.as_bytes(); let wallet = profile_holder.inner.inject_wallet(); diff --git a/uniffi_aries_vcx/demo/app/src/main/java/org/hyperledger/ariesvcx/Constants.kt b/uniffi_aries_vcx/demo/app/src/main/java/org/hyperledger/ariesvcx/Constants.kt new file mode 100644 index 0000000000..aca596f3d6 --- /dev/null +++ b/uniffi_aries_vcx/demo/app/src/main/java/org/hyperledger/ariesvcx/Constants.kt @@ -0,0 +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://b199-27-57-116-96.ngrok-free.app"; +const val RELAY_USER_ID = "demo-user-1"; \ No newline at end of file diff --git a/uniffi_aries_vcx/demo/app/src/main/java/org/hyperledger/ariesvcx/HomeScreen.kt b/uniffi_aries_vcx/demo/app/src/main/java/org/hyperledger/ariesvcx/HomeScreen.kt index 7eea41d7d2..efe3316640 100644 --- a/uniffi_aries_vcx/demo/app/src/main/java/org/hyperledger/ariesvcx/HomeScreen.kt +++ b/uniffi_aries_vcx/demo/app/src/main/java/org/hyperledger/ariesvcx/HomeScreen.kt @@ -17,7 +17,6 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.stringResource import androidx.navigation.NavHostController import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay @@ -46,9 +45,8 @@ fun HomeScreen( mutableStateOf(true) } - val serviceEndpoint = stringResource(R.string.serviceEndpoint) val request = Request.Builder() - .url("$serviceEndpoint/pop_user_message/${walletConfig.walletKey}") + .url("$BASE_RELAY_ENDPOINT/pop_user_message/$RELAY_USER_ID") .build() diff --git a/uniffi_aries_vcx/demo/app/src/main/java/org/hyperledger/ariesvcx/ScanScreen.kt b/uniffi_aries_vcx/demo/app/src/main/java/org/hyperledger/ariesvcx/ScanScreen.kt index 802713677a..2c7cec32c7 100644 --- a/uniffi_aries_vcx/demo/app/src/main/java/org/hyperledger/ariesvcx/ScanScreen.kt +++ b/uniffi_aries_vcx/demo/app/src/main/java/org/hyperledger/ariesvcx/ScanScreen.kt @@ -33,7 +33,6 @@ import androidx.compose.ui.viewinterop.AndroidView import androidx.core.content.ContextCompat import android.util.Base64 import androidx.compose.runtime.rememberCoroutineScope -import androidx.compose.ui.res.stringResource import androidx.navigation.NavHostController import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -58,8 +57,6 @@ fun ScanScreen( ProcessCameraProvider.getInstance(context) } - val serviceEndpoint = stringResource(R.string.serviceEndpoint) - scannedQRCodeText?.let { text -> val encoded = Uri.parse(text)?.getQueryParameter("c_i") val decoded = String(Base64.decode(encoded, Base64.DEFAULT)) @@ -77,7 +74,7 @@ fun ScanScreen( ) connection.sendRequest( profileHolder, - "$serviceEndpoint/send_user_message/${walletConfig.walletKey}", + "$BASE_RELAY_ENDPOINT/send_user_message/$RELAY_USER_ID", emptyList() ) withContext(Dispatchers.Main) { diff --git a/uniffi_aries_vcx/demo/app/src/main/res/values/strings.xml b/uniffi_aries_vcx/demo/app/src/main/res/values/strings.xml index 2afc0cb215..ad12620a2e 100644 --- a/uniffi_aries_vcx/demo/app/src/main/res/values/strings.xml +++ b/uniffi_aries_vcx/demo/app/src/main/res/values/strings.xml @@ -1,4 +1,3 @@ demo - https://b199-27-57-116-96.ngrok-free.app