Don't request video for invisible group call participants
This commit is contained in:
parent
b4b65c4f00
commit
01549b11d1
7 changed files with 171 additions and 16 deletions
22
ts/util/setUtil.ts
Normal file
22
ts/util/setUtil.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
const add = <T>(set: Readonly<Set<T>>, item: T): Set<T> =>
|
||||
new Set(set).add(item);
|
||||
|
||||
export const remove = <T>(
|
||||
set: Readonly<Set<T>>,
|
||||
...items: ReadonlyArray<T>
|
||||
): Set<T> => {
|
||||
const clone = new Set(set);
|
||||
for (const item of items) {
|
||||
clone.delete(item);
|
||||
}
|
||||
return clone;
|
||||
};
|
||||
|
||||
export const toggle = <T>(
|
||||
set: Readonly<Set<T>>,
|
||||
item: Readonly<T>,
|
||||
shouldInclude: boolean
|
||||
): Set<T> => (shouldInclude ? add : remove)(set, item);
|
Loading…
Add table
Add a link
Reference in a new issue