Skip to content
Closed
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 @@ -138,6 +138,8 @@ private void OnChatReset(ChatEvents.ChatResetEvent obj)
scrollToBottomPresenter.OnChannelChanged();
separatorFixedIndexFromBottom = -1;
messageCountWhenSeparatorViewed = null;

Debug.Log($"[PACO] OnChatReset: isFocused {isFocused} -> false\n{System.Environment.StackTrace}");
isFocused = false;
}

Expand Down Expand Up @@ -271,7 +273,10 @@ private void OnMessageAddedToChatHistory(ChatChannel destinationChannel, ChatMes

// 5. Handle the fade-out for unfocused chat
if (!isFocused)
{
Debug.Log($"[PACO] OnMessageAdded restarting fade (isFocused=false)\n{System.Environment.StackTrace}");
view.RestartChatEntriesFadeout();
}
}

private void ScrollToNewMessagesSeparator()
Expand Down Expand Up @@ -557,6 +562,8 @@ private void OnAutoTranslationSettingsChanged(string conversationId)

public void SetFocusState(bool isFocused, bool animate, float duration, Ease easing)
{
Debug.Log($"[PACO] SetFocusState: {this.isFocused} -> {isFocused}\n{System.Environment.StackTrace}");

this.isFocused = isFocused;

// Delegate logical state change to sub-presenter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,8 @@ internal void RestartChatEntriesFadeout()

internal void StartChatEntriesFadeout()
{
Debug.Log($"[PACO] StartChatEntriesFadeout\n{System.Environment.StackTrace}");

// Kill any previous sequence or
// tweens touching this CanvasGroup
_fadeSequenceTween?.Kill();
Expand All @@ -320,14 +322,18 @@ internal void StartChatEntriesFadeout()

_fadeSequenceTween = DOTween.Sequence()
.AppendInterval(waitSeconds)
.AppendCallback(() => Debug.Log($"[PACO] Fade delay elapsed, DOFade about to begin. alpha={chatEntriesCanvasGroup.alpha}"))
.Append(chatEntriesCanvasGroup.DOFade(0.4f, chatEntriesFadeTime))
.OnComplete(() =>
{
Debug.Log("[PACO] Fade sequence COMPLETED (alpha reached 0.4)");
completed = true;
_fadeSequenceTween = null;
})
.OnKill(() =>
{
Debug.Log($"[PACO] Fade sequence KILLED (completed={completed})");

// If killed before completion,
// snap back to fully visible
if (!completed && chatEntriesCanvasGroup)
Expand All @@ -339,6 +345,8 @@ internal void StartChatEntriesFadeout()

internal void StopChatEntriesFadeout()
{
Debug.Log($"[PACO] StopChatEntriesFadeout\n{System.Environment.StackTrace}");

_fadeSequenceTween?.Kill();
chatEntriesCanvasGroup.DOKill();
chatEntriesCanvasGroup.alpha = 1f;
Expand Down
4 changes: 4 additions & 0 deletions Explorer/Assets/DCL/Chat/_Refactor/ChatPanelPresenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using System.Threading;
using DCL.Translation;
using DCL.Translation.Service;
using UnityEngine;
using UnityEngine.InputSystem;
using Utility;

Expand Down Expand Up @@ -186,6 +187,7 @@ private void OnOpenChatCommandLineShortcutPerformed(InputAction.CallbackContext

private void OnUIClose(InputAction.CallbackContext obj)
{
Debug.Log($"[PACO] OnUIClose (ESC): isMinimized={chatStateMachine.IsMinimized}");
if (chatStateMachine.IsMinimized) return;

chatStateMachine.SetVisibility(true);
Expand Down Expand Up @@ -235,11 +237,13 @@ private void OnShownInSharedSpaceAsync(ChatSharedAreaEvents.ChatPanelShownInShar

private void OnMvcViewShowed(ChatSharedAreaEvents.ChatPanelMvcViewShowedEvent evt)
{
Debug.Log("[PACO] OnMvcViewShowed (IBlocksChat opened)");
chatStateMachine.Minimize();
}

private void OnMvcViewClosed(ChatSharedAreaEvents.ChatPanelMvcViewClosedEvent evt)
{
Debug.Log($"[PACO] OnMvcViewClosed: isFocused={chatStateMachine.IsFocused}");
if (!chatStateMachine.IsFocused)
chatStateMachine.PopState();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using DCL.Chat.ChatServices;
using MVC;
using System;
using UnityEngine;
using Utility;

namespace DCL.Chat.ChatStates
Expand Down Expand Up @@ -75,6 +76,7 @@ private void PropagateStateChange(ChatState currentState) =>

public void OnViewShow()
{
Debug.Log($"[PACO] OnViewShow: {fsm.CurrentState?.GetType().Name} -> DefaultChatState\n{System.Environment.StackTrace}");
inputBlocker.Initialize();

fsm.Enter<DefaultChatState>();
Expand All @@ -97,11 +99,13 @@ private void HandleToggleMembersEvent(ChatEvents.ToggleMembersEvent evt)

private void HandleClickInside()
{
Debug.Log($"[PACO] HandleClickInside: state={fsm.CurrentState?.GetType().Name}");
fsm.CurrentState!.OnClickInside();
}

private void HandleClickOutside()
{
Debug.Log($"[PACO] HandleClickOutside: state={fsm.CurrentState?.GetType().Name}\n{System.Environment.StackTrace}");
fsm.CurrentState!.OnClickOutside();
}

Expand All @@ -117,11 +121,13 @@ private void HandlePointerEntered()

public void Minimize()
{
Debug.Log($"[PACO] Minimize: state={fsm.CurrentState?.GetType().Name}\n{System.Environment.StackTrace}");
fsm.CurrentState!.OnMinimizeRequested();
}

public void SetInitialState(bool focus)
{
Debug.Log($"[PACO] SetInitialState(focus={focus}): state={fsm.CurrentState?.GetType().Name}, prev={fsm.PreviousState?.GetType().Name}\n{System.Environment.StackTrace}");
if (focus)
fsm.Enter<FocusedChatState>();
else
Expand All @@ -141,6 +147,7 @@ public void SetToggleState()

public void PopState()
{
Debug.Log($"[PACO] PopState: state={fsm.CurrentState?.GetType().Name}, prev={fsm.PreviousState?.GetType().Name}\n{System.Environment.StackTrace}");
fsm.TryPopState();
}

Expand All @@ -150,6 +157,7 @@ public void PopState()
/// <param name="isVisible"></param>
public void SetVisibility(bool isVisible)
{
Debug.Log($"[PACO] SetVisibility(isVisible={isVisible}): state={fsm.CurrentState?.GetType().Name}\n{System.Environment.StackTrace}");
if (isVisible)
fsm.Enter<DefaultChatState>();
else
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using MVC;
using UnityEngine;

namespace DCL.Chat.ChatStates
{
Expand All @@ -18,6 +19,7 @@ public DefaultChatState(MVCStateMachine<ChatState> chatStateMachine, ChatUIMedia

public void Enter()
{
Debug.Log($"[PACO] >>> DefaultChatState.Enter()\n{System.Environment.StackTrace}");
uiMediator.SetupForDefaultState(animate: true);
uiMediator.chatInputPresenter.OnBlur();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using DCL.Chat.ChatServices;
using MVC;
using UnityEngine;

namespace DCL.Chat.ChatStates
{
Expand All @@ -18,13 +19,15 @@ public FocusedChatState(MVCStateMachine<ChatState> stateMachine, ChatUIMediator

public void Enter()
{
Debug.Log("[PACO] >>> FocusedChatState.Enter()");
mediator.SetupForFocusedState();

inputBlocker.Block();
}

public override void Exit()
{
Debug.Log($"[PACO] <<< FocusedChatState.Exit()\n{System.Environment.StackTrace}");
inputBlocker.Unblock();
}

Expand Down
Loading