Skip to content

Commit

Permalink
fix service endpoint constant
Browse files Browse the repository at this point in the history
Signed-off-by: Swapnil Tripathi <[email protected]>
  • Loading branch information
swaptr committed Sep 24, 2023
1 parent 0d9d799 commit 202f49d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
9 changes: 3 additions & 6 deletions uniffi_aries_vcx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<resources>
...
<string name="serviceEndpoint">{YOUR_PUBLIC_IP}</string>
</resources>
```kt
const val BASE_RELAY_ENDPOINT = <your-public-ip-endpoint>;
```

Now you are ready to start communicating. Use the QR scanner in the app to establish connection with the peer.
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))
Expand All @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion uniffi_aries_vcx/demo/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<resources>
<string name="app_name">demo</string>
<string name="serviceEndpoint">https://b199-27-57-116-96.ngrok-free.app</string>
</resources>

0 comments on commit 202f49d

Please sign in to comment.