From 6653cbf65a0bcf75e6b65f58809abb103511aa4a Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Mon, 16 Sep 2024 14:35:46 +0000 Subject: [PATCH 01/32] =?UTF-8?q?=E7=95=AA=E7=B7=9A=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E6=A9=9F=E8=83=BD=E9=96=8B=E7=99=BA=E9=96=8B=E5=A7=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/発車時刻表/EachData.tsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/components/発車時刻表/EachData.tsx b/components/発車時刻表/EachData.tsx index af37d73..9f49e87 100644 --- a/components/発車時刻表/EachData.tsx +++ b/components/発車時刻表/EachData.tsx @@ -92,6 +92,22 @@ export const EachData: FC = (props) => { .split("~")[currentTrainData?.Direction == 1 ? 1 : 0] }間を走行中` : `現在地:${currentTrainData?.Pos}`; + +const [platformNumber, setPlatformNumber] = useState(); +useEffect(()=>{ + fetch("https://n8n.haruk.in/webhook/JR-shikoku-PosID?num="+currentTrainData?.PosNum) + .then(res=>res.json()) + .then(data=>{ + if(data?.type == "Station"){ + setPlatformNumber(data?.platform); + } + else{ + setPlatformNumber(undefined); + } + }) +},[currentTrainData,currentTrain]) + + return ( <> = (props) => { { Linking.openURL( "https://nexcloud.haruk.in/apps/forms/s/TEkBQW5WLcYjLyAzGxncQLtw" From 30393c0fd4b6d07cb1e5ef73a02aa320f8f8fbb3 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Mon, 16 Sep 2024 16:07:39 +0000 Subject: [PATCH 02/32] =?UTF-8?q?Revert=20"release=E5=90=91=E3=81=91?= =?UTF-8?q?=E5=B0=81=E5=8D=B0"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit c56a1961a76d815afdbdb49b4f031e16954d4c3a. --- Apps.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Apps.js b/Apps.js index 5e8ebca..cc526e0 100644 --- a/Apps.js +++ b/Apps.js @@ -28,7 +28,7 @@ export function AppContainer() { Date: Thu, 3 Oct 2024 10:21:55 +0000 Subject: [PATCH 03/32] =?UTF-8?q?=E5=9C=9F=E8=AE=83=E7=B7=9A=E3=81=AE?= =?UTF-8?q?=E6=99=AE=E9=80=9A=E5=88=97=E8=BB=8A=E6=83=85=E5=A0=B1=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/webViewInjectjavascript.ts | 184 +++++++++++++++++++++++++++++++++ 1 file changed, 184 insertions(+) diff --git a/lib/webViewInjectjavascript.ts b/lib/webViewInjectjavascript.ts index 298020e..8f54f83 100644 --- a/lib/webViewInjectjavascript.ts +++ b/lib/webViewInjectjavascript.ts @@ -516,6 +516,190 @@ export const injectJavascriptData: InjectJavascriptData = ( case "114M": setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s6000p.png'); break; + + + // 土讃線普通列車系統(include ごな線) + // ごな線 + case "5851D": //219D併結 [ToDo: 219Dとの分割対策] + case "5854D": + setStationIcon(element.querySelector("img"),'https://storage.haruk.in/tosa9640jgr.png'); + break; + + //JR車両乗り入れ運用 + case "5858D": + case "5869D": + setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s1000.png'); + break; + //併結運用の併結される側 [ToDo: 分割対策] + case "5845D": + case "5851D": + case "5818D": + case "5820D": + setStationIcon(element.querySelector("img"),'https://storage.haruk.in/tosa9640.png'); + break; + // 土讃線単体列車のキハ32運用 + case "715D": + case "718D": + setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s32ns.png'); + break; + + // サンライズに伴う気動車代走 + case "6219D": + case "6222D": + setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s1000.png'); + break; + // それ以外の土讃線ごな線直通列車 + case "5811D": + case "5813D": + case "5815D": + case "5817D": + case "5843D": + case "5853D": + case "5855D": + case "5859D": + case "5861D": + case "5865D": + case "5881D": + case "5885D": + case "5889D": + + case "5812D": + case "5814D": + case "5816D": + case "5852D": + case "5856D": + case "5860D": + case "5862D": + case "5872D": + case "5874D": + case "5876D": + case "5880D": + case "5882D": + setStationIcon(element.querySelector("img"),'https://storage.haruk.in/tosa9640.png'); + break; + // それ以外の土讃線普通列車(1000) + case "4210D": + case "4212D": + case "4214D": + case "4218D": + case "4220D": + case "4222D": + case "4224D": + case "4226D": + case "4228D": + case "4230D": + case "4232D": + case "4234D": + case "4236D": + case "4238D": + case "4240D": + case "4242D": + case "4244D": + case "4250D": + case "4252D": + case "4254D": + case "4256D": + + case "4211D": + case "4221D": + case "4223D": + case "4225D": + case "4227D": + case "4229D": + case "4231D": + case "4235D": + case "4237D": + case "4239D": + case "4241D": + case "4245D": + case "4247D": + case "4249D": + case "4251D": + case "4253D": + case "4255D": + case "4257D": + case "4259D": + case "4261D": + + case "4710D": + case "4726D": + case "4730D": + case "4732D": + case "4734D": + case "4738D": + case "4740D": + case "4742D": + case "4744D": + case "4746D": + case "4752D": + case "4756D": + case "4762D": + case "4764D": + case "4766D": + + case "4711D": + case "4713D": + case "4723D": + case "4725D": + case "4727D": + case "4729D": + case "4731D": + case "4737D": + case "4739D": + case "4745D": + case "4753D": + case "4755D": + case "4759D": + case "4761D": + case "4763D": + + case "216D": + case "238D": + case "246D": + case "248D": + + case "213D": + case "215D": + case "217D": + case "219D": + case "223D": + case "243D": + + case "710D": + case "712D": + case "714D": + case "716D": + case "720D": + case "722D": + case "724D": + case "728D": + case "736D": + case "748D": + case "750D": + case "754D": + case "758D": + case "760D": + case "768D": + + case "717D": + case "719D": + case "721D": + case "733D": + case "735D": + case "737D": + case "741D": + case "743D": + case "747D": + case "749D": + case "751D": + case "755D": + case "757D": + case "761D": + + setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s1000.png'); + break; + + default: break; } From 0a14cfc9f7ccf9eaf232a5c7dd1699511b272c28 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Fri, 4 Oct 2024 04:48:51 +0000 Subject: [PATCH 04/32] typo --- lib/webViewInjectjavascript.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/webViewInjectjavascript.ts b/lib/webViewInjectjavascript.ts index 8f54f83..391969a 100644 --- a/lib/webViewInjectjavascript.ts +++ b/lib/webViewInjectjavascript.ts @@ -662,9 +662,9 @@ export const injectJavascriptData: InjectJavascriptData = ( case "215D": case "217D": case "219D": - case "223D": + case "233D": case "243D": - + case "710D": case "712D": case "714D": From bf7e1138627e6d6e241a35ee9226a6aae728c596 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Wed, 16 Oct 2024 07:32:13 +0000 Subject: [PATCH 05/32] =?UTF-8?q?=E6=95=A3=E6=AD=A9=E3=82=92LED=E3=81=AB?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/発車時刻表/EachData.tsx | 33 +++++++++++++++++------- components/発車時刻表/LED_vidion.js | 2 -- lib/webViewInjectjavascript.ts | 1 + 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/components/発車時刻表/EachData.tsx b/components/発車時刻表/EachData.tsx index af37d73..715c2b5 100644 --- a/components/発車時刻表/EachData.tsx +++ b/components/発車時刻表/EachData.tsx @@ -10,6 +10,7 @@ import { DependTime } from "./LED_inside_Component/DependTime"; import { LastStation } from "./LED_inside_Component/LastStation"; import { StatusAndDelay } from "./LED_inside_Component/StatusAndDelay"; import { TrainName } from "./LED_inside_Component/TrainName"; +import { customTrainDataDetector } from "../custom-train-data"; type Props = { d: { @@ -22,12 +23,6 @@ type Props = { station: { Station_JP: string; }; - customTrainDataDetector: (trainID: string) => { - trainName: string; - trainNumDistance?: number; - type: string; - info: string; - }; navigate: (screen: string, data?: any) => void; openStationACFromEachTrainInfo: (station: string) => void; }; @@ -37,7 +32,6 @@ export const EachData: FC = (props) => { trainIDSwitch, trainDescriptionSwitch, station, - customTrainDataDetector, navigate, openStationACFromEachTrainInfo, } = props; @@ -69,9 +63,30 @@ export const EachData: FC = (props) => { payload, }); }; - const [train, setTrain] = useState(customTrainDataDetector(d.train)); + + const getTrainDataFromCurrentTrain = (trainNum: string) => { + const customTrainData = customTrainDataDetector(d.train); + if(customTrainData.type != "Normal") return customTrainData; + + const currentTrainData = currentTrain.filter((a) => a.num == trainNum); + if(currentTrainData.length == 0) return customTrainData; + + else if (currentTrainData[0].Type.includes("rapid:")) { + const typeText = currentTrainData[0].Type.split(":"); + const returnData = { + type: "Rapid", + trainName: typeText[1].replace("\r", ""), + trainIcon: null, + trainNumDistance: null, + info: "", + }; + return returnData; + } + return customTrainData; + } + const [train, setTrain] = useState(getTrainDataFromCurrentTrain(d.train)); useEffect(() => { - setTrain(customTrainDataDetector(d.train)); + setTrain(getTrainDataFromCurrentTrain(d.train)); }, [currentTrain, d.train, trainDescriptionSwitch]); // 土讃線複数存在対策 const currentTrainData = checkDuplicateTrainData( diff --git a/components/発車時刻表/LED_vidion.js b/components/発車時刻表/LED_vidion.js index f787522..51fa6e3 100644 --- a/components/発車時刻表/LED_vidion.js +++ b/components/発車時刻表/LED_vidion.js @@ -1,7 +1,6 @@ import React, { useState, useEffect } from "react"; import { View } from "react-native"; import { widthPercentageToDP as wp } from "react-native-responsive-screen"; -import { customTrainDataDetector } from "../custom-train-data"; import { useInterval } from "../../lib/useInterval"; import { objectIsEmpty } from "../../lib/objectIsEmpty"; import { useCurrentTrain } from "../../stateBox/useCurrentTrain"; @@ -203,7 +202,6 @@ export default function LED_vision(props) { d, trainIDSwitch, trainDescriptionSwitch, - customTrainDataDetector, navigate, openStationACFromEachTrainInfo, }} diff --git a/lib/webViewInjectjavascript.ts b/lib/webViewInjectjavascript.ts index 391969a..d13f21f 100644 --- a/lib/webViewInjectjavascript.ts +++ b/lib/webViewInjectjavascript.ts @@ -946,6 +946,7 @@ makeTrainView.observe(document.getElementById('modal_content'), { trainMenu == "true" ? ` // これの中身抽出ShowTrainTimeInfo("1228M","normal") + // ShowTrainTimeInfo("142M","rapid:サンポート南風リレー") function setTrainMenuDialog(d){ try{ const offclick = d.getAttribute('offclick'); From b41c02ca76e1ca694a02e23fa2e364c8fb5201d9 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Thu, 17 Oct 2024 11:52:17 +0000 Subject: [PATCH 06/32] =?UTF-8?q?=E7=8F=BE=E5=9C=A8=E5=9C=B0=E3=83=86?= =?UTF-8?q?=E3=82=AD=E3=82=B9=E3=83=88=E8=A1=A8=E7=A4=BA=E9=96=A2=E9=80=A3?= =?UTF-8?q?=E3=81=AE=E6=A9=9F=E8=83=BD=E3=82=92=E7=B5=B1=E5=90=88=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EachTrainInfo/TrainDataView.js | 22 +++++-------- components/発車時刻表/EachData.tsx | 31 ++++++++--------- lib/trainPositionTextArray.ts | 33 +++++++++++++++++++ 3 files changed, 54 insertions(+), 32 deletions(-) create mode 100644 lib/trainPositionTextArray.ts diff --git a/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js b/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js index 98e0541..26d7334 100644 --- a/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js +++ b/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js @@ -5,6 +5,7 @@ import { useDeviceOrientationChange } from "../../../stateBox/useDeviceOrientati import { getStationList2 } from "../../../lib/getStationList2"; import { useCurrentTrain } from "../../../stateBox/useCurrentTrain"; import { SheetManager } from "react-native-actions-sheet"; +import { trainPosition } from "../../../lib/trainPositionTextArray"; export const TrainDataView = ({ currentTrainData, @@ -16,12 +17,17 @@ export const TrainDataView = ({ }) => { const { width, height } = useWindowDimensions(); const { isLandscape } = useDeviceOrientationChange(); - const { webview, getCurrentTrain, inject } = useCurrentTrain(); + const { inject } = useCurrentTrain(); const [mapsStationData, setMapsStationData] = useState(undefined); useEffect(() => { getStationList2().then(setMapsStationData); }, []); const onLine = !!currentPosition?.toString().length; + const trainPositionText = (trainData) => { + const { isBetween, Pos } = trainPosition(trainData); + if (isBetween === true) return `${Pos.from}~${Pos.to}`; + else return Pos.Pos == "" ? "" : `${Pos.Pos}`; + }; return ( = (props) => { const getTrainDataFromCurrentTrain = (trainNum: string) => { const customTrainData = customTrainDataDetector(d.train); - if(customTrainData.type != "Normal") return customTrainData; - - const currentTrainData = currentTrain.filter((a) => a.num == trainNum); - if(currentTrainData.length == 0) return customTrainData; - + if (customTrainData.type != "Normal") return customTrainData; + const currentTrainData = currentTrain.filter((a) => a.num == trainNum); + if (currentTrainData.length == 0) return customTrainData; else if (currentTrainData[0].Type.includes("rapid:")) { const typeText = currentTrainData[0].Type.split(":"); const returnData = { @@ -83,7 +82,7 @@ export const EachData: FC = (props) => { return returnData; } return customTrainData; - } + }; const [train, setTrain] = useState(getTrainDataFromCurrentTrain(d.train)); useEffect(() => { setTrain(getTrainDataFromCurrentTrain(d.train)); @@ -96,17 +95,11 @@ export const EachData: FC = (props) => { currentTrainData, station.Station_JP )}`; - const trainPositionText = currentTrainData?.Pos.match("~") - ? `現在地:${ - currentTrainData?.Pos.replace("(下り)", "") - .replace("(上り)", "") - .split("~")[currentTrainData?.Direction == 1 ? 0 : 1] - }→${ - currentTrainData?.Pos.replace("(下り)", "") - .replace("(上り)", "") - .split("~")[currentTrainData?.Direction == 1 ? 1 : 0] - }間を走行中` - : `現在地:${currentTrainData?.Pos}`; + const trainPositionText = (trainData: trainDataType) => { + const { isBetween, Pos } = trainPosition(trainData); + if (isBetween === true) return `現在地:${Pos.from}→${Pos.to}間を走行中`; + else return Pos.Pos == "" ? "" : `現在地:${Pos.Pos}`; + }; return ( <> = (props) => { {trainDescriptionSwitch && ( { Linking.openURL( diff --git a/lib/trainPositionTextArray.ts b/lib/trainPositionTextArray.ts new file mode 100644 index 0000000..22366d9 --- /dev/null +++ b/lib/trainPositionTextArray.ts @@ -0,0 +1,33 @@ +type returnBetweenType = { + isBetween: true; + Pos: { + from: string; + to: string; + }; +}; +type returnCurrentType = { + isBetween: false; + Pos: { + Pos: string; + }; +}; +export type trainDataType = { + Pos?: string; + Direction?: number; +}; +type trainData = ( + trainData: trainDataType +) => returnBetweenType | returnCurrentType; + +export const trainPosition: trainData = (trainData) => { + if (!trainData?.Pos) return { isBetween: false, Pos: { Pos: "" } }; + const { Pos, Direction } = trainData; + if (Pos.match("~")) { + const [topST, downST] = Pos.replace("(下り)", "") + .replace("(上り)", "") + .split("~"); + const from = Direction == 1 ? topST : downST; + const to = Direction == 1 ? downST : topST; + return { isBetween: true, Pos: { from, to } }; + } else return { isBetween: false, Pos: { Pos } }; +}; From 199d41fd833010478591628947044f3d9cd096ca Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Thu, 17 Oct 2024 16:12:36 +0000 Subject: [PATCH 07/32] =?UTF-8?q?=E3=82=AF=E3=82=A8=E3=83=AA=E3=81=AE?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/発車時刻表/EachData.tsx | 26 ++++++++----------- ...rainData.js => checkDuplicateTrainData.ts} | 4 ++- lib/getTrainDelayStatus.ts | 4 ++- lib/trainPositionTextArray.ts | 6 +++++ 4 files changed, 23 insertions(+), 17 deletions(-) rename lib/{checkDuplicateTrainData.js => checkDuplicateTrainData.ts} (63%) diff --git a/components/発車時刻表/EachData.tsx b/components/発車時刻表/EachData.tsx index 024380b..6feb5e5 100644 --- a/components/発車時刻表/EachData.tsx +++ b/components/発車時刻表/EachData.tsx @@ -101,20 +101,16 @@ export const EachData: FC = (props) => { else return Pos.Pos == "" ? "" : `現在地:${Pos.Pos}`; }; -const [platformNumber, setPlatformNumber] = useState(); -useEffect(()=>{ - fetch("https://n8n.haruk.in/webhook/JR-shikoku-PosID?num="+currentTrainData?.PosNum) - .then(res=>res.json()) - .then(data=>{ - if(data?.type == "Station"){ - setPlatformNumber(data?.platform); - } - else{ - setPlatformNumber(undefined); - } - }) -},[currentTrainData,currentTrain]) - + const [platformNumber, setPlatformNumber] = useState(); + useEffect(() => { + fetch( + `https://n8n.haruk.in/webhook/JR-shikoku-PosID?PosNum=${currentTrainData?.PosNum}&Line=${currentTrainData?.Line}` + ) + .then((res) => res.json()) + .then((data) => + setPlatformNumber(data?.type == "Station" ? data?.platform : undefined) + ); + }, [currentTrainData, currentTrain]); return ( <> @@ -147,7 +143,7 @@ useEffect(()=>{ trainIDSwitch ? currentTrainData?.PosNum : trainPositionText(currentTrainData) - } ${platformNumber? platformNumber+"番線":""}`} + } ${platformNumber ? platformNumber + "番線" : ""}`} onLongClick={() => { Linking.openURL( "https://nexcloud.haruk.in/apps/forms/s/TEkBQW5WLcYjLyAzGxncQLtw" diff --git a/lib/checkDuplicateTrainData.js b/lib/checkDuplicateTrainData.ts similarity index 63% rename from lib/checkDuplicateTrainData.js rename to lib/checkDuplicateTrainData.ts index e8b3813..881db65 100644 --- a/lib/checkDuplicateTrainData.js +++ b/lib/checkDuplicateTrainData.ts @@ -1,4 +1,6 @@ -export const checkDuplicateTrainData = (currentTrainArray) => { +import { trainDataType } from "./trainPositionTextArray"; + +export const checkDuplicateTrainData = (currentTrainArray: trainDataType[]) => { const notNyujoData = currentTrainArray.filter((d) => d.delay !== "入線"); if (currentTrainArray.length == 1) return currentTrainArray[0]; if (notNyujoData.length == 0) return currentTrainArray[0]; diff --git a/lib/getTrainDelayStatus.ts b/lib/getTrainDelayStatus.ts index af7e163..9fe76c3 100644 --- a/lib/getTrainDelayStatus.ts +++ b/lib/getTrainDelayStatus.ts @@ -1,5 +1,7 @@ +import { trainDataType } from "./trainPositionTextArray"; + type getTrainDelayStatus = ( - current: { delay: number | "入線" | string; Pos: string }, + current: trainDataType, Station_JP: string ) => string | number; export const getTrainDelayStatus: getTrainDelayStatus = ( diff --git a/lib/trainPositionTextArray.ts b/lib/trainPositionTextArray.ts index 22366d9..b9d89c3 100644 --- a/lib/trainPositionTextArray.ts +++ b/lib/trainPositionTextArray.ts @@ -14,6 +14,12 @@ type returnCurrentType = { export type trainDataType = { Pos?: string; Direction?: number; + Index?: number; + Line?: string; + PosNum?: number; + Type?: string; + delay?: string | number; + num?: string; }; type trainData = ( trainData: trainDataType From 5b1b5a029b1680900de0944ec599a8fd65a30913 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Sat, 19 Oct 2024 02:41:34 +0000 Subject: [PATCH 08/32] =?UTF-8?q?=E3=81=8A=E6=B0=97=E3=81=AB=E5=85=A5?= =?UTF-8?q?=E3=82=8A=E9=A7=85=E3=81=AE=E3=83=89=E3=83=83=E3=83=88=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=E6=A9=9F=E8=83=BD=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Menu/StationPagination.tsx | 166 ++++++++++++++++++++++++++ menu.js | 85 +++++++++---- 2 files changed, 225 insertions(+), 26 deletions(-) create mode 100644 components/Menu/StationPagination.tsx diff --git a/components/Menu/StationPagination.tsx b/components/Menu/StationPagination.tsx new file mode 100644 index 0000000..d73eff1 --- /dev/null +++ b/components/Menu/StationPagination.tsx @@ -0,0 +1,166 @@ +import React, { FC, useState } from "react"; +import { View, Text, TouchableOpacity } from "react-native"; +import { Pagination } from "react-native-snap-carousel"; +import { useInterval } from "../../lib/useInterval"; + +import lineColorList from "../../assets/originData/lineColorList"; + +type StationProps = { + DispNum: string; + JrHpUrl: string; + MyStation: string; + StationMap: string; + StationNumber: string | null; + StationTimeTable: string; + Station_EN: string; + Station_JP: string; + jslodApi: string; + lat: number; + lng: number; +}; +type StationPaginationProps = { + entries: StationProps[][]; + activeSlide: number; + carouselRef: any; + setSelectedCurrentStation: React.Dispatch>; + dotButton: boolean; +}; + +export const Paginations: FC = (props) => { + const { + entries, + activeSlide, + carouselRef, + setSelectedCurrentStation, + dotButton, + } = props; + return ( + + ) + } + dotElement={ + dotButton && ( + + ) + } + /> + ); +}; +type StationNumberMakerProps = { + currentStations: StationProps[][]; + setSelectedCurrentStation: React.Dispatch>; + active?: boolean; + index?: number; +}; +export const StationNumberMaker: FC = (props) => { + const { currentStations, active, index, setSelectedCurrentStation } = props; + return ( + setSelectedCurrentStation(index)} + /> + ); +}; +type StationNumberProps = { + currentStation: StationProps[]; + active: boolean; + onPress: () => void; +}; +export const StationNumber: FC = (props) => { + const { currentStation, active, onPress } = props; + const [animation, setAnimation] = useState(0); + const data = currentStation.filter((d) => (d.StationNumber ? true : false)); + useInterval(() => { + if (!data) return; + setAnimation(animation + 1 < data.length ? animation + 1 : 0); + }, 2000); + + const lineID = data[animation].StationNumber.slice(0, 1); + const lineName = data[animation].StationNumber.slice(1); + const size = active ? 24 : 18; + const margin = active ? 3 : 6; + const border = active ? 2 : 1; + return ( + <> + {active && ( + + + + )} + + + + {lineID + "\n" + lineName} + + + + + ); +}; diff --git a/menu.js b/menu.js index eefde48..12e8695 100644 --- a/menu.js +++ b/menu.js @@ -1,5 +1,5 @@ import React, { useRef, useState, useEffect } from "react"; -import Carousel from "react-native-snap-carousel"; +import Carousel, { Pagination } from "react-native-snap-carousel"; import { Platform, View, @@ -7,6 +7,7 @@ import { Linking, Text, TouchableOpacity, + LayoutAnimation, } from "react-native"; import Constants from "expo-constants"; import * as Location from "expo-location"; @@ -31,6 +32,9 @@ import { SheetManager } from "react-native-actions-sheet"; import { useTrainDelayData } from "./stateBox/useTrainDelayData"; import { useNavigation } from "@react-navigation/native"; import { useStationList } from "./stateBox/useStationList"; +import { Paginations } from "./components/Menu/StationPagination"; +import lineColorList from "./assets/originData/lineColorList"; +import { AS } from "./storageControl"; export default function Menu({ getCurrentTrain }) { const { navigate } = useNavigation(); @@ -110,6 +114,7 @@ export default function Menu({ getCurrentTrain }) { setSelectedCurrentStation(0); return; } + console.log(allStationData) if (allStationData[selectedCurrentStation] == undefined) { const count = selectedCurrentStation - 1; setSelectedCurrentStation(count); @@ -156,6 +161,24 @@ export default function Menu({ getCurrentTrain }) { SheetManager.show("StationDetailView", { payload }); }; + const [dotButton, setDotButton] = useState(false); + + useEffect(() => { + AS.getItem("CarouselSettings/activeDotSettings").then((data) => { + setDotButton(data === "true"); + }); + }, []); + const oLPSign = () => { + LayoutAnimation.configureNext({ + duration: 600, + update: { type: "spring", springDamping: 0.5 }, + }); + AS.setItem( + "CarouselSettings/activeDotSettings", + !dotButton ? "true": "false" + ); + setDotButton(!dotButton); + } return ( {originalStationList.length != 0 && allStationData.length != 0 && ( - { - return ( - - - - ); - }} - /> + <> + { + return ( + + + + ); + }} + /> + + )} {allStationData.length != 0 && originalStationList.length != 0 && From ddcc5f053b153d24966e44bc0657852eef96534e Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Sat, 19 Oct 2024 02:46:07 +0000 Subject: [PATCH 09/32] fix --- menu.js | 1 - 1 file changed, 1 deletion(-) diff --git a/menu.js b/menu.js index 12e8695..260d4a8 100644 --- a/menu.js +++ b/menu.js @@ -114,7 +114,6 @@ export default function Menu({ getCurrentTrain }) { setSelectedCurrentStation(0); return; } - console.log(allStationData) if (allStationData[selectedCurrentStation] == undefined) { const count = selectedCurrentStation - 1; setSelectedCurrentStation(count); From 8519a6d27343c647ab8856be34ecaacc1bbcdb95 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Sat, 19 Oct 2024 04:04:24 +0000 Subject: [PATCH 10/32] =?UTF-8?q?=E3=81=8A=E6=B0=97=E3=81=AB=E5=85=A5?= =?UTF-8?q?=E3=82=8A=E3=82=92=E6=93=8D=E4=BD=9C=E3=81=97=E3=81=9F=E3=81=A8?= =?UTF-8?q?=E3=81=8D=E3=81=AB=E3=82=AF=E3=83=A9=E3=83=83=E3=82=B7=E3=83=A5?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=83=90=E3=82=B0=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Menu/StationPagination.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/components/Menu/StationPagination.tsx b/components/Menu/StationPagination.tsx index d73eff1..4dac96e 100644 --- a/components/Menu/StationPagination.tsx +++ b/components/Menu/StationPagination.tsx @@ -86,6 +86,7 @@ export const StationNumberMaker: FC = (props) => { currentStation={currentStations[index]} active={active} onPress={() => setSelectedCurrentStation(index)} + key={currentStations[index][0].StationNumber} /> ); }; From 86655f5632f30cf9ebcfc437e329f60d5c4e9b5a Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Sat, 19 Oct 2024 12:08:55 +0000 Subject: [PATCH 11/32] =?UTF-8?q?=E9=80=9A=E9=81=8E=E9=A7=85=E6=83=85?= =?UTF-8?q?=E5=A0=B1=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/originData/tokushima.ts | 2 +- .../EachTrainInfo/EachStopList.js | 2 +- .../EachTrainInfoCore.js | 87 ++++++++++++++++--- .../findReversalPoints.js | 4 +- 4 files changed, 80 insertions(+), 15 deletions(-) diff --git a/assets/originData/tokushima.ts b/assets/originData/tokushima.ts index c90b303..b94015d 100644 --- a/assets/originData/tokushima.ts +++ b/assets/originData/tokushima.ts @@ -1,5 +1,5 @@ export default [ -{"Station_JP" : "徳島", "Station_EN" : "Tokushima", "MyStation" : "0", "StationNumber" : "T00", "DispNum" : "3", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/tokushima.pdf", "StationMap":"https://www.google.co.jp/maps/place/34.074642,134.550764", "JrHpUrl" : "http://www.jr-shikoku.co.jp/01_trainbus/kakueki/tokushima/"}, +{"Station_JP" : "徳島", "Station_EN" : "Tokushima", "MyStation" : "0", "StationNumber" : "B00", "DispNum" : "3", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/tokushima.pdf", "StationMap":"https://www.google.co.jp/maps/place/34.074642,134.550764", "JrHpUrl" : "http://www.jr-shikoku.co.jp/01_trainbus/kakueki/tokushima/"}, {"Station_JP" : "佐古", "Station_EN" : "Sako", "MyStation" : "0", "StationNumber" : "B01", "DispNum" : "2", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/sako.pdf", "StationMap":"https://www.google.co.jp/maps/place/34.080616,134.538576", "JrHpUrl" : ""}, {"Station_JP" : "蔵本", "Station_EN" : "Kuramoto", "MyStation" : "1", "StationNumber" : "B02", "DispNum" : "2", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/kuramoto.pdf", "StationMap":"https://www.google.co.jp/maps/place/34.079332,134.518705", "JrHpUrl" : ""}, {"Station_JP" : "府中", "Station_EN" : "Kō", "MyStation" : "2", "StationNumber" : "B04", "DispNum" : "2", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/ko.pdf", "StationMap":"https://www.google.co.jp/maps/place/34.074134,134.482939", "JrHpUrl" : ""}, diff --git a/components/ActionSheetComponents/EachTrainInfo/EachStopList.js b/components/ActionSheetComponents/EachTrainInfo/EachStopList.js index a2813b3..dbfd194 100644 --- a/components/ActionSheetComponents/EachTrainInfo/EachStopList.js +++ b/components/ActionSheetComponents/EachTrainInfo/EachStopList.js @@ -43,7 +43,7 @@ export const EachStopList = ({ .set("hour", parseInt(time.split(":")[0])) .set("minute", parseInt(time.split(":")[1])) .add(isNaN(currentTrainData?.delay) ? 0 : currentTrainData.delay, "minute"); - const timeString = dates.format("HH:mm").split(":"); + const timeString = se == "通過"? "" :dates.format("HH:mm").split(":"); return ( d.StationNumber) .map((d) => d.StationNumber); - return StationNumbers[0]; + return StationNumbers; }); + useEffect(() => { + const stopStationList = trainData.map((i) => { + const [station, se, time] = i.split(","); + return stationList.map((a) => a.filter((d) => d.StationName == station)); + }); + const allThroughStationList = stopStationList.map((i, index, array) => { + let allThroughStation = []; + if (index == array.length - 1) return; + + const firstItem = array[index]; + const secondItem = array[index + 1]; + let betweenStationLine = ""; + let baseStationNumberFirst = ""; + let baseStationNumberSecond = ""; + Object.keys(stationIDPair).forEach((d, index2, array) => { + if (!d) return; + const haveFirst = firstItem[index2]; + const haveSecond = secondItem[index2]; + if (haveFirst.length && haveSecond.length) { + betweenStationLine = d; + baseStationNumberFirst = haveFirst[0].StationNumber; + baseStationNumberSecond = haveSecond[0].StationNumber; + } + }); + if (!betweenStationLine) return; + let reverse = false; + originalStationList[ + lineListPair[stationIDPair[betweenStationLine]] + ].forEach((d) => { + console.log(d.StationNumber, baseStationNumberFirst, baseStationNumberSecond); + if ( + d.StationNumber > baseStationNumberFirst && + d.StationNumber < baseStationNumberSecond + ) { + console.log(d.Station_JP); + allThroughStation.push(`${d.Station_JP},通過,`); + reverse = false; + } else { + if ( + d.StationNumber < baseStationNumberFirst && + d.StationNumber > baseStationNumberSecond + ) { + console.log(d.Station_JP); + allThroughStation.push(`${d.Station_JP},通過,`); + reverse = true; + } + } + }); + if (reverse) allThroughStation.reverse(); + return allThroughStation; + }); + let mainArray = [...trainData]; + let indexs = 0; + trainData.forEach((d, index, array) => { + indexs = indexs+1; + if(!allThroughStationList[index]) return; + if(allThroughStationList[index].length == 0) return; + mainArray.splice(indexs, 0, ...allThroughStationList[index]); + indexs = indexs+allThroughStationList[index].length; + }); + setTrainDataWithThrough(mainArray); + }, [trainData]); + const points = trainPositionSwitch == "true" ? findReversalPoints(currentPosition, stopStationIDList) @@ -360,18 +425,18 @@ export const EachTrainInfoCore = ({ )} - {trainData.map((i, index) => + {trainDataWidhThrough.map((i, index) => i.split(",")[1] == "提" ? ( ) : ( - + ) )} {tailStation.length != 0 && diff --git a/lib/eachTrainInfoCoreLib/findReversalPoints.js b/lib/eachTrainInfoCoreLib/findReversalPoints.js index 05f6f55..a7cd70e 100644 --- a/lib/eachTrainInfoCoreLib/findReversalPoints.js +++ b/lib/eachTrainInfoCoreLib/findReversalPoints.js @@ -20,11 +20,11 @@ export const findReversalPoints = (array, stopStationIDList) => { const stopStationIDListNumber = stopStationIDList.map((d) => { if (!d) return { line: [], ID: [] }; return { - line: d + line: d[0] .split("") .filter((s) => "A" < s && s < "Z") .join(""), - ID: d + ID: d[0] .split("") .filter((s) => "0" <= s && s <= "9") .join(""), From a9dddfca2c0d1087bf17d2836aa7efb67b71a3f7 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Sat, 19 Oct 2024 12:54:32 +0000 Subject: [PATCH 12/32] =?UTF-8?q?=E9=80=9A=E9=81=8E=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E3=81=AE=E3=82=AA=E3=83=B3=E3=82=AA=E3=83=95=E3=82=92=E5=AE=9F?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EachTrainInfo/EachStopList.js | 14 ++++++-- .../EachTrainInfo/ScrollStickyContent.js | 27 ++++++++++++-- .../EachTrainInfoCore.js | 36 +++++++++++-------- 3 files changed, 57 insertions(+), 20 deletions(-) diff --git a/components/ActionSheetComponents/EachTrainInfo/EachStopList.js b/components/ActionSheetComponents/EachTrainInfo/EachStopList.js index dbfd194..66decaf 100644 --- a/components/ActionSheetComponents/EachTrainInfo/EachStopList.js +++ b/components/ActionSheetComponents/EachTrainInfo/EachStopList.js @@ -10,7 +10,9 @@ export const EachStopList = ({ points, currentTrainData, openStationACFromEachTrainInfo, + showThrew, }) => { + if (!showThrew && i.split(",")[1] == "通過") return null; const [station, se, time] = i.split(","); // 阿波池田,発,6:21 const Stations = stationList .map((a) => a.filter((d) => d.StationName == station)) @@ -43,7 +45,7 @@ export const EachStopList = ({ .set("hour", parseInt(time.split(":")[0])) .set("minute", parseInt(time.split(":")[1])) .add(isNaN(currentTrainData?.delay) ? 0 : currentTrainData.delay, "minute"); - const timeString = se == "通過"? "" :dates.format("HH:mm").split(":"); + const timeString = se == "通過" ? "" : dates.format("HH:mm").split(":"); return ( ( - {station} + + {station} + {points && points.findIndex((d) => d == index) >= 0 ? ( 🚊 diff --git a/components/ActionSheetComponents/EachTrainInfo/ScrollStickyContent.js b/components/ActionSheetComponents/EachTrainInfo/ScrollStickyContent.js index 3881b36..6496b4e 100644 --- a/components/ActionSheetComponents/EachTrainInfo/ScrollStickyContent.js +++ b/components/ActionSheetComponents/EachTrainInfo/ScrollStickyContent.js @@ -1,7 +1,8 @@ import React from "react"; -import { View, Text } from "react-native"; +import { View, Text, LayoutAnimation } from "react-native"; -export const ScrollStickyContent = ({ currentTrainData }) => { +export const ScrollStickyContent = (props) => { + const { currentTrainData, showThrew, setShowThrew, haveThrough } = props; return ( { > 見込 - + { + if (!haveThrough) return; + LayoutAnimation.configureNext({ + duration: 200, + update: { type: "easeInEaseOut", springDamping: 0.6 }, + }); + setShowThrew(!showThrew); + }} + > + (通過{showThrew ? "▼" : "▶"}) + diff --git a/components/ActionSheetComponents/EachTrainInfoCore.js b/components/ActionSheetComponents/EachTrainInfoCore.js index a0107bc..0ef42bb 100644 --- a/components/ActionSheetComponents/EachTrainInfoCore.js +++ b/components/ActionSheetComponents/EachTrainInfoCore.js @@ -82,6 +82,8 @@ export const EachTrainInfoCore = ({ const [currentPosition, setCurrentPosition] = useState([]); const [trainData, setTrainData] = useState([]); const [trainDataWidhThrough, setTrainDataWithThrough] = useState([]); + const [showThrew, setShowThrew] = useState(false); + const [haveThrough, setHaveThrough] = useState(false); const stationList = originalStationList && @@ -136,13 +138,13 @@ export const EachTrainInfoCore = ({ originalStationList[ lineListPair[stationIDPair[betweenStationLine]] ].forEach((d) => { - console.log(d.StationNumber, baseStationNumberFirst, baseStationNumberSecond); if ( d.StationNumber > baseStationNumberFirst && d.StationNumber < baseStationNumberSecond ) { console.log(d.Station_JP); allThroughStation.push(`${d.Station_JP},通過,`); + setHaveThrough(true); reverse = false; } else { if ( @@ -151,6 +153,7 @@ export const EachTrainInfoCore = ({ ) { console.log(d.Station_JP); allThroughStation.push(`${d.Station_JP},通過,`); + setHaveThrough(true); reverse = true; } } @@ -161,11 +164,11 @@ export const EachTrainInfoCore = ({ let mainArray = [...trainData]; let indexs = 0; trainData.forEach((d, index, array) => { - indexs = indexs+1; - if(!allThroughStationList[index]) return; - if(allThroughStationList[index].length == 0) return; + indexs = indexs + 1; + if (!allThroughStationList[index]) return; + if (allThroughStationList[index].length == 0) return; mainArray.splice(indexs, 0, ...allThroughStationList[index]); - indexs = indexs+allThroughStationList[index].length; + indexs = indexs + allThroughStationList[index].length; }); setTrainDataWithThrough(mainArray); }, [trainData]); @@ -366,7 +369,9 @@ export const EachTrainInfoCore = ({ shortHeader={} longHeader={} topStickyContent={ - + } > {headStation.length != 0 && @@ -429,14 +434,17 @@ export const EachTrainInfoCore = ({ i.split(",")[1] == "提" ? ( ) : ( - + ) )} {tailStation.length != 0 && From 6a8bdba8497b4efc6e65b1f19495148de1f10185 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Sat, 19 Oct 2024 12:57:58 +0000 Subject: [PATCH 13/32] =?UTF-8?q?=E3=83=AC=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ActionSheetComponents/EachTrainInfo/EachStopList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/ActionSheetComponents/EachTrainInfo/EachStopList.js b/components/ActionSheetComponents/EachTrainInfo/EachStopList.js index 66decaf..5ffecb7 100644 --- a/components/ActionSheetComponents/EachTrainInfo/EachStopList.js +++ b/components/ActionSheetComponents/EachTrainInfo/EachStopList.js @@ -136,7 +136,7 @@ export const EachStopList = ({ width: 60, }} > - {timeString[0]}:{timeString[1]} + {se == "通過" ? "レ" : `${timeString[0]}:${timeString[1]}`} {se?.replace("発", "出発").replace("着", "到着")} From bc8a786db748d06c749c6400c21a2452bb552f47 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Sat, 19 Oct 2024 13:27:49 +0000 Subject: [PATCH 14/32] =?UTF-8?q?=E9=80=9A=E9=81=8E=E3=83=9C=E3=82=BF?= =?UTF-8?q?=E3=83=B3=E3=81=AE=E3=83=87=E3=82=B6=E3=82=A4=E3=83=B3=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EachTrainInfo/ScrollStickyContent.js | 46 ++++++++++--------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/components/ActionSheetComponents/EachTrainInfo/ScrollStickyContent.js b/components/ActionSheetComponents/EachTrainInfo/ScrollStickyContent.js index 6496b4e..23cf4e5 100644 --- a/components/ActionSheetComponents/EachTrainInfo/ScrollStickyContent.js +++ b/components/ActionSheetComponents/EachTrainInfo/ScrollStickyContent.js @@ -50,27 +50,31 @@ export const ScrollStickyContent = (props) => { > 見込 - { - if (!haveThrough) return; - LayoutAnimation.configureNext({ - duration: 200, - update: { type: "easeInEaseOut", springDamping: 0.6 }, - }); - setShowThrew(!showThrew); - }} - > - (通過{showThrew ? "▼" : "▶"}) - + + + { + if (!haveThrough) return; + LayoutAnimation.configureNext({ + duration: 200, + update: { type: "easeInEaseOut", springDamping: 0.6 }, + }); + setShowThrew(!showThrew); + }} + > + (通過{showThrew ? "▼" : "▶"}) + + + From 64d56d3df60627f4175a506031728bcfcbd0d2c7 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Sat, 19 Oct 2024 13:36:17 +0000 Subject: [PATCH 15/32] =?UTF-8?q?=E5=BD=93=E3=81=9F=E3=82=8A=E5=88=A4?= =?UTF-8?q?=E5=AE=9A=E3=82=92=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EachTrainInfo/ScrollStickyContent.js | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/components/ActionSheetComponents/EachTrainInfo/ScrollStickyContent.js b/components/ActionSheetComponents/EachTrainInfo/ScrollStickyContent.js index 23cf4e5..545428d 100644 --- a/components/ActionSheetComponents/EachTrainInfo/ScrollStickyContent.js +++ b/components/ActionSheetComponents/EachTrainInfo/ScrollStickyContent.js @@ -1,5 +1,5 @@ import React from "react"; -import { View, Text, LayoutAnimation } from "react-native"; +import { View, Text, LayoutAnimation, TouchableOpacity } from "react-native"; export const ScrollStickyContent = (props) => { const { currentTrainData, showThrew, setShowThrew, haveThrough } = props; @@ -50,7 +50,16 @@ export const ScrollStickyContent = (props) => { > 見込 - + { + if (!haveThrough) return; + LayoutAnimation.configureNext({ + duration: 200, + update: { type: "easeInEaseOut", springDamping: 0.6 }, + }); + setShowThrew(!showThrew); + }} + > { textAlignVertical: "center", opacity: haveThrough ? 1 : 0, }} - onPress={() => { - if (!haveThrough) return; - LayoutAnimation.configureNext({ - duration: 200, - update: { type: "easeInEaseOut", springDamping: 0.6 }, - }); - setShowThrew(!showThrew); - }} > (通過{showThrew ? "▼" : "▶"}) - + From b6ba770a8aba6f40d4ba51992f92f2d4355eda59 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Sat, 19 Oct 2024 15:00:08 +0000 Subject: [PATCH 16/32] =?UTF-8?q?=E5=88=97=E8=BB=8A=E3=82=A2=E3=82=A4?= =?UTF-8?q?=E3=82=B3=E3=83=B3=E3=81=AE=E4=BD=8D=E7=BD=AE=E3=82=92=E5=A4=89?= =?UTF-8?q?=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EachTrainInfo/EachStopList.js | 2 +- .../EachTrainInfoCore.js | 12 +- .../findReversalPoints.js | 116 ++++-------------- 3 files changed, 32 insertions(+), 98 deletions(-) diff --git a/components/ActionSheetComponents/EachTrainInfo/EachStopList.js b/components/ActionSheetComponents/EachTrainInfo/EachStopList.js index 5ffecb7..f5d3fb6 100644 --- a/components/ActionSheetComponents/EachTrainInfo/EachStopList.js +++ b/components/ActionSheetComponents/EachTrainInfo/EachStopList.js @@ -107,7 +107,7 @@ export const EachStopList = ({ {station} - {points && points.findIndex((d) => d == index) >= 0 ? ( + {points ? ( 🚊 ) : null} {!isNaN(currentTrainData?.delay) && currentTrainData?.delay != 0 && ( diff --git a/components/ActionSheetComponents/EachTrainInfoCore.js b/components/ActionSheetComponents/EachTrainInfoCore.js index 0ef42bb..5c283d9 100644 --- a/components/ActionSheetComponents/EachTrainInfoCore.js +++ b/components/ActionSheetComponents/EachTrainInfoCore.js @@ -95,7 +95,7 @@ export const EachTrainInfoCore = ({ ); // 使用例 - const stopStationIDList = trainData.map((i) => { + const stopStationIDList = trainDataWidhThrough.map((i) => { const [station, se, time] = i.split(","); const Stations = stationList.map((a) => a.filter((d) => d.StationName == station) @@ -104,9 +104,7 @@ export const EachTrainInfoCore = ({ Stations && Stations.reduce((newArray, e) => { return newArray.concat(e); - }, []) - .filter((d) => d.StationNumber) - .map((d) => d.StationNumber); + }, []).map((d) => d.StationNumber); return StationNumbers; }); useEffect(() => { @@ -142,7 +140,6 @@ export const EachTrainInfoCore = ({ d.StationNumber > baseStationNumberFirst && d.StationNumber < baseStationNumberSecond ) { - console.log(d.Station_JP); allThroughStation.push(`${d.Station_JP},通過,`); setHaveThrough(true); reverse = false; @@ -151,7 +148,6 @@ export const EachTrainInfoCore = ({ d.StationNumber < baseStationNumberFirst && d.StationNumber > baseStationNumberSecond ) { - console.log(d.Station_JP); allThroughStation.push(`${d.Station_JP},通過,`); setHaveThrough(true); reverse = true; @@ -176,7 +172,7 @@ export const EachTrainInfoCore = ({ const points = trainPositionSwitch == "true" ? findReversalPoints(currentPosition, stopStationIDList) - : []; + : stopStationIDList.map(() => false); const trainName = useMemo(() => { if (!data.limited) return ""; const limitedArray = data.limited.split(":"); @@ -439,7 +435,7 @@ export const EachTrainInfoCore = ({ i, index, stationList, - points, + points: points ? points[index] : false, currentTrainData, openStationACFromEachTrainInfo, showThrew, diff --git a/lib/eachTrainInfoCoreLib/findReversalPoints.js b/lib/eachTrainInfoCoreLib/findReversalPoints.js index a7cd70e..353a75c 100644 --- a/lib/eachTrainInfoCoreLib/findReversalPoints.js +++ b/lib/eachTrainInfoCoreLib/findReversalPoints.js @@ -7,105 +7,43 @@ export const findReversalPoints = (array, stopStationIDList) => { if (!array instanceof Array) return []; if (!array) return []; if (array[0] instanceof Array) return []; - const arrayNumber = array.map((d) => ({ - line: d - .split("") - .filter((s) => "A" < s && s < "Z") - .join(""), - ID: d - .split("") - .filter((s) => "0" <= s && s <= "9") - .join(""), - })); - const stopStationIDListNumber = stopStationIDList.map((d) => { - if (!d) return { line: [], ID: [] }; - return { - line: d[0] - .split("") - .filter((s) => "A" < s && s < "Z") - .join(""), - ID: d[0] - .split("") - .filter((s) => "0" <= s && s <= "9") - .join(""), - }; - }); + // 完全一致 if (array.length == 1) { - const index = stopStationIDList.indexOf(array[0]); - if (index != -1) return [index]; - // 通過駅の場合 - for (let i = 0; i < stopStationIDListNumber.length - 1; i++) { - if (stopStationIDListNumber[i].ID < arrayNumber[0].ID) { - if (stopStationIDListNumber[i + 1].ID > arrayNumber[0].ID) { - return [i + 1]; - } - } - if (stopStationIDListNumber[i].ID > arrayNumber[0].ID) { - if (stopStationIDListNumber[i + 1].ID < arrayNumber[0].ID) { - return [i + 1]; - } - } + const index = stopStationIDList.map((d) => { + let a = false; + d.forEach((x) => { + if (x == array[0]) a = true; + }); + return a; + }); + if (index != -1) { + return index; } } // 駅間の場合 if (array.length == 2) { - const index1 = stopStationIDList.indexOf(array[0]); - const index2 = stopStationIDList.indexOf(array[1]); - if (index1 != -1 && index2 != -1) { - // 駅間で通過駅も無い場合 - if (index1 < index2) { - if (index1 + 1 == index2) { - return [index2]; - } else { - const returnArray = []; - for (let i = index1 + 1; i <= index2; i++) { - returnArray.push(i); - } - return returnArray; + + const allThroughStation = stopStationIDList.map((d) => { + if(array[0] == "M12" && array[1] == "Y09" || array[0] == "Y09" && array[1] == "M12"){ + if(d[0] == "M12"){ + return true; } + else return false; } - if (index1 > index2) { - if (index2 + 1 == index1) return [index1]; - else { - const returnArray = []; - for (let i = index2 + 1; i <= index1; i++) { - returnArray.push(i); - } - return returnArray; - } - } - } else { - const getNearStationID = (stationID) => { - for (let i = 0; i <= stopStationIDListNumber.length; i++) { - if (stopStationIDListNumber[i].ID < stationID) { - if (stopStationIDListNumber[i + 1].ID > stationID) { - return i + 1; - } - } - if (stopStationIDListNumber[i].ID > stationID) { - if (stopStationIDListNumber[i + 1].ID < stationID) { - return i + 1; - } - } - } - }; - let newIndex1 = index1; - let newIndex2 = index2; - if (index1 == -1) { - newIndex1 = getNearStationID(arrayNumber[0].ID); - } - if (index2 == -1) { - newIndex2 = getNearStationID(arrayNumber[1].ID); - } - if (newIndex1 && newIndex2) { - return [newIndex1, newIndex2]; + if (d[0] < array[0] && d[0] > array[1]) { + return true; + } else if (d[0] < array[1] && d[0] > array[0]) { + return true; + }else if (d[0] < array[0] && d[0] == array[1]) { + return true; + } else if (d[0] == array[1] && d[0] > array[0]) { + return true; } - // 通過駅の場合 - } - - return []; + return false; + }); + return allThroughStation; } } catch (e) { console.log(e); From 8726cf35b9a3e197e7a271cde53cbd530acad444 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Sun, 20 Oct 2024 12:21:35 +0000 Subject: [PATCH 17/32] =?UTF-8?q?=E5=88=97=E8=BB=8A=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E3=82=A2=E3=82=A4=E3=82=B3=E3=83=B3=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EachTrainInfoCore.js | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/components/ActionSheetComponents/EachTrainInfoCore.js b/components/ActionSheetComponents/EachTrainInfoCore.js index 5c283d9..e73893e 100644 --- a/components/ActionSheetComponents/EachTrainInfoCore.js +++ b/components/ActionSheetComponents/EachTrainInfoCore.js @@ -257,9 +257,41 @@ export const EachTrainInfoCore = ({ if (currentTrainData?.Pos.match("~")) { const pos = currentTrainData?.Pos.replace("(下り)", "") .replace("(上り)", "") + .replace("(徳島線)", "") + .replace("(高徳線)", "") .split("~"); const direction = parseInt(currentTrainData?.Direction) || 0; - if (direction == 0) { + if (pos[0] == "児島" && pos[1] == "宇多津") { + setCurrentPosition(["M12", "Y09"]); + return; + } else if (pos[1] == "児島" && pos[0] == "宇多津") { + setCurrentPosition(["Y09", "M12"]); + return; + } + const currentPosID = Object.keys(originalStationList).map((key) => { + let firstStation = false; + let firstStationID = ""; + let secondStation = false; + let secondStationID = ""; + originalStationList[key].forEach((station) => { + if (station.Station_JP === pos[0]) { + firstStation = true; + firstStationID = station.StationNumber; + } + if (station.Station_JP === pos[1]) { + secondStation = true; + secondStationID = station.StationNumber; + } + }); + if (firstStation && secondStation) { + return [firstStationID, secondStationID]; + } else return false; + }); + const currentPos = currentPosID.filter((d) => d != false)[0]; + if (currentPos) { + if (direction == 0) setCurrentPosition(currentPos.reverse()); + else setCurrentPosition(currentPos); + } else if (direction == 0) { setCurrentPosition([ getStationID(pos[1], stationList), getStationID(pos[0], stationList), From c2c23d85fb08c2cf872b195f7f74d0de497430b9 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Sat, 19 Oct 2024 02:48:25 +0000 Subject: [PATCH 18/32] =?UTF-8?q?=E3=83=86=E3=82=AD=E3=82=B9=E3=83=88?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/発車時刻表/EachData.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/発車時刻表/EachData.tsx b/components/発車時刻表/EachData.tsx index 6feb5e5..22dd788 100644 --- a/components/発車時刻表/EachData.tsx +++ b/components/発車時刻表/EachData.tsx @@ -141,7 +141,7 @@ export const EachData: FC = (props) => { { From bd1ea0857c5fd4c56dd75c0e395ed255b47097f5 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Wed, 23 Oct 2024 07:00:33 +0000 Subject: [PATCH 19/32] =?UTF-8?q?=E7=8F=BE=E5=9C=A8=E5=9C=B0=E3=82=B8?= =?UTF-8?q?=E3=83=A3=E3=83=B3=E3=83=97=E6=A9=9F=E8=83=BD=E3=82=92=E5=AE=9F?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EachTrainInfoCore.js | 27 ++++++++++++++++++- components/DynamicHeaderScrollView.js | 6 ++--- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/components/ActionSheetComponents/EachTrainInfoCore.js b/components/ActionSheetComponents/EachTrainInfoCore.js index e73893e..3f362cf 100644 --- a/components/ActionSheetComponents/EachTrainInfoCore.js +++ b/components/ActionSheetComponents/EachTrainInfoCore.js @@ -1,4 +1,4 @@ -import React, { useEffect, useMemo, useState } from "react"; +import React, { useEffect, useMemo, useRef, useState } from "react"; import { View, Text, @@ -7,6 +7,7 @@ import { useWindowDimensions, BackHandler, Linking, + LayoutAnimation, } from "react-native"; import { SheetManager } from "react-native-actions-sheet"; import { AS } from "../../storageControl"; @@ -173,6 +174,28 @@ export const EachTrainInfoCore = ({ trainPositionSwitch == "true" ? findReversalPoints(currentPosition, stopStationIDList) : stopStationIDList.map(() => false); + const [isJumped, setIsJumped] = useState(false); + useEffect(() => { + if (isJumped) return () => {}; + if (!points) return () => {}; + if (points.length == 0) return () => {}; + const position = points.findIndex((d) => d == true); + if (position == -1) return () => {}; + if (trainDataWidhThrough[position].split(",")[1] == "通過") { + LayoutAnimation.configureNext({ + duration: 200, + update: { type: "easeInEaseOut", springDamping: 0.6 }, + }); + setShowThrew(true); + } + const count = position * 44-30; + // 0.5秒待機してからスクロール + setTimeout( + () => ScrollViewRef.current?.scrollTo({ y: count, animated: true }), + 500 + ); + setIsJumped(true); + }, [points]); const trainName = useMemo(() => { if (!data.limited) return ""; const limitedArray = data.limited.split(":"); @@ -198,6 +221,7 @@ export const EachTrainInfoCore = ({ const { height } = useWindowDimensions(); const { isLandscape } = useDeviceOrientationChange(); + const ScrollViewRef = useRef(); const [trueTrainID, setTrueTrainID] = useState(); useEffect(() => { @@ -389,6 +413,7 @@ export const EachTrainInfoCore = ({ from={from} styles={styles} actionSheetRef={actionSheetRef} + ScrollViewRef={ScrollViewRef} containerProps={{ style: { maxHeight: isLandscape ? height - 94 : (height / 100) * 70, diff --git a/components/DynamicHeaderScrollView.js b/components/DynamicHeaderScrollView.js index 5602473..180eae2 100644 --- a/components/DynamicHeaderScrollView.js +++ b/components/DynamicHeaderScrollView.js @@ -13,14 +13,13 @@ export const DynamicHeaderScrollView = (props) => { topStickyContent, styles, from, + ScrollViewRef, } = props; const [headerSize, setHeaderSize] = useState("default"); useLayoutEffect(() => { AS.getItem("headerSize") .then((res) => { - if (res) { - setHeaderSize(res); - } + if (res) setHeaderSize(res); }) .catch((e) => { AS.setItem("headerSize", "default"); @@ -160,6 +159,7 @@ export const DynamicHeaderScrollView = (props) => { stickyHeaderIndices={[1]} scrollEventThrottle={16} onScroll={onScroll} + ref={ScrollViewRef} > {topStickyContent && ( From 40b7437c87878c97c19126291d0c3d986339c116 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Wed, 23 Oct 2024 07:37:20 +0000 Subject: [PATCH 20/32] =?UTF-8?q?=E3=82=A2=E3=82=A4=E3=82=B3=E3=83=B3?= =?UTF-8?q?=E7=99=BA=E5=8B=95=E6=9D=A1=E4=BB=B6=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../findReversalPoints.js | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/eachTrainInfoCoreLib/findReversalPoints.js b/lib/eachTrainInfoCoreLib/findReversalPoints.js index 353a75c..5981d75 100644 --- a/lib/eachTrainInfoCoreLib/findReversalPoints.js +++ b/lib/eachTrainInfoCoreLib/findReversalPoints.js @@ -17,31 +17,31 @@ export const findReversalPoints = (array, stopStationIDList) => { }); return a; }); - if (index != -1) { - return index; - } + if (index != -1) return index; } // 駅間の場合 if (array.length == 2) { - const allThroughStation = stopStationIDList.map((d) => { - if(array[0] == "M12" && array[1] == "Y09" || array[0] == "Y09" && array[1] == "M12"){ - if(d[0] == "M12"){ - return true; - } - else return false; - } - if (d[0] < array[0] && d[0] > array[1]) { - return true; - } else if (d[0] < array[1] && d[0] > array[0]) { - return true; - }else if (d[0] < array[0] && d[0] == array[1]) { - return true; - } else if (d[0] == array[1] && d[0] > array[0]) { - return true; - } + if ( + (array[0] == "M12" && array[1] == "Y09") || + (array[0] == "Y09" && array[1] == "M12") + ) + return d[0] == "M12" ? true : false; - return false; + let returndata = false; + d.forEach((x) => { + if (array[0] < x && x < array[1]) { + returndata = true; + } else if (array[0] < x && x == array[1]) { + returndata = true; + } else if (array[1] == x && x < array[0]) { + returndata = true; + } else if (array[1] < x && x < array[0]) { + returndata = true; + } + }); + + return returndata; }); return allThroughStation; } From 6440cff9283fa36b4cc13e3d4d561f5e43002079 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Wed, 23 Oct 2024 07:48:05 +0000 Subject: [PATCH 21/32] =?UTF-8?q?=E5=8B=95=E4=BD=9C=E5=8E=9F=E7=90=86?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ActionSheetComponents/EachTrainInfoCore.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/ActionSheetComponents/EachTrainInfoCore.js b/components/ActionSheetComponents/EachTrainInfoCore.js index 3f362cf..d0ee70f 100644 --- a/components/ActionSheetComponents/EachTrainInfoCore.js +++ b/components/ActionSheetComponents/EachTrainInfoCore.js @@ -188,7 +188,8 @@ export const EachTrainInfoCore = ({ }); setShowThrew(true); } - const count = position * 44-30; + if(position < 5) return() => {}; // 5駅以内の場合はスクロールしない + const count = position * 44-40; // 0.5秒待機してからスクロール setTimeout( () => ScrollViewRef.current?.scrollTo({ y: count, animated: true }), From eeb3993c712ac848d60e93b3972eeb3f95551e85 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Wed, 23 Oct 2024 08:00:09 +0000 Subject: [PATCH 22/32] =?UTF-8?q?css=E3=81=AE=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EachTrainInfo/EachStopList.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/components/ActionSheetComponents/EachTrainInfo/EachStopList.js b/components/ActionSheetComponents/EachTrainInfo/EachStopList.js index f5d3fb6..9f3d451 100644 --- a/components/ActionSheetComponents/EachTrainInfo/EachStopList.js +++ b/components/ActionSheetComponents/EachTrainInfo/EachStopList.js @@ -107,9 +107,14 @@ export const EachStopList = ({ {station} - {points ? ( - 🚊 - ) : null} + + {points ? ( + + 🚊 + + ) : null} + + {!isNaN(currentTrainData?.delay) && currentTrainData?.delay != 0 && ( Date: Wed, 23 Oct 2024 11:48:54 +0000 Subject: [PATCH 23/32] =?UTF-8?q?545M=E3=81=8C=E3=82=AF=E3=83=A9=E3=83=83?= =?UTF-8?q?=E3=82=B7=E3=83=A5=E3=81=99=E3=82=8B=E3=83=90=E3=82=B0=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- stateBox/useBusAndTrainData.js | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/stateBox/useBusAndTrainData.js b/stateBox/useBusAndTrainData.js index 8a5cc58..21b6774 100644 --- a/stateBox/useBusAndTrainData.js +++ b/stateBox/useBusAndTrainData.js @@ -81,24 +81,12 @@ export const BusAndTrainDataProvider = ({ children }) => { returnArray.push(Object.keys(trainPairList[trainNum])[0]); } switch (trainNum) { - case "4125M": - returnArray.push("545M"); - break; - case "545M": - returnArray.push("4125M"); - break; case "143M": returnArray.push("147M"); break; case "147M": returnArray.push("143M"); break; - case "1261M": - returnArray.push("4261M"); - break; - case "4261M": - returnArray.push("1261M"); - break; case new RegExp(/^4[1-9]\d\d[DM]$/).test(trainNum): if (trainList["5" + trainNum.substring(1)]) returnArray.push("5" + trainNum.substring(1)); From 8dbae5c66b1471389c75f0930f0a964b005e26db Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Wed, 23 Oct 2024 14:30:47 +0000 Subject: [PATCH 24/32] =?UTF-8?q?=E5=80=A4=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ActionSheetComponents/EachTrainInfoCore.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/ActionSheetComponents/EachTrainInfoCore.js b/components/ActionSheetComponents/EachTrainInfoCore.js index d0ee70f..f5ab02c 100644 --- a/components/ActionSheetComponents/EachTrainInfoCore.js +++ b/components/ActionSheetComponents/EachTrainInfoCore.js @@ -183,17 +183,17 @@ export const EachTrainInfoCore = ({ if (position == -1) return () => {}; if (trainDataWidhThrough[position].split(",")[1] == "通過") { LayoutAnimation.configureNext({ - duration: 200, + duration: 400, update: { type: "easeInEaseOut", springDamping: 0.6 }, }); setShowThrew(true); } if(position < 5) return() => {}; // 5駅以内の場合はスクロールしない - const count = position * 44-40; + const count = position * 44-50; // 0.5秒待機してからスクロール setTimeout( () => ScrollViewRef.current?.scrollTo({ y: count, animated: true }), - 500 + 400 ); setIsJumped(true); }, [points]); From 681f4d625ffdfedfc99b1d761f9880b908cc9ade Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Thu, 24 Oct 2024 17:21:50 +0000 Subject: [PATCH 25/32] =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E6=A9=9F=E8=83=BD?= =?UTF-8?q?=E3=81=AE=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Settings/LayoutSettings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/Settings/LayoutSettings.js b/components/Settings/LayoutSettings.js index 44b36bb..64af443 100644 --- a/components/Settings/LayoutSettings.js +++ b/components/Settings/LayoutSettings.js @@ -131,7 +131,7 @@ export const LayoutSettings = ({ bool={trainPosition} setBool={setTrainPosition} color="red" - str="列車の現在位置をアイコン表示" + str="列車の現在地表示/ジャンプ" /> From 9a458096a2f5272da870be9d6e45468860733179 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Thu, 24 Oct 2024 17:23:13 +0000 Subject: [PATCH 26/32] =?UTF-8?q?70,72=E3=81=AE=E9=81=8B=E7=94=A8=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/webViewInjectjavascript.ts | 144 ++++++++++++++++++++++++++++++++- 1 file changed, 142 insertions(+), 2 deletions(-) diff --git a/lib/webViewInjectjavascript.ts b/lib/webViewInjectjavascript.ts index d13f21f..b9dd1d0 100644 --- a/lib/webViewInjectjavascript.ts +++ b/lib/webViewInjectjavascript.ts @@ -698,9 +698,149 @@ export const injectJavascriptData: InjectJavascriptData = ( setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s1000.png'); break; - + // 予讃線/土讃線普通列車運用(7000,7200) + // 下り列車(伊予西条-松山は全て7000系) - default: + case "5519M": + case "5525M": + case "5215M": + case "5103M": + case "107M": + case "1219M": + case "5109M": + case "6109M": + case "5531M": + case "1221M": + case "5225M": + case "5111M": + case "1227M": + case "115M": + case "5229M": + case "5117M": + case "5119M": + case "119M": + case "5231M": + case "4537M": + case "5233M": + case "123M": + case "125M": + case "5235M": + case "5239M": + case "5547M": + case "129M": + case "131M": + case "5241M": + case "5133M": + case "135M": + case "1243M": + case "137M": + case "5139M": + case "4559M": + case "1245M": + case "141M": + case "1247M": + case "5249M": + case "145M": + case "5253M": + case "5149M": + case "5255M": + case "151M": + case "5257M": + case "153M": + case "5259M": + case "155M": + case "1263M": + case "157M": + setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s7200.png'); + break; + // 下り7000系 + case "101M": + case "4601M": + case "4113M": + case "121M": + case "127M": + case "555M": + case "4565M": + case "159M": + setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s7000.png'); + break; + // 上り列車 7200系 + case "5102M": + case "104M": + case "5210M": + case "5108M": + case "110M": + case "118M": + case "5218M": + case "5120M": + case "5220M": + case "5512M": + case "1602M": + case "1224M": + case "5124M": + case "5226M": + case "5126M": + case "1230M": + case "4128M": + case "130M": + case "4522M": + case "5232M": + case "132M": + case "5234M": + case "134M": + case "136M": + case "5236M": + case "5140M": + case "5238M": + case "5240M": + case "142M": + case "4530M": + case "144M": + case "5242M": + case "146M": + case "5244M": + case "4148M": + case "1246M": + case "150M": + case "5538M": + case "5152M": + case "154M": + case "156M": + case "1252M": + case "158M": + case "4604M": + case "548M": + case "5254M": + case "1606M": + case "5160M": + case "5256M": + setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s7200.png'); + break; + // 上り7000系 + case "112M": + case "114M": + case "122M": + case "4138M": + case "138M": + case "4542M": + case "162M": + case "4166M": + setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s7000.png'); + break; + default: //指定車両でなく、Regexでの指定に移動 + // 琴平直通系普通電車 + if(new RegExp(/^(1|4|5)2\\d\\dM$/).test(列番データ)){ + setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s7200.png'); + break; + } + else if(new RegExp(/^(1|4|5)(1|5|6)\\d\\dM$/).test(列番データ)){ + setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s7000.png'); + break; + } + else if(new RegExp(/^(1|5|6)\\d\\dM$/).test(列番データ)){ + setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s7000.png'); + break; + } break; } ` From 40cb1f3251d406412ac93e5edc38ff50978b5d5b Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Thu, 24 Oct 2024 18:08:33 +0000 Subject: [PATCH 27/32] =?UTF-8?q?=E5=84=AA=E5=85=88=E9=A0=86=E4=BD=8D?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/webViewInjectjavascript.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/webViewInjectjavascript.ts b/lib/webViewInjectjavascript.ts index b9dd1d0..a814a42 100644 --- a/lib/webViewInjectjavascript.ts +++ b/lib/webViewInjectjavascript.ts @@ -770,6 +770,7 @@ export const injectJavascriptData: InjectJavascriptData = ( case "5210M": case "5108M": case "110M": + case "112M": case "118M": case "5218M": case "5120M": @@ -817,7 +818,6 @@ export const injectJavascriptData: InjectJavascriptData = ( setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s7200.png'); break; // 上り7000系 - case "112M": case "114M": case "122M": case "4138M": From 5a062351e324472854092e22d5cf9704984716a9 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Fri, 25 Oct 2024 10:09:25 +0000 Subject: [PATCH 28/32] =?UTF-8?q?=E4=B8=80=E9=83=A8=E7=8A=B6=E6=B3=81?= =?UTF-8?q?=E3=81=AB=E3=82=88=E3=81=A3=E3=81=A6=E9=80=9A=E9=81=8E=E9=A7=85?= =?UTF-8?q?=E3=81=8C=E3=81=97=E3=81=BE=E3=81=88=E3=81=AA=E3=81=8F=E3=81=AA?= =?UTF-8?q?=E3=82=8B=E3=83=90=E3=82=B0=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ActionSheetComponents/EachTrainInfoCore.js | 1 + 1 file changed, 1 insertion(+) diff --git a/components/ActionSheetComponents/EachTrainInfoCore.js b/components/ActionSheetComponents/EachTrainInfoCore.js index f5ab02c..8a9f340 100644 --- a/components/ActionSheetComponents/EachTrainInfoCore.js +++ b/components/ActionSheetComponents/EachTrainInfoCore.js @@ -177,6 +177,7 @@ export const EachTrainInfoCore = ({ const [isJumped, setIsJumped] = useState(false); useEffect(() => { if (isJumped) return () => {}; + setShowThrew(true); if (!points) return () => {}; if (points.length == 0) return () => {}; const position = points.findIndex((d) => d == true); From b302df4664e9fe1f54c8ab4c5bba69bd48c754df Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Fri, 25 Oct 2024 14:05:58 +0000 Subject: [PATCH 29/32] =?UTF-8?q?=E3=82=B5=E3=83=B3=E3=83=9D=E3=83=BC?= =?UTF-8?q?=E3=83=88=E8=A1=A8=E8=A8=98=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/webViewInjectjavascript.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/webViewInjectjavascript.ts b/lib/webViewInjectjavascript.ts index a814a42..ed18176 100644 --- a/lib/webViewInjectjavascript.ts +++ b/lib/webViewInjectjavascript.ts @@ -847,6 +847,10 @@ export const injectJavascriptData: InjectJavascriptData = ( : ``; const normal_train_name = ` + if(列車名データ.match("サンポート")){ + const textBase = 列車名データ.split(":")[1]; + 行き先情報.innerText = textBase+行き先情報.innerText; + } if(new RegExp(/^4[1-9]\\d\\d[DM]$/).test(列番データ) || new RegExp(/^5[1-7]\\d\\d[DM]$/).test(列番データ) || 列番データ ==="3621D"){ 行き先情報.innerText = "ワンマン\\n"+行き先情報.innerText; flag=true; @@ -954,6 +958,7 @@ const setStrings = () =>{ } var 行き先情報 = element.getElementsByTagName("p")[0]; var 列番データ = element.getAttribute('offclick').split('"')[1]; + var 列車名データ = element.getAttribute('offclick').split('"')[3]; var flag=false; var TrainType = undefined; setTrainMenuDialog(element) From 50c332979337871d9a955a8cb9197e455fa4ca7a Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Fri, 25 Oct 2024 14:06:08 +0000 Subject: [PATCH 30/32] =?UTF-8?q?=E7=B4=B0=E3=81=8B=E3=81=84=E3=83=90?= =?UTF-8?q?=E3=82=B0=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EachTrainInfoCore.js | 20 +++++++++++-------- components/発車時刻表/EachData.tsx | 16 ++++++++++----- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/components/ActionSheetComponents/EachTrainInfoCore.js b/components/ActionSheetComponents/EachTrainInfoCore.js index 8a9f340..baae4cf 100644 --- a/components/ActionSheetComponents/EachTrainInfoCore.js +++ b/components/ActionSheetComponents/EachTrainInfoCore.js @@ -177,10 +177,10 @@ export const EachTrainInfoCore = ({ const [isJumped, setIsJumped] = useState(false); useEffect(() => { if (isJumped) return () => {}; - setShowThrew(true); if (!points) return () => {}; if (points.length == 0) return () => {}; const position = points.findIndex((d) => d == true); + let isThrew = false; if (position == -1) return () => {}; if (trainDataWidhThrough[position].split(",")[1] == "通過") { LayoutAnimation.configureNext({ @@ -188,14 +188,18 @@ export const EachTrainInfoCore = ({ update: { type: "easeInEaseOut", springDamping: 0.6 }, }); setShowThrew(true); + isThrew = true; + } + if (position < 5) { + } // 5駅以内の場合はスクロールしない + else { + const count = position * 44 - 50; + // 0.5秒待機してからスクロール + setTimeout( + () => ScrollViewRef.current?.scrollTo({ y: count, animated: true }), + 400 + ); } - if(position < 5) return() => {}; // 5駅以内の場合はスクロールしない - const count = position * 44-50; - // 0.5秒待機してからスクロール - setTimeout( - () => ScrollViewRef.current?.scrollTo({ y: count, animated: true }), - 400 - ); setIsJumped(true); }, [points]); const trainName = useMemo(() => { diff --git a/components/発車時刻表/EachData.tsx b/components/発車時刻表/EachData.tsx index 22dd788..275358e 100644 --- a/components/発車時刻表/EachData.tsx +++ b/components/発車時刻表/EachData.tsx @@ -102,14 +102,18 @@ export const EachData: FC = (props) => { }; const [platformNumber, setPlatformNumber] = useState(); + const [platformDescription, setPlatformDescription] = useState(); useEffect(() => { fetch( `https://n8n.haruk.in/webhook/JR-shikoku-PosID?PosNum=${currentTrainData?.PosNum}&Line=${currentTrainData?.Line}` ) .then((res) => res.json()) - .then((data) => - setPlatformNumber(data?.type == "Station" ? data?.platform : undefined) - ); + .then((data) => { + setPlatformNumber(data?.type == "Station" ? data?.platform : undefined); + setPlatformDescription( + data?.type == "Station" ? data?.description : undefined + ); + }); }, [currentTrainData, currentTrain]); return ( @@ -141,9 +145,11 @@ export const EachData: FC = (props) => { { Linking.openURL( "https://nexcloud.haruk.in/apps/forms/s/TEkBQW5WLcYjLyAzGxncQLtw" From 4507c0ef2a8d4ea322a48fefe1cacfb0c6e089e3 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Thu, 31 Oct 2024 12:26:07 +0000 Subject: [PATCH 31/32] =?UTF-8?q?5.5=20release=20=E3=83=90=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=83=A7=E3=83=B3=E3=82=B3=E3=83=BC=E3=83=89=E5=A4=89?= =?UTF-8?q?=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Settings/SettingTopPage.js | 2 +- config/newsUpdate.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/Settings/SettingTopPage.js b/components/Settings/SettingTopPage.js index a54874d..7999be6 100644 --- a/components/Settings/SettingTopPage.js +++ b/components/Settings/SettingTopPage.js @@ -12,7 +12,7 @@ import * as Updates from "expo-updates"; import { useWindowDimensions } from "react-native"; import { ListItem } from "native-base"; -const versionCode = "5.4.1"; +const versionCode = "5.5"; export const SettingTopPage = ({ navigate, testNFC, updateAndReload }) => { const { width } = useWindowDimensions(); diff --git a/config/newsUpdate.ts b/config/newsUpdate.ts index af3a94b..78b2436 100644 --- a/config/newsUpdate.ts +++ b/config/newsUpdate.ts @@ -1 +1 @@ -export const news = "2024-9-29"; +export const news = "2024-11-01"; From 2047df93092fd2f3f3a4c8644b7784cc2906c388 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Thu, 31 Oct 2024 12:26:15 +0000 Subject: [PATCH 32/32] =?UTF-8?q?=E3=83=AA=E3=83=AA=E3=83=BC=E3=82=B9?= =?UTF-8?q?=E7=94=A8=E5=B0=81=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Apps.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Apps.js b/Apps.js index cc526e0..5e8ebca 100644 --- a/Apps.js +++ b/Apps.js @@ -28,7 +28,7 @@ export function AppContainer() {