@ray-js/ipc-player-integration 0.0.65-beta.4 → 0.0.66-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/lib/ctx/ctx.composition.js +3 -13
- package/lib/ctx/ctx.js +35 -46
- package/lib/ctx/multiCameraCtx.d.ts +0 -2
- package/lib/ctx/multiCameraCtx.js +1 -17
- package/lib/i18n/index.d.ts +0 -12
- package/lib/i18n/strings.d.ts +0 -6
- package/lib/i18n/strings.js +0 -6
- package/lib/index.d.ts +4 -0
- package/lib/index.js +3 -1
- package/lib/interface.d.ts +3 -17
- package/lib/renderer/capabilities.d.ts +8 -0
- package/lib/renderer/capabilities.js +19 -0
- package/lib/renderer/context.d.ts +5 -0
- package/lib/renderer/context.js +6 -0
- package/lib/renderer/directionControl.d.ts +6 -0
- package/lib/renderer/directionControl.js +3 -0
- package/lib/renderer/font.less +5 -0
- package/lib/renderer/glyphs.d.ts +1 -0
- package/lib/renderer/glyphs.js +256 -0
- package/lib/renderer/index.module.less +48 -0
- package/lib/renderer/ptzZoom.d.ts +6 -0
- package/lib/renderer/ptzZoom.js +3 -0
- package/lib/renderer/text.d.ts +4 -0
- package/lib/renderer/text.js +32 -0
- package/lib/renderer/text.module.less +4 -0
- package/lib/renderer/viewport.d.ts +7 -0
- package/lib/renderer/viewport.js +24 -0
- package/lib/res/lynx-signal/index.d.ts +1 -0
- package/lib/res/lynx-signal/index.js +22 -0
- package/lib/res/lynx-signal/signalFour0.png +0 -0
- package/lib/res/lynx-signal/signalFour1.png +0 -0
- package/lib/res/lynx-signal/signalFour2.png +0 -0
- package/lib/res/lynx-signal/signalFour3.png +0 -0
- package/lib/res/lynx-signal/signalFour4.png +0 -0
- package/lib/res/lynx-signal/signalThree0.png +0 -0
- package/lib/res/lynx-signal/signalThree1.png +0 -0
- package/lib/res/lynx-signal/signalThree2.png +0 -0
- package/lib/res/lynx-signal/signalThree3.png +0 -0
- package/lib/res/player-charging.png +0 -0
- package/lib/res/player-more-arrow.png +0 -0
- package/lib/res/player-solar.png +0 -0
- package/lib/ui/bottomLeftContent.js +119 -55
- package/lib/ui/bottomRightContent.js +6 -3
- package/lib/ui/scrollHintArrow.d.ts +23 -0
- package/lib/ui/scrollHintArrow.js +82 -0
- package/lib/ui/ui.d.ts +5 -0
- package/lib/ui/ui.js +89 -98
- package/lib/utils/navigation.d.ts +1 -2
- package/lib/utils/navigation.js +3 -13
- package/lib/widgets/battery/battery.js +7 -5
- package/lib/widgets/battery/batteryFull.js +7 -5
- package/lib/widgets/battery/statusIcon.d.ts +6 -0
- package/lib/widgets/battery/statusIcon.js +36 -0
- package/lib/widgets/battery/statusIcon.less +24 -0
- package/lib/widgets/floodlight/floodlight.js +2 -1
- package/lib/widgets/flowLowTip/flowLowTip.js +2 -1
- package/lib/widgets/fullScreen/fullScreen.js +2 -1
- package/lib/widgets/fullScreen/fullTravelRouteControl.d.ts +1 -1
- package/lib/widgets/fullScreen/fullTravelRouteControl.js +1 -1
- package/lib/widgets/fullScreen/verticalScreen.js +2 -1
- package/lib/widgets/index.d.ts +0 -1
- package/lib/widgets/index.js +1 -2
- package/lib/widgets/moveInteractiveControl/controlButton.js +2 -1
- package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.js +12 -3
- package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.less +24 -4
- package/lib/widgets/multiCamera/index.less +0 -1
- package/lib/widgets/multiCamera/landscapeTip.js +2 -1
- package/lib/widgets/multiCamera/moveablePtzControl.js +5 -5
- package/lib/widgets/multiCamera/multiPtz.js +3 -2
- package/lib/widgets/multiCamera/ptzMoveableTip.js +2 -1
- package/lib/widgets/multiCamera/switchLayout.js +2 -1
- package/lib/widgets/multiCamera/tileMultiPtz.js +3 -2
- package/lib/widgets/multiCamera/tileSwitchLayout.js +2 -1
- package/lib/widgets/multiCamera/tileTip.js +2 -1
- package/lib/widgets/muted/muted.js +2 -1
- package/lib/widgets/muted/muted.test.js +66 -52
- package/lib/widgets/ptz/ptz.js +2 -1
- package/lib/widgets/ptz/ptzControl.js +1 -1
- package/lib/widgets/ptzControlTip/ptzControlTip.js +6 -3
- package/lib/widgets/ptzControlTip/ptzControlTip.less +6 -0
- package/lib/widgets/realTimeMagnification/realTimeMagnification.js +2 -1
- package/lib/widgets/recordVideo/recordVideo.js +54 -58
- package/lib/widgets/recordVideo/recordVideo.less +74 -17
- package/lib/widgets/recordVideo/recordVideo.test.js +0 -1
- package/lib/widgets/resolution/fullResolutionControl.js +29 -19
- package/lib/widgets/resolution/resolution.js +3 -2
- package/lib/widgets/screenshot/screenshot.js +45 -67
- package/lib/widgets/screenshot/screenshot.less +40 -1
- package/lib/widgets/signal4G/signal4G.js +4 -1
- package/lib/widgets/siren/siren.js +2 -1
- package/lib/widgets/tempHumidity/tempHumidity.js +2 -1
- package/lib/widgets/toggleVerticalFull/toggleVerticalFull.js +2 -1
- package/lib/widgets/trialBadge/index.d.ts +1 -2
- package/lib/widgets/trialBadge/index.js +17 -20
- package/lib/widgets/trialBadge/index.less +24 -0
- package/lib/widgets/trialBadge/useTrialBadge.d.ts +2 -3
- package/lib/widgets/trialBadge/useTrialBadge.js +2 -13
- package/lib/widgets/tryExperience/tryExperience.js +2 -1
- package/lib/widgets/videoBitKBP/videoBitKBP.js +2 -1
- package/lib/widgets/voiceIntercom/voiceIntercom.js +50 -24
- package/lib/widgets/voiceIntercom/voiceIntercom.less +16 -0
- package/lib/widgets/zoomTurntable/lynxDockLayout.d.ts +6 -0
- package/lib/widgets/zoomTurntable/lynxDockLayout.js +30 -0
- package/lib/widgets/zoomTurntable/turntable/index.d.ts +5 -7
- package/lib/widgets/zoomTurntable/turntable/index.js +3 -1
- package/lib/widgets/zoomTurntable/turntable/lynx.d.ts +5 -0
- package/lib/widgets/zoomTurntable/turntable/lynx.js +273 -0
- package/lib/widgets/zoomTurntable/turntable/lynx.less +9 -0
- package/lib/widgets/zoomTurntable/turntable/lynxModel.d.ts +37 -0
- package/lib/widgets/zoomTurntable/turntable/lynxModel.js +122 -0
- package/lib/widgets/zoomTurntable/turntable/lynxPaint.d.ts +3 -0
- package/lib/widgets/zoomTurntable/turntable/lynxPaint.js +36 -0
- package/lib/widgets/zoomTurntable/zoomTurntableDock.d.ts +2 -0
- package/lib/widgets/zoomTurntable/zoomTurntableDock.js +1 -1
- package/lib/widgets/zoomTurntable/zoomTurntableEntry.js +31 -18
- package/lib/widgets/zoomTurntable/zoomTurntableTip.js +23 -3
- package/package.json +15 -7
- package/lib/ctx/ctx.album.test.d.ts +0 -1
- package/lib/ctx/ctx.album.test.js +0 -197
- package/lib/ctx/multiCameraCtx.test.d.ts +0 -1
- package/lib/ctx/multiCameraCtx.test.js +0 -65
- package/lib/ui/absoluteContent.d.ts +0 -2
- package/lib/ui/absoluteContent.js +0 -3
- package/lib/utils/captureResult.d.ts +0 -12
- package/lib/utils/captureResult.js +0 -70
- package/lib/utils/captureResult.test.d.ts +0 -1
- package/lib/utils/captureResult.test.js +0 -223
- package/lib/utils/fullLinkTracking.d.ts +0 -5
- package/lib/utils/fullLinkTracking.js +0 -71
- package/lib/widgets/captureResult/captureResult.d.ts +0 -16
- package/lib/widgets/captureResult/captureResult.js +0 -85
- package/lib/widgets/captureResult/captureResult.less +0 -144
- package/lib/widgets/captureResult/captureResult.test.d.ts +0 -1
- package/lib/widgets/captureResult/captureResult.test.js +0 -84
- package/lib/widgets/captureResult/index.d.ts +0 -2
- package/lib/widgets/captureResult/index.js +0 -2
- package/lib/widgets/recordVideo/recordVideo.lifecycle.test.d.ts +0 -1
- package/lib/widgets/recordVideo/recordVideo.lifecycle.test.js +0 -106
- package/lib/widgets/screenshot/screenshot.test.d.ts +0 -1
- package/lib/widgets/screenshot/screenshot.test.js +0 -135
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import "core-js/modules/esnext.iterator.constructor.js";
|
|
3
|
-
import "core-js/modules/esnext.iterator.filter.js";
|
|
4
|
-
import "core-js/modules/esnext.iterator.for-each.js";
|
|
5
|
-
import { getLaunchOptionsSync } from '@ray-js/ray';
|
|
6
|
-
import { getInitUtmTid } from '@ray-js/ray-ipc-utils';
|
|
7
|
-
export const createEntryTracking = () => {
|
|
8
|
-
let upstreamRtid;
|
|
9
|
-
try {
|
|
10
|
-
var _getLaunchOptionsSync;
|
|
11
|
-
upstreamRtid = (_getLaunchOptionsSync = getLaunchOptionsSync()) === null || _getLaunchOptionsSync === void 0 || (_getLaunchOptionsSync = _getLaunchOptionsSync.query) === null || _getLaunchOptionsSync === void 0 ? void 0 : _getLaunchOptionsSync.utm_rtid;
|
|
12
|
-
} catch (error) {
|
|
13
|
-
// Tracking must not prevent navigation when launch options are unavailable.
|
|
14
|
-
}
|
|
15
|
-
return {
|
|
16
|
-
utm_source: 'miniprogram',
|
|
17
|
-
utm_medium: 'panel_smart_quality',
|
|
18
|
-
entry_source_type: 'organic',
|
|
19
|
-
utm_rtid: upstreamRtid || getInitUtmTid()
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
export const appendTrackingQuery = (url, tracking) => {
|
|
23
|
-
const hashIndex = url.indexOf('#');
|
|
24
|
-
const base = hashIndex < 0 ? url : url.slice(0, hashIndex);
|
|
25
|
-
const hash = hashIndex < 0 ? '' : url.slice(hashIndex);
|
|
26
|
-
const queryIndex = base.indexOf('?');
|
|
27
|
-
const path = queryIndex < 0 ? base : base.slice(0, queryIndex);
|
|
28
|
-
const params = (queryIndex < 0 ? [] : base.slice(queryIndex + 1).split('&')).filter(param => {
|
|
29
|
-
if (!param) return false;
|
|
30
|
-
return !Object.prototype.hasOwnProperty.call(tracking, decodeURIComponent(param.split('=')[0]));
|
|
31
|
-
});
|
|
32
|
-
Object.entries(tracking).forEach(_ref => {
|
|
33
|
-
let [key, value] = _ref;
|
|
34
|
-
params.push(`${key}=${encodeURIComponent(value)}`);
|
|
35
|
-
});
|
|
36
|
-
return `${path}?${params.join('&')}${hash}`;
|
|
37
|
-
};
|
|
38
|
-
const reportEntry = async (eventType, devId, tracking) => {
|
|
39
|
-
try {
|
|
40
|
-
const {
|
|
41
|
-
homeId
|
|
42
|
-
} = await new Promise((resolve, reject) => {
|
|
43
|
-
ty.home.getCurrentHomeInfo({
|
|
44
|
-
success: resolve,
|
|
45
|
-
fail: reject
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
const {
|
|
49
|
-
miniProgram
|
|
50
|
-
} = ty.getAccountInfoSync();
|
|
51
|
-
const event = _objectSpread(_objectSpread({
|
|
52
|
-
project_type: 'cloud_storage',
|
|
53
|
-
event_type: eventType,
|
|
54
|
-
container_type: 'miniapp',
|
|
55
|
-
miniapp_code: miniProgram.appId,
|
|
56
|
-
miniapp_version: miniProgram.version,
|
|
57
|
-
service_type: 'security_cloud_service'
|
|
58
|
-
}, tracking), {}, {
|
|
59
|
-
device_id: devId,
|
|
60
|
-
homeid: homeId
|
|
61
|
-
});
|
|
62
|
-
ty.event({
|
|
63
|
-
eventId: eventType === 'card_view' ? 'ty_XjSozxV0YkDMjzH8orMHx0g2HMc6GQ3q' : 'ty_tUWSmFcHcSetzZd5soRTq6Y3nEYE0RgP',
|
|
64
|
-
event
|
|
65
|
-
});
|
|
66
|
-
} catch (error) {
|
|
67
|
-
console.warn('[IPC] entry tracking failed:', error);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
export const reportEntryView = (devId, tracking) => reportEntry('card_view', devId, tracking);
|
|
71
|
-
export const reportEntryClick = (devId, tracking) => reportEntry('card_click', devId, tracking);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import './captureResult.less';
|
|
3
|
-
export type CaptureKind = 'record' | 'screenshot';
|
|
4
|
-
export interface CaptureResultToastProps {
|
|
5
|
-
brandColor: string;
|
|
6
|
-
kind: CaptureKind;
|
|
7
|
-
thumbnailPath: string;
|
|
8
|
-
onCheck: () => void;
|
|
9
|
-
count?: number;
|
|
10
|
-
/** 自定义标题(可选),不传时使用默认文案 */
|
|
11
|
-
title?: React.ReactNode;
|
|
12
|
-
/** 自定义操作按钮文案(可选),不传时默认为“查看” */
|
|
13
|
-
checkText?: string;
|
|
14
|
-
className?: string;
|
|
15
|
-
}
|
|
16
|
-
export declare function CaptureResultToast({ brandColor, count, kind, onCheck, thumbnailPath, title, checkText, className, }: CaptureResultToastProps): React.JSX.Element;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Image, Text, View } from '@ray-js/ray';
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
import Strings from '../../i18n';
|
|
5
|
-
import './captureResult.less';
|
|
6
|
-
const BACKDROP_LAYERS = ['back', 'middle'];
|
|
7
|
-
const TEXT_KEYS = {
|
|
8
|
-
record: {
|
|
9
|
-
check: 'ipc_player_record_success_check',
|
|
10
|
-
multi: 'ipc_player_record_multi_success_tip',
|
|
11
|
-
single: 'ipc_player_record_success_tip'
|
|
12
|
-
},
|
|
13
|
-
screenshot: {
|
|
14
|
-
check: 'ipc_player_shot_success_check',
|
|
15
|
-
multi: 'ipc_player_screenshot_multi_success_tip',
|
|
16
|
-
single: 'ipc_player_screenshot_success_tip'
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
const LEGACY_CLASS_MAP = {
|
|
20
|
-
record: {
|
|
21
|
-
toast: 'ipc-player-plugin-record-success-toast',
|
|
22
|
-
imageBox: 'ipc-player-plugin-record-success-toast-image-box',
|
|
23
|
-
imageBoxMulti: 'ipc-player-plugin-record-success-toast-image-box-multi',
|
|
24
|
-
image: 'ipc-player-plugin-record-success-toast-image',
|
|
25
|
-
playIconBox: 'ipc-player-plugin-record-success-play-icon-box',
|
|
26
|
-
playIcon: 'ipc-player-plugin-record-success-play-icon',
|
|
27
|
-
title: 'ipc-player-plugin-record-success-toast-title',
|
|
28
|
-
check: 'ipc-player-plugin-record-success-toast-bottom'
|
|
29
|
-
},
|
|
30
|
-
screenshot: {
|
|
31
|
-
toast: 'ipc-player-plugin-screenshot-toast',
|
|
32
|
-
imageBox: 'ipc-player-plugin-screenshot-toast-image-box',
|
|
33
|
-
imageBoxMulti: 'ipc-player-plugin-screenshot-toast-image-box-multi',
|
|
34
|
-
image: 'ipc-player-plugin-screenshot-toast-image',
|
|
35
|
-
playIconBox: '',
|
|
36
|
-
playIcon: '',
|
|
37
|
-
title: 'ipc-player-plugin-screenshot-toast-title',
|
|
38
|
-
check: 'ipc-player-plugin-screenshot-toast-bottom'
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
export function CaptureResultToast(_ref) {
|
|
42
|
-
let {
|
|
43
|
-
brandColor,
|
|
44
|
-
count = 0,
|
|
45
|
-
kind,
|
|
46
|
-
onCheck,
|
|
47
|
-
thumbnailPath,
|
|
48
|
-
title,
|
|
49
|
-
checkText,
|
|
50
|
-
className
|
|
51
|
-
} = _ref;
|
|
52
|
-
const isMultiLens = count > 1;
|
|
53
|
-
const textKeys = TEXT_KEYS[kind];
|
|
54
|
-
const legacyCls = LEGACY_CLASS_MAP[kind];
|
|
55
|
-
const imageClassName = clsx('ipc-player-plugin-capture-result-image', legacyCls.image);
|
|
56
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
57
|
-
className: clsx('ipc-player-plugin-capture-result-toast', legacyCls.toast, className)
|
|
58
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
59
|
-
className: clsx('ipc-player-plugin-capture-result-image-box', legacyCls.imageBox, isMultiLens && ['ipc-player-plugin-capture-result-image-box-multi', legacyCls.imageBoxMulti])
|
|
60
|
-
}, isMultiLens ? /*#__PURE__*/React.createElement(React.Fragment, null, BACKDROP_LAYERS.map(layer => /*#__PURE__*/React.createElement(View, {
|
|
61
|
-
key: layer,
|
|
62
|
-
className: clsx('ipc-player-plugin-capture-result-backdrop', `ipc-player-plugin-capture-result-image-${layer}`)
|
|
63
|
-
})), /*#__PURE__*/React.createElement(Image, {
|
|
64
|
-
className: clsx(imageClassName, 'ipc-player-plugin-capture-result-image-front'),
|
|
65
|
-
src: thumbnailPath
|
|
66
|
-
})) : /*#__PURE__*/React.createElement(Image, {
|
|
67
|
-
className: imageClassName,
|
|
68
|
-
src: thumbnailPath
|
|
69
|
-
}), kind === 'record' && /*#__PURE__*/React.createElement(View, {
|
|
70
|
-
className: clsx('ipc-player-plugin-capture-result-play-icon-box', legacyCls.playIconBox)
|
|
71
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
72
|
-
className: clsx('icon-panel', 'icon-panel-record-play', 'ipc-player-plugin-capture-result-play-icon', legacyCls.playIcon)
|
|
73
|
-
}))), /*#__PURE__*/React.createElement(View, {
|
|
74
|
-
className: clsx('ipc-player-plugin-capture-result-title', legacyCls.title)
|
|
75
|
-
}, title ? typeof title === 'string' ? /*#__PURE__*/React.createElement(Text, null, title) : title : count > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, null, Strings.getLang(textKeys.multi)), /*#__PURE__*/React.createElement(Text, {
|
|
76
|
-
className: "ipc-player-plugin-capture-result-count"
|
|
77
|
-
}, Strings.formatString(Strings.getLang('ipc_player_multi_capture_success_count'), count))) : Strings.getLang(textKeys.single)), /*#__PURE__*/React.createElement(View, {
|
|
78
|
-
onClick: onCheck,
|
|
79
|
-
className: clsx('ipc-player-plugin-capture-result-check', legacyCls.check),
|
|
80
|
-
style: {
|
|
81
|
-
color: brandColor,
|
|
82
|
-
borderColor: brandColor
|
|
83
|
-
}
|
|
84
|
-
}, checkText || Strings.getLang(textKeys.check)));
|
|
85
|
-
}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
.ipc-player-plugin-capture-result-toast,
|
|
2
|
-
.ipc-player-plugin-record-success-toast,
|
|
3
|
-
.ipc-player-plugin-screenshot-toast {
|
|
4
|
-
--capture-result-text-color: var(--fontColor, #fff);
|
|
5
|
-
--capture-result-near-backdrop-color: rgba(255, 255, 255, 0.2);
|
|
6
|
-
--capture-result-far-backdrop-color: rgba(255, 255, 255, 0.1);
|
|
7
|
-
|
|
8
|
-
z-index: 100;
|
|
9
|
-
display: flex;
|
|
10
|
-
flex: 1;
|
|
11
|
-
align-items: center;
|
|
12
|
-
padding: calc(7px * var(--ipc-player-size-scale, 1))
|
|
13
|
-
calc(16px * var(--ipc-player-size-scale, 1))
|
|
14
|
-
calc(7px * var(--ipc-player-size-scale, 1))
|
|
15
|
-
calc(12px * var(--ipc-player-size-scale, 1));
|
|
16
|
-
background-color: var(--shot-card-bg-color);
|
|
17
|
-
border-radius: calc(8px * var(--ipc-player-size-scale, 1));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
:root[theme='light'] .ipc-player-plugin-capture-result-toast {
|
|
21
|
-
--capture-result-text-color: #1a1a1a;
|
|
22
|
-
--capture-result-near-backdrop-color: rgba(0, 0, 0, 0.1);
|
|
23
|
-
--capture-result-far-backdrop-color: rgba(0, 0, 0, 0.05);
|
|
24
|
-
|
|
25
|
-
background-color: #fff;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.ipc-player-plugin-capture-result-image-box,
|
|
29
|
-
.ipc-player-plugin-record-success-toast-image-box,
|
|
30
|
-
.ipc-player-plugin-screenshot-toast-image-box {
|
|
31
|
-
position: relative;
|
|
32
|
-
width: calc(66px * var(--ipc-player-size-scale, 1));
|
|
33
|
-
height: calc(39px * var(--ipc-player-size-scale, 1));
|
|
34
|
-
overflow: hidden;
|
|
35
|
-
border-radius: calc(4px * var(--ipc-player-size-scale, 1));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.ipc-player-plugin-capture-result-image,
|
|
39
|
-
.ipc-player-plugin-record-success-toast-image,
|
|
40
|
-
.ipc-player-plugin-screenshot-toast-image {
|
|
41
|
-
width: 100%;
|
|
42
|
-
height: 100%;
|
|
43
|
-
object-fit: cover;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.ipc-player-plugin-capture-result-backdrop,
|
|
47
|
-
.ipc-player-plugin-capture-result-image-front {
|
|
48
|
-
position: absolute;
|
|
49
|
-
box-sizing: border-box;
|
|
50
|
-
border-radius: calc(4px * var(--ipc-player-size-scale, 1));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.ipc-player-plugin-capture-result-image-back {
|
|
54
|
-
top: calc(1px * var(--ipc-player-size-scale, 1));
|
|
55
|
-
left: calc(5px * var(--ipc-player-size-scale, 1));
|
|
56
|
-
z-index: 1;
|
|
57
|
-
width: calc(56px * var(--ipc-player-size-scale, 1));
|
|
58
|
-
height: calc(28px * var(--ipc-player-size-scale, 1));
|
|
59
|
-
background: var(--capture-result-far-backdrop-color);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.ipc-player-plugin-capture-result-image-middle {
|
|
63
|
-
top: calc(3px * var(--ipc-player-size-scale, 1));
|
|
64
|
-
left: calc(2.5px * var(--ipc-player-size-scale, 1));
|
|
65
|
-
z-index: 2;
|
|
66
|
-
width: calc(61px * var(--ipc-player-size-scale, 1));
|
|
67
|
-
height: calc(30.5px * var(--ipc-player-size-scale, 1));
|
|
68
|
-
background: var(--capture-result-near-backdrop-color);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.ipc-player-plugin-capture-result-image-front {
|
|
72
|
-
top: calc(5px * var(--ipc-player-size-scale, 1));
|
|
73
|
-
left: 0;
|
|
74
|
-
z-index: 3;
|
|
75
|
-
width: calc(66px * var(--ipc-player-size-scale, 1));
|
|
76
|
-
height: calc(33px * var(--ipc-player-size-scale, 1));
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.ipc-player-plugin-capture-result-play-icon-box,
|
|
80
|
-
.ipc-player-plugin-record-success-play-icon-box {
|
|
81
|
-
position: absolute;
|
|
82
|
-
top: 50%;
|
|
83
|
-
left: 50%;
|
|
84
|
-
z-index: 4;
|
|
85
|
-
display: flex;
|
|
86
|
-
align-items: center;
|
|
87
|
-
justify-content: center;
|
|
88
|
-
width: calc(16px * var(--ipc-player-size-scale, 1));
|
|
89
|
-
height: calc(16px * var(--ipc-player-size-scale, 1));
|
|
90
|
-
overflow: hidden;
|
|
91
|
-
background-color: rgba(0, 0, 0, 0.2);
|
|
92
|
-
border-radius: 50%;
|
|
93
|
-
transform: translate(-50%, -50%);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.ipc-player-plugin-capture-result-image-box-multi
|
|
97
|
-
.ipc-player-plugin-capture-result-play-icon-box {
|
|
98
|
-
top: calc(50% + 2px * var(--ipc-player-size-scale, 1));
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.ipc-player-plugin-capture-result-play-icon,
|
|
102
|
-
.ipc-player-plugin-record-success-play-icon {
|
|
103
|
-
color: #ffffff;
|
|
104
|
-
font-size: calc(9px * var(--ipc-player-size-scale, 1)) !important;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.ipc-player-plugin-capture-result-title,
|
|
108
|
-
.ipc-player-plugin-record-success-toast-title,
|
|
109
|
-
.ipc-player-plugin-screenshot-toast-title {
|
|
110
|
-
display: flex;
|
|
111
|
-
flex: 1;
|
|
112
|
-
flex-direction: column;
|
|
113
|
-
min-width: 0;
|
|
114
|
-
margin-right: calc(12px * var(--ipc-player-size-scale, 1));
|
|
115
|
-
margin-left: calc(8px * var(--ipc-player-size-scale, 1));
|
|
116
|
-
color: var(--capture-result-text-color, var(--fontColor));
|
|
117
|
-
font-size: calc(14px * var(--ipc-player-size-scale, 1));
|
|
118
|
-
line-height: calc(20px * var(--ipc-player-size-scale, 1));
|
|
119
|
-
word-break: break-word;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.ipc-player-plugin-capture-result-count {
|
|
123
|
-
margin-top: calc(2px * var(--ipc-player-size-scale, 1));
|
|
124
|
-
color: var(--capture-result-text-color, var(--fontColor));
|
|
125
|
-
font-size: calc(12px * var(--ipc-player-size-scale, 1));
|
|
126
|
-
line-height: calc(17px * var(--ipc-player-size-scale, 1));
|
|
127
|
-
opacity: 0.5;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.ipc-player-plugin-capture-result-check,
|
|
131
|
-
.ipc-player-plugin-record-success-toast-bottom,
|
|
132
|
-
.ipc-player-plugin-screenshot-toast-bottom {
|
|
133
|
-
min-width: calc(52px * var(--ipc-player-size-scale, 1));
|
|
134
|
-
max-width: calc(100px * var(--ipc-player-size-scale, 1));
|
|
135
|
-
flex-shrink: 0;
|
|
136
|
-
padding: calc(5px * var(--ipc-player-size-scale, 1))
|
|
137
|
-
calc(11px * var(--ipc-player-size-scale, 1));
|
|
138
|
-
overflow: hidden;
|
|
139
|
-
font-size: calc(14px * var(--ipc-player-size-scale, 1));
|
|
140
|
-
white-space: nowrap;
|
|
141
|
-
text-overflow: ellipsis;
|
|
142
|
-
border: 1px solid #1989fa;
|
|
143
|
-
border-radius: calc(4px * var(--ipc-player-size-scale, 1));
|
|
144
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { renderToStaticMarkup } from 'react-dom/server';
|
|
3
|
-
jest.mock('@ray-js/ray', () => {
|
|
4
|
-
const React = require('react');
|
|
5
|
-
return {
|
|
6
|
-
Image: _ref => {
|
|
7
|
-
let {
|
|
8
|
-
className,
|
|
9
|
-
src
|
|
10
|
-
} = _ref;
|
|
11
|
-
return /*#__PURE__*/React.createElement("img", {
|
|
12
|
-
alt: "",
|
|
13
|
-
className: className,
|
|
14
|
-
src: src
|
|
15
|
-
});
|
|
16
|
-
},
|
|
17
|
-
Text: _ref2 => {
|
|
18
|
-
let {
|
|
19
|
-
children,
|
|
20
|
-
className
|
|
21
|
-
} = _ref2;
|
|
22
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
23
|
-
className: className
|
|
24
|
-
}, children);
|
|
25
|
-
},
|
|
26
|
-
View: _ref3 => {
|
|
27
|
-
let {
|
|
28
|
-
children,
|
|
29
|
-
className
|
|
30
|
-
} = _ref3;
|
|
31
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
32
|
-
className: className
|
|
33
|
-
}, children);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
});
|
|
37
|
-
jest.mock('../../i18n', () => ({
|
|
38
|
-
__esModule: true,
|
|
39
|
-
default: {
|
|
40
|
-
getLang: key => key,
|
|
41
|
-
formatString: (template, count) => `${template}:${count}`
|
|
42
|
-
}
|
|
43
|
-
}));
|
|
44
|
-
jest.mock('./captureResult.less', () => ({}));
|
|
45
|
-
const {
|
|
46
|
-
CaptureResultToast
|
|
47
|
-
} = require('./captureResult');
|
|
48
|
-
const renderToast = count => renderToStaticMarkup(/*#__PURE__*/React.createElement(CaptureResultToast, {
|
|
49
|
-
brandColor: "#ff592a",
|
|
50
|
-
count: count,
|
|
51
|
-
kind: "screenshot",
|
|
52
|
-
onCheck: () => undefined,
|
|
53
|
-
thumbnailPath: "thingfile://capture.jpg"
|
|
54
|
-
}));
|
|
55
|
-
const countClass = (markup, className) => [...markup.matchAll(/class="([^"]*)"/g)].filter(_ref4 => {
|
|
56
|
-
let [, names] = _ref4;
|
|
57
|
-
return names.split(/\s+/).includes(className);
|
|
58
|
-
}).length;
|
|
59
|
-
describe('CaptureResultToast', () => {
|
|
60
|
-
it('shows the actual count for one successful multi-lens item', () => {
|
|
61
|
-
expect(renderToast(1)).toContain('ipc_player_multi_capture_success_count:1');
|
|
62
|
-
expect(renderToast(0)).not.toContain('ipc_player_multi_capture_success_count');
|
|
63
|
-
});
|
|
64
|
-
it('keeps the single-item thumbnail unchanged', () => {
|
|
65
|
-
const markup = renderToast(1);
|
|
66
|
-
expect(countClass(markup, 'ipc-player-plugin-capture-result-backdrop')).toBe(0);
|
|
67
|
-
expect(countClass(markup, 'ipc-player-plugin-capture-result-image-front')).toBe(0);
|
|
68
|
-
expect(countClass(markup, 'ipc-player-plugin-capture-result-image')).toBe(1);
|
|
69
|
-
});
|
|
70
|
-
it('renders both backdrops for two captured items', () => {
|
|
71
|
-
const markup = renderToast(2);
|
|
72
|
-
expect(countClass(markup, 'ipc-player-plugin-capture-result-backdrop')).toBe(2);
|
|
73
|
-
expect(countClass(markup, 'ipc-player-plugin-capture-result-image-back')).toBe(1);
|
|
74
|
-
expect(countClass(markup, 'ipc-player-plugin-capture-result-image-middle')).toBe(1);
|
|
75
|
-
expect(countClass(markup, 'ipc-player-plugin-capture-result-image-front')).toBe(1);
|
|
76
|
-
});
|
|
77
|
-
it('caps the backdrop count at two', () => {
|
|
78
|
-
const markup = renderToast(4);
|
|
79
|
-
expect(countClass(markup, 'ipc-player-plugin-capture-result-backdrop')).toBe(2);
|
|
80
|
-
expect(countClass(markup, 'ipc-player-plugin-capture-result-image-back')).toBe(1);
|
|
81
|
-
expect(countClass(markup, 'ipc-player-plugin-capture-result-image-middle')).toBe(1);
|
|
82
|
-
expect(countClass(markup, 'ipc-player-plugin-capture-result-image-front')).toBe(1);
|
|
83
|
-
});
|
|
84
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import "core-js/modules/esnext.iterator.constructor.js";
|
|
2
|
-
import "core-js/modules/esnext.iterator.filter.js";
|
|
3
|
-
import "core-js/modules/esnext.iterator.map.js";
|
|
4
|
-
import React, { useState } from 'react';
|
|
5
|
-
import ReactDOM from 'react-dom';
|
|
6
|
-
import { act, Simulate } from 'react-dom/test-utils';
|
|
7
|
-
import { atom, getDefaultStore } from 'jotai';
|
|
8
|
-
import { PlayState } from '../../interface';
|
|
9
|
-
import { RecordVideo } from './recordVideo';
|
|
10
|
-
jest.mock('@ray-js/ray', () => ({
|
|
11
|
-
View: 'div',
|
|
12
|
-
Text: 'span',
|
|
13
|
-
Image: 'img',
|
|
14
|
-
getSystemInfoSync: () => ({
|
|
15
|
-
platform: 'android'
|
|
16
|
-
})
|
|
17
|
-
}));
|
|
18
|
-
jest.mock('@ray-js/ray-ipc-utils', () => ({
|
|
19
|
-
goToIpcPageNativeRoute: jest.fn()
|
|
20
|
-
}));
|
|
21
|
-
jest.mock('@ray-js/ray-ipc-utils/lib/interface', () => ({}));
|
|
22
|
-
jest.mock('../../utils/device', () => ({
|
|
23
|
-
getDeviceInfo: jest.fn()
|
|
24
|
-
}));
|
|
25
|
-
jest.mock('../../i18n', () => ({
|
|
26
|
-
__esModule: true,
|
|
27
|
-
default: {
|
|
28
|
-
getLang: key => key
|
|
29
|
-
}
|
|
30
|
-
}));
|
|
31
|
-
jest.mock('./recordVideo.less', () => ({}));
|
|
32
|
-
jest.mock('../captureResult/captureResult.less', () => ({}));
|
|
33
|
-
describe('RecordVideo', () => {
|
|
34
|
-
let container;
|
|
35
|
-
beforeEach(() => {
|
|
36
|
-
jest.useFakeTimers('modern');
|
|
37
|
-
container = document.createElement('div');
|
|
38
|
-
document.body.appendChild(container);
|
|
39
|
-
});
|
|
40
|
-
afterEach(() => {
|
|
41
|
-
act(() => ReactDOM.unmountComponentAtNode(container));
|
|
42
|
-
container.remove();
|
|
43
|
-
jest.clearAllTimers();
|
|
44
|
-
jest.useRealTimers();
|
|
45
|
-
});
|
|
46
|
-
it.each([false, true])('removes the recording timer after stop (remounted: %s)', async remount => {
|
|
47
|
-
var _container$querySelec, _container$querySelec2;
|
|
48
|
-
const store = getDefaultStore();
|
|
49
|
-
const recording = atom(false);
|
|
50
|
-
const recordingDisabled = atom(false);
|
|
51
|
-
const screenType = atom('vertical');
|
|
52
|
-
const setRecording = jest.fn(async value => {
|
|
53
|
-
store.set(recording, value);
|
|
54
|
-
return value ? true : {
|
|
55
|
-
tempImagePath: 'thingfile://record.jpg'
|
|
56
|
-
};
|
|
57
|
-
});
|
|
58
|
-
function Harness(_ref) {
|
|
59
|
-
let {
|
|
60
|
-
widgetKey
|
|
61
|
-
} = _ref;
|
|
62
|
-
const [contents, setContents] = useState([]);
|
|
63
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(RecordVideo, {
|
|
64
|
-
key: widgetKey,
|
|
65
|
-
devId: 'device',
|
|
66
|
-
recording,
|
|
67
|
-
recordingDisabled,
|
|
68
|
-
screenType,
|
|
69
|
-
brandColor: atom('#ff592a'),
|
|
70
|
-
playState: atom(PlayState.PLAYING),
|
|
71
|
-
setRecording,
|
|
72
|
-
setRecordingDisabled: value => store.set(recordingDisabled, value),
|
|
73
|
-
addContent: (_type, content) => setContents(items => [...items, content]),
|
|
74
|
-
deleteContent: (_type, id) => setContents(items => items.filter(item => item.id !== id))
|
|
75
|
-
}), contents.map(item => /*#__PURE__*/React.createElement(item.content, {
|
|
76
|
-
key: item.id
|
|
77
|
-
})));
|
|
78
|
-
}
|
|
79
|
-
const clickRecord = async () => {
|
|
80
|
-
await act(async () => {
|
|
81
|
-
Simulate.click(container.querySelector('.ipc-player-plugin-record-video-icon').parentElement);
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
await act(async () => {
|
|
85
|
-
ReactDOM.render(/*#__PURE__*/React.createElement(Harness, {
|
|
86
|
-
widgetKey: 0
|
|
87
|
-
}), container);
|
|
88
|
-
});
|
|
89
|
-
await clickRecord();
|
|
90
|
-
act(() => jest.advanceTimersByTime(3000));
|
|
91
|
-
expect((_container$querySelec = container.querySelector('.ipc-player-plugin-record-video-toast-time')) === null || _container$querySelec === void 0 ? void 0 : _container$querySelec.textContent).toBe('00:03');
|
|
92
|
-
if (remount) {
|
|
93
|
-
await act(async () => {
|
|
94
|
-
store.set(screenType, 'full');
|
|
95
|
-
ReactDOM.render(/*#__PURE__*/React.createElement(Harness, {
|
|
96
|
-
widgetKey: 1
|
|
97
|
-
}), container);
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
expect((_container$querySelec2 = container.querySelector('.ipc-player-plugin-record-video-toast-time')) === null || _container$querySelec2 === void 0 ? void 0 : _container$querySelec2.textContent).toBe('00:03');
|
|
101
|
-
await clickRecord();
|
|
102
|
-
expect(setRecording).toHaveBeenLastCalledWith(false);
|
|
103
|
-
expect(container.querySelector('.icon-panel-record-stop')).toBeNull();
|
|
104
|
-
expect(container.querySelector('.ipc-player-plugin-record-video-toast-time')).toBeNull();
|
|
105
|
-
});
|
|
106
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { act, renderHook } from '@testing-library/react-hooks/dom';
|
|
2
|
-
import { atom } from 'jotai';
|
|
3
|
-
import { authorize, authorizeStatus, getFileSystemManager, getSystemInfoSync, showModal } from '@ray-js/ray';
|
|
4
|
-
import { getDeviceInfo } from '../../utils/device';
|
|
5
|
-
import { Screenshot } from './screenshot';
|
|
6
|
-
jest.mock('@ray-js/ray', () => ({
|
|
7
|
-
View: 'div',
|
|
8
|
-
Text: 'span',
|
|
9
|
-
Image: 'img',
|
|
10
|
-
getSystemInfoSync: jest.fn(),
|
|
11
|
-
getFileSystemManager: jest.fn(),
|
|
12
|
-
authorize: jest.fn(),
|
|
13
|
-
authorizeStatus: jest.fn(),
|
|
14
|
-
showModal: jest.fn(),
|
|
15
|
-
openAppSystemSettingPage: jest.fn()
|
|
16
|
-
}));
|
|
17
|
-
jest.mock('@ray-js/ray-ipc-utils', () => ({
|
|
18
|
-
goToIpcPageNativeRoute: jest.fn()
|
|
19
|
-
}));
|
|
20
|
-
jest.mock('../../utils/device', () => ({
|
|
21
|
-
getDeviceInfo: jest.fn()
|
|
22
|
-
}));
|
|
23
|
-
jest.mock('../../i18n', () => ({
|
|
24
|
-
__esModule: true,
|
|
25
|
-
default: {
|
|
26
|
-
getLang: key => key
|
|
27
|
-
}
|
|
28
|
-
}));
|
|
29
|
-
jest.mock('./screenshot.less', () => ({}));
|
|
30
|
-
jest.mock('../captureResult/captureResult.less', () => ({}));
|
|
31
|
-
beforeEach(() => {
|
|
32
|
-
jest.clearAllMocks();
|
|
33
|
-
getSystemInfoSync.mockReturnValue({
|
|
34
|
-
platform: 'android',
|
|
35
|
-
system: 'android 12'
|
|
36
|
-
});
|
|
37
|
-
authorizeStatus.mockImplementation(_ref => {
|
|
38
|
-
let {
|
|
39
|
-
fail
|
|
40
|
-
} = _ref;
|
|
41
|
-
return fail({
|
|
42
|
-
errorCode: 9004
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
authorize.mockImplementation(_ref2 => {
|
|
46
|
-
let {
|
|
47
|
-
fail
|
|
48
|
-
} = _ref2;
|
|
49
|
-
return fail({
|
|
50
|
-
errorCode: 9004
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
getFileSystemManager.mockReturnValue({
|
|
54
|
-
access: jest.fn(_ref3 => {
|
|
55
|
-
let {
|
|
56
|
-
success
|
|
57
|
-
} = _ref3;
|
|
58
|
-
return success();
|
|
59
|
-
})
|
|
60
|
-
});
|
|
61
|
-
getDeviceInfo.mockResolvedValue({
|
|
62
|
-
configMetas: {
|
|
63
|
-
tyabimr4v3: {
|
|
64
|
-
split_info: [{
|
|
65
|
-
index: 1
|
|
66
|
-
}, {
|
|
67
|
-
index: 2
|
|
68
|
-
}, {
|
|
69
|
-
index: 3
|
|
70
|
-
}]
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
const createProps = () => ({
|
|
76
|
-
IPCPlayerContext: {
|
|
77
|
-
snapshot: jest.fn(_ref4 => {
|
|
78
|
-
let {
|
|
79
|
-
success
|
|
80
|
-
} = _ref4;
|
|
81
|
-
return success({
|
|
82
|
-
tempImagePath: 'thingfile://capture.jpg'
|
|
83
|
-
});
|
|
84
|
-
})
|
|
85
|
-
},
|
|
86
|
-
addContent: jest.fn(),
|
|
87
|
-
deleteContent: jest.fn(),
|
|
88
|
-
saveToAlbum: 0,
|
|
89
|
-
devId: 'camera-1',
|
|
90
|
-
toast: jest.fn(),
|
|
91
|
-
screenType: atom('vertical'),
|
|
92
|
-
brandColor: atom('#000000'),
|
|
93
|
-
multiLens: true,
|
|
94
|
-
event: {
|
|
95
|
-
emit: jest.fn()
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
it('keeps multi-lens results when legacy album authorization is unavailable', async () => {
|
|
99
|
-
const props = createProps();
|
|
100
|
-
const {
|
|
101
|
-
result,
|
|
102
|
-
unmount
|
|
103
|
-
} = renderHook(() => Screenshot(props));
|
|
104
|
-
await act(async () => {
|
|
105
|
-
await result.current.props.onClick();
|
|
106
|
-
});
|
|
107
|
-
expect(authorizeStatus).not.toHaveBeenCalled();
|
|
108
|
-
expect(props.IPCPlayerContext.snapshot).toHaveBeenCalledWith(expect.objectContaining({
|
|
109
|
-
saveToAlbum: 0
|
|
110
|
-
}));
|
|
111
|
-
const [, config] = props.addContent.mock.calls[0];
|
|
112
|
-
expect(config.content().props).toEqual(expect.objectContaining({
|
|
113
|
-
count: 3,
|
|
114
|
-
thumbnailPath: 'thingfile://capture_lens1.jpg'
|
|
115
|
-
}));
|
|
116
|
-
unmount();
|
|
117
|
-
});
|
|
118
|
-
it('keeps the permission rejection path before taking a snapshot', async () => {
|
|
119
|
-
getSystemInfoSync.mockReturnValue({
|
|
120
|
-
platform: 'ios',
|
|
121
|
-
system: 'iOS 18'
|
|
122
|
-
});
|
|
123
|
-
const props = createProps();
|
|
124
|
-
const {
|
|
125
|
-
result,
|
|
126
|
-
unmount
|
|
127
|
-
} = renderHook(() => Screenshot(props));
|
|
128
|
-
await act(async () => {
|
|
129
|
-
await result.current.props.onClick();
|
|
130
|
-
});
|
|
131
|
-
expect(props.IPCPlayerContext.snapshot).not.toHaveBeenCalled();
|
|
132
|
-
expect(props.addContent).not.toHaveBeenCalled();
|
|
133
|
-
expect(showModal).toHaveBeenCalledTimes(1);
|
|
134
|
-
unmount();
|
|
135
|
-
});
|