< Summary

Class:CollapsableChatSearchListComponentView
Assembly:WorldChatWindowHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/WorldChatWindowHUD/CollapsableChatSearchListComponentView.cs
Covered lines:25
Uncovered lines:6
Coverable lines:31
Total lines:78
Line coverage:80.6% (25 of 31)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
add_OnOpenPrivateChat(...)0%110100%
remove_OnOpenPrivateChat(...)0%2100%
add_OnOpenPublicChat(...)0%110100%
remove_OnOpenPublicChat(...)0%2100%
Initialize(...)0%110100%
Filter(...)0%2100%
Count()0%110100%
Clear()0%110100%
Get(...)0%220100%
Dispose()0%110100%
Remove(...)0%220100%
Set(...)0%110100%
Set(...)0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/WorldChatWindowHUD/CollapsableChatSearchListComponentView.cs

#LineLine coverage
 1using System;
 2using UIComponents.CollapsableSortedList;
 3using UnityEngine;
 4
 5public class CollapsableChatSearchListComponentView : CollapsableSortedListComponentView<string, BaseComponentView>
 6{
 7    [SerializeField] private CollapsableDirectChatListComponentView directChatList;
 8    [SerializeField] private CollapsablePublicChannelListComponentView publicChannelList;
 9
 10    public event Action<PrivateChatEntry> OnOpenPrivateChat
 11    {
 2712        add => directChatList.OnOpenChat += value;
 013        remove => directChatList.OnOpenChat += value;
 14    }
 15
 16    public event Action<PublicChannelEntry> OnOpenPublicChat
 17    {
 2718        add => publicChannelList.OnOpenChat += value;
 019        remove => publicChannelList.OnOpenChat -= value;
 20    }
 21
 22    public void Initialize(IChatController chatController)
 23    {
 2724        directChatList.Initialize(chatController);
 2725        publicChannelList.Initialize(chatController);
 2726    }
 27
 28    public override void Filter(Func<BaseComponentView, bool> comparision)
 29    {
 030        directChatList.Filter(comparision);
 031        publicChannelList.Filter(comparision);
 032        UpdateEmptyState();
 033    }
 34
 35    public override int Count()
 36    {
 12837        return directChatList.Count() + publicChannelList.Count();
 38    }
 39
 40    public override void Clear()
 41    {
 942        directChatList.Clear();
 943        publicChannelList.Clear();
 944        UpdateEmptyState();
 945    }
 46
 47    public override BaseComponentView Get(string key)
 48    {
 1849        return (BaseComponentView) directChatList.Get(key) ?? publicChannelList.Get(key);
 50    }
 51
 52    public override void Dispose()
 53    {
 354        base.Dispose();
 355        directChatList.Dispose();
 356        publicChannelList.Dispose();
 357    }
 58
 59    public override BaseComponentView Remove(string key)
 60    {
 161        var view = (BaseComponentView) directChatList.Remove(key) ?? publicChannelList.Remove(key);
 162        UpdateEmptyState();
 163        return view;
 64    }
 65
 66    public void Set(PrivateChatEntry.PrivateChatEntryModel model)
 67    {
 1868        directChatList.Set(model.userId, model);
 1869        directChatList.Get(model.userId).EnableAvatarSnapshotFetching();
 1870        UpdateEmptyState();
 1871    }
 72
 73    public void Set(PublicChannelEntry.PublicChannelEntryModel model)
 74    {
 875        publicChannelList.Set(model.channelId, model);
 876        UpdateEmptyState();
 877    }
 78}