[Android] vibration module#6061
Conversation
|
By analyzing the blame information on this pull request, we identified @mkonicek, @nicklockwood and @vjeux to be potential reviewers. |
60216b1 to
2964c4b
Compare
There was a problem hiding this comment.
parameter duration Missing annotation
There was a problem hiding this comment.
parameter duration Missing annotation
There was a problem hiding this comment.
Please use Flow to declare it's a number.
|
Cc: @dmmiller |
There was a problem hiding this comment.
sorry didn't understand you 😞
|
Looks good overall, thanks! |
2964c4b to
536053e
Compare
|
@skv-headless updated the pull request. |
There was a problem hiding this comment.
no-unused-vars: "invariant" is defined but never used
536053e to
0f27881
Compare
|
@skv-headless updated the pull request. |
4136394 to
f7eb974
Compare
|
@skv-headless updated the pull request. |
There was a problem hiding this comment.
it is not that easy to make vibration duration in ios. I would rather make separate pr for that.
There was a problem hiding this comment.
@nicklockwood http://stackoverflow.com/a/13047464/1410905 if it is good solution I can make ios vibration duration here.
f7eb974 to
5aff712
Compare
|
@skv-headless updated the pull request. |
There was a problem hiding this comment.
You don't need to store this separately. It is available on ReactContextBaseJavaModule via getReactApplicationContext()
|
Can we also add comments about deprecating VibrationIOS since we will now just have one Vibration API? |
|
Since we're adding this, it would be great to support a vibration pattern. Seems pretty simple to implement - http://developer.android.com/reference/android/os/Vibrator.html |
5aff712 to
46208a2
Compare
|
@skv-headless updated the pull request. |
|
@dmmiller I've fixed your notes. |
|
@skv-headless Feel free to do it in a follow-up PR :D |
46208a2 to
5d2bf34
Compare
|
@skv-headless updated the pull request. |
|
I think this PR is finished. I've already started to work on vibration patters but I'm going to create separate PR for that. |
|
@facebook-github-bot shipit |
|
Cool, thanks. I've asked for the bot to accept it :) |
|
@facebook-github-bot shipit |
|
Thanks for importing. If you are an FB employee go to Phabricator to review. |
|
Failed to land because of failing tests. Luckily this should be easy, you just need to update BUCK files so that the code builds internally at fb where we use Buck. See https://circleci.com/gh/facebook/react-native/3133 My guess is you just need to add a dependency here: https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/shell/BUCK |
|
@mkonicek is there any instruction how to launch tests locally? I'll update tomorrow. |
|
@skv-headless updated the pull request. |
1c90bcd to
e48feda
Compare
|
@skv-headless updated the pull request. |
|
@mkonicek circle tests passed |
|
@facebook-github-bot shipit |
|
Thanks for importing. If you are an FB employee go to Phabricator to review. |
|
@dmmiller if there are problems with shipping (maybe like this #6208 (comment)) I can create PR again |
|
I'll get it to land. Let me commandeer the diff locally and get it in. |
|
@facebook-github-bot shipit |
Summary: This is a revised follow up version from #8574 ( originally implemented in `objc` ) This PR change the implementation in JS suggested by javache **motivation** To supports vibration pattern like android. The [iOS vibration implementation link](http://stackoverflow.com/questions/12966467/are-there-apis-for-custom-vibrations-in-ios/13047464#13047464) mentioned by skv-headless at #6061 (comment), which will not be accepted by apple since that implementation uses a private API. Thus, I use pure public API `NSTimer` to implement it. **Note** Since vibration time on iOS is not configurable, there are slightly differences with android. for example: **Android Usage:** `Vibration.vibrate([0, 500, 200, 500])` ==> V(0.5s) --wait(0.2s)--> V(0.5s) `Vibration.vibrate([300, 500, 200, 500])` ==> --wait(0.3s)--> V(0.5s) --wait(0.2s)--> V(0.5s) **iOS Usage:** if first argument is 0, it will not be included in pattern array. ( vibration Closes #9233 Differential Revision: D3775085 Pulled By: javache fbshipit-source-id: 370495857d5581399de32d2bed1ea1bcce193e9d
Summary: This is a revised follow up version from #8574 ( originally implemented in `objc` ) This PR change the implementation in JS suggested by javache **motivation** To supports vibration pattern like android. The [iOS vibration implementation link](http://stackoverflow.com/questions/12966467/are-there-apis-for-custom-vibrations-in-ios/13047464#13047464) mentioned by skv-headless at react/react-native#6061 (comment), which will not be accepted by apple since that implementation uses a private API. Thus, I use pure public API `NSTimer` to implement it. **Note** Since vibration time on iOS is not configurable, there are slightly differences with android. for example: **Android Usage:** `Vibration.vibrate([0, 500, 200, 500])` ==> V(0.5s) --wait(0.2s)--> V(0.5s) `Vibration.vibrate([300, 500, 200, 500])` ==> --wait(0.3s)--> V(0.5s) --wait(0.2s)--> V(0.5s) **iOS Usage:** if first argument is 0, it will not be included in pattern array. ( vibration Closes react/react-native#9233 Differential Revision: D3775085 Pulled By: javache fbshipit-source-id: 370495857d5581399de32d2bed1ea1bcce193e9d
I will fix other notes from #2794 if I get positive feedback.