@ray-js/ipc-player-integration 0.0.66-beta.0 → 0.0.67-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 (141) hide show
  1. package/README.md +0 -6
  2. package/lib/ctx/ctx.album.test.d.ts +1 -0
  3. package/lib/ctx/ctx.album.test.js +197 -0
  4. package/lib/ctx/ctx.composition.js +13 -3
  5. package/lib/ctx/ctx.js +46 -35
  6. package/lib/ctx/multiCameraCtx.d.ts +2 -0
  7. package/lib/ctx/multiCameraCtx.js +17 -1
  8. package/lib/ctx/multiCameraCtx.test.d.ts +1 -0
  9. package/lib/ctx/multiCameraCtx.test.js +65 -0
  10. package/lib/i18n/index.d.ts +12 -0
  11. package/lib/i18n/strings.d.ts +6 -0
  12. package/lib/i18n/strings.js +6 -0
  13. package/lib/index.d.ts +0 -4
  14. package/lib/index.js +1 -3
  15. package/lib/interface.d.ts +17 -3
  16. package/lib/ui/absoluteContent.d.ts +2 -0
  17. package/lib/ui/absoluteContent.js +3 -0
  18. package/lib/ui/bottomLeftContent.js +55 -119
  19. package/lib/ui/bottomRightContent.js +3 -6
  20. package/lib/ui/ui.d.ts +0 -5
  21. package/lib/ui/ui.js +98 -89
  22. package/lib/utils/captureResult.d.ts +12 -0
  23. package/lib/utils/captureResult.js +70 -0
  24. package/lib/utils/captureResult.test.d.ts +1 -0
  25. package/lib/utils/captureResult.test.js +223 -0
  26. package/lib/utils/fullLinkTracking.d.ts +5 -0
  27. package/lib/utils/fullLinkTracking.js +71 -0
  28. package/lib/utils/navigation.d.ts +2 -1
  29. package/lib/utils/navigation.js +13 -3
  30. package/lib/widgets/battery/battery.js +5 -7
  31. package/lib/widgets/battery/batteryFull.js +5 -7
  32. package/lib/widgets/captureResult/captureResult.d.ts +16 -0
  33. package/lib/widgets/captureResult/captureResult.js +85 -0
  34. package/lib/widgets/captureResult/captureResult.less +144 -0
  35. package/lib/widgets/captureResult/captureResult.test.d.ts +1 -0
  36. package/lib/widgets/captureResult/captureResult.test.js +84 -0
  37. package/lib/widgets/captureResult/index.d.ts +2 -0
  38. package/lib/widgets/captureResult/index.js +2 -0
  39. package/lib/widgets/floodlight/floodlight.js +1 -2
  40. package/lib/widgets/flowLowTip/flowLowTip.js +1 -2
  41. package/lib/widgets/fullScreen/fullScreen.js +4 -18
  42. package/lib/widgets/fullScreen/fullTravelRouteControl.d.ts +1 -1
  43. package/lib/widgets/fullScreen/fullTravelRouteControl.js +1 -1
  44. package/lib/widgets/fullScreen/verticalScreen.js +1 -2
  45. package/lib/widgets/index.d.ts +1 -0
  46. package/lib/widgets/index.js +2 -1
  47. package/lib/widgets/moveInteractiveControl/controlButton.js +1 -2
  48. package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.js +3 -12
  49. package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.less +4 -24
  50. package/lib/widgets/multiCamera/index.less +1 -0
  51. package/lib/widgets/multiCamera/landscapeTip.js +1 -2
  52. package/lib/widgets/multiCamera/moveablePtzControl.js +5 -5
  53. package/lib/widgets/multiCamera/multiPtz.js +2 -3
  54. package/lib/widgets/multiCamera/ptzMoveableTip.js +1 -2
  55. package/lib/widgets/multiCamera/switchLayout.js +1 -2
  56. package/lib/widgets/multiCamera/tileMultiPtz.js +2 -3
  57. package/lib/widgets/multiCamera/tileSwitchLayout.js +1 -2
  58. package/lib/widgets/multiCamera/tileTip.js +1 -2
  59. package/lib/widgets/muted/muted.js +1 -2
  60. package/lib/widgets/muted/muted.test.js +52 -66
  61. package/lib/widgets/ptz/ptz.js +1 -2
  62. package/lib/widgets/ptz/ptzControl.js +1 -1
  63. package/lib/widgets/ptzControlTip/ptzControlTip.js +3 -6
  64. package/lib/widgets/ptzControlTip/ptzControlTip.less +0 -6
  65. package/lib/widgets/realTimeMagnification/realTimeMagnification.js +1 -2
  66. package/lib/widgets/recordVideo/recordVideo.js +58 -54
  67. package/lib/widgets/recordVideo/recordVideo.less +17 -74
  68. package/lib/widgets/recordVideo/recordVideo.lifecycle.test.d.ts +1 -0
  69. package/lib/widgets/recordVideo/recordVideo.lifecycle.test.js +106 -0
  70. package/lib/widgets/recordVideo/recordVideo.test.js +1 -0
  71. package/lib/widgets/resolution/fullResolutionControl.js +19 -29
  72. package/lib/widgets/resolution/resolution.js +2 -3
  73. package/lib/widgets/screenshot/screenshot.js +67 -45
  74. package/lib/widgets/screenshot/screenshot.less +1 -40
  75. package/lib/widgets/screenshot/screenshot.test.d.ts +1 -0
  76. package/lib/widgets/screenshot/screenshot.test.js +135 -0
  77. package/lib/widgets/signal4G/signal4G.js +1 -4
  78. package/lib/widgets/siren/siren.js +1 -2
  79. package/lib/widgets/tempHumidity/tempHumidity.js +1 -2
  80. package/lib/widgets/toggleVerticalFull/toggleVerticalFull.js +1 -2
  81. package/lib/widgets/trialBadge/index.d.ts +2 -1
  82. package/lib/widgets/trialBadge/index.js +20 -17
  83. package/lib/widgets/trialBadge/index.less +0 -24
  84. package/lib/widgets/trialBadge/useTrialBadge.d.ts +3 -2
  85. package/lib/widgets/trialBadge/useTrialBadge.js +13 -2
  86. package/lib/widgets/tryExperience/tryExperience.js +1 -2
  87. package/lib/widgets/videoBitKBP/videoBitKBP.js +1 -2
  88. package/lib/widgets/voiceIntercom/voiceIntercom.js +24 -50
  89. package/lib/widgets/voiceIntercom/voiceIntercom.less +0 -16
  90. package/lib/widgets/zoomTurntable/turntable/index.d.ts +7 -5
  91. package/lib/widgets/zoomTurntable/turntable/index.js +1 -3
  92. package/lib/widgets/zoomTurntable/zoomTurntableDock.d.ts +0 -2
  93. package/lib/widgets/zoomTurntable/zoomTurntableDock.js +1 -1
  94. package/lib/widgets/zoomTurntable/zoomTurntableEntry.js +18 -31
  95. package/lib/widgets/zoomTurntable/zoomTurntableTip.js +3 -23
  96. package/package.json +7 -15
  97. package/lib/renderer/capabilities.d.ts +0 -8
  98. package/lib/renderer/capabilities.js +0 -19
  99. package/lib/renderer/context.d.ts +0 -5
  100. package/lib/renderer/context.js +0 -6
  101. package/lib/renderer/directionControl.d.ts +0 -6
  102. package/lib/renderer/directionControl.js +0 -3
  103. package/lib/renderer/font.less +0 -5
  104. package/lib/renderer/glyphs.d.ts +0 -1
  105. package/lib/renderer/glyphs.js +0 -256
  106. package/lib/renderer/index.module.less +0 -48
  107. package/lib/renderer/ptzZoom.d.ts +0 -6
  108. package/lib/renderer/ptzZoom.js +0 -3
  109. package/lib/renderer/text.d.ts +0 -4
  110. package/lib/renderer/text.js +0 -32
  111. package/lib/renderer/text.module.less +0 -4
  112. package/lib/renderer/viewport.d.ts +0 -7
  113. package/lib/renderer/viewport.js +0 -24
  114. package/lib/res/lynx-signal/index.d.ts +0 -1
  115. package/lib/res/lynx-signal/index.js +0 -22
  116. package/lib/res/lynx-signal/signalFour0.png +0 -0
  117. package/lib/res/lynx-signal/signalFour1.png +0 -0
  118. package/lib/res/lynx-signal/signalFour2.png +0 -0
  119. package/lib/res/lynx-signal/signalFour3.png +0 -0
  120. package/lib/res/lynx-signal/signalFour4.png +0 -0
  121. package/lib/res/lynx-signal/signalThree0.png +0 -0
  122. package/lib/res/lynx-signal/signalThree1.png +0 -0
  123. package/lib/res/lynx-signal/signalThree2.png +0 -0
  124. package/lib/res/lynx-signal/signalThree3.png +0 -0
  125. package/lib/res/player-charging.png +0 -0
  126. package/lib/res/player-more-arrow.png +0 -0
  127. package/lib/res/player-solar.png +0 -0
  128. package/lib/ui/scrollHintArrow.d.ts +0 -23
  129. package/lib/ui/scrollHintArrow.js +0 -82
  130. package/lib/widgets/battery/statusIcon.d.ts +0 -6
  131. package/lib/widgets/battery/statusIcon.js +0 -36
  132. package/lib/widgets/battery/statusIcon.less +0 -24
  133. package/lib/widgets/zoomTurntable/lynxDockLayout.d.ts +0 -6
  134. package/lib/widgets/zoomTurntable/lynxDockLayout.js +0 -30
  135. package/lib/widgets/zoomTurntable/turntable/lynx.d.ts +0 -5
  136. package/lib/widgets/zoomTurntable/turntable/lynx.js +0 -273
  137. package/lib/widgets/zoomTurntable/turntable/lynx.less +0 -9
  138. package/lib/widgets/zoomTurntable/turntable/lynxModel.d.ts +0 -37
  139. package/lib/widgets/zoomTurntable/turntable/lynxModel.js +0 -122
  140. package/lib/widgets/zoomTurntable/turntable/lynxPaint.d.ts +0 -3
  141. package/lib/widgets/zoomTurntable/turntable/lynxPaint.js +0 -36
