< Summary

Class:SceneContextMenuHandler
Assembly:BuilderProjectsPanel
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/ProjectsPanelHUD/Scripts/Handlers/SceneContextMenuHandler.cs
Covered lines:26
Uncovered lines:12
Coverable lines:38
Total lines:76
Line coverage:68.4% (26 of 38)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
SceneContextMenuHandler(...)0%110100%
Dispose()0%110100%
OnContextMenuOpen(...)0%6200%
OnRequestContextMenuHide()0%110100%
OnContextMenuSettingsPressed(...)0%2100%
OnContextMenuDuplicatePressed(...)0%2100%
OnContextMenuDownloadPressed(...)0%2100%
OnContextMenuSharePressed(...)0%2100%
OnContextMenuUnpublishPressed(...)0%2100%
OnContextMenuDeletePressed(...)0%2100%
OnContextMenuQuitContributorPressed(...)0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/ProjectsPanelHUD/Scripts/Handlers/SceneContextMenuHandler.cs

#LineLine coverage
 1using System;
 2using DCL.Builder;
 3using DCL.Interface;
 4using UnityEngine;
 5
 6internal class SceneContextMenuHandler : IDisposable
 7{
 8    private readonly SceneCardViewContextMenu contextMenu;
 9    private readonly ISectionsController sectionsController;
 10    private readonly IScenesViewController scenesViewController;
 11    private readonly UnpublishPopupController unpublishPopupController;
 12
 13    private Vector2Int sceneCoords;
 14    private Scene.Source sceneSource;
 15
 1716    public SceneContextMenuHandler(SceneCardViewContextMenu contextMenu, ISectionsController sectionsController,
 17        IScenesViewController scenesViewController, UnpublishPopupController unpublishPopupController)
 18    {
 1719        this.contextMenu = contextMenu;
 1720        this.sectionsController = sectionsController;
 1721        this.scenesViewController = scenesViewController;
 1722        this.unpublishPopupController = unpublishPopupController;
 23
 1724        sectionsController.OnRequestContextMenuHide += OnRequestContextMenuHide;
 25
 1726        scenesViewController.OnContextMenuPressed += OnContextMenuOpen;
 27
 1728        contextMenu.OnSettingsPressed += OnContextMenuSettingsPressed;
 1729        contextMenu.OnDuplicatePressed += OnContextMenuDuplicatePressed;
 1730        contextMenu.OnDownloadPressed += OnContextMenuDownloadPressed;
 1731        contextMenu.OnSharePressed += OnContextMenuSharePressed;
 1732        contextMenu.OnUnpublishPressed += OnContextMenuUnpublishPressed;
 1733        contextMenu.OnDeletePressed += OnContextMenuDeletePressed;
 1734        contextMenu.OnQuitContributorPressed += OnContextMenuQuitContributorPressed;
 1735    }
 36
 37    public void Dispose()
 38    {
 1739        sectionsController.OnRequestContextMenuHide -= OnRequestContextMenuHide;
 40
 1741        scenesViewController.OnContextMenuPressed -= OnContextMenuOpen;
 42
 1743        contextMenu.OnSettingsPressed -= OnContextMenuSettingsPressed;
 1744        contextMenu.OnDuplicatePressed -= OnContextMenuDuplicatePressed;
 1745        contextMenu.OnDownloadPressed -= OnContextMenuDownloadPressed;
 1746        contextMenu.OnSharePressed -= OnContextMenuSharePressed;
 1747        contextMenu.OnUnpublishPressed -= OnContextMenuUnpublishPressed;
 1748        contextMenu.OnDeletePressed -= OnContextMenuDeletePressed;
 1749        contextMenu.OnQuitContributorPressed -= OnContextMenuQuitContributorPressed;
 1750    }
 51
 52    void OnContextMenuOpen(ISceneData sceneData, ISceneCardView sceneCard)
 53    {
 054        contextMenu.transform.position = sceneCard.contextMenuButtonPosition;
 055        contextMenu.Show(sceneData.id, sceneData.isDeployed,
 56            sceneData.isOwner || sceneData.isOperator, sceneData.isContributor);
 057        sceneCoords = sceneData.coords;
 058        sceneSource = sceneData.source;
 059    }
 60
 261    void OnRequestContextMenuHide() { contextMenu.Hide(); }
 62
 063    void OnContextMenuSettingsPressed(string id) { scenesViewController.SelectScene(id); }
 64
 065    void OnContextMenuDuplicatePressed(string id) { }
 66
 067    void OnContextMenuDownloadPressed(string id) { }
 68
 069    void OnContextMenuSharePressed(string id) { }
 70
 071    void OnContextMenuUnpublishPressed(string id) { unpublishPopupController.Show(sceneCoords, sceneSource); }
 72
 073    void OnContextMenuDeletePressed(string id) { }
 74
 075    void OnContextMenuQuitContributorPressed(string id) { }
 76}