feat: section 3 — km milestone notifications

- Foreground notification handler in App.tsx (iOS shows banners while active)
- requestNotificationPermissions() called on app mount
- GPS task tracks running distance per recording session (module-level state)
- Fires immediate notification at each km crossed, gated on kmNotifications setting
This commit is contained in:
Davide Scaini
2026-06-03 09:03:55 +02:00
parent 2378d31f0b
commit 5f12b2857d
4 changed files with 75 additions and 5 deletions
+17
View File
@@ -1,8 +1,25 @@
import { useEffect } from 'react';
import { StatusBar } from 'expo-status-bar';
import * as Notifications from 'expo-notifications';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { AppNavigator } from './src/navigation/AppNavigator';
import { requestNotificationPermissions } from './src/services/gps';
// Show notifications even when the app is in the foreground (iOS suppresses by default)
Notifications.setNotificationHandler({
handleNotification: async () => ({
shouldShowBanner: true,
shouldShowList: true,
shouldPlaySound: true,
shouldSetBadge: false,
}),
});
export default function App() {
useEffect(() => {
requestNotificationPermissions();
}, []);
return (
<GestureHandlerRootView style={{ flex: 1 }}>
<StatusBar style="light" />