@ledvance/ui-biz-bundle 1.0.80 → 1.0.81
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/package.json
CHANGED
|
@@ -8,6 +8,7 @@ import { Formatter } from '@tuya/tuya-panel-lamp-sdk'
|
|
|
8
8
|
import { DreamMusicDataType, dreamMusicData } from './MusicDataBean'
|
|
9
9
|
import { Result } from '@ledvance/base/src/models/modules/Result'
|
|
10
10
|
import { NativeApi } from '@ledvance/base/src/api/native'
|
|
11
|
+
import { parseJSON } from '@tuya/tuya-panel-lamp-sdk/lib/utils'
|
|
11
12
|
const DreamMusicFormatter = new Formatter.DreamLightMicMusicFormatter()
|
|
12
13
|
export const useEnable = (dpKey: string) => {
|
|
13
14
|
return useDp(dpKey)
|
|
@@ -126,13 +127,14 @@ export const useDreamMusic = (dpKey: string): [DreamLightMicMusicData | "", (mus
|
|
|
126
127
|
|
|
127
128
|
export const getRemoteDreamMusic = async (devId: string) => {
|
|
128
129
|
const res = await NativeApi.getJson(devId, 'dreamlightmic_music_data')
|
|
129
|
-
|
|
130
|
+
const cloudData = Array.isArray(parseJSON(res?.data)) && parseJSON(res?.data) || []
|
|
131
|
+
if (res.success && cloudData?.length) {
|
|
130
132
|
return {
|
|
131
133
|
success: true,
|
|
132
|
-
data:
|
|
134
|
+
data: cloudData.map(item => remoteDreamMusicUIState(item)),
|
|
133
135
|
}
|
|
134
136
|
} else {
|
|
135
|
-
if (res.msg?.includes('资源未找到')) {
|
|
137
|
+
if (res.msg?.includes('资源未找到') || cloudData?.length === 0) {
|
|
136
138
|
const res = await NativeApi.putJson(devId, 'dreamlightmic_music_data', JSON.stringify(dreamMusicData))
|
|
137
139
|
if (res.success) {
|
|
138
140
|
return {
|
|
@@ -21,6 +21,7 @@ import { useDispatch } from 'react-redux'
|
|
|
21
21
|
import res from '@ledvance/base/src/res'
|
|
22
22
|
import { SCENE } from '../../hooks/DeviceDpStateHooks'
|
|
23
23
|
import { Utils } from '@tuya/tuya-panel-lamp-sdk'
|
|
24
|
+
import { parseJSON } from '@tuya/tuya-panel-lamp-sdk/lib/utils'
|
|
24
25
|
const { nToHS, toFixed, sToN } = Utils
|
|
25
26
|
type SetRemoteSceneListType = (
|
|
26
27
|
deviceId: string,
|
|
@@ -425,13 +426,14 @@ type LampType = {
|
|
|
425
426
|
}
|
|
426
427
|
export async function getRemoteFantasyScene(featureId: string, devId: string, lampType: LampType) {
|
|
427
428
|
const res = await NativeApi.getJson(devId, featureId)
|
|
428
|
-
|
|
429
|
+
const cloudData = Array.isArray(parseJSON(res?.data)) && parseJSON(res?.data) || []
|
|
430
|
+
if (res.success && cloudData?.length) {
|
|
429
431
|
return {
|
|
430
432
|
success: true,
|
|
431
433
|
data: JSON.parse(res.data)?.map(item => remoteFantasySceneInfo2SceneUIState(item, lampType.isStringLight)),
|
|
432
434
|
}
|
|
433
435
|
} else {
|
|
434
|
-
if (res.msg?.includes('资源未找到')) {
|
|
436
|
+
if (res.msg?.includes('资源未找到') || cloudData?.length === 0) {
|
|
435
437
|
const defaultScene = getDefFantasyScene(lampType)
|
|
436
438
|
const res = await NativeApi.putJson(devId, featureId, JSON.stringify(defaultScene))
|
|
437
439
|
if (res.success) {
|
|
@@ -309,7 +309,7 @@ const TimerPage = () => {
|
|
|
309
309
|
<View style={{ marginVertical: cx(30) }}>
|
|
310
310
|
<Text>
|
|
311
311
|
{I18n.formatValue(
|
|
312
|
-
runningTimer()[0].enable
|
|
312
|
+
runningTimer()[0].enable ?
|
|
313
313
|
runningTimer()[0].stringOff :
|
|
314
314
|
runningTimer()[0].stringOn, getSingleLightEndTimeString(runningTimer()[0].progressHook.countdown)
|
|
315
315
|
)}
|