Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade the package to 4.6.0 version #147

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading