Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!this.permissions['mute-user']) {
return;
}
const { room } = this.state;
const { muted } = room;
this.actionSheetOptions = [I18n.t('Cancel')];
const userIsMuted = !!(muted || []).find(m => m === user.username);
user.muted = userIsMuted;
if (userIsMuted) {
this.actionSheetOptions.push(I18n.t('Unmute'));
} else {
this.actionSheetOptions.push(I18n.t('Mute'));
}
this.setState({ userLongPressed: user });
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
this.showActionSheet();
}
onReactionLongPress = (message) => {
this.setState({ selectedMessage: message, reactionsModalVisible: true });
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
}
impact: type => {
if (Platform.OS !== "ios") {
return;
}
Haptic.impactAsync(type);
},
};
onPress={disabled ? null : () => {
if (Platform.OS === "ios" && impact === true) {
Haptics.impactAsync(Haptics.ImpactFeedbackStyle[impactStyle]);
}
if (onPressAction) {
return onPressAction();
}
}}
>
setTimeout(() => {
this.showActionSheet();
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
});
}
onPress={() => {
onPress();
Haptic.impactAsync(Haptic.ImpactFeedbackStyle[impact]);
}}
>
const onEnableAudioRecording = async (
state: Container.TypedState,
action: Chat2Gen.EnableAudioRecordingPayload,
logger: Saga.SagaLogger
) => {
const conversationIDKey = action.payload.conversationIDKey
const audio = state.chat2.audioRecording.get(conversationIDKey)
if (!audio || ChatConstants.isCancelledAudioRecording(audio)) {
logger.info('enableAudioRecording: no recording info set, bailing')
return false
}
if (isIOS) {
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light)
} else {
Vibration.vibrate(50)
}
const outboxID = ChatConstants.generateOutboxID()
const audioPath = await RPCChatTypes.localGetUploadTempFileRpcPromise({filename: 'audio.m4a', outboxID})
AudioRecorder.prepareRecordingAtPath(audioPath, {
AudioEncoding: 'aac',
AudioEncodingBitRate: 32000,
AudioQuality: 'Low',
Channels: 1,
MeteringEnabled: true,
SampleRate: 22050,
})
AudioRecorder.onProgress = null
AudioRecorder.onFinished = () => {
logger.info('onEnableAudioRecording: recording finished')