Skip to content

Commit a84646d

Browse files
feat: create community event (#4778)
1 parent 27e6095 commit a84646d

12 files changed

Lines changed: 354 additions & 16 deletions

File tree

Explorer/Assets/AddressableAssetsData/AddressableAssetSettings.asset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ MonoBehaviour:
1515
m_DefaultGroup: 47f803e1e9c5079449bd106df98a0b7d
1616
m_currentHash:
1717
serializedVersion: 2
18-
Hash: a6b474a8c1f3d2d1f0f9dc4906484622
18+
Hash: 00000000000000000000000000000000
1919
m_OptimizeCatalogSize: 0
2020
m_BuildRemoteCatalog: 0
2121
m_CatalogRequestsTimeout: 0

Explorer/Assets/DCL/Browser/DecentralandUrls/DecentralandUrl.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public enum DecentralandUrl
2727
ContentModerationReport,
2828

2929
ApiEvents,
30+
EventsWebpage,
3031

3132
ApiAuth,
3233
AuthSignatureWebApp,

Explorer/Assets/DCL/Browser/DecentralandUrls/DecentralandUrlsSource.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ private static string RawUrl(DecentralandUrl decentralandUrl) =>
9090
DecentralandUrl.LocalGateKeeperSceneAdapter => "https://comms-gatekeeper-local.decentraland.org/get-scene-adapter",
9191
DecentralandUrl.ChatAdapter => $"https://comms-gatekeeper.decentraland.{ENV}/private-messages/token",
9292
DecentralandUrl.ApiEvents => $"https://events.decentraland.{ENV}/api/events",
93+
DecentralandUrl.EventsWebpage => $"https://decentraland.{ENV}/events",
9394
DecentralandUrl.OpenSea => $"https://opensea.decentraland.{ENV}",
9495
DecentralandUrl.Host => $"https://decentraland.{ENV}",
9596
DecentralandUrl.ApiChunks => $"https://api.decentraland.{ENV}/v1/map.png",

Explorer/Assets/DCL/Communities/CommunitiesCard/CommunityCardController.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
using DCL.InWorldCamera.CameraReelStorageService;
1515
using DCL.InWorldCamera.CameraReelStorageService.Schemas;
1616
using DCL.InWorldCamera.PhotoDetail;
17+
using DCL.Multiplayer.Connections.DecentralandUrls;
1718
using DCL.PlacesAPIService;
1819
using DCL.Profiles;
1920
using DCL.UI;
@@ -59,6 +60,7 @@ public class CommunityCardController : ControllerBase<CommunityCardView, Communi
5960
private readonly IEventsApiService eventsApiService;
6061
private readonly ISharedSpaceManager sharedSpaceManager;
6162
private readonly IChatEventBus chatEventBus;
63+
private readonly IDecentralandUrlsSource decentralandUrlsSource;
6264
private readonly IWeb3IdentityCache web3IdentityCache;
6365
private readonly LambdasProfilesProvider lambdasProfilesProvider;
6466

@@ -92,6 +94,7 @@ public CommunityCardController(ViewFactoryMethod viewFactory,
9294
IEventsApiService eventsApiService,
9395
ISharedSpaceManager sharedSpaceManager,
9496
IChatEventBus chatEventBus,
97+
IDecentralandUrlsSource decentralandUrlsSource,
9598
IWeb3IdentityCache web3IdentityCache,
9699
LambdasProfilesProvider lambdasProfilesProvider)
97100
: base(viewFactory)
@@ -110,6 +113,7 @@ public CommunityCardController(ViewFactoryMethod viewFactory,
110113
this.eventsApiService = eventsApiService;
111114
this.sharedSpaceManager = sharedSpaceManager;
112115
this.chatEventBus = chatEventBus;
116+
this.decentralandUrlsSource = decentralandUrlsSource;
113117
this.web3IdentityCache = web3IdentityCache;
114118
this.lambdasProfilesProvider = lambdasProfilesProvider;
115119
this.thumbnailLoader = new ThumbnailLoader(null);
@@ -270,7 +274,8 @@ protected override void OnViewInstantiated()
270274
viewInstance.successNotificationView,
271275
clipboard,
272276
webBrowser,
273-
realmNavigator);
277+
realmNavigator,
278+
decentralandUrlsSource);
274279

275280
viewInstance.SetCardBackgroundColor(viewInstance.BackgroundColor, BG_SHADER_COLOR_1);
276281
}

Explorer/Assets/DCL/Communities/CommunitiesCard/Events/EventListController.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
using DCL.Communities.EventInfo;
88
using DCL.Diagnostics;
99
using DCL.EventsApi;
10+
using DCL.Multiplayer.Connections.DecentralandUrls;
1011
using DCL.PlacesAPIService;
1112
using DCL.UI;
1213
using DCL.Utilities.Extensions;
1314
using ECS.SceneLifeCycle.Realm;
1415
using MVC;
16+
using System;
1517
using System.Collections.Generic;
1618
using System.Threading;
1719
using Utility;
@@ -44,10 +46,11 @@ public class EventListController : CommunityFetchingControllerBase<PlaceAndEvent
4446
private readonly List<string> eventPlaceIds = new (PAGE_SIZE);
4547
private readonly Dictionary<string, PlaceInfo> placeInfoCache = new (PAGE_SIZE);
4648
private readonly ThumbnailLoader thumbnailLoader;
49+
private readonly string createEventFormat;
4750

4851
private CommunityData? communityData = null;
52+
private string[] communityPlaceIds = Array.Empty<string>();
4953
private CancellationTokenSource eventCardOperationsCts = new ();
50-
private string[] communityPlaceIds;
5154

5255
protected override SectionFetchData<PlaceAndEventDTO> currentSectionFetchData => eventsFetchData;
5356

@@ -60,7 +63,8 @@ public EventListController(EventListView view,
6063
WarningNotificationView inWorldSuccessNotificationView,
6164
ISystemClipboard clipboard,
6265
IWebBrowser webBrowser,
63-
IRealmNavigator realmNavigator) : base(view, PAGE_SIZE)
66+
IRealmNavigator realmNavigator,
67+
IDecentralandUrlsSource decentralandUrlsSource) : base(view, PAGE_SIZE)
6468
{
6569
this.view = view;
6670
this.eventsApiService = eventsApiService;
@@ -73,6 +77,8 @@ public EventListController(EventListView view,
7377
this.mvcManager = mvcManager;
7478
this.thumbnailLoader = thumbnailLoader;
7579

80+
createEventFormat = $"{decentralandUrlsSource.Url(DecentralandUrl.EventsWebpage)}/submit?community_id={{0}}";
81+
7682
view.InitList(thumbnailLoader, cancellationToken);
7783

7884
view.OpenWizardRequested += OnOpenWizardRequested;
@@ -81,6 +87,7 @@ public EventListController(EventListView view,
8187
view.InterestedButtonClicked += OnInterestedButtonClicked;
8288
view.EventShareButtonClicked += OnEventShareButtonClicked;
8389
view.EventCopyLinkButtonClicked += OnEventCopyLinkButtonClicked;
90+
view.CreateEventRequested += OnCreateEventButtonClicked;
8491
}
8592

8693
public override void Dispose()
@@ -91,12 +98,16 @@ public override void Dispose()
9198
view.InterestedButtonClicked -= OnInterestedButtonClicked;
9299
view.EventShareButtonClicked -= OnEventShareButtonClicked;
93100
view.EventCopyLinkButtonClicked -= OnEventCopyLinkButtonClicked;
101+
view.CreateEventRequested -= OnCreateEventButtonClicked;
94102

95103
eventCardOperationsCts.SafeCancelAndDispose();
96104

97105
base.Dispose();
98106
}
99107

108+
private void OnCreateEventButtonClicked() =>
109+
webBrowser.OpenUrl(string.Format(createEventFormat, communityData?.id));
110+
100111
private void OnEventCopyLinkButtonClicked(PlaceAndEventDTO eventData)
101112
{
102113
clipboard.Set(EventUtilities.GetEventCopyLink(eventData.Event));
@@ -174,7 +185,7 @@ private void OnOpenWizardRequested()
174185

175186
protected override async UniTask<int> FetchDataAsync(CancellationToken ct)
176187
{
177-
Result<EventWithPlaceIdDTOListResponse> eventResponse = await eventsApiService.GetEventsByPlaceIdsAsync(communityPlaceIds, eventsFetchData.PageNumber, PAGE_SIZE, ct)
188+
Result<EventWithPlaceIdDTOListResponse> eventResponse = await eventsApiService.GetCommunityEventsByPlaceIdsAsync(communityData!.Value.id, communityPlaceIds, eventsFetchData.PageNumber, PAGE_SIZE, ct)
178189
.SuppressToResultAsync(ReportCategory.COMMUNITIES);
179190

180191
if (ct.IsCancellationRequested)

Explorer/Assets/DCL/Communities/CommunitiesCard/Events/EventListView.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ public class EventListView : MonoBehaviour, ICommunityFetchingView<PlaceAndEvent
2121
[field: SerializeField] private GameObject emptyState { get; set; } = null!;
2222
[field: SerializeField] private GameObject emptyStateAdminText { get; set; } = null!;
2323
[field: SerializeField] private Button openWizardButton { get; set; } = null!;
24+
[field: SerializeField] private Button createEventButton { get; set; } = null!;
2425
[field: SerializeField] private CommunityEventsContextMenuConfiguration contextMenuConfiguration { get; set; } = null!;
2526

2627
public event Action? NewDataRequested;
2728
public event Action? OpenWizardRequested;
29+
public event Action? CreateEventRequested;
2830

2931
public event Action<PlaceAndEventDTO>? MainButtonClicked;
3032
public event Action<PlaceAndEventDTO>? JumpInButtonClicked;
@@ -43,6 +45,7 @@ private void Awake()
4345
{
4446
loopListScrollRect.SetScrollSensitivityBasedOnPlatform();
4547
openWizardButton.onClick.AddListener(() => OpenWizardRequested?.Invoke());
48+
createEventButton.onClick.AddListener(() => CreateEventRequested?.Invoke());
4649

4750
contextMenu = new GenericContextMenu(contextMenuConfiguration.ContextMenuWidth, verticalLayoutPadding: contextMenuConfiguration.VerticalPadding, elementsSpacing: contextMenuConfiguration.ElementsSpacing)
4851
.AddControl(new ButtonContextMenuControlSettings(contextMenuConfiguration.ShareText, contextMenuConfiguration.ShareSprite, () => EventShareButtonClicked?.Invoke(lastClickedEventCtx)))
@@ -52,6 +55,7 @@ private void Awake()
5255
public void SetCanModify(bool canModify)
5356
{
5457
this.canModify = canModify;
58+
createEventButton.gameObject.SetActive(canModify);
5559
}
5660

5761
public void InitList(ThumbnailLoader newThumbnailLoader,

Explorer/Assets/DCL/Communities/CommunitiesCard/Places/PlacesSectionController.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ await inWorldWarningNotificationView.AnimatedShowAsync(COMMUNITY_PLACES_DELETE_E
158158
}
159159

160160
placesFetchData.Items.RemoveAll(elem => elem.PlaceInfo.id.Equals(placeInfo.id));
161-
RefreshGrid(false);
161+
RefreshGrid(true);
162162
}
163163
}
164164

@@ -174,6 +174,7 @@ private void OnElementJumpInButtonClicked(PlaceInfo placeInfo)
174174

175175
private void OnElementInfoButtonClicked(PlaceInfo place)
176176
{
177+
// The button for this callback is disabled, a user cannot reach this point.
177178
throw new NotImplementedException();
178179
}
179180

0 commit comments

Comments
 (0)