import SignOutButton from "@/components-old/sign-out-button/sign-out-button.component"; import { selectDeleteAfterUpload } from "@/redux/app/app.selectors"; import { selectBodyshop, selectCurrentUser } from "@/redux/user/user.selectors"; import { formatBytes } from "@/util/uploadUtils"; import AsyncStorage from "@react-native-async-storage/async-storage"; import * as Application from "expo-application"; import Constants from "expo-constants"; import { useTranslation } from "react-i18next"; import { Alert, ScrollView, StyleSheet, View } from "react-native"; import { Button, Card, Divider, List, Text } from "react-native-paper"; import { SafeAreaView } from "react-native-safe-area-context"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import UploadDeleteSwitch from "./upload-delete-switch"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, deleteAfterUpload: selectDeleteAfterUpload, currentUser: selectCurrentUser, }); const mapDispatchToProps = (dispatch) => ({}); export default connect(mapStateToProps, mapDispatchToProps)(Tab); function Tab({ bodyshop, currentUser }) { const { t } = useTranslation(); const handleClearStorage = () => { Alert.alert( "Clear Local Cache", "This will remove persisted Redux state. Media already uploaded won't be affected. Continue?", [ { text: "Cancel", style: "cancel" }, { text: "Clear", style: "destructive", onPress: async () => { try { await AsyncStorage.removeItem("persist:root"); Alert.alert("Cleared", "Local cache cleared."); } catch (_e) { Alert.alert("Error", "Unable to clear local cache."); } }, }, ] ); }; return ( Settings {" "} {t("mediabrowser.labels.deleteafterupload")} } /> {!bodyshop?.uselocalmediaserver && ( } /> )} Signed in to bodyshop:{" "} {bodyshop?.shopname || bodyshop?.id || "Unknown"} Signed in to as: {currentUser?.email || "Unknown"} {t("settings.labels.version", { number: `${Constants.expoConfig.version}(${Application.nativeBuildVersion} - ${Constants.expoConfig.extra.expover})`, })} ); } const styles = StyleSheet.create({ container: { paddingVertical: 24, paddingHorizontal: 20, }, title: { marginBottom: 12, fontWeight: "600", }, section: { marginBottom: 20, }, inlineRow: { flexDirection: "row", alignItems: "center", justifyContent: "space-between", paddingVertical: 8, paddingHorizontal: 4, }, switchLabel: { fontSize: 16, fontWeight: "500", }, paragraph: { marginBottom: 8, }, actionsRow: { justifyContent: "flex-end", }, divider: { marginTop: 8, }, footerNote: { textAlign: "center", // color: "#666", marginTop: 16, }, });