mirror of
https://github.com/element-hq/element-call.git
synced 2026-11-22 12:17:37 +00:00
setEffect -> ClearEffect
This commit is contained in:
1 parent
3acf5d9a28
commit
02eb134e40
3 files changed
+9
-11
No files matched your search
@@ -75,7 +75,7 @@ describe("the pipeline's state", () => {
|
||||
const effects = createBackgroundEffects(testScope(), {
|
||||
supported: true,
|
||||
effect$: behavior(effect, { n: "none", b: "blur" }),
|
||||
setEffect: vi.fn(),
|
||||
clearEffect: vi.fn(),
|
||||
added$: new BehaviorSubject<AddedBackground[] | undefined>([]),
|
||||
canSegment: () => cold(answer, { y: true, n: false }),
|
||||
pipeline: fakePipeline().pipeline,
|
||||
@@ -110,7 +110,7 @@ describe("the pipeline's state", () => {
|
||||
describe("background effects", () => {
|
||||
let effect$: BehaviorSubject<string>;
|
||||
let added$: BehaviorSubject<AddedBackground[] | undefined>;
|
||||
let setEffect: (raw: string) => void;
|
||||
let clearEffect: () => void;
|
||||
let fake: ReturnType<typeof fakePipeline>;
|
||||
|
||||
function build(
|
||||
@@ -119,7 +119,7 @@ describe("background effects", () => {
|
||||
return createBackgroundEffects(testScope(), {
|
||||
supported: true,
|
||||
effect$,
|
||||
setEffect,
|
||||
clearEffect,
|
||||
added$,
|
||||
canSegment: () => of(true),
|
||||
pipeline: fake.pipeline,
|
||||
@@ -135,7 +135,7 @@ describe("background effects", () => {
|
||||
beforeEach(() => {
|
||||
effect$ = new BehaviorSubject("none");
|
||||
added$ = new BehaviorSubject<AddedBackground[] | undefined>(undefined);
|
||||
setEffect = vi.fn((raw: string) => effect$.next(raw));
|
||||
clearEffect = vi.fn(() => effect$.next("none"));
|
||||
fake = fakePipeline();
|
||||
});
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ import { type Behavior } from "./Behavior";
|
||||
import { type ObservableScope } from "./ObservableScope";
|
||||
import {
|
||||
type BackgroundEffect,
|
||||
type EffectId,
|
||||
imagePathFor,
|
||||
parseEffect,
|
||||
} from "../tracks/backgroundEffectCatalog";
|
||||
@@ -57,9 +56,8 @@ export interface BackgroundEffectsOptions {
|
||||
supported: boolean;
|
||||
/** The effect chosen, as the setting stores it. */
|
||||
effect$: Behavior<string>;
|
||||
/** Saves the chosen effect. Used to reset the choice to "none" when the
|
||||
* chosen effect can't run here. */
|
||||
setEffect: (id: EffectId) => void;
|
||||
/** Resets the choice to no effect, for when the chosen one can't run here. */
|
||||
clearEffect: () => void;
|
||||
/** The backgrounds the device keeps, undefined until it has said. */
|
||||
added$: Behavior<AddedBackground[] | undefined>;
|
||||
/** Builds a segmenter on trial, and answers whether it could. */
|
||||
@@ -81,7 +79,7 @@ export function createBackgroundEffects(
|
||||
{
|
||||
supported,
|
||||
effect$,
|
||||
setEffect,
|
||||
clearEffect,
|
||||
added$,
|
||||
canSegment,
|
||||
pipeline,
|
||||
@@ -108,7 +106,7 @@ export function createBackgroundEffects(
|
||||
added !== undefined &&
|
||||
!added.some(({ id }) => id === effect.id))
|
||||
)
|
||||
setEffect("none");
|
||||
clearEffect();
|
||||
});
|
||||
|
||||
// Asked once an effect is first wanted. A browser update may fix what
|
||||
|
||||
@@ -57,7 +57,7 @@ export function createAppBackgroundEffects(
|
||||
return createBackgroundEffects(scope, {
|
||||
supported: supportsBackgroundProcessors(),
|
||||
effect$: backgroundEffectSetting.value$,
|
||||
setEffect: backgroundEffectSetting.setValue,
|
||||
clearEffect: () => backgroundEffectSetting.setValue("none"),
|
||||
added$: addedBackgrounds.added$,
|
||||
canSegment,
|
||||
pipeline: new BackgroundProcessorWrapper(transformer, "background-effect"),
|
||||
|
||||
Reference in new issue
Block a user