feat: Enable Firebase Cloud Messaging for iOS with platform-specific configurations and update Android build settings.

This commit is contained in:
pradeepkumar
2026-03-09 06:07:36 +05:30
parent 0102617dc7
commit f1003be757
5 changed files with 58 additions and 31 deletions

View File

@@ -30,16 +30,8 @@ class PushNotificationService {
void Function(String? actionUrl)? onNotificationTap;
/// Initialize Firebase Messaging and local notifications.
/// Skipped on iOS until Firebase iOS app is configured.
Future<void> initialize() async {
if (_initialized) return;
// Skip on iOS — no Firebase iOS app configured yet
if (Platform.isIOS) {
debugPrint('[FCM] Skipped on iOS — no Firebase iOS app configured');
return;
}
_initialized = true;
_messaging = FirebaseMessaging.instance;
@@ -188,7 +180,7 @@ class PushNotificationService {
/// Unregister FCM token from backend (call on logout).
Future<void> unregister() async {
if (Platform.isIOS || _currentToken == null) return;
if (_currentToken == null) return;
try {
await _repo.removeFcmToken(_currentToken!);
debugPrint('[FCM] Token unregistered from backend');
@@ -200,7 +192,6 @@ class PushNotificationService {
/// Re-register token after login.
Future<void> registerAfterLogin() async {
if (Platform.isIOS) return;
await _getAndRegisterToken();
}
}