@@ -1,14 +1,17 @@
1
- import React, { useContext, useRef } from 'react';
2
- import { View, Image, getSystemInfoSync } from '@ray-js/ray';
1
+ import "core-js/modules/esnext.iterator.constructor.js";
2
+ import "core-js/modules/esnext.iterator.map.js";
3
+ import React, { useContext, useEffect, useRef } from 'react';
4
+ import { View, Text, getSystemInfoSync } from '@ray-js/ray';
3
5
  import { useSetState, useUpdateEffect, useMemoizedFn } from 'ahooks';
4
6
  import clsx from 'clsx';
5
7
  import { goToIpcPageNativeRoute } from '@ray-js/ray-ipc-utils';
6
- import { PlayerText as Text } from '../../renderer/text';
7
8
  import Strings from '../../i18n';
8
9
  import { useStore } from '../../ctx/store';
9
10
  import { UIEventContext } from '../../ui/context';
10
11
  import { pauseTimeToHideAllComponent, changeIgnoreHideStopPreview, widgetLabs, widgetClick } from '../../ui/constant';
12
+ import { getCaptureResultSummary } from '../../utils/captureResult';
11
13
  import { ensureAlbumPermission } from '../../utils/authorize/album';
14
+ import { CaptureResultToast } from '../captureResult/captureResult';
12
15
  import './screenshot.less';
