<commit_before>// Copyright 2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only

/* eslint-disable class-methods-use-this */

import {
  Call,
  CallEndedReason,
  CallId,
  CallingMessage,
  CallLogLevel,
  CallSettings,
  CallState,
  CanvasVideoRenderer,
  ConnectionState,
  JoinState,
  HttpMethod,
  DeviceId,
  GroupCall,
  GroupMemberInfo,
  GumVideoCapturer,
  HangupMessage,
  HangupType,
  OfferType,
  OpaqueMessage,
  PeekInfo,
  RingRTC,
  UserId,
  VideoFrameSource,
  VideoRequest,
} from 'ringrtc';
import { uniqBy, noop } from 'lodash';

import {
  ActionsType as UxActionsType,
  GroupCallPeekInfoType,
} from '../state/ducks/calling';
import { getConversationCallMode } from '../state/ducks/conversations';
import { EnvelopeClass } from '../textsecure.d';
import {
  CallMode,
  AudioDevice,
  MediaDeviceSettings,
  GroupCallConnectionState,
  GroupCallJoinState,
} from '../types/Calling';
import { ConversationModel } from '../models/conversations';
import {
  base64ToArrayBuffer,
  uuidToArrayBuffer,
  arrayBufferToUuid,
} from '../Crypto';
import { getOwn } from '../util/getOwn';
import {
  fetchMembershipProof,
  getMembershipList,
  wrapWithSyncMessageSend,
} from '../groups';
import { missingCaseError } from '../util/missingCaseError';
import { normalizeGroupCallTimestamp } from '../util/ringrtc/normalizeGroupCallTimestamp';
import {
  REQUESTED_VIDEO_WIDTH,
  REQUESTED_VIDEO_HEIGHT,
  REQUESTED_VIDEO_FRAMERATE,
} from '../calling/constants';

const RINGRTC_HTTP_METHOD_TO_OUR_HTTP_METHOD: Map<
  HttpMethod,
  'GET' | 'PUT' | 'POST' | 'DELETE'
> = new Map([
  [HttpMethod.Get, 'GET'],
  [HttpMethod.Put, 'PUT'],
  [HttpMethod.Post, 'POST'],
  [HttpMethod.Delete, 'DELETE'],
]);

// We send group call update messages to tell other clients to peek, which triggers
//   notifications, timeline messages, big green "Join" buttons, and so on. This enum
//   represents the three possible states we can be in. This helps ensure that we don't
//   send an update on disconnect if we never sent one when we joined.
enum GroupCallUpdateMessageState {
  SentNothing,
  SentJoin,
  SentLeft,
}

export {
  CallState,
  CanvasVideoRenderer,
  GumVideoCapturer,
  VideoCapturer,
  VideoRenderer,
} from 'ringrtc';

export class CallingClass {
  readonly videoCapturer: GumVideoCapturer;

  readonly videoRenderer: CanvasVideoRenderer;

  private uxActions?: UxActionsType;

  private sfuUrl?: string;

  private lastMediaDeviceSettings?: MediaDeviceSettings;

  private deviceReselectionTimer?: NodeJS.Timeout;<commit_msg>Minor: remove unused exports from calling service<commit_after>// Copyright 2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only

/* eslint-disable class-methods-use-this */

import {
  Call,
  CallEndedReason,
  CallId,
  CallingMessage,
  CallLogLevel,
  CallSettings,
  CallState,
  CanvasVideoRenderer,
  ConnectionState,
  JoinState,
  HttpMethod,
  DeviceId,
  GroupCall,
  GroupMemberInfo,
  GumVideoCapturer,
  HangupMessage,
  HangupType,
  OfferType,
  OpaqueMessage,
  PeekInfo,
  RingRTC,
  UserId,
  VideoFrameSource,
  VideoRequest,
} from 'ringrtc';
import { uniqBy, noop } from 'lodash';

import {
  ActionsType as UxActionsType,
  GroupCallPeekInfoType,
} from '../state/ducks/calling';
import { getConversationCallMode } from '../state/ducks/conversations';
import { EnvelopeClass } from '../textsecure.d';
import {
  CallMode,
  AudioDevice,
  MediaDeviceSettings,
  GroupCallConnectionState,
  GroupCallJoinState,
} from '../types/Calling';
import { ConversationModel } from '../models/conversations';
import {
  base64ToArrayBuffer,
  uuidToArrayBuffer,
  arrayBufferToUuid,
} from '../Crypto';
import { getOwn } from '../util/getOwn';
import {
  fetchMembershipProof,
  getMembershipList,
  wrapWithSyncMessageSend,
} from '../groups';
import { missingCaseError } from '../util/missingCaseError';
import { normalizeGroupCallTimestamp } from '../util/ringrtc/normalizeGroupCallTimestamp';
import {
  REQUESTED_VIDEO_WIDTH,
  REQUESTED_VIDEO_HEIGHT,
  REQUESTED_VIDEO_FRAMERATE,
} from '../calling/constants';

const RINGRTC_HTTP_METHOD_TO_OUR_HTTP_METHOD: Map<
  HttpMethod,
  'GET' | 'PUT' | 'POST' | 'DELETE'
> = new Map([
  [HttpMethod.Get, 'GET'],
  [HttpMethod.Put, 'PUT'],
  [HttpMethod.Post, 'POST'],
  [HttpMethod.Delete, 'DELETE'],
]);

// We send group call update messages to tell other clients to peek, which triggers
//   notifications, timeline messages, big green "Join" buttons, and so on. This enum
//   represents the three possible states we can be in. This helps ensure that we don't
//   send an update on disconnect if we never sent one when we joined.
enum GroupCallUpdateMessageState {
  SentNothing,
  SentJoin,
  SentLeft,
}

export class CallingClass {
  readonly videoCapturer: GumVideoCapturer;

  readonly videoRenderer: CanvasVideoRenderer;

  private uxActions?: UxActionsType;

  private sfuUrl?: string;

  private lastMediaDeviceSettings?: MediaDeviceSettings;

  private deviceReselectionTimer?: NodeJS.Timeout;
{'fraction_non_alphanumeric': 0.10633663366336633, 'fraction_numerical': 0.0031683168316831685, 'mean_word_length': 4.55054945054945, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2935998', 'n_tokens_mistral': 1651, 'n_tokens_neox': 1588, 'n_words': 407}