import { withClickTracking } from "../../services/telemetry"; import React from "react"; import { Linking, ScrollView, Text, View } from "react-native"; import { SafeAreaView } from "react-native-safe-area-context"; import { useNavigation } from "../../context/NavigationContext"; import { StatusBar } from "expo-status-bar"; import { Ionicons } from "@expo/vector-icons"; import { useColorScheme } from "nativewind"; import { IconButton } from "../../components/button"; import { EntropyByline } from "../../components/entropy-mark"; import { useAppConfig } from "../../context/AppConfigContext"; export interface LegalSection { title: string; content: string; } export interface TermsOfServiceScreenProps { /** * Per-app section list. When omitted, the screen falls back to * `AppConfig.termsText` (rendered as a single section) or a generic * placeholder. */ sections?: LegalSection[]; /** * Optional version/build label rendered in the header (vault uses * `v1.2.3 (4567)` here). Apps that don't ship build metadata can * omit this. */ buildLabel?: string; /** Effective-date label override. Defaults to today's date. */ effectiveDate?: string; /** Support email surfaced in the contact section. */ supportEmail?: string; /** Footer organisation name. Defaults to `appName`. */ organisationName?: string; /** Footer license blurb. Defaults to "Open Source • MIT License". */ licenseLabel?: string; } export function TermsOfServiceScreen({ sections, buildLabel, effectiveDate, supportEmail = "support@entropysoftworks.com", organisationName, licenseLabel = "Open Source • MIT License", }: TermsOfServiceScreenProps) { const { colorScheme } = useColorScheme(); const isDark = colorScheme === "dark"; const router = useNavigation(); const { appName, termsText } = useAppConfig(); const resolvedSections: LegalSection[] = sections ?? (termsText ? [{ title: "Terms", content: termsText }] : [{ title: "Terms of Service", content: `Terms of service for ${appName}.` }]); const today = effectiveDate ?? new Date().toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric", }); const org = organisationName ?? appName; return ( router.back()} > {buildLabel ? ( {buildLabel} ) : null} Terms of Service Effective Date: {today} These Terms of Service ("Terms") govern your use of {appName} and related services. By using {appName}, you agree to be bound by these Terms. {resolvedSections.map((section, index) => ( {section.title} {section.content} ))} Contact For questions about these Terms of Service, please contact us by email at{" "} Linking.openURL(`mailto:${supportEmail}`) )} > {supportEmail} Important Notice By creating an account or using {appName}, you acknowledge that you have read, understood, and agree to be bound by these Terms of Service. If you do not agree, please discontinue use of the application. © {new Date().getFullYear()} {org}. All rights reserved. {licenseLabel ? ( {licenseLabel} ) : null} ); } export default TermsOfServiceScreen;