@eohjsc/react-native-smart-city 0.2.86 → 0.2.89

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 (126) hide show
  1. package/assets/images/Common/Calendar.svg +3 -0
  2. package/assets/images/Common/SmartPhone.svg +3 -0
  3. package/assets/images/Hanet/CaptureFaceID.svg +25 -0
  4. package/assets/images/Hanet/FaceFrame.svg +6 -0
  5. package/assets/images/brightnessBlack.svg +12 -0
  6. package/index.js +4 -0
  7. package/package.json +3 -3
  8. package/src/Images/SmartIr/AC.svg +14 -0
  9. package/src/Images/SmartIr/DIY.svg +3 -0
  10. package/src/Images/SmartIr/Fan.svg +10 -0
  11. package/src/Images/SmartIr/Fridge.svg +5 -0
  12. package/src/Images/SmartIr/Remote.svg +15 -0
  13. package/src/Images/SmartIr/SmartIr.svg +4 -0
  14. package/src/Images/SmartIr/TV.svg +10 -0
  15. package/src/Images/SmartIr/Union.svg +9 -0
  16. package/src/Images/SmartIr/WM.svg +11 -0
  17. package/src/Images/SmartIr/index.js +10 -0
  18. package/src/commons/ActionGroup/ColorPickerTemplate.js +51 -0
  19. package/src/commons/ActionGroup/ColorPickerTemplateStyles.js +17 -0
  20. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/AutoLockStyles.js +40 -0
  21. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapper.js +65 -0
  22. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapperStyles.js +43 -0
  23. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/__test__/index.test.js +48 -0
  24. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/index.js +57 -0
  25. package/src/commons/ActionGroup/{OnOffSmartLock.js → OnOffSmartLock/OnOffSmartLock.js} +5 -5
  26. package/src/commons/ActionGroup/{OnOffSmartLockStyle.js → OnOffSmartLock/OnOffSmartLockStyle.js} +1 -1
  27. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscode.js +48 -0
  28. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscodeStyles.js +42 -0
  29. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/PasscodeListStyles.js +49 -0
  30. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +66 -0
  31. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/ButtonWrapper.js +96 -0
  32. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/SetupGeneratePasscodeStyles.js +98 -0
  33. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +62 -0
  34. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/index.js +249 -0
  35. package/src/commons/ActionGroup/OnOffTemplate/index.js +4 -2
  36. package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +2 -1
  37. package/src/commons/ActionGroup/SliderRangeTemplate.js +64 -0
  38. package/src/commons/ActionGroup/{LightActionTemplateStyles.js → SliderRangeTemplateStyles.js} +0 -8
  39. package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +167 -186
  40. package/src/commons/ActionGroup/StatesGridActionTemplate.js +2 -1
  41. package/src/commons/ActionGroup/index.js +7 -4
  42. package/src/commons/BottomSheet/index.js +2 -1
  43. package/src/commons/Device/DisconnectedView.js +7 -1
  44. package/src/commons/Device/Hanet/ItemHanetDevice.js +109 -0
  45. package/src/commons/Device/HistoryChart.js +2 -2
  46. package/src/commons/Device/HorizontalBarChart.js +7 -0
  47. package/src/commons/Device/ItemDevice.js +18 -15
  48. package/src/commons/Device/LinearChart.js +14 -41
  49. package/src/commons/Device/__test__/DisconnectedView.test.js +13 -2
  50. package/src/commons/RowItem/index.js +12 -7
  51. package/src/commons/SubUnit/Favorites/index.js +2 -2
  52. package/src/commons/SubUnit/ShortDetail.js +39 -20
  53. package/src/commons/WheelDateTimePicker/index.js +18 -4
  54. package/src/configs/API.js +23 -1
  55. package/src/configs/Colors.js +1 -0
  56. package/src/configs/Constants.js +48 -0
  57. package/src/configs/SCConfig.js +1 -1
  58. package/src/context/actionType.ts +4 -0
  59. package/src/context/mockStore.ts +3 -0
  60. package/src/context/reducer.ts +20 -0
  61. package/src/iot/RemoteControl/Bluetooth.js +3 -22
  62. package/src/iot/RemoteControl/index.js +0 -1
  63. package/src/navigations/HanetCameraStack.js +41 -0
  64. package/src/navigations/SmartIrStack.js +31 -0
  65. package/src/navigations/SmartLockStack.js +51 -0
  66. package/src/navigations/UnitStack.js +46 -4
  67. package/src/screens/ActivityLog/hooks/index.js +1 -1
  68. package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +1 -1
  69. package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +79 -72
  70. package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +155 -27
  71. package/src/screens/AddNewGateway/PlugAndPlay/__test__/ConnectWifiWarning.test.js +65 -0
  72. package/src/screens/AddNewGateway/PlugAndPlay/__test__/GatewayWifiList.test.js +26 -2
  73. package/src/screens/Device/__test__/detail.test.js +0 -10
  74. package/src/screens/Device/components/SensorConnectStatusViewHeader.js +13 -2
  75. package/src/screens/Device/detail.js +118 -38
  76. package/src/screens/Device/hooks/useDisconnectedDevice.js +28 -16
  77. package/src/screens/GuestInfo/components/AccessScheduleItem.js +9 -2
  78. package/src/screens/GuestInfo/components/RecurringDetail.js +3 -2
  79. package/src/screens/GuestInfo/components/TemporaryDetail.js +3 -2
  80. package/src/screens/GuestInfo/styles/AccessScheduleItemStyles.js +3 -0
  81. package/src/screens/HanetCamera/CaptureFaceID.js +210 -0
  82. package/src/screens/HanetCamera/Detail.js +252 -0
  83. package/src/screens/HanetCamera/ManageAccess.js +173 -0
  84. package/src/screens/HanetCamera/MemberInfo.js +208 -0
  85. package/src/screens/HanetCamera/__test__/CaptureFaceID.test.js +133 -0
  86. package/src/screens/HanetCamera/__test__/Detail.test.js +185 -0
  87. package/src/screens/HanetCamera/__test__/ManageAccess.test.js +152 -0
  88. package/src/screens/HanetCamera/__test__/MemberInfo.test.js +178 -0
  89. package/src/screens/HanetCamera/components/CheckinHeader.js +37 -0
  90. package/src/screens/HanetCamera/hooks/__test__/useHanetCheckinData.test.js +151 -0
  91. package/src/screens/HanetCamera/hooks/__test__/useHanetPlaceMembers.test.js +71 -0
  92. package/src/screens/HanetCamera/hooks/index.js +5 -0
  93. package/src/screens/HanetCamera/hooks/useHanetCheckinData.js +116 -0
  94. package/src/screens/HanetCamera/hooks/useHanetPlaceMembers.js +86 -0
  95. package/src/screens/HanetCamera/hooks/useStateAlertAction.js +62 -0
  96. package/src/screens/HanetCamera/styles/captureFaceIDStyles.js +50 -0
  97. package/src/screens/HanetCamera/styles/checkinHeaderStyles.js +24 -0
  98. package/src/screens/HanetCamera/styles/detailStyles.js +107 -0
  99. package/src/screens/HanetCamera/styles/manageAccessStyles.js +49 -0
  100. package/src/screens/HanetCamera/styles/memberInfoStyles.js +73 -0
  101. package/src/screens/HanetCamera/utils/Monitor.js +52 -0
  102. package/src/screens/Notification/__test__/NotificationItem.test.js +1 -0
  103. package/src/screens/Notification/components/NotificationItem.js +16 -0
  104. package/src/screens/SmartIr/__test__/ButtonsBottom.test.js +31 -0
  105. package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +80 -0
  106. package/src/screens/SmartIr/__test__/SelectBrand.test.js +65 -0
  107. package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +57 -0
  108. package/src/screens/SmartIr/__test__/SmartIr.test.js +1 -0
  109. package/src/screens/SmartIr/components/GroupButtonByType/ButtonsBottom.js +45 -0
  110. package/src/screens/SmartIr/components/GroupButtonByType/ButtonsBottomStyles.js +31 -0
  111. package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +208 -0
  112. package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByTypeStyles.js +113 -0
  113. package/src/screens/SmartIr/components/SelectBrand.js +61 -0
  114. package/src/screens/SmartIr/components/SelectBrandStyles.js +14 -0
  115. package/src/screens/SmartIr/components/SelectDeviceType.js +96 -0
  116. package/src/screens/SmartIr/components/SelectDeviceTypeStyles.js +30 -0
  117. package/src/screens/SmartIr/index.js +8 -3
  118. package/src/screens/Unit/Detail.js +7 -11
  119. package/src/screens/Unit/__test__/Detail.test.js +0 -10
  120. package/src/screens/Unit/components/MyUnitDevice/index.js +2 -4
  121. package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +38 -9
  122. package/src/utils/I18n/translations/en.json +51 -1
  123. package/src/utils/I18n/translations/vi.json +51 -1
  124. package/src/utils/Route/index.js +14 -1
  125. package/src/commons/ActionGroup/LightActionTemplate.js +0 -103
  126. package/src/commons/ActionGroup/__test__/LightActionTemplate.test.js +0 -59
