@ray-js/ipc-player-integration 0.0.35-beta.15 → 0.0.35-beta.17
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.
|
@@ -39,15 +39,20 @@ const BottomLeftContent = _ref => {
|
|
|
39
39
|
const tryExp = bottomLeftContent === null || bottomLeftContent === void 0 ? void 0 : bottomLeftContent.find(item => item.id === 'TryExperience');
|
|
40
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;
|
|
41
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]);
|
|
42
47
|
const isLowPhone = useMemo(() => {
|
|
43
|
-
var _isLowPhone, _tryExp$
|
|
48
|
+
var _isLowPhone, _tryExp$initProps4;
|
|
44
49
|
const tryExp = bottomLeftContent === null || bottomLeftContent === void 0 ? void 0 : bottomLeftContent.find(item => item.id === 'TryExperience');
|
|
45
|
-
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;
|
|
46
51
|
}, []);
|
|
47
52
|
const gRawData = useMemo(() => {
|
|
48
|
-
var _gRawData, _tryExp$
|
|
53
|
+
var _gRawData, _tryExp$initProps5;
|
|
49
54
|
const tryExp = bottomLeftContent === null || bottomLeftContent === void 0 ? void 0 : bottomLeftContent.find(item => item.id === 'TryExperience');
|
|
50
|
-
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;
|
|
51
56
|
}, [bottomLeftContent]);
|
|
52
57
|
const [shouldHide] = useComponentHideState();
|
|
53
58
|
const {
|
|
@@ -56,7 +61,7 @@ const BottomLeftContent = _ref => {
|
|
|
56
61
|
handleCountdownEnd
|
|
57
62
|
} = useTrialBadge(ctx.event, ctx.devId, trialRemainingSec);
|
|
58
63
|
const paddingLeftPx = screenType === 'vertical' ? 0 : 25;
|
|
59
|
-
const showBadge = showSmartImageQuality && showTrialBadge && canOpenSettings && gRawData && !isLowPhone && trialRemainingSec > 0;
|
|
64
|
+
const showBadge = showSmartImageQuality && showTrialBadge && canOpenSettings && gRawData && !isLowPhone && buttonState === 1 && trialRemainingSec > 0;
|
|
60
65
|
const bottomBarHeight = screenType === 'vertical' ? 40 : 58;
|
|
61
66
|
const badgeAreaHeight = screenType === 'vertical' ? BADGE_HEIGHT_VERTICAL : BADGE_HEIGHT_FULL;
|
|
62
67
|
const containerHeight = showBadge ? `${bottomBarHeight + badgeAreaHeight}px` : `${bottomBarHeight}px`;
|
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]);
|
|
@@ -551,6 +553,8 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
551
553
|
* 监听退出此player
|
|
552
554
|
*/
|
|
553
555
|
usePageEvent('onUnload', () => {
|
|
556
|
+
console.log('res===onUnload');
|
|
557
|
+
siqInitRef.current = false;
|
|
554
558
|
ipcTTTOperatorLog('hide: 调用停止录制方法');
|
|
555
559
|
setRecording(false, true);
|
|
556
560
|
setIntercom(false, true);
|
|
@@ -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);
|
|
@@ -85,6 +79,7 @@ export const TryExperience = props => {
|
|
|
85
79
|
}
|
|
86
80
|
}, [buttonState]);
|
|
87
81
|
const onTryExperience = useCallback(async () => {
|
|
82
|
+
console.log('res===onTryExperience', lockRef.current, isLowPhone);
|
|
88
83
|
if (lockRef.current) return;
|
|
89
84
|
if (isLowPhone) {
|
|
90
85
|
showToast({
|
|
@@ -104,7 +99,7 @@ export const TryExperience = props => {
|
|
|
104
99
|
try {
|
|
105
100
|
const getAI = await getAIFrameFeature(devId);
|
|
106
101
|
if (buttonState === TryExperienceStatus.Open) {
|
|
107
|
-
var _getAI$aiFrameFeature, _getAI$aiFrameFeature2, _getAI$aiFrameFeature3, _props$event
|
|
102
|
+
var _getAI$aiFrameFeature, _getAI$aiFrameFeature2, _getAI$aiFrameFeature3, _props$event;
|
|
108
103
|
// 由开变关的时候,只关inPreview
|
|
109
104
|
const scope = _objectSpread(_objectSpread({}, (_getAI$aiFrameFeature = getAI.aiFrameFeature) === null || _getAI$aiFrameFeature === void 0 ? void 0 : _getAI$aiFrameFeature.scope), {}, {
|
|
110
105
|
inPreview: false
|
|
@@ -120,10 +115,9 @@ export const TryExperience = props => {
|
|
|
120
115
|
exportEnabled: (_getAI$aiFrameFeature3 = getAI.aiFrameFeature) === null || _getAI$aiFrameFeature3 === void 0 ? void 0 : _getAI$aiFrameFeature3.exportEnabled
|
|
121
116
|
}
|
|
122
117
|
});
|
|
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);
|
|
118
|
+
(_props$event = props.event) === null || _props$event === void 0 || _props$event.emit(refreshSmartImageQualityEvent);
|
|
125
119
|
} else if (buttonState === TryExperienceStatus.Close && isPurchase || buttonState === TryExperienceStatus.Close && trialRemainingSec < 300 && trialRemainingSec > 0) {
|
|
126
|
-
var _getAI$aiFrameFeature4, _getAI$aiFrameFeature5, _getAI$aiFrameFeature6, _props$
|
|
120
|
+
var _getAI$aiFrameFeature4, _getAI$aiFrameFeature5, _getAI$aiFrameFeature6, _props$event2;
|
|
127
121
|
const scope = _objectSpread(_objectSpread({}, (_getAI$aiFrameFeature4 = getAI.aiFrameFeature) === null || _getAI$aiFrameFeature4 === void 0 ? void 0 : _getAI$aiFrameFeature4.scope), {}, {
|
|
128
122
|
inPreview: true
|
|
129
123
|
});
|
|
@@ -139,7 +133,7 @@ export const TryExperience = props => {
|
|
|
139
133
|
exportEnabled: (_getAI$aiFrameFeature6 = getAI.aiFrameFeature) === null || _getAI$aiFrameFeature6 === void 0 ? void 0 : _getAI$aiFrameFeature6.exportEnabled
|
|
140
134
|
}
|
|
141
135
|
});
|
|
142
|
-
(_props$
|
|
136
|
+
(_props$event2 = props.event) === null || _props$event2 === void 0 || _props$event2.emit(refreshSmartImageQualityEvent);
|
|
143
137
|
} else {
|
|
144
138
|
gotoAIDrawMiniProgram(devId, brandColor);
|
|
145
139
|
}
|