Hand raised sound
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
This commit is contained in:
parent
980f162c96
commit
c126ca1016
4 changed files with 39 additions and 2 deletions
BIN
sounds/notification_simple-01.ogg
Executable file
BIN
sounds/notification_simple-01.ogg
Executable file
Binary file not shown.
|
@ -15,6 +15,7 @@ import * as Errors from '../../types/errors';
|
||||||
import { getPlatform } from '../selectors/user';
|
import { getPlatform } from '../selectors/user';
|
||||||
import { isConversationTooBigToRing } from '../../conversations/isConversationTooBigToRing';
|
import { isConversationTooBigToRing } from '../../conversations/isConversationTooBigToRing';
|
||||||
import { missingCaseError } from '../../util/missingCaseError';
|
import { missingCaseError } from '../../util/missingCaseError';
|
||||||
|
import { drop } from '../../util/drop';
|
||||||
import { calling } from '../../services/calling';
|
import { calling } from '../../services/calling';
|
||||||
import { truncateAudioLevel } from '../../calling/truncateAudioLevel';
|
import { truncateAudioLevel } from '../../calling/truncateAudioLevel';
|
||||||
import type { StateType as RootStateType } from '../reducer';
|
import type { StateType as RootStateType } from '../reducer';
|
||||||
|
@ -974,8 +975,26 @@ function receiveGroupCallReactions(
|
||||||
|
|
||||||
function groupCallRaisedHandsChange(
|
function groupCallRaisedHandsChange(
|
||||||
payload: GroupCallRaisedHandsChangeActionPayloadType
|
payload: GroupCallRaisedHandsChangeActionPayloadType
|
||||||
): GroupCallRaisedHandsChangeActionType {
|
): ThunkAction<
|
||||||
return { type: GROUP_CALL_RAISED_HANDS_CHANGE, payload };
|
void,
|
||||||
|
RootStateType,
|
||||||
|
unknown,
|
||||||
|
GroupCallRaisedHandsChangeActionType
|
||||||
|
> {
|
||||||
|
return async (dispatch, getState) => {
|
||||||
|
const { conversationId, raisedHands } = payload;
|
||||||
|
|
||||||
|
const existingCall = getGroupCall(conversationId, getState().calling);
|
||||||
|
const isFirstHandRaised =
|
||||||
|
existingCall &&
|
||||||
|
!existingCall.raisedHands?.length &&
|
||||||
|
raisedHands.length > 0;
|
||||||
|
if (isFirstHandRaised) {
|
||||||
|
drop(callingTones.handRaised());
|
||||||
|
}
|
||||||
|
|
||||||
|
dispatch({ type: GROUP_CALL_RAISED_HANDS_CHANGE, payload });
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function groupCallStateChange(
|
function groupCallStateChange(
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { missingCaseError } from './missingCaseError';
|
||||||
|
|
||||||
export enum SoundType {
|
export enum SoundType {
|
||||||
CallingHangUp,
|
CallingHangUp,
|
||||||
|
CallingHandRaised,
|
||||||
CallingPresenting,
|
CallingPresenting,
|
||||||
Pop,
|
Pop,
|
||||||
Ringtone,
|
Ringtone,
|
||||||
|
@ -103,6 +104,10 @@ export class Sound {
|
||||||
}
|
}
|
||||||
|
|
||||||
static getSrc(soundStyle: SoundType): string {
|
static getSrc(soundStyle: SoundType): string {
|
||||||
|
if (soundStyle === SoundType.CallingHandRaised) {
|
||||||
|
return 'sounds/notification_simple-01.ogg';
|
||||||
|
}
|
||||||
|
|
||||||
if (soundStyle === SoundType.CallingHangUp) {
|
if (soundStyle === SoundType.CallingHangUp) {
|
||||||
return 'sounds/navigation-cancel.ogg';
|
return 'sounds/navigation-cancel.ogg';
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,19 @@ const ringtoneEventQueue = new PQueue({
|
||||||
class CallingTones {
|
class CallingTones {
|
||||||
private ringtone?: Sound;
|
private ringtone?: Sound;
|
||||||
|
|
||||||
|
async handRaised() {
|
||||||
|
const canPlayTone = window.Events.getCallRingtoneNotification();
|
||||||
|
if (!canPlayTone) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const tone = new Sound({
|
||||||
|
soundType: SoundType.CallingHandRaised,
|
||||||
|
});
|
||||||
|
|
||||||
|
await tone.play();
|
||||||
|
}
|
||||||
|
|
||||||
async playEndCall(): Promise<void> {
|
async playEndCall(): Promise<void> {
|
||||||
const canPlayTone = window.Events.getCallRingtoneNotification();
|
const canPlayTone = window.Events.getCallRingtoneNotification();
|
||||||
if (!canPlayTone) {
|
if (!canPlayTone) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue