@eohjsc/react-native-smart-city 0.3.92 → 0.3.94

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 (87) hide show
  1. package/package.json +5 -1
  2. package/src/commons/ActionGroup/SliderRangeTemplate.js +2 -2
  3. package/src/commons/AlertAction/index.js +5 -0
  4. package/src/commons/BottomButtonView/index.js +22 -4
  5. package/src/commons/Button/index.js +5 -0
  6. package/src/commons/Device/ConnectedViewHeader.js +0 -1
  7. package/src/commons/Device/Emergency/EmergencyDetail.js +4 -2
  8. package/src/commons/Device/Emergency/__test__/EmergencyDetail.test.js +4 -2
  9. package/src/commons/Device/ProgressBar/index.js +3 -1
  10. package/src/commons/Device/ProgressBar/styles.js +1 -4
  11. package/src/commons/Device/WindSpeed/Anemometer/index.js +1 -1
  12. package/src/commons/Header/HeaderCustom.js +8 -18
  13. package/src/commons/SubUnit/OneTap/ItemOneTap.js +84 -129
  14. package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +74 -39
  15. package/src/commons/SubUnit/OneTap/index.js +24 -4
  16. package/src/commons/ViewButtonBottom/index.js +32 -4
  17. package/src/configs/API.js +4 -0
  18. package/src/configs/AccessibilityLabel.js +1 -0
  19. package/src/configs/BLE.js +1 -0
  20. package/src/context/actionType.ts +2 -1
  21. package/src/context/mockStore.ts +1 -0
  22. package/src/context/reducer.ts +12 -1
  23. package/src/hooks/Explore/useKeyboardAnimated.js +10 -4
  24. package/src/hooks/IoT/useBluetoothConnection.js +14 -26
  25. package/src/hooks/useMqtt.js +95 -0
  26. package/src/iot/Monitor.js +2 -1
  27. package/src/iot/RemoteControl/Bluetooth.js +56 -19
  28. package/src/iot/RemoteControl/__test__/Bluetooth.test.js +140 -0
  29. package/src/iot/mqtt.js +233 -0
  30. package/src/navigations/UnitStack.js +11 -3
  31. package/src/screens/AddLocationMaps/index.js +18 -16
  32. package/src/screens/AddLocationMaps/indexStyle.js +3 -0
  33. package/src/screens/AddNewGateway/ConnectingDevice.js +7 -0
  34. package/src/screens/AddNewGateway/RenameNewDevices.js +2 -2
  35. package/src/screens/AddNewGateway/SelectDeviceType.js +67 -9
  36. package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +35 -0
  37. package/src/screens/AddNewGateway/__test__/SelectDeviceType.test.js +183 -29
  38. package/src/screens/Automate/AddNewAction/NewActionWrapper.js +3 -6
  39. package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +29 -29
  40. package/src/screens/Automate/AddNewAction/__test__/SetupSensor.test.js +45 -39
  41. package/src/screens/Automate/AddNewAutoSmart/AddAutomationTypeSmart.js +25 -0
  42. package/src/screens/{AddNewAutoSmart/index.js → Automate/AddNewAutoSmart/AddTypeSmart.js} +16 -51
  43. package/src/screens/Automate/AddNewAutoSmart/AddUnknownTypeSmart.js +29 -0
  44. package/src/screens/{AddNewAutoSmart → Automate/AddNewAutoSmart}/__test__/AddNewAutoSmart.test.js +11 -11
  45. package/src/screens/{AddNewAutoSmart → Automate/AddNewAutoSmart}/styles/AddNewAutoSmartStyles.js +1 -1
  46. package/src/screens/Automate/Components/InputNameStyles.js +1 -1
  47. package/src/screens/Automate/EditActionsList/__tests__/index.test.js +11 -25
  48. package/src/screens/Automate/EditActionsList/index.js +32 -33
  49. package/src/screens/Automate/MultiUnits.js +29 -19
  50. package/src/screens/Automate/ScriptDetail/__test__/index.test.js +78 -5
  51. package/src/screens/Automate/ScriptDetail/index.js +38 -10
  52. package/src/screens/Automate/Styles/MultiUnitsStyles.js +1 -1
  53. package/src/screens/Automate/__test__/MultiUnits.test.js +64 -7
  54. package/src/screens/Automate/__test__/index.test.js +45 -11
  55. package/src/screens/Automate/index.js +53 -38
  56. package/src/screens/Device/__test__/detail.test.js +1 -1
  57. package/src/screens/Device/__test__/mqttDetail.test.js +599 -0
  58. package/src/screens/Device/components/SensorDisplayItem.js +1 -7
  59. package/src/screens/Device/detail.js +64 -30
  60. package/src/screens/Device/hooks/__test__/useEvaluateValue.test.js +24 -1
  61. package/src/screens/Device/hooks/useDeviceWatchConfigControl.js +13 -3
  62. package/src/screens/SelectUnit/__test__/index.test.js +8 -13
  63. package/src/screens/Sharing/InfoMemberUnit.js +2 -2
  64. package/src/screens/Sharing/MemberList.js +28 -7
  65. package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +32 -18
  66. package/src/screens/Sharing/__test__/MemberList.test.js +37 -4
  67. package/src/screens/SmartAccount/__test__/SmartAccount.test.js +8 -4
  68. package/src/screens/SmartAccount/index.js +8 -9
  69. package/src/screens/SmartAccount/style.js +8 -7
  70. package/src/screens/Unit/AddMenu.js +42 -19
  71. package/src/screens/Unit/Detail.js +4 -19
  72. package/src/screens/Unit/Summaries.js +6 -17
  73. package/src/screens/Unit/__test__/AddMenu.test.js +68 -15
  74. package/src/screens/Unit/__test__/Summaries.test.js +2 -2
  75. package/src/screens/Unit/components/AutomateScript/index.js +1 -1
  76. package/src/utils/FactoryGateway.js +525 -0
  77. package/src/utils/I18n/translations/en.js +1409 -0
  78. package/src/utils/I18n/translations/vi.js +1411 -0
  79. package/src/utils/I18n/translations.ts +2 -2
  80. package/src/utils/Permission/backend.js +7 -0
  81. package/src/utils/Route/index.js +2 -1
  82. package/src/utils/Utils.js +11 -0
  83. package/src/commons/Device/SensorConnectedStatus.js +0 -56
  84. package/src/commons/Device/__test__/SensorConnectedStatus.test.js +0 -29
  85. package/src/screens/Sharing/__test__/MemberList2.test.js +0 -74
  86. package/src/utils/I18n/translations/en.json +0 -1138
  87. package/src/utils/I18n/translations/vi.json +0 -1136
