< Summary

Class:DCL.Chat.HUD.PrivateChatHUDView
Assembly:PrivateChatWindowHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/PrivateChatWindow/PrivateChatHUDView.cs
Covered lines:4
Uncovered lines:16
Coverable lines:20
Total lines:44
Line coverage:20% (4 of 20)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
PrivateChatHUDView()0%110100%
Awake()0%110100%
AddEntry(...)0%2100%
ClearAllEntries()0%2100%
AddSeparatorEntryIfNeeded(...)0%6200%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/PrivateChatWindow/PrivateChatHUDView.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using UnityEngine;
 4
 5namespace DCL.Chat.HUD
 6{
 7    public class PrivateChatHUDView : ChatHUDView
 8    {
 9        [SerializeField] private PoolPrivateChatEntryFactory chatEntryFactory;
 10
 1511        private readonly Dictionary<string, DateSeparatorEntry> dateSeparators = new Dictionary<string, DateSeparatorEnt
 12
 13        public override void Awake()
 14        {
 1415            base.Awake();
 1416            ChatEntryFactory = chatEntryFactory;
 1417        }
 18
 19        public override void AddEntry(ChatEntryModel model, bool setScrollPositionToBottom = false)
 20        {
 021            AddSeparatorEntryIfNeeded(model);
 022            base.AddEntry(model, setScrollPositionToBottom);
 023        }
 24
 25        public override void ClearAllEntries()
 26        {
 027            base.ClearAllEntries();
 028            dateSeparators.Clear();
 029        }
 30
 31        private void AddSeparatorEntryIfNeeded(ChatEntryModel chatEntryModel)
 32        {
 033            var entryDateTime = DateTimeOffset.FromUnixTimeMilliseconds((long) chatEntryModel.timestamp).Date;
 034            var separatorId = entryDateTime.Ticks.ToString();
 035            if (dateSeparators.ContainsKey(separatorId)) return;
 036            var dateSeparatorEntry = chatEntryFactory.CreateDateSeparator();
 037            dateSeparatorEntry.transform.SetParent(chatEntriesContainer, false);
 038            dateSeparatorEntry.Populate(chatEntryModel);
 039            dateSeparatorEntry.SetFadeout(IsFadeoutModeEnabled);
 040            dateSeparators[separatorId] = dateSeparatorEntry;
 041            SetEntry(separatorId, dateSeparatorEntry);
 042        }
 43    }
 44}