Skip to content

Commit 575e348

Browse files
committed
Merge branch 'develop' of https://github.com/GetStream/stream-chat-unity into develop
# Conflicts: # Assets/Plugins/StreamChat/Tests/StatefulClient/BaseStateIntegrationTests.cs
2 parents 3b2de0a + f7c138a commit 575e348

78 files changed

Lines changed: 1016 additions & 204 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Assets/Plugins/StreamChat/Changelog.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
v4.7.0:
2+
Fixes:
3+
* Fix the IStreamChannel instance provided by an event not triggering its own events (the channel was not being watched if it was only returned via event)
4+
* Fix client events: IStreamChatClient.AddedToChannelAsMember, IStreamChatClient.RemovedFromChannelAsMember, IStreamChatClient.ChannelInviteReceived, IStreamChatClient.ChannelInviteAccepted, IStreamChatClient.ChannelInviteRejected not being executed on the main thread
5+
* Fix the client not reconnecting immediately after losing network connection when the network is available again
6+
* Fix internal WebSocket client sometimes getting stuck in the Connecting state on Android when the network was not available
7+
8+
Features:
9+
* Add state recovery after the disconnected period - once the client reconnects, it will fetch any missed events (like new messages, etc.) from the server and reconstruct the missed state
10+
111
v4.6.0:
212
Improvements:
313
* Added client events that are fired when the local user is added to a new channel -> IStreamChatClient.AddedToChannelAsMember or removed from a channel IStreamChatClient.RemovedFromChannelAsMember - These two events fire only for channels that are not tracked locally. For tracked channels, the IStreamChannel.MemberAdded & IStreamChannel.MemberRemoved should be used

Assets/Plugins/StreamChat/Core/Exceptions/StreamDeserializationException.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,16 @@ public class StreamDeserializationException : Exception
1111
public Type TargetType { get; }
1212

1313
public StreamDeserializationException(string content, Type targetType, Exception innerException)
14-
: base($"Failed to deserialize string to type: `{targetType.Name}` ", innerException)
14+
: base($"Failed to deserialize string to type: `{targetType.Name}`", innerException)
1515
{
1616
TargetType = targetType;
1717
Content = content;
1818
}
19+
20+
public override string ToString()
21+
{
22+
var innerExceptionMessage = InnerException != null ? InnerException.ToString() : string.Empty;
23+
return $"Failed to deserialize string to type: `{TargetType.Name}`\nContent: {Content}\nInnerException: {innerExceptionMessage}";
24+
}
1925
}
2026
}

Assets/Plugins/StreamChat/Core/InternalDTO/Responses/SyncResponseInternalDTO.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ internal partial class SyncResponseInternalDTO
2323
/// List of events
2424
/// </summary>
2525
[Newtonsoft.Json.JsonProperty("events", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
26-
public System.Collections.Generic.List<EventInternalDTO> Events { get; set; } = new System.Collections.Generic.List<EventInternalDTO>();
26+
public System.Collections.Generic.List<object> Events { get; set; } = new System.Collections.Generic.List<object>();
2727

2828
/// <summary>
2929
/// List of CIDs that user can't access

Assets/Plugins/StreamChat/Core/LowLevelClient/API/ChannelApi.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Threading.Tasks;
33
using StreamChat.Core.Helpers;
4+
using StreamChat.Core.InternalDTO.Requests;
45
using StreamChat.Core.InternalDTO.Responses;
56
using StreamChat.Core.LowLevelClient.API.Internal;
67
using StreamChat.Core.LowLevelClient.Models;
@@ -141,6 +142,12 @@ public Task SendTypingStartEventAsync(string channelType, string channelId)
141142
public Task SendTypingStopEventAsync(string channelType, string channelId)
142143
=> _internalChannelApi.SendTypingStopEventAsync(channelType, channelId);
143144

145+
public async Task<SyncResponse> SyncAsync(SyncRequest syncRequest)
146+
{
147+
var dto = await _internalChannelApi.SyncAsync(syncRequest.TrySaveToDto());
148+
return dto.ToDomain<SyncResponseInternalDTO, SyncResponse>();
149+
}
150+
144151
private readonly IInternalChannelApi _internalChannelApi;
145152
}
146153
}

Assets/Plugins/StreamChat/Core/LowLevelClient/API/IChannelApi.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,5 +150,8 @@ Task<MarkReadResponse> MarkReadAsync(string channelType, string channelId,
150150
Task SendTypingStartEventAsync(string channelType, string channelId);
151151

152152
Task SendTypingStopEventAsync(string channelType, string channelId);
153+
154+
//StreamTodo: perhaps we can skip this declaration and use the Internal one directly
155+
Task<SyncResponse> SyncAsync(SyncRequest syncRequest);
153156
}
154157
}

Assets/Plugins/StreamChat/Core/LowLevelClient/API/Internal/IInternalChannelApi.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,7 @@ Task<MarkReadResponseInternalDTO> MarkReadAsync(string channelType, string chann
5252
Task SendTypingStartEventAsync(string channelType, string channelId);
5353

5454
Task SendTypingStopEventAsync(string channelType, string channelId);
55+
56+
Task<SyncResponseInternalDTO> SyncAsync(SyncRequestInternalDTO syncRequest);
5557
}
5658
}

Assets/Plugins/StreamChat/Core/LowLevelClient/API/Internal/InternalChannelApi.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,5 +133,8 @@ public Task SendTypingStopEventAsync(string channelType, string channelId)
133133
{
134134
Type = WSEventType.TypingStop
135135
});
136+
137+
public Task<SyncResponseInternalDTO> SyncAsync(SyncRequestInternalDTO syncRequest)
138+
=> Post<SyncRequestInternalDTO, SyncResponseInternalDTO>($"/sync", syncRequest);
136139
}
137140
}

Assets/Plugins/StreamChat/Core/LowLevelClient/API/Internal/InternalMessageApi.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System.Net.Http;
2-
using System.Threading.Tasks;
1+
using System.Threading.Tasks;
32
using StreamChat.Core.InternalDTO.Requests;
43
using StreamChat.Core.InternalDTO.Responses;
54
using StreamChat.Core.Web;

Assets/Plugins/StreamChat/Core/LowLevelClient/Events/EventBase.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ namespace StreamChat.Core.LowLevelClient.Events
22
{
33
public abstract class EventBase
44
{
5+
public System.DateTimeOffset CreatedAt { get; set; }
6+
57
private System.Collections.Generic.Dictionary<string, object> _additionalProperties = new System.Collections.Generic.Dictionary<string, object>();
68

79
[Newtonsoft.Json.JsonExtensionData]

Assets/Plugins/StreamChat/Core/LowLevelClient/Events/EventChannelDeleted.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ public sealed class EventChannelDeleted : EventBase,
1515

1616
public string Cid { get; set; }
1717

18-
public System.DateTimeOffset? CreatedAt { get; set; }
19-
2018
public string Team { get; set; }
2119

2220
public string Type { get; set; }

0 commit comments

Comments
 (0)