< Summary

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

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%2100%
Configure(...)0%2100%
SetButtonAction(...)0%2100%
RefreshControl()0%2100%
SetUserId(...)0%2100%
SetUserName(...)0%6200%
SetUserThumbnail(...)0%6200%

File(s)

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

#LineLine coverage
 1using System;
 2using TMPro;
 3using UnityEngine;
 4using UnityEngine.UI;
 5
 6namespace DCL.MyAccount
 7{
 8    public class BlockedUserEntry : BaseComponentView, IComponentModelConfig<BlockedUserEntryModel>
 9    {
 10        [SerializeField] private TextMeshProUGUI playerNameText;
 11        [SerializeField] private Button unblockButton;
 12
 13        [SerializeField] private ImageComponentView userThumbnail;
 14
 15        [Header("Configuration")]
 16        [SerializeField] private BlockedUserEntryModel model;
 17
 018        public BlockedUserEntryModel Model => model;
 19
 20        public event Action<string> OnUnblockedClicked;
 21
 22        public override void Awake()
 23        {
 024            base.Awake();
 25
 026            unblockButton.onClick.AddListener(() =>
 27            {
 028                OnUnblockedClicked?.Invoke(model.userId);
 029            });
 030        }
 31
 32        public void Configure(BlockedUserEntryModel newModel)
 33        {
 034            model = newModel;
 035            RefreshControl();
 036        }
 37
 38        public void SetButtonAction(Action<string> action)
 39        {
 040            OnUnblockedClicked = action;
 041        }
 42
 43        public override void RefreshControl()
 44        {
 045            SetUserId(model.userId);
 046            SetUserName(model.userName);
 047            SetUserThumbnail(model.thumbnailUrl);
 048        }
 49
 50        private void SetUserId(string userId)
 51        {
 052            model.userId = userId;
 053        }
 54
 55        private void SetUserName(string userName)
 56        {
 057            model.userName = userName;
 58
 059            if (playerNameText == null)
 060                return;
 61
 062            playerNameText.text = userName;
 063        }
 64
 65        private void SetUserThumbnail(string thumbnailUrl)
 66        {
 067            model.thumbnailUrl = thumbnailUrl;
 68
 069            if (userThumbnail == null)
 070                return;
 71
 072            userThumbnail.SetImage(thumbnailUrl);
 073        }
 74    }
 75}