@ray-js/ipc-player-integration 0.0.35-beta.7 → 0.0.35-beta.9
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.
package/lib/ui/ui.js
CHANGED
|
@@ -446,8 +446,6 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
446
446
|
buttonState: res.buttonState,
|
|
447
447
|
trialRemainingSec: res.trialRemainingSec,
|
|
448
448
|
refreshToken: Date.now()
|
|
449
|
-
}).catch(() => {
|
|
450
|
-
// ignore
|
|
451
449
|
});
|
|
452
450
|
});
|
|
453
451
|
});
|
|
@@ -455,7 +453,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
455
453
|
if (playState === PlayState.PLAYING) {
|
|
456
454
|
refreshSmartImageQuality();
|
|
457
455
|
}
|
|
458
|
-
}, [playState]);
|
|
456
|
+
}, [instance, playState]);
|
|
459
457
|
const refreshBottomLeft = () => {
|
|
460
458
|
event.current.emit(startTimeToHideAllComponent);
|
|
461
459
|
event.current.emit(showAllComponent);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { View, Image, getSystemInfoSync } from '@ray-js/ray';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import React, { useState, useEffect } from 'react';
|
|
3
|
+
import React, { useState, useEffect, useCallback } from 'react';
|
|
4
4
|
import { useStore } from '../../ctx/store';
|
|
5
5
|
import { gotoAIDrawMiniProgram } from '../../utils';
|
|
6
6
|
import tryZh from '../../res/try/try_zh.png';
|
|
@@ -33,8 +33,9 @@ const pickIconByStatus = buttonState => {
|
|
|
33
33
|
case TryExperienceStatus.Close:
|
|
34
34
|
return tryClose;
|
|
35
35
|
case TryExperienceStatus.Default:
|
|
36
|
-
default:
|
|
37
36
|
return getDefaultLangIcon();
|
|
37
|
+
default:
|
|
38
|
+
return '';
|
|
38
39
|
}
|
|
39
40
|
};
|
|
40
41
|
export const TryExperience = props => {
|
|
@@ -55,22 +56,23 @@ export const TryExperience = props => {
|
|
|
55
56
|
const iconUrl = pickIconByStatus(buttonState);
|
|
56
57
|
setImgSrc(iconUrl);
|
|
57
58
|
}, [buttonState]);
|
|
59
|
+
const onTryExperience = useCallback(() => {
|
|
60
|
+
if (buttonState === TryExperienceStatus.Open) {
|
|
61
|
+
setImgSrc(tryOpen);
|
|
62
|
+
} else if (buttonState === TryExperienceStatus.Close && isPurchase) {
|
|
63
|
+
setImgSrc(tryClose);
|
|
64
|
+
} else if (buttonState === TryExperienceStatus.Close && trialRemainingSec < 300 && trialRemainingSec > 0) {
|
|
65
|
+
setImgSrc(tryClose);
|
|
66
|
+
} else {
|
|
67
|
+
gotoAIDrawMiniProgram(props.devId, brandColor);
|
|
68
|
+
}
|
|
69
|
+
}, [buttonState]);
|
|
58
70
|
if (hideTryExperienceMenu) {
|
|
59
71
|
return null;
|
|
60
72
|
}
|
|
61
73
|
return /*#__PURE__*/React.createElement(View, {
|
|
62
74
|
className: clsx(className),
|
|
63
|
-
onClick:
|
|
64
|
-
if (buttonState === TryExperienceStatus.Open) {
|
|
65
|
-
setImgSrc(tryOpen);
|
|
66
|
-
} else if (buttonState === TryExperienceStatus.Close && isPurchase) {
|
|
67
|
-
setImgSrc(tryClose);
|
|
68
|
-
} else if (buttonState === TryExperienceStatus.Close && trialRemainingSec < 300 && trialRemainingSec > 0) {
|
|
69
|
-
setImgSrc(tryClose);
|
|
70
|
-
} else {
|
|
71
|
-
gotoAIDrawMiniProgram(props.devId, brandColor);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
75
|
+
onClick: onTryExperience
|
|
74
76
|
}, /*#__PURE__*/React.createElement(View, {
|
|
75
77
|
className: "try-experience-box"
|
|
76
78
|
}, imgSrc && /*#__PURE__*/React.createElement(Image, {
|