Git Product home page Git Product logo

getstream / stream-feed-flutter Goto Github PK

View Code? Open in Web Editor NEW
71.0 32.0 66.0 7.2 MB

Stream Feed official Flutter SDK. Build your own feed experience using Dart and Flutter.

Home Page: https://getstream.io

License: Other

Kotlin 0.03% Swift 0.28% Objective-C 0.01% Dart 98.44% Shell 0.03% HTML 0.71% Ruby 0.50%
stream getstream feed flutter dart activity-feed feed-sdk flutter-plugin stream-feed hacktoberfest

stream-feed-flutter's Introduction

Official Flutter packages for Stream Activity Feeds

The official Dart client for Stream Activity Feeds, a service for building activity feed applications. This library can be used on any Dart project and on both mobile and web apps with Flutter. You can sign up for a Stream account at https://getstream.io/get_started.

Note: The user interface for the activity feed can vary widely across different apps. Most of our activity feed customers integrate with Stream via their backend and build their own UI. This takes advantage of Stream’s scalability while keeping full control over the UI. We update this library but not as frequently as other SDKs.

Pub Build status codecov melos

Stream Feed Activity Feed cover image

⚠️ This SDK is no longer actively maintained by Stream

A Feeds integration includes a combination of server-side and client-side code and the interface can vary widely which is why we are no longer focussing on supporting this SDK. If you are starting from scratch we recommend you only use the server-side SDKs.

This is by no means a reflection of our commitment to maintaining and improving the Feeds API which will always be a product that we support.

We continue to welcome pull requests from community members in case you want to improve this SDK.


🔗 Quick Links

  • Register to get an API key for Stream Activity Feeds
  • Tutorial to learn how to setup a timeline feed, follow other feeds and post new activities.
  • Stream Activity Feeds UI Kit to jumpstart your design with notifications and social feeds

🛠 Installation

Install from pub

Next step is to add stream_feed to your dependencies, to do that just open pubspec.yaml and add it inside the dependencies section.

dependencies:
  flutter:
    sdk: flutter

  stream_feed: ^[latest-version]

Using with Flutter

This package can be integrated into Flutter applications. Remember to not expose the App Secret in your Flutter web apps, mobile apps, or other non-trusted environments like desktop apps.

🔌 Usage

API client setup Serverside + Clientside

If you want to use the API client directly on your web/mobile app you need to generate a user token server-side and pass it.

Server-side token generation

// Instantiate a new client (server side)
const apiKey = 'my-API-key';
const secret = 'my-API-secret';

// Instantiate a new client (server side)
var client = StreamFeedClient(apiKey, secret: secret);

// Optionally supply the app identifier and an options object specifying the data center to use and timeout for requests (15s)
client = StreamFeedClient(apiKey,
      secret: secret,
      appId: 'yourappid',
      options: StreamHttpClientOptions(
          location: Location.usEast, connectTimeout: Duration(seconds: 15)));

// Create a token for user with id "the-user-id"
final userToken = client.frontendToken('the-user-id');

⚠️ for security, you must never expose your API secret or generated client side token, and it's highly recommended to use exp claim in client side token.

Client API init

// Instantiate new client with a user token
var client = StreamFeedClient(apiKey, token: Token('userToken'));

🔮 Examples

// Instantiate a feed object server side
var user1 = client.flatFeed('user', '1');

