mattermost-mobile/app/constants/calls.ts
Christopher Poile 92bdb2847b
[MM-57486] [MM-58008] Calls: Mobile ringing for incoming calls (#7984)
* notification ringing, settings screen, native code patch, ringing mp3s

* i18n

* play preview on first press

* prevent playing from background (only affects Android) to match iOS beh

* stop ringing/vibration on entering background

* ring when coming back from background and new incoming call is present

* no push notification sound when it's a call; improve ringing

* move sounds to asset folder; copy on postinstall for android bundling

* make Ringtone type a string enum

* make Android ring async + await ring and stop; changes from PR comments

* missing fields after merge

* release lock on an exception

* cancel sample ringing when turning notifications off

* copy sound files for android build

* typo

* update snapshots

* testing if the problem is copying the mp3 files

* fix android mp3 assets when building for non-release

* add sounds to .gitignore

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
2024-07-03 10:22:46 -04:00

76 lines
1.9 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {toMilliseconds} from '@utils/datetime';
const RefreshConfigMillis = toMilliseconds({minutes: 20});
const RequiredServer = {
FULL_VERSION: '6.3.0',
MAJOR_VERSION: 6,
MIN_VERSION: 3,
PATCH_VERSION: 0,
};
const MultiSessionCallsVersion = {
FULL_VERSION: '0.21.0',
MAJOR_VERSION: 0,
MIN_VERSION: 21,
PATCH_VERSION: 0,
};
const HostControlsCallsVersion = {
FULL_VERSION: '0.27.0',
MAJOR_VERSION: 0,
MIN_VERSION: 27,
PATCH_VERSION: 0,
};
const PluginId = 'com.mattermost.calls';
const REACTION_TIMEOUT = 10000;
const REACTION_LIMIT = 20;
const CALL_QUALITY_RESET_MS = toMilliseconds({minutes: 1});
const CAPTION_TIMEOUT = 5000;
const RING_LENGTH = 30000;
export enum Ringtone {
Calm = 'Calm',
Dynamic = 'Dynamic',
Urgent = 'Urgent',
Cheerful = 'Cheerful',
}
const RINGTONE_DEFAULT = Ringtone.Calm;
// 30 seconds of vibration (there is no loop setting)
const RINGTONE_VIBRATE_PATTERN = [1000, 500, 1000, 500, 1000, 500, 1000, 500, 1000, 1000, 500, 1000, 500, 1000, 500, 1000, 500, 1000, 1000, 500, 1000, 500, 1000, 500, 1000, 500, 1000, 1000, 500, 1000, 500, 1000, 500, 1000, 500, 1000, 1000, 500, 1000, 500, 1000];
export enum MessageBarType {
Microphone,
CallQuality,
}
// The JobTypes from calls plugin's server/public/job.go
const JOB_TYPE_RECORDING = 'recording';
const JOB_TYPE_TRANSCRIBING = 'transcribing';
const JOB_TYPE_CAPTIONING = 'captioning';
export default {
RefreshConfigMillis,
RequiredServer,
MultiSessionCallsVersion,
HostControlsCallsVersion,
PluginId,
REACTION_TIMEOUT,
REACTION_LIMIT,
MessageBarType,
CALL_QUALITY_RESET_MS,
CAPTION_TIMEOUT,
JOB_TYPE_RECORDING,
JOB_TYPE_TRANSCRIBING,
JOB_TYPE_CAPTIONING,
RING_LENGTH,
RINGTONE_DEFAULT,
RINGTONE_VIBRATE_PATTERN,
};