< Summary

Class:DCL.ContentModeration.AdultContentAgeConfirmationComponentView
Assembly:ContentModerationHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/ContentModerationHUD/AdultContentAgeConfirmationComponentView.cs
Covered lines:0
Uncovered lines:24
Coverable lines:24
Total lines:59
Line coverage:0% (0 of 24)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:7
Method coverage:0% (0 of 7)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%2100%
Dispose()0%2100%
RefreshControl()0%2100%
ShowModal()0%2100%
OnConfirmAgeCheckboxChanged(...)0%2100%
Cancel()0%6200%
Confirm()0%6200%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/ContentModerationHUD/AdultContentAgeConfirmationComponentView.cs

#LineLine coverage
 1using System;
 2using UnityEngine;
 3using UnityEngine.UI;
 4
 5namespace DCL.ContentModeration
 6{
 7    public class AdultContentAgeConfirmationComponentView : BaseComponentView, IAdultContentAgeConfirmationComponentView
 8    {
 9        [SerializeField] internal Button backgroundButton;
 10        [SerializeField] internal ToggleComponentView confirmAgeCheckbox;
 11        [SerializeField] internal ButtonComponentView cancelButton;
 12        [SerializeField] internal ButtonComponentView confirmButton;
 13
 14        public event Action OnCancelClicked;
 15        public event Action OnConfirmClicked;
 16
 17        public override void Awake()
 18        {
 019            base.Awake();
 020            confirmAgeCheckbox.OnSelectedChanged += OnConfirmAgeCheckboxChanged;
 021            backgroundButton.onClick.AddListener(Cancel);
 022            cancelButton.onClick.AddListener(Cancel);
 023            confirmButton.onClick.AddListener(Confirm);
 024            OnConfirmAgeCheckboxChanged(confirmAgeCheckbox.isOn, null, null);
 025        }
 26
 27        public override void Dispose()
 28        {
 029            confirmAgeCheckbox.OnSelectedChanged -= OnConfirmAgeCheckboxChanged;
 030            backgroundButton.onClick.RemoveAllListeners();
 031            cancelButton.onClick.RemoveAllListeners();
 032            confirmButton.onClick.RemoveAllListeners();
 033            base.Dispose();
 034        }
 35
 036        public override void RefreshControl() { }
 37
 38        public void ShowModal()
 39        {
 040            confirmAgeCheckbox.isOn = false;
 041            Show();
 042        }
 43
 44        private void OnConfirmAgeCheckboxChanged(bool isOn, string id, string text) =>
 045            confirmButton.SetInteractable(isOn);
 46
 47        private void Cancel()
 48        {
 049            Hide();
 050            OnCancelClicked?.Invoke();
 051        }
 52
 53        private void Confirm()
 54        {
 055            Hide();
 056            OnConfirmClicked?.Invoke();
 057        }
 58    }
 59}