// Get activities from 5 to 10 (slow pagination)
final activities = await user1.getActivities(limit: 5, offset: 5);
// Filter on an id less than a given UUID
final filtered_activities = await user1.getActivities(
      limit: 5,
      filter: Filter().idLessThan('e561de8f-00f1-11e4-b400-0cc47a024be0')

// All API calls are performed asynchronous and return a Promise object
await user1
    .getActivities(
        limit: 5,
        filter: Filter().idLessThan('e561de8f-00f1-11e4-b400-0cc47a024be0'))
    .then((value) => /* on success */
        print(value))
    .onError((error,
              stackTrace) => /* on failure, reason.error contains an explanation */
        print(error));

// Create a new activity
final activity = Activity( actor: '1', verb: 'tweet', object: '1', foreignId: 'tweet:1' );
final added_activity = await user1.addActivity(activity);
// Create a bit more complex activity
final complex_activity = Activity(
    actor: '1',
    verb: 'run',
    object: '1',
    foreignId: 'run:1',
    extraData: {
      'course': {'name': 'Golden Gate park', 'distance': 10},
      'participants': ['Thierry', 'Tommaso'],
      'started_at': DateTime.now().toIso8601String(),
    },
  );
final added_complex_activity = await user1.addActivity(complex_activity);

// Remove an activity by its id
await user1.removeActivityById('e561de8f-00f1-11e4-b400-0cc47a024be0');
// or remove by the foreign id
await user1.removeActivityByForeignId('tweet:1');

// mark a notification feed as read
await notification1.getActivities(
  marker: ActivityMarker().allRead(),
);


// mark a notification feed as seen
await notification1.getActivities(
  marker: ActivityMarker().allSeen(),
);

// Follow another feed
await user1.follow(client.flatFeed('flat', '42'));

// Stop following another feed
await user1.unfollow(client.flatFeed('flat', '42'));

// Stop following another feed while keeping previously published activities
// from that feed
await user1.unfollow(client.flatFeed('flat', '42'), keepHistory: true);

// Follow another feed without copying the history
await user1.follow(client.flatFeed('flat', '42'), activityCopyLimit: 0);

// List followers, following
await user1.getFollowers(limit: 10, offset: 10);
await user1.getFollowed(limit: 10, offset: 0);


await user1.follow(client.flatFeed('flat', '42'));

// adding multiple activities
const activities = [
  Activity(actor: '1', verb: 'tweet', object: '1'),
  Activity(actor: '2', verb: 'tweet', object: '3'),
];
await user1.addActivities(activities);

// specifying additional feeds to push the activity to using the to param
// especially useful for notification style feeds
final to = FeedId.fromIds(['user:2', 'user:3']);
final activityTo = Activity(
  to: to,
  actor: '1',
  verb: 'tweet',
  object: '1',
  foreignId: 'tweet:1',
);
await user1.addActivity(activityTo);


// adding one activity to multiple feeds
final feeds = FeedId.fromIds(['flat:1', 'flat:2', 'flat:3', 'flat:4']);
final activityTarget = Activity(
  actor: 'User:2',
  verb: 'pin',
  object: 'Place:42',
  target: 'Board:1',
);

// ⚠️ server-side only!
await client.batch.addToMany(activityTarget, feeds!);

// Batch create follow relations (let flat:1 follow user:1, user:2 and user:3 feeds in one single request)
const follows = [
  FollowRelation(source: 'flat:1', target: 'user:1'),
  FollowRelation(source:'flat:1', target: 'user:2'),
  FollowRelation(source:'flat:1', target: 'user:3'),
];

// ⚠️ server-side only!
await client.batch.followMany(follows);

// Updating parts of an activity
final set = {
  'product.price': 19.99,
  shares: {
    facebook: '...',
    twitter: '...',
  },
};
final unset = ['daily_likes', 'popularity'];

// ...by ID
final update = ActivityUpdate.withId( '54a60c1e-4ee3-494b-a1e3-50c06acb5ed4', set, unset);
await client.updateActivityById(update);
// ...or by combination of foreign ID and time
const timestamp = DateTime.now();
const foreignID= 'product:123';
final update2 = ActivityUpdate.withForeignId(
  foreignID,
  timestamp,
  set,
  unset,
);
await client.updateActivityById(update2);


// update the 'to' fields on an existing activity
// client.flatFeed("user", "ken").function (foreign_id, timestamp, new_targets, added_targets, removed_targets)
// new_targets, added_targets, and removed_targets are all arrays of feed IDs
// either provide only the `new_targets` parameter (will replace all targets on the activity),
// OR provide the added_targets and removed_targets parameters
// NOTE - the updateActivityToTargets method is not intended to be used in a browser environment.
await client.flatFeed('user', 'ken').updateActivityToTargets('foreign_id:1234', timestamp, ['feed:1234']);
await client.flatFeed('user', 'ken').updateActivityToTargets('foreign_id:1234', timestamp, null, ['feed:1234']);
await client.flatFeed('user', 'ken').updateActivityToTargets('foreign_id:1234', timestamp, null, null, ['feed:1234']);

Realtime (Faye)

Stream uses Faye for realtime notifications. Below is quick guide to subscribing to feed changes

// ⚠️ userToken is generated server-side (see previous section)
final client = StreamFeedClient('YOUR_API_KEY', token: userToken,appId: 'APP_ID');
final user1 = client.flatFeed('user', '1');

// subscribe to the changes
final subscription = await userFeed.subscribe((message) => print(message));
// now whenever something changes to the feed user 1
// the callback will be called

// To cancel a subscription you can call cancel on the
// object returned from a subscribe call.
// This will remove the listener from this channel.
await subscription.cancel();

Docs are available on GetStream.io.

Free for Makers

Stream is free for most side and hobby projects. To qualify your project/company needs to have < 5 team members and < $10k in monthly revenue. For complete pricing details visit our Feed Pricing Page

Structure

Stream Feed Dart is a monorepo built using Melos. Individual packages can be found in the packages directory while configuration and top level commands can be found in melos.yaml.

To get started, run bootstrap after cloning the project.

melos bootstrap

Dart version requirements

This API Client project requires Dart v2.12 at a minimum.

See the github action configuration for details of how it is built, tested and packaged.

Contributing

See extensive at test documentation for your changes.

You can find generic API documentation enriched by code snippets from this package at https://getstream.io/activity-feeds/docs/flutter-dart/?language=dart

Copyright and License Information

Project is licensed under the BSD 3-Clause.

We are hiring

We've recently closed a $38 million Series B funding round and we keep actively growing. Our APIs are used by more than a billion end-users, and you'll have a chance to make a huge impact on the product within a team of the strongest engineers all over the world.

Check out our current openings and apply via Stream's website.

stream-feed-flutter's People

Contributors

balvinderz avatar ferhatelmas avatar groovinchip avatar hayesgordon avatar imtoori avatar jimmypettersson85 avatar lohanidamodar avatar mahboubii avatar marco-ulge avatar mrfifield avatar nash0x7e2 avatar obrunsmann avatar sachaarbonel avatar tschellenbach avatar xsahil03x avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stream-feed-flutter's Issues

[HELP] The policy "Don't impersonate other users

Hi team,
im creating a new user

final streamUser = await client.user(uid).create(
        {
          'uid': uid,
        },
        getOrCreate: true,
      );

and posting an activity

final circleFeed = client.flatFeed(circle, circ.id);

    final activity = feed.Activity(
      actor: uid,
      verb: 'post',
      object: 'post:${post.id}',
      foreignId: 'post:${post.id}',
      to: [feed.FeedId.id('$timeline:$uid')],
    );

    final res = await circleFeed.addActivity(activity);

Im trying to post this activity on two feeds: 'circle' and timeline of the connected user (uid)
Im getting:

{detail: The policy "Don't impersonate other users" (900) blocked this request, please consult the documentation https://getstream.io/docs/, status_code: 403, code: 17, exception: NotAllowedException, duration: 0.16ms, more_info: https://getstream.io/docs/api_error_responses}, jsonData: null, status: 403, code: null}

Am i doing something wrong ?
Nelson

Subscribing To Notification Feed

When subscribing to real-time updates of the notification feeds they also only return Enriched activities and not NotificationGroup<Activity>
Not sure if we are able to subscribe to them or not but that would be very useful.

What platform is it about?

  • Android
  • iOS
  • Web
  • Windows
  • MacOS
  • Linux

Error Trying To Subscribe To A Feed

I keep getting the below error:
Unhandled Exception: Invalid argument(s): Missing app id, which is needed in order to subscribe feed
I see in the code that the internal subscriber requires a token but the public-facing Subscribe function does not give an option to put one.

Error trying to get activity feeds

I am receiving this error each time:

 *** Request ***
flutter: uri: https://api.stream-io-api.com/api/v1.0/enrich/feed/timeline/eTHVBnEm0FQB2HeaRKVlEfVf58B3personal/?limit=100&offset=0&api_key=hmwext26344q&location=unspecified
flutter: method: GET
flutter: responseType: ResponseType.json
flutter: followRedirects: true
flutter: connectTimeout: 10000
flutter: sendTimeout: 0
flutter: receiveTimeout: 10000
flutter: receiveDataWhenStatusError: true
flutter: extra: {}
flutter: headers:
flutter:  stream-auth-type: jwt
flutter:  x-stream-client: stream-feed-dart-client-ios-0.1.2
flutter:  Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiZVRIVkJuRW0wRlFCMkhlYVJLVmxFZlZmNThCM3BlcnNvbmFsIn0.fg1c3TDXi2yqGWCWmljOQgGM3NdgjZwFRw9Q_bK5mTA
flutter: data:
flutter: null
flutter:
flutter: *** DioError ***:
flutter: uri: https://api.stream-io-api.com/api/v1.0/enrich/feed/timeline/eTHVBnEm0FQB2HeaRKVlEfVf58B3personal/?limit=100&offset=0&api_key=hmwext26344q&location=unspecified
flutter: DioError [DioErrorType.response]: Http status error [403]
#0      DioMixin.assureDioError
package:dio/src/dio_mixin.dart:819
#1      DioMixin._dispatchRequest
package:dio/src/dio_mixin.dart:678
<asynchronous suspension>
#2      DioMixin.fetch.<anonymous closure>.<anonymous closure> (package:dio/src/dio_mixin.dart)
package:dio/src/dio_mixin.dart:1
<asynchronous suspension>
flutter: uri: https://api.stream-io-api.com/api/v1.0/enrich/feed/timeline/eTHVBnEm0FQB2HeaRKVlEfVf58B3personal/?limit=100&offset=0&api_key=hmwext26344q&location=unspecified
flutter: statusCode: 403
flutter: headers:
flutter:  connection: keep-alive
flutter:  x-ratelimit-reset: 1620604260
flutter:  date: Sun, 09 May 2021 23:50:30 GMT
flutter:  transfer-encoding: chunked
flutter:  access-control-allow-origin: *
flutter:  x-ratelimit-limit: 2000
flutter:  content-encoding: gzip
flutter:  x-ratelimit-remaining: 1999
flutter:  content-type: text/plain; charset=utf-8
flutter:  server: nginx
flutter: Response Text:
flutter: {"detail":"signature is invalid","status_code":403,"code":17,"exception":"NotAllowedException","duration":"0.00ms","more_info":"https://getstream.io/docs/api_error_responses"}
2
flutter:
[VERBOSE-2:ui_dart_state.cc(186)] Unhandled Exception: StreamApiException{body: {"detail":"signature is invalid","status_code":403,"code":17,"exception":"NotAllowedException","duration":"0.00ms","more_info":"https://getstream.io/docs/api_error_responses"}, jsonData: {detail: signature is invalid, status_code: 403, code: 17, exception: NotAllowedException, duration: 0.00ms, more_info: https://getstream.io/docs/api_error_responses}, status: 403, code: 17}

The request is:

widget.streamClient
        .flatFeed('timeline', widget.sUser.userId)
        .getEnrichedActivities(
            limit: 100,
            offset: 0,
            flags: EnrichmentFlags()
                .withReactionCounts()
                .withOwnReactions()
                .withOwnChildren()
                .withRecentReactions())
        .then((value) {
      print(value[0]);
    });

Export `StreamApiException` to outside the package

Is your feature request related to a problem? Please describe.

I need to handle with some exceptions from the GetStream, example:

StreamApiException (StreamApiException{body: {detail: Reaction does not exist, status_code: 404, code: 16, exception: DoesNotExistException, duration: 1.31ms, more_info: https://getstream.io/docs/api_error_responses}, jsonData: null, status: 404, code: null})

but the package doesn't export the exception StreamApiException.

Describe the solution you'd like

Export https://github.com/GetStream/stream-feed-flutter/blob/master/packages/stream_feed/lib/src/core/exceptions.dart on https://github.com/GetStream/stream-feed-flutter/blob/master/packages/stream_feed/lib/src/core/index.dart .

Describe alternatives you've considered
Nop...

Const errors

Describe the bug
Getting multiple constant constructor errors (Activity class,FeedIdClass)

Code is just me testing the sdk out, ignore the scrappy code

var user1 = StreamFeedHelper.client
              .flatFeed('user', UserHelper.user?.userUuid ?? "");
          var id = StreamFeedHelper.client.currentUser;
          print(id);
          const activity = Activity(
              actor:  StreamFeedHelper.client.currentUser.ref ,
              verb: 'post',
              object: 'Place:42',
              to: [
              FeedId.id('timeline:${UserHelper.user?.userUuid}')
              ],
              extraData: {"message": "Hello There"});
          var activity11 =  await user1.addActivity(activity);
          print("Activity sent $activity11");

Screenshot 2021-09-01 at 11 02 20 PM

Screenshot 2021-09-01 at 11 08 10 PM

Screenshot 2021-09-01 at 11 12 13 PM

What version of Flutter do you use?
v2.13.4

What package are you using? What version?
stream feed 0.2.3

What platform is it about?

  • [ yes] Android
  • iOS
  • Web
  • Windows
  • MacOS
  • Linux

a copy of flutter doctor --verbose

To Reproduce
Steps to reproduce the behavior:
Initialise an activity or feedid object with a value stored in an object

Expected behavior
It should let me initialise the object

Screenshots
If applicable, add screenshots to help explain your problem.

Stream Analytics

Is stream Analytics included in the feeds sdk for flutter or the chat sdk? If so is there a way to set it up? I do not see anything in the docks for setting it up for flutter/dart.

Better Pagination Support

It would be nice to get the feed items with a page number and a max page number when we get activities so we can know when the last page is showing and to not try and fetch more pages.

Populate actor while getting feed

Problem
Feed like in almost any social media app shows feed with users who have posted feed. In currenct version when we get feed we get only id we have to get user by our self.

Suggested Solution
Can u add request field like populateActors so we will all activities in convinient form

[Help] You do not have permission to do this, you got this error because there are no policies allowing this request on this application.

Hi,
Just to share.

Error: You do not have permission to do this, you got this error because there are no policies allowing this request on this application.

When getting followers, from other feed (that dont belong to current user)

final circleFeed = client.flatFeed('circle', circleID);
final followers = await circleFeed.followers(limit: 10, offset: 0);

Just ask support to add policy, and voila !

Subscribing to the feed only gives activities of Type activity and not Enriched Activity

Subscribing to the feed only gives activities of Type activity and not Enriched Activity.

Using version:

stream_feed:
    dependency: "direct main"
    description:
      path: "./packages/stream_feed"
      ref: fix-issue-89
      resolved-ref: "67d28575b6d41cbbbc155f02a00e25319b5faefa"
      url: "https://github.com/GetStream/stream-feed-flutter.git"
    source: git
    version: "0.2.1"

Example App ?

Hi team,
So happy to have a feed plugin now ❤️

Is there any plan to create an example app like the chat does ?

Thank you,
Nelson

Can Create but not Update Activities

Describe the bug
I can create an activity with:

await _feed.addActivity(feed.Activity(
          actor: context.streamFeedClient.currentUser!.ref,
          verb: 'post',
          object: '${describeEnum(_selectedObjectType!)}:$_selectedObjectId',
          extraData: {
            'caption': _captionController.text,
            'tags': _tags.whereType<String>().toList()
          }));

Where [_feed] is class of type FlatFeed extends Feed

created via streamFeedClient.flatFeed(kUserFeedName, userId);

However, when I try and run:

await _feed.updateActivityById(id: _activity.id!, set: {
        'caption': _captionController.text,
        'tags': _tags.whereType<String>().toList()
      });

I get this error message:

/flutter (28710): *** DioError ***:
I/flutter (28710): uri: https://api.stream-io-api.com/api/v1.0/activity?api_key=em6ka2nnezvv&location=unspecified
I/flutter (28710): DioError [DioErrorType.response]: Http status error [403]
I/flutter (28710): #0      DioMixin.assureDioError
package:dio/src/dio_mixin.dart:819
I/flutter (28710): #1      DioMixin._dispatchRequest
package:dio/src/dio_mixin.dart:678
I/flutter (28710): <asynchronous suspension>
I/flutter (28710): #2      DioMixin.fetch.<anonymous closure>.<anonymous closure> (package:dio/src/dio_mixin.dart)
package:dio/src/dio_mixin.dart:1
I/flutter (28710): <asynchronous suspension>
I/flutter (28710): uri: https://api.stream-io-api.com/api/v1.0/activity?api_key=em6ka2nnezvv&location=unspecified
I/flutter (28710): statusCode: 403
I/flutter (28710): headers:
I/flutter (28710):  connection: keep-alive
I/flutter (28710):  x-ratelimit-reset: 1629555900
I/flutter (28710):  date: Sat, 21 Aug 2021 14:24:05 GMT
I/flutter (28710):  transfer-encoding: chunked
I/flutter (28710):  access-control-allow-origin: *
I/flutter (28710):  x-ratelimit-limit: 300
I/flutter (28710):  content-encoding: gzip
I/flutter (28710):  x-ratelimit-remaining: 299
I/flutter (28710):  content-type: text/plain; charset=utf-8
I/flutter (28710):  server: nginx
I/flutter (28710): Response Text:
I/flutter (28710): {"detail":"This endpoint cannot be accessed with user authentication","status_code":403,"code":17,"exception":"NotAllowedException","duration":"0.00ms","more_info":"https://getstream.io/docs/api_error_responses"}
2
I/flutter (28710):
I/flutter (28710): StreamApiException{body: {"detail":"This endpoint cannot be accessed with user authentication","status_code":403,"code":17,"exception":"NotAllowedException","duration":"0.00ms","more_info":"https://getstream.io/docs/api_error_responses"}, jsonData: {detail: This endpoint cannot be accessed with user authentication, status_code: 403, code: 17, exception: NotAllowedException, duration: 0.00ms, more_info: https://getstream.io/docs/api_error_responses}, status: 403, code: 17}

The documentation is a bit confusing as it states: (https://getstream.io/activity-feeds/docs/flutter-dart/adding_activities/?language=dart)

When you update an activity, you must include the following fields both when adding and updating the activity:time & foreign_id

But then in the code it gives examples using updateActivityById method which does not include either of these fields.

Not sure if this is a SDK bug or something else but assistance would be appreciated.

Thanks,

Richard


What version of Flutter do you use?

Latest

What package are you using? What version?

Latest

What platform is it about?

  • Android

Type mismatch crash at SDK on timeout error

Describe the bug
When fetching feed using SDK, In case of timeout error there is a type mismatch crash at SDK side, instead of getting the timeout error logs through the SDK we are getting type mismatch error.

What version of Flutter do you use?
2.5.3

What package are you using? What version?
0.5.0

What platform is it about?

  • [ Y] Android
  • [ Y] iOS
  • Web
  • Windows
  • MacOS
  • Linux

To Reproduce
Steps to reproduce the behavior:

  1. Set the timeout value in SDK to some less value like 5 sec
  2. Fetch feed using SDK
  3. See error

Expected behavior

I/flutter (20724): (2022-02-18 13:10:38.274839) 🚨 📜 ╔╣ DioError ║ DioErrorType.connectTimeout
I/flutter (20724): (2022-02-18 13:10:38.275134) 🚨 📜 ║  Connecting timed out [1000ms]
I/flutter (20724): (2022-02-18 13:10:38.275303) 🚨 📜 ╚════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝
I/flutter (20724): (2022-02-18 13:10:38.275737) 🚨 📜 
I/flutter (20724): (2022-02-18 13:10:38.275910) 🚨 📜 ╔╣ Request ║ GET 
I/flutter (20724): (2022-02-18 13:10:38.276026) 🚨 📜 ║  https://api.stream-io-api.com/api/v1.0/enrich/feed/trending/all/?api_key=**&location=**&limit=100&offset=0&with_own_reactions=true&with_reaction_counts=true&with_own_children=true&ranking=**
I/flutter (20724): (2022-02-18 13:10:38.276200) 🚨 📜 ╚════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝
I/flutter (20724): NoSuchMethodError: The getter 'length' was called on null.
I/flutter (20724): Receiver: null
I/flutter (20724): Tried calling: length #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:63:5)
I/flutter (20724): #1      _parseJson (dart:convert-patch/convert_patch.dart:39:28)
I/flutter (20724): #2      JsonDecoder.convert (dart:convert/json.dart:506:36)
I/flutter (20724): #3      JsonCodec.decode (dart:convert/json.dart:157:41)
I/flutter (20724): #4      new StreamFeedsNetworkError.fromDioError (package:stream_feed/src/core/error/stream_feeds_error.dart:45:23)
I/flutter (20724): #5      StreamHttpClient._parseError (package:stream_feed/src/core/http/stream_http_client.dart:81:39)
I/flutter (20724): #6      StreamHttpClient.get (package:stream_feed/src/core/http/stream_http_client.dart:105:13)
I/flutter (20724): <asynchronous suspension>
I/flutter (20724): #7      FlatFeed.getEnrichedActivities (package:stream_feed/src/client/flat_feed.dart:133:20)
I/flutter (20724): <asynchronous suspension>
I/flutter (20724): #8      FutureExtensions.onError.<anonymous closure> (dart:async/future.dart)
I/flutter (20724): <asynchronous suspension>
[sentry] [debug] Event 7c8bd7b4f4af45c694596abf63036512 was dropped due to sampling decision```

UI kit

Stateless widgets

  • AttachedActivity (high priority)
  • InfiniteScroll (high priority)
  • InfinititeScrollPaginator (high priority)
  • LoadMorePaginator (WIP)
  • NewActivitiesNotification (WIP)
  • IconBadge
  • LoadMoreButton (WIP)
  • NotificationFeed (WIP)
  • Dropdown
  • Panel
  • DropdownPanel
  • FeedPlaceHolder (shimmer?)
  • DataLabel (low priority)
  • Activity
  • ActivityContent
  • ActivityFooter
  • ActivityHeader
  • Avatar
  • AvatarGroup
  • Button
  • Card
  • FlatFeed
  • Icons
  • LikeButton
  • Link
  • ReactionIcon
  • RepostButton
  • SinglePost
  • StatusUpdateForm
  • TextArea
  • TimeHeader
  • UserBar
  • Title

Stateful widgets

  • Notification (WIP)
  • NotificationDropdown (WIP)
  • Audio (low priority)
  • Video
  • ReactionList
  • CommentField
  • ReactionToggleIcon
  • FollowButton
  • Gallery
  • EmojiPicker (low priority)

View All users without following

Hello. How can I show all users without following? It says in the documentation :

  1. The first thing we need to do is view a list of users and pick a few to follow. We'll start by creating a view that shows all the users and lets a user follow a few. Here is the screen that shows all the users:
  2. Now that we have a way to follow users we can view our timeline. When we're done, assuming we've followed "bob" and "sara" we'll see a screen that looks like this:

BUT I want to show all feedbacks or posts on the page for all users. how can I ?

Thanks

What platform is it about?

  • Android
  • iOS

The Class User Has Conflicts

The class User conflicts with the Firebase class name of User. We can work around it but might I suggest changing the name to streamUser of feedUser?

`userToken` must be provided while running on client-side error

Describe the bug
I am getting E/flutter (17650): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: Assertion failed: "userToken must be provided while running on client-side" with secret
But in the example you are using fine
Screenshot 2021-06-09 at 11 11 29 PM

What version of Flutter do you use?
2.2.1

What package are you using? What version?
0.2.1

What platform is it about?

  • [ *] Android
  • iOS
  • Web
  • Windows
  • MacOS
  • Linux

a copy of flutter doctor --verbose
[✓] Flutter (Channel stable, 2.2.1, on macOS 11.3.1 20E241 darwin-x64, locale en-GB)
• Flutter version 2.2.1 at /Users/rizan/flutter
• Framework revision 02c026b03c (13 days ago), 2021-05-27 12:24:44 -0700
• Engine revision 0fdb562ac8
• Dart version 2.13.1

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/rizan/Library/Android/sdk
• Platform android-S, build-tools 30.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5, Build version 12E262
• CocoaPods version 1.10.1

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)

[✓] VS Code (version 1.56.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.23.0

[✓] Connected device (2 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.77

To Reproduce
Steps to reproduce the behavior:

  1. Trying to connect with final StreamFeedClient _streamSDKFeedClient = StreamFeedClient.connect(StreamAPIKey.value, secret: StreamAPISecret.value);
  2. But giving me the error E/flutter (17650): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: Assertion failed: "userToken must be provided while running on client-side"

Expected behavior
It should crate the client

Screenshots
Screenshot 2021-06-09 at 11 09 57 PM

**Logs **
E/flutter (17650): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: Assertion failed: "userToken must be provided while running on client-side"

Unread Messages count

I am searching how to get the total amount of unread messages.

So these information are included in the original response:
image

But then truncated in the message parsing:

final data = (result.data!['results'] as List)

Actor Id On Add Activity

Can we remove the need to add SU as part of an actor ID. Is there a certain reason for this? I use that actor ID when getting the activities and would have to rewrite code to remove that in a lot of places. If it is something that is needed I understand just trying to better understand the use of it.

Realtime For Feeds Not Working

Describe the bug
I am using the realtime subscription but I am not getting any activities or anything.

What version of Flutter do you use?
2.10.2

What package are you using? What version?
0.5.0
What platform is it about?

  • Android
  • iOS
  • Web
  • Windows
  • MacOS
  • Linux

a copy of flutter doctor --verbose

[✓] Flutter (Channel stable, 2.10.2, on macOS 12.2.1 21D62 darwin-arm, locale
    en-US)
    • Flutter version 2.10.2 at /Users/rickeylee/Desktop/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 097d3313d8 (5 days ago), 2022-02-18 19:33:08 -0600
    • Engine revision a83ed0e5e3
    • Dart version 2.16.1
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/rickeylee/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.10.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)

[✓] VS Code (version 1.64.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.34.0

[✓] Connected device (4 available)
    • SM N950U (mobile)          • ce061716d1923703017e                     •
      android-arm64  • Android 9 (API 28)
    • iPhone 12 Pro Max (mobile) • 00008101-0012090C14F9001E                •
      ios            • iOS 15.2.1 19C63
    • iPhone (mobile)            • d0545eb2ff26e1c087d1b29c26f8e15da19284bb •
      ios            • iOS 15.2.1 19C63
    • Chrome (web)               • chrome                                   •
      web-javascript • Google Chrome 98.0.4758.109
    ! Error: iPhone 12 Pro Max is busy: Preparing the watch for development via
      iPhone 12 Pro Max. Xcode will continue when iPhone 12 Pro Max is finished.
      (code -10)

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

To Reproduce
Steps to reproduce the behavior:
Create a feed timeline and subscribe to the timeline and have new activities added to it.

Expected behavior
To get new activities when added to the feed.

This worked a few weeks ago and just noticed that it's not working.

StreamFeedClient isn't defined

Ive both stream_chat_flutter_core and stream_feed_flutter_core and .
it gives me The function 'StreamFeedClient' isn't defined.

Cannot Access Current User

Im still not able to access the current user after setting the user since updating. Old ticket #177

This is my riverpod provider:

final streamUser = FutureProvider.autoDispose((ref) async {
  final streamClient = ref.read(client);
  final currentUser = ref.watch(userAccount);
  if (streamClient != null && currentUser.asData!.value.uid != null) {
    print('Feed User set.');
    var u =
        '${currentUser.asData!.value.uid}_${currentUser.asData!.value.currentAccount}';
    final user = await streamClient.setUser(
        feed.User(
          id: u,
        ),
        feed.Token(currentUser.asData!.value.currentToken!));
    await streamClient.currentUser!.profile();
    return user;
  }
  return Future.value();
});

and the function where I first get a user:

widget.streamClient.currentUser!.get().then((value) {
      var data = value.data;
      
      setState(() {
        image = data!['photo'] as String;
        name = data['name'] as String;
      });
      fetchStories();
    });

@xsahil03x

Subscribing to the feed throws exception and doesn't show a message

Describe the bug
When the user subscribes to the feed, if there is a new event, it throws an error.
Unhandled Exception: type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'String?' in type cast

What version of Flutter do you use?
Flutter (Channel stable, 2.2.1, on macOS 11.2.3 20D91 darwin-x64, locale en-TR)

What package are you using? What version?
stream_feed: ^0.2.1

What platform is it about?
Only tested on

  • MacOS

a copy of flutter doctor --verbose

[✓] Flutter (Channel stable, 2.2.1, on macOS 11.2.3 20D91 darwin-x64, locale en-TR)
    • Flutter version 2.2.1 at /Users/salih/Desktop/flutter
    • Framework revision 02c026b03c (13 days ago), 2021-05-27 12:24:44 -0700
    • Engine revision 0fdb562ac8
    • Dart version 2.13.1

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/salih/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: /Library/Java/JavaVirtualMachines/jdk-15.0.1.jdk/Contents/Home/bin/java
    • Java version Java(TM) SE Runtime Environment (build 15.0.1+9-18)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5, Build version 12E262
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio
    • Android Studio at /Users/salih/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7717.56.2111.7361063/Android Studio Preview.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[✓] IntelliJ IDEA Ultimate Edition (version 2021.1.2)
    • IntelliJ at /Users/salih/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 57.0.5
    • Dart plugin version 211.7233

[✓] VS Code (version 1.56.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.23.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 11.2.3 20D91 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 91.0.4472.77

To Reproduce

  1. Run the following code
 final _streamFeedClient = StreamFeedClient.connect(
   <api-key>
    token: token,
    appId: <appId>,
  );
  final feed = _streamFeedClient.notificationFeed('user', userId);
  final activity = Activity(
    actor: createUserReference(userId),
    verb: 'created',
    object: 'created',
    time: DateTime.now(),
    extraData: {
      "createdTask": task.toJson(),
    },
  );
  feed.addActivity(activity);
  feed.subscribe((message) {
    print('message in a bottle $message');
  });
  1. Add a new activity to the feed.

Expected behavior
It should print "message in a bottle" with a message variable.

**Logs **

flutter: *** Request ***
flutter: uri: https://api.stream-io-api.com/api/v1.0/feed/task/32db0f46-3593-4e14-aa57-f05af4887260/?api_key=yn6bquc5zs6m&location=unspecified
flutter: method: POST
flutter: responseType: ResponseType.json
flutter: followRedirects: true
flutter: connectTimeout: 10000
flutter: sendTimeout: 0
flutter: receiveTimeout: 10000
flutter: receiveDataWhenStatusError: true
flutter: extra: {}
flutter: headers:
flutter:  stream-auth-type: jwt
flutter:  x-stream-client: stream-feed-dart-client-macos-0.2.1
flutter:  Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MjMyNzE0NTMsImlhdCI6MTYyMzI3MDI1MywidXNlcl9pZCI6IjMyZGIwZjQ2LTM1OTMtNGUxNC1hYTU3LWYwNWFmNDg4NzI2MCJ9.UNxSVBQLpFLiGqFz8rUePQJdsvKmtt8ipe-9Kt2jsTc
flutter:  content-type: application/json; charset=utf-8
flutter: data:
flutter: Activity(SU:32db0f46-3593-4e14-aa57-f05af4887260, task_situation_updated to true, updated, null, null, null, null, 2021-06-09 23:24:18.238189, null, null, null, null, {createdTask: {"id": "32db0f46-3593-4e14-aa57-f05af4887260", "title": "KeyPack", "isFinished": true}})
flutter: 
flutter: *** Response ***
flutter: uri: https://api.stream-io-api.com/api/v1.0/feed/task/32db0f46-3593-4e14-aa57-f05af4887260/?api_key=yn6bquc5zs6m&location=unspecified
flutter: statusCode: 201
flutter: headers:
flutter:  connection: keep-alive
flutter:  cache-control: no-cache
flutter:  date: Wed, 09 Jun 2021 20:24:19 GMT
flutter:  access-control-allow-origin: *
flutter:  x-ratelimit-limit: 1000
flutter:  x-ratelimit-reset: 1623270300
flutter:  x-ratelimit-remaining: 998
flutter:  content-type: application/json;charset=utf-8
flutter:  access-control-max-age: 86400
flutter:  server: nginx
flutter:  access-control-allow-headers: x-requested-with, content-type, accept, origin, authorization, x-csrftoken, x-stream-client, stream-auth-type
flutter:  access-control-allow-methods: GET, POST, PUT, PATCH, DELETE, OPTIONS
flutter:  content-length: 366
flutter: Response Text:
flutter: {"actor":"SU:32db0f46-3593-4e14-aa57-f05af4887260","createdTask":"{\"id\": \"32db0f46-3593-4e14-aa57-f05af4887260\", \"title\": \"KeyPack\", \"isFinished\": true}","duration":"6.90ms","foreign_id":"","id":"cff95542-c979-11eb-8080-80005abdd229","object":"task_situation_updated to true","origin":null,"target":"","time":"2021-06-09T23:24:18.238189","verb":"updated"}
flutter: 
flutter: (2021-06-09 23:24:18.877664) ℹ️ 🕒 received message : {data: {deleted: [], deleted_foreign_ids: [], feed: task:32db0f46-3593-4e14-aa57-f05af4887260, new: [{actor: {error: ReferenceNotFound, id: 32db0f46-3593-4e14-aa57-f05af4887260, reference: SU:32db0f46-3593-4e14-aa57-f05af4887260, reference_type: user}, createdTask: {"id": "32db0f46-3593-4e14-aa57-f05af4887260", "title": "KeyPack", "isFinished": true}, foreign_id: , group: updated_2021-06-09, id: cff95542-c979-11eb-8080-80005abdd229, object: task_situation_updated to true, origin: null, target: , time: 2021-06-09T23:24:18.238189, verb: updated}]}, channel: /site-1128601-feed-task32db0f46-3593-4e14-aa57-f05af4887260, successful: false}
flutter: (2021-06-09 23:24:18.877872) ℹ️ 🕒 Client 1-4add16cf-2e01-4a95-b84e-2782369ab005 calling listeners for /site-1128601-feed-task32db0f46-3593-4e14-aa57-f05af4887260 with {deleted: [], deleted_foreign_ids: [], feed: task:32db0f46-3593-4e14-aa57-f05af4887260, new: [{actor: {error: ReferenceNotFound, id: 32db0f46-3593-4e14-aa57-f05af4887260, reference: SU:32db0f46-3593-4e14-aa57-f05af4887260, reference_type: user}, createdTask: {"id": "32db0f46-3593-4e14-aa57-f05af4887260", "title": "KeyPack", "isFinished": true}, foreign_id: , group: updated_2021-06-09, id: cff95542-c979-11eb-8080-80005abdd229, object: task_situation_updated to true, origin: null, target: , time: 2021-06-09T23:24:18.238189, verb: updated}]}
[ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'String?' in type cast
#0      _$ActivityFromJson (package:stream_feed/src/core/models/activity.g.dart:11:26)
#1      new Activity.fromJson (package:stream_feed/src/core/models/activity.dart:33:7)
#2      _$RealtimeMessageFromJson.<anonymous closure> (package:stream_feed/src/core/models/realtime_message.g.dart:17:30)
#3      MappedListIterable.elementAt (dart:_internal/iterable.dart:412:31)
#4      ListIterator.moveNext (dart:_internal/iterable.dart:341:26)
#5      new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:188:27)
#6      new _GrowableList.of (dart:core-patch/growable_array.dart:150:28)
#7      new List.of (dart:core-patch/array_patch.dart:50:28)
#8      ListIterable.toList (dart:_internal/iterable.dart:212:44)
#9      _$RealtimeMessageFromJson (package:stream_feed/src/core/models/realtime_message.g.dart:20:10)
#10     new RealtimeMessage.fromJson (package:stream_feed/src/core/models/realtime_message.dart:26:7)
#11     Feed.subscribe.<anonymous closure> (package:stream_feed/src/client/feed.dart:76:47)
#12     Subscription.call (package:faye_dart/src/subscription.dart:21:16)
#13     EventEmitter.emit (package:faye_dart/src/event_emitter.dart:59:23)
#14     Channel.trigger (package:faye_dart/src/channel.dart:26:50)
#15     ChannelMapX.distributeMessage (package:faye_dart/src/channel.dart:103:22)
#16     FayeClient._deliverMessage (package:faye_dart/src/client.dart:430:15)
#17     FayeClient._receiveMessage.<anonymous closure> (package:faye_dart/src/client.dart:409:7)
#18     Extensible.pipeThroughExtensions.pipe (package:faye_dart/src/extensible.dart:29:46)
#19     Extensible.pipeThroughExtensions.pipe (package:faye_dart/src/extensible.dart:32:34)
#20     Extensible.pipeThroughExtensions (package:faye_dart/src/extensible.dart:37:9)
#21     FayeClient._receiveMessage (package:faye_dart/src/client.dart:406:5)
#22     FayeClient._onDataReceived (package:faye_dart/src/client.dart:169:7)
#23     _rootRunUnary (dart:async/zone.dart:1362:47)
#24     _CustomZone.runUnary (dart:async/zone.dart:1265:19)
#25     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)
#26     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#27     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#28     _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:123:11)
#29     _HandleErrorStream._handleData (dart:async/stream_pipe.dart:256:10)
#30     _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153:13)
#31     _rootRunUnary (dart:async/zone.dart:1362:47)
#32     _CustomZone.runUnary (dart:async/zone.dart:1265:19)
#33     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)
#34     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#35     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#36     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:733:19)
#37     _StreamController._add (dart:async/stream_controller.dart:607:7)
#38     _rootRunUnary (dart:async/zone.dart:1362:47)
#39     _CustomZone.runUnary (dart:async/zone.dart:1265:19)
#40     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)
#41     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#42     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#43     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:733:19)
#44     _StreamController._add (dart:async/stream_controller.dart:607:7)
#45     _StreamController.add (dart:async/stream_controller.dart:554:5)
#46     new _WebSocketImpl._fromSocket.<anonymous closure> (dart:_http/websocket_impl.dart:1145:21)
#47     _rootRunUnary (dart:async/zone.dart:1362:47)
#48     _CustomZone.runUnary (dart:async/zone.dart:1265:19)
#49     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)
#50     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#51     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#52     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:63:11)
#53     _EventSinkWrapper.add (dart:async/stream_transformers.dart:13:11)
#54     _WebSocketProtocolTransformer._messageFrameEnd (dart:_http/websocket_impl.dart:338:23)
#55     _WebSocketProtocolTransformer.add (dart:_http/websocket_impl.dart:232:46)
#56     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:111:24)
#57     _rootRunUnary (dart:async/zone.dart:1362:47)
#58     _CustomZone.runUnary (dart:async/zone.dart:1265:19)
#59     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)
#60     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#61     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#62     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:733:19)
#63     _StreamController._add (dart:async/stream_controller.dart:607:7)
#64     _StreamController.add (dart:async/stream_controller.dart:554:5)
#65     _Socket._onData (dart:io-patch/socket_patch.dart:2160:41)
#66     _rootRunUnary (dart:async/zone.dart:1362:47)
#67     _CustomZone.runUnary (dart:async/zone.dart:1265:19)
#68     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)
#69     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#70     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#71     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:733:19)
#72     _StreamController._add (dart:async/stream_controller.dart:607:7)
#73     _StreamController.add (dart:async/stream_controller.dart:554:5)
#74     _RawSecureSocket._sendReadEvent (dart:io/secure_socket.dart:991:19)
#75     _rootRun (dart:async/zone.dart:1346:47)
#76     _CustomZone.run (dart:async/zone.dart:1258:19)
#77     _CustomZone.runGuarded (dart:async/zone.dart:1162:7)
#78     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1202:23)
#79     _rootRun (dart:async/zone.dart:1354:13)
#80     _CustomZone.run (dart:async/zone.dart:1258:19)
#81     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:1186:23)
#82     Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18:15)
#83     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:395:19)
#84     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:426:5)
#85     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)

[ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: Instance of 'Error'
#0      EventEmitter.emit (package:faye_dart/src/event_emitter.dart:75:19)
#1      Channel.trigger (package:faye_dart/src/channel.dart:26:50)
#2      ChannelMapX.distributeMessage (package:faye_dart/src/channel.dart:103:22)
#3      FayeClient._deliverMessage (package:faye_dart/src/client.dart:430:15)
#4      FayeClient._receiveMessage.<anonymous closure> (package:faye_dart/src/client.dart:409:7)
#5      Extensible.pipeThroughExtensions.pipe (package:faye_dart/src/extensible.dart:29:46)
#6      Extensible.pipeThroughExtensions.pipe (package:faye_dart/src/extensible.dart:32:34)
#7      Extensible.pipeThroughExtensions (package:faye_dart/src/extensible.dart:37:9)
#8      FayeClient._receiveMessage (package:faye_dart/src/client.dart:406:5)
#9      FayeClient._onDataReceived (package:faye_dart/src/client.dart:169:7)
#10     _rootRunUnary (dart:async/zone.dart:1362:47)
#11     _CustomZone.runUnary (dart:async/zone.dart:1265:19)
#12     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)
#13     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#14     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#15     _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:123:11)
#16     _HandleErrorStream._handleData (dart:async/stream_pipe.dart:256:10)
#17     _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153:13)
#18     _rootRunUnary (dart:async/zone.dart:1362:47)
#19     _CustomZone.runUnary (dart:async/zone.dart:1265:19)
#20     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)
#21     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#22     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#23     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:733:19)
#24     _StreamController._add (dart:async/stream_controller.dart:607:7)
#25     _rootRunUnary (dart:async/zone.dart:1362:47)
#26     _CustomZone.runUnary (dart:async/zone.dart:1265:19)
#27     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)
#28     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#29     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#30     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:733:19)
#31     _StreamController._add (dart:async/stream_controller.dart:607:7)
#32     _StreamController.add (dart:async/stream_controller.dart:554:5)
#33     new _WebSocketImpl._fromSocket.<anonymous closure> (dart:_http/websocket_impl.dart:1145:21)
#34     _rootRunUnary (dart:async/zone.dart:1362:47)
#35     _CustomZone.runUnary (dart:async/zone.dart:1265:19)
#36     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)
#37     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#38     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#39     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:63:11)
#40     _EventSinkWrapper.add (dart:async/stream_transformers.dart:13:11)
#41     _WebSocketProtocolTransformer._messageFrameEnd (dart:_http/websocket_impl.dart:338:23)
#42     _WebSocketProtocolTransformer.add (dart:_http/websocket_impl.dart:232:46)
#43     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:111:24)
#44     _rootRunUnary (dart:async/zone.dart:1362:47)
#45     _CustomZone.runUnary (dart:async/zone.dart:1265:19)
#46     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)
#47     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#48     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#49     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:733:19)
#50     _StreamController._add (dart:async/stream_controller.dart:607:7)
#51     _StreamController.add (dart:async/stream_controller.dart:554:5)
#52     _Socket._onData (dart:io-patch/socket_patch.dart:2160:41)
#53     _rootRunUnary (dart:async/zone.dart:1362:47)
#54     _CustomZone.runUnary (dart:async/zone.dart:1265:19)
#55     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)
#56     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#57     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#58     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:733:19)
#59     _StreamController._add (dart:async/stream_controller.dart:607:7)
#60     _StreamController.add (dart:async/stream_controller.dart:554:5)
#61     _RawSecureSocket._sendReadEvent (dart:io/secure_socket.dart:991:19)
#62     _rootRun (dart:async/zone.dart:1346:47)
#63     _CustomZone.run (dart:async/zone.dart:1258:19)
#64     _CustomZone.runGuarded (dart:async/zone.dart:1162:7)
#65     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1202:23)
#66     _rootRun (dart:async/zone.dart:1354:13)
#67     _CustomZone.run (dart:async/zone.dart:1258:19)
#68     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:1186:23)
#69     Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18:15)
#70     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:395:19)
#71     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:426:5)
#72     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)

Additional context
Add any other context about the problem here.

Feature List

Client

  • Upload Image POST /images
  • Process Image GET /images?url=&...
  • Upload File POST /files
  • RefreshCDNUrl POST /files/refresh
  • GetActivities GET /activities
  • GetEnrichedActivities GET /enrich/activities
  • OG GET /og
  • PersonalizedFeed GET /enrich/personalization/feed (should it be moved to feed?)

User

  • Create POST /user
  • Get GET /user/${userID}
  • Delete DELETE /user/${userID}
  • Update PUT /user/${userID}
  • GetOrCreate => User.Create
  • Profile => User.Get

Feed

  • AddActivity POST /feed/${feedType}/${feedID}
  • RemoveActivity DELETE /feed/${feedType}/${feedID}
  • AddActivities POST /feed/${feedType}/${feedID}
  • Get GET /feed/${feedType}/${feedID} or GET enrich/feed/${feedType}/${feedID}
  • GetActivityDetail => Feed.Get

Follow

  • Follow POST /feed/${feedType}/${feedID}/following
  • Unfollow DELETE /feed/${feedType}/${feedID}/following/${targetFeedId}
  • Following GET /feed/${feedType}/${feedID}/following
  • Followers GET /feed/${feedType}/${feedID}/followers
  • FollowStats GET /stats/follow

Realtime

  • Faye Client
  • Subscribe
  • Unsubscribe

Reaction

  • Add POST /reaction
  • AddChild POST /reaction
  • Get GET /reaction/${reactionID}
  • Delete DELETE /reaction/${reactionID}
  • Filter GET /reaction/...
  • Update PUT /reaction/${reactionID}

Collections

Analytics

Analytics has different base url from main client

  • TrackImpressions POST /impression
  • TrackEngagements POST /engagement

Files

Added to Client

Images

Added to Client

Personalization

Skipped

Batch Operations

Skipped

extra_data Parsing

I got an error parsing extra_data on an activity:

Bildschirmfoto 2021-10-29 um 20 49 12

flutter: type 'Null' is not a subtype of type 'Object' in type cast
flutter: #0      _$EnrichedActivityFromJson.<anonymous closure>
#1      MapMixin.map (dart:collection/maps.dart:170:28)
#2      _$EnrichedActivityFromJson
package:stream_feed/…/models/enriched_activity.g.dart:27
#3      new EnrichedActivity.fromJson
package:stream_feed/…/models/enriched_activity.dart:66
#4      FlatFeed.getEnrichedActivities.<anonymous closure>
package:stream_feed/…/client/flat_feed.dart:133
#5      MappedListIterable.elementAt (dart:_internal/iterable.dart:413:31)
#6      ListIterator.moveNext (dart:_internal/iterable.dart:342:26)
#7      new _List._ofEfficientLengthIterable (dart:core-patch/array.dart:93:27)
#8      new _List.of (dart:core-patch/array.dart:55:20)
#9      new List.of (dart:core-patch/array_patch.dart:52:20)
#10     ListIterable.toList (dart:_internal/iterable.dart:213:44)
#11     FlatFeed.getEnrichedActivities
package:stream_feed/…/client/flat_feed.dart:134

Maybe it would be nice to also allow null values while it's a weak map either?

Stream Token Issue

I am receiving this exception:
'package:stream_feed/src/client/stream_feed_client_impl.dart': Failed assertion: line 61 pos 9: 'userId != null': Invalid userToken, It should contain user_id``
I receive it when passing the token from my backend to the front end. The issue appears because we have to pass a token object and not a string. Are we supposed to still create the token via our backend server or just make it in the app?

Getting Current Stream User Issue

Describe the bug
A clear and concise description of what the bug is.
When calling widget.streamClient.currentUser It returns null. It worked before switching to the lastest version.
I have tried all sorts of ways to set the user but the issue reamins.
What version of Flutter do you use?
2.5.3

What package are you using? What version?
0.4.0

What platform is it about?

  • Android
  • iOS
  • Web
  • Windows
  • MacOS
  • Linux

Notification Feed Subscription not being triggered by ActivityMarker().allSeen().allRead()

Hi,

Is there a way to be able to be able to receive real-time updates when a user marks all their notifications as seen / read?

I am getting unseen counts to display an indicator via

final counts = await _notificationFeed.getUnreadUnseenCounts()

Then subscribing to the notification feed via

 _feedSubscription =
          await _notificationFeed.subscribe(_handleSubscriptionMessage);

When the user opens their notifications list I run this

final feedActivities = await _notificationFeed
          .getEnrichedActivities<User, dynamic, String, String>(
              limit: _postsPerPage,
              offset: offset,
              marker: ActivityMarker().allSeen().allRead());

However, the subscription is not triggered and so the indicator does not update correctly.

Can you advise how this should be achieved please?

Thanks,

Rich

Suspend Feature

Is your feature request related to a problem? Please describe.
The ability to suspend a user from posting to any timeline for a set time frame.

Describe the solution you'd like
Say user A had a post reported by User B. An admin could then use a Stream Feed function to suspend the user like how you can with the stream chat for a certain chat. This would work just like how Facebook and Instagram allow you to still see new post but you cannot like comment or make post of your own.

Describe alternatives you've considered
Maybe a slow post mode.

Cannot Create Activities

I receive the following error when trying to add an activity.
I am signed in with the same person that I am adding the activity for and the token is valid.

flutter: uri: https://api.stream-io-api.com/api/v1.0/feed/user/eTHVBnEm0FQB2HeaRKVlEfVf58B3personal/?api_key=hmwext26344q&location=unspecified
flutter: statusCode: 403
flutter: headers:
flutter:  connection: keep-alive
flutter:  cache-control: no-cache
flutter:  x-ratelimit-reset: 1620775620
flutter:  date: Tue, 11 May 2021 23:26:48 GMT
flutter:  access-control-allow-origin: *
flutter:  x-ratelimit-limit: 1000
flutter:  content-encoding: gzip
flutter:  x-ratelimit-remaining: 999
flutter:  content-type: application/json;charset=utf-8
flutter:  access-control-max-age: 86400
flutter:  server: nginx
flutter:  access-control-allow-headers: x-requested-with, content-type, accept, origin, authorization, x-csrftoken, x-stream-client, stream-auth-type
flutter:  access-control-allow-methods: GET, POST, PUT, PATCH, DELETE, OPTIONS
flutter:  content-length: 218
flutter: Response Text:
flutter: {"detail":"The policy \"Don't impersonate other users\" (900) blocked this request, please consult the documentation https://getstream.io/docs/","status_code":403,"code":17,"exception":"NotAllowedException","duration":"0.18ms","more_info":"https://getstream.io/docs/api_error_responses"}
2
flutter:
[VERBOSE-2:ui_dart_state.cc(186)] Unhandled Exception: StreamApiException{body: {detail: The policy "Don't impersonate other users" (900) blocked this request, please consult the documentation https://getstream.io/docs/, status_code: 403, code: 17, exception: NotAllowedException, duration: 0.18ms, more_info: https://getstream.io/docs/api_error_responses}, jsonData: null, status: 403, code: null}

Subscribe to reactions ?

Hi
I'm using reactions for activity comments. Is there any way to subscribe for realtime reactions update ?

I know they is already subscription for feeds.

Thank you,
Nelson

[Bug] FormatException: Invalid character (at character 1)<p>Please try again in 30 seconds===^

Describe the bug
I got during 5 min:

[Bug] FormatException: Invalid character (at character 1)

Please try again in 30 seconds===^

And then, back to normal.

I reload the app so i lost debug.
But, code which failed was:

What version of Flutter do you use?
Flutter 2.2.2

What package are you using? What version?
git develop

What platform is it about?

  • iOS

To Reproduce

final client = feed.StreamFeedClient.connect(
        apiKey,
        token: feed.Token(response.body),
        appId: 'XXXX',
      );

I check getstream status and everything was fine...

NotificationGroup Issue

The NotificationGroup model is not publicly available to import. As of now I have to manually add
import 'package:stream_feed/src/core/models/group.dart'; Then I get this warning for doing so:
Don't import implementation files from another package.

Realtime feature for reaction updates

Current implementation of realtime feed only provides updates related to feed creation and deletion but doesn't provides updates related to comments, likes and other minor changes to feed.

When can we expect those features?

Date's timezones

Hello,

we're migrating to this package from our own Stream API implementation. While all the timestamps coming from the API are UTC we also need to parse them as UTC to let them automatically convert into local time.

What I've done was:

DateTime.parse('${json['time'] as String}Z')

This worked perfectly fine and got converted in the local timezone.

Right now:

print(activity.time!.isUtc);

Prints false which is not correct - the time actually is UTC :/

Respost Issue

I have a question. I am trying to do a repost/share as Facebook and Twitter do but when I use the code below I have issues. The activity is not copied to the target feed just the reaction does and not even the data that is added to the reaction.

streamClient!.reactions.add(
                                              'share', widget.post.id!,
                                              userId: streamClient
                                                  .currentUser!.userId,
                                              data: {
                                                'id': widget.post.id!,
                                              },
                                              targetFeeds: [
                                                feed.FeedId(
                                                    'user',
                                                    streamClient
                                                        .currentUser!.userId)
                                              ]);

Update dev ?

Hi @sachaarbonel @xsahil03x
Is it possible to update more ofter dev branch ?
im developing an app on top of your packages, but last features are all on their branch.

No matter if bugs still exists, having features on develop will enable us to find bugs !

Thanks for your work :)
Have a nice day

Log Level?

Hey, a quick one...are we able to reduce the StreamFeedClient log level? I seem to be getting every line from every call dumped into my VSCode debug console - it would be nice if we could turn this off when not directly debugging GetStream SDK, as it just dominates the log and drowns out everything else.

Thanks,

Rich

[Bug] Subscribe (Experimental)

Describe the bug
Hi,
i get an error when i subscribe to a feed.

What package are you using? What version?
Develop branch

What platform is it about?

  • iOS

**Logs **
Run flutter analyze and attach any output of that command below.
If there are any analysis errors, try resolving them before filing this issue.

Paste the output of running flutter doctor -v here.

final userFeed = getstreamClient.flatFeed('timeline', uid);
      subscription = await userFeed.subscribe((message) {
        print('subscription $message');
      });
flutter: error Invalid argument(s): Missing app id, which is needed in order to subscribe feed
flutter: error #0      checkNotNull
package:stream_feed//util/extension.dart:36
#1      StreamFeedClientImpl._feedSubscriber
package:stream_feed//client/stream_feed_client_impl.dart:194
#2      Feed.subscribe
package:stream_feed//client/feed.dart:75
#3      FeedModel.fetchFirstList
package:amber_app//feed/feed_model.dart:47
#4      feedModelProvider.<anonymous closure>
package:amber_app//feed/feed.dart:51
#5      feedModelProvider.<anonymous closure>
package:amber_app//feed/feed.dart:42

Just sharing the bug, as i know its still experimental :)
By the way, it will be awesome to have a stream instead of a Subscription :)

Best regards,
Nelson

EnrichedActivity Not Returning Reactions

I am not sure what is happening. I add a reaction like so:

widget.streamClient.reactions
                      .add('like', widget.post.id,
                          userId: widget.streamClient.currentUser.userId,
                          data: {
                            'value': index,
                          });

Then I get the enriched activities like so:

 timeline
        .getEnrichedActivities(
            limit: 100,
            offset: 0,
            flags: EnrichmentFlags()
                .withReactionCounts()
                .withOwnReactions()
                .withRecentReactions())

It will return the activities but not any reactions it's like they do not get updated even though I get a return value.

I/flutter (29491): *** Request ***
I/flutter (29491): uri: https://api.stream-io-api.com/api/v1.0/reaction/?api_key=hmwext26344q&location=unspecified
I/flutter (29491): method: POST
I/flutter (29491): responseType: ResponseType.json
I/flutter (29491): followRedirects: true
I/flutter (29491): connectTimeout: 10000
I/flutter (29491): sendTimeout: 0
I/flutter (29491): receiveTimeout: 10000
I/flutter (29491): receiveDataWhenStatusError: true
I/flutter (29491): extra: {}
I/flutter (29491): headers:
I/flutter (29491):  stream-auth-type: jwt
I/flutter (29491):  x-stream-client: stream-feed-dart-client-android-0.1.2
I/flutter (29491):  Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMEFKWmZVT1Rxb1hMOHlCeVhZODZUYzBMS3VsMnBlcnNvbmFsIn0.YnnMv2ApNpKPdh6aBCQm9hlB-W7C0DDyuzAMO2g61IA
I/flutter (29491):  content-type: application/json; charset=utf-8
I/flutter (29491): data:
I/flutter (29491): Reaction(null, like, bc1118f0-b2d2-11eb-8c76-1254437355c5, 0AJZfUOTqoXL8yByXY86Tc0LKul2personal, null, null, null, null, null, null, {value: 4}, null, null)
I/flutter (29491):
I/flutter (29491): *** Response ***
I/flutter (29491): uri: https://api.stream-io-api.com/api/v1.0/reaction/?api_key=hmwext26344q&location=unspecified
I/flutter (29491): statusCode: 201
I/flutter (29491): headers:
I/flutter (29491):  connection: keep-alive
I/flutter (29491):  cache-control: no-cache
I/flutter (29491):  date: Wed, 12 May 2021 19:14:05 GMT
I/flutter (29491):  access-control-allow-origin: *
I/flutter (29491):  x-ratelimit-limit: 1000
I/flutter (29491):  x-ratelimit-reset: 1620846900
I/flutter (29491):  x-ratelimit-remaining: 999
I/flutter (29491):  content-type: application/json;charset=utf-8
I/flutter (29491):  access-control-max-age: 86400
I/flutter (29491):  server: nginx
I/flutter (29491):  access-control-allow-headers: x-requested-with, content-type, accept, origin, authorization, x-csrftoken, x-stream-client, stream-auth-type
I/flutter (29491):  access-control-allow-methods: GET, POST, PUT, PATCH, DELETE, OPTIONS
I/flutter (29491):  content-length: 691
I/flutter (29491): Response Text:
I/flutter (29491): {"created_at":"2021-05-12T19:14:05.323360Z","updated_at":"2021-05-12T19:14:05.323360Z","id":"e95a85d0-b44b-4017-9fcd-cfae75d62d90","user_id":"0AJZfUOTqoXL8yByXY86Tc0LKul2personal","user":{"created_at":"2021-04-13T23:04:05.306176Z","updated_at":"2021-04-13T23:04:05.306176Z","id":"0AJZfUOTqoXL8yByXY86Tc0LKul2personal","data":{"gender":"Female","name":"jane doe","photo":"https://firebasestorage.googleapis.com/v0/b/fire-snab.appspot.com/o/profile-image-placeholder.png?alt=media&token=b17598bb-a510-4167-8354-ab75642ba89e"}},"kind":"like","activity_id":"bc1118f0-b2d2-11eb-8c76-1254437355c5","data":{"value":4},"parent":"","latest_children":{},"children_counts":{},"duration":"5.79ms"}
I/flutter (29491):
I/flutter (29491): Reaction(e95a85d0-b44b-4017-9fcd-cfae75d62d90, like, bc1118f0-b2d2-11eb-8c76-1254437355c5, 0AJZfUOTqoXL8yByXY86Tc0LKul2personal, , 2021-05-12 19:14:05.323360Z, 2021-05-12 19:14:05.323360Z, null, {created_at: 2021-04-13T23:04:05.306176Z, updated_at: 2021-04-13T23:04:05.306176Z, id: 0AJZfUOTqoXL8yByXY86Tc0LKul2personal, data: {gender: Female, name: jane doe, photo: https://firebasestorage.googleapis.com/v0/b/fire-snab.appspot.com/o/profile-image-placeholder.png?alt=media&token=b17598bb-a510-4167-8354-ab75642ba89e}}, null, {value: 4}, {}, {})

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

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

[Help] Connect user

Hi,

In your example, you are connecting the user when app is started :

final client = StreamFeedClient.connect(_key, token: Token(_user_token));

In real uses case, we cant do it at launch, because user is not logged in yet..
Do you have some advice ?

Im also using chat, and is more convenient, because we dont need a cient instance (final client = StreamFeedClient.connect(_key, token: Token(_user_token));); we just need to do at some point:

https://github.com/GetStream/flutter-samples/blob/2306ae9ca35f46876b59106803018b72260094a3/packages/stream_chat_v1/lib/main.dart#L64

api_key is missing error in example project

Describe the bug

I download the example folder and run, then initialize API key, token and appID,

`  final client = StreamFeedClient.connect(
    _key,
    token: Token("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMTEzNDYxMSJ9.ROo1ALbUo03TEeTgd2dMZe6xSfRnenQsHtZUncqRXLU"),
    appId: "1134611",
  );`

but this gives this error when I click any user, for example, Sahil Kumar or any other.

`flutter: *** Request ***
flutter: uri: https://api.stream-io-api.com/api/v1.0/user/?get_or_create=true&api_key=&location=unspecified
flutter: method: POST
flutter: responseType: ResponseType.json
flutter: followRedirects: true
flutter: connectTimeout: 10000
flutter: sendTimeout: 0
flutter: receiveTimeout: 10000
flutter: receiveDataWhenStatusError: true
flutter: extra: {}
flutter: headers:
flutter:  stream-auth-type: jwt
flutter:  x-stream-client: stream-feed-dart-client-ios-0.2.2
flutter:  Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMTEzNDYxMSJ9.ROo1ALbUo03TEeTgd2dMZe6xSfRnenQsHtZUncqRXLU
flutter:  content-type: application/json; charset=utf-8
flutter: data:
flutter: User(sahil-kumar, {first_name: Sahil, last_name: Kumar, full_name: Sahil Kumar}, null, null, null, null)
flutter:
flutter: *** DioError ***:
flutter: uri: https://api.stream-io-api.com/api/v1.0/user/?get_or_create=true&api_key=&location=unspecified
flutter: DioError [DioErrorType.response]: Http status error [401]
#0      DioMixin.assureDioError
package:dio/src/dio_mixin.dart:819
#1      DioMixin._dispatchRequest
package:dio/src/dio_mixin.dart:678
<asynchronous suspension>
#2      DioMixin.fetch.<anonymous closure>.<anonymous closure> (package:dio/src/dio_mixin.dart)
package:dio/src/dio_mixin.dart:1
<asynchronous suspension>
flutter: uri: https://api.stream-io-api.com/api/v1.0/user/?get_or_create=true&api_key=&location=unspecified
flutter: statusCode: 401
flutter: headers:
flutter:  connection: keep-alive
flutter:  content-type: text/plain; charset=utf-8
flutter:  access-control-allow-origin: *
flutter:  date: Thu, 22 Jul 2021 11:51:33 GMT
flutter:  server: nginx
flutter:  content-length: 168
`

How can I solve this problem ?

What version of Flutter do you use?
Flutter 2.2.3
What package are you using? What version?
version 0.2.2

What platform is it about?

  • Android
  • iOS

✓] Flutter (Channel stable, 2.2.3, on macOS 11.4 20F71 darwin-x64, locale en-AZ)
• Flutter version 2.2.3 at /Users/shahmirzali/Development/flutter
• Framework revision f4abaa0735 (3 weeks ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/shahmirzali/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5, Build version 12E262
• CocoaPods version 1.10.1

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.58.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.24.0

[✓] Connected device (2 available)
• iPhone (mobile) • c47d4be7167357fd9af36d2acb585f38cc997040 • ios • iOS 14.4.2
• Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.164

• No issues found!

Getting Following Feeds

When I try to get the feeds that the current user is following I get null trying to access the data. If you look at the response from the request it shows there is indeed data but using value[0].target or value[0] each returns null.

I/flutter (17428): *** Request ***
I/flutter (17428): uri: https://api.stream-io-api.com/api/v1.0/feed/timeline/Prhia3HUNgPesoCjkaEdEUPuOWZ2personal/following?limit=100&offset=0&api_key=hmwext26344q&location=unspecified
I/flutter (17428): method: GET
I/flutter (17428): responseType: ResponseType.json
I/flutter (17428): followRedirects: true
I/flutter (17428): connectTimeout: 10000
I/flutter (17428): sendTimeout: 0
I/flutter (17428): receiveTimeout: 10000
I/flutter (17428): receiveDataWhenStatusError: true
I/flutter (17428): extra: {}
I/flutter (17428): headers:
I/flutter (17428):  stream-auth-type: jwt
I/flutter (17428):  x-stream-client: stream-feed-dart-client-android-0.1.3
I/flutter (17428):  Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiUHJoaWEzSFVOZ1Blc29DamthRWRFVVB1T1daMnBlcnNvbmFsIn0.L8Yu4YxwCb4JykadVwlwTJyidBhIerqGpWn1LAK0Sj4
I/flutter (17428): data:
I/flutter (17428): null
I/flutter (17428):
I/flutter (17428): *** Response ***
I/flutter (17428): uri: https://api.stream-io-api.com/api/v1.0/feed/timeline/Prhia3HUNgPesoCjkaEdEUPuOWZ2personal/following?limit=100&offset=0&api_key=hmwext26344q&location=unspecified
I/flutter (17428): statusCode: 200
I/flutter (17428): headers:
I/flutter (17428):  connection: keep-alive
I/flutter (17428):  cache-control: no-cache
I/flutter (17428):  x-ratelimit-reset: 1621443000
I/flutter (17428):  date: Wed, 19 May 2021 16:49:38 GMT
I/flutter (17428):  access-control-allow-origin: *
I/flutter (17428):  x-ratelimit-limit: 500
I/flutter (17428):  content-encoding: gzip
I/flutter (17428):  x-ratelimit-remaining: 499
I/flutter (17428):  content-type: application/json;charset=utf-8
I/flutter (17428):  access-control-max-age: 86400
I/flutter (17428):  server: nginx
I/flutter (17428):  access-control-allow-headers: x-requested-with, content-type, accept, origin, authorization, x-csrftoken, x-stream-client, stream-auth-type
I/flutter (17428):  access-control-allow-methods: GET, POST, PUT, PATCH, DELETE, OPTIONS
I/flutter (17428):  content-length: 192
I/flutter (17428): Response Text:
I/flutter (17428): {"results":[{"feed_id":"timeline:Prhia3HUNgPesoCjkaEdEUPuOWZ2personal","target_id":"user:WPpmnSSN1uURXNODPak2rlsCV332personal","created_at":"2021-05-14T19:58:27.274792063Z","updated_at":"2021-05-14T19:58:27.274792063Z"}],"duration":"1.62ms"}
I/flutter (17428):
I/flutter (17428): Following: Follow(null, null)

Log level when subscribing

Is your feature request related to a problem? Please describe.
Hi
Im connecting with

final client = feed.StreamFeedClient(apiKey, appId: 'XXXX', logLevel: feed.Level.SEVERE);

And subscribing

final userFeed = widget.getstreamClient.flatFeed('timeline', widget.model.uid);
      subscription = await userFeed.subscribe((message) {

Problem is i still see

flutter: (2022-01-27 15:59:32.956484) ℹ️ 🕒 Initiating connection for 1-8-
flutter: (2022-01-27 15:59:32.957818) ℹ️ 🕒 sending message : {id: 4, clientId: , channel: /meta/connect, connectionType: websocket}
flutter: (2022-01-27 16:00:03.170611) ℹ️ 🕒 received message : {id: 4, clientId: 1-5, channel: /meta/connect, advice: Advice(retry, 0, 30000), successful: true}
flutter: (2022-01-27 16:00:03.171803) ℹ️ 🕒 Closed connection for 1-5

getEnrichedActivities - Filter

Describe the bug
Hi team,
im using filters when getting activities.

getEnrichedActivities(
            limit: _itemsMaxSize,
            filter: filter.idGreaterThanOrEqual(lastActivityId),

My problem is
if i keep: filter.idGreaterThanOrEqual(lastActivityId) im seeing my activity => Great

activityId:2157117b-dd7b-11eb-a6fd-12d73b08236b newItems => [2157117b-dd7b-11eb-a6fd-12d73b08236b]

but, if i switch to filter.idLessThanOrEqual(lastActivityId) im not seeing anymore the activity, i see old activities only

activityId:2157117b-dd7b-11eb-a6fd-12d73b08236b newItems => [ac4ed14a-dd67-11eb-b60d-128a130028af, 1212b7b7-dd65-11eb-9337-0a1200300037, e8f71af1-dd63-11eb-92b9-0a1200300037, dcd17743-dd04-11eb-9c64-0ae838defca7, 861fc8c3-dd04-11eb-b74c-128a130028af]

What package are you using? What version?
develop

What platform is it about?

  • Android
  • [X ] iOS
  • Web
  • Windows
  • MacOS
  • Linux

Additional context
Dont know why, but after some time... idLessThanOrEqual works :

activityId:2157117b-dd7b-11eb-a6fd-12d73b08236b newItems => [2157117b-dd7b-11eb-a6fd-12d73b08236b, 86944ce2-dd78-11eb-a1e9-0a1200300037, dbe68432-dd77-11eb-81ad-128a130028af, d8a3e027-dd76-11eb-a495-0ae838defca7, b85db3c1-dd76-11eb-8f6f-0a0d7a10423a]

Is there some cache involve ?
Best regards,
Nelson

Feed Subscribe Issue

When you receive the new activities the data is of type Enriched Activity but the data only has the fields of Type activity.

This is an enriched activity when I first get all activities:
EnrichedActivity(EnrichableField({created_at: 2021-06-07T02:16:12.451786Z, updated_at: 2021-06-07T02:16:12.451786Z, id: yveXfteo6tTV674YBzeGAHlg8xC2personal, data: {gender: Male, name: rickey lee, photo: https://firebasestorage.googleapis.com/v0/b/fire-snab.appspot.com/o/profile-image-placeholder.png?alt=media&token=b17598bb-a510-4167-8354-ab75642ba89e}}), EnrichableField(texted), posted, EnrichableField(), null, , 3270aa64-cbb3-11eb-8080-8001543e6aa3, 2021-06-12 19:20:07.076106, null, null, EnrichableField(user:yveXfteo6tTV674YBzeGAHlg8xC2personal), null, {atSigns: {}, files: [], hasFile: false, latest_reactions_extra: {}, text: Hello everyone, toExpire: false}, {}, {}, {})

This is the data I get from the subscription:
{actor: {created_at: 2021-06-07T02:16:12.451786Z, data: {gender: Male, name: rickey lee, photo: https://firebasestorage.googleapis.com/v0/b/fire-snab.appspot.com/o/profile-image-placeholder.png?alt=media&token=b17598bb-a510-4167-8354-ab75642ba89e}, id: yveXfteo6tTV674YBzeGAHlg8xC2personal, updated_at: 2021-06-07T02:16:12.451786Z}, verb: posted, object: texted, foreign_id: , time: 2021-06-12T19:44:24.863293, atSigns: {}, files: [], hasFile: false, text: Hi, toExpire: false}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.