13
16
  const CLOSE_TIME = 5000;
14
17
  export function Screenshot(props) {
@@ -36,8 +39,15 @@ export function Screenshot(props) {
36
39
  /** 记录截屏url */
37
40
  const [state, setState] = useSetState({
38
41
  showShot: false,
39
- shotUrl: ''
42
+ shotUrl: '',
43
+ shotCount: 0
40
44
  });
45
+ const snapshotRequestIdRef = useRef(0);
46
+ useEffect(() => {
47
+ return () => {
48
+ snapshotRequestIdRef.current += 1;
49
+ };
50
+ }, []);
41
51
  useUpdateEffect(() => {
42
52
  if (state.showShot && screenType) {
43
53
  showShotToast();
@@ -50,7 +60,8 @@ export function Screenshot(props) {
50
60
  timer.current = setTimeout(() => {
51
61
  setState({
52
62
  showShot: false,
53
- shotUrl: ''
63
+ shotUrl: '',
64
+ shotCount: 0
54
65
  });
55
66
  deleteContent('absolute', 'plugin-screenshot-toast');
56
67
  }, CLOSE_TIME);
@@ -60,7 +71,8 @@ export function Screenshot(props) {
60
71
  const handCheck = () => {
61
72
  setState({
62
73
  showShot: false,
63
- shotUrl: ''
74
+ shotUrl: '',
75
+ shotCount: 0
64
76
  });
65
77
  deleteContent('absolute', 'plugin-screenshot-toast');
66
78
  clearInterval(timer.current);
@@ -82,34 +94,25 @@ export function Screenshot(props) {
82
94
  marginLeft: screenType === 'vertical' ? '0' : '-200px'
83
95
  },
84
96
  content: () => {
85
- return /*#__PURE__*/React.createElement(View, {
86
- className: "ipc-player-plugin-screenshot-toast"
87
- }, /*#__PURE__*/React.createElement(View, {
88
- className: "ipc-player-plugin-screenshot-toast-image-box"
89
- }, /*#__PURE__*/React.createElement(Image, {
90
- className: "ipc-player-plugin-screenshot-toast-image",
91
- src: state.shotUrl
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')));
97
+ return /*#__PURE__*/React.createElement(CaptureResultToast, {
98
+ brandColor: brandColor,
99
+ count: state.shotCount,
100
+ kind: "screenshot",
101
+ onCheck: handCheck,
102
+ thumbnailPath: state.shotUrl
103
+ });
102
104
  }
103
105
  });
104
106
  timeToCloseToast();
105
107
  };
106
108
  const handClick = useMemoizedFn(async () => {
107
- var _props$event, _props$event2;
108
- const ev = (_props$event = props.event) !== null && _props$event !== void 0 ? _props$event : event;
109
- ((_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, {
110
111
  widgetId: widgetLabs.SCREENSHOT
111
112
  });
112
113
  console.log('截屏!!!');
114
+ deleteContent('absolute', 'plugin-screenshot-toast');
115
+ clearTimeout(timer.current);
113
116
  setState({
114
117
  showShot: false
115
118
  });
@@ -120,27 +123,46 @@ export function Screenshot(props) {
120
123
  props.event ? props.event.emit(changeIgnoreHideStopPreview, true) : event.emit(changeIgnoreHideStopPreview, true);
121
124
  }
122
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
+ };
123
139
  const granted = await ensureAlbumPermission();
124
- ev.emit(changeIgnoreHideStopPreview, false);
140
+ setIgnoreHideStopPreview(false);
125
141
  if (!granted) return;
126
- IPCPlayerContext.snapshot({
127
- saveToAlbum,
128
- success: res => {
129
- ev.emit(changeIgnoreHideStopPreview, false);
130
- setState({
131
- showShot: true,
132
- shotUrl: res.tempImagePath
133
- });
134
- },
135
- fail: err => {
136
- ev.emit(changeIgnoreHideStopPreview, false);
137
- const errObj = err.innerError || err || {};
138
- const errMsg = errObj.errorMsg || Strings.getLang('ipc_player_error_screenshot_error_tip');
139
- toast({
140
- title: errMsg
141
- });
142
- }
143
- });
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
+ })();
144
166
  });
145
167
  if (hideScreenShotMenu) return null;
146
168
  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,135 @@
1
+ import { act, renderHook } from '@testing-library/react-hooks/dom';
2
+ import { atom } from 'jotai';
3
+ import { authorize, authorizeStatus, getFileSystemManager, getSystemInfoSync, showModal } from '@ray-js/ray';
4
+ import { getDeviceInfo } from '../../utils/device';
5
+ import { Screenshot } from './screenshot';
6
+ jest.mock('@ray-js/ray', () => ({
7
+ View: 'div',
8
+ Text: 'span',
9
+ Image: 'img',
10
+ getSystemInfoSync: jest.fn(),
11
+ getFileSystemManager: jest.fn(),
12
+ authorize: jest.fn(),
13
+ authorizeStatus: jest.fn(),
14
+ showModal: jest.fn(),
15
+ openAppSystemSettingPage: jest.fn()
16
+ }));
17
+ jest.mock('@ray-js/ray-ipc-utils', () => ({
18
+ goToIpcPageNativeRoute: jest.fn()
19
+ }));
20
+ jest.mock('../../utils/device', () => ({
21
+ getDeviceInfo: jest.fn()
22
+ }));
23
+ jest.mock('../../i18n', () => ({
24
+ __esModule: true,
25
+ default: {
26
+ getLang: key => key
27
+ }
28
+ }));
29
+ jest.mock('./screenshot.less', () => ({}));
30
+ jest.mock('../captureResult/captureResult.less', () => ({}));
31
+ beforeEach(() => {
32
+ jest.clearAllMocks();
33
+ getSystemInfoSync.mockReturnValue({
34
+ platform: 'android',
35
+ system: 'android 12'
36
+ });
37
+ authorizeStatus.mockImplementation(_ref => {
38
+ let {
39
+ fail
40
+ } = _ref;
41
+ return fail({
42
+ errorCode: 9004
43
+ });
44
+ });
45
+ authorize.mockImplementation(_ref2 => {
46
+ let {
47
+ fail
48
+ } = _ref2;
49
+ return fail({
50
+ errorCode: 9004
51
+ });
52
+ });
53
+ getFileSystemManager.mockReturnValue({
54
+ access: jest.fn(_ref3 => {
55
+ let {
56
+ success
57
+ } = _ref3;
58
+ return success();
59
+ })
60
+ });
61
+ getDeviceInfo.mockResolvedValue({
62
+ configMetas: {
63
+ tyabimr4v3: {
64
+ split_info: [{
65
+ index: 1
66
+ }, {
67
+ index: 2
68
+ }, {
69
+ index: 3
70
+ }]
71
+ }
72
+ }
73
+ });
74
+ });
75
+ const createProps = () => ({
76
+ IPCPlayerContext: {
77
+ snapshot: jest.fn(_ref4 => {
78
+ let {
79
+ success
80
+ } = _ref4;
81
+ return success({
82
+ tempImagePath: 'thingfile://capture.jpg'
83
+ });
84
+ })
85
+ },
86
+ addContent: jest.fn(),
87
+ deleteContent: jest.fn(),
88
+ saveToAlbum: 0,
89
+ devId: 'camera-1',
90
+ toast: jest.fn(),
91
+ screenType: atom('vertical'),
92
+ brandColor: atom('#000000'),
93
+ multiLens: true,
94
+ event: {
95
+ emit: jest.fn()
96
+ }
97
+ });
98
+ it('keeps multi-lens results when legacy album authorization is unavailable', async () => {
99
+ const props = createProps();
100
+ const {
101
+ result,
102
+ unmount
103
+ } = renderHook(() => Screenshot(props));
104
+ await act(async () => {
105
+ await result.current.props.onClick();
106
+ });
107
+ expect(authorizeStatus).not.toHaveBeenCalled();
108
+ expect(props.IPCPlayerContext.snapshot).toHaveBeenCalledWith(expect.objectContaining({
109
+ saveToAlbum: 0
110
+ }));
111
+ const [, config] = props.addContent.mock.calls[0];
112
+ expect(config.content().props).toEqual(expect.objectContaining({
113
+ count: 3,
114
+ thumbnailPath: 'thingfile://capture_lens1.jpg'
115
+ }));
116
+ unmount();
117
+ });
118
+ it('keeps the permission rejection path before taking a snapshot', async () => {
119
+ getSystemInfoSync.mockReturnValue({
120
+ platform: 'ios',
121
+ system: 'iOS 18'
122
+ });
123
+ const props = createProps();
124
+ const {
125
+ result,
126
+ unmount
127
+ } = renderHook(() => Screenshot(props));
128
+ await act(async () => {
129
+ await result.current.props.onClick();
130
+ });
131
+ expect(props.IPCPlayerContext.snapshot).not.toHaveBeenCalled();
132
+ expect(props.addContent).not.toHaveBeenCalled();
133
+ expect(showModal).toHaveBeenCalledTimes(1);
134
+ unmount();
135
+ });
@@ -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) {
@@ -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
- const renderMode = usePlayerRenderMode();
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').replace(/\s*[||]\s*$/, '')), /*#__PURE__*/React.createElement(Text, {
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
- 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
- });
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
- /// <reference types="react" />
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
- export const useTrialBadge = (event, devId, trialRemainingSec) => {
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
- await gotoSecurityCloudService2(devId);
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
  };
@@ -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';