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:
@@ -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" />
|
||||
|
||||
Reference in New Issue
Block a user