@eohjsc/react-native-smart-city 0.7.0 → 0.7.3-rc2
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/README.md +2 -2
- package/assets/images/Automation-fill.svg +85 -0
- package/assets/images/Scenario-filled.svg +22 -0
- package/assets/images/schedule-fill.svg +48 -0
- package/package.json +5 -5
- package/src/commons/Action/ItemQuickAction.js +1 -1
- package/src/commons/DateTimeRangeChange/index.js +1 -1
- package/src/commons/Device/ItemDevice.js +3 -19
- package/src/commons/MenuActionMore/MenuActionMoreStyles.js +2 -1
- package/src/commons/MenuActionMore/index.js +1 -1
- package/src/commons/NavBar/NavBarStyles.js +1 -1
- package/src/commons/SubUnit/OneTap/ItemOneTap.js +3 -3
- package/src/commons/Unit/HeaderUnit/index.js +29 -21
- package/src/commons/Widgets/IFrameWithConfig/IFrameWithConfig.js +44 -1
- package/src/commons/Widgets/IFrameWithConfig/__tests__/IFrameWithConfig.test.js +69 -0
- package/src/commons/WrapParallaxScrollView/index.js +9 -10
- package/src/configs/Constants.js +3 -3
- package/src/navigations/AddDeviceStack.js +2 -2
- package/src/navigations/AddGatewayStack.js +2 -2
- package/src/navigations/AddLGDeviceStack.js +2 -2
- package/src/navigations/AddMemberStack.js +2 -2
- package/src/navigations/AddSubUnitStack.js +2 -2
- package/src/navigations/AddUnitStack.js +2 -2
- package/src/navigations/AllGatewayStack.js +2 -2
- package/src/navigations/AutomateStack.js +2 -2
- package/src/navigations/EmergencyContactsStack.js +2 -2
- package/src/navigations/GatewayStack.js +2 -2
- package/src/navigations/HanetCameraStack.js +2 -2
- package/src/navigations/Main.js +2 -2
- package/src/navigations/NotificationStack.js +2 -2
- package/src/navigations/SharedStack.js +2 -2
- package/src/navigations/SmartAccountStack.js +2 -2
- package/src/navigations/SmartIrStack.js +2 -2
- package/src/navigations/SmartLockStack.js +2 -2
- package/src/navigations/SmartStack.js +2 -2
- package/src/navigations/TemplateStack.js +2 -2
- package/src/navigations/UnitStack.js +2 -2
- package/src/navigations/utils.js +1 -4
- package/src/screens/Automate/Styles/indexStyles.js +6 -0
- package/src/screens/Automate/__test__/index.test.js +3 -28
- package/src/screens/Automate/index.js +48 -31
- package/src/screens/SharedUnit/index.js +5 -0
- package/src/screens/Unit/Detail.js +1 -5
- package/src/screens/Unit/MoreMenu.js +6 -5
- package/src/screens/Unit/__test__/MoreMenu.test.js +5 -1
- package/src/screens/Unit/components/AutomateScript/index.js +3 -3
- package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +1 -1
- package/src/screens/UnitSummary/index.js +5 -1
- package/src/utils/Apis/axios.js +4 -2
- package/assets/images/OneTap.svg +0 -14
- package/assets/images/Schedule.svg +0 -39
- package/assets/images/ValueChange.svg +0 -49
package/README.md
CHANGED
|
@@ -38,9 +38,9 @@ import {
|
|
|
38
38
|
NotificationStack,
|
|
39
39
|
} from '@eohjsc/react-native-smart-city';
|
|
40
40
|
import Config from 'react-native-config';
|
|
41
|
-
import {
|
|
41
|
+
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
42
42
|
|
|
43
|
-
const Stack =
|
|
43
|
+
const Stack = createNativeStackNavigator();
|
|
44
44
|
|
|
45
45
|
const YourStack = () => {
|
|
46
46
|
useEffect(() => {
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<svg width="32" height="33" viewBox="0 0 32 33" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M4.47926 19H20.6321L26.7817 19C26.8339 19 26.8887 18.9909 26.9383 18.9746C34.0722 16.6164 30.219 10.7773 27.3552 10.1332C27.0858 10.0726 26.8618 9.84915 26.8495 9.57329C26.5905 3.773 21.8246 2.87754 18.9832 3.55914C18.8157 3.5993 18.6337 3.55517 18.5034 3.44261C11.5699 -2.54669 6.02035 3.87361 5.33871 7.83231C5.31063 7.99537 5.20669 8.13981 5.06109 8.21842C-2.14665 12.11 1.98469 17.5056 4.22833 18.93C4.30392 18.978 4.38972 19 4.47926 19Z" fill="url(#paint0_linear_4755_4247)" stroke="url(#paint1_linear_4755_4247)" stroke-width="0.5"/>
|
|
3
|
+
<path d="M14 11L14 15" stroke="white" stroke-width="0.5" stroke-linecap="round"/>
|
|
4
|
+
<path d="M18 11L18 15" stroke="white" stroke-width="0.5" stroke-linecap="round"/>
|
|
5
|
+
<rect x="11.25" y="15.25" width="9.5" height="9.5" rx="0.25" fill="url(#paint2_linear_4755_4247)" stroke="white" stroke-width="0.5"/>
|
|
6
|
+
<circle cx="16" cy="20" r="1.75" fill="white" stroke="url(#paint3_linear_4755_4247)" stroke-width="0.5"/>
|
|
7
|
+
<path d="M14 25L14 30" stroke="url(#paint4_linear_4755_4247)" stroke-width="0.5" stroke-linecap="round"/>
|
|
8
|
+
<path d="M18 25L18 31" stroke="url(#paint5_linear_4755_4247)" stroke-width="0.5" stroke-linecap="round"/>
|
|
9
|
+
<path d="M11 21H2.5C2.22386 21 2 21.2239 2 21.5V26" stroke="url(#paint6_linear_4755_4247)" stroke-width="0.5"/>
|
|
10
|
+
<path d="M11 23H8.5C8.22386 23 8 23.2239 8 23.5V28" stroke="url(#paint7_linear_4755_4247)" stroke-width="0.5"/>
|
|
11
|
+
<path d="M21 23H23.5C23.7761 23 24 23.2239 24 23.5V28" stroke="url(#paint8_linear_4755_4247)" stroke-width="0.5"/>
|
|
12
|
+
<path d="M21 21H29.5C29.7761 21 30 21.2239 30 21.5V26" stroke="url(#paint9_linear_4755_4247)" stroke-width="0.5"/>
|
|
13
|
+
<circle cx="2" cy="26" r="1" fill="url(#paint10_linear_4755_4247)"/>
|
|
14
|
+
<circle cx="8" cy="28" r="1" fill="url(#paint11_linear_4755_4247)"/>
|
|
15
|
+
<circle cx="14" cy="30" r="1" fill="url(#paint12_linear_4755_4247)"/>
|
|
16
|
+
<circle cx="18" cy="32" r="1" fill="url(#paint13_linear_4755_4247)"/>
|
|
17
|
+
<circle cx="24" cy="28" r="1" fill="url(#paint14_linear_4755_4247)"/>
|
|
18
|
+
<circle cx="30" cy="26" r="1" fill="url(#paint15_linear_4755_4247)"/>
|
|
19
|
+
<defs>
|
|
20
|
+
<linearGradient id="paint0_linear_4755_4247" x1="1" y1="1" x2="16.8565" y2="27.4568" gradientUnits="userSpaceOnUse">
|
|
21
|
+
<stop stop-color="#2B6B9F"/>
|
|
22
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
23
|
+
</linearGradient>
|
|
24
|
+
<linearGradient id="paint1_linear_4755_4247" x1="1" y1="1" x2="16.8565" y2="27.4568" gradientUnits="userSpaceOnUse">
|
|
25
|
+
<stop stop-color="#2B6B9F"/>
|
|
26
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
27
|
+
</linearGradient>
|
|
28
|
+
<linearGradient id="paint2_linear_4755_4247" x1="11" y1="15" x2="20.9889" y2="25" gradientUnits="userSpaceOnUse">
|
|
29
|
+
<stop stop-color="#2B6B9F"/>
|
|
30
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
31
|
+
</linearGradient>
|
|
32
|
+
<linearGradient id="paint3_linear_4755_4247" x1="14" y1="18" x2="17.9956" y2="22" gradientUnits="userSpaceOnUse">
|
|
33
|
+
<stop stop-color="#2B6B9F"/>
|
|
34
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
35
|
+
</linearGradient>
|
|
36
|
+
<linearGradient id="paint4_linear_4755_4247" x1="14" y1="25" x2="12.0789" y2="25.3838" gradientUnits="userSpaceOnUse">
|
|
37
|
+
<stop stop-color="#2B6B9F"/>
|
|
38
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
39
|
+
</linearGradient>
|
|
40
|
+
<linearGradient id="paint5_linear_4755_4247" x1="18" y1="25" x2="16.0561" y2="25.3236" gradientUnits="userSpaceOnUse">
|
|
41
|
+
<stop stop-color="#2B6B9F"/>
|
|
42
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
43
|
+
</linearGradient>
|
|
44
|
+
<linearGradient id="paint6_linear_4755_4247" x1="2" y1="21" x2="6.23811" y2="28.637" gradientUnits="userSpaceOnUse">
|
|
45
|
+
<stop stop-color="#2B6B9F"/>
|
|
46
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
47
|
+
</linearGradient>
|
|
48
|
+
<linearGradient id="paint7_linear_4755_4247" x1="8" y1="23" x2="12.4092" y2="25.6484" gradientUnits="userSpaceOnUse">
|
|
49
|
+
<stop stop-color="#2B6B9F"/>
|
|
50
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
51
|
+
</linearGradient>
|
|
52
|
+
<linearGradient id="paint8_linear_4755_4247" x1="24" y1="23" x2="19.5908" y2="25.6484" gradientUnits="userSpaceOnUse">
|
|
53
|
+
<stop stop-color="#2B6B9F"/>
|
|
54
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
55
|
+
</linearGradient>
|
|
56
|
+
<linearGradient id="paint9_linear_4755_4247" x1="30" y1="21" x2="25.7619" y2="28.637" gradientUnits="userSpaceOnUse">
|
|
57
|
+
<stop stop-color="#2B6B9F"/>
|
|
58
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
59
|
+
</linearGradient>
|
|
60
|
+
<linearGradient id="paint10_linear_4755_4247" x1="1" y1="25" x2="2.99779" y2="27" gradientUnits="userSpaceOnUse">
|
|
61
|
+
<stop stop-color="#2B6B9F"/>
|
|
62
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
63
|
+
</linearGradient>
|
|
64
|
+
<linearGradient id="paint11_linear_4755_4247" x1="7" y1="27" x2="8.99779" y2="29" gradientUnits="userSpaceOnUse">
|
|
65
|
+
<stop stop-color="#2B6B9F"/>
|
|
66
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
67
|
+
</linearGradient>
|
|
68
|
+
<linearGradient id="paint12_linear_4755_4247" x1="13" y1="29" x2="14.9978" y2="31" gradientUnits="userSpaceOnUse">
|
|
69
|
+
<stop stop-color="#2B6B9F"/>
|
|
70
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
71
|
+
</linearGradient>
|
|
72
|
+
<linearGradient id="paint13_linear_4755_4247" x1="17" y1="31" x2="18.9978" y2="33" gradientUnits="userSpaceOnUse">
|
|
73
|
+
<stop stop-color="#2B6B9F"/>
|
|
74
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
75
|
+
</linearGradient>
|
|
76
|
+
<linearGradient id="paint14_linear_4755_4247" x1="23" y1="27" x2="24.9978" y2="29" gradientUnits="userSpaceOnUse">
|
|
77
|
+
<stop stop-color="#2B6B9F"/>
|
|
78
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
79
|
+
</linearGradient>
|
|
80
|
+
<linearGradient id="paint15_linear_4755_4247" x1="29" y1="25" x2="30.9978" y2="27" gradientUnits="userSpaceOnUse">
|
|
81
|
+
<stop stop-color="#2B6B9F"/>
|
|
82
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
83
|
+
</linearGradient>
|
|
84
|
+
</defs>
|
|
85
|
+
</svg>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M22 2L26 6V28C26 29.1046 25.1046 30 24 30H8C6.89543 30 6 29.1046 6 28V4C6 2.89543 6.89543 2 8 2H22Z" fill="url(#paint0_linear_4777_3590)"/>
|
|
3
|
+
<path d="M10 5L8 7.5L10 10" stroke="white"/>
|
|
4
|
+
<path d="M15.6667 5L17.6667 7.5L15.6667 10" stroke="white"/>
|
|
5
|
+
<path d="M24 13L12 13" stroke="white" stroke-linecap="square"/>
|
|
6
|
+
<path d="M24 16H12" stroke="white" stroke-linecap="square"/>
|
|
7
|
+
<path d="M24 19H12" stroke="white" stroke-linecap="square"/>
|
|
8
|
+
<path d="M24 22H12" stroke="white" stroke-linecap="square"/>
|
|
9
|
+
<path d="M24 25H12" stroke="white" stroke-linecap="square"/>
|
|
10
|
+
<path d="M9 13H8" stroke="white" stroke-linecap="square"/>
|
|
11
|
+
<path d="M14 5L13 10" stroke="white" stroke-linecap="square"/>
|
|
12
|
+
<path d="M9 16H8" stroke="white" stroke-linecap="square"/>
|
|
13
|
+
<path d="M9 19H8" stroke="white" stroke-linecap="square"/>
|
|
14
|
+
<path d="M9 22H8" stroke="white" stroke-linecap="square"/>
|
|
15
|
+
<path d="M9 25H8" stroke="white" stroke-linecap="square"/>
|
|
16
|
+
<defs>
|
|
17
|
+
<linearGradient id="paint0_linear_4777_3590" x1="6" y1="2" x2="32.4667" y2="20.9257" gradientUnits="userSpaceOnUse">
|
|
18
|
+
<stop stop-color="#2B6B9F"/>
|
|
19
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
20
|
+
</linearGradient>
|
|
21
|
+
</defs>
|
|
22
|
+
</svg>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect x="0.25" y="3.25" width="27.5" height="24.5" rx="0.75" fill="url(#paint0_linear_4755_4196)" stroke="url(#paint1_linear_4755_4196)" stroke-width="0.5"/>
|
|
3
|
+
<circle cx="22.5" cy="22.5" r="4.5" fill="white"/>
|
|
4
|
+
<path d="M0 8.5H27.5" stroke="url(#paint2_linear_4755_4196)" stroke-width="0.5"/>
|
|
5
|
+
<rect x="3.25" y="11.25" width="3.5" height="3.5" fill="white" stroke="url(#paint3_linear_4755_4196)" stroke-width="0.5"/>
|
|
6
|
+
<mask id="path-5-inside-1_4755_4196" fill="white">
|
|
7
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.6001 13H24.4001V14.487C25.343 14.7098 26.2232 15.0946 27.0098 15.6106L28.3537 14.2667L31.0407 16.9537L29.6242 18.3702C30.023 19.0567 30.3255 19.8062 30.513 20.6H32V24.4H30.513C30.3078 25.2686 29.9651 26.084 29.509 26.8221L31.0406 28.3537L28.3536 31.0407L26.822 29.5091C26.084 29.9651 25.2685 30.3079 24.3999 30.5131V32H20.5999V30.513C19.806 30.3255 19.0565 30.023 18.37 29.6242L16.9535 31.0406L14.2665 28.3536L15.6104 27.0097C15.0945 26.2231 14.7097 25.3429 14.4869 24.4H13V20.6H14.4869C14.6917 19.7333 15.0334 18.9195 15.488 18.1828L14.2666 17.0287L16.8765 14.2667L18.1744 15.4932C18.9134 15.036 19.7301 14.6925 20.6001 14.487V13ZM22.5002 26.4583C24.6863 26.4583 26.4585 24.6861 26.4585 22.5C26.4585 20.3139 24.6863 18.5417 22.5002 18.5417C20.3141 18.5417 18.5419 20.3139 18.5419 22.5C18.5419 24.6861 20.3141 26.4583 22.5002 26.4583Z"/>
|
|
8
|
+
</mask>
|
|
9
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.6001 13H24.4001V14.487C25.343 14.7098 26.2232 15.0946 27.0098 15.6106L28.3537 14.2667L31.0407 16.9537L29.6242 18.3702C30.023 19.0567 30.3255 19.8062 30.513 20.6H32V24.4H30.513C30.3078 25.2686 29.9651 26.084 29.509 26.8221L31.0406 28.3537L28.3536 31.0407L26.822 29.5091C26.084 29.9651 25.2685 30.3079 24.3999 30.5131V32H20.5999V30.513C19.806 30.3255 19.0565 30.023 18.37 29.6242L16.9535 31.0406L14.2665 28.3536L15.6104 27.0097C15.0945 26.2231 14.7097 25.3429 14.4869 24.4H13V20.6H14.4869C14.6917 19.7333 15.0334 18.9195 15.488 18.1828L14.2666 17.0287L16.8765 14.2667L18.1744 15.4932C18.9134 15.036 19.7301 14.6925 20.6001 14.487V13ZM22.5002 26.4583C24.6863 26.4583 26.4585 24.6861 26.4585 22.5C26.4585 20.3139 24.6863 18.5417 22.5002 18.5417C20.3141 18.5417 18.5419 20.3139 18.5419 22.5C18.5419 24.6861 20.3141 26.4583 22.5002 26.4583Z" fill="url(#paint4_linear_4755_4196)"/>
|
|
10
|
+
<path d="M24.4001 13H24.9001V12.5H24.4001V13ZM20.6001 13V12.5H20.1001V13H20.6001ZM24.4001 14.487H23.9001V14.8827L24.2851 14.9736L24.4001 14.487ZM27.0098 15.6106L26.7356 16.0287L27.0757 16.2518L27.3634 15.9642L27.0098 15.6106ZM28.3537 14.2667L28.7073 13.9131L28.3537 13.5596L28.0002 13.9131L28.3537 14.2667ZM31.0407 16.9537L31.3943 17.3073L31.7478 16.9537L31.3943 16.6002L31.0407 16.9537ZM29.6242 18.3702L29.2707 18.0167L28.9986 18.2887L29.1919 18.6214L29.6242 18.3702ZM30.513 20.6L30.0264 20.7149L30.1173 21.1H30.513V20.6ZM32 20.6H32.5V20.1H32V20.6ZM32 24.4V24.9H32.5V24.4H32ZM30.513 24.4V23.9H30.1173L30.0264 24.285L30.513 24.4ZM29.509 26.8221L29.0837 26.5592L28.8757 26.8958L29.1555 27.1756L29.509 26.8221ZM31.0406 28.3537L31.3942 28.7072L31.7477 28.3537L31.3942 28.0001L31.0406 28.3537ZM28.3536 31.0407L28.0001 31.3942L28.3536 31.7478L28.7072 31.3942L28.3536 31.0407ZM26.822 29.5091L27.1756 29.1555L26.8958 28.8757L26.5592 29.0837L26.822 29.5091ZM24.3999 30.5131L24.285 30.0264L23.8999 30.1174V30.5131H24.3999ZM24.3999 32V32.5H24.8999V32H24.3999ZM20.5999 32H20.0999V32.5H20.5999V32ZM20.5999 30.513H21.0999V30.1174L20.7149 30.0264L20.5999 30.513ZM18.37 29.6242L18.6211 29.1918L18.2885 28.9986L18.0164 29.2706L18.37 29.6242ZM16.9535 31.0406L16.6 31.3942L16.9535 31.7477L17.3071 31.3942L16.9535 31.0406ZM14.2665 28.3536L13.913 28.0001L13.5594 28.3536L13.913 28.7072L14.2665 28.3536ZM15.6104 27.0097L15.964 27.3633L16.2516 27.0756L16.0285 26.7355L15.6104 27.0097ZM14.4869 24.4L14.9735 24.2851L14.8826 23.9H14.4869V24.4ZM13 24.4H12.5V24.9H13V24.4ZM13 20.6V20.1H12.5V20.6H13ZM14.4869 20.6V21.1H14.8826L14.9736 20.715L14.4869 20.6ZM15.488 18.1828L15.9135 18.4453L16.1272 18.0989L15.8314 17.8194L15.488 18.1828ZM14.2666 17.0287L13.9032 16.6853L13.5598 17.0487L13.9232 17.3921L14.2666 17.0287ZM16.8765 14.2667L17.2199 13.9033L16.8565 13.5599L16.5131 13.9233L16.8765 14.2667ZM18.1744 15.4932L17.831 15.8566L18.1105 16.1206L18.4375 15.9184L18.1744 15.4932ZM20.6001 14.487L20.715 14.9736L21.1001 14.8826V14.487H20.6001ZM24.4001 12.5H20.6001V13.5H24.4001V12.5ZM24.9001 14.487V13H23.9001V14.487H24.9001ZM27.2841 15.1925C26.4498 14.6453 25.5157 14.2368 24.515 14.0004L24.2851 14.9736C25.1702 15.1827 25.9967 15.544 26.7356 16.0287L27.2841 15.1925ZM28.0002 13.9131L26.6563 15.257L27.3634 15.9642L28.7073 14.6203L28.0002 13.9131ZM31.3943 16.6002L28.7073 13.9131L28.0002 14.6203L30.6872 17.3073L31.3943 16.6002ZM29.9778 18.7238L31.3943 17.3073L30.6872 16.6002L29.2707 18.0167L29.9778 18.7238ZM30.9996 20.485C30.8006 19.6426 30.4796 18.8473 30.0566 18.1191L29.1919 18.6214C29.5664 19.2661 29.8503 19.9697 30.0264 20.7149L30.9996 20.485ZM32 20.1H30.513V21.1H32V20.1ZM32.5 24.4V20.6H31.5V24.4H32.5ZM30.513 24.9H32V23.9H30.513V24.9ZM29.9344 27.0849C30.4181 26.302 30.7819 25.4368 30.9996 24.5149L30.0264 24.285C29.8338 25.1004 29.512 25.866 29.0837 26.5592L29.9344 27.0849ZM31.3942 28.0001L29.8626 26.4685L29.1555 27.1756L30.6871 28.7072L31.3942 28.0001ZM28.7072 31.3942L31.3942 28.7072L30.6871 28.0001L28.0001 30.6871L28.7072 31.3942ZM26.4685 29.8626L28.0001 31.3942L28.7072 30.6871L27.1756 29.1555L26.4685 29.8626ZM24.5149 30.9997C25.4367 30.7819 26.302 30.4182 27.0848 29.9344L26.5592 29.0837C25.866 29.5121 25.1004 29.8338 24.285 30.0264L24.5149 30.9997ZM24.8999 32V30.5131H23.8999V32H24.8999ZM20.5999 32.5H24.3999V31.5H20.5999V32.5ZM20.0999 30.513V32H21.0999V30.513H20.0999ZM18.1188 30.0565C18.8471 30.4796 19.6424 30.8006 20.485 30.9997L20.7149 30.0264C19.9696 29.8504 19.2659 29.5664 18.6211 29.1918L18.1188 30.0565ZM17.3071 31.3942L18.7235 29.9777L18.0164 29.2706L16.6 30.6871L17.3071 31.3942ZM13.913 28.7072L16.6 31.3942L17.3071 30.6871L14.6201 28.0001L13.913 28.7072ZM15.2569 26.6562L13.913 28.0001L14.6201 28.7072L15.964 27.3633L15.2569 26.6562ZM14.0003 24.515C14.2367 25.5156 14.6451 26.4496 15.1923 27.2839L16.0285 26.7355C15.5439 25.9966 15.1826 25.1702 14.9735 24.2851L14.0003 24.515ZM13 24.9H14.4869V23.9H13V24.9ZM12.5 20.6V24.4H13.5V20.6H12.5ZM14.4869 20.1H13V21.1H14.4869V20.1ZM15.0625 17.9202C14.5803 18.7017 14.2176 19.5652 14.0003 20.4851L14.9736 20.715C15.1657 19.9014 15.4865 19.1373 15.9135 18.4453L15.0625 17.9202ZM15.8314 17.8194L14.61 16.6653L13.9232 17.3921L15.1446 18.5462L15.8314 17.8194ZM14.63 17.3721L17.2399 14.6101L16.5131 13.9233L13.9032 16.6853L14.63 17.3721ZM16.5331 14.6301L17.831 15.8566L18.5178 15.1297L17.2199 13.9033L16.5331 14.6301ZM20.4851 14.0004C19.5618 14.2185 18.6952 14.583 17.9114 15.0679L18.4375 15.9184C19.1315 15.489 19.8983 15.1665 20.715 14.9736L20.4851 14.0004ZM20.1001 13V14.487H21.1001V13H20.1001ZM25.9585 22.5C25.9585 24.41 24.4102 25.9583 22.5002 25.9583V26.9583C24.9625 26.9583 26.9585 24.9623 26.9585 22.5H25.9585ZM22.5002 19.0417C24.4102 19.0417 25.9585 20.59 25.9585 22.5H26.9585C26.9585 20.0377 24.9625 18.0417 22.5002 18.0417V19.0417ZM19.0419 22.5C19.0419 20.59 20.5902 19.0417 22.5002 19.0417V18.0417C20.0379 18.0417 18.0419 20.0377 18.0419 22.5H19.0419ZM22.5002 25.9583C20.5902 25.9583 19.0419 24.41 19.0419 22.5H18.0419C18.0419 24.9623 20.0379 26.9583 22.5002 26.9583V25.9583Z" fill="white" mask="url(#path-5-inside-1_4755_4196)"/>
|
|
11
|
+
<rect x="4.25" y="0.25" width="2.5" height="5.5" rx="1.25" fill="white" stroke="url(#paint5_linear_4755_4196)" stroke-width="0.5"/>
|
|
12
|
+
<rect x="21.25" y="0.25" width="2.5" height="5.5" rx="1.25" fill="white" stroke="url(#paint6_linear_4755_4196)" stroke-width="0.5"/>
|
|
13
|
+
<path d="M22 20V23.9C22 23.9552 22.0448 24 22.1 24H24" stroke="url(#paint7_linear_4755_4196)" stroke-width="0.5"/>
|
|
14
|
+
<defs>
|
|
15
|
+
<linearGradient id="paint0_linear_4755_4196" x1="0" y1="3" x2="24.8097" y2="30.8177" gradientUnits="userSpaceOnUse">
|
|
16
|
+
<stop stop-color="#2B6B9F"/>
|
|
17
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
18
|
+
</linearGradient>
|
|
19
|
+
<linearGradient id="paint1_linear_4755_4196" x1="0" y1="3" x2="24.8097" y2="30.8177" gradientUnits="userSpaceOnUse">
|
|
20
|
+
<stop stop-color="#2B6B9F"/>
|
|
21
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
22
|
+
</linearGradient>
|
|
23
|
+
<linearGradient id="paint2_linear_4755_4196" x1="0" y1="8.5" x2="0.0724708" y2="10.4952" gradientUnits="userSpaceOnUse">
|
|
24
|
+
<stop stop-color="#2B6B9F"/>
|
|
25
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
26
|
+
</linearGradient>
|
|
27
|
+
<linearGradient id="paint3_linear_4755_4196" x1="3" y1="11" x2="6.99557" y2="15" gradientUnits="userSpaceOnUse">
|
|
28
|
+
<stop stop-color="#2B6B9F"/>
|
|
29
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
30
|
+
</linearGradient>
|
|
31
|
+
<linearGradient id="paint4_linear_4755_4196" x1="13" y1="13" x2="31.979" y2="32" gradientUnits="userSpaceOnUse">
|
|
32
|
+
<stop stop-color="#2B6B9F"/>
|
|
33
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
34
|
+
</linearGradient>
|
|
35
|
+
<linearGradient id="paint5_linear_4755_4196" x1="4" y1="0" x2="8.79788" y2="2.4016" gradientUnits="userSpaceOnUse">
|
|
36
|
+
<stop stop-color="#2B6B9F"/>
|
|
37
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
38
|
+
</linearGradient>
|
|
39
|
+
<linearGradient id="paint6_linear_4755_4196" x1="21" y1="0" x2="25.7979" y2="2.4016" gradientUnits="userSpaceOnUse">
|
|
40
|
+
<stop stop-color="#2B6B9F"/>
|
|
41
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
42
|
+
</linearGradient>
|
|
43
|
+
<linearGradient id="paint7_linear_4755_4196" x1="22" y1="20" x2="25.1986" y2="21.6011" gradientUnits="userSpaceOnUse">
|
|
44
|
+
<stop stop-color="#2B6B9F"/>
|
|
45
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
46
|
+
</linearGradient>
|
|
47
|
+
</defs>
|
|
48
|
+
</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.7.
|
|
4
|
+
"version": "0.7.3-rc2",
|
|
5
5
|
"description": "TODO",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"files": [
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@react-navigation/bottom-tabs": "^6.5.20",
|
|
86
86
|
"@react-navigation/drawer": "^6.6.15",
|
|
87
87
|
"@react-navigation/native": "^6.1.17",
|
|
88
|
-
"@react-navigation/stack": "^6.
|
|
88
|
+
"@react-navigation/native-stack": "^6.11.0",
|
|
89
89
|
"@sentry/react-native": "^5.24.1",
|
|
90
90
|
"@testing-library/react-hooks": "^6.0.0",
|
|
91
91
|
"@types/jest": "^26.0.19",
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
"react-dom": "18.2.0",
|
|
135
135
|
"react-hooks-global-state": "^2.1.0",
|
|
136
136
|
"react-i18next": "^11.8.12",
|
|
137
|
-
"react-native": "0.
|
|
137
|
+
"react-native": "0.73.9",
|
|
138
138
|
"react-native-alert-async": "^1.0.5",
|
|
139
139
|
"react-native-android-location-enabler": "^1.2.2",
|
|
140
140
|
"react-native-base64": "^0.1.0",
|
|
@@ -169,7 +169,7 @@
|
|
|
169
169
|
"react-native-permissions": "3.6.0",
|
|
170
170
|
"react-native-popover-view": "^5.1.8",
|
|
171
171
|
"react-native-progress": "^5.0.0",
|
|
172
|
-
"react-native-reanimated": "
|
|
172
|
+
"react-native-reanimated": "3.3.0",
|
|
173
173
|
"react-native-responsive-fontsize": "^0.5.1",
|
|
174
174
|
"react-native-safe-area-context": "^3.1.1",
|
|
175
175
|
"react-native-screens": "^3.32.0",
|
|
@@ -181,7 +181,7 @@
|
|
|
181
181
|
"react-native-vector-icons": "^10.1.0",
|
|
182
182
|
"react-native-version-check": "^3.4.2",
|
|
183
183
|
"react-native-vlc-media-player": "^1.0.67",
|
|
184
|
-
"react-native-webview": "^
|
|
184
|
+
"react-native-webview": "^13.10.5",
|
|
185
185
|
"react-native-wheel-color-picker": "^1.2.0",
|
|
186
186
|
"react-native-wheel-scrollview-picker": "^1.2.2",
|
|
187
187
|
"react-native-wifi-reborn": "4.5.0",
|
|
@@ -113,7 +113,7 @@ const ItemQuickAction = memo(({ sensor, wrapperStyle, setStatus }) => {
|
|
|
113
113
|
>
|
|
114
114
|
<View style={wrapperStyle}>
|
|
115
115
|
<IconComponent
|
|
116
|
-
icon={action?.icon_kit || action?.icon || '
|
|
116
|
+
icon={action?.icon_kit || action?.icon || 'poweroff'}
|
|
117
117
|
isOn={isOn}
|
|
118
118
|
size={20}
|
|
119
119
|
/>
|
|
@@ -21,7 +21,8 @@ const ItemDevice = memo(
|
|
|
21
21
|
({ description, title, sensor, unit, station, wrapStyle }) => {
|
|
22
22
|
const t = useTranslations();
|
|
23
23
|
const navigation = useNavigation();
|
|
24
|
-
const { is_managed_by_backend, device_type, icon_kit, icon } =
|
|
24
|
+
const { is_managed_by_backend, device_type, icon_kit, icon, quick_action } =
|
|
25
|
+
sensor;
|
|
25
26
|
|
|
26
27
|
const {
|
|
27
28
|
isConnected: isEoHBackendConnected,
|
|
@@ -72,24 +73,7 @@ const ItemDevice = memo(
|
|
|
72
73
|
t,
|
|
73
74
|
]);
|
|
74
75
|
|
|
75
|
-
const canRenderQuickAction = useMemo(() =>
|
|
76
|
-
if (is_managed_by_backend) {
|
|
77
|
-
return (
|
|
78
|
-
device_type === DEVICE_TYPE.LG_THINQ ||
|
|
79
|
-
isBluetoothConnected ||
|
|
80
|
-
!isFetchingStatusFromEoHBackend
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
return device_type === DEVICE_TYPE.GOOGLE_HOME
|
|
84
|
-
? isHomeAssistantConnected
|
|
85
|
-
: true;
|
|
86
|
-
}, [
|
|
87
|
-
device_type,
|
|
88
|
-
isBluetoothConnected,
|
|
89
|
-
isFetchingStatusFromEoHBackend,
|
|
90
|
-
isHomeAssistantConnected,
|
|
91
|
-
is_managed_by_backend,
|
|
92
|
-
]);
|
|
76
|
+
const canRenderQuickAction = useMemo(() => !!quick_action, [quick_action]);
|
|
93
77
|
|
|
94
78
|
return (
|
|
95
79
|
<ItemDeviceWrapper
|
|
@@ -4,9 +4,9 @@ import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
|
4
4
|
import moment from 'moment';
|
|
5
5
|
import Text from '../../Text';
|
|
6
6
|
import { API, Colors } from '../../../configs';
|
|
7
|
-
import OneTap from '../../../../assets/images/
|
|
8
|
-
import ValueChange from '../../../../assets/images/
|
|
9
|
-
import Schedule from '../../../../assets/images/
|
|
7
|
+
import OneTap from '../../../../assets/images/Scenario-filled.svg';
|
|
8
|
+
import ValueChange from '../../../../assets/images/Automation-fill.svg';
|
|
9
|
+
import Schedule from '../../../../assets/images/schedule-fill.svg';
|
|
10
10
|
import Event from '../../../../assets/images/Event.svg';
|
|
11
11
|
import CheckCircle from '../../../../assets/images/CheckCircle.svg';
|
|
12
12
|
import FImage from '../../FImage';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { memo, useCallback, useRef } from 'react';
|
|
1
|
+
import React, { memo, useCallback, useMemo, useRef } from 'react';
|
|
2
2
|
import { StatusBar, StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
3
3
|
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
4
4
|
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
@@ -17,14 +17,15 @@ import AddMenu from '../../../screens/Unit/AddMenu';
|
|
|
17
17
|
import MoreMenu from '../../../screens/Unit/MoreMenu';
|
|
18
18
|
import Text from '../../Text';
|
|
19
19
|
|
|
20
|
-
const HeaderUnit = memo(({
|
|
20
|
+
const HeaderUnit = memo(({ transparent, unit }) => {
|
|
21
|
+
const { user_id, name = '' } = unit;
|
|
21
22
|
const { goBack, navigate } = useNavigation();
|
|
22
23
|
const { routeName } = useRoute().params || {};
|
|
23
24
|
const buttonMoreRef = useRef(null);
|
|
24
25
|
const t = useTranslations();
|
|
25
26
|
|
|
26
27
|
const [showAdd, setShowAdd, setHideAdd] = useBoolean();
|
|
27
|
-
const { isOwner } = useIsOwnerOfUnit(
|
|
28
|
+
const { isOwner } = useIsOwnerOfUnit(user_id);
|
|
28
29
|
|
|
29
30
|
const { childRef, showingPopover, showPopoverWithRef, hidePopover } =
|
|
30
31
|
usePopover();
|
|
@@ -33,38 +34,44 @@ const HeaderUnit = memo(({ unit, unitData }) => {
|
|
|
33
34
|
showPopoverWithRef(buttonMoreRef);
|
|
34
35
|
}, [showPopoverWithRef]);
|
|
35
36
|
|
|
37
|
+
const handleGoBack = useCallback(() => {
|
|
38
|
+
if (routeName) {
|
|
39
|
+
navigate(routeName);
|
|
40
|
+
} else {
|
|
41
|
+
goBack();
|
|
42
|
+
}
|
|
43
|
+
}, [goBack, navigate, routeName]);
|
|
44
|
+
|
|
45
|
+
const colorHeader = useMemo(() => {
|
|
46
|
+
return transparent ? Colors.White : Colors.Black;
|
|
47
|
+
}, [transparent]);
|
|
48
|
+
|
|
36
49
|
return (
|
|
37
50
|
<View style={styles.container}>
|
|
38
51
|
<TouchableOpacity
|
|
39
52
|
accessibilityLabel={AccessibilityLabel.HEADER_UNIT_BUTTON_BACK}
|
|
40
|
-
onPress={
|
|
41
|
-
if (routeName) {
|
|
42
|
-
navigate(routeName);
|
|
43
|
-
} else {
|
|
44
|
-
goBack();
|
|
45
|
-
}
|
|
46
|
-
}}
|
|
53
|
+
onPress={handleGoBack}
|
|
47
54
|
>
|
|
48
55
|
<View style={styles.btnLeft}>
|
|
49
|
-
<AntDesign name={'left'} size={27} color={
|
|
56
|
+
<AntDesign name={'left'} size={27} color={colorHeader} />
|
|
50
57
|
</View>
|
|
51
58
|
</TouchableOpacity>
|
|
52
|
-
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
</
|
|
58
|
-
|
|
59
|
+
{!transparent && (
|
|
60
|
+
<View style={styles.boxTitle}>
|
|
61
|
+
<Text semibold style={styles.txtHeader} numberOfLines={1}>
|
|
62
|
+
{t('Welcome {name}', { name: name })}
|
|
63
|
+
</Text>
|
|
64
|
+
</View>
|
|
65
|
+
)}
|
|
59
66
|
|
|
60
67
|
<View style={styles.boxRight}>
|
|
61
|
-
{
|
|
68
|
+
{isOwner && (
|
|
62
69
|
<TouchableOpacity
|
|
63
70
|
accessibilityLabel={AccessibilityLabel.HEADER_UNIT_BUTTON_ADD}
|
|
64
71
|
onPress={setShowAdd}
|
|
65
72
|
>
|
|
66
73
|
<View style={styles.btnAdd}>
|
|
67
|
-
<AntDesign name={'plus'} size={27} color={
|
|
74
|
+
<AntDesign name={'plus'} size={27} color={colorHeader} />
|
|
68
75
|
</View>
|
|
69
76
|
</TouchableOpacity>
|
|
70
77
|
)}
|
|
@@ -74,7 +81,7 @@ const HeaderUnit = memo(({ unit, unitData }) => {
|
|
|
74
81
|
accessibilityLabel={AccessibilityLabel.HEADER_UNIT_BUTTON_MORE}
|
|
75
82
|
>
|
|
76
83
|
<View style={styles.btnMore}>
|
|
77
|
-
<MaterialIcons name={'more-vert'} size={27} color={
|
|
84
|
+
<MaterialIcons name={'more-vert'} size={27} color={colorHeader} />
|
|
78
85
|
</View>
|
|
79
86
|
</TouchableOpacity>
|
|
80
87
|
</View>
|
|
@@ -98,6 +105,7 @@ const HeaderUnit = memo(({ unit, unitData }) => {
|
|
|
98
105
|
});
|
|
99
106
|
|
|
100
107
|
export default HeaderUnit;
|
|
108
|
+
|
|
101
109
|
const stickyHeaderHeight =
|
|
102
110
|
Device.TopbarHeight + (Device.isIOS ? 0 : StatusBar.currentHeight);
|
|
103
111
|
|
|
@@ -9,10 +9,16 @@ import { useFetchConfigHistory } from '../../UnitSummary/ConfigHistoryChart';
|
|
|
9
9
|
import API from '../../../configs/API';
|
|
10
10
|
import WebView from 'react-native-webview';
|
|
11
11
|
import { TouchableOpacity, View } from 'react-native';
|
|
12
|
+
import { useRemoteControl } from '../../../hooks/IoT';
|
|
13
|
+
import { useSCContextSelector } from '../../../context';
|
|
12
14
|
|
|
13
15
|
const IFrameWithConfig = memo(
|
|
14
16
|
({ item = {}, widgetStyle, isWidgetBox, isSetting, isEditing }) => {
|
|
15
17
|
const ref = useRef();
|
|
18
|
+
const sendRemoteCommand = useRemoteControl();
|
|
19
|
+
const userId = useSCContextSelector(
|
|
20
|
+
(state) => state?.auth?.account?.user?.id
|
|
21
|
+
);
|
|
16
22
|
|
|
17
23
|
const { configuration } = item;
|
|
18
24
|
const { url } = configuration || {};
|
|
@@ -66,6 +72,34 @@ const IFrameWithConfig = memo(
|
|
|
66
72
|
}
|
|
67
73
|
}, [item?.id, url]);
|
|
68
74
|
|
|
75
|
+
const triggerAction = useCallback(
|
|
76
|
+
async ({ actionKey, actionIndex, data }) => {
|
|
77
|
+
let action = null;
|
|
78
|
+
if (!configuration?.actions) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (actionIndex !== undefined) {
|
|
82
|
+
action = configuration?.actions[actionIndex];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (actionKey) {
|
|
86
|
+
action = configuration?.actions.find(
|
|
87
|
+
(act) => act.action === actionKey
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
if (!action) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
await sendRemoteCommand(
|
|
94
|
+
action.action_data.end_device,
|
|
95
|
+
action.action_data,
|
|
96
|
+
data,
|
|
97
|
+
userId
|
|
98
|
+
);
|
|
99
|
+
},
|
|
100
|
+
[configuration?.actions, sendRemoteCommand, userId]
|
|
101
|
+
);
|
|
102
|
+
|
|
69
103
|
const onMessage = useCallback(
|
|
70
104
|
async (event) => {
|
|
71
105
|
const eventData = event.nativeEvent.data
|
|
@@ -95,9 +129,18 @@ const IFrameWithConfig = memo(
|
|
|
95
129
|
case 'requestAdjustMobileHeight':
|
|
96
130
|
setHeight(data);
|
|
97
131
|
break;
|
|
132
|
+
case 'triggerAction':
|
|
133
|
+
triggerAction(data);
|
|
134
|
+
break;
|
|
98
135
|
}
|
|
99
136
|
},
|
|
100
|
-
[
|
|
137
|
+
[
|
|
138
|
+
configuration,
|
|
139
|
+
fetchDataDisplayHistory,
|
|
140
|
+
item.id,
|
|
141
|
+
postMessage,
|
|
142
|
+
triggerAction,
|
|
143
|
+
]
|
|
101
144
|
);
|
|
102
145
|
|
|
103
146
|
useEffect(() => {
|
|
@@ -11,6 +11,14 @@ import WebView from 'react-native-webview';
|
|
|
11
11
|
import { TouchableOpacity, View } from 'react-native';
|
|
12
12
|
import { refFunctions } from '../../../../../__mocks__/react-native-webview';
|
|
13
13
|
|
|
14
|
+
const mockDoAction = jest.fn();
|
|
15
|
+
jest.mock('../../../../hooks/IoT', () => {
|
|
16
|
+
return {
|
|
17
|
+
...jest.requireActual('../../../../hooks/IoT'),
|
|
18
|
+
useRemoteControl: () => mockDoAction,
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
|
|
14
22
|
jest.mock('../../../../iot/states', () => {
|
|
15
23
|
return {
|
|
16
24
|
...jest.requireActual('../../../../iot/states'),
|
|
@@ -27,6 +35,7 @@ describe('Test IFrame With Config', () => {
|
|
|
27
35
|
};
|
|
28
36
|
|
|
29
37
|
beforeEach(() => {
|
|
38
|
+
mockDoAction.mockClear();
|
|
30
39
|
item = {
|
|
31
40
|
id: 1,
|
|
32
41
|
configuration: {
|
|
@@ -281,4 +290,64 @@ describe('Test IFrame With Config', () => {
|
|
|
281
290
|
'window.postMessage(' + JSON.stringify(message) + ', "*")'
|
|
282
291
|
);
|
|
283
292
|
};
|
|
293
|
+
|
|
294
|
+
const triggerAction = async (
|
|
295
|
+
data,
|
|
296
|
+
actions = [
|
|
297
|
+
{
|
|
298
|
+
action: 'xxx',
|
|
299
|
+
action_data: {
|
|
300
|
+
end_device: 1,
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
]
|
|
304
|
+
) => {
|
|
305
|
+
item.configuration.actions = actions;
|
|
306
|
+
const { root } = await render(<IFrameWithConfig isWidgetBox item={item} />);
|
|
307
|
+
const webview = root.findByType(WebView);
|
|
308
|
+
|
|
309
|
+
await act(async () => {
|
|
310
|
+
webview.props.onMessage({
|
|
311
|
+
nativeEvent: {
|
|
312
|
+
data: JSON.stringify({
|
|
313
|
+
type: 'triggerAction',
|
|
314
|
+
eraWidgetId: 1,
|
|
315
|
+
source: 'eraIframeWidget',
|
|
316
|
+
data: data,
|
|
317
|
+
}),
|
|
318
|
+
origin: 'http://localhost',
|
|
319
|
+
},
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
test('test iframe trigger action', async () => {
|
|
325
|
+
await triggerAction({ actionKey: 'xxx' });
|
|
326
|
+
expect(mockDoAction).toHaveBeenCalledWith(
|
|
327
|
+
item.configuration.actions[0].action_data.end_device,
|
|
328
|
+
item.configuration.actions[0].action_data,
|
|
329
|
+
undefined,
|
|
330
|
+
undefined
|
|
331
|
+
);
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
test('test iframe trigger by index', async () => {
|
|
335
|
+
await triggerAction({ actionIndex: 0 });
|
|
336
|
+
expect(mockDoAction).toHaveBeenCalledWith(
|
|
337
|
+
item.configuration.actions[0].action_data.end_device,
|
|
338
|
+
item.configuration.actions[0].action_data,
|
|
339
|
+
undefined,
|
|
340
|
+
undefined
|
|
341
|
+
);
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
test('test iframe trigger not exists', async () => {
|
|
345
|
+
await triggerAction({ actionIndex: -1 });
|
|
346
|
+
expect(mockDoAction).toHaveBeenCalledTimes(0);
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
test('test iframe trigger no actions', async () => {
|
|
350
|
+
await triggerAction({ actionIndex: 0 }, []);
|
|
351
|
+
expect(mockDoAction).toHaveBeenCalledTimes(0);
|
|
352
|
+
});
|
|
284
353
|
});
|
|
@@ -13,12 +13,13 @@ import ParallaxScrollView from '../../libs/react-native-parallax-scroll-view';
|
|
|
13
13
|
const stickyHeaderHeight =
|
|
14
14
|
Device.TopbarHeight + (Device.isIOS ? 0 : StatusBar.currentHeight);
|
|
15
15
|
|
|
16
|
-
const WrapParallaxScrollView = ({ children, unit,
|
|
16
|
+
const WrapParallaxScrollView = ({ children, unit, onRefresh }) => {
|
|
17
|
+
const { name = '', background } = unit;
|
|
17
18
|
const t = useTranslations();
|
|
18
19
|
const renderForeground = useCallback(
|
|
19
20
|
() => (
|
|
20
21
|
<View style={styles.wrap}>
|
|
21
|
-
<HeaderUnit unit={unit}
|
|
22
|
+
<HeaderUnit transparent unit={unit} />
|
|
22
23
|
<Text
|
|
23
24
|
numberOfLines={1}
|
|
24
25
|
semibold
|
|
@@ -26,12 +27,12 @@ const WrapParallaxScrollView = ({ children, unit, unitData, onRefresh }) => {
|
|
|
26
27
|
accessibilityLabel={AccessibilityLabel.HEADER_UNIT_BUTTON_TEXT}
|
|
27
28
|
>
|
|
28
29
|
{t('Welcome {name}', {
|
|
29
|
-
name:
|
|
30
|
+
name: name,
|
|
30
31
|
})}
|
|
31
32
|
</Text>
|
|
32
33
|
</View>
|
|
33
34
|
),
|
|
34
|
-
[unit,
|
|
35
|
+
[unit, t, name]
|
|
35
36
|
);
|
|
36
37
|
const renderBackground = useCallback(
|
|
37
38
|
() => (
|
|
@@ -39,9 +40,7 @@ const WrapParallaxScrollView = ({ children, unit, unitData, onRefresh }) => {
|
|
|
39
40
|
<FImage
|
|
40
41
|
style={styles.image}
|
|
41
42
|
source={
|
|
42
|
-
|
|
43
|
-
? { uri: unit.background }
|
|
44
|
-
: SCConfig.appUnitDefaultBackground
|
|
43
|
+
background ? { uri: background } : SCConfig.appUnitDefaultBackground
|
|
45
44
|
}
|
|
46
45
|
defaultSource={Images.BgUnit}
|
|
47
46
|
resizeMode="cover"
|
|
@@ -52,15 +51,15 @@ const WrapParallaxScrollView = ({ children, unit, unitData, onRefresh }) => {
|
|
|
52
51
|
/>
|
|
53
52
|
</View>
|
|
54
53
|
),
|
|
55
|
-
[
|
|
54
|
+
[background]
|
|
56
55
|
);
|
|
57
56
|
const renderStickyHeader = useCallback(
|
|
58
57
|
() => (
|
|
59
58
|
<View style={styles.stickyHeader}>
|
|
60
|
-
<HeaderUnit unit={unit}
|
|
59
|
+
<HeaderUnit unit={unit} />
|
|
61
60
|
</View>
|
|
62
61
|
),
|
|
63
|
-
[unit
|
|
62
|
+
[unit]
|
|
64
63
|
);
|
|
65
64
|
return (
|
|
66
65
|
<ParallaxScrollView
|