@@ -0,0 +1,525 @@
1
+ export const configDataFactory = {
2
+ id: 128282,
3
+ status_texts: [],
4
+ is_on: false,
5
+ get_value_unit: '0 ',
6
+ period_configs: [],
7
+ auto_triggers: [],
8
+ spotsensorconnect: null,
9
+ last_maxmin: {
10
+ id: 15772,
11
+ config_id: 128282,
12
+ max: 1,
13
+ min: 0,
14
+ created_at: '2022-12-06',
15
+ min_created_at: '2022-12-06T00:11:22.798649Z',
16
+ max_created_at: '2022-12-06T00:11:48.587128Z',
17
+ },
18
+ user_receive_email: [],
19
+ phone_send_sms: [],
20
+ status_configuration: {},
21
+ is_auto_release: false,
22
+ active: true,
23
+ name: 'Led',
24
+ is_read: true,
25
+ is_write: true,
26
+ range_min: 0,
27
+ range_max: 0,
28
+ unit: '',
29
+ scale: 0.1,
30
+ is_main: true,
31
+ is_chart: true,
32
+ is_report: true,
33
+ is_chart_column: false,
34
+ is_hide: false,
35
+ display_type: '',
36
+ is_alarm: false,
37
+ email_flags: false,
38
+ time_is_over: null,
39
+ is_update_value_when_change: false,
40
+ maintain_time: 5,
41
+ number_send_email: null,
42
+ period_send_email: 15,
43
+ allow_min_value: 0,
44
+ allow_max_value: 0,
45
+ message: 'Th\\u00f4ng b\\u00e1o.',
46
+ last_time_send_email: null,
47
+ ai_trans_offset_value: '0.000',
48
+ ai_trans_average_sample: 0,
49
+ last_values: [],
50
+ icon: '',
51
+ scale_write: 1,
52
+ lock: false,
53
+ flag: false,
54
+ index: 0,
55
+ decimal_behind: 1,
56
+ active_filter: '',
57
+ high_level: 0,
58
+ low_level: 0,
59
+ value_converter: '',
60
+ ack: false,
61
+ sensor_type: '',
62
+ enable_log_max_min: true,
63
+ log_value_mode: 1,
64
+ freq_log_data: 600,
65
+ release_time: 0,
66
+ sensor: 35440,
67
+ end_device: null,
68
+ last_value: null,
69
+ last_value_log: null,
70
+ };
71
+
72
+ export const gatewayDataFactory = {
73
+ code: 'code-123',
74
+ name: 'Son chip - esp32 2',
75
+ mqtt_server: {
76
+ host: 'example.cloudmqtt.com',
77
+ allow_frontend_connect: true,
78
+ websocket_port: 443,
79
+ },
80
+ sensors: [
81
+ {
82
+ id: 35441,
83
+ configs: [
84
+ {
85
+ id: 128282,
86
+ status_texts: [],
87
+ is_on: false,
88
+ get_value_unit: '0 ',
89
+ period_configs: [],
90
+ auto_triggers: [],
91
+ spotsensorconnect: null,
92
+ last_maxmin: {
93
+ id: 15772,
94
+ config_id: 128282,
95
+ max: 1,
96
+ min: 0,
97
+ created_at: '2022-12-06',
98
+ min_created_at: '2022-12-06T00:11:22.798649Z',
99
+ max_created_at: '2022-12-06T00:11:48.587128Z',
100
+ },
101
+ user_receive_email: [],
102
+ phone_send_sms: [],
103
+ status_configuration: {},
104
+ is_auto_release: false,
105
+ active: true,
106
+ name: 'Led',
107
+ is_read: true,
108
+ is_write: true,
109
+ range_min: 0,
110
+ range_max: 0,
111
+ unit: '',
112
+ scale: 1,
113
+ is_main: true,
114
+ is_chart: true,
115
+ is_report: true,
116
+ is_chart_column: false,
117
+ is_hide: false,
118
+ display_type: '',
119
+ is_alarm: false,
120
+ email_flags: false,
121
+ time_is_over: null,
122
+ is_update_value_when_change: false,
123
+ maintain_time: 5,
124
+ number_send_email: null,
125
+ period_send_email: 15,
126
+ allow_min_value: 0,
127
+ allow_max_value: 0,
128
+ message: 'Th\\u00f4ng b\\u00e1o.',
129
+ last_time_send_email: null,
130
+ ai_trans_offset_value: '0.000',
131
+ ai_trans_average_sample: 0,
132
+ last_values: [],
133
+ icon: '',
134
+ scale_write: 1,
135
+ lock: false,
136
+ flag: false,
137
+ index: 0,
138
+ decimal_behind: null,
139
+ active_filter: '',
140
+ high_level: 0,
141
+ low_level: 0,
142
+ value_converter: '',
143
+ ack: false,
144
+ sensor_type: '',
145
+ enable_log_max_min: true,
146
+ log_value_mode: 1,
147
+ freq_log_data: 600,
148
+ release_time: 0,
149
+ sensor: 35440,
150
+ end_device: null,
151
+ last_value: null,
152
+ last_value_log: null,
153
+ },
154
+ ],
155
+ active: true,
156
+ name: 'Device Led',
157
+ mix: true,
158
+ index: 0,
159
+ icon: '',
160
+ is_managed_by_backend: true,
161
+ device_id: '',
162
+ last_updated: null,
163
+ connection_time: 30,
164
+ sent_email: false,
165
+ device_type: '',
166
+ is_reading_device: false,
167
+ realtime_monitoring: false,
168
+ station: null,
169
+ chip: 7689,
170
+ icon_kit: null,
171
+ },
172
+ {
173
+ id: 35466,
174
+ configs: [
175
+ {
176
+ id: 128323,
177
+ status_texts: [],
178
+ is_on: false,
179
+ get_value_unit: '56.9 %',
180
+ period_configs: [],
181
+ auto_triggers: [],
182
+ spotsensorconnect: null,
183
+ last_maxmin: {
184
+ id: 15843,
185
+ config_id: 128323,
186
+ max: 60.8,
187
+ min: 0,
188
+ created_at: '2022-12-07',
189
+ min_created_at: '2022-12-07T17:44:10.864589Z',
190
+ max_created_at: '2022-12-07T17:54:43.580269Z',
191
+ },
192
+ user_receive_email: [],
193
+ phone_send_sms: [],
194
+ status_configuration: {},
195
+ is_auto_release: false,
196
+ active: true,
197
+ name: 'Do am',
198
+ is_read: true,
199
+ is_write: false,
200
+ range_min: 0,
201
+ range_max: 0,
202
+ unit: '%',
203
+ scale: 0.1,
204
+ is_main: true,
205
+ is_chart: true,
206
+ is_report: true,
207
+ is_chart_column: false,
208
+ is_hide: false,
209
+ display_type: '',
210
+ is_alarm: false,
211
+ email_flags: false,
212
+ time_is_over: null,
213
+ is_update_value_when_change: false,
214
+ maintain_time: 5,
215
+ number_send_email: null,
216
+ period_send_email: 15,
217
+ allow_min_value: 0,
218
+ allow_max_value: 0,
219
+ message: 'Th\\u00f4ng b\\u00e1o.',
220
+ last_time_send_email: null,
221
+ ai_trans_offset_value: '0.000',
222
+ ai_trans_average_sample: 0,
223
+ last_values: [],
224
+ icon: '',
225
+ scale_write: 1,
226
+ lock: false,
227
+ flag: false,
228
+ index: 0,
229
+ decimal_behind: 1,
230
+ active_filter: '',
231
+ high_level: 0,
232
+ low_level: 0,
233
+ value_converter: '',
234
+ ack: false,
235
+ sensor_type: '',
236
+ enable_log_max_min: true,
237
+ log_value_mode: 1,
238
+ freq_log_data: 600,
239
+ release_time: 0,
240
+ sensor: 35466,
241
+ end_device: null,
242
+ last_value: null,
243
+ last_value_log: null,
244
+ },
245
+ {
246
+ id: 128324,
247
+ status_texts: [],
248
+ is_on: false,
249
+ get_value_unit: '27 *C',
250
+ period_configs: [],
251
+ auto_triggers: [],
252
+ spotsensorconnect: null,
253
+ last_maxmin: {
254
+ id: 15844,
255
+ config_id: 128324,
256
+ max: 27,
257
+ min: 0,
258
+ created_at: '2022-12-07',
259
+ min_created_at: '2022-12-07T17:44:10.864589Z',
260
+ max_created_at: '2022-12-07T17:49:53.430263Z',
261
+ },
262
+ user_receive_email: [],
263
+ phone_send_sms: [],
264
+ status_configuration: {},
265
+ is_auto_release: false,
266
+ active: true,
267
+ name: 'Nhiet do',
268
+ is_read: true,
269
+ is_write: false,
270
+ range_min: 0,
271
+ range_max: 0,
272
+ unit: '*C',
273
+ scale: 0.1,
274
+ is_main: true,
275
+ is_chart: true,
276
+ is_report: true,
277
+ is_chart_column: false,
278
+ is_hide: false,
279
+ display_type: '',
280
+ is_alarm: false,
281
+ email_flags: false,
282
+ time_is_over: null,
283
+ is_update_value_when_change: false,
284
+ maintain_time: 5,
285
+ number_send_email: null,
286
+ period_send_email: 15,
287
+ allow_min_value: 0,
288
+ allow_max_value: 0,
289
+ message: 'Th\\u00f4ng b\\u00e1o.',
290
+ last_time_send_email: null,
291
+ ai_trans_offset_value: '0.000',
292
+ ai_trans_average_sample: 0,
293
+ last_values: [],
294
+ icon: '',
295
+ scale_write: 1,
296
+ lock: false,
297
+ flag: false,
298
+ index: 0,
299
+ decimal_behind: 1,
300
+ active_filter: '',
301
+ high_level: 0,
302
+ low_level: 0,
303
+ value_converter: '',
304
+ ack: false,
305
+ sensor_type: '',
306
+ enable_log_max_min: true,
307
+ log_value_mode: 1,
308
+ freq_log_data: 600,
309
+ release_time: 0,
310
+ sensor: 35466,
311
+ end_device: null,
312
+ last_value: null,
313
+ last_value_log: null,
314
+ },
315
+ ],
316
+ active: true,
317
+ name: 'Device Temp - Humi',
318
+ mix: true,
319
+ index: 0,
320
+ icon: '',
321
+ is_managed_by_backend: true,
322
+ device_id: '',
323
+ last_updated: null,
324
+ connection_time: 60,
325
+ sent_email: false,
326
+ device_type: '',
327
+ is_reading_device: false,
328
+ realtime_monitoring: false,
329
+ station: null,
330
+ chip: 7689,
331
+ icon_kit: null,
332
+ },
333
+ {
334
+ // zigbee
335
+ id: 123,
336
+ configs: [
337
+ {
338
+ id: 111,
339
+ status_texts: [],
340
+ is_on: false,
341
+ get_value_unit: '0 ',
342
+ period_configs: [],
343
+ auto_triggers: [],
344
+ spotsensorconnect: null,
345
+ last_maxmin: {
346
+ id: 15772,
347
+ config_id: 128282,
348
+ max: 1,
349
+ min: 0,
350
+ created_at: '2022-12-06',
351
+ min_created_at: '2022-12-06T00:11:22.798649Z',
352
+ max_created_at: '2022-12-06T00:11:48.587128Z',
353
+ },
354
+ user_receive_email: [],
355
+ phone_send_sms: [],
356
+ status_configuration: {},
357
+ is_auto_release: false,
358
+ active: true,
359
+ name: 'Led',
360
+ is_read: true,
361
+ is_write: true,
362
+ range_min: 0,
363
+ range_max: 0,
364
+ unit: '',
365
+ scale: 1,
366
+ is_main: true,
367
+ is_chart: true,
368
+ is_report: true,
369
+ is_chart_column: false,
370
+ is_hide: false,
371
+ display_type: '',
372
+ is_alarm: false,
373
+ email_flags: false,
374
+ time_is_over: null,
375
+ is_update_value_when_change: false,
376
+ maintain_time: 5,
377
+ number_send_email: null,
378
+ period_send_email: 15,
379
+ allow_min_value: 0,
380
+ allow_max_value: 0,
381
+ message: 'Th\\u00f4ng b\\u00e1o.',
382
+ last_time_send_email: null,
383
+ ai_trans_offset_value: '0.000',
384
+ ai_trans_average_sample: 0,
385
+ last_values: [],
386
+ icon: '',
387
+ scale_write: 1,
388
+ lock: false,
389
+ flag: false,
390
+ index: 0,
391
+ decimal_behind: null,
392
+ active_filter: '',
393
+ high_level: 0,
394
+ low_level: 0,
395
+ value_converter: '',
396
+ ack: false,
397
+ sensor_type: '',
398
+ enable_log_max_min: true,
399
+ log_value_mode: 1,
400
+ freq_log_data: 600,
401
+ release_time: 0,
402
+ sensor: 123,
403
+ end_device: null,
404
+ last_value: null,
405
+ last_value_log: null,
406
+ },
407
+ ],
408
+ active: true,
409
+ name: 'Device Zigbee nhiet do',
410
+ mix: true,
411
+ index: 0,
412
+ icon: '',
413
+ is_managed_by_backend: true,
414
+ device_id: '',
415
+ last_updated: null,
416
+ connection_time: 30,
417
+ sent_email: false,
418
+ device_type: '',
419
+ is_reading_device: false,
420
+ realtime_monitoring: false,
421
+ station: null,
422
+ chip: 7689,
423
+ icon_kit: null,
424
+ },
425
+ ],
426
+ id: 7689,
427
+ sn: '57ae596e-ef65-4162-9b6f-4f67f2c86632',
428
+ interchange_throttle: 20,
429
+ is_wifi: false,
430
+ wifi_ssid: '',
431
+ wifi_pass: null,
432
+ phone: '',
433
+ wifi_is_using: null,
434
+ wifi_update_time: '12:56:44 05-12-2022',
435
+ is_success_new_wifi: false,
436
+ max_config: 10,
437
+ is_timer: false,
438
+ datetime_active: '2022-12-05',
439
+ sim_co: true,
440
+ message_expire: 'Th\\u00f4ng b\\u00e1o gia h\\u1ea1n Sim.',
441
+ is_hex: true,
442
+ conditional_config: null,
443
+ conditional_value: '0',
444
+ is_using_soft_interlock: false,
445
+ modbus_gateway: {
446
+ finalize_id: null,
447
+ baud_speed: 9600,
448
+ ip_master: null,
449
+ port: null,
450
+ sensors: [
451
+ {
452
+ add: 1,
453
+ ip_slave: null,
454
+ configs: [
455
+ {
456
+ id: 110425,
457
+ sa: 0,
458
+ len: 1,
459
+ func: 3,
460
+ sa1: 0,
461
+ sa2: 0,
462
+ len1: 0,
463
+ len2: 1,
464
+ ex: '0',
465
+ scale: 1,
466
+ time_is_over: null,
467
+ transformer: 'int_all',
468
+ ai_trans_max_value: 0,
469
+ ai_trans_min_value: 0,
470
+ ai_trans_max_raw_in: 0,
471
+ ai_trans_min_raw_in: 0,
472
+ scale_write: 1,
473
+ device: 24122,
474
+ config: 128323,
475
+ },
476
+ {
477
+ id: 110426,
478
+ sa: 1,
479
+ len: 1,
480
+ func: 3,
481
+ sa1: 0,
482
+ sa2: 1,
483
+ len1: 0,
484
+ len2: 1,
485
+ ex: '0',
486
+ scale: 1,
487
+ time_is_over: null,
488
+ transformer: 'int_all',
489
+ ai_trans_max_value: 0,
490
+ ai_trans_min_value: 0,
491
+ ai_trans_max_raw_in: 0,
492
+ ai_trans_min_raw_in: 0,
493
+ scale_write: 1,
494
+ device: 24122,
495
+ config: 128324,
496
+ },
497
+ ],
498
+ sensor_id: 35466,
499
+ },
500
+ ],
501
+ chip_id: 7689,
502
+ version: 9,
503
+ },
504
+ zigbee_gateway: {
505
+ id: 224,
506
+ sensors: [
507
+ {
508
+ id: 566,
509
+ configs: [
510
+ {
511
+ id: 1621,
512
+ key: 'temperature_measured',
513
+ device: 566,
514
+ config: 111,
515
+ },
516
+ ],
517
+ ieee_address: '0x00158d00022fd3c6',
518
+ model_name: 'lumi.weather',
519
+ gateway: 224,
520
+ sensor: 123,
521
+ },
522
+ ],
523
+ chip: 7682,
524
+ },
525
+ };