diff --git a/android/app/build.gradle b/android/app/build.gradle index 0a44e5f0..45708d7b 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -135,8 +135,8 @@ android { applicationId 'com.aceiotsolutions.connecting_mha_app' minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 6 - versionName "0.0.6" + versionCode 7 + versionName "0.0.7" } splits { abi { diff --git a/app.json b/app.json index 1ed6b339..c288ca5f 100644 --- a/app.json +++ b/app.json @@ -2,7 +2,7 @@ "expo": { "name": "Connecting MHA", "slug": "connecting-mha-app", - "version": "0.0.6", + "version": "0.0.7", "orientation": "portrait", "owner": "ace-iot", "icon": "./assets/icon.png", @@ -25,7 +25,7 @@ "foregroundImage": "./assets/icon.adaptive.foreground.png", "backgroundImage": "./assets/icon.adaptive.background.png" }, - "versionCode": 6, + "versionCode": 7, "package": "com.aceiotsolutions.connecting_mha_app" }, "web": { diff --git a/assets/svg/user.svg b/assets/svg/user.svg index 771ad77f..37f2dbfe 100755 --- a/assets/svg/user.svg +++ b/assets/svg/user.svg @@ -1,4 +1,50 @@ - - - + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/components/DemandResponse/OptedOutNotification.tsx b/components/DemandResponse/OptedOutNotification.tsx index 2bb33a93..ff38cf68 100755 --- a/components/DemandResponse/OptedOutNotification.tsx +++ b/components/DemandResponse/OptedOutNotification.tsx @@ -1,39 +1,39 @@ -import React from "react"; -import { StyleSheet, Text, TouchableOpacity } from "react-native"; -import { theme } from "../../theme"; -import AlertCircle from "../../assets/svg/alert-circle.svg"; - -export function OptedOutNotification() { - return ( - - - You have opted out of demand response - - - ); -} - -const styles = StyleSheet.create({ - container: { - flexDirection: "row", - alignItems: "center", - justifyContent: "center", - minHeight: 45, - paddingVertical: theme.padding / 2, - backgroundColor: theme.colors.periwinkle, - borderRadius: 22, - }, - icon: { - marginHorizontal: theme.padding, - marginRight: "auto", - }, - label: { - color: theme.primary, - fontFamily: theme.fonts.title, - paddingHorizontal: theme.padding, - }, - cta: { - marginLeft: "auto", - marginRight: theme.padding * 2, - }, -}); +import React from "react"; +import { StyleSheet, Text, TouchableOpacity } from "react-native"; +import { theme, typography } from "../../theme"; +import AlertCircle from "../../assets/svg/alert-circle.svg"; + +export function OptedOutNotification() { + return ( + + + Standard operation has resumed + + + ); +} + +const styles = StyleSheet.create({ + container: { + flexDirection: "row", + alignItems: "center", + justifyContent: "center", + minHeight: 45, + paddingVertical: theme.padding / 2, + backgroundColor: theme.colors.periwinkle, + borderRadius: 22, + }, + icon: { + marginHorizontal: theme.padding, + marginRight: "auto", + }, + label: { + color: theme.primary, + fontFamily: theme.fonts.title, + paddingHorizontal: theme.padding, + }, + cta: { + marginLeft: "auto", + marginRight: theme.padding * 2, + }, +}); diff --git a/ios/ConnectingMHA/Info.plist b/ios/ConnectingMHA/Info.plist index a44985af..ba7435bf 100644 --- a/ios/ConnectingMHA/Info.plist +++ b/ios/ConnectingMHA/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 0.0.6 + 0.0.7 CFBundleSignature ???? CFBundleURLTypes @@ -30,7 +30,7 @@ CFBundleVersion - 6 + 7 LSRequiresIPhoneOS NSAppTransportSecurity diff --git a/package.json b/package.json index dbeaec9c..5584f78b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "connecting-mha-app", - "version": "0.0.6", + "version": "0.0.7", "scripts": { "start": "expo start --dev-client", "android": "expo run:android", diff --git a/screens/DemandResponseMessageScreen.tsx b/screens/DemandResponseMessageScreen.tsx index 5d9bb66c..f1bc05c7 100755 --- a/screens/DemandResponseMessageScreen.tsx +++ b/screens/DemandResponseMessageScreen.tsx @@ -1,94 +1,94 @@ -import React, { useEffect, useState } from "react"; -import { StyleSheet, Text, View, SafeAreaView } from "react-native"; -import { useHomeConfigData } from "../hooks/useHomeConfigData"; -import { theme, typography } from "../theme"; -import { useNavigation, useRoute } from "@react-navigation/native"; -import { Button } from "../components/Button"; -import { DemandResponseScreenRouteProps } from "../types"; -import { useDeviceUpdateDerStatus } from "../hooks/api"; -import { ErrorLabel } from "../components/ErrorLabel"; -import { DataBoundary } from "../components/DataBoundary"; - -export function DemandResponseMessageScreen() { - const { data, error, loading, getData } = useHomeConfigData(); - const [optedOut, setOptedOut] = useState(false); - const navigation = useNavigation(); - - const route = useRoute(); - const { deviceId, showOptOutButton } = route.params; - const { update, error: updateError, loading: updateLoading } = useDeviceUpdateDerStatus(deviceId); - - const message = data?.lpc_config.current_event_message.message; - const refresh = getData; - - useEffect(() => { - getData(); - }, []); - - useEffect(() => { - if (!optedOut) { - return; - } - - const optOut = async () => { - const response = await update({ status: "opted_out" }); - - if (response.success) { - navigation.goBack(); - } else { - setOptedOut(false); - } - }; - - optOut(); - }, [optedOut]); - - return ( - - - {data && ( - - - {message} - - {updateError && } - - {showOptOutButton && ( - - - - )} - - - ); -} - -const styles = StyleSheet.create({ - container: { - flex: 1, - backgroundColor: theme.background, - alignItems: "center", - }, - content: { - height: "100%", - padding: theme.padding, - }, - textBlock: { - flex: 1, - paddingTop: theme.padding, - }, -}); +import React, { useEffect, useState } from "react"; +import { StyleSheet, Text, View, SafeAreaView } from "react-native"; +import { useHomeConfigData } from "../hooks/useHomeConfigData"; +import { theme, typography } from "../theme"; +import { useNavigation, useRoute } from "@react-navigation/native"; +import { Button } from "../components/Button"; +import { DemandResponseScreenRouteProps } from "../types"; +import { useDeviceUpdateDerStatus } from "../hooks/api"; +import { ErrorLabel } from "../components/ErrorLabel"; +import { DataBoundary } from "../components/DataBoundary"; + +export function DemandResponseMessageScreen() { + const { data, error, loading, getData } = useHomeConfigData(); + const [optedOut, setOptedOut] = useState(false); + const navigation = useNavigation(); + + const route = useRoute(); + const { deviceId, showOptOutButton } = route.params; + const { update, error: updateError, loading: updateLoading } = useDeviceUpdateDerStatus(deviceId); + + const message = data?.lpc_config.current_event_message.message; + const refresh = getData; + + useEffect(() => { + getData(); + }, []); + + useEffect(() => { + if (!optedOut) { + return; + } + + const optOut = async () => { + const response = await update({ status: "opted_out" }); + + if (response.success) { + navigation.goBack(); + } else { + setOptedOut(false); + } + }; + + optOut(); + }, [optedOut]); + + return ( + + + {data && ( + + + {message} + + {updateError && } + + {showOptOutButton && ( + + + + )} + + + ); +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + backgroundColor: theme.background, + alignItems: "center", + }, + content: { + height: "100%", + padding: theme.padding, + }, + textBlock: { + flex: 1, + paddingTop: theme.padding, + }, +}); diff --git a/screens/MacAddressScreen.tsx b/screens/MacAddressScreen.tsx index 9a040e92..fd96c9a9 100644 --- a/screens/MacAddressScreen.tsx +++ b/screens/MacAddressScreen.tsx @@ -1,5 +1,5 @@ import React, { useState } from "react"; -import { Text, View, StyleSheet, SafeAreaView, Modal, TouchableOpacity, Dimensions } from "react-native"; +import { Text, View, StyleSheet, SafeAreaView, Modal, TouchableOpacity } from "react-native"; import { theme } from "../theme"; import { Button } from "../components/Button"; import { setJwt, getApiEndpoint, setStorageMacAddress } from "../utils/api"; @@ -11,9 +11,6 @@ import sign from "jwt-encode"; import { TextInputMask } from "react-native-masked-text"; import User from "../assets/svg/user.svg"; -const WIDTH = Dimensions.get("window").width; -const HEIGHT = Dimensions.get("window").height; - export function MacAddressScreen() { const [isModalVisible, setIsModalVisible] = useState(false); const [macAddress, setMacAddress] = useState("001122334455"); @@ -90,39 +87,46 @@ export function MacAddressScreen() { return ( - - - - - - Find your 12-character mac address from your gateway and enter it below + + + + + + + + Find your 12-character mac address from your gateway and enter it below + + + setMacAddress(newMacAddress.replace(/[^a-zA-Z\d]+/g, "").toLowerCase())} + maxLength={17} + /> - setMacAddress(newMacAddress.replace(/[^a-zA-Z\d]+/g, "").toLowerCase())} - maxLength={17} - /> + + - - ); } const styles = StyleSheet.create({ container: { + flex: 1, flexDirection: "column", - height: HEIGHT / 3, - width: WIDTH < 510 ? 300 : WIDTH / 3, - marginTop: HEIGHT / 4, - marginLeft: WIDTH < 510 ? (WIDTH - 300) / 2 : WIDTH / 3, - borderRadius: 30, justifyContent: "center", alignItems: "center", + }, + boxContainer: { + justifyContent: "center", + alignItems: "center", + height: 320, + width: 300, + borderRadius: 30, backgroundColor: theme.backdrop, }, settingButton: { @@ -160,11 +164,12 @@ const styles = StyleSheet.create({ errorModal: { flex: 1, backgroundColor: "#000000aa", + flexDirection: "column", + justifyContent: "center", + alignItems: "center", }, errorContainer: { - marginTop: 270, - marginHorizontal: 50, - padding: 40, + padding: 50, borderRadius: 20, backgroundColor: "#FFFFFF", alignItems: "center", diff --git a/screens/OptionsMenuScreen.tsx b/screens/OptionsMenuScreen.tsx index d7e4ed4e..d060c441 100644 --- a/screens/OptionsMenuScreen.tsx +++ b/screens/OptionsMenuScreen.tsx @@ -7,6 +7,8 @@ import { useHemsData, useHemsUpdateDerStatus } from "../hooks/api"; import { ErrorLabel } from "../components/ErrorLabel"; import { getApiEndpoint, getJwt, getStorageMacAddress } from "../utils/api"; +const isDevEnv = !process.env.NODE_ENV || process.env.NODE_ENV === "development"; + function ApiEndpointButton() { const [endpoint, setEndpoint] = useState(); const navigation = useNavigation(); @@ -24,12 +26,21 @@ function ApiEndpointButton() { }); return ( - navigation.navigate("SettingsScreen")}> - - HEMS API Endpoint - {endpoint} - - + <> + {isDevEnv ? ( + navigation.navigate("SettingsScreen")}> + + HEMS API Endpoint + {endpoint} + + + ) : ( + + HEMS API Endpoint + {endpoint} + + )} + ); } @@ -46,12 +57,21 @@ function JwtButton() { }); return ( - navigation.navigate("AuthTokenScreen")}> - - Authentication Token (JWT) - {jwt} - - + <> + {isDevEnv ? ( + navigation.navigate("AuthTokenScreen")}> + + Authentication Token (JWT) + {jwt} + + + ) : ( + + Authentication Token (JWT) + {jwt} + + )} + ); } @@ -77,6 +97,16 @@ function MacAddressButton() { ); } +function ViewWelcomeScreenButton() { + const navigation = useNavigation(); + + return ( + navigation.navigate("DebugWelcome")}> + + + ); +} + function DemandResponseToggle() { const { data, error, loading, getData } = useHemsData(); const { update, error: updateError, loading: updateLoading } = useHemsUpdateDerStatus(data?.id ?? ""); @@ -128,9 +158,9 @@ function ScreenLink({ title, screenName }: ScreenLinkProps) { } export function OptionsMenuScreen() { - const isDevEnv = !process.env.NODE_ENV || process.env.NODE_ENV === "development"; return ( + diff --git a/screens/ThermostatScreen.tsx b/screens/ThermostatScreen.tsx index 3f9e430b..8abf5434 100644 --- a/screens/ThermostatScreen.tsx +++ b/screens/ThermostatScreen.tsx @@ -184,7 +184,7 @@ export function ThermostatScreen() { : setNewSetpoint({ setpoint: newSetpointData.setpoint - 0.56 }) } onDrag={({ direction }) => { - setNewSetpoint({ setpoint: newSetpointData.setpoint + 0.2 * (direction === "up" ? 1 : -1) }); + // setNewSetpoint({ setpoint: newSetpointData.setpoint + 0.2 * (direction === "up" ? 1 : -1) }); }} /> diff --git a/screens/WelcomeScreen.tsx b/screens/WelcomeScreen.tsx index 3c484aef..46871158 100644 --- a/screens/WelcomeScreen.tsx +++ b/screens/WelcomeScreen.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { Text, View, StyleSheet, SafeAreaView, TouchableOpacity, Dimensions } from "react-native"; +import { Text, View, StyleSheet, SafeAreaView, TouchableOpacity } from "react-native"; import Phone from "../assets/svg/phone.svg"; import Welcome from "../assets/svg/welcome.svg"; import Mail from "../assets/svg/mail.svg"; @@ -11,9 +11,6 @@ import { NavigationActions } from "react-navigation"; import { useNavigation } from "@react-navigation/native"; import { MainNavigationProps } from "../types/navigation"; -const WIDTH = Dimensions.get("window").width; -const HEIGHT = Dimensions.get("window").height; - export function WelcomeScreen() { const navigation = useNavigation(); @@ -31,7 +28,7 @@ export function WelcomeScreen() { - + @@ -41,13 +38,12 @@ export function WelcomeScreen() { - The Connecting MHA app allows participants in the program to view, manage and override their smart home - devices. The app works only with the Connecting MHA program and users are given more details and - instructions for use upon enrollment. + This app is designed to help you manage your new smart devices, just click on the tab below to access the + device you want to control. - If you have any questions, concerns, or are having trouble during an{" "} - Energy Savings Event contact us via phone or email. + If you have any questions or concerns with your devices, or are having trouble during an + Energy Savings Event, contact us via phone or email: