< Summary

Class:PlacesAndEventsSectionComponentController
Assembly:ExploreV2
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/ExploreV2/Scripts/Sections/PlacesAndEventsSection/PlacesAndEventsSectionComponentController.cs
Covered lines:27
Uncovered lines:0
Coverable lines:27
Total lines:82
Line coverage:100% (27 of 27)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
PlacesAndEventsSectionComponentController(...)0%110100%
RequestExploreV2Closing()0%220100%
GoToEventsSubSection()0%110100%
Dispose()0%110100%
PlacesAndEventsVisibleChanged(...)0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/ExploreV2/Scripts/Sections/PlacesAndEventsSection/PlacesAndEventsSectionComponentController.cs

#LineLine coverage
 1using DCL;
 2using ExploreV2Analytics;
 3using System;
 4
 5public interface IPlacesAndEventsSectionComponentController : IDisposable
 6{
 7    /// <summary>
 8    /// It will be triggered when the section want to request to close the ExploreV2 main menu.
 9    /// </summary>
 10    event Action<bool> OnCloseExploreV2;
 11}
 12
 13public class PlacesAndEventsSectionComponentController : IPlacesAndEventsSectionComponentController
 14{
 15    internal const float MIN_TIME_TO_CHECK_API = 60f;
 16
 17    public event Action<bool> OnCloseExploreV2;
 18
 19    internal IPlacesAndEventsSectionComponentView view;
 20    internal IHighlightsSubSectionComponentController highlightsSubSectionComponentController;
 21    internal IPlacesSubSectionComponentController placesSubSectionComponentController;
 22    internal IEventsSubSectionComponentController eventsSubSectionComponentController;
 23
 1824    internal BaseVariable<bool> placesAndEventsVisible => DataStore.i.exploreV2.placesAndEventsVisible;
 25
 626    public PlacesAndEventsSectionComponentController(IPlacesAndEventsSectionComponentView view, IExploreV2Analytics expl
 27    {
 628        this.view = view;
 29
 630        PlacesAPIController placesAPI = new PlacesAPIController();
 631        EventsAPIController eventsAPI = new EventsAPIController();
 32
 633        highlightsSubSectionComponentController = new HighlightsSubSectionComponentController(
 34            view.currentHighlightsSubSectionComponentView,
 35            placesAPI,
 36            eventsAPI,
 37            FriendsController.i,
 38            exploreV2Analytics);
 39
 640        highlightsSubSectionComponentController.OnCloseExploreV2 += RequestExploreV2Closing;
 641        highlightsSubSectionComponentController.OnGoToEventsSubSection += GoToEventsSubSection;
 42
 643        placesSubSectionComponentController = new PlacesSubSectionComponentController(
 44            view.currentPlacesSubSectionComponentView,
 45            placesAPI,
 46            FriendsController.i,
 47            exploreV2Analytics);
 48
 649        placesSubSectionComponentController.OnCloseExploreV2 += RequestExploreV2Closing;
 50
 651        eventsSubSectionComponentController = new EventsSubSectionComponentController(
 52            view.currentEventsSubSectionComponentView,
 53            eventsAPI,
 54            exploreV2Analytics);
 55
 656        eventsSubSectionComponentController.OnCloseExploreV2 += RequestExploreV2Closing;
 57
 658        placesAndEventsVisible.OnChange += PlacesAndEventsVisibleChanged;
 659        PlacesAndEventsVisibleChanged(placesAndEventsVisible.Get(), false);
 660    }
 61
 262    internal void RequestExploreV2Closing() { OnCloseExploreV2?.Invoke(false); }
 63
 264    internal void GoToEventsSubSection() { view.GoToSubsection(PlacesAndEventsSectionComponentView.EVENTS_SUB_SECTION_IN
 65
 66    public void Dispose()
 67    {
 668        highlightsSubSectionComponentController.OnCloseExploreV2 -= RequestExploreV2Closing;
 669        highlightsSubSectionComponentController.OnGoToEventsSubSection -= GoToEventsSubSection;
 670        highlightsSubSectionComponentController.Dispose();
 71
 672        placesSubSectionComponentController.OnCloseExploreV2 -= RequestExploreV2Closing;
 673        placesSubSectionComponentController.Dispose();
 74
 675        eventsSubSectionComponentController.OnCloseExploreV2 -= RequestExploreV2Closing;
 676        eventsSubSectionComponentController.Dispose();
 77
 678        placesAndEventsVisible.OnChange -= PlacesAndEventsVisibleChanged;
 679    }
 80
 1681    internal void PlacesAndEventsVisibleChanged(bool current, bool previous) { view.SetActive(current); }
 82}