@@ -47,46 +47,9 @@ const chartOptions = {
47
47
  text: '',
48
48
  },
49
49
  labels: {
50
- formatter: function (value) {
51
- const time = new Date(this.value || value);
52
- let date = ('0' + time.getDate()).slice(-2);
53
- let month = ('0' + (time.getMonth() + 1)).slice(-2);
54
- return `${date}.${month}`;
55
- },
56
- },
57
- minRange: 3600 * 24 * 1000,
58
- tickInterval: 24 * 3600 * 1000,
59
- },
60
- plotOptions: {
61
- series: {
62
- events: {
63
- legendItemClick: function () {
64
- const { index, visible, chart } = this;
65
- const { series } = chart;
66
- series.forEach((serie, i) => {
67
- if (i !== index) {
68
- serie.visible ? serie.show() : serie.hide();
69
- }
70
- });
71
- const isHiding = (serie, i) => {
72
- if (i === index) {
73
- return visible;
74
- }
75
- return !serie.visible;
76
- };
77
- if (this.chart.series.every(isHiding)) {
78
- this.chart.yAxis[0].update({
79
- min: 0,
80
- max: 100,
81
- });
82
- } else {
83
- this.chart.yAxis[0].update({
84
- min: undefined,
85
- max: undefined,
86
- });
87
- }
88
- },
89
- },
50
+ align: 'center',
51
+ padding: 70,
52
+ format: '{value:%d.%m %H:%M}',
90
53
  },
91
54
  },
