Skip to content

Commit

Permalink
Upgrade the package to 4.6.0 version (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
sierpinskid authored Jun 12, 2024
1 parent f24bae1 commit cca8710
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
4 changes: 4 additions & 0 deletions Assets/Plugins/StreamChat/Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v4.6.0:
Improvements:
* 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

v4.5.0:
Fixes:
* Fixed channel member role deserialization breaking
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ private set
/// <summary>
/// SDK Version number
/// </summary>
public static readonly Version SDKVersion = new Version(4, 5, 0);
public static readonly Version SDKVersion = new Version(4, 6, 0);

/// <summary>
/// Use this method to create the main client instance or use StreamChatClient constructor to create a client instance with custom dependencies
Expand Down
20 changes: 15 additions & 5 deletions Assets/Plugins/StreamChat/Samples/EventsSamples.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Threading.Tasks;
using StreamChat.Core;
using StreamChat.Core.Models;
using StreamChat.Core.QueryBuilders.Filters;
using StreamChat.Core.QueryBuilders.Filters.Channels;
using StreamChat.Core.StatefulModels;

namespace StreamChat.Samples
Expand All @@ -12,6 +15,13 @@ public async Task QueryChannelsEvents()
// Get a single channel
var channel = await Client.GetOrCreateChannelWithIdAsync(ChannelType.Messaging, "my-channel-id");

// Or multiple with optional filters
var channels = await Client.QueryChannelsAsync(new List<IFieldFilterRule>()
{
ChannelFilter.Members.In(Client.LocalUserData.User)
});

// Subscribe to events
channel.MessageReceived += OnMessageReceived;
channel.MessageUpdated += OnMessageUpdated;
channel.MessageDeleted += OnMessageDeleted;
Expand Down Expand Up @@ -112,7 +122,7 @@ private void OnTypingUsersChanged(IStreamChannel channel)
{
}

public void ClientEvents()
public void SubscribeToClientEvents()
{
Client.AddedToChannelAsMember += OnAddedToChannelAsMember;
Client.RemovedFromChannelAsMember += OnRemovedFromChannel;
Expand All @@ -130,22 +140,22 @@ private void OnRemovedFromChannel(IStreamChannel channel, IStreamChannelMember m
// member - object containing channel membership information
}

public void ConnectionEvents()
public void SubscribeToConnectionEvents()
{
Client.Connected += OnConnected;
Client.Disconnected += OnDisconnected;
Client.ConnectionStateChanged += OnConnectionStateChanged;
}

private void OnConnectionStateChanged(ConnectionState previous, ConnectionState current)
private void OnConnected(IStreamLocalUserData localUserData)
{
}

private void OnDisconnected()
{
}

private void OnConnected(IStreamLocalUserData localUserData)
private void OnConnectionStateChanged(ConnectionState previous, ConnectionState current)
{
}

Expand Down

0 comments on commit cca8710

Please sign in to comment.