765efe288e
One-time prompt on first launch (Android only) directing the user to exclude bincio-rec from battery optimization. Uses the direct REQUEST_IGNORE_BATTERY_OPTIMIZATIONS system dialog with a fallback to the general settings page for OEMs that block the direct intent. Dismissal persisted in AsyncStorage so prompt never repeats.
32 lines
1004 B
TypeScript
32 lines
1004 B
TypeScript
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';
|
|
import { promptBatteryOptimizationIfNeeded } from './src/services/batteryOptimization';
|
|
|
|
// 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();
|
|
promptBatteryOptimizationIfNeeded();
|
|
}, []);
|
|
|
|
return (
|
|
<GestureHandlerRootView style={{ flex: 1 }}>
|
|
<StatusBar style="light" />
|
|
<AppNavigator />
|
|
</GestureHandlerRootView>
|
|
);
|
|
}
|