お気に入りリストからのジャンプを全ての駅で利用可能に
This commit is contained in:
parent
3488c5e8d5
commit
28b23efc5e
@ -2,7 +2,13 @@ import React from "react";
|
||||
import { Platform, LayoutAnimation } from "react-native";
|
||||
import { WebView } from "react-native-webview";
|
||||
|
||||
import { lineList, stationNamePair } from "../../lib/getStationList";
|
||||
import {
|
||||
lineList,
|
||||
lineList_LineWebID,
|
||||
lineListPair,
|
||||
stationIDPair,
|
||||
stationNamePair,
|
||||
} from "../../lib/getStationList";
|
||||
import { checkDuplicateTrainData } from "../../lib/checkDuplicateTrainData";
|
||||
import { useFavoriteStation } from "../../stateBox/useFavoriteStation";
|
||||
import { useCurrentTrain } from "../../stateBox/useCurrentTrain";
|
||||
@ -129,19 +135,35 @@ export const AppsWebView = ({ openStationACFromEachTrainInfo }) => {
|
||||
const onLoadEnd = () => {
|
||||
if (once) return () => {};
|
||||
if (!stationData) return () => {};
|
||||
if (!originalStationList) return () => {};
|
||||
if (favoriteStation.length < 1) return () => {};
|
||||
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;
|
||||
const bootStationList = [];
|
||||
Object.keys(originalStationList).forEach((d) => {
|
||||
let findNearStations = false;
|
||||
originalStationList[d].forEach((x) => {
|
||||
let lineName = lineList_LineWebID[d];
|
||||
if (findNearStations) {
|
||||
if (x.MyStation){
|
||||
bootStationList.push({ line: lineName, station: x });
|
||||
findNearStations = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (x.StationNumber == favoriteStation[0][0].StationNumber) {
|
||||
console.log(originalStationList[d]);
|
||||
if (!x.MyStation) findNearStations = true;
|
||||
else bootStationList.push({ line: lineName, station: x });
|
||||
}
|
||||
});
|
||||
return returnData[0];
|
||||
};
|
||||
const lineName = getStationLine(favoriteStation[0][0]);
|
||||
if (favoriteStation[0].StationNumber == "M12") {
|
||||
bootStationList.push({
|
||||
line: "seto",
|
||||
station: { Station_JP: "児島", MyStation: "0" },
|
||||
});
|
||||
}
|
||||
});
|
||||
webview.current?.injectJavaScript(
|
||||
`MoveDisplayStation('${lineName}_${favoriteStation[0][0].MyStation}_${favoriteStation[0][0].Station_JP}')`
|
||||
`MoveDisplayStation('${bootStationList[0].line}_${bootStationList[0].station.MyStation}_${bootStationList[0].station.Station_JP}')`
|
||||
);
|
||||
once = true;
|
||||
};
|
||||
|
@ -40,6 +40,17 @@ export const lineListPair = {
|
||||
N: "鳴門線(池谷-鳴門間)[N]",
|
||||
M: "瀬戸大橋線(児島-宇多津間)[M]",
|
||||
};
|
||||
export const lineList_LineWebID = {
|
||||
"予讃線(高松-松山間)[Y]" : "yosan",
|
||||
"予讃線(松山-宇和島間)[U]" : "uwajima",
|
||||
"予讃線/愛ある伊予灘線(向井原-伊予大洲間)[S]" : "uwajima2",
|
||||
"土讃線(多度津-高知間)[D]" : "dosan",
|
||||
"土讃線(高知-窪川間)[K]" : "dosan2",
|
||||
"高徳線(高松-徳島間)[T]" : "koutoku",
|
||||
"徳島線(徳島-阿波池田間)[B]" : "tokushima",
|
||||
"鳴門線(池谷-鳴門間)[N]" : "naruto",
|
||||
"瀬戸大橋線(児島-宇多津間)[M]" : "seto",
|
||||
};
|
||||
export const getStationList2 = async () => {
|
||||
return {
|
||||
yosan,
|
||||
|
Loading…
Reference in New Issue
Block a user