@ray-js/ray-ipc-player 2.0.21-beta-1 → 2.0.21-beta-2

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 (2) hide show
  1. package/lib/index.js +17 -15
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -170,21 +170,7 @@ const Player = props => {
170
170
  }
171
171
  }
172
172
  });
173
- onDpDataChange(res => {
174
- if (res.deviceId === devId) {
175
- const dpsInfo = res.dps;
176
- const arr = Object.keys(dpsInfo);
177
- if (arr.length === 1) {
178
- const dpId = +arr[0];
179
- const dpValue = dpsInfo[arr[0]];
180
- // 这里的 149 为固定 dpId, 无需进行根据 code 获取
181
- if (dpId === 149 && !dpValue) {
182
- // 进入到面板中,低功耗产品上报休眠, 进行标记
183
- setWirelessFlag(true);
184
- }
185
- }
186
- }
187
- });
173
+ onDpDataChange(handleDpDataChange);
188
174
  }, []);
189
175
  usePageEvent('onHide', async () => {
190
176
  setPlayState(d => {
@@ -204,6 +190,22 @@ const Player = props => {
204
190
  console.log(res);
205
191
  });
206
192
  });
193
+ const handleDpDataChange = useMemoizedFn(res => {
194
+ if (res.deviceId === devId) {
195
+ const dpsInfo = res.dps;
196
+ const arr = Object.keys(dpsInfo);
197
+ if (arr.length === 1) {
198
+ const dpId = +arr[0];
199
+ const dpValue = dpsInfo[arr[0]];
200
+ console.log(privateState, 'privateState');
201
+ // 这里的 149 为固定 dpId, 无需进行根据 code 获取
202
+ if (dpId === 149 && !dpValue && !privateState) {
203
+ // 进入到面板中,低功耗产品上报休眠, 进行标记
204
+ setWirelessFlag(true);
205
+ }
206
+ }
207
+ }
208
+ });
207
209
  const handleMqttMessage = useMemoizedFn(event => {
208
210
  var _event$messageData;
209
211
  if ((event === null || event === void 0 ? void 0 : event.protocol) === 1 && event !== null && event !== void 0 && (_event$messageData = event.messageData) !== null && _event$messageData !== void 0 && _event$messageData.online) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ray-ipc-player",
3
- "version": "2.0.21-beta-1",
3
+ "version": "2.0.21-beta-2",
4
4
  "description": "ray小程序播放器",
5
5
  "keywords": [
6
6
  "tuya-miniapp",