refactor: cleanup dead code from reminder system

- Remove permission fallback logic from LocalNotificationService
- Remove unused methods: _scheduleInApp*, _trackFallback, bindInAppReminderHandler
- Remove unused fields: _permissionFallbackTracker, _inAppReminderHandler, _inAppFallbackTimersByEventId, _canDeliverSystemNotification
- Remove unused _showSnoozeOptions from ReminderOverlay
- Remove unused reminderActionExecutor from AuthSessionBootstrapper
- Remove obsolete test files: reminder_permission_fallback_test, reminder_notification_bridge_test, auth_session_bootstrapper_test
- Add native notification grouping (threadIdentifier/groupKey)
This commit is contained in:
qzl
2026-03-20 18:53:32 +08:00
parent 42c2fbc8f3
commit d17f5d78aa
7 changed files with 23 additions and 938 deletions
@@ -1,58 +0,0 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:mocktail/mocktail.dart';
import 'package:social_app/core/notifications/local_notification_service.dart';
import 'package:social_app/core/startup/auth_session_bootstrapper.dart';
import 'package:social_app/features/auth/presentation/bloc/auth_state.dart';
import 'package:social_app/features/calendar/data/services/calendar_service.dart';
import 'package:social_app/features/calendar/reminders/reminder_action_executor.dart';
class MockCalendarService extends Mock implements CalendarService {}
class MockLocalNotificationService extends Mock
implements LocalNotificationService {}
class MockReminderActionExecutor extends Mock
implements ReminderActionExecutor {}
void main() {
late MockCalendarService calendarService;
late MockLocalNotificationService notificationService;
late MockReminderActionExecutor reminderActionExecutor;
late AuthSessionBootstrapper bootstrapper;
setUp(() {
calendarService = MockCalendarService();
notificationService = MockLocalNotificationService();
reminderActionExecutor = MockReminderActionExecutor();
bootstrapper = AuthSessionBootstrapper(
calendarService: calendarService,
notificationService: notificationService,
reminderActionExecutor: reminderActionExecutor,
);
});
test('does not fetch calendar events for unauthenticated state', () async {
await bootstrapper.syncForAuthState(AuthUnauthenticated());
verifyNever(() => calendarService.getEventsForRange(any(), any()));
verifyNever(() => notificationService.rebuildUpcomingReminders(any()));
});
test('fetches upcoming events after authenticated state', () async {
when(
() => calendarService.getEventsForRange(any(), any()),
).thenAnswer((_) async => []);
when(
() => notificationService.rebuildUpcomingReminders(any()),
).thenAnswer((_) async {});
await bootstrapper.syncForAuthState(
const AuthAuthenticated(
user: AuthUser(id: 'u1', phone: 'a@test.com'),
),
);
verify(() => calendarService.getEventsForRange(any(), any())).called(1);
verify(() => notificationService.rebuildUpcomingReminders(any())).called(1);
});
}