84 Commits

Author SHA1 Message Date
harukin-OneMix4
4f540d89c7 LEDと看板のロジック変更 2023-03-02 19:42:46 +09:00
harukin-OneMix4
2e535c2685 locationAndFavoriteの位置変更 2023-03-02 18:53:08 +09:00
harukin-OneMix4
23927a3f16 menuの固定データを分割 2023-03-02 18:31:59 +09:00
harukin-OneMix4
d45b6aee0e fixed yarn.lock 2023-03-02 17:43:29 +09:00
harukin-OneMix4
abe8334b26 Merge commit '64538e33f317c6fe395859673922f63c2e3b0514' into develop 2023-03-02 17:42:01 +09:00
harukin-OneMix4
64538e33f3 coreシステムのアップグレード 2023-03-02 17:36:21 +09:00
harukin-OneMix4
942b90e6d2 Merge commit '9d751866913f6fb743ae3e43a580d7624b333864' into develop 2023-02-22 20:29:40 +09:00
harukin-OneMix4
9d75186691 iOSのLEDボトム文字列が変な場所にある問題を修正 2023-02-22 20:29:28 +09:00
harukin-OneMix4
9959fbe5c9 LEDの文字サイズ調整 2023-02-22 20:27:30 +09:00
harukin-OneMix4
0230f5409a iOSで→が真ん中に来なかった問題を修正 2023-02-22 20:13:16 +09:00
harukin-OneMix4
1c67d1d486 iosでもlottieアニメが動作するように修正 2023-02-22 20:03:39 +09:00
harukin-DeskMini
97d05571e5 Merge commit '655f174321ccfe35b1631adf568f590dc6286b03' into develop 2023-02-06 12:06:30 +09:00
harukin-DeskMini
655f174321 ふぁぼが空の時にクラッシュしていた問題を修正 2023-02-06 12:06:21 +09:00
harukin-DeskMini
3137d50e24 Merge commit 'a7347a18163dfd8c29f99d1583e5429f9625423a' into develop 2023-02-06 11:25:30 +09:00
harukin-DeskMini
74864da293 Merge commit '815734eb07186bf15c58a3befd9b190fd2839170' into develop 2023-02-06 11:24:48 +09:00
harukin-DeskMini
4e90ecf132 ios beta publish 2023-02-06 11:20:43 +09:00
harukin-DeskMini
a7347a1816 バスのある駅でデータを出すボタンを設置 2023-02-06 03:22:02 +09:00
harukin-DeskMini
815734eb07 路線色の定義 2023-02-06 03:14:08 +09:00
harukin-DeskMini
369ae557c7 駅リストの管理に情報を追加/DetailView側に路線概要表示機能を追加 2023-02-05 17:07:57 +09:00
harukin-DeskMini
4c47a1684c Merge commit 'c2ca832b804afb3b5817afece0c98b4e9e504020' into develop 2023-02-05 05:03:31 +09:00
harukin-DeskMini
c2ca832b80 駅名標に不要な要素が残るバグを修正 2023-02-05 04:56:24 +09:00
harukin-DeskMini
5867ad3aa8 不要なタイミングで駅情報が消去されるバグを修正 2023-02-01 21:49:57 +09:00
harukin-DeskMini
ece076ad48 Merge commit '58340bb608aca83f50ea018fcbdd4f7e4043952c' into develop 2023-02-01 20:46:14 +09:00
harukin-DeskMini
58340bb608 最右端のデータを消去した場合にクラッシュするバグの修正 2023-02-01 20:46:03 +09:00
harukin-DeskMini
32fb402126 Merge commit 'bb89149876e720f8d3152e8d2e2116a942436e4a' into develop 2023-02-01 17:17:25 +09:00
harukin-DeskMini
44b6a113ff Merge commit 'e93fe7095ef717bd0ddebeb18f28038a374d83f6' into develop 2023-02-01 17:15:55 +09:00
harukin-DeskMini
e93fe7095e 高知運転所と高知駅が誤認してクラッシュしていた問題 2023-02-01 17:15:17 +09:00
harukin-DeskMini
bb89149876 選択された駅名板を利用したLED表示と選択画面の整備 2023-02-01 16:57:49 +09:00
harukin-DeskMini
12f23bef16 ふぁぼ駅を表示するように変更(現在地が表示されない) 2023-02-01 15:25:33 +09:00
harukin-DeskMini
f580e319cf Merge commit '7dc72ef433745388e6a31b06b1811e972896ae27' into develop 2023-01-30 03:32:51 +09:00
harukin-DeskMini
7dc72ef433 ふぁぼstateをトップ階層に移動し各コンポーネントで共有化 2023-01-30 03:32:30 +09:00
harukin-DeskMini
746c996cba 全コンポーネントをcomponentからchildへ移動 2023-01-30 03:02:00 +09:00
harukin-DeskMini
556b04e3b0 アイコン処理用function分離 2023-01-30 02:51:57 +09:00
harukin-DeskMini
67f9b8b698 Merge commit '3ff585a577d45227ec7bfa473eb658fea0853f9c' into develop 2023-01-30 01:19:06 +09:00
harukin-DeskMini
3ff585a577 タブバーのロング押し実装に伴うnavigation手法の変更とふぁぼ画面へのクイックアクセス機能整備 2023-01-30 01:18:53 +09:00
harukin-DeskMini
f5e4947c3b navigationの制御方式多少変更 2023-01-30 00:04:18 +09:00
harukin-DeskMini
fae18a6a47 Merge commit '40fb55c8cf5462a40a499ddcc69cb5313e559f84' into develop 2023-01-29 22:10:18 +09:00
harukin-DeskMini
40fb55c8cf いしづちと南風のjson解析に不完全があったのを修正 2023-01-29 22:08:56 +09:00
harukin-DeskMini
1fd2be5ddf Merge commit 'e35ab09002641b3813d2055ff8107bd8088c4629' into develop 2023-01-29 09:11:37 +09:00
harukin-DeskMini
e35ab09002 アイコンがリンク切れしていたので一部差し替え 2023-01-29 09:10:41 +09:00
harukin-DeskMini
f993577e34 検知日本語条件を修正 2023-01-29 08:57:59 +09:00
harukin-DeskMini
7f8a77d9fa 検知日本語条件を修正 2023-01-29 08:57:31 +09:00
harukin-DeskMini
50973db9ce Merge commit '7595dd845a73ae10dbeef8ae5324fba00c6b7beb' into develop 2023-01-29 08:39:37 +09:00
harukin-DeskMini
2fbd54eb7f 4.4.2.9 2023-01-29 08:39:18 +09:00
harukin-DeskMini
7595dd845a LEDの動作条件修正 2023-01-29 08:38:40 +09:00
harukin-DeskMini
d475b5c8a4 beta向けにeasの設定書き込み/4.5 beta-1 2023-01-29 07:59:06 +09:00
harukin-DeskMini
3a45288eee Merge commit 'c996b31dad836bed1994d4f25997f75b61cb661c' into develop 2023-01-29 07:57:32 +09:00
harukin-DeskMini
c996b31dad ふぁぼりすとを作成 2023-01-29 06:37:52 +09:00
harukin-DeskMini
2040d829fe お気に入り機能を実装 2023-01-29 04:07:41 +09:00
harukin-DeskMini
9eaa32a0f2 Merge commit 'a17626042a557594f5db9d200d1c53b95bb14356' 2023-01-28 23:56:46 +09:00
harukin-DeskMini
a17626042a 4.4.2.8 2023-01-28 23:56:40 +09:00
harukin-DeskMini
1dc1b9a636 エラー発生時の再試行用ボタンの設置 2023-01-28 23:56:10 +09:00
harukin-DeskMini
a56dfc7618 keyの修正と位置情報の取得タイミングの調整 2023-01-28 20:10:43 +09:00
harukin-DeskMini
178fda07af Merge commit 'bf016b1c8b2e84a38c675124888fe338c05d582c' 2023-01-28 08:53:37 +09:00
harukin-DeskMini
bf016b1c8b 4.4.2.7 2023-01-28 08:53:23 +09:00
harukin-DeskMini
1a1227dfeb AsyncStorage→ReactNativeStorageへの変更 2023-01-28 08:49:19 +09:00
harukin-DeskMini
29963ab876 LEDから列車視点版への移動が可能に 2023-01-28 08:31:39 +09:00
harukin-DeskMini
a5523d61c3 menuのanimation変更 2023-01-28 07:18:19 +09:00
harukin-DeskMini
337179b4c4 各種挙動が不完全な部分を修正 2023-01-28 07:16:50 +09:00
harukin-DeskMini
052c121179 LED表示機能第二弾リファクタリング 2023-01-28 06:51:52 +09:00
harukin-DeskMini
7321f6d514 LED表示機能第一段リファクタリング 2023-01-28 03:27:41 +09:00
harukin-DeskMini
ff48198c87 delayDataをkey管理化 2023-01-27 23:00:00 +09:00
harukin-DeskMini
690df1d2bc Signの動作変更 2023-01-27 22:59:29 +09:00
harukin-DeskMini
0251b9fc2f Merge commit '67eed85c225f2b935e2a8f377fb46614fa9cf390' 2023-01-26 06:37:52 +09:00
harukin-DeskMini
67eed85c22 4.4.2.6 2023-01-26 06:37:40 +09:00
harukin-DeskMini
cb94b545dc LEDVisionのエラーfallback対策&始発駅表記の対応 2023-01-26 06:36:52 +09:00
harukin-DeskMini
1ef8870153 Merge commit '18e046dc33da0b27fdfae244e390e0b7ddeffabf' into develop 2023-01-26 06:36:00 +09:00
harukin-DeskMini
18e046dc33 framework0への改修途中 2023-01-26 06:35:47 +09:00
harukin-OneMix4
f64ccfa271 Merge commit '5406d981957000a09610912aeb6e5d684f3c202e' 2022-12-08 01:08:20 +09:00
harukin-OneMix4
5406d98195 4.4.2.5 2022-12-08 01:07:58 +09:00
harukin-OneMix4
a923ac8b20 Merge commit '1ecb9ec0463b3c2c3ebf9da3b78015e9724632f4' into develop 2022-12-08 01:06:41 +09:00
harukin-OneMix4
03d6f02de5 Merge commit 'a5b5d8f1b41c88e0b71593f7eaa9e65ab3ee662f' into develop 2022-12-08 01:06:34 +09:00
harukin-OneMix4
1ecb9ec046 不要なデータの消去 2022-12-08 01:06:14 +09:00
harukin-OneMix4
796464c03a Merge commit '3723b01401e4868ec5f1c4ea5f1f57cd970500f0' 2022-12-07 23:31:17 +09:00
harukin-OneMix4
3723b01401 4.4.2.4 2022-12-07 23:31:06 +09:00
harukin-OneMix4
59c60d7791 Merge commit '10ea09cb00a5fdaf79798350ee30211d4d3ec41f' 2022-12-07 23:28:58 +09:00
harukin-OneMix4
10ea09cb00 Merge commit '13c1ab6e170f4f8757239dcf2f9e51bfc6c48b9f' into develop 2022-12-07 23:28:37 +09:00
harukin-DeskMini
7810b770cc Merge commit '1430c31140b00da4c971a9b518c2fe01c6d1b4bf' 2022-11-29 21:25:06 +09:00
harukin-DeskMini
00e0dbab9d Merge branch 'master' of https://gitlab.haruk.in/harukin/jrshikoku 2022-11-22 14:42:50 +09:00
harukin-OneMix4
923a28e1a5 Merge branch 'develop' 2022-11-22 14:41:47 +09:00
harukin-DeskMini
151edd5fff Merge commit 'cf57f29e62ceff066426e04ae1ca79d2b65b1cf2' 2022-11-21 00:06:58 +09:00
harukin-DeskMini
f7965be3ef Merge commit 'cbce84a9ab1a79f4302c1b7c65a23a0263e78905' 2022-11-19 15:34:28 +09:00
harukin-DeskMini
32f6fa3b60 Merge commit '7a33ee409581dffccb189887cffbb8419bb881de' 2022-10-01 02:09:31 +09:00
harukin-DeskMini
5474b3eab2 Merge commit '15bb692676e546e59ce418c8b7e2847ca7345ceb' 2022-09-30 00:15:36 +09:00
28 changed files with 6295 additions and 17479 deletions

