diff --git a/.gitignore b/.gitignore
index 0fc43c5..2e856bf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,4 +5,6 @@ npm-debug.*
*.p12
*.key
*.mobileprovision
-dist/
\ No newline at end of file
+dist/
+# Local Netlify folder
+.netlify
diff --git a/Top.js b/Top.js
index f57bbb5..4ef5452 100644
--- a/Top.js
+++ b/Top.js
@@ -12,6 +12,7 @@ import { useCurrentTrain } from "./stateBox/useCurrentTrain";
import { useTrainMenu } from "./stateBox/useTrainMenu";
import { AS } from "./storageControl";
import { news } from "./config/newsUpdate";
+import { Linking, Platform } from "react-native";
const Stack = createStackNavigator();
export const Top = () => {
const { webview } = useCurrentTrain();
@@ -29,6 +30,14 @@ export const Top = () => {
}, []);
const goToTrainMenu = () => {
+ if (Platform.OS === "web") {
+ Linking.openURL("https://train.jr-shikoku.co.jp/");
+ setTimeout(() => {
+ navigate("topMenu", { screen: "menu" });
+ }, 100);
+
+ return;
+ }
if (!isFocused()) {
navigate("positions", { screen: "Apps" });
}
diff --git a/UpdateAsync.ts b/UpdateAsync.ts
index 8d93c3a..be8b320 100644
--- a/UpdateAsync.ts
+++ b/UpdateAsync.ts
@@ -5,7 +5,7 @@ export const UpdateAsync = () => {
Updates.checkForUpdateAsync()
.then((update) => {
if (!update.isAvailable) return;
- if (Platform.OS == "ios") {
+ if (Platform.OS !== "android") {
alert("アプリのデータを更新しています。");
} else {
ToastAndroid.showWithGravityAndOffset(
@@ -20,7 +20,7 @@ export const UpdateAsync = () => {
return;
})
.catch((e) => {
- Platform.OS == "ios"
+ Platform.OS != "android"
? alert(e.toString())
: ToastAndroid.showWithGravityAndOffset(
e.toString(),
diff --git a/app.json b/app.json
index 56b6d94..f2aeff5 100644
--- a/app.json
+++ b/app.json
@@ -2,7 +2,7 @@
"expo": {
"name": "JR四国非公式",
"slug": "jrshikoku",
- "platforms": ["ios", "android"],
+ "platforms": ["ios", "android","web"],
"version": "6.0",
"orientation": "default",
"icon": "./assets/icons/s8600.png",
diff --git a/components/Settings/settings.js b/components/Settings/settings.js
index 70be4cf..6abe238 100644
--- a/components/Settings/settings.js
+++ b/components/Settings/settings.js
@@ -8,10 +8,11 @@ import {
Image,
useWindowDimensions,
ToastAndroid,
+ Platform
} from "react-native";
import { createStackNavigator } from "@react-navigation/stack";
import { TransitionPresets } from "@react-navigation/stack";
-import * as ExpoFelicaReader from "../../modules/expo-felica-reader/src";
+//import * as ExpoFelicaReader from "../../modules/expo-felica-reader/src";
import * as Updates from "expo-updates";
import StatusbarDetect from "../../StatusbarDetect";
import { AS } from "../../storageControl";
@@ -49,8 +50,8 @@ export default function Setting(props) {
AS.getItem("startPage").then(setStartPage);
}, []);
const testNFC = async () => {
- const result = await ExpoFelicaReader.scan();
- alert(result);
+ //const result = await ExpoFelicaReader.scan();
+ //alert(result);
};
const updateAndReload = () => {
Promise.all([
@@ -137,7 +138,7 @@ export default function Setting(props) {
/>
)}
-
{(props) => }
-
+ }
{
+ const stationPinData = [];
+ Object.keys(stationData).forEach((d, indexBase) => {
+ stationData[d].forEach((D, index) => {
+ if (!D.StationMap) return null;
+ if (selectedLine && selectedLine != d) return;
+ const latlng = D.StationMap.replace(
+ "https://www.google.co.jp/maps/place/",
+ ""
+ ).split(",");
+ if (latlng.length == 0) return null;
+ stationPinData.push({ D, d, latlng, indexBase: 0, index });
+ });
+ });
+ setStationPin(stationPinData);
+ }, [stationData, selectedLine]);
+ useLayoutEffect(() => {
+ mapRef.current.fitToCoordinates(
+ stationPin.map(({ latlng }) => ({
+ latitude: parseFloat(latlng[0]),
+ longitude: parseFloat(latlng[1]),
+ })),
+ { edgePadding: { top: 80, bottom: 120, left: 50, right: 50 } } // Add margin values here
+ );
+ }, [stationPin]);
+ return (
+
+
+ {stationPin.map(({ D, d, latlng, indexBase, index }) => (
+
+ ))}
+
+
+
+ SheetManager.show("TrainMenuLineSelector")}
+ >
+
+ ▲ ここを押して路線をフィルタリングできます ▲
+
+
+ {selectedLine
+ ? lineListPair[stationIDPair[selectedLine]]
+ : "JR四国 対象全駅"}
+
+
+
+ 路線記号からフィルタリング
+
+ {Object.keys(stationData).map((d) => (
+ {
+ const s = selectedLine == d ? undefined : d;
+ if(!s) return;
+ setSelectedLine(s);
+ Object.keys(stationData).forEach((data, indexBase) => {
+ stationData[data].forEach((D, index) => {
+ if (!D.StationMap) return null;
+ if (s && s != data) return;
+ const latlng = D.StationMap.replace(
+ "https://www.google.co.jp/maps/place/",
+ ""
+ ).split(",");
+ if (latlng.length == 0) return null;
+ if (index == 0 && stationPin.length > 0) {
+ webview.current
+ ?.injectJavaScript(`MoveDisplayStation('${data}_${D.MyStation}_${D.Station_JP}');
+ document.getElementById("disp").insertAdjacentHTML("afterbegin", "");`);
+ }
+ });
+ });
+ }}
+ >
+
+ {stationIDPair[d]}
+
+
+ ))}
+
+
+ {navigate && (
+
+
+ navigate("howto", {
+ info: "https://train.jr-shikoku.co.jp/usage.htm",
+ })
+ }
+ >
+ 使い方
+
+ navigate("favoriteList")}
+ >
+ お気に入り
+
+
+ Linking.openURL(
+ "https://nexcloud.haruk.in/apps/forms/ZRHjWFF7znr5Xjr2"
+ )
+ }
+ >
+ フィードバック
+
+
+ )}
+ {
+ goBack();
+ webview.current?.injectJavaScript(injectJavaScript);
+ }}
+ top={0}
+ mapSwitch={"flex"}
+ />
+
+ );
+}
diff --git a/components/trainbaseview.js b/components/trainbaseview.js
index 4d46a4b..ca62447 100644
--- a/components/trainbaseview.js
+++ b/components/trainbaseview.js
@@ -6,6 +6,9 @@ import { useNavigation } from "@react-navigation/native";
import { BigButton } from "./atom/BigButton";
export default function TrainBase({ route }) {
+ if (!route.params) {
+ return null;
+ }
const { info } = route.params;
const { goBack } = useNavigation();
const jss = `
diff --git a/howto.js b/howto.js
index 565dca6..ec21ff8 100644
--- a/howto.js
+++ b/howto.js
@@ -4,6 +4,9 @@ import { WebView } from "react-native-webview";
import { BigButton } from "./components/atom/BigButton";
import { useNavigation } from "@react-navigation/native";
export default ({ navigation: { navigate }, route }) => {
+ if (!route.params) {
+ return null
+ }
const { info, goTo, useShow } = route.params;
const { goBack } = useNavigation();
const onExit = () => {
diff --git a/index.js b/index.js
index 9f717eb..3cbdf21 100644
--- a/index.js
+++ b/index.js
@@ -1,3 +1,4 @@
+import 'babel-polyfill';
import { registerRootComponent } from "expo";
import { registerWidgetTaskHandler } from "react-native-android-widget";
@@ -8,4 +9,6 @@ import { widgetTaskHandler } from "./components/AndroidWidget/widget-task-handle
// It also ensures that whether you load the app in Expo Go or in a native build,
// the environment is set up appropriately
registerRootComponent(App);
-registerWidgetTaskHandler(widgetTaskHandler);
+if (Platform.OS === "android") {
+ registerWidgetTaskHandler(widgetTaskHandler);
+}
diff --git a/menu.js b/menu.js
index 6560ba0..6a7a888 100644
--- a/menu.js
+++ b/menu.js
@@ -46,6 +46,7 @@ export default function Menu({ getCurrentTrain }) {
//位置情報
const [locationStatus, setLocationStatus] = useState(null);
useEffect(() => {
+ if (Platform.OS == "web") return;
Location.requestForegroundPermissionsAsync().then((data) => {
setLocationStatus(
Platform.OS == "ios"
diff --git a/ndView.tsx b/ndView.tsx
index fc579d0..ef2d1ad 100644
--- a/ndView.tsx
+++ b/ndView.tsx
@@ -1,10 +1,12 @@
-import React, { Ref, useRef, useState } from "react";
-import { View, Platform, TouchableOpacity, StyleProp, ViewStyle } from "react-native";
+import React, { Ref, useRef, useState,useEffect } from "react";
+import { View, Platform, TouchableOpacity, StyleProp, ViewStyle,Linking } from "react-native";
import { WebView } from "react-native-webview";
import Constants from "expo-constants";
import { Ionicons } from "@expo/vector-icons";
+import { useNavigation } from "@react-navigation/native";
export default function tndView() {
const webview = useRef(null);
+ const { navigate, addListener, isFocused } = useNavigation();
const jsa = `
document.querySelector('.sitettl').style.display = 'none';
document.querySelector('.attention').style.display = 'none';
@@ -84,6 +86,23 @@ setInterval(() => {
});
}, 1000);
`;
+ const goToTrainMenu = () =>{
+ if (Platform.OS === "web") {
+ Linking.openURL("https://www.jr-shikoku.co.jp/info/");
+ setTimeout(() => {
+ // @ts-ignore
+ navigate("topMenu", { screen: "menu" });
+ }, 100);
+
+ return;
+ }
+ }
+ useEffect(() => {
+ // @ts-ignore
+ const unsubscribe = addListener("tabPress", goToTrainMenu);
+ return unsubscribe;
+ }, [addListener]);
+
return (