김성연

tjddus: add MapView, Marker, StartFinshLocation frontend, update backend login

Showing 36 changed files with 442 additions and 23 deletions
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="JSX" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/code.iml" filepath="$PROJECT_DIR$/.idea/code.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/locationTest/expo-location-example" vcs="Git" />
<mapping directory="$PROJECT_DIR$/my-project" vcs="Git" />
<mapping directory="$PROJECT_DIR$/render_server_react_native" vcs="Git" />
<mapping directory="$PROJECT_DIR$/render_server_react_native/@expo/vector-icons" vcs="Git" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="940f1aa2-9848-4abc-bd75-a3db12d9e8e1" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/render_server_react_native/AuthContext.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/render_server_react_native/components/CurrentUserLocationComponent.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/render_server_react_native/components/LoginComponent.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/render_server_react_native/components/MyProfileComponent.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/render_server_react_native/components/SignUpComponent.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/render_server_react_native/constants/layout.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/render_server_react_native/navigations/SelectOrTakePhotoStackNavigation.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/render_server_react_native/navigations/SelectOrTakePhotoTabNavigation.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/render_server_react_native/navigations/TabNavigation.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/render_server_react_native/reducers/index.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/render_server_react_native/reducers/location.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/render_server_react_native/reducers/user.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/render_server_react_native/sagas/index.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/render_server_react_native/sagas/location.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/render_server_react_native/sagas/user.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/render_server_react_native/screens/Gallery.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/render_server_react_native/screens/Login.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/render_server_react_native/screens/Main.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/render_server_react_native/screens/Maps.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/render_server_react_native/screens/Profile.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/render_server_react_native/screens/TakePhoto.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/render_server_react_native/screens/UploadPhoto.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/render_server_react_native/store.js" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="JavaScript File" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/render_server_react_native" />
</component>
<component name="ProjectId" id="1baLVrrFUlmMeeq9EFLzndP0zML" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showExcludedFiles" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="ASKED_ADD_EXTERNAL_FILES" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="nodejs_package_manager_path" value="npm" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/user_and_post_server" />
<recent name="$PROJECT_DIR$" />
<recent name="$PROJECT_DIR$/my-project/sagas" />
<recent name="$PROJECT_DIR$/my-project/reducers" />
</key>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="940f1aa2-9848-4abc-bd75-a3db12d9e8e1" name="Default Changelist" comment="" />
<created>1588865284571</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1588865284571</updated>
<workItem from="1588865285717" duration="748000" />
<workItem from="1588875642765" duration="2528000" />
<workItem from="1588878826886" duration="6053000" />
<workItem from="1588919313007" duration="576000" />
<workItem from="1589357475573" duration="2335000" />
<workItem from="1589800232399" duration="230000" />
<workItem from="1589865778893" duration="5143000" />
<workItem from="1589960196464" duration="11230000" />
<workItem from="1590036154083" duration="405000" />
<workItem from="1590039473513" duration="2083000" />
<workItem from="1590082072338" duration="1708000" />
<workItem from="1590302730003" duration="745000" />
<workItem from="1590304674918" duration="364000" />
<workItem from="1590305558438" duration="34000" />
<workItem from="1590392477108" duration="7362000" />
<workItem from="1590405423629" duration="8216000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
<component name="VcsManagerConfiguration">
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
</component>
<component name="WindowStateProjectService">
<state x="368" y="125" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1590082196823">
<screen x="0" y="23" width="1440" height="877" />
</state>
<state x="368" y="125" key="#com.intellij.execution.impl.EditConfigurationsDialog/0.23.1440.877@0.23.1440.877" timestamp="1590082196823" />
<state x="710" y="271" key="#com.intellij.fileTypes.FileTypeChooser" timestamp="1588881921466">
<screen x="0" y="23" width="1440" height="877" />
</state>
<state x="710" y="271" key="#com.intellij.fileTypes.FileTypeChooser/0.23.1440.877@0.23.1440.877" timestamp="1588881921466" />
<state width="784" height="229" key="GridCell.Tab.0.bottom" timestamp="1588878772214">
<screen x="0" y="23" width="1440" height="877" />
</state>
<state width="784" height="229" key="GridCell.Tab.0.bottom/0.23.1440.877@0.23.1440.877" timestamp="1588878772214" />
<state width="784" height="229" key="GridCell.Tab.0.center" timestamp="1588878772213">
<screen x="0" y="23" width="1440" height="877" />
</state>
<state width="784" height="229" key="GridCell.Tab.0.center/0.23.1440.877@0.23.1440.877" timestamp="1588878772213" />
<state width="784" height="229" key="GridCell.Tab.0.left" timestamp="1588878772212">
<screen x="0" y="23" width="1440" height="877" />
</state>
<state width="784" height="229" key="GridCell.Tab.0.left/0.23.1440.877@0.23.1440.877" timestamp="1588878772212" />
<state width="784" height="229" key="GridCell.Tab.0.right" timestamp="1588878772213">
<screen x="0" y="23" width="1440" height="877" />
</state>
<state width="784" height="229" key="GridCell.Tab.0.right/0.23.1440.877@0.23.1440.877" timestamp="1588878772213" />
<state x="702" y="213" width="670" height="676" key="search.everywhere.popup" timestamp="1588882527475">
<screen x="0" y="23" width="1440" height="877" />
</state>
<state x="702" y="213" width="670" height="676" key="search.everywhere.popup/0.23.1440.877@0.23.1440.877" timestamp="1588882527475" />
<state x="767" y="383" key="vcs.readOnlyHandler.ReadOnlyStatusDialog" timestamp="1588882053803">
<screen x="0" y="23" width="1440" height="877" />
</state>
<state x="767" y="383" key="vcs.readOnlyHandler.ReadOnlyStatusDialog/0.23.1440.877@0.23.1440.877" timestamp="1588882053803" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="javascript">
<url>file://$PROJECT_DIR$/my-project/screens/HomeScreen.js</url>
<option name="timeStamp" value="1" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
</project>
\ No newline at end of file
......@@ -9,6 +9,7 @@ npm-debug.*
*.orig.*
web-build/
web-report/
node_modules/
# macOS
.DS_Store
......
import React, {useState, useEffect} from 'react';
import MapView, {Marker} from 'react-native-maps';
import {StyleSheet, Text, TextInput, View, TouchableOpacity} from 'react-native';
import screen from '../constants/layout';
import {useSelector, useDispatch} from "react-redux";
import * as Location from 'expo-location';
import {set} from "react-native-reanimated";
import {MaterialCommunityIcons} from "@expo/vector-icons";
import {SET_LOC_REQUEST} from "../reducers/location";
const StartAndFinishLocationComponent = () => {
const [hasPermission, setHasPermission] = useState(false);
const [startTextLocation, setStartTextLocation] = useState('');
const [finishTextLocation, setFinishTextLocation] = useState('');
const [userLocation, setUserLocation] = useState(null);
const onChangeStartLocation = async (startTextLocation) => {
setStartTextLocation(startTextLocation);
};
const onChangeFinishLocation = (finishTextLocation) => {
setFinishTextLocation(finishTextLocation);
};
const dispatch = useDispatch();
const setLocation = async () => {
if (!startTextLocation || !finishTextLocation) {
return
}
console.log(startTextLocation, finishTextLocation);
await dispatch({
type: SET_LOC_REQUEST,
data: {
startTextLocation,
finishTextLocation
}
}
)
};
return (
<View style={styles.container}>
<View style={styles.input}>
<Text style={styles.textStyle}>출발지</Text>
<TextInput
style={styles.inputText}
onChangeText={onChangeStartLocation}
/>
<TouchableOpacity>
<MaterialCommunityIcons color={'grey'} name={'map-marker'} size={30}/>
</TouchableOpacity>
</View>
<View style={styles.input}>
<Text style={styles.textStyle}>도착지</Text>
<TextInput
style={styles.inputText}
onChangeText={onChangeFinishLocation}
/>
</View>
<View style={{flexDirection: 'row'}}>
<TouchableOpacity style={styles.buttonStyle} onPress={setLocation}>
<Text>MAP설정</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.buttonStyle}>
<Text>사용자최적경로검색</Text>
</TouchableOpacity>
</View>
</View>
)
};
export default StartAndFinishLocationComponent;
const styles = StyleSheet.create({
container: {
marginLeft: 20,
marginRight: 20,
},
input: {
borderRadius: 10,
backgroundColor: 'lightgrey',
paddingLeft: 10,
paddingRight: 10,
width: 300,
height: 40,
alignItems: 'center',
flexDirection: 'row',
justifyContent: 'space-between',
borderBottomColor: '#bbb',
marginBottom: 10
// borderBottomWidth: StyleSheet.hairlineWidth,
},
inputText: {
flex: 1,
},
textStyle: {
fontWeight: 'bold',
fontSize: 17,
marginRight: 15,
},
buttonStyle: {
flex: 1,
backgroundColor: '#ecf0f1',
alignItems: 'center',
justifyContent: 'center',
width: 30,
height: 30,
borderWidth: 1,
borderColor: 'black',
marginBottom: 20
}
});
const host = '172.20.10.3';
export default host;
\ No newline at end of file
export const host = '172.20.10.3';
export const coordAPIKEY = 'CDCF07BD-2CE4-33D9-BA13-D6CE4360A2B3';
......
This diff could not be displayed because it is too large.
......@@ -17,6 +17,7 @@
"expo-asset": "^8.1.4",
"expo-camera": "~8.2.0",
"expo-font": "^8.1.1",
"expo-location": "~8.1.0",
"expo-media-library": "~8.1.0",
"expo-permissions": "~8.1.0",
"expo-web-browser": "^8.2.1",
......
import {combineReducers} from "redux";
import user from './user';
// import post from './post';
import location from './location';
const rootReducer = combineReducers({
user,
// post
location
});
export default rootReducer;
\ No newline at end of file
......
export const initialState = {
startLocation: null,
finishLocation: null,
settingLocation: false,
info: '',
};
export const SET_LOC_REQUEST = 'SET_LOC_REQUEST';
export const SET_LOC_SUCCESS = 'SET_LOC_SUCCESS';
export const SET_LOC_FAILURE = 'SET_LOC_FAILURE';
export default (state = initialState, action) => {
switch (action.type) {
case SET_LOC_REQUEST: {
return {
...state,
settingLocation: true,
}
}
case SET_LOC_SUCCESS: {
const {startLocation, finishLocation} = action.data;
return {
...state,
startLocation,
finishLocation,
isLoggingIn: false,
};
}
case SET_LOC_FAILURE: {
const {info} = action.data;
return {
...state,
settingLocation: false,
info,
}
}
default: {
return {
...state,
};
}
}
};
\ No newline at end of file
import {all, fork} from 'redux-saga/effects';
import user from './user';
// import post from './post';
import location from './location';
export default function* rootSaga(){
export default function* rootSaga() {
yield all([
fork(user),
// fork(post)
fork(location),
])
}
\ No newline at end of file
......
import {all, call, fork, delay, put, takeEvery, takeLatest} from 'redux-saga/effects';
import axios from 'axios';
import {coordAPIKEY} from '../env';
import {
SET_LOC_REQUEST,
SET_LOC_SUCCESS,
SET_LOC_FAILURE,
} from "../reducers/location";
function setLocationAPI(data) {
const {startTextLocation, finishTextLocation} = data;
console.log(startTextLocation, finishTextLocation);
const startRes = axios.get(`http://api.vworld.kr/req/address?service=address&request=getcoord&version=2.0&crs=epsg:4326&address=${startTextLocation}&refine=true&simple=false&format=xml&type=road&key=${coordAPIKEY}`);
const finishRes = axios.get(`http://api.vworld.kr/req/address?service=address&request=getcoord&version=2.0&crs=epsg:4326&address=${finishTextLocation}&refine=true&simple=false&format=xml&type=road&key=${coordAPIKEY}`);
return {startRes, finishRes};
}
function* setLocation(action) {
try {
console.log('saga의 setLocation', action.data);
const res = yield call(setLocationAPI, action.data);
console.log(res.startRes, res.finishRes);
const {result} = res.startRes;
console.log(result);
} catch (e) {
console.error(e);
}
};
function* watchSetLocation() {
console.log('watchSetLocation');
yield takeLatest(SET_LOC_REQUEST, setLocation);
}
export default function* locationSaga() {
yield all([
fork(watchSetLocation),
]);
};
\ No newline at end of file
......@@ -37,6 +37,9 @@ function loginAPI(data) {
const {email, password} = data;
console.log(email, password);
console.log(`http://${host}:4001/user/login`);
// const res1 = axios.get(`http://${host}:4001/user/test`, {
// withCredentials: true
// });
return axios.post(`http://${host}:4001/user/login`, {
email, password
}, {
......
import React from 'react';
import MapView from 'react-native-maps';
import React, {useState, useEffect} from 'react';
import MapView, {Marker} from 'react-native-maps';
import {StyleSheet, Text, View, Dimensions} from 'react-native';
import screen from '../constants/layout';
import StartAndFinishLocationComponent from "../components/CurrentUserLocationComponent";
const Maps = () => {
const [initialRegion, setInitialRegion] = useState(
{
latitude: 37.56647,
longitude: 126.977963,
latitudeDelta: 0.3922,
longitudeDelta: 0.3421
});
return (
<View style={styles.container}>
<Text style={styles.textStyle}>Current User Location</Text>
<StartAndFinishLocationComponent/>
<MapView
style={styles.mapStyle}
initialRegion={{
latitude: 37.78825,
longitude: -122.4324,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421
}}
/>
initialRegion={initialRegion}
>
<Marker
coordinate={initialRegion}
title="this is a marker"
description="this is a marker example">
</Marker>
</MapView>
</View>
)
};
......@@ -32,4 +45,10 @@ const styles = StyleSheet.create({
width: screen.width,
height: screen.height / 2,
},
textStyle: {
fontWeight: 'bold',
fontSize: 20,
color: 'grey',
marginBottom: 20,
}
});
......
{
"development": {
"username": "root",
"password": "test",
"password": "ksy98042!",
"database": "capstone_design_prj1",
"host": "127.0.0.1",
"dialect": "mysql",
......
This diff is collapsed. Click to expand it.
......@@ -2587,9 +2587,9 @@
}
},
"needle": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/needle/-/needle-2.4.1.tgz",
"integrity": "sha512-x/gi6ijr4B7fwl6WYL9FwlCvRQKGlUNvnceho8wxkwXqN8jvVmmmATTmZPRRG7b/yC1eode26C2HO9jl78Du9g==",
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/needle/-/needle-2.5.0.tgz",
"integrity": "sha512-o/qITSDR0JCyCKEQ1/1bnUXMmznxabbwi/Y4WwJElf+evwJNFNwIDMCCt5IigFVxgeGBJESLohGtIS9gEzo1fA==",
"requires": {
"debug": "^3.2.6",
"iconv-lite": "^0.4.4",
......@@ -4428,6 +4428,11 @@
"resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-3.0.0.tgz",
"integrity": "sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ="
},
"xmlhttprequest": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz",
"integrity": "sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw="
},
"xmlhttprequest-ssl": {
"version": "1.5.5",
"resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz",
......
......@@ -30,6 +30,7 @@
"pug": "2.0.0-beta11",
"sequelize": "^5.21.5",
"sequelize-cli": "^5.5.1",
"socket.io": "^2.3.0"
"socket.io": "^2.3.0",
"xmlhttprequest": "^1.8.0"
}
}
......
......@@ -4,9 +4,10 @@ const bcrypt = require('bcrypt');
const passport = require('passport');
const {isLoggedIn, isNotLoggedIn} = require("./middleware");
const models = require('../models/index');
const {searchPubTransPathAJAX} = require('../crawling');
router.get('/loadMe', isLoggedIn, (req, res, next) => {
console.log('loadMe요청옴', req.user);
// console.log('loadMe요청옴', req.user);
return res.json({user: req.user});
});
......@@ -113,4 +114,8 @@ router.get('/logout', (req, res, next) => {
return res.send();
});
router.get('/test', (req, res, next) => {
searchPubTransPathAJAX();
});
module.exports = router;
\ No newline at end of file
......