diff --git a/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/.idea/other.xml b/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/.idea/other.xml
index a76f118..56676a7 100644
--- a/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/.idea/other.xml
+++ b/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/.idea/other.xml
@@ -256,6 +256,17 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/app/src/main/cpp/ProxyClient.cpp b/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/app/src/main/cpp/ProxyClient.cpp
index 894f6aa..8cb02a9 100644
--- a/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/app/src/main/cpp/ProxyClient.cpp
+++ b/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/app/src/main/cpp/ProxyClient.cpp
@@ -117,18 +117,20 @@ Java_com_example_locationshare_ProxyClientJNI_proxyClientDisconnect(JNIEnv *env,
}
*/
JNIEXPORT void JNICALL
-Java_com_example_locationshare_ProxyClientJNI_proxyClientPublish(JNIEnv *env, jclass, jlong clientHandle, jstring jContent) {
+Java_com_example_locationshare_ProxyClientJNI_proxyClientPublish(JNIEnv *env, jclass, jlong clientHandle, jstring jContent, jstring jEthereumPrivateKey) {
const char* content = env->GetStringUTFChars(jContent, 0);
uint64_t contentLength = strlen(content);
+ const char* ethereumPrivateKey = env->GetStringUTFChars(jEthereumPrivateKey, 0);
LOGI("proxyClientPublish clientHandle: %d", clientHandle);
- LOGI("proxyClientPublish string: %s", content);
+ LOGI("proxyClientPublish content: %s", content);
+ LOGI("proxyClientPublish ethereumPrivateKey: %s", ethereumPrivateKey);
Error* errors = nullptr;
uint64_t numErrors = 0;
- proxyClientPublish(&errors, &numErrors, static_cast(clientHandle), content, contentLength);
+ proxyClientPublish(&errors, &numErrors, static_cast(clientHandle), content, contentLength, ethereumPrivateKey);
env->ReleaseStringUTFChars(jContent, content);
diff --git a/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/app/src/main/cpp/streamrproxyclient.h b/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/app/src/main/cpp/streamrproxyclient.h
deleted file mode 100644
index 87c47f6..0000000
--- a/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/app/src/main/cpp/streamrproxyclient.h
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef LIBSTREAMRPROXYCLIENT_HPP
-#define LIBSTREAMRPROXYCLIENT_HPP
-
-#include // NOLINT
-
-#if defined(__clang__) || defined(__GNUC__)
-#define SHARED_EXPORT __attribute__((visibility("default")))
-#define SHARED_LOCAL __attribute__((visibility("hidden")))
-#endif
-
-#if defined(__swift__)
-#define EXTERN_C
-#else
-#define EXTERN_C extern "C"
-#endif
-
-#define ERROR_INVALID_ETHEREUM_ADDRESS "INVALID_ETHEREUM_ADDRESS"
-#define ERROR_INVALID_STREAM_PART_ID "INVALID_STREAM_PART_ID"
-#define ERROR_PROXY_CLIENT_NOT_FOUND "PROXY_CLIENT_NOT_FOUND"
-#define ERROR_INVALID_PROXY_URL "INVALID_PROXY_URL"
-#define ERROR_NO_PROXIES_DEFINED "NO_PROXIES_DEFINED"
-#define ERROR_PROXY_CONNECTION_FAILED "PROXY_CONNECTION_FAILED"
-#define ERROR_PROXY_BROADCAST_FAILED "PROXY_BROADCAST_FAILED"
-EXTERN_C const char* SHARED_EXPORT testRpc();
-
-// this file should be in C, not C++
-
-static void __attribute__((constructor)) initialize();
-
-EXTERN_C struct SHARED_EXPORT Proxy {
- const char* websocketUrl;
- const char* ethereumAddress;
-};
-
-EXTERN_C struct SHARED_EXPORT Error {
- const char* message;
- const char* code;
-};
-
-EXTERN_C uint64_t SHARED_EXPORT proxyClientNew(
- Error** error,
- uint64_t* numErrors,
- const char* ownEthereumAddress,
- const char* streamPartId);
-
-EXTERN_C void SHARED_EXPORT
-proxyClientDelete(Error** errors, uint64_t* numErrors, uint64_t clientHandle);
-
-EXTERN_C uint64_t SHARED_EXPORT proxyClientConnect(
- Error** errors,
- uint64_t* numErrors,
- uint64_t clientHandle,
- const Proxy* proxies,
- uint64_t numProxies);
-
-EXTERN_C void SHARED_EXPORT proxyClientPublish(
- Error** errors,
- uint64_t* numErrors,
- uint64_t clientHandle,
- const char* content,
- uint64_t contentLength);
-
-#endif // LIBSTREAMRPROXYCLIENT_HPP
\ No newline at end of file
diff --git a/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/app/src/main/cpp/streamrproxyclient.h b/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/app/src/main/cpp/streamrproxyclient.h
new file mode 120000
index 0000000..5f7ddf1
--- /dev/null
+++ b/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/app/src/main/cpp/streamrproxyclient.h
@@ -0,0 +1 @@
+../../../../../../../include/streamrproxyclient.h
\ No newline at end of file
diff --git a/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/app/src/main/java/com/example/locationshare/ProxyClientJNI.kt b/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/app/src/main/java/com/example/locationshare/ProxyClientJNI.kt
index 0db1c1a..4114dc0 100644
--- a/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/app/src/main/java/com/example/locationshare/ProxyClientJNI.kt
+++ b/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/app/src/main/java/com/example/locationshare/ProxyClientJNI.kt
@@ -34,7 +34,7 @@ object ProxyClientJNI {
external fun proxyClientDisconnect(clientHandle: Long)
*/
@Throws(StreamrProxyException::class)
- external fun proxyClientPublish(clientHandle: Long, content: String)
+ external fun proxyClientPublish(clientHandle: Long, content: String, ethereumPrivateKey: String)
data class Proxy(
val websocketUrl: String,
diff --git a/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/app/src/main/java/com/example/locationshare/StreamrProxyClient.kt b/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/app/src/main/java/com/example/locationshare/StreamrProxyClient.kt
index 7d01670..31b8edc 100644
--- a/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/app/src/main/java/com/example/locationshare/StreamrProxyClient.kt
+++ b/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/app/src/main/java/com/example/locationshare/StreamrProxyClient.kt
@@ -16,7 +16,7 @@ class StreamrProxyClient(val state: StateFlow) {
private val job = SupervisorJob()
private val scope = CoroutineScope(Dispatchers.Default + job)
private var publishingJob: Job? = null
- private val validEthereumAddress = "0x1234567890123456789012345678901234567890";
+ private val validEthereumAddress = "0xa5374e3c19f15e1847881979dd0c6c9ffe846bd5";
private val validStreamPartId = "0xd7278f1e4a946fa7838b5d1e0fe50c5725fb23de/nativesdktest#01";
val proxyClientHandle = ProxyClientJNI.proxyClientNew(validEthereumAddress, validStreamPartId)
companion object {
@@ -25,12 +25,15 @@ class StreamrProxyClient(val state: StateFlow) {
var status: Status by mutableStateOf(Status.stopped)
private set
- var proxyAddress by mutableStateOf("0xfccf49c5a714cab640e329464c6f81d72df6e307")
+ var proxyAddress by mutableStateOf("0x2ee615edd5d13310f83d8125ff4f0960a7475e33")
private set
var proxyId by mutableStateOf("ws://10.0.2.2:44211")
private set
+ var ethereumPrivateKey by mutableStateOf("23bead9b499af21c4c16e4511b3b6b08c3e22e76e0591f5ab5ba8d4c3a5b1820")
+ private set
+
var intervalSeconds by mutableStateOf(defaultPublishingIntervalInSeconds)
private set
@@ -42,6 +45,10 @@ class StreamrProxyClient(val state: StateFlow) {
this.proxyId = proxyId
}
+ fun updateEthereumPrivateKey(ethereumPrivateKey: String){
+ this.ethereumPrivateKey = ethereumPrivateKey
+ }
+
fun updateIntervalSeconds(intervalSeconds: String){
this.intervalSeconds = intervalSeconds
}
@@ -55,7 +62,7 @@ class StreamrProxyClient(val state: StateFlow) {
withContext(Dispatchers.IO) {
println("proxyClientHandle: ${proxyClientHandle}")
println("Publish: $data")
- ProxyClientJNI.proxyClientPublish(proxyClientHandle, data)
+ ProxyClientJNI.proxyClientPublish(proxyClientHandle, data, ethereumPrivateKey)
println("Publish End")
}
}
diff --git a/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/app/src/main/java/com/example/locationshare/ui/LocationShareScreen.kt b/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/app/src/main/java/com/example/locationshare/ui/LocationShareScreen.kt
index e5761f8..915ef5c 100644
--- a/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/app/src/main/java/com/example/locationshare/ui/LocationShareScreen.kt
+++ b/packages/streamr-libstreamrproxyclient/examples/android/LocationShare/app/src/main/java/com/example/locationshare/ui/LocationShareScreen.kt
@@ -48,6 +48,7 @@ fun LocationShareScreen(
ProxyFieldsLayout(
proxyAddress = locationShareViewModel.streamrProxyClient.proxyAddress,
proxyId = locationShareViewModel.streamrProxyClient.proxyId,
+ ethereumPrivateKey = locationShareViewModel.streamrProxyClient.ethereumPrivateKey,
status = locationShareViewModel.streamrProxyClient.status,
onProxyAddressChanged = {
locationShareViewModel.streamrProxyClient.updateProxyAddress(
@@ -55,6 +56,7 @@ fun LocationShareScreen(
)
},
onProxyIdChanged = { locationShareViewModel.streamrProxyClient.updateProxyId(it) },
+ onEthereumPrivateKeyChanged = { locationShareViewModel.streamrProxyClient.updateEthereumPrivateKey(it) },
modifier = Modifier
.fillMaxWidth()
.wrapContentHeight()
@@ -139,9 +141,11 @@ fun LocationShareScreen(
fun ProxyFieldsLayout(
proxyAddress: String,
proxyId: String,
+ ethereumPrivateKey: String,
status: Status,
onProxyAddressChanged: (String) -> Unit,
onProxyIdChanged: (String) -> Unit,
+ onEthereumPrivateKeyChanged: (String) -> Unit,
modifier: Modifier = Modifier
) {
val mediumPadding = dimensionResource(R.dimen.padding_medium)
@@ -187,6 +191,22 @@ fun ProxyFieldsLayout(
disabledContainerColor = colorScheme.surface,
)
)
+
+ OutlinedTextField(
+ value = ethereumPrivateKey,
+ onValueChange = onEthereumPrivateKeyChanged,
+ label = {
+ Text("Ethereum Private Key")
+ },
+ singleLine = true,
+ shape = shapes.large,
+ modifier = Modifier.fillMaxWidth(),
+ colors = TextFieldDefaults.colors(
+ focusedContainerColor = colorScheme.surface,
+ unfocusedContainerColor = colorScheme.surface,
+ disabledContainerColor = colorScheme.surface,
+ )
+ )
Text(text = "Status: ${status}")
}
}