駅への移動スクリプトをhooksに移動
This commit is contained in:
@@ -23,7 +23,7 @@ export const AppsWebView = ({ openStationACFromEachTrainInfo }) => {
|
||||
const { navigate } = useNavigation();
|
||||
const { favoriteStation } = useFavoriteStation();
|
||||
const { isLandscape } = useDeviceOrientationChange();
|
||||
const { originalStationList, stationList } = useStationList();
|
||||
const { originalStationList, stationList, getInjectJavascriptAddress } = useStationList();
|
||||
const {
|
||||
setSelectedLine,
|
||||
mapsStationData: stationData,
|
||||
@@ -137,34 +137,9 @@ export const AppsWebView = ({ openStationACFromEachTrainInfo }) => {
|
||||
if (!stationData) return () => {};
|
||||
if (!originalStationList) return () => {};
|
||||
if (favoriteStation.length < 1) return () => {};
|
||||
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 });
|
||||
}
|
||||
});
|
||||
if (favoriteStation[0].StationNumber == "M12") {
|
||||
bootStationList.push({
|
||||
line: "seto",
|
||||
station: { Station_JP: "児島", MyStation: "0" },
|
||||
});
|
||||
}
|
||||
});
|
||||
webview.current?.injectJavaScript(
|
||||
`MoveDisplayStation('${bootStationList[0].line}_${bootStationList[0].station.MyStation}_${bootStationList[0].station.Station_JP}')`
|
||||
);
|
||||
const string = getInjectJavascriptAddress(favoriteStation[0][0].StationNumber);
|
||||
if (!string) return () => {};
|
||||
webview.current?.injectJavaScript(string);
|
||||
once = true;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user