@ray-js/ipc-player-integration 0.0.61-beta.1 → 0.0.63

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 (49) hide show
  1. package/lib/ctx/ctx.composition.js +4 -19
  2. package/lib/ctx/ctx.js +55 -103
  3. package/lib/ctx/ports.output.d.ts +0 -1
  4. package/lib/ctx/resolution.d.ts +1 -1
  5. package/lib/ctx/resolution.js +1 -3
  6. package/lib/i18n/index.d.ts +0 -12
  7. package/lib/i18n/strings.d.ts +0 -6
  8. package/lib/i18n/strings.js +0 -6
  9. package/lib/interface.d.ts +3 -19
  10. package/lib/ui/bottomLeftContent.js +1 -3
  11. package/lib/ui/ui.d.ts +0 -2
  12. package/lib/ui/ui.js +26 -30
  13. package/lib/utils/navigation.d.ts +1 -2
  14. package/lib/utils/navigation.js +3 -13
  15. package/lib/utils/ttt.js +8 -2
  16. package/lib/widgets/index.d.ts +0 -1
  17. package/lib/widgets/index.js +1 -2
  18. package/lib/widgets/recordVideo/recordVideo.js +52 -53
  19. package/lib/widgets/recordVideo/recordVideo.less +74 -17
  20. package/lib/widgets/recordVideo/recordVideo.test.js +0 -1
  21. package/lib/widgets/screenshot/screenshot.js +44 -66
  22. package/lib/widgets/screenshot/screenshot.less +40 -1
  23. package/lib/widgets/trialBadge/index.d.ts +1 -2
  24. package/lib/widgets/trialBadge/index.js +9 -17
  25. package/lib/widgets/trialBadge/useTrialBadge.d.ts +2 -3
  26. package/lib/widgets/trialBadge/useTrialBadge.js +2 -13
  27. package/lib/widgets/tryExperience/tryExperience.js +1 -0
  28. package/package.json +2 -3
  29. package/lib/ctx/ctx.album.test.d.ts +0 -1
  30. package/lib/ctx/ctx.album.test.js +0 -197
  31. package/lib/ui/absoluteContent.d.ts +0 -2
  32. package/lib/ui/absoluteContent.js +0 -3
  33. package/lib/utils/captureResult.d.ts +0 -14
  34. package/lib/utils/captureResult.js +0 -70
  35. package/lib/utils/captureResult.test.d.ts +0 -1
  36. package/lib/utils/captureResult.test.js +0 -117
  37. package/lib/utils/fullLinkTracking.d.ts +0 -5
  38. package/lib/utils/fullLinkTracking.js +0 -71
  39. package/lib/widgets/captureResult/captureResult.d.ts +0 -16
  40. package/lib/widgets/captureResult/captureResult.js +0 -85
  41. package/lib/widgets/captureResult/captureResult.less +0 -144
  42. package/lib/widgets/captureResult/captureResult.test.d.ts +0 -1
  43. package/lib/widgets/captureResult/captureResult.test.js +0 -80
  44. package/lib/widgets/captureResult/index.d.ts +0 -2
  45. package/lib/widgets/captureResult/index.js +0 -2
  46. package/lib/widgets/recordVideo/recordVideo.lifecycle.test.d.ts +0 -1
  47. package/lib/widgets/recordVideo/recordVideo.lifecycle.test.js +0 -106
  48. package/lib/widgets/screenshot/screenshot.test.d.ts +0 -1
  49. package/lib/widgets/screenshot/screenshot.test.js +0 -120
