< 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:80
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    public event Action<bool> OnCloseExploreV2;
 16
 17    internal IPlacesAndEventsSectionComponentView view;
 18    internal IHighlightsSubSectionComponentController highlightsSubSectionComponentController;
 19    internal IPlacesSubSectionComponentController placesSubSectionComponentController;
 20    internal IEventsSubSectionComponentController eventsSubSectionComponentController;
 21
 1822    internal BaseVariable<bool> placesAndEventsVisible => DataStore.i.exploreV2.placesAndEventsVisible;
 23
 624    public PlacesAndEventsSectionComponentController(IPlacesAndEventsSectionComponentView view, IExploreV2Analytics expl
 25    {
 626        this.view = view;
 27
 628        PlacesAPIController placesAPI = new PlacesAPIController();
 629        EventsAPIController eventsAPI = new EventsAPIController();
 30
 631        highlightsSubSectionComponentController = new HighlightsSubSectionComponentController(
 32            view.currentHighlightsSubSectionComponentView,
 33            placesAPI,
 34            eventsAPI,
 35            FriendsController.i,
 36            exploreV2Analytics);
 37
 638        highlightsSubSectionComponentController.OnCloseExploreV2 += RequestExploreV2Closing;
 639        highlightsSubSectionComponentController.OnGoToEventsSubSection += GoToEventsSubSection;
 40
 641        placesSubSectionComponentController = new PlacesSubSectionComponentController(
 42            view.currentPlacesSubSectionComponentView,
 43            placesAPI,
 44            FriendsController.i,
 45            exploreV2Analytics);
 46
 647        placesSubSectionComponentController.OnCloseExploreV2 += RequestExploreV2Closing;
 48
 649        eventsSubSectionComponentController = new EventsSubSectionComponentController(
 50            view.currentEventsSubSectionComponentView,
 51            eventsAPI,
 52            exploreV2Analytics);
 53
 654        eventsSubSectionComponentController.OnCloseExploreV2 += RequestExploreV2Closing;
 55
 656        placesAndEventsVisible.OnChange += PlacesAndEventsVisibleChanged;
 657        PlacesAndEventsVisibleChanged(placesAndEventsVisible.Get(), false);
 658    }
 59
 260    internal void RequestExploreV2Closing() { OnCloseExploreV2?.Invoke(false); }
 61
 262    internal void GoToEventsSubSection() { view.GoToSubsection(PlacesAndEventsSectionComponentView.EVENTS_SUB_SECTION_IN
 63
 64    public void Dispose()
 65    {
 666        highlightsSubSectionComponentController.OnCloseExploreV2 -= RequestExploreV2Closing;
 667        highlightsSubSectionComponentController.OnGoToEventsSubSection -= GoToEventsSubSection;
 668        highlightsSubSectionComponentController.Dispose();
 69
 670        placesSubSectionComponentController.OnCloseExploreV2 -= RequestExploreV2Closing;
 671        placesSubSectionComponentController.Dispose();
 72
 673        eventsSubSectionComponentController.OnCloseExploreV2 -= RequestExploreV2Closing;
 674        eventsSubSectionComponentController.Dispose();
 75
 676        placesAndEventsVisible.OnChange -= PlacesAndEventsVisibleChanged;
 677    }
 78
 1679    internal void PlacesAndEventsVisibleChanged(bool current, bool previous) { view.SetActive(current); }
 80}