< Summary

Class:PublicChannelEntry
Assembly:WorldChatWindowHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/WorldChatWindowHUD/PublicChannelEntry.cs
Covered lines:14
Uncovered lines:3
Coverable lines:17
Total lines:60
Line coverage:82.3% (14 of 17)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Create()0%110100%
Awake()0%110100%
Initialize(...)0%2100%
Configure(...)0%110100%
RefreshControl()0%110100%
PublicChannelEntryModel(...)0%110100%

File(s)

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

#LineLine coverage
 1using System;
 2using TMPro;
 3using UnityEngine;
 4using UnityEngine.UI;
 5using static PublicChannelEntry;
 6
 7public class PublicChannelEntry : BaseComponentView, IComponentModelConfig<PublicChannelEntryModel>
 8{
 9    [SerializeField] internal Button openChatButton;
 10    [SerializeField] internal TMP_Text nameLabel;
 11    [SerializeField] internal PublicChannelEntryModel model;
 12    [SerializeField] internal UnreadNotificationBadge unreadNotifications;
 13
 14    private IChatController chatController;
 15
 016    public PublicChannelEntryModel Model => model;
 17
 18    public event Action<PublicChannelEntry> OnOpenChat;
 19
 20    public static PublicChannelEntry Create()
 21    {
 222        return Instantiate(Resources.Load<PublicChannelEntry>("SocialBarV1/PublicChannelElement"));
 23    }
 24
 25    public override void Awake()
 26    {
 2527        base.Awake();
 2728        openChatButton.onClick.AddListener(() => OnOpenChat?.Invoke(this));
 2529    }
 30
 31    public void Initialize(IChatController chatController)
 32    {
 033        this.chatController = chatController;
 034    }
 35
 36    public void Configure(PublicChannelEntryModel newModel)
 37    {
 2138        model = newModel;
 2139        RefreshControl();
 2140    }
 41
 42    public override void RefreshControl()
 43    {
 2144        nameLabel.text = $"#{model.name}";
 2145        unreadNotifications.Initialize(chatController, model.channelId);
 2146    }
 47
 48    [Serializable]
 49    public class PublicChannelEntryModel : BaseComponentModel
 50    {
 51        public string channelId;
 52        public string name;
 53
 2154        public PublicChannelEntryModel(string channelId, string name)
 55        {
 2156            this.channelId = channelId;
 2157            this.name = name;
 2158        }
 59    }
 60}