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 @@ -839,7 +839,6 @@ await MapRendererContainer
staticContainer.SceneRestrictionBusController,
uiShellContainer.MainUIView.SidebarView.NearbyVoiceChatButton,
uiShellContainer.MainUIView.SidebarView.NearbyVoiceWidget,
uiShellContainer.MainUIView.SidebarView.NearbyVoiceTip,
bootstrapContainer.VolumeBus,
userBlockingCache,
voiceChatContainer.NearbyMuteService,
Expand Down
49 changes: 0 additions & 49 deletions Explorer/Assets/DCL/PluginSystem/Global/VoiceChatPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public class VoiceChatPlugin : IDCLGlobalPlugin<VoiceChatPlugin.Settings>
private readonly IUserBlockingCache userBlockingCache;
private readonly NearbyVoiceChatButtonView nearbyVoiceChatButtonView;
private readonly NearbyVoiceWidgetView nearbyVoiceWidgetView;
private readonly NearbyVoiceTipView nearbyVoiceTipView;
private readonly ILoadingStatus loadingStatus;
private readonly IScenesCache scenesCache;
private readonly ISceneRestrictionBusController sceneRestrictionBusController;
Expand All @@ -85,7 +84,6 @@ public class VoiceChatPlugin : IDCLGlobalPlugin<VoiceChatPlugin.Settings>
private NearbyMicrophoneAudioToggleHandler? nearbyMicrophoneAudioToggleHandler;
private NearbyVoiceChatButtonController? nearbyButtonController;
private NearbyVoiceWidgetController? nearbyWidgetController;
private CancellationTokenSource? nearbyTipCts;
private VoiceChatConfiguration voiceChatConfiguration;

public VoiceChatPlugin(
Expand All @@ -106,7 +104,6 @@ public VoiceChatPlugin(
ISceneRestrictionBusController sceneRestrictionBusController,
NearbyVoiceChatButtonView nearbyVoiceChatButtonView,
NearbyVoiceWidgetView nearbyVoiceWidgetView,
NearbyVoiceTipView nearbyVoiceTipView,
VolumeBus volumeBus,
IUserBlockingCache userBlockingCache,
NearbyMuteService? nearbyMuteService = null,
Expand All @@ -131,15 +128,13 @@ public VoiceChatPlugin(
this.sceneRestrictionBusController = sceneRestrictionBusController;
this.nearbyVoiceChatButtonView = nearbyVoiceChatButtonView;
this.nearbyVoiceWidgetView = nearbyVoiceWidgetView;
this.nearbyVoiceTipView = nearbyVoiceTipView;
this.volumeBus = volumeBus;

voiceChatOrchestrator = voiceChatContainer.VoiceChatOrchestrator;
}

public void Dispose()
{
nearbyTipCts.SafeCancelAndDispose();
pluginScope.Dispose();

if (voiceChatPluginSettingsAsset.Value != null)
Expand Down Expand Up @@ -258,20 +253,9 @@ public async UniTask InitializeAsync(Settings settings, CancellationToken ct)

nearbyWidgetController = new NearbyVoiceWidgetController(nearbyVoiceWidgetView, stateModel, voiceChatConfiguration.ChatAudioMixerGroup, volumeBus);
pluginScope.Add(nearbyWidgetController);

// Intro FLUX
nearbyTipCts = new CancellationTokenSource();
RunNearbyVoiceTipAsync(nearbyVoiceTipView, loadingStatus, nearbyVoiceChatButtonView, nearbyTipCts.Token).Forget();
}
}

private static async UniTaskVoid RunNearbyVoiceTipAsync(NearbyVoiceTipView view, ILoadingStatus loadingStatus,
NearbyVoiceChatButtonView buttonView, CancellationToken ct)
{
if (await NearbyVoiceTipFlow.WaitAndShowAsync(view, loadingStatus, ct))
buttonView.Button.onClick.Invoke();
}

[Serializable]
public class Settings : IDCLPluginSettings
{
Expand All @@ -283,38 +267,5 @@ public class VoiceChatConfigurationsReference : AssetReferenceT<VoiceChatPluginS
public VoiceChatConfigurationsReference(string guid) : base(guid) { }
}
}

private static class NearbyVoiceTipFlow
{
public static async UniTask<bool> WaitAndShowAsync(NearbyVoiceTipView view, ILoadingStatus loadingStatus, CancellationToken ct)
{
view.Hide();

if (DCLPlayerPrefs.GetBool(DCLPrefKeys.NEARBY_VOICE_TIP_DISMISSED))
return false;

try
{
await UniTask.WaitUntil(
() => loadingStatus.CurrentStage.Value == LoadingStatus.LoadingStage.Completed,
cancellationToken: ct);

view.Show();

int winner = await UniTask.WhenAny(
view.CloseButton.OnClickAsync(ct),
view.TryItNowButton.OnClickAsync(ct));

DCLPlayerPrefs.SetBool(DCLPrefKeys.NEARBY_VOICE_TIP_DISMISSED, true, save: true);
view.Hide();

return winner == 1;
}
catch (OperationCanceledException)
{
return false;
}
}
}
}
}
Loading