diff --git a/app.json b/app.json index 2833d11..c30ea2f 100644 --- a/app.json +++ b/app.json @@ -7,7 +7,7 @@ "android", "web" ], - "version": "6.0", + "version": "6.0.1", "orientation": "default", "icon": "./assets/icons/s8600.png", "splash": { @@ -22,7 +22,7 @@ "**/*" ], "ios": { - "buildNumber": "46", + "buildNumber": "47", "supportsTablet": false, "bundleIdentifier": "jrshikokuinfo.xprocess.hrkn", "config": { @@ -44,7 +44,7 @@ }, "android": { "package": "jrshikokuinfo.xprocess.hrkn", - "versionCode": 27, + "versionCode": 28, "permissions": [ "ACCESS_FINE_LOCATION", "NFC", @@ -300,7 +300,7 @@ } }, { - "name": "s7200", + "name": "7200", "ios": "./assets/icons/s7200.png", "android": { "foregroundImage": "./assets/icons/s7200.png", diff --git a/components/FavoriteList.js b/components/FavoriteList.tsx similarity index 97% rename from components/FavoriteList.js rename to components/FavoriteList.tsx index 40ac5cf..814da0f 100644 --- a/components/FavoriteList.js +++ b/components/FavoriteList.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from "react"; +import React, { FC, useEffect } from "react"; import { View, Text, ScrollView } from "react-native"; import Icon from "react-native-vector-icons/Entypo"; @@ -8,7 +8,7 @@ import { useNavigation } from "@react-navigation/native"; import { useTrainMenu } from "../stateBox/useTrainMenu"; import { FavoriteListItem } from "./atom/FavoriteListItem"; import { BigButton } from "./atom/BigButton"; -export default function FavoriteList() { +export const FavoriteList: FC = () => { const { favoriteStation } = useFavoriteStation(); const { webview } = useCurrentTrain(); const { navigate, addListener, goBack, canGoBack } = useNavigation(); @@ -92,4 +92,4 @@ export default function FavoriteList() { goBack()} string="閉じる" /> ); -} +}; diff --git a/components/Settings/FavoriteSettings.js b/components/Settings/FavoriteSettings.js index 4c4e0ec..9a08d43 100644 --- a/components/Settings/FavoriteSettings.js +++ b/components/Settings/FavoriteSettings.js @@ -4,51 +4,17 @@ import { useNavigation } from "@react-navigation/native"; import { useFavoriteStation } from "../../stateBox/useFavoriteStation"; import { CheckBox } from "react-native-elements"; import { FavoriteSettingsItem } from "./FavoliteSettings/FavoiliteSettingsItem"; +import { SheetHeaderItem } from "@/components/atom/SheetHeaderItem"; export const FavoriteSettings = () => { const { favoriteStation, setFavoriteStation } = useFavoriteStation(); const { goBack } = useNavigation(); return ( - - - - - - < 設定 - - - - - - - お気に入り設定 - - - + {favoriteStation.map((currentStation, index, array) => ( { const { goBack } = useNavigation(); @@ -21,45 +22,7 @@ export const LauncherIconSettings = ({ navigate }) => { const [currentIcon] = useState(getAppIconName()); return ( - - - - - - < 設定 - - - - - - - アイコン設定 - - - + {currentIcon ? ( <> diff --git a/components/Settings/LayoutSettings.js b/components/Settings/LayoutSettings.js index e92af7b..4020857 100644 --- a/components/Settings/LayoutSettings.js +++ b/components/Settings/LayoutSettings.js @@ -4,6 +4,7 @@ import { useNavigation } from "@react-navigation/native"; import { SwitchArea } from "../atom/SwitchArea"; import { CheckBox } from "react-native-elements"; import { TripleSwitchArea } from "../atom/TripleSwitchArea"; +import { SheetHeaderItem } from "../atom/SheetHeaderItem"; export const LayoutSettings = ({ navigate, @@ -25,45 +26,7 @@ export const LayoutSettings = ({ const { goBack } = useNavigation(); return ( - - - - - - < 設定 - - - - - - - レイアウト設定 - - - + { const { expoPushToken } = useNotification(); @@ -19,92 +20,36 @@ export const NotificationSettings = () => { AS.getItem("strangeTrain").then(setStrangeTrain); }, []); + const setRegister = () => { + fetch( + "https://n8n.haruk.in/webhook/jr-shikoku-notification-configurations", + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + token: expoPushToken, + traInfoEX, + informations, + strangeTrain, + }), + } + ).then(() => { + Promise.all([ + AS.setItem("traInfoEX", traInfoEX.toString()), + AS.setItem("informations", informations.toString()), + AS.setItem("strangeTrain", strangeTrain.toString()), + ]).then(() => alert("通知の設定を保存、登録しました")); + }); + }; return ( - - - - - - < 設定 - - - - - - - 通知設定(β) - - - { - fetch( - "https://n8n.haruk.in/webhook/jr-shikoku-notification-configurations", - { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ - token: expoPushToken, - traInfoEX, - informations, - strangeTrain, - }), - } - ).then(() => { - Promise.all([ - AS.setItem("traInfoEX", traInfoEX.toString()), - AS.setItem("informations", informations.toString()), - AS.setItem("strangeTrain", strangeTrain.toString()), - ]).then(() => alert("通知の設定を保存、登録しました")); - }); - }} - style={{ - flexDirection: "column", - flex: 1, - }} - > - - - 登録実行 - - - - - + - - - navigation.goBack()} - style={{ - flexDirection: "column", - flex: 1, - }} - > - - - 閉じる - - - - - - - アプリの設定画面 - - - + navigation.goBack(), + }} /> diff --git a/components/Settings/WidgetSettings.js b/components/Settings/WidgetSettings.js index 25b2628..f5213e5 100644 --- a/components/Settings/WidgetSettings.js +++ b/components/Settings/WidgetSettings.js @@ -8,6 +8,7 @@ import { getInfoString } from "../AndroidWidget/InfoWidget"; import { AS } from "../../storageControl"; import { nameToWidget } from "../AndroidWidget/widget-task-handler"; import { ListItem } from "native-base"; +import { SheetHeaderItem } from "../atom/SheetHeaderItem"; export const WidgetSettings = ({ navigate }) => { const { JR_shikoku_train_info, Info_Widget } = nameToWidget; @@ -41,45 +42,10 @@ export const WidgetSettings = ({ navigate }) => { }, []); return ( - - - - - - < 設定 - - - - - - - ウィジェット設定 - - - + { + +type Props = { + currentStation: { + Station_JP: string; + StationNumber: string; + }[]; + onPress: () => void; + children: React.ReactNode; +} +export const FavoriteListItem:FC = ({ currentStation, children, onPress }) => { const lineIDs = []; const EachIDs = []; currentStation.forEach((d) => { diff --git a/components/atom/SheetHeaderItem.tsx b/components/atom/SheetHeaderItem.tsx new file mode 100644 index 0000000..601a0d1 --- /dev/null +++ b/components/atom/SheetHeaderItem.tsx @@ -0,0 +1,48 @@ +import React, { FC } from "react"; +import { View, Text, TouchableOpacity, TextStyle } from "react-native"; + +type Props = { + LeftItem?: SideItemProps; + RightItem?: SideItemProps; + title: string; +}; + +const textStyle: TextStyle = { + fontSize: 20, + fontWeight: "bold", + color: "white", + padding: 10, + textAlignVertical: "center", +}; +export const SheetHeaderItem: FC = (props) => { + const { LeftItem, RightItem, title } = props; + return ( + + + {LeftItem ? : <>} + + {title} + + {RightItem ? : <>} + + + ); +}; + +type SideItemProps = { + onPress: () => void; + title: string; + position: "left" | "right"; +}; +const SideItem: FC = ({ onPress, title, position }) => { + return ( + + + {title} + + + ); +};