Skip to content

Commit

Permalink
Move /t_ms delta admin text type parsing to separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
gave92 committed Feb 8, 2020
1 parent 8862d4f commit 561d0e0
Show file tree
Hide file tree
Showing 21 changed files with 497 additions and 726 deletions.
708 changes: 11 additions & 697 deletions fbchat-sharp/API/Client.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using System.Linq;

namespace fbchat_sharp.API
{
Expand Down Expand Up @@ -58,7 +59,7 @@ public class FB_LiveLocationEvent : FB_ThreadEvent
{
var thread = FB_LiveLocationEvent._get_thread(session, data);

foreach (var location_data in data?.get("messageLiveLocations").OrEmptyIfNull())
foreach (var location_data in data?.get("messageLiveLocations") ?? Enumerable.Empty<JToken>())
{
var message = new FB_Message(session: session, thread_id: thread.uid, uid: data?.get("messageId")?.Value<string>());
var author = new FB_User(session: session, uid: location_data?.get("senderId")?.Value<string>());
Expand Down Expand Up @@ -123,9 +124,9 @@ internal class ClientPayload
{
public static IEnumerable<FB_Event> parse_client_payloads(Session session, JToken data)
{
var payload = JToken.Parse(string.Join("", data.get("payload")?.Value<string>()));
var payload = JToken.Parse(string.Join("", data.get("payload")?.Select(x => x?.Value<int?>()?.ToString())));

foreach (var d in payload.get("deltas").OrEmptyIfNull())
foreach (var d in payload?.get("deltas") ?? Enumerable.Empty<JToken>())
{
yield return parse_client_delta(session, d);
}
Expand Down
File renamed without changes.
Loading

0 comments on commit 561d0e0

Please sign in to comment.