| | 1 | | using ExploreV2Analytics; |
| | 2 | | using System; |
| | 3 | |
|
| | 4 | | public interface IPlacesAndEventsSectionComponentController : IDisposable |
| | 5 | | { |
| | 6 | | /// <summary> |
| | 7 | | /// It will be triggered when the section want to request to close the ExploreV2 main menu. |
| | 8 | | /// </summary> |
| | 9 | | event Action OnCloseExploreV2; |
| | 10 | |
|
| | 11 | | /// <summary> |
| | 12 | | /// It will be triggered when any action is executed inside the places and events section. |
| | 13 | | /// </summary> |
| | 14 | | event Action OnAnyActionExecuted; |
| | 15 | | } |
| | 16 | |
|
| | 17 | | public class PlacesAndEventsSectionComponentController : IPlacesAndEventsSectionComponentController |
| | 18 | | { |
| | 19 | | public event Action OnCloseExploreV2; |
| | 20 | | public event Action OnAnyActionExecuted; |
| | 21 | |
|
| | 22 | | internal IPlacesAndEventsSectionComponentView view; |
| | 23 | | internal IPlacesSubSectionComponentController placesSubSectionComponentController; |
| | 24 | | internal IEventsSubSectionComponentController eventsSubSectionComponentController; |
| | 25 | |
|
| 4 | 26 | | public PlacesAndEventsSectionComponentController(IPlacesAndEventsSectionComponentView view, IExploreV2Analytics expl |
| | 27 | | { |
| 4 | 28 | | this.view = view; |
| | 29 | |
|
| 4 | 30 | | placesSubSectionComponentController = new PlacesSubSectionComponentController( |
| | 31 | | view.currentPlacesSubSectionComponentView, |
| | 32 | | new PlacesAPIController(), |
| | 33 | | FriendsController.i, |
| | 34 | | exploreV2Analytics); |
| | 35 | |
|
| 4 | 36 | | placesSubSectionComponentController.OnCloseExploreV2 += RequestExploreV2Closing; |
| | 37 | |
|
| 4 | 38 | | eventsSubSectionComponentController = new EventsSubSectionComponentController( |
| | 39 | | view.currentEventsSubSectionComponentView, |
| | 40 | | new EventsAPIController(), |
| | 41 | | exploreV2Analytics); |
| | 42 | |
|
| 4 | 43 | | eventsSubSectionComponentController.OnCloseExploreV2 += RequestExploreV2Closing; |
| | 44 | |
|
| 4 | 45 | | view.OnAnyActionExecuted += OnAnyActionExecutedInAnySubSection; |
| 4 | 46 | | placesSubSectionComponentController.OnAnyActionExecuted += OnAnyActionExecutedInAnySubSection; |
| 4 | 47 | | eventsSubSectionComponentController.OnAnyActionExecuted += OnAnyActionExecutedInAnySubSection; |
| 4 | 48 | | } |
| | 49 | |
|
| 2 | 50 | | internal void RequestExploreV2Closing() { OnCloseExploreV2?.Invoke(); } |
| | 51 | |
|
| 2 | 52 | | internal void OnAnyActionExecutedInAnySubSection() { OnAnyActionExecuted?.Invoke(); } |
| | 53 | |
|
| | 54 | | public void Dispose() |
| | 55 | | { |
| 4 | 56 | | view.OnAnyActionExecuted -= OnAnyActionExecutedInAnySubSection; |
| | 57 | |
|
| 4 | 58 | | placesSubSectionComponentController.OnCloseExploreV2 -= RequestExploreV2Closing; |
| 4 | 59 | | placesSubSectionComponentController.OnAnyActionExecuted -= OnAnyActionExecutedInAnySubSection; |
| 4 | 60 | | placesSubSectionComponentController.Dispose(); |
| | 61 | |
|
| 4 | 62 | | eventsSubSectionComponentController.OnCloseExploreV2 -= RequestExploreV2Closing; |
| 4 | 63 | | eventsSubSectionComponentController.OnAnyActionExecuted -= OnAnyActionExecutedInAnySubSection; |
| 4 | 64 | | eventsSubSectionComponentController.Dispose(); |
| 4 | 65 | | } |
| | 66 | | } |