import * as WebBrowser from "expo-web-browser"; import { StyleSheet, Text } from "react-native"; import { fonts } from "@/constants/theme"; import { useAccounts } from "@/contexts/AccountsContext"; import { useAppTheme } from "@/contexts/ThemeContext"; type LegalAgreementNoticeProps = { action: string; }; function openLegalPage(baseUrl: string, path: "/terms" | "/privacy") { const origin = baseUrl.replace(/\/$/, ""); void WebBrowser.openBrowserAsync(`${origin}${path}`); } export function LegalAgreementNotice({ action }: LegalAgreementNoticeProps) { const { colors } = useAppTheme(); const { apiUrl } = useAccounts(); return ( By {action}, you agree to our{" "} openLegalPage(apiUrl, "/terms")} > Terms of Service {" "} and{" "} openLegalPage(apiUrl, "/privacy")} > Privacy Policy . ); } const styles = StyleSheet.create({ text: { textAlign: "center", fontSize: 12, fontFamily: fonts.body, lineHeight: 18, }, link: { fontFamily: fonts.bodyMedium, textDecorationLine: "underline", }, });