Skip to content

Commit

Permalink
Merge pull request #21 from yeukfei02/fix-code
Browse files Browse the repository at this point in the history
refactor: 💡 add sg mrt map
  • Loading branch information
yeukfei02 committed Nov 21, 2020
2 parents ecd6ef5 + 9e594ae commit d9cdf93
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 13 deletions.
6 changes: 3 additions & 3 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"ios",
"android"
],
"version": "0.1.12",
"version": "0.1.13",
"orientation": "portrait",
"icon": "./assets/appstore-icon.png",
"updates": {
Expand All @@ -17,7 +17,7 @@
],
"ios": {
"bundleIdentifier": "com.donaldwu.singaporebusarrivalapp",
"buildNumber": "0.1.12",
"buildNumber": "0.1.13",
"infoPlist": {
"NSLocationWhenInUseUsageDescription": "Singapore Bus Arrival App requires your location so that we can find related bus arrival information for you",
"NSLocationAlwaysUsageDescription": "Singapore Bus Arrival App requires your location so that we can find related bus arrival information for you",
Expand All @@ -27,7 +27,7 @@
},
"android": {
"package": "com.donaldwu.singaporebusarrivalapp",
"versionCode": 12,
"versionCode": 13,
"permissions": [
"ACCESS_COARSE_LOCATION",
"ACCESS_FINE_LOCATION"
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"eslint-plugin-react": "^7.21.5",
"expo": "~39.0.2",
"expo-constants": "^9.2.0",
"expo-file-system": "^9.2.0",
"git-cz": "^4.7.1",
"graphql": "^15.4.0",
"husky": "^4.3.0",
Expand All @@ -42,6 +43,8 @@
"react-native-safe-area-context": "3.1.4",
"react-native-screens": "~2.10.1",
"react-native-web": "~0.13.12",
"react-native-webview": "10.7.0",
"rn-pdf-reader-js": "^4.1.1",
"standard-version": "^9.0.0"
},
"devDependencies": {
Expand Down
33 changes: 33 additions & 0 deletions src/components/settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ function Settings(props: any): JSX.Element {
setVisible(false);
};

const handleSingaporeMrtCurrentMapClick = () => {
props.navigation.navigate(`SingaporeMrtMapPdf`, {
uri: 'https://drive.google.com/uc?export=download&id=1hrIwwbgah0FKvWwRdXpvcGEG-AsYr3Yp',
});
};

const handleSingaporeMrtFutureMapClick = () => {
props.navigation.navigate(`SingaporeMrtMapPdf`, {
uri: 'https://drive.google.com/uc?export=download&id=1vZGHSW_5pj5fMOEAhL42f0yCHLS4KaRb',
});
};

const handleEmailIconClick = () => {
Linking.openURL(`mailto:yeukfei02@gmail.com`);
};
Expand Down Expand Up @@ -91,6 +103,27 @@ function Settings(props: any): JSX.Element {

<View style={{ marginVertical: 20 }}></View>

<Text style={{ fontSize: 25, fontWeight: 'bold', color: theme === 'light' ? 'black' : 'white' }}>
Singapore Mrt Map
</Text>

<View style={{ marginVertical: 20 }}></View>

<View style={{ flexDirection: 'row', justifyContent: 'space-around' }}>
<TouchableOpacity onPress={() => handleSingaporeMrtCurrentMapClick()}>
<View style={{ backgroundColor: 'orange', padding: 15, borderRadius: 5 }}>
<Text style={{ color: 'white', fontWeight: 'bold', fontSize: 15 }}>Current Map</Text>
</View>
</TouchableOpacity>
<TouchableOpacity onPress={() => handleSingaporeMrtFutureMapClick()}>
<View style={{ backgroundColor: 'lightskyblue', padding: 15, borderRadius: 5 }}>
<Text style={{ color: 'white', fontWeight: 'bold', fontSize: 15 }}>Future Map</Text>
</View>
</TouchableOpacity>
</View>

<View style={{ marginVertical: 20 }}></View>

<Text style={{ fontSize: 25, fontWeight: 'bold', color: theme === 'light' ? 'black' : 'white' }}>
Report a bug
</Text>
Expand Down
21 changes: 21 additions & 0 deletions src/components/settingsView/SettingsView.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';

import Settings from '../settings/Settings';
import SingaporeMrtMapPdf from '../singaporeMrtMapPdf/SingaporeMrtMapPdf';

const Stack = createStackNavigator();

function SettingsView(): JSX.Element {
return (
<NavigationContainer independent={true}>
<Stack.Navigator screenOptions={{ headerShown: false }}>
<Stack.Screen name="Settings" component={Settings} />
<Stack.Screen name="SingaporeMrtMapPdf" component={SingaporeMrtMapPdf} />
</Stack.Navigator>
</NavigationContainer>
);
}

export default SettingsView;
32 changes: 32 additions & 0 deletions src/components/singaporeMrtMapPdf/SingaporeMrtMapPdf.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React, { useEffect, useState } from 'react';
import { StyleSheet, View } from 'react-native';
import PDFReader from 'rn-pdf-reader-js';

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'white',
},
});

function SingaporeMrtMapPdf(props: any): JSX.Element {
const [uri, setUri] = useState('');

useEffect(() => {
if (props.route.params) {
setUri(props.route.params.uri);
}
}, [props.route.params]);

return (
<View style={styles.container}>
<PDFReader
source={{
uri: uri,
}}
/>
</View>
);
}

export default SingaporeMrtMapPdf;
4 changes: 2 additions & 2 deletions src/components/tabView/TabView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { FontAwesome, MaterialIcons } from '@expo/vector-icons';
import NearMeView from '../nearMeView/NearMeView';
import SearchView from '../searchView/SearchView';
import FavouritesView from '../favouritesView/FavouritesView';
import Settings from '../settings/Settings';
import SettingsView from '../settingsView/SettingsView';

const Tab = createBottomTabNavigator();

Expand Down Expand Up @@ -63,7 +63,7 @@ function TabView(): JSX.Element {
<Tab.Screen name="NearMe" component={NearMeView} />
<Tab.Screen name="Search" component={SearchView} />
<Tab.Screen name="Favourites" component={FavouritesView} />
<Tab.Screen name="Settings" component={Settings} />
<Tab.Screen name="Settings" component={SettingsView} />
</Tab.Navigator>
</NavigationContainer>
);
Expand Down
56 changes: 48 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3113,6 +3113,11 @@ balanced-match@^1.0.0:
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=

base64-js@^1.0.2:
version "1.5.1"
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a"
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==

base64-js@^1.1.2, base64-js@^1.2.3, base64-js@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.1.tgz#58ece8cb75dd07e71ed08c736abc5fac4dbf8df1"
Expand Down Expand Up @@ -3272,6 +3277,14 @@ buffer-from@^1.0.0:
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==

buffer@5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.1.0.tgz#c913e43678c7cb7c8bd16afbcddb6c5505e8f9fe"
integrity sha512-YkIRgwsZwJWTnyQrsBTWefizHh+8GYj3kbL1BTiAQ/9pwpino0G7B2gp5tx/FUBqUlvtxV85KNR3mwfAtv15Yw==
dependencies:
base64-js "^1.0.2"
ieee754 "^1.1.4"

buffer@^5.2.0:
version "5.7.1"
resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0"
Expand Down Expand Up @@ -3993,6 +4006,11 @@ cssstyle@^2.0.0, cssstyle@^2.2.0:
dependencies:
cssom "~0.3.6"

csstype@2.6.8:
version "2.6.8"
resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.8.tgz#0fb6fc2417ffd2816a418c9336da74d7f07db431"
integrity sha512-msVS9qTuMT5zwAGCVm4mxfrZ18BNc6Csd0oJAtiFMZ1FAx1CCvy2+5MDmYoix63LM/6NDbNtodCiGYGmFgO0dA==

csstype@^3.0.2:
version "3.0.4"
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.0.4.tgz#b156d7be03b84ff425c9a0a4b1e5f4da9c5ca888"
Expand Down Expand Up @@ -4531,16 +4549,16 @@ escape-html@~1.0.3:
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=

escape-string-regexp@2.0.0, escape-string-regexp@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344"
integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==

escape-string-regexp@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=

escape-string-regexp@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344"
integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==

escape-string-regexp@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
Expand Down Expand Up @@ -4837,7 +4855,7 @@ expo-error-recovery@~1.3.0:
dependencies:
fbjs "1.0.0"

expo-file-system@~9.2.0:
expo-file-system@^9.2.0, expo-file-system@~9.2.0:
version "9.2.0"
resolved "https://registry.yarnpkg.com/expo-file-system/-/expo-file-system-9.2.0.tgz#e8efde36968a1e6d826236044a970e85bfe0aeee"
integrity sha512-GsDf+E6e1WyYqyUiXbcWthLk7oVO+WDticnHUGAzb17hVCgxJhlUbRriwY3kBkQAX1mr+Hq9lkgJPIRbV197Fw==
Expand Down Expand Up @@ -5772,7 +5790,7 @@ iconv-lite@^0.6.2:
dependencies:
safer-buffer ">= 2.1.2 < 3.0.0"

ieee754@^1.1.13:
ieee754@^1.1.13, ieee754@^1.1.4:
version "1.2.1"
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352"
integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==
Expand Down Expand Up @@ -5902,7 +5920,7 @@ interpret@^1.0.0:
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e"
integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==

invariant@^2.2.2, invariant@^2.2.4:
invariant@2.2.4, invariant@^2.2.2, invariant@^2.2.4:
version "2.2.4"
resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6"
integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==
Expand Down Expand Up @@ -7184,6 +7202,11 @@ jpeg-js@^0.3.4:
resolved "https://registry.yarnpkg.com/jpeg-js/-/jpeg-js-0.3.7.tgz#471a89d06011640592d314158608690172b1028d"
integrity sha512-9IXdWudL61npZjvLuVe/ktHiA41iE8qFyLB+4VDTblEsWBzeg8WQTlktdUK4CdncUqtUgUg0bbOmTE2bKBKaBQ==

js-base64@2.4.5:
version "2.4.5"
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.4.5.tgz#e293cd3c7c82f070d700fc7a1ca0a2e69f101f92"
integrity sha512-aUnNwqMOXw3yvErjMPSQu6qIIzUmT1e5KcU1OZxRDU1g/am6mzBvcrmLAYwzmB59BHPrh5/tKaiF4OPhqRWESQ==

"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
Expand Down Expand Up @@ -9304,6 +9327,14 @@ react-native-web@~0.13.12:
prop-types "^15.6.0"
react-timer-mixin "^0.13.4"

react-native-webview@10.7.0:
version "10.7.0"
resolved "https://registry.yarnpkg.com/react-native-webview/-/react-native-webview-10.7.0.tgz#b96e152ffdae4eeffaa74f43671a35733885b52d"
integrity sha512-4TSYwJqMBUTKB9+xqGbPwx+eLXbp6RRD7lQ2BumT8eSTfuuqr2rXNqcrlKU1VRla7QGGYowmYmxl2aXIx5k9wA==
dependencies:
escape-string-regexp "2.0.0"
invariant "2.2.4"

"react-native@https://github.com/expo/react-native/archive/sdk-39.0.4.tar.gz":
version "0.63.2"
resolved "https://github.com/expo/react-native/archive/sdk-39.0.4.tar.gz#701dd827e27167db70cced8d09bedcc3c2d52897"
Expand Down Expand Up @@ -9733,6 +9764,15 @@ rimraf@~2.2.6:
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.2.8.tgz#e439be2aaee327321952730f99a8929e4fc50582"
integrity sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=

rn-pdf-reader-js@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/rn-pdf-reader-js/-/rn-pdf-reader-js-4.1.1.tgz#979bc045b9d6065ceb1a6de8bd82f4c6184c0bf7"
integrity sha512-KnBzB1wfHPdE/Qb6oMmX0/iAD60tp+kf0TZaHw6tb0ULrdSvaG5rspTJArUEA724qYFwuVG1U2B0WTK8inpe1Q==
dependencies:
buffer "5.1.0"
csstype "2.6.8"
js-base64 "2.4.5"

rst-selector-parser@^2.2.3:
version "2.2.3"
resolved "https://registry.yarnpkg.com/rst-selector-parser/-/rst-selector-parser-2.2.3.tgz#81b230ea2fcc6066c89e3472de794285d9b03d91"
Expand Down

0 comments on commit d9cdf93

Please sign in to comment.