< Summary

Class:SectionsHandler
Assembly:BuilderProjectsPanel
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/ProjectsPanelHUD/Scripts/Handlers/SectionsHandler.cs
Covered lines:29
Uncovered lines:6
Coverable lines:35
Total lines:83
Line coverage:82.8% (29 of 35)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
SectionsHandler(...)0%110100%
Dispose()0%110100%
OnSectionShow(...)0%5.685070%
OnSectionHide(...)0%5.685070%
SelectProject(...)0%110100%

File(s)

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

#LineLine coverage
 1using System;
 2using DCL.Builder;
 3
 4internal class SectionsHandler : IDisposable
 5{
 6    private readonly ISectionsController sectionsController;
 7    private readonly IScenesViewController scenesViewController;
 8    private readonly SearchBarView searchBarView;
 9    private readonly ILandsController landsController;
 10    private readonly IProjectsController projectsController;
 11
 1712    public SectionsHandler(ISectionsController sectionsController, IScenesViewController scenesViewController, ILandsCon
 13    {
 1714        this.sectionsController = sectionsController;
 1715        this.scenesViewController = scenesViewController;
 1716        this.searchBarView = searchBarView;
 1717        this.landsController = landsController;
 1718        this.projectsController = projectsController;
 19
 1720        sectionsController.OnSectionShow += OnSectionShow;
 1721        sectionsController.OnSectionHide += OnSectionHide;
 1722        scenesViewController.OnProjectSelected += SelectProject;
 1723    }
 24
 25    public void Dispose()
 26    {
 1727        sectionsController.OnSectionShow -= OnSectionShow;
 1728        sectionsController.OnSectionHide -= OnSectionHide;
 1729        scenesViewController.OnProjectSelected -= SelectProject;
 1730    }
 31
 32    void OnSectionShow(SectionBase sectionBase)
 33    {
 134        if (sectionBase is ISceneListener deployedSceneListener)
 35        {
 136            scenesViewController.AddListener(deployedSceneListener);
 37        }
 38
 139        if (sectionBase is IProjectsListener projectsListener)
 40        {
 041            projectsController.AddListener(projectsListener);
 42        }
 43
 144        if (sectionBase is ISelectSceneListener selectSceneListener)
 45        {
 046            scenesViewController.AddListener(selectSceneListener);
 47        }
 48
 149        if (sectionBase is ILandsListener landsListener)
 50        {
 051            landsController.AddListener(landsListener);
 52        }
 53
 154        searchBarView.SetSearchBar(sectionBase.searchHandler, sectionBase.searchBarConfig);
 155    }
 56
 57    void OnSectionHide(SectionBase sectionBase)
 58    {
 159        if (sectionBase is ISceneListener deployedSceneListener)
 60        {
 161            scenesViewController.RemoveListener(deployedSceneListener);
 62        }
 63
 164        if (sectionBase is IProjectsListener projectSceneListener)
 65        {
 066            projectsController.RemoveListener(projectSceneListener);
 67        }
 68
 169        if (sectionBase is ISelectSceneListener selectSceneListener)
 70        {
 071            scenesViewController.RemoveListener(selectSceneListener);
 72        }
 73
 174        if (sectionBase is ILandsListener landsListener)
 75        {
 076            landsController.RemoveListener(landsListener);
 77        }
 78
 179        searchBarView.SetSearchBar(null, null);
 180    }
 81
 482    void SelectProject(ISceneCardView sceneCardView) { sectionsController.OpenSection(SectionId.SETTINGS_PROJECT_GENERAL
 83}