Hi dspoh,
Below is a simple way to achieve it.
Open your chat provider, add the code below into it.
-
class MyDataManager : CuteChat.AppDataManager
-
{
-
public MyDataManager(AppPortal portal):base(portal)
-
{
-
}
-
public override void UpdateUserInfo(IChatUserInfo info)
-
{
-
if (info.DisplayName != null && info.DisplayName.Length > 100)
-
info.DisplayName = info.DisplayName.Substring(0,100);
-
if (info.Description != null && info.Description.Length > 150)
-
info.Description = info.Description.Substring(0, 150);
-
-
using (IChatDataProvider provider = this.CreateDataProvider())
-
{
-
provider.UpdateUserInfo(info);
-
}
-
}
-
}
-
public override AppDataManager CreateDataManagerInstance(AppPortal portal)
-
{
-
return new MyDataManager(portal);
-
}
Like
- public class SampleProvider : ChatProvider
- {
-
- class MyDataManager : CuteChat.AppDataManager
- {
- public MyDataManager(AppPortal portal)
- : base(portal)
- {
- }
- public override void UpdateUserInfo(IChatUserInfo info)
- {
- if (info.DisplayName != null && info.DisplayName.Length > 100)
- info.DisplayName = info.DisplayName.Substring(0, 100);
- if (info.Description != null && info.Description.Length > 150)
- info.Description = info.Description.Substring(0, 150);
-
- using (IChatDataProvider provider = this.CreateDataProvider())
- {
- provider.UpdateUserInfo(info);
- }
- }
- }
- public override AppDataManager CreateDataManagerInstance(AppPortal portal)
- {
- return new MyDataManager(portal);
- }
-
- }
Regards,
Ken