diff --git a/app/i18n/en.json b/app/i18n/en.json index 7a0b3364..6e851d4c 100644 --- a/app/i18n/en.json +++ b/app/i18n/en.json @@ -36,7 +36,9 @@ "title": "Settings", "language": "App Language", "share": "Share App", - "rate": "Rate Better Rail", + "shareMessage": "The Israel Railways alternative app", + "rateIOS": "Rate Better Rail", + "rateAndroid": "Rate Better Rail", "imageAttribution": "Image Attributions", "privacyPolicy": "Privacy Policy", "feedback": "Send Feedback", diff --git a/app/i18n/he.json b/app/i18n/he.json index 71f3e1bf..898b4f07 100644 --- a/app/i18n/he.json +++ b/app/i18n/he.json @@ -38,7 +38,9 @@ "title": "הגדרות", "language": "שפה", "share": "שתפו את Better Rail", - "rate": "דרגו ב- App Store", + "shareMessage": "האלטרנטיבה לאפליקציית רכבת ישראל", + "rateIOS": "דרגו ב- App Store", + "rateAndroid": "דרגו ב- Play Store", "imageAttribution": "קרדיט תמונות", "privacyPolicy": "מדיניות פרטיות", "feedback": "שליחת פידבק", diff --git a/app/screens/settings/settings-screen.tsx b/app/screens/settings/settings-screen.tsx index 968fb50f..96fc4b91 100644 --- a/app/screens/settings/settings-screen.tsx +++ b/app/screens/settings/settings-screen.tsx @@ -1,6 +1,7 @@ import React from "react" import { observer } from "mobx-react-lite" -import { Linking, Share, Platform, TextStyle, View, ViewStyle } from "react-native" +import { Linking, Platform, TextStyle, View, ViewStyle } from "react-native" +import Share from "react-native-share" import { Screen, Text } from "../../components" import { SettingBox } from "./components/settings-box" import { getVersion } from "react-native-device-info" @@ -33,7 +34,40 @@ const VERSION_TEXT: TextStyle = { color: color.dim, } -const storeLink = Platform.select({ ios: "https://apps.apple.com/app/better-rail/id1562982976?action=write-review" }) +function shareApp() { + const url = "https://better-rail.co.il/" + const title = "Better Rail" + const message = translate("settings.shareMessage") + + const shareOptions = Platform.select({ + ios: { + activityItemSources: [ + { + placeholderItem: { type: "url", content: url }, + item: { + default: { type: "text", content: `${message} ${url}` }, + }, + subject: { + default: title, + }, + linkMetadata: { title: message }, + }, + ], + }, + default: { + title, + subject: title, + message: `${message} ${url}`, + }, + }) + + Share.open(shareOptions) +} + +const storeLink = Platform.select({ + ios: "https://apps.apple.com/app/better-rail/id1562982976?action=write-review", + android: "market://details?id=com.betterrail", +}) export const SettingsScreen = observer(function SettingsScreen({ navigation }: SettingsScreenProps) { return ( @@ -49,20 +83,15 @@ export const SettingsScreen = observer(function SettingsScreen({ navigation }: S /> - {Platform.OS === "ios" && ( - - - Share.share({ message: "Better Rail - האלטרנטיבה לאפליקציית רכבת ישראל", url: "https://better-rail.co.il" }) - } - /> - Linking.openURL(storeLink)} /> - - )} + + + Linking.openURL(storeLink)} + /> +