diff --git a/src/navigation/Drawer.js b/src/navigation/Drawer.js index 4828614..3a9bfec 100644 --- a/src/navigation/Drawer.js +++ b/src/navigation/Drawer.js @@ -21,6 +21,7 @@ import Relatives from "~/scenes/Relatives"; import Sheets from "~/scenes/Sheets"; import AlertAggListArchived from "~/scenes/AlertAggListArchived"; import About from "~/scenes/About"; +import Contribute from "~/scenes/Contribute"; import Location from "~/scenes/Location"; import Developer from "~/scenes/Developer"; import HelpSignal from "~/scenes/HelpSignal"; @@ -413,6 +414,22 @@ export default React.memo(function DrawerNav() { }} listeners={{}} /> + ( + + ), + unmountOnBlur: true, + }} + listeners={{}} + /> + { + navigateTo({ name: "Contribute" }); + }} + /> { diff --git a/src/navigation/RootStack.js b/src/navigation/RootStack.js index 0beee74..1298f2e 100644 --- a/src/navigation/RootStack.js +++ b/src/navigation/RootStack.js @@ -39,6 +39,8 @@ function getHeaderTitle(route) { return "Alertes archivées"; case "About": return "À Propos"; + case "Contribute": + return "Faire un don"; case "Location": return "Ma Localisation"; case "NotFound": diff --git a/src/scenes/About/index.js b/src/scenes/About/index.js index ac16c39..ee196d4 100644 --- a/src/scenes/About/index.js +++ b/src/scenes/About/index.js @@ -1,12 +1,20 @@ import React, { useState, useCallback, useEffect } from "react"; -import { View, Image, ScrollView } from "react-native"; +import { + View, + Image, + ScrollView, + TouchableOpacity, + Linking, + Alert, +} from "react-native"; import { Button } from "react-native-paper"; +import { useNavigation } from "@react-navigation/native"; import * as Updates from "expo-updates"; import { StatusBar } from "expo-status-bar"; import { MaterialIcons, AntDesign, FontAwesome } from "@expo/vector-icons"; import Text from "~/components/Text"; -import { useTheme } from "~/theme"; +import { useTheme, createStyles } from "~/theme"; import { paramsActions, useParamsState } from "~/stores"; @@ -16,7 +24,24 @@ const logo = require("~/assets/img/logo192.png"); const version = require("../../../package.json").version; +const openURL = async (url) => { + try { + const supported = await Linking.canOpenURL(url); + if (supported) { + await Linking.openURL(url); + } else { + Alert.alert("Erreur", "Impossible d'ouvrir ce lien"); + } + } catch (error) { + Alert.alert( + "Erreur", + "Une erreur s'est produite lors de l'ouverture du lien", + ); + } +}; + export default function About() { + const navigation = useNavigation(); const textStyle = { textAlign: "left", fontSize: 16, @@ -153,6 +178,81 @@ export default function About() { + + {/* Website and Contribute Buttons */} + + {/* Website Button */} + openURL("https://alerte-secours.fr")} + > + + + Site officiel + + + + {/* Contribute Button */} + navigation.navigate("Contribute")} + > + + + Contribuer au projet + + + + + + ); diff --git a/src/theme/app/Dark.js b/src/theme/app/Dark.js index 686a5ec..e342156 100644 --- a/src/theme/app/Dark.js +++ b/src/theme/app/Dark.js @@ -96,6 +96,13 @@ const ThemeDark = { call: "#4c6ef5", onColor: "#FFFFFF", }, + + donation: { + liberapay: "#f59f00", // Same as colors.warn + buymeacoffee: "#40c057", // Same as colors.ok + github: "#b3c4ff", // Same as colors.primary (dark theme) + onDonation: "#FFFFFF", + }, }, }; export default ThemeDark; diff --git a/src/theme/app/Light.js b/src/theme/app/Light.js index 019d446..0b9d536 100644 --- a/src/theme/app/Light.js +++ b/src/theme/app/Light.js @@ -95,6 +95,13 @@ const ThemeLight = { call: "#4c6ef5", onColor: "#FFFFFF", }, + + donation: { + liberapay: "#f59f00", // Same as colors.warn + buymeacoffee: "#40c057", // Same as colors.ok + github: "#1864ab", // Same as colors.primary + onDonation: "#FFFFFF", + }, }, };