decord/source/modules/video_calls/native/useScreenshareUtils.tsx
github-actions da5b5e5efe chore: update source for alpha 346.6
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4821.js (118.4 MB)
2026-09-12 13:45:10 +00:00

209 lines
7.9 KiB
TypeScript

// Module ID: 10081
// Function ID: 10082
// Name: useScreenshareUtils
// Dependencies: [19, 17, 4658, 1908, 1074, 4661, 4615, 7858, 1910, 9211, 4778, 4688, 9218, 9239, 10082, 10076, 1608, 10100, 10101, 10102, 10103, 504, 10088, 7265, 1114, 2]
// Exports: default, getOSRequirement, getStreamPressHandler, handleCloseScreenshare, tryStartScreenShare
// Module 10081 (useScreenshareUtils)
import util from "util" /* 1114 */;
import MetaQuestUtils from "MetaQuestUtils" /* 1608 */;
import inject from "inject" /* 1910 */;
import StreamKeyUtils from "StreamKeyUtils" /* 4688 */;
import StreamActionCreators from "StreamActionCreators" /* 4778 */;
import useAnalyticsLocationsDefault from "useAnalyticsLocations" /* 7265 */;
import ForegroundServiceManagerDefault from "ForegroundServiceManager" /* 7858 */;
import CallsUtils from "CallsUtils" /* 9211 */;
import AudioActionCreatorsDefault from "AudioActionCreators" /* 9218 */;
import useHasVideoPermission from "useHasVideoPermission" /* 10076 */;
import MobileGoLiveUpsellExperimentDefault from "MobileGoLiveUpsellExperiment" /* 10088 */;
import noop from "module_19" /* 19 */;
import ApplicationStreamingStore from "ApplicationStreamingStore" /* 4658 */;
import MediaEngineStore from "MediaEngineStore" /* 1908 */;
const require = globalThis.__r;
const useHasVideoPermissionDefault = useHasVideoPermission;
require = fn;
function stopScreenshare() {
const voiceEngine = inject.getVoiceEngine();
voiceEngine.stopBroadcast();
const currentUserActiveStream = ApplicationStreamingStore.getCurrentUserActiveStream();
if (null != currentUserActiveStream) {
const tmpResult = tmp(4778);
tmpResult.stopStream(tmp(4688).encodeStreamKey(currentUserActiveStream));
const tmpResult2 = tmp(4688);
}
AudioActionCreatorsDefault.setGoLiveSource(null);
}
function startStream() {
if ("android" === obj.getVoiceEngine().platform) {
const result = ForegroundServiceManagerDefault.isForegroundServiceRunning((arg0) => {
if (arg0) {
const voiceEngine = tmp(tmp2[8]).getVoiceEngine();
voiceEngine.startBroadcast();
const tmpResult = tmp(tmp2[8]);
} else {
const result = tmp(tmp2[9]).showScreenshareDisabledAlert();
const tmpResult2 = tmp(tmp2[9]);
}
});
} else {
BroadcastUploadManager.showPicker();
}
}
const ApplicationStreamStates = fn(1074).ApplicationStreamStates;
const Features = fn(4661).Features;
const DeviceUtils = fn(4615);
const systemVersionMajor = DeviceUtils.getSystemVersionMajor();
const BroadcastUploadManager = fn(17).NativeModules.BroadcastUploadManager;
const size = fn(2);
let result = size.fileFinishedImporting("modules/video_calls/native/useScreenshareUtils.tsx");
export default function useScreenshareUtils(arg0) {
_require = arg0;
let tmp = useHasVideoPermissionDefault(arg0);
importDefault = tmp;
dependencyMap = tmp2;
const items = [stateFromStores1];
const stateFromStores = require("initialize").useStateFromStores(items, () => stateFromStores1.supports(constants.VIDEO));
let obj = require("initialize");
const showMobileGoLiveUpsell = MobileGoLiveUpsellExperimentDefault.useConfig({ location: "useScreenshareUtils" }).showMobileGoLiveUpsell;
const items1 = [showMobileGoLiveUpsell];
stateFromStores1 = require("initialize").useStateFromStores(items1, () => showMobileGoLiveUpsell.getCurrentUserActiveStream());
const analyticsLocations = useAnalyticsLocationsDefault().analyticsLocations;
const items2 = [stateFromStores1, arg0, stateFromStores, tmp, closure_8 >= 12, showMobileGoLiveUpsell, analyticsLocations];
return stateFromStores.useMemo(() => {
let tmp = null != stateFromStores1;
if (tmp) {
tmp = stateFromStores1.state === ApplicationStreamStates.ACTIVE;
}
let tmp3 = stateFromStores;
if (stateFromStores) {
tmp3 = closure_1;
}
if (tmp3) {
tmp3 = dependencyMap;
}
let obj = { isFeatureEnabled: tmp3, isActive: tmp, text: null, onPress: null, imgSource: null };
if (!showMobileGoLiveUpsell) {
if (tmp) {
const intl = util.intl;
let stringResult = intl.string(util.t.CpkXwZ);
}
obj.text = stringResult;
let flag = tmp4;
if (tmp4 === undefined) {
flag = false;
}
closure_1 = analyticsLocations;
if (tmp12) {
if (tmp11) {
if (flag) {
let fn = function l() {
return closure_0(10082).showMobileGoLiveActionSheet(closure_1);
};
} else {
fn = tmp14;
if (tmp) {
fn = stopScreenshare;
}
}
} else {
fn = CallsUtils.showScreenshareDisabledAlert;
}
} else {
fn = function l() {
const obj = closure_0(9239);
obj.reportAVError({ type: closure_0(9239).AVError.SCREENSHARE_OS_NOT_SUPPORTED, channelId: closure_0.id });
const obj2 = { type: closure_0(9239).AVError.SCREENSHARE_OS_NOT_SUPPORTED, channelId: closure_0.id };
const result = closure_0(9211).showMinOSScreenshareRequirementAlert();
};
}
obj.onPress = fn;
if (obj2.isMetaQuest()) {
tmp19(tmp ? 10100 : 10101);
} else {
if (tmp4) {
let tmp20 = 10102;
} else {
tmp20 = tmp ? 10103 : 10102;
}
obj.imgSource = tmp19(tmp20);
return obj;
}
obj2 = MetaQuestUtils;
tmp11 = closure_1;
tmp12 = dependencyMap;
}
const intl2 = util.intl;
stringResult = intl2.string(util.t.fjBNo1);
}, items2);
};
export const handleCloseScreenshare = function handleCloseScreenshare() {
const currentUserActiveStream = ApplicationStreamingStore.getCurrentUserActiveStream();
if (null != currentUserActiveStream) {
const obj = StreamActionCreators;
obj.stopStream(StreamKeyUtils.encodeStreamKey(currentUserActiveStream));
}
AudioActionCreatorsDefault.setGoLiveSource(null);
};
export { stopScreenshare };
export { startStream };
export const getOSRequirement = function getOSRequirement() {
return closure_8 >= 12;
};
export const getStreamPressHandler = function getStreamPressHandler(analyticsLocations) {
({ channel: require, showMobileGoLiveUpsell } = analyticsLocations);
({ hasPermission, isActive, osRequirement } = analyticsLocations);
if (showMobileGoLiveUpsell === undefined) {
showMobileGoLiveUpsell = false;
}
analyticsLocations = analyticsLocations.analyticsLocations;
if (osRequirement) {
if (hasPermission) {
if (showMobileGoLiveUpsell) {
let fn = function l() {
return closure_0(10082).showMobileGoLiveActionSheet(closure_1);
};
} else {
fn = tmp;
if (isActive) {
fn = stopScreenshare;
}
}
} else {
fn = CallsUtils.showScreenshareDisabledAlert;
}
} else {
fn = function l() {
const obj = closure_0(9239);
obj.reportAVError({ type: closure_0(9239).AVError.SCREENSHARE_OS_NOT_SUPPORTED, channelId: closure_0.id });
const obj2 = { type: closure_0(9239).AVError.SCREENSHARE_OS_NOT_SUPPORTED, channelId: closure_0.id };
const result = closure_0(9211).showMinOSScreenshareRequirementAlert();
};
}
return fn;
};
export const tryStartScreenShare = function tryStartScreenShare(channel) {
let videoPermission = closure_8 >= 12;
if (videoPermission) {
videoPermission = useHasVideoPermission.getVideoPermission(channel);
}
if (videoPermission) {
if ("android" === obj2.getVoiceEngine().platform) {
let result = ForegroundServiceManagerDefault.isForegroundServiceRunning((arg0) => {
if (arg0) {
const voiceEngine = tmp(tmp2[8]).getVoiceEngine();
voiceEngine.startBroadcast();
const tmpResult = tmp(tmp2[8]);
} else {
const result = tmp(tmp2[9]).showScreenshareDisabledAlert();
const tmpResult2 = tmp(tmp2[9]);
}
});
} else {
BroadcastUploadManager.showPicker();
}
obj2 = inject;
}
};