< Summary

Class:DCL.Wallet.WalletCardHUDComponentView
Assembly:WalletHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/WalletHUD/WalletCardHUDComponentView.cs
Covered lines:25
Uncovered lines:4
Coverable lines:29
Total lines:77
Line coverage:86.2% (25 of 29)
Covered branches:0
Total branches:0
Covered methods:8
Total methods:9
Method coverage:88.8% (8 of 9)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%110100%
Dispose()0%110100%
RefreshControl()0%2100%
SetWalletCardActive(...)0%110100%
SetWalletCardAsGuest(...)0%110100%
SetEthereumManaLoadingActive(...)0%110100%
SetEthereumManaBalance(...)0%110100%
SetPolygonManaLoadingActive(...)0%110100%
SetPolygonManaBalance(...)0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/WalletHUD/WalletCardHUDComponentView.cs

#LineLine coverage
 1using System;
 2using TMPro;
 3using UIComponents.Scripts.Components;
 4using UnityEngine;
 5using UnityEngine.UI;
 6
 7namespace DCL.Wallet
 8{
 9    public class WalletCardHUDComponentView : BaseComponentView<WalletCardHUDModel>, IWalletCardHUDComponentView
 10    {
 11        [SerializeField] internal Button guestButton;
 12        [SerializeField] internal Button signedInWalletButton;
 13        [SerializeField] internal GameObject ethereumManaBalanceLoading;
 14        [SerializeField] internal TMP_Text ethereumManaBalanceText;
 15        [SerializeField] internal GameObject polygonManaBalanceLoading;
 16        [SerializeField] internal TMP_Text polygonManaBalanceText;
 17
 18        public event Action OnWalletCardClicked;
 19
 20        public override void Awake()
 21        {
 4322            base.Awake();
 23
 4424            guestButton.onClick.AddListener(() => OnWalletCardClicked?.Invoke());
 4425            signedInWalletButton.onClick.AddListener(() => OnWalletCardClicked?.Invoke());
 4326        }
 27
 28        public override void Dispose()
 29        {
 5730            guestButton.onClick.RemoveAllListeners();
 5731            signedInWalletButton.onClick.RemoveAllListeners();
 32
 5733            base.Dispose();
 5734        }
 35
 36        public override void RefreshControl()
 37        {
 038            SetWalletCardAsGuest(model.IsGuest);
 039            SetEthereumManaBalance(model.EthereumManaBalance);
 040            SetPolygonManaBalance(model.PolygonManaBalance);
 041        }
 42
 43        public void SetWalletCardActive(bool isActive) =>
 244            gameObject.SetActive(isActive);
 45
 46        public void SetWalletCardAsGuest(bool isGuest)
 47        {
 248            model.IsGuest = isGuest;
 249            guestButton.gameObject.SetActive(isGuest);
 250            signedInWalletButton.gameObject.SetActive(!isGuest);
 251        }
 52
 53        public void SetEthereumManaLoadingActive(bool isActive)
 54        {
 255            ethereumManaBalanceText.gameObject.SetActive(!isActive);
 256            ethereumManaBalanceLoading.SetActive(isActive);
 257        }
 58
 59        public void SetEthereumManaBalance(double balance)
 60        {
 261            model.EthereumManaBalance = balance;
 262            ethereumManaBalanceText.text = WalletUtils.FormatBalanceToString(balance);
 263        }
 64
 65        public void SetPolygonManaLoadingActive(bool isActive)
 66        {
 267            polygonManaBalanceText.gameObject.SetActive(!isActive);
 268            polygonManaBalanceLoading.SetActive(isActive);
 269        }
 70
 71        public void SetPolygonManaBalance(double balance)
 72        {
 273            model.PolygonManaBalance = balance;
 274            polygonManaBalanceText.text = WalletUtils.FormatBalanceToString(balance);
 275        }
 76    }
 77}