172 lines
5.0 KiB
TypeScript
172 lines
5.0 KiB
TypeScript
import React, { useState } from "react";
|
|
import {
|
|
ScrollView,
|
|
StyleSheet,
|
|
View,
|
|
Text,
|
|
Alert,
|
|
Platform,
|
|
} from "react-native";
|
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
import { router } from "expo-router";
|
|
import { moderateScale, verticalScale } from "react-native-size-matters";
|
|
|
|
import SettingsHeader from "@/features/settings/components/SettingsHeader";
|
|
import ProfileMenuItem from "@/features/profile/components/ProfileMenuItem";
|
|
import PrimaryButton from "@/components/buttons/PrimaryButton";
|
|
import { Colors } from "@/theme";
|
|
|
|
export default function PrivacySettingsScreen() {
|
|
const [analyticsEnabled, setAnalyticsEnabled] = useState(true);
|
|
const [offlineCacheEnabled, setOfflineCacheEnabled] = useState(true);
|
|
|
|
const handleClearHistory = () => {
|
|
const doClear = () => {
|
|
const msg = "Search and navigation history cleared.";
|
|
if (Platform.OS === "web") {
|
|
window.alert(msg);
|
|
} else {
|
|
Alert.alert("Success", msg);
|
|
}
|
|
};
|
|
|
|
if (Platform.OS === "web") {
|
|
if (window.confirm("Clear all local search history? This cannot be undone.")) {
|
|
doClear();
|
|
}
|
|
} else {
|
|
Alert.alert(
|
|
"Clear Search History",
|
|
"Are you sure you want to clear your local search history?",
|
|
[
|
|
{ text: "Cancel", style: "cancel" },
|
|
{ text: "Clear", style: "destructive", onPress: doClear },
|
|
]
|
|
);
|
|
}
|
|
};
|
|
|
|
const handleSave = () => {
|
|
const msg = "Privacy preferences updated!";
|
|
if (Platform.OS === "web") {
|
|
window.alert(msg);
|
|
router.back();
|
|
} else {
|
|
Alert.alert("Success", msg, [
|
|
{ text: "OK", onPress: () => router.back() },
|
|
]);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<SafeAreaView style={styles.safeArea}>
|
|
<ScrollView
|
|
showsVerticalScrollIndicator={false}
|
|
contentContainerStyle={styles.contentContainer}
|
|
>
|
|
<View style={styles.container}>
|
|
<SettingsHeader title="Privacy & Data" />
|
|
|
|
<Text style={styles.sectionSubtitle}>
|
|
Manage your personal data storage, local history, and anonymized metrics.
|
|
</Text>
|
|
|
|
<View style={styles.card}>
|
|
<ProfileMenuItem
|
|
icon="analytics-outline"
|
|
title="Share Anonymous Diagnostics"
|
|
subtitle="Helps Acupedia improve performance & stability"
|
|
isSwitch
|
|
switchValue={analyticsEnabled}
|
|
onSwitchChange={setAnalyticsEnabled}
|
|
/>
|
|
|
|
<ProfileMenuItem
|
|
icon="server-outline"
|
|
title="Offline Content Caching"
|
|
subtitle="Cache accessed modules for offline clinical reading"
|
|
isSwitch
|
|
switchValue={offlineCacheEnabled}
|
|
onSwitchChange={setOfflineCacheEnabled}
|
|
/>
|
|
|
|
<ProfileMenuItem
|
|
icon="trash-outline"
|
|
title="Clear Search History"
|
|
subtitle="Remove cached search queries & recents"
|
|
showArrow
|
|
isLast
|
|
onPress={handleClearHistory}
|
|
/>
|
|
</View>
|
|
|
|
<View style={styles.infoBox}>
|
|
<Text style={styles.infoTitle}>Clinical Privacy & Content Protection</Text>
|
|
<Text style={styles.infoText}>
|
|
Acupedia is strictly compliant with privacy principles. We never sell your clinical search data, bookmarks, or account information to third parties.
|
|
</Text>
|
|
<Text style={[styles.infoText, { marginTop: 6 }]}>
|
|
Proprietary anatomical charts, point coordinates, and clinical needling depths are protected by hardware screen-capture and recording prevention on native mobile devices.
|
|
</Text>
|
|
</View>
|
|
|
|
<View style={styles.buttonWrapper}>
|
|
<PrimaryButton title="Save Preferences" onPress={handleSave} />
|
|
</View>
|
|
</View>
|
|
</ScrollView>
|
|
</SafeAreaView>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
safeArea: {
|
|
flex: 1,
|
|
backgroundColor: Colors.background,
|
|
},
|
|
contentContainer: {
|
|
flexGrow: 1,
|
|
paddingBottom: verticalScale(32),
|
|
},
|
|
container: {
|
|
flex: 1,
|
|
paddingHorizontal: moderateScale(20),
|
|
paddingTop: verticalScale(12),
|
|
},
|
|
sectionSubtitle: {
|
|
fontSize: moderateScale(13),
|
|
color: Colors.textSecondary,
|
|
marginBottom: verticalScale(16),
|
|
lineHeight: moderateScale(18),
|
|
},
|
|
card: {
|
|
backgroundColor: "#FFFFFF",
|
|
borderRadius: moderateScale(16),
|
|
overflow: "hidden",
|
|
borderWidth: 1,
|
|
borderColor: "#E5E7EB",
|
|
marginBottom: verticalScale(20),
|
|
},
|
|
infoBox: {
|
|
backgroundColor: "#F8FAFC",
|
|
borderRadius: moderateScale(14),
|
|
padding: moderateScale(16),
|
|
borderWidth: 1,
|
|
borderColor: "#E2E8F0",
|
|
},
|
|
infoTitle: {
|
|
fontSize: moderateScale(14),
|
|
fontWeight: "700",
|
|
color: Colors.textPrimary,
|
|
marginBottom: verticalScale(4),
|
|
},
|
|
infoText: {
|
|
fontSize: moderateScale(12),
|
|
color: Colors.textSecondary,
|
|
lineHeight: moderateScale(18),
|
|
},
|
|
buttonWrapper: {
|
|
marginTop: verticalScale(24),
|
|
},
|
|
});
|