167 lines
6.3 KiB
TypeScript
167 lines
6.3 KiB
TypeScript
// Metro module 10567 (f10568).
|
|
import { useContext, useRef, useEffect, useCallback } from "react";
|
|
import { View } from "react-native";
|
|
import { AnalyticEvents } from "../../../Constants";
|
|
import { PremiumTypes, PremiumUpsellTypes } from "../../premium/PremiumConstants";
|
|
import { ResolutionTypes } from "../../../_bundle/Module4250";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import { RevealContext } from "../../video_calls/native/components/RevealProvider";
|
|
import { useAnalyticsContext } from "../../../hooks/analytics";
|
|
import useAnalyticsLocations from "../../app_analytics/useAnalyticsLocations";
|
|
import ReanimatedRexport, { useAnimatedStyle } from "../../reanimated/ReanimatedRexport";
|
|
import * as _timing from "../../../design/animation/reanimated/timing/timing";
|
|
import * as _native from "../../../design/void/native";
|
|
import { LegacyText, LiveTag } from "../../../design/void/native";
|
|
import * as _StreamQualityUtils from "../../../utils/StreamQualityUtils";
|
|
import { useMaxQuality, getResolutionText, getFPSText } from "../../../utils/StreamQualityUtils";
|
|
import useStreamError from "../useStreamError";
|
|
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
|
|
import openPremiumModal from "../../../components_native/premium/openPremiumModal";
|
|
import { PremiumFeatureCardOrder } from "../../user_settings/premium/native/PremiumFeaturesCards";
|
|
import PremiumUtils from "../../../utils/PremiumUtils";
|
|
import { PressableOpacity } from "../../../design/void/Pressables/native/Pressables";
|
|
import FastImage from "../../../components_native/common/FastImage";
|
|
import Module9377 from "../../../_bundle/Module9377";
|
|
const useStyles = createStyles({
|
|
liveIndicator: {
|
|
flexDirection: "row",
|
|
alignItems: "center",
|
|
height: 18
|
|
},
|
|
liveTag: {
|
|
borderBottomLeftRadius: Module712.radii.none,
|
|
borderTopLeftRadius: Module712.radii.none,
|
|
height: 18,
|
|
textAlign: "center"
|
|
},
|
|
qualityTag: {
|
|
borderBottomLeftRadius: Module712.radii.sm,
|
|
borderTopLeftRadius: Module712.radii.sm,
|
|
backgroundColor: Module712.unsafe_rawColors.PRIMARY_800,
|
|
opacity: 0.8,
|
|
paddingLeft: 8,
|
|
paddingRight: 4,
|
|
flexDirection: "row",
|
|
alignItems: "center",
|
|
height: 18
|
|
},
|
|
qualityTagText: {
|
|
color: "#fff",
|
|
textAlign: "center",
|
|
fontWeight: "700"
|
|
},
|
|
reducedQualityTagText: {
|
|
color: Module712.unsafe_rawColors.PRIMARY_300
|
|
},
|
|
nitroWheel: {
|
|
width: 20,
|
|
marginLeft: -4
|
|
}
|
|
});
|
|
const __initData = {
|
|
code: "function StreamQualityLiveIndicatorTsx1(){const{withTiming,reveal,STANDARD_EASING}=this.__closure;return{opacity:withTiming(reveal?1:0,{easing:STANDARD_EASING,duration:250})};}"
|
|
};
|
|
export default function StreamQualityLiveIndicator(props) {
|
|
let r59, r65, pointerEvents;
|
|
let isPremiumFPS, isPremiumResolution, c18132_6;
|
|
const { participant, style } = props;
|
|
isPremiumFPS = void 0;
|
|
isPremiumResolution = void 0;
|
|
c18132_6 = void 0;
|
|
const styles = useStyles();
|
|
const reveal = useContext(RevealContext).reveal;
|
|
const location2 = useAnalyticsContext().location;
|
|
const analyticsLocations = useAnalyticsLocations().analyticsLocations;
|
|
const ref = useRef(false);
|
|
const f = function f() {
|
|
return {
|
|
opacity: _timing.withTiming(reveal ? 1 : 0, {
|
|
easing: _native.STANDARD_EASING,
|
|
duration: 250
|
|
})
|
|
};
|
|
};
|
|
f.__closure = {
|
|
withTiming: _timing.withTiming,
|
|
reveal,
|
|
STANDARD_EASING: _native.STANDARD_EASING
|
|
};
|
|
f.__workletHash = 14676679064575;
|
|
f.__initData = __initData;
|
|
const animatedStyle = useAnimatedStyle(f);
|
|
const maxQuality = useMaxQuality(participant);
|
|
const r54 = useStreamError(participant) != null;
|
|
try {
|
|
const isPremiumFPS2 = _StreamQualityUtils.isPremiumFPS(maxQuality);
|
|
r59 = isPremiumFPS2;
|
|
isPremiumFPS = isPremiumFPS2;
|
|
} catch ($e) {
|
|
r59 = false;
|
|
isPremiumFPS = false;
|
|
}
|
|
try {
|
|
const isPremiumResolution2 = _StreamQualityUtils.isPremiumResolution(maxQuality);
|
|
r65 = isPremiumResolution2;
|
|
isPremiumResolution = isPremiumResolution2;
|
|
} catch ($e) {
|
|
r65 = false;
|
|
isPremiumResolution = false;
|
|
}
|
|
let r67 = r59 || r65;
|
|
c18132_6 = r67;
|
|
useEffect(() => {
|
|
const current = ref.current;
|
|
if (current ? !current : c18132_6) {
|
|
AnalyticsUtils.track(AnalyticEvents.PREMIUM_UPSELL_VIEWED, {
|
|
type: PremiumUpsellTypes.STREAM_QUALITY_INDICATOR,
|
|
has_premium_stream_fps: isPremiumFPS,
|
|
has_premium_stream_resolution: isPremiumResolution,
|
|
location_stack: analyticsLocations
|
|
});
|
|
ref.current = true;
|
|
}
|
|
}, [analyticsLocations, r67, r59, r65]);
|
|
const callback = useCallback(() => {
|
|
openPremiumModal({
|
|
analyticsLocation: location2,
|
|
analyticsLocations,
|
|
premiumFeatureCardOrder: PremiumFeatureCardOrder.TIER_0_LEADING
|
|
});
|
|
}, [location2, analyticsLocations]);
|
|
const isPremium = PremiumUtils.isPremium(participant.user, PremiumTypes.TIER_1);
|
|
const r83 = isPremium ? !isPremium : !PremiumUtils.canStreamQuality(PremiumUtils.StreamQuality.MID, participant.user);
|
|
const r98 = PremiumUtils.isPremiumExactly(participant.user, PremiumTypes.TIER_1) && (maxQuality == null ? void 0 : maxQuality.maxResolution.type) === ResolutionTypes.SOURCE && !PremiumUtils.canStreamQuality(PremiumUtils.StreamQuality.HIGH);
|
|
const r112 = maxQuality == null;
|
|
let r113 = null;
|
|
if (!r112) {
|
|
L20: {
|
|
pointerEvents = "none";
|
|
if (r67) {
|
|
if (!r83) {
|
|
pointerEvents = "none";
|
|
if (!r98) {
|
|
break L20;
|
|
}
|
|
}
|
|
pointerEvents = "auto";
|
|
}
|
|
}
|
|
if (r67) {
|
|
r67 = <FastImage source={Module9377} style={styles.nitroWheel} resizeMode="contain" />;
|
|
}
|
|
r113 = <ReanimatedRexport.View pointerEvents={pointerEvents} style={[style, animatedStyle]}>
|
|
<PressableOpacity accessibilityRole="button" style={[styles.liveIndicator, style]} onPress={callback}>
|
|
<View style={styles.qualityTag}>
|
|
{r67}
|
|
<LegacyText style={[styles.qualityTagText, r54 ? styles.reducedQualityTagText : null]}>
|
|
{`${getResolutionText(maxQuality.maxResolution)} ${getFPSText(maxQuality.maxFrameRate)}`}
|
|
</LegacyText>
|
|
</View>
|
|
<LiveTag style={styles.liveTag} />
|
|
</PressableOpacity>
|
|
</ReanimatedRexport.View>;
|
|
}
|
|
return r113;
|
|
};
|