< Summary

Class:DCL.Chat.HUD.LeaveChannelConfirmationWindowComponentView
Assembly:WorldChatWindowHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/WorldChatWindowHUD/LeaveChannelConfirmationWindowComponentView.cs
Covered lines:24
Uncovered lines:2
Coverable lines:26
Total lines:71
Line coverage:92.3% (24 of 26)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%110100%
Dispose()0%110100%
Configure(...)0%110100%
RefreshControl()0%2.062075%
SetChannel(...)0%110100%
Show(...)0%110100%
Hide(...)0%110100%
Create()0%110100%

File(s)

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

#LineLine coverage
 1using System;
 2using UnityEngine;
 3using UnityEngine.UI;
 4
 5namespace DCL.Chat.HUD
 6{
 7    public class LeaveChannelConfirmationWindowComponentView : BaseComponentView, ILeaveChannelConfirmationWindowCompone
 8    {
 9        [Header("Prefab References")]
 10        [SerializeField] internal Button backgroundButton;
 11        [SerializeField] internal Button closeButton;
 12        [SerializeField] internal ButtonComponentView cancelButton;
 13        [SerializeField] internal ButtonComponentView confirmButton;
 14
 15        [Header("Configuration")]
 16        [SerializeField] internal LeaveChannelConfirmationWindowComponentModel model;
 17
 018        public RectTransform Transform => (RectTransform)transform;
 19
 20        public event Action OnCancelLeave;
 21        public event Action<string> OnConfirmLeave;
 22
 23        public override void Awake()
 24        {
 325            base.Awake();
 26
 327            backgroundButton.onClick.AddListener(() => OnCancelLeave?.Invoke());
 328            closeButton.onClick.AddListener(() => OnCancelLeave?.Invoke());
 329            cancelButton.onClick.AddListener(() => OnCancelLeave?.Invoke());
 330            confirmButton.onClick.AddListener(() => OnConfirmLeave?.Invoke(model.channelId));
 331        }
 32
 33        public override void Dispose()
 34        {
 535            backgroundButton.onClick.RemoveAllListeners();
 536            closeButton.onClick.RemoveAllListeners();
 537            cancelButton.onClick.RemoveAllListeners();
 538            confirmButton.onClick.RemoveAllListeners();
 39
 540            base.Dispose();
 541        }
 42
 43        public void Configure(LeaveChannelConfirmationWindowComponentModel newModel)
 44        {
 145            model = newModel;
 146            RefreshControl();
 147        }
 48
 49        public override void RefreshControl()
 50        {
 151            if (model == null)
 052                return;
 53
 154            SetChannel(model.channelId);
 155        }
 56
 257        public void SetChannel(string channelId) => model.channelId = channelId;
 58
 159        public override void Show(bool instant = false) => gameObject.SetActive(true);
 60
 161        public override void Hide(bool instant = false) => gameObject.SetActive(false);
 62
 63        public static LeaveChannelConfirmationWindowComponentView Create()
 64        {
 365            LeaveChannelConfirmationWindowComponentView leaveChannelComponenView = Instantiate(Resources.Load<GameObject
 366            leaveChannelComponenView.name = "_LeaveChannelConfirmationHUD";
 67
 368            return leaveChannelComponenView;
 69        }
 70    }
 71}