92
55
  };
@@ -126,7 +89,11 @@ function LinearChart({ datas }) {
126
89
 
127
90
  return (
128
91
  <View style={styles.container}>
129
- <HighchartsReactNative styles={styles.chartStyle} options={options} />
92
+ <HighchartsReactNative
93
+ styles={styles.chartStyle}
94
+ webviewStyles={styles.webviewStyle}
95
+ options={options}
96
+ />
130
97
  </View>
131
98
  );
132
99
  }
@@ -145,4 +112,10 @@ const styles = StyleSheet.create({
145
112
  backgroundColor: Colors.White,
146
113
  flex: 1,
147
114
  },
115
+ webviewStyle: {
116
+ flex: 1,
117
+ minHeight: 200,
118
+ height: 300,
119
+ opacity: 0.99,
120
+ },
148
121
  });
@@ -5,9 +5,9 @@ import renderer, { act } from 'react-test-renderer';
5
5
  import { SCProvider } from '../../../context';
6
6
  import { mockSCStore } from '../../../context/mockStore';
7
7
 
8
- const wrapComponent = (sensor) => (
8
+ const wrapComponent = (sensor, isDeviceHasBle) => (
9
9
  <SCProvider initState={mockSCStore({})}>
10
- <DisconnectedView sensor={sensor} />
10
+ <DisconnectedView sensor={sensor} isDeviceHasBle={isDeviceHasBle} />
11
11
  </SCProvider>
12
12
  );
13
13
 
@@ -63,4 +63,15 @@ describe('Test DisconnectedView', () => {
63
63
  const Views = instance.findAllByType(View);
64
64
  expect(Views).toHaveLength(15);
65
65
  });
66
+
67
+ test('render DisconnectedView text check bluetooth', () => {
68
+ const isDeviceHasBle = true;
69
+ const sensor = { icon: 'test' };
70
+ act(() => {
71
+ tree = renderer.create(wrapComponent(sensor, isDeviceHasBle));
72
+ });
73
+ const instance = tree.root;
74
+ const Views = instance.findAllByType(View);
75
+ expect(Views).toHaveLength(17);
76
+ });
66
77
  });
@@ -21,7 +21,8 @@ export const RowItem = memo(
21
21
  type, //primary | disable | undefined
22
22
  leftIcon,
23
23
  text,
24
- subtext,
24
+ isShowSubText = true,
25
+ subtext = '',
25
26
  subtextColor = Colors.Gray6,
26
27
  rightComponent,
27
28
  onPress,
@@ -40,14 +41,18 @@ export const RowItem = memo(
40
41
  <View style={styles.wrapItem}>
41
42
  <TouchableOpacity onPress={onPress} disabled={type === 'disable'}>
42
43
  <View style={styles.Border}>
43
- <View style={styles.paddingLeft16}>
44
- <CircleView size={40} backgroundColor={circleColor} center>
45
- {leftIcon}
46
- </CircleView>
47
- </View>
44
+ {!!leftIcon && (
45
+ <View style={styles.paddingLeft16}>
46
+ <CircleView size={40} backgroundColor={circleColor} center>
47
+ {leftIcon}
48
+ </CircleView>
49
+ </View>
50
+ )}
48
51
  <View style={styles.columeFlex}>
49
52
  <Text style={styles.titleName}> {text}</Text>
50
- <Text style={styles.status}> {subtext}</Text>
53
+ {!!isShowSubText && (
54
+ <Text style={styles.status}> {subtext}</Text>
55
+ )}
51
56
  </View>
52
57
  {!!rightComponent && (
53
58
  <View style={styles.endFlex}>{rightComponent}</View>
@@ -15,7 +15,7 @@ const SubUnitFavorites = ({
15
15
  unit,
16
16
  isOwner,
17
17
  favorites,
18
- isNetworkConnected,
18
+ serverDown,
19
19
  isGGHomeConnected,
20
20
  wrapItemStyle,
21
21
  }) => {
@@ -72,8 +72,8 @@ const SubUnitFavorites = ({
72
72
  sensor={sensor}
73
73
  unit={unit}
74
74
  station={sensor.station}
75
- isNetworkConnected={isNetworkConnected}
76
75
  isGGHomeConnected={isGGHomeConnected}
76
+ serverDown={serverDown}
77
77
  status={sensorsStatus.find((s) => s.id === sensor.id)}
78
78
  wrapStyle={wrapItemStyle}
79
79
  />
@@ -4,10 +4,11 @@ import { useNavigation, useIsFocused } from '@react-navigation/native';
4
4
  import { useTranslations } from '../../hooks/Common/useTranslations';
5
5
 
6
6
  import { Images, Device, API } from '../../configs';
7
- import { TESTID } from '../../configs/Constants';
7
+ import { DEVICE_TYPE, TESTID } from '../../configs/Constants';
8
8
  import { Section } from '../Section';
9
9
  import Text from '../Text';
10
10
  import ItemDevice from '../Device/ItemDevice';
11
+ import ItemHanetDevice from '../Device/Hanet/ItemHanetDevice';
11
12
  import ItemAddNew from '../Device/ItemAddNew';
12
13
  import { standardizeCameraScreenSize } from '../../utils/Utils';
13
14
  import Routes from '../../utils/Route';
@@ -22,7 +23,7 @@ const { standardizeWidth, standardizeHeight } = standardizeCameraScreenSize(
22
23
  const ShortDetailSubUnit = ({
23
24
  unit,
24
25
  station,
25
- isNetworkConnected,
26
+ serverDown,
26
27
  isGGHomeConnected,
27
28
  }) => {
28
29
  const t = useTranslations();
@@ -126,24 +127,42 @@ const ShortDetailSubUnit = ({
126
127
 
127
128
  <View style={styles.boxDevices}>
128
129
  {!!station.sensors &&
129
- station.sensors.map((sensor, index) => (
130
- <ItemDevice
131
- key={`sensor-${sensor.id}`}
132
- id={sensor.id}
133
- svgMain={sensor.icon || 'sensor'}
134
- statusIcon={sensor.action && sensor.action.icon}
135
- statusColor={sensor.action && sensor.action.color}
136
- description={sensor.value}
137
- title={sensor.name}
138
- index={index}
139
- sensor={sensor}
140
- unit={unit}
141
- station={station}
142
- isNetworkConnected={isNetworkConnected}
143
- isGGHomeConnected={isGGHomeConnected}
144
- status={sensorsStatus.find((s) => s.id === sensor.id)}
145
- />
146
- ))}
130
+ station.sensors.map((sensor, index) => {
131
+ switch (sensor.device_type) {
132
+ case DEVICE_TYPE.HANET:
133
+ return (
134
+ <ItemHanetDevice
135
+ key={`sensor-${sensor.id}`}
136
+ id={sensor.id}
137
+ svgMain={sensor.icon || 'sensor'}
138
+ title={sensor.name}
139
+ index={index}
140
+ sensor={sensor}
141
+ unit={unit}
142
+ station={station}
143
+ />
144
+ );
145
+ default:
146
+ return (
147
+ <ItemDevice
148
+ key={`sensor-${sensor.id}`}
149
+ id={sensor.id}
150
+ svgMain={sensor.icon || 'sensor'}
151
+ statusIcon={sensor.action && sensor.action.icon}
152
+ statusColor={sensor.action && sensor.action.color}
153
+ description={sensor.value}
154
+ title={sensor.name}
155
+ index={index}
156
+ sensor={sensor}
157
+ unit={unit}
158
+ station={station}
159
+ isGGHomeConnected={isGGHomeConnected}
160
+ serverDown={serverDown}
161
+ status={sensorsStatus.find((s) => s.id === sensor.id)}
162
+ />
163
+ );
164
+ }
165
+ })}
147
166
  <ItemAddNew title={t('add_new_device')} onAddNew={handleOnAddNew} />
148
167
  </View>
149
168
  </Section>
@@ -92,10 +92,14 @@ const WheelDateTimePicker = ({
92
92
  }, [dateSelected, hourSelected, minuteSelected, onCancel, onPicked]);
93
93
 
94
94
  const title = useMemo(() => {
95
- if (mode === 'time') {
96
- return t('set_time');
95
+ switch (mode) {
96
+ case 'time':
97
+ return t('set_time');
98
+ case 'datetime':
99
+ return t('set_date_time');
100
+ default:
101
+ return t('minutes');
97
102
  }
98
- return t('set_date_time');
99
103
  }, [t, mode]);
100
104
 
101
105
  return (
@@ -125,7 +129,7 @@ const WheelDateTimePicker = ({
125
129
  style={styles.picker}
126
130
  />
127
131
  </View>
128
- ) : (
132
+ ) : mode === 'datetime' ? (
129
133
  <View style={styles.container}>
130
134
  <Picker
131
135
  dataSource={dateData}
@@ -153,6 +157,16 @@ const WheelDateTimePicker = ({
153
157
  style={styles.picker}
154
158
  />
155
159
  </View>
160
+ ) : (
161
+ <View style={styles.container}>
162
+ <Picker
163
+ dataSource={minuteData}
164
+ selectedIndex={indexInitialMinute}
165
+ onValueChange={onValueMinuteChange}
166
+ keyPrefix="minute"
167
+ style={styles.picker}
168
+ />
169
+ </View>
156
170
  )}
157
171
  <ViewButtonBottom
158
172
  leftTitle={t('cancel')}
@@ -184,7 +184,29 @@ const API = {
184
184
  VCONNEX: {
185
185
  AUTHORIZE: (client_id, redirect_uri, user_id, unit_id, station_id) =>
186
186
  // eslint-disable-next-line max-len
187
- `https://partner-api-stg.vconnex.vn/oauth/authorize?client_id=${client_id}&redirect_uri=${redirect_uri}&response_type=code&scope=SYNCH&scope=CONTROL&scope=QUERY&state=${user_id}@${unit_id}@${station_id}`,
187
+ `https://partner-api.vconnex.vn/oauth/authorize?client_id=${client_id}&redirect_uri=${redirect_uri}&response_type=code&scope=SYNCH&scope=CONTROL&scope=QUERY&state=${user_id}@${unit_id}@${station_id}`,
188
+ },
189
+ },
190
+ CAMERA: {
191
+ HANET: {
192
+ CHECKIN: (device_id) =>
193
+ SCConfig.apiRoot +
194
+ `/camera_manager/hanet/cameras/${device_id}/checkin/`,
195
+ PLACE_MEMBERS: (place_id) =>
196
+ SCConfig.apiRoot + `/camera_manager/hanet/places/${place_id}/members/`,
197
+ RENAME_MEMBER: (place_id, member_id) =>
198
+ SCConfig.apiRoot +
199
+ `/camera_manager/hanet/places/${place_id}/members/${member_id}/rename/`,
200
+ REMOVE_MEMBER: (place_id, member_id) =>
201
+ SCConfig.apiRoot +
202
+ `/camera_manager/hanet/places/${place_id}/members/${member_id}/`,
203
+ UPDATE_FACE_ID: (place_id, member_id) =>
204
+ SCConfig.apiRoot +
205
+ `/camera_manager/hanet/places/${place_id}/members/${member_id}/update_face_id/`,
206
+ REGISTER: (place_id) =>
207
+ SCConfig.apiRoot + `/camera_manager/hanet/places/${place_id}/members/`,
208
+ PUSHER_AUTH: () =>
209
+ SCConfig.apiRoot + '/camera_manager/hanet/pusher/auth/',
188
210
  },
189
211
  },
190
212
  NOTIFICATION: {
@@ -110,6 +110,7 @@ export const Colors = {
110
110
  Blue10: '#1890FF',
111
111
  Blue11: '#096DD9',
112
112
  Blue12: '#0050B3',
113
+ Blue13: '#E2F0F8',
113
114
 
114
115
  //Range Volcano:
115
116
  Volcano3: '#FFBB96',
@@ -73,6 +73,16 @@ export const Constants = {
73
73
 
74
74
  export const DEVICE_TYPE = {
75
75
  LG_THINQ: 'LG_THINQ',
76
+ HANET: 'HANET',
77
+ };
78
+
79
+ const marginItem = 12;
80
+ const marginHorizontal = 16;
81
+ const widthItem = (Constants.width - marginHorizontal * 2 - marginItem) / 2;
82
+ const heightItem = (widthItem / 166) * 106;
83
+ export const DEVICE_SIZE = {
84
+ width: widthItem,
85
+ height: heightItem,
76
86
  };
77
87
 
78
88
  export const SCANNING_STATUS = {
@@ -100,6 +110,26 @@ export const AUTOMATE_TYPE = {
100
110
  SCENARIO: 'scenario',
101
111
  };
102
112
 
113
+ export const SMART_TIVI_BUTTON = {
114
+ ONOFF_BUTTON: 'OnOff',
115
+ EXIT_BUTTON: 'Exit',
116
+ VOLUME_UP_BUTTON: 'VolumeUp',
117
+ VOLUME_DOWN_BUTTON: 'VolumeDown',
118
+ CH_UP: 'ChUp',
119
+ CH_DOWN: 'ChDown',
120
+ PREV_BUTTON: 'Prev',
121
+ STOP_BUTTON: 'Stop',
122
+ NEXT_BUTTON: 'Next',
123
+ UP_BUTTON: 'Up',
124
+ DOWN_BUTTON: 'Down',
125
+ LEFT_BUTTON: 'Left',
126
+ RIGHT_BUTTON: 'Right',
127
+ OK_BUTTON: 'Ok',
128
+ HOME_BUTTON: 'Home',
129
+ BACK_BUTTON: 'Back',
130
+ CHANNEL_BUTTON: 'Channel',
131
+ };
132
+
103
133
  export const AUTOMATE_SELECT = {
104
134
  SELECT_DEVICE: 'select_device',
105
135
  SELECT_SENSOR: 'select_sensor',
@@ -636,6 +666,23 @@ export const TESTID = {
636
666
 
637
667
  // MoveToAnotherSubUnit
638
668
  ROW_SUB_UNIT: 'ROW_SUB_UNIT',
669
+
670
+ // HanetCameraDetail
671
+ TEXT_COUNT_MEMBER: 'TEXT_COUNT_MEMBER',
672
+ TEXT_COUNT_STRANGER: 'TEXT_COUNT_STRANGER',
673
+ ROW_HANET_MANAGE_ACCESS: 'ROW_HANET_MANAGE_ACCESS',
674
+ HANET_MANAGE_ACCESS_ADD_BUTTON: 'HANET_MANAGE_ACCESS_ADD_BUTTON',
675
+ HANET_ADD_MEMBER_OPTION: 'HANET_ADD_MEMBER_OPTION',
676
+
677
+ //SetupGeneratePasscode
678
+ GENERATE_PASSCODE_CHOOSE_USER: 'GENERATE_PASSCODE_CHOOSE_USER',
679
+ GENERATE_PASSCODE_SET_TIME: 'GENERATE_PASSCODE_SET_TIME',
680
+ GENERATE_PASSCODE_SET_DURATION: 'GENERATE_PASSCODE_SET_DURATION',
681
+
682
+ //AutoLock
683
+ AUTO_LOCK_BUTTON_ENABLE: 'AUTO_LOCK_BUTTON_ENABLE',
684
+ AUTO_LOCK_BUTTON_INSTANT: 'AUTO_LOCK_BUTTON_INSTANT',
685
+ AUTO_LOCK_BUTTON_RELOCK_TIMING: 'AUTO_LOCK_BUTTON_RELOCK_TIMING',
639
686
  };
640
687
 
641
688
  export const NOTIFICATION_TYPES = {
@@ -682,4 +729,5 @@ export const SENSOR_TYPE = {
682
729
  SMOKE: 'smoke',
683
730
  FIRE: 'fire',
684
731
  SOS: 'sos',
732
+ FILTER_WATER: 'filter_water',
685
733
  };
@@ -92,7 +92,7 @@ const SCDefaultConfig = {
92
92
  LG_URL: 'https://qt-vn.m.lgaccount.com/emp/v2',
93
93
  VCONNEX_CLIENT_ID: '',
94
94
  VCONNEX_REDIRECT_URI_APP: '',
95
- pusherAppKey: '9a591ae4a764acc08714',
95
+ pusherAppKey: '8557fcc63959f564f1aa',
96
96
  pusherAppCluster: 'ap1',
97
97
  };
98
98
 
@@ -7,6 +7,8 @@ export const Action = {
7
7
  IS_FIRST_OPEN_CAMERA: 'IS_FIRST_OPEN_CAMERA',
8
8
  IS_LAVIDA_SOURCE: 'IS_LAVIDA_SOURCE',
9
9
  IS_CONNECT_WIFI_GATEWAY: 'IS_CONNECT_WIFI_GATEWAY',
10
+ SET_BLUETOOTH_STATE: 'SET_BLUETOOTH_STATE',
11
+ SET_NETWORK_CONNECTED: 'SET_NETWORK_CONNECTED',
10
12
  };
11
13
 
12
14
  export type AuthData = {
@@ -52,4 +54,6 @@ export type AppType = {
52
54
  isFirstOpenCamera: boolean;
53
55
  isLavidaSource: boolean;
54
56
  isConnectWifiGateway: boolean;
57
+ isBluetoothEnabled: boolean;
58
+ isNetworkConnected: boolean;
55
59
  };
@@ -49,6 +49,9 @@ export const mockSCStore = (data: ContextData): ContextData => {
49
49
  listAction: [...mockDataStore.listAction, ...(data?.listAction || [])],
50
50
  app: {
51
51
  isFirstOpenCamera: true,
52
+ isConnectWifiGateway: false,
53
+ isBluetoothEnabled: true,
54
+ isNetworkConnected: true,
52
55
  },
53
56
  };
54
57
  };
@@ -41,6 +41,8 @@ export const initialState = {
41
41
  isFirstOpenCamera: true,
42
42
  isLavidaSource: false,
43
43
  isConnectWifiGateway: false,
44
+ isBluetoothEnabled: false,
45
+ isNetworkConnected: false,
44
46
  },
45
47
  };
46
48
 
@@ -117,6 +119,24 @@ export const reducer = (currentState: ContextData, action: Action) => {
117
119
  },
118
120
  };
119
121
  }
122
+ case Action.SET_BLUETOOTH_STATE: {
123
+ return {
124
+ ...currentState,
125
+ app: {
126
+ ...currentState.app,
127
+ isBluetoothEnabled: payload,
128
+ },
129
+ };
130
+ }
131
+ case Action.SET_NETWORK_CONNECTED: {
132
+ return {
133
+ ...currentState,
134
+ app: {
135
+ ...currentState.app,
136
+ isNetworkConnected: payload,
137
+ },
138
+ };
139
+ }
120
140
  default:
121
141
  return currentState;
122
142
  }
@@ -5,7 +5,6 @@ import t from '../../hooks/Common/useTranslations';
5
5
  import base64 from 'react-native-base64';
6
6
  import { BleManager } from 'react-native-ble-plx';
7
7
  import { ToastBottomHelper } from '../../utils/Utils';
8
- import { useEffect, useState } from 'react';
9
8
 
10
9
  const bluetoothDevices = {};
11
10
  const needToScanDevices = [];
@@ -185,31 +184,13 @@ export const sendDataOverBluetooth = async (
185
184
  return result;
186
185
  }
187
186
 
188
- // eslint-disable-next-line no-shadow
189
- setTimeout(async (device) => {
190
- await device.cancelConnection();
187
+ const timeout = setTimeout(() => {
188
+ device.cancelConnection();
189
+ clearTimeout(timeout);
191
190
  }, responseTime);
192
191
  return result;
193
192
  };
194
193
 
195
- export const isBluetoothEnabled = async () => {
196
- const state = await bleManager.state();
197
- return state === 'PoweredOn';
198
- };
199
-
200
- export const useIsBluetoothEnabled = () => {
201
- const [isEnabled, setIsEnabled] = useState(null);
202
-
203
- useEffect(() => {
204
- const subscription = bleManager.onStateChange((state) => {
205
- setIsEnabled(state === 'PoweredOn');
206
- }, true);
207
-
208
- return () => subscription.remove();
209
- }, []);
210
- return isEnabled;
211
- };
212
-
213
194
  export const enableBluetoothForAndroid = async () => {
214
195
  await bleManager.enable();
215
196
  };
@@ -40,7 +40,6 @@ export const sendRemoteCommand = async (
40
40
  }
41
41
  }
42
42
  }
43
-
44
43
  if (action.command_prefer_over_internet) {
45
44
  result = await sendCommandOverInternet(sensor, action, data, 'internet');
46
45
  }
@@ -0,0 +1,41 @@
1
+ import { createStackNavigator } from '@react-navigation/stack';
2
+ import React, { memo } from 'react';
3
+ import HanetCameraDetail from '../screens/HanetCamera/Detail';
4
+ import HanetManageAccess from '../screens/HanetCamera/ManageAccess';
5
+ import HanetMemberInfo from '../screens/HanetCamera/MemberInfo';
6
+ import HanetCaptureFaceID from '../screens/HanetCamera/CaptureFaceID';
7
+ import Route from '../utils/Route';
8
+ import { screenOptions } from './utils';
9
+
10
+ const Stack = createStackNavigator();
11
+
12
+ export const HanetCameraStack = memo(() => {
13
+ return (
14
+ <Stack.Navigator
15
+ screenOptions={{
16
+ ...screenOptions,
17
+ }}
18
+ >
19
+ <Stack.Screen
20
+ name={Route.HanetCameraDetail}
21
+ component={HanetCameraDetail}
22
+ options={{ headerShown: false }}
23
+ />
24
+ <Stack.Screen
25
+ name={Route.HanetManageAccess}
26
+ component={HanetManageAccess}
27
+ options={{ headerShown: false }}
28
+ />
29
+ <Stack.Screen
30
+ name={Route.HanetMemberInfo}
31
+ component={HanetMemberInfo}
32
+ options={{ headerShown: false }}
33
+ />
34
+ <Stack.Screen
35
+ name={Route.HanetCaptureFaceID}
36
+ component={HanetCaptureFaceID}
37
+ options={{ headerShown: false }}
38
+ />
39
+ </Stack.Navigator>
40
+ );
41
+ });
@@ -0,0 +1,31 @@
1
+ import { createStackNavigator } from '@react-navigation/stack';
2
+ import React, { memo } from 'react';
3
+
4
+ import SelectDeviceType from '../screens/SmartIr/components/SelectDeviceType';
5
+ import SelectBrand from '../screens/SmartIr/components/SelectBrand';
6
+ import GroupButtonByType from '../screens/SmartIr/components/GroupButtonByType/GroupButtonByType';
7
+ import Route from '../utils/Route';
8
+ import { screenOptions } from './utils';
9
+
10
+ const Stack = createStackNavigator();
11
+
12
+ export const SmartIrStack = memo(() => {
13
+ return (
14
+ <Stack.Navigator
15
+ screenOptions={{
16
+ ...screenOptions,
17
+ headerShown: false,
18
+ }}
19
+ >
20
+ <Stack.Screen
21
+ name={Route.SelectDeviceType}
22
+ component={SelectDeviceType}
23
+ />
24
+ <Stack.Screen name={Route.SelectBrand} component={SelectBrand} />
25
+ <Stack.Screen
26
+ name={Route.GroupButtonByType}
27
+ component={GroupButtonByType}
28
+ />
29
+ </Stack.Navigator>
30
+ );
31
+ });
@@ -0,0 +1,51 @@
1
+ import { createStackNavigator } from '@react-navigation/stack';
2
+ import React, { memo } from 'react';
3
+
4
+ import Route from '../utils/Route';
5
+ import { screenOptions } from './utils';
6
+ import SetupGeneratePasscode from '../commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/index';
7
+ import AutoLock from '../commons/ActionGroup/OnOffSmartLock/AutoLock/index';
8
+ import PasscodeList from '../commons/ActionGroup/OnOffSmartLock/PasscodeList/index';
9
+ import ItemPasscode from '../commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscode';
10
+
11
+ const Stack = createStackNavigator();
12
+
13
+ export const SmartLockStack = memo(() => {
14
+ return (
15
+ <Stack.Navigator
16
+ screenOptions={{
17
+ ...screenOptions,
18
+ headerShown: false,
19
+ }}
20
+ >
21
+ <Stack.Screen
22
+ name={Route.SetupGeneratePasscode}
23
+ component={SetupGeneratePasscode}
24
+ options={{
25
+ headerShown: false,
26
+ }}
27
+ />
28
+ <Stack.Screen
29
+ name={Route.AutoLock}
30
+ component={AutoLock}
31
+ options={{
32
+ headerShown: false,
33
+ }}
34
+ />
35
+ <Stack.Screen
36
+ name={Route.PasscodeList}
37
+ component={PasscodeList}
38
+ options={{
39
+ headerShown: false,
40
+ }}
41
+ />
42
+ <Stack.Screen
43
+ name={Route.ItemPasscode}
44
+ component={ItemPasscode}
45
+ options={{
46
+ headerShown: false,
47
+ }}
48
+ />
49
+ </Stack.Navigator>
50
+ );
51
+ });