@@ -1,120 +0,0 @@
1
- import { act, renderHook } from '@testing-library/react-hooks/dom';
2
- import { atom } from 'jotai';
3
- import { authorize, authorizeStatus, getSystemInfoSync, showModal } from '@ray-js/ray';
4
- import { getDeviceInfo } from '../../utils/device';
5
- import { Screenshot } from './screenshot';
6
- jest.mock('@ray-js/ray', () => ({
7
- View: 'div',
8
- Text: 'span',
9
- Image: 'img',
10
- getSystemInfoSync: jest.fn(),
11
- authorize: jest.fn(),
12
- authorizeStatus: jest.fn(),
13
- showModal: jest.fn(),
14
- openAppSystemSettingPage: jest.fn()
15
- }));
16
- jest.mock('@ray-js/ray-ipc-utils', () => ({
17
- goToIpcPageNativeRoute: jest.fn()
18
- }));
19
- jest.mock('../../utils/device', () => ({
20
- getDeviceInfo: jest.fn()
21
- }));
22
- jest.mock('../../i18n', () => ({
23
- __esModule: true,
24
- default: {
25
- getLang: key => key
26
- }
27
- }));
28
- jest.mock('./screenshot.less', () => ({}));
29
- jest.mock('../captureResult/captureResult.less', () => ({}));
30
- beforeEach(() => {
31
- jest.clearAllMocks();
32
- getSystemInfoSync.mockReturnValue({
33
- platform: 'android',
34
- system: 'android 12'
35
- });
36
- authorizeStatus.mockImplementation(_ref => {
37
- let {
38
- fail
39
- } = _ref;
40
- return fail({
41
- errorCode: 9004
42
- });
43
- });
44
- authorize.mockImplementation(_ref2 => {
45
- let {
46
- fail
47
- } = _ref2;
48
- return fail({
49
- errorCode: 9004
50
- });
51
- });
52
- getDeviceInfo.mockResolvedValue({
53
- configMetas: {
54
- tyabimr4v3: {
55
- total_split_num: 3
56
- }
57
- }
58
- });
59
- });
60
- const createProps = () => ({
61
- IPCPlayerContext: {
62
- snapshot: jest.fn(_ref3 => {
63
- let {
64
- success
65
- } = _ref3;
66
- return success({
67
- tempImagePath: 'thingfile://capture.jpg'
68
- });
69
- })
70
- },
71
- addContent: jest.fn(),
72
- deleteContent: jest.fn(),
73
- saveToAlbum: 0,
74
- devId: 'camera-1',
75
- toast: jest.fn(),
76
- screenType: atom('vertical'),
77
- brandColor: atom('#000000'),
78
- multiLens: true,
79
- event: {
80
- emit: jest.fn()
81
- }
82
- });
83
- it('keeps multi-lens results when legacy album authorization is unavailable', async () => {
84
- const props = createProps();
85
- const {
86
- result,
87
- unmount
88
- } = renderHook(() => Screenshot(props));
89
- await act(async () => {
90
- await result.current.props.onClick();
91
- });
92
- expect(authorizeStatus).not.toHaveBeenCalled();
93
- expect(props.IPCPlayerContext.snapshot).toHaveBeenCalledWith(expect.objectContaining({
94
- saveToAlbum: 0
95
- }));
96
- const [, config] = props.addContent.mock.calls[0];
97
- expect(config.content().props).toEqual(expect.objectContaining({
98
- count: 3,
99
- thumbnailPath: 'thingfile://capture_lens1.jpg'
100
- }));
101
- unmount();
102
- });
103
- it('keeps the permission rejection path before taking a snapshot', async () => {
104
- getSystemInfoSync.mockReturnValue({
105
- platform: 'ios',
106
- system: 'iOS 18'
107
- });
108
- const props = createProps();
109
- const {
110
- result,
111
- unmount
112
- } = renderHook(() => Screenshot(props));
113
- await act(async () => {
114
- await result.current.props.onClick();
115
- });
116
- expect(props.IPCPlayerContext.snapshot).not.toHaveBeenCalled();
117
- expect(props.addContent).not.toHaveBeenCalled();
118
- expect(showModal).toHaveBeenCalledTimes(1);
119
- unmount();
120
- });