Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class CommunityCardContextMenuConfiguration : ScriptableObject
[Space(10)]
[SerializeField] private Sprite deleteCommunitySprite;
[SerializeField] private string deleteCommunityText = "Delete Community";
[SerializeField] private Color deleteCommunityTextColor = Color.red;

public int ContextMenuWidth => contextMenuWidth;
public int ElementsSpacing => elementsSpacing;
Expand All @@ -26,5 +27,6 @@ public class CommunityCardContextMenuConfiguration : ScriptableObject

public Sprite DeleteCommunitySprite => deleteCommunitySprite;
public string DeleteCommunityText => deleteCommunityText;
public Color DeleteCommunityTextColor => deleteCommunityTextColor;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ private async void OnOpenCommunityChatAsync()
chatEventBus.OpenCommunityConversationUsingUserId(communityData.id);
CloseController();
}
catch (Exception ex) when (ex is not OperationCanceledException)
catch (OperationCanceledException) { }
catch (Exception ex)
Comment on lines -186 to +187

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was it not the same?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, because previously OperationCanceledException wasn't handled, now it's explicitly suppressed

{
ReportHub.LogException(ex, ReportCategory.COMMUNITIES);
}
Expand All @@ -199,6 +200,8 @@ protected override void OnViewInstantiated()
viewInstance.DeleteCommunityRequested += OnDeleteCommunityRequested;
viewInstance.CameraReelGalleryConfigs.PhotosView.OpenWizardButtonClicked += OnOpenCommunityWizard;

viewInstance.SetConfirmationDialogDependencies(profileRepositoryWrapper);

cameraReelGalleryController = new CameraReelGalleryController(viewInstance.CameraReelGalleryConfigs.PhotosView.GalleryView, cameraReelStorageService, cameraReelScreenshotsStorage,
new ReelGalleryConfigParams(viewInstance.CameraReelGalleryConfigs.GridLayoutFixedColumnCount, viewInstance.CameraReelGalleryConfigs.ThumbnailHeight,
viewInstance.CameraReelGalleryConfigs.ThumbnailWidth, false, false), false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using DCL.UI;
using DCL.UI.GenericContextMenu;
using DCL.UI.GenericContextMenu.Controls.Configs;
using DCL.UI.Profiles.Helpers;
using MVC;
using System;
using System.Threading;
Expand Down Expand Up @@ -126,7 +127,13 @@ private void Awake()
elementsSpacing: contextMenuSettings.ElementsSpacing,
anchorPoint: ContextMenuOpenDirection.BOTTOM_LEFT)
.AddControl(new ButtonContextMenuControlSettings(contextMenuSettings.LeaveCommunityText, contextMenuSettings.LeaveCommunitySprite, ShowLeaveConfirmationDialog))
.AddControl(deleteCommunityContextMenuElement = new GenericContextMenuElement(new ButtonContextMenuControlSettings(contextMenuSettings.DeleteCommunityText, contextMenuSettings.DeleteCommunitySprite, OnDeleteCommunityRequested)));
.AddControl(deleteCommunityContextMenuElement = new GenericContextMenuElement(
new ButtonContextMenuControlSettings(contextMenuSettings.DeleteCommunityText, contextMenuSettings.DeleteCommunitySprite, OnDeleteCommunityRequested, textColor: contextMenuSettings.DeleteCommunityTextColor, iconColor: contextMenuSettings.DeleteCommunityTextColor)));
}

public void SetConfirmationDialogDependencies(ProfileRepositoryWrapper profileRepositoryWrapper)
{
confirmationDialogView.SetProfileRepository(profileRepositoryWrapper);
}

private void OnDeleteCommunityRequested()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Cysharp.Threading.Tasks;
using DCL.UI.ProfileElements;
using DCL.UI.Profiles.Helpers;
using DG.Tweening;
using System;
using System.Threading;
using TMPro;
using UnityEngine;
Expand All @@ -12,15 +13,32 @@ public class ConfirmationDialogView : MonoBehaviour
{
public struct DialogData
{
public struct UserData
{
public readonly string Address;
public readonly string ThumbnailUrl;
public readonly Color Color;

public UserData(string address, string thumbnailUrl, Color color)
{
Address = address;
ThumbnailUrl = thumbnailUrl;
Color = color;
}
}

public readonly string Text;
public readonly string SubText;
public readonly string CancelButtonText;
public readonly string ConfirmButtonText;
public readonly Sprite Image;
public readonly bool ShowImageRim;
public readonly bool ShowQuitImage;
public readonly UserData UserInfo;

public DialogData(string text, string cancelButtonText, string confirmButtonText, Sprite image, bool showImageRim, bool showQuitImage, string subText = "")
public DialogData(string text, string cancelButtonText, string confirmButtonText,
Sprite image, bool showImageRim, bool showQuitImage,
string subText = "", UserData userInfo = default)
{
Text = text;
CancelButtonText = cancelButtonText;
Expand All @@ -29,6 +47,7 @@ public DialogData(string text, string cancelButtonText, string confirmButtonText
ShowImageRim = showImageRim;
ShowQuitImage = showQuitImage;
SubText = subText;
UserInfo = userInfo;
}
}

Expand All @@ -50,8 +69,16 @@ public enum ConfirmationResult
[field: SerializeField] private Image mainImage { get; set; }
[field: SerializeField] private GameObject quitImage { get; set; }
[field: SerializeField] private Image rimImage { get; set; }
[field: SerializeField] private ProfilePictureView profilePictureView { get; set; }
[field: SerializeField] private Image profileActionIcon { get; set; }

private readonly UniTask[] closeTasks = new UniTask[3];
private ProfileRepositoryWrapper profileRepositoryWrapper;

public void SetProfileRepository(ProfileRepositoryWrapper profileRepositoryWrapper)
{
this.profileRepositoryWrapper = profileRepositoryWrapper;
}

private UniTask[] GetCloseTasks(CancellationToken ct)
{
Expand All @@ -77,6 +104,18 @@ public async UniTask<ConfirmationResult> ShowConfirmationDialogAsync(DialogData
quitImage.SetActive(dialogData.ShowQuitImage);
mainImage.sprite = dialogData.Image;

bool hasProfileImage = !string.IsNullOrEmpty(dialogData.UserInfo.Address);

rimImage.gameObject.SetActive(!hasProfileImage);
profilePictureView.gameObject.SetActive(hasProfileImage);
profileActionIcon.sprite = dialogData.Image;

if (hasProfileImage)
{
profilePictureView.SetDefaultThumbnail();
profilePictureView.Setup(profileRepositoryWrapper, dialogData.UserInfo.Color, dialogData.UserInfo.ThumbnailUrl, dialogData.UserInfo.Address);
}

await viewCanvasGroup.DOFade(1f, fadeDuration).ToUniTask(cancellationToken: ct);
viewCanvasGroup.interactable = true;
viewCanvasGroup.blocksRaycasts = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ namespace DCL.Communities.CommunitiesCard.Members
public class CommunityMemberListContextMenuConfiguration : ScriptableObject
{
[SerializeField] private int contextMenuWidth = 250;
[SerializeField] private int elementsSpacing = 5;
[SerializeField] private int separatorHeight = 20;
[SerializeField] private RectOffset verticalPadding;
[Space(10)]
[SerializeField] private Sprite viewProfileSprite;
[SerializeField] private string viewProfileText = "View Profile";
Expand All @@ -32,6 +35,9 @@ public class CommunityMemberListContextMenuConfiguration : ScriptableObject
[SerializeField] private string banUserText = "Ban";

public int ContextMenuWidth => contextMenuWidth;
public int ElementsSpacing => elementsSpacing;
public int SeparatorHeight => separatorHeight;
public RectOffset VerticalPadding => verticalPadding;

public Sprite ViewProfileSprite => viewProfileSprite;
public string ViewProfileText => viewProfileText;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ MonoBehaviour:
m_Name: CommunityMemberListContextMenuSettings
m_EditorClassIdentifier:
contextMenuWidth: 250
elementsSpacing: 5
verticalPadding:
m_Left: 15
m_Right: 15
m_Top: 20
m_Bottom: 25
viewProfileSprite: {fileID: 21300000, guid: c42ef609dd1154fa9a0e37d744af5614, type: 3}
viewProfileText: View Profile
blockSprite: {fileID: 21300000, guid: 493ac3c2397b64caea2decabee6048e8, type: 3}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using DCL.UI.GenericContextMenu.Controls.Configs;
using System;

namespace DCL.Communities.CommunitiesCard.Members
{
public static class FriendshipHelpers
{
public static UserProfileContextMenuControlSettings.FriendshipStatus Convert(this FriendshipStatus status)
{
return status switch
{
FriendshipStatus.friend => UserProfileContextMenuControlSettings.FriendshipStatus.FRIEND,
FriendshipStatus.request_received => UserProfileContextMenuControlSettings.FriendshipStatus.REQUEST_RECEIVED,
FriendshipStatus.request_sent => UserProfileContextMenuControlSettings.FriendshipStatus.REQUEST_SENT,
FriendshipStatus.blocked => UserProfileContextMenuControlSettings.FriendshipStatus.BLOCKED,
FriendshipStatus.blocked_by => UserProfileContextMenuControlSettings.FriendshipStatus.DISABLED,
FriendshipStatus.none => UserProfileContextMenuControlSettings.FriendshipStatus.NONE,
_ => throw new ArgumentOutOfRangeException(nameof(status), status, null)
};
}

public static FriendshipStatus Convert(this Friends.FriendshipStatus status)
{
return status switch
{
Friends.FriendshipStatus.FRIEND => FriendshipStatus.friend,
Friends.FriendshipStatus.REQUEST_RECEIVED => FriendshipStatus.request_received,
Friends.FriendshipStatus.REQUEST_SENT => FriendshipStatus.request_sent,
Friends.FriendshipStatus.BLOCKED => FriendshipStatus.blocked,
Friends.FriendshipStatus.BLOCKED_BY => FriendshipStatus.blocked_by,
Friends.FriendshipStatus.NONE => FriendshipStatus.none,
_ => throw new ArgumentOutOfRangeException(nameof(status), status, null)
};
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading