-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(WIP): adding uniffi bindings to support android and ios #473
base: main
Are you sure you want to change the base?
Conversation
We refactored how we construct a |
@oblique i rebased, now it works again. test-wasm ci will still fail at the moment. Should I make the crate wasm compatible or should we just ignore it and use something like: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for the contribution, we're supper happy about it and would love to getting it upstream 🙇
I think we don't care about wasm in this new crate so you could just put this in top of #![cfg(not(target_arch = "wasm32"))] |
true, that's enough. I thought we would then have to update the Cargo.toml etc. as well with target-specific dependencies, but that is not the case. Thank you |
9cf49c0
to
8a858d8
Compare
node-uniffi/src/types.rs
Outdated
|
||
/// Events emitted by the node. | ||
#[derive(uniffi::Enum)] | ||
pub enum NodeEvent { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use the one from lumina-node
crate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can, but I haven't yet found a solution to make PeerId from libp2p and Vec<u16,u16> compatible with uniffi without the specific wrappers i wrote in types.rs. Afaik, e.g. tuple types are not directly supported because they cannot be cleanly mapped to equivalent types in different target languages. Of course, I could bring the wrappers into the lumina node if that's wanted :)
Mobile bindings for Lumina node via UniFFI
This PR adds iOS and Android bindings for the node using Mozilla's UniFFI.
I followed the approach from wasm and tested it successfully in the iOS and Android simulator.
Current State
TODOs
#[uniffi::export(async_runtime = "tokio")]
)