feat: Enable Firebase Cloud Messaging for iOS with platform-specific configurations and update Android build settings.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user