Scrollable Navigation Rail
This commit is contained in:
+17
-10
@@ -268,6 +268,21 @@ Future<void> main() async {
|
||||
debugPrint('dotenv load failed or timed out: $e');
|
||||
}
|
||||
|
||||
// Read VAPID_KEY once at startup. trim() handles trailing whitespace / BOM
|
||||
// artifacts that the .env parser may leave, which would cause isEmpty to
|
||||
// return true even when the key is present with a non-empty value.
|
||||
final vapidKey = kIsWeb ? (dotenv.env['VAPID_KEY']?.trim() ?? '') : '';
|
||||
if (kIsWeb) {
|
||||
if (vapidKey.isEmpty) {
|
||||
debugPrint(
|
||||
'Web FCM: VAPID_KEY not set in .env — web push notifications disabled. '
|
||||
'Add VAPID_KEY=<key> from Firebase Console → Project Settings → Cloud Messaging.',
|
||||
);
|
||||
} else {
|
||||
debugPrint('Web FCM: VAPID_KEY loaded (${vapidKey.length} chars).');
|
||||
}
|
||||
}
|
||||
|
||||
AppTime.initialize(location: 'Asia/Manila');
|
||||
|
||||
final supabaseUrl = dotenv.env['SUPABASE_URL'] ?? '';
|
||||
@@ -336,17 +351,9 @@ Future<void> main() async {
|
||||
final event = data.event;
|
||||
|
||||
// Web: register FCM token for iOS 16.4+ PWA push support.
|
||||
// Requires the VAPID key from Firebase Console → Project Settings →
|
||||
// Cloud Messaging → Web Push certificates → Key pair.
|
||||
// Add VAPID_KEY=<your_key> to your .env file.
|
||||
// vapidKey was read once at startup from dotenv — see boot sequence above.
|
||||
if (kIsWeb) {
|
||||
final vapidKey = dotenv.env['VAPID_KEY'] ?? '';
|
||||
if (vapidKey.isEmpty) {
|
||||
debugPrint(
|
||||
'Web FCM: VAPID_KEY not set in .env — skipping token registration.',
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (vapidKey.isEmpty) return; // already warned at startup
|
||||
if (event == AuthChangeEvent.signedIn) {
|
||||
try {
|
||||
final token = await FirebaseMessaging.instance.getToken(
|
||||
|
||||
Reference in New Issue
Block a user