Skip to content

Commit

Permalink
Add embedded infos getter
Browse files Browse the repository at this point in the history
  • Loading branch information
crow committed Aug 29, 2024
1 parent 9d19ab3 commit aceacf6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/src/airship_automation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@ class AirshipAutomation {
_subscription = onEmbeddedInfoUpdated.listen(_updateEmbeddedIds);
}

bool isEmbeddedAvailable({required String embeddedId}) =>
_embeddedInfos.any((info) => info.embeddedId == embeddedId);

Stream<bool> isEmbeddedAvailableStream({required String embeddedId}) =>
(_isEmbeddedAvailableControllers[embeddedId] ??=
StreamController<bool>.broadcast()
..add(isEmbeddedAvailable(embeddedId: embeddedId)))
.stream;

bool isEmbeddedAvailable({required String embeddedId}) =>
_embeddedInfos.any((info) => info.embeddedId == embeddedId);
List<EmbeddedInfo> getEmbeddedInfos() => _embeddedInfos;

Stream<EmbeddedInfoUpdatedEvent> get onEmbeddedInfoUpdated => _module
.getEventStream("com.airship.flutter/event/embedded_info_updated")
Expand Down

0 comments on commit aceacf6

Please sign in to comment.