From 7951014d9619176990f47c5b5d8df931c9c2790e Mon Sep 17 00:00:00 2001 From: nnajah1 Date: Mon, 14 Apr 2025 17:56:25 +0800 Subject: [PATCH] bug fixes --- .../executionHistory/executionHistory.bin | Bin 16881496 -> 16881496 bytes .../executionHistory/executionHistory.lock | Bin 17 -> 17 bytes .../.gradle/7.5.1/fileHashes/fileHashes.bin | Bin 904535 -> 905135 bytes .../.gradle/7.5.1/fileHashes/fileHashes.lock | Bin 17 -> 17 bytes .../buildOutputCleanup.lock | Bin 17 -> 17 bytes android/.gradle/file-system.probe | Bin 8 -> 8 bytes app/screens/account/index.js | 3 + .../main/station/fragments/bottomsheet.js | 11 +- app/screens/main/station/fragments/map.js | 4 +- .../station/fragments/stationdetailspanel.js | 15 +- .../main/station/fragments/stationpanel.js | 151 ++++++++---------- .../payatpump/fragments/stationpanel.js | 99 +++++------- index.js | 4 +- 13 files changed, 128 insertions(+), 159 deletions(-) diff --git a/android/.gradle/7.5.1/executionHistory/executionHistory.bin b/android/.gradle/7.5.1/executionHistory/executionHistory.bin index 9b2a2880f2b2306c9a4c10280764ae2907c45ac4..57f6ca4b8f9c5f886de7d47917350b841cf5bae9 100644 GIT binary patch delta 1353 zcmajcX;hSD7{+l1!blh@hAgE`j4YO^5T(6LOKCyPjI@myAqGa?DH1dbw@aoGGL!19 zXkjeN79k3KTPSFQvPE+NTD54kh>|SZq<`>%kMDEN@0{nubKm!M?x(B1GO7zp6(gr&b*K*0;fj+>@j5~ybfk{bNR3j0j@B_cR>$dhjaH(@=maI{ zM2*!+I$6m|QL579)+stwrzu_Il%esOpiG^vGjyiT(%Cvk=juG2uZg-qlQdZu>LN|i zRAuR6U7|~MnX)xa(=|hvYo@NyEM3`@vo0<%-CsK1=bP^<&nxtl6?iS+O@` zUf95K_{|yRh83uA<=`sJ#vELYYj7>D!}Z9;4al=9T%H5Hw%uKQW}|ahVxTo*F7i=; z8&L=^ickz6=Ap!DjWFE#ww=QVb6f3RqbSDqb$r4=4wD=WY0f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TIwKwBiR`4H)36# ztzz@${hpZ @@ -262,6 +263,7 @@ class About extends React.PureComponent { Unioil Logo @@ -271,6 +273,7 @@ class About extends React.PureComponent { diff --git a/app/screens/main/station/fragments/bottomsheet.js b/app/screens/main/station/fragments/bottomsheet.js index bc3fabe8..c3bb9946 100644 --- a/app/screens/main/station/fragments/bottomsheet.js +++ b/app/screens/main/station/fragments/bottomsheet.js @@ -92,15 +92,14 @@ const updateFavorite = async (city, index, callback) => { export default function renderStationPanel(props) { - const [updatedFavorite, setupdatedfavorite] = useState(false) - const [updatedFavoriteIndex, setupdatedfavoriteindex] = useState(null) const bottomSheetRef = useRef(null); + const snapPoints = [450, 300, 0]; useEffect(() => { if (props.visible) { bottomSheetRef.current?.expand(); } else { - bottomSheetRef.current?.close(); + bottomSheetRef.current?.collapse(); } }, [props.visible]); @@ -108,10 +107,11 @@ export default function renderStationPanel(props) { + {renderStations(props.isGuest, props.data, props.onClick, props.onUpdateFavorite)} @@ -125,7 +125,6 @@ export default function renderStationPanel(props) { - {renderStations(props.isGuest, props.data, props.onClick, props.onUpdateFavorite)} ) diff --git a/app/screens/main/station/fragments/map.js b/app/screens/main/station/fragments/map.js index 6f4a1ebc..ef055818 100644 --- a/app/screens/main/station/fragments/map.js +++ b/app/screens/main/station/fragments/map.js @@ -33,8 +33,8 @@ export default function RenderMap(props){ return ( { const [updateFavorite, setUpdateFavorite] = useState(0) const [updateFavoriteVal, setUpdateFavoriteVal] = useState(false) const bottomSheetRef = useRef(null); + const snapPoints = ['40%']; useEffect(() => { if (props.visible) { - bottomSheetRef.current?.expand(); + bottomSheetRef.current?.expand(); } else { - bottomSheetRef.current?.close(); + bottomSheetRef.current?.collapse(); } }, [props.visible]); @@ -180,13 +181,14 @@ const renderStationPanel = (props) => { } return ( - + // + {renderStationDetails(props.data, props.onClick)} @@ -215,9 +217,8 @@ const renderStationPanel = (props) => { - {renderStationDetails(props.data, props.onClick)} - + // ); } diff --git a/app/screens/main/station/fragments/stationpanel.js b/app/screens/main/station/fragments/stationpanel.js index b488574c..b106df5b 100644 --- a/app/screens/main/station/fragments/stationpanel.js +++ b/app/screens/main/station/fragments/stationpanel.js @@ -1,5 +1,5 @@ import React from 'react'; -import {useState, useEffect, useRef} from 'react'; +import { useState, useEffect, useRef } from 'react'; import { Text, View, @@ -39,7 +39,7 @@ const styles = { }, }; -const {height} = Dimensions.get('window'); +const { height } = Dimensions.get('window'); const renderStations = (isGuest, data, onPress, onUpdateFavorite, props) => { return data.map((station, index) => { @@ -49,9 +49,10 @@ const renderStations = (isGuest, data, onPress, onUpdateFavorite, props) => { return ( ); }); @@ -60,10 +61,10 @@ const renderStations = (isGuest, data, onPress, onUpdateFavorite, props) => { key={index} activeOpacity={1} onPress={() => onPress(station) || null} - style={{backgroundColor: props.app_theme?.theme.dark ? Theme.colors.black : Theme.colors.white}} - > - - + style={{ backgroundColor: props.app_theme?.theme.dark ? Theme.colors.black : Theme.colors.white }} + > + + { }}> {station.address} - {stars} + {stars} { - if(isGuest){ + if (isGuest) { guestError() } else { updateFavorite(station, index, onUpdateFavorite) } }} - style={{flex: 0, justifyContent: 'center'}}> + style={{ flex: 0, justifyContent: 'center' }}> { ); @@ -109,19 +110,19 @@ const renderStations = (isGuest, data, onPress, onUpdateFavorite, props) => { const guestError = () => { Alert.alert( - "Information", + "Information", `\nApply for a card to enjoy this feature`, - [ - { - text: 'Cancel', - onPress: () => console.log('Cancel Pressed'), - style: { color: 'red' }, - }, + [ { - text: 'Enroll Card', - onPress: () => navigate('Login') - }, - ] + text: 'Cancel', + onPress: () => console.log('Cancel Pressed'), + style: { color: 'red' }, + }, + { + text: 'Enroll Card', + onPress: () => navigate('Login') + }, + ] ); } @@ -148,16 +149,11 @@ const updateFavorite = async (city, index, callback) => { }; const renderStationPanel = (props) => { - const [snap, setSnap] = useState(['10%', '10%', '3%']); - const bottomSheetRef = useRef(null); + const [snap, setSnap] = useState(['10%', '10%', '3%']); + const bottomSheetRef = useRef(null); useEffect(() => { init(); - if (props.visible) { - bottomSheetRef.current?.expand(); - } else { - bottomSheetRef.current?.close(); - } }, [props.visible, props.data]); const init = () => { @@ -177,79 +173,62 @@ const renderStationPanel = (props) => { }; const getPanelTitle = () => { - if(props.error) return 'There was an error' - else if(props.loading && !props.isSearched && props.data.length == 0) return 'Getting Nearby Stations' - else if(!props.loading && props.isFavorite && props.data.length == 0) return 'No Favorite' - else if(props.isSearched) return 'Unioil Stations found: ' + (props.data.length > 0 ? props.data.length : 0) + if (props.error) return 'There was an error' + else if (props.loading && !props.isSearched && props.data.length == 0) return 'Getting Nearby Stations' + else if (!props.loading && props.isFavorite && props.data.length == 0) return 'No Favorite' + else if (props.isSearched) return 'Unioil Stations found: ' + (props.data.length > 0 ? props.data.length : 0) else return 'Unioil Stations found: ' + (props.data.length > 0 ? props.data.length : 0) } - const renderHeaders = () => ( - - - - - {getPanelTitle()} - - - {props.error ? ( - - Try Again - - ) : props.loading ? ( - - ) : null} - + const renderHeaders = () => { + return ( + + + + {getPanelTitle()} + + + {props.error ? ( + + Try Again + + ) : props.loading ? ( + + ) : null} ); + }; - const renderContents = () => ( - - - {props.data.length > 0 ? ( - renderStations(props.isGuest, props.data, props.onClick, props.onUpdateFavorite, props) - ) : ( - - )} - - + const renderContents = () => { + return ( + + {props.data.length > 0 ? renderStations(props.isGuest, props.data, props.onClick, props.onUpdateFavorite, props) : + } + ); + }; return ( - + // - {renderHeaders()} - {renderContents()} + + {renderHeaders()} + {renderContents()} + - + // ); } diff --git a/app/screens/payatpump/fragments/stationpanel.js b/app/screens/payatpump/fragments/stationpanel.js index 17599e68..62903a06 100644 --- a/app/screens/payatpump/fragments/stationpanel.js +++ b/app/screens/payatpump/fragments/stationpanel.js @@ -103,37 +103,41 @@ const updateFavorite = async (city, index, callback) => { }; const renderStationPanel = (props) => { - const [panel, setpanel] = useState(null); - const [updatedFavorite, setupdatedfavorite] = useState(false); - const [updatedFavoriteIndex, setupdatedfavoriteindex] = useState(null); - const [loading, setLoading] = useState(false); - const [snap, setSnap] = useState(['10%', '10%', '3%']); + const [snap, setSnap] = useState(['10%', '10%', '3%']); const bottomSheetRef = useRef(null); + const [initialSnap, setInitialSnap] = useState(0) useEffect(() => { init(); - if (props.visible) { - bottomSheetRef.current?.expand(); - } else { - bottomSheetRef.current?.close(); - } }, [props.visible, props.data.length]); + const init = () => { - if (props.visible == true || props.data.length !== 0) { + if (props.visible == true) { if (props.data.length === 1) { setSnap([Platform.OS === "android" ? '23%' : '16%', '8%', '8%']); } else if (props.data.length === 2) { setSnap([Platform.OS === "android" ? '39%' : '27%', '8%', '8%']); + setInitialSnap(0); } else { setSnap(['38%', '8%', '8%']); + setInitialSnap(0); + } + } else if (props.data.length != 0) { + if (props.data.length === 1) { + setSnap([Platform.OS === "android" ? '23%' : '16%', '8%', '8%']); + } else if (props.data.length === 2) { + setSnap([Platform.OS === "android" ? '39%' : '27%', '8%', '8%']); + setInitialSnap(0); + } else { + setSnap(['38%', '8%', '8%']); + setInitialSnap(0); } - } else { setSnap([Platform.select({ ios: '14%', android: '12%' }), '8%', '8%']); + setInitialSnap(2); } }; - const getPanelTitle = () => { if (props.error) return 'There was an error' else if (props.loading && !props.isSearched && props.data.length == 0) return 'Getting Nearby Stations' @@ -142,22 +146,16 @@ const renderStationPanel = (props) => { else return 'Unioil Stations found: ' + (props.data.length > 0 ? props.data.length : 0) } - const renderHeaders = () => ( - + const renderHeaders = () => { + return ( - + - {getPanelTitle()} @@ -171,42 +169,29 @@ const renderStationPanel = (props) => { - - ); - - - const renderContents = () => ( - - {props.data.length > 0 ? ( - renderStations(props.data, props.onClick, props.onUpdateFavorite, props) - ) : ( - - - - )} - - ); + ); + }; + const renderContents = () => { + return ( + + {props.data.length > 0 ? renderStations(props.data, props.onClick, props.onUpdateFavorite, props) : + } + + ); + }; return ( - {renderHeaders()} - {renderContents()} + + {renderHeaders()} + {renderContents()} + ); } diff --git a/index.js b/index.js index 20425b2c..6da7a073 100644 --- a/index.js +++ b/index.js @@ -6,11 +6,13 @@ import './polyfills.js'; import 'react-native-gesture-handler'; import 'react-native-reanimated'; -import { AppRegistry } from 'react-native'; +import { AppRegistry, LogBox } from 'react-native'; import App from './app/App'; import { name as appName } from './app.json'; import messaging from '@react-native-firebase/messaging'; +LogBox.ignoreLogs(['`new NativeEventEmitter()`']); + messaging().setBackgroundMessageHandler(async remoteMessage => { console.log("'Message handled in the background!'", remoteMessage); });