mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 21:15:32 +09:00
23 lines
700 B
TypeScript
23 lines
700 B
TypeScript
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
export interface MessageEmojiAnimationState {
|
|
animateEmojiSetting: boolean;
|
|
animatedMediaPlaybackAllowed?: boolean;
|
|
stayInteractiveWhenUnfocused?: boolean;
|
|
windowFocused?: boolean;
|
|
windowVisible?: boolean;
|
|
}
|
|
|
|
export function shouldAnimateMessageEmojiByDefault({
|
|
animateEmojiSetting,
|
|
animatedMediaPlaybackAllowed,
|
|
stayInteractiveWhenUnfocused,
|
|
windowFocused,
|
|
windowVisible,
|
|
}: MessageEmojiAnimationState): boolean {
|
|
if (!animateEmojiSetting) return false;
|
|
if (animatedMediaPlaybackAllowed !== undefined) return animatedMediaPlaybackAllowed;
|
|
if (!windowVisible) return false;
|
|
return Boolean(windowFocused || stayInteractiveWhenUnfocused);
|
|
}
|