245
App.js
View File

@@ -1,4 +1,4 @@
import React, { useEffect, useRef } from "react";
import React, { useEffect, useRef, useState } from "react";
import { NavigationContainer } from "@react-navigation/native";
import {
createStackNavigator,
@@ -8,14 +8,23 @@ import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import { AntDesign, Ionicons } from "@expo/vector-icons";
import { Platform, UIManager } from "react-native";
import { UpdateAsync } from "./UpdateAsync.js";
import { getStationList2 } from "./lib/getStationList2";
import { AS } from "./storageControl";
import Apps from "./Apps";
import tndView from "./ndView";
import trainbase from "./trainbaseview";
import howto from "./howto";
import menu from "./menu";
import TNDView from "./ndView";
import TrainBase from "./trainbaseview";
import HowTo from "./howto";
import Menu from "./menu";
import News from "./components/news.js";
import Setting from "./components/settings.js";
import trainMenu from "./components/trainMenu.js";
import TrainMenu from "./components/trainMenu.js";
import FavoriteList from "./components/FavoriteList.js";
import { LogBox } from "react-native";
LogBox.ignoreLogs([
"ViewPropTypes will be removed",
"ColorPropType will be removed",
]);
const Stack = createStackNavigator();
const Tab = createBottomTabNavigator();
if (Platform.OS === "android") {
@@ -24,96 +33,254 @@ if (Platform.OS === "android") {
}
}
export default function App() {
const navigationRef = useRef();
useEffect(UpdateAsync, []);
useEffect(() => {
UpdateAsync();
}, []);
const [favoriteStation, setFavoriteStation] = useState([]);
useEffect(() => {
AS.getItem("favoriteStation")
.then((d) => {
const returnData = JSON.parse(d);
setFavoriteStation(returnData);
})
.catch((d) => console.log(d));
}, []);
const [busAndTrainData, setBusAndTrainData] = useState([]);
useEffect(() => {
AS.getItem("busAndTrain")
.then((d) => {
const returnData = JSON.parse(d);
setBusAndTrainData(returnData);
})
.catch((d) => {
fetch(
"https://script.google.com/macros/s/AKfycbw0UW6ZeCDgUYFRP0zxpc_Oqfy-91dBdbWv-cM8n3narKp14IyCd2wy5HW7taXcW7E/exec"
)
.then((d) => d.json())
.then((d) => {
setBusAndTrainData(d);
AS.setItem("busAndTrain", JSON.stringify(d));
});
});
}, []);
return (
<NavigationContainer name="Root" ref={navigationRef} style={{ flex: 1 }}>
<Tab.Navigator>
<Stack.Screen
<NavigationContainer name="Root" style={{ flex: 1 }}>
<Tab.Navigator detachInactiveScreens={false}>
<Tab.Screen
name="login"
component={top}
options={{
tabBarLabel: "位置情報",
headerTransparent: true,
gestureEnabled: true,
tabBarIcon: () => <AntDesign name="barchart" size={32} />,
tabBarIcon: initIcon("barchart", "AntDesign"),
}}
/>
<Stack.Screen
>
{(props) => (
<Top
{...props}
favoriteStation={favoriteStation}
setFavoriteStation={setFavoriteStation}
busAndTrainData={busAndTrainData}
/>
)}
</Tab.Screen>
<Tab.Screen
name="menuPage"
component={menuPage}
options={{
tabBarLabel: "リンク",
headerTransparent: true,
gestureEnabled: true,
tabBarIcon: () => <Ionicons name="ios-radio" size={32} />,
tabBarIcon: initIcon("ios-radio", "Ionicons"),
}}
/>
<Stack.Screen
>
{(props) => (
<MenuPage
{...props}
favoriteStation={favoriteStation}
setFavoriteStation={setFavoriteStation}
busAndTrainData={busAndTrainData}
/>
)}
</Tab.Screen>
<Tab.Screen
name="home"
component={tndView}
options={{
tabBarLabel: "運行情報",
headerTransparent: true,
gestureEnabled: true,
tabBarIcon: () => <Ionicons name="md-train" size={32} />,
tabBarIcon: initIcon("md-train", "Ionicons"),
}}
/>
>
{(props) => <TNDView {...props} />}
</Tab.Screen>
</Tab.Navigator>
</NavigationContainer>
);
}
function top() {
const initIcon = (name, type) => {
switch (type) {
case "Ionicons":
return ({ focused, color, size }) => (
<Ionicons name={name} size={32} color={focused ? "#0099CC" : "black"} />
);
case "AntDesign":
return ({ focused, color, size }) => (
<AntDesign
name={name}
size={32}
color={focused ? "#0099CC" : "black"}
/>
);
}
};
const Top = ({
navigation,
favoriteStation,
setFavoriteStation,
busAndTrainData,
}) => {
const webview = useRef();
//地図用
const [mapsStationData, setMapsStationData] = useState(undefined);
useEffect(() => {
getStationList2().then(setMapsStationData);
}, []);
useEffect(() => {
const unsubscribe = navigation.addListener("tabLongPress", (e) => {
navigation.navigate("favoriteList");
});
return unsubscribe;
}, [navigation]);
return (
<Stack.Navigator>
<Stack.Screen
name="Apps"
component={Apps}
options={{
headerShown: false,
gestureEnabled: true,
headerTransparent: true,
}}
/>
>
{(props) => (
<Apps
{...props}
webview={webview}
favoriteStation={favoriteStation}
setFavoriteStation={setFavoriteStation}
busAndTrainData={busAndTrainData}
/>
)}
</Stack.Screen>
<Stack.Screen
name="trainbase"
component={trainbase}
options={{
title: "トレインビジョン",
gestureEnabled: true,
...TransitionPresets.SlideFromRightIOS,
}}
/>
>
{(props) => <TrainBase {...props} />}
</Stack.Screen>
<Stack.Screen
name="howto"
component={howto}
options={{
title: "使い方",
...optionData,
}}
/>
<Stack.Screen name="news" component={News} options={optionData} />
>
{(props) => <HowTo {...props} />}
</Stack.Screen>
<Stack.Screen name="news" options={optionData}>
{(props) => <News {...props} />}
</Stack.Screen>
<Stack.Screen name="trainMenu" options={optionData}>
{(props) => (
<TrainMenu
{...props}
webview={webview}
stationData={mapsStationData}
/>
)}
</Stack.Screen>
<Stack.Screen
name="trainMenu"
component={trainMenu}
options={optionData}
/>
name="favoriteList"
options={{ ...optionData, gestureEnabled: false }}
>
{(props) => (
<FavoriteList
{...props}
webview={webview}
stationData={mapsStationData}
favoriteStation={favoriteStation}
setFavoriteStation={setFavoriteStation}
/>
)}
</Stack.Screen>
</Stack.Navigator>
);
}
function menuPage() {
};
function MenuPage({
navigation,
favoriteStation,
setFavoriteStation,
busAndTrainData,
}) {
useEffect(() => {
const unsubscribe = navigation.addListener("tabPress", (e) => {
AS.getItem("favoriteStation")
.then((d) => {
const returnData = JSON.parse(d);
setFavoriteStation(returnData);
})
.catch((d) => console.log(d));
});
return unsubscribe;
}, [navigation]);
return (
<Stack.Navigator>
<Stack.Screen
name="menu"
component={menu}
options={{
headerShown: false,
gestureEnabled: true,
headerTransparent: true,
}}
/>
<Stack.Screen name="setting" component={Setting} options={optionData} />
>
{(props) => (
<Menu
{...props}
favoriteStation={favoriteStation}
setFavoriteStation={setFavoriteStation}
busAndTrainData={busAndTrainData}
/>
)}
</Stack.Screen>
<Stack.Screen name="setting" options={optionData}>
{(props) => <Setting {...props} />}
</Stack.Screen>
<Stack.Screen
name="trainbase"
options={{
...TransitionPresets.ModalPresentationIOS,
cardOverlayEnabled: true,
headerShown: false,
gestureEnabled: true,
headerTransparent: true,
gestureResponseDistance: { vertical: 300 },
}}
>
{(props) => <TrainBase {...props} />}
</Stack.Screen>
</Stack.Navigator>
);
}

335
Apps.js
View File

@@ -8,9 +8,10 @@ import {
} from "react-native";
import { WebView } from "react-native-webview";
import Constants from "expo-constants";
import AsyncStorage from "@react-native-async-storage/async-storage";
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
import { AS } from "./storageControl";
import { news } from "./config/newsUpdate";
import { getStationList } from "./lib/getStationList";
import { getStationList, lineList } from "./lib/getStationList";
import { StationDeteilView } from "./components/ActionSheetComponents/StationDeteilView";
import { injectJavascriptData } from "./lib/webViewInjectjavascript";
import { getStationList2 } from "./lib/getStationList2";
@@ -18,32 +19,29 @@ import { getStationList2 } from "./lib/getStationList2";
import StatusbarDetect from './StatusbarDetect';
var Status = StatusbarDetect(); */
export default function Apps(props) {
const {
navigation: { navigate },
} = props;
export default function Apps({
navigation,
webview,
favoriteStation,
setFavoriteStation,
busAndTrainData,
}) {
const { navigate } = navigation;
var urlcache = "";
const webview = useRef();
//画面表示関連
const [iconSetting, setIconSetting] = useState(undefined);
const [mapSwitch, setMapSwitch] = useState(undefined);
const [stationMenu, setStationMenu] = useState(undefined);
//地図用
const [mapsStationData, setMapsStationData] = useState(undefined);
useEffect(() => {
getStationList2().then((data) => {
console.log(data);
setMapsStationData(data);
});
}, []);
//駅情報画面用
const StationBoardAcSR = useRef(null);
const [stationBoardData, setStationBoardData] = useState(undefined);
const [originalStationList, setOriginalStationList] = useState();
const [selectedStation, setSelectedStation] = useState(undefined);
useEffect(() => getStationList().then(setOriginalStationList), []);
useEffect(() => {
getStationList().then(setOriginalStationList);
}, []);
//地図表示テキスト
const injectJavascript = injectJavascriptData(
@@ -54,63 +52,113 @@ export default function Apps(props) {
useEffect(() => {
//ニュース表示
AsyncStorage.getItem("status")
AS.getItem("status")
.then((d) => {
if (d != news) navigate("news");
})
.catch((e) => navigate("news"));
}, []);
useEffect(() => {
//列車アイコンスイッチ
AsyncStorage.getItem("iconSwitch")
AS.getItem("iconSwitch")
.then((d) => {
if (d) {
setIconSetting(d);
} else {
AsyncStorage.setItem("iconSwitch", "true").then(() =>
Updates.reloadAsync()
);
AS.setItem("iconSwitch", "true").then(Updates.reloadAsync);
}
})
.catch((d) =>
AsyncStorage.setItem("iconSwitch", "true").then(() =>
Updates.reloadAsync()
)
);
.catch((d) => AS.setItem("iconSwitch", "true").then(Updates.reloadAsync));
}, []);
useEffect(() => {
//地図スイッチ
AsyncStorage.getItem("mapSwitch")
AS.getItem("mapSwitch")
.then((d) => {
if (d) {
setMapSwitch(d);
} else {
AsyncStorage.setItem("mapSwitch", "false").then(() =>
Updates.reloadAsync()
);
AS.setItem("mapSwitch", "false").then(Updates.reloadAsync);
}
})
.catch((d) =>
AsyncStorage.setItem("mapSwitch", "false").then(() =>
Updates.reloadAsync()
)
);
.catch((d) => AS.setItem("mapSwitch", "false").then(Updates.reloadAsync));
}, []);
useEffect(() => {
//駅メニュースイッチ
AsyncStorage.getItem("stationSwitch")
AS.getItem("stationSwitch")
.then((d) => {
if (d) {
setStationMenu(d);
} else {
AsyncStorage.setItem("stationSwitch", "true").then(() =>
Updates.reloadAsync()
);
AS.setItem("stationSwitch", "true").then(Updates.reloadAsync);
}
})
.catch((d) =>
AsyncStorage.setItem("stationSwitch", "true").then(() =>
Updates.reloadAsync()
)
AS.setItem("stationSwitch", "true").then(Updates.reloadAsync)
);
}, []);
const onMessage = (event) => {
if (!event.nativeEvent.data.includes("PopUpMenu")) {
navigate("trainbase", { info: event.nativeEvent.data, from: "Train" });
return;
}
if (!originalStationList) {
alert("駅名標データを取得中...");
return;
}
const selectedStationPDFAddress = event.nativeEvent.data
.split(",")[3]
.replace("'", "")
.replace("'", "");
const findStationEachLine = (selectLine) => {
let NearStation = selectLine.filter(
(d) => d.StationTimeTable == selectedStationPDFAddress
);
return NearStation;
};
let returnDataBase = lineList
.map((d) => findStationEachLine(originalStationList[d]))
.filter((d) => d.length > 0)
.reduce((pre, current) => {
pre.push(...current);
return pre;
}, []);
if (returnDataBase.length) {
setStationBoardData(returnDataBase);
StationBoardAcSR.current?.setModalVisible();
} else {
setStationBoardData(undefined);
StationBoardAcSR.current?.hide();
}
return;
};
const onNavigationStateChange = (event) => {
if (event.url != urlcache) {
//URL二重判定回避
urlcache = event.url;
if (event.url.includes("https://train.jr-shikoku.co.jp/usage.htm")) {
if (Platform.OS === "android") navigate("howto");
webview?.current.goBack();
//Actions.howto();
} else if (
event.url.includes("https://train.jr-shikoku.co.jp/train.html")
) {
//Actions.trainbase({info: event.url});
if (Platform.OS === "android")
navigate("trainbase", { info: event.url });
webview?.current.goBack();
}
}
};
return (
<View
style={{
@@ -120,7 +168,7 @@ export default function Apps(props) {
>
{/* {Status} */}
<WebView
useWebKit={true}
useWebKit
ref={webview}
source={{ uri: "https://train.jr-shikoku.co.jp/sp.html" }}
originWhitelist={[
@@ -128,125 +176,104 @@ export default function Apps(props) {
"https://train.jr-shikoku.co.jp/sp.html",
]}
mixedContentMode={"compatibility"}
javaScriptEnabled={true}
allowsBackForwardNavigationGestures={true}
setSupportMultipleWindows={true}
onNavigationStateChange={(event) => {
if (event.url != urlcache) {
//URL二重判定回避
urlcache = event.url;
if (
event.url.includes("https://train.jr-shikoku.co.jp/usage.htm")
) {
if (Platform.OS === "android") navigate("howto");
webview?.current.goBack();
//Actions.howto();
} else if (
event.url.includes("https://train.jr-shikoku.co.jp/train.html")
) {
//Actions.trainbase({info: event.url});
if (Platform.OS === "android")
navigate("trainbase", { info: event.url });
webview?.current.goBack();
}
}
}}
onMessage={(event) => {
if (!originalStationList) {
alert("駅名標データを取得中...");
return;
}
if (event.nativeEvent.data.includes("PopUpMenu")) {
const selectedStationPDFAddress = event.nativeEvent.data
.split(",")[3]
.replace("'", "")
.replace("'", "");
const findStationEachLine = (selectLine) => {
let NearStation = selectLine.filter(
(d) => d.StationTimeTable == selectedStationPDFAddress
);
return NearStation;
};
const lineList = [
"予讃線",
"松宇線",
"伊予灘線",
"土讃線",
"窪川線",
"高徳線",
"徳島線",
"鳴門線",
"瀬戸大橋線",
];
let returnDataBase = lineList
.map((d) => findStationEachLine(originalStationList[d]))
.filter((d) => d.length > 0)
.reduce((pre, current) => {
pre.push(...current);
return pre;
}, []);
if (returnDataBase.length) {
let currentStation =
currentStation == undefined ? [] : currentStation;
setStationBoardData(returnDataBase);
StationBoardAcSR.current?.setModalVisible();
} else {
setStationBoardData(undefined);
StationBoardAcSR.current?.hide();
}
return;
}
navigate("trainbase", { info: event.nativeEvent.data });
}}
javaScriptEnabled
allowsBackForwardNavigationGestures
setSupportMultipleWindows
onNavigationStateChange={onNavigationStateChange}
onMessage={onMessage}
injectedJavaScript={injectJavascript}
onTouchMove={() => StationBoardAcSR.current?.hide()}
/>
<TouchableOpacity
onPress={() =>
navigate("trainMenu", { webview, stationData: mapsStationData })
}
style={{
position: "absolute",
top: Platform.OS == "ios" ? Constants.statusBarHeight : 0,
left: 10,
width: 50,
height: 50,
backgroundColor: "#0099CC",
borderColor: "white",
borderStyle: "solid",
borderWidth: 1,
borderRadius: 50,
alignContent: "center",
alignSelf: "center",
alignItems: "center",
display: mapSwitch == "true" ? "flex" : "none",
}}
>
<View style={{ flex: 1 }} />
<Text
style={{
textAlign: "center",
width: "auto",
height: "auto",
textAlignVertical: "center",
fontWeight: "bold",
color: "white",
}}
>
</Text>
<View style={{ flex: 1 }} />
</TouchableOpacity>
<MapsButton
onPress={() => navigate("trainMenu", { webview })}
top={Platform.OS == "ios" ? Constants.statusBarHeight : 0}
mapSwitch={mapSwitch == "true" ? "flex" : "none"}
/>
<ReloadButton
onPress={() => webview.current.reload()}
top={Platform.OS == "ios" ? Constants.statusBarHeight : 0}
/>
<StationDeteilView
StationBoardAcSR={StationBoardAcSR}
currentStation={stationBoardData}
originalStationList={originalStationList}
favoriteStation={favoriteStation}
setFavoriteStation={setFavoriteStation}
busAndTrainData={busAndTrainData}
/>
</View>
);
}
const MapsButton = ({ onPress, top, mapSwitch }) => {
const styles = {
touch: {
position: "absolute",
top,
left: 10,
width: 50,
height: 50,
backgroundColor: "#0099CC",
borderColor: "white",
borderStyle: "solid",
borderWidth: 1,
borderRadius: 50,
alignContent: "center",
alignSelf: "center",
alignItems: "center",
display: mapSwitch,
},
text: {
textAlign: "center",
width: "auto",
height: "auto",
textAlignVertical: "center",
fontWeight: "bold",
color: "white",
},
};
return (
<TouchableOpacity onPress={onPress} style={styles.touch}>
<View style={{ flex: 1 }} />
<Text style={styles.text}></Text>
<View style={{ flex: 1 }} />
</TouchableOpacity>
);
};
const ReloadButton = ({ onPress, top, mapSwitch }) => {
const styles = {
touch: {
position: "absolute",
top,
right: 10,
width: 50,
height: 50,
backgroundColor: "#0099CC",
borderColor: "white",
borderStyle: "solid",
borderWidth: 1,
borderRadius: 50,
alignContent: "center",
alignSelf: "center",
alignItems: "center",
display: mapSwitch,
},
text: {
textAlign: "center",
width: "auto",
height: "auto",
textAlignVertical: "center",
fontWeight: "bold",
color: "white",
},
};
return (
<TouchableOpacity onPress={onPress} style={styles.touch}>
<View style={{ flex: 1 }} />
<Ionicons name="reload" color="white" size={30} />
<View style={{ flex: 1 }} />
</TouchableOpacity>
);
};

View File

@@ -1,7 +1,7 @@
import { ToastAndroid } from "react-native";
import * as Updates from "expo-updates";
export const UpdateAsync = () =>
export const UpdateAsync = () => {
Updates.checkForUpdateAsync()
.then((update) => {
if (!update.isAvailable) return;
@@ -34,3 +34,4 @@ export const UpdateAsync = () =>
.finally(() => {
return;
});
};

View File

@@ -3,8 +3,11 @@
"name": "JR四国運行状況",
"slug": "jrshikoku",
"privacy": "public",
"platforms": ["ios", "android"],
"version": "4.4",
"platforms": [
"ios",
"android"
],
"version": "4.5",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
@@ -15,9 +18,11 @@
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": ["**/*"],
"assetBundlePatterns": [
"**/*"
],
"ios": {
"buildNumber": "22",
"buildNumber": "24",
"supportsTablet": true,
"bundleIdentifier": "jrshikokuinfo.xprocess.hrkn",
"config": {
@@ -27,13 +32,20 @@
"android": {
"package": "jrshikokuinfo.xprocess.hrkn",
"versionCode": 16,
"permissions": ["ACCESS_FINE_LOCATION"],
"permissions": [
"ACCESS_FINE_LOCATION"
],
"googleServicesFile": "./google-services.json",
"config": {
"googleMaps": {
"apiKey": "AIzaSyAmFb-Yj033bXZWlSzNrfq_0jc1PgRrWcE"
}
}
},
"extra": {
"eas": {
"projectId": "398abf60-57a7-11e9-970c-8f04356d08bf"
}
}
}
}

1
assets/939-star.json Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,11 @@
export default {
Y: "#F5AC13",
U: "#F5AC13",
S: "#9AA7D7",
D: "#DC4586",
K: "#DC4586",
B: "#366481",
N: "#881F61",
T: "#87CA3B",
M: "#0071be",
};

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,5 @@
import React, { Component, useRef, useState, useEffect } from "react";
import React from "react";
import {
StatusBar,
Platform,
View,
LayoutAnimation,
ScrollView,
@@ -9,30 +7,9 @@ import {
Text,
TouchableOpacity,
} from "react-native";
import Image from "react-native-remote-svg";
import Constants from "expo-constants";
import { List, ListItem } from "native-base";
import Icon from "react-native-vector-icons/Entypo";
import * as Location from "expo-location";
import StatusbarDetect from "../../StatusbarDetect";
var Status = StatusbarDetect();
import { useNavigation } from "@react-navigation/native";
import AutoHeightImage from "react-native-auto-height-image";
import {
widthPercentageToDP as wp,
heightPercentageToDP as hp,
} from "react-native-responsive-screen";
import {
FontAwesome,
Fontisto,
Foundation,
Ionicons,
MaterialCommunityIcons,
} from "@expo/vector-icons";
import * as WebBrowser from "expo-web-browser";
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
import ActionSheet from "react-native-actions-sheet";
import LottieView from "lottie-react-native";
import SvgUri from "react-native-svg-uri";
export const JRSTraInfo = (props) => {
const {
JRSTraInfoEXAcSR,
@@ -45,7 +22,7 @@ export const JRSTraInfo = (props) => {
<ActionSheet
ref={JRSTraInfoEXAcSR}
gestureEnabled
CustomHeaderComponent={() => { }}
CustomHeaderComponent={<></>}
>
<View
style={{
@@ -80,8 +57,8 @@ export const JRSTraInfo = (props) => {
<Text style={{ fontSize: 30, fontWeight: "bold", color: "white" }}>
{getTime
? getTime.toLocaleTimeString("ja-JP").split(":")[0] +
":" +
getTime.toLocaleTimeString("ja-JP").split(":")[1]
":" +
getTime.toLocaleTimeString("ja-JP").split(":")[1]
: NaN}{" "}
</Text>
<Ionicons
@@ -116,7 +93,7 @@ export const JRSTraInfo = (props) => {
delayData.map((d) => {
let data = d.split(" ");
return (
<View style={{ flexDirection: "row" }}>
<View style={{ flexDirection: "row" }} key={data[1]}>
<Text style={{ flex: 15, fontSize: 20 }}>
{data[0].replace("\n", "")}
</Text>

View File

@@ -1,21 +1,51 @@
import React from "react";
import { View, ScrollView, Linking } from "react-native";
import StatusbarDetect from "../../StatusbarDetect";
var Status = StatusbarDetect();
import React, { useState, useEffect } from "react";
import {
StatusBar,
View,
LayoutAnimation,
ScrollView,
Linking,
Text,
TouchableOpacity,
} from "react-native";
import { FontAwesome, Foundation, Ionicons } from "@expo/vector-icons";
import ActionSheet from "react-native-actions-sheet";
import Sign from "../../components/駅名表/Sign";
import { useInterval } from "../../lib/useInterval";
import { TicketBox } from "../atom/TicketBox";
import {
widthPercentageToDP as wp,
heightPercentageToDP as hp,
} from "react-native-responsive-screen";
import lineColorList from "../../assets/originData/lineColorList";
export const StationDeteilView = (props) => {
const { StationBoardAcSR, currentStation, originalStationList } = props;
const {
StationBoardAcSR,
currentStation,
originalStationList,
favoriteStation,
setFavoriteStation,
busAndTrainData,
} = props;
const [trainBus, setTrainBus] = useState();
useEffect(() => {
if (!currentStation) return () => {};
const data = busAndTrainData.filter((d) => {
return d.name === currentStation[0].Station_JP;
});
if (data.length == 0) {
setTrainBus();
}
setTrainBus(data[0]);
}, [currentStation]);
return (
<ActionSheet
ref={StationBoardAcSR}
gestureEnabled
CustomHeaderComponent={() => {}}
CustomHeaderComponent={<></>}
>
<View
key={currentStation}
@@ -40,12 +70,30 @@ export const StationDeteilView = (props) => {
</View>
<View>
{currentStation && (
<Sign
currentStation={currentStation}
originalStationList={originalStationList}
oP={() => Linking.openURL(currentStation[0].StationTimeTable)}
/>
<View
style={{
margin: 10,
marginHorizontal: wp("10%"),
}}
>
<Sign
currentStation={currentStation}
originalStationList={originalStationList}
favoriteStation={favoriteStation}
setFavoriteStation={setFavoriteStation}
oP={() => Linking.openURL(currentStation[0].StationTimeTable)}
/>
</View>
)}
{currentStation &&
currentStation.map((d) => (
<NexPreStationLine
currentStation={d}
originalStationList={originalStationList}
favoriteStation={favoriteStation}
setFavoriteStation={setFavoriteStation}
/>
))}
{currentStation && (
<View style={{ flexDirection: "row" }}>
{!currentStation[0].JrHpUrl || (
@@ -81,7 +129,17 @@ export const StationDeteilView = (props) => {
Linking.openURL(currentStation[0].StationMap)
}
>
GoogleMap
Map
</TicketBox>
)}
{!trainBus || (
<TicketBox
backgroundColor={"#CE5C00"}
icon={<Ionicons name="bus" color="white" size={50} />}
flex={1}
onPressButton={() => Linking.openURL(trainBus.address)}
>
平行バス
</TicketBox>
)}
</View>
@@ -91,3 +149,226 @@ export const StationDeteilView = (props) => {
</ActionSheet>
);
};
const StationName = (props) => {
const { stringData, ss } = props;
return (
<View style={ss}>
<Text style={styleSheet.下枠駅名}>{stringData.Station_JP}</Text>
<Text style={styleSheet.下枠駅名}>{stringData.Station_EN}</Text>
</View>
);
};
const NexPreStationLine = ({
currentStation,
originalStationList,
oP,
favoriteStation,
setFavoriteStation,
}) => {
const [preStation, setPreStation] = useState();
const [nexStation, setNexStation] = useState();
const [lineName, setLineName] = useState();
useEffect(() => {
getPreNextStation(currentStation);
}, [currentStation]);
useEffect(() => {
if (!currentStation) return () => {};
getPreNextStation(currentStation);
}, []);
const getPreNextStation = (now) => {
const lineList = [
"予讃線(高松-松山間)[Y]",
"予讃線(松山-宇和島間)[U]",
"予讃線/愛ある伊予灘線(向井原-伊予大洲間)[S]",
"土讃線(多度津-高知間)[D]",
"土讃線(高知-窪川間)[K]",
"高徳線(高松-徳島間)[T]",
"徳島線(徳島-阿波池田)[B]",
"鳴門線(池谷-鳴門間)[N]",
"瀬戸大橋線(宇多津-児島間)[M]",
];
let returnData;
lineList.forEach((d) => {
let cache = originalStationList[d].findIndex(
(data) => data.StationNumber == now.StationNumber
);
if (cache != -1) {
returnData = [
originalStationList[d][cache - 1],
originalStationList[d][cache + 1],
d,
];
}
});
setPreStation(returnData[0]);
setNexStation(returnData[1]);
setLineName(returnData[2]);
};
return (
<View
style={{
height: 50,
backgroundColor: lineName
? lineColorList[lineName.split("[")[1].replace("]", "")]
: "red",
flexDirection: "row",
alignContent: "center",
alignItems: "center",
}}
>
<View style={styleSheet.下枠フレーム}>
{preStation ? (
<>
<Text style={styleSheet.下枠左右マーク}></Text>
{preStation.StationNumber ? (
<View style={styleSheet.下枠駅ナンバー}>
<View style={{ flex: 1 }} />
<Text
style={{
fontSize: parseInt("10%"),
color: "white",
}}
>
{preStation.StationNumber}
</Text>
<View style={{ flex: 1 }} />
</View>
) : (
<></>
)}
<StationName
stringData={preStation}
ss={{ flex: 1, alignItems: "flex-start" }}
/>
</>
) : (
<></>
)}
</View>
<Text
style={{
fontSize: parseInt("10%"),
color: "white",
textAlign: "center",
}}
>
{lineName &&
lineName
.split("(")
.map((d, index) => (index == 1 ? "(" + d : d))
.join("\n")}
</Text>
<View style={styleSheet.下枠フレーム}>
{nexStation ? (
<>
<StationName
stringData={nexStation}
ss={{ flex: 1, alignItems: "flex-end" }}
/>
{nexStation.StationNumber ? (
<View style={styleSheet.下枠駅ナンバー}>
<View style={{ flex: 1 }} />
<Text style={{ fontSize: parseInt("15%"), color: "white" }}>
{nexStation.StationNumber}
</Text>
<View style={{ flex: 1 }} />
</View>
) : (
<></>
)}
<Text style={styleSheet.下枠左右マーク}></Text>
</>
) : (
<></>
)}
</View>
</View>
);
};
const styleSheet = {
外枠: {
width: wp("80%"),
height: (wp("80%") / 20) * 9,
borderColor: "#2E94BB",
borderWidth: 1,
backgroundColor: "white",
},
下帯: {
position: "absolute",
bottom: "0%",
left: "0%",
width: "100%",
height: "30%",
backgroundColor: "#2E94BB",
},
JRStyle: {
position: "absolute",
top: "2%",
left: "2%",
fontWeight: "bold",
fontSize: parseInt("30%"),
color: "#2E94BB",
},
stationNameAreaOverWrap: {
position: "absolute",
top: "10%",
alignContent: "center",
flexDirection: "row",
},
Station_JP: {
fontWeight: "bold",
fontSize: parseInt("40%"),
color: "#005170",
},
Station_EN: {
fontWeight: "bold",
fontSize: parseInt("15%"),
color: "#005170",
},
下帯内容: {
position: "absolute",
bottom: "0%",
height: "30%",
width: "100%",
alignItems: "center",
flexDirection: "column",
},
下枠フレーム: {
flex: 1,
flexDirection: "row",
alignContent: "center",
height: wp("10%"),
},
下枠左右マーク: {
fontWeight: "bold",
fontSize: parseInt("20%"),
color: "white",
paddingHorizontal: 10,
textAlignVertical: "center",
},
下枠駅ナンバー: {
alignContent: "center",
alignItems: "center",
width: wp("8%"),
height: wp("8%"),
margin: wp("1%"),
borderColor: "white",
borderWidth: parseInt("2%"),
borderRadius: parseInt("100%"),
},
下枠駅名: {
fontWeight: "bold",
fontSize: parseInt("15%"),
color: "white",
flex: 1,
paddingHorizontal: 0,
marginVertical: 0,
textAlignVertical: "center",
},
};

111
components/FavoriteList.js Normal file
View File

@@ -0,0 +1,111 @@
import React, { Component, useRef, useState, useEffect } from "react";
import { View, Text, TouchableOpacity, ScrollView } from "react-native";
import { WebView } from "react-native-webview";
import { ListItem } from "native-base";
import Icon from "react-native-vector-icons/Entypo";
import StatusbarDetect from "../StatusbarDetect";
import { AS } from "../storageControl";
import { news } from "../config/newsUpdate";
import { getStationList, lineList } from "../lib/getStationList";
var Status = StatusbarDetect();
export default function FavoriteList({
navigation,
webview,
stationData,
favoriteStation,
setFavoriteStation,
}) {
const { navigate } = navigation;
return (
<View style={{ height: "100%", backgroundColor: "#0099CC" }}>
<Text
style={{
textAlign: "center",
fontSize: 25,
color: "white",
fontWeight: "bold",
paddingVertical: 10,
}}
>
位置情報クイック移動メニュー
</Text>
<ScrollView style={{ height: "100%", backgroundColor: "white" }}>
{favoriteStation
.filter((d) => d[0].StationMap)
.map((currentStation) => {
return (
<ListItem
onPress={() => {
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(currentStation[0]);
webview.current?.injectJavaScript(
`MoveDisplayStation('${lineName}_${currentStation[0].MyStation}_${currentStation[0].Station_JP}')`
);
navigate("Apps");
}}
>
<Text style={{ fontSize: 20, flex: 2 }}>
{currentStation
.map((d) => d.StationNumber)
.filter((d) => d !== null)
.join("/")}
</Text>
<Text style={{ fontSize: 20, flex: 3 }}>
{currentStation[0].Station_JP}
</Text>
<View
style={{
flex: 2,
flexDirection: "row",
alignContent: "center",
alignItems: "center",
}}
>
<View style={{ flex: 1 }} />
<Text style={{ fontSize: 20 }}>移動する</Text>
<Icon name="chevron-right" size={20} />
</View>
</ListItem>
);
})}
</ScrollView>
<Text
style={{
backgroundColor: "white",
borderWidth: 1,
borderStyle: "solid",
}}
>
お気に入り登録した駅のうち位置情報システムで移動可能な駅が表示されていますタップすることで位置情報システムの当該の駅に移動します
</Text>
<TouchableOpacity
style={{
padding: 10,
flexDirection: "row",
borderColor: "white",
borderWidth: 1,
margin: 10,
borderRadius: 5,
alignItems: "center",
}}
onPress={() => navigation.goBack()}
>
<View style={{ flex: 1 }} />
<Text style={{ fontSize: 25, fontWeight: "bold", color: "white" }}>
閉じる
</Text>
<View style={{ flex: 1 }} />
</TouchableOpacity>
</View>
);
}

View File

@@ -2,7 +2,7 @@ import React from "react";
import { View, Text, TouchableOpacity } from "react-native";
import { WebView } from "react-native-webview";
import StatusbarDetect from "../StatusbarDetect";
import AsyncStorage from "@react-native-async-storage/async-storage";
import { AS } from "../storageControl";
import { news } from "../config/newsUpdate";
var Status = StatusbarDetect();
export default function News(props) {
@@ -30,7 +30,7 @@ export default function News(props) {
alignItems: "center",
}}
onPress={() => {
AsyncStorage.setItem("status", news);
AS.setItem("status", news);
navigate("Apps");
}}
>

View File

@@ -2,7 +2,7 @@ import React, { useState, useEffect } from "react";
import { View, Text, TouchableOpacity } from "react-native";
import * as Updates from "expo-updates";
import StatusbarDetect from "../StatusbarDetect";
import AsyncStorage from "@react-native-async-storage/async-storage";
import { AS } from "../storageControl";
var Status = StatusbarDetect();
import { Switch } from "react-native-elements";
@@ -14,9 +14,9 @@ export default function Setting(props) {
const [mapSwitch, setMapSwitch] = useState(undefined);
const [stationMenu, setStationMenu] = useState(undefined);
useEffect(() => {
AsyncStorage.getItem("iconSwitch").then(setIconSetting);
AsyncStorage.getItem("mapSwitch").then(setMapSwitch);
AsyncStorage.getItem("stationSwitch").then(setStationMenu);
AS.getItem("iconSwitch").then(setIconSetting);
AS.getItem("mapSwitch").then(setMapSwitch);
AS.getItem("stationSwitch").then(setStationMenu);
}, []);
return (
<View style={{ height: "100%", backgroundColor: "#0099CC" }}>
@@ -102,7 +102,7 @@ export default function Setting(props) {
textAlignVertical: "center",
}}
>
内部バージョン: 4.4.2.3
内部バージョン: 4.5 beta-1
</Text>
<View style={{ flex: 1 }} />
</View>
@@ -134,9 +134,9 @@ export default function Setting(props) {
}}
onPress={() => {
Promise.all([
AsyncStorage.setItem("iconSwitch", iconSetting.toString()),
AsyncStorage.setItem("mapSwitch", mapSwitch.toString()),
AsyncStorage.setItem("stationSwitch", stationMenu.toString()),
AS.setItem("iconSwitch", iconSetting.toString()),
AS.setItem("mapSwitch", mapSwitch.toString()),
AS.setItem("stationSwitch", stationMenu.toString()),
]).then(() => {
Updates.reloadAsync();
});

View File

@@ -1,22 +1,11 @@
import React, { useState, useEffect, useRef } from "react";
import React, { useRef } from "react";
import { View, Text, TouchableOpacity, Linking } from "react-native";
import { WebView } from "react-native-webview";
import StatusbarDetect from "../StatusbarDetect";
import AsyncStorage from "@react-native-async-storage/async-storage";
import MapView, { Marker, Geojson, PROVIDER_GOOGLE } from "react-native-maps";
import {
FontAwesome,
Fontisto,
Foundation,
Ionicons,
MaterialCommunityIcons,
} from "@expo/vector-icons";
var Status = StatusbarDetect();
export default function trainMenu({
route: {
params: { webview, stationData },
},
import MapView, { Marker } from "react-native-maps";
import { MaterialCommunityIcons } from "@expo/vector-icons";
export default function TrainMenu({
navigation: { navigate },
webview,
stationData,
}) {
const mapRef = useRef();
return (
@@ -54,7 +43,6 @@ export default function trainMenu({
longitude: parseFloat(latlng[1]),
}}
onPress={() => {
console.log(stationData);
webview.current?.injectJavaScript(
`MoveDisplayStation('${d}_${D.MyStation}_${D.Station_JP}')`
);
@@ -78,12 +66,7 @@ export default function trainMenu({
backgroundColor={"#EA4752"}
icon="star"
flex={1}
onPressButton={() =>
/* Linking.openURL(
"https://www.jr-shikoku.co.jp/01_trainbus/jikoku/sp/#mainprice-box"
) */
alert("お気に入り駅登録機能は現在開発中です!レイアウト募集中!")
}
onPressButton={() => navigate("favoriteList")}
>
お気に入り
</UsefulBox>
@@ -110,10 +93,7 @@ export default function trainMenu({
borderRadius: 5,
alignItems: "center",
}}
onPress={() => {
AsyncStorage.setItem("status", "2022/04/14");
navigate("Apps");
}}
onPress={() => navigate("Apps")}
>
<View style={{ flex: 1 }} />
<Text style={{ fontSize: 25, fontWeight: "bold", color: "white" }}>

View File

@@ -1,20 +1,13 @@
import React, { Component, useRef, useState, useEffect } from "react";
import {
StatusBar,
View,
LayoutAnimation,
ScrollView,
Linking,
Text,
TouchableOpacity,
} from "react-native";
import React, { useState, useEffect } from "react";
import { View, Text, TouchableOpacity } from "react-native";
import { Switch } from "react-native-elements";
import {
widthPercentageToDP as wp,
heightPercentageToDP as hp,
} from "react-native-responsive-screen";
import { widthPercentageToDP as wp } from "react-native-responsive-screen";
import LottieView from "lottie-react-native";
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
import { customTrainDataDetector } from "../custom-train-data";
import { useInterval } from "../../lib/useInterval";
import trainList from "../../assets/originData/trainList";
import { objectIsEmpty } from "../../lib/objectIsEmpty";
let diagramData = undefined;
@@ -53,55 +46,88 @@ export default function LED_vision(props) {
referer: "https://train.jr-shikoku.co.jp/sp.html",
},
};
const [trainDiagram, setTrainDiagram] = useState(null);
const [stationDiagram, setStationDiagram] = useState(null);
const [currentTrain, setCurrentTrain] = useState(null);
const [trainDiagram, setTrainDiagram] = useState(null); // 全列車のダイヤを列番ベースで整理
const [stationDiagram, setStationDiagram] = useState({}); //当該駅の全時刻表
const [currentTrain, setCurrentTrain] = useState(null); //現在在線中の全列車
const [currentTrainLoading, setCurrentTrainLoading] = useState("loading");
const [finalSwitch, setFinalSwitch] = useState(false);
const [trainIDSwitch, setTrainIDSwitch] = useState(false);
const [trainDescriptionSwitch, setTrainDescriptionSwitch] = useState(false);
const parseAllTrainDiagram = (text) => {
const val = text.replace("[\r\n", "").split(",\r\n");
let trainDiagram = {};
val.forEach((element) => {
try {
let data = JSON.parse(element);
Object.keys(data).forEach((key) => (trainDiagram[key] = data[key]));
} catch (e) {}
});
return trainDiagram;
};
useEffect(() => {
//全列車リストを生成する副作用[無条件初回実行]
fetch(
"https://train.jr-shikoku.co.jp/g?arg1=station&arg2=traintimeinfo&arg3=dia",
HeaderConfig
)
.then((response) => response.text())
.then((d) => {
const val = d.replace("[\r\n", "").split(",\r\n");
let trainDiagram = {};
val.forEach((element) => {
try {
let data = JSON.parse(element);
Object.keys(data).forEach((key) => (trainDiagram[key] = data[key]));
} catch (e) {}
});
setTrainDiagram(trainDiagram);
return trainDiagram;
if (d.indexOf("<title>404 Not Found</title>") != -1) throw Error;
setTrainDiagram(parseAllTrainDiagram(d));
})
.then((trainDiagram) => {
let returnData = {};
if (!trainDiagram) {
setStationDiagram(returnData);
return;
}
Object.keys(trainDiagram).forEach((key) => {
if (trainDiagram[key].match(props.station.Station_JP)) {
returnData[key] = trainDiagram[key];
}
});
setStationDiagram(returnData);
.catch((d) => {
console.log("fallback");
setTrainDiagram(trainList);
});
}, []);
const getTime = () => {
const returnData = [];
Object.keys(stationDiagram).forEach((d) => {
useEffect(() => {
// 現在の駅に停車するダイヤを作成する副作用[列車ダイヤと現在駅情報]
if (!trainDiagram) {
setStationDiagram({});
return;
}
let returnData = {};
Object.keys(trainDiagram).forEach((key) => {
if (trainDiagram[key].match(props.station.Station_JP + ",")) {
returnData[key] = trainDiagram[key];
}
});
setStationDiagram(returnData);
}, [trainDiagram, props.station]);
const getCurrentTrain = () =>
fetch(
"https://train.jr-shikoku.co.jp/g?arg1=train&arg2=train",
HeaderConfig
)
.then((response) => response.json())
.then((d) =>
d.map((x) => ({ num: x.TrainNum, delay: x.delay, Pos: x.Pos }))
)
.then((d) => {
setCurrentTrain(d);
setCurrentTrainLoading("success");
})
.catch((e) => {
console.log("えらー");
setCurrentTrainLoading("error");
});
useEffect(getCurrentTrain, []); //初回だけ現在の全在線列車取得
useInterval(getCurrentTrain, 15000); //15秒毎に全在線列車取得
const getTime = (stationDiagram, station) => {
const returnData = Object.keys(stationDiagram).map((d) => {
let a = {};
stationDiagram[d].split("#").forEach((data) => {
if (data.match("着")) {
a.lastStation = data.split(",着,")[0];
}
if (data.match(props.station.Station_JP)) {
if (data.split(",")[0] === station.Station_JP) {
if (data.match(",発,")) {
a.time = data.split(",発,")[1];
} else {
@@ -110,9 +136,8 @@ export default function LED_vision(props) {
}
}
});
returnData.push({ train: d, time: a.time, lastStation: a.lastStation });
return { train: d, time: a.time, lastStation: a.lastStation };
});
return returnData.sort((a, b) => {
switch (true) {
case parseInt(a.time.split(":")[0]) < parseInt(b.time.split(":")[0]):
@@ -126,19 +151,15 @@ export default function LED_vision(props) {
}
});
};
const trainTimeAndNumber = stationDiagram != null ? getTime() : null;
const getCurrentTrain = () =>
fetch(
"https://train.jr-shikoku.co.jp/g?arg1=train&arg2=train",
HeaderConfig
)
.then((response) => response.json())
.then((d) => d.map((x) => ({ num: x.TrainNum, delay: x.delay })))
.then(setCurrentTrain);
useEffect(getCurrentTrain, []);
const [trainTimeAndNumber, setTrainTimeAndNumber] = useState(null);
useInterval(getCurrentTrain, 15000);
useEffect(() => {
//現在の駅に停車する列車から時刻を切り出してLEDベースにフォーマット
if (objectIsEmpty(stationDiagram)) return () => {};
const getTimeData = getTime(stationDiagram, props.station);
setTrainTimeAndNumber(getTimeData);
}, [stationDiagram]);
const timeFiltering = (d) => {
const date = new Date();
@@ -156,6 +177,17 @@ export default function LED_vision(props) {
return false;
};
const [selectedTrain, setSelectedTrain] = useState([]);
useEffect(() => {
if (!trainTimeAndNumber) return () => {};
if (!currentTrain) return () => {};
const data = trainTimeAndNumber
.filter((d) => currentTrain.map((m) => m.num).includes(d.train))
.filter(timeFiltering)
.filter((d) => !!finalSwitch || d.lastStation != "当駅止");
setSelectedTrain(data);
}, [trainTimeAndNumber, currentTrain, finalSwitch]);
return (
<View
style={{
@@ -166,206 +198,330 @@ export default function LED_vision(props) {
marginHorizontal: wp("1%"),
}}
>
<View
style={{
alignContent: "center",
alignItems: "center",
width: "100%",
marginVertical: 10,
flexDirection: "row",
}}
>
<View style={{ flex: 1 }}></View>
<View style={{}}>
<Text style={{ fontSize: 25, color: "white", fontWeight: "bold" }}>
次の列車
</Text>
<Text style={{ fontSize: 15, color: "white" }}>Next Train</Text>
</View>
<View style={{ flex: 1 }}></View>
</View>
{trainTimeAndNumber
? currentTrain &&
trainTimeAndNumber
.filter((d) => currentTrain.map((m) => m.num).includes(d.train))
.filter(timeFiltering)
.filter((d) => !!finalSwitch || d.lastStation != "当駅止")
.map((d, index) => {
const train = customTrainDataDetector(d.train);
return [
<View
style={{
alignContent: "center",
alignItems: "center",
width: "94%",
marginVertical: 5,
marginHorizontal: "3%",
backgroundColor: "#000",
flexDirection: "row",
}}
>
<View style={{ flex: 9 }}>
<Text
style={{
fontSize: train.trainName.length > 6 ? 15 : 20,
color: (() => {
switch (train.type) {
case "Rapid":
return "aqua";
case "LTDEXP":
return "red";
case "NightLTDEXP":
return "red";
case "Normal":
return "white";
}
})(),
fontWeight: "bold",
}}
>
{trainIDSwitch
? d.train
: (() => {
switch (train.type) {
case "Rapid":
return "快速";
case "LTDEXP":
return "特急";
case "NightLTDEXP":
return "寝台特急";
case "Normal":
return "普通列車";
}
})() +
" " +
train.trainName +
(train.trainNumDistance == undefined
? ""
: parseInt(
d.train.replace("M", "").replace("D", "")
) -
train.trainNumDistance +
"号")}
</Text>
</View>
<View style={{ flex: 4, flexDirection: "row" }}>
<Text
style={{
fontSize: d.lastStation.length > 4 ? 15 : 20,
color: "white",
fontWeight: "bold",
}}
>
{d.lastStation}
</Text>
</View>
<View style={{ flex: 3 }}>
<Text
style={{
fontSize: 20,
color: "white",
fontWeight: "bold",
}}
>
{d.time}
</Text>
</View>
<View style={{ flex: 4 }}>
<Text
style={{
fontSize: 20,
color: "white",
fontWeight: "bold",
}}
>
{(() => {
const delay = currentTrain.filter(
(a) => a.num == d.train
)[0].delay;
switch (true) {
case isNaN(delay):
return delay;
case delay == 0:
return "定刻通り";
default:
return delay + "分遅れ";
}
})()}
</Text>
</View>
</View>,
trainDescriptionSwitch && !!train.info && (
<View
style={{
alignContent: "center",
alignItems: "center",
width: "94%",
marginVertical: 5,
marginHorizontal: "3%",
backgroundColor: "#000",
flexDirection: "row",
}}
>
<View style={{ flex: 4 }}>
<Text
style={{
fontSize: 20,
color: "green",
fontWeight: "bold",
}}
>
{" "}
&gt; {train.info}
</Text>
</View>
</View>
),
];
})
: null}
<View style={{ flexDirection: "row", padding: 10 }}>
<Text
style={{
alignItems: "center",
alignContent: "center",
textAlign: "center",
textAlignVertical: "center",
color: "white",
}}
>
種別名 / 列番
</Text>
<Switch value={trainIDSwitch} onValueChange={setTrainIDSwitch} />
<View style={{ flex: 1 }} />
<Text
style={{
alignItems: "center",
alignContent: "center",
textAlign: "center",
textAlignVertical: "center",
color: "white",
}}
>
列車情報
</Text>
<Switch
value={trainDescriptionSwitch}
onValueChange={setTrainDescriptionSwitch}
<Header
currentTrainLoading={currentTrainLoading}
setCurrentTrainLoading={setCurrentTrainLoading}
getCurrentTrain={getCurrentTrain}
/>
{selectedTrain.map((d, index) => (
<EachData
d={d}
trainIDSwitch={trainIDSwitch}
trainDescriptionSwitch={trainDescriptionSwitch}
props={props}
currentTrain={currentTrain}
customTrainDataDetector={customTrainDataDetector}
navigate={props.navigate}
/>
<View style={{ flex: 1 }} />
<Text
style={{
alignItems: "center",
alignContent: "center",
textAlign: "center",
textAlignVertical: "center",
color: "white",
}}
>
当駅止表示
</Text>
<Switch value={finalSwitch} onValueChange={setFinalSwitch} />
</View>
))}
<Footer
trainIDSwitch={trainIDSwitch}
setTrainIDSwitch={setTrainIDSwitch}
trainDescriptionSwitch={trainDescriptionSwitch}
setTrainDescriptionSwitch={setTrainDescriptionSwitch}
finalSwitch={finalSwitch}
setFinalSwitch={setFinalSwitch}
/>
</View>
);
}
const Header = ({
currentTrainLoading,
setCurrentTrainLoading,
getCurrentTrain,
}) => (
<View
style={{
alignContent: "center",
alignItems: "center",
width: "100%",
marginVertical: 10,
flexDirection: "row",
}}
>
<View style={{ flex: 1 }}></View>
<View style={{}}>
<Text style={{ fontSize: 25, color: "white", fontWeight: "bold" }}>
次の列車
</Text>
<Text style={{ fontSize: 15, color: "white" }}>Next Train</Text>
</View>
<View style={{ flex: 1, flexDirection: "row-reverse" }}>
{currentTrainLoading == "loading" ? (
<LottieView
autoPlay
loop
style={{ width: 40, height: 40, marginRight: 30 }}
source={require("../../assets/51690-loading-diamonds.json")}
/>
) : currentTrainLoading == "error" ? (
<Ionicons
name="reload"
color="white"
size={30}
style={{ marginRight: 30 }}
onPress={() => {
setCurrentTrainLoading("loading");
getCurrentTrain();
}}
/>
) : null}
</View>
</View>
);
const Footer = ({
trainIDSwitch,
setTrainIDSwitch,
trainDescriptionSwitch,
setTrainDescriptionSwitch,
finalSwitch,
setFinalSwitch,
}) => {
return (
<View style={{ flexDirection: "row", padding: 10, alignItems: "center" }}>
<Text
style={{
alignItems: "center",
alignContent: "center",
textAlign: "center",
textAlignVertical: "center",
color: "white",
}}
>
種別名 / 列番
</Text>
<Switch value={trainIDSwitch} onValueChange={setTrainIDSwitch} />
<View style={{ flex: 1 }} />
<Text
style={{
alignItems: "center",
alignContent: "center",
textAlign: "center",
textAlignVertical: "center",
color: "white",
}}
>
列車情報
</Text>
<Switch
value={trainDescriptionSwitch}
onValueChange={setTrainDescriptionSwitch}
/>
<View style={{ flex: 1 }} />
<Text
style={{
alignItems: "center",
alignContent: "center",
textAlign: "center",
textAlignVertical: "center",
color: "white",
}}
>
当駅止表示
</Text>
<Switch value={finalSwitch} onValueChange={setFinalSwitch} />
</View>
);
};
const EachData = ({
d,
trainIDSwitch,
trainDescriptionSwitch,
props,
currentTrain,
customTrainDataDetector,
navigate,
}) => {
const getTrainType = (data) => {
switch (data) {
case "Rapid":
return { color: "aqua", name: "快速" };
case "LTDEXP":
return { color: "red", name: "特急" };
case "NightLTDEXP":
return { color: "red", name: "寝台特急" };
case "Normal":
return { color: "white", name: "普通列車" };
}
};
const [train, setTrain] = useState(customTrainDataDetector(d.train));
useEffect(() => {
setTrain(customTrainDataDetector(d.train));
}, [currentTrain, d.train, trainDescriptionSwitch]);
return (
<>
<TouchableOpacity
style={{
alignContent: "center",
alignItems: "center",
width: "94%",
marginVertical: 5,
marginHorizontal: "3%",
backgroundColor: "#000",
flexDirection: "row",
}}
onPress={() => {
if (train.type != "Normal") {
navigate("trainbase", {
info: "train.html?tn=" + d.train,
from: "LED",
});
}
}}
>
<TrainName
train={train}
trainIDSwitch={trainIDSwitch}
d={d}
getTrainType={getTrainType(train.type)}
/>
<LastStation d={d} />
<DependTime d={d} />
<StatusAndDelay
currentTrain={currentTrain}
d={d}
props={props}
trainDescriptionSwitch={trainDescriptionSwitch}
/>
</TouchableOpacity>
{trainDescriptionSwitch && !!train.info && <Description train={train} />}
</>
);
};
const TrainName = ({ train, trainIDSwitch, d, getTrainType }) => {
const { trainName, trainNumDistance } = train;
let TrainNumber = "";
if (trainNumDistance != undefined) {
const timeInfo =
parseInt(d.train.replace("M", "").replace("D", "")) - trainNumDistance;
TrainNumber = timeInfo + "号";
}
return (
<View style={{ flex: 9 }}>
<Text
style={{
fontSize: trainName.length > 6 ? parseInt("13%") : parseInt("18%"),
color: getTrainType.color,
fontWeight: "bold",
}}
>
{trainIDSwitch
? d.train
: `${getTrainType.name} ${trainName}${TrainNumber}`}
</Text>
</View>
);
};
const LastStation = ({ d }) => {
return (
<View style={{ flex: 4, flexDirection: "row" }}>
<Text
style={{
fontSize:
d.lastStation.length > 4 ? parseInt("13%") : parseInt("18%"),
color: "white",
fontWeight: "bold",
}}
>
{d.lastStation}
</Text>
</View>
);
};
const DependTime = ({ d }) => {
return (
<View style={{ flex: 3 }}>
<Text
style={{
fontSize: parseInt("18%"),
color: "white",
fontWeight: "bold",
}}
>
{d.time}
</Text>
</View>
);
};
const checkDuplicateTrainData = (currentTrainArray) => {
const notNyujoData = currentTrainArray.filter((d) => d.delay !== "入線");
if (currentTrainArray.length == 1) return currentTrainArray[0];
if (notNyujoData.length == 0) return currentTrainArray[0];
else return notNyujoData[0];
};
const StatusAndDelay = ({ currentTrain, d, props, trainDescriptionSwitch }) => {
const [status, setStatus] = useState("");
useEffect(() => {
const array = currentTrain.filter((a) => a.num == d.train);
const current = checkDuplicateTrainData(array);
// 土讃線複数存在対策
if (!current) return () => {};
const delay = current.delay;
switch (true) {
case delay === "入線":
if (current.Pos === props.station.Station_JP) {
setStatus("当駅始発");
break;
} else {
setStatus("発車前");
break;
}
case isNaN(delay):
setStatus(delay);
break;
case delay === 0:
setStatus("定刻通り");
break;
default:
setStatus(delay + "分遅れ");
break;
}
}, [currentTrain, d.train, trainDescriptionSwitch]);
return (
<View style={{ flex: 4 }}>
<Text
style={{
fontSize: parseInt("18%"),
color: "white",
fontWeight: "bold",
paddingLeft: 1,
}}
>
{status}
</Text>
</View>
);
};
const Description = ({ train }) => {
return (
<View
style={{
alignContent: "center",
alignItems: "center",
width: "94%",
marginVertical: 5,
marginHorizontal: "3%",
backgroundColor: "#000",
flexDirection: "row",
}}
>
<View style={{ flex: 4 }}>
<Text
style={{
fontSize: parseInt("18%"),
color: "green",
fontWeight: "bold",
}}
>
{" "}
&gt; {train.info}
</Text>
</View>
</View>
);
};

View File

@@ -12,21 +12,68 @@ import {
widthPercentageToDP as wp,
heightPercentageToDP as hp,
} from "react-native-responsive-screen";
import LottieView from "lottie-react-native";
import { useInterval } from "../../lib/useInterval";
import { AS } from "../../storageControl";
export default function Sign(props) {
const { currentStation, originalStationList, oP } = props;
const {
currentStation,
originalStationList,
oP,
favoriteStation,
setFavoriteStation,
} = props;
const [nexPrePosition, setNexPrePosition] = useState(0);
const [preStation, setPreStation] = useState();
const [nexStation, setNexStation] = useState();
const [testButtonStatus, setTestButtonStatus] = useState(false);
useEffect(() => {
const isFavorite = favoriteStation.filter((d) => {
const compare = JSON.stringify(d);
const current = JSON.stringify(currentStation);
if (compare === current) {
return true;
} else {
return false;
}
});
setTestButtonStatus(isFavorite.length != 0);
}, [favoriteStation, currentStation]);
useInterval(() => {
if (currentStation.length == 1) {
setNexPrePosition(0);
return () => {};
}
LayoutAnimation.easeInEaseOut();
setNexPrePosition(
nexPrePosition + 1 == currentStation.length ? 0 : nexPrePosition + 1
);
}, 2000);
useEffect(() => {
setNexPrePosition(0);
getPreNextStation(currentStation[0]);
}, [currentStation]);
useEffect(() => {
if (!currentStation[nexPrePosition]) return () => {};
getPreNextStation(currentStation[nexPrePosition]);
}, [nexPrePosition]);
const getPreNextStation = (now) => {
const lineList = [
"予讃線",
"松宇線",
"伊予灘線",
"土讃線",
"窪川線",
"高徳線",
"徳島線",
"鳴門線",
"瀬戸大橋線",
"予讃線(高松-松山間)[Y]",
"予讃線(松山-宇和島間)[U]",
"予讃線/愛ある伊予灘線(向井原-伊予大洲間)[S]",
"土讃線(多度津-高知間)[D]",
"土讃線(高知-窪川間)[K]",
"高徳線(高松-徳島間)[T]",
"徳島線(徳島-阿波池田)[B]",
"鳴門線(池谷-鳴門間)[N]",
"瀬戸大橋線(宇多津-児島間)[M]",
];
let returnData;
lineList.forEach((d) => {
@@ -40,101 +87,163 @@ export default function Sign(props) {
];
}
});
return returnData;
setPreStation(returnData[0]);
setNexStation(returnData[1]);
};
const [nexPrePosition, setNexPrePosition] = useState(0);
useInterval(() => {
if (currentStation.length == 1) return;
LayoutAnimation.easeInEaseOut();
setNexPrePosition(
nexPrePosition + 1 == currentStation.length ? 0 : nexPrePosition + 1
);
}, 2000);
const lottieRef = useRef();
return (
<TouchableOpacity style={styleSheet.外枠} onPress={oP}>
<StationNumberMaker currentStation={currentStation} />
<StationNameArea currentStation={currentStation} />
<TouchableOpacity
style={{ position: "absolute", right: -15, top: -20 }}
onPress={() => {
if (testButtonStatus) {
const otherData = favoriteStation.filter((d) => {
const compare = JSON.stringify(d);
const current = JSON.stringify(currentStation);
if (compare !== current) {
return true;
} else {
return false;
}
});
AS.setItem("favoriteStation", JSON.stringify(otherData));
setFavoriteStation(otherData);
} else {
let ret = favoriteStation;
ret.push(currentStation);
AS.setItem("favoriteStation", JSON.stringify(ret));
setFavoriteStation(ret);
}
setTestButtonStatus(!testButtonStatus);
}}
>
<LottieDelayView
progress={testButtonStatus ? 1 : 0}
speed={1.4}
style={{ width: 80, height: 80 }}
source={require("../../assets/939-star.json")}
lottieRef={lottieRef}
loop={false}
/>
</TouchableOpacity>
<Text style={styleSheet.JRStyle}>JR</Text>
<View style={styleSheet.下帯} />
<View style={styleSheet.下帯内容}>
{(() => {
let [preStation, nexStation] = getPreNextStation(
currentStation[nexPrePosition]
);
return (
<View style={styleSheet.下枠フレーム}>
<View style={styleSheet.下枠フレーム}>
{preStation && (
<>
<Text style={styleSheet.下枠左右マーク}></Text>
{preStation.StationNumber && (
<View style={styleSheet.下枠駅ナンバー}>
<View style={{ flex: 1 }} />
<Text
style={{
fontSize: parseInt("10%"),
color: "white",
}}
>
{preStation.StationNumber}
</Text>
<View style={{ flex: 1 }} />
</View>
)}
<StationName
stringData={preStation}
ss={{ flex: 1, alignItems: "flex-start" }}
/>
</>
)}
</View>
<View style={styleSheet.下枠フレーム}>
{nexStation && (
<>
<StationName
stringData={nexStation}
ss={{ flex: 1, alignItems: "flex-end" }}
/>
{nexStation.StationNumber && (
<View style={styleSheet.下枠駅ナンバー}>
<View style={{ flex: 1 }} />
<Text
style={{ fontSize: parseInt("10%"), color: "white" }}
>
{nexStation.StationNumber}
</Text>
<View style={{ flex: 1 }} />
</View>
)}
<Text style={styleSheet.下枠左右マーク}></Text>
</>
)}
</View>
</View>
);
})()}
<NexPreStationLine preStation={preStation} nexStation={nexStation} />
</View>
</TouchableOpacity>
);
}
const LottieDelayView = ({
progress,
speed,
style,
source,
lottieRef,
loop,
}) => {
const [progressState, setProgressState] = useState(undefined);
useEffect(() => {
if (progress == 0) {
lottieRef.current.play(progressState !== undefined ? 35 : 7, 7);
} else {
lottieRef.current.play(progressState !== undefined ? 7 : 35, 35);
}
}, [progress]);
return (
<LottieView
progress={progressState}
speed={speed}
style={style}
source={source}
ref={lottieRef}
loop={loop}
onAnimationFinish={(isCanceled) => {
setProgressState(progress);
}}
/>
);
};
const NexPreStationLine = ({ nexStation, preStation }) => {
return (
<View style={styleSheet.下枠フレーム}>
<View style={styleSheet.下枠フレーム}>
{preStation ? (
<>
<Text style={styleSheet.下枠左右マーク}></Text>
{preStation.StationNumber ? (
<View style={styleSheet.下枠駅ナンバー}>
<View style={{ flex: 1 }} />
<Text
style={{
fontSize: parseInt("10%"),
color: "white",
}}
>
{preStation.StationNumber}
</Text>
<View style={{ flex: 1 }} />
</View>
) : (
<></>
)}
<StationName
stringData={preStation}
ss={{ flex: 1, alignItems: "flex-start" }}
/>
</>
) : (
<></>
)}
</View>
<View style={styleSheet.下枠フレーム}>
{nexStation ? (
<>
<StationName
stringData={nexStation}
ss={{ flex: 1, alignItems: "flex-end" }}
/>
{nexStation.StationNumber ? (
<View style={styleSheet.下枠駅ナンバー}>
<View style={{ flex: 1 }} />
<Text style={{ fontSize: parseInt("10%"), color: "white" }}>
{nexStation.StationNumber}
</Text>
<View style={{ flex: 1 }} />
</View>
) : (
<></>
)}
<Text style={styleSheet.下枠左右マーク}></Text>
</>
) : (
<></>
)}
</View>
</View>
);
};
const StationNumberMaker = (props) => {
const getTop = (array, index) => {
if (array.length == 1) return 20;
else if (index == 0) return 5;
else if (index == 1) return 35;
else return 20;
};
return props.currentStation
.filter((d) => (d.StationNumber ? true : false))
.map((d, index, array) => (
<View
key={d + index}
style={{
position: "absolute",
alignContent: "center",
alignItems: "center",
top:
(() => {
if (array.length == 1) return 20;
else if (index == 0) return 5;
else if (index == 1) return 35;
else return 20;
})() + "%",
top: getTop(array, index) + "%",
right: "10%",
width: wp("10%"),
height: wp("10%"),
@@ -185,8 +294,7 @@ const styleSheet = {
height: (wp("80%") / 20) * 9,
borderColor: "#2E94BB",
borderWidth: 1,
margin: 10,
marginHorizontal: wp("10%"),
backgroundColor: "white",
},
下帯: {
position: "absolute",
@@ -232,6 +340,7 @@ const styleSheet = {
flex: 1,
flexDirection: "row",
alignContent: "center",
alignItems: "center",
},
下枠左右マーク: {
fontWeight: "bold",

View File

@@ -15,6 +15,12 @@
},
"production": {
"releaseChannel": "aliexpress"
},
"beta4.5": {
"releaseChannel": "base"
},
"production4.5": {
"releaseChannel": "buyma"
}
},
"submit": {

View File

@@ -3,23 +3,12 @@ import React, { Component } from "react";
import { StatusBar, View, TouchableOpacity, Text } from "react-native";
import { WebView } from "react-native-webview";
export default ({ navigation: { navigate } }) => (
<View style={{ height: "100%", backgroundColor: "#0099CC" }}>
<View style={styles.View}>
<WebView
useWebKit={true}
useWebKit
source={{ uri: "https://train.jr-shikoku.co.jp/usage.htm" }}
/>
<TouchableOpacity
style={{
padding: 10,
flexDirection: "row",
borderColor: "white",
borderWidth: 1,
margin: 10,
borderRadius: 5,
alignItems: "center",
}}
onPress={() => navigate("Apps")}
>
<TouchableOpacity style={styles.touch} onPress={() => navigate("Apps")}>
<View style={{ flex: 1 }} />
<Text style={{ fontSize: 25, fontWeight: "bold", color: "white" }}>
閉じる
@@ -28,3 +17,15 @@ export default ({ navigation: { navigate } }) => (
</TouchableOpacity>
</View>
);
const styles = {
View: { height: "100%", backgroundColor: "#0099CC" },
touch: {
padding: 10,
flexDirection: "row",
borderColor: "white",
borderWidth: 1,
margin: 10,
borderRadius: 5,
alignItems: "center",
},
};

View File

@@ -18,6 +18,18 @@ import train_lang from "../assets/originData/train_lang";
let status = undefined;
export const lineList = [
"予讃線(高松-松山間)[Y]",
"予讃線(松山-宇和島間)[U]",
"予讃線/愛ある伊予灘線(向井原-伊予大洲間)[S]",
"土讃線(多度津-高知間)[D]",
"土讃線(高知-窪川間)[K]",
"高徳線(高松-徳島間)[T]",
"徳島線(徳島-阿波池田)[B]",
"鳴門線(池谷-鳴門間)[N]",
"瀬戸大橋線(宇多津-児島間)[M]",
];
export const getStationList = async (props) => {
if (status) return status;
//駅リストイニシャライズ
@@ -41,15 +53,15 @@ export const getStationList = async (props) => {
]).then((values) => {
let stationList = {};
[
stationList.予讃線,
stationList.松宇線,
stationList.伊予灘線,
stationList.土讃線,
stationList.窪川線,
stationList.高徳線,
stationList.徳島線,
stationList.鳴門線,
stationList.瀬戸大橋線,
stationList["予讃線(高松-松山間)[Y]"],
stationList["予讃線(松山-宇和島間)[U]"],
stationList["予讃線/愛ある伊予灘線(向井原-伊予大洲間)[S]"],
stationList["土讃線(多度津-高知間)[D]"],
stationList["土讃線(高知-窪川間)[K]"],
stationList["高徳線(高松-徳島間)[T]"],
stationList["徳島線(徳島-阿波池田)[B]"],
stationList["鳴門線(池谷-鳴門間)[N]"],
stationList["瀬戸大橋線(宇多津-児島間)[M]"],
stationList.駅間リスト,
stationList.日英対応表,
] = values;
@@ -103,52 +115,55 @@ export const getStationList = async (props) => {
return data;
});
};
stationList.予讃線 = addStationPosition(
concatBetweenStations(stationList.予讃線),
stationList["予讃線(高松-松山間)[Y]"] = addStationPosition(
concatBetweenStations(stationList["予讃線(高松-松山間)[Y]"]),
予讃線,
stationList.日英対応表
);
stationList.松宇線 = addStationPosition(
concatBetweenStations(stationList.松宇線),
stationList["予讃線(松山-宇和島間)[U]"] = addStationPosition(
concatBetweenStations(stationList["予讃線(松山-宇和島間)[U]"]),
予讃線,
stationList.日英対応表
);
stationList.伊予灘線 = addStationPosition(
concatBetweenStations(stationList.伊予灘線),
予讃線,
stationList.日英対応表
);
stationList.土讃線 = addStationPosition(
concatBetweenStations(stationList.土讃線),
stationList["予讃線/愛ある伊予灘線(向井原-伊予大洲間)[S]"] =
addStationPosition(
concatBetweenStations(
stationList["予讃線/愛ある伊予灘線(向井原-伊予大洲間)[S]"]
),
予讃線,
stationList.日英対応表
);
stationList["土讃線(多度津-高知間)[D]"] = addStationPosition(
concatBetweenStations(stationList["土讃線(多度津-高知間)[D]"]),
土讃線,
stationList.日英対応表
);
stationList.窪川線 = addStationPosition(
concatBetweenStations(stationList.窪川線),
stationList["土讃線(高知-窪川間)[K]"] = addStationPosition(
concatBetweenStations(stationList["土讃線(高知-窪川間)[K]"]),
土讃線,
stationList.日英対応表
);
stationList.高徳線 = addStationPosition(
concatBetweenStations(stationList.高徳線),
stationList["高徳線(高松-徳島間)[T]"] = addStationPosition(
concatBetweenStations(stationList["高徳線(高松-徳島間)[T]"]),
高徳線,
stationList.日英対応表
);
stationList.鳴門線 = addStationPosition(
concatBetweenStations(stationList.鳴門線),
stationList["鳴門線(池谷-鳴門間)[N]"] = addStationPosition(
concatBetweenStations(stationList["鳴門線(池谷-鳴門間)[N]"]),
鳴門線,
stationList.日英対応表
);
const tokushimaCurrent = addStationPosition(
concatBetweenStations(stationList.徳島線),
concatBetweenStations(stationList["徳島線(徳島-阿波池田)[B]"]),
徳島線,
stationList.日英対応表
);
stationList.徳島線 = [
stationList["徳島線(徳島-阿波池田)[B]"] = [
tokushimaCurrent[tokushimaCurrent.length - 1],
...tokushimaCurrent,
];
stationList.徳島線.pop();
stationList.瀬戸大橋線 = [
stationList["徳島線(徳島-阿波池田)[B]"].pop();
stationList["瀬戸大橋線(宇多津-児島間)[M]"] = [
{
Station_JP: "坂出",
Station_EN: "Sakaide",

3
lib/objectIsEmpty.js Normal file
View File

@@ -0,0 +1,3 @@
export const objectIsEmpty = (obj) => {
return !Object.keys(obj).length;
};

View File

@@ -109,7 +109,7 @@ case "1017M":
case "1025M":
case "1027M":
case "1029M":
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/s8000no.png');
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/f/s8000nr.png');
break;
//8000 アンパン
@@ -135,7 +135,7 @@ case "1023M":
//MEXP
//8000
case "1092M":
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/s8000no.png');
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/s8000nr.png');
break;
//8600
case "1091M":

1107
menu.js

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,7 @@
import React, { Component } from "react";
import { StatusBar, View, Linking, Platform, Text } from "react-native";
import React from "react";
import { View, Platform } from "react-native";
import { WebView } from "react-native-webview";
import Constants from "expo-constants";
import { TouchableOpacity } from "react-native-gesture-handler";
export default function tndView() {
return (
<View

12485
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -8,42 +8,43 @@
},
"dependencies": {
"@expo/vector-icons": "^13.0.0",
"@react-native-async-storage/async-storage": "~1.17.3",
"@react-native-async-storage/async-storage": "1.17.11",
"@react-native-community/masked-view": "0.1.10",
"@react-navigation/bottom-tabs": "^5.11.11",
"@react-navigation/native": "^5.9.4",
"@react-navigation/stack": "^5.14.5",
"expo": "^45.0.0",
"expo-font": "~10.1.0",
"expo-location": "~14.2.2",
"expo-updates": "~0.13.4",
"expo-web-browser": "~10.2.1",
"expo": "^48.0.0",
"expo-font": "~11.1.1",
"expo-location": "~15.1.1",
"expo-updates": "~0.16.3",
"expo-web-browser": "~12.1.1",
"firebase": "8.2.3",
"lottie-react-native": "5.0.1",
"lottie-react-native": "5.1.4",
"native-base": "^2.15.2",
"npm": "^7.18.1",
"pushy-react-native": "^1.0.18",
"react": "17.0.2",
"react-native": "0.68.2",
"react": "18.2.0",
"react-native": "0.71.3",
"react-native-actions-sheet": "^0.4.9",
"react-native-auto-height-image": "^3.2.4",
"react-native-elements": "^3.4.2",
"react-native-gesture-handler": "~2.2.1",
"react-native-maps": "0.30.2",
"react-native-reanimated": "~2.8.0",
"react-native-gesture-handler": "~2.9.0",
"react-native-maps": "1.3.2",
"react-native-reanimated": "~2.14.4",
"react-native-remote-svg": "^2.0.6",
"react-native-responsive-screen": "^1.4.2",
"react-native-router-flux": "^4.3.1",
"react-native-safe-area-context": "4.2.4",
"react-native-screens": "~3.11.1",
"react-native-safe-area-context": "4.5.0",
"react-native-screens": "~3.20.0",
"react-native-snap-carousel": "^3.9.1",
"react-native-storage": "^1.0.1",
"react-native-svg": "12.3.0",
"react-native-svg": "13.4.0",
"react-native-svg-uri": "^1.2.3",
"react-native-vector-icons": "^8.1.0",
"react-native-webview": "11.18.1"
"react-native-webview": "11.26.0"
},
"devDependencies": {
"babel-preset-expo": "~9.1.0"
"babel-preset-expo": "^9.3.0"
},
"private": true
}

27
storageConfig.js Normal file
View File

@@ -0,0 +1,27 @@
import Storage from "react-native-storage";
import AsyncStorage from "@react-native-async-storage/async-storage";
const storage = new Storage({
// maximum capacity, default 1000 key-ids
size: 10000,
// Use AsyncStorage for RN apps, or window.localStorage for web apps.
// If storageBackend is not set, data will be lost after reload.
storageBackend: AsyncStorage, // for web: window.localStorage
// expire time, default: 1 day (1000 * 3600 * 24 milliseconds).
// can be null, which means never expire.
defaultExpires: null,
// cache data in the memory. default is true.
enableCache: true,
// if data was not found in storage or expired data was found,
// the corresponding sync method will be invoked returning
// the latest data.
sync: {
// we'll talk about the details later.
},
});
export default storage;

14
storageControl.js Normal file
View File

@@ -0,0 +1,14 @@
import storage from "./storageConfig.js";
export const AS = {
getItem: (key) => storage.load({ key }),
setItem: (key, data) =>
storage.save({
key, // Note: Do not use underscore("_") in key!
data,
// if expires not specified, the defaultExpires will be applied instead.
// if set to null, then it will never expire.
expires: null,
}),
};

View File

@@ -1,9 +1,17 @@
import React, { Component, useRef } from "react";
import { StatusBar, Platform, View } from "react-native";
import {
StatusBar,
Platform,
View,
TouchableOpacity,
Text,
} from "react-native";
import { WebView } from "react-native-webview";
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
export default function TrainBase({ route }) {
const { info } = route.params;
export default function TrainBase({ route, navigation }) {
const { info, from } = route.params;
const { navigate } = navigation;
const webview = useRef();
const jss = `document.getElementById('Footer').style.display = 'none';
${
@@ -28,6 +36,27 @@ export default function TrainBase({ route }) {
setSupportMultipleWindows={false}
onMessage={(event) => {}}
/>
{from == "LED" && (
<TouchableOpacity
style={{
padding: 10,
flexDirection: "row",
borderColor: "black",
borderWidth: 1,
margin: 10,
borderRadius: 5,
alignItems: "center",
}}
onPress={() => navigate("menu")}
>
<View style={{ flex: 1 }} />
<MaterialCommunityIcons name="close" color="black" size={30} />
<Text style={{ fontSize: 25, fontWeight: "bold", color: "black" }}>
閉じる
</Text>
<View style={{ flex: 1 }} />
</TouchableOpacity>
)}
</View>
);
}

6831
yarn.lock

File diff suppressed because it is too large Load Diff