Notifications: local-only session reminders; drop the FCM-bridge framing

- Session-expiry reminders are purely on-device (AlarmManager); added an Android
  notification channel and a "Send a test reminder" button (Account > Notifications)
  to verify delivery without a real session
- Strip all FCM/bridge talk from unifiedPush.ts + README; UnifiedPush(ntfy) is now
  an optional no-op stub for hypothetical future server-initiated messages only

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Hank 2026-07-07 14:14:34 -07:00
parent 0bc9aa97ba
commit 02e2c750ea
4 changed files with 88 additions and 56 deletions

View file

@ -1,7 +1,8 @@
import React, { useCallback, useState } from 'react';
import { StyleSheet, Switch, Text, TouchableOpacity, View } from 'react-native';
import { Alert, StyleSheet, Switch, Text, TouchableOpacity, View } from 'react-native';
import { useFocusEffect } from '@react-navigation/native';
import { useTheme } from '@/theme/ThemeContext';
import { sendTestReminder } from '@/notifications/localReminders';
import {
DEFAULT_LEAD_MINUTES,
LEAD_STEP,
@ -80,9 +81,24 @@ export function NotificationsScreen() {
</View>
</View>
<TouchableOpacity
style={[styles.testBtn, { borderColor: colors.primary }]}
onPress={async () => {
const ok = await sendTestReminder(10);
Alert.alert(
ok ? 'Test scheduled' : 'Notifications blocked',
ok
? 'A test reminder will appear in ~10 seconds (you can background the app).'
: 'Allow notifications for BigBrainParking in system settings.',
);
}}
>
<Text style={{ color: colors.primary, fontWeight: '700' }}>Send a test reminder</Text>
</TouchableOpacity>
<Text style={[styles.footnote, { color: colors.subtext }]}>
Reminders are scheduled on-device (no Google services needed). Adjusts in{' '}
{LEAD_STEP}-minute steps, {MIN_LEAD_MINUTES}{MAX_LEAD_MINUTES} min.
Reminders fire entirely on-device (AlarmManager) no server, no push, no Google
services. Adjusts in {LEAD_STEP}-minute steps, {MIN_LEAD_MINUTES}{MAX_LEAD_MINUTES} min.
</Text>
</View>
);
@ -108,5 +124,12 @@ const styles = StyleSheet.create({
leadDisplay: { alignItems: 'center' },
leadValue: { fontSize: 40, fontWeight: '800' },
leadUnit: { fontSize: 13, marginTop: 2 },
footnote: { fontSize: 12, marginTop: 20, lineHeight: 18 },
testBtn: {
marginTop: 20,
borderWidth: 1.5,
borderRadius: 12,
padding: 14,
alignItems: 'center',
},
footnote: { fontSize: 12, marginTop: 16, lineHeight: 18 },
});