@ray-js/ipc-player-integration 0.0.59-beta.0 → 0.0.61-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 +0 -6
- package/lib/ctx/ctx.album.test.d.ts +1 -0
- package/lib/ctx/ctx.album.test.js +197 -0
- package/lib/ctx/ctx.composition.js +19 -4
- package/lib/ctx/ctx.js +103 -55
- package/lib/ctx/ports.output.d.ts +1 -0
- package/lib/ctx/resolution.d.ts +1 -1
- package/lib/ctx/resolution.js +3 -1
- package/lib/i18n/index.d.ts +12 -0
- package/lib/i18n/strings.d.ts +6 -0
- package/lib/i18n/strings.js +6 -0
- package/lib/index.d.ts +0 -4
- package/lib/index.js +1 -3
- package/lib/interface.d.ts +19 -3
- package/lib/ui/absoluteContent.d.ts +2 -0
- package/lib/ui/absoluteContent.js +3 -0
- package/lib/ui/bottomLeftContent.js +55 -119
- package/lib/ui/bottomRightContent.js +3 -6
- package/lib/ui/ui.d.ts +2 -5
- package/lib/ui/ui.js +49 -63
- package/lib/utils/captureResult.d.ts +14 -0
- package/lib/utils/captureResult.js +70 -0
- package/lib/utils/captureResult.test.d.ts +1 -0
- package/lib/utils/captureResult.test.js +117 -0
- package/lib/utils/fullLinkTracking.d.ts +5 -0
- package/lib/utils/fullLinkTracking.js +71 -0
- package/lib/utils/navigation.d.ts +2 -1
- package/lib/utils/navigation.js +13 -3
- package/lib/utils/ttt.js +2 -8
- package/lib/widgets/battery/battery.js +1 -2
- package/lib/widgets/battery/batteryFull.js +1 -2
- package/lib/widgets/captureResult/captureResult.d.ts +16 -0
- package/lib/widgets/captureResult/captureResult.js +85 -0
- package/lib/widgets/captureResult/captureResult.less +144 -0
- package/lib/widgets/captureResult/captureResult.test.d.ts +1 -0
- package/lib/widgets/captureResult/captureResult.test.js +80 -0
- package/lib/widgets/captureResult/index.d.ts +2 -0
- package/lib/widgets/captureResult/index.js +2 -0
- package/lib/widgets/floodlight/floodlight.js +1 -2
- package/lib/widgets/flowLowTip/flowLowTip.js +1 -2
- package/lib/widgets/fullScreen/fullScreen.js +1 -2
- package/lib/widgets/fullScreen/fullTravelRouteControl.d.ts +1 -1
- package/lib/widgets/fullScreen/fullTravelRouteControl.js +1 -1
- package/lib/widgets/fullScreen/verticalScreen.js +1 -2
- package/lib/widgets/index.d.ts +1 -0
- package/lib/widgets/index.js +2 -1
- package/lib/widgets/moveInteractiveControl/controlButton.js +1 -2
- package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.js +3 -12
- package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.less +4 -24
- package/lib/widgets/multiCamera/landscapeTip.js +1 -2
- package/lib/widgets/multiCamera/moveablePtzControl.js +1 -1
- package/lib/widgets/multiCamera/multiPtz.js +1 -2
- package/lib/widgets/multiCamera/ptzMoveableTip.js +1 -2
- package/lib/widgets/multiCamera/switchLayout.js +1 -2
- package/lib/widgets/multiCamera/tileMultiPtz.js +1 -2
- package/lib/widgets/multiCamera/tileSwitchLayout.js +1 -2
- package/lib/widgets/multiCamera/tileTip.js +1 -2
- package/lib/widgets/muted/muted.js +10 -5
- package/lib/widgets/muted/muted.less +5 -1
- package/lib/widgets/muted/muted.test.d.ts +1 -0
- package/lib/widgets/muted/muted.test.js +81 -0
- package/lib/widgets/ptz/ptz.js +1 -2
- package/lib/widgets/ptz/ptzControl.js +1 -1
- package/lib/widgets/ptzControlTip/ptzControlTip.js +3 -6
- package/lib/widgets/ptzControlTip/ptzControlTip.less +0 -6
- package/lib/widgets/realTimeMagnification/realTimeMagnification.js +1 -2
- package/lib/widgets/recordVideo/recordVideo.js +53 -53
- package/lib/widgets/recordVideo/recordVideo.less +17 -74
- package/lib/widgets/recordVideo/recordVideo.lifecycle.test.d.ts +1 -0
- package/lib/widgets/recordVideo/recordVideo.lifecycle.test.js +106 -0
- package/lib/widgets/recordVideo/recordVideo.test.js +1 -0
- package/lib/widgets/resolution/fullResolutionControl.js +19 -29
- package/lib/widgets/resolution/resolution.js +2 -3
- package/lib/widgets/screenshot/screenshot.js +66 -45
- package/lib/widgets/screenshot/screenshot.less +1 -40
- package/lib/widgets/screenshot/screenshot.test.d.ts +1 -0
- package/lib/widgets/screenshot/screenshot.test.js +120 -0
- package/lib/widgets/signal4G/signal4G.js +1 -4
- package/lib/widgets/siren/siren.js +1 -2
- package/lib/widgets/tempHumidity/tempHumidity.js +1 -2
- package/lib/widgets/toggleVerticalFull/toggleVerticalFull.js +1 -2
- package/lib/widgets/trialBadge/index.d.ts +2 -1
- package/lib/widgets/trialBadge/index.js +20 -17
- package/lib/widgets/trialBadge/index.less +0 -24
- package/lib/widgets/trialBadge/useTrialBadge.d.ts +3 -2
- package/lib/widgets/trialBadge/useTrialBadge.js +13 -2
- package/lib/widgets/tryExperience/tryExperience.js +1 -3
- package/lib/widgets/videoBitKBP/videoBitKBP.js +1 -2
- package/lib/widgets/voiceIntercom/voiceIntercom.js +24 -50
- package/lib/widgets/voiceIntercom/voiceIntercom.less +0 -16
- package/lib/widgets/zoomTurntable/turntable/index.d.ts +7 -5
- package/lib/widgets/zoomTurntable/turntable/index.js +1 -2
- package/lib/widgets/zoomTurntable/zoomTurntableEntry.js +1 -2
- package/lib/widgets/zoomTurntable/zoomTurntableTip.js +1 -2
- package/package.json +8 -15
- package/lib/renderer/capabilities.d.ts +0 -8
- package/lib/renderer/capabilities.js +0 -19
- package/lib/renderer/context.d.ts +0 -5
- package/lib/renderer/context.js +0 -6
- package/lib/renderer/directionControl.d.ts +0 -6
- package/lib/renderer/directionControl.js +0 -3
- package/lib/renderer/font.less +0 -5
- package/lib/renderer/glyphs.d.ts +0 -1
- package/lib/renderer/glyphs.js +0 -256
- package/lib/renderer/index.module.less +0 -48
- package/lib/renderer/ptzZoom.d.ts +0 -6
- package/lib/renderer/ptzZoom.js +0 -3
- package/lib/renderer/text.d.ts +0 -4
- package/lib/renderer/text.js +0 -32
- package/lib/renderer/text.module.less +0 -4
- package/lib/renderer/viewport.d.ts +0 -7
- package/lib/renderer/viewport.js +0 -24
- package/lib/res/lynx-signal/index.d.ts +0 -1
- package/lib/res/lynx-signal/index.js +0 -22
- 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-more-arrow.png +0 -0
- package/lib/ui/scrollHintArrow.d.ts +0 -23
- package/lib/ui/scrollHintArrow.js +0 -82
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import "core-js/modules/esnext.iterator.constructor.js";
|
|
2
2
|
import "core-js/modules/esnext.iterator.map.js";
|
|
3
3
|
import React, { useState, useContext, useEffect } from 'react';
|
|
4
|
-
import { View, showToast } from '@ray-js/ray';
|
|
4
|
+
import { Text, View, showToast } from '@ray-js/ray';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
7
6
|
import Strings from '../../i18n';
|
|
8
7
|
import { useMemoizedFn } from '../../hooks';
|
|
9
8
|
import { useStore } from '../../ctx/store';
|
|
@@ -34,10 +33,6 @@ export const FullResolutionControl = props => {
|
|
|
34
33
|
const onPlayerTap = useMemoizedFn(() => {
|
|
35
34
|
setHide(true);
|
|
36
35
|
});
|
|
37
|
-
const normalizeResolution = value => {
|
|
38
|
-
const normalized = String(value || '').toUpperCase();
|
|
39
|
-
return normalized === 'HD' ? 'HD' : 'SD';
|
|
40
|
-
};
|
|
41
36
|
useEffect(() => {
|
|
42
37
|
event.on('showFullResolutionControl', onShowFullResolutionControl);
|
|
43
38
|
event.on(playerTap, onPlayerTap);
|
|
@@ -47,14 +42,13 @@ export const FullResolutionControl = props => {
|
|
|
47
42
|
};
|
|
48
43
|
}, []);
|
|
49
44
|
const changeResolution = useMemoizedFn(value => {
|
|
50
|
-
|
|
51
|
-
if (targetResolution === normalizeResolution(resolution)) {
|
|
45
|
+
if (value === resolution) {
|
|
52
46
|
showToast({
|
|
53
47
|
icon: 'none',
|
|
54
48
|
title: Strings.getLang('ipc_player_current_resolution_is_equal')
|
|
55
49
|
});
|
|
56
50
|
} else {
|
|
57
|
-
setResolution(
|
|
51
|
+
setResolution(value).then(() => {
|
|
58
52
|
showToast({
|
|
59
53
|
icon: 'none',
|
|
60
54
|
title: Strings.getLang('ipc_player_change_resolution_success')
|
|
@@ -74,24 +68,20 @@ export const FullResolutionControl = props => {
|
|
|
74
68
|
className: clsx('ipc-player-plugin-full-resolution-control', 'ipc-plugin-absolute-move-in-right', {
|
|
75
69
|
'ipc-plugin-absolute-move-in-right-hide': hide
|
|
76
70
|
})
|
|
77
|
-
}, resolutionList.map(item => {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
color: brandColor
|
|
94
|
-
} : undefined
|
|
95
|
-
}, Strings.getLang(`ipc_player_resolution_${normalizedItem}`));
|
|
96
|
-
}));
|
|
71
|
+
}, resolutionList.map(item => /*#__PURE__*/React.createElement(Text, {
|
|
72
|
+
onClick: () => {
|
|
73
|
+
event.emit(widgetClick, {
|
|
74
|
+
widgetId: widgetLabs.FULL_RESOLUTION_CONTROL,
|
|
75
|
+
extra: {
|
|
76
|
+
resolution: item
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
changeResolution(item);
|
|
80
|
+
},
|
|
81
|
+
key: item,
|
|
82
|
+
className: clsx('ipc-player-plugin-full-resolution-control-text'),
|
|
83
|
+
style: item === resolution && {
|
|
84
|
+
color: brandColor
|
|
85
|
+
}
|
|
86
|
+
}, Strings.getLang(`ipc_player_resolution_${item}`))));
|
|
97
87
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import { View } from '@ray-js/ray';
|
|
2
|
+
import { View, Text } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import React, { useContext } from 'react';
|
|
5
5
|
import { useMemoizedFn } from 'ahooks';
|
|
6
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
7
6
|
import Strings from '../../i18n';
|
|
8
7
|
import { FullResolutionControl } from './fullResolutionControl';
|
|
9
8
|
import { fullResolutionId, pauseTimeToHideAllComponent, hideAllComponent, widgetLabs, widgetClick } from '../../ui/constant';
|
|
@@ -53,7 +52,7 @@ export const Resolution = props => {
|
|
|
53
52
|
}
|
|
54
53
|
if (verticalResolutionCustomClick) return false;
|
|
55
54
|
if (screenType === 'vertical') {
|
|
56
|
-
setResolution(
|
|
55
|
+
setResolution(resolution === 'HD' ? 'SD' : 'HD');
|
|
57
56
|
}
|
|
58
57
|
event.emit(pauseTimeToHideAllComponent);
|
|
59
58
|
return true;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import React, { useContext, useRef } from 'react';
|
|
2
|
-
import { View,
|
|
1
|
+
import React, { useContext, useEffect, useRef } from 'react';
|
|
2
|
+
import { View, Text, getSystemInfoSync } from '@ray-js/ray';
|
|
3
3
|
import { useSetState, useUpdateEffect, useMemoizedFn } from 'ahooks';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { goToIpcPageNativeRoute } from '@ray-js/ray-ipc-utils';
|
|
6
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
7
6
|
import Strings from '../../i18n';
|
|
8
7
|
import { useStore } from '../../ctx/store';
|
|
9
8
|
import { UIEventContext } from '../../ui/context';
|
|
10
9
|
import { pauseTimeToHideAllComponent, changeIgnoreHideStopPreview, widgetLabs, widgetClick } from '../../ui/constant';
|
|
10
|
+
import { getCaptureResultSummary } from '../../utils/captureResult';
|
|
11
11
|
import { ensureAlbumPermission } from '../../utils/authorize/album';
|
|
12
|
+
import { CaptureResultToast } from '../captureResult/captureResult';
|
|
12
13
|
import './screenshot.less';
|
|
13
14
|
const CLOSE_TIME = 5000;
|
|
14
15
|
export function Screenshot(props) {
|
|
@@ -36,8 +37,15 @@ export function Screenshot(props) {
|
|
|
36
37
|
/** 记录截屏url */
|
|
37
38
|
const [state, setState] = useSetState({
|
|
38
39
|
showShot: false,
|
|
39
|
-
shotUrl: ''
|
|
40
|
+
shotUrl: '',
|
|
41
|
+
shotCount: 0
|
|
40
42
|
});
|
|
43
|
+
const snapshotRequestIdRef = useRef(0);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
return () => {
|
|
46
|
+
snapshotRequestIdRef.current += 1;
|
|
47
|
+
};
|
|
48
|
+
}, []);
|
|
41
49
|
useUpdateEffect(() => {
|
|
42
50
|
if (state.showShot && screenType) {
|
|
43
51
|
showShotToast();
|
|
@@ -50,7 +58,8 @@ export function Screenshot(props) {
|
|
|
50
58
|
timer.current = setTimeout(() => {
|
|
51
59
|
setState({
|
|
52
60
|
showShot: false,
|
|
53
|
-
shotUrl: ''
|
|
61
|
+
shotUrl: '',
|
|
62
|
+
shotCount: 0
|
|
54
63
|
});
|
|
55
64
|
deleteContent('absolute', 'plugin-screenshot-toast');
|
|
56
65
|
}, CLOSE_TIME);
|
|
@@ -60,7 +69,8 @@ export function Screenshot(props) {
|
|
|
60
69
|
const handCheck = () => {
|
|
61
70
|
setState({
|
|
62
71
|
showShot: false,
|
|
63
|
-
shotUrl: ''
|
|
72
|
+
shotUrl: '',
|
|
73
|
+
shotCount: 0
|
|
64
74
|
});
|
|
65
75
|
deleteContent('absolute', 'plugin-screenshot-toast');
|
|
66
76
|
clearInterval(timer.current);
|
|
@@ -82,31 +92,20 @@ export function Screenshot(props) {
|
|
|
82
92
|
marginLeft: screenType === 'vertical' ? '0' : '-200px'
|
|
83
93
|
},
|
|
84
94
|
content: () => {
|
|
85
|
-
return /*#__PURE__*/React.createElement(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
})), /*#__PURE__*/React.createElement(View, {
|
|
93
|
-
className: "ipc-player-plugin-screenshot-toast-title"
|
|
94
|
-
}, Strings.getLang('ipc_player_screenshot_success_tip')), /*#__PURE__*/React.createElement(View, {
|
|
95
|
-
onClick: handCheck,
|
|
96
|
-
className: "ipc-player-plugin-screenshot-toast-bottom",
|
|
97
|
-
style: {
|
|
98
|
-
color: brandColor,
|
|
99
|
-
borderColor: brandColor
|
|
100
|
-
}
|
|
101
|
-
}, Strings.getLang('ipc_player_shot_success_check')));
|
|
95
|
+
return /*#__PURE__*/React.createElement(CaptureResultToast, {
|
|
96
|
+
brandColor: brandColor,
|
|
97
|
+
count: state.shotCount,
|
|
98
|
+
kind: "screenshot",
|
|
99
|
+
onCheck: handCheck,
|
|
100
|
+
thumbnailPath: state.shotUrl
|
|
101
|
+
});
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
timeToCloseToast();
|
|
105
105
|
};
|
|
106
106
|
const handClick = useMemoizedFn(async () => {
|
|
107
|
-
var _props$event
|
|
108
|
-
|
|
109
|
-
((_props$event2 = props.event) !== null && _props$event2 !== void 0 ? _props$event2 : event).emit(widgetClick, {
|
|
107
|
+
var _props$event;
|
|
108
|
+
((_props$event = props.event) !== null && _props$event !== void 0 ? _props$event : event).emit(widgetClick, {
|
|
110
109
|
widgetId: widgetLabs.SCREENSHOT
|
|
111
110
|
});
|
|
112
111
|
console.log('截屏!!!');
|
|
@@ -120,27 +119,49 @@ export function Screenshot(props) {
|
|
|
120
119
|
props.event ? props.event.emit(changeIgnoreHideStopPreview, true) : event.emit(changeIgnoreHideStopPreview, true);
|
|
121
120
|
}
|
|
122
121
|
event.emit(pauseTimeToHideAllComponent);
|
|
122
|
+
const setIgnoreHideStopPreview = value => {
|
|
123
|
+
var _props$event2;
|
|
124
|
+
((_props$event2 = props.event) !== null && _props$event2 !== void 0 ? _props$event2 : event).emit(changeIgnoreHideStopPreview, value);
|
|
125
|
+
};
|
|
126
|
+
const handleSnapshotFail = err => {
|
|
127
|
+
setIgnoreHideStopPreview(false);
|
|
128
|
+
console.log(err, 'err');
|
|
129
|
+
const errObj = err.innerError || err || {};
|
|
130
|
+
const errMsg = errObj.errorMsg || Strings.getLang('ipc_player_error_screenshot_error_tip');
|
|
131
|
+
toast({
|
|
132
|
+
title: errMsg
|
|
133
|
+
});
|
|
134
|
+
};
|
|
123
135
|
const granted = await ensureAlbumPermission();
|
|
124
|
-
|
|
136
|
+
setIgnoreHideStopPreview(false);
|
|
125
137
|
if (!granted) return;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
138
|
+
(() => {
|
|
139
|
+
const requestId = ++snapshotRequestIdRef.current;
|
|
140
|
+
IPCPlayerContext.snapshot({
|
|
141
|
+
saveToAlbum,
|
|
142
|
+
success: async res => {
|
|
143
|
+
var _props$multiCameraCtx;
|
|
144
|
+
setIgnoreHideStopPreview(false);
|
|
145
|
+
const splitNum = (_props$multiCameraCtx = props.multiCameraCtx) === null || _props$multiCameraCtx === void 0 || (_props$multiCameraCtx = _props$multiCameraCtx.protocol) === null || _props$multiCameraCtx === void 0 ? void 0 : _props$multiCameraCtx.total_split_num;
|
|
146
|
+
const summary = await getCaptureResultSummary(res, {
|
|
147
|
+
multiLens: props.multiLens,
|
|
148
|
+
protocolCount: splitNum,
|
|
149
|
+
devId
|
|
150
|
+
});
|
|
151
|
+
if (requestId !== snapshotRequestIdRef.current) return;
|
|
152
|
+
if (!summary) {
|
|
153
|
+
handleSnapshotFail({});
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
setState({
|
|
157
|
+
showShot: true,
|
|
158
|
+
shotUrl: summary.thumbnailPath,
|
|
159
|
+
shotCount: summary.isMultiLens ? summary.count : 0
|
|
160
|
+
});
|
|
161
|
+
},
|
|
162
|
+
fail: handleSnapshotFail
|
|
163
|
+
});
|
|
164
|
+
})();
|
|
144
165
|
});
|
|
145
166
|
if (hideScreenShotMenu) return null;
|
|
146
167
|
return /*#__PURE__*/React.createElement(View, {
|
|
@@ -2,46 +2,7 @@
|
|
|
2
2
|
color: var(--iconColor);
|
|
3
3
|
font-size: calc(var(--iconPlayerSize) * var(--ipc-player-size-scale, 1)) !important;
|
|
4
4
|
}
|
|
5
|
+
|
|
5
6
|
.ipc-player-plugin-screenshot-toast-wrap {
|
|
6
7
|
position: absolute;
|
|
7
8
|
}
|
|
8
|
-
.ipc-player-plugin-screenshot-toast {
|
|
9
|
-
flex: 1;
|
|
10
|
-
border-radius: calc(8px * var(--ipc-player-size-scale, 1));;
|
|
11
|
-
background-color: var(--shot-card-bg-color);
|
|
12
|
-
display: flex;
|
|
13
|
-
align-items: center;
|
|
14
|
-
padding: calc(8px * var(--ipc-player-size-scale, 1)) calc(12px * var(--ipc-player-size-scale, 1));
|
|
15
|
-
z-index: 100;
|
|
16
|
-
.ipc-player-plugin-screenshot-toast-image-box {
|
|
17
|
-
border-radius: calc(4px * var(--ipc-player-size-scale, 1));
|
|
18
|
-
overflow: hidden;
|
|
19
|
-
width: calc(66px * var(--ipc-player-size-scale, 1));
|
|
20
|
-
height: calc(66px * 0.57 * var(--ipc-player-size-scale, 1));
|
|
21
|
-
}
|
|
22
|
-
.ipc-player-plugin-screenshot-toast-image {
|
|
23
|
-
width: 100%;
|
|
24
|
-
height: 100%;
|
|
25
|
-
object-fit: cover;
|
|
26
|
-
}
|
|
27
|
-
.ipc-player-plugin-screenshot-toast-title {
|
|
28
|
-
flex: 1;
|
|
29
|
-
margin-left: calc(12px * var(--ipc-player-size-scale, 1));
|
|
30
|
-
font-size: calc(14px * var(--ipc-player-size-scale, 1));
|
|
31
|
-
color: var(--fontColor);
|
|
32
|
-
margin-right: calc(12px * var(--ipc-player-size-scale, 1));
|
|
33
|
-
word-break: break-word;
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
.ipc-player-plugin-screenshot-toast-bottom {
|
|
37
|
-
border: 1px solid #1989FA;
|
|
38
|
-
min-width: calc(52px * var(--ipc-player-size-scale, 1));
|
|
39
|
-
max-width: calc(100px * var(--ipc-player-size-scale, 1));
|
|
40
|
-
border-radius: calc(4px * var(--ipc-player-size-scale, 1));
|
|
41
|
-
padding: calc(5px * var(--ipc-player-size-scale, 1)) calc(11px * var(--ipc-player-size-scale, 1));
|
|
42
|
-
font-size: calc(14px * var(--ipc-player-size-scale, 1));
|
|
43
|
-
white-space: nowrap;
|
|
44
|
-
overflow: hidden;
|
|
45
|
-
text-overflow: ellipsis;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { act, renderHook } from '@testing-library/react-hooks/dom';
|
|
2
|
+
import { atom } from 'jotai';
|
|
3
|
+
import { authorize, authorizeStatus, 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
|
+
authorize: jest.fn(),
|
|
12
|
+
authorizeStatus: jest.fn(),
|
|
13
|
+
showModal: jest.fn(),
|
|
14
|
+
openAppSystemSettingPage: jest.fn()
|
|
15
|
+
}));
|
|
16
|
+
jest.mock('@ray-js/ray-ipc-utils', () => ({
|
|
17
|
+
goToIpcPageNativeRoute: jest.fn()
|
|
18
|
+
}));
|
|
19
|
+
jest.mock('../../utils/device', () => ({
|
|
20
|
+
getDeviceInfo: jest.fn()
|
|
21
|
+
}));
|
|
22
|
+
jest.mock('../../i18n', () => ({
|
|
23
|
+
__esModule: true,
|
|
24
|
+
default: {
|
|
25
|
+
getLang: key => key
|
|
26
|
+
}
|
|
27
|
+
}));
|
|
28
|
+
jest.mock('./screenshot.less', () => ({}));
|
|
29
|
+
jest.mock('../captureResult/captureResult.less', () => ({}));
|
|
30
|
+
beforeEach(() => {
|
|
31
|
+
jest.clearAllMocks();
|
|
32
|
+
getSystemInfoSync.mockReturnValue({
|
|
33
|
+
platform: 'android',
|
|
34
|
+
system: 'android 12'
|
|
35
|
+
});
|
|
36
|
+
authorizeStatus.mockImplementation(_ref => {
|
|
37
|
+
let {
|
|
38
|
+
fail
|
|
39
|
+
} = _ref;
|
|
40
|
+
return fail({
|
|
41
|
+
errorCode: 9004
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
authorize.mockImplementation(_ref2 => {
|
|
45
|
+
let {
|
|
46
|
+
fail
|
|
47
|
+
} = _ref2;
|
|
48
|
+
return fail({
|
|
49
|
+
errorCode: 9004
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
getDeviceInfo.mockResolvedValue({
|
|
53
|
+
configMetas: {
|
|
54
|
+
tyabimr4v3: {
|
|
55
|
+
total_split_num: 3
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
const createProps = () => ({
|
|
61
|
+
IPCPlayerContext: {
|
|
62
|
+
snapshot: jest.fn(_ref3 => {
|
|
63
|
+
let {
|
|
64
|
+
success
|
|
65
|
+
} = _ref3;
|
|
66
|
+
return success({
|
|
67
|
+
tempImagePath: 'thingfile://capture.jpg'
|
|
68
|
+
});
|
|
69
|
+
})
|
|
70
|
+
},
|
|
71
|
+
addContent: jest.fn(),
|
|
72
|
+
deleteContent: jest.fn(),
|
|
73
|
+
saveToAlbum: 0,
|
|
74
|
+
devId: 'camera-1',
|
|
75
|
+
toast: jest.fn(),
|
|
76
|
+
screenType: atom('vertical'),
|
|
77
|
+
brandColor: atom('#000000'),
|
|
78
|
+
multiLens: true,
|
|
79
|
+
event: {
|
|
80
|
+
emit: jest.fn()
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
it('keeps multi-lens results when legacy album authorization is unavailable', async () => {
|
|
84
|
+
const props = createProps();
|
|
85
|
+
const {
|
|
86
|
+
result,
|
|
87
|
+
unmount
|
|
88
|
+
} = renderHook(() => Screenshot(props));
|
|
89
|
+
await act(async () => {
|
|
90
|
+
await result.current.props.onClick();
|
|
91
|
+
});
|
|
92
|
+
expect(authorizeStatus).not.toHaveBeenCalled();
|
|
93
|
+
expect(props.IPCPlayerContext.snapshot).toHaveBeenCalledWith(expect.objectContaining({
|
|
94
|
+
saveToAlbum: 0
|
|
95
|
+
}));
|
|
96
|
+
const [, config] = props.addContent.mock.calls[0];
|
|
97
|
+
expect(config.content().props).toEqual(expect.objectContaining({
|
|
98
|
+
count: 3,
|
|
99
|
+
thumbnailPath: 'thingfile://capture_lens1.jpg'
|
|
100
|
+
}));
|
|
101
|
+
unmount();
|
|
102
|
+
});
|
|
103
|
+
it('keeps the permission rejection path before taking a snapshot', async () => {
|
|
104
|
+
getSystemInfoSync.mockReturnValue({
|
|
105
|
+
platform: 'ios',
|
|
106
|
+
system: 'iOS 18'
|
|
107
|
+
});
|
|
108
|
+
const props = createProps();
|
|
109
|
+
const {
|
|
110
|
+
result,
|
|
111
|
+
unmount
|
|
112
|
+
} = renderHook(() => Screenshot(props));
|
|
113
|
+
await act(async () => {
|
|
114
|
+
await result.current.props.onClick();
|
|
115
|
+
});
|
|
116
|
+
expect(props.IPCPlayerContext.snapshot).not.toHaveBeenCalled();
|
|
117
|
+
expect(props.addContent).not.toHaveBeenCalled();
|
|
118
|
+
expect(showModal).toHaveBeenCalledTimes(1);
|
|
119
|
+
unmount();
|
|
120
|
+
});
|
|
@@ -3,15 +3,12 @@ import { View, Image } from '@ray-js/ray';
|
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { useSignal4G } from '../../hooks';
|
|
5
5
|
import { signalSvgMap } from '../../res';
|
|
6
|
-
import { signalPngMap } from '../../res/lynx-signal';
|
|
7
|
-
import { usePlayerRenderMode } from '../../renderer/context';
|
|
8
6
|
import './signal4G.less';
|
|
9
7
|
export const Signal4G = props => {
|
|
10
8
|
const {
|
|
11
9
|
className,
|
|
12
10
|
devId
|
|
13
11
|
} = props;
|
|
14
|
-
const isLynx = usePlayerRenderMode() === 'lynx';
|
|
15
12
|
const {
|
|
16
13
|
dpValue,
|
|
17
14
|
signalKey
|
|
@@ -25,7 +22,7 @@ export const Signal4G = props => {
|
|
|
25
22
|
className: clsx('ipc-player-plugin-signal4g')
|
|
26
23
|
}, /*#__PURE__*/React.createElement(Image, {
|
|
27
24
|
className: clsx('ipc-player-plugin-signal4g-icon'),
|
|
28
|
-
src:
|
|
25
|
+
src: signalSvgMap[signalKey],
|
|
29
26
|
mode: "aspectFit"
|
|
30
27
|
})));
|
|
31
28
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { View } from '@ray-js/ray';
|
|
1
|
+
import { View, Text } from '@ray-js/ray';
|
|
2
2
|
import React, { useContext } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
5
4
|
import { useDpState } from '../../hooks';
|
|
6
5
|
import { useStore } from '../../ctx/store';
|
|
7
6
|
import { UIEventContext } from '../../ui/context';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import "core-js/modules/esnext.iterator.constructor.js";
|
|
2
2
|
import "core-js/modules/esnext.iterator.map.js";
|
|
3
3
|
import React, { useMemo } from 'react';
|
|
4
|
-
import { View } from '@ray-js/ray';
|
|
4
|
+
import { View, Text } from '@ray-js/ray';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
7
6
|
import { useTemperature, useHumidity, useEc, useWaterTemperature, useDpSupport } from '../../hooks';
|
|
8
7
|
import { IPC_EC, IPC_WATER_TEMPERATURE, SENSOR_HUMIDITY, SENSOR_TEMPERATURE } from '../../utils/content/dpCode';
|
|
9
8
|
import './tempHumidity.less';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { View } from '@ray-js/ray';
|
|
1
|
+
import { Text, View } from '@ray-js/ray';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
5
4
|
import { useStore } from '../../ctx/store';
|
|
6
5
|
import './toggleVerticalFull.less';
|
|
7
6
|
export function ToggleVerticalFull(props) {
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import './index.less';
|
|
3
3
|
type Props = {
|
|
4
4
|
className?: string;
|
|
5
|
+
onView?: () => void;
|
|
5
6
|
/** 主题色(用于「开通」按钮背景)。默认与 player brandColor 一致 */
|
|
6
7
|
brandColor?: string;
|
|
7
8
|
/** 试看倒计时初始秒数,来源于 smartImageQualityState.trialRemainingSec */
|
|
@@ -11,5 +12,5 @@ type Props = {
|
|
|
11
12
|
/** 倒计时归零时触发,本组件保证整个生命周期内只回调一次 */
|
|
12
13
|
onCountdownEnd?: () => void;
|
|
13
14
|
};
|
|
14
|
-
export declare const TrialBadge: ({ className, brandColor, trialRemainingSec, onSubscribe, onCountdownEnd, }: Props) => React.JSX.Element;
|
|
15
|
+
export declare const TrialBadge: ({ className, onView, brandColor, trialRemainingSec, onSubscribe, onCountdownEnd, }: Props) => React.JSX.Element;
|
|
15
16
|
export { useTrialBadge } from './useTrialBadge';
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { Image, View } from '@ray-js/ray';
|
|
2
|
+
import { Image, Text, View } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { usePlayerRenderMode } from '../../renderer/context';
|
|
5
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
6
4
|
import Strings from '../../i18n';
|
|
7
5
|
import tryOpen from '../../res/try/try_open.png';
|
|
8
6
|
import './index.less';
|
|
@@ -18,12 +16,15 @@ const formatCountdown = seconds => {
|
|
|
18
16
|
export const TrialBadge = _ref => {
|
|
19
17
|
let {
|
|
20
18
|
className,
|
|
19
|
+
onView,
|
|
21
20
|
brandColor = FALLBACK_BRAND_COLOR,
|
|
22
21
|
trialRemainingSec = 0,
|
|
23
22
|
onSubscribe,
|
|
24
23
|
onCountdownEnd
|
|
25
24
|
} = _ref;
|
|
26
|
-
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
onView === null || onView === void 0 || onView();
|
|
27
|
+
}, [onView]);
|
|
27
28
|
const [remainingSec, setRemainingSec] = useState(Math.max(0, Math.floor(trialRemainingSec)));
|
|
28
29
|
const endedRef = useRef(false);
|
|
29
30
|
const onCountdownEndRef = useRef(onCountdownEnd);
|
|
@@ -63,16 +64,14 @@ export const TrialBadge = _ref => {
|
|
|
63
64
|
}, [trialRemainingSec]);
|
|
64
65
|
const countdownText = formatCountdown(remainingSec);
|
|
65
66
|
return /*#__PURE__*/React.createElement(View, {
|
|
66
|
-
className: clsx('ipc-player-trial-badge', className
|
|
67
|
-
'ipc-player-trial-badge--lynx': renderMode === 'lynx'
|
|
68
|
-
})
|
|
67
|
+
className: clsx('ipc-player-trial-badge', className)
|
|
69
68
|
}, /*#__PURE__*/React.createElement(Image, {
|
|
70
69
|
className: "ipc-player-trial-badge-icon",
|
|
71
70
|
src: tryOpen,
|
|
72
71
|
mode: "heightFix"
|
|
73
72
|
}), /*#__PURE__*/React.createElement(Text, {
|
|
74
73
|
className: "ipc-player-trial-badge-status"
|
|
75
|
-
}, Strings.getLang('ipc_player_trial_in_use')
|
|
74
|
+
}, Strings.getLang('ipc_player_trial_in_use')), /*#__PURE__*/React.createElement(Text, {
|
|
76
75
|
className: "ipc-player-trial-badge-divider"
|
|
77
76
|
}, "|"), /*#__PURE__*/React.createElement(Text, {
|
|
78
77
|
className: "ipc-player-trial-badge-preview"
|
|
@@ -82,15 +81,19 @@ export const TrialBadge = _ref => {
|
|
|
82
81
|
backgroundColor: brandColor
|
|
83
82
|
},
|
|
84
83
|
onClick: () => {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
84
|
+
try {
|
|
85
|
+
ty.event({
|
|
86
|
+
eventId: 'thing_qbwpX5zfbKOSjD4jz1tPv61rqrhGX7iV',
|
|
87
|
+
event: {
|
|
88
|
+
business_type: 'ipc',
|
|
89
|
+
scene_type: 'smart_image_quality',
|
|
90
|
+
feat_type: 'go_pay',
|
|
91
|
+
biz: 'preview_mini'
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
} catch (error) {
|
|
95
|
+
console.warn('[IPC] trial subscription tracking failed:', error);
|
|
96
|
+
}
|
|
94
97
|
onSubscribe === null || onSubscribe === void 0 || onSubscribe();
|
|
95
98
|
}
|
|
96
99
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
@@ -66,27 +66,3 @@
|
|
|
66
66
|
font-weight: 600;
|
|
67
67
|
line-height: 1;
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
// Lynx 不支持 inline-flex 的 WebView 排版语义,显式声明横向 flex。
|
|
71
|
-
.ipc-player-trial-badge--lynx {
|
|
72
|
-
// Match WebView inline-flex: size to content instead of stretching across its parent.
|
|
73
|
-
align-self: flex-start;
|
|
74
|
-
display: flex;
|
|
75
|
-
flex-direction: row;
|
|
76
|
-
background-color: rgba(0, 0, 0, 0.65);
|
|
77
|
-
|
|
78
|
-
.ipc-player-trial-badge-icon {
|
|
79
|
-
width: 20px;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.ipc-player-trial-badge-status,
|
|
83
|
-
.ipc-player-trial-badge-divider,
|
|
84
|
-
.ipc-player-trial-badge-preview {
|
|
85
|
-
flex-shrink: 0;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.ipc-player-trial-badge-cta {
|
|
89
|
-
display: flex;
|
|
90
|
-
flex-direction: row;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import type { MutableRefObject } from 'react';
|
|
2
2
|
import type { EventInstance } from '../../interface';
|
|
3
|
-
export declare const useTrialBadge: (event: EventInstance, devId: string, trialRemainingSec: number) => {
|
|
3
|
+
export declare const useTrialBadge: (event: EventInstance, devId: string, trialRemainingSec: number, viewedRef?: MutableRefObject<boolean>) => {
|
|
4
4
|
showTrialBadge: boolean;
|
|
5
5
|
setShowTrialBadge: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
6
|
+
handleTrialView: () => void;
|
|
6
7
|
handleTrialSubscribe: () => Promise<void>;
|
|
7
8
|
handleCountdownEnd: () => Promise<void>;
|
|
8
9
|
};
|
|
@@ -3,7 +3,10 @@ import { setTrailFinish } from '../../utils/ttt';
|
|
|
3
3
|
import { gotoSecurityCloudService2 } from '../../utils';
|
|
4
4
|
import { trialCountdownEnd } from '../../ui/constant';
|
|
5
5
|
import Strings from '../../i18n';
|
|
6
|
-
|
|
6
|
+
import { createEntryTracking, reportEntryClick, reportEntryView } from '../../utils/fullLinkTracking';
|
|
7
|
+
export const useTrialBadge = (event, devId, trialRemainingSec, viewedRef) => {
|
|
8
|
+
const localViewedRef = useRef(false);
|
|
9
|
+
const pageViewedRef = viewedRef || localViewedRef;
|
|
7
10
|
const [showTrialBadge, setShowTrialBadge] = useState(false);
|
|
8
11
|
const prevTrialSecRef = useRef(trialRemainingSec);
|
|
9
12
|
useEffect(() => {
|
|
@@ -14,9 +17,16 @@ export const useTrialBadge = (event, devId, trialRemainingSec) => {
|
|
|
14
17
|
}
|
|
15
18
|
prevTrialSecRef.current = trialRemainingSec;
|
|
16
19
|
}, [trialRemainingSec]);
|
|
20
|
+
const handleTrialView = useCallback(() => {
|
|
21
|
+
if (pageViewedRef.current) return;
|
|
22
|
+
pageViewedRef.current = true;
|
|
23
|
+
reportEntryView(devId, createEntryTracking());
|
|
24
|
+
}, [devId, pageViewedRef]);
|
|
17
25
|
const handleTrialSubscribe = useCallback(async () => {
|
|
18
26
|
try {
|
|
19
|
-
|
|
27
|
+
const tracking = createEntryTracking();
|
|
28
|
+
await reportEntryClick(devId, tracking);
|
|
29
|
+
await gotoSecurityCloudService2(devId, tracking);
|
|
20
30
|
} catch (error) {
|
|
21
31
|
ty.showToast({
|
|
22
32
|
title: Strings.getLang('ipc_player_fetch_error'),
|
|
@@ -51,6 +61,7 @@ export const useTrialBadge = (event, devId, trialRemainingSec) => {
|
|
|
51
61
|
return {
|
|
52
62
|
showTrialBadge,
|
|
53
63
|
setShowTrialBadge,
|
|
64
|
+
handleTrialView,
|
|
54
65
|
handleTrialSubscribe,
|
|
55
66
|
handleCountdownEnd
|
|
56
67
|
};
|