stream-feed-flutter icon indicating copy to clipboard operation
stream-feed-flutter copied to clipboard

Best way to check if a notification feed has unseen activity?

Open ObserverMoment opened this issue 2 years ago • 0 comments

Hi,

Just starting to dig into this package as I build out some social features for my application.

I can't see how to just check if there are one or more unseen activities on a notification feed. I don't need any details, or even need to know how many there are, I just need to display a dot if there are any.

Can you point me in the right direction please?

I initialise with:

_notificationFeed = context.streamFeedClient.notificationFeed( 'user_notification', [userId);

Get some initial data with: (I can't see any way via the SDK to get a summary or aggregated count or similar?) final feedData = await _notificationFeed.getActivities();

And subscribe with:

try {
      _feedSubscription = await _notificationFeed.subscribe(_updateIndicator);
    } catch (e) {
      print(e);
      throw Exception(e);
    } finally {
      setState(() {});
    }

Finally handle with:

  Future<void> _updateIndicator(RealtimeMessage? message) async {
    print(message);
  }

Is there a method somewhere that I'm not seeing on the feed client? And does the message that we get via the subscription contain the info that I am after?

Thanks for your help and also for the great package!

Rich

ObserverMoment avatar Aug 18 '21 17:08 ObserverMoment