diff --git a/Explorer/Assets/DCL/Chat/ChatController.cs b/Explorer/Assets/DCL/Chat/ChatController.cs index 78a5a99a808..5e69e663d75 100644 --- a/Explorer/Assets/DCL/Chat/ChatController.cs +++ b/Explorer/Assets/DCL/Chat/ChatController.cs @@ -15,6 +15,7 @@ using DCL.Multiplayer.Profiles.Tables; using DCL.Nametags; using DCL.Profiles; +using DCL.UI.Profiles.Helpers; using DCL.RealmNavigation; using DCL.Settings.Settings; using DCL.UI; @@ -61,6 +62,7 @@ public class ChatController : ControllerBase private readonly ChatControllerChatBubblesHelper chatBubblesHelper; private readonly ChatControllerMemberListHelper memberListHelper; private readonly IRoomHub roomHub; + private readonly ProfileRepositoryWrapper profileRepositoryWrapper; private readonly List membersBuffer = new (); private readonly List participantProfileBuffer = new (); @@ -107,7 +109,8 @@ public ChatController( RPCChatPrivacyService chatPrivacyService, IFriendsEventBus friendsEventBus, ChatHistoryStorage chatStorage, - ObjectProxy friendsService) : base(viewFactory) + ObjectProxy friendsService, + ProfileRepositoryWrapper profileDataProvider) : base(viewFactory) { this.chatMessagesBus = chatMessagesBus; this.chatHistory = chatHistory; @@ -124,6 +127,7 @@ public ChatController( this.web3IdentityCache = web3IdentityCache; this.loadingStatus = loadingStatus; this.chatStorage = chatStorage; + this.profileRepositoryWrapper = profileDataProvider; chatUserStateEventBus = new ChatUserStateEventBus(); var chatRoom = roomHub.ChatRoom(); @@ -231,6 +235,7 @@ protected override void OnViewShow() cameraEntity = world.CacheCamera(); viewInstance!.InjectDependencies(viewDependencies); + viewInstance.SetProfileDataPovider(profileRepositoryWrapper); viewInstance.Initialize(chatHistory.Channels, chatSettings, GetProfilesFromParticipants, loadingStatus); chatStorage?.SetNewLocalUserWalletAddress(web3IdentityCache.Identity!.Address); diff --git a/Explorer/Assets/DCL/Chat/ChatControllerChatBubblesHelper.cs b/Explorer/Assets/DCL/Chat/ChatControllerChatBubblesHelper.cs index 2e854a5e628..bab91d70380 100644 --- a/Explorer/Assets/DCL/Chat/ChatControllerChatBubblesHelper.cs +++ b/Explorer/Assets/DCL/Chat/ChatControllerChatBubblesHelper.cs @@ -6,7 +6,7 @@ using DCL.Multiplayer.Profiles.Tables; using DCL.Settings.Settings; using Utility.Arch; -using DCL.UI.Profiles.Helpers; +using DCL.Profiles.Helpers; namespace DCL.Chat { diff --git a/Explorer/Assets/DCL/Chat/ChatConversationsToolbarView.cs b/Explorer/Assets/DCL/Chat/ChatConversationsToolbarView.cs index f4e9cc8ecea..1aff21f52ce 100644 --- a/Explorer/Assets/DCL/Chat/ChatConversationsToolbarView.cs +++ b/Explorer/Assets/DCL/Chat/ChatConversationsToolbarView.cs @@ -1,9 +1,9 @@ using Cysharp.Threading.Tasks; using DCL.Chat.History; using DCL.Profiles; +using DCL.UI.Profiles.Helpers; using DCL.UI; using DG.Tweening; -using MVC; using System.Collections.Generic; using System.Threading; using UnityEngine; @@ -13,7 +13,7 @@ namespace DCL.Chat { - public class ChatConversationsToolbarView : MonoBehaviour, IViewWithGlobalDependencies, IPointerEnterHandler, IPointerExitHandler + public class ChatConversationsToolbarView : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler { public delegate void ConversationSelectedDelegate(ChatChannel.ChannelId channelId); public delegate void ConversationRemovalRequestedDelegate(ChatChannel.ChannelId channelId); @@ -36,9 +36,8 @@ public class ChatConversationsToolbarView : MonoBehaviour, IViewWithGlobalDepend [SerializeField] private Button scrollDownButton; - private ViewDependencies viewDependencies; - private Dictionary items = new (); + private ProfileRepositoryWrapper profileRepositoryWrapper; /// /// Raised when a different conversation item is selected. @@ -152,9 +151,13 @@ public void SetConnectionStatus(ChatChannel.ChannelId destinationChannel, Online items[destinationChannel].SetConnectionStatus(connectionStatus); } - public void InjectDependencies(ViewDependencies dependencies) + /// + /// + /// + /// + public void SetProfileDataProvider(ProfileRepositoryWrapper profileDataProvider) { - viewDependencies = dependencies; + this.profileRepositoryWrapper = profileDataProvider; } /// @@ -261,11 +264,11 @@ private void OnItemTooltipShown(GameObject tooltip) private async UniTaskVoid SetupUserConversationItemAsync(ChatConversationsToolbarViewItem newItem) { - Profile? profile = await viewDependencies.GetProfileAsync(newItem.Id.Id, CancellationToken.None); + Profile? profile = await profileRepositoryWrapper.GetProfileAsync(newItem.Id.Id, CancellationToken.None); if (profile != null) { - newItem.SetProfileData(viewDependencies, profile.UserNameColor, profile.Avatar.FaceSnapshotUrl, profile.UserId); + newItem.SetProfileData(profileRepositoryWrapper, profile.UserNameColor, profile.Avatar.FaceSnapshotUrl, profile.UserId); newItem.SetConversationName(profile.ValidatedName); newItem.SetClaimedNameIconVisibility(profile.HasClaimedName); newItem.SetConversationType(true); diff --git a/Explorer/Assets/DCL/Chat/ChatConversationsToolbarViewItem.cs b/Explorer/Assets/DCL/Chat/ChatConversationsToolbarViewItem.cs index 217aa514fb5..9028ee691cf 100644 --- a/Explorer/Assets/DCL/Chat/ChatConversationsToolbarViewItem.cs +++ b/Explorer/Assets/DCL/Chat/ChatConversationsToolbarViewItem.cs @@ -1,9 +1,9 @@ using DCL.Chat.History; +using DCL.UI.Profiles.Helpers; using DCL.UI; using DCL.UI.Buttons; using DCL.UI.ProfileElements; using DG.Tweening; -using MVC; using TMPro; using UnityEngine; using UnityEngine.EventSystems; @@ -146,15 +146,15 @@ public void SetSelectionStatus(bool isSelected) /// /// Provides the data required to display the profile picture. /// - /// A set of system tools for views. + /// A way to access Profile data asynchronously. /// The color of the user's profile picture. It affects the tooltip too. /// The URL to the profile picture. /// The Id of the user (wallet Id). - public void SetProfileData(ViewDependencies viewDependencies, Color userColor, string faceSnapshotUrl, string userId) + public void SetProfileData(ProfileRepositoryWrapper profileDataProvider, Color userColor, string faceSnapshotUrl, string userId) { customIcon.gameObject.SetActive(false); profilePictureView.gameObject.SetActive(true); - profilePictureView.SetupWithDependencies(viewDependencies, userColor, faceSnapshotUrl, userId); + profilePictureView.SetupWithDependencies(profileDataProvider, userColor, faceSnapshotUrl, userId); tooltipText.color = userColor; } diff --git a/Explorer/Assets/DCL/Chat/ChatInputBoxElement.cs b/Explorer/Assets/DCL/Chat/ChatInputBoxElement.cs index a154128cc04..17d506d2ce9 100644 --- a/Explorer/Assets/DCL/Chat/ChatInputBoxElement.cs +++ b/Explorer/Assets/DCL/Chat/ChatInputBoxElement.cs @@ -2,6 +2,7 @@ using DCL.Audio; using DCL.Emoji; using DCL.Profiles; +using DCL.UI.Profiles.Helpers; using DCL.Settings.Settings; using DCL.UI; using DCL.UI.CustomInputField; @@ -81,6 +82,8 @@ public class ChatInputBoxElement : MonoBehaviour, IViewWithGlobalDependencies private bool isInputSubmissionEnabled; + private ProfileRepositoryWrapper profileRepositoryWrapper; + public string InputBoxText { get => inputField.text; @@ -107,6 +110,11 @@ public void InjectDependencies(ViewDependencies dependencies) viewDependencies = dependencies; } + public void SetProfileDataProvider(ProfileRepositoryWrapper profileDataProvider) + { + profileRepositoryWrapper = profileDataProvider; + } + private bool IsEmojisEnabled { get => emojiPanelButton.gameObject.activeSelf; @@ -480,11 +488,11 @@ private void UpdateProfileNameMap() if (profileSuggestionsDictionary.TryGetValue(profile.DisplayName, out ProfileInputSuggestionData profileSuggestionData)) { if (profileSuggestionData.ProfileData != profile) - profileSuggestionsDictionary[profile.DisplayName] = new ProfileInputSuggestionData(profile, viewDependencies); + profileSuggestionsDictionary[profile.DisplayName] = new ProfileInputSuggestionData(profile, profileRepositoryWrapper); } else { - profileSuggestionsDictionary.TryAdd(profile.DisplayName, new ProfileInputSuggestionData(profile, viewDependencies)); + profileSuggestionsDictionary.TryAdd(profile.DisplayName, new ProfileInputSuggestionData(profile, profileRepositoryWrapper)); } } } diff --git a/Explorer/Assets/DCL/Chat/ChatMemberListView.cs b/Explorer/Assets/DCL/Chat/ChatMemberListView.cs index cdd9bebe7fd..367091b44bb 100644 --- a/Explorer/Assets/DCL/Chat/ChatMemberListView.cs +++ b/Explorer/Assets/DCL/Chat/ChatMemberListView.cs @@ -1,4 +1,5 @@ using Cysharp.Threading.Tasks; +using DCL.UI.Profiles.Helpers; using DCL.UI.Utilities; using DCL.Web3; using MVC; @@ -40,6 +41,7 @@ public struct MemberData private List members = new (); private ViewDependencies viewDependencies; + private ProfileRepositoryWrapper profileRepositoryWrapper; private bool isInitialized; private bool isVisible; private UniTaskCompletionSource contextMenuTask = new (); @@ -75,6 +77,11 @@ public void InjectDependencies(ViewDependencies dependencies) viewDependencies = dependencies; } + public void SetProfileDataProvider(ProfileRepositoryWrapper profileDataProvider) + { + profileRepositoryWrapper = profileDataProvider; + } + /// /// Replaces the data to be represented by the view. /// @@ -102,7 +109,7 @@ private LoopListViewItem2 OnGetItemByIndex(LoopListView2 list, int index) ChatMemberListViewItem memberItem = newItem.GetComponent(); memberItem.Id = members[index].Id; memberItem.Name = members[index].Name; - memberItem.SetupProfilePicture(viewDependencies, members[index].ProfileColor, members[index].FaceSnapshotUrl, members[index].Id); + memberItem.SetupProfilePicture(profileRepositoryWrapper, members[index].ProfileColor, members[index].FaceSnapshotUrl, members[index].Id); memberItem.ConnectionStatus = members[index].ConnectionStatus; memberItem.Tag = members[index].WalletId; memberItem.NameTextColor = members[index].ProfileColor; diff --git a/Explorer/Assets/DCL/Chat/ChatMemberListViewItem.cs b/Explorer/Assets/DCL/Chat/ChatMemberListViewItem.cs index df0a922a350..7e1ce9280f2 100644 --- a/Explorer/Assets/DCL/Chat/ChatMemberListViewItem.cs +++ b/Explorer/Assets/DCL/Chat/ChatMemberListViewItem.cs @@ -1,5 +1,5 @@ +using DCL.UI.Profiles.Helpers; using DCL.UI.ProfileElements; -using MVC; using System; using TMPro; using UnityEngine; @@ -69,9 +69,9 @@ public void OnPointerExit(PointerEventData eventData) contextMenuButton.gameObject.SetActive(false); } - public void SetupProfilePicture(ViewDependencies viewDependencies, Color userColor, string faceSnapshotUrl, string userId) + public void SetupProfilePicture(ProfileRepositoryWrapper profileDataProvider, Color userColor, string faceSnapshotUrl, string userId) { - profilePictureView.SetupWithDependencies(viewDependencies, userColor, faceSnapshotUrl, userId); + profilePictureView.SetupWithDependencies(profileDataProvider, userColor, faceSnapshotUrl, userId); } private void Start() diff --git a/Explorer/Assets/DCL/Chat/ChatMessageViewerElement.cs b/Explorer/Assets/DCL/Chat/ChatMessageViewerElement.cs index caf4eb77de9..92db543114b 100644 --- a/Explorer/Assets/DCL/Chat/ChatMessageViewerElement.cs +++ b/Explorer/Assets/DCL/Chat/ChatMessageViewerElement.cs @@ -2,6 +2,7 @@ using DCL.Chat.History; using DCL.Profiles; using DCL.Diagnostics; +using DCL.Profiles.Helpers; using DCL.UI.Profiles.Helpers; using DCL.UI.Utilities; using DCL.Web3; @@ -72,6 +73,7 @@ private enum ChatItemPrefabIndex // It must match the list in the LoopListView. private IReadOnlyList? chatMessages; private CancellationTokenSource? fadeoutCts; + private ProfileRepositoryWrapper profileRepositoryWrapper; private int separatorPositionIndex; private int messageCountWhenSeparatorWasSet; @@ -389,12 +391,12 @@ private async UniTaskVoid SetItemDataAsync(int index, ChatMessage itemData, Chat itemView.usernameElement.userName.color = ProfileNameColorHelper.GetNameColor(itemData.SenderValidatedName); else { - Profile? profile = await viewDependencies.GetProfileAsync(itemData.SenderWalletAddress, CancellationToken.None); + Profile? profile = await profileRepositoryWrapper.GetProfileAsync(itemData.SenderWalletAddress, CancellationToken.None); if (profile != null) { itemView.usernameElement.userName.color = profile.UserNameColor; - itemView.ProfilePictureView.SetupWithDependencies(viewDependencies, profile.UserNameColor, profile.Avatar.FaceSnapshotUrl, profile.UserId); + itemView.ProfilePictureView.SetupWithDependencies(profileRepositoryWrapper, profile.UserNameColor, profile.Avatar.FaceSnapshotUrl, profile.UserId); } } @@ -428,5 +430,10 @@ private void OnEnable() { loopList.RefreshAllShownItem(); // This avoids artifacts when new items are added while the object is disabled } + + public void SetProfileDataProvider(ProfileRepositoryWrapper profileRepositoryWrapper) + { + this.profileRepositoryWrapper = profileRepositoryWrapper; + } } } diff --git a/Explorer/Assets/DCL/Chat/ChatTitleBarView.cs b/Explorer/Assets/DCL/Chat/ChatTitleBarView.cs index 4f454584542..6b116efa0e0 100644 --- a/Explorer/Assets/DCL/Chat/ChatTitleBarView.cs +++ b/Explorer/Assets/DCL/Chat/ChatTitleBarView.cs @@ -1,4 +1,5 @@ using Cysharp.Threading.Tasks; +using DCL.UI.Profiles.Helpers; using DCL.UI.ProfileElements; using DCL.Web3; using MVC; @@ -110,11 +111,11 @@ public void SetNearbyChannelImage() profileView.gameObject.SetActive(false); } - public void SetupProfileView(Web3Address userId) + public void SetupProfileView(Web3Address userId, ProfileRepositoryWrapper profileDataProvider) { cts = cts.SafeRestart(); profileView.gameObject.SetActive(true); - profileView.SetupAsync(userId, cts.Token).Forget(); + profileView.SetupAsync(userId, profileDataProvider, cts.Token).Forget(); nearbyChannelContainer.SetActive(false); memberCountObject.SetActive(false); } diff --git a/Explorer/Assets/DCL/Chat/ChatView.cs b/Explorer/Assets/DCL/Chat/ChatView.cs index 171de8d06d2..5924d4ce705 100644 --- a/Explorer/Assets/DCL/Chat/ChatView.cs +++ b/Explorer/Assets/DCL/Chat/ChatView.cs @@ -3,6 +3,7 @@ using DCL.Settings.Settings; using DCL.Chat.History; using DCL.Profiles; +using DCL.UI.Profiles.Helpers; using DCL.RealmNavigation; using DCL.UI; using DCL.Web3; @@ -180,6 +181,7 @@ public class ChatView : ViewBase, IView, IViewWithGlobalDependencies, IPointerEn public event DeleteChatHistoryRequestedDelegate? DeleteChatHistoryRequested; private ViewDependencies viewDependencies; + private ProfileRepositoryWrapper profileRepositoryWrapper; private readonly List sortedMemberData = new (); private IReadOnlyDictionary? channels; @@ -267,7 +269,7 @@ public ChatChannel.ChannelId CurrentChannelId chatTitleBar.SetNearbyChannelImage(); break; case ChatChannel.ChatChannelType.USER: - chatTitleBar.SetupProfileView(new Web3Address(currentChannel.Id.Id)); + chatTitleBar.SetupProfileView(new Web3Address(currentChannel.Id.Id), profileRepositoryWrapper); break; } @@ -342,6 +344,15 @@ public void SetupInitialConversationToolbarStatusIconForUsers(HashSet us } } + public void SetProfileDataPovider(ProfileRepositoryWrapper profileDataProvider) + { + conversationsToolbar.SetProfileDataProvider(profileDataProvider); + memberListView.SetProfileDataProvider(profileDataProvider); + chatMessageViewer.SetProfileDataProvider(profileDataProvider); + chatInputBox.SetProfileDataProvider(profileDataProvider); + this.profileRepositoryWrapper = profileDataProvider; + } + private void Start() { IsUnfolded = true; @@ -445,7 +456,6 @@ public void InjectDependencies(ViewDependencies dependencies) chatMessageViewer.InjectDependencies(dependencies); memberListView.InjectDependencies(dependencies); chatTitleBar.InjectDependencies(dependencies); - conversationsToolbar.InjectDependencies(dependencies); } public void Initialize(IReadOnlyDictionary chatChannels, diff --git a/Explorer/Assets/DCL/Friends/RPCFriendsService.cs b/Explorer/Assets/DCL/Friends/RPCFriendsService.cs index 6b0ed68ee95..0f6a2d1df45 100644 --- a/Explorer/Assets/DCL/Friends/RPCFriendsService.cs +++ b/Explorer/Assets/DCL/Friends/RPCFriendsService.cs @@ -4,7 +4,7 @@ using DCL.Profiles; using DCL.Profiles.Self; using DCL.SocialService; -using DCL.UI.Profiles.Helpers; +using DCL.Profiles.Helpers; using DCL.Utilities; using DCL.Web3; using Decentraland.SocialService.V2; diff --git a/Explorer/Assets/DCL/Friends/UI/FriendPanel/FriendsPanelController.cs b/Explorer/Assets/DCL/Friends/UI/FriendPanel/FriendsPanelController.cs index 182bb77eefb..939d0d6f04c 100644 --- a/Explorer/Assets/DCL/Friends/UI/FriendPanel/FriendsPanelController.cs +++ b/Explorer/Assets/DCL/Friends/UI/FriendPanel/FriendsPanelController.cs @@ -6,6 +6,7 @@ using DCL.Friends.UI.FriendPanel.Sections.Requests; using DCL.Multiplayer.Connectivity; using DCL.Profiles; +using DCL.UI.Profiles.Helpers; using DCL.UI.SharedSpaceManager; using DCL.Web3; using ECS.SceneLifeCycle.Realm; @@ -68,7 +69,8 @@ public FriendsPanelController(ViewFactoryMethod viewFactory, ViewDependencies viewDependencies, bool includeUserBlocking, bool isConnectivityStatusEnabled, - ISharedSpaceManager sharedSpaceManager) : base(viewFactory) + ISharedSpaceManager sharedSpaceManager, + ProfileRepositoryWrapper profileDataProvider) : base(viewFactory) { this.sidebarRequestNotificationIndicator = sidebarRequestNotificationIndicator; this.dclInput = dclInput; @@ -82,7 +84,7 @@ public FriendsPanelController(ViewFactoryMethod viewFactory, friendsService, friendEventBus, mvcManager, - new FriendListPagedDoubleCollectionRequestManager(friendsService, friendEventBus, profileRepository, friendsConnectivityStatusTracker, instantiatedView.FriendsSection.LoopList, viewDependencies, FRIENDS_PAGE_SIZE, FRIENDS_FETCH_ELEMENTS_THRESHOLD), + new FriendListPagedDoubleCollectionRequestManager(friendsService, friendEventBus, profileRepository, friendsConnectivityStatusTracker, instantiatedView.FriendsSection.LoopList, profileDataProvider, FRIENDS_PAGE_SIZE, FRIENDS_FETCH_ELEMENTS_THRESHOLD), passportBridge, onlineUsersProvider, realmNavigator, @@ -98,7 +100,7 @@ public FriendsPanelController(ViewFactoryMethod viewFactory, else friendSectionController = new FriendSectionController(instantiatedView.FriendsSection, mvcManager, - new FriendListRequestManager(friendsService, friendEventBus, profileRepository, instantiatedView.FriendsSection.LoopList, viewDependencies, FRIENDS_PAGE_SIZE, FRIENDS_FETCH_ELEMENTS_THRESHOLD), + new FriendListRequestManager(friendsService, friendEventBus, profileRepository, instantiatedView.FriendsSection.LoopList, profileDataProvider, FRIENDS_PAGE_SIZE, FRIENDS_FETCH_ELEMENTS_THRESHOLD), passportBridge, onlineUsersProvider, realmNavigator, @@ -110,13 +112,13 @@ public FriendsPanelController(ViewFactoryMethod viewFactory, friendsService, friendEventBus, mvcManager, - new RequestsRequestManager(friendsService, friendEventBus, viewDependencies, FRIENDS_REQUEST_PAGE_SIZE, instantiatedView.RequestsSection.LoopList), + new RequestsRequestManager(friendsService, friendEventBus, profileDataProvider, FRIENDS_REQUEST_PAGE_SIZE, instantiatedView.RequestsSection.LoopList), passportBridge, includeUserBlocking); blockedSectionController = new BlockedSectionController(instantiatedView.BlockedSection, mvcManager, - new BlockedPanelList(friendsService, friendEventBus, viewDependencies, instantiatedView.BlockedSection.LoopList, FRIENDS_PAGE_SIZE, FRIENDS_FETCH_ELEMENTS_THRESHOLD), + new BlockedPanelList(friendsService, friendEventBus, profileDataProvider, instantiatedView.BlockedSection.LoopList, FRIENDS_PAGE_SIZE, FRIENDS_FETCH_ELEMENTS_THRESHOLD), passportBridge); requestsSectionController.ReceivedRequestsCountChanged += FriendRequestCountChanged; diff --git a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Blocked/BlockedPanelList.cs b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Blocked/BlockedPanelList.cs index dd167913887..3849bec27f4 100644 --- a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Blocked/BlockedPanelList.cs +++ b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Blocked/BlockedPanelList.cs @@ -1,5 +1,5 @@ using Cysharp.Threading.Tasks; -using MVC; +using DCL.UI.Profiles.Helpers; using SuperScrollView; using System; using System.Collections.Generic; @@ -22,10 +22,10 @@ public class BlockedPanelList : FriendPanelRequestManager public BlockedPanelList( IFriendsService friendsService, IFriendsEventBus friendsEventBus, - ViewDependencies viewDependencies, + ProfileRepositoryWrapper profileDataProvider, LoopListView2 loopListView, int pageSize, - int elementsMissingThreshold) : base(viewDependencies, loopListView, pageSize, elementsMissingThreshold) + int elementsMissingThreshold) : base(profileDataProvider, loopListView, pageSize, elementsMissingThreshold) { this.friendsService = friendsService; this.friendsEventBus = friendsEventBus; diff --git a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Blocked/BlockedUserView.cs b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Blocked/BlockedUserView.cs index 07d1413399c..497840cffdc 100644 --- a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Blocked/BlockedUserView.cs +++ b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Blocked/BlockedUserView.cs @@ -1,4 +1,5 @@ using DCL.Friends.UI.FriendPanel.Sections.Friends; +using DCL.UI.Profiles.Helpers; using System; using TMPro; using UnityEngine; @@ -24,12 +25,12 @@ public DateTime BlockedDate } } - public override void Configure(FriendProfile profile) + public override void Configure(FriendProfile profile, ProfileRepositoryWrapper profileDataProvider) { buttons.Clear(); buttons.Add(UnblockButton); buttons.Add(ContextMenuButton); - base.Configure(profile); + base.Configure(profile, profileDataProvider); } protected override void ToggleButtonView(bool isActive) diff --git a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/FriendPanelDoubleCollectionRequestManager.cs b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/FriendPanelDoubleCollectionRequestManager.cs index acefbb3aa17..2cd76111a2e 100644 --- a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/FriendPanelDoubleCollectionRequestManager.cs +++ b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/FriendPanelDoubleCollectionRequestManager.cs @@ -1,5 +1,5 @@ using Cysharp.Threading.Tasks; -using MVC; +using DCL.UI.Profiles.Helpers; using SuperScrollView; using System; using System.Threading; @@ -11,7 +11,7 @@ public abstract class FriendPanelDoubleCollectionRequestManager : IDisposable { protected readonly IFriendsService friendsService; protected readonly IFriendsEventBus friendEventBus; - private readonly ViewDependencies viewDependencies; + private readonly ProfileRepositoryWrapper profileRepositoryWrapper; private readonly LoopListView2 loopListView; private readonly int pageSize; private readonly int elementsMissingThreshold; @@ -42,7 +42,7 @@ public abstract class FriendPanelDoubleCollectionRequestManager : IDisposable protected FriendPanelDoubleCollectionRequestManager(IFriendsService friendsService, IFriendsEventBus friendEventBus, - ViewDependencies viewDependencies, + ProfileRepositoryWrapper profileDataProvider, LoopListView2 loopListView, int pageSize, int elementsMissingThreshold, @@ -55,7 +55,7 @@ protected FriendPanelDoubleCollectionRequestManager(IFriendsService friendsServi { this.friendsService = friendsService; this.friendEventBus = friendEventBus; - this.viewDependencies = viewDependencies; + this.profileRepositoryWrapper = profileDataProvider; this.loopListView = loopListView; this.pageSize = pageSize; this.elementsMissingThreshold = elementsMissingThreshold; @@ -105,9 +105,8 @@ public LoopListViewItem2 GetLoopListItemByIndex(LoopListView2 loopListView, int { listItem = loopListView.NewListViewItem(loopListView.ItemPrefabDataList[userElementIndex].mItemPrefab.name); T friendListUserView = listItem.GetComponent(); - friendListUserView.InjectDependencies(viewDependencies); int collectionIndex = index - 1; - friendListUserView.Configure(GetFirstCollectionElement(collectionIndex)); + friendListUserView.Configure(GetFirstCollectionElement(collectionIndex), profileRepositoryWrapper); CustomiseElement(friendListUserView, collectionIndex, firstCollectionStatus); friendListUserView.RemoveMainButtonClickListeners(); friendListUserView.MainButtonClicked += profile => ElementClicked?.Invoke(profile); @@ -129,9 +128,8 @@ public LoopListViewItem2 GetLoopListItemByIndex(LoopListView2 loopListView, int { listItem = loopListView.NewListViewItem(loopListView.ItemPrefabDataList[userElementIndex].mItemPrefab.name); T friendListUserView = listItem.GetComponent(); - friendListUserView.InjectDependencies(viewDependencies); int collectionIndex = index - onlineFriendMarker - 2; - friendListUserView.Configure(GetSecondCollectionElement(collectionIndex)); + friendListUserView.Configure(GetSecondCollectionElement(collectionIndex), profileRepositoryWrapper); CustomiseElement(friendListUserView, collectionIndex, secondCollectionStatus); friendListUserView.RemoveMainButtonClickListeners(); friendListUserView.MainButtonClicked += profile => ElementClicked?.Invoke(profile); diff --git a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/FriendPanelRequestManager.cs b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/FriendPanelRequestManager.cs index 4dc732864b2..be2089b6820 100644 --- a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/FriendPanelRequestManager.cs +++ b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/FriendPanelRequestManager.cs @@ -1,5 +1,5 @@ using Cysharp.Threading.Tasks; -using MVC; +using DCL.UI.Profiles.Helpers; using SuperScrollView; using System; using System.Threading; @@ -9,7 +9,7 @@ namespace DCL.Friends.UI.FriendPanel.Sections { public abstract class FriendPanelRequestManager : IDisposable where T : FriendPanelUserView { - private readonly ViewDependencies viewDependencies; + private readonly ProfileRepositoryWrapper profileRepositoryWrapper; private readonly LoopListView2 loopListView; private readonly int pageSize; private readonly int elementsMissingThreshold; @@ -26,11 +26,11 @@ public abstract class FriendPanelRequestManager : IDisposable where T : Frien public event Action? ElementClicked; - protected FriendPanelRequestManager(ViewDependencies viewDependencies, + protected FriendPanelRequestManager(ProfileRepositoryWrapper profileDataProvider, LoopListView2 loopListView, int pageSize, int elementsMissingThreshold) { - this.viewDependencies = viewDependencies; + this.profileRepositoryWrapper = profileDataProvider; this.loopListView = loopListView; this.pageSize = pageSize; this.elementsMissingThreshold = elementsMissingThreshold; @@ -50,8 +50,7 @@ public LoopListViewItem2 GetLoopListItemByIndex(LoopListView2 loopListView, int { LoopListViewItem2 listItem = loopListView.NewListViewItem(loopListView.ItemPrefabDataList[0].mItemPrefab.name); T view = listItem.GetComponent(); - view.InjectDependencies(viewDependencies); - view.Configure(GetCollectionElement(index)); + view.Configure(GetCollectionElement(index), profileRepositoryWrapper); view.RemoveMainButtonClickListeners(); view.MainButtonClicked += profile => ElementClicked?.Invoke(profile); @@ -87,7 +86,7 @@ private async UniTask FetchDataInternalAsync(CancellationToken ct) public async UniTask InitAsync(CancellationToken ct) { - //This could happen when there's a prewarm and the user navigates to this section before the prewarm finishes + //This could happen when there's a prewarm and the user navigates to this section before the prewarm finishes if (isInitializing) return; isInitializing = true; diff --git a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/FriendPanelUserView.cs b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/FriendPanelUserView.cs index 42b860c0eb6..4c557348836 100644 --- a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/FriendPanelUserView.cs +++ b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/FriendPanelUserView.cs @@ -1,5 +1,5 @@ +using DCL.UI.Profiles.Helpers; using DCL.UI.ProfileElements; -using MVC; using System; using System.Collections.Generic; using TMPro; @@ -9,7 +9,7 @@ namespace DCL.Friends.UI.FriendPanel.Sections { - public class FriendPanelUserView : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IViewWithGlobalDependencies + public class FriendPanelUserView : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler { protected readonly List