feat: add Telegram mini app connect for P2P access

This commit is contained in:
2026-01-29 21:27:13 +03:00
parent 3879780c14
commit dd1e0dc294
48 changed files with 2558 additions and 9502 deletions
+17 -1
View File
@@ -12,6 +12,7 @@ import {
Platform,
KeyboardAvoidingView,
AlertButton,
Image,
} from 'react-native';
import { useNavigation } from '@react-navigation/native';
import { useAuth } from '../contexts/AuthContext';
@@ -74,6 +75,12 @@ const getEmojiFromAvatarId = (avatarId: string): string => {
return avatar ? avatar.emoji : '👤';
};
// Check if avatar is an uploaded image URL vs emoji avatar ID
const isUploadedImageUrl = (avatarUrl: string | null): boolean => {
if (!avatarUrl) return false;
return avatarUrl.startsWith('http://') || avatarUrl.startsWith('https://');
};
const EditProfileScreen: React.FC = () => {
const navigation = useNavigation();
const { user } = useAuth();
@@ -242,7 +249,11 @@ const EditProfileScreen: React.FC = () => {
>
<View style={[styles.avatarCircle, { backgroundColor: colors.surface }]}>
{avatarUrl ? (
<Text style={styles.avatarEmoji}>{getEmojiFromAvatarId(avatarUrl)}</Text>
isUploadedImageUrl(avatarUrl) ? (
<Image source={{ uri: avatarUrl }} style={styles.avatarImage} />
) : (
<Text style={styles.avatarEmoji}>{getEmojiFromAvatarId(avatarUrl)}</Text>
)
) : (
<Text style={[styles.avatarInitial, { color: colors.textSecondary }]}>
{fullName?.charAt(0)?.toUpperCase() || user?.email?.charAt(0)?.toUpperCase() || '?'}
@@ -382,6 +393,11 @@ const styles = StyleSheet.create({
avatarEmoji: {
fontSize: 70,
},
avatarImage: {
width: 120,
height: 120,
borderRadius: 60,
},
avatarInitial: {
fontSize: 48,
fontWeight: 'bold',
+70 -43
View File
@@ -392,16 +392,9 @@ const SettingsScreen: React.FC = () => {
};
return (
<SafeAreaView style={[styles.container, { backgroundColor: colors.background }]} testID="settings-screen">
<View style={[styles.container, { backgroundColor: colors.background }]} testID="settings-screen">
<StatusBar barStyle={isDarkMode ? "light-content" : "dark-content"} />
{/* Header */}
<View style={[styles.header, { backgroundColor: colors.surface, borderBottomColor: colors.border }]}>
<View style={{ width: 40 }} />
<Text style={[styles.headerTitle, { color: colors.text }]}>Settings</Text>
<View style={{ width: 40 }} />
</View>
<ScrollView showsVerticalScrollIndicator={false}>
{/* ACCOUNT SECTION */}
@@ -526,42 +519,76 @@ const SettingsScreen: React.FC = () => {
{/* DEVELOPER OPTIONS (only in DEV) */}
{__DEV__ && (
<View style={[styles.section, { backgroundColor: colors.surface, marginTop: 20 }]}>
<Text style={[styles.sectionHeader, { color: colors.textSecondary }]}>DEVELOPER</Text>
<SettingItem
icon="🗑️"
title="Reset Wallet"
subtitle="Clear all wallet data"
textColor="#FF9500"
showArrow={false}
onPress={() => {
showAlert(
'Reset Wallet',
'This will delete all wallet data including saved accounts and keys. Are you sure?',
[
{ text: 'Cancel', style: 'cancel' },
{
text: 'Reset',
style: 'destructive',
onPress: async () => {
try {
await AsyncStorage.multiRemove([
'@pezkuwi_wallets',
'@pezkuwi_selected_account',
'@pezkuwi_selected_network'
]);
showAlert('Success', 'Wallet data cleared. Restart the app to see changes.');
} catch {
showAlert('Error', 'Failed to clear wallet data');
<>
<SectionHeader title="DEVELOPER" />
<View style={[styles.section, { backgroundColor: colors.surface }]}>
<SettingItem
icon="🔄"
title="Reset Onboarding"
subtitle="Show Welcome & Verify screens again"
textColor="#FF9500"
showArrow={false}
onPress={() => {
showAlert(
'Reset Onboarding',
'This will reset onboarding state. Restart the app to see the Welcome screen.',
[
{ text: 'Cancel', style: 'cancel' },
{
text: 'Reset',
style: 'destructive',
onPress: async () => {
try {
await AsyncStorage.multiRemove([
'@pezkuwi/privacy_consent_accepted',
'@pezkuwi_human_verified'
]);
showAlert('Success', 'Onboarding reset. Restart the app to see changes.');
} catch {
showAlert('Error', 'Failed to reset onboarding');
}
}
}
}
]
);
}}
testID="reset-wallet-button"
/>
</View>
]
);
}}
testID="reset-onboarding-button"
/>
<SettingItem
icon="🗑️"
title="Reset Wallet"
subtitle="Clear all wallet data"
textColor="#FF9500"
showArrow={false}
onPress={() => {
showAlert(
'Reset Wallet',
'This will delete all wallet data including saved accounts and keys. Are you sure?',
[
{ text: 'Cancel', style: 'cancel' },
{
text: 'Reset',
style: 'destructive',
onPress: async () => {
try {
await AsyncStorage.multiRemove([
'@pezkuwi_wallets',
'@pezkuwi_selected_account',
'@pezkuwi_selected_network'
]);
showAlert('Success', 'Wallet data cleared. Restart the app to see changes.');
} catch {
showAlert('Error', 'Failed to clear wallet data');
}
}
}
]
);
}}
testID="reset-wallet-button"
/>
</View>
</>
)}
{/* LOGOUT */}
@@ -925,7 +952,7 @@ const SettingsScreen: React.FC = () => {
</SafeAreaView>
</Modal>
</SafeAreaView>
</View>
);
};