diff --git a/app/assets/iqair-empty-stations.png b/app/assets/iqair-empty-stations.png new file mode 100644 index 00000000..84e87658 Binary files /dev/null and b/app/assets/iqair-empty-stations.png differ diff --git a/app/assets/iqair-map-outline.png b/app/assets/iqair-map-outline.png index e7837382..443342aa 100644 Binary files a/app/assets/iqair-map-outline.png and b/app/assets/iqair-map-outline.png differ diff --git a/app/assets/iqair-station-outline.png b/app/assets/iqair-station-outline.png index a4842c3a..723f8880 100644 Binary files a/app/assets/iqair-station-outline.png and b/app/assets/iqair-station-outline.png differ diff --git a/app/screens/iqair/details/index.js b/app/screens/iqair/details/index.js index 443f71ce..14f5dfce 100644 --- a/app/screens/iqair/details/index.js +++ b/app/screens/iqair/details/index.js @@ -5,7 +5,6 @@ export class index extends Component { render() { return ( - index ) } diff --git a/app/screens/iqair/guide/index.js b/app/screens/iqair/guide/index.js index 9d900733..ac636c5e 100644 --- a/app/screens/iqair/guide/index.js +++ b/app/screens/iqair/guide/index.js @@ -10,6 +10,8 @@ import { returnIcon, returnStatus } from '../../../utils/IQAIRhelper'; +import { useNavigation } from '@react-navigation/native'; +import CustomHeader from '../../../components/header.js'; import CustomSafeArea from '../../../components/safeArea.component'; import Elements from '../../../components/elements.js'; import Theme from '../../../components/theme.style.js'; @@ -54,6 +56,8 @@ const status = [ ] const Guide = () => { + const navigation = useNavigation(); + const renderItem = ({item, index}) => { return ( @@ -72,6 +76,8 @@ const Guide = () => { return ( + navigation.goBack()} title="IQAIR Guide" menu={false} navigation={navigation} /> + { + const navigation = useNavigation(); + const [permissionLocation, setPermissionLocation] = useState(false); const [selected, setSelected] = useState(undefined); const [stations, setStations] = useState([]); @@ -100,6 +104,7 @@ const MapContainer = () => { return ( + navigation.goBack()} title="IQAIR Location" menu={false} navigation={navigation} /> { + ) } diff --git a/app/screens/iqair/stations/list/Empty.js b/app/screens/iqair/stations/list/Empty.js new file mode 100644 index 00000000..c45b3883 --- /dev/null +++ b/app/screens/iqair/stations/list/Empty.js @@ -0,0 +1,44 @@ +import React from 'react' +import { + View, + Text, + StyleSheet, + Image +} from 'react-native' +import { useSelector } from 'react-redux'; +import Theme from '../../../../components/theme.style.js'; + +const Empty = () => { + const app_theme = useSelector(state => state.appThemeReducer.theme); + + return ( + + + + No Station Yet + + + ) +} + +export default Empty + +const styles = StyleSheet.create({ + container: { + flex: 1, + }, + emptyContainer: { + paddingHorizontal: 30, + alignItems: 'center' + }, + emptyImage: { + width: '100%', + resizeMode: 'contain' + }, + emptyText: (theme) => { + return { + color: theme?.theme.dark ? theme.theme.colors.text : Theme.colors.searchGray, + marginTop: -(Theme.screen.w * .15) + } + } +}) \ No newline at end of file diff --git a/app/screens/iqair/stations/list/List.js b/app/screens/iqair/stations/list/List.js index dbee0051..cd13fcaf 100644 --- a/app/screens/iqair/stations/list/List.js +++ b/app/screens/iqair/stations/list/List.js @@ -6,12 +6,14 @@ import { View } from 'react-native' import Theme from '../../../../components/theme.style.js'; +import Empty from './Empty.js'; import ListItem from './ListItem.js'; const List = (props) => { const renderItem = (value, data) => { return @@ -23,6 +25,8 @@ const List = (props) => { renderItem(item, props.data)} + contentContainerStyle={props.data?.length === 0 && { flex: 1 }} + ListEmptyComponent={Empty} /> ) diff --git a/app/screens/iqair/stations/list/ListItem.js b/app/screens/iqair/stations/list/ListItem.js index 332ef67c..ea4ac91d 100644 --- a/app/screens/iqair/stations/list/ListItem.js +++ b/app/screens/iqair/stations/list/ListItem.js @@ -12,21 +12,33 @@ import { returnIcon, returnStatusId } from '../../../../utils/IQAIRhelper'; +import { + useDispatch, + useSelector +} from 'react-redux'; +import { useNavigation } from '@react-navigation/native'; +import { openModal } from '../../../../redux/actions/AlertActions'; +import DB from '../../../../components/storage'; import API from '../../../../components/api/iqair'; import Theme from '../../../../components/theme.style.js'; import Elements from '../../../../components/elements.js'; import Icon from '../../../../components/icons.js'; const ListItem = (props) => { + const dispatch = useDispatch(); + const navigation = useNavigation(); + + const app_theme = useSelector(state => state.appThemeReducer.theme); + const {value, data} = props; const {item, index} = value; - + const [IQAir, setIQAir] = useState(undefined); const [loading, setLoading] = useState(false); const [ID, setID] = useState(0); useEffect(() => { - init(); + // init(); }, []); const init = () => { @@ -51,16 +63,48 @@ const ListItem = (props) => { }, 1000) } + const onDelete = () => { + dispatch(openModal({ + open: true, + title: "Warning", + body: "Are you sure you want to delete this staion?", + yesCB: deleteStation, + theme: app_theme + })) + } + + const deleteStation = async () => { + const stations = await DB.get('iqair'); + if(stations) { + const newArray = [...JSON.parse(stations)]; + const parsedArray = newArray.filter(station => station.station_uuid !== item.station_uuid); + await DB.set('iqair', JSON.stringify(parsedArray), () => { + props.init(); + dispatch(openModal({ + open: true, + title: "Success", + body: "Saved station is deleted", + yesCB: deleteStation, + theme: app_theme + })) + }, () => {}); + } + } + + const onPressDetails = () => { + navigation.navigate("Details") + } + return ( - + - {item.name} - {item.address} + {item.name} + {item.address} - + @@ -77,11 +121,11 @@ const ListItem = (props) => { - {IQAir?.pollution.aqius} * - US AQI + {IQAir?.pollution.aqius} * + US AQI - {returnStatus(ID).title} + {returnStatus(ID).title} } @@ -95,21 +139,21 @@ const ListItem = (props) => { <> - {IQAir?.weather.hu}% + {IQAir?.weather.hu}% - {(IQAir?.weather.ws * 3.6).toFixed(2)} km/h + {(IQAir?.weather.ws * 3.6).toFixed(2)} km/h - {IQAir?.weather.tp}° + {IQAir?.weather.tp}° } - + ) @@ -118,9 +162,9 @@ const ListItem = (props) => { export default ListItem const styles = StyleSheet.create({ - renderItem: (index, data) => { + renderItem: (index, data, appTheme) => { return { - backgroundColor: 'white', + backgroundColor: appTheme?.theme.dark ? appTheme?.theme.colors.border : Theme.colors.white, borderRadius: 5, marginHorizontal: 18, paddingHorizontal: 15, @@ -131,7 +175,7 @@ const styles = StyleSheet.create({ }, firstRow: { flexDirection: 'row', - flex: 1 + height: 50, }, infoContainer: { flex: 1, @@ -149,18 +193,18 @@ const styles = StyleSheet.create({ secondRow: { flexDirection: 'row', height: 70, - flex: 1, - marginTop: 10 }, iconContainer: { flex: .25, backgroundColor: Theme.colors.whitesmoke, alignItems: 'center', - justifyContent: 'center' + justifyContent: 'center', + borderTopLeftRadius: 5, + borderBottomLeftRadius: 5 }, iconShadow: { alignItems: 'center', - justifyContent: 'center' + justifyContent: 'center', }, icon: { height: '75%', @@ -201,7 +245,6 @@ const styles = StyleSheet.create({ }, thirdRow: { flexDirection: 'row', - flex: 1, height: 20, alignItems: 'center', marginTop: 14, @@ -254,5 +297,12 @@ const styles = StyleSheet.create({ infoText: { fontSize: 10, color: Theme.colors.searchText + }, + darkColor: (appTheme) => { + if(appTheme?.theme.dark) { + return { + color: Theme.colors.white + } + } } }) \ No newline at end of file diff --git a/app/screens/iqair/stations/list/index.js b/app/screens/iqair/stations/list/index.js index 119284b9..a406e45c 100644 --- a/app/screens/iqair/stations/list/index.js +++ b/app/screens/iqair/stations/list/index.js @@ -1,9 +1,12 @@ import React, { useEffect, useState } from 'react' import { View, - StyleSheet + StyleSheet, + Text, + TouchableOpacity } from 'react-native' import { useNavigation } from '@react-navigation/native'; +import Theme from '../../../../components/theme.style.js'; import List from './List.js'; import Search from '../search/Search.js'; import SearchResult from '../search/SearchResult'; @@ -51,7 +54,11 @@ const Lists = (props) => { { result.length === 0 && - } + } + + + ADD UNIOIL STATION + ) @@ -63,5 +70,18 @@ const styles = StyleSheet.create({ container: { flex: 1, paddingTop: 20, + }, + addLocationButton: { + backgroundColor: Theme.colors.primary, + width: Theme.screen.w - 80, + alignSelf: 'center', + marginBottom: 20, + alignItems: 'center', + paddingVertical: 10, + borderRadius: 5 + }, + addLocationText: { + color: Theme.colors.white, + fontSize: 15 } }) \ No newline at end of file diff --git a/app/screens/iqair/stations/search/Search.js b/app/screens/iqair/stations/search/Search.js index c1b90d85..a865cd3b 100644 --- a/app/screens/iqair/stations/search/Search.js +++ b/app/screens/iqair/stations/search/Search.js @@ -54,20 +54,21 @@ const Search = (props) => { const onPressSearch = () => { if(cityDropDown.length !== 0) { + setSearchValue(""); setCityDropDown([]); } else { search(); } } - const search = async () => { + const search = async (item) => { setLoading(true); let SESSION = await DB.session() REQUEST("gas_stations_city", "get", { Authorization: SESSION.token }, { noID: true, - value: selectedCity.city_uuid + value: item ? item.city_uuid : selectedCity.city_uuid }, {}, (res) => { if(res.data.length > 0){ setSearchValue(""); @@ -85,15 +86,16 @@ const Search = (props) => { setSearchValue(item.name); setSelectedCity(item); setCityDropDown([]); + search(item); } return ( - - {item.name} + + {item.name} ) } - + return ( { { cityDropDown.length > 0 && - + { + return { + position: 'absolute', + height: 400, + left: 0, + right: 0, + bottom: -405, + backgroundColor: apptheme?.theme.dark ? apptheme?.theme.colors.border : Theme.colors.white, + shadowColor: '#000', + shadowOffset: { width: 0, height: .8}, + shadowOpacity: .4, + shadowRadius: 1, + elevation: 3, + paddingHorizontal: 5 + } }, - searchItemButton: { + searchItemButton: { paddingVertical: 20, paddingHorizontal: 10, borderBottomWidth: 1, borderColor: Theme.colors.searchGray }, - searchItemText: { - color: Theme.colors.darkerGray + searchItemText: (appTheme) => { + return { + color: appTheme?.theme.dark ? appTheme?.theme.colors.text : Theme.colors.darkerGray + } }, buttonText: { flex: 1, diff --git a/app/screens/iqair/stations/search/SearchResult.js b/app/screens/iqair/stations/search/SearchResult.js index 4b519dd7..7f8a7675 100644 --- a/app/screens/iqair/stations/search/SearchResult.js +++ b/app/screens/iqair/stations/search/SearchResult.js @@ -6,11 +6,13 @@ import { Text, TouchableOpacity } from 'react-native'; +import { useSelector } from 'react-redux'; import Icon from '../../../../components/icons.js'; import Theme from '../../../../components/theme.style.js'; import DB from '../../../../components/storage'; const SearchResult = (props) => { + const app_theme = useSelector(state => state.appThemeReducer.theme); const [savedLocations, setSavedLocations] = useState([]); useEffect(() => { @@ -57,11 +59,11 @@ const SearchResult = (props) => { } return( - + - {value.name} - {value.address} + {value.name} + {value.address} {renderAddButton()} @@ -94,35 +96,41 @@ const styles = StyleSheet.create({ addLocationContainer: { justifyContent: 'center', }, - item: { - marginHorizontal: 18, - backgroundColor: "white", - paddingVertical: 10, - paddingHorizontal: 17, - shadowColor: '#000', - marginBottom: 10, - shadowOffset: { width: 0, height: .8}, - shadowOpacity: .3, - shadowRadius: 3, - elevation: 3, - flexDirection: 'row' + item: (appTheme) => { + return { + marginHorizontal: 18, + backgroundColor: appTheme?.theme.dark ? appTheme?.theme.colors.border : Theme.colors.white, + paddingVertical: 10, + paddingHorizontal: 17, + shadowColor: '#000', + marginBottom: 10, + shadowOffset: { width: 0, height: .8}, + shadowOpacity: .3, + shadowRadius: 3, + elevation: 3, + flexDirection: 'row' + } }, itemInfo: { marginLeft: 10, paddingRight: 10, flex: 1 }, - itemName: { - fontSize: 14, - color: Theme.colors.searchText + itemName: (appTheme) => { + return { + fontSize: 14, + color: appTheme?.theme.dark ? Theme.colors.white : Theme.colors.searchText + } }, - itemsAddress: { - fontSize: 9, - color: Theme.colors.searchText + itemsAddress: (appTheme) => { + return { + fontSize: 9, + color: appTheme?.theme.dark ? Theme.colors.white : Theme.colors.searchText + } }, scrollView: { marginVertical: 20, - flex: 1 + flex: 1, } }) \ No newline at end of file diff --git a/app/screens/main/home.js b/app/screens/main/home.js index 7c688bba..5fa3cd86 100644 --- a/app/screens/main/home.js +++ b/app/screens/main/home.js @@ -277,11 +277,6 @@ class Home extends React.PureComponent { this.displayBanner = false }) } - - // let timeout = setTimeout(() => { - // this.getNotifications() - // clearTimeout(timeout) - // }, 3000); } getNotifications = async () => { diff --git a/app/screens/tracker/add.js b/app/screens/tracker/add.js index fabf0c4c..87844638 100644 --- a/app/screens/tracker/add.js +++ b/app/screens/tracker/add.js @@ -38,11 +38,13 @@ const Tracker = (navigation) => { tracks.push(data) await DB.set("tracker", JSON.stringify(tracks), function(){ + const taskToShow = `Fuel Efficiency tracker added` + navigation.route.params?.reload(); navigation.openModal({ open: true, title: "Tracker", - body: "Fuel Efficiency tracker ${task}", + body: taskToShow, yesCB: () => navigation.navigation.goBack(), yesButtonOnly: true, theme: navigation.app_theme diff --git a/app/screens/tracker/edit.js b/app/screens/tracker/edit.js index 5170c74c..47eb941d 100644 --- a/app/screens/tracker/edit.js +++ b/app/screens/tracker/edit.js @@ -71,11 +71,13 @@ const Tracker = (navigation) => { } const onDone = (task) => { + const taskToShow = `Fuel Efficiency tracker ${task}` + navigation.route.params?.reload(); navigation.openModal({ open: true, title: "Tracker", - body: "Fuel Efficiency tracker ${task}", + body: taskToShow, yesCB: () => navigation.navigation.goBack(), yesButtonOnly: true, theme: navigation.app_theme diff --git a/ios/RNUnioilLoyaltyApp.xcodeproj/project.pbxproj b/ios/RNUnioilLoyaltyApp.xcodeproj/project.pbxproj index 4ddeb3e1..be219630 100644 --- a/ios/RNUnioilLoyaltyApp.xcodeproj/project.pbxproj +++ b/ios/RNUnioilLoyaltyApp.xcodeproj/project.pbxproj @@ -1063,7 +1063,7 @@ CODE_SIGN_ENTITLEMENTS = "RNUnioilLoyaltyApp/Unioil Loyalty App.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 6; + CURRENT_PROJECT_VERSION = 0; DEVELOPMENT_TEAM = J29MB7XX75; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -1211,7 +1211,7 @@ "\"${PODS_ROOT}/CocoaLibEvent/lib\"", "\"${PODS_ROOT}/OpenSSL-Universal/ios/lib\"", ); - MARKETING_VERSION = 1.6.3; + MARKETING_VERSION = 1.6.5; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "$(inherited)", @@ -1238,7 +1238,7 @@ CODE_SIGN_ENTITLEMENTS = "RNUnioilLoyaltyApp/Unioil Loyalty App.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 6; + CURRENT_PROJECT_VERSION = 0; DEVELOPMENT_TEAM = J29MB7XX75; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -1309,7 +1309,7 @@ "\"${PODS_ROOT}/CocoaLibEvent/lib\"", "\"${PODS_ROOT}/OpenSSL-Universal/ios/lib\"", ); - MARKETING_VERSION = 1.6.3; + MARKETING_VERSION = 1.6.5; ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ( "$(inherited)", diff --git a/ios/RNUnioilLoyaltyApp.xcworkspace/xcuserdata/macbookpro2017.xcuserdatad/UserInterfaceState.xcuserstate b/ios/RNUnioilLoyaltyApp.xcworkspace/xcuserdata/macbookpro2017.xcuserdatad/UserInterfaceState.xcuserstate index 5265af31..edb33ad9 100644 Binary files a/ios/RNUnioilLoyaltyApp.xcworkspace/xcuserdata/macbookpro2017.xcuserdatad/UserInterfaceState.xcuserstate and b/ios/RNUnioilLoyaltyApp.xcworkspace/xcuserdata/macbookpro2017.xcuserdatad/UserInterfaceState.xcuserstate differ