< Summary

Class:DCL.Social.Chat.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:84
Line coverage:93.5% (29 of 31)
Covered branches:0
Total branches:0
Covered methods:11
Total methods:13
Method coverage:84.6% (11 of 13)

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 DCL.Social.Chat;
 2using System;
 3using UIComponents.CollapsableSortedList;
 4using UnityEngine;
 5
 6namespace DCL.Social.Chat
 7{
 8    public class CollapsableChatSearchListComponentView : CollapsableSortedListComponentView<string, BaseComponentView>
 9    {
 10        [SerializeField] private CollapsableDirectChatListComponentView directChatList;
 11        [SerializeField] private CollapsablePublicChannelListComponentView publicChannelList;
 12
 13        public event Action<PrivateChatEntry> OnOpenPrivateChat
 14        {
 4015            add => directChatList.OnOpenChat += value;
 016            remove => directChatList.OnOpenChat += value;
 17        }
 18
 19        public event Action<PublicChatEntry> OnOpenPublicChat
 20        {
 4021            add => publicChannelList.OnOpenChat += value;
 022            remove => publicChannelList.OnOpenChat -= value;
 23        }
 24
 25        public void Initialize(
 26            IChatController chatController,
 27            DataStore_Mentions mentionDataStore)
 28        {
 4029            directChatList.Initialize(chatController, mentionDataStore);
 4030            publicChannelList.Initialize(chatController, mentionDataStore);
 4031        }
 32
 33        public override void Filter(Func<BaseComponentView, bool> comparision)
 34        {
 235            directChatList.Filter(comparision);
 236            publicChannelList.Filter(comparision);
 237            UpdateEmptyState();
 238        }
 39
 40        public override int Count()
 41        {
 28642            return directChatList.Count() + publicChannelList.Count();
 43        }
 44
 45        public override void Clear()
 46        {
 1147            directChatList.Clear();
 1148            publicChannelList.Clear();
 1149            UpdateEmptyState();
 1150        }
 51
 52        public override BaseComponentView Get(string key)
 53        {
 2654            return (BaseComponentView) directChatList.Get(key) ?? publicChannelList.Get(key);
 55        }
 56
 57        public override void Dispose()
 58        {
 359            base.Dispose();
 360            directChatList.Dispose();
 361            publicChannelList.Dispose();
 362        }
 63
 64        public override BaseComponentView Remove(string key)
 65        {
 266            var entry = (BaseComponentView) directChatList.Remove(key) ?? publicChannelList.Remove(key);
 267            UpdateEmptyState();
 268            return entry;
 69        }
 70
 71        public void Set(PrivateChatEntryModel model)
 72        {
 2373            directChatList.Set(model.userId, model);
 2374            directChatList.Get(model.userId).EnableAvatarSnapshotFetching();
 2375            UpdateEmptyState();
 2376        }
 77
 78        public void Set(PublicChatEntryModel model)
 79        {
 1280            publicChannelList.Set(model.channelId, model);
 1281            UpdateEmptyState();
 1282        }
 83    }
 84}