@eohjsc/react-native-smart-city 0.3.4 → 0.3.7
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 +15 -36
- package/package.json +5 -9
- package/react-native-smart-city.podspec +0 -1
- package/src/commons/Action/ItemQuickAction.js +4 -16
- package/src/commons/Action/__test__/ItemQuickAction.test.js +6 -11
- package/src/commons/ActionGroup/ColorPickerTemplate.js +24 -37
- package/src/commons/ActionGroup/CurtainButtonTemplate.js +5 -10
- package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +31 -12
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/__test__/index.test.js +0 -4
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscode.js +1 -1
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +0 -14
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/index.js +0 -1
- package/src/commons/ActionGroup/OnOffTemplate/OnOffButtonTemplate.js +2 -8
- package/src/commons/ActionGroup/OnOffTemplate/OnOffSimpleTemplate.js +10 -10
- package/src/commons/ActionGroup/OnOffTemplate/index.js +2 -3
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +9 -7
- package/src/commons/ActionGroup/SliderRangeTemplate.js +2 -6
- package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +3 -7
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +8 -22
- package/src/commons/ActionGroup/TimerActionTemplate.js +3 -11
- package/src/commons/ActionGroup/TwoButtonTemplate/index.js +5 -1
- package/src/commons/ActionGroup/__test__/CurtainButtonTemplate.test.js +4 -53
- package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +83 -3
- package/src/commons/ActionGroup/__test__/OnOffButtonTemplate.test.js +14 -14
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +78 -53
- package/src/commons/ActionGroup/__test__/OneBigButtonTemplate.test.js +20 -36
- package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +57 -1
- package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +6 -58
- package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +1 -49
- package/src/commons/ActionGroup/__test__/index.test.js +4 -142
- package/src/commons/Auth/AccountList.js +1 -1
- package/src/commons/Automate/ItemAutomate.js +3 -1
- package/src/commons/Connecting/__test__/Connecting.test.js +2 -19
- package/src/commons/ConnectingProcess/DeviceItem/DeviceItem.js +3 -7
- package/src/commons/ConnectingProcess/DeviceItem/DeviceItemStyles.js +11 -8
- package/src/commons/ConnectingProcess/__test__/Connecting.test.js +3 -136
- package/src/commons/ConnectingProcess/__test__/DeviceItem.test.js +2 -3
- package/src/commons/ConnectingProcess/index.js +25 -75
- package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +13 -16
- package/src/commons/Dashboard/MyPinnedSharedUnit/index.js +1 -1
- package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +5 -0
- package/src/commons/Device/ConnectedViewHeader.js +1 -1
- package/src/commons/Device/HistoryChart.js +3 -7
- package/src/commons/Device/ItemDevice.js +12 -19
- package/src/commons/Device/LinearChart.js +0 -15
- package/src/commons/Device/PMSensor/PMSensorIndicatior.js +12 -16
- package/src/commons/Device/PMSensor/PMSensorIndicatorStyles.js +0 -3
- package/src/commons/Device/SonosSpeaker/index.js +1 -1
- package/src/commons/Device/WaterQualitySensor/ListQualityIndicator.js +0 -1
- package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +2 -7
- package/src/commons/Explore/__test__/CityItem.test.js +54 -33
- package/src/commons/Form/CurrencyInput.js +1 -15
- package/src/commons/Form/TextInputPassword.js +1 -1
- package/src/commons/FullLoading/index.js +1 -2
- package/src/commons/Header/HeaderCustom.js +1 -2
- package/src/commons/HeaderAni/index.js +1 -6
- package/src/commons/HorizontalPicker/index.js +2 -2
- package/src/commons/MediaPlayerDetail/Styles/MediaPlayerDetailStyles.js +6 -0
- package/src/commons/MediaPlayerDetail/index.js +47 -25
- package/src/commons/MenuActionAddnew/index.js +0 -1
- package/src/commons/MenuActionList/index.js +0 -1
- package/src/commons/MenuActionMore/index.js +1 -1
- package/src/commons/PreventAccess/index.js +1 -9
- package/src/commons/Sharing/MemberList.js +2 -10
- package/src/commons/Sharing/WrapHeaderScrollable.js +0 -2
- package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +1 -0
- package/src/commons/SubUnit/Favorites/index.js +3 -2
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +35 -8
- package/src/commons/SubUnit/OneTap/index.js +2 -1
- package/src/commons/SubUnit/ShortDetail.js +9 -25
- package/src/commons/SubUnit/__test__/Item.test.js +1 -0
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +2 -9
- package/src/commons/Unit/SharedUnit.js +0 -1
- package/src/commons/Unit/__test__/SharedUnit.test.js +183 -38
- package/src/commons/UnitSummary/ConfigHistoryChart/index.js +13 -2
- package/src/commons/UnitSummary/ConfigHistoryChart.js +13 -22
- package/src/commons/WheelDateTimePicker/index.js +3 -4
- package/src/configs/API.js +143 -87
- package/src/configs/Constants.js +2 -57
- package/src/configs/SCConfig.js +0 -4
- package/src/context/actionType.ts +0 -8
- package/src/context/mockStore.ts +0 -10
- package/src/context/reducer.ts +2 -38
- package/src/hooks/Common/index.js +0 -2
- package/src/hooks/Common/useGetIdUser.js +5 -1
- package/src/hooks/Common/useSensorsStatus.js +4 -4
- package/src/hooks/useReceiveNotifications.js +5 -9
- package/src/iot/Monitor.js +2 -3
- package/src/iot/RemoteControl/Bluetooth.js +1 -1
- package/src/iot/RemoteControl/GoogleHome.js +49 -75
- package/src/iot/RemoteControl/Internet.js +1 -1
- package/src/iot/RemoteControl/__test__/GoogleHome.test.js +48 -95
- package/src/iot/RemoteControl/__test__/Internet.test.js +7 -18
- package/src/iot/RemoteControl/__test__/LgThinq.test.js +177 -36
- package/src/iot/RemoteControl/index.js +52 -52
- package/src/navigations/UnitStack.js +20 -11
- package/src/screens/AQIGuide/index.js +1 -1
- package/src/screens/ActivityLog/FilterPopup.js +0 -2
- package/src/screens/ActivityLog/__test__/index.test.js +23 -38
- package/src/screens/ActivityLog/hooks/__test__/index.test.js +90 -51
- package/src/screens/ActivityLog/hooks/index.js +1 -1
- package/src/screens/ActivityLog/index.js +2 -2
- package/src/screens/AddCommon/SelectSubUnit.js +0 -1
- package/src/screens/AddCommon/SelectUnit.js +0 -1
- package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +24 -13
- package/src/screens/AddCommon/__test__/SelectUnit.test.js +33 -9
- package/src/screens/AddLocationMaps/index.js +5 -9
- package/src/screens/AddNewAction/SelectAction.js +8 -8
- package/src/screens/AddNewAction/SelectSensorDevices.js +2 -8
- package/src/screens/AddNewAction/SetupSensor.js +7 -7
- package/src/screens/AddNewAction/__test__/SelectAction.test.js +91 -10
- package/src/screens/AddNewAction/__test__/SelectSensorDevices.test.js +26 -40
- package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +1 -3
- package/src/screens/AddNewAutoSmart/index.js +2 -5
- package/src/screens/AddNewDevice/ConnectingDevices.js +3 -3
- package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +34 -42
- package/src/screens/AddNewDevice/__test__/ConnectDevices.test.js +4 -0
- package/src/screens/AddNewDevice/__test__/ConnectingDevices.test.js +22 -22
- package/src/screens/AddNewDevice/hooks/ConnectDevices.js +1 -1
- package/src/screens/AddNewDevice/index.js +0 -1
- package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +17 -23
- package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +4 -7
- package/src/screens/AddNewGateway/SelectGateway.js +0 -1
- package/src/screens/AddNewGateway/SetupGatewayWifi.js +0 -2
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +6 -4
- package/src/screens/AddNewGateway/__test__/ConnectedGateway.test.js +4 -0
- package/src/screens/AddNewGateway/__test__/ConnectingGateway.test.js +29 -5
- package/src/screens/AddNewGateway/__test__/SelectGateway.test.js +4 -0
- package/src/screens/AddNewGateway/__test__/SetupGateway.test.js +4 -0
- package/src/screens/AddNewGateway/index.js +0 -1
- package/src/screens/AddNewOneTap/__test__/AddNewOneTap.test.js +24 -10
- package/src/screens/AddNewOneTap/index.js +2 -3
- package/src/screens/AllCamera/index.js +4 -4
- package/src/screens/Automate/MultiUnits.js +8 -8
- package/src/screens/Automate/__test__/MultiUnits.test.js +9 -6
- package/src/screens/Automate/__test__/index.test.js +12 -7
- package/src/screens/Automate/index.js +3 -5
- package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +8 -36
- package/src/screens/ConfirmUnitDeletion/index.js +1 -7
- package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +22 -71
- package/src/screens/Device/EditDevice/index.js +15 -17
- package/src/screens/Device/__test__/detail.test.js +86 -33
- package/src/screens/Device/components/DetailHistoryChart.js +1 -1
- package/src/screens/Device/components/SensorConnectStatusViewHeader.js +0 -1
- package/src/screens/Device/components/SensorDisplayItem.js +2 -5
- package/src/screens/Device/detail.js +24 -80
- package/src/screens/Device/hooks/useDisconnectedDevice.js +4 -4
- package/src/screens/Device/hooks/useFavoriteDevice.js +9 -5
- package/src/screens/DeviceInfo/__test__/index.test.js +2 -0
- package/src/screens/EditActionsList/index.js +1 -1
- package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +3 -6
- package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +19 -7
- package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +2 -20
- package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +23 -40
- package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
- package/src/screens/EmergencySetting/index.js +1 -4
- package/src/screens/EnterPassword/__test__/EnterPassword.test.js +25 -41
- package/src/screens/Explore/index.js +0 -2
- package/src/screens/GuestInfo/__test__/index.test.js +41 -14
- package/src/screens/GuestInfo/components/RecurringDetail.js +0 -1
- package/src/screens/GuestInfo/components/TemporaryDetail.js +2 -2
- package/src/screens/HanetCamera/Detail.js +1 -1
- package/src/screens/HanetCamera/__test__/CaptureFaceID.test.js +12 -8
- package/src/screens/HanetCamera/__test__/Detail.test.js +42 -27
- package/src/screens/HanetCamera/__test__/ManageAccess.test.js +5 -8
- package/src/screens/HanetCamera/__test__/MemberInfo.test.js +32 -10
- package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +2 -3
- package/src/screens/HanetCamera/hooks/__test__/useHanetCheckinData.test.js +35 -43
- package/src/screens/HanetCamera/hooks/__test__/useHanetPlaceMembers.test.js +21 -10
- package/src/screens/HanetCamera/hooks/useHanetCheckinData.js +11 -11
- package/src/screens/HanetCamera/hooks/useHanetPlaceMembers.js +11 -11
- package/src/screens/ManageAccess/__test__/ManageAccess.test.js +22 -33
- package/src/screens/ManageAccess/hooks/__test__/useManageAccess.test.js +45 -44
- package/src/screens/ManageAccess/hooks/index.js +4 -7
- package/src/screens/ManageAccess/index.js +1 -2
- package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +12 -35
- package/src/screens/MoveToAnotherSubUnit/index.js +6 -6
- package/src/screens/Notification/__test__/Notification.test.js +25 -14
- package/src/screens/Notification/__test__/NotificationItem.test.js +7 -8
- package/src/screens/Notification/components/NotificationItem.js +20 -17
- package/src/screens/Notification/index.js +2 -9
- package/src/screens/PlayBackCamera/Timer.js +2 -2
- package/src/screens/PlayBackCamera/__test__/index.test.js +2 -87
- package/src/screens/PlayBackCamera/index.js +6 -22
- package/src/screens/ScanChipQR/__test__/ScanChipQR.test.js +20 -7
- package/src/screens/ScanChipQR/components/QRScan/index.js +0 -1
- package/src/screens/ScanChipQR/hooks/index.js +16 -15
- package/src/screens/ScanSensorQR/__test__/ScanSensorQR.test.js +24 -8
- package/src/screens/ScriptDetail/__test__/index.test.js +86 -17
- package/src/screens/ScriptDetail/index.js +14 -19
- package/src/screens/SelectUnit/__test__/index.test.js +55 -12
- package/src/screens/SelectUnit/index.js +4 -9
- package/src/screens/SetSchedule/index.js +11 -15
- package/src/screens/SharedUnit/__test__/TabHeader.test.js +2 -0
- package/src/screens/SharedUnit/index.js +0 -2
- package/src/screens/Sharing/Components/SensorItem.js +12 -10
- package/src/screens/Sharing/InfoMemberUnit.js +1 -1
- package/src/screens/Sharing/MemberList.js +11 -12
- package/src/screens/Sharing/SelectPermission.js +76 -121
- package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +29 -47
- package/src/screens/Sharing/__test__/MemberList.test.js +127 -13
- package/src/screens/Sharing/__test__/SelectPermission.test.js +38 -28
- package/src/screens/Sharing/__test__/SelectUser.test.js +38 -17
- package/src/screens/Sharing/hooks/index.js +0 -3
- package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +2 -3
- package/src/screens/SmartIr/components/SelectBrand.js +1 -1
- package/src/screens/SubUnit/AddSubUnit.js +17 -23
- package/src/screens/SubUnit/Detail.js +2 -1
- package/src/screens/SubUnit/EditSubUnit.js +13 -15
- package/src/screens/SubUnit/ManageSubUnit.js +7 -13
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +89 -29
- package/src/screens/SubUnit/__test__/Detail.test.js +8 -31
- package/src/screens/SubUnit/__test__/EditSubUnit.test.js +89 -21
- package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +1 -27
- package/src/screens/SubUnit/hooks/__test__/useManageSubUnit.test.js +45 -48
- package/src/screens/SubUnit/hooks/useManageSubUnit.js +7 -7
- package/src/screens/SyncLGDevice/AddLGDevice.js +0 -1
- package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +91 -22
- package/src/screens/TDSGuide/index.js +1 -4
- package/src/screens/UVIndexGuide/index.js +1 -1
- package/src/screens/Unit/ChooseLocation.js +14 -7
- package/src/screens/Unit/Detail.js +75 -30
- package/src/screens/Unit/ManageUnit.js +0 -1
- package/src/screens/Unit/SelectAddress.js +23 -45
- package/src/screens/Unit/SmartAccount.js +4 -4
- package/src/screens/Unit/Station/index.js +0 -4
- package/src/screens/Unit/Summaries.js +2 -18
- package/src/screens/Unit/__test__/CheckSendEmail.test.js +29 -24
- package/src/screens/Unit/__test__/ChooseLocation.test.js +14 -27
- package/src/screens/Unit/__test__/Detail.test.js +200 -99
- package/src/screens/Unit/__test__/ManageUnit.test.js +42 -18
- package/src/screens/Unit/__test__/SelectAddress.test.js +49 -159
- package/src/screens/Unit/__test__/SmartAccount.test.js +9 -17
- package/src/screens/Unit/__test__/SmartAccountItem.test.js +1 -0
- package/src/screens/Unit/components/MyUnitDevice/index.js +4 -4
- package/src/screens/Unit/components/SharedUnit/index.js +0 -1
- package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +2 -2
- package/src/screens/Unit/components/__test__/SharedUnit.test.js +34 -31
- package/src/screens/Unit/styles.js +0 -4
- package/src/screens/UnitSummary/__test__/index.test.js +30 -91
- package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +2 -31
- package/src/screens/UnitSummary/components/PowerConsumeHistoryChart/__test__/index.test.js +4 -7
- package/src/screens/UnitSummary/components/PowerConsumeHistoryChart/index.js +13 -2
- package/src/screens/UnitSummary/components/PowerConsumption/__test__/ItemPower.test.js +1 -0
- package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +16 -14
- package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +2 -11
- package/src/screens/UnitSummary/components/RunningDevices/index.js +10 -7
- package/src/screens/UnitSummary/components/Temperature/index.js +4 -4
- package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +2 -10
- package/src/screens/UnitSummary/index.js +1 -15
- package/src/screens/WaterQualityGuide/index.js +1 -1
- package/src/utils/Apis/axios.js +31 -54
- package/src/utils/Converter/time.js +18 -0
- package/src/utils/I18n/translations/en.json +1 -7
- package/src/utils/I18n/translations/vi.json +1 -8
- package/src/utils/Route/index.js +0 -1
- package/src/utils/Utils.js +7 -11
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/ItemPasscode.test.js +0 -24
- package/src/commons/ActionGroup/__test__/NumberUpDownTemplateWithNullConfigValue.test.js +0 -60
- package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +0 -77
- package/src/commons/Calendar/__test__/Calendar.test.js +0 -33
- package/src/commons/Device/Hanet/ItemHanetDevice.test.js +0 -58
- package/src/commons/FieldTemplate/ChooseUserField/ChooseFieldStyles.js +0 -25
- package/src/commons/FieldTemplate/ChooseUserField/ChoosePopup.js +0 -96
- package/src/commons/FieldTemplate/ChooseUserField/ChoosePopupStyles.js +0 -39
- package/src/commons/FieldTemplate/ChooseUserField/__test__/index.test.js +0 -118
- package/src/commons/FieldTemplate/ChooseUserField/index.js +0 -62
- package/src/commons/FieldTemplate/PasscodeField/PasscodeFieldStyles.js +0 -30
- package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +0 -90
- package/src/commons/FieldTemplate/PasscodeField/index.js +0 -43
- package/src/commons/FieldTemplate/ScheduleField/ScheduleFieldStyles.js +0 -13
- package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +0 -179
- package/src/commons/FieldTemplate/ScheduleField/index.js +0 -176
- package/src/commons/PreventAccess/__test__/PreventAccess.test.js +0 -62
- package/src/hooks/Common/useGGHomeDeviceConnected.js +0 -16
- package/src/hooks/IoT/__test__/useGGHomeConnection.test.js +0 -198
- package/src/hooks/IoT/__test__/useRemoteControl.test.js +0 -198
- package/src/hooks/IoT/index.js +0 -4
- package/src/hooks/IoT/useGGHomeConnection.js +0 -91
- package/src/hooks/IoT/useRemoteControl.js +0 -79
- package/src/hooks/index.js +0 -4
- package/src/navigations/UnitStackStyles.js +0 -21
- package/src/screens/Sharing/__test__/MemberList2.test.js +0 -80
- package/src/screens/SideMenuDetail/SideMenuDetailStyles.js +0 -28
- package/src/screens/SideMenuDetail/__test__/index.test.js +0 -154
- package/src/screens/SideMenuDetail/index.js +0 -148
- package/src/screens/Unit/__test__/Summaries.test.js +0 -100
- package/src/screens/Unit/components/MyAllUnit/__test__/MyAllUnit.test.js +0 -36
- package/src/screens/Unit/components/MyAllUnit/__test__/index.test.js +0 -54
- package/src/screens/Unit/hook/useUnitConnectRemoteDevices.js +0 -50
- package/src/utils/Permission/common.js +0 -67
- package/src/utils/Setting/Location.js +0 -30
- package/src/utils/__test__/Utils.test.js +0 -12
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
Text,
|
|
14
14
|
TouchableOpacity,
|
|
15
15
|
Platform,
|
|
16
|
+
ActivityIndicator,
|
|
16
17
|
} from 'react-native';
|
|
17
18
|
import { VLCPlayer } from 'react-native-vlc-media-player';
|
|
18
19
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
@@ -42,14 +43,18 @@ const MediaPlayerDetail = ({
|
|
|
42
43
|
height,
|
|
43
44
|
}) => {
|
|
44
45
|
const { setAction } = useContext(SCContext);
|
|
45
|
-
const { camera_opened } = useSCContextSelector(
|
|
46
|
+
const { isFirstOpenCamera, camera_opened } = useSCContextSelector(
|
|
47
|
+
(state) => state.app
|
|
48
|
+
);
|
|
46
49
|
const t = useTranslations();
|
|
47
50
|
const [paused, setPaused] = useState(isPaused);
|
|
48
51
|
|
|
49
52
|
const onTapPause = useCallback(() => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
if (!isFirstOpenCamera) {
|
|
54
|
+
setPaused(false);
|
|
55
|
+
id && setAction(Action.CAMERA_STATUS_CHANGE, { id, status: true });
|
|
56
|
+
}
|
|
57
|
+
}, [id, isFirstOpenCamera, setAction]);
|
|
53
58
|
|
|
54
59
|
const onTapGoDetail = useCallback(() => {
|
|
55
60
|
if (!paused) {
|
|
@@ -67,31 +72,29 @@ const MediaPlayerDetail = ({
|
|
|
67
72
|
}, []);
|
|
68
73
|
|
|
69
74
|
const getWidthHeight = useCallback(() => {
|
|
70
|
-
let
|
|
71
|
-
|
|
75
|
+
let width = 0,
|
|
76
|
+
height = 0;
|
|
72
77
|
switch (amount) {
|
|
73
78
|
case 1:
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
width = Constants.width;
|
|
80
|
+
height = 224;
|
|
76
81
|
break;
|
|
77
82
|
case 4:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
(Platform.OS === 'ios' && Constants.width < 400 ? 1.5 : 2);
|
|
81
|
-
newHeight = 112;
|
|
83
|
+
width = Constants.width / 2;
|
|
84
|
+
height = 112;
|
|
82
85
|
break;
|
|
83
86
|
case 6:
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
width = Constants.width / 3;
|
|
88
|
+
height = 112;
|
|
86
89
|
break;
|
|
87
90
|
default:
|
|
88
|
-
|
|
89
|
-
|
|
91
|
+
width = Constants.width - 28;
|
|
92
|
+
height = 162;
|
|
90
93
|
break;
|
|
91
94
|
}
|
|
92
95
|
return {
|
|
93
|
-
width
|
|
94
|
-
height
|
|
96
|
+
width,
|
|
97
|
+
height,
|
|
95
98
|
};
|
|
96
99
|
}, [amount]);
|
|
97
100
|
|
|
@@ -100,9 +103,9 @@ const MediaPlayerDetail = ({
|
|
|
100
103
|
<VLCPlayer
|
|
101
104
|
autoAspectRatio={true}
|
|
102
105
|
videoAspectRatio={
|
|
103
|
-
|
|
104
|
-
? `${
|
|
105
|
-
: `${width}:${height}`
|
|
106
|
+
width && height
|
|
107
|
+
? `${width}:${height}`
|
|
108
|
+
: `${getWidthHeight().width}:${getWidthHeight().height}`
|
|
106
109
|
}
|
|
107
110
|
source={{
|
|
108
111
|
initType: 2,
|
|
@@ -123,20 +126,31 @@ const MediaPlayerDetail = ({
|
|
|
123
126
|
styles.player,
|
|
124
127
|
style,
|
|
125
128
|
{
|
|
126
|
-
width:
|
|
127
|
-
height:
|
|
129
|
+
width: width || getWidthHeight().width,
|
|
130
|
+
height: height || getWidthHeight().height,
|
|
128
131
|
},
|
|
132
|
+
isFirstOpenCamera && styles.firstOpenCamera,
|
|
129
133
|
]}
|
|
130
134
|
isLive={true}
|
|
131
135
|
/>
|
|
132
136
|
);
|
|
133
137
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
134
|
-
}, [uri]);
|
|
138
|
+
}, [uri, isFirstOpenCamera]);
|
|
135
139
|
|
|
136
140
|
useEffect(() => {
|
|
137
141
|
setPaused(isPaused);
|
|
138
142
|
}, [isPaused]);
|
|
139
143
|
|
|
144
|
+
useEffect(() => {
|
|
145
|
+
if (isFirstOpenCamera) {
|
|
146
|
+
const to = setTimeout(() => {
|
|
147
|
+
setAction(Action.IS_FIRST_OPEN_CAMERA, false);
|
|
148
|
+
clearTimeout(to);
|
|
149
|
+
}, 1000);
|
|
150
|
+
}
|
|
151
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
152
|
+
}, [isFirstOpenCamera]);
|
|
153
|
+
|
|
140
154
|
useEffect(() => {
|
|
141
155
|
if (id && !(camera_opened || []).some((item) => item === id)) {
|
|
142
156
|
setPaused(true);
|
|
@@ -147,6 +161,14 @@ const MediaPlayerDetail = ({
|
|
|
147
161
|
const source = !thumbnail || !thumbnail.uri ? Images.BgDevice : thumbnail;
|
|
148
162
|
return (
|
|
149
163
|
<View style={[styles.wrap, wrapStyles]}>
|
|
164
|
+
{isFirstOpenCamera && Platform.OS === 'ios' && (
|
|
165
|
+
<>
|
|
166
|
+
{renderCamera}
|
|
167
|
+
<View style={styles.loading}>
|
|
168
|
+
<ActivityIndicator size={'small'} color={Colors.Primary} />
|
|
169
|
+
</View>
|
|
170
|
+
</>
|
|
171
|
+
)}
|
|
150
172
|
<View style={[styles.loadingWrap]}>
|
|
151
173
|
<Text style={styles.loadingText}>{t('loading')}</Text>
|
|
152
174
|
</View>
|
|
@@ -172,7 +194,7 @@ const MediaPlayerDetail = ({
|
|
|
172
194
|
/>
|
|
173
195
|
</View>
|
|
174
196
|
) : (
|
|
175
|
-
renderCamera
|
|
197
|
+
!isFirstOpenCamera && renderCamera
|
|
176
198
|
)}
|
|
177
199
|
|
|
178
200
|
<View style={styles.buttonView}>
|
|
@@ -7,7 +7,6 @@ import t from '../../hooks/Common/useTranslations';
|
|
|
7
7
|
import Text from '../Text';
|
|
8
8
|
import { Colors } from '../../configs';
|
|
9
9
|
import { styles } from './styles';
|
|
10
|
-
import { TESTID } from '../../configs/Constants';
|
|
11
10
|
|
|
12
11
|
const PreventAccess = memo(({ headerBodyText, visible, hidePreventAccess }) => {
|
|
13
12
|
const { goBack } = useNavigation();
|
|
@@ -38,7 +37,6 @@ const PreventAccess = memo(({ headerBodyText, visible, hidePreventAccess }) => {
|
|
|
38
37
|
transparent={true}
|
|
39
38
|
onBackButtonPress={handleBackPress}
|
|
40
39
|
style={styles.container}
|
|
41
|
-
testID={TESTID.BUTTON_PREVENT_ACCESS}
|
|
42
40
|
>
|
|
43
41
|
<View style={styles.popoverStyle}>
|
|
44
42
|
<View style={styles.actionTextWrap}>
|
|
@@ -50,13 +48,7 @@ const PreventAccess = memo(({ headerBodyText, visible, hidePreventAccess }) => {
|
|
|
50
48
|
</Text>
|
|
51
49
|
</View>
|
|
52
50
|
<View style={styles.endOfText}>
|
|
53
|
-
<Text
|
|
54
|
-
testID={TESTID.TEXT_PREVENT_ACCESS}
|
|
55
|
-
size={16}
|
|
56
|
-
bold
|
|
57
|
-
color={Colors.Primary}
|
|
58
|
-
onPress={handleDonePopup}
|
|
59
|
-
>
|
|
51
|
+
<Text size={16} bold color={Colors.Primary} onPress={handleDonePopup}>
|
|
60
52
|
{dataText?.endOfText}
|
|
61
53
|
</Text>
|
|
62
54
|
</View>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
2
|
import { View, StyleSheet } from 'react-native';
|
|
3
3
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
4
|
-
import { Colors
|
|
4
|
+
import { Colors } from '../../configs';
|
|
5
5
|
import Text from '../../commons/Text';
|
|
6
6
|
import RowMember from './RowMember';
|
|
7
7
|
|
|
@@ -26,9 +26,7 @@ const MemberList = ({
|
|
|
26
26
|
/>
|
|
27
27
|
))}
|
|
28
28
|
{!dataMember.length && (
|
|
29
|
-
<
|
|
30
|
-
<Text style={styles.textCenter}>{t('no_member')}</Text>
|
|
31
|
-
</View>
|
|
29
|
+
<Text style={styles.textCenter}>{t('no_member')}</Text>
|
|
32
30
|
)}
|
|
33
31
|
</View>
|
|
34
32
|
);
|
|
@@ -39,10 +37,4 @@ const styles = StyleSheet.create({
|
|
|
39
37
|
box: {
|
|
40
38
|
backgroundColor: Colors.White,
|
|
41
39
|
},
|
|
42
|
-
viewEmpty: {
|
|
43
|
-
justifyContent: 'center',
|
|
44
|
-
alignItems: 'center',
|
|
45
|
-
height: Constants.height - 200,
|
|
46
|
-
backgroundColor: Colors.White,
|
|
47
|
-
},
|
|
48
40
|
});
|
|
@@ -13,7 +13,6 @@ import { isIphoneX } from 'react-native-iphone-x-helper';
|
|
|
13
13
|
import { Colors, Theme } from '../../configs';
|
|
14
14
|
import HeaderAni, { heightHeader } from '../../commons/HeaderAni';
|
|
15
15
|
import Text from '../../commons/Text';
|
|
16
|
-
import { TESTID } from '../../configs/Constants';
|
|
17
16
|
|
|
18
17
|
const WrapHeaderScrollable = ({
|
|
19
18
|
children,
|
|
@@ -60,7 +59,6 @@ const WrapHeaderScrollable = ({
|
|
|
60
59
|
onLeft={onGoBack}
|
|
61
60
|
/>
|
|
62
61
|
<Animated.ScrollView
|
|
63
|
-
testID={TESTID.ANIMATED_SCROLL}
|
|
64
62
|
scrollEventThrottle={16}
|
|
65
63
|
onScroll={Animated.event(
|
|
66
64
|
[{ nativeEvent: { contentOffset: { y: animatedScrollYValue } } }],
|
|
@@ -8,13 +8,13 @@ import ItemDevice from '../../Device/ItemDevice';
|
|
|
8
8
|
import ItemOneTap from '../OneTap/ItemOneTap';
|
|
9
9
|
import ItemAddNew from '../../Device/ItemAddNew';
|
|
10
10
|
import styles from './styles';
|
|
11
|
-
import { notImplemented } from '../../../utils/Utils';
|
|
12
11
|
|
|
13
12
|
const SubUnitFavorites = ({
|
|
14
13
|
isOwner,
|
|
15
14
|
unit,
|
|
16
15
|
favoriteDevices,
|
|
17
16
|
favoriteAutomates,
|
|
17
|
+
isGGHomeConnected,
|
|
18
18
|
wrapItemStyle,
|
|
19
19
|
}) => {
|
|
20
20
|
const t = useTranslations();
|
|
@@ -22,7 +22,7 @@ const SubUnitFavorites = ({
|
|
|
22
22
|
const { getStatus, serverDown } = useSensorsStatus(unit, favoriteDevices);
|
|
23
23
|
|
|
24
24
|
const handleOnAddNew = () => {
|
|
25
|
-
|
|
25
|
+
alert(t('feature_under_development'));
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
return (
|
|
@@ -42,6 +42,7 @@ const SubUnitFavorites = ({
|
|
|
42
42
|
sensor={sensor}
|
|
43
43
|
unit={unit}
|
|
44
44
|
station={sensor.station}
|
|
45
|
+
isGGHomeConnected={isGGHomeConnected}
|
|
45
46
|
serverDown={serverDown}
|
|
46
47
|
status={getStatus(sensor)}
|
|
47
48
|
wrapStyle={wrapItemStyle}
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { TouchableOpacity } from 'react-native';
|
|
3
4
|
import Toast from 'react-native-toast-message';
|
|
4
5
|
import { act, create } from 'react-test-renderer';
|
|
5
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
6
|
-
|
|
7
6
|
import SubUnitAutomate from '..';
|
|
8
7
|
import { AUTOMATE_TYPE, TESTID } from '../../../../configs/Constants';
|
|
9
8
|
import { SCProvider } from '../../../../context';
|
|
10
9
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
11
10
|
import Routes from '../../../../utils/Route';
|
|
12
|
-
import api from '../../../../utils/Apis/axios';
|
|
13
|
-
import { API } from '../../../../configs';
|
|
14
|
-
|
|
15
|
-
const mock = new MockAdapter(api.axiosInstance);
|
|
16
11
|
|
|
17
12
|
const wrapComponent = (data) => (
|
|
18
13
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -37,6 +32,8 @@ jest.mock('@react-navigation/native', () => {
|
|
|
37
32
|
};
|
|
38
33
|
});
|
|
39
34
|
|
|
35
|
+
jest.mock('axios');
|
|
36
|
+
|
|
40
37
|
let tree;
|
|
41
38
|
let data = {
|
|
42
39
|
isOwner: true,
|
|
@@ -63,9 +60,18 @@ let data = {
|
|
|
63
60
|
|
|
64
61
|
describe('test Item', () => {
|
|
65
62
|
beforeEach(() => {
|
|
63
|
+
axios.post.mockClear();
|
|
66
64
|
mockedNavigate.mockClear();
|
|
67
65
|
});
|
|
68
66
|
test('render SubUnitAutomate isOwner and handleOnAddNew', async () => {
|
|
67
|
+
const response = {
|
|
68
|
+
status: 200,
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
axios.post.mockImplementation(async () => {
|
|
72
|
+
return response;
|
|
73
|
+
});
|
|
74
|
+
|
|
69
75
|
await act(async () => {
|
|
70
76
|
tree = await create(wrapComponent(data));
|
|
71
77
|
});
|
|
@@ -108,7 +114,6 @@ describe('test Item', () => {
|
|
|
108
114
|
el.type === TouchableOpacity
|
|
109
115
|
);
|
|
110
116
|
expect(handleScriptAction).toHaveLength(1);
|
|
111
|
-
mock.onPost(API.AUTOMATE.ACTION_ONE_TAP(1)).reply(200);
|
|
112
117
|
await act(async () => {
|
|
113
118
|
await handleScriptAction[0].props.onPress();
|
|
114
119
|
});
|
|
@@ -122,6 +127,14 @@ describe('test Item', () => {
|
|
|
122
127
|
|
|
123
128
|
test('render SubUnitAutomate not is owner handleScriptAction fail', async () => {
|
|
124
129
|
data.isOwner = false;
|
|
130
|
+
const response = {
|
|
131
|
+
status: 400,
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
axios.post.mockImplementation(async () => {
|
|
135
|
+
return response;
|
|
136
|
+
});
|
|
137
|
+
|
|
125
138
|
await act(async () => {
|
|
126
139
|
tree = await create(wrapComponent(data));
|
|
127
140
|
});
|
|
@@ -132,7 +145,6 @@ describe('test Item', () => {
|
|
|
132
145
|
el.type === TouchableOpacity
|
|
133
146
|
);
|
|
134
147
|
expect(handleScriptAction).toHaveLength(1);
|
|
135
|
-
mock.onPost(API.AUTOMATE.ACTION_ONE_TAP(1)).reply(400);
|
|
136
148
|
await act(async () => {
|
|
137
149
|
await handleScriptAction[0].props.onPress();
|
|
138
150
|
});
|
|
@@ -169,6 +181,14 @@ describe('test Item', () => {
|
|
|
169
181
|
],
|
|
170
182
|
},
|
|
171
183
|
];
|
|
184
|
+
const response = {
|
|
185
|
+
status: 200,
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
axios.post.mockImplementation(async () => {
|
|
189
|
+
return response;
|
|
190
|
+
});
|
|
191
|
+
|
|
172
192
|
await act(async () => {
|
|
173
193
|
tree = await create(wrapComponent(data));
|
|
174
194
|
});
|
|
@@ -213,6 +233,13 @@ describe('test Item', () => {
|
|
|
213
233
|
],
|
|
214
234
|
},
|
|
215
235
|
];
|
|
236
|
+
const response = {
|
|
237
|
+
status: 200,
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
await axios.post.mockImplementation(async () => {
|
|
241
|
+
return response;
|
|
242
|
+
});
|
|
216
243
|
|
|
217
244
|
await act(async () => {
|
|
218
245
|
tree = await create(wrapComponent(data));
|
|
@@ -41,9 +41,10 @@ const SubUnitAutomate = ({ isOwner, listAutomate, unit, wrapItemStyle }) => {
|
|
|
41
41
|
setAutomates(listAutomate[indexAutomate]);
|
|
42
42
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
43
43
|
}, [listAutomate]);
|
|
44
|
+
|
|
44
45
|
return (
|
|
45
46
|
<Section style={styles.noShadow}>
|
|
46
|
-
<View style={styles.boxScenario}
|
|
47
|
+
<View style={styles.boxScenario}>
|
|
47
48
|
{listAutomate.map((item, index) => (
|
|
48
49
|
<TouchableOpacity
|
|
49
50
|
style={
|
|
@@ -15,18 +15,12 @@ import { standardizeCameraScreenSize } from '../../utils/Utils';
|
|
|
15
15
|
import Routes from '../../utils/Route';
|
|
16
16
|
import FastImage from 'react-native-fast-image';
|
|
17
17
|
import MediaPlayerDetail from '../MediaPlayerDetail';
|
|
18
|
-
import {
|
|
19
|
-
keyPermission,
|
|
20
|
-
OpenSetting,
|
|
21
|
-
permitPermissionFunction,
|
|
22
|
-
} from '../../utils/Permission/common';
|
|
23
|
-
import { RESULTS } from 'react-native-permissions';
|
|
24
18
|
|
|
25
19
|
const { standardizeWidth, standardizeHeight } = standardizeCameraScreenSize(
|
|
26
20
|
Device.screenWidth - 32
|
|
27
21
|
);
|
|
28
22
|
|
|
29
|
-
const ShortDetailSubUnit = ({ unit, station }) => {
|
|
23
|
+
const ShortDetailSubUnit = ({ unit, station, isGGHomeConnected }) => {
|
|
30
24
|
const t = useTranslations();
|
|
31
25
|
const { navigate } = useNavigation();
|
|
32
26
|
|
|
@@ -77,24 +71,13 @@ const ShortDetailSubUnit = ({ unit, station }) => {
|
|
|
77
71
|
};
|
|
78
72
|
|
|
79
73
|
const handleOnAddNew = () => {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
unit_name: unit.name,
|
|
88
|
-
},
|
|
89
|
-
});
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
if (res === RESULTS.BLOCKED) {
|
|
93
|
-
OpenSetting(
|
|
94
|
-
t('camera_request_permission'),
|
|
95
|
-
t('camera_request_permission_des')
|
|
96
|
-
);
|
|
97
|
-
}
|
|
74
|
+
navigate(Routes.AddDeviceStack, {
|
|
75
|
+
screen: Routes.ScanSensorQR,
|
|
76
|
+
params: {
|
|
77
|
+
station_id: station?.id,
|
|
78
|
+
unit_id: unit.id,
|
|
79
|
+
unit_name: unit.name,
|
|
80
|
+
},
|
|
98
81
|
});
|
|
99
82
|
};
|
|
100
83
|
|
|
@@ -139,6 +122,7 @@ const ShortDetailSubUnit = ({ unit, station }) => {
|
|
|
139
122
|
sensor={sensor}
|
|
140
123
|
unit={unit}
|
|
141
124
|
station={station}
|
|
125
|
+
isGGHomeConnected={isGGHomeConnected}
|
|
142
126
|
serverDown={serverDown}
|
|
143
127
|
status={getStatus(sensor)}
|
|
144
128
|
/>
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Image, View } from 'react-native';
|
|
3
3
|
import { act, create } from 'react-test-renderer';
|
|
4
|
-
import mock from 'react-native-permissions/mock';
|
|
5
4
|
import { TESTID } from '../../../configs/Constants';
|
|
6
5
|
import { SCProvider } from '../../../context';
|
|
7
6
|
import { mockSCStore } from '../../../context/mockStore';
|
|
8
7
|
import ShortDetailSubUnit from '../ShortDetail';
|
|
9
8
|
import ItemAddNew from '../../Device/ItemAddNew';
|
|
10
9
|
import Routes from '../../../utils/Route';
|
|
11
|
-
import { keyPermission } from '../../../utils/Permission/common';
|
|
12
10
|
|
|
13
11
|
const wrapComponent = (props) => (
|
|
14
12
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -23,10 +21,6 @@ jest.mock('react', () => {
|
|
|
23
21
|
};
|
|
24
22
|
});
|
|
25
23
|
|
|
26
|
-
jest.mock('react-native-permissions', () => {
|
|
27
|
-
return mock;
|
|
28
|
-
});
|
|
29
|
-
|
|
30
24
|
const mockedNavigate = jest.fn();
|
|
31
25
|
jest.mock('@react-navigation/native', () => {
|
|
32
26
|
return {
|
|
@@ -151,10 +145,10 @@ describe('test ShortDetail Subunit', () => {
|
|
|
151
145
|
(item) =>
|
|
152
146
|
item.props.testID === TESTID.SUB_UNIT_DEVICES && item.type === View
|
|
153
147
|
);
|
|
154
|
-
expect(itemDevice.length).toBe(
|
|
148
|
+
expect(itemDevice.length).toBe(1);
|
|
155
149
|
});
|
|
156
150
|
|
|
157
|
-
test('render ShortDetail add new device',
|
|
151
|
+
test('render ShortDetail add new device', () => {
|
|
158
152
|
act(() => {
|
|
159
153
|
tree = create(wrapComponent(props));
|
|
160
154
|
});
|
|
@@ -163,7 +157,6 @@ describe('test ShortDetail Subunit', () => {
|
|
|
163
157
|
act(() => {
|
|
164
158
|
buttonAddNew.props.onAddNew();
|
|
165
159
|
});
|
|
166
|
-
await mock.request(keyPermission.CAMERA);
|
|
167
160
|
expect(mockedNavigate).toHaveBeenCalledWith(Routes.AddDeviceStack, {
|
|
168
161
|
screen: Routes.ScanSensorQR,
|
|
169
162
|
params: {
|