From ffe18b83989c2cbce4c6121aa6e1643d9ad1ee00 Mon Sep 17 00:00:00 2001 From: harukin-DeskMini Date: Mon, 27 Mar 2023 05:32:49 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=E6=A7=8B=E5=86=85=E5=9B=B3=E5=AF=BE?= =?UTF-8?q?=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/originData/uwajima.js | 2 +- .../StationDeteilView.js | 67 +++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/assets/originData/uwajima.js b/assets/originData/uwajima.js index aebb12f..0e0de79 100644 --- a/assets/originData/uwajima.js +++ b/assets/originData/uwajima.js @@ -14,7 +14,7 @@ export default [ {"Station_JP" : "八幡浜", "Station_EN" : "Yawatahama", "MyStation" : "11", "StationNumber" : "U18", "DispNum" : "3", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/yawatahama.pdf", "StationMap":"https://www.google.co.jp/maps/place/33.458146,132.436002", "JrHpUrl" : "http://www.jr-shikoku.co.jp/01_trainbus/kakueki/yawatahama/"}, {"Station_JP" : "双岩", "Station_EN" : "Futaiwa", "MyStation" : "12", "StationNumber" : "U19", "DispNum" : "2", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/futaiwa.pdf", "StationMap":"https://www.google.co.jp/maps/place/33.424669,132.457934", "JrHpUrl" : ""}, {"Station_JP" : "伊予石城", "Station_EN" : "Iyo-Iwaki", "MyStation" : "13", "StationNumber" : "U20", "DispNum" : "2", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/iyo-iwaki.pdf", "StationMap":"https://www.google.co.jp/maps/place/33.391413,132.473259", "JrHpUrl" : ""}, -{"Station_JP" : "卯之町", "Station_EN" : "Unomachi", "MyStation" : "14", "StationNumber" : "U22", "DispNum" : "3", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/unomachi.pdf", "StationMap":"https://www.google.co.jp/maps/place/33.363175,132.509959", "JrHpUrl" : "http://www.jr-shikoku.co.jp/01_trainbus/kakueki/unomachi/"}, +{"Station_JP" : "卯之町", "Station_EN" : "Unomachi", "MyStation" : "14", "StationNumber" : "U22", "DispNum" : "3", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/unomachi.pdf", "StationMap":"https://www.google.co.jp/maps/place/33.363175,132.509959", "JrHpUrl" : ""}, {"Station_JP" : "下宇和", "Station_EN" : "Shimo-Uwa", "MyStation" : "15", "StationNumber" : "U23", "DispNum" : "2", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/shimo-uwa.pdf", "StationMap":"https://www.google.co.jp/maps/place/33.349786,132.531172", "JrHpUrl" : ""}, {"Station_JP" : "立間", "Station_EN" : "Tachima", "MyStation" : "16", "StationNumber" : "U24", "DispNum" : "2", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/tachima.pdf", "StationMap":"https://www.google.co.jp/maps/place/33.296721,132.539509", "JrHpUrl" : ""}, {"Station_JP" : "伊予吉田", "Station_EN" : "Iyo-Yoshida", "MyStation" : "17", "StationNumber" : "U25", "DispNum" : "2", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/iyo-yoshida.pdf", "StationMap":"https://www.google.co.jp/maps/place/33.273287,132.544098", "JrHpUrl" : ""}, diff --git a/components/ActionSheetComponents/StationDeteilView.js b/components/ActionSheetComponents/StationDeteilView.js index 237db26..4ecabe8 100644 --- a/components/ActionSheetComponents/StationDeteilView.js +++ b/components/ActionSheetComponents/StationDeteilView.js @@ -8,6 +8,7 @@ import { Text, TouchableOpacity, } from "react-native"; +import AutoHeightImage from "react-native-auto-height-image"; import { FontAwesome, Foundation, Ionicons } from "@expo/vector-icons"; import ActionSheet from "react-native-actions-sheet"; import Sign from "../../components/駅名表/Sign"; @@ -94,6 +95,13 @@ export const StationDeteilView = (props) => { setFavoriteStation={setFavoriteStation} /> ))} + {currentStation && + currentStation[0].JrHpUrl && + currentStation[0].StationNumber != "M12" && ( + <駅構内図 //高松/阿波池田&後免&須崎kounai.png児島例外/ + uri={currentStation[0].JrHpUrl.replace("/index.html", "/")} + /> + )} {currentStation && ( {!currentStation[0].JrHpUrl || ( @@ -291,6 +299,65 @@ const NexPreStationLine = ({ ); }; +const 駅構内図 = (props) => { + const [open, setOpen] = useState(false); + return ( + <> + Linking.openURL(props.uri + "images/kounai.gif")} + onPress={() => setOpen(!open)} + > + + + {open ? "駅構内図を非表示" : "駅構内図を表示"} + + + + + {open && ( + <> + + + + + + )} + + + ); +}; + const styleSheet = { 外枠: { width: wp("80%"), From 3d09b93df55c95a3e2a3e5c308371b668e849f3d Mon Sep 17 00:00:00 2001 From: harukin-DeskMini Date: Mon, 27 Mar 2023 05:37:20 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=E6=9A=AB=E5=AE=9A=E7=9A=84=E3=83=96?= =?UTF-8?q?=E3=83=A9=E3=82=A6=E3=82=B6=E3=82=B8=E3=83=A3=E3=83=B3=E3=83=97?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ActionSheetComponents/StationDeteilView.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/ActionSheetComponents/StationDeteilView.js b/components/ActionSheetComponents/StationDeteilView.js index 4ecabe8..8e08395 100644 --- a/components/ActionSheetComponents/StationDeteilView.js +++ b/components/ActionSheetComponents/StationDeteilView.js @@ -312,8 +312,8 @@ const 駅構内図 = (props) => { alignItems: "center", margin: 2, }} - onLongPress={() => Linking.openURL(props.uri + "images/kounai.gif")} - onPress={() => setOpen(!open)} + onPress={() => Linking.openURL(props.uri + "/kounai_map.html")} + //onPress={() => setOpen(!open)} > Date: Mon, 27 Mar 2023 06:15:07 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=E3=82=A2=E3=83=97=E3=83=AA=E3=81=AE?= =?UTF-8?q?=E8=B5=B7=E5=8B=95=E6=99=82=E3=81=AB=E3=81=8A=E6=B0=97=E3=81=AB?= =?UTF-8?q?=E5=85=A5=E3=82=8A=E3=81=AE=E4=B8=80=E4=BB=B6=E7=9B=AE=E3=81=AB?= =?UTF-8?q?=E3=82=B8=E3=83=A3=E3=83=B3=E3=83=97=E3=81=99=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.js | 1 + Apps.js | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/App.js b/App.js index 9fd49de..028e4cf 100644 --- a/App.js +++ b/App.js @@ -177,6 +177,7 @@ const Top = ({ favoriteStation={favoriteStation} setFavoriteStation={setFavoriteStation} busAndTrainData={busAndTrainData} + stationData={mapsStationData} /> )} diff --git a/Apps.js b/Apps.js index 2a2f59e..fc05805 100644 --- a/Apps.js +++ b/Apps.js @@ -25,6 +25,7 @@ export default function Apps({ favoriteStation, setFavoriteStation, busAndTrainData, + stationData, }) { const { navigate } = navigation; var urlcache = ""; @@ -39,10 +40,12 @@ export default function Apps({ const [stationBoardData, setStationBoardData] = useState(undefined); const [originalStationList, setOriginalStationList] = useState(); const [selectedStation, setSelectedStation] = useState(undefined); + let once = false; useEffect(() => { getStationList().then(setOriginalStationList); }, []); + useEffect(() => {}, [stationData, favoriteStation]); //地図表示テキスト const injectJavascript = injectJavascriptData( mapSwitch, @@ -183,6 +186,26 @@ export default function Apps({ onMessage={onMessage} injectedJavaScript={injectJavascript} onTouchMove={() => StationBoardAcSR.current?.hide()} + onLoadEnd={() => { + if (once) return () => {}; + if (!stationData) return () => {}; + if (favoriteStation.length > 0) { + const getStationLine = (now) => { + const returnData = Object.keys(stationData).filter((d) => { + const cache = stationData[d].findIndex( + (data) => data.Station_JP == now.Station_JP + ); + return cache != -1; + }); + return returnData[0]; + }; + const lineName = getStationLine(favoriteStation[0][0]); + webview.current?.injectJavaScript( + `MoveDisplayStation('${lineName}_${favoriteStation[0][0].MyStation}_${favoriteStation[0][0].Station_JP}')` + ); + once = true; + } + }} /> navigate("trainMenu", { webview })}