Skip to content

Commit

Permalink
Merge pull request #6148 from decentraland/release/release-20240401
Browse files Browse the repository at this point in the history
Release: 20240401
  • Loading branch information
anicalbano authored Apr 1, 2024
2 parents 33e2596 + 8245e52 commit d6d28f4
Show file tree
Hide file tree
Showing 70 changed files with 8,629 additions and 1,430 deletions.
6 changes: 5 additions & 1 deletion browser-interface/packages/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { getFeatureFlagEnabled } from 'shared/meta/selectors'
import { now } from 'lib/javascript/now'
import { isURL } from 'lib/javascript/isURL'
import { store } from 'shared/store/isolatedStore'
import logWrapper from '../lib/logger/wrap'

/**
* Estimated avatar height
Expand All @@ -11,6 +12,9 @@ export const playerHeight = 1.6

// Entry points
export const PREVIEW: boolean = !!(globalThis as any).preview
// update logger
logWrapper()

export const WORLD_EXPLORER = !PREVIEW

export const RENDERER_WS = location.search.includes('ws')
Expand Down Expand Up @@ -54,7 +58,7 @@ export const DEBUG_ANALYTICS = location.search.includes('DEBUG_ANALYTICS')
export const DEBUG_REDUX = location.search.includes('DEBUG_REDUX')
export const DEBUG_REDUX_SAGAS = location.search.includes('DEBUG_REDUX_SAGAS')
export const DEBUG_SCENE_LOG = DEBUG || location.search.includes('DEBUG_SCENE_LOG')
export const DEBUG_KERNEL_LOG = !PREVIEW || location.search.includes('DEBUG_KERNEL_LOG')
export const DEBUG_KERNEL_LOG = location.search.includes('DEBUG_KERNEL_LOG')
export const DEBUG_WS_MESSAGES = location.search.includes('DEBUG_WS_MESSAGES')
export const DEBUG_VOICE_CHAT = location.search.includes('DEBUG_VOICE_CHAT')
export const DEBUG_LOGS = location.search.includes('DEBUG_LOGS')
Expand Down
13 changes: 11 additions & 2 deletions browser-interface/packages/lib/logger/wrap.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export const METHODS = ['info', 'log', 'warn', 'trace'] as const
import { PREVIEW } from "../../config"

export const METHODS = ['info', 'log', 'warn', 'trace', 'error'] as const
type Method = (typeof METHODS)[number]

/**
Expand All @@ -7,8 +9,15 @@ type Method = (typeof METHODS)[number]
*/
export const _console = Object.assign({}, console)

function getPrefix(value?: string) {
if (value) return value
if (location.search.includes('DEBUG_LOGS')) return '*'
if (PREVIEW) return 'kernel:scene'
return 'kernel:scene'
}

export function wrap(testPrefix?: string) {
const prefix = testPrefix ? testPrefix : location.search.includes('DEBUG_LOGS') ? '*' : 'kernel'
const prefix = getPrefix(testPrefix)
function logger(method: Method) {
return function log(...args: any[]): void {
const [logPrefix] = args
Expand Down
3 changes: 2 additions & 1 deletion browser-interface/packages/shared/comms/peers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
positionReportToCommsPositionRfc4,
squareDistanceRfc4
} from './interface/utils'
import { isBlocked } from 'shared/friends/utils'

/**
* peerInformationMap contains data received of the current peers that we have
Expand Down Expand Up @@ -123,7 +124,7 @@ function sendPeerUserData(address: string) {
avatarMessageObservable.notifyObservers({
type: AvatarMessageType.USER_DATA,
userId: peer.ethereumAddress,
data: peer,
data: { ...peer, visible: !isBlocked(profile.userId) },
profile
})
}
Expand Down
2 changes: 1 addition & 1 deletion browser-interface/packages/ui/avatar/avatarSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type Position = {
rotationW: number
}

const avatarMap = new Map<string, AvatarEntity>()
export const avatarMap = new Map<string, AvatarEntity>()

export class AvatarEntity extends Entity {
visible = true
Expand Down
6 changes: 4 additions & 2 deletions browser-interface/packages/ui/decentraland-ui.scene.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { executeTask } from '@dcl/legacy-ecs'
import { avatarMessageObservable } from './avatar/avatarSystem'
import { avatarMap, avatarMessageObservable } from './avatar/avatarSystem'

declare const dcl: DecentralandInterface

Expand All @@ -23,7 +23,9 @@ void executeTask(async () => {
if (payload !== lastProcessed) {
try {
lastProcessed = payload
avatarMessageObservable.emit('message', JSON.parse(payload))
const msg = JSON.parse(payload)
const invisible = avatarMap.get(msg.userId)?.visible === false && msg.visible === false
if (!invisible) avatarMessageObservable.emit('message', msg)
} catch (err) {
console.error(err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ Transform:
m_GameObject: {fileID: 4323503760844960451}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalPosition: {x: 0, y: -0.8, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class ChatHUDView : BaseComponentView, IChatHUDComponentView
[SerializeField] internal InputAction_Trigger closeMentionSuggestionsInput;
[SerializeField] internal ChatMentionSuggestionComponentView chatMentionSuggestions;
[SerializeField] internal WebGLIMEInput webGlImeInput;
[SerializeField] internal Button unblockButton;
[SerializeField] private Model model;

private readonly Dictionary<string, ChatEntry> entries = new ();
Expand Down Expand Up @@ -109,7 +110,7 @@ void Action(string s) =>
public event Action<string> OnMentionSuggestionSelected;
public event Action<ChatEntryModel> OnCopyMessageRequested;
public event Action<ChatMessage> OnSendMessage;

public event Action<string> OnUnblockUser;
public int EntryCount => entries.Count;
public IChatEntryFactory ChatEntryFactory { get; set; }
public IComparer<ChatEntryModel> SortingStrategy { get; set; }
Expand All @@ -127,6 +128,11 @@ public override void Awake()
model.enableFadeoutMode = true;
contextMenu.SetPassportOpenSource(true);

unblockButton.onClick.AddListener(() =>
{
OnUnblockUser?.Invoke(model.conversationUserId);
});

#if (UNITY_WEBGL && !UNITY_EDITOR)
// WebGLInput plugin breaks many features:
// @mentions navigation with ARROW keys
Expand Down Expand Up @@ -244,6 +250,12 @@ public void HideMentionSuggestions()
chatMentionSuggestions.Hide();
}

public void SetBlockedStatus(bool blocked)
{
inputField.gameObject.SetActive(!blocked);
unblockButton.gameObject.SetActive(blocked);
}

public void AddMentionToInputField(int fromIndex, int length, string userId, string userName)
{
string message = inputField.text;
Expand Down Expand Up @@ -342,6 +354,11 @@ protected void Populate(ChatEntry entry, ChatEntryModel model)
entry.SetFadeout(this.model.enableFadeoutMode);
}

public void SetConversationUserId(string userId)
{
model.conversationUserId = userId;
}

protected void Dock(ChatEntry entry)
{
entry.transform.SetParent(chatEntriesContainer, false);
Expand Down Expand Up @@ -530,6 +547,7 @@ private struct Model
public string inputFieldText;
public bool enableFadeoutMode;
public ChatEntryModel[] entries;
public string conversationUserId;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using DCL.Social.Chat;
using DCL.Interface;
using DCL.Interface;
using System;
using System.Collections.Generic;

Expand All @@ -17,15 +16,14 @@ public interface IChatHUDComponentView
event Action OnNextChatInHistory;
event Action<string> OnMentionSuggestionSelected;
event Action<ChatEntryModel> OnCopyMessageRequested;
event Action<string> OnUnblockUser;

int EntryCount { get; }
IComparer<ChatEntryModel> SortingStrategy { set; }
bool UseLegacySorting { set; }

void OnMessageCancelHover();

void SetEntry(ChatEntryModel model, bool setScrollPositionToBottom = false);

void SetConversationUserId(string userId);
void Dispose();

void RemoveOldestEntry();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
using DCL.Helpers;
using System;
using UnityEngine;

namespace DCL.MyAccount
{
public class BlockedListComponentView : BaseComponentView, IBlockedListComponentView
{
[Header("General")]
[SerializeField] internal GameObject mainContainer;
[SerializeField] internal GameObject loadingContainer;
[SerializeField] internal RectTransform contentTransform;
[SerializeField] internal GameObject scrollBar;
[SerializeField] internal CollapsableSortedBlockedEntryList blockedList;

public event Action<string> OnUnblockUser;

public void SetupBlockedList()
{
blockedList.OnUnblockUser = OnUnblockUser;
int SortByAlphabeticalOrder(BlockedUserEntry u1, BlockedUserEntry u2)
{
return string.Compare(u1.Model.userName, u2.Model.userName, StringComparison.InvariantCultureIgnoreCase);
}

blockedList.SortingMethod = SortByAlphabeticalOrder;
}

public void Set(BlockedUserEntryModel user)
{
blockedList.Set(user.userId, user);
RefreshContentLayout();
}

public void Remove(string userId)
{
blockedList.Remove(userId);
RefreshContentLayout();
}

public void ClearAllEntries()
{
blockedList.Clear();
}

public override void Show(bool instant = false)
{
gameObject.SetActive(true);

if (scrollBar != null)
scrollBar.SetActive(true);
}

public override void Hide(bool instant = false)
{
gameObject.SetActive(false);

if (scrollBar != null)
scrollBar.SetActive(false);
}

public void SetLoadingActive(bool isActive)
{
loadingContainer.SetActive(isActive);
mainContainer.SetActive(!isActive);
}

public void RefreshContentLayout() =>
Utils.ForceRebuildLayoutImmediate(contentTransform);

public override void RefreshControl()
{
}
}
}

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

Loading

0 comments on commit d6d28f4

Please sign in to comment.