< Summary

Class:NotificationsController
Assembly:NotificationsController
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/NotificationsController/NotificationsController.cs
Covered lines:8
Uncovered lines:17
Coverable lines:25
Total lines:58
Line coverage:32% (8 of 25)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%110100%
Initialize(...)0%2100%
Dispose()0%110100%
ShowNotificationFromJson(...)0%6200%
ShowNotification(...)0%4.123050%
ShowNotification(...)0%3.143075%
DismissAllNotifications(...)0%220100%
ShowWelcomeNotification()0%20400%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/NotificationsController/NotificationsController.cs

#LineLine coverage
 1using DCL.NotificationModel;
 2using UnityEngine;
 3
 4public class NotificationsController : MonoBehaviour
 5{
 06    public static NotificationsController i { get; private set; }
 7    public static bool disableWelcomeNotification = false;
 8
 09    public bool allowNotifications { get; set; }
 10
 13211    void Awake() { i = this; }
 12
 13    INotificationHUDController controller;
 14
 15    public void Initialize(INotificationHUDController controller)
 16    {
 017        this.controller = controller;
 018        allowNotifications = true;
 019    }
 20
 2021    public void Dispose() { controller.Dispose(); }
 22
 23    public void ShowNotificationFromJson(string notificationJson)
 24    {
 025        if (!allowNotifications)
 026            return;
 27
 028        Model model = JsonUtility.FromJson<Model>(notificationJson);
 029        ShowNotification(model);
 030    }
 31
 32    public void ShowNotification(Model notification)
 33    {
 1334        if (!allowNotifications)
 1335            return;
 36
 037        controller?.ShowNotification(notification);
 038    }
 39
 40    public void ShowNotification(INotification notification)
 41    {
 242        if (!allowNotifications)
 043            return;
 44
 245        controller?.ShowNotification(notification);
 246    }
 47
 1448    public void DismissAllNotifications(string groupID) { controller?.DismissAllNotifications(groupID); }
 49
 50    public void ShowWelcomeNotification()
 51    {
 052        if (!allowNotifications || disableWelcomeNotification)
 053            return;
 54
 55        //TODO(Brian): This should be triggered entirely by kernel
 056        controller?.ShowWelcomeNotification();
 057    }
 58}