Skip to content
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

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

Draft
wants to merge 1 commit into
base: jni-0.21
Choose a base branch
from

Conversation

MarijnS95
Copy link
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant