-
Notifications
You must be signed in to change notification settings - Fork 121
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
Haptics #2611
Open
msdewitt
wants to merge
22
commits into
cybersemics:main
Choose a base branch
from
msdewitt:issue-2392
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Haptics #2611
Changes from 15 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
c351bf9
Add Haptrics light tap to fastClick
024d2d1
Fix lint
f1a5bbd
Fix lint
2ae6c74
Add some changes in draft comments.
3dae0ef
Move selectionStart to MultiGesture
db68d35
Remove debugging
99ba87c
Remove space
60744b6
Add selectionChanged haptics
cdb1210
Add more Haptics
9d7ca6f
Merge branch 'main' into issue-2392
msdewitt e2b49da
Adjust packages
4c5e8b5
Changed
e576860
Add haptics only on native check
3b496a9
Adjust
a6aa73a
Lint adjust
07a4abf
Update gestures
e01d73c
Add suggested change
ed47d92
Update selectionChanged
abd9aa8
Update changes in code review comments
c55030e
Remove onEnd haptics
7a43c59
Add toolbar changes for scroll haptics
aa23971
Address code review changes
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import { Capacitor } from '@capacitor/core' | ||
import { Haptics, ImpactStyle } from '@capacitor/haptics' | ||
import _ from 'lodash' | ||
import { isTouch } from '../browser' | ||
|
||
|
@@ -27,7 +29,6 @@ const fastClick = isTouch | |
const y = e.touches[0].clientY | ||
touchStart = { x, y } | ||
} | ||
|
||
msdewitt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
tapDown?.(e) | ||
}, | ||
// cancel tap if touchmove exceeds threshold (e.g. with scrolling or dragging) | ||
|
@@ -42,6 +43,9 @@ const fastClick = isTouch | |
} | ||
}, 16.666), | ||
onTouchEnd: (e: React.TouchEvent) => { | ||
if (Capacitor.isNativePlatform()) { | ||
Haptics.impact({ style: ImpactStyle.Light }) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this should go in the else statement below with |
||
let cancel = !touchStart | ||
|
||
if (touchStart && e.changedTouches.length > 0) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
One suggestion might be creating our own
haptics
utility which checks forCapacitor.isNativePlatform()
internally so that we don't need to include so many newif
blocks throughout the rest of the code.e.g.:
A reasonable counterargument is that we want to expressly show within the hooks/actions/components that the haptic event is only triggered on native.
I would be okay with leaving this as it is, but slightly prefer creating a utility.
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.
We definitely want to abstract this out since the condition is present with every Haptics call. It should always NOOP on other platforms.
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.
@msdewitt #2611 (comment)