airbnb / airbnb/DeepLinkDispatch

Annotation to auto inject value from intent.getExtras() into fields

Open
#176 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Kotlin
Stars
4.4k
Forks
414
PR merge metrics
No merged PRs in 30d

Description

Getting deep link parameters from `intent.getExtras()` is quite troublesome. Would be cool if we can do something like this:

```java
@DeepLink("foo://example.com/deepLink/{id}")
public class ExampleActivity extends Activity {
@DeepLinkRouteParameter("id")
@InjectExtra("id")
long mId;

@DeepLinkQueryParameter("query_parameter")
@Nullable // or @NonNull
@InjectExtra("query_parameter")
Boolean mQueryParameter;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (!DeepLinkParameters.inject(this)) {
Dart.inject(this); // https://github.com/f2prateek/dart
}
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start by locating the deep-link injection entry point, `DeepLinkParameters.inject(this)`, and the `@InjectExtra`, `@DeepLinkRouteParameter`, and `@DeepLinkQueryParameter` annotations. Review how values from `intent.getExtras()` are currently handled; done means annotated fields receive the corresponding route or query values while preserving the shown nullable and non-null use cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.