@ray-js/ipc-player-integration 0.0.35-beta.14 → 0.0.35-beta.16
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.
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import "core-js/modules/esnext.iterator.constructor.js";
|
|
3
2
|
import "core-js/modules/esnext.iterator.find.js";
|
|
4
3
|
import React, { useMemo } from 'react';
|
|
@@ -9,6 +8,10 @@ import { useComponentHideState } from './hooks';
|
|
|
9
8
|
import { TrialBadge, useTrialBadge } from '../widgets/trialBadge';
|
|
10
9
|
/** 右侧透明渐变宽度,用于提示横向可滑动 */
|
|
11
10
|
const FADE_MASK = 'linear-gradient(to right, #000 calc(100% - 48px), transparent 100%)';
|
|
11
|
+
|
|
12
|
+
/** TrialBadge 组件高度 40px + 间距 */
|
|
13
|
+
const BADGE_HEIGHT_VERTICAL = 44;
|
|
14
|
+
const BADGE_HEIGHT_FULL = 48;
|
|
12
15
|
const BottomLeftContent = _ref => {
|
|
13
16
|
let {
|
|
14
17
|
ctx,
|
|
@@ -36,15 +39,20 @@ const BottomLeftContent = _ref => {
|
|
|
36
39
|
const tryExp = bottomLeftContent === null || bottomLeftContent === void 0 ? void 0 : bottomLeftContent.find(item => item.id === 'TryExperience');
|
|
37
40
|
return (_trialRemainingSec = tryExp === null || tryExp === void 0 || (_tryExp$initProps2 = tryExp.initProps) === null || _tryExp$initProps2 === void 0 ? void 0 : _tryExp$initProps2.trialRemainingSec) !== null && _trialRemainingSec !== void 0 ? _trialRemainingSec : 0;
|
|
38
41
|
}, [bottomLeftContent]);
|
|
42
|
+
const buttonState = useMemo(() => {
|
|
43
|
+
var _tryExp$initProps3;
|
|
44
|
+
const tryExp = bottomLeftContent === null || bottomLeftContent === void 0 ? void 0 : bottomLeftContent.find(item => item.id === 'TryExperience');
|
|
45
|
+
return tryExp === null || tryExp === void 0 || (_tryExp$initProps3 = tryExp.initProps) === null || _tryExp$initProps3 === void 0 ? void 0 : _tryExp$initProps3.buttonState;
|
|
46
|
+
}, [bottomLeftContent]);
|
|
39
47
|
const isLowPhone = useMemo(() => {
|
|
40
|
-
var _isLowPhone, _tryExp$
|
|
48
|
+
var _isLowPhone, _tryExp$initProps4;
|
|
41
49
|
const tryExp = bottomLeftContent === null || bottomLeftContent === void 0 ? void 0 : bottomLeftContent.find(item => item.id === 'TryExperience');
|
|
42
|
-
return (_isLowPhone = tryExp === null || tryExp === void 0 || (_tryExp$
|
|
50
|
+
return (_isLowPhone = tryExp === null || tryExp === void 0 || (_tryExp$initProps4 = tryExp.initProps) === null || _tryExp$initProps4 === void 0 ? void 0 : _tryExp$initProps4.isLowPhone) !== null && _isLowPhone !== void 0 ? _isLowPhone : false;
|
|
43
51
|
}, []);
|
|
44
52
|
const gRawData = useMemo(() => {
|
|
45
|
-
var _gRawData, _tryExp$
|
|
53
|
+
var _gRawData, _tryExp$initProps5;
|
|
46
54
|
const tryExp = bottomLeftContent === null || bottomLeftContent === void 0 ? void 0 : bottomLeftContent.find(item => item.id === 'TryExperience');
|
|
47
|
-
return (_gRawData = tryExp === null || tryExp === void 0 || (_tryExp$
|
|
55
|
+
return (_gRawData = tryExp === null || tryExp === void 0 || (_tryExp$initProps5 = tryExp.initProps) === null || _tryExp$initProps5 === void 0 ? void 0 : _tryExp$initProps5.gRawData) !== null && _gRawData !== void 0 ? _gRawData : false;
|
|
48
56
|
}, [bottomLeftContent]);
|
|
49
57
|
const [shouldHide] = useComponentHideState();
|
|
50
58
|
const {
|
|
@@ -53,40 +61,32 @@ const BottomLeftContent = _ref => {
|
|
|
53
61
|
handleCountdownEnd
|
|
54
62
|
} = useTrialBadge(ctx.event, ctx.devId, trialRemainingSec);
|
|
55
63
|
const paddingLeftPx = screenType === 'vertical' ? 0 : 25;
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
marginBottom: 8,
|
|
69
|
-
zIndex: 101,
|
|
70
|
-
width: 'max-content'
|
|
71
|
-
};
|
|
72
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, showSmartImageQuality && showTrialBadge && canOpenSettings && gRawData && !isLowPhone && trialRemainingSec > 0 && /*#__PURE__*/React.createElement(CoverView, {
|
|
73
|
-
style: _objectSpread(_objectSpread({}, trialBadgeStyle), {}, {
|
|
64
|
+
const showBadge = showSmartImageQuality && showTrialBadge && canOpenSettings && gRawData && !isLowPhone && buttonState === 1 && trialRemainingSec > 0;
|
|
65
|
+
const bottomBarHeight = screenType === 'vertical' ? 40 : 58;
|
|
66
|
+
const badgeAreaHeight = screenType === 'vertical' ? BADGE_HEIGHT_VERTICAL : BADGE_HEIGHT_FULL;
|
|
67
|
+
const containerHeight = showBadge ? `${bottomBarHeight + badgeAreaHeight}px` : `${bottomBarHeight}px`;
|
|
68
|
+
return /*#__PURE__*/React.createElement(CoverView, {
|
|
69
|
+
className: clsx('ipc-player-bottom-left-content-wrap'),
|
|
70
|
+
style: {
|
|
71
|
+
right: `${reservedRight}px`,
|
|
72
|
+
height: containerHeight,
|
|
73
|
+
display: 'flex',
|
|
74
|
+
flexDirection: 'column',
|
|
75
|
+
justifyContent: 'flex-end',
|
|
74
76
|
opacity: shouldHide ? 0 : 1,
|
|
75
77
|
pointerEvents: shouldHide ? 'none' : 'auto'
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
+
}
|
|
79
|
+
}, showBadge && /*#__PURE__*/React.createElement(View, {
|
|
80
|
+
style: {
|
|
81
|
+
paddingLeft: screenType === 'vertical' ? '0px' : '25px',
|
|
82
|
+
marginBottom: screenType === 'vertical' ? '4px' : '8px'
|
|
83
|
+
}
|
|
78
84
|
}, /*#__PURE__*/React.createElement(TrialBadge, {
|
|
79
85
|
brandColor: brandColor,
|
|
80
86
|
trialRemainingSec: trialRemainingSec,
|
|
81
87
|
onSubscribe: handleTrialSubscribe,
|
|
82
88
|
onCountdownEnd: handleCountdownEnd
|
|
83
|
-
})), /*#__PURE__*/React.createElement(
|
|
84
|
-
className: clsx('ipc-player-bottom-left-content-wrap'),
|
|
85
|
-
style: {
|
|
86
|
-
right: `${reservedRight}px`,
|
|
87
|
-
height: containerHeight
|
|
88
|
-
}
|
|
89
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
89
|
+
})), /*#__PURE__*/React.createElement(View, {
|
|
90
90
|
style: {
|
|
91
91
|
paddingBottom: screenType === 'vertical' ? '14px' : '32px',
|
|
92
92
|
paddingLeft: `${paddingLeftPx}px`,
|
|
@@ -100,6 +100,6 @@ const BottomLeftContent = _ref => {
|
|
|
100
100
|
maskImage: FADE_MASK
|
|
101
101
|
},
|
|
102
102
|
className: clsx('ipc-player-bottom-left-content-container')
|
|
103
|
-
}, children))
|
|
103
|
+
}, children));
|
|
104
104
|
};
|
|
105
105
|
export default BottomLeftContent;
|
package/lib/ui/ui.js
CHANGED
|
@@ -455,7 +455,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
455
455
|
// canOpenSettings: true,
|
|
456
456
|
// };
|
|
457
457
|
const getNgRes = await getNgRawData();
|
|
458
|
-
console.log('res===
|
|
458
|
+
console.log('res===getNgRes111', res, getNgRes);
|
|
459
459
|
updatePlayerWidgetProps(instance, 'bottomLeft', 'TryExperience', {
|
|
460
460
|
isPurchase: res.isPurchase,
|
|
461
461
|
buttonState: res.buttonState,
|
|
@@ -465,8 +465,10 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
465
465
|
isLowPhone: isLowPhoneRef.current
|
|
466
466
|
});
|
|
467
467
|
});
|
|
468
|
+
const siqInitRef = useRef(false);
|
|
468
469
|
useEffect(() => {
|
|
469
|
-
if (playState === PlayState.PLAYING) {
|
|
470
|
+
if (playState === PlayState.PLAYING && !siqInitRef.current) {
|
|
471
|
+
siqInitRef.current = true;
|
|
470
472
|
refreshSmartImageQuality();
|
|
471
473
|
}
|
|
472
474
|
}, [instance, playState]);
|
package/lib/ui/ui.less
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { setTrailFinish } from '../../utils/ttt';
|
|
3
3
|
import { gotoSecurityCloudService2 } from '../../utils';
|
|
4
|
-
import { trialCountdownEnd
|
|
4
|
+
import { trialCountdownEnd } from '../../ui/constant';
|
|
5
5
|
import Strings from '../../i18n';
|
|
6
6
|
export const useTrialBadge = (event, devId, trialRemainingSec) => {
|
|
7
7
|
const [showTrialBadge, setShowTrialBadge] = useState(false);
|
|
8
|
+
const prevTrialSecRef = useRef(trialRemainingSec);
|
|
8
9
|
useEffect(() => {
|
|
9
10
|
if (trialRemainingSec > 0 && trialRemainingSec < 300) {
|
|
10
|
-
|
|
11
|
+
if (trialRemainingSec !== prevTrialSecRef.current) {
|
|
12
|
+
setShowTrialBadge(true);
|
|
13
|
+
}
|
|
11
14
|
}
|
|
15
|
+
prevTrialSecRef.current = trialRemainingSec;
|
|
12
16
|
}, [trialRemainingSec]);
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
const hide = () => setShowTrialBadge(false);
|
|
15
|
-
event.on(hideTrialBadgeEvent, hide);
|
|
16
|
-
return () => {
|
|
17
|
-
event.off(hideTrialBadgeEvent, hide);
|
|
18
|
-
};
|
|
19
|
-
}, [event]);
|
|
20
17
|
const handleTrialSubscribe = useCallback(async () => {
|
|
21
18
|
try {
|
|
22
|
-
|
|
23
|
-
console.log('res===gotoSecurityCloudService2', res);
|
|
19
|
+
await gotoSecurityCloudService2(devId);
|
|
24
20
|
} catch (error) {
|
|
25
21
|
ty.showToast({
|
|
26
22
|
title: Strings.getLang('ipc_player_fetch_error'),
|
|
@@ -5,7 +5,7 @@ import React, { useState, useEffect, useCallback, useRef } from 'react';
|
|
|
5
5
|
import { useStore } from '../../ctx/store';
|
|
6
6
|
import Strings from '../../i18n';
|
|
7
7
|
import { getAIFrameFeature, gotoAIDrawMiniProgram, setAIFrameFeature } from '../../utils';
|
|
8
|
-
import { refreshSmartImageQualityEvent
|
|
8
|
+
import { refreshSmartImageQualityEvent } from '../../ui/constant';
|
|
9
9
|
import tryZh from '../../res/try/try_zh.png';
|
|
10
10
|
import tryEn from '../../res/try/try_en.png';
|
|
11
11
|
import tryOpen from '../../res/try/try_open.png';
|
|
@@ -71,12 +71,6 @@ export const TryExperience = props => {
|
|
|
71
71
|
setImgSrc(tryClose);
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
|
-
// ty.getNgRawData({
|
|
75
|
-
// rawKey: 'is_smart_image_quality',
|
|
76
|
-
// success: () => {},
|
|
77
|
-
// fail: () => {},
|
|
78
|
-
// });
|
|
79
|
-
// success里具体的值 要看看实际调试结果, APP NG 配置支持的话 才展示智能画质开关哦
|
|
80
74
|
if (buttonState === 0 || buttonState) {
|
|
81
75
|
const iconUrl = pickIconByStatus(buttonState);
|
|
82
76
|
setImgSrc(iconUrl);
|
|
@@ -104,7 +98,7 @@ export const TryExperience = props => {
|
|
|
104
98
|
try {
|
|
105
99
|
const getAI = await getAIFrameFeature(devId);
|
|
106
100
|
if (buttonState === TryExperienceStatus.Open) {
|
|
107
|
-
var _getAI$aiFrameFeature, _getAI$aiFrameFeature2, _getAI$aiFrameFeature3, _props$event
|
|
101
|
+
var _getAI$aiFrameFeature, _getAI$aiFrameFeature2, _getAI$aiFrameFeature3, _props$event;
|
|
108
102
|
// 由开变关的时候,只关inPreview
|
|
109
103
|
const scope = _objectSpread(_objectSpread({}, (_getAI$aiFrameFeature = getAI.aiFrameFeature) === null || _getAI$aiFrameFeature === void 0 ? void 0 : _getAI$aiFrameFeature.scope), {}, {
|
|
110
104
|
inPreview: false
|
|
@@ -120,10 +114,9 @@ export const TryExperience = props => {
|
|
|
120
114
|
exportEnabled: (_getAI$aiFrameFeature3 = getAI.aiFrameFeature) === null || _getAI$aiFrameFeature3 === void 0 ? void 0 : _getAI$aiFrameFeature3.exportEnabled
|
|
121
115
|
}
|
|
122
116
|
});
|
|
123
|
-
(_props$event = props.event) === null || _props$event === void 0 || _props$event.emit(
|
|
124
|
-
(_props$event2 = props.event) === null || _props$event2 === void 0 || _props$event2.emit(refreshSmartImageQualityEvent);
|
|
117
|
+
(_props$event = props.event) === null || _props$event === void 0 || _props$event.emit(refreshSmartImageQualityEvent);
|
|
125
118
|
} else if (buttonState === TryExperienceStatus.Close && isPurchase || buttonState === TryExperienceStatus.Close && trialRemainingSec < 300 && trialRemainingSec > 0) {
|
|
126
|
-
var _getAI$aiFrameFeature4, _getAI$aiFrameFeature5, _getAI$aiFrameFeature6, _props$
|
|
119
|
+
var _getAI$aiFrameFeature4, _getAI$aiFrameFeature5, _getAI$aiFrameFeature6, _props$event2;
|
|
127
120
|
const scope = _objectSpread(_objectSpread({}, (_getAI$aiFrameFeature4 = getAI.aiFrameFeature) === null || _getAI$aiFrameFeature4 === void 0 ? void 0 : _getAI$aiFrameFeature4.scope), {}, {
|
|
128
121
|
inPreview: true
|
|
129
122
|
});
|
|
@@ -139,7 +132,7 @@ export const TryExperience = props => {
|
|
|
139
132
|
exportEnabled: (_getAI$aiFrameFeature6 = getAI.aiFrameFeature) === null || _getAI$aiFrameFeature6 === void 0 ? void 0 : _getAI$aiFrameFeature6.exportEnabled
|
|
140
133
|
}
|
|
141
134
|
});
|
|
142
|
-
(_props$
|
|
135
|
+
(_props$event2 = props.event) === null || _props$event2 === void 0 || _props$event2.emit(refreshSmartImageQualityEvent);
|
|
143
136
|
} else {
|
|
144
137
|
gotoAIDrawMiniProgram(devId, brandColor);
|
|
145
138
|
}
|
|
@@ -152,7 +145,10 @@ export const TryExperience = props => {
|
|
|
152
145
|
if (hideTryExperienceMenu) {
|
|
153
146
|
return null;
|
|
154
147
|
}
|
|
155
|
-
|
|
148
|
+
if (!imgSrc || !canOpenSettings || !gRawData) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
156
152
|
className: clsx(className),
|
|
157
153
|
onClick: onTryExperience
|
|
158
154
|
}, /*#__PURE__*/React.createElement(View, {
|
|
@@ -161,5 +157,5 @@ export const TryExperience = props => {
|
|
|
161
157
|
className: "try-experience-icon",
|
|
162
158
|
src: imgSrc,
|
|
163
159
|
mode: "heightFix"
|
|
164
|
-
})))
|
|
160
|
+
})));
|
|
165
161
|
};
|