GetStream / swift-activity-feed

Stream Swift iOS Activity Feed Components
https://getstream.io/
BSD 3-Clause "New" or "Revised" License
30 stars 17 forks source link

Feed fails to display when starting from a clean data feed #4

Closed dconroy closed 4 years ago

dconroy commented 4 years ago

When deleting all app data from a collection of feeds, and then going back in to make a new post and display it... it fails to decode new posts. Could it be avatars?

🐴 [18/01 05:28:41.664] ➡️ get(timeline:dconroy, true, GetStream.Pagination.none, "", GetStream.FeedMarkOption.none, GetStream.FeedReactionsOptions(rawValue: 13))
🐴 [18/01 05:28:41.664] 🧾 Parameters: ["withOwnReactions": true, "withRecentReactions": true, "withReactionCounts": true]
🐴 [18/01 05:28:41.694] ⬅️ Response 200: https://api.stream-io-api.com/api/v1.0/enrich/feed/timeline/dconroy/?api_key=2v627n68x39v&withOwnReactions=1&withReactionCounts=1&withRecentReactions=1
🐴 [18/01 05:28:41.694] ⒿⓈⓄⓃ 417 bytes
 {
  "results" : [
    {
      "id" : "49d60af5-39dc-11ea-af91-12f8ef9c949e",
      "reaction_counts" : {

      },
      "verb" : "post",
      "time" : "2020-01-18T10:21:28.257407",
      "latest_reactions" : {

      },
      "object" : "Test 1234",
      "actor" : {
        "id" : "dconroy",
        "data" : null,
        "updated_at" : "2020-01-18T07:59:53.958398Z",
        "created_at" : "2020-01-18T07:59:53.958398Z"
      },
      "origin" : null,
      "latest_reactions_extra" : {

      },
      "own_reactions" : {

      },
      "target" : "",
      "foreign_id" : ""
    }
  ],
  "next" : "",
  "duration" : "10.91ms"
}
❌ JSON decoding error: The data couldn’t be read because it isn’t in the correct format.. Data: 417 bytes
b-onc commented 4 years ago

Hello @dconroy Can you share more information about what you've done, so we can try to replicate the issue? Can you replicate the issue on a fresh project?

b-onc commented 4 years ago

Hello @dconroy We've looked into this issue and figured out the problem: When you create GetStream.User and try to decode it as GetStreamActivityFeed.User decoding will fail since they're not compatible. Solution is to update your user with GetStreamActivityFeed.User type (so it has a name/avatar image)

I'm going to update the SDK so it'll print a better error.

Thanks for the info!