Skip to content

Commit

Permalink
Move the push token error in the service
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolay-vasilev-prime committed Feb 3, 2025
1 parent 723f57b commit acc70a5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,5 @@ class NotificationsBloc extends $NotificationsBloc {
(_) => _service.getPushToken().asResultStream(),
)
.setResultStateHandler(this)
.mapResult((token) => token ?? (throw NotFoundErrorModel()))
.publish();
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{{> licence.dart }}

import '../../base/models/errors/error_model.dart';
import '../../base/repositories/push_notification_repository.dart';

class NotificationService {
NotificationService(this._repository);

final PushNotificationRepository _repository;

Future<String?> getPushToken() =>
_repository.getToken();
Future<String> getPushToken() async =>
await _repository.getToken() ?? (throw NotFoundErrorModel());
}

0 comments on commit acc70a5

Please sign in to comment.