feat: Implement Firebase push notifications with support for flavor-specific configurations.

This commit is contained in:
pradeepkumar
2026-03-08 21:55:52 +05:30
parent 744b7b7ca8
commit e129be5a59
26 changed files with 974 additions and 124 deletions

View File

@@ -73,6 +73,39 @@ class NotificationRepository {
);
}
}
/// Register FCM token with backend.
/// POST /notifications/fcm-token
Future<void> registerFcmToken(String token, String device) async {
try {
await _dio.post('/notifications/fcm-token', data: {
'token': token,
'device': device,
});
} on DioException catch (e) {
if (e.error is ApiException) throw e.error as ApiException;
throw ApiException(
message: e.message ?? 'Failed to register FCM token',
statusCode: e.response?.statusCode,
);
}
}
/// Remove FCM token from backend.
/// DELETE /notifications/fcm-token
Future<void> removeFcmToken(String token) async {
try {
await _dio.delete('/notifications/fcm-token', data: {
'token': token,
});
} on DioException catch (e) {
if (e.error is ApiException) throw e.error as ApiException;
throw ApiException(
message: e.message ?? 'Failed to remove FCM token',
statusCode: e.response?.statusCode,
);
}
}
}
class NotificationsResponse {