< Summary

Class:DCL.MyAccount.UpdateEmailConfirmationHUDComponentView
Assembly:MyAccountHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/MyAccountHUD/UpdateEmailConfirmationHUDComponentView.cs
Covered lines:0
Uncovered lines:21
Coverable lines:21
Total lines:59
Line coverage:0% (0 of 21)
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%
ShowConfirmationModal(...)0%2100%
HideConfirmationModal()0%2100%
AcceptConfirmation()0%6200%
RejectConfirmation()0%6200%

File(s)

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

#LineLine coverage
 1using System;
 2using TMPro;
 3using UnityEngine;
 4using UnityEngine.UI;
 5
 6namespace DCL.MyAccount
 7{
 8    public class UpdateEmailConfirmationHUDComponentView : BaseComponentView, IUpdateEmailConfirmationHUDComponentView
 9    {
 10        [SerializeField] internal Image actionLogoImage;
 11        [SerializeField] internal TMP_Text confirmationText;
 12        [SerializeField] internal Button backgroundButton;
 13        [SerializeField] internal Button noButton;
 14        [SerializeField] internal Button yesButton;
 15
 16        public event Action<bool> OnConfirmationModalAccepted;
 17
 18        public override void Awake()
 19        {
 020            base.Awake();
 21
 022            backgroundButton.onClick.AddListener(RejectConfirmation);
 23
 024            noButton.onClick.AddListener(RejectConfirmation);
 025            yesButton.onClick.AddListener(AcceptConfirmation);
 026        }
 27
 28        public override void Dispose()
 29        {
 030            noButton.onClick.RemoveAllListeners();
 031            yesButton.onClick.RemoveAllListeners();
 032            base.Dispose();
 033        }
 34
 035        public override void RefreshControl() { }
 36
 37        public void ShowConfirmationModal(Sprite actionLogo, string text)
 38        {
 039            actionLogoImage.sprite = actionLogo;
 040            confirmationText.text = text;
 041            Show();
 042        }
 43
 44        public void HideConfirmationModal() =>
 045            Hide();
 46
 47        private void AcceptConfirmation()
 48        {
 049            HideConfirmationModal();
 050            OnConfirmationModalAccepted?.Invoke(true);
 051        }
 52
 53        private void RejectConfirmation()
 54        {
 055            HideConfirmationModal();
 056            OnConfirmationModalAccepted?.Invoke(false);
 057        }
 58    }
 59}