Skip to content

Commit 072c698

Browse files
committed
Minor fixes
1 parent ff94361 commit 072c698

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

Explorer/Assets/DCL/Chat/ChatController.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ private void OnSelectConversation(ChatChannel.ChannelId channelId)
365365
if (TryGetView(out var view))
366366
{
367367
view.CurrentChannelId = channelId;
368-
368+
callButtonController.SetCallButtonVisibility(!channelId.Equals(ChatChannel.NEARBY_CHANNEL_ID));
369369
if (channelId.Equals(ChatChannel.NEARBY_CHANNEL_ID))
370370
{
371371
view.SetupViewWithUserState(ChatUserStateUpdater.ChatUserState.CONNECTED);
@@ -396,6 +396,22 @@ private async UniTaskVoid UpdateChatUserStateAsync(string userId, bool updateToo
396396

397397
view.UpdateConversationToolbarStatusIconForUser(userId, offline ? OnlineStatus.OFFLINE : OnlineStatus.ONLINE);
398398
}
399+
400+
CallButtonController.OtherUserCallStatus callStatus = CallButtonController.OtherUserCallStatus.USER_OFFLINE;
401+
402+
switch (userState)
403+
{
404+
case ChatUserStateUpdater.ChatUserState.CONNECTED:
405+
callStatus = CallButtonController.OtherUserCallStatus.USER_AVAILABLE;
406+
break;
407+
case ChatUserStateUpdater.ChatUserState.DISCONNECTED:
408+
callStatus = CallButtonController.OtherUserCallStatus.USER_OFFLINE;
409+
break;
410+
case ChatUserStateUpdater.ChatUserState.PRIVATE_MESSAGES_BLOCKED:
411+
callStatus = CallButtonController.OtherUserCallStatus.USER_REJECTS_CALLS;
412+
break;
413+
}
414+
callButtonController.SetCallStatusForUser(callStatus, userId);
399415
}
400416

401417
#endregion
@@ -721,7 +737,7 @@ private void SubscribeToEvents()
721737
view.CurrentChannelChanged += OnViewCurrentChannelChangedAsync;
722738
view.ConversationSelected += OnSelectConversation;
723739
view.DeleteChatHistoryRequested += OnViewDeleteChatHistoryRequested;
724-
740+
725741
}
726742

727743
chatHistory.ChannelAdded += OnChatHistoryChannelAdded;

Explorer/Assets/DCL/VoiceChat/CallButtonController.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,19 @@ public CallButtonController(CallButtonView view)
2222
this.view.CallButton.onClick.AddListener(OnCallButtonClicked);
2323
}
2424

25+
public void SetCallButtonVisibility(bool isVisible)
26+
{
27+
view.gameObject.SetActive(isVisible);
28+
view.TooltipParent.gameObject.SetActive(false);
29+
isClickedOnce = false;
30+
}
31+
2532
public void SetCallStatusForUser(OtherUserCallStatus status, string userId)
2633
{
2734
currentUserId = userId;
2835
otherUserStatus = status;
2936
view.TooltipParent.gameObject.SetActive(false);
37+
isClickedOnce = false;
3038
}
3139

3240
private void OnCallButtonClicked()

0 commit comments

Comments
 (0)