@ray-js/ipc-player-integration 0.0.68-beta.0 → 0.0.69-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 +13 -3
- package/lib/ctx/ctx.js +48 -35
- package/lib/ctx/multiCameraCtx.d.ts +2 -0
- package/lib/ctx/multiCameraCtx.js +17 -1
- package/lib/ctx/multiCameraCtx.test.d.ts +1 -0
- package/lib/ctx/multiCameraCtx.test.js +65 -0
- 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 +18 -3
- package/lib/ui/absoluteContent.d.ts +2 -0
- package/lib/ui/absoluteContent.js +3 -0
- package/lib/ui/bottomCoverHeight.d.ts +2 -0
- package/lib/ui/bottomCoverHeight.js +6 -0
- package/lib/ui/bottomCoverHeight.test.d.ts +1 -0
- package/lib/ui/bottomCoverHeight.test.js +15 -0
- package/lib/ui/bottomLeftContent.js +65 -123
- package/lib/ui/bottomRightContent.js +13 -11
- package/lib/ui/topLeftContent.js +2 -4
- package/lib/ui/topRightContent.js +2 -4
- package/lib/ui/ui.d.ts +0 -5
- package/lib/ui/ui.js +100 -93
- package/lib/utils/captureResult.d.ts +12 -0
- package/lib/utils/captureResult.js +70 -0
- package/lib/utils/captureResult.test.d.ts +1 -0
- package/lib/utils/captureResult.test.js +223 -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/widgets/battery/battery.js +5 -7
- package/lib/widgets/battery/batteryFull.js +5 -7
- 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 +84 -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 +31 -44
- package/lib/widgets/fullScreen/fullTravelRouteControl.d.ts +2 -2
- package/lib/widgets/fullScreen/fullTravelRouteControl.js +6 -3
- 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 +5 -16
- package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.less +4 -24
- package/lib/widgets/multiCamera/index.less +1 -0
- package/lib/widgets/multiCamera/landscapeTip.js +2 -5
- package/lib/widgets/multiCamera/moveablePtzControl.js +7 -9
- package/lib/widgets/multiCamera/multiPtz.js +2 -3
- package/lib/widgets/multiCamera/ptzMoveableTip.js +2 -5
- package/lib/widgets/multiCamera/switchLayout.js +1 -2
- package/lib/widgets/multiCamera/tileMultiPtz.js +2 -3
- package/lib/widgets/multiCamera/tileSwitchLayout.js +1 -2
- package/lib/widgets/multiCamera/tileTip.js +2 -5
- package/lib/widgets/muted/muted.js +1 -2
- package/lib/widgets/muted/muted.test.js +52 -66
- package/lib/widgets/ptz/ptz.js +1 -2
- package/lib/widgets/ptz/ptzControl.js +3 -4
- package/lib/widgets/ptzControlTip/ptzControlTip.js +4 -9
- package/lib/widgets/ptzControlTip/ptzControlTip.less +0 -6
- package/lib/widgets/realTimeMagnification/realTimeMagnification.js +1 -2
- package/lib/widgets/recordVideo/recordVideo.js +178 -32
- 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 +3 -169
- package/lib/widgets/resolution/fullResolutionControl.js +19 -29
- package/lib/widgets/resolution/resolution.js +2 -3
- package/lib/widgets/screenshot/screenshot.js +125 -35
- package/lib/widgets/screenshot/screenshot.less +1 -40
- package/lib/widgets/screenshot/screenshot.test.js +113 -108
- 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 +21 -3
- package/lib/widgets/tryExperience/tryExperience.js +1 -2
- 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 -3
- package/lib/widgets/zoomTurntable/zoomTurntableDock.d.ts +3 -5
- package/lib/widgets/zoomTurntable/zoomTurntableDock.js +4 -4
- package/lib/widgets/zoomTurntable/zoomTurntableEntry.js +19 -32
- package/lib/widgets/zoomTurntable/zoomTurntableTip.js +3 -24
- package/package.json +7 -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-manifest.json +0 -9
- 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/overlay.d.ts +0 -4
- package/lib/renderer/overlay.js +0 -6
- 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-charging.png +0 -0
- package/lib/res/player-more-arrow.png +0 -0
- package/lib/res/player-solar.png +0 -0
- package/lib/ui/scrollHintArrow.d.ts +0 -23
- package/lib/ui/scrollHintArrow.js +0 -83
- package/lib/widgets/battery/statusIcon.d.ts +0 -6
- package/lib/widgets/battery/statusIcon.js +0 -36
- package/lib/widgets/battery/statusIcon.less +0 -24
- package/lib/widgets/captureToast/captureToast.d.ts +0 -9
- package/lib/widgets/captureToast/captureToast.js +0 -73
- package/lib/widgets/recordVideo/recordVideoTimer.d.ts +0 -3
- package/lib/widgets/recordVideo/recordVideoTimer.js +0 -26
- package/lib/widgets/zoomTurntable/lynxDockLayout.d.ts +0 -6
- package/lib/widgets/zoomTurntable/lynxDockLayout.js +0 -30
- package/lib/widgets/zoomTurntable/turntable/lynx.d.ts +0 -5
- package/lib/widgets/zoomTurntable/turntable/lynx.js +0 -273
- package/lib/widgets/zoomTurntable/turntable/lynx.less +0 -9
- package/lib/widgets/zoomTurntable/turntable/lynxModel.d.ts +0 -37
- package/lib/widgets/zoomTurntable/turntable/lynxModel.js +0 -122
- package/lib/widgets/zoomTurntable/turntable/lynxPaint.d.ts +0 -3
- package/lib/widgets/zoomTurntable/turntable/lynxPaint.js +0 -36
|
@@ -1,29 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import ReactDOM from 'react-dom';
|
|
7
|
-
import { act, Simulate } from 'react-dom/test-utils';
|
|
8
|
-
import { atom, getDefaultStore } from 'jotai';
|
|
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';
|
|
9
5
|
import { Screenshot } from './screenshot';
|
|
10
|
-
import { PlayerRenderModeContext } from '../../renderer/context';
|
|
11
6
|
jest.mock('@ray-js/ray', () => ({
|
|
12
7
|
View: 'div',
|
|
13
|
-
CoverView: 'div',
|
|
14
8
|
Text: 'span',
|
|
15
9
|
Image: 'img',
|
|
16
|
-
getSystemInfoSync: ()
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
getSystemInfoSync: jest.fn(),
|
|
11
|
+
getFileSystemManager: jest.fn(),
|
|
12
|
+
authorize: jest.fn(),
|
|
13
|
+
authorizeStatus: jest.fn(),
|
|
14
|
+
showModal: jest.fn(),
|
|
15
|
+
openAppSystemSettingPage: jest.fn()
|
|
20
16
|
}));
|
|
21
17
|
jest.mock('@ray-js/ray-ipc-utils', () => ({
|
|
22
18
|
goToIpcPageNativeRoute: jest.fn()
|
|
23
19
|
}));
|
|
24
|
-
jest.mock('
|
|
25
|
-
jest.
|
|
26
|
-
ensureAlbumPermission: async () => true
|
|
20
|
+
jest.mock('../../utils/device', () => ({
|
|
21
|
+
getDeviceInfo: jest.fn()
|
|
27
22
|
}));
|
|
28
23
|
jest.mock('../../i18n', () => ({
|
|
29
24
|
__esModule: true,
|
|
@@ -31,100 +26,110 @@ jest.mock('../../i18n', () => ({
|
|
|
31
26
|
getLang: key => key
|
|
32
27
|
}
|
|
33
28
|
}));
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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'
|
|
41
36
|
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
authorizeStatus.mockImplementation(_ref => {
|
|
38
|
+
let {
|
|
39
|
+
fail
|
|
40
|
+
} = _ref;
|
|
41
|
+
return fail({
|
|
42
|
+
errorCode: 9004
|
|
45
43
|
});
|
|
46
|
-
container.remove();
|
|
47
|
-
jest.clearAllTimers();
|
|
48
|
-
jest.useRealTimers();
|
|
49
44
|
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
screenType,
|
|
57
|
-
brandColor: atom('#000000'),
|
|
58
|
-
devId: 'test-device',
|
|
59
|
-
saveToAlbum: false,
|
|
60
|
-
event: {
|
|
61
|
-
emit: jest.fn()
|
|
62
|
-
},
|
|
63
|
-
toast: jest.fn(),
|
|
64
|
-
IPCPlayerContext: {
|
|
65
|
-
snapshot: _ref => {
|
|
66
|
-
let {
|
|
67
|
-
success
|
|
68
|
-
} = _ref;
|
|
69
|
-
return success({
|
|
70
|
-
tempImagePath: 'shot.jpg'
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
addContent: (_area, item) => updateContents(items => [...items, item]),
|
|
75
|
-
deleteContent: (_area, id) => updateContents(items => items.filter(item => item.id !== id))
|
|
76
|
-
};
|
|
77
|
-
const Harness = () => {
|
|
78
|
-
const [items, setItems] = React.useState([]);
|
|
79
|
-
const [generation, setGeneration] = React.useState(0);
|
|
80
|
-
updateContents = setItems;
|
|
81
|
-
remount = () => setGeneration(value => value + 1);
|
|
82
|
-
return /*#__PURE__*/React.createElement(PlayerRenderModeContext.Provider, {
|
|
83
|
-
value: mode
|
|
84
|
-
}, /*#__PURE__*/React.createElement(Screenshot, _extends({
|
|
85
|
-
key: generation
|
|
86
|
-
}, props)), items.map(item => item.absoluteNoCoverView ? /*#__PURE__*/React.createElement(item.content, _extends({
|
|
87
|
-
key: item.id
|
|
88
|
-
}, item.initProps)) : /*#__PURE__*/React.createElement("div", {
|
|
89
|
-
key: item.id,
|
|
90
|
-
className: item.absoluteContentClassName,
|
|
91
|
-
style: item.absolutePosition
|
|
92
|
-
}, /*#__PURE__*/React.createElement(item.content, item.initProps))));
|
|
93
|
-
};
|
|
94
|
-
const overlay = () => container.querySelector('.ipc-player-plugin-screenshot-toast-wrap');
|
|
95
|
-
act(() => {
|
|
96
|
-
ReactDOM.render(/*#__PURE__*/React.createElement(Harness, null), container);
|
|
97
|
-
});
|
|
98
|
-
await act(async () => {
|
|
99
|
-
Simulate.click(container.firstElementChild);
|
|
100
|
-
});
|
|
101
|
-
expect(overlay().style.width).toBe('400px');
|
|
102
|
-
act(() => {
|
|
103
|
-
jest.advanceTimersByTime(2000);
|
|
104
|
-
});
|
|
105
|
-
act(() => {
|
|
106
|
-
store.set(screenType, 'vertical');
|
|
107
|
-
remount();
|
|
108
|
-
});
|
|
109
|
-
expect(overlay().style.width).toBe('auto');
|
|
110
|
-
expect(overlay().style.left).toBe('16px');
|
|
111
|
-
expect(overlay().style.right).toBe('16px');
|
|
112
|
-
act(() => {
|
|
113
|
-
jest.advanceTimersByTime(1000);
|
|
114
|
-
});
|
|
115
|
-
act(() => {
|
|
116
|
-
store.set(screenType, 'full');
|
|
117
|
-
remount();
|
|
118
|
-
});
|
|
119
|
-
expect(overlay().style.width).toBe('400px');
|
|
120
|
-
expect(overlay().style.left).toBe('50%');
|
|
121
|
-
act(() => {
|
|
122
|
-
jest.advanceTimersByTime(1999);
|
|
123
|
-
});
|
|
124
|
-
expect(overlay()).not.toBeNull();
|
|
125
|
-
act(() => {
|
|
126
|
-
jest.advanceTimersByTime(1);
|
|
45
|
+
authorize.mockImplementation(_ref2 => {
|
|
46
|
+
let {
|
|
47
|
+
fail
|
|
48
|
+
} = _ref2;
|
|
49
|
+
return fail({
|
|
50
|
+
errorCode: 9004
|
|
127
51
|
});
|
|
128
|
-
expect(overlay()).toBeNull();
|
|
129
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();
|
|
130
135
|
});
|
|
@@ -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>, rtidRef?: MutableRefObject<Map<string, string>>) => {
|
|
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,17 @@ 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, rtidRef) => {
|
|
8
|
+
const localViewedRef = useRef(false);
|
|
9
|
+
const pageViewedRef = viewedRef || localViewedRef;
|
|
10
|
+
const localRtidRef = useRef(new Map());
|
|
11
|
+
const pageRtidRef = rtidRef || localRtidRef;
|
|
12
|
+
const getTracking = useCallback(() => {
|
|
13
|
+
const tracking = createEntryTracking(pageRtidRef.current.get(devId));
|
|
14
|
+
pageRtidRef.current.set(devId, tracking.utm_rtid);
|
|
15
|
+
return tracking;
|
|
16
|
+
}, [devId, pageRtidRef]);
|
|
7
17
|
const [showTrialBadge, setShowTrialBadge] = useState(false);
|
|
8
18
|
const prevTrialSecRef = useRef(trialRemainingSec);
|
|
9
19
|
useEffect(() => {
|
|
@@ -14,16 +24,23 @@ export const useTrialBadge = (event, devId, trialRemainingSec) => {
|
|
|
14
24
|
}
|
|
15
25
|
prevTrialSecRef.current = trialRemainingSec;
|
|
16
26
|
}, [trialRemainingSec]);
|
|
27
|
+
const handleTrialView = useCallback(() => {
|
|
28
|
+
if (pageViewedRef.current) return;
|
|
29
|
+
pageViewedRef.current = true;
|
|
30
|
+
reportEntryView(devId, getTracking());
|
|
31
|
+
}, [devId, pageViewedRef, getTracking]);
|
|
17
32
|
const handleTrialSubscribe = useCallback(async () => {
|
|
18
33
|
try {
|
|
19
|
-
|
|
34
|
+
const tracking = getTracking();
|
|
35
|
+
await reportEntryClick(devId, tracking);
|
|
36
|
+
await gotoSecurityCloudService2(devId, tracking);
|
|
20
37
|
} catch (error) {
|
|
21
38
|
ty.showToast({
|
|
22
39
|
title: Strings.getLang('ipc_player_fetch_error'),
|
|
23
40
|
icon: 'none'
|
|
24
41
|
});
|
|
25
42
|
}
|
|
26
|
-
}, [devId]);
|
|
43
|
+
}, [devId, getTracking]);
|
|
27
44
|
const handleCountdownEnd = useCallback(async () => {
|
|
28
45
|
try {
|
|
29
46
|
setShowTrialBadge(false);
|
|
@@ -51,6 +68,7 @@ export const useTrialBadge = (event, devId, trialRemainingSec) => {
|
|
|
51
68
|
return {
|
|
52
69
|
showTrialBadge,
|
|
53
70
|
setShowTrialBadge,
|
|
71
|
+
handleTrialView,
|
|
54
72
|
handleTrialSubscribe,
|
|
55
73
|
handleCountdownEnd
|
|
56
74
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import { View, Image, getSystemInfoSync, showToast } from '@ray-js/ray';
|
|
2
|
+
import { View, Image, getSystemInfoSync, showToast, Text } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
|
5
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
6
5
|
import { useStore } from '../../ctx/store';
|
|
7
6
|
import Strings from '../../i18n';
|
|
8
7
|
import { getAIFrameFeature, gotoAIDrawMiniProgram, setAIFrameFeature } from '../../utils';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { View, usePageEvent } from '@ray-js/ray';
|
|
2
|
+
import { View, Text, usePageEvent } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { getVideoBitrateKbps, requestWifiSignal } from '@ray-js/ray-ipc-utils';
|
|
5
5
|
import { ClarityType } from '@ray-js/ray-ipc-utils/lib/interface';
|
|
6
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
7
6
|
import { PlayState } from '../../interface';
|
|
8
7
|
import './videoBitKBP.less';
|
|
9
8
|
import { useStore } from '../../ctx/store';
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import React, { useRef, useContext, useState, useEffect, forwardRef, useImperativeHandle } from 'react';
|
|
3
|
-
import { View, Image,
|
|
3
|
+
import { View, Image, getSystemInfoSync } from '@ray-js/ray';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { useStore, getDefaultStore, updateAtom } from '../../ctx/store';
|
|
6
6
|
import './voiceIntercom.less';
|
|
7
|
-
import { usePlayerRenderMode } from '../../renderer/context';
|
|
8
|
-
import { PlayerText } from '../../renderer/text';
|
|
9
7
|
import { PlayerStreamStatus, IntercomMode, PlayState } from '../../interface';
|
|
10
8
|
import { UIEventContext } from '../../ui/context';
|
|
11
9
|
import { radialGradient } from '../../utils';
|
|
@@ -39,7 +37,6 @@ export const VoiceIntercom = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
39
37
|
const {
|
|
40
38
|
event
|
|
41
39
|
} = useContext(UIEventContext);
|
|
42
|
-
const renderMode = usePlayerRenderMode();
|
|
43
40
|
const {
|
|
44
41
|
recording,
|
|
45
42
|
mute,
|
|
@@ -198,45 +195,23 @@ export const VoiceIntercom = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
198
195
|
}, intercomClassName),
|
|
199
196
|
onTouchStart: handTouchStart,
|
|
200
197
|
onTouchEnd: onTouchEnd
|
|
201
|
-
}, intercom ? (() => {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
const baseHeight = [5, 10, 16, 10, 5][index];
|
|
211
|
-
const factor = 1 + Math.sin((frame + index) / 5) * 0.2;
|
|
212
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
213
|
-
key: index,
|
|
214
|
-
className: "lynx-talking-bar",
|
|
215
|
-
style: {
|
|
216
|
-
height: `${baseHeight * factor}px`,
|
|
217
|
-
background: talkingColor
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
}));
|
|
198
|
+
}, intercom ? (() => /*#__PURE__*/React.createElement(View, {
|
|
199
|
+
className: clsx({
|
|
200
|
+
'ipc-player-plugin-voice-small-ing-intercom': mode !== 'circle'
|
|
201
|
+
})
|
|
202
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
203
|
+
className: clsx('bars'),
|
|
204
|
+
style: {
|
|
205
|
+
transform: `scale(${scale})`,
|
|
206
|
+
transformOrigin: 'center'
|
|
221
207
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
transform: `scale(${scale})`,
|
|
230
|
-
transformOrigin: 'center'
|
|
231
|
-
}
|
|
232
|
-
}, [0, 1, 2, 3, 4].map(index => /*#__PURE__*/React.createElement(View, {
|
|
233
|
-
key: index,
|
|
234
|
-
className: clsx('bar'),
|
|
235
|
-
style: {
|
|
236
|
-
background: talkingColor
|
|
237
|
-
}
|
|
238
|
-
}))));
|
|
239
|
-
})() : (() => {
|
|
208
|
+
}, [0, 1, 2, 3, 4].map(index => /*#__PURE__*/React.createElement(View, {
|
|
209
|
+
key: index,
|
|
210
|
+
className: clsx('bar'),
|
|
211
|
+
style: {
|
|
212
|
+
background: talkingColor
|
|
213
|
+
}
|
|
214
|
+
})))))() : (() => {
|
|
240
215
|
if (icon) {
|
|
241
216
|
if (typeof icon === 'string') {
|
|
242
217
|
return /*#__PURE__*/React.createElement(View, {
|
|
@@ -250,14 +225,13 @@ export const VoiceIntercom = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
250
225
|
className: clsx('icon-image-default-container', iconClassName)
|
|
251
226
|
}, icon);
|
|
252
227
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
className: className
|
|
228
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
229
|
+
className: clsx('icon-panel',
|
|
230
|
+
// 类名按 iconfont 的 font_class 取,不是 name —— 图标库里这枚图标的
|
|
231
|
+
// name 是「one-way-intercom」(单向对讲)、font_class 是「yuyin」(unicode e63c),
|
|
232
|
+
// 而 CSS 类是按 font_class 生成的。曾经按 name 拼类名,字形永远找不到,
|
|
233
|
+
// 重新导出多少次都不会有那个类。别再"顺手改成语义化名字"。
|
|
234
|
+
'icon-panel-yuyin', mode === 'circle' && 'intercom-default-size', mode !== 'circle' && 'ipc-player-plugin-voice-small-intercom', iconClassName)
|
|
261
235
|
});
|
|
262
236
|
})());
|
|
263
237
|
});
|
|
@@ -32,22 +32,6 @@
|
|
|
32
32
|
align-items: center;
|
|
33
33
|
height: 100%;
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
// Lynx 对讲中状态使用内联帧高度,避开 :nth-child 与 CSS animation 在 Lynx 下的兼容差异。
|
|
37
|
-
.lynx-talking-bars {
|
|
38
|
-
padding: 0 1px;
|
|
39
|
-
display: flex;
|
|
40
|
-
align-items: center;
|
|
41
|
-
justify-content: center;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.lynx-talking-bar {
|
|
45
|
-
width: 2px;
|
|
46
|
-
margin: 0 1px;
|
|
47
|
-
border-radius: 5px;
|
|
48
|
-
transition: height 30ms linear;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
35
|
.ipc-player-plugin-voice-intercom-img {
|
|
52
36
|
width: calc(@size * var(--ipc-player-size-scale, 1));
|
|
53
37
|
height: calc(@size * var(--ipc-player-size-scale, 1));
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ZoomTurntableProps } from './type';
|
|
3
3
|
import './index.less';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
/**
|
|
5
|
+
* 焦距转盘渲染层。
|
|
6
|
+
* 内嵌自 ray-zoom-turntable,实际绘制与手势在 rjs(render 线程)内完成,
|
|
7
|
+
* 拖动不过桥,保证跟手。
|
|
8
|
+
*/
|
|
9
|
+
declare const ZoomTurntable: React.FC<ZoomTurntableProps>;
|
|
10
|
+
export default ZoomTurntable;
|