Skip to content

Conversation

@Ivolutio
Copy link

@Ivolutio Ivolutio commented Mar 4, 2018

For Android, I also changed the if statements in onMethodCall to a switch case.
I do not know how to do stuff for iOS, so I only implemented a TODO line for cancel().

IKStreamIvo added 2 commits March 4, 2018 16:20
I am not sure if this works for iOS, since I do not own one.
Don't know how to do it for iOS.
@Ivolutio
Copy link
Author

Ivolutio commented Mar 4, 2018

😮 I completely skipped over this part in the readme:

// Vibrate
// Vibration duration is a constant 500ms because 
// it cannot be set to a specific duration on iOS.
Vibrate.vibrate()

But, I didn't see you using anything with call arguments in iOS to specify duration, like it's done in Android.. So I do think that would be fine, right? 😅

I also forgot to add it to the example in the readme, but I'll do that if you have accepted this pull 😄.

@clovisnicolas
Copy link
Owner

I removed the duration parameter on the dart vibrate method because I haven't found a way to vibrate for a specific duration on iOS, and I wanted the result to be the same on both platforms. It can be frustrating to have a different result on both platforms.
Same for the cancel() method, I'm not sure this is feasible on iOS, as the duration is always the same.
However, we could add a method to cancel the vibration with pattern on both platforms

@Ivolutio
Copy link
Author

Ivolutio commented Mar 5, 2018

I understand, but you wouldn't want to exclude the features from Android either, right? 😞

@clovisnicolas
Copy link
Owner

Well I know this is debatable, but I think plugins should only expose the common subset of platform features. I find it frustrating to have shared code which behaves differently on both platforms, but once again, this is only my opinion ;)

@Ivolutio
Copy link
Author

Ivolutio commented Mar 5, 2018

Maybe it could be an idea to have this then? I am currently using a long vibration to keep vibrating until I release a button. (Android)

if (Platform.isIOS) {
  Vibrate.vibrate(); //normal 500ms
}
else if (Platform.isAndroid) {
  Vibrate.vibrateAndroid(new Duration(...)); //custom duration
}

(This is the code the user will enter)

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.

2 participants