-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
Add deep linking support to IntentAndroid #4320
Conversation
public Map<String, Object> getConstants() { | ||
final Map<String, Object> constants = new HashMap<>(); | ||
|
||
Intent intent = ((Activity) mActivityContext).getIntent(); |
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.
Why not mActivity.getIntent() ?
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.
There's no mActivity
here! O.o
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.
Just change all (activity's) Context to Activity class
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.
Because it should be a Activity instance.
Nice! Thanks for working on this! |
@mkonicek Thanks. Waiting for the Dialog commit before I change anything here :D |
@satya164 updated the pull request. |
@satya164 updated the pull request. |
@satya164 updated the pull request. |
1 similar comment
@satya164 updated the pull request. |
@mkonicek I've updated the PR using However, the current activity is only set on I'm not sure if it's the best approach though. Please have a look and lemme know. cc @foghina |
Just pinged @foghina, thanks for the patience. Many PRs in the queue and branch cut.. |
|
||
constants.put("initialURL", initialURL); | ||
|
||
return constants; |
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.
This seems reasonable - the process could be started by an intent.
I don't like exposing Since the JS API is only similar but not identical and since the JS API is a function call anyway ( Exposing constants has bitten us in the past (see screen size), they should only be used for things that are really constant. |
@satya164 updated the pull request. |
@satya164 updated the pull request. |
@satya164 updated the pull request. |
1 similar comment
@satya164 updated the pull request. |
@satya164 updated the pull request. |
@satya164 updated the pull request. |
|
||
callback.invoke(initialURL); | ||
} catch (Exception e) { | ||
throw new JSApplicationIllegalArgumentException( |
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 you add an error callback (all @ReactMethod
s have two callbacks) and call it here instead of throwing an exception? You should probably still log the full exception details, though, to make it easier to debug problems.
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.
@foghina Was wondering the same thing. I kept it consistent with the canOpenURL
method which is in the same file. It's really confusing.
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.
Oh, darn. Then we can probably leave it as it is for the purposes of this PR but we should refactor this module.
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.
@foghina Yes, we should. I'll send another PR with the changes then, after this is merged.
@facebook-github-bot shipit |
Thanks for importing. If you are an FB employee go to https://our.intern.facebook.com/intern/opensource/github/pull_request/1658069957805935/int_phab to review. |
@satya164 heads-up: patch failed internally because we don't mirror |
@foghina No probs. I'll send another PR with the website changes :) |
Add a method to handle URLs registered to the app,
Refer - http://developer.android.com/training/app-indexing/deep-linking.html#adding-filters
The API cannot be same as the iOS API (i.e. as a constant), as the activity is not availble at the time of module initialization. Moreover, multiple activties can share the same bridge instance, and the activity itself is not a constant. Hence the initialURL can change.