mirror of
https://github.com/aljazceru/react-native-pubky.git
synced 2026-02-23 16:04:28 +01:00
feat: republish homeserver
Adds republishHomeserver method. Upgrades bindings. Updates README.md.
This commit is contained in:
@@ -205,6 +205,25 @@ class PubkyModule(reactContext: ReactApplicationContext) :
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
fun republishHomeserver(secretKey: String, homeserver: String, promise: Promise) {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
try {
|
||||
val result = republishHomeserver(secretKey, homeserver)
|
||||
val array = Arguments.createArray().apply {
|
||||
result.forEach { pushString(it) }
|
||||
}
|
||||
withContext(Dispatchers.Main) {
|
||||
promise.resolve(array)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
withContext(Dispatchers.Main) {
|
||||
promise.reject("Error", e.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
fun signIn(secretKey: String, promise: Promise) {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
|
||||
@@ -418,6 +418,8 @@ internal interface _UniFFILib : Library {
|
||||
): RustBuffer.ByValue
|
||||
fun uniffi_pubkycore_fn_func_remove_event_listener(_uniffi_out_err: RustCallStatus,
|
||||
): Unit
|
||||
fun uniffi_pubkycore_fn_func_republish_homeserver(`secretKey`: RustBuffer.ByValue,`homeserver`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
||||
): RustBuffer.ByValue
|
||||
fun uniffi_pubkycore_fn_func_resolve(`publicKey`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
||||
): RustBuffer.ByValue
|
||||
fun uniffi_pubkycore_fn_func_resolve_https(`publicKey`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
||||
@@ -576,6 +578,8 @@ internal interface _UniFFILib : Library {
|
||||
): Short
|
||||
fun uniffi_pubkycore_checksum_func_remove_event_listener(
|
||||
): Short
|
||||
fun uniffi_pubkycore_checksum_func_republish_homeserver(
|
||||
): Short
|
||||
fun uniffi_pubkycore_checksum_func_resolve(
|
||||
): Short
|
||||
fun uniffi_pubkycore_checksum_func_resolve_https(
|
||||
@@ -653,6 +657,9 @@ private fun uniffiCheckApiChecksums(lib: _UniFFILib) {
|
||||
if (lib.uniffi_pubkycore_checksum_func_remove_event_listener() != 23534.toShort()) {
|
||||
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
||||
}
|
||||
if (lib.uniffi_pubkycore_checksum_func_republish_homeserver() != 63919.toShort()) {
|
||||
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
||||
}
|
||||
if (lib.uniffi_pubkycore_checksum_func_resolve() != 34317.toShort()) {
|
||||
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
||||
}
|
||||
@@ -1305,6 +1312,14 @@ fun `removeEventListener`() =
|
||||
|
||||
|
||||
|
||||
fun `republishHomeserver`(`secretKey`: String, `homeserver`: String): List<String> {
|
||||
return FfiConverterSequenceString.lift(
|
||||
rustCall() { _status ->
|
||||
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_republish_homeserver(FfiConverterString.lower(`secretKey`),FfiConverterString.lower(`homeserver`),_status)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
fun `resolve`(`publicKey`: String): List<String> {
|
||||
return FfiConverterSequenceString.lift(
|
||||
rustCall() { _status ->
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user