Skip to content

DRAFT! Parse Intent from getIntent() and provide extra getters#4

Draft
MarijnS95 wants to merge 1 commit into
jni-0.21from
get-intent
Draft

DRAFT! Parse Intent from getIntent() and provide extra getters#4
MarijnS95 wants to merge 1 commit into
jni-0.21from
get-intent

Conversation

@MarijnS95
Copy link
Copy Markdown
Member

@MarijnS95 MarijnS95 commented Jan 28, 2025

Depends on #9

Works towards rust-mobile/ndk#275 / rust-mobile/ndk#380, but doesn't yet fully implement the onNewIntent() callback + setIntent() yet to follow up on new intents delivered to an already running app.


Quick draft to see if I could use this crate. While there's exactly zero overlap in the current implementation (this crate only provided setters, whereas I only needed getters), I still think this is the right place to implement (continue implementing...) a JNI-based Intent wrapper. No other Rust crate exists for this purpose yet while it's still very useful to have in Rust.

This renames Intent to IntentBuilder (because of storing a "builder-pattern" Result inside) and Inner to a publicized Intent where a few new getters are implemented. A free with_current_intent() function is added to provide a view of an 'env scoped Intent based on Activity.getIntent() on ndk_context::android_context() (I know, broken design).

TODO

  • Replace .unwrap() with proper result wrappers.
  • Include more getters.
  • Move setters to the Intent struct where they return normal Results, which can then be captured in the IntentBuilder instead.
  • Clean up commented mess :)
@MarijnS95 MarijnS95 changed the base branch from main to jni-0.21 January 30, 2025 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant