Skip to content

Commit 3a3ffa3

Browse files
removed the manual refresh notifications
1 parent cbb7eb7 commit 3a3ffa3

File tree

1 file changed

+9
-83
lines changed

1 file changed

+9
-83
lines changed

app/(tabs)/profile.tsx

Lines changed: 9 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ import { LinearGradient } from 'expo-linear-gradient';
1313
import { router } from 'expo-router';
1414
import React, { useCallback, useMemo, useRef, useState } from 'react';
1515
import {
16-
ActivityIndicator,
17-
Animated,
18-
Platform,
19-
Pressable,
20-
RefreshControl,
21-
ScrollView,
22-
StyleSheet,
23-
Text,
24-
View
16+
ActivityIndicator,
17+
Animated,
18+
Platform,
19+
Pressable,
20+
RefreshControl,
21+
ScrollView,
22+
StyleSheet,
23+
Text,
24+
View,
2525
} from 'react-native';
2626

2727
interface StatCardProps {
@@ -82,7 +82,6 @@ export default function ProfileScreen() {
8282
// Animations
8383
const signOutScale = useRef(new Animated.Value(1)).current;
8484
const notificationScale = useRef(new Animated.Value(1)).current;
85-
const refreshNotifScale = useRef(new Animated.Value(1)).current;
8685

8786
const themedStyles = useMemo(
8887
() => ({
@@ -180,43 +179,6 @@ export default function ProfileScreen() {
180179
router.push('/send-notification' as any);
181180
};
182181

183-
const handleRefreshNotifications = async () => {
184-
if (Platform.OS === 'ios') {
185-
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium);
186-
}
187-
188-
if (!user?.uid) {
189-
Alert.alert('Error', 'You must be logged in to refresh notifications');
190-
return;
191-
}
192-
193-
try {
194-
const pushToken = await NotificationService.registerForPushNotifications();
195-
196-
if (pushToken) {
197-
await NotificationService.storePushToken(user.uid, pushToken);
198-
console.log('Push token refreshed:', pushToken);
199-
Alert.alert(
200-
'Success',
201-
'Push notifications enabled! You will now receive event notifications.',
202-
[{ text: 'OK' }]
203-
);
204-
} else {
205-
Alert.alert(
206-
'Notifications Unavailable',
207-
'Push notifications could not be enabled. This may be because:\n\n' +
208-
'• You denied notification permissions\n' +
209-
'• You are using Expo Go (use a development build instead)\n' +
210-
'• The app is not properly configured for push notifications',
211-
[{ text: 'OK' }]
212-
);
213-
}
214-
} catch (error) {
215-
console.error('Error refreshing push token:', error);
216-
Alert.alert('Error', 'Failed to refresh notifications. Please try again.');
217-
}
218-
};
219-
220182
const animateButton = (anim: Animated.Value, pressed: boolean) => {
221183
Animated.spring(anim, {
222184
toValue: pressed ? 0.97 : 1,
@@ -412,30 +374,6 @@ export default function ProfileScreen() {
412374
)}
413375

414376
<FadeInView delay={350} direction="up">
415-
<Pressable
416-
onPressIn={() => animateButton(refreshNotifScale, true)}
417-
onPressOut={() => animateButton(refreshNotifScale, false)}
418-
onPress={handleRefreshNotifications}
419-
>
420-
<Animated.View style={{ transform: [{ scale: refreshNotifScale }] }}>
421-
<View
422-
style={[
423-
styles.refreshNotifButton,
424-
{ backgroundColor: colors.cardBackground },
425-
theme.shadows.sm,
426-
]}
427-
>
428-
<IconSymbol name="arrow.clockwise" size={20} color={colors.primary} />
429-
<Text style={[styles.refreshNotifButtonText, { color: colors.text }]}>
430-
Refresh Notifications
431-
</Text>
432-
<IconSymbol name="chevron.right" size={16} color={colors.textTertiary} />
433-
</View>
434-
</Animated.View>
435-
</Pressable>
436-
</FadeInView>
437-
438-
<FadeInView delay={400} direction="up">
439377
<Pressable
440378
onPressIn={() => animateButton(signOutScale, true)}
441379
onPressOut={() => animateButton(signOutScale, false)}
@@ -635,18 +573,6 @@ const styles = StyleSheet.create({
635573
fontSize: 16,
636574
fontWeight: '600',
637575
},
638-
refreshNotifButton: {
639-
flexDirection: 'row',
640-
alignItems: 'center',
641-
padding: 16,
642-
borderRadius: 16,
643-
gap: 12,
644-
},
645-
refreshNotifButtonText: {
646-
flex: 1,
647-
fontSize: 16,
648-
fontWeight: '600',
649-
},
650576
signOutButton: {
651577
flexDirection: 'row',
652578
alignItems: 'center',

0 commit comments

Comments
 (0)