Skip to content

Commit

Permalink
[IMPROVEMENT] Use haptics rather than vibration (#1016)
Browse files Browse the repository at this point in the history
* Install expo-haptics

* Use expo-haptics rather than RN's Vibration module
  • Loading branch information
diegolmello authored Jun 28, 2019
1 parent b3986b9 commit 3b43cb3
Show file tree
Hide file tree
Showing 18 changed files with 3,990 additions and 3,757 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public List<Package> getPackageList() {
return Arrays.<Package>asList(
new expo.modules.constants.ConstantsPackage(),
new expo.modules.filesystem.FileSystemPackage(),
new expo.modules.haptics.HapticsPackage(),
new expo.modules.permissions.PermissionsPackage(),
new expo.modules.webbrowser.WebBrowserPackage()
);
Expand Down
5 changes: 3 additions & 2 deletions app/containers/MessageActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { Alert, Clipboard, Share } from 'react-native';
import { connect } from 'react-redux';
import ActionSheet from 'react-native-action-sheet';
import moment from 'moment';
import * as Haptics from 'expo-haptics';

import {
actionsHide as actionsHideAction,
deleteRequest as deleteRequestAction,
Expand All @@ -13,7 +15,6 @@ import {
toggleReactionPicker as toggleReactionPickerAction,
toggleStarRequest as toggleStarRequestAction
} from '../actions/messages';
import { vibrate } from '../utils/vibration';
import RocketChat from '../lib/rocketchat';
import database from '../lib/realm';
import I18n from '../i18n';
Expand Down Expand Up @@ -146,7 +147,7 @@ export default class MessageActions extends React.Component {
}
setTimeout(() => {
this.showActionSheet();
vibrate();
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
});
}

Expand Down
11 changes: 0 additions & 11 deletions app/utils/vibration.js

This file was deleted.

4 changes: 2 additions & 2 deletions app/views/RoomMembersView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import ActionSheet from 'react-native-action-sheet';
import { connect } from 'react-redux';
import { SafeAreaView } from 'react-navigation';
import equal from 'deep-equal';
import * as Haptics from 'expo-haptics';

import styles from './styles';
import UserItem from '../../presentation/UserItem';
Expand All @@ -13,7 +14,6 @@ import RocketChat from '../../lib/rocketchat';
import database, { safeAddListener } from '../../lib/realm';
import { Toast } from '../../utils/info';
import log from '../../utils/log';
import { vibrate } from '../../utils/vibration';
import I18n from '../../i18n';
import SearchBox from '../../containers/SearchBox';
import protectedFunction from '../../lib/methods/helpers/protectedFunction';
Expand Down Expand Up @@ -164,7 +164,7 @@ export default class RoomMembersView extends React.Component {
this.actionSheetOptions.push(I18n.t('Mute'));
}
this.setState({ userLongPressed: user });
vibrate();
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
this.showActionSheet();
}

Expand Down
4 changes: 2 additions & 2 deletions app/views/RoomView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { SafeAreaView } from 'react-navigation';
import equal from 'deep-equal';
import moment from 'moment';
import EJSON from 'ejson';
import * as Haptics from 'expo-haptics';

import {
toggleReactionPicker as toggleReactionPickerAction,
Expand Down Expand Up @@ -39,7 +40,6 @@ import { COLOR_WHITE } from '../../constants/colors';
import debounce from '../../utils/debounce';
import buildMessage from '../../lib/methods/helpers/buildMessage';
import FileModal from '../../containers/FileModal';
import { vibrate } from '../../utils/vibration';
import ReactionsModal from '../../containers/ReactionsModal';
import { Toast } from '../../utils/info';

Expand Down Expand Up @@ -341,7 +341,7 @@ export default class RoomView extends React.Component {

onReactionLongPress = (message) => {
this.setState({ selectedMessage: message, reactionsModalVisible: true });
vibrate();
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
}

onCloseReactionsModal = () => {
Expand Down
7 changes: 7 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ PODS:
- EXFileSystem (5.0.1):
- UMCore
- UMFileSystemInterface
- EXHaptics (5.0.1):
- UMCore
- EXPermissions (5.0.1):
- UMCore
- UMPermissionsInterface
Expand Down Expand Up @@ -171,6 +173,7 @@ DEPENDENCIES:
- EXAppLoaderProvider (from `../node_modules/expo-app-loader-provider/ios`)
- EXConstants (from `../node_modules/expo-constants/ios`)
- EXFileSystem (from `../node_modules/expo-file-system/ios`)
- EXHaptics (from `../node_modules/expo-haptics/ios`)
- EXPermissions (from `../node_modules/expo-permissions/ios`)
- EXWebBrowser (from `../node_modules/expo-web-browser/ios`)
- Fabric (~> 1.9.0)
Expand Down Expand Up @@ -243,6 +246,9 @@ EXTERNAL SOURCES:
EXFileSystem:
:path: !ruby/object:Pathname
path: "../node_modules/expo-file-system/ios"
EXHaptics:
:path: !ruby/object:Pathname
path: "../node_modules/expo-haptics/ios"
EXPermissions:
:path: !ruby/object:Pathname
path: "../node_modules/expo-permissions/ios"
Expand Down Expand Up @@ -313,6 +319,7 @@ SPEC CHECKSUMS:
EXAppLoaderProvider: 8f2c04a0a8d9be91f7c37c2b8824077ee5d4bc01
EXConstants: 9fe56eec8bf0a3ee9beb8f3381fa91340a5b1e57
EXFileSystem: 96624bd4b93a0684335c421a6567a92b25bd7ddb
EXHaptics: 6d594612afa321bfc8e167bdfb0b47f940f8f537
EXPermissions: 8e05008ed4fc8c9be6c17ea95301fc3f3f005a7b
EXWebBrowser: e03894b4583bb726e5ea05d01b341ba00134c2b5
Fabric: f988e33c97f08930a413e08123064d2e5f68d655
Expand Down
1 change: 1 addition & 0 deletions ios/Pods/Headers/Private/EXHaptics/EXHapticsModule.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ios/Pods/Headers/Public/EXHaptics/EXHapticsModule.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions ios/Pods/Local Podspecs/EXHaptics.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions ios/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3b43cb3

Please sign in to comment.