< Summary

Class:DCL.MyAccount.BlockedListComponentView
Assembly:MyAccountHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/MyAccountHUD/BlockedListComponentView.cs
Covered lines:0
Uncovered lines:25
Coverable lines:25
Total lines:75
Line coverage:0% (0 of 25)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:9
Method coverage:0% (0 of 9)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
SetupBlockedList()0%2100%
Set(...)0%2100%
Remove(...)0%2100%
ClearAllEntries()0%2100%
Show(...)0%6200%
Hide(...)0%6200%
SetLoadingActive(...)0%2100%
RefreshContentLayout()0%2100%
RefreshControl()0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/MyAccountHUD/BlockedListComponentView.cs

#LineLine coverage
 1using DCL.Helpers;
 2using System;
 3using UnityEngine;
 4
 5namespace DCL.MyAccount
 6{
 7    public class BlockedListComponentView : BaseComponentView, IBlockedListComponentView
 8    {
 9        [Header("General")]
 10        [SerializeField] internal GameObject mainContainer;
 11        [SerializeField] internal GameObject loadingContainer;
 12        [SerializeField] internal RectTransform contentTransform;
 13        [SerializeField] internal GameObject scrollBar;
 14        [SerializeField] internal CollapsableSortedBlockedEntryList blockedList;
 15
 16        public event Action<string> OnUnblockUser;
 17
 18        public void SetupBlockedList()
 19        {
 020            blockedList.OnUnblockUser = OnUnblockUser;
 21            int SortByAlphabeticalOrder(BlockedUserEntry u1, BlockedUserEntry u2)
 22            {
 023                return string.Compare(u1.Model.userName, u2.Model.userName, StringComparison.InvariantCultureIgnoreCase)
 24            }
 25
 026            blockedList.SortingMethod = SortByAlphabeticalOrder;
 027        }
 28
 29        public void Set(BlockedUserEntryModel user)
 30        {
 031            blockedList.Set(user.userId, user);
 032            RefreshContentLayout();
 033        }
 34
 35        public void Remove(string userId)
 36        {
 037            blockedList.Remove(userId);
 038            RefreshContentLayout();
 039        }
 40
 41        public void ClearAllEntries()
 42        {
 043            blockedList.Clear();
 044        }
 45
 46        public override void Show(bool instant = false)
 47        {
 048            gameObject.SetActive(true);
 49
 050            if (scrollBar != null)
 051                scrollBar.SetActive(true);
 052        }
 53
 54        public override void Hide(bool instant = false)
 55        {
 056            gameObject.SetActive(false);
 57
 058            if (scrollBar != null)
 059                scrollBar.SetActive(false);
 060        }
 61
 62        public void SetLoadingActive(bool isActive)
 63        {
 064            loadingContainer.SetActive(isActive);
 065            mainContainer.SetActive(!isActive);
 066        }
 67
 68        public void RefreshContentLayout() =>
 069            Utils.ForceRebuildLayoutImmediate(contentTransform);
 70
 71        public override void RefreshControl()
 72        {
 073        }
 74    }
 75}