Skip to content
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
7 changes: 6 additions & 1 deletion .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
---
version: v2.0.0
version: v2.0.1
changelog:
- date: 2026-07-06
version: v2.0.1
changes:
- type: bug
text: "Implemented minor fixes to error handling, logging, and cryptor logic."
- date: 2026-04-01
version: v2.0.0
changes:
Expand Down
32 changes: 0 additions & 32 deletions c-sharp-chat/PubnubChatApi/PubNubChatConsoleExample/Program.cs

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions c-sharp-chat/PubnubChatApi/PubnubChatApi.sln
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PubnubChatApi", "PubnubChat
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PubNubChatApi.Tests", "PubNubChatApi.Tests\PubNubChatApi.Tests.csproj", "{54ACBC4B-510A-499F-9494-24F9F90F7B67}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PubNubChatConsoleExample", "PubNubChatConsoleExample\PubNubChatConsoleExample.csproj", "{E5373345-87EA-43F1-A76A-F1C739003CD2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -20,9 +18,5 @@ Global
{54ACBC4B-510A-499F-9494-24F9F90F7B67}.Debug|Any CPU.Build.0 = Debug|Any CPU
{54ACBC4B-510A-499F-9494-24F9F90F7B67}.Release|Any CPU.ActiveCfg = Release|Any CPU
{54ACBC4B-510A-499F-9494-24F9F90F7B67}.Release|Any CPU.Build.0 = Release|Any CPU
{E5373345-87EA-43F1-A76A-F1C739003CD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E5373345-87EA-43F1-A76A-F1C739003CD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E5373345-87EA-43F1-A76A-F1C739003CD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E5373345-87EA-43F1-A76A-F1C739003CD2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
Expand Down Expand Up @@ -86,7 +87,7 @@ public bool IsDeleted

protected Subscription? subscription;

private Dictionary<string, Timer> typingIndicators = new();
private ConcurrentDictionary<string, Timer> typingIndicators = new();

/// <summary>
/// Event that is triggered when a message is received.
Expand Down Expand Up @@ -439,7 +440,7 @@ public void StreamTyping(bool stream)
if (typingIndicators.TryGetValue(userId, out var timer))
{
timer.Stop();
typingIndicators.Remove(userId);
typingIndicators.Remove(userId, out _);
timer.Dispose();
}
}
Expand All @@ -456,7 +457,7 @@ public void StreamTyping(bool stream)
var newTimer = new Timer(chat.Config.TypingTimeout);
newTimer.Elapsed += (_, _) =>
{
typingIndicators.Remove(userId);
typingIndicators.Remove(userId, out _);
OnUsersTyping?.Invoke(typingIndicators.Keys.ToList());
};
typingIndicators[userId] = newTimer;
Expand Down
29 changes: 18 additions & 11 deletions c-sharp-chat/PubnubChatApi/PubnubChatApi/Entities/Chat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -674,20 +674,27 @@ internal async void StoreActivityTimeStamp()
storeActivity = true;
while (storeActivity)
{
var getResult = await User.GetUserData(this, currentUserId).ConfigureAwait(false);
if (getResult.Status.Error)
try
{
Logger.Error($"Error when trying to store user activity timestamp: {getResult.Status.ErrorData}");
await Task.Delay(Config.StoreUserActivityInterval).ConfigureAwait(false);
continue;
var getResult = await User.GetUserData(this, currentUserId).ConfigureAwait(false);
if (getResult.Status.Error)
{
Logger.Error($"Error when trying to store user activity timestamp: {getResult.Status.ErrorData}");
await Task.Delay(Config.StoreUserActivityInterval).ConfigureAwait(false);
continue;
}
var data = (ChatUserData)getResult.Result;
data.CustomData ??= new Dictionary<string, object>();
data.CustomData["lastActiveTimestamp"] = ChatUtils.TimeTokenNow();
var setData = await User.UpdateUserData(this, currentUserId, data).ConfigureAwait(false);
if (setData.Status.Error)
{
Logger.Error($"Error when trying to store user activity timestamp: {setData.Status.ErrorData}");
}
}
var data = (ChatUserData)getResult.Result;
data.CustomData ??= new Dictionary<string, object>();
data.CustomData["lastActiveTimestamp"] = ChatUtils.TimeTokenNow();
var setData = await User.UpdateUserData(this, currentUserId, data).ConfigureAwait(false);
if (setData.Status.Error)
catch (Exception e)
{
Logger.Error($"Error when trying to store user activity timestamp: {setData.Status.ErrorData}");
Logger.Error($"Exception occured when trying to store activity timestamp: {e.Message}");
}
await Task.Delay(Config.StoreUserActivityInterval).ConfigureAwait(false);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
Expand Down Expand Up @@ -86,7 +87,7 @@ public bool IsDeleted

protected Subscription? subscription;

private Dictionary<string, Timer> typingIndicators = new();
private ConcurrentDictionary<string, Timer> typingIndicators = new();

/// <summary>
/// Event that is triggered when a message is received.
Expand Down Expand Up @@ -439,7 +440,7 @@ public void StreamTyping(bool stream)
if (typingIndicators.TryGetValue(userId, out var timer))
{
timer.Stop();
typingIndicators.Remove(userId);
typingIndicators.Remove(userId, out _);
timer.Dispose();
}
}
Expand All @@ -456,7 +457,7 @@ public void StreamTyping(bool stream)
var newTimer = new Timer(chat.Config.TypingTimeout);
newTimer.Elapsed += (_, _) =>
{
typingIndicators.Remove(userId);
typingIndicators.Remove(userId, out _);
OnUsersTyping?.Invoke(typingIndicators.Keys.ToList());
};
typingIndicators[userId] = newTimer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -674,20 +674,27 @@ internal async void StoreActivityTimeStamp()
storeActivity = true;
while (storeActivity)
{
var getResult = await User.GetUserData(this, currentUserId).ConfigureAwait(false);
if (getResult.Status.Error)
try
{
Logger.Error($"Error when trying to store user activity timestamp: {getResult.Status.ErrorData}");
await Task.Delay(Config.StoreUserActivityInterval).ConfigureAwait(false);
continue;
var getResult = await User.GetUserData(this, currentUserId).ConfigureAwait(false);
if (getResult.Status.Error)
{
Logger.Error($"Error when trying to store user activity timestamp: {getResult.Status.ErrorData}");
await Task.Delay(Config.StoreUserActivityInterval).ConfigureAwait(false);
continue;
}
var data = (ChatUserData)getResult.Result;
data.CustomData ??= new Dictionary<string, object>();
data.CustomData["lastActiveTimestamp"] = ChatUtils.TimeTokenNow();
var setData = await User.UpdateUserData(this, currentUserId, data).ConfigureAwait(false);
if (setData.Status.Error)
{
Logger.Error($"Error when trying to store user activity timestamp: {setData.Status.ErrorData}");
}
}
var data = (ChatUserData)getResult.Result;
data.CustomData ??= new Dictionary<string, object>();
data.CustomData["lastActiveTimestamp"] = ChatUtils.TimeTokenNow();
var setData = await User.UpdateUserData(this, currentUserId, data).ConfigureAwait(false);
if (setData.Status.Error)
catch (Exception e)
{
Logger.Error($"Error when trying to store user activity timestamp: {setData.Status.ErrorData}");
Logger.Error($"Exception occured when trying to store activity timestamp: {e.Message}");
}
await Task.Delay(Config.StoreUserActivityInterval).ConfigureAwait(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace PubnubChatApi
{
public class UnityChatPNSDKSource : IPNSDKSource
{
private const string build = "2.0.0";
private const string build = "2.0.1";

private string GetPlatformString()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public class PubnubChatUIController : MonoBehaviour
[Header("Pubnub settings")]
[SerializeField] private string publishKey;
[SerializeField] private string subscribeKey;
[SerializeField] private string secretKey;
[SerializeField] private string userId;
[SerializeField] private string channelId;
[SerializeField] private bool fetchChannelHistoryOnStart;
Expand All @@ -43,8 +42,7 @@ private async void Awake()
new PNConfiguration(new UserId(userId))
{
PublishKey = publishKey,
SubscribeKey = subscribeKey,
SecretKey = secretKey
SubscribeKey = subscribeKey
}, false);
if (createChat.Error)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.pubnub.pubnubchat",
"version": "2.0.0",
"version": "2.0.1",
"displayName": "Pubnub Chat",
"description": "PubNub Unity Chat SDK",
"unity": "2022.3",
Expand Down
Loading