google preperation 1

This commit is contained in:
2026-10-26 20:48:16 +01:00
parent 9a65ff7ad4
commit 3b50cb0fe9
47 changed files with 4969 additions and 4580 deletions
+5 -22
View File
@@ -3,6 +3,7 @@ import 'package:timezone/timezone.dart' as tz;
import 'package:timezone/data/latest.dart' as tz;
import 'package:flutter_timezone/flutter_timezone.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../services/app_settings.dart';
import '../services/google_calendar_service.dart';
class NotificationService {
@@ -92,6 +93,10 @@ class NotificationService {
/// Fetches the calendar and reschedules all reminders. Call on app start
/// and whenever notification settings change.
Future<void> rescheduleFromCalendar() async {
if (!AppSettings.instance.clubUnlocked) {
await cancelAll(); // reminders are a club-member feature
return;
}
final service = GoogleCalendarService();
try {
final now = DateTime.now();
@@ -172,28 +177,6 @@ class NotificationService {
} catch (_) {}
}
Future<void> scheduleTestNotification() async {
try {
await initialize();
final prefs = await SharedPreferences.getInstance();
final isSlovenian = (prefs.getString('language') ?? 'English') == 'Slovenian';
await _plugin.show(
9999,
isSlovenian ? 'Testno obvestilo' : 'Test Notification',
isSlovenian ? 'Obvestila delujejo!' : 'Notifications are working!',
_notifDetails,
);
final in10s = DateTime.now().add(const Duration(seconds: 10));
await _scheduleNotification(
id: 9998,
title: isSlovenian ? 'Načrtovano testno obvestilo' : 'Scheduled Test',
body: isSlovenian ? 'Načrtovana obvestila delujejo!' : 'Scheduled notifications are working!',
scheduledDate: in10s,
mode: await _scheduleMode(),
);
} catch (_) {}
}
Future<void> _scheduleNotification({
required int id,
required String title,