2026-05-03 22:01:43 +08:00
|
|
|
|
import { StatusBar } from 'expo-status-bar';
|
<think>Let me analyze the staged changes to generate a proper conventional commit message.
Looking at the changes:
1. **New files**:
- `app/(app)/(tabs)/profile/account-deletion.tsx` - account deletion screen
- `app/(app)/(tabs)/profile/privacy-settings.tsx` - privacy settings screen
- `src/screens/profile/AccountDeletionScreen.tsx` - account deletion implementation
- `src/screens/profile/PrivacySettingsScreen.tsx` - privacy settings implementation
2. **Modified files**:
- Database changes: `LocalDataSource.ts`, `DatabaseManager.ts`, `DatabaseConfig.ts`, `MigrationManager.ts` - refactoring database layer (removing LockManager, simplified initialization, added retry logic)
- Auth store: `authStore.ts` - changed `initDatabase` to `switchDatabase`
- Auth service: `authService.ts` - added privacy settings and account deletion methods
- DTOs: `dto.ts` - added PrivacySettingsDTO, DeletionStatusDTO, VoteOptionDTO, VoteResultDTO types
- Navigation: `hrefs.ts` - added new href functions for privacy settings and account deletion
- Profile screens: `SettingsScreen.tsx`, `index.ts`, `_layout.tsx` - added new menu items and routes
- Various message screens - added keyboard handling props
- `app/_layout.tsx` - added CSS for mobile touch handling
- `CreatePostScreen.tsx` - fixed vote_options format
- `PostDetailScreen.tsx` - added type annotations for vote handling
- `MediaCacheManager.ts` - updated to use new expo-file-system API
- `VerificationSettingsScreen.tsx` - fixed type safety
- `AccountSecurityScreen.tsx` - styling refactoring
This is a multi-faceted change involving:
Database refactoring, new privacy/account deletion features, bug fixes, and UI improvements. The database changes appear to be refactoring without new functionality. The most significant changes are the privacy settings and account deletion features, plus bug fixes like the vote options format and mobile touch handling.
</think>
feat(profile): add privacy settings and account deletion screens
Add privacy settings and account deletion functionality with new screens and APIs. Refactor database initialization to use switchDatabase for user switching. Fix vote options format in post creation and add type safety to vote handling. Improve mobile touch handling in layout and message screens. Update media cache to use new expo-file-system API.
BREAKING CHANGE: Database initialization now uses switchDatabase instead of initDatabase for user switching
2026-04-08 16:48:19 +08:00
|
|
|
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
|
|
|
|
import {
|
|
|
|
|
|
ActivityIndicator,
|
|
|
|
|
|
Alert,
|
|
|
|
|
|
ScrollView,
|
|
|
|
|
|
StyleSheet,
|
|
|
|
|
|
TextInput,
|
|
|
|
|
|
TouchableOpacity,
|
|
|
|
|
|
View,
|
|
|
|
|
|
} from 'react-native';
|
|
|
|
|
|
import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
|
|
|
|
import { MaterialCommunityIcons } from '@expo/vector-icons';
|
|
|
|
|
|
import { useRouter } from 'expo-router';
|
|
|
|
|
|
import { authService } from '../../services';
|
|
|
|
|
|
import { spacing, borderRadius, fontSizes, useAppColors, type AppColors } from '../../theme';
|
2026-05-03 22:01:43 +08:00
|
|
|
|
import { Text, SimpleHeader } from '../../components/common';
|
<think>Let me analyze the staged changes to generate a proper conventional commit message.
Looking at the changes:
1. **New files**:
- `app/(app)/(tabs)/profile/account-deletion.tsx` - account deletion screen
- `app/(app)/(tabs)/profile/privacy-settings.tsx` - privacy settings screen
- `src/screens/profile/AccountDeletionScreen.tsx` - account deletion implementation
- `src/screens/profile/PrivacySettingsScreen.tsx` - privacy settings implementation
2. **Modified files**:
- Database changes: `LocalDataSource.ts`, `DatabaseManager.ts`, `DatabaseConfig.ts`, `MigrationManager.ts` - refactoring database layer (removing LockManager, simplified initialization, added retry logic)
- Auth store: `authStore.ts` - changed `initDatabase` to `switchDatabase`
- Auth service: `authService.ts` - added privacy settings and account deletion methods
- DTOs: `dto.ts` - added PrivacySettingsDTO, DeletionStatusDTO, VoteOptionDTO, VoteResultDTO types
- Navigation: `hrefs.ts` - added new href functions for privacy settings and account deletion
- Profile screens: `SettingsScreen.tsx`, `index.ts`, `_layout.tsx` - added new menu items and routes
- Various message screens - added keyboard handling props
- `app/_layout.tsx` - added CSS for mobile touch handling
- `CreatePostScreen.tsx` - fixed vote_options format
- `PostDetailScreen.tsx` - added type annotations for vote handling
- `MediaCacheManager.ts` - updated to use new expo-file-system API
- `VerificationSettingsScreen.tsx` - fixed type safety
- `AccountSecurityScreen.tsx` - styling refactoring
This is a multi-faceted change involving:
Database refactoring, new privacy/account deletion features, bug fixes, and UI improvements. The database changes appear to be refactoring without new functionality. The most significant changes are the privacy settings and account deletion features, plus bug fixes like the vote options format and mobile touch handling.
</think>
feat(profile): add privacy settings and account deletion screens
Add privacy settings and account deletion functionality with new screens and APIs. Refactor database initialization to use switchDatabase for user switching. Fix vote options format in post creation and add type safety to vote handling. Improve mobile touch handling in layout and message screens. Update media cache to use new expo-file-system API.
BREAKING CHANGE: Database initialization now uses switchDatabase instead of initDatabase for user switching
2026-04-08 16:48:19 +08:00
|
|
|
|
import { useResponsive, useResponsiveSpacing } from '../../hooks';
|
|
|
|
|
|
import { useAuthStore } from '../../stores';
|
|
|
|
|
|
import type { DeletionStatusDTO } from '../../types/dto';
|
|
|
|
|
|
import * as hrefs from '../../navigation/hrefs';
|
|
|
|
|
|
|
|
|
|
|
|
const CONTENT_MAX_WIDTH = 720;
|
|
|
|
|
|
|
|
|
|
|
|
function createAccountDeletionStyles(colors: AppColors) {
|
|
|
|
|
|
return StyleSheet.create({
|
|
|
|
|
|
container: {
|
|
|
|
|
|
flex: 1,
|
|
|
|
|
|
backgroundColor: colors.background.paper,
|
|
|
|
|
|
},
|
|
|
|
|
|
loadingWrap: {
|
|
|
|
|
|
flex: 1,
|
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
|
},
|
|
|
|
|
|
scrollContent: {
|
|
|
|
|
|
paddingVertical: spacing.lg,
|
|
|
|
|
|
},
|
|
|
|
|
|
content: {
|
|
|
|
|
|
maxWidth: CONTENT_MAX_WIDTH,
|
|
|
|
|
|
alignSelf: 'center',
|
|
|
|
|
|
width: '100%',
|
|
|
|
|
|
},
|
|
|
|
|
|
section: {
|
|
|
|
|
|
marginBottom: spacing['2xl'],
|
|
|
|
|
|
},
|
|
|
|
|
|
// 警告卡片 - 扁平化风格
|
|
|
|
|
|
warningCard: {
|
|
|
|
|
|
backgroundColor: colors.error.light + '20',
|
|
|
|
|
|
borderRadius: 14,
|
|
|
|
|
|
padding: spacing.lg,
|
|
|
|
|
|
marginHorizontal: spacing['2xl'],
|
|
|
|
|
|
marginBottom: spacing.xl,
|
|
|
|
|
|
},
|
|
|
|
|
|
warningTitle: {
|
|
|
|
|
|
fontWeight: '700',
|
|
|
|
|
|
fontSize: fontSizes.md,
|
|
|
|
|
|
marginBottom: spacing.sm,
|
|
|
|
|
|
color: colors.error.main,
|
|
|
|
|
|
},
|
|
|
|
|
|
warningText: {
|
|
|
|
|
|
color: colors.error.dark,
|
|
|
|
|
|
marginBottom: spacing.xs,
|
|
|
|
|
|
fontSize: fontSizes.sm,
|
|
|
|
|
|
},
|
|
|
|
|
|
// 状态卡片 - 扁平化风格
|
|
|
|
|
|
statusCard: {
|
|
|
|
|
|
backgroundColor: colors.warning.light + '30',
|
|
|
|
|
|
borderRadius: 14,
|
|
|
|
|
|
padding: spacing.lg,
|
|
|
|
|
|
marginHorizontal: spacing['2xl'],
|
|
|
|
|
|
marginBottom: spacing.xl,
|
|
|
|
|
|
},
|
|
|
|
|
|
statusTitle: {
|
|
|
|
|
|
fontWeight: '700',
|
|
|
|
|
|
fontSize: fontSizes.md,
|
|
|
|
|
|
marginBottom: spacing.sm,
|
|
|
|
|
|
color: colors.warning.dark,
|
|
|
|
|
|
},
|
|
|
|
|
|
daysText: {
|
|
|
|
|
|
fontSize: 32,
|
|
|
|
|
|
fontWeight: '700',
|
|
|
|
|
|
color: colors.warning.dark,
|
|
|
|
|
|
textAlign: 'center',
|
|
|
|
|
|
marginVertical: spacing.md,
|
|
|
|
|
|
},
|
|
|
|
|
|
// 内容区域
|
|
|
|
|
|
sectionContent: {
|
|
|
|
|
|
marginHorizontal: spacing['2xl'],
|
|
|
|
|
|
marginBottom: spacing.xl,
|
|
|
|
|
|
},
|
|
|
|
|
|
sectionTitle: {
|
|
|
|
|
|
fontWeight: '600',
|
|
|
|
|
|
fontSize: fontSizes.sm,
|
|
|
|
|
|
color: colors.text.secondary,
|
|
|
|
|
|
textTransform: 'uppercase',
|
|
|
|
|
|
letterSpacing: 0.5,
|
|
|
|
|
|
marginBottom: spacing.md,
|
|
|
|
|
|
},
|
|
|
|
|
|
listItem: {
|
|
|
|
|
|
flexDirection: 'row',
|
|
|
|
|
|
alignItems: 'flex-start',
|
|
|
|
|
|
marginBottom: spacing.sm,
|
|
|
|
|
|
},
|
|
|
|
|
|
listBullet: {
|
|
|
|
|
|
marginRight: spacing.sm,
|
|
|
|
|
|
marginTop: 2,
|
|
|
|
|
|
},
|
|
|
|
|
|
// 输入框 - 扁平化风格
|
|
|
|
|
|
input: {
|
2026-04-11 04:27:22 +08:00
|
|
|
|
backgroundColor: colors.background.default,
|
<think>Let me analyze the staged changes to generate a proper conventional commit message.
Looking at the changes:
1. **New files**:
- `app/(app)/(tabs)/profile/account-deletion.tsx` - account deletion screen
- `app/(app)/(tabs)/profile/privacy-settings.tsx` - privacy settings screen
- `src/screens/profile/AccountDeletionScreen.tsx` - account deletion implementation
- `src/screens/profile/PrivacySettingsScreen.tsx` - privacy settings implementation
2. **Modified files**:
- Database changes: `LocalDataSource.ts`, `DatabaseManager.ts`, `DatabaseConfig.ts`, `MigrationManager.ts` - refactoring database layer (removing LockManager, simplified initialization, added retry logic)
- Auth store: `authStore.ts` - changed `initDatabase` to `switchDatabase`
- Auth service: `authService.ts` - added privacy settings and account deletion methods
- DTOs: `dto.ts` - added PrivacySettingsDTO, DeletionStatusDTO, VoteOptionDTO, VoteResultDTO types
- Navigation: `hrefs.ts` - added new href functions for privacy settings and account deletion
- Profile screens: `SettingsScreen.tsx`, `index.ts`, `_layout.tsx` - added new menu items and routes
- Various message screens - added keyboard handling props
- `app/_layout.tsx` - added CSS for mobile touch handling
- `CreatePostScreen.tsx` - fixed vote_options format
- `PostDetailScreen.tsx` - added type annotations for vote handling
- `MediaCacheManager.ts` - updated to use new expo-file-system API
- `VerificationSettingsScreen.tsx` - fixed type safety
- `AccountSecurityScreen.tsx` - styling refactoring
This is a multi-faceted change involving:
Database refactoring, new privacy/account deletion features, bug fixes, and UI improvements. The database changes appear to be refactoring without new functionality. The most significant changes are the privacy settings and account deletion features, plus bug fixes like the vote options format and mobile touch handling.
</think>
feat(profile): add privacy settings and account deletion screens
Add privacy settings and account deletion functionality with new screens and APIs. Refactor database initialization to use switchDatabase for user switching. Fix vote options format in post creation and add type safety to vote handling. Improve mobile touch handling in layout and message screens. Update media cache to use new expo-file-system API.
BREAKING CHANGE: Database initialization now uses switchDatabase instead of initDatabase for user switching
2026-04-08 16:48:19 +08:00
|
|
|
|
borderRadius: 14,
|
|
|
|
|
|
padding: spacing.md,
|
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
|
color: colors.text.primary,
|
|
|
|
|
|
height: 56,
|
|
|
|
|
|
},
|
|
|
|
|
|
// 按钮行
|
|
|
|
|
|
buttonRow: {
|
|
|
|
|
|
flexDirection: 'row',
|
|
|
|
|
|
gap: spacing.md,
|
|
|
|
|
|
marginTop: spacing.lg,
|
|
|
|
|
|
marginHorizontal: spacing['2xl'],
|
|
|
|
|
|
},
|
|
|
|
|
|
// 扁平化按钮
|
|
|
|
|
|
primaryButton: {
|
|
|
|
|
|
flex: 1,
|
|
|
|
|
|
height: 56,
|
|
|
|
|
|
borderRadius: 14,
|
2026-04-11 04:27:22 +08:00
|
|
|
|
backgroundColor: colors.primary.main,
|
<think>Let me analyze the staged changes to generate a proper conventional commit message.
Looking at the changes:
1. **New files**:
- `app/(app)/(tabs)/profile/account-deletion.tsx` - account deletion screen
- `app/(app)/(tabs)/profile/privacy-settings.tsx` - privacy settings screen
- `src/screens/profile/AccountDeletionScreen.tsx` - account deletion implementation
- `src/screens/profile/PrivacySettingsScreen.tsx` - privacy settings implementation
2. **Modified files**:
- Database changes: `LocalDataSource.ts`, `DatabaseManager.ts`, `DatabaseConfig.ts`, `MigrationManager.ts` - refactoring database layer (removing LockManager, simplified initialization, added retry logic)
- Auth store: `authStore.ts` - changed `initDatabase` to `switchDatabase`
- Auth service: `authService.ts` - added privacy settings and account deletion methods
- DTOs: `dto.ts` - added PrivacySettingsDTO, DeletionStatusDTO, VoteOptionDTO, VoteResultDTO types
- Navigation: `hrefs.ts` - added new href functions for privacy settings and account deletion
- Profile screens: `SettingsScreen.tsx`, `index.ts`, `_layout.tsx` - added new menu items and routes
- Various message screens - added keyboard handling props
- `app/_layout.tsx` - added CSS for mobile touch handling
- `CreatePostScreen.tsx` - fixed vote_options format
- `PostDetailScreen.tsx` - added type annotations for vote handling
- `MediaCacheManager.ts` - updated to use new expo-file-system API
- `VerificationSettingsScreen.tsx` - fixed type safety
- `AccountSecurityScreen.tsx` - styling refactoring
This is a multi-faceted change involving:
Database refactoring, new privacy/account deletion features, bug fixes, and UI improvements. The database changes appear to be refactoring without new functionality. The most significant changes are the privacy settings and account deletion features, plus bug fixes like the vote options format and mobile touch handling.
</think>
feat(profile): add privacy settings and account deletion screens
Add privacy settings and account deletion functionality with new screens and APIs. Refactor database initialization to use switchDatabase for user switching. Fix vote options format in post creation and add type safety to vote handling. Improve mobile touch handling in layout and message screens. Update media cache to use new expo-file-system API.
BREAKING CHANGE: Database initialization now uses switchDatabase instead of initDatabase for user switching
2026-04-08 16:48:19 +08:00
|
|
|
|
alignItems: 'center',
|
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
|
},
|
|
|
|
|
|
primaryButtonText: {
|
2026-04-11 04:27:22 +08:00
|
|
|
|
color: colors.text.inverse,
|
<think>Let me analyze the staged changes to generate a proper conventional commit message.
Looking at the changes:
1. **New files**:
- `app/(app)/(tabs)/profile/account-deletion.tsx` - account deletion screen
- `app/(app)/(tabs)/profile/privacy-settings.tsx` - privacy settings screen
- `src/screens/profile/AccountDeletionScreen.tsx` - account deletion implementation
- `src/screens/profile/PrivacySettingsScreen.tsx` - privacy settings implementation
2. **Modified files**:
- Database changes: `LocalDataSource.ts`, `DatabaseManager.ts`, `DatabaseConfig.ts`, `MigrationManager.ts` - refactoring database layer (removing LockManager, simplified initialization, added retry logic)
- Auth store: `authStore.ts` - changed `initDatabase` to `switchDatabase`
- Auth service: `authService.ts` - added privacy settings and account deletion methods
- DTOs: `dto.ts` - added PrivacySettingsDTO, DeletionStatusDTO, VoteOptionDTO, VoteResultDTO types
- Navigation: `hrefs.ts` - added new href functions for privacy settings and account deletion
- Profile screens: `SettingsScreen.tsx`, `index.ts`, `_layout.tsx` - added new menu items and routes
- Various message screens - added keyboard handling props
- `app/_layout.tsx` - added CSS for mobile touch handling
- `CreatePostScreen.tsx` - fixed vote_options format
- `PostDetailScreen.tsx` - added type annotations for vote handling
- `MediaCacheManager.ts` - updated to use new expo-file-system API
- `VerificationSettingsScreen.tsx` - fixed type safety
- `AccountSecurityScreen.tsx` - styling refactoring
This is a multi-faceted change involving:
Database refactoring, new privacy/account deletion features, bug fixes, and UI improvements. The database changes appear to be refactoring without new functionality. The most significant changes are the privacy settings and account deletion features, plus bug fixes like the vote options format and mobile touch handling.
</think>
feat(profile): add privacy settings and account deletion screens
Add privacy settings and account deletion functionality with new screens and APIs. Refactor database initialization to use switchDatabase for user switching. Fix vote options format in post creation and add type safety to vote handling. Improve mobile touch handling in layout and message screens. Update media cache to use new expo-file-system API.
BREAKING CHANGE: Database initialization now uses switchDatabase instead of initDatabase for user switching
2026-04-08 16:48:19 +08:00
|
|
|
|
fontSize: fontSizes.md,
|
|
|
|
|
|
fontWeight: '600',
|
|
|
|
|
|
},
|
|
|
|
|
|
secondaryButton: {
|
|
|
|
|
|
flex: 1,
|
|
|
|
|
|
height: 56,
|
|
|
|
|
|
borderRadius: 14,
|
|
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
|
borderWidth: 1.5,
|
|
|
|
|
|
borderColor: colors.divider,
|
|
|
|
|
|
},
|
|
|
|
|
|
secondaryButtonText: {
|
|
|
|
|
|
color: colors.text.primary,
|
|
|
|
|
|
fontSize: fontSizes.md,
|
|
|
|
|
|
fontWeight: '600',
|
|
|
|
|
|
},
|
|
|
|
|
|
dangerButton: {
|
|
|
|
|
|
flex: 1,
|
|
|
|
|
|
height: 56,
|
|
|
|
|
|
borderRadius: 14,
|
|
|
|
|
|
backgroundColor: colors.error.main,
|
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
|
},
|
|
|
|
|
|
dangerButtonText: {
|
2026-04-11 04:27:22 +08:00
|
|
|
|
color: colors.text.inverse,
|
<think>Let me analyze the staged changes to generate a proper conventional commit message.
Looking at the changes:
1. **New files**:
- `app/(app)/(tabs)/profile/account-deletion.tsx` - account deletion screen
- `app/(app)/(tabs)/profile/privacy-settings.tsx` - privacy settings screen
- `src/screens/profile/AccountDeletionScreen.tsx` - account deletion implementation
- `src/screens/profile/PrivacySettingsScreen.tsx` - privacy settings implementation
2. **Modified files**:
- Database changes: `LocalDataSource.ts`, `DatabaseManager.ts`, `DatabaseConfig.ts`, `MigrationManager.ts` - refactoring database layer (removing LockManager, simplified initialization, added retry logic)
- Auth store: `authStore.ts` - changed `initDatabase` to `switchDatabase`
- Auth service: `authService.ts` - added privacy settings and account deletion methods
- DTOs: `dto.ts` - added PrivacySettingsDTO, DeletionStatusDTO, VoteOptionDTO, VoteResultDTO types
- Navigation: `hrefs.ts` - added new href functions for privacy settings and account deletion
- Profile screens: `SettingsScreen.tsx`, `index.ts`, `_layout.tsx` - added new menu items and routes
- Various message screens - added keyboard handling props
- `app/_layout.tsx` - added CSS for mobile touch handling
- `CreatePostScreen.tsx` - fixed vote_options format
- `PostDetailScreen.tsx` - added type annotations for vote handling
- `MediaCacheManager.ts` - updated to use new expo-file-system API
- `VerificationSettingsScreen.tsx` - fixed type safety
- `AccountSecurityScreen.tsx` - styling refactoring
This is a multi-faceted change involving:
Database refactoring, new privacy/account deletion features, bug fixes, and UI improvements. The database changes appear to be refactoring without new functionality. The most significant changes are the privacy settings and account deletion features, plus bug fixes like the vote options format and mobile touch handling.
</think>
feat(profile): add privacy settings and account deletion screens
Add privacy settings and account deletion functionality with new screens and APIs. Refactor database initialization to use switchDatabase for user switching. Fix vote options format in post creation and add type safety to vote handling. Improve mobile touch handling in layout and message screens. Update media cache to use new expo-file-system API.
BREAKING CHANGE: Database initialization now uses switchDatabase instead of initDatabase for user switching
2026-04-08 16:48:19 +08:00
|
|
|
|
fontSize: fontSizes.md,
|
|
|
|
|
|
fontWeight: '600',
|
|
|
|
|
|
},
|
|
|
|
|
|
buttonDisabled: {
|
|
|
|
|
|
opacity: 0.6,
|
|
|
|
|
|
},
|
|
|
|
|
|
cancelButton: {
|
|
|
|
|
|
marginTop: spacing.lg,
|
|
|
|
|
|
marginHorizontal: spacing['2xl'],
|
|
|
|
|
|
},
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export const AccountDeletionScreen: React.FC = () => {
|
|
|
|
|
|
const colors = useAppColors();
|
|
|
|
|
|
const styles = useMemo(() => createAccountDeletionStyles(colors), [colors]);
|
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
|
const { isMobile } = useResponsive();
|
|
|
|
|
|
const insets = useSafeAreaInsets();
|
2026-05-18 01:06:46 +08:00
|
|
|
|
const logout = useAuthStore((s) => s.logout);
|
<think>Let me analyze the staged changes to generate a proper conventional commit message.
Looking at the changes:
1. **New files**:
- `app/(app)/(tabs)/profile/account-deletion.tsx` - account deletion screen
- `app/(app)/(tabs)/profile/privacy-settings.tsx` - privacy settings screen
- `src/screens/profile/AccountDeletionScreen.tsx` - account deletion implementation
- `src/screens/profile/PrivacySettingsScreen.tsx` - privacy settings implementation
2. **Modified files**:
- Database changes: `LocalDataSource.ts`, `DatabaseManager.ts`, `DatabaseConfig.ts`, `MigrationManager.ts` - refactoring database layer (removing LockManager, simplified initialization, added retry logic)
- Auth store: `authStore.ts` - changed `initDatabase` to `switchDatabase`
- Auth service: `authService.ts` - added privacy settings and account deletion methods
- DTOs: `dto.ts` - added PrivacySettingsDTO, DeletionStatusDTO, VoteOptionDTO, VoteResultDTO types
- Navigation: `hrefs.ts` - added new href functions for privacy settings and account deletion
- Profile screens: `SettingsScreen.tsx`, `index.ts`, `_layout.tsx` - added new menu items and routes
- Various message screens - added keyboard handling props
- `app/_layout.tsx` - added CSS for mobile touch handling
- `CreatePostScreen.tsx` - fixed vote_options format
- `PostDetailScreen.tsx` - added type annotations for vote handling
- `MediaCacheManager.ts` - updated to use new expo-file-system API
- `VerificationSettingsScreen.tsx` - fixed type safety
- `AccountSecurityScreen.tsx` - styling refactoring
This is a multi-faceted change involving:
Database refactoring, new privacy/account deletion features, bug fixes, and UI improvements. The database changes appear to be refactoring without new functionality. The most significant changes are the privacy settings and account deletion features, plus bug fixes like the vote options format and mobile touch handling.
</think>
feat(profile): add privacy settings and account deletion screens
Add privacy settings and account deletion functionality with new screens and APIs. Refactor database initialization to use switchDatabase for user switching. Fix vote options format in post creation and add type safety to vote handling. Improve mobile touch handling in layout and message screens. Update media cache to use new expo-file-system API.
BREAKING CHANGE: Database initialization now uses switchDatabase instead of initDatabase for user switching
2026-04-08 16:48:19 +08:00
|
|
|
|
const [status, setStatus] = useState<DeletionStatusDTO | null>(null);
|
|
|
|
|
|
const [loading, setLoading] = useState(true);
|
|
|
|
|
|
const [submitting, setSubmitting] = useState(false);
|
|
|
|
|
|
const [password, setPassword] = useState('');
|
|
|
|
|
|
|
|
|
|
|
|
const scrollBottomInset = isMobile ? 64 + 24 + insets.bottom + spacing.md : spacing.md;
|
|
|
|
|
|
|
|
|
|
|
|
const responsivePadding = useResponsiveSpacing({ xs: 8, sm: 12, md: 16, lg: 24, xl: 32 });
|
|
|
|
|
|
|
|
|
|
|
|
const loadStatus = useCallback(async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
const result = await authService.getDeletionStatus();
|
|
|
|
|
|
setStatus(result);
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error('加载注销状态失败:', error);
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
setLoading(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
loadStatus();
|
|
|
|
|
|
}, [loadStatus]);
|
|
|
|
|
|
|
|
|
|
|
|
const handleRequestDeletion = useCallback(async () => {
|
|
|
|
|
|
if (!password.trim()) {
|
|
|
|
|
|
Alert.alert('提示', '请输入密码确认');
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Alert.alert(
|
|
|
|
|
|
'确认注销',
|
|
|
|
|
|
'注销后,您的账号将在90天后永久删除。在此期间,您可以通过重新登录来取消注销。确定要继续吗?',
|
|
|
|
|
|
[
|
|
|
|
|
|
{ text: '取消', style: 'cancel' },
|
|
|
|
|
|
{
|
|
|
|
|
|
text: '确定注销',
|
|
|
|
|
|
style: 'destructive',
|
|
|
|
|
|
onPress: async () => {
|
|
|
|
|
|
setSubmitting(true);
|
|
|
|
|
|
try {
|
|
|
|
|
|
const result = await authService.requestAccountDeletion(password);
|
|
|
|
|
|
if (result) {
|
|
|
|
|
|
setStatus(result);
|
|
|
|
|
|
setPassword('');
|
|
|
|
|
|
Alert.alert('已申请注销', '您的账号将在90天后永久删除。在此期间登录即可取消注销。');
|
|
|
|
|
|
await logout();
|
|
|
|
|
|
router.replace(hrefs.hrefAuthLogin());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
Alert.alert('失败', '密码错误或申请失败,请重试');
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error('申请注销失败:', error);
|
|
|
|
|
|
Alert.alert('失败', '申请注销失败,请稍后重试');
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
setSubmitting(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
]
|
|
|
|
|
|
);
|
|
|
|
|
|
}, [password, logout, router]);
|
|
|
|
|
|
|
|
|
|
|
|
const handleCancelDeletion = useCallback(async () => {
|
|
|
|
|
|
Alert.alert(
|
|
|
|
|
|
'取消注销',
|
|
|
|
|
|
'确定要取消注销申请吗?您的账号将恢复正常使用。',
|
|
|
|
|
|
[
|
|
|
|
|
|
{ text: '继续注销', style: 'cancel' },
|
|
|
|
|
|
{
|
|
|
|
|
|
text: '确定取消',
|
|
|
|
|
|
onPress: async () => {
|
|
|
|
|
|
setSubmitting(true);
|
|
|
|
|
|
try {
|
|
|
|
|
|
const ok = await authService.cancelAccountDeletion();
|
|
|
|
|
|
if (ok) {
|
|
|
|
|
|
setStatus({ is_pending_deletion: false });
|
|
|
|
|
|
Alert.alert('已取消', '注销申请已取消,您的账号已恢复正常使用');
|
|
|
|
|
|
} else {
|
|
|
|
|
|
Alert.alert('失败', '取消注销失败,请稍后重试');
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error('取消注销失败:', error);
|
|
|
|
|
|
Alert.alert('失败', '取消注销失败,请稍后重试');
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
setSubmitting(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
]
|
|
|
|
|
|
);
|
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
|
|
if (loading) {
|
|
|
|
|
|
return (
|
2026-05-03 22:01:43 +08:00
|
|
|
|
<SafeAreaView style={styles.container} edges={['top', 'bottom']}>
|
<think>Let me analyze the staged changes to generate a proper conventional commit message.
Looking at the changes:
1. **New files**:
- `app/(app)/(tabs)/profile/account-deletion.tsx` - account deletion screen
- `app/(app)/(tabs)/profile/privacy-settings.tsx` - privacy settings screen
- `src/screens/profile/AccountDeletionScreen.tsx` - account deletion implementation
- `src/screens/profile/PrivacySettingsScreen.tsx` - privacy settings implementation
2. **Modified files**:
- Database changes: `LocalDataSource.ts`, `DatabaseManager.ts`, `DatabaseConfig.ts`, `MigrationManager.ts` - refactoring database layer (removing LockManager, simplified initialization, added retry logic)
- Auth store: `authStore.ts` - changed `initDatabase` to `switchDatabase`
- Auth service: `authService.ts` - added privacy settings and account deletion methods
- DTOs: `dto.ts` - added PrivacySettingsDTO, DeletionStatusDTO, VoteOptionDTO, VoteResultDTO types
- Navigation: `hrefs.ts` - added new href functions for privacy settings and account deletion
- Profile screens: `SettingsScreen.tsx`, `index.ts`, `_layout.tsx` - added new menu items and routes
- Various message screens - added keyboard handling props
- `app/_layout.tsx` - added CSS for mobile touch handling
- `CreatePostScreen.tsx` - fixed vote_options format
- `PostDetailScreen.tsx` - added type annotations for vote handling
- `MediaCacheManager.ts` - updated to use new expo-file-system API
- `VerificationSettingsScreen.tsx` - fixed type safety
- `AccountSecurityScreen.tsx` - styling refactoring
This is a multi-faceted change involving:
Database refactoring, new privacy/account deletion features, bug fixes, and UI improvements. The database changes appear to be refactoring without new functionality. The most significant changes are the privacy settings and account deletion features, plus bug fixes like the vote options format and mobile touch handling.
</think>
feat(profile): add privacy settings and account deletion screens
Add privacy settings and account deletion functionality with new screens and APIs. Refactor database initialization to use switchDatabase for user switching. Fix vote options format in post creation and add type safety to vote handling. Improve mobile touch handling in layout and message screens. Update media cache to use new expo-file-system API.
BREAKING CHANGE: Database initialization now uses switchDatabase instead of initDatabase for user switching
2026-04-08 16:48:19 +08:00
|
|
|
|
<View style={styles.loadingWrap}>
|
|
|
|
|
|
<ActivityIndicator size="large" color={colors.primary.main} />
|
|
|
|
|
|
</View>
|
|
|
|
|
|
</SafeAreaView>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
2026-05-03 22:01:43 +08:00
|
|
|
|
<SafeAreaView style={styles.container} edges={['top', 'bottom']}>
|
|
|
|
|
|
<StatusBar style="auto" />
|
|
|
|
|
|
<SimpleHeader title="注销账号" onBack={() => router.back()} />
|
<think>Let me analyze the staged changes to generate a proper conventional commit message.
Looking at the changes:
1. **New files**:
- `app/(app)/(tabs)/profile/account-deletion.tsx` - account deletion screen
- `app/(app)/(tabs)/profile/privacy-settings.tsx` - privacy settings screen
- `src/screens/profile/AccountDeletionScreen.tsx` - account deletion implementation
- `src/screens/profile/PrivacySettingsScreen.tsx` - privacy settings implementation
2. **Modified files**:
- Database changes: `LocalDataSource.ts`, `DatabaseManager.ts`, `DatabaseConfig.ts`, `MigrationManager.ts` - refactoring database layer (removing LockManager, simplified initialization, added retry logic)
- Auth store: `authStore.ts` - changed `initDatabase` to `switchDatabase`
- Auth service: `authService.ts` - added privacy settings and account deletion methods
- DTOs: `dto.ts` - added PrivacySettingsDTO, DeletionStatusDTO, VoteOptionDTO, VoteResultDTO types
- Navigation: `hrefs.ts` - added new href functions for privacy settings and account deletion
- Profile screens: `SettingsScreen.tsx`, `index.ts`, `_layout.tsx` - added new menu items and routes
- Various message screens - added keyboard handling props
- `app/_layout.tsx` - added CSS for mobile touch handling
- `CreatePostScreen.tsx` - fixed vote_options format
- `PostDetailScreen.tsx` - added type annotations for vote handling
- `MediaCacheManager.ts` - updated to use new expo-file-system API
- `VerificationSettingsScreen.tsx` - fixed type safety
- `AccountSecurityScreen.tsx` - styling refactoring
This is a multi-faceted change involving:
Database refactoring, new privacy/account deletion features, bug fixes, and UI improvements. The database changes appear to be refactoring without new functionality. The most significant changes are the privacy settings and account deletion features, plus bug fixes like the vote options format and mobile touch handling.
</think>
feat(profile): add privacy settings and account deletion screens
Add privacy settings and account deletion functionality with new screens and APIs. Refactor database initialization to use switchDatabase for user switching. Fix vote options format in post creation and add type safety to vote handling. Improve mobile touch handling in layout and message screens. Update media cache to use new expo-file-system API.
BREAKING CHANGE: Database initialization now uses switchDatabase instead of initDatabase for user switching
2026-04-08 16:48:19 +08:00
|
|
|
|
<ScrollView contentContainerStyle={[styles.scrollContent, { paddingBottom: scrollBottomInset, paddingHorizontal: responsivePadding }]}>
|
|
|
|
|
|
<View style={styles.content}>
|
|
|
|
|
|
{status?.is_pending_deletion ? (
|
|
|
|
|
|
<View style={styles.section}>
|
|
|
|
|
|
<View style={styles.statusCard}>
|
|
|
|
|
|
<Text variant="body" style={styles.statusTitle}>
|
|
|
|
|
|
账号注销申请中
|
|
|
|
|
|
</Text>
|
|
|
|
|
|
<Text variant="body" color={colors.text.secondary}>
|
|
|
|
|
|
您的账号将在以下天数后永久删除:
|
|
|
|
|
|
</Text>
|
|
|
|
|
|
<Text variant="body" style={styles.daysText}>
|
|
|
|
|
|
{status.cool_down_days || 90} 天
|
|
|
|
|
|
</Text>
|
|
|
|
|
|
<Text variant="caption" color={colors.text.secondary}>
|
|
|
|
|
|
在此期间,您可以通过重新登录或点击下方按钮来取消注销申请。
|
|
|
|
|
|
</Text>
|
|
|
|
|
|
<TouchableOpacity
|
|
|
|
|
|
style={[styles.secondaryButton, styles.cancelButton, submitting && styles.buttonDisabled]}
|
|
|
|
|
|
onPress={handleCancelDeletion}
|
|
|
|
|
|
disabled={submitting}
|
|
|
|
|
|
>
|
|
|
|
|
|
{submitting ? (
|
|
|
|
|
|
<ActivityIndicator size="small" color={colors.text.primary} />
|
|
|
|
|
|
) : (
|
|
|
|
|
|
<Text style={styles.secondaryButtonText}>取消注销申请</Text>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
|
</View>
|
|
|
|
|
|
</View>
|
|
|
|
|
|
) : (
|
|
|
|
|
|
<View style={styles.section}>
|
|
|
|
|
|
{/* 警告卡片 */}
|
|
|
|
|
|
<View style={styles.warningCard}>
|
|
|
|
|
|
<Text variant="body" style={styles.warningTitle}>
|
|
|
|
|
|
警告:账号注销后将无法恢复
|
|
|
|
|
|
</Text>
|
|
|
|
|
|
<Text variant="body" style={styles.warningText}>
|
|
|
|
|
|
注销后,您的账号将在90天后永久删除。
|
|
|
|
|
|
</Text>
|
|
|
|
|
|
<Text variant="body" style={styles.warningText}>
|
|
|
|
|
|
在此期间,您可以通过重新登录来取消注销。
|
|
|
|
|
|
</Text>
|
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
|
|
{/* 注销说明 */}
|
|
|
|
|
|
<View style={styles.sectionContent}>
|
|
|
|
|
|
<Text style={styles.sectionTitle}>注销后将发生什么</Text>
|
|
|
|
|
|
<View style={styles.listItem}>
|
|
|
|
|
|
<MaterialCommunityIcons name="close-circle" size={16} color={colors.error.main} style={styles.listBullet} />
|
|
|
|
|
|
<Text variant="body" color={colors.text.secondary}>
|
|
|
|
|
|
您的个人资料将被删除
|
|
|
|
|
|
</Text>
|
|
|
|
|
|
</View>
|
|
|
|
|
|
<View style={styles.listItem}>
|
|
|
|
|
|
<MaterialCommunityIcons name="information" size={16} color={colors.warning.main} style={styles.listBullet} />
|
|
|
|
|
|
<Text variant="body" color={colors.text.secondary}>
|
|
|
|
|
|
您发布的帖子、评论将保留,但显示为「已注销用户」
|
|
|
|
|
|
</Text>
|
|
|
|
|
|
</View>
|
|
|
|
|
|
<View style={styles.listItem}>
|
|
|
|
|
|
<MaterialCommunityIcons name="close-circle" size={16} color={colors.error.main} style={styles.listBullet} />
|
|
|
|
|
|
<Text variant="body" color={colors.text.secondary}>
|
|
|
|
|
|
您的关注、粉丝关系将被清除
|
|
|
|
|
|
</Text>
|
|
|
|
|
|
</View>
|
|
|
|
|
|
<View style={styles.listItem}>
|
|
|
|
|
|
<MaterialCommunityIcons name="close-circle" size={16} color={colors.error.main} style={styles.listBullet} />
|
|
|
|
|
|
<Text variant="body" color={colors.text.secondary}>
|
|
|
|
|
|
您的收藏、点赞记录将被删除
|
|
|
|
|
|
</Text>
|
|
|
|
|
|
</View>
|
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
|
|
{/* 密码确认 */}
|
|
|
|
|
|
<View style={styles.sectionContent}>
|
|
|
|
|
|
<Text style={styles.sectionTitle}>请输入密码确认</Text>
|
|
|
|
|
|
<TextInput
|
|
|
|
|
|
style={styles.input}
|
|
|
|
|
|
placeholder="请输入密码"
|
|
|
|
|
|
placeholderTextColor={colors.text.hint}
|
|
|
|
|
|
secureTextEntry
|
|
|
|
|
|
value={password}
|
|
|
|
|
|
onChangeText={setPassword}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
|
|
{/* 按钮行 */}
|
|
|
|
|
|
<View style={styles.buttonRow}>
|
|
|
|
|
|
<TouchableOpacity
|
|
|
|
|
|
style={styles.secondaryButton}
|
|
|
|
|
|
onPress={() => router.back()}
|
|
|
|
|
|
>
|
|
|
|
|
|
<Text style={styles.secondaryButtonText}>返回</Text>
|
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
|
<TouchableOpacity
|
|
|
|
|
|
style={[styles.dangerButton, submitting && styles.buttonDisabled]}
|
|
|
|
|
|
onPress={handleRequestDeletion}
|
|
|
|
|
|
disabled={submitting || !password.trim()}
|
|
|
|
|
|
>
|
2026-04-11 04:27:22 +08:00
|
|
|
|
{submitting ? (
|
|
|
|
|
|
<ActivityIndicator size="small" color={colors.text.inverse} />
|
|
|
|
|
|
) : (
|
<think>Let me analyze the staged changes to generate a proper conventional commit message.
Looking at the changes:
1. **New files**:
- `app/(app)/(tabs)/profile/account-deletion.tsx` - account deletion screen
- `app/(app)/(tabs)/profile/privacy-settings.tsx` - privacy settings screen
- `src/screens/profile/AccountDeletionScreen.tsx` - account deletion implementation
- `src/screens/profile/PrivacySettingsScreen.tsx` - privacy settings implementation
2. **Modified files**:
- Database changes: `LocalDataSource.ts`, `DatabaseManager.ts`, `DatabaseConfig.ts`, `MigrationManager.ts` - refactoring database layer (removing LockManager, simplified initialization, added retry logic)
- Auth store: `authStore.ts` - changed `initDatabase` to `switchDatabase`
- Auth service: `authService.ts` - added privacy settings and account deletion methods
- DTOs: `dto.ts` - added PrivacySettingsDTO, DeletionStatusDTO, VoteOptionDTO, VoteResultDTO types
- Navigation: `hrefs.ts` - added new href functions for privacy settings and account deletion
- Profile screens: `SettingsScreen.tsx`, `index.ts`, `_layout.tsx` - added new menu items and routes
- Various message screens - added keyboard handling props
- `app/_layout.tsx` - added CSS for mobile touch handling
- `CreatePostScreen.tsx` - fixed vote_options format
- `PostDetailScreen.tsx` - added type annotations for vote handling
- `MediaCacheManager.ts` - updated to use new expo-file-system API
- `VerificationSettingsScreen.tsx` - fixed type safety
- `AccountSecurityScreen.tsx` - styling refactoring
This is a multi-faceted change involving:
Database refactoring, new privacy/account deletion features, bug fixes, and UI improvements. The database changes appear to be refactoring without new functionality. The most significant changes are the privacy settings and account deletion features, plus bug fixes like the vote options format and mobile touch handling.
</think>
feat(profile): add privacy settings and account deletion screens
Add privacy settings and account deletion functionality with new screens and APIs. Refactor database initialization to use switchDatabase for user switching. Fix vote options format in post creation and add type safety to vote handling. Improve mobile touch handling in layout and message screens. Update media cache to use new expo-file-system API.
BREAKING CHANGE: Database initialization now uses switchDatabase instead of initDatabase for user switching
2026-04-08 16:48:19 +08:00
|
|
|
|
<Text style={styles.dangerButtonText}>确认注销</Text>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
|
</View>
|
|
|
|
|
|
</View>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</View>
|
|
|
|
|
|
</ScrollView>
|
|
|
|
|
|
</SafeAreaView>
|
|
|
|
|
|
);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export default AccountDeletionScreen;
|