< Summary

Class:GraphicCardNotification
Assembly:GraphicCardWarningHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/GraphicCardWarningHUD/GraphicCardNotification.cs
Covered lines:1
Uncovered lines:9
Coverable lines:10
Total lines:33
Line coverage:10% (1 of 10)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%2100%
OpenMoreInfoUrl()0%2100%
Dismiss()0%12300%
CanShowGraphicCardPopup()0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/GraphicCardWarningHUD/GraphicCardNotification.cs

#LineLine coverage
 1using DCL.Helpers;
 2using DCL.Interface;
 3using UnityEngine;
 4using UnityEngine.UI;
 5
 6public class GraphicCardNotification : Notification
 7{
 8    // Filling this with the URL will automatically make the button visible
 9    private const string MORE_INFO_URL = "https://docs.decentraland.org/decentraland/hardware-acceleration/";
 10    private const string DONT_SHOW_GRAPHIC_CARD_POPUP_KEY = "DONT_SHOW_GRAPHIC_CARD_POPUP";
 11    [SerializeField] private Button moreInfoButton;
 12    [SerializeField] private Toggle dontShowAgain;
 13
 14    private void Awake()
 15    {
 016        moreInfoButton.gameObject.SetActive(!string.IsNullOrEmpty(MORE_INFO_URL));
 017        moreInfoButton.onClick.AddListener(OpenMoreInfoUrl);
 018    }
 19
 20    private void OpenMoreInfoUrl()
 21    {
 022        WebInterface.OpenURL(MORE_INFO_URL);
 023        Dismiss();
 024    }
 25
 26    protected override void Dismiss()
 27    {
 028        PlayerPrefsUtils.SetInt(DONT_SHOW_GRAPHIC_CARD_POPUP_KEY, dontShowAgain.isOn ? 1 : 0);
 029        base.Dismiss();
 030    }
 31
 132    public static bool CanShowGraphicCardPopup() => PlayerPrefs.GetInt(DONT_SHOW_GRAPHIC_CARD_POPUP_KEY, 0) == 0;
 33}