Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel
import tech.threefold.mycelium.rust.uniffi.mycelmob.addressFromSecretKey
import tech.threefold.mycelium.rust.uniffi.mycelmob.generateSecretKey
import tech.threefold.mycelium.rust.uniffi.mycelmob.getPeerStatus

private const val tag = "[Myceliumflut]"

Expand Down Expand Up @@ -56,6 +57,15 @@ class MainActivity: FlutterActivity() {
Log.d(tag, "stopping VPN")
result.success(stopCmdSent)
}
"getPeerStatus" -> {
try {
val peerStatus = getPeerStatus()
result.success(peerStatus)
} catch (e: Exception) {
Log.e(tag, "Error getting peer status: ${e.message}")
result.error("PEER_STATUS_ERROR", e.message, null)
}
}
else -> result.notImplemented()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,8 @@ internal interface UniffiForeignFutureCompleteVoid : com.sun.jna.Callback {








Expand All @@ -742,6 +744,8 @@ internal interface UniffiLib : Library {
): RustBuffer.ByValue
fun uniffi_mycelmob_fn_func_generate_secret_key(uniffi_out_err: UniffiRustCallStatus,
): RustBuffer.ByValue
fun uniffi_mycelmob_fn_func_get_peer_status(uniffi_out_err: UniffiRustCallStatus,
): RustBuffer.ByValue
fun uniffi_mycelmob_fn_func_hello_int(uniffi_out_err: UniffiRustCallStatus,
): Int
fun uniffi_mycelmob_fn_func_hello_mycelios(uniffi_out_err: UniffiRustCallStatus,
Expand Down Expand Up @@ -866,6 +870,8 @@ internal interface UniffiLib : Library {
): Short
fun uniffi_mycelmob_checksum_func_generate_secret_key(
): Short
fun uniffi_mycelmob_checksum_func_get_peer_status(
): Short
fun uniffi_mycelmob_checksum_func_hello_int(
): Short
fun uniffi_mycelmob_checksum_func_hello_mycelios(
Expand Down Expand Up @@ -897,6 +903,9 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) {
if (lib.uniffi_mycelmob_checksum_func_generate_secret_key() != 63601.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
if (lib.uniffi_mycelmob_checksum_func_get_peer_status() != 1198.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
if (lib.uniffi_mycelmob_checksum_func_hello_int() != 31063.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
Expand Down Expand Up @@ -1099,6 +1108,15 @@ public object FfiConverterSequenceString: FfiConverterRustBuffer<List<kotlin.Str
)
}

fun `getPeerStatus`(): List<kotlin.String> {
return FfiConverterSequenceString.lift(
uniffiRustCall() { _status ->
UniffiLib.INSTANCE.uniffi_mycelmob_fn_func_get_peer_status(
_status)
}
)
}

fun `helloInt`(): kotlin.Int {
return FfiConverterInt.lift(
uniffiRustCall() { _status ->
Expand Down
Loading