@eohjsc/react-native-smart-city 0.2.83 → 0.2.86
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/assets/images/Device/button-lock.svg +3 -0
- package/assets/images/Device/button-unlock.svg +3 -0
- package/assets/images/Event.svg +9 -0
- package/assets/images/brightness.svg +12 -0
- package/package.json +4 -2
- package/src/Images/Common/SuccessfullyConnected.svg +4 -0
- package/src/Images/Common/eye-closed.png +0 -0
- package/src/Images/Common/eye-closed@2x.png +0 -0
- package/src/Images/Common/eye-closed@3x.png +0 -0
- package/src/Images/Common/eye.png +0 -0
- package/src/Images/Common/eye@2x.png +0 -0
- package/src/Images/Common/eye@3x.png +0 -0
- package/src/commons/ActionGroup/LightActionTemplate.js +103 -0
- package/src/commons/ActionGroup/LightActionTemplateStyles.js +57 -0
- package/src/commons/ActionGroup/OnOffSmartLock.js +48 -0
- package/src/commons/ActionGroup/OnOffSmartLockStyle.js +51 -0
- package/src/commons/ActionGroup/OnOffTemplate/OnOffButtonTemplate.js +33 -31
- package/src/commons/ActionGroup/__test__/LightActionTemplate.test.js +59 -0
- package/src/commons/ActionGroup/index.js +6 -0
- package/src/commons/Automate/ItemAutomate.js +1 -1
- package/src/commons/Automate/ItemAutomateStyles.js +5 -1
- package/src/commons/CardShadow/index.js +5 -2
- package/src/commons/CardShadow/styles.js +2 -3
- package/src/commons/ConnectingProcess/DeviceItem/DeviceItem.js +16 -0
- package/src/commons/ConnectingProcess/DeviceItem/DeviceItemStyles.js +42 -0
- package/src/commons/ConnectingProcess/__test__/Connecting.test.js +27 -0
- package/src/commons/ConnectingProcess/__test__/DeviceItem.test.js +18 -0
- package/src/commons/ConnectingProcess/index.js +205 -0
- package/src/commons/ConnectingProcess/styles.js +69 -0
- package/src/commons/Device/ItemDevice.js +8 -3
- package/src/commons/Device/LinearChart.js +1 -0
- package/src/commons/Device/WaterQualitySensor/ListQualityIndicator.js +1 -1
- package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +1 -1
- package/src/commons/Form/TextInputPassword.js +1 -1
- package/src/commons/FullLoading/index.js +35 -0
- package/src/commons/MediaPlayer/__test__/index.test.js +45 -0
- package/src/commons/SubUnit/OneTap/ItemOneTap.js +3 -0
- package/src/commons/SubUnit/ShortDetail.js +10 -22
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +57 -48
- package/src/commons/index.js +2 -0
- package/src/configs/API.js +6 -2
- package/src/configs/Constants.js +36 -0
- package/src/configs/Images.js +2 -0
- package/src/context/actionType.ts +2 -0
- package/src/context/reducer.ts +10 -0
- package/src/hooks/Common/useBlockBackAndroid.js +3 -1
- package/src/navigations/AddDeviceStack.js +10 -0
- package/src/screens/ActivityLog/hooks/index.js +18 -4
- package/src/screens/ActivityLog/index.js +3 -0
- package/src/screens/AddCommon/SelectSubUnit.js +30 -6
- package/src/screens/AddCommon/SelectUnit.js +24 -2
- package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +120 -1
- package/src/screens/AddCommon/__test__/SelectUnit.test.js +16 -1
- package/src/screens/AddNewAction/SelectAction.js +46 -28
- package/src/screens/AddNewAction/SelectSensorDevices.js +4 -2
- package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +3 -3
- package/src/screens/AddNewAutoSmart/index.js +18 -1
- package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +63 -16
- package/src/screens/AddNewGateway/PlugAndPlay/FirstWarning.js +4 -2
- package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +52 -23
- package/src/screens/AddNewGateway/SelectGateway.js +132 -0
- package/src/screens/AddNewGateway/SelectGatewayStyles.js +55 -0
- package/src/screens/AddNewGateway/__test__/SetupGateway.test.js +0 -52
- package/src/screens/AddNewOneTap/index.js +32 -17
- package/src/screens/Automate/index.js +2 -2
- package/src/screens/Device/EditDevice/index.js +5 -3
- package/src/screens/Device/components/SensorDisplayItem.js +3 -0
- package/src/screens/Device/detail.js +7 -6
- package/src/screens/Device/styles.js +2 -0
- package/src/screens/Notification/__test__/NotificationItem.test.js +27 -5
- package/src/screens/Notification/components/NotificationItem.js +112 -20
- package/src/screens/ScanChipQR/__test__/ScanChipQR.test.js +11 -7
- package/src/screens/ScanChipQR/hooks/index.js +78 -24
- package/src/screens/ScriptDetail/index.js +1 -6
- package/src/screens/SelectUnit/index.js +1 -0
- package/src/screens/SharedUnit/index.js +1 -1
- package/src/screens/SmartIr/__test__/SmartIr.test.js +61 -0
- package/src/screens/SmartIr/index.js +23 -0
- package/src/screens/SmartIr/styles.js +14 -0
- package/src/screens/Unit/AddMenu.js +4 -1
- package/src/screens/Unit/Detail.js +24 -2
- package/src/screens/Unit/ManageUnit.js +1 -1
- package/src/screens/Unit/ManageUnitStyles.js +0 -6
- package/src/screens/Unit/SmartAccount.js +5 -1
- package/src/screens/UnitSummary/components/PowerConsumeHistoryChart/__test__/index.test.js +32 -1
- package/src/screens/UnitSummary/components/PowerConsumeHistoryChart/index.js +1 -1
- package/src/utils/Apis/axios.js +1 -1
- package/src/utils/I18n/translations/en.json +18 -2
- package/src/utils/I18n/translations/vi.json +18 -3
- package/src/utils/Route/index.js +3 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M22.0495 3.90313C22.0112 3.88385 21.9687 3.87473 21.9259 3.87662C21.8831 3.87852 21.8415 3.89138 21.8051 3.91397C21.7687 3.93656 21.7388 3.96811 21.7181 4.00561C21.6974 4.04311 21.6867 4.0853 21.687 4.12813V6.13438C21.687 6.30625 21.7776 6.46562 21.9213 6.55937C22.626 7.00293 23.2781 7.52502 23.8651 8.11563C24.887 9.14063 25.6901 10.3313 26.2495 11.6563C26.828 13.0279 27.1245 14.502 27.1213 15.9906C27.1213 17.4938 26.8276 18.9531 26.2495 20.325C25.6907 21.6481 24.881 22.8504 23.8651 23.8656C22.8525 24.8841 21.6509 25.6951 20.3276 26.2531C18.9588 26.8344 17.4995 27.1281 15.9995 27.1281C14.4995 27.1281 13.0401 26.8344 11.6713 26.2531C10.348 25.6951 9.14638 24.8841 8.13384 23.8656C7.11791 22.8504 6.3082 21.6481 5.74946 20.325C5.17097 18.9533 4.87446 17.4793 4.87759 15.9906C4.87759 14.4875 5.17134 13.0281 5.74946 11.6562C6.30884 10.3313 7.11196 9.14063 8.13384 8.11563C8.72759 7.52188 9.37759 7.00312 10.0776 6.55937C10.2245 6.46875 10.312 6.30625 10.312 6.13438V4.125C10.312 3.9375 10.1151 3.81875 9.94946 3.9C5.57759 6.1 2.56196 10.6031 2.49946 15.8219C2.41196 23.2844 8.51509 29.4844 15.9745 29.5C23.4432 29.5156 29.4995 23.4594 29.4995 15.9875C29.4995 10.7 26.4682 6.12188 22.0495 3.90313ZM14.9995 17.5H16.9995C17.137 17.5 17.2495 17.3875 17.2495 17.25V2.75C17.2495 2.6125 17.137 2.5 16.9995 2.5H14.9995C14.862 2.5 14.7495 2.6125 14.7495 2.75L14.7495 17.25C14.7495 17.3875 14.862 17.5 14.9995 17.5Z" fill="#00979D"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M22.0495 3.90313C22.0112 3.88385 21.9687 3.87473 21.9259 3.87662C21.8831 3.87852 21.8415 3.89138 21.8051 3.91397C21.7687 3.93656 21.7388 3.96811 21.7181 4.00561C21.6974 4.04311 21.6867 4.0853 21.687 4.12813V6.13438C21.687 6.30625 21.7776 6.46562 21.9213 6.55937C22.626 7.00293 23.2781 7.52502 23.8651 8.11563C24.887 9.14063 25.6901 10.3313 26.2495 11.6563C26.828 13.0279 27.1245 14.502 27.1213 15.9906C27.1213 17.4938 26.8276 18.9531 26.2495 20.325C25.6907 21.6481 24.881 22.8504 23.8651 23.8656C22.8525 24.8841 21.6509 25.6951 20.3276 26.2531C18.9588 26.8344 17.4995 27.1281 15.9995 27.1281C14.4995 27.1281 13.0401 26.8344 11.6713 26.2531C10.348 25.6951 9.14638 24.8841 8.13384 23.8656C7.11791 22.8504 6.3082 21.6481 5.74946 20.325C5.17097 18.9533 4.87446 17.4793 4.87759 15.9906C4.87759 14.4875 5.17134 13.0281 5.74946 11.6562C6.30884 10.3313 7.11196 9.14063 8.13384 8.11563C8.72759 7.52188 9.37759 7.00312 10.0776 6.55937C10.2245 6.46875 10.312 6.30625 10.312 6.13438V4.125C10.312 3.9375 10.1151 3.81875 9.94946 3.9C5.57759 6.1 2.56196 10.6031 2.49946 15.8219C2.41196 23.2844 8.51509 29.4844 15.9745 29.5C23.4432 29.5156 29.4995 23.4594 29.4995 15.9875C29.4995 10.7 26.4682 6.12188 22.0495 3.90313ZM14.9995 17.5H16.9995C17.137 17.5 17.2495 17.3875 17.2495 17.25V2.75C17.2495 2.6125 17.137 2.5 16.9995 2.5H14.9995C14.862 2.5 14.7495 2.6125 14.7495 2.75L14.7495 17.25C14.7495 17.3875 14.862 17.5 14.9995 17.5Z" fill="#F5222D"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<svg width="22" height="40" viewBox="0 0 22 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M21.4995 0H6.49908L0.500977 21.5962H6.51129L1.4009 40H3.20118L20.5983 18.4029H11.785L21.4995 0Z" fill="url(#paint0_linear_8208_3875)"/>
|
|
3
|
+
<defs>
|
|
4
|
+
<linearGradient id="paint0_linear_8208_3875" x1="0.500977" y1="0" x2="33.409" y2="17.2947" gradientUnits="userSpaceOnUse">
|
|
5
|
+
<stop stop-color="#2B6B9F"/>
|
|
6
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
7
|
+
</linearGradient>
|
|
8
|
+
</defs>
|
|
9
|
+
</svg>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M10.0001 3.90845C8.79471 3.90824 7.61636 4.26551 6.61406 4.93507C5.61177 5.60463 4.83056 6.55639 4.36924 7.66998C3.90791 8.78357 3.78721 10.009 4.02239 11.1912C4.25757 12.3734 4.83807 13.4593 5.69046 14.3115C6.54286 15.1638 7.62885 15.7441 8.81109 15.979C9.99333 16.214 11.2187 16.0931 12.3322 15.6316C13.4457 15.1701 14.3974 14.3887 15.0667 13.3863C15.7361 12.3839 16.0932 11.2055 16.0928 10.0001C16.0922 8.38449 15.4501 6.83522 14.3076 5.6929C13.1651 4.55058 11.6157 3.90872 10.0001 3.90845ZM10.0001 14.6376C9.08332 14.6378 8.18709 14.3662 7.4247 13.8571C6.66232 13.3479 6.06802 12.6242 5.71696 11.7773C5.36589 10.9304 5.27383 9.99847 5.4524 9.09928C5.63097 8.20008 6.07216 7.37403 6.72019 6.72557C7.36821 6.07711 8.19397 5.63536 9.09304 5.45618C9.99212 5.277 10.9241 5.36844 11.7712 5.71893C12.6184 6.06943 13.3425 6.66324 13.8522 7.42528C14.3618 8.18731 14.634 9.08336 14.6344 10.0001C14.6336 11.2293 14.1452 12.4079 13.2763 13.2773C12.4075 14.1467 11.2292 14.636 10.0001 14.6376Z" fill="#BFBFBF"/>
|
|
3
|
+
<path d="M9.37419 0.866699H10.6242C10.6936 0.866699 10.7284 0.901421 10.7284 0.970866V2.96774C10.7284 3.03719 10.6936 3.07191 10.6242 3.07191H9.37419C9.30474 3.07191 9.27002 3.03719 9.27002 2.96774V0.970866C9.27002 0.901421 9.30474 0.866699 9.37419 0.866699Z" fill="#BFBFBF"/>
|
|
4
|
+
<path d="M3.09933 3.98419L3.98321 3.10031C4.03232 3.0512 4.08142 3.0512 4.13053 3.10031L5.54253 4.51231C5.59164 4.56141 5.59164 4.61052 5.54253 4.65962L4.65865 5.54351C4.60954 5.59261 4.56044 5.59261 4.51133 5.54351L3.09933 4.1315C3.05022 4.0824 3.05022 4.03329 3.09933 3.98419Z" fill="#BFBFBF"/>
|
|
5
|
+
<path d="M0.970866 9.27197H2.96774C3.03719 9.27197 3.07191 9.3067 3.07191 9.37614V10.6261C3.07191 10.6956 3.03719 10.7303 2.96774 10.7303H0.970866C0.901421 10.7303 0.866699 10.6956 0.866699 10.6261V9.37614C0.866699 9.3067 0.901421 9.27197 0.970866 9.27197Z" fill="#BFBFBF"/>
|
|
6
|
+
<path d="M3.10079 15.8697L4.5128 14.4577C4.5619 14.4086 4.61101 14.4086 4.66011 14.4577L5.54399 15.3416C5.5931 15.3907 5.5931 15.4398 5.54399 15.4889L4.13199 16.9009C4.08289 16.95 4.03378 16.95 3.98468 16.9009L3.10079 16.017C3.05169 15.9679 3.05169 15.9188 3.10079 15.8697Z" fill="#BFBFBF"/>
|
|
7
|
+
<path d="M9.37614 16.9282H10.6261C10.6956 16.9282 10.7303 16.9629 10.7303 17.0324V19.0293C10.7303 19.0987 10.6956 19.1334 10.6261 19.1334H9.37614C9.3067 19.1334 9.27197 19.0987 9.27197 19.0293V17.0324C9.27197 16.9629 9.3067 16.9282 9.37614 16.9282Z" fill="#BFBFBF"/>
|
|
8
|
+
<path d="M14.4572 15.3404L15.3411 14.4565C15.3902 14.4074 15.4393 14.4074 15.4884 14.4565L16.9004 15.8685C16.9496 15.9176 16.9496 15.9667 16.9004 16.0158L16.0166 16.8997C15.9675 16.9488 15.9184 16.9488 15.8692 16.8997L14.4572 15.4877C14.4081 15.4386 14.4081 15.3895 14.4572 15.3404Z" fill="#BFBFBF"/>
|
|
9
|
+
<path d="M17.0324 9.26978H19.0293C19.0987 9.26978 19.1334 9.3045 19.1334 9.37394V10.6239C19.1334 10.6934 19.0987 10.7281 19.0293 10.7281H17.0324C16.9629 10.7281 16.9282 10.6934 16.9282 10.6239V9.37394C16.9282 9.3045 16.9629 9.26978 17.0324 9.26978Z" fill="#BFBFBF"/>
|
|
10
|
+
<path d="M14.4558 4.51109L15.8678 3.09908C15.9169 3.04998 15.966 3.04998 16.0151 3.09908L16.899 3.98297C16.9481 4.03207 16.9481 4.08118 16.899 4.13028L15.487 5.54229C15.4379 5.59139 15.3888 5.59139 15.3397 5.54229L14.4558 4.6584C14.4067 4.6093 14.4067 4.56019 14.4558 4.51109Z" fill="#BFBFBF"/>
|
|
11
|
+
<path d="M9.89605 6.07715C8.87128 6.10077 7.89643 6.52444 7.18002 7.25756C6.4636 7.99068 6.0625 8.97503 6.0625 10.0001C6.0625 11.0251 6.4636 12.0095 7.18002 12.7426C7.89643 13.4757 8.87128 13.8994 9.89605 13.923C9.92367 13.923 9.95017 13.912 9.9697 13.8925C9.98924 13.8729 10.0002 13.8464 10.0002 13.8188V6.18132C10.0002 6.15369 9.98924 6.12719 9.9697 6.10766C9.95017 6.08812 9.92367 6.07715 9.89605 6.07715Z" fill="#BFBFBF"/>
|
|
12
|
+
</svg>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eohjsc/react-native-smart-city",
|
|
3
3
|
"title": "React Native Smart Home",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.86",
|
|
5
5
|
"description": "TODO",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"files": [
|
|
@@ -174,6 +174,7 @@
|
|
|
174
174
|
"react-native-parsed-text": "^0.0.22",
|
|
175
175
|
"react-native-permissions": "^2.1.5",
|
|
176
176
|
"react-native-popover-view": "^4.0.3",
|
|
177
|
+
"react-native-progress": "^5.0.0",
|
|
177
178
|
"react-native-reanimated": "1.10.1",
|
|
178
179
|
"react-native-responsive-fontsize": "^0.5.1",
|
|
179
180
|
"react-native-safe-area-context": "^3.1.1",
|
|
@@ -186,8 +187,9 @@
|
|
|
186
187
|
"react-native-udp": "^4.1.3",
|
|
187
188
|
"react-native-unimodules": "^0.11.0",
|
|
188
189
|
"react-native-version-check": "^3.4.2",
|
|
189
|
-
"react-native-vlc-media-player": "
|
|
190
|
+
"react-native-vlc-media-player": "^1.0.39",
|
|
190
191
|
"react-native-webview": "^10.9.3",
|
|
192
|
+
"react-native-wheel-color-picker": "^1.2.0",
|
|
191
193
|
"react-native-wheel-scrollview-picker": "^1.2.2",
|
|
192
194
|
"react-native-wifi-reborn": "^4.5.0",
|
|
193
195
|
"react-navigation": "^2.2.0",
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M21.8437 11.0312H20.3781C20.0593 11.0312 19.7562 11.1844 19.5687 11.4469L14.6562 18.2594L12.4312 15.1719C12.2437 14.9125 11.9437 14.7563 11.6218 14.7563H10.1562C9.95303 14.7563 9.83428 14.9875 9.95303 15.1531L13.8468 20.5531C13.9388 20.6815 14.06 20.7861 14.2005 20.8583C14.341 20.9305 14.4967 20.9681 14.6546 20.9681C14.8125 20.9681 14.9682 20.9305 15.1087 20.8583C15.2492 20.7861 15.3704 20.6815 15.4624 20.5531L22.0437 11.4281C22.1656 11.2625 22.0468 11.0312 21.8437 11.0312V11.0312Z" fill="#52C41A"/>
|
|
3
|
+
<path d="M16 2C8.26875 2 2 8.26875 2 16C2 23.7312 8.26875 30 16 30C23.7312 30 30 23.7312 30 16C30 8.26875 23.7312 2 16 2ZM16 27.625C9.58125 27.625 4.375 22.4187 4.375 16C4.375 9.58125 9.58125 4.375 16 4.375C22.4187 4.375 27.625 9.58125 27.625 16C27.625 22.4187 22.4187 27.625 16 27.625Z" fill="#52C41A"/>
|
|
4
|
+
</svg>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React, { memo, useCallback, useState, useMemo } from 'react';
|
|
2
|
+
import { Alert, View } from 'react-native';
|
|
3
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
4
|
+
import styles from './LightActionTemplateStyles';
|
|
5
|
+
import Text from '../Text';
|
|
6
|
+
import { Colors } from '../../configs';
|
|
7
|
+
import { Card } from '../CardShadow';
|
|
8
|
+
import ColorPicker from 'react-native-wheel-color-picker';
|
|
9
|
+
import SvgBrightness from '../../../assets/images/brightness.svg';
|
|
10
|
+
import Slider from 'react-native-slider';
|
|
11
|
+
import OnOffButtonTemplate from './OnOffTemplate/OnOffButtonTemplate';
|
|
12
|
+
|
|
13
|
+
const LightActionTemplate = memo(({ actionGroup, doAction, sensor }) => {
|
|
14
|
+
const t = useTranslations();
|
|
15
|
+
const { configuration, title } = actionGroup;
|
|
16
|
+
const dataColor = useMemo(() => {
|
|
17
|
+
return configuration?.config_color;
|
|
18
|
+
}, [configuration]);
|
|
19
|
+
|
|
20
|
+
const dataBrightness = useMemo(() => {
|
|
21
|
+
return configuration?.config_brightness;
|
|
22
|
+
}, [configuration]);
|
|
23
|
+
|
|
24
|
+
const [valueComplete, setValueComplete] = useState(dataBrightness || 0);
|
|
25
|
+
const [value, setValue] = useState(dataBrightness || 0);
|
|
26
|
+
const [color, setColor] = useState(dataColor || '');
|
|
27
|
+
const [isOn] = useState(true);
|
|
28
|
+
|
|
29
|
+
const onChangeColor = useCallback(
|
|
30
|
+
(color) => {
|
|
31
|
+
setColor(color);
|
|
32
|
+
Alert.alert(t('feature_under_development'));
|
|
33
|
+
},
|
|
34
|
+
[t]
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const onChangeBrightness = useCallback(
|
|
38
|
+
(value) => {
|
|
39
|
+
setValueComplete(value);
|
|
40
|
+
Alert.alert(t('feature_under_development'));
|
|
41
|
+
},
|
|
42
|
+
[t]
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const triggerAction = useCallback(() => {
|
|
46
|
+
Alert.alert(t('feature_under_development'));
|
|
47
|
+
}, [t]);
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<View>
|
|
51
|
+
<OnOffButtonTemplate
|
|
52
|
+
isOn={isOn}
|
|
53
|
+
triggerAction={triggerAction}
|
|
54
|
+
actionGroup={actionGroup}
|
|
55
|
+
isLight={true}
|
|
56
|
+
/>
|
|
57
|
+
<Card title={!!title && t(title)}>
|
|
58
|
+
<View style={styles.viewPickColor}>
|
|
59
|
+
<ColorPicker
|
|
60
|
+
style={styles.colorPicker}
|
|
61
|
+
sliderHidden={true}
|
|
62
|
+
swatches={false}
|
|
63
|
+
color={color}
|
|
64
|
+
onColorChangeComplete={(color) => onChangeColor(color)}
|
|
65
|
+
thumbSize={16}
|
|
66
|
+
/>
|
|
67
|
+
</View>
|
|
68
|
+
<View style={styles.viewBrightness}>
|
|
69
|
+
<View style={styles.LeftBrightness}>
|
|
70
|
+
<SvgBrightness />
|
|
71
|
+
<Text type="H4" style={styles.LeftTextBrightness}>
|
|
72
|
+
{t('brightness')}
|
|
73
|
+
</Text>
|
|
74
|
+
</View>
|
|
75
|
+
<View style={styles.RightBrightness}>
|
|
76
|
+
<View style={styles.slider}>
|
|
77
|
+
<Slider
|
|
78
|
+
value={valueComplete}
|
|
79
|
+
onSlidingComplete={(value) => onChangeBrightness(value)}
|
|
80
|
+
onValueChange={(value) => setValue(value)}
|
|
81
|
+
step={1}
|
|
82
|
+
minimumValue={0}
|
|
83
|
+
maximumValue={100}
|
|
84
|
+
thumbTintColor={Colors.Gray3}
|
|
85
|
+
minimumTrackTintColor={Colors.Primary}
|
|
86
|
+
maximumTrackTintColor={Colors.Gray4}
|
|
87
|
+
trackStyle={styles.trackSlider}
|
|
88
|
+
thumbStyle={styles.thumbSlider}
|
|
89
|
+
/>
|
|
90
|
+
</View>
|
|
91
|
+
<View style={styles.valuePercent}>
|
|
92
|
+
<Text type="Label" style={styles.textValuePercent}>
|
|
93
|
+
{`${value || 0}%`}
|
|
94
|
+
</Text>
|
|
95
|
+
</View>
|
|
96
|
+
</View>
|
|
97
|
+
</View>
|
|
98
|
+
</Card>
|
|
99
|
+
</View>
|
|
100
|
+
);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
export default LightActionTemplate;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { Colors } from '../../configs';
|
|
3
|
+
|
|
4
|
+
export default StyleSheet.create({
|
|
5
|
+
wrap: {
|
|
6
|
+
flexDirection: 'row',
|
|
7
|
+
justifyContent: 'space-around',
|
|
8
|
+
paddingVertical: 30,
|
|
9
|
+
},
|
|
10
|
+
viewPickColor: {
|
|
11
|
+
justifyContent: 'center',
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
},
|
|
14
|
+
viewBrightness: {
|
|
15
|
+
paddingTop: 16,
|
|
16
|
+
flexDirection: 'row',
|
|
17
|
+
justifyContent: 'space-between',
|
|
18
|
+
},
|
|
19
|
+
slider: {
|
|
20
|
+
width: 131,
|
|
21
|
+
},
|
|
22
|
+
trackSlider: {
|
|
23
|
+
height: 8,
|
|
24
|
+
borderRadius: 30,
|
|
25
|
+
},
|
|
26
|
+
thumbSlider: {
|
|
27
|
+
backgroundColor: Colors.Primary,
|
|
28
|
+
width: 20,
|
|
29
|
+
height: 20,
|
|
30
|
+
},
|
|
31
|
+
colorPicker: {
|
|
32
|
+
width: '100%',
|
|
33
|
+
height: 'auto',
|
|
34
|
+
},
|
|
35
|
+
valuePercent: {
|
|
36
|
+
width: 40,
|
|
37
|
+
flexDirection: 'row',
|
|
38
|
+
paddingLeft: 16,
|
|
39
|
+
},
|
|
40
|
+
textValuePercent: {
|
|
41
|
+
width: 50,
|
|
42
|
+
},
|
|
43
|
+
LeftBrightness: {
|
|
44
|
+
flex: 1,
|
|
45
|
+
flexDirection: 'row',
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
},
|
|
48
|
+
LeftTextBrightness: {
|
|
49
|
+
paddingTop: 4,
|
|
50
|
+
paddingLeft: 8,
|
|
51
|
+
},
|
|
52
|
+
RightBrightness: {
|
|
53
|
+
flex: 1.2,
|
|
54
|
+
flexDirection: 'row',
|
|
55
|
+
alignItems: 'center',
|
|
56
|
+
},
|
|
57
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { memo, useCallback, useState } from 'react';
|
|
2
|
+
import { SafeAreaView, TouchableOpacity, View } from 'react-native';
|
|
3
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
4
|
+
import { Section } from '../Section';
|
|
5
|
+
import Text from '../Text';
|
|
6
|
+
import styles from './OnOffSmartLockStyle';
|
|
7
|
+
import ButtonLock from '../../../assets/images/Device/button-lock.svg';
|
|
8
|
+
import ButtonUnLock from '../../../assets/images/Device/button-unlock.svg';
|
|
9
|
+
|
|
10
|
+
const OnOffSmartLock = memo(({ actionGroup, doAction, sensor }) => {
|
|
11
|
+
const t = useTranslations();
|
|
12
|
+
const [active, setActive] = useState(true);
|
|
13
|
+
|
|
14
|
+
const handleClickButton = useCallback(() => {
|
|
15
|
+
setActive(!active);
|
|
16
|
+
}, [active]);
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<SafeAreaView style={styles.container}>
|
|
20
|
+
<View style={styles.wrap}>
|
|
21
|
+
<Section style={styles.section}>
|
|
22
|
+
<View style={styles.wrapController}>
|
|
23
|
+
<Text style={styles.textController}>{t('controller')}</Text>
|
|
24
|
+
</View>
|
|
25
|
+
<View style={styles.wrapButtonSmartLock}>
|
|
26
|
+
<TouchableOpacity onPress={handleClickButton}>
|
|
27
|
+
{active ? (
|
|
28
|
+
<ButtonLock style={styles.buttonSmartLock} />
|
|
29
|
+
) : (
|
|
30
|
+
<ButtonUnLock style={styles.buttonSmartLock} />
|
|
31
|
+
)}
|
|
32
|
+
</TouchableOpacity>
|
|
33
|
+
<Text style={styles.textSmartLock}>
|
|
34
|
+
{active ? t('lock') : t('unlock')}
|
|
35
|
+
</Text>
|
|
36
|
+
</View>
|
|
37
|
+
<View style={styles.wrapStatus}>
|
|
38
|
+
<Text style={styles.textStatus}>
|
|
39
|
+
{active ? t('door_is_open') : t('door_is_close')}
|
|
40
|
+
</Text>
|
|
41
|
+
</View>
|
|
42
|
+
</Section>
|
|
43
|
+
</View>
|
|
44
|
+
</SafeAreaView>
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export default OnOffSmartLock;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { Colors } from '../../configs';
|
|
3
|
+
|
|
4
|
+
export default StyleSheet.create({
|
|
5
|
+
container: {
|
|
6
|
+
flex: 1,
|
|
7
|
+
},
|
|
8
|
+
wrap: {
|
|
9
|
+
paddingHorizontal: 16,
|
|
10
|
+
},
|
|
11
|
+
section: {
|
|
12
|
+
borderRadius: 10,
|
|
13
|
+
},
|
|
14
|
+
wrapController: {
|
|
15
|
+
flexDirection: 'row',
|
|
16
|
+
justifyContent: 'flex-start',
|
|
17
|
+
},
|
|
18
|
+
textController: {
|
|
19
|
+
color: Colors.Gray8,
|
|
20
|
+
fontSize: 16,
|
|
21
|
+
marginBottom: 16,
|
|
22
|
+
},
|
|
23
|
+
wrapButtonSmartLock: {
|
|
24
|
+
flexDirection: 'column',
|
|
25
|
+
justifyContent: 'center',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
backgroundColor: Colors.Gray2,
|
|
28
|
+
borderRadius: 10,
|
|
29
|
+
borderColor: Colors.Gray4,
|
|
30
|
+
borderWidth: 1,
|
|
31
|
+
},
|
|
32
|
+
buttonSmartLock: {
|
|
33
|
+
marginTop: 14,
|
|
34
|
+
},
|
|
35
|
+
textSmartLock: {
|
|
36
|
+
color: Colors.Gray9,
|
|
37
|
+
fontSize: 14,
|
|
38
|
+
marginTop: 8,
|
|
39
|
+
marginBottom: 18,
|
|
40
|
+
},
|
|
41
|
+
wrapStatus: {
|
|
42
|
+
flexDirection: 'row',
|
|
43
|
+
justifyContent: 'center',
|
|
44
|
+
alignItems: 'center',
|
|
45
|
+
},
|
|
46
|
+
textStatus: {
|
|
47
|
+
color: Colors.Gray8,
|
|
48
|
+
fontSize: 14,
|
|
49
|
+
marginTop: 16,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
@@ -6,37 +6,39 @@ import { TouchableOpacity, View } from 'react-native';
|
|
|
6
6
|
import { Colors } from '../../../configs';
|
|
7
7
|
import styles from './OnOffButtonTemplateStyle';
|
|
8
8
|
|
|
9
|
-
const OnOffButtonTemplate = memo(
|
|
10
|
-
|
|
9
|
+
const OnOffButtonTemplate = memo(
|
|
10
|
+
({ isOn, triggerAction, actionGroup, isLight = false }) => {
|
|
11
|
+
const { configuration } = actionGroup;
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
<View style={styles.barrierControlContainer}>
|
|
16
|
+
<TouchableOpacity style={styles.bigCircle} onPress={triggerAction}>
|
|
17
|
+
<View style={styles.smallCircle}>
|
|
18
|
+
<Icon
|
|
19
|
+
name={isOn ? configuration.icon_on : configuration.icon_off}
|
|
20
|
+
size={44}
|
|
21
|
+
color={isOn ? Colors.Green7 : Colors.Gray6}
|
|
22
|
+
/>
|
|
23
|
+
<Text
|
|
24
|
+
style={[
|
|
25
|
+
styles.textBig,
|
|
26
|
+
{ color: isOn ? Colors.Gray8 : Colors.Gray6 },
|
|
27
|
+
]}
|
|
28
|
+
>
|
|
29
|
+
{isOn ? configuration.text_on : configuration.text_off}
|
|
30
|
+
</Text>
|
|
31
|
+
</View>
|
|
32
|
+
</TouchableOpacity>
|
|
33
|
+
</View>
|
|
34
|
+
{!!actionGroup.title && !isLight && (
|
|
35
|
+
<Text size={20} semibold center>
|
|
36
|
+
{actionGroup.title}
|
|
37
|
+
</Text>
|
|
38
|
+
)}
|
|
39
|
+
</>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
);
|
|
41
43
|
|
|
42
44
|
export default OnOffButtonTemplate;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import renderer, { act } from 'react-test-renderer';
|
|
3
|
+
import Slider from 'react-native-slider';
|
|
4
|
+
import ColorPicker from 'react-native-wheel-color-picker';
|
|
5
|
+
|
|
6
|
+
import LightActionTemplate from '../LightActionTemplate';
|
|
7
|
+
import { SCProvider } from '../../../context';
|
|
8
|
+
import { mockSCStore } from '../../../context/mockStore';
|
|
9
|
+
|
|
10
|
+
const wrapComponent = (actionGroup) => (
|
|
11
|
+
<SCProvider initState={mockSCStore({})}>
|
|
12
|
+
<LightActionTemplate actionGroup={actionGroup} doAction={jest.fn()} />
|
|
13
|
+
</SCProvider>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
describe('Test CurtainButtonTemplate', () => {
|
|
17
|
+
const actionGroup = {
|
|
18
|
+
configuration: {
|
|
19
|
+
action: 'b1be40f2-f482-4796-8c1a-0431ab49ab5a',
|
|
20
|
+
action_data: {
|
|
21
|
+
color: '#00979D',
|
|
22
|
+
command_prefer_over_bluetooth: true,
|
|
23
|
+
command_prefer_over_googlehome: false,
|
|
24
|
+
command_prefer_over_internet: false,
|
|
25
|
+
googlehome_actions: [Array],
|
|
26
|
+
icon: '123231',
|
|
27
|
+
icon_kit: null,
|
|
28
|
+
id: 5,
|
|
29
|
+
key: 'b1be40f2-f482-4796-8c1a-0431ab49ab5a',
|
|
30
|
+
lg_actions: [Array],
|
|
31
|
+
name: 'change color',
|
|
32
|
+
},
|
|
33
|
+
config_brightness: 18,
|
|
34
|
+
config_color: 17,
|
|
35
|
+
},
|
|
36
|
+
id: 2,
|
|
37
|
+
template: 'light_action_template',
|
|
38
|
+
title: 'controller',
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
let wrapper;
|
|
42
|
+
|
|
43
|
+
test('render LightActionTemplate', async () => {
|
|
44
|
+
await act(() => {
|
|
45
|
+
wrapper = renderer.create(wrapComponent(actionGroup));
|
|
46
|
+
});
|
|
47
|
+
const instance = wrapper.root;
|
|
48
|
+
const slider = instance.findAllByType(Slider);
|
|
49
|
+
const colorPicker = instance.findAllByType(ColorPicker);
|
|
50
|
+
expect(slider.length).toEqual(1);
|
|
51
|
+
expect(colorPicker.length).toEqual(1);
|
|
52
|
+
await act(async () => {
|
|
53
|
+
await slider[0].props.onSlidingComplete();
|
|
54
|
+
});
|
|
55
|
+
await act(async () => {
|
|
56
|
+
await colorPicker[0].props.onColorChangeComplete();
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -10,6 +10,8 @@ import OnOffTemplate from './OnOffTemplate';
|
|
|
10
10
|
import TimerActionTemplate from './TimerActionTemplate';
|
|
11
11
|
import CurtainButtonTemplate from './CurtainButtonTemplate';
|
|
12
12
|
import SmartTiviActionTemplate from './SmartTiviActionTemplate/SmartTiviActionTemplate';
|
|
13
|
+
import LightActionTemplate from './LightActionTemplate';
|
|
14
|
+
import OnOffSmartLock from './OnOffSmartLock';
|
|
13
15
|
|
|
14
16
|
export const getActionComponent = (template) => {
|
|
15
17
|
switch (template) {
|
|
@@ -20,6 +22,8 @@ export const getActionComponent = (template) => {
|
|
|
20
22
|
case 'OnOffButtonActionTemplate':
|
|
21
23
|
case 'OnOffSimpleActionTemplate':
|
|
22
24
|
return OnOffTemplate;
|
|
25
|
+
case 'OnOffButtonActionSmartLock':
|
|
26
|
+
return OnOffSmartLock;
|
|
23
27
|
case 'one_button_action_template': // todo refactor later with backend
|
|
24
28
|
case 'OneBigButtonActionTemplate':
|
|
25
29
|
return OneBigButtonTemplate;
|
|
@@ -35,6 +39,8 @@ export const getActionComponent = (template) => {
|
|
|
35
39
|
return CurtainButtonTemplate;
|
|
36
40
|
case 'SmartTiviActionTemplate':
|
|
37
41
|
return SmartTiviActionTemplate;
|
|
42
|
+
case 'light_action_template':
|
|
43
|
+
return LightActionTemplate;
|
|
38
44
|
default:
|
|
39
45
|
return null;
|
|
40
46
|
}
|
|
@@ -3,10 +3,13 @@ import { View } from 'react-native';
|
|
|
3
3
|
import Text from '../../commons/Text';
|
|
4
4
|
import styles from './styles';
|
|
5
5
|
|
|
6
|
-
const Card = memo(({ title, children, style }) => {
|
|
6
|
+
const Card = memo(({ title, children, style, rightHeaderComponent }) => {
|
|
7
7
|
return (
|
|
8
8
|
<View style={[styles.card, style]}>
|
|
9
|
-
|
|
9
|
+
<View style={styles.headerTitle}>
|
|
10
|
+
{!!title && <Text style={styles.headerLeft}>{title}</Text>}
|
|
11
|
+
{!!rightHeaderComponent && rightHeaderComponent}
|
|
12
|
+
</View>
|
|
10
13
|
{children}
|
|
11
14
|
</View>
|
|
12
15
|
);
|
|
@@ -17,9 +17,8 @@ export default StyleSheet.create({
|
|
|
17
17
|
shadowRadius: 3,
|
|
18
18
|
elevation: 6,
|
|
19
19
|
},
|
|
20
|
-
headerTitle: {
|
|
21
|
-
|
|
22
|
-
alignItems: 'flex-end',
|
|
20
|
+
headerTitle: { justifyContent: 'space-between', flexDirection: 'row' },
|
|
21
|
+
headerLeft: {
|
|
23
22
|
color: Colors.Gray8,
|
|
24
23
|
fontSize: 16,
|
|
25
24
|
lineHeight: 24,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import styles from './DeviceItemStyles';
|
|
4
|
+
import FImage from '../../FImage';
|
|
5
|
+
import Text from '../../Text';
|
|
6
|
+
|
|
7
|
+
const DeviceItem = memo(({ icon, name }) => {
|
|
8
|
+
return (
|
|
9
|
+
<View style={styles.container}>
|
|
10
|
+
{!!icon && <FImage source={{ uri: icon }} style={styles.iconSensor} />}
|
|
11
|
+
<Text style={styles.textItem}>{name}</Text>
|
|
12
|
+
</View>
|
|
13
|
+
);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export default DeviceItem;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { Constants, Colors } from '../../../configs';
|
|
3
|
+
|
|
4
|
+
const marginItem = 12;
|
|
5
|
+
const marginHorizontal = 5;
|
|
6
|
+
const widthItem = (Constants.width - marginHorizontal * 2 - marginItem) / 2;
|
|
7
|
+
const heightItem = (widthItem / 166) * 60;
|
|
8
|
+
|
|
9
|
+
export default StyleSheet.create({
|
|
10
|
+
container: {
|
|
11
|
+
paddingHorizontal: 15,
|
|
12
|
+
borderRadius: 10,
|
|
13
|
+
width: 250,
|
|
14
|
+
height: heightItem,
|
|
15
|
+
borderWidth: 1,
|
|
16
|
+
borderColor: Colors.Gray4,
|
|
17
|
+
backgroundColor: Colors.White,
|
|
18
|
+
justifyContent: 'center',
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
marginBottom: 16,
|
|
21
|
+
flexDirection: 'row',
|
|
22
|
+
shadowColor: Colors.Shadow,
|
|
23
|
+
shadowOffset: {
|
|
24
|
+
width: 0,
|
|
25
|
+
height: 2,
|
|
26
|
+
},
|
|
27
|
+
shadowOpacity: 0.1,
|
|
28
|
+
shadowRadius: 3,
|
|
29
|
+
elevation: 6,
|
|
30
|
+
paddingLeft: 30,
|
|
31
|
+
paddingRight: 30,
|
|
32
|
+
},
|
|
33
|
+
iconSensor: {
|
|
34
|
+
width: 32,
|
|
35
|
+
height: 32,
|
|
36
|
+
resizeMode: 'contain',
|
|
37
|
+
},
|
|
38
|
+
textItem: {
|
|
39
|
+
marginLeft: 15,
|
|
40
|
+
fontSize: 16,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import renderer, { act } from 'react-test-renderer';
|
|
3
|
+
import ConnectingProcess from '../index';
|
|
4
|
+
import { SafeAreaView } from 'react-native';
|
|
5
|
+
import { SCProvider } from '../../../context';
|
|
6
|
+
import { mockSCStore } from '../../../context/mockStore';
|
|
7
|
+
|
|
8
|
+
const wrapComponent = (route) => (
|
|
9
|
+
<SCProvider initState={mockSCStore({})}>
|
|
10
|
+
<ConnectingProcess route={route} />
|
|
11
|
+
</SCProvider>
|
|
12
|
+
);
|
|
13
|
+
describe('Test ConnectingProcess', () => {
|
|
14
|
+
let tree;
|
|
15
|
+
test('create ConnectingProcess', () => {
|
|
16
|
+
const scan_sensor_data = { imei: 'SENSOR-afasdfas' };
|
|
17
|
+
const gateway = { id: 1, name: 'gateway' };
|
|
18
|
+
const station = { id: 1, icon_kit: 'a', name: 'station' };
|
|
19
|
+
const route = { params: { scan_sensor_data, gateway, station } };
|
|
20
|
+
act(() => {
|
|
21
|
+
tree = renderer.create(wrapComponent(route));
|
|
22
|
+
});
|
|
23
|
+
const instance = tree.root;
|
|
24
|
+
const safeAreaView = instance.findAllByType(SafeAreaView);
|
|
25
|
+
expect(safeAreaView).toHaveLength(1);
|
|
26
|
+
});
|
|
27
|
+
});
|