< Summary

Class:DCL.Chat.HUD.CollapsableChatSearchListComponentView
Assembly:WorldChatWindowHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/WorldChatWindowHUD/CollapsableChatSearchListComponentView.cs
Covered lines:29
Uncovered lines:2
Coverable lines:31
Total lines:81
Line coverage:93.5% (29 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%110100%
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
 5namespace DCL.Chat.HUD
 6{
 7    public class CollapsableChatSearchListComponentView : CollapsableSortedListComponentView<string, BaseComponentView>
 8    {
 9        [SerializeField] private CollapsableDirectChatListComponentView directChatList;
 10        [SerializeField] private CollapsablePublicChannelListComponentView publicChannelList;
 11
 12        public event Action<PrivateChatEntry> OnOpenPrivateChat
 13        {
 4014            add => directChatList.OnOpenChat += value;
 015            remove => directChatList.OnOpenChat += value;
 16        }
 17
 18        public event Action<PublicChatEntry> OnOpenPublicChat
 19        {
 4020            add => publicChannelList.OnOpenChat += value;
 021            remove => publicChannelList.OnOpenChat -= value;
 22        }
 23
 24        public void Initialize(IChatController chatController)
 25        {
 3426            directChatList.Initialize(chatController);
 3427            publicChannelList.Initialize(chatController);
 3428        }
 29
 30        public override void Filter(Func<BaseComponentView, bool> comparision)
 31        {
 232            directChatList.Filter(comparision);
 233            publicChannelList.Filter(comparision);
 234            UpdateEmptyState();
 235        }
 36
 37        public override int Count()
 38        {
 28639            return directChatList.Count() + publicChannelList.Count();
 40        }
 41
 42        public override void Clear()
 43        {
 1144            directChatList.Clear();
 1145            publicChannelList.Clear();
 1146            UpdateEmptyState();
 1147        }
 48
 49        public override BaseComponentView Get(string key)
 50        {
 2651            return (BaseComponentView) directChatList.Get(key) ?? publicChannelList.Get(key);
 52        }
 53
 54        public override void Dispose()
 55        {
 356            base.Dispose();
 357            directChatList.Dispose();
 358            publicChannelList.Dispose();
 359        }
 60
 61        public override BaseComponentView Remove(string key)
 62        {
 263            var entry = (BaseComponentView) directChatList.Remove(key) ?? publicChannelList.Remove(key);
 264            UpdateEmptyState();
 265            return entry;
 66        }
 67
 68        public void Set(PrivateChatEntryModel model)
 69        {
 2370            directChatList.Set(model.userId, model);
 2371            directChatList.Get(model.userId).EnableAvatarSnapshotFetching();
 2372            UpdateEmptyState();
 2373        }
 74
 75        public void Set(PublicChatEntryModel model)
 76        {
 1277            publicChannelList.Set(model.channelId, model);
 1278            UpdateEmptyState();
 1279        }
 80    }
 81}