@ray-js/ipc-player-integration 0.0.71-beta.0 → 0.0.72-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.
Files changed (145) hide show
  1. package/README.md +0 -6
  2. package/lib/ctx/ctx.composition.d.ts +5 -1
  3. package/lib/ctx/ctx.composition.js +4 -1
  4. package/lib/ctx/ctx.js +17 -12
  5. package/lib/ctx/ctx.test.js +19 -54
  6. package/lib/features/initPlayerWidgets/index.d.ts +3 -0
  7. package/lib/features/initPlayerWidgets/index.js +4 -0
  8. package/lib/index.d.ts +0 -4
  9. package/lib/index.js +1 -3
  10. package/lib/interface.d.ts +1 -1
  11. package/lib/ui/bottomControlLayout.d.ts +11 -0
  12. package/lib/ui/bottomControlLayout.js +19 -0
  13. package/lib/ui/bottomControlLayout.test.js +64 -0
  14. package/lib/ui/bottomLeftContent.js +73 -180
  15. package/lib/ui/bottomLeftContent.test.js +138 -0
  16. package/lib/ui/bottomRightContent.d.ts +2 -2
  17. package/lib/ui/bottomRightContent.js +24 -16
  18. package/lib/ui/bottomRightContent.test.js +144 -0
  19. package/lib/ui/constant.d.ts +2 -0
  20. package/lib/ui/constant.js +4 -1
  21. package/lib/ui/topLeftContent.js +2 -4
  22. package/lib/ui/topRightContent.js +2 -4
  23. package/lib/ui/ui.d.ts +0 -5
  24. package/lib/ui/ui.js +33 -86
  25. package/lib/ui/ui.less +24 -59
  26. package/lib/widgets/battery/battery.js +5 -7
  27. package/lib/widgets/battery/batteryFull.js +5 -7
  28. package/lib/widgets/captureResult/captureResult.js +1 -2
  29. package/lib/widgets/floatWindow/floatWindow.d.ts +13 -0
  30. package/lib/widgets/floatWindow/floatWindow.js +93 -0
  31. package/lib/widgets/floatWindow/floatWindow.less +14 -0
  32. package/lib/widgets/floatWindow/floatWindow.test.d.ts +1 -0
  33. package/lib/widgets/floatWindow/floatWindow.test.js +164 -0
  34. package/lib/widgets/floatWindow/icon.d.ts +1 -0
  35. package/lib/widgets/floatWindow/icon.js +4 -0
  36. package/lib/widgets/floatWindow/index.d.ts +1 -0
  37. package/lib/widgets/floatWindow/index.js +1 -0
  38. package/lib/widgets/floodlight/floodlight.js +1 -2
  39. package/lib/widgets/flowLowTip/flowLowTip.js +1 -2
  40. package/lib/widgets/fullScreen/fullScreen.js +1 -2
  41. package/lib/widgets/fullScreen/fullTravelRouteControl.d.ts +1 -1
  42. package/lib/widgets/fullScreen/fullTravelRouteControl.js +1 -1
  43. package/lib/widgets/fullScreen/verticalScreen.js +1 -2
  44. package/lib/widgets/index.d.ts +1 -0
  45. package/lib/widgets/index.js +2 -1
  46. package/lib/widgets/moveInteractiveControl/controlButton.js +1 -2
  47. package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.js +5 -16
  48. package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.less +4 -24
  49. package/lib/widgets/multiCamera/landscapeTip.js +2 -8
  50. package/lib/widgets/multiCamera/moveablePtzControl.js +3 -5
  51. package/lib/widgets/multiCamera/multiPtz.js +1 -2
  52. package/lib/widgets/multiCamera/ptzMoveableTip.js +2 -8
  53. package/lib/widgets/multiCamera/switchLayout.js +1 -2
  54. package/lib/widgets/multiCamera/tileMultiPtz.js +1 -2
  55. package/lib/widgets/multiCamera/tileSwitchLayout.js +1 -2
  56. package/lib/widgets/multiCamera/tileTip.js +2 -8
  57. package/lib/widgets/muted/muted.js +1 -2
  58. package/lib/widgets/muted/muted.test.js +52 -66
  59. package/lib/widgets/ptz/ptz.js +1 -2
  60. package/lib/widgets/ptz/ptzControl.js +3 -4
  61. package/lib/widgets/ptzControlTip/ptzControlTip.js +4 -9
  62. package/lib/widgets/ptzControlTip/ptzControlTip.less +0 -6
  63. package/lib/widgets/realTimeMagnification/realTimeMagnification.js +1 -2
  64. package/lib/widgets/recordVideo/recordVideo.js +169 -47
  65. package/lib/widgets/recordVideo/recordVideo.lifecycle.test.js +2 -4
  66. package/lib/widgets/recordVideo/recordVideo.test.js +2 -169
  67. package/lib/widgets/resolution/fullResolutionControl.js +19 -29
  68. package/lib/widgets/resolution/resolution.js +2 -3
  69. package/lib/widgets/screenshot/screenshot.js +122 -48
  70. package/lib/widgets/screenshot/screenshot.test.js +113 -108
  71. package/lib/widgets/signal4G/signal4G.js +1 -4
  72. package/lib/widgets/siren/siren.js +1 -2
  73. package/lib/widgets/tempHumidity/tempHumidity.js +1 -2
  74. package/lib/widgets/toggleVerticalFull/toggleVerticalFull.js +1 -2
  75. package/lib/widgets/trialBadge/index.js +3 -8
  76. package/lib/widgets/trialBadge/index.less +0 -24
  77. package/lib/widgets/tryExperience/tryExperience.js +1 -2
  78. package/lib/widgets/videoBitKBP/videoBitKBP.js +1 -2
  79. package/lib/widgets/voiceIntercom/voiceIntercom.js +81 -57
  80. package/lib/widgets/voiceIntercom/voiceIntercom.less +0 -35
  81. package/lib/widgets/zoomTurntable/turntable/index.d.ts +7 -5
  82. package/lib/widgets/zoomTurntable/turntable/index.js +1 -3
  83. package/lib/widgets/zoomTurntable/zoomTurntableDock.d.ts +3 -5
  84. package/lib/widgets/zoomTurntable/zoomTurntableDock.js +4 -4
  85. package/lib/widgets/zoomTurntable/zoomTurntableEntry.js +19 -32
  86. package/lib/widgets/zoomTurntable/zoomTurntableTip.js +3 -17
  87. package/package.json +7 -15
  88. package/lib/ctx/intercom.test.js +0 -85
  89. package/lib/renderer/capabilities.d.ts +0 -8
  90. package/lib/renderer/capabilities.js +0 -19
  91. package/lib/renderer/context.d.ts +0 -5
  92. package/lib/renderer/context.js +0 -6
  93. package/lib/renderer/directionControl.d.ts +0 -6
  94. package/lib/renderer/directionControl.js +0 -3
  95. package/lib/renderer/font-manifest.json +0 -9
  96. package/lib/renderer/font.less +0 -5
  97. package/lib/renderer/glyphs.d.ts +0 -1
  98. package/lib/renderer/glyphs.js +0 -256
  99. package/lib/renderer/index.module.less +0 -48
  100. package/lib/renderer/overlay.d.ts +0 -6
  101. package/lib/renderer/overlay.js +0 -18
  102. package/lib/renderer/ptzZoom.d.ts +0 -6
  103. package/lib/renderer/ptzZoom.js +0 -3
  104. package/lib/renderer/text.d.ts +0 -4
  105. package/lib/renderer/text.js +0 -32
  106. package/lib/renderer/text.module.less +0 -4
  107. package/lib/renderer/viewport.d.ts +0 -7
  108. package/lib/renderer/viewport.js +0 -24
  109. package/lib/res/lynx-signal/index.d.ts +0 -1
  110. package/lib/res/lynx-signal/index.js +0 -22
  111. package/lib/res/lynx-signal/signalFour0.png +0 -0
  112. package/lib/res/lynx-signal/signalFour1.png +0 -0
  113. package/lib/res/lynx-signal/signalFour2.png +0 -0
  114. package/lib/res/lynx-signal/signalFour3.png +0 -0
  115. package/lib/res/lynx-signal/signalFour4.png +0 -0
  116. package/lib/res/lynx-signal/signalThree0.png +0 -0
  117. package/lib/res/lynx-signal/signalThree1.png +0 -0
  118. package/lib/res/lynx-signal/signalThree2.png +0 -0
  119. package/lib/res/lynx-signal/signalThree3.png +0 -0
  120. package/lib/res/player-charging.png +0 -0
  121. package/lib/res/player-more-arrow.png +0 -0
  122. package/lib/res/player-solar.png +0 -0
  123. package/lib/ui/scrollHintArrow.d.ts +0 -23
  124. package/lib/ui/scrollHintArrow.js +0 -83
  125. package/lib/widgets/battery/statusIcon.d.ts +0 -6
  126. package/lib/widgets/battery/statusIcon.js +0 -36
  127. package/lib/widgets/battery/statusIcon.less +0 -24
  128. package/lib/widgets/captureToast/captureToast.d.ts +0 -10
  129. package/lib/widgets/captureToast/captureToast.js +0 -58
  130. package/lib/widgets/recordVideo/recordVideoTimer.d.ts +0 -3
  131. package/lib/widgets/recordVideo/recordVideoTimer.js +0 -26
  132. package/lib/widgets/screenshot/screenshot.permissions.test.js +0 -137
  133. package/lib/widgets/voiceIntercom/voiceIntercom.test.js +0 -135
  134. package/lib/widgets/zoomTurntable/lynxDockLayout.d.ts +0 -6
  135. package/lib/widgets/zoomTurntable/lynxDockLayout.js +0 -30
  136. package/lib/widgets/zoomTurntable/turntable/lynx.d.ts +0 -5
  137. package/lib/widgets/zoomTurntable/turntable/lynx.js +0 -273
  138. package/lib/widgets/zoomTurntable/turntable/lynx.less +0 -9
  139. package/lib/widgets/zoomTurntable/turntable/lynxModel.d.ts +0 -37
  140. package/lib/widgets/zoomTurntable/turntable/lynxModel.js +0 -122
  141. package/lib/widgets/zoomTurntable/turntable/lynxPaint.d.ts +0 -3
  142. package/lib/widgets/zoomTurntable/turntable/lynxPaint.js +0 -36
  143. /package/lib/{ctx/intercom.test.d.ts → ui/bottomControlLayout.test.d.ts} +0 -0
  144. /package/lib/{widgets/screenshot/screenshot.permissions.test.d.ts → ui/bottomLeftContent.test.d.ts} +0 -0
  145. /package/lib/{widgets/voiceIntercom/voiceIntercom.test.d.ts → ui/bottomRightContent.test.d.ts} +0 -0
@@ -1,17 +1,19 @@
1
1
  import "core-js/modules/esnext.iterator.constructor.js";
2
2
  import "core-js/modules/esnext.iterator.map.js";
3
- import React, { useContext, useRef, useEffect } from 'react';
4
- import { View, getSystemInfoSync } from '@ray-js/ray';
5
- import { useMemoizedFn } from 'ahooks';
3
+ import React, { useContext, useEffect, useRef } from 'react';
4
+ import { View, Text, getSystemInfoSync } from '@ray-js/ray';
5
+ import { useSetState, useUpdateEffect, useMemoizedFn } from 'ahooks';
6
6
  import clsx from 'clsx';
7
- import { getCaptureResultSummary } from '../../utils/captureResult';
8
- import { PlayerText as Text } from '../../renderer/text';
7
+ import { goToIpcPageNativeRoute } from '@ray-js/ray-ipc-utils';
9
8
  import Strings from '../../i18n';
9
+ import { useStore } from '../../ctx/store';
10
10
  import { UIEventContext } from '../../ui/context';
11
11
  import { pauseTimeToHideAllComponent, changeIgnoreHideStopPreview, widgetLabs, widgetClick } from '../../ui/constant';
12
+ import { getCaptureResultSummary } from '../../utils/captureResult';
12
13
  import { ensureAlbumPermission } from '../../utils/authorize/album';
13
- import CaptureToast from '../captureToast/captureToast';
14
+ import { CaptureResultToast } from '../captureResult/captureResult';
14
15
  import './screenshot.less';
16
+ const CLOSE_TIME = 5000;
15
17
  export function Screenshot(props) {
16
18
  const {
17
19
  IPCPlayerContext,
@@ -23,39 +25,97 @@ export function Screenshot(props) {
23
25
  className,
24
26
  hideScreenShotMenu
25
27
  } = props;
28
+ const {
29
+ screenType,
30
+ brandColor
31
+ } = useStore({
32
+ screenType: props.screenType,
33
+ brandColor: props.brandColor
34
+ });
26
35
  const {
27
36
  event
28
37
  } = useContext(UIEventContext);
29
- const requestIdRef = useRef(0);
30
- useEffect(() => () => {
31
- requestIdRef.current += 1;
38
+
39
+ /** 记录截屏url */
40
+ const [state, setState] = useSetState({
41
+ showShot: false,
42
+ shotUrl: '',
43
+ shotCount: 0
44
+ });
45
+ const snapshotRequestIdRef = useRef(0);
46
+ useEffect(() => {
47
+ return () => {
48
+ snapshotRequestIdRef.current += 1;
49
+ };
32
50
  }, []);
33
- const showShotToast = (imageUrl, count) => {
51
+ useUpdateEffect(() => {
52
+ if (state.showShot && screenType) {
53
+ showShotToast();
54
+ }
55
+ }, [state.showShot, screenType]);
56
+ const timer = useRef();
57
+ const timeToCloseToast = () => {
58
+ clearInterval(timer.current);
59
+ // @ts-ignore
60
+ timer.current = setTimeout(() => {
61
+ setState({
62
+ showShot: false,
63
+ shotUrl: '',
64
+ shotCount: 0
65
+ });
66
+ deleteContent('absolute', 'plugin-screenshot-toast');
67
+ }, CLOSE_TIME);
68
+ };
69
+
70
+ /** 跳转相册 */
71
+ const handCheck = () => {
72
+ setState({
73
+ showShot: false,
74
+ shotUrl: '',
75
+ shotCount: 0
76
+ });
77
+ deleteContent('absolute', 'plugin-screenshot-toast');
78
+ clearInterval(timer.current);
79
+ goToIpcPageNativeRoute('ipc_album_panel', devId);
80
+ };
81
+
82
+ /** 添加截屏成功弹窗 */
83
+ const showShotToast = () => {
34
84
  deleteContent('absolute', 'plugin-screenshot-toast');
35
85
  addContent('absolute', {
36
86
  id: 'plugin-screenshot-toast',
37
- absoluteNoCoverView: true,
38
- content: CaptureToast,
39
- initProps: {
40
- kind: 'screenshot',
41
- count,
42
- imageUrl,
43
- captureId: Date.now(),
44
- screenType: props.screenType,
45
- brandColor: props.brandColor,
46
- devId,
47
- deleteContent
87
+ absoluteContentClassName: 'ipc-player-plugin-screenshot-toast-wrap',
88
+ absolutePosition: {
89
+ top: screenType === 'vertical' ? '12px' : '60px',
90
+ left: screenType === 'vertical' ? '16px' : '50%',
91
+ right: screenType === 'vertical' ? '16px' : 'unset',
92
+ display: 'flex',
93
+ width: screenType === 'vertical' ? 'auto' : '400px',
94
+ marginLeft: screenType === 'vertical' ? '0' : '-200px'
95
+ },
96
+ content: () => {
97
+ return /*#__PURE__*/React.createElement(CaptureResultToast, {
98
+ brandColor: brandColor,
99
+ count: state.shotCount,
100
+ kind: "screenshot",
101
+ onCheck: handCheck,
102
+ thumbnailPath: state.shotUrl
103
+ });
48
104
  }
49
105
  });
106
+ timeToCloseToast();
50
107
  };
51
108
  const handClick = useMemoizedFn(async () => {
52
- var _props$event, _props$event2;
53
- const ev = (_props$event = props.event) !== null && _props$event !== void 0 ? _props$event : event;
54
- ((_props$event2 = props.event) !== null && _props$event2 !== void 0 ? _props$event2 : event).emit(widgetClick, {
109
+ var _props$event;
110
+ ((_props$event = props.event) !== null && _props$event !== void 0 ? _props$event : event).emit(widgetClick, {
55
111
  widgetId: widgetLabs.SCREENSHOT
56
112
  });
57
113
  console.log('截屏!!!');
58
114
  deleteContent('absolute', 'plugin-screenshot-toast');
115
+ clearTimeout(timer.current);
116
+ setState({
117
+ showShot: false
118
+ });
59
119
  const {
60
120
  platform
61
121
  } = getSystemInfoSync();
@@ -63,32 +123,46 @@ export function Screenshot(props) {
63
123
  props.event ? props.event.emit(changeIgnoreHideStopPreview, true) : event.emit(changeIgnoreHideStopPreview, true);
64
124
  }
65
125
  event.emit(pauseTimeToHideAllComponent);
126
+ const setIgnoreHideStopPreview = value => {
127
+ var _props$event2;
128
+ ((_props$event2 = props.event) !== null && _props$event2 !== void 0 ? _props$event2 : event).emit(changeIgnoreHideStopPreview, value);
129
+ };
130
+ const handleSnapshotFail = err => {
131
+ setIgnoreHideStopPreview(false);
132
+ console.log(err, 'err');
133
+ const errObj = err.innerError || err || {};
134
+ const errMsg = errObj.errorMsg || Strings.getLang('ipc_player_error_screenshot_error_tip');
135
+ toast({
136
+ title: errMsg
137
+ });
138
+ };
66
139
  const granted = await ensureAlbumPermission();
67
- ev.emit(changeIgnoreHideStopPreview, false);
140
+ setIgnoreHideStopPreview(false);
68
141
  if (!granted) return;
69
- const requestId = ++requestIdRef.current;
70
- IPCPlayerContext.snapshot({
71
- saveToAlbum,
72
- success: async res => {
73
- var _props$multiCameraCtx;
74
- ev.emit(changeIgnoreHideStopPreview, false);
75
- const summary = await getCaptureResultSummary(res, {
76
- multiLens: props.multiLens,
77
- lensIndices: (_props$multiCameraCtx = props.multiCameraCtx) === null || _props$multiCameraCtx === void 0 || (_props$multiCameraCtx = _props$multiCameraCtx.protocol) === null || _props$multiCameraCtx === void 0 || (_props$multiCameraCtx = _props$multiCameraCtx.split_info) === null || _props$multiCameraCtx === void 0 ? void 0 : _props$multiCameraCtx.map(lens => lens.index),
78
- devId
79
- });
80
- if (requestId !== requestIdRef.current || !summary) return;
81
- showShotToast(summary.thumbnailPath, summary.isMultiLens ? summary.count : 0);
82
- },
83
- fail: err => {
84
- ev.emit(changeIgnoreHideStopPreview, false);
85
- const errObj = (err === null || err === void 0 ? void 0 : err.innerError) || err || {};
86
- const errMsg = errObj.errorMsg || Strings.getLang('ipc_player_error_screenshot_error_tip');
87
- toast({
88
- title: errMsg
89
- });
90
- }
91
- });
142
+ (() => {
143
+ const requestId = ++snapshotRequestIdRef.current;
144
+ IPCPlayerContext.snapshot({
145
+ saveToAlbum,
146
+ success: async res => {
147
+ var _props$multiCameraCtx;
148
+ setIgnoreHideStopPreview(false);
149
+ const lensIndices = (_props$multiCameraCtx = props.multiCameraCtx) === null || _props$multiCameraCtx === void 0 || (_props$multiCameraCtx = _props$multiCameraCtx.protocol) === null || _props$multiCameraCtx === void 0 || (_props$multiCameraCtx = _props$multiCameraCtx.split_info) === null || _props$multiCameraCtx === void 0 ? void 0 : _props$multiCameraCtx.map(lens => lens.index);
150
+ const summary = await getCaptureResultSummary(res, {
151
+ multiLens: props.multiLens,
152
+ lensIndices,
153
+ devId
154
+ });
155
+ if (requestId !== snapshotRequestIdRef.current) return;
156
+ if (!summary) return;
157
+ setState({
158
+ showShot: true,
159
+ shotUrl: summary.thumbnailPath,
160
+ shotCount: summary.isMultiLens ? summary.count : 0
161
+ });
162
+ },
163
+ fail: handleSnapshotFail
164
+ });
165
+ })();
92
166
  });
93
167
  if (hideScreenShotMenu) return null;
94
168
  return /*#__PURE__*/React.createElement(View, {
@@ -1,29 +1,24 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
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.map.js";
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
- platform: 'ios',
18
- system: 'iOS 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('@ray-js/ray-ipc-utils/lib/interface', () => ({}));
25
- jest.mock('../../utils/authorize/album', () => ({
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
- describe('screenshot overlay survives toolbar orientation remounts', () => {
35
- let container;
36
- beforeEach(() => {
37
- jest.useFakeTimers();
38
- jest.setSystemTime(10000);
39
- container = document.createElement('div');
40
- document.body.appendChild(container);
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
- afterEach(() => {
43
- act(() => {
44
- ReactDOM.unmountComponentAtNode(container);
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
- it.each(['webview', 'lynx'])('updates landscape -> portrait -> landscape geometry in %s', async mode => {
51
- const screenType = atom('full');
52
- const store = getDefaultStore();
53
- let remount;
54
- let updateContents;
55
- const props = {
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: isLynx ? signalPngMap[signalKey] : signalSvgMap[signalKey],
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) {
@@ -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';
@@ -24,7 +22,6 @@ export const TrialBadge = _ref => {
24
22
  onSubscribe,
25
23
  onCountdownEnd
26
24
  } = _ref;
27
- const renderMode = usePlayerRenderMode();
28
25
  useEffect(() => {
29
26
  onView === null || onView === void 0 || onView();
30
27
  }, [onView]);
@@ -67,16 +64,14 @@ export const TrialBadge = _ref => {
67
64
  }, [trialRemainingSec]);
68
65
  const countdownText = formatCountdown(remainingSec);
69
66
  return /*#__PURE__*/React.createElement(View, {
70
- className: clsx('ipc-player-trial-badge', className, {
71
- 'ipc-player-trial-badge--lynx': renderMode === 'lynx'
72
- })
67
+ className: clsx('ipc-player-trial-badge', className)
73
68
  }, /*#__PURE__*/React.createElement(Image, {
74
69
  className: "ipc-player-trial-badge-icon",
75
70
  src: tryOpen,
76
71
  mode: "heightFix"
77
72
  }), /*#__PURE__*/React.createElement(Text, {
78
73
  className: "ipc-player-trial-badge-status"
79
- }, Strings.getLang('ipc_player_trial_in_use').replace(/\s*[||]\s*$/, '')), /*#__PURE__*/React.createElement(Text, {
74
+ }, Strings.getLang('ipc_player_trial_in_use')), /*#__PURE__*/React.createElement(Text, {
80
75
  className: "ipc-player-trial-badge-divider"
81
76
  }, "|"), /*#__PURE__*/React.createElement(Text, {
82
77
  className: "ipc-player-trial-badge-preview"
@@ -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,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';