From 4b977fef24f866d907f14250bebd52d8e3329dd2 Mon Sep 17 00:00:00 2001 From: Juan Molteni Date: Wed, 22 Jul 2026 22:20:09 -0300 Subject: [PATCH 1/8] fix: stop lint flagging PascalCase enum members as UPPER_CASE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The style guide (docs/code-style-guidelines.md § Naming Conventions) says enumerations and their enumerators are PascalCase, but ReSharper swept enum members into the CAPITALS_SNAKE_CASE constants rule (enum members are const fields to the analyzer), flagging every PascalCase member of 265 enums. Add an explicit 'Enum members' naming rule (PascalCase) to the shared .editorconfig so the warning stops firing. No code renames. Co-Authored-By: Claude Fable 5 --- Explorer/.editorconfig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Explorer/.editorconfig b/Explorer/.editorconfig index 29d1f720dbe..538b406a60e 100644 --- a/Explorer/.editorconfig +++ b/Explorer/.editorconfig @@ -61,6 +61,12 @@ dotnet_naming_rule.interfaces_should_be_pascal_case_with_i_prefix.symbols = inte dotnet_naming_rule.interfaces_should_be_pascal_case_with_i_prefix.style = i_prefix_pascal_case_style dotnet_naming_rule.interfaces_should_be_pascal_case_with_i_prefix.severity = warning +# Enum members are PascalCase (docs/code-style-guidelines.md § Naming Conventions: +# "Enumeration and its Enumerators -> PascalCase"). Enum members are const fields to +# the analyzer, so without this explicit rule ReSharper sweeps them into the +# CAPITALS_SNAKE_CASE constants rule below. +resharper_csharp_naming_rule.enum_member = AaBb + #### CAPITALS_SNAKE_CASE #### dotnet_naming_style.capital_snake_case_style.capitalization = all_upper From c73e016b8797fd2120607d16ed4eff5f4cc621b3 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Thu, 23 Jul 2026 10:34:08 -0300 Subject: [PATCH 2/8] Dummy change Signed-off-by: Juan Ignacio Molteni --- Explorer/Assets/DCL/FeatureFlags/FeatureFlagsStrings.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Explorer/Assets/DCL/FeatureFlags/FeatureFlagsStrings.cs b/Explorer/Assets/DCL/FeatureFlags/FeatureFlagsStrings.cs index bb88ba13923..46a9a6db041 100644 --- a/Explorer/Assets/DCL/FeatureFlags/FeatureFlagsStrings.cs +++ b/Explorer/Assets/DCL/FeatureFlags/FeatureFlagsStrings.cs @@ -97,6 +97,7 @@ public static class Endpoints public enum FeatureFlag { + None = 0, MultiplayerCompressionWin, MultiplayerCompressionMac, From ffaa0641b682d01f51a96bdb455bd0a799c60665 Mon Sep 17 00:00:00 2001 From: Vitaly Popuzin Date: Thu, 23 Jul 2026 16:43:10 +0200 Subject: [PATCH 3/8] moved enum rules to the DotSettings --- Explorer/.editorconfig | 7 ------- Explorer/Explorer.sln.DotSettings | 1 + 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/Explorer/.editorconfig b/Explorer/.editorconfig index 538b406a60e..ae11f6c248e 100644 --- a/Explorer/.editorconfig +++ b/Explorer/.editorconfig @@ -61,13 +61,6 @@ dotnet_naming_rule.interfaces_should_be_pascal_case_with_i_prefix.symbols = inte dotnet_naming_rule.interfaces_should_be_pascal_case_with_i_prefix.style = i_prefix_pascal_case_style dotnet_naming_rule.interfaces_should_be_pascal_case_with_i_prefix.severity = warning -# Enum members are PascalCase (docs/code-style-guidelines.md § Naming Conventions: -# "Enumeration and its Enumerators -> PascalCase"). Enum members are const fields to -# the analyzer, so without this explicit rule ReSharper sweeps them into the -# CAPITALS_SNAKE_CASE constants rule below. -resharper_csharp_naming_rule.enum_member = AaBb - - #### CAPITALS_SNAKE_CASE #### dotnet_naming_style.capital_snake_case_style.capitalization = all_upper diff --git a/Explorer/Explorer.sln.DotSettings b/Explorer/Explorer.sln.DotSettings index 7ba8e7a8064..703415e4d80 100644 --- a/Explorer/Explorer.sln.DotSettings +++ b/Explorer/Explorer.sln.DotSettings @@ -517,6 +517,7 @@ <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Types and namespaces"><ElementKinds><Kind Name="NAMESPACE" /><Kind Name="CLASS" /><Kind Name="STRUCT" /><Kind Name="ENUM" /><Kind Name="DELEGATE" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="" Suffix="" Style="AA_BB" /></Policy></Policy> <Policy><Descriptor Staticness="Instance" AccessRightKinds="Public" Description="Unity serialized field (Public)"><ElementKinds><Kind Name="UNITY_SERIALISED_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy> <Policy><Descriptor Staticness="Instance" AccessRightKinds="Private, Protected, ProtectedInternal" Description="Unity serialized field (Non-public)"><ElementKinds><Kind Name="UNITY_SERIALISED_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Enum member"><ElementKinds><Kind Name="ENUM_MEMBER" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy> True True True From a0e938d8cb3c0d7a68d913fd6bc2f88f2d023bb7 Mon Sep 17 00:00:00 2001 From: Vitaly Popuzin Date: Thu, 23 Jul 2026 18:16:06 +0200 Subject: [PATCH 4/8] validating new enum rule --- .../Editor/TriggerEmotePlayableBehaviour.cs | 2 +- .../Systems/InstantiateRandomAvatarsSystem.cs | 4 +- .../Emotes/Components/CharacterEmoteIntent.cs | 10 +- .../Emotes/Systems/UpdateEmoteInputSystem.cs | 2 +- .../Tests/UpdateEmoteInputSystemShould.cs | 2 +- .../CharacterPreviewController.cs | 2 +- .../Donations/UI/DonationsPanelController.cs | 2 +- .../DCL/FeatureFlags/FeaturesRegistry.cs | 2 +- .../InWorldCamera/ScreenRecorder.cs | 18 +-- .../Systems/CaptureScreenshotSystem.cs | 6 +- .../RestrictedActions/GlobalWorldActions.cs | 2 +- .../RestrictedActionsAPIImplementation.cs | 2 +- .../Tests/GlobalWorldActionsShould.cs | 2 +- .../EventBased/NearbyVoiceChatAnalytics.cs | 14 +-- .../Systems/AnalyticsEmotesSystem.cs | 2 +- .../PluginSystem/Global/VoiceChatPlugin.cs | 4 +- .../Systems/AvatarShapeHandlerSystem.cs | 2 +- .../Tests/AvatarShapeHandlerSystemShould.cs | 6 +- .../Configuration/SettingsModuleBindings.cs | 2 +- .../Assets/DCL/Settings/SettingsController.cs | 4 +- .../NearbyMicrophoneAudioToggleHandler.cs | 10 +- .../Core/NearbyMicrophoneHandler.cs | 24 ++-- .../Core/NearbyVoiceBannedPlayerWatcher.cs | 4 +- .../Core/NearbyVoiceChatStateModel.cs | 48 ++++---- .../Core/NearbyVoiceChatSuppressor.cs | 10 +- .../NearbyVoiceSceneRestrictionWatcher.cs | 4 +- .../Systems/NearbyAudioCleanupSystem.cs | 2 +- .../Systems/NearbyVoiceChatDebugSystem.cs | 8 +- .../Systems/NearbyVoiceChatNametagSystem.cs | 2 +- .../NearbyAudioBindingSystemShould.cs | 10 +- .../NearbyAudioCleanupSystemShould.cs | 4 +- ...earbyMicrophoneAudioToggleHandlerShould.cs | 36 +++--- .../NearbyVoiceBannedPlayerWatcherShould.cs | 26 ++--- .../NearbyVoiceChatAnalyticsShould.cs | 46 ++++---- .../EditMode/NearbyVoiceChatManagerShould.cs | 18 +-- .../NearbyVoiceChatNametagSystemShould.cs | 12 +- .../NearbyVoiceChatStateModelShould.cs | 108 +++++++++--------- .../NearbyAudioFullCycleManualTest.cs | 28 ++--- .../NearbyAudioFullCyclePerformanceTest.cs | 2 +- ...byVoiceChatNametagSystemPerformanceTest.cs | 2 +- .../UI/NearbyVoiceChatButtonController.cs | 10 +- .../UI/NearbyVoiceChatButtonView.cs | 14 +-- .../UI/NearbyVoiceWidgetController.cs | 16 +-- .../DCL/VoiceChat/VoiceChatContainer.cs | 4 +- 44 files changed, 269 insertions(+), 269 deletions(-) diff --git a/Explorer/Assets/DCL/AvatarAnimation/Editor/TriggerEmotePlayableBehaviour.cs b/Explorer/Assets/DCL/AvatarAnimation/Editor/TriggerEmotePlayableBehaviour.cs index 85d74f8f8c6..6e3834a981f 100644 --- a/Explorer/Assets/DCL/AvatarAnimation/Editor/TriggerEmotePlayableBehaviour.cs +++ b/Explorer/Assets/DCL/AvatarAnimation/Editor/TriggerEmotePlayableBehaviour.cs @@ -39,7 +39,7 @@ public override void ProcessFrame(Playable playable, FrameData info, object play profile.IsDirty = true; // It adds the emote intent (which will be consumed and removed by the CharacterEmoteSystem) if it was not already added - CharacterEmoteIntent emoteIntent = new (){ EmoteId = URN, TriggerSource = TriggerSource.SELF, Spatial = true}; + CharacterEmoteIntent emoteIntent = new (){ EmoteId = URN, TriggerSource = TriggerSource.Self, Spatial = true}; GlobalWorld.ECSWorldInstance.Add(cachedEntity, emoteIntent); } } diff --git a/Explorer/Assets/DCL/AvatarRendering/AvatarShape/DemoScripts/Systems/InstantiateRandomAvatarsSystem.cs b/Explorer/Assets/DCL/AvatarRendering/AvatarShape/DemoScripts/Systems/InstantiateRandomAvatarsSystem.cs index 697181838ef..fb2a1a6fd3d 100644 --- a/Explorer/Assets/DCL/AvatarRendering/AvatarShape/DemoScripts/Systems/InstantiateRandomAvatarsSystem.cs +++ b/Explorer/Assets/DCL/AvatarRendering/AvatarShape/DemoScripts/Systems/InstantiateRandomAvatarsSystem.cs @@ -334,7 +334,7 @@ private void CreateAvatar(ICharacterControllerSettings characterControllerSettin new RandomAvatar()); if (hasEmote) - World.Add(entity, new CharacterEmoteIntent { EmoteId = new URN(EMOTE_URN_PREFIX + emoteDropdownBinding.Value), Spatial = true, TriggerSource = TriggerSource.SELF }); + World.Add(entity, new CharacterEmoteIntent { EmoteId = new URN(EMOTE_URN_PREFIX + emoteDropdownBinding.Value), Spatial = true, TriggerSource = TriggerSource.Self }); } else { @@ -366,7 +366,7 @@ private void CreateAvatar(ICharacterControllerSettings characterControllerSettin ); if (hasEmote) - World.Add(entity, new CharacterEmoteIntent { EmoteId = new URN(EMOTE_URN_PREFIX + emoteDropdownBinding.Value), Spatial = true, TriggerSource = TriggerSource.SELF }); + World.Add(entity, new CharacterEmoteIntent { EmoteId = new URN(EMOTE_URN_PREFIX + emoteDropdownBinding.Value), Spatial = true, TriggerSource = TriggerSource.Self }); } } diff --git a/Explorer/Assets/DCL/AvatarRendering/Emotes/Components/CharacterEmoteIntent.cs b/Explorer/Assets/DCL/AvatarRendering/Emotes/Components/CharacterEmoteIntent.cs index 47ff1d0374a..4260d3af7b5 100644 --- a/Explorer/Assets/DCL/AvatarRendering/Emotes/Components/CharacterEmoteIntent.cs +++ b/Explorer/Assets/DCL/AvatarRendering/Emotes/Components/CharacterEmoteIntent.cs @@ -6,10 +6,10 @@ namespace DCL.AvatarRendering.Emotes { public enum TriggerSource { - PREVIEW, - SELF, - REMOTE, - SCENE, + Preview, + Self, + Remote, + Scene, } public struct CharacterEmoteIntent @@ -25,7 +25,7 @@ public void UpdateRemoteId(URN emoteId) { this.EmoteId = emoteId; this.Spatial = true; - this.TriggerSource = TriggerSource.REMOTE; + this.TriggerSource = TriggerSource.Remote; } public bool UpdatePlayTimeout(float dt) diff --git a/Explorer/Assets/DCL/AvatarRendering/Emotes/Systems/UpdateEmoteInputSystem.cs b/Explorer/Assets/DCL/AvatarRendering/Emotes/Systems/UpdateEmoteInputSystem.cs index ae11a54301a..ffd47d80869 100644 --- a/Explorer/Assets/DCL/AvatarRendering/Emotes/Systems/UpdateEmoteInputSystem.cs +++ b/Explorer/Assets/DCL/AvatarRendering/Emotes/Systems/UpdateEmoteInputSystem.cs @@ -99,7 +99,7 @@ private void TriggerEmote([Data] int emoteIndex, if (emoteId.IsNullOrEmpty()) return; - var newEmoteIntent = new CharacterEmoteIntent { EmoteId = emoteId, Spatial = true, TriggerSource = TriggerSource.SELF}; + var newEmoteIntent = new CharacterEmoteIntent { EmoteId = emoteId, Spatial = true, TriggerSource = TriggerSource.Self}; ref var emoteIntent = ref World.AddOrGet(entity, newEmoteIntent); emoteIntent = newEmoteIntent; } diff --git a/Explorer/Assets/DCL/AvatarRendering/Emotes/Tests/UpdateEmoteInputSystemShould.cs b/Explorer/Assets/DCL/AvatarRendering/Emotes/Tests/UpdateEmoteInputSystemShould.cs index 19daedc0f31..d7d0b7fcb9d 100644 --- a/Explorer/Assets/DCL/AvatarRendering/Emotes/Tests/UpdateEmoteInputSystemShould.cs +++ b/Explorer/Assets/DCL/AvatarRendering/Emotes/Tests/UpdateEmoteInputSystemShould.cs @@ -95,7 +95,7 @@ public void TriggerEmoteBySlotIntent() Assert.IsTrue(world.Has(entity)); var intent = world.Get(entity); Assert.AreEqual("urn:decentraland:off-chain:base-avatars:wave", intent.EmoteId.ToString()); - Assert.AreEqual(TriggerSource.SELF, intent.TriggerSource); + Assert.AreEqual(TriggerSource.Self, intent.TriggerSource); Assert.IsTrue(intent.Spatial); Assert.IsFalse(world.Has(entity), "TriggerEmoteBySlotIntent should be removed after processing"); } diff --git a/Explorer/Assets/DCL/Character/CharacterPreview/CharacterPreviewController.cs b/Explorer/Assets/DCL/Character/CharacterPreview/CharacterPreviewController.cs index 85ffefc06e1..350c880a19b 100644 --- a/Explorer/Assets/DCL/Character/CharacterPreview/CharacterPreviewController.cs +++ b/Explorer/Assets/DCL/Character/CharacterPreview/CharacterPreviewController.cs @@ -149,7 +149,7 @@ public bool IsAvatarLoaded() => public void PlayEmote(string emoteId) { - var intent = new CharacterEmoteIntent { EmoteId = emoteId, TriggerSource = TriggerSource.PREVIEW }; + var intent = new CharacterEmoteIntent { EmoteId = emoteId, TriggerSource = TriggerSource.Preview }; if (globalWorld.Has(characterPreviewEntity)) globalWorld.Set(characterPreviewEntity, intent); diff --git a/Explorer/Assets/DCL/Donations/UI/DonationsPanelController.cs b/Explorer/Assets/DCL/Donations/UI/DonationsPanelController.cs index ac39fe8c206..5c664e2ffde 100644 --- a/Explorer/Assets/DCL/Donations/UI/DonationsPanelController.cs +++ b/Explorer/Assets/DCL/Donations/UI/DonationsPanelController.cs @@ -134,7 +134,7 @@ private void PlayEmoteByUrn(URN emoteUrn) { EmoteId = emoteUrn, Spatial = true, - TriggerSource = TriggerSource.SELF + TriggerSource = TriggerSource.Self }); } diff --git a/Explorer/Assets/DCL/FeatureFlags/FeaturesRegistry.cs b/Explorer/Assets/DCL/FeatureFlags/FeaturesRegistry.cs index 7fddcd00e55..75b9c2b3469 100644 --- a/Explorer/Assets/DCL/FeatureFlags/FeaturesRegistry.cs +++ b/Explorer/Assets/DCL/FeatureFlags/FeaturesRegistry.cs @@ -139,7 +139,7 @@ public enum FeatureId { // Numbered because we use these to selectively enable settings, // this way we avoid breaking that if we ever change the order here. - NONE = 0, + None = 0, VOICE_CHAT = 1, COMMUNITY_VOICE_CHAT = 2, FRIENDS = 3, diff --git a/Explorer/Assets/DCL/InWorldCamera/InWorldCamera/ScreenRecorder.cs b/Explorer/Assets/DCL/InWorldCamera/InWorldCamera/ScreenRecorder.cs index bfb6163ed6b..66d5c0cd40e 100644 --- a/Explorer/Assets/DCL/InWorldCamera/InWorldCamera/ScreenRecorder.cs +++ b/Explorer/Assets/DCL/InWorldCamera/InWorldCamera/ScreenRecorder.cs @@ -8,10 +8,10 @@ namespace DCL.InWorldCamera { public enum RecordingState { - UNKNOWN = 0, - IDLE = 1, - CAPTURING = 2, - SCREENSHOT_READY = 3, + Unknown = 0, + Idle = 1, + Capturing = 2, + ScreenshotReady = 3, } public sealed class ScreenRecorder : IDisposable @@ -32,7 +32,7 @@ public sealed class ScreenRecorder : IDisposable private ScreenFrameData debugTargetScreenFrame; - public RecordingState State { get; private set; } = RecordingState.IDLE; + public RecordingState State { get; private set; } = RecordingState.Idle; public ScreenRecorder(RectTransform canvasRectTransform) { @@ -53,7 +53,7 @@ public void Dispose() public IEnumerator CaptureScreenshot() { - State = RecordingState.CAPTURING; + State = RecordingState.Capturing; yield return GameObjectExtensions.WAIT_FOR_END_OF_FRAME; // for UI to appear on screenshot. Converting to UniTask didn't work :( @@ -76,7 +76,7 @@ public IEnumerator CaptureScreenshot() Object.Destroy(screenshotTexture); Object.Destroy(newScreenShot); - State = RecordingState.SCREENSHOT_READY; + State = RecordingState.ScreenshotReady; } private void UpscaleTexture2D(Texture2D sourceTexture, int upscaleFactor) @@ -103,10 +103,10 @@ private void UpscaleTexture2D(Texture2D sourceTexture, int upscaleFactor) public Texture2D? GetScreenshotAndReset() { - if (State != RecordingState.SCREENSHOT_READY) + if (State != RecordingState.ScreenshotReady) return null; - State = RecordingState.IDLE; + State = RecordingState.Idle; return screenshot; } diff --git a/Explorer/Assets/DCL/InWorldCamera/InWorldCamera/Systems/CaptureScreenshotSystem.cs b/Explorer/Assets/DCL/InWorldCamera/InWorldCamera/Systems/CaptureScreenshotSystem.cs index a2f373df8f8..83f5965750f 100644 --- a/Explorer/Assets/DCL/InWorldCamera/InWorldCamera/Systems/CaptureScreenshotSystem.cs +++ b/Explorer/Assets/DCL/InWorldCamera/InWorldCamera/Systems/CaptureScreenshotSystem.cs @@ -74,10 +74,10 @@ protected override void OnDispose() protected override void Update(float t) { - if (recorder.State == RecordingState.CAPTURING || hudController.IsVfxInProgress) + if (recorder.State == RecordingState.Capturing || hudController.IsVfxInProgress) return; - if (recorder.State == RecordingState.SCREENSHOT_READY && metadataBuilder.MetadataIsReady) + if (recorder.State == RecordingState.ScreenshotReady && metadataBuilder.MetadataIsReady) { ProcessCapturedScreenshot(); return; @@ -111,7 +111,7 @@ private void ProcessCapturedScreenshot() private bool ScreenshotIsRequested() { - if (recorder.State != RecordingState.IDLE) return false; + if (recorder.State != RecordingState.Idle) return false; if (World.TryGet(camera, out TakeScreenshotRequest request)) { diff --git a/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/RestrictedActions/GlobalWorldActions.cs b/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/RestrictedActions/GlobalWorldActions.cs index 539941804c3..5160297bafe 100644 --- a/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/RestrictedActions/GlobalWorldActions.cs +++ b/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/RestrictedActions/GlobalWorldActions.cs @@ -102,7 +102,7 @@ public void RotateCamera(Vector3? newCameraTarget, Vector3 newPlayerPosition) public void TriggerEmote(URN urn, bool isLooping, AvatarEmoteMask mask) { // If it's just Add() there are inconsistencies when the intent is processed at CharacterEmoteSystem for rapidly triggered emotes... - world.AddOrSet(playerEntity, new CharacterEmoteIntent { EmoteId = urn, Spatial = true, TriggerSource = TriggerSource.SCENE, Mask = mask }); + world.AddOrSet(playerEntity, new CharacterEmoteIntent { EmoteId = urn, Spatial = true, TriggerSource = TriggerSource.Scene, Mask = mask }); } public async UniTask<(URN Urn, bool IsLooping)?> TriggerSceneEmoteAsync(ISceneData sceneData, string src, string hash, bool loop, AvatarEmoteMask mask, diff --git a/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/RestrictedActions/RestrictedActionsAPIImplementation.cs b/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/RestrictedActions/RestrictedActionsAPIImplementation.cs index 32f001023ed..027b4d20213 100644 --- a/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/RestrictedActions/RestrictedActionsAPIImplementation.cs +++ b/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/RestrictedActions/RestrictedActionsAPIImplementation.cs @@ -180,7 +180,7 @@ private void TriggerMaskedEmoteOnSceneWorld(CommunicationData.URLHelpers.URN urn { EmoteId = urn, Spatial = true, - TriggerSource = TriggerSource.SCENE, + TriggerSource = TriggerSource.Scene, Mask = mask, }); } diff --git a/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/RestrictedActions/Tests/GlobalWorldActionsShould.cs b/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/RestrictedActions/Tests/GlobalWorldActionsShould.cs index 0e97ede6ac4..a0b790f4ffc 100644 --- a/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/RestrictedActions/Tests/GlobalWorldActionsShould.cs +++ b/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/RestrictedActions/Tests/GlobalWorldActionsShould.cs @@ -198,7 +198,7 @@ public void AddIntentAndSendMessageWhenAvatarVisible() var intent = world.Get(playerEntity); Assert.AreEqual(emoteUrn, intent.EmoteId); Assert.IsTrue(intent.Spatial); - Assert.AreEqual(TriggerSource.SCENE, intent.TriggerSource); + Assert.AreEqual(TriggerSource.Scene, intent.TriggerSource); } [Test] diff --git a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/EventBased/NearbyVoiceChatAnalytics.cs b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/EventBased/NearbyVoiceChatAnalytics.cs index 8a85bc1fc9b..0897b23de16 100644 --- a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/EventBased/NearbyVoiceChatAnalytics.cs +++ b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/EventBased/NearbyVoiceChatAnalytics.cs @@ -42,14 +42,14 @@ private void OnStateChanged(NearbyVoiceChatState next) prevState = next; // IDLE → SPEAKING: dispatch by activation. FOCUS_RESUMED is a continuation, not a fresh use. - if (prev == NearbyVoiceChatState.IDLE && next == NearbyVoiceChatState.OPEN_MIC) + if (prev == NearbyVoiceChatState.Idle && next == NearbyVoiceChatState.OpenMic) { switch (stateModel.CurrentActivation) { - case NearbyVoiceActivation.BUTTON: + case NearbyVoiceActivation.Button: TrackSpeakButton(enabled: true); break; - case NearbyVoiceActivation.PUSH_TO_TALK: + case NearbyVoiceActivation.PushToTalk: analytics.Track(AnalyticsEvents.VoiceChat.NEARBY_VOICE_SPEAK_PTT); break; } @@ -57,8 +57,8 @@ private void OnStateChanged(NearbyVoiceChatState next) } // SPEAKING → IDLE: button-toggle off. Skip suppression-driven stops (call/scene/loading) — system, not user. - if (prev == NearbyVoiceChatState.OPEN_MIC && next == NearbyVoiceChatState.IDLE - && stateModel.CurrentActivation == NearbyVoiceActivation.BUTTON + if (prev == NearbyVoiceChatState.OpenMic && next == NearbyVoiceChatState.Idle + && stateModel.CurrentActivation == NearbyVoiceActivation.Button && stateModel.ActiveSuppression.Value == null) { TrackSpeakButton(enabled: false); @@ -69,9 +69,9 @@ private void OnStateChanged(NearbyVoiceChatState next) // - Disable() is unconditional, so toggle-off can fire from IDLE or SPEAKING. // - Enable() is gated to DISABLED, so toggle-on is only DISABLED → IDLE. // Transitions involving SUPPRESSED are system-driven (call/scene/loading) and are skipped. - if (next == NearbyVoiceChatState.DISABLED && prev is NearbyVoiceChatState.IDLE or NearbyVoiceChatState.OPEN_MIC) + if (next == NearbyVoiceChatState.Disabled && prev is NearbyVoiceChatState.Idle or NearbyVoiceChatState.OpenMic) TrackToggle(enabled: false); - else if (prev == NearbyVoiceChatState.DISABLED && next == NearbyVoiceChatState.IDLE) + else if (prev == NearbyVoiceChatState.Disabled && next == NearbyVoiceChatState.Idle) TrackToggle(enabled: true); } diff --git a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/Systems/AnalyticsEmotesSystem.cs b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/Systems/AnalyticsEmotesSystem.cs index 698afb19d15..e762054689f 100644 --- a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/Systems/AnalyticsEmotesSystem.cs +++ b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/Systems/AnalyticsEmotesSystem.cs @@ -38,7 +38,7 @@ protected override void Update(float t) if (World.TryGet(playerEntity, out var emoteIntent)) { - if (emoteIntent.TriggerSource is TriggerSource.REMOTE or TriggerSource.PREVIEW) + if (emoteIntent.TriggerSource is TriggerSource.Remote or TriggerSource.Preview) return; if (lastEmoteId != emoteIntent.EmoteId) diff --git a/Explorer/Assets/DCL/PluginSystem/Global/VoiceChatPlugin.cs b/Explorer/Assets/DCL/PluginSystem/Global/VoiceChatPlugin.cs index a2580784aa4..3954a740dd1 100644 --- a/Explorer/Assets/DCL/PluginSystem/Global/VoiceChatPlugin.cs +++ b/Explorer/Assets/DCL/PluginSystem/Global/VoiceChatPlugin.cs @@ -231,8 +231,8 @@ public async UniTask InitializeAsync(Settings settings, CancellationToken ct) // Persist the user's on/off preference of the nearby chat. stateModel.State.Subscribe(newState => { - if (newState is NearbyVoiceChatState.DISABLED or NearbyVoiceChatState.IDLE) - DCLPlayerPrefs.SetBool(DCLPrefKeys.NEARBY_VOICE_CHAT_DISABLED, newState == NearbyVoiceChatState.DISABLED); + if (newState is NearbyVoiceChatState.Disabled or NearbyVoiceChatState.Idle) + DCLPlayerPrefs.SetBool(DCLPrefKeys.NEARBY_VOICE_CHAT_DISABLED, newState == NearbyVoiceChatState.Disabled); }); var sceneRestrictionWatcher = new NearbyVoiceSceneRestrictionWatcher(scenesCache, sceneRestrictionBusController, stateModel); diff --git a/Explorer/Assets/DCL/SDKComponents/AvatarShape/Systems/AvatarShapeHandlerSystem.cs b/Explorer/Assets/DCL/SDKComponents/AvatarShape/Systems/AvatarShapeHandlerSystem.cs index 483c56c4744..170988f9420 100644 --- a/Explorer/Assets/DCL/SDKComponents/AvatarShape/Systems/AvatarShapeHandlerSystem.cs +++ b/Explorer/Assets/DCL/SDKComponents/AvatarShape/Systems/AvatarShapeHandlerSystem.cs @@ -226,7 +226,7 @@ private void ProcessSceneEmotePromiseResult(Entity globalWorldEntity, Streamable { EmoteId = emoteUrn, Spatial = true, - TriggerSource = TriggerSource.SCENE, + TriggerSource = TriggerSource.Scene, }); } } diff --git a/Explorer/Assets/DCL/SDKComponents/AvatarShape/Tests/AvatarShapeHandlerSystemShould.cs b/Explorer/Assets/DCL/SDKComponents/AvatarShape/Tests/AvatarShapeHandlerSystemShould.cs index 566ee8ddfe8..42450f4f194 100644 --- a/Explorer/Assets/DCL/SDKComponents/AvatarShape/Tests/AvatarShapeHandlerSystemShould.cs +++ b/Explorer/Assets/DCL/SDKComponents/AvatarShape/Tests/AvatarShapeHandlerSystemShould.cs @@ -220,7 +220,7 @@ public void TriggersLocalSceneEmote() var characterEmoteIntent = globalWorld.Get(globalEntity); Assert.AreEqual(emoteUrn, characterEmoteIntent.EmoteId); Assert.IsTrue(characterEmoteIntent.Spatial); - Assert.AreEqual(TriggerSource.SCENE, characterEmoteIntent.TriggerSource); + Assert.AreEqual(TriggerSource.Scene, characterEmoteIntent.TriggerSource); } [Test] @@ -311,7 +311,7 @@ public void TriggersRealmSceneEmote() var characterEmoteIntent = globalWorld.Get(globalEntity); Assert.AreEqual(emoteUrn, characterEmoteIntent.EmoteId); Assert.IsTrue(characterEmoteIntent.Spatial); - Assert.AreEqual(TriggerSource.SCENE, characterEmoteIntent.TriggerSource); + Assert.AreEqual(TriggerSource.Scene, characterEmoteIntent.TriggerSource); } [Test] @@ -564,7 +564,7 @@ public void InterruptPreviouslyLoadingEmote() var characterEmoteIntent = globalWorld.Get(globalEntity); Assert.AreEqual(emoteUrn, characterEmoteIntent.EmoteId); Assert.IsTrue(characterEmoteIntent.Spatial); - Assert.AreEqual(TriggerSource.SCENE, characterEmoteIntent.TriggerSource); + Assert.AreEqual(TriggerSource.Scene, characterEmoteIntent.TriggerSource); } } } diff --git a/Explorer/Assets/DCL/Settings/Configuration/SettingsModuleBindings.cs b/Explorer/Assets/DCL/Settings/Configuration/SettingsModuleBindings.cs index e1db2bf283e..a47b078fa75 100644 --- a/Explorer/Assets/DCL/Settings/Configuration/SettingsModuleBindings.cs +++ b/Explorer/Assets/DCL/Settings/Configuration/SettingsModuleBindings.cs @@ -24,7 +24,7 @@ namespace DCL.Settings.Configuration public abstract class SettingsModuleBindingBase { [field: SerializeField] - public FeatureId FeatureId { get; set; } = FeatureId.NONE; + public FeatureId FeatureId { get; set; } = FeatureId.None; public abstract UniTask CreateModuleAsync( Transform parent, diff --git a/Explorer/Assets/DCL/Settings/SettingsController.cs b/Explorer/Assets/DCL/Settings/SettingsController.cs index 60d7c21652b..e932fcb2fd5 100644 --- a/Explorer/Assets/DCL/Settings/SettingsController.cs +++ b/Explorer/Assets/DCL/Settings/SettingsController.cs @@ -162,7 +162,7 @@ private async UniTask GenerateSettingsSectionAsync(SettingsSectionConfig section if (group.FeatureFlagName != FeatureFlag.None && !FeatureFlagsConfiguration.Instance.IsEnabled(group.FeatureFlagName.GetStringValue())) return; - if (group.FeatureId != FeatureId.NONE && !FeaturesRegistry.Instance.IsEnabled(group.FeatureId)) return; + if (group.FeatureId != FeatureId.None && !FeaturesRegistry.Instance.IsEnabled(group.FeatureId)) return; SettingsGroupView generalGroupView = (await assetsProvisioner.ProvideInstanceAsync(settingsMenuConfiguration.SettingsGroupPrefab!, sectionContainer)).Value; @@ -174,7 +174,7 @@ private async UniTask GenerateSettingsSectionAsync(SettingsSectionConfig section foreach (SettingsModuleBindingBase module in group.Modules) if (module != null) { - if (module.FeatureId != FeatureId.NONE && !FeaturesRegistry.Instance.IsEnabled(module.FeatureId)) + if (module.FeatureId != FeatureId.None && !FeaturesRegistry.Instance.IsEnabled(module.FeatureId)) continue; var controller = diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyMicrophoneAudioToggleHandler.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyMicrophoneAudioToggleHandler.cs index 4c2034733e7..5ccdde0a359 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyMicrophoneAudioToggleHandler.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyMicrophoneAudioToggleHandler.cs @@ -5,8 +5,8 @@ namespace DCL.VoiceChat.Nearby { /// - /// Plays start/stop speaking SFX on user-driven ↔ - /// transitions only. + /// Plays start/stop speaking SFX on user-driven ↔ + /// transitions only. /// A Suppress() force-stop also produces an OPEN_MIC → IDLE tick, so the off-cue is gated on /// being null (Suppress sets the reason /// before calling StopSpeaking, making it observable here). Resume always returns to IDLE @@ -47,13 +47,13 @@ private void OnStateChanged(NearbyVoiceChatState newState) NearbyVoiceChatState prev = previousState; previousState = newState; - bool isUserStart = prev == NearbyVoiceChatState.IDLE && newState == NearbyVoiceChatState.OPEN_MIC; - bool isUserStop = prev == NearbyVoiceChatState.OPEN_MIC && newState == NearbyVoiceChatState.IDLE + bool isUserStart = prev == NearbyVoiceChatState.Idle && newState == NearbyVoiceChatState.OpenMic; + bool isUserStop = prev == NearbyVoiceChatState.OpenMic && newState == NearbyVoiceChatState.Idle && stateModel.ActiveSuppression.Value == null; if (!isUserStart && !isUserStop) return; - float volumeScale = stateModel.CurrentActivation == NearbyVoiceActivation.PUSH_TO_TALK + float volumeScale = stateModel.CurrentActivation == NearbyVoiceActivation.PushToTalk ? configuration.NearbyPushToTalkVolumeScale : DEFAULT_VOLUME_SCALE; diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyMicrophoneHandler.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyMicrophoneHandler.cs index 3ac009ac74e..dc0d087121d 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyMicrophoneHandler.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyMicrophoneHandler.cs @@ -79,9 +79,9 @@ public void Dispose() private void Connect() { if (islandRoom.Info.ConnectionState != LKConnectionState.ConnConnected) return; - if (stateModel.State.Value is not (NearbyVoiceChatState.IDLE or NearbyVoiceChatState.OPEN_MIC)) return; + if (stateModel.State.Value is not (NearbyVoiceChatState.Idle or NearbyVoiceChatState.OpenMic)) return; - PublishMicWithRetryAsync(startMic: stateModel.State.Value == NearbyVoiceChatState.OPEN_MIC).Forget(); + PublishMicWithRetryAsync(startMic: stateModel.State.Value == NearbyVoiceChatState.OpenMic).Forget(); } private void Disconnect() @@ -94,7 +94,7 @@ private void Disconnect() private void OnNearbyStateChanged(NearbyVoiceChatState newState) { // Cancel in-flight mic publish immediately so PublishAsync observes it via its CancellationToken - if (newState is NearbyVoiceChatState.SUPPRESSED or NearbyVoiceChatState.DISABLED) + if (newState is NearbyVoiceChatState.Suppressed or NearbyVoiceChatState.Disabled) activationCts.SafeCancelAndDispose(); OnNearbyStateChangedInternalAsync(newState).Forget(); @@ -109,19 +109,19 @@ async UniTaskVoid OnNearbyStateChangedInternalAsync(NearbyVoiceChatState state) switch (state) { - case NearbyVoiceChatState.DISABLED: - case NearbyVoiceChatState.SUPPRESSED: + case NearbyVoiceChatState.Disabled: + case NearbyVoiceChatState.Suppressed: Disconnect(); break; - case NearbyVoiceChatState.IDLE: + case NearbyVoiceChatState.Idle: if (micPublisher.isRecording) micPublisher.StopMicrophone(); Connect(); // ensures listener + track published; no-ops if already done break; - case NearbyVoiceChatState.OPEN_MIC: + case NearbyVoiceChatState.OpenMic: if (micPublisher.isPublished) micPublisher.StartMicrophone(); else @@ -182,7 +182,7 @@ private void OnApplicationFocusChanged(bool hasFocus) if (!DCLPlayerPrefs.GetBool(DCLPrefKeys.SETTINGS_MUTE_MIC_IN_BACKGROUND, true)) return; - if (!hasFocus && stateModel.State.Value == NearbyVoiceChatState.OPEN_MIC && micPublisher.isRecording) + if (!hasFocus && stateModel.State.Value == NearbyVoiceChatState.OpenMic && micPublisher.isRecording) { micPublisher.StopMicrophone(); wasNearbyMicActiveBeforeFocusLoss = true; @@ -193,13 +193,13 @@ private void OnApplicationFocusChanged(bool hasFocus) { wasNearbyMicActiveBeforeFocusLoss = false; - if (stateModel.State.Value == NearbyVoiceChatState.SUPPRESSED) + if (stateModel.State.Value == NearbyVoiceChatState.Suppressed) { ReportHub.Log(ReportCategory.NEARBY_VOICE_CHAT, "Nearby mic NOT resumed — state is SUPPRESSED"); return; } - stateModel.StartSpeaking(NearbyVoiceActivation.FOCUS_RESUMED); + stateModel.StartSpeaking(NearbyVoiceActivation.FocusResumed); ReportHub.Log(ReportCategory.NEARBY_VOICE_CHAT, "Nearby mic resumed — application regained focus"); } } @@ -225,7 +225,7 @@ void RepublishIfNeeded() { if (!micPublisher.isPublished) return; - bool wasSpeaking = stateModel.State.Value == NearbyVoiceChatState.OPEN_MIC; + bool wasSpeaking = stateModel.State.Value == NearbyVoiceChatState.OpenMic; micPublisher.Unpublish(); PublishMicWithRetryAsync(startMic: wasSpeaking).Forget(); } @@ -249,7 +249,7 @@ private async UniTask PublishMicWithRetryAsync(bool startMic = false) if (ct.IsCancellationRequested || disposed) return; - if (startMic && stateModel.State.Value == NearbyVoiceChatState.OPEN_MIC) + if (startMic && stateModel.State.Value == NearbyVoiceChatState.OpenMic) micPublisher.StartMicrophone(); ReportHub.Log(ReportCategory.NEARBY_VOICE_CHAT, startMic ? "Mic track published and started" : "Mic track published (standby)"); diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyVoiceBannedPlayerWatcher.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyVoiceBannedPlayerWatcher.cs index 65f8c02b5da..342e0aa7596 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyVoiceBannedPlayerWatcher.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyVoiceBannedPlayerWatcher.cs @@ -56,12 +56,12 @@ private void SetBanned(bool banned) if (banned) { restrictionBus.PushSceneRestriction(SceneRestriction.CreateNearbyVoiceChatBlocked(SceneRestrictionsAction.APPLIED)); - stateModel.Suppress(SuppressionReason.SCENE_BAN); + stateModel.Suppress(SuppressionReason.SceneBan); } else { restrictionBus.PushSceneRestriction(SceneRestriction.CreateNearbyVoiceChatBlocked(SceneRestrictionsAction.REMOVED)); - stateModel.Resume(SuppressionReason.SCENE_BAN); + stateModel.Resume(SuppressionReason.SceneBan); } } } diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyVoiceChatStateModel.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyVoiceChatStateModel.cs index 6369daf4c43..8cd09db8e1c 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyVoiceChatStateModel.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyVoiceChatStateModel.cs @@ -7,29 +7,29 @@ namespace DCL.VoiceChat.Nearby { public enum NearbyVoiceChatState { - DISABLED, - IDLE, // default state where user is connected to nearby chat and can hear its participants - OPEN_MIC, - SUPPRESSED, // when you have another more priority voice chat - Private or Community + Disabled, + Idle, // default state where user is connected to nearby chat and can hear its participants + OpenMic, + Suppressed, // when you have another more priority voice chat - Private or Community } public enum SuppressionReason { /// Initial world loading is in progress. - LOADING, + Loading, /// Higher-priority Community or Private call is active. - CALL, + Call, /// Current scene disables Nearby voice chat via feature toggles. - SCENE, + Scene, /// Local player is banned from the current scene. - SCENE_BAN, + SceneBan, } public enum NearbyVoiceActivation { - PUSH_TO_TALK, // Hold [T] - BUTTON, // Widget speak button click - FOCUS_RESUMED, // Auto-resume after application regained focus + PushToTalk, // Hold [T] + Button, // Widget speak button click + FocusResumed, // Auto-resume after application regained focus } public class NearbyVoiceChatStateModel : IDisposable @@ -62,7 +62,7 @@ public bool IsLocalSpeaking set => isLocalSpeaking = value; } - public bool IsListeningDisabled => state.Value is NearbyVoiceChatState.SUPPRESSED or NearbyVoiceChatState.DISABLED; + public bool IsListeningDisabled => state.Value is NearbyVoiceChatState.Suppressed or NearbyVoiceChatState.Disabled; public NearbyVoiceChatStateModel(NearbyVoiceChatState initialState) { @@ -78,29 +78,29 @@ public void Dispose() public void Enable() { - if (state.Value == NearbyVoiceChatState.DISABLED) - SetState(NearbyVoiceChatState.IDLE); + if (state.Value == NearbyVoiceChatState.Disabled) + SetState(NearbyVoiceChatState.Idle); } public void Disable() { - SetState(NearbyVoiceChatState.DISABLED); + SetState(NearbyVoiceChatState.Disabled); } // Speaking - public void StartSpeaking(NearbyVoiceActivation activation = NearbyVoiceActivation.BUTTON) + public void StartSpeaking(NearbyVoiceActivation activation = NearbyVoiceActivation.Button) { - if (state.Value == NearbyVoiceChatState.IDLE) + if (state.Value == NearbyVoiceChatState.Idle) { CurrentActivation = activation; - SetState(NearbyVoiceChatState.OPEN_MIC); + SetState(NearbyVoiceChatState.OpenMic); } } public void StopSpeaking() { - if (state.Value == NearbyVoiceChatState.OPEN_MIC) - SetState(NearbyVoiceChatState.IDLE); + if (state.Value == NearbyVoiceChatState.OpenMic) + SetState(NearbyVoiceChatState.Idle); } // Suppression @@ -111,13 +111,13 @@ public void Suppress(SuppressionReason reason) activeSuppression.Value = reason; - if (state.Value != NearbyVoiceChatState.SUPPRESSED) + if (state.Value != NearbyVoiceChatState.Suppressed) { - if (state.Value == NearbyVoiceChatState.OPEN_MIC) + if (state.Value == NearbyVoiceChatState.OpenMic) StopSpeaking(); preBlockedState = state.Value; - SetState(NearbyVoiceChatState.SUPPRESSED); + SetState(NearbyVoiceChatState.Suppressed); } } @@ -129,7 +129,7 @@ public void Resume(SuppressionReason reason) if (TryResetToRemainedSuppression(activeSuppression)) return; - if (state.Value == NearbyVoiceChatState.SUPPRESSED) + if (state.Value == NearbyVoiceChatState.Suppressed) SetState(preBlockedState); } diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyVoiceChatSuppressor.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyVoiceChatSuppressor.cs index d4f63dbab1e..5b2fdcfbc4e 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyVoiceChatSuppressor.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyVoiceChatSuppressor.cs @@ -30,7 +30,7 @@ public NearbyVoiceChatSuppressor(NearbyVoiceChatStateModel stateModel, IReadonly // Suppress while world is still loading so we do not attempt to connect before the player spawns. // User preference (DISABLED/IDLE from PlayerPrefs) is preserved as preBlockedState and restored on Resume(LOADING). if (loadingStatus.CurrentStage.Value != LoadingStatus.LoadingStage.Completed) - stateModel.Suppress(SuppressionReason.LOADING); + stateModel.Suppress(SuppressionReason.Loading); loadingStageSubscription = loadingStatus.CurrentStage.Subscribe(OnLoadingStageChanged); callStatusSubscription = callStatus.Subscribe(OnCallStatusChanged); @@ -48,17 +48,17 @@ public void Dispose() private void OnCallStatusChanged(VoiceChatStatus status) { if (status.IsInCall()) - stateModel.Suppress(SuppressionReason.CALL); + stateModel.Suppress(SuppressionReason.Call); else if (status.IsNotConnected()) - stateModel.Resume(SuppressionReason.CALL); + stateModel.Resume(SuppressionReason.Call); } private void OnLoadingStageChanged(LoadingStatus.LoadingStage stage) { if (stage == LoadingStatus.LoadingStage.Completed) - stateModel.Resume(SuppressionReason.LOADING); + stateModel.Resume(SuppressionReason.Loading); else - stateModel.Suppress(SuppressionReason.LOADING); + stateModel.Suppress(SuppressionReason.Loading); } } } diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyVoiceSceneRestrictionWatcher.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyVoiceSceneRestrictionWatcher.cs index 01228a4e521..c46d5d2bfec 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyVoiceSceneRestrictionWatcher.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyVoiceSceneRestrictionWatcher.cs @@ -48,12 +48,12 @@ private void SetBlocked(bool blocksVoice) if (blocksVoice) { restrictionBus.PushSceneRestriction(SceneRestriction.CreateNearbyVoiceChatBlocked(SceneRestrictionsAction.APPLIED)); - stateModel.Suppress(SuppressionReason.SCENE); + stateModel.Suppress(SuppressionReason.Scene); } else { restrictionBus.PushSceneRestriction(SceneRestriction.CreateNearbyVoiceChatBlocked(SceneRestrictionsAction.REMOVED)); - stateModel.Resume(SuppressionReason.SCENE); + stateModel.Resume(SuppressionReason.Scene); } } } diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Systems/NearbyAudioCleanupSystem.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Systems/NearbyAudioCleanupSystem.cs index f22c6abf996..43c302c3e95 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Systems/NearbyAudioCleanupSystem.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Systems/NearbyAudioCleanupSystem.cs @@ -22,7 +22,7 @@ namespace DCL.VoiceChat.Nearby.Systems /// Trigger #2 (stream gone) — registry no longer reports the bound (walletId, sid). /// Trigger #3 (blocked) returns true for the bound walletId. /// Trigger #4 (scene-banned) returns true for the bound walletId. - /// Trigger #5 (listening gate) — bulk removal when is in or ; + /// Trigger #5 (listening gate) — bulk removal when is in or ; /// /// /// diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Systems/NearbyVoiceChatDebugSystem.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Systems/NearbyVoiceChatDebugSystem.cs index 9eb6719f773..5a161fa0c88 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Systems/NearbyVoiceChatDebugSystem.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Systems/NearbyVoiceChatDebugSystem.cs @@ -245,10 +245,10 @@ private void ApplySettings(ref NearbyAudioSourceComponent nearbyAudio) private static string ColorFor(NearbyVoiceChatState state) => state switch { - NearbyVoiceChatState.OPEN_MIC => "green", - NearbyVoiceChatState.IDLE => "white", - NearbyVoiceChatState.SUPPRESSED => "yellow", - NearbyVoiceChatState.DISABLED => "#888888", + NearbyVoiceChatState.OpenMic => "green", + NearbyVoiceChatState.Idle => "white", + NearbyVoiceChatState.Suppressed => "yellow", + NearbyVoiceChatState.Disabled => "#888888", _ => "white", }; diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Systems/NearbyVoiceChatNametagSystem.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Systems/NearbyVoiceChatNametagSystem.cs index 698d700c447..2dbf29adad8 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Systems/NearbyVoiceChatNametagSystem.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Systems/NearbyVoiceChatNametagSystem.cs @@ -45,7 +45,7 @@ protected override void Update(float t) return; } - localMicOpen = stateModel.State.Value == NearbyVoiceChatState.OPEN_MIC; + localMicOpen = stateModel.State.Value == NearbyVoiceChatState.OpenMic; UpdateExistingNearbyNametagsQuery(World); AddMissingNearbyNametagsQuery(World); diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyAudioBindingSystemShould.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyAudioBindingSystemShould.cs index 1b5f071065b..31252f6bc0a 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyAudioBindingSystemShould.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyAudioBindingSystemShould.cs @@ -55,7 +55,7 @@ public void SetUp() registry = new FakeStreamRegistry(); bindings = new HashSet(); userBlockingCache = Substitute.For(); - stateModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.IDLE); + stateModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.Idle); sourceFactory = new FakeNearbyAudioSourceFactory(); system = new NearbyAudioBindingSystem(world, registry, bindings, userBlockingCache, stateModel, sourceFactory, RoomMetadataCurrentScene.CreateForTest()); @@ -196,7 +196,7 @@ public void SuppressedStateSkipsCreation() registry.SeedActiveStream(wallet, "sid-1"); } - stateModel.Suppress(SuppressionReason.CALL); + stateModel.Suppress(SuppressionReason.Call); system.Update(0); @@ -230,12 +230,12 @@ public void ResumeRebindsFromRegistry() CreateStreamingAvatar(WALLET, SID); registry.SeedActiveStream(WALLET, SID); - stateModel.Suppress(SuppressionReason.CALL); + stateModel.Suppress(SuppressionReason.Call); system.Update(0); Assert.That(CountAudioEntities(), Is.EqualTo(0), "suppressed tick must not allocate"); - stateModel.Resume(SuppressionReason.CALL); + stateModel.Resume(SuppressionReason.Call); system.Update(0); Assert.That(CountAudioEntities(), Is.EqualTo(1), "resume must re-bind from the unchanged component snapshot"); @@ -369,7 +369,7 @@ public void BindingIteratesSidsFromComponentWithoutCallingRegistryGetAudioSids() // Replace registry with the mock for the lifetime of this test. var localBindings = new HashSet(); - using var localStateModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.IDLE); + using var localStateModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.Idle); var localFactory = new FakeNearbyAudioSourceFactory(); try { diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyAudioCleanupSystemShould.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyAudioCleanupSystemShould.cs index 276eaaf714b..f28c8775a77 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyAudioCleanupSystemShould.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyAudioCleanupSystemShould.cs @@ -60,7 +60,7 @@ public void SetUp() registry = new FakeStreamRegistry(); bindings = new HashSet(); userBlockingCache = Substitute.For(); - stateModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.IDLE); + stateModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.Idle); configuration = ScriptableObject.CreateInstance(); sourceFactory = new NearbyAudioSourceFactory(configuration); @@ -157,7 +157,7 @@ public void SuppressedStateTearsDownAllAudioEntities() seeded.Add((audioEntity, source, $"wallet-{i}")); } - stateModel.Suppress(SuppressionReason.CALL); + stateModel.Suppress(SuppressionReason.Call); system.Update(0); diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyMicrophoneAudioToggleHandlerShould.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyMicrophoneAudioToggleHandlerShould.cs index 047d910f9c3..1e441dcdb2b 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyMicrophoneAudioToggleHandlerShould.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyMicrophoneAudioToggleHandlerShould.cs @@ -8,8 +8,8 @@ namespace DCL.VoiceChat.NearbyVoiceChat.Tests.EditMode { /// /// Documents as a user-action SFX adapter: - /// plays on/off cues only on user-driven ↔ - /// transitions, at 0.2× the asset volume when the + /// plays on/off cues only on user-driven ↔ + /// transitions, at 0.2× the asset volume when the /// session was triggered by push-to-talk and at full volume otherwise. Suppress force-stops and system /// Resume transitions stay silent. /// @@ -29,7 +29,7 @@ public class NearbyMicrophoneAudioToggleHandlerShould [SetUp] public void SetUp() { - stateModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.IDLE); + stateModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.Idle); configuration = ScriptableObject.CreateInstance(); configuration.NearbyPushToTalkVolumeScale = PUSH_TO_TALK_SCALE; offClip = ScriptableObject.CreateInstance(); @@ -66,7 +66,7 @@ public void NotPlayAnythingAtConstruction() [Test] public void PlayOnClipAtFullVolumeForButtonActivation() { - stateModel.StartSpeaking(NearbyVoiceActivation.BUTTON); + stateModel.StartSpeaking(NearbyVoiceActivation.Button); Assert.That(played.Count, Is.EqualTo(1)); Assert.That(played[0].clip, Is.SameAs(onClip)); @@ -76,7 +76,7 @@ public void PlayOnClipAtFullVolumeForButtonActivation() [Test] public void PlayOffClipAtFullVolumeForButtonActivation() { - stateModel.StartSpeaking(NearbyVoiceActivation.BUTTON); + stateModel.StartSpeaking(NearbyVoiceActivation.Button); played.Clear(); stateModel.StopSpeaking(); @@ -89,7 +89,7 @@ public void PlayOffClipAtFullVolumeForButtonActivation() [Test] public void PlayOnClipAtReducedVolumeForPushToTalk() { - stateModel.StartSpeaking(NearbyVoiceActivation.PUSH_TO_TALK); + stateModel.StartSpeaking(NearbyVoiceActivation.PushToTalk); Assert.That(played.Count, Is.EqualTo(1)); Assert.That(played[0].clip, Is.SameAs(onClip)); @@ -99,7 +99,7 @@ public void PlayOnClipAtReducedVolumeForPushToTalk() [Test] public void PlayOffClipAtReducedVolumeForPushToTalk() { - stateModel.StartSpeaking(NearbyVoiceActivation.PUSH_TO_TALK); + stateModel.StartSpeaking(NearbyVoiceActivation.PushToTalk); played.Clear(); stateModel.StopSpeaking(); @@ -112,7 +112,7 @@ public void PlayOffClipAtReducedVolumeForPushToTalk() [Test] public void PlayAtFullVolumeForFocusResumed() { - stateModel.StartSpeaking(NearbyVoiceActivation.FOCUS_RESUMED); + stateModel.StartSpeaking(NearbyVoiceActivation.FocusResumed); Assert.That(played.Count, Is.EqualTo(1)); Assert.That(played[0].scale, Is.EqualTo(DEFAULT_SCALE).Within(TOLERANCE)); @@ -121,10 +121,10 @@ public void PlayAtFullVolumeForFocusResumed() [Test] public void NotPlayOffClipWhenSuppressedFromOpenMic() { - stateModel.StartSpeaking(NearbyVoiceActivation.BUTTON); + stateModel.StartSpeaking(NearbyVoiceActivation.Button); played.Clear(); - stateModel.Suppress(SuppressionReason.CALL); + stateModel.Suppress(SuppressionReason.Call); Assert.That(played, Is.Empty); } @@ -132,11 +132,11 @@ public void NotPlayOffClipWhenSuppressedFromOpenMic() [Test] public void NotPlayOnClipWhenResumedToOpenMic() { - stateModel.StartSpeaking(NearbyVoiceActivation.BUTTON); - stateModel.Suppress(SuppressionReason.CALL); + stateModel.StartSpeaking(NearbyVoiceActivation.Button); + stateModel.Suppress(SuppressionReason.Call); played.Clear(); - stateModel.Resume(SuppressionReason.CALL); + stateModel.Resume(SuppressionReason.Call); Assert.That(played, Is.Empty); } @@ -144,11 +144,11 @@ public void NotPlayOnClipWhenResumedToOpenMic() [Test] public void StaySilentAcrossFullSuppressResumeCycle() { - stateModel.StartSpeaking(NearbyVoiceActivation.BUTTON); + stateModel.StartSpeaking(NearbyVoiceActivation.Button); played.Clear(); - stateModel.Suppress(SuppressionReason.SCENE); - stateModel.Resume(SuppressionReason.SCENE); + stateModel.Suppress(SuppressionReason.Scene); + stateModel.Resume(SuppressionReason.Scene); Assert.That(played, Is.Empty); } @@ -156,7 +156,7 @@ public void StaySilentAcrossFullSuppressResumeCycle() [Test] public void NotPlayOffClipWhenDisabledFromOpenMic() { - stateModel.StartSpeaking(NearbyVoiceActivation.BUTTON); + stateModel.StartSpeaking(NearbyVoiceActivation.Button); played.Clear(); stateModel.Disable(); @@ -169,7 +169,7 @@ public void StopReactingAfterDispose() { handler.Dispose(); - stateModel.StartSpeaking(NearbyVoiceActivation.BUTTON); + stateModel.StartSpeaking(NearbyVoiceActivation.Button); Assert.That(played, Is.Empty); } diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceBannedPlayerWatcherShould.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceBannedPlayerWatcherShould.cs index 1ed28db0810..c04a0a82d49 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceBannedPlayerWatcherShould.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceBannedPlayerWatcherShould.cs @@ -12,7 +12,7 @@ namespace DCL.VoiceChat.NearbyVoiceChat.Tests.EditMode /// /// Documents : /// when the gatekeeper returns a forbidden-access response for the current scene, - /// the watcher suppresses Nearby voice chat with + /// the watcher suppresses Nearby voice chat with /// and pushes a NEARBY_VOICE_CHAT_BLOCKED:APPLIED restriction. Any subsequent successful /// scene-room connect or clean disconnect releases the suppression. /// @@ -32,7 +32,7 @@ public void SetUp() roomHub.SceneRoom().Returns(sceneRoom); restrictionBus = Substitute.For(); - stateModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.IDLE); + stateModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.Idle); watcher = new NearbyVoiceBannedPlayerWatcher(roomHub, restrictionBus, stateModel); } @@ -48,8 +48,8 @@ public void SuppressOnForbiddenAccess() { sceneRoom.CurrentSceneRoomForbiddenAccess += Raise.Event(); - Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.SUPPRESSED)); - Assert.That(stateModel.ActiveSuppression.Value, Is.EqualTo(SuppressionReason.SCENE_BAN)); + Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.Suppressed)); + Assert.That(stateModel.ActiveSuppression.Value, Is.EqualTo(SuppressionReason.SceneBan)); restrictionBus.Received(1).PushSceneRestriction(Arg.Is(r => r.Type == SceneRestrictions.NEARBY_VOICE_CHAT_BLOCKED && r.Action == SceneRestrictionsAction.APPLIED)); } @@ -62,7 +62,7 @@ public void ResumeOnSceneRoomConnected() sceneRoom.CurrentSceneRoomConnected += Raise.Event(); - Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.IDLE)); + Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.Idle)); Assert.That(stateModel.ActiveSuppression.Value, Is.Null); restrictionBus.Received(1).PushSceneRestriction(Arg.Is(r => r.Type == SceneRestrictions.NEARBY_VOICE_CHAT_BLOCKED && r.Action == SceneRestrictionsAction.REMOVED)); @@ -76,7 +76,7 @@ public void ResumeOnSceneRoomDisconnected() sceneRoom.CurrentSceneRoomDisconnected += Raise.Event(); - Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.IDLE)); + Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.Idle)); restrictionBus.Received(1).PushSceneRestriction(Arg.Is(r => r.Action == SceneRestrictionsAction.REMOVED)); } @@ -92,7 +92,7 @@ public void IgnoreDuplicateForbiddenWhileAlreadyBanned() sceneRoom.CurrentSceneRoomForbiddenAccess += Raise.Event(); - Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.SUPPRESSED)); + Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.Suppressed)); restrictionBus.DidNotReceive().PushSceneRestriction(Arg.Any()); } @@ -101,7 +101,7 @@ public void IgnoreReleaseWhenNotBanned() { sceneRoom.CurrentSceneRoomConnected += Raise.Event(); - Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.IDLE)); + Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.Idle)); restrictionBus.DidNotReceive().PushSceneRestriction(Arg.Any()); } @@ -116,8 +116,8 @@ public void RestoreSuppressionAfterConnectedAndForbiddenAgain() sceneRoom.CurrentSceneRoomForbiddenAccess += Raise.Event(); - Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.SUPPRESSED)); - Assert.That(stateModel.ActiveSuppression.Value, Is.EqualTo(SuppressionReason.SCENE_BAN)); + Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.Suppressed)); + Assert.That(stateModel.ActiveSuppression.Value, Is.EqualTo(SuppressionReason.SceneBan)); restrictionBus.Received(1).PushSceneRestriction(Arg.Is(r => r.Type == SceneRestrictions.NEARBY_VOICE_CHAT_BLOCKED && r.Action == SceneRestrictionsAction.APPLIED)); } @@ -133,8 +133,8 @@ public void RestoreSuppressionAfterDisconnectedAndForbiddenAgain() sceneRoom.CurrentSceneRoomForbiddenAccess += Raise.Event(); - Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.SUPPRESSED)); - Assert.That(stateModel.ActiveSuppression.Value, Is.EqualTo(SuppressionReason.SCENE_BAN)); + Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.Suppressed)); + Assert.That(stateModel.ActiveSuppression.Value, Is.EqualTo(SuppressionReason.SceneBan)); restrictionBus.Received(1).PushSceneRestriction(Arg.Is(r => r.Type == SceneRestrictions.NEARBY_VOICE_CHAT_BLOCKED && r.Action == SceneRestrictionsAction.APPLIED)); } @@ -148,7 +148,7 @@ public void ReleaseSuppressionOnDisposeWhileBanned() watcher.Dispose(); watcher = null!; - Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.IDLE)); + Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.Idle)); restrictionBus.Received(1).PushSceneRestriction(Arg.Is(r => r.Action == SceneRestrictionsAction.REMOVED)); } diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceChatAnalyticsShould.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceChatAnalyticsShould.cs index b534b0dce4f..350fccd2723 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceChatAnalyticsShould.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceChatAnalyticsShould.cs @@ -37,7 +37,7 @@ public void SetUp() INearbyMuteRepository repository = Substitute.For(); muteService = new NearbyMuteService(muteCache, repository); - stateModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.DISABLED); + stateModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.Disabled); sut = new NearbyVoiceChatAnalytics(analytics, stateModel, muteService); } @@ -58,7 +58,7 @@ public void FireSpeakButtonOnFromIdleToSpeaking() analytics.ClearReceivedCalls(); // Act — user clicks the widget speak button - stateModel.StartSpeaking(NearbyVoiceActivation.BUTTON); + stateModel.StartSpeaking(NearbyVoiceActivation.Button); // Assert AssertTrackedOnce(AnalyticsEvents.VoiceChat.NEARBY_VOICE_SPEAK_BUTTON, @@ -70,7 +70,7 @@ public void FireSpeakButtonOffFromSpeakingToIdle() { // Arrange — user clicked Speak, now stops by clicking again stateModel.Enable(); - stateModel.StartSpeaking(NearbyVoiceActivation.BUTTON); + stateModel.StartSpeaking(NearbyVoiceActivation.Button); analytics.ClearReceivedCalls(); // Act @@ -87,11 +87,11 @@ public void NotFireSpeakButtonOffOnSuppression() // Suppression by call/scene/loading internally calls StopSpeaking — system-driven, not user intent. // Arrange — user is mid-speak via button stateModel.Enable(); - stateModel.StartSpeaking(NearbyVoiceActivation.BUTTON); + stateModel.StartSpeaking(NearbyVoiceActivation.Button); analytics.ClearReceivedCalls(); // Act — incoming private call suppresses nearby - stateModel.Suppress(SuppressionReason.CALL); + stateModel.Suppress(SuppressionReason.Call); // Assert — no enabled:false fired (the SPEAKING→IDLE inside Suppress is system-driven) analytics.DidNotReceive().Track( @@ -110,7 +110,7 @@ public void FireSpeakPttOnIdleToSpeakingWithPushToTalk() analytics.ClearReceivedCalls(); // Act — user holds [T] - stateModel.StartSpeaking(NearbyVoiceActivation.PUSH_TO_TALK); + stateModel.StartSpeaking(NearbyVoiceActivation.PushToTalk); // Assert — fires once on press, no payload required analytics.Received(1).Track( @@ -125,7 +125,7 @@ public void NotFireSpeakButtonOnPushToTalkRelease() // SPEAKING→IDLE after a PTT press must not emit a button toggle-off event. // Arrange stateModel.Enable(); - stateModel.StartSpeaking(NearbyVoiceActivation.PUSH_TO_TALK); + stateModel.StartSpeaking(NearbyVoiceActivation.PushToTalk); analytics.ClearReceivedCalls(); // Act — user releases [T] @@ -147,7 +147,7 @@ public void NotFireAnySpeakEventOnFocusResumed() analytics.ClearReceivedCalls(); // Act — application regained focus and the mic auto-resumed - stateModel.StartSpeaking(NearbyVoiceActivation.FOCUS_RESUMED); + stateModel.StartSpeaking(NearbyVoiceActivation.FocusResumed); // Assert — neither speak event variant fires analytics.DidNotReceive().Track( @@ -168,9 +168,9 @@ public void FireSpeakEventsPerFreshSpeakingSession() analytics.ClearReceivedCalls(); // Act — button session (on/off), then a PTT press - stateModel.StartSpeaking(NearbyVoiceActivation.BUTTON); + stateModel.StartSpeaking(NearbyVoiceActivation.Button); stateModel.StopSpeaking(); - stateModel.StartSpeaking(NearbyVoiceActivation.PUSH_TO_TALK); + stateModel.StartSpeaking(NearbyVoiceActivation.PushToTalk); // Assert — button fires twice (on + off), PTT fires once on press analytics.Received(2).Track( @@ -217,7 +217,7 @@ public void FireToggleOffFromSpeaking() // SPEAKING → DISABLED happens if the user toggles the widget off mid-speak. // Arrange stateModel.Enable(); - stateModel.StartSpeaking(NearbyVoiceActivation.BUTTON); + stateModel.StartSpeaking(NearbyVoiceActivation.Button); analytics.ClearReceivedCalls(); // Act @@ -237,7 +237,7 @@ public void NotFireToggleOnSuppressionFromIdle() analytics.ClearReceivedCalls(); // Act - stateModel.Suppress(SuppressionReason.CALL); + stateModel.Suppress(SuppressionReason.Call); // Assert AssertNoToggle(); @@ -250,11 +250,11 @@ public void NotFireToggleOnSuppressionFromSpeaking() // The intermediate IDLE is a forced stop, not a user-driven toggle. // Arrange stateModel.Enable(); - stateModel.StartSpeaking(NearbyVoiceActivation.BUTTON); + stateModel.StartSpeaking(NearbyVoiceActivation.Button); analytics.ClearReceivedCalls(); // Act - stateModel.Suppress(SuppressionReason.CALL); + stateModel.Suppress(SuppressionReason.Call); // Assert AssertNoToggle(); @@ -266,11 +266,11 @@ public void NotFireToggleOnResumeToIdle() // Higher-priority call ended → nearby chat resumes to IDLE. Not a user toggle. // Arrange stateModel.Enable(); - stateModel.Suppress(SuppressionReason.CALL); + stateModel.Suppress(SuppressionReason.Call); analytics.ClearReceivedCalls(); // Act - stateModel.Resume(SuppressionReason.CALL); + stateModel.Resume(SuppressionReason.Call); // Assert AssertNoToggle(); @@ -282,13 +282,13 @@ public void NotFireToggleOnResumeToDisabled() // Loading stage suppresses the feature at startup while the user preference is DISABLED. // After load completes, Resume restores the preference — no toggle event should fire. // Arrange - using var disabledStart = new NearbyVoiceChatStateModel(NearbyVoiceChatState.DISABLED); + using var disabledStart = new NearbyVoiceChatStateModel(NearbyVoiceChatState.Disabled); using var localAnalytics = new NearbyVoiceChatAnalytics(analytics, disabledStart, muteService); - disabledStart.Suppress(SuppressionReason.LOADING); + disabledStart.Suppress(SuppressionReason.Loading); analytics.ClearReceivedCalls(); // Act - disabledStart.Resume(SuppressionReason.LOADING); + disabledStart.Resume(SuppressionReason.Loading); // Assert AssertNoToggle(); @@ -300,7 +300,7 @@ public void NotFireToggleOnStopSpeaking() // SPEAKING → IDLE via StopSpeaking is mic-off, not a feature toggle. // Arrange stateModel.Enable(); - stateModel.StartSpeaking(NearbyVoiceActivation.BUTTON); + stateModel.StartSpeaking(NearbyVoiceActivation.Button); analytics.ClearReceivedCalls(); // Act @@ -319,7 +319,7 @@ public void NotFireToggleOnStartSpeaking() analytics.ClearReceivedCalls(); // Act - stateModel.StartSpeaking(NearbyVoiceActivation.BUTTON); + stateModel.StartSpeaking(NearbyVoiceActivation.Button); // Assert AssertNoToggle(); @@ -333,7 +333,7 @@ public void NotFireToggleOnDisableFromSuppressed() // since the user was not actually using nearby at the moment. // Arrange stateModel.Enable(); - stateModel.Suppress(SuppressionReason.CALL); + stateModel.Suppress(SuppressionReason.Call); analytics.ClearReceivedCalls(); // Act @@ -395,7 +395,7 @@ public void NotFireSpeakAfterDispose() sut.Dispose(); // Act - stateModel.StartSpeaking(NearbyVoiceActivation.BUTTON); + stateModel.StartSpeaking(NearbyVoiceActivation.Button); // Assert analytics.DidNotReceive().Track( diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceChatManagerShould.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceChatManagerShould.cs index 037dbe7b746..b9bb6c1a72a 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceChatManagerShould.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceChatManagerShould.cs @@ -19,7 +19,7 @@ public class NearbyVoiceChatManagerShould [SetUp] public void SetUp() { - stateModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.IDLE); + stateModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.Idle); callStatus = new ReactiveProperty(VoiceChatStatus.DISCONNECTED); loadingStatus = new FakeLoadingStatus(LoadingStatus.LoadingStage.Completed); } @@ -37,7 +37,7 @@ public void NotSuppressLoadingWhenAlreadyCompletedAtConstruction() using var manager = new NearbyVoiceChatSuppressor(stateModel, callStatus, loadingStatus); // Assert - Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.IDLE)); + Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.Idle)); } [Test] @@ -50,8 +50,8 @@ public void SuppressLoadingWhenStageIsNotCompletedAtConstruction() using var manager = new NearbyVoiceChatSuppressor(stateModel, callStatus, loadingStatus); // Assert - Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.SUPPRESSED)); - Assert.That(stateModel.ActiveSuppression.Value, Is.EqualTo(SuppressionReason.LOADING)); + Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.Suppressed)); + Assert.That(stateModel.ActiveSuppression.Value, Is.EqualTo(SuppressionReason.Loading)); } [Test] @@ -65,7 +65,7 @@ public void ResumeLoadingWhenStageReachesCompleted() loadingStatus.CurrentStageMut.Value = LoadingStatus.LoadingStage.Completed; // Assert - Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.IDLE)); + Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.Idle)); } [Test] @@ -78,8 +78,8 @@ public void SuppressOnCallInCall() callStatus.Value = VoiceChatStatus.VOICE_CHAT_IN_CALL; // Assert - Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.SUPPRESSED)); - Assert.That(stateModel.ActiveSuppression.Value, Is.EqualTo(SuppressionReason.CALL)); + Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.Suppressed)); + Assert.That(stateModel.ActiveSuppression.Value, Is.EqualTo(SuppressionReason.Call)); } [Test] @@ -93,7 +93,7 @@ public void ResumeOnCallDisconnected() callStatus.Value = VoiceChatStatus.DISCONNECTED; // Assert - Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.IDLE)); + Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.Idle)); } [Test] @@ -108,7 +108,7 @@ public void UnsubscribeAfterDispose() loadingStatus.CurrentStageMut.Value = LoadingStatus.LoadingStage.Init; // Assert - Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.IDLE)); + Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.Idle)); } private class FakeLoadingStatus : ILoadingStatus diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceChatNametagSystemShould.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceChatNametagSystemShould.cs index 67975a9f482..21cd4bee593 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceChatNametagSystemShould.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceChatNametagSystemShould.cs @@ -42,7 +42,7 @@ public void SetUp() registry = Substitute.For(); - stateModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.IDLE); + stateModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.Idle); muteCache = Substitute.For(); muteService = new NearbyMuteService(muteCache, Substitute.For()); @@ -72,7 +72,7 @@ public void SuppressedStateFlagsAllNearbyComponentsForRemoval() Entity b = CreateNametaggedAvatarEntity("wallet-b", new VoiceChatNametagComponent(true, VoiceChatType.NEARBY)); Entity c = CreateNametaggedAvatarEntity("wallet-c", new VoiceChatNametagComponent(false, VoiceChatType.NEARBY)); - stateModel.Suppress(SuppressionReason.CALL); + stateModel.Suppress(SuppressionReason.Call); system.Update(0); AssertIsRemoving(a); @@ -97,7 +97,7 @@ public void SuppressedStateLeavesNonNearbyComponentsAlone() Entity community = CreateNametaggedAvatarEntity("wallet-community", new VoiceChatNametagComponent(true, VoiceChatType.COMMUNITY)); - stateModel.Suppress(SuppressionReason.CALL); + stateModel.Suppress(SuppressionReason.Call); system.Update(0); ref var c = ref world.Get(community); @@ -114,7 +114,7 @@ public void SuppressedStateSkipsAvatarPass() CreateAvatarEntity("wallet-a"); registry.IsActiveSpeaker("wallet-a").Returns(true); - stateModel.Suppress(SuppressionReason.CALL); + stateModel.Suppress(SuppressionReason.Call); system.Update(0); int count = 0; @@ -368,12 +368,12 @@ public void ResumeFromSuppressedReAddsComponentForActiveSpeaker() // 1. Tick under SUPPRESSED — bulk teardown runs but there's nothing to teardown yet // (component was never created since suppressed gate skips add-missing). - stateModel.Suppress(SuppressionReason.CALL); + stateModel.Suppress(SuppressionReason.Call); system.Update(0); Assert.That(world.Has(e), Is.False); // 2. Resume → IDLE, tick again — add-missing must rehydrate. - stateModel.Resume(SuppressionReason.CALL); + stateModel.Resume(SuppressionReason.Call); system.Update(0); Assert.That(world.Has(e), Is.True); diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceChatStateModelShould.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceChatStateModelShould.cs index 26a70e770fb..d5f66daa4f9 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceChatStateModelShould.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceChatStateModelShould.cs @@ -32,7 +32,7 @@ public class NearbyVoiceChatStateModelShould [SetUp] public void SetUp() { - model = new NearbyVoiceChatStateModel(NearbyVoiceChatState.DISABLED); + model = new NearbyVoiceChatStateModel(NearbyVoiceChatState.Disabled); stateChanges = new List(); model.State.Subscribe(s => stateChanges.Add(s)); } @@ -48,14 +48,14 @@ public void TearDown() [Test] public void StartInGivenInitialState() { - Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.DISABLED)); + Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.Disabled)); } [Test] public void StartInSpeakingStateWhenInitializedAsSpeaking() { - using var speakingModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.OPEN_MIC); - Assert.That(speakingModel.State.Value, Is.EqualTo(NearbyVoiceChatState.OPEN_MIC)); + using var speakingModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.OpenMic); + Assert.That(speakingModel.State.Value, Is.EqualTo(NearbyVoiceChatState.OpenMic)); } // ── Enable / Disable ──────────────────────────────────────── @@ -67,7 +67,7 @@ public void TransitionToHearingWhenEnabled() model.Enable(); // Assert — player connects to island, starts hearing nearby voices - Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.IDLE)); + Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.Idle)); } [Test] @@ -82,25 +82,25 @@ public void IgnoreEnableWhenAlreadyActive() model.Enable(); // Assert - Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.OPEN_MIC)); + Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.OpenMic)); Assert.That(stateChanges, Is.Empty); } [Test] public void TransitionToDisabledFromAnyState( - [Values(NearbyVoiceChatState.IDLE, NearbyVoiceChatState.OPEN_MIC)] + [Values(NearbyVoiceChatState.Idle, NearbyVoiceChatState.OpenMic)] NearbyVoiceChatState activeState) { // Arrange model.Enable(); - if (activeState == NearbyVoiceChatState.OPEN_MIC) + if (activeState == NearbyVoiceChatState.OpenMic) model.StartSpeaking(); // Act — player leaves the island or feature is toggled off model.Disable(); // Assert - Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.DISABLED)); + Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.Disabled)); } // ── Speaking ──────────────────────────────────────────────── @@ -115,7 +115,7 @@ public void TransitionToSpeakingWhenMicActivated() model.StartSpeaking(); // Assert - Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.OPEN_MIC)); + Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.OpenMic)); } [Test] @@ -125,7 +125,7 @@ public void NotStartSpeakingWhenDisabled() model.StartSpeaking(); // Assert — should stay DISABLED, speaking requires IDLE state first - Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.DISABLED)); + Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.Disabled)); } [Test] @@ -133,13 +133,13 @@ public void NotStartSpeakingWhenSuppressed() { // Arrange model.Enable(); - model.Suppress(SuppressionReason.CALL); + model.Suppress(SuppressionReason.Call); // Act — trying to speak while suppressed by another call model.StartSpeaking(); // Assert - Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.SUPPRESSED)); + Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.Suppressed)); } [Test] @@ -153,7 +153,7 @@ public void TransitionBackToHearingWhenMicDeactivated() model.StopSpeaking(); // Assert — still hearing nearby players, just not transmitting - Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.IDLE)); + Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.Idle)); } [Test] @@ -167,7 +167,7 @@ public void IgnoreStopSpeakingWhenNotSpeaking() model.StopSpeaking(); // Assert - Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.IDLE)); + Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.Idle)); Assert.That(stateChanges, Is.Empty); } @@ -180,10 +180,10 @@ public void SuppressWhenHigherPriorityCallStarts() model.Enable(); // Act — player joins a Community or Private voice call - model.Suppress(SuppressionReason.CALL); + model.Suppress(SuppressionReason.Call); // Assert — nearby chat pauses, resources released - Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.SUPPRESSED)); + Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.Suppressed)); } [Test] @@ -194,10 +194,10 @@ public void SuppressFromSpeakingState() model.StartSpeaking(); // Act — incoming private call, nearby must yield - model.Suppress(SuppressionReason.CALL); + model.Suppress(SuppressionReason.Call); // Assert - Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.SUPPRESSED)); + Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.Suppressed)); } [Test] @@ -206,18 +206,18 @@ public void NotOverwritePreSuppressedStateOnDoubleSuppression() // Arrange — player was speaking, then suppressed (force-stopped to IDLE before SUPPRESSED) model.Enable(); model.StartSpeaking(); - model.Suppress(SuppressionReason.CALL); + model.Suppress(SuppressionReason.Call); stateChanges.Clear(); // Act — another suppression event (should be idempotent) - model.Suppress(SuppressionReason.CALL); + model.Suppress(SuppressionReason.Call); // Assert — no state change, pre-blocked state (IDLE) preserved Assert.That(stateChanges, Is.Empty); // Verify resume returns to IDLE (mic is not auto-restored — user must re-activate) - model.Resume(SuppressionReason.CALL); - Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.IDLE)); + model.Resume(SuppressionReason.Call); + Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.Idle)); } [Test] @@ -225,13 +225,13 @@ public void ResumeToHearingAfterSuppression() { // Arrange — was hearing, then suppressed model.Enable(); - model.Suppress(SuppressionReason.CALL); + model.Suppress(SuppressionReason.Call); // Act — higher-priority call ended - model.Resume(SuppressionReason.CALL); + model.Resume(SuppressionReason.Call); // Assert — back to hearing nearby players - Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.IDLE)); + Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.Idle)); } [Test] @@ -240,15 +240,15 @@ public void ResumeToIdleAfterSuppressionFromSpeaking() // Arrange — was speaking, then suppressed by incoming call model.Enable(); model.StartSpeaking(); - model.Suppress(SuppressionReason.CALL); + model.Suppress(SuppressionReason.Call); // Act — call ended, nearby resumes - model.Resume(SuppressionReason.CALL); + model.Resume(SuppressionReason.Call); // Assert — mic is NOT auto-restored. The user must explicitly re-activate it: // * for PTT: the release event can be missed during SUPPRESSED, so auto-restore would leak the mic; // * for toggle: designers require the user to consciously opt back in after another chat ended. - Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.IDLE)); + Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.Idle)); } [Test] @@ -260,14 +260,14 @@ public void EmitStopSpeakingTransitionOnSuppressFromSpeaking() stateChanges.Clear(); // Act — suppression arrives while SPEAKING - model.Suppress(SuppressionReason.CALL); + model.Suppress(SuppressionReason.Call); // Assert — SPEAKING → IDLE (forced stop) → SUPPRESSED, so downstream listeners // (e.g. mic publisher) tear down cleanly instead of only seeing SPEAKING → SUPPRESSED. Assert.That(stateChanges, Is.EqualTo(new[] { - NearbyVoiceChatState.IDLE, - NearbyVoiceChatState.SUPPRESSED, + NearbyVoiceChatState.Idle, + NearbyVoiceChatState.Suppressed, })); } @@ -275,14 +275,14 @@ public void EmitStopSpeakingTransitionOnSuppressFromSpeaking() public void ResumeToDisabledWhenUserPreferenceWasDisabled() { // Arrange — user has the feature disabled, then LOADING suppression kicks in on startup - using var disabledModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.DISABLED); - disabledModel.Suppress(SuppressionReason.LOADING); + using var disabledModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.Disabled); + disabledModel.Suppress(SuppressionReason.Loading); // Act — loading completes - disabledModel.Resume(SuppressionReason.LOADING); + disabledModel.Resume(SuppressionReason.Loading); // Assert — user preference preserved, feature does not silently turn itself on - Assert.That(disabledModel.State.Value, Is.EqualTo(NearbyVoiceChatState.DISABLED)); + Assert.That(disabledModel.State.Value, Is.EqualTo(NearbyVoiceChatState.Disabled)); } [Test] @@ -293,10 +293,10 @@ public void IgnoreResumeWhenNotSuppressed() stateChanges.Clear(); // Act — no-op when not suppressed - model.Resume(SuppressionReason.CALL); + model.Resume(SuppressionReason.Call); // Assert - Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.IDLE)); + Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.Idle)); Assert.That(stateChanges, Is.Empty); } @@ -307,23 +307,23 @@ public void SupportCompleteFeatureLifecycle() { // Player joins island → hears nearby players model.Enable(); - Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.IDLE)); + Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.Idle)); // Player activates microphone → starts speaking to nearby players model.StartSpeaking(); - Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.OPEN_MIC)); + Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.OpenMic)); // Player receives a private call → nearby suppressed (SPEAKING force-stopped to IDLE first) - model.Suppress(SuppressionReason.CALL); - Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.SUPPRESSED)); + model.Suppress(SuppressionReason.Call); + Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.Suppressed)); // Private call ends → nearby resumes to IDLE (user must re-activate mic explicitly) - model.Resume(SuppressionReason.CALL); - Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.IDLE)); + model.Resume(SuppressionReason.Call); + Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.Idle)); // Player leaves island → feature disabled model.Disable(); - Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.DISABLED)); + Assert.That(model.State.Value, Is.EqualTo(NearbyVoiceChatState.Disabled)); } // ── Reactive Notifications ────────────────────────────────── @@ -334,19 +334,19 @@ public void NotifySubscribersOnEveryStateTransition() // Act model.Enable(); model.StartSpeaking(); - model.Suppress(SuppressionReason.CALL); - model.Resume(SuppressionReason.CALL); + model.Suppress(SuppressionReason.Call); + model.Resume(SuppressionReason.Call); model.Disable(); // Assert — every meaningful transition was observed Assert.That(stateChanges, Is.EqualTo(new[] { - NearbyVoiceChatState.IDLE, // Enable - NearbyVoiceChatState.OPEN_MIC, // StartSpeaking - NearbyVoiceChatState.IDLE, // Suppress — force-stop SPEAKING - NearbyVoiceChatState.SUPPRESSED, // Suppress — enter suppression - NearbyVoiceChatState.IDLE, // Resume — user preference was IDLE - NearbyVoiceChatState.DISABLED, // Disable + NearbyVoiceChatState.Idle, // Enable + NearbyVoiceChatState.OpenMic, // StartSpeaking + NearbyVoiceChatState.Idle, // Suppress — force-stop SPEAKING + NearbyVoiceChatState.Suppressed, // Suppress — enter suppression + NearbyVoiceChatState.Idle, // Resume — user preference was IDLE + NearbyVoiceChatState.Disabled, // Disable })); } @@ -360,7 +360,7 @@ public void NotNotifySubscribersOnNoOpTransitions() // Act — all no-ops: Enable while active, StopSpeaking while hearing, Resume while not suppressed model.Enable(); model.StopSpeaking(); - model.Resume(SuppressionReason.CALL); + model.Resume(SuppressionReason.Call); // Assert Assert.That(stateChanges, Is.Empty); diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/PerformanceTests/NearbyAudioFullCycleManualTest.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/PerformanceTests/NearbyAudioFullCycleManualTest.cs index 0efeb18091c..93e253e45fe 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/PerformanceTests/NearbyAudioFullCycleManualTest.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/PerformanceTests/NearbyAudioFullCycleManualTest.cs @@ -63,7 +63,7 @@ public class NearbyAudioFullCycleManualTest : MonoBehaviour [Header("Listening Gate")] [Tooltip("Inspector-driven target state. Translated to the matching state-model transition every Update.")] - [SerializeField] private NearbyVoiceChatState forceState = NearbyVoiceChatState.IDLE; + [SerializeField] private NearbyVoiceChatState forceState = NearbyVoiceChatState.Idle; [Header("System Toggles (off = skip that stage in Update)")] [SerializeField] private bool runBinding = true; @@ -88,7 +88,7 @@ public class NearbyAudioFullCycleManualTest : MonoBehaviour // ── Avatar bookkeeping ────────────────────────────────────── private readonly List avatars = new (256); private readonly List deleteScratch = new (32); - private NearbyVoiceChatState lastSyncedState = NearbyVoiceChatState.IDLE; + private NearbyVoiceChatState lastSyncedState = NearbyVoiceChatState.Idle; private int nextAvatarOrdinal; private struct AvatarHandle @@ -125,7 +125,7 @@ private void Awake() registry = new FakeStreamRegistry(); bindings = new HashSet(); - stateModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.IDLE); + stateModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.Idle); configuration = ScriptableObject.CreateInstance(); sourceFactory = new NearbyAudioSourceFactory(configuration); @@ -189,21 +189,21 @@ private void SyncListeningGate() switch (forceState) { - case NearbyVoiceChatState.IDLE: - if (lastSyncedState == NearbyVoiceChatState.SUPPRESSED) - stateModel.Resume(SuppressionReason.CALL); - else if (lastSyncedState == NearbyVoiceChatState.DISABLED) + case NearbyVoiceChatState.Idle: + if (lastSyncedState == NearbyVoiceChatState.Suppressed) + stateModel.Resume(SuppressionReason.Call); + else if (lastSyncedState == NearbyVoiceChatState.Disabled) stateModel.Enable(); - else if (lastSyncedState == NearbyVoiceChatState.OPEN_MIC) + else if (lastSyncedState == NearbyVoiceChatState.OpenMic) stateModel.StopSpeaking(); break; - case NearbyVoiceChatState.OPEN_MIC: + case NearbyVoiceChatState.OpenMic: stateModel.StartSpeaking(); break; - case NearbyVoiceChatState.SUPPRESSED: - stateModel.Suppress(SuppressionReason.CALL); + case NearbyVoiceChatState.Suppressed: + stateModel.Suppress(SuppressionReason.Call); break; - case NearbyVoiceChatState.DISABLED: + case NearbyVoiceChatState.Disabled: stateModel.Disable(); break; } @@ -305,10 +305,10 @@ private void OnGUI() private void Remove10Avatars() => targetAvatarCount = Mathf.Max(0, targetAvatarCount - 10); [ContextMenu("Suppress (CALL)")] - private void SuppressContext() => forceState = NearbyVoiceChatState.SUPPRESSED; + private void SuppressContext() => forceState = NearbyVoiceChatState.Suppressed; [ContextMenu("Resume to IDLE")] - private void ResumeContext() => forceState = NearbyVoiceChatState.IDLE; + private void ResumeContext() => forceState = NearbyVoiceChatState.Idle; [ContextMenu("Force mass cleanup (clear all sids)")] private void ForceMassCleanup() => registry?.ClearAll(); diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/PerformanceTests/NearbyAudioFullCyclePerformanceTest.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/PerformanceTests/NearbyAudioFullCyclePerformanceTest.cs index 9e8fd921c45..459b442fc00 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/PerformanceTests/NearbyAudioFullCyclePerformanceTest.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/PerformanceTests/NearbyAudioFullCyclePerformanceTest.cs @@ -72,7 +72,7 @@ public void SetUp() registry = new FakeStreamRegistry(); bindings = new HashSet(); IUserBlockingCache userBlockingCache = Substitute.For(); - stateModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.IDLE); + stateModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.Idle); configuration = ScriptableObject.CreateInstance(); sourceFactory = new NearbyAudioSourceFactory(configuration); diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/PerformanceTests/NearbyVoiceChatNametagSystemPerformanceTest.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/PerformanceTests/NearbyVoiceChatNametagSystemPerformanceTest.cs index f74542aa496..31e6580601f 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/PerformanceTests/NearbyVoiceChatNametagSystemPerformanceTest.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/PerformanceTests/NearbyVoiceChatNametagSystemPerformanceTest.cs @@ -42,7 +42,7 @@ public void SetUp() registry = Substitute.For(); - stateModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.IDLE); + stateModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.Idle); var muteService = new NearbyMuteService(Substitute.For(), Substitute.For()); Entity playerEntity = world.Create(); diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/UI/NearbyVoiceChatButtonController.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/UI/NearbyVoiceChatButtonController.cs index 2afd97500d2..63a67ac93db 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/UI/NearbyVoiceChatButtonController.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/UI/NearbyVoiceChatButtonController.cs @@ -19,7 +19,7 @@ public NearbyVoiceChatButtonController(NearbyVoiceChatButtonView view, NearbyVoi this.view = view; view.SetState(stateModel.State.Value); - view.IsSuppressed = stateModel.State.Value == NearbyVoiceChatState.SUPPRESSED; + view.IsSuppressed = stateModel.State.Value == NearbyVoiceChatState.Suppressed; view.CloseAreaButton.onClick.AddListener(view.HideDisabledTooltip); view.InitializeSoundWave(() => stateModel.IsLocalSpeaking ? 1f : 0f); stateSubscription = stateModel.State.Subscribe(OnStateChanged); @@ -29,9 +29,9 @@ public NearbyVoiceChatButtonController(NearbyVoiceChatButtonView view, NearbyVoi private void OnStateChanged(NearbyVoiceChatState state) { view.SetState(state); - view.IsSuppressed = state == NearbyVoiceChatState.SUPPRESSED; + view.IsSuppressed = state == NearbyVoiceChatState.Suppressed; - if (state != NearbyVoiceChatState.SUPPRESSED) + if (state != NearbyVoiceChatState.Suppressed) view.HideDisabledTooltip(); } @@ -41,8 +41,8 @@ private void OnSuppressionReasonChanged(SuppressionReason? reason) string text = reason switch { - SuppressionReason.SCENE => SCENE_SUPPRESSED_TEXT, - SuppressionReason.SCENE_BAN => SCENE_BAN_SUPPRESSED_TEXT, + SuppressionReason.Scene => SCENE_SUPPRESSED_TEXT, + SuppressionReason.SceneBan => SCENE_BAN_SUPPRESSED_TEXT, _ => CALL_SUPPRESSED_TEXT, }; diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/UI/NearbyVoiceChatButtonView.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/UI/NearbyVoiceChatButtonView.cs index 9397c5b7430..2777ee3280c 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/UI/NearbyVoiceChatButtonView.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/UI/NearbyVoiceChatButtonView.cs @@ -52,7 +52,7 @@ public struct MetaStateSprites private void Awake() { soundWaveAnimator.gameObject.SetActive(false); - SetState(NearbyVoiceChatState.DISABLED); + SetState(NearbyVoiceChatState.Disabled); button.onClick.AddListener(HideHoverTooltip); } @@ -66,18 +66,18 @@ public void SetState(NearbyVoiceChatState state) { MetaStateSprites sprites = state switch { - NearbyVoiceChatState.DISABLED => disconnectedSprites, - NearbyVoiceChatState.IDLE => hearingSprites, - NearbyVoiceChatState.OPEN_MIC => speakingSprites, - NearbyVoiceChatState.SUPPRESSED => blockedSprites, + NearbyVoiceChatState.Disabled => disconnectedSprites, + NearbyVoiceChatState.Idle => hearingSprites, + NearbyVoiceChatState.OpenMic => speakingSprites, + NearbyVoiceChatState.Suppressed => blockedSprites, _ => disconnectedSprites, }; - greenDotImage.SetActive(state is NearbyVoiceChatState.IDLE or NearbyVoiceChatState.OPEN_MIC); + greenDotImage.SetActive(state is NearbyVoiceChatState.Idle or NearbyVoiceChatState.OpenMic); unselectedImage.sprite = sprites.unselected; hoverStateImage.sprite = sprites.hover; - soundWaveAnimator.gameObject.SetActive(state == NearbyVoiceChatState.OPEN_MIC); + soundWaveAnimator.gameObject.SetActive(state == NearbyVoiceChatState.OpenMic); } public void InitializeSoundWave(Func amplitudeProvider) diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/UI/NearbyVoiceWidgetController.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/UI/NearbyVoiceWidgetController.cs index 4ce8190c358..75db28f23ed 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/UI/NearbyVoiceWidgetController.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/UI/NearbyVoiceWidgetController.cs @@ -62,16 +62,16 @@ private void SyncViewWithState(NearbyVoiceChatState state) { switch (state) { - case NearbyVoiceChatState.SUPPRESSED or NearbyVoiceChatState.DISABLED: + case NearbyVoiceChatState.Suppressed or NearbyVoiceChatState.Disabled: UnsubscribePushToTalk(); view.CloseAreaButton.onClick.Invoke(); break; - case NearbyVoiceChatState.IDLE: + case NearbyVoiceChatState.Idle: SubscribePushToTalk(); break; } - bool isSpeaking = state == NearbyVoiceChatState.OPEN_MIC; - bool isConnected = isSpeaking || state is NearbyVoiceChatState.IDLE; + bool isSpeaking = state == NearbyVoiceChatState.OpenMic; + bool isConnected = isSpeaking || state is NearbyVoiceChatState.Idle; view.HearOthersToggle.SetIsOnWithoutNotify(isConnected); view.VolumeSliderContainer.SetActive(isConnected); @@ -93,12 +93,12 @@ private void OnHearOthersToggled(bool isOn) private void OnSpeakButtonClicked() { - if (stateModel.State.Value == NearbyVoiceChatState.IDLE) + if (stateModel.State.Value == NearbyVoiceChatState.Idle) { - stateModel.StartSpeaking(NearbyVoiceActivation.BUTTON); + stateModel.StartSpeaking(NearbyVoiceActivation.Button); view.HearText.text = SPEAKING_BUTTON_TEXT; } - else if (stateModel.State.Value == NearbyVoiceChatState.OPEN_MIC) + else if (stateModel.State.Value == NearbyVoiceChatState.OpenMic) stateModel.StopSpeaking(); } @@ -123,7 +123,7 @@ private void UnsubscribePushToTalk() private void OnPushToTalkPressed(InputAction.CallbackContext ctx) { view.HearText.text = SPEAKING_PUSH_TO_TALK_TEXT; - stateModel.StartSpeaking(NearbyVoiceActivation.PUSH_TO_TALK); + stateModel.StartSpeaking(NearbyVoiceActivation.PushToTalk); } private void OnPushToTalkReleased(InputAction.CallbackContext ctx) diff --git a/Explorer/Assets/DCL/VoiceChat/VoiceChatContainer.cs b/Explorer/Assets/DCL/VoiceChat/VoiceChatContainer.cs index cc3b1e9922f..422a9fd02d2 100644 --- a/Explorer/Assets/DCL/VoiceChat/VoiceChatContainer.cs +++ b/Explorer/Assets/DCL/VoiceChat/VoiceChatContainer.cs @@ -76,8 +76,8 @@ public VoiceChatContainer( NearbyStateModel = FeaturesRegistry.Instance.IsEnabled(FeatureId.NEARBY_VOICE_CHAT) ? new NearbyVoiceChatStateModel( DCLPlayerPrefs.GetBool(DCLPrefKeys.NEARBY_VOICE_CHAT_DISABLED) - ? NearbyVoiceChatState.DISABLED - : NearbyVoiceChatState.IDLE) + ? NearbyVoiceChatState.Disabled + : NearbyVoiceChatState.Idle) : null; } From 4fdee5605804bf998cbe10f79afd1f46e09cb5dd Mon Sep 17 00:00:00 2001 From: Vitaly Popuzin Date: Fri, 24 Jul 2026 11:40:50 +0200 Subject: [PATCH 5/8] refactor: rename enum members to PascalCase (safe subset) Rename CAP_SNAKE_CASE enum members to PascalCase across the project, enforced by the ENUM_MEMBER UserRule in Explorer.sln.DotSettings. Only provably-safe enums are renamed: each was audited to confirm its member names never cross a by-name boundary (Enum.Parse/nameof/ToString reaching wire, analytics, query strings, PlayerPrefs, disk, cache keys, AudioMixer/shader/SortingLayer names, or JSON StringEnumConverter). Enums whose member name is serialized are intentionally left as-is (SortBy, SortDirection, NotificationType, SDKVersion, SeasonState, AssetBundleRegistryEnum, AudioMixerExposedParam, OpenBadgeSectionOrigin, LoginMethod, ChatChannelType, and the Communities/DTO wire enums). Also fixes Web3IdentitySource, which had regressed to CAP_SNAKE on this branch after the #9100 deep-link merge. --- .../ApplicationBlocklistGuard.cs | 2 +- .../BlockedScreenController.cs | 2 +- .../Data/SpecProfile.cs | 10 +- .../Logic/MinimumSpecsGuard.cs | 10 +- .../InsufficientDiskSpaceScreenController.cs | 2 +- .../UI/MinimumSpecsScreenController.cs | 2 +- .../LauncherRedirectionScreenController.cs | 2 +- .../Assets/DCL/AssetsProvision/AssetSource.cs | 18 +- .../CodeResolver/JsCodeResolver.cs | 4 +- .../Contextual/ContextualAsset.cs | 16 +- .../Contextual/ContextualImage.cs | 8 +- Explorer/Assets/DCL/Audio/AudioClipConfig.cs | 2 +- .../DCL/Audio/UIAudioPlaybackController.cs | 6 +- .../AuthenticationScreenController.cs | 6 +- ...entityVerificationDappDeepLinkAuthState.cs | 4 +- .../IdentityVerificationOTPAuthState.cs | 4 +- .../States/LobbyForNewAccountAuthState.cs | 2 +- .../States/LoginSelectionAuthState.cs | 16 +- .../States/ProfileFetchingAuthState.cs | 6 +- .../Editor/MoveAvatarPlayableAsset.cs | 2 +- .../Editor/MoveAvatarPlayableBehaviour.cs | 4 +- .../AvatarCachedVisibilityComponent.cs | 20 +- .../Components/HiddenPlayerComponent.cs | 4 +- .../Systems/AvatarInstantiatorSystem.cs | 4 +- .../Systems/AvatarShapeVisibilitySystem.cs | 4 +- .../AvatarShapeVisibilitySystemShould.cs | 12 +- .../Intents/GetEmotesByPointersIntention.cs | 2 +- .../GetSceneEmoteFromRealmIntention.cs | 2 +- .../Emotes/EmoteTriggerSource.cs | 4 +- .../Helpers/EmoteWheelShortcutHandler.cs | 4 +- .../Emotes/Plugin/EmotesContainer.cs | 6 +- .../Systems/Play/SceneMaskedEmoteSystem.cs | 2 +- .../Emotes/Systems/UpdateEmoteInputSystem.cs | 6 +- .../Tests/UpdateEmoteInputSystemShould.cs | 2 +- .../Thumbnails/Utils/LoadThumbnailsUtils.cs | 2 +- .../GetWearablesByPointersIntention.cs | 2 +- .../Load/LoadDefaultWearablesSystem.cs | 4 +- .../AvatarSection/AvatarController.cs | 2 +- .../Outfits/Commands/DeleteOutfitCommand.cs | 2 +- .../DCL/Backpack/BackpackSearchController.cs | 4 +- .../GiftReceivedPopupController.cs | 2 +- .../GiftSelection/GiftSelectionController.cs | 2 +- .../GiftSelection/GiftingHeaderPresenter.cs | 8 +- .../GiftTransfer/GiftTransferController.cs | 4 +- .../GiftTransferSuccessController.cs | 2 +- ...artWearableAuthorizationPopupController.cs | 2 +- .../ChangeRealmPromptController.cs | 2 +- .../Character/CharacterCamera/CameraMode.cs | 2 +- .../Components/CursorComponent.cs | 2 +- .../ApplyCinemachineCameraInputSystem.cs | 4 +- .../ControlCinemachineVirtualCameraSystem.cs | 18 +- .../Systems/UpdateCameraInputSystem.cs | 2 +- ...ApplyCinemachineCameraInputSystemShould.cs | 2 +- .../CinemachineVirtualCameraSystemShould.cs | 8 +- .../Tests/UpdateCursorInputSystemShould.cs | 2 +- .../Animation/AnimationStatesLogic.cs | 4 +- .../Animation/AvatarAnimationEventsHandler.cs | 24 +- .../Animation/GliderPropAnimationLogic.cs | 2 +- .../CharacterMotion/Components/GlideState.cs | 8 +- .../Components/MovementKind.cs | 12 +- .../OverridableCharacterControllerSettings.cs | 18 +- .../Systems/CalculateCameraFovSystem.cs | 2 +- .../Systems/CalculateSpeedLimitSystem.cs | 2 +- .../Systems/GliderPropControllerSystem.cs | 16 +- .../CharacterMotion/Systems/HeadIKSystem.cs | 2 +- .../Systems/MovePlayerWithDurationSystem.cs | 2 +- .../Systems/PointAtMarkerSystem.cs | 4 +- .../Systems/StunCharacterSystem.cs | 2 +- .../Systems/UpdateInputJumpSystem.cs | 4 +- .../Systems/UpdateInputMovementSystem.cs | 16 +- .../Systems/UpdatePointAndClickInputSystem.cs | 12 +- .../Tests/ApplyExternalForceShould.cs | 6 +- .../Tests/ApplyGlidingShould.cs | 4 +- .../Tests/CoyoteTimerShould.cs | 2 +- .../MovePlayerWithDurationSystemShould.cs | 8 +- .../Utils/MovementSpeedLimitHelper.cs | 8 +- .../Velocity/ApplyExternalForce.cs | 2 +- .../CharacterMotion/Velocity/ApplyGliding.cs | 8 +- .../CharacterMotion/Velocity/ApplyJump.cs | 8 +- .../Velocity/ApplySlopeModifier.cs | 2 +- .../CharacterTransformDirtyFlagShould.cs | 4 +- .../Chat/ChatConversationsToolbarViewItem.cs | 6 +- Explorer/Assets/DCL/Chat/ChatTitlebarView.cs | 6 +- .../DCL/Chat/Commands/ChatTeleporter.cs | 30 +- .../DCL/Chat/MessageBus/ChatMessageOrigins.cs | 24 +- .../DCL/Chat/MessageBus/IChatMessagesBus.cs | 2 +- .../Chat/MessageBus/LiveKitChatMessagesBus.cs | 6 +- .../MessageBus/TeleportPromptChatBridge.cs | 2 +- .../Assets/DCL/Chat/RPCChatPrivacyService.cs | 2 +- .../DCL/Chat/Settings/ChatSettingsAsset.cs | 44 +- .../ChatMainSharedAreaController.cs | 2 +- .../ChatChannels/ChatChannelsView.cs | 6 +- .../ChatCommands/GetUserCallStatusCommand.cs | 18 +- .../ChatCommands/GetUserChatStatusCommand.cs | 2 +- .../ChatCommands/ResolveInputStateCommand.cs | 2 +- .../ChatCommands/SendMessageCommand.cs | 4 +- .../_Refactor/ChatInput/ChatInputPresenter.cs | 2 +- .../ChatInput/States/BlockedChatInputState.cs | 14 +- .../States/SuggestionPanelChatInputState.cs | 4 +- .../ChatMessages/ChatMessageFeedPresenter.cs | 4 +- .../DCL/Chat/_Refactor/ChatPanelPresenter.cs | 4 +- .../Core/ChatReactionsFactory.cs | 4 +- .../Presenters/EmojiPanelReactionBridge.cs | 4 +- .../ChatServices/ChatHistoryService.cs | 6 +- .../ChatServices/ChatWorldBubbleService.cs | 6 +- .../PrivateConversationUserStateService.cs | 38 +- .../ChatTitleBar/ChatTitlebarPresenter.cs | 18 +- .../ChatViews/ChannelMemberFeedView.cs | 2 +- .../ChatViews/ChatDefaultTitlebarView.cs | 4 +- .../CommunitiesBrowserController.cs | 30 +- ...tiesBrowserFilteredCommunitiesPresenter.cs | 8 +- ...unitiesBrowserMainRightSectionPresenter.cs | 10 +- .../CommunitiesBrowserRightSectionMainView.cs | 4 +- ...iesBrowserStreamingCommunitiesPresenter.cs | 8 +- .../CommunityRequestsReceivedGroupView.cs | 6 +- .../CommunityResultCardView.cs | 54 +- .../FilteredCommunitiesView.cs | 10 +- .../Announcements/AnnouncementCardView.cs | 2 +- .../AnnouncementEmojiController.cs | 2 +- .../AnnouncementsSectionController.cs | 2 +- .../CommunityCardController.cs | 18 +- .../CommunitiesCard/CommunityCardView.cs | 50 +- .../CommunityCardVoiceChatPresenter.cs | 12 +- .../Members/FriendshipHelpers.cs | 24 +- .../Members/MemberListItemView.cs | 18 +- .../Members/MembersListController.cs | 46 +- .../Members/MembersListView.cs | 24 +- .../Places/PlacesSectionView.cs | 2 +- .../DTOs/CommunitySorting.cs | 4 +- .../CommunityCreationEditionController.cs | 6 +- .../Donations/UI/DonationsPanelController.cs | 12 +- .../DCL/Donations/UI/DonationsPanelView.cs | 26 +- .../DCL/EmojiPanel/EmojiPanelPresenter.cs | 4 +- .../DCL/EmotesWheel/EmotesWheelController.cs | 10 +- .../DCL/Events/EventDetailPanelController.cs | 2 +- .../DCL/Events/EventsByDayController.cs | 6 +- .../DCL/Events/EventsCalendarController.cs | 6 +- .../Assets/DCL/Events/EventsController.cs | 2 +- Explorer/Assets/DCL/Events/EventsSection.cs | 4 +- Explorer/Assets/DCL/Events/EventsView.cs | 4 +- .../ExplorePanel/ExplorePanelController.cs | 994 +++++++++--------- .../ExternalUrlPromptController.cs | 2 +- .../DCL/FeatureFlags/FeaturesRegistry.cs | 226 ++-- .../FriendsConnectivityStatusTracker.cs | 8 +- .../Assets/DCL/Friends/FriendshipStatus.cs | 12 +- .../Assets/DCL/Friends/RPCFriendsService.cs | 12 +- .../FriendsConnectivityStatusTrackerShould.cs | 8 +- .../BlockUserPromptController.cs | 2 +- .../BlockUserPrompt/BlockUserPromptParams.cs | 4 +- .../UI/BlockUserPrompt/BlockUserPromptView.cs | 4 +- .../UI/FriendPanel/FriendsPanelController.cs | 34 +- .../PersistentFriendPanelOpenerController.cs | 10 +- .../Blocked/BlockedSectionController.cs | 4 +- ...ListPagedDoubleCollectionRequestManager.cs | 10 +- .../Friends/FriendListSectionUtilities.cs | 2 +- .../Sections/Friends/FriendListUserView.cs | 4 +- .../Friends/FriendSectionController.cs | 2 +- ...riendsSectionDoubleCollectionController.cs | 6 +- .../Sections/Requests/RequestUserView.cs | 2 +- .../Requests/RequestsRequestManager.cs | 8 +- .../Requests/RequestsSectionController.cs | 8 +- .../UI/FriendPanel/StatusWrapperView.cs | 16 +- .../FriendPushNotificationController.cs | 2 +- .../UI/Requests/FriendRequestController.cs | 50 +- .../UI/UnfriendConfirmationPopupController.cs | 2 +- .../CameraReelGalleryController.cs | 24 +- .../CameraReelToast/CameraReelToastMessage.cs | 12 +- .../ToggleInWorldCameraActivitySystem.cs | 16 +- .../UI/InWorldCameraController.cs | 2 +- .../PhotoDetail/PhotoDetailController.cs | 12 +- .../CRDTTests/Protocol/CRDTProtocolShould.cs | 8 +- .../CRDT/CRDTTests/Protocol/CRDTTestsUtils.cs | 4 +- .../CRDTTests/Protocol/ParsedCRDTTestFile.cs | 4 +- .../CrdtEcsBridge/ISceneCommunicationPipe.cs | 4 +- ...mmunicationsControllerAPIImplementation.cs | 2 +- ...icationsControllerAPIImplementationBase.cs | 12 +- .../SDKMessageBusCommsAPIImplementation.cs | 2 +- .../Communications/SceneCommunicationPipe.cs | 2 +- .../ConfigureSceneMaterial.cs | 2 +- .../AssetBundles/GetAssetBundleIntention.cs | 6 +- ...eAssetBundleLoadingParametersSystemBase.cs | 10 +- .../LoadAssetBundlePartialSystemShould.cs | 2 +- ...ssetBundleLoadingParametersSystemShould.cs | 24 +- .../Components/CommonLoadingArguments.cs | 8 +- .../Common/Components/ILoadingIntention.cs | 2 +- .../Common/Components/SubIntention.cs | 2 +- .../LoadSystemBaseAbandonedResultShould.cs | 4 +- .../Tests/LoadSystemBaseShould.cs | 4 +- .../Global/Dynamic/Bootstraper.cs | 2 +- .../Global/Dynamic/CommsContainer.cs | 2 +- .../Global/Dynamic/DynamicWorldContainer.cs | 20 +- .../Global/Dynamic/GlobalWorldFactory.cs | 4 +- .../Global/Dynamic/InitialRealm.cs | 2 +- .../Global/Dynamic/Landscapes/Landscape.cs | 26 +- .../Global/Dynamic/MainSceneLoader.cs | 26 +- .../ECSPortableExperiencesController.cs | 8 +- .../Global/Dynamic/RealmController.cs | 2 +- .../Global/Dynamic/RealmUrl/RealmUrls.cs | 2 +- .../Editor/RealmLaunchSettingsDrawer.cs | 2 +- .../UntrustedRealmConfirmationController.cs | 2 +- .../DCL/Infrastructure/MVC/CanvasOrdering.cs | 16 +- .../Examples/ExampleControllerWithSystem.cs | 2 +- .../MVC/Examples/MVCCheetSheet.cs | 2 +- .../DCL/Infrastructure/MVC/IController.cs | 2 +- .../MVCFacade/MVCManagerMenusAccessFacade.cs | 36 +- .../Infrastructure/MVC/Manager/MVCManager.cs | 8 +- .../MVC/Tests/ControllerBaseShould.cs | 6 +- .../MVC/Tests/MVCManagerShould.cs | 16 +- .../IMVCManagerMenusAccessFacade.cs | 18 +- .../WindowsStackManager/WindowStackManager.cs | 12 +- .../Components/SceneLoadingState.cs | 16 +- .../SceneLifeCycle/Debug/SceneAbortKind.cs | 6 +- .../Systems/AbortSceneLoadingDebugSystem.cs | 6 +- .../Systems/RapidSceneReloadDebugSystem.cs | 4 +- .../SceneLifeCycle/ECSBannedScene.cs | 2 +- .../SceneLifeCycle/ECSReloadScene.cs | 2 +- ...solveSceneStateByIncreasingRadiusSystem.cs | 16 +- .../VisualSceneStateResolver.cs | 10 +- .../SceneLifeCycle/Realm/IRealmNavigator.cs | 44 +- .../Realm/PortableExperienceMetadata.cs | 6 +- .../SceneLoadingLimit/SceneLimitsKey.cs | 8 +- .../SceneLoadingLimit/SceneLoadingLimit.cs | 40 +- .../SceneLoadingLimit/SceneTransitionState.cs | 8 +- .../Systems/UnloadSceneSystem.cs | 4 +- .../Tests/VisualSceneStateResolverShould.cs | 36 +- .../Apis/Modules/CommsApi/CommsApiWrap.cs | 2 +- .../CommsApi/GetActiveVideoStreamsResponse.cs | 16 +- .../Modules/Ethereums/EthereumApiWrapper.cs | 4 +- .../Apis/Modules/Players/PlayersWrap.cs | 2 +- .../UserIdentityApi/UserIdentityApiWrapper.cs | 2 +- .../DCL/Input/Component/InputMapComponent.cs | 28 +- .../DCL/Input/Systems/ApplyInputMapsSystem.cs | 16 +- .../Input/Systems/UpdateCursorInputSystem.cs | 14 +- .../ProcessOtherAvatarsInteractionSystem.cs | 4 +- ...cessOtherAvatarsInteractionSystemShould.cs | 2 +- .../LOD/Components/InitialSceneStateLOD.cs | 16 +- .../Assets/DCL/LOD/Components/SceneLODInfo.cs | 2 +- .../Systems/InstantiateSceneLODInfoSystem.cs | 2 +- .../DCL/LOD/Systems/ResolveISSLODSystem.cs | 2 +- .../DCL/LOD/Systems/UnloadSceneLODSystem.cs | 6 +- .../LOD/Systems/UpdateSceneLODInfoSystem.cs | 6 +- .../EditMode/ResolveISSLODSystemShould.cs | 2 +- .../DCL/Landscape/Jobs/NoiseComposeJob.cs | 8 +- .../Assets/DCL/Landscape/Jobs/NoiseJob.cs | 22 +- .../Landscape/Jobs/NoiseSimpleOperation.cs | 8 +- Explorer/Assets/DCL/Landscape/Noise.cs | 6 +- .../CompositeNoiseGenerator.cs | 2 +- .../NoiseGeneration/NoiseGenerator.cs | 2 +- .../DCL/Landscape/Settings/LandscapeData.cs | 6 +- .../MapRenderer/MapLayers/Pins/IPinMarker.cs | 4 +- .../MapRenderer/MapLayers/Pins/PinMarker.cs | 2 +- .../MapLayers/Pins/PinMarkerController.cs | 2 +- .../MapRenderer/MapPath/MapPathController.cs | 2 +- .../CreditsUnlockedController.cs | 2 +- .../MarketplaceCreditsMenuController.cs | 20 +- .../MarketplaceCreditsMenuView.cs | 10 +- .../Purchase/CreditsPurchaseService.cs | 74 +- .../Purchase/CreditsPurchaseTypes.cs | 48 +- .../Relay/CreditsManagerMetaTxRelayer.cs | 28 +- .../Purchase/Relay/PolygonSettlementPoller.cs | 18 +- .../Tests/CreditsPurchaseServiceShould.cs | 38 +- .../Tests/CreditsTopUpServiceShould.cs | 48 +- .../Purchase/TopUp/CreditsTopUpService.cs | 40 +- .../Purchase/TopUp/CreditsTopUpTypes.cs | 26 +- .../TopUp/UI/CreditsTopUpModalController.cs | 64 +- .../UI/CreditPurchaseModalController.cs | 76 +- ...ketplaceCreditsVerifyEmailSubController.cs | 4 +- .../MarketplaceCreditsWelcomeSubController.cs | 8 +- .../Assets/DCL/Minimap/MinimapController.cs | 4 +- .../Minimap/SceneRestrictionsController.cs | 16 +- .../Tests/SceneRestrictionControllerShould.cs | 50 +- .../VoiceChatActivatableConnectiveRoom.cs | 12 +- .../GateKeeper/Rooms/GateKeeperSceneRoom.cs | 8 +- .../Messaging/Hubs/MessagePipesHub.cs | 6 +- .../Messaging/Pipe/IMessagePipe.cs | 6 +- .../Connections/Messaging/Pipe/MessagePipe.cs | 2 +- .../Connections/Pulse/ENet/ENetTransport.cs | 14 +- .../Connections/Pulse/ITransport.cs | 10 +- .../Connections/Pulse/PeerIdCache.cs | 12 +- .../Pulse/PulseMultiplayerService.cs | 4 +- .../Tests/PulseMultiplayerServiceShould.cs | 4 +- .../Connective/ActivatableConnectiveRoom.cs | 2 +- .../Rooms/Connective/ConnectiveRoom.cs | 42 +- .../Rooms/Connective/IConnectiveRoom.cs | 12 +- .../Connective/ProxiedConnectiveRoomBase.cs | 2 +- .../Connections/Rooms/InteriorRoom.cs | 6 +- .../Connections/Rooms/RoomSource.cs | 10 +- .../Systems/Debug/DebugPulseSystem.cs | 2 +- .../DebugRoomsSystem.Indicator.cs | 2 +- .../Settings/MultiplayerMovementSettings.cs | 4 +- .../Movement/Systems/MultiplayerContainer.cs | 2 +- .../Systems/MultiplayerMovementDebugSystem.cs | 4 +- .../Systems/PlayerMovementNetSendSystem.cs | 2 +- .../PulseMultiplayerBus.PlayerState.cs | 8 +- .../Movement/Systems/PulseMultiplayerBus.cs | 4 +- .../Systems/RemotePlayerAnimationSystem.cs | 2 +- .../Systems/RemotePlayersMovementSystem.cs | 12 +- .../Tests/MovementMessageCompressionTests.cs | 8 +- ...PulseMultiplayerBusRealmFilteringShould.cs | 8 +- .../PulseIncomingProfileAnnouncements.cs | 2 +- .../LiveKitMessagesBroadcaster.cs | 6 +- .../Profiles/Entities/RemoteEntities.cs | 2 +- .../Profiles/RemoteProfiles/RemoteProfiles.cs | 2 +- .../LiveKitRemoveIntentions.cs | 8 +- .../RemoveIntentions/PulseRemoveIntentions.cs | 4 +- .../Profiles/Tables/EntityParticipantTable.cs | 2 +- .../Systems/NametagPlacementSystem.cs | 4 +- .../DCL/Navmap/EventInfoPanelController.cs | 2 +- .../DCL/Navmap/NavmapSearchBarController.cs | 450 ++++---- .../DCL/Navmap/PlaceInfoPanelController.cs | 30 +- .../Navmap/PlacesAndEventsPanelController.cs | 12 +- .../SearchForPlaceAndShowResultsCommand.cs | 2 +- .../Assets/DCL/Navmap/ShowEventInfoCommand.cs | 2 +- .../Assets/DCL/Navmap/ShowPlaceInfoCommand.cs | 4 +- .../Browser/DecentralandUrlsSource.cs | 28 +- .../Browser/GatewayUrlsSource.cs | 8 +- .../DCL/NftPrompt/NftPromptController.cs | 2 +- .../NewNotificationController.cs | 8 +- .../NotificationsPanelController.cs | 2 +- .../NotificationsRequestController.cs | 2 +- .../NotificationJsonDtoConverter.cs | 2 +- ...PassportAdditionalFieldsConfigurationSO.cs | 22 +- ...tionalFieldsPassportSubModuleController.cs | 90 +- .../UserBasicInfoPassportModuleController.cs | 4 +- .../Assets/DCL/Passport/PassportController.cs | 90 +- .../Assets/DCL/Passport/PassportSection.cs | 10 +- Explorer/Assets/DCL/Passport/PassportView.cs | 4 +- .../Analytics/AnalyticsConfiguration.cs | 8 +- .../Analytics/EventBased/EventsAnalytics.cs | 2 +- .../EventBased/ExplorePanelAnalytics.cs | 2 +- .../Analytics/Systems/AnalyticsContainer.cs | 8 +- .../Systems/AdaptPhysicsSystem.cs | 2 +- .../Systems/AdaptivePerformancePlugin.cs | 2 +- .../Systems/AdaptivePhysicsSettings.cs | 8 +- .../Systems/UpdatePhysicsSimulationSystem.cs | 6 +- .../Memory/MemoryBudget.cs | 36 +- .../Memory/SystemMemoryCap.cs | 10 +- .../Tests/MemoryBudgetProviderShould.cs | 6 +- .../Profiling/ECS/DebugViewProfilingSystem.cs | 12 +- .../PerformanceBottleneckDetector.cs | 20 +- .../DCL/Places/PlaceDetailPanelController.cs | 2 +- .../Assets/DCL/Places/PlacesController.cs | 12 +- .../DCL/Places/PlacesResultsController.cs | 32 +- .../Assets/DCL/Places/PlacesResultsView.cs | 4 +- Explorer/Assets/DCL/Places/PlacesSection.cs | 8 +- .../Assets/DCL/Places/PlacesSortByFilter.cs | 4 +- Explorer/Assets/DCL/Places/PlacesView.cs | 16 +- .../DCL/PluginSystem/Global/AvatarPlugin.cs | 4 +- .../Global/CharacterMotionPlugin.cs | 4 +- .../DCL/PluginSystem/Global/ChatPlugin.cs | 2 +- .../Global/CreditPurchasePlugin.cs | 2 +- .../DCL/PluginSystem/Global/EmotePlugin.cs | 2 +- .../PluginSystem/Global/EnsureClockSync.cs | 8 +- .../Global/EnsureClockSyncPlugin.cs | 12 +- .../PluginSystem/Global/ExplorePanelPlugin.cs | 8 +- .../PluginSystem/Global/FriendsContainer.cs | 6 +- .../Global/FriendsServicesContainer.cs | 2 +- .../DCL/PluginSystem/Global/InputPlugin.cs | 2 +- .../Global/MultiplayerConnectionWatchdog.cs | 4 +- .../Global/SocialServicesContainer.cs | 2 +- .../DCL/PluginSystem/Global/StaticSettings.cs | 6 +- .../PluginSystem/Global/VoiceChatPlugin.cs | 6 +- .../DCL/PluginSystem/Global/WearablePlugin.cs | 2 +- .../Global/Web3AuthenticationPlugin.cs | 2 +- .../PluginSystem/World/AssetBundlesPlugin.cs | 4 +- .../PluginSystem/World/MaterialWorldPlugin.cs | 2 +- .../Repository/RealmProfileRepository.cs | 6 +- .../Assets/DCL/Profiles/Self/SelfProfile.cs | 6 +- .../Profiles/SharedAPI/IProfileRepository.cs | 8 +- .../Profiles/SharedAPI/Profile.CompactInfo.cs | 4 +- .../SharedAPI/ProfileRepositoryExtensions.cs | 10 +- .../RealmNavigation/ITeleportController.cs | 8 +- .../UI/PrivateWorldPopupController.cs | 2 +- .../DCL/RealmNavigation/RealmNavigator.cs | 14 +- .../UnloadCacheImmediateTeleportOperation.cs | 2 +- .../DCL/RewardPanel/RewardPanelController.cs | 2 +- .../DCL/RuntimeDeepLink/DeepLinkHandle.cs | 8 +- .../DeepLinkHandleImplementation.cs | 8 +- .../DCL/RuntimeDeepLink/DeepLinkSentinel.cs | 6 +- .../Tests/AvatarAttachHandlerSystemShould.cs | 2 +- .../Components/AvatarLocomotionOverrides.cs | 18 +- .../AvatarLocomotionOverridesHelper.cs | 36 +- ...ropagateAvatarLocomotionOverridesSystem.cs | 18 +- .../AvatarModifierAreaHandlerSystem.cs | 8 +- .../Systems/CameraModeAreaHandlerSystem.cs | 6 +- .../MainCamera/Systems/MainCameraSystem.cs | 12 +- .../Tests/EditMode/MainCameraSystemShould.cs | 14 +- .../Components/InputModifierComponent.cs | 56 +- .../Systems/InputModifierHandlerSystem.cs | 8 +- .../Tests/InputModifierHandlerSystemShould.cs | 14 +- .../Components/LightSourceComponent.cs | 8 +- .../Systems/LightSourceCullingSystem.cs | 4 +- .../Systems/LightSourceLodSystem.cs | 2 +- .../MediaStream/LivekitPlayer.cs | 16 +- .../MediaStream/MediaPlayerExtensions.cs | 4 +- .../MediaStream/MultiMediaPlayer.cs | 12 +- .../SDKComponents/SceneUI/Utils/Extensions.cs | 4 +- .../Tests/TriggerAreaHandlerSystemShould.cs | 2 +- .../SDKEntityTriggerAreaComponent.cs | 10 +- ...SDKEntityTriggerAreaHandlerSystemShould.cs | 6 +- .../SceneLoadingScreenController.cs | 2 +- .../SceneRestriction/SceneRestriction.cs | 32 +- .../SceneRestrictionBusController.cs | 2 +- .../Configuration/DropdownModuleBinding.cs | 60 +- .../Configuration/SliderModuleBinding.cs | 56 +- .../Configuration/ToggleModuleBinding.cs | 66 +- .../ChatBubblesVisibilityController.cs | 18 +- .../ChatPrivacySettingsController.cs | 8 +- .../ChatSoundsSettingsController.cs | 12 +- .../ChatTranslationSettingsController.cs | 2 +- .../DoubleTapToMoveSettingsController.cs | 2 +- .../PointAtMarkerVisibilityController.cs | 12 +- .../VoiceChatVolumeSettingsController.cs | 2 +- .../PointAtMarkerVisibilitySettings.cs | 8 +- .../Assets/DCL/Settings/SettingsController.cs | 478 ++++----- .../Assets/DCL/SkyBox/RealmSkyboxState.cs | 4 +- .../Assets/DCL/SkyBox/SDKComponentState.cs | 4 +- .../Assets/DCL/SkyBox/SceneMetadataState.cs | 4 +- .../Systems/SmartWearableSystem.cs | 2 +- .../TeleportPromptController.cs | 2 +- .../HyperlinkTextFormatterShould.cs | 6 +- .../ChatEntryMenuPopupController.cs | 2 +- .../UI/ColorPicker/ColorPickerController.cs | 2 +- .../DCL/UI/Communities/CommunityTitleView.cs | 2 +- .../ConfirmationDialogController.cs | 4 +- .../ConfirmationDialogOpener.cs | 2 +- .../Opener/ConfirmationDialogParameter.cs | 4 +- .../Opener/ReportUserConfirmationDialog.cs | 2 +- .../UI/Controls/ControlsPanelController.cs | 2 +- .../DCL/UI/DebugMenu/ConsolePanelView.cs | 4 +- .../DuplicateIdentityWindowController.cs | 2 +- .../DCL/UI/ErrorPopup/ErrorPopupController.cs | 2 +- .../ErrorPopupWithRetryController.cs | 28 +- .../ChatOptionsContextMenuController.cs | 2 +- .../CommunityPlayerEntryContextMenu.cs | 36 +- ...GenericUserProfileContextMenuController.cs | 44 +- .../UserProfileContextMenuControlSettings.cs | 12 +- .../GenericContextMenuUserProfileView.cs | 22 +- .../GenericContextMenuController.cs | 228 ++-- .../ContextMenuOpenDirection.cs | 12 +- .../GenericContextMenu.cs | 2 +- .../InputSuggestions/BaseSuggestionElement.cs | 8 +- .../EmojiInputSuggestionData.cs | 2 +- .../InputSuggestionPanelController.cs | 2 +- .../InputSuggestionPanelView.cs | 4 +- .../ProfileInputSuggestionData.cs | 2 +- .../UI/MainUIContainer/MainUIController.cs | 2 +- .../DCL/UI/OTPInput/OTPInputFieldView.cs | 14 +- .../Assets/DCL/UI/OTPInput/OTPSlotView.cs | 18 +- .../DCL/UI/OnlineStatusConfiguration.cs | 6 +- .../PastePopupToastController.cs | 2 +- .../Names/ProfileNameEditorController.cs | 2 +- .../GetProfileThumbnailCommand.cs | 4 +- .../ProfileElements/ProfilePictureView.cs | 8 +- .../ProfileThumbnailViewModel.cs | 22 +- .../ProfileThumbnailViewModelExtensions.cs | 6 +- .../ProfileElements/SimpleProfileView.cs | 6 +- .../DCL/UI/Profiles/ProfileMenuController.cs | 2 +- .../Profiles/SidebarProfileMenuController.cs | 2 +- .../UI/Sidebar/HelpMenu/HelpMenuController.cs | 2 +- .../DCL/UI/Sidebar/SidebarController.cs | 14 +- .../SidebarSettingsWidgetController.cs | 2 +- .../DCL/UI/Skybox/SkyboxMenuController.cs | 6 +- .../SmartWearablesSideBarTooltipController.cs | 2 +- .../TextFormatter/HyperlinkTextFormatter.cs | 8 +- .../DCL/UI/TextFormatter/ITextFormatter.cs | 8 +- .../RealUserInAppInitializationFlow.cs | 2 +- .../CommunityStreamButtonPresenter.cs | 4 +- .../CommunityVoiceChatCallStatusService.cs | 42 +- ...CommunityVoiceChatCallStatusServiceNull.cs | 2 +- ...ommunityVoiceChatInCallButtonsPresenter.cs | 2 +- .../CommunityVoiceChatInCallPresenter.cs | 8 +- .../CommunityVoiceChatInCallView.cs | 6 +- .../CommunityVoiceChatPresenter.cs | 24 +- ...mmunityVoiceChatSubTitleButtonPresenter.cs | 6 +- .../SceneVoiceChatPresenter.cs | 4 +- .../VoiceChat/Core/IVoiceChatOrchestrator.cs | 22 +- .../Core/VoiceChatCallTypeValidator.cs | 6 +- .../VoiceChat/Core/VoiceChatOrchestrator.cs | 64 +- .../Core/VoiceChatParticipantState.cs | 10 +- .../Core/VoiceChatParticipantsStateService.cs | 12 +- .../DCL/VoiceChat/Core/VoiceChatRoleHelper.cs | 2 +- .../VoiceChat/Core/VoiceChatRoomManager.cs | 14 +- .../DCL/VoiceChat/Core/VoiceChatStatus.cs | 26 +- .../Microphone/VoiceChatMicrophoneHandler.cs | 2 +- .../VoiceChatMicrophoneStateManager.cs | 10 +- .../Nametags/VoiceChatNametagsHandler.cs | 8 +- .../Core/NearbyMicrophoneHandler.cs | 2 +- .../Core/NearbyVoiceBannedPlayerWatcher.cs | 4 +- .../NearbyVoiceSceneRestrictionWatcher.cs | 4 +- .../Systems/NearbyVoiceChatNametagSystem.cs | 12 +- .../NearbyVoiceBannedPlayerWatcherShould.cs | 12 +- .../EditMode/NearbyVoiceChatManagerShould.cs | 10 +- .../NearbyVoiceChatNametagSystemShould.cs | 28 +- ...byVoiceChatNametagSystemPerformanceTest.cs | 2 +- .../UI/NearbyVoicePanelController.cs | 2 +- .../PrivateVoiceChatCallStatusService.cs | 56 +- .../PrivateVoiceChatCallStatusServiceNull.cs | 2 +- .../PrivateVoiceChatPresenter.cs | 8 +- .../PrivateVoiceChat/PrivateVoiceChatView.cs | 12 +- .../Services/RPCPrivateVoiceChatService.cs | 4 +- .../Services/SceneVoiceChatTrackerService.cs | 2 +- .../DCL/VoiceChat/UI/CallButtonPresenter.cs | 40 +- .../VoiceChat/UI/VoiceChatPanelPresenter.cs | 32 +- .../UI/VoiceChatPanelResizePresenter.cs | 26 +- .../DCL/VoiceChat/VoiceChatContainer.cs | 8 +- .../DeeplinkSigninRetrievalException.cs | 12 +- .../Implementations/CompositeWeb3Provider.cs | 2 +- .../Dapp/DappDeepLinkAuthenticator.cs | 8 +- .../Dapp/DappWeb3EthereumApi.cs | 4 +- .../PrivateKeyAuthenticator.cs | 2 +- .../RandomGeneratedWeb3Authenticator.cs | 2 +- .../Implementations/TokenFileAuthenticator.cs | 2 +- .../DCL/Web3/Identities/IWeb3Identity.cs | 12 +- ...ntityWithNethereumAccountJsonSerializer.cs | 2 +- .../Assets/DCL/Web3/RestrictedEthereumApi.cs | 2 +- Explorer/Assets/DCL/Web3/Web3RequestSource.cs | 2 +- .../Dumper/EnvelopeJsonConverter.cs | 2 +- .../GenericPostArgumentsJsonConverter.cs | 18 +- .../Dumper/WebRequestDumpAnalyticsHandler.cs | 6 +- .../WebRequests/Dumper/WebRequestsDumper.cs | 8 +- .../Assets/DCL/WebRequests/RetryPolicy.cs | 16 +- .../Assets/DCL/WebRequests/WebRequestUtils.cs | 4 +- .../DecentralandProtocol/CommsApi.gen.cs | 6 +- .../SocialServiceV2.gen.cs | 10 +- 525 files changed, 3790 insertions(+), 3790 deletions(-) diff --git a/Explorer/Assets/DCL/ApplicationGuards/ApplicationBlocklistGuard/ApplicationBlocklistGuard.cs b/Explorer/Assets/DCL/ApplicationGuards/ApplicationBlocklistGuard/ApplicationBlocklistGuard.cs index 6b56e795fd9..1d47734aabd 100644 --- a/Explorer/Assets/DCL/ApplicationGuards/ApplicationBlocklistGuard/ApplicationBlocklistGuard.cs +++ b/Explorer/Assets/DCL/ApplicationGuards/ApplicationBlocklistGuard/ApplicationBlocklistGuard.cs @@ -15,7 +15,7 @@ public static class ApplicationBlocklistGuard { public static async UniTask IsUserBlocklistedAsync(IWebRequestController webRequestController, IDecentralandUrlsSource urlsSource, string userID, ModerationDataProvider moderationDataProvider, CancellationToken ct) { - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.REPORT_USER)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.ReportUser)) { var result = await moderationDataProvider.GetBanStatusAsync(userID, ct) .SuppressToResultAsync(ReportCategory.STARTUP); diff --git a/Explorer/Assets/DCL/ApplicationGuards/ApplicationBlocklistGuard/BlockedScreenController.cs b/Explorer/Assets/DCL/ApplicationGuards/ApplicationBlocklistGuard/BlockedScreenController.cs index 8d5f38547f0..3be6839afa4 100644 --- a/Explorer/Assets/DCL/ApplicationGuards/ApplicationBlocklistGuard/BlockedScreenController.cs +++ b/Explorer/Assets/DCL/ApplicationGuards/ApplicationBlocklistGuard/BlockedScreenController.cs @@ -17,7 +17,7 @@ public class BlockedScreenController : ControllerBase CanvasOrdering.SortingLayer.OVERLAY; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Overlay; public BlockedScreenController(ViewFactoryMethod viewFactory, UnityAppWebBrowser webBrowser) : base(viewFactory) { diff --git a/Explorer/Assets/DCL/ApplicationGuards/ApplicationMinimumSpecsGuard/Data/SpecProfile.cs b/Explorer/Assets/DCL/ApplicationGuards/ApplicationMinimumSpecsGuard/Data/SpecProfile.cs index 5d29ae99869..d30951ade22 100644 --- a/Explorer/Assets/DCL/ApplicationGuards/ApplicationMinimumSpecsGuard/Data/SpecProfile.cs +++ b/Explorer/Assets/DCL/ApplicationGuards/ApplicationMinimumSpecsGuard/Data/SpecProfile.cs @@ -4,11 +4,11 @@ namespace DCL.ApplicationGuards { public enum SpecCategory { - OS, - CPU, - GPU, - VRAM, - RAM, + Os, + Cpu, + Gpu, + Vram, + Ram, Storage, ComputeShaders } diff --git a/Explorer/Assets/DCL/ApplicationGuards/ApplicationMinimumSpecsGuard/Logic/MinimumSpecsGuard.cs b/Explorer/Assets/DCL/ApplicationGuards/ApplicationMinimumSpecsGuard/Logic/MinimumSpecsGuard.cs index fc26b043d2b..ad3af173261 100644 --- a/Explorer/Assets/DCL/ApplicationGuards/ApplicationMinimumSpecsGuard/Logic/MinimumSpecsGuard.cs +++ b/Explorer/Assets/DCL/ApplicationGuards/ApplicationMinimumSpecsGuard/Logic/MinimumSpecsGuard.cs @@ -71,11 +71,11 @@ private List Evaluate() // OS string os = systemInfoProvider.OperatingSystem; - results.Add(new SpecResult(SpecCategory.OS, profile.OsCheck(os), profile.OsRequirement, os)); + results.Add(new SpecResult(SpecCategory.Os, profile.OsCheck(os), profile.OsRequirement, os)); // CPU string cpu = systemInfoProvider.ProcessorType; - results.Add(new SpecResult(SpecCategory.CPU, profile.CpuCheck(cpu), profile.CpuRequirement, cpu)); + results.Add(new SpecResult(SpecCategory.Cpu, profile.CpuCheck(cpu), profile.CpuRequirement, cpu)); // GPU string gpuName = systemInfoProvider.GraphicsDeviceName; @@ -93,7 +93,7 @@ private List Evaluate() string actualGpuDisplayString = $"{gpuName}".Trim(); results.Add(new SpecResult( - SpecCategory.GPU, + SpecCategory.Gpu, isGpuSpecMet, gpuRequirementMessage, actualGpuDisplayString @@ -106,7 +106,7 @@ private List Evaluate() // NOTE: e.g., shows "16 GB" not "15.7 GB" string actualVramDisplay = $"{roundedActualVramGB} GB"; - results.Add(new SpecResult(SpecCategory.VRAM, isVramMet, profile.VramRequirement, actualVramDisplay)); + results.Add(new SpecResult(SpecCategory.Vram, isVramMet, profile.VramRequirement, actualVramDisplay)); // RAM int actualRamMB = systemInfoProvider.SystemMemorySize; @@ -115,7 +115,7 @@ private List Evaluate() // NOTE: e.g., shows "16 GB" not "15.7 GB" string actualRamDisplay = $"{roundedActualRamGB} GB"; - results.Add(new SpecResult(SpecCategory.RAM, isRamMet, profile.RamRequirement, actualRamDisplay)); + results.Add(new SpecResult(SpecCategory.Ram, isRamMet, profile.RamRequirement, actualRamDisplay)); try { diff --git a/Explorer/Assets/DCL/ApplicationGuards/ApplicationMinimumSpecsGuard/UI/InsufficientDiskSpaceScreenController.cs b/Explorer/Assets/DCL/ApplicationGuards/ApplicationMinimumSpecsGuard/UI/InsufficientDiskSpaceScreenController.cs index 3293291d6d2..11aaef47538 100644 --- a/Explorer/Assets/DCL/ApplicationGuards/ApplicationMinimumSpecsGuard/UI/InsufficientDiskSpaceScreenController.cs +++ b/Explorer/Assets/DCL/ApplicationGuards/ApplicationMinimumSpecsGuard/UI/InsufficientDiskSpaceScreenController.cs @@ -8,7 +8,7 @@ namespace DCL.ApplicationGuards public class InsufficientDiskSpaceScreenController : ControllerBase { - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.OVERLAY; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Overlay; public InsufficientDiskSpaceScreenController(ViewFactoryMethod viewFactory) : base(viewFactory) { } diff --git a/Explorer/Assets/DCL/ApplicationGuards/ApplicationMinimumSpecsGuard/UI/MinimumSpecsScreenController.cs b/Explorer/Assets/DCL/ApplicationGuards/ApplicationMinimumSpecsGuard/UI/MinimumSpecsScreenController.cs index 874352d7c3a..9d6b09cd9d4 100644 --- a/Explorer/Assets/DCL/ApplicationGuards/ApplicationMinimumSpecsGuard/UI/MinimumSpecsScreenController.cs +++ b/Explorer/Assets/DCL/ApplicationGuards/ApplicationMinimumSpecsGuard/UI/MinimumSpecsScreenController.cs @@ -14,7 +14,7 @@ public class MinimumSpecsScreenController : ControllerBase specResult; - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.OVERLAY; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Overlay; public readonly UniTaskCompletionSource HoldingTask; private MinimumSpecsTablePresenter specsTablePresenter; diff --git a/Explorer/Assets/DCL/ApplicationGuards/ApplicationVersionGuard/LauncherRedirectionScreenController.cs b/Explorer/Assets/DCL/ApplicationGuards/ApplicationVersionGuard/LauncherRedirectionScreenController.cs index 2d9a5ac730c..ac081ea8520 100644 --- a/Explorer/Assets/DCL/ApplicationGuards/ApplicationVersionGuard/LauncherRedirectionScreenController.cs +++ b/Explorer/Assets/DCL/ApplicationGuards/ApplicationVersionGuard/LauncherRedirectionScreenController.cs @@ -14,7 +14,7 @@ public class LauncherRedirectionScreenController : ControllerBase CanvasOrdering.SortingLayer.OVERLAY; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Overlay; public LauncherRedirectionScreenController(ApplicationVersionGuard versionGuard, ViewFactoryMethod viewFactory, string current, string latest) : base(viewFactory) { diff --git a/Explorer/Assets/DCL/AssetsProvision/AssetSource.cs b/Explorer/Assets/DCL/AssetsProvision/AssetSource.cs index 02c6c9d6749..96d6f2766f2 100644 --- a/Explorer/Assets/DCL/AssetsProvision/AssetSource.cs +++ b/Explorer/Assets/DCL/AssetsProvision/AssetSource.cs @@ -10,27 +10,27 @@ namespace AssetManagement [Flags] public enum AssetSource { - NONE = 0, + None = 0, /// /// From the resources bundled at build time /// - EMBEDDED = 1, + Embedded = 1, /// /// Downloaded over network /// - WEB = 1 << 1, + Web = 1 << 1, /// /// Downloaded over Addressables /// - ADDRESSABLE = 1 << 2, + Addressable = 1 << 2, /// /// All sources /// - ALL = EMBEDDED | WEB | ADDRESSABLE, + All = Embedded | Web | Addressable, } public static class AssetSourceEnumExtensions @@ -38,16 +38,16 @@ public static class AssetSourceEnumExtensions private static readonly Dictionary CURRENT_SOURCE_STRINGS = new () { { - AssetSource.ADDRESSABLE, "ADDRESSABLE" + AssetSource.Addressable, "ADDRESSABLE" }, { - AssetSource.EMBEDDED, "EMBEDDED" + AssetSource.Embedded, "EMBEDDED" }, { - AssetSource.WEB, "WEB" + AssetSource.Web, "WEB" }, { - AssetSource.NONE, "NONE" + AssetSource.None, "NONE" }, }; diff --git a/Explorer/Assets/DCL/AssetsProvision/CodeResolver/JsCodeResolver.cs b/Explorer/Assets/DCL/AssetsProvision/CodeResolver/JsCodeResolver.cs index 18fa7476e51..bd02527662e 100644 --- a/Explorer/Assets/DCL/AssetsProvision/CodeResolver/JsCodeResolver.cs +++ b/Explorer/Assets/DCL/AssetsProvision/CodeResolver/JsCodeResolver.cs @@ -15,11 +15,11 @@ public JsCodeResolver(IWebRequestController webRequestController) { providers = new Dictionary { - { AssetSource.WEB, new WebJsCodeProvider(webRequestController) }, + { AssetSource.Web, new WebJsCodeProvider(webRequestController) }, }; } public UniTask GetCodeContent(URLAddress contentUrl, CancellationToken ct) => - providers[AssetSource.WEB].GetJsCodeAsync(contentUrl, ct); + providers[AssetSource.Web].GetJsCodeAsync(contentUrl, ct); } } diff --git a/Explorer/Assets/DCL/AssetsProvision/Contextual/ContextualAsset.cs b/Explorer/Assets/DCL/AssetsProvision/Contextual/ContextualAsset.cs index 652e573ae19..e071f6de297 100644 --- a/Explorer/Assets/DCL/AssetsProvision/Contextual/ContextualAsset.cs +++ b/Explorer/Assets/DCL/AssetsProvision/Contextual/ContextualAsset.cs @@ -15,9 +15,9 @@ public class ContextualAsset : IDisposable where T: Object public enum State { - UNLOADED, - LOADING, - LOADED, + Unloaded, + Loading, + Loaded, } public State CurrentState { get; private set; } @@ -26,7 +26,7 @@ public ContextualAsset(AssetReferenceT reference) { this.reference = reference; asset = null; - CurrentState = State.UNLOADED; + CurrentState = State.Unloaded; } public async UniTask> AssetAsync(CancellationToken token) @@ -35,20 +35,20 @@ public async UniTask> AssetAsync(CancellationToken token) { if (asset == null) { - CurrentState = State.LOADING; + CurrentState = State.Loading; var handle = reference.LoadAssetAsync(); await handle.Task!.AsUniTask().AttachExternalCancellation(token); if (handle.Status != AsyncOperationStatus.Succeeded) throw new Exception($"Load failed: {reference.RuntimeKey}"); T value = handle.Result!; asset = new Owned(value); - CurrentState = State.LOADED; + CurrentState = State.Loaded; } return asset!.Downgrade(); } catch (Exception) { - CurrentState = State.UNLOADED; + CurrentState = State.Unloaded; throw; } } @@ -59,7 +59,7 @@ public void Release() reference.ReleaseAsset(); asset.Dispose(out _); asset = null; - CurrentState = State.UNLOADED; + CurrentState = State.Unloaded; } public void Dispose() diff --git a/Explorer/Assets/DCL/AssetsProvision/Contextual/ContextualImage.cs b/Explorer/Assets/DCL/AssetsProvision/Contextual/ContextualImage.cs index e58775aa2c6..ae732ddbc53 100644 --- a/Explorer/Assets/DCL/AssetsProvision/Contextual/ContextualImage.cs +++ b/Explorer/Assets/DCL/AssetsProvision/Contextual/ContextualImage.cs @@ -31,7 +31,7 @@ private void Awake() private void OnEnable() { - if (asset.CurrentState is ContextualAsset.State.UNLOADED) + if (asset.CurrentState is ContextualAsset.State.Unloaded) LoadAsync().Forget(); } @@ -64,9 +64,9 @@ private void OnDestroy() public UniTask TriggerOrWaitReadyAsync(CancellationToken token) => asset.CurrentState switch { - ContextualAsset.State.UNLOADED => LoadAsync(), - ContextualAsset.State.LOADING => UniTask.WaitWhile(() => asset.CurrentState is ContextualAsset.State.LOADING, cancellationToken: token), - ContextualAsset.State.LOADED => UniTask.CompletedTask, + ContextualAsset.State.Unloaded => LoadAsync(), + ContextualAsset.State.Loading => UniTask.WaitWhile(() => asset.CurrentState is ContextualAsset.State.Loading, cancellationToken: token), + ContextualAsset.State.Loaded => UniTask.CompletedTask, _ => throw new ArgumentOutOfRangeException() }; } diff --git a/Explorer/Assets/DCL/Audio/AudioClipConfig.cs b/Explorer/Assets/DCL/Audio/AudioClipConfig.cs index 57fd7e8b711..9d58ef18355 100644 --- a/Explorer/Assets/DCL/Audio/AudioClipConfig.cs +++ b/Explorer/Assets/DCL/Audio/AudioClipConfig.cs @@ -30,7 +30,7 @@ public enum AudioClipSelectionMode public enum AudioCategory { - UI, + Ui, Chat, World, Avatar, diff --git a/Explorer/Assets/DCL/Audio/UIAudioPlaybackController.cs b/Explorer/Assets/DCL/Audio/UIAudioPlaybackController.cs index 073d80fb3e3..e8bd3e8a63f 100644 --- a/Explorer/Assets/DCL/Audio/UIAudioPlaybackController.cs +++ b/Explorer/Assets/DCL/Audio/UIAudioPlaybackController.cs @@ -180,7 +180,7 @@ private bool CheckAudioClips(AudioClipConfig audioClipConfig) private bool CheckAudioCategory(AudioClipConfig audioClipConfig) { //We can only play UI sounds through this bus. Other sounds are discarded - if (audioClipConfig.Category is not (AudioCategory.Chat or AudioCategory.Music or AudioCategory.UI)) + if (audioClipConfig.Category is not (AudioCategory.Chat or AudioCategory.Music or AudioCategory.Ui)) { ReportHub.LogError(new ReportData(ReportCategory.AUDIO), $"Cannot Play Audio {audioClipConfig.name} as it is from category {audioClipConfig.Category} and this bus only supports Chat, Music or UI"); return false; @@ -228,7 +228,7 @@ private AudioSource GetDefaultAudioSourceForCategory(AudioCategory audioCategory { switch (audioCategory) { - case AudioCategory.UI: + case AudioCategory.Ui: return UiAudioSource; case AudioCategory.Chat: return ChatAudioSource; @@ -261,7 +261,7 @@ private void OnBeforeApplicationQuitting() { switch(audioClipPair.Key.Category) { - case AudioCategory.UI: + case AudioCategory.Ui: if(!mixerVolumesController.IsGroupMuted(AudioMixerExposedParam.UI_Volume)) continue; break; diff --git a/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenController.cs b/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenController.cs index 35918d0b417..9df75ce865b 100644 --- a/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenController.cs +++ b/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenController.cs @@ -73,7 +73,7 @@ public enum AuthStatus private UniTaskCompletionSource? lifeCycleTask; private CancellationTokenSource? loginCancellationTokenSource; - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.FULLSCREEN; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Fullscreen; public ReactiveProperty CurrentState { get; } = new (AuthStatus.None); public string CurrentRequestID { get; internal set; } = string.Empty; public LoginMethod CurrentLoginMethod { get; internal set; } @@ -152,7 +152,7 @@ protected override void OnViewInstantiated() audio = new AuthenticationScreenAudio(viewInstance, audioMixerVolumesController, backgroundMusic); characterPreviewController = new AuthenticationScreenCharacterPreviewController(viewInstance.CharacterPreviewView, emotesSettings, characterPreviewFactory, world, characterPreviewEventBus); - bool enableEmailOTP = FeaturesRegistry.Instance.IsEnabled(FeatureId.EMAIL_OTP_AUTH); + bool enableEmailOTP = FeaturesRegistry.Instance.IsEnabled(FeatureId.EmailOTPAuth); viewInstance.LoginSelectionAuthView.EmailOTPContainer.SetActive(enableEmailOTP); viewInstance.DiscordButton.onClick.AddListener(OpenSupportUrl); @@ -212,7 +212,7 @@ private async UniTaskVoid TryAutoLoginAndProceedAsync(IWeb3Identity storedIdenti bool autoLoginSuccess = await web3Authenticator.TryAutoLoginAsync(ct); if (autoLoginSuccess) - fsm.Enter(new (storedIdentity, storedIdentity.Source != IWeb3Identity.Web3IdentitySource.TOKEN_FILE, ct)); + fsm.Enter(new (storedIdentity, storedIdentity.Source != IWeb3Identity.Web3IdentitySource.TokenFile, ct)); else { fsm.Enter(UIAnimationHashes.IN, true); diff --git a/Explorer/Assets/DCL/AuthenticationScreenFlow/States/IdentityVerificationDappDeepLinkAuthState.cs b/Explorer/Assets/DCL/AuthenticationScreenFlow/States/IdentityVerificationDappDeepLinkAuthState.cs index 81ca9d02e00..503f1511e97 100644 --- a/Explorer/Assets/DCL/AuthenticationScreenFlow/States/IdentityVerificationDappDeepLinkAuthState.cs +++ b/Explorer/Assets/DCL/AuthenticationScreenFlow/States/IdentityVerificationDappDeepLinkAuthState.cs @@ -104,12 +104,12 @@ private async UniTaskVoid AuthenticateAsync(LoginMethod method, CancellationToke catch (Web3Exception e) { loginException = e; - machine.Enter(ErrorType.CONNECTION_ERROR); + machine.Enter(ErrorType.ConnectionError); } catch (Exception e) { loginException = e; - machine.Enter(ErrorType.CONNECTION_ERROR); + machine.Enter(ErrorType.ConnectionError); } } } diff --git a/Explorer/Assets/DCL/AuthenticationScreenFlow/States/IdentityVerificationOTPAuthState.cs b/Explorer/Assets/DCL/AuthenticationScreenFlow/States/IdentityVerificationOTPAuthState.cs index 0f9360fa542..16dcb606c56 100644 --- a/Explorer/Assets/DCL/AuthenticationScreenFlow/States/IdentityVerificationOTPAuthState.cs +++ b/Explorer/Assets/DCL/AuthenticationScreenFlow/States/IdentityVerificationOTPAuthState.cs @@ -125,12 +125,12 @@ private async UniTaskVoid AuthenticateAsync(string email, CancellationToken ct) catch (InvalidEmailException e) { loginException = e; - machine.Enter(ErrorType.INVALID_EMAIL); + machine.Enter(ErrorType.InvalidEmail); } catch (Exception e) { loginException = e; - machine.Enter(ErrorType.CONNECTION_ERROR); + machine.Enter(ErrorType.ConnectionError); } finally{ compositeWeb3Provider.OTPSendSucceeded -= OnOTPSendSucceeded; } } diff --git a/Explorer/Assets/DCL/AuthenticationScreenFlow/States/LobbyForNewAccountAuthState.cs b/Explorer/Assets/DCL/AuthenticationScreenFlow/States/LobbyForNewAccountAuthState.cs index 02e25641e2d..00540beb19d 100644 --- a/Explorer/Assets/DCL/AuthenticationScreenFlow/States/LobbyForNewAccountAuthState.cs +++ b/Explorer/Assets/DCL/AuthenticationScreenFlow/States/LobbyForNewAccountAuthState.cs @@ -319,7 +319,7 @@ async UniTaskVoid PublishNewProfileAsync(CancellationToken ct) spanErrorInfo = new SpanErrorInfo("Exception on finalizing new user", e); view.Hide(UIAnimationHashes.SLIDE); - fsm.Enter(ErrorType.CONNECTION_ERROR); + fsm.Enter(ErrorType.ConnectionError); } } } diff --git a/Explorer/Assets/DCL/AuthenticationScreenFlow/States/LoginSelectionAuthState.cs b/Explorer/Assets/DCL/AuthenticationScreenFlow/States/LoginSelectionAuthState.cs index 62f0a63bc78..186a7f71f29 100644 --- a/Explorer/Assets/DCL/AuthenticationScreenFlow/States/LoginSelectionAuthState.cs +++ b/Explorer/Assets/DCL/AuthenticationScreenFlow/States/LoginSelectionAuthState.cs @@ -114,14 +114,14 @@ public void Enter(ErrorType errorType) { switch (errorType) { - case ErrorType.NONE: break; - case ErrorType.CONNECTION_ERROR: + case ErrorType.None: break; + case ErrorType.ConnectionError: view.ErrorPopupRoot.SetActive(true); break; - case ErrorType.RESTRICTED_USER: + case ErrorType.RestrictedUser: view.RestrictedUserContainer.SetActive(true); break; - case ErrorType.INVALID_EMAIL: + case ErrorType.InvalidEmail: view.SetEmailInputFieldErrorState(true); Enter(); return; @@ -207,9 +207,9 @@ private void RequestAlphaAccess() => public enum ErrorType { - NONE = 0, - CONNECTION_ERROR = 1, - RESTRICTED_USER = 2, - INVALID_EMAIL = 3, + None = 0, + ConnectionError = 1, + RestrictedUser = 2, + InvalidEmail = 3, } } diff --git a/Explorer/Assets/DCL/AuthenticationScreenFlow/States/ProfileFetchingAuthState.cs b/Explorer/Assets/DCL/AuthenticationScreenFlow/States/ProfileFetchingAuthState.cs index 5087891a682..80423a46424 100644 --- a/Explorer/Assets/DCL/AuthenticationScreenFlow/States/ProfileFetchingAuthState.cs +++ b/Explorer/Assets/DCL/AuthenticationScreenFlow/States/ProfileFetchingAuthState.cs @@ -93,7 +93,7 @@ private async UniTaskVoid FetchProfileFlowAsync(string email, IWeb3Identity iden if (!IsUserAllowedToAccessToBeta(identity)) { profileFetchException = new NotAllowedUserException($"User not allowed to access beta - restricted user {email} in {nameof(ProfileFetchingAuthState)} ({(isCached ? "cached" : "main")} flow)"); - machine.Enter(ErrorType.RESTRICTED_USER); + machine.Enter(ErrorType.RestrictedUser); } else { @@ -146,12 +146,12 @@ private async UniTaskVoid FetchProfileFlowAsync(string email, IWeb3Identity iden catch (TimeoutException e) { profileFetchException = e; - machine.Enter(ErrorType.CONNECTION_ERROR); + machine.Enter(ErrorType.ConnectionError); } catch (Exception e) { profileFetchException = e; - machine.Enter(ErrorType.CONNECTION_ERROR); + machine.Enter(ErrorType.ConnectionError); } } } diff --git a/Explorer/Assets/DCL/AvatarAnimation/Editor/MoveAvatarPlayableAsset.cs b/Explorer/Assets/DCL/AvatarAnimation/Editor/MoveAvatarPlayableAsset.cs index b694856323f..cff9b23d549 100644 --- a/Explorer/Assets/DCL/AvatarAnimation/Editor/MoveAvatarPlayableAsset.cs +++ b/Explorer/Assets/DCL/AvatarAnimation/Editor/MoveAvatarPlayableAsset.cs @@ -14,7 +14,7 @@ public class MoveAvatarPlayableAsset : PlayableAsset, ITimelineClipAsset public float Forward = 0.0f; [Tooltip("Makes the avatar use a given animation while moving forward. While the clip is not playing, the animation is Idle.")] - public MovementKind MovementAnimation = MovementKind.IDLE; + public MovementKind MovementAnimation = MovementKind.Idle; [Tooltip("Makes the avatar rotate a given amount of degrees per second. Positive means turning to the right.")] [Range(-360.0f, 360.0f)] diff --git a/Explorer/Assets/DCL/AvatarAnimation/Editor/MoveAvatarPlayableBehaviour.cs b/Explorer/Assets/DCL/AvatarAnimation/Editor/MoveAvatarPlayableBehaviour.cs index 786f8377ed4..54c926ad4c0 100644 --- a/Explorer/Assets/DCL/AvatarAnimation/Editor/MoveAvatarPlayableBehaviour.cs +++ b/Explorer/Assets/DCL/AvatarAnimation/Editor/MoveAvatarPlayableBehaviour.cs @@ -15,7 +15,7 @@ namespace DCL.AvatarAnimation.Editor public class MoveAvatarPlayableBehaviour : BaseAvatarPlayableBehaviour { public float Forward = 0.0f; - public MovementKind MovementAnimation = MovementKind.IDLE; + public MovementKind MovementAnimation = MovementKind.Idle; public float Rotation = 0.0f; private Transform cachedCharacterControllerTransform; @@ -43,7 +43,7 @@ public override void OnBehaviourPause(Playable playable, FrameData info) if (hasInputcomponent) { - movement.Kind = MovementKind.IDLE; + movement.Kind = MovementKind.Idle; movement.Axes = Vector2.zero; } } diff --git a/Explorer/Assets/DCL/AvatarRendering/AvatarShape/Components/AvatarCachedVisibilityComponent.cs b/Explorer/Assets/DCL/AvatarRendering/AvatarShape/Components/AvatarCachedVisibilityComponent.cs index deab0bc9ded..ab39c7267b4 100644 --- a/Explorer/Assets/DCL/AvatarRendering/AvatarShape/Components/AvatarCachedVisibilityComponent.cs +++ b/Explorer/Assets/DCL/AvatarRendering/AvatarShape/Components/AvatarCachedVisibilityComponent.cs @@ -7,21 +7,21 @@ public struct AvatarCachedVisibilityComponent public bool ShouldUpdateDitherState(float newDistance, float startFadeDithering, float endFadeDithering) { - if (newDistance >= startFadeDithering && currentDitherState != DITHER_STATE.OPAQUE) + if (newDistance >= startFadeDithering && currentDitherState != DITHER_STATE.Opaque) { - currentDitherState = DITHER_STATE.OPAQUE; + currentDitherState = DITHER_STATE.Opaque; return true; } - if (newDistance <= endFadeDithering && currentDitherState != DITHER_STATE.TRANSPARENT) + if (newDistance <= endFadeDithering && currentDitherState != DITHER_STATE.Transparent) { - currentDitherState = DITHER_STATE.TRANSPARENT; + currentDitherState = DITHER_STATE.Transparent; return true; } if (newDistance > endFadeDithering && newDistance < startFadeDithering) { - currentDitherState = DITHER_STATE.DITHERING; + currentDitherState = DITHER_STATE.Dithering; return true; } @@ -30,15 +30,15 @@ public bool ShouldUpdateDitherState(float newDistance, float startFadeDithering, public void ResetDitherState() { - currentDitherState = DITHER_STATE.UNINITIALIZED; + currentDitherState = DITHER_STATE.Uninitialized; } } public enum DITHER_STATE { - UNINITIALIZED, - TRANSPARENT, - DITHERING, - OPAQUE, + Uninitialized, + Transparent, + Dithering, + Opaque, } } diff --git a/Explorer/Assets/DCL/AvatarRendering/AvatarShape/Components/HiddenPlayerComponent.cs b/Explorer/Assets/DCL/AvatarRendering/AvatarShape/Components/HiddenPlayerComponent.cs index 3dc427b4415..3cce4e42e9c 100644 --- a/Explorer/Assets/DCL/AvatarRendering/AvatarShape/Components/HiddenPlayerComponent.cs +++ b/Explorer/Assets/DCL/AvatarRendering/AvatarShape/Components/HiddenPlayerComponent.cs @@ -7,8 +7,8 @@ public struct HiddenPlayerComponent [Flags] public enum HiddenReason : byte { - BLOCKED = 1 << 0, - BANNED = 1 << 1, + Blocked = 1 << 0, + Banned = 1 << 1, } public HiddenReason Reason; diff --git a/Explorer/Assets/DCL/AvatarRendering/AvatarShape/Systems/AvatarInstantiatorSystem.cs b/Explorer/Assets/DCL/AvatarRendering/AvatarShape/Systems/AvatarInstantiatorSystem.cs index f5ade536adc..37802651b55 100644 --- a/Explorer/Assets/DCL/AvatarRendering/AvatarShape/Systems/AvatarInstantiatorSystem.cs +++ b/Explorer/Assets/DCL/AvatarRendering/AvatarShape/Systems/AvatarInstantiatorSystem.cs @@ -85,8 +85,8 @@ public AvatarInstantiatorSystem(World world, for (var i = 0; i < facialFeaturesTexturesByBodyShapeCopy.Length; i++) facialFeaturesTexturesByBodyShapeCopy[i] = new FacialFeaturesTextures(new Dictionary>()); - pointAtFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.POINT_AT); - headSyncFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.HEAD_SYNC); + pointAtFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.PointAt); + headSyncFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.HeadSync); } protected override void OnDispose() diff --git a/Explorer/Assets/DCL/AvatarRendering/AvatarShape/Systems/AvatarShapeVisibilitySystem.cs b/Explorer/Assets/DCL/AvatarRendering/AvatarShape/Systems/AvatarShapeVisibilitySystem.cs index fa1293a8398..896dda74182 100644 --- a/Explorer/Assets/DCL/AvatarRendering/AvatarShape/Systems/AvatarShapeVisibilitySystem.cs +++ b/Explorer/Assets/DCL/AvatarRendering/AvatarShape/Systems/AvatarShapeVisibilitySystem.cs @@ -145,7 +145,7 @@ private void BlockAvatars(in Entity entity, ref AvatarShapeComponent avatarShape bool isBlocked = userBlockingCache.UserIsBlocked(avatarShapeComponent.ID); - SetHiddenComponent(entity, isBlocked, HiddenPlayerComponent.HiddenReason.BLOCKED); + SetHiddenComponent(entity, isBlocked, HiddenPlayerComponent.HiddenReason.Blocked); } [Query] @@ -156,7 +156,7 @@ private void BanAvatars(in Entity entity, ref AvatarShapeComponent avatarShapeCo bool isBanned = RoomMetadataCurrentScene.Instance.IsUserBanned(avatarShapeComponent.ID); - SetHiddenComponent(entity, isBanned, HiddenPlayerComponent.HiddenReason.BANNED); + SetHiddenComponent(entity, isBanned, HiddenPlayerComponent.HiddenReason.Banned); } private void SetHiddenComponent(Entity entity, bool hiddenValue, HiddenPlayerComponent.HiddenReason hiddenReason) diff --git a/Explorer/Assets/DCL/AvatarRendering/AvatarShape/Tests/EditMode/AvatarShapeVisibilitySystemShould.cs b/Explorer/Assets/DCL/AvatarRendering/AvatarShape/Tests/EditMode/AvatarShapeVisibilitySystemShould.cs index 0500365d224..df9d5f6b143 100644 --- a/Explorer/Assets/DCL/AvatarRendering/AvatarShape/Tests/EditMode/AvatarShapeVisibilitySystemShould.cs +++ b/Explorer/Assets/DCL/AvatarRendering/AvatarShape/Tests/EditMode/AvatarShapeVisibilitySystemShould.cs @@ -282,7 +282,7 @@ public void AddHiddenComponentWhenUserIsBlocked() // Assert Assert.IsTrue(world.Has(avatarEntity)); ref var hiddenComponent = ref world.Get(avatarEntity); - Assert.IsTrue(hiddenComponent.Reason.HasFlag(HiddenPlayerComponent.HiddenReason.BLOCKED)); + Assert.IsTrue(hiddenComponent.Reason.HasFlag(HiddenPlayerComponent.HiddenReason.Blocked)); } [Test] @@ -449,11 +449,11 @@ public void CombineMultipleHiddenReasons() // Manually add banned reason to test combination ref var hiddenComponent = ref world.Get(avatarEntity); - hiddenComponent.Reason |= HiddenPlayerComponent.HiddenReason.BANNED; + hiddenComponent.Reason |= HiddenPlayerComponent.HiddenReason.Banned; // Act - verify both reasons are present - Assert.IsTrue(hiddenComponent.Reason.HasFlag(HiddenPlayerComponent.HiddenReason.BLOCKED)); - Assert.IsTrue(hiddenComponent.Reason.HasFlag(HiddenPlayerComponent.HiddenReason.BANNED)); + Assert.IsTrue(hiddenComponent.Reason.HasFlag(HiddenPlayerComponent.HiddenReason.Blocked)); + Assert.IsTrue(hiddenComponent.Reason.HasFlag(HiddenPlayerComponent.HiddenReason.Banned)); // Unblock user userBlockingCache.UserIsBlocked(USER_ID).Returns(false); @@ -462,8 +462,8 @@ public void CombineMultipleHiddenReasons() // Assert - Only banned reason should remain Assert.IsTrue(world.Has(avatarEntity)); ref var updatedHiddenComponent = ref world.Get(avatarEntity); - Assert.IsFalse(updatedHiddenComponent.Reason.HasFlag(HiddenPlayerComponent.HiddenReason.BLOCKED)); - Assert.IsTrue(updatedHiddenComponent.Reason.HasFlag(HiddenPlayerComponent.HiddenReason.BANNED)); + Assert.IsFalse(updatedHiddenComponent.Reason.HasFlag(HiddenPlayerComponent.HiddenReason.Blocked)); + Assert.IsTrue(updatedHiddenComponent.Reason.HasFlag(HiddenPlayerComponent.HiddenReason.Banned)); } [Test] diff --git a/Explorer/Assets/DCL/AvatarRendering/Emotes/Components/Intents/GetEmotesByPointersIntention.cs b/Explorer/Assets/DCL/AvatarRendering/Emotes/Components/Intents/GetEmotesByPointersIntention.cs index 2449271bbeb..dae7825c320 100644 --- a/Explorer/Assets/DCL/AvatarRendering/Emotes/Components/Intents/GetEmotesByPointersIntention.cs +++ b/Explorer/Assets/DCL/AvatarRendering/Emotes/Components/Intents/GetEmotesByPointersIntention.cs @@ -27,7 +27,7 @@ public struct GetEmotesByPointersIntention : IAssetIntention, IDisposable, IEqua public GetEmotesByPointersIntention(List pointers, BodyShape bodyShape, - AssetSource permittedSources = AssetSource.ALL, + AssetSource permittedSources = AssetSource.All, int timeout = StreamableLoadingDefaults.TIMEOUT) : this() { this.pointers = pointers; diff --git a/Explorer/Assets/DCL/AvatarRendering/Emotes/Components/Intents/GetSceneEmoteFromRealmIntention.cs b/Explorer/Assets/DCL/AvatarRendering/Emotes/Components/Intents/GetSceneEmoteFromRealmIntention.cs index 696a96dbf7b..09c196e21f2 100644 --- a/Explorer/Assets/DCL/AvatarRendering/Emotes/Components/Intents/GetSceneEmoteFromRealmIntention.cs +++ b/Explorer/Assets/DCL/AvatarRendering/Emotes/Components/Intents/GetSceneEmoteFromRealmIntention.cs @@ -37,7 +37,7 @@ public GetSceneEmoteFromRealmIntention( string emoteHash, bool loop, BodyShape bodyShape, - AssetSource permittedSources = AssetSource.ALL, + AssetSource permittedSources = AssetSource.All, int timeout = StreamableLoadingDefaults.TIMEOUT ) : this() { diff --git a/Explorer/Assets/DCL/AvatarRendering/Emotes/EmoteTriggerSource.cs b/Explorer/Assets/DCL/AvatarRendering/Emotes/EmoteTriggerSource.cs index acbbaddacd0..598a14447c5 100644 --- a/Explorer/Assets/DCL/AvatarRendering/Emotes/EmoteTriggerSource.cs +++ b/Explorer/Assets/DCL/AvatarRendering/Emotes/EmoteTriggerSource.cs @@ -6,9 +6,9 @@ namespace DCL.AvatarRendering.Emotes public enum EmoteTriggerSource { /// Click on a wheel slot or press [0-9] while the emotes wheel is open. - WHEEL_SLOT, + WheelSlot, /// Press B+[0-9] while the emotes wheel is closed. - SHORTCUT, + Shortcut, } } diff --git a/Explorer/Assets/DCL/AvatarRendering/Emotes/Helpers/EmoteWheelShortcutHandler.cs b/Explorer/Assets/DCL/AvatarRendering/Emotes/Helpers/EmoteWheelShortcutHandler.cs index 36f4e287023..e220869ca2d 100644 --- a/Explorer/Assets/DCL/AvatarRendering/Emotes/Helpers/EmoteWheelShortcutHandler.cs +++ b/Explorer/Assets/DCL/AvatarRendering/Emotes/Helpers/EmoteWheelShortcutHandler.cs @@ -34,10 +34,10 @@ public virtual void NotifyEmotePlayed(EmoteTriggerSource source) { switch (source) { - case EmoteTriggerSource.SHORTCUT: + case EmoteTriggerSource.Shortcut: ignoreNextRelease = true; break; - case EmoteTriggerSource.WHEEL_SLOT: + case EmoteTriggerSource.WheelSlot: lockUntilTime = UnityEngine.Time.time + QUICK_EMOTE_LOCK_TIME; break; default: diff --git a/Explorer/Assets/DCL/AvatarRendering/Emotes/Plugin/EmotesContainer.cs b/Explorer/Assets/DCL/AvatarRendering/Emotes/Plugin/EmotesContainer.cs index 2df78a2d842..6985fd35005 100644 --- a/Explorer/Assets/DCL/AvatarRendering/Emotes/Plugin/EmotesContainer.cs +++ b/Explorer/Assets/DCL/AvatarRendering/Emotes/Plugin/EmotesContainer.cs @@ -33,11 +33,11 @@ protected override async UniTask InitializeInternalAsync(Settings settings, Canc AudioSource audioSource = (await assetsProvisioner.ProvideMainAssetAsync(settings.EmoteAudioSource, ct)).Value.GetComponent(); EmoteMaskCatalog emoteMaskCatalog = (await assetsProvisioner.ProvideMainAssetAsync(settings.EmoteMaskCatalog, ct)).Value; - bool legacyAnimationsEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.LOCAL_SCENE_DEVELOPMENT) - || FeaturesRegistry.Instance.IsEnabled(FeatureId.SELF_PREVIEW_BUILDER_COLLECTIONS); + bool legacyAnimationsEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.LocalSceneDevelopment) + || FeaturesRegistry.Instance.IsEnabled(FeatureId.SelfPreviewBuilderCollections); - bool forceBackfaceCulling = FeaturesRegistry.Instance.IsEnabled(FeatureId.FORCE_BACKFACE_CULLING); + bool forceBackfaceCulling = FeaturesRegistry.Instance.IsEnabled(FeatureId.ForceBackfaceCulling); EmotePlayer = new EmotePlayer(audioSource, emoteMaskCatalog, legacyAnimationsEnabled, forceBackfaceCulling); } diff --git a/Explorer/Assets/DCL/AvatarRendering/Emotes/Systems/Play/SceneMaskedEmoteSystem.cs b/Explorer/Assets/DCL/AvatarRendering/Emotes/Systems/Play/SceneMaskedEmoteSystem.cs index 473c3ffa2b3..d3c6e700d88 100644 --- a/Explorer/Assets/DCL/AvatarRendering/Emotes/Systems/Play/SceneMaskedEmoteSystem.cs +++ b/Explorer/Assets/DCL/AvatarRendering/Emotes/Systems/Play/SceneMaskedEmoteSystem.cs @@ -198,7 +198,7 @@ private void UpdateMaskedEmoteVisibility(ref CharacterMaskedEmoteComponent maske && ec.CurrentEmoteReference != null; bool isGliding = globalWorld.TryGet(globalPlayerEntity, out GlideState glideState) - && glideState.Value is GlideStateValue.OPENING_PROP or GlideStateValue.GLIDING; + && glideState.Value is GlideStateValue.OpeningProp or GlideStateValue.Gliding; bool shouldPlay = isInScene && !fullBodyIsPlaying && !isGliding; diff --git a/Explorer/Assets/DCL/AvatarRendering/Emotes/Systems/UpdateEmoteInputSystem.cs b/Explorer/Assets/DCL/AvatarRendering/Emotes/Systems/UpdateEmoteInputSystem.cs index ffd47d80869..33fc0172131 100644 --- a/Explorer/Assets/DCL/AvatarRendering/Emotes/Systems/UpdateEmoteInputSystem.cs +++ b/Explorer/Assets/DCL/AvatarRendering/Emotes/Systems/UpdateEmoteInputSystem.cs @@ -52,7 +52,7 @@ private void OnSlotPerformed(InputAction.CallbackContext obj) { int emoteIndex = actionNameById[obj.action.name]; triggeredEmote = emoteIndex; - triggeredEmoteSource = EmoteTriggerSource.SHORTCUT; + triggeredEmoteSource = EmoteTriggerSource.Shortcut; } protected override void Update(float t) @@ -76,7 +76,7 @@ protected override void Update(float t) private void TriggerEmoteBySlotIntent(in Entity entity, ref TriggerEmoteBySlotIntent intent) { triggeredEmote = intent.Slot; - triggeredEmoteSource = EmoteTriggerSource.WHEEL_SLOT; + triggeredEmoteSource = EmoteTriggerSource.WheelSlot; World.Remove(entity); } @@ -90,7 +90,7 @@ private void TriggerEmote([Data] int emoteIndex, in AvatarShapeComponent avatarShapeComponent, in GlideState glideState) { - if (inputModifier.DisableEmote || glideState.Value != GlideStateValue.PROP_CLOSED) return; + if (inputModifier.DisableEmote || glideState.Value != GlideStateValue.PropClosed) return; IReadOnlyList emotes = profile.Avatar.Emotes; if (emoteIndex < 0 || emoteIndex >= emotes.Count) return; diff --git a/Explorer/Assets/DCL/AvatarRendering/Emotes/Tests/UpdateEmoteInputSystemShould.cs b/Explorer/Assets/DCL/AvatarRendering/Emotes/Tests/UpdateEmoteInputSystemShould.cs index d7d0b7fcb9d..e6c6dccccb8 100644 --- a/Explorer/Assets/DCL/AvatarRendering/Emotes/Tests/UpdateEmoteInputSystemShould.cs +++ b/Explorer/Assets/DCL/AvatarRendering/Emotes/Tests/UpdateEmoteInputSystemShould.cs @@ -232,7 +232,7 @@ public void NotifyHandlerWithWheelSlotWhenTriggeringFromIntent() // Assert - handler is notified with WheelSlot when trigger came from wheel intent (not Shortcut) Assert.AreEqual(1, testShortcutHandler.NotifyCalls.Count, "Handler should be notified once"); - Assert.AreEqual(EmoteTriggerSource.WHEEL_SLOT, testShortcutHandler.NotifyCalls[0]); + Assert.AreEqual(EmoteTriggerSource.WheelSlot, testShortcutHandler.NotifyCalls[0]); Assert.IsTrue(world.Has(entity), "Emote should still be triggered"); } diff --git a/Explorer/Assets/DCL/AvatarRendering/Thumbnails/Utils/LoadThumbnailsUtils.cs b/Explorer/Assets/DCL/AvatarRendering/Thumbnails/Utils/LoadThumbnailsUtils.cs index 65a7a2a693e..70c58ead7de 100644 --- a/Explorer/Assets/DCL/AvatarRendering/Thumbnails/Utils/LoadThumbnailsUtils.cs +++ b/Explorer/Assets/DCL/AvatarRendering/Thumbnails/Utils/LoadThumbnailsUtils.cs @@ -65,7 +65,7 @@ public static void CreateThumbnailABPromise( GetAssetBundleIntention.FromHash( hash: thumbnailPath.Value + PlatformUtils.GetCurrentPlatform(), typeof(Texture2D), - permittedSources: AssetSource.ALL, + permittedSources: AssetSource.All, assetBundleManifestVersion: assetBundleManifestVersion, parentEntityID: attachment.GetEntityId(), cancellationTokenSource: cancellationTokenSource ?? new CancellationTokenSource() diff --git a/Explorer/Assets/DCL/AvatarRendering/Wearables/Components/Intentions/GetWearablesByPointersIntention.cs b/Explorer/Assets/DCL/AvatarRendering/Wearables/Components/Intentions/GetWearablesByPointersIntention.cs index ff30cf44bac..04bc46cd5b5 100644 --- a/Explorer/Assets/DCL/AvatarRendering/Wearables/Components/Intentions/GetWearablesByPointersIntention.cs +++ b/Explorer/Assets/DCL/AvatarRendering/Wearables/Components/Intentions/GetWearablesByPointersIntention.cs @@ -28,7 +28,7 @@ public struct GetWearablesByPointersIntention : IAssetIntention, IDisposable, IE /// public long ResolvedWearablesIndices; - public GetWearablesByPointersIntention(List pointers, BodyShape bodyShape, IReadOnlyCollection forceRender, AssetSource permittedSources = AssetSource.ALL) + public GetWearablesByPointersIntention(List pointers, BodyShape bodyShape, IReadOnlyCollection forceRender, AssetSource permittedSources = AssetSource.All) { Pointers = pointers; BodyShape = bodyShape; diff --git a/Explorer/Assets/DCL/AvatarRendering/Wearables/Systems/Load/LoadDefaultWearablesSystem.cs b/Explorer/Assets/DCL/AvatarRendering/Wearables/Systems/Load/LoadDefaultWearablesSystem.cs index 7c13f91b6a8..c7219a9fb2c 100644 --- a/Explorer/Assets/DCL/AvatarRendering/Wearables/Systems/Load/LoadDefaultWearablesSystem.cs +++ b/Explorer/Assets/DCL/AvatarRendering/Wearables/Systems/Load/LoadDefaultWearablesSystem.cs @@ -152,7 +152,7 @@ private void AddBodyShapes() { wearable.GetUrn() }, BodyShape.MALE, - Array.Empty(), AssetSource.EMBEDDED), + Array.Empty(), AssetSource.Embedded), PartitionComponent.TOP_PRIORITY); } @@ -228,7 +228,7 @@ private void AddBodyShapes() { wearable.GetUrn() }, BodyShape.FEMALE, - Array.Empty(), AssetSource.EMBEDDED), + Array.Empty(), AssetSource.Embedded), PartitionComponent.TOP_PRIORITY); } diff --git a/Explorer/Assets/DCL/Backpack/AvatarSection/AvatarController.cs b/Explorer/Assets/DCL/Backpack/AvatarSection/AvatarController.cs index 97eae67be80..457fc8a0e9f 100644 --- a/Explorer/Assets/DCL/Backpack/AvatarSection/AvatarController.cs +++ b/Explorer/Assets/DCL/Backpack/AvatarSection/AvatarController.cs @@ -65,7 +65,7 @@ public AvatarController(AvatarView view, outfitsPresenter, (RectTransform) view.transform); - bool isOutfitsEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.BACKPACK_OUTFITS); + bool isOutfitsEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.BackpackOutfits); if (!isOutfitsEnabled) tabsManager.SetTabEnabled(AvatarSubSection.Outfits, false); diff --git a/Explorer/Assets/DCL/Backpack/AvatarSection/Outfits/Commands/DeleteOutfitCommand.cs b/Explorer/Assets/DCL/Backpack/AvatarSection/Outfits/Commands/DeleteOutfitCommand.cs index 623a853dcb1..9272168e6b1 100644 --- a/Explorer/Assets/DCL/Backpack/AvatarSection/Outfits/Commands/DeleteOutfitCommand.cs +++ b/Explorer/Assets/DCL/Backpack/AvatarSection/Outfits/Commands/DeleteOutfitCommand.cs @@ -60,7 +60,7 @@ public async UniTask ExecuteAsync(int slotIndex, Cancellati return DeleteOutfitOutcome.Failed; } - if (ct.IsCancellationRequested || decision == ConfirmationResult.CANCEL) + if (ct.IsCancellationRequested || decision == ConfirmationResult.Cancel) return DeleteOutfitOutcome.Cancelled; try diff --git a/Explorer/Assets/DCL/Backpack/BackpackSearchController.cs b/Explorer/Assets/DCL/Backpack/BackpackSearchController.cs index 0133020f8ec..3c8c9bda0c5 100644 --- a/Explorer/Assets/DCL/Backpack/BackpackSearchController.cs +++ b/Explorer/Assets/DCL/Backpack/BackpackSearchController.cs @@ -37,10 +37,10 @@ public BackpackSearchController(SearchBarView view, } private void RestoreInput(string text) => - inputBlock.Enable(InputMapComponent.Kind.SHORTCUTS, InputMapComponent.Kind.IN_WORLD_CAMERA); + inputBlock.Enable(InputMapComponent.Kind.Shortcuts, InputMapComponent.Kind.InWorldCamera); private void DisableShortcutsInput(string text) => - inputBlock.Disable(InputMapComponent.Kind.SHORTCUTS, InputMapComponent.Kind.IN_WORLD_CAMERA); + inputBlock.Disable(InputMapComponent.Kind.Shortcuts, InputMapComponent.Kind.InWorldCamera); public void Clear() { diff --git a/Explorer/Assets/DCL/Backpack/Gifting/Notifications/GiftReceivedPopupController.cs b/Explorer/Assets/DCL/Backpack/Gifting/Notifications/GiftReceivedPopupController.cs index 03a0a9445c7..e6cbeced4d5 100644 --- a/Explorer/Assets/DCL/Backpack/Gifting/Notifications/GiftReceivedPopupController.cs +++ b/Explorer/Assets/DCL/Backpack/Gifting/Notifications/GiftReceivedPopupController.cs @@ -25,7 +25,7 @@ public class GiftReceivedPopupController : ControllerBase CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; private ImageController imageController; private CancellationTokenSource? lifeCts; diff --git a/Explorer/Assets/DCL/Backpack/Gifting/Presenters/GiftSelection/GiftSelectionController.cs b/Explorer/Assets/DCL/Backpack/Gifting/Presenters/GiftSelection/GiftSelectionController.cs index 31598cf0870..60946f911e5 100644 --- a/Explorer/Assets/DCL/Backpack/Gifting/Presenters/GiftSelection/GiftSelectionController.cs +++ b/Explorer/Assets/DCL/Backpack/Gifting/Presenters/GiftSelection/GiftSelectionController.cs @@ -21,7 +21,7 @@ public class GiftSelectionController : ControllerBase CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; private readonly IProfileRepository profileRepository; private readonly GiftSelectionComponentFactory componentFactory; diff --git a/Explorer/Assets/DCL/Backpack/Gifting/Presenters/GiftSelection/GiftingHeaderPresenter.cs b/Explorer/Assets/DCL/Backpack/Gifting/Presenters/GiftSelection/GiftingHeaderPresenter.cs index 77ae62bd939..da50cfdd273 100644 --- a/Explorer/Assets/DCL/Backpack/Gifting/Presenters/GiftSelection/GiftingHeaderPresenter.cs +++ b/Explorer/Assets/DCL/Backpack/Gifting/Presenters/GiftSelection/GiftingHeaderPresenter.cs @@ -16,10 +16,10 @@ public class GiftingHeaderPresenter : IDisposable { private static readonly InputMapComponent.Kind[] BLOCKED_INPUTS = { - InputMapComponent.Kind.PLAYER, - InputMapComponent.Kind.SHORTCUTS, - InputMapComponent.Kind.CAMERA, - InputMapComponent.Kind.IN_WORLD_CAMERA, + InputMapComponent.Kind.Player, + InputMapComponent.Kind.Shortcuts, + InputMapComponent.Kind.Camera, + InputMapComponent.Kind.InWorldCamera, }; private const string TITLE_FORMAT = "Send a Gift to {1}"; diff --git a/Explorer/Assets/DCL/Backpack/Gifting/Presenters/GiftTransfer/GiftTransferController.cs b/Explorer/Assets/DCL/Backpack/Gifting/Presenters/GiftTransfer/GiftTransferController.cs index a86f9dfcffe..d95f804b60a 100644 --- a/Explorer/Assets/DCL/Backpack/Gifting/Presenters/GiftTransfer/GiftTransferController.cs +++ b/Explorer/Assets/DCL/Backpack/Gifting/Presenters/GiftTransfer/GiftTransferController.cs @@ -23,7 +23,7 @@ public sealed class GiftTransferController { private static readonly TimeSpan LONG_RUNNING_HINT_DELAY = TimeSpan.FromSeconds(10); - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; private enum State { Waiting, Success, Failed } @@ -274,7 +274,7 @@ private async UniTask ShowErrorPopupAsync(CancellationToken ct) .ConfirmationDialogOpener .OpenConfirmationDialogAsync(dialogParams, ct); - if (result == ConfirmationResult.CONFIRM) + if (result == ConfirmationResult.Confirm) { ReportHub.Log(ReportCategory.GIFTING, GiftingTextIds.RetryLogMessage); await mvcManager.ShowAsync(IssueCommand(inputData), ct); diff --git a/Explorer/Assets/DCL/Backpack/Gifting/Presenters/GiftTransferSuccess/GiftTransferSuccessController.cs b/Explorer/Assets/DCL/Backpack/Gifting/Presenters/GiftTransferSuccess/GiftTransferSuccessController.cs index fdb3d762976..581e7dc42a7 100644 --- a/Explorer/Assets/DCL/Backpack/Gifting/Presenters/GiftTransferSuccess/GiftTransferSuccessController.cs +++ b/Explorer/Assets/DCL/Backpack/Gifting/Presenters/GiftTransferSuccess/GiftTransferSuccessController.cs @@ -13,7 +13,7 @@ namespace DCL.Backpack.Gifting.Presenters public sealed class GiftTransferSuccessController : ControllerBase { - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; private CancellationTokenSource? lifeCts; diff --git a/Explorer/Assets/DCL/Backpack/SmartWearableAuthorizationPopupController.cs b/Explorer/Assets/DCL/Backpack/SmartWearableAuthorizationPopupController.cs index 1cd632f7208..4c6e938ba99 100644 --- a/Explorer/Assets/DCL/Backpack/SmartWearableAuthorizationPopupController.cs +++ b/Explorer/Assets/DCL/Backpack/SmartWearableAuthorizationPopupController.cs @@ -31,7 +31,7 @@ public SmartWearableAuthorizationPopupController( this.categoryIcons = categoryIcons; } - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; protected override void OnViewInstantiated() { diff --git a/Explorer/Assets/DCL/ChangeRealmPrompt/ChangeRealmPromptController.cs b/Explorer/Assets/DCL/ChangeRealmPrompt/ChangeRealmPromptController.cs index 28ed665798e..024305979f6 100644 --- a/Explorer/Assets/DCL/ChangeRealmPrompt/ChangeRealmPromptController.cs +++ b/Explorer/Assets/DCL/ChangeRealmPrompt/ChangeRealmPromptController.cs @@ -8,7 +8,7 @@ namespace DCL.ChangeRealmPrompt { public partial class ChangeRealmPromptController : ControllerBase { - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; private readonly ICursor cursor; private readonly Action changeRealmCallback; diff --git a/Explorer/Assets/DCL/Character/CharacterCamera/CameraMode.cs b/Explorer/Assets/DCL/Character/CharacterCamera/CameraMode.cs index 6187fa8c0db..ca59e5c967f 100644 --- a/Explorer/Assets/DCL/Character/CharacterCamera/CameraMode.cs +++ b/Explorer/Assets/DCL/Character/CharacterCamera/CameraMode.cs @@ -5,7 +5,7 @@ public enum CameraMode : byte FirstPerson = 0, ThirdPerson = 1, DroneView = 2, - SDKCamera = 3, + SdkCamera = 3, /// /// Free-fly, does not follow character, intercepts controls designated for character movement diff --git a/Explorer/Assets/DCL/Character/CharacterCamera/Components/CursorComponent.cs b/Explorer/Assets/DCL/Character/CharacterCamera/Components/CursorComponent.cs index 2470ed434ce..978ab3eebc6 100644 --- a/Explorer/Assets/DCL/Character/CharacterCamera/Components/CursorComponent.cs +++ b/Explorer/Assets/DCL/Character/CharacterCamera/Components/CursorComponent.cs @@ -12,7 +12,7 @@ public enum CursorState /// Cursor is Locked and opened a menu with which the user has to interact without unlocking. /// The mouse cursor will be visible and camera will not move, so the user can click on the UI. The camera will keep the Locked position. /// - LockedWithUI + LockedWithUi } public struct CursorComponent diff --git a/Explorer/Assets/DCL/Character/CharacterCamera/Systems/ApplyCinemachineCameraInputSystem.cs b/Explorer/Assets/DCL/Character/CharacterCamera/Systems/ApplyCinemachineCameraInputSystem.cs index a89d0102fb8..2944573f69f 100644 --- a/Explorer/Assets/DCL/Character/CharacterCamera/Systems/ApplyCinemachineCameraInputSystem.cs +++ b/Explorer/Assets/DCL/Character/CharacterCamera/Systems/ApplyCinemachineCameraInputSystem.cs @@ -44,7 +44,7 @@ private void Apply([Data] float dt, ref CameraComponent camera, ref CameraInput dvc.m_YAxis.m_InputAxisValue = cameraInput.Delta.y; break; case CameraMode.ThirdPerson: - case CameraMode.SDKCamera: + case CameraMode.SdkCamera: CinemachineFreeLook tpc = cinemachinePreset.ThirdPersonCameraData.Camera; tpc.m_XAxis.m_InputAxisValue = cameraInput.Delta.x; tpc.m_YAxis.m_InputAxisValue = cameraInput.Delta.y; @@ -73,7 +73,7 @@ private void Apply([Data] float dt, ref CameraComponent camera, ref CameraInput private void ForceLookAt(in Entity entity, in CameraComponent camera, ref ICinemachinePreset cinemachinePreset, in CameraLookAtIntent lookAtIntent) { // Only process the LookAtIntent if we're not in SDKCamera mode - if (camera.Mode == CameraMode.SDKCamera) return; + if (camera.Mode == CameraMode.SdkCamera) return; switch (camera.Mode) { diff --git a/Explorer/Assets/DCL/Character/CharacterCamera/Systems/ControlCinemachineVirtualCameraSystem.cs b/Explorer/Assets/DCL/Character/CharacterCamera/Systems/ControlCinemachineVirtualCameraSystem.cs index b29548cbf5d..413910ad2f0 100644 --- a/Explorer/Assets/DCL/Character/CharacterCamera/Systems/ControlCinemachineVirtualCameraSystem.cs +++ b/Explorer/Assets/DCL/Character/CharacterCamera/Systems/ControlCinemachineVirtualCameraSystem.cs @@ -59,7 +59,7 @@ protected override void Update(float t) [None(typeof(CameraBlockerComponent), typeof(InWorldCameraComponent))] private void HandleCameraInput([Data] float dt, in CameraComponent cameraComponent) { - if (cameraComponent.Mode == CameraMode.SDKCamera) return; + if (cameraComponent.Mode == CameraMode.SdkCamera) return; // this blocks the user of changing the current camera, but the SDK still can do it if (!cameraComponent.CameraInputChangeEnabled) return; @@ -107,7 +107,7 @@ private void HandleFreeFlyState(ref CameraComponent cameraComponent, in CameraIn [None(typeof(InWorldCameraComponent))] private void HandleOffset([Data] float dt, ref CameraComponent cameraComponent, ref ICinemachinePreset cinemachinePreset, in CameraInput input, in CursorComponent cursorComponent) { - if (cameraComponent.Mode is not (CameraMode.DroneView or CameraMode.ThirdPerson) || cursorComponent.CursorState == CursorState.LockedWithUI) + if (cameraComponent.Mode is not (CameraMode.DroneView or CameraMode.ThirdPerson) || cursorComponent.CursorState == CursorState.LockedWithUi) return; ICinemachineThirdPersonCameraData cameraData = cameraComponent.Mode == CameraMode.ThirdPerson ? cinemachinePreset.ThirdPersonCameraData : cinemachinePreset.DroneViewCameraData; @@ -148,7 +148,7 @@ private void HandleOffset([Data] float dt, ref CameraComponent cameraComponent, [None(typeof(InWorldCameraComponent))] private void UpdateCameraState(ref CameraComponent cameraComponent, ref ICinemachinePreset cinemachinePreset, ref CinemachineCameraState state) { - if (cameraComponent.Mode == CameraMode.SDKCamera) return; + if (cameraComponent.Mode == CameraMode.SdkCamera) return; if (cameraComponent.Mode == CameraMode.FirstPerson) cameraComponent.IsTransitioningToFirstPerson = cinemachinePreset.Brain.IsBlending; @@ -158,7 +158,7 @@ private void UpdateCameraState(ref CameraComponent cameraComponent, ref ICinemac private void SwitchCamera(CameraMode targetCameraMode, ref ICinemachinePreset cinemachinePreset, ref CameraComponent camera, ref CinemachineCameraState cameraState) { - if (camera.PreviousMode != CameraMode.SDKCamera && IsCorrectCameraEnabled(targetCameraMode, cinemachinePreset)) + if (camera.PreviousMode != CameraMode.SdkCamera && IsCorrectCameraEnabled(targetCameraMode, cinemachinePreset)) return; ProcessCameraActivation(targetCameraMode, cinemachinePreset, ref camera, ref cameraState); @@ -194,7 +194,7 @@ private void ProcessCameraActivation(CameraMode targetCameraMode, ICinemachinePr SetActiveCamera(ref cameraState, cinemachinePreset.FirstPersonCameraData.Camera); break; case CameraMode.ThirdPerson: - cinemachinePreset.ThirdPersonCameraData.Camera.m_Transitions.m_InheritPosition = camera.PreviousMode != CameraMode.FirstPerson && camera.PreviousMode != CameraMode.SDKCamera; + cinemachinePreset.ThirdPersonCameraData.Camera.m_Transitions.m_InheritPosition = camera.PreviousMode != CameraMode.FirstPerson && camera.PreviousMode != CameraMode.SdkCamera; if (camera.PreviousMode == CameraMode.FirstPerson) { cinemachinePreset.ThirdPersonCameraData.Camera.m_XAxis.Value = cinemachinePreset.FirstPersonCameraData.POV.m_HorizontalAxis.Value; @@ -239,14 +239,14 @@ private void HandleInputBlock(CameraMode targetCameraMode, CameraMode currentCam if (targetCameraMode == CameraMode.Free) { ref InputMapComponent inputMapComponent = ref inputMap.GetInputMapComponent(World); - inputMapComponent.UnblockInput(InputMapComponent.Kind.FREE_CAMERA); - inputMapComponent.BlockInput(InputMapComponent.Kind.PLAYER); + inputMapComponent.UnblockInput(InputMapComponent.Kind.FreeCamera); + inputMapComponent.BlockInput(InputMapComponent.Kind.Player); } else if (currentCameraMode == CameraMode.Free) { ref InputMapComponent inputMapComponent = ref inputMap.GetInputMapComponent(World); - inputMapComponent.UnblockInput(InputMapComponent.Kind.PLAYER); - inputMapComponent.BlockInput(InputMapComponent.Kind.FREE_CAMERA); + inputMapComponent.UnblockInput(InputMapComponent.Kind.Player); + inputMapComponent.BlockInput(InputMapComponent.Kind.FreeCamera); } } diff --git a/Explorer/Assets/DCL/Character/CharacterCamera/Systems/UpdateCameraInputSystem.cs b/Explorer/Assets/DCL/Character/CharacterCamera/Systems/UpdateCameraInputSystem.cs index 92ca227d7b0..0efe467a83e 100644 --- a/Explorer/Assets/DCL/Character/CharacterCamera/Systems/UpdateCameraInputSystem.cs +++ b/Explorer/Assets/DCL/Character/CharacterCamera/Systems/UpdateCameraInputSystem.cs @@ -70,7 +70,7 @@ private void UpdateInput(ref CameraInput cameraInput, ref CursorComponent cursor if (currentDelta.sqrMagnitude > CURSOR_DIRTY_THRESHOLD) cursorComponent.PositionIsDirty = true; - cameraInput.Delta = cursorComponent.CursorState != CursorState.Free && cursorComponent.CursorState != CursorState.LockedWithUI ? currentDelta : Vector2.zero; + cameraInput.Delta = cursorComponent.CursorState != CursorState.Free && cursorComponent.CursorState != CursorState.LockedWithUi ? currentDelta : Vector2.zero; } if (!freeCameraActions.enabled) diff --git a/Explorer/Assets/DCL/Character/CharacterCamera/Tests/ApplyCinemachineCameraInputSystemShould.cs b/Explorer/Assets/DCL/Character/CharacterCamera/Tests/ApplyCinemachineCameraInputSystemShould.cs index 879849f053f..37aad7c8691 100644 --- a/Explorer/Assets/DCL/Character/CharacterCamera/Tests/ApplyCinemachineCameraInputSystemShould.cs +++ b/Explorer/Assets/DCL/Character/CharacterCamera/Tests/ApplyCinemachineCameraInputSystemShould.cs @@ -262,7 +262,7 @@ public void IgnoreCameraLookAtIntentForSDKCamera() // Arrange Vector3 lookAtTarget = new Vector3(10, 0, 10); Vector3 playerPosition = Vector3.zero; - world.Set(entity, new CameraComponent(camera) { Mode = CameraMode.SDKCamera }); + world.Set(entity, new CameraComponent(camera) { Mode = CameraMode.SdkCamera }); world.Add(entity, new CameraLookAtIntent(lookAtTarget, playerPosition)); // Act diff --git a/Explorer/Assets/DCL/Character/CharacterCamera/Tests/CinemachineVirtualCameraSystemShould.cs b/Explorer/Assets/DCL/Character/CharacterCamera/Tests/CinemachineVirtualCameraSystemShould.cs index 3c0cd1e9716..829e20df1ca 100644 --- a/Explorer/Assets/DCL/Character/CharacterCamera/Tests/CinemachineVirtualCameraSystemShould.cs +++ b/Explorer/Assets/DCL/Character/CharacterCamera/Tests/CinemachineVirtualCameraSystemShould.cs @@ -75,7 +75,7 @@ public void CreateCameraSetup() cinemachinePreset.DefaultCameraMode.Returns(CameraMode.ThirdPerson); cinemachineCameraAudioSettings = Substitute.For(); system = new ControlCinemachineVirtualCameraSystem(world, cinemachineCameraAudioSettings); - world.Create(new InputMapComponent(InputMapComponent.Kind.PLAYER | InputMapComponent.Kind.CAMERA | InputMapComponent.Kind.SHORTCUTS)); + world.Create(new InputMapComponent(InputMapComponent.Kind.Player | InputMapComponent.Kind.Camera | InputMapComponent.Kind.Shortcuts)); inputMap = world.CacheInputMap(); @@ -93,7 +93,7 @@ public void DisposeCameraSetup() [Test] public void InitInputMapComponent() { - Assert.That(inputMap.GetInputMapComponent(world).Active, Is.EqualTo(InputMapComponent.Kind.PLAYER | InputMapComponent.Kind.CAMERA | InputMapComponent.Kind.SHORTCUTS)); + Assert.That(inputMap.GetInputMapComponent(world).Active, Is.EqualTo(InputMapComponent.Kind.Player | InputMapComponent.Kind.Camera | InputMapComponent.Kind.Shortcuts)); Assert.That(world.Get(entity).CurrentCamera, Is.EqualTo(thirdPersonCameraData.Camera)); } @@ -233,10 +233,10 @@ public void AdaptToCameraModeFromComponent(bool lockInput) public void SwitchFromSDKCameraToThirdPerson() { CameraComponent component = world.Get(entity); - component.Mode = CameraMode.SDKCamera; + component.Mode = CameraMode.SdkCamera; world.Set(entity, component); - Assert.That(component.Mode, Is.EqualTo(CameraMode.SDKCamera)); + Assert.That(component.Mode, Is.EqualTo(CameraMode.SdkCamera)); Assert.That(world.Get(entity).CurrentCamera, Is.EqualTo(thirdPersonCameraData.Camera)); component.Mode = CameraMode.ThirdPerson; diff --git a/Explorer/Assets/DCL/Character/CharacterCamera/Tests/UpdateCursorInputSystemShould.cs b/Explorer/Assets/DCL/Character/CharacterCamera/Tests/UpdateCursorInputSystemShould.cs index 77847149c1a..0daa7ff354d 100644 --- a/Explorer/Assets/DCL/Character/CharacterCamera/Tests/UpdateCursorInputSystemShould.cs +++ b/Explorer/Assets/DCL/Character/CharacterCamera/Tests/UpdateCursorInputSystemShould.cs @@ -199,7 +199,7 @@ public void DisallowPanningWhenInSDKCameraMode() // Arrange world.Set(entity, new CursorComponent { CursorState = CursorState.Free, PositionIsDirty = true }); ref var cameraData = ref world.Get(entity); - cameraData.CameraMode = CameraMode.SDKCamera; + cameraData.CameraMode = CameraMode.SdkCamera; Press(mouse.leftButton); // Temporal lock diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Animation/AnimationStatesLogic.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Animation/AnimationStatesLogic.cs index 77c2dae2b78..86053e956b9 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Animation/AnimationStatesLogic.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Animation/AnimationStatesLogic.cs @@ -27,7 +27,7 @@ public static void Execute(float dt, float verticalVelocity = rigidTransform.GravityVelocity.y + velocity.y + rigidTransform.ExternalVelocity.y; bool jumpTriggered = jumpState.JumpCount > animationComponent.States.JumpCount; - bool glidingTriggered = glideState.Value == GlideStateValue.OPENING_PROP && animationComponent.States.GlideState != GlideStateValue.OPENING_PROP; + bool glidingTriggered = glideState.Value == GlideStateValue.OpeningProp && animationComponent.States.GlideState != GlideStateValue.OpeningProp; animationComponent.States.IsGrounded = isGrounded; animationComponent.States.JumpCount = jumpState.JumpCount; @@ -63,7 +63,7 @@ public static void SetAnimatorParameters(IAvatarView view, in AnimationStates st view.SetAnimatorBool(AnimationHashes.FALLING, states.IsFalling); view.SetAnimatorBool(AnimationHashes.LONG_FALL, states.IsLongFall); view.SetAnimatorBool(AnimationHashes.STUNNED, states.IsStunned); - view.SetAnimatorBool(AnimationHashes.GLIDING, states.GlideState is GlideStateValue.OPENING_PROP or GlideStateValue.GLIDING); + view.SetAnimatorBool(AnimationHashes.GLIDING, states.GlideState is GlideStateValue.OpeningProp or GlideStateValue.Gliding); view.SetAnimatorFloat(AnimationHashes.GLIDE_BLEND, states.GlideBlendValue); if (jumpTriggered) diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Animation/AvatarAnimationEventsHandler.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Animation/AvatarAnimationEventsHandler.cs index 6e4a7d8deb9..404afea5caa 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Animation/AvatarAnimationEventsHandler.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Animation/AvatarAnimationEventsHandler.cs @@ -24,18 +24,18 @@ public class AvatarAnimationEventsHandler : MonoBehaviour private static readonly Dictionary<(MovementKind, AvatarAnimationEventType), AvatarAudioClipType> AUDIO_CLIP_LOOKUP = new() { - { (MovementKind.RUN, AvatarAnimationEventType.Jump), AvatarAudioClipType.JumpStartRun }, - { (MovementKind.RUN, AvatarAnimationEventType.Land), AvatarAudioClipType.JumpLandRun }, - { (MovementKind.RUN, AvatarAnimationEventType.Step), AvatarAudioClipType.StepRun }, - { (MovementKind.JOG, AvatarAnimationEventType.Jump), AvatarAudioClipType.JumpStartJog }, - { (MovementKind.JOG, AvatarAnimationEventType.Land), AvatarAudioClipType.JumpLandJog }, - { (MovementKind.JOG, AvatarAnimationEventType.Step), AvatarAudioClipType.StepJog }, - { (MovementKind.WALK, AvatarAnimationEventType.Jump), AvatarAudioClipType.JumpStartWalk }, - { (MovementKind.WALK, AvatarAnimationEventType.Land), AvatarAudioClipType.JumpLandWalk }, - { (MovementKind.WALK, AvatarAnimationEventType.Step), AvatarAudioClipType.StepWalk }, - { (MovementKind.IDLE, AvatarAnimationEventType.Jump), AvatarAudioClipType.JumpStartWalk }, - { (MovementKind.IDLE, AvatarAnimationEventType.Land), AvatarAudioClipType.JumpLandWalk }, - { (MovementKind.IDLE, AvatarAnimationEventType.Step), AvatarAudioClipType.StepWalk }, + { (MovementKind.Run, AvatarAnimationEventType.Jump), AvatarAudioClipType.JumpStartRun }, + { (MovementKind.Run, AvatarAnimationEventType.Land), AvatarAudioClipType.JumpLandRun }, + { (MovementKind.Run, AvatarAnimationEventType.Step), AvatarAudioClipType.StepRun }, + { (MovementKind.Jog, AvatarAnimationEventType.Jump), AvatarAudioClipType.JumpStartJog }, + { (MovementKind.Jog, AvatarAnimationEventType.Land), AvatarAudioClipType.JumpLandJog }, + { (MovementKind.Jog, AvatarAnimationEventType.Step), AvatarAudioClipType.StepJog }, + { (MovementKind.Walk, AvatarAnimationEventType.Jump), AvatarAudioClipType.JumpStartWalk }, + { (MovementKind.Walk, AvatarAnimationEventType.Land), AvatarAudioClipType.JumpLandWalk }, + { (MovementKind.Walk, AvatarAnimationEventType.Step), AvatarAudioClipType.StepWalk }, + { (MovementKind.Idle, AvatarAnimationEventType.Jump), AvatarAudioClipType.JumpStartWalk }, + { (MovementKind.Idle, AvatarAnimationEventType.Land), AvatarAudioClipType.JumpLandWalk }, + { (MovementKind.Idle, AvatarAnimationEventType.Step), AvatarAudioClipType.StepWalk }, { (ANY_KIND, AvatarAnimationEventType.AirJump), AvatarAudioClipType.AirJump }, }; diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Animation/GliderPropAnimationLogic.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Animation/GliderPropAnimationLogic.cs index 20e372f38a9..14eee423f07 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Animation/GliderPropAnimationLogic.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Animation/GliderPropAnimationLogic.cs @@ -8,7 +8,7 @@ public static class GliderPropAnimationLogic { public static void Execute(Animator animator, in CharacterAnimationComponent animationComponent, GlideStateValue glideState) { - bool isGliding = glideState is GlideStateValue.OPENING_PROP or GlideStateValue.GLIDING; + bool isGliding = glideState is GlideStateValue.OpeningProp or GlideStateValue.Gliding; animator.SetFloat(AnimationHashes.MOVEMENT_BLEND, animationComponent.States.MovementBlendValue); animator.SetBool(AnimationHashes.GLIDING, isGliding); diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Components/GlideState.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Components/GlideState.cs index 7c9f4b36255..dedf2d422ca 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Components/GlideState.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Components/GlideState.cs @@ -11,9 +11,9 @@ public struct GlideState public enum GlideStateValue { - PROP_CLOSED, - OPENING_PROP, - GLIDING, - CLOSING_PROP + PropClosed, + OpeningProp, + Gliding, + ClosingProp } } diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Components/MovementKind.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Components/MovementKind.cs index feeb4a6b9eb..22a4006f558 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Components/MovementKind.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Components/MovementKind.cs @@ -3,15 +3,15 @@ namespace DCL.CharacterMotion.Components // Number defines movement blend id in animator public enum MovementKind : byte { - IDLE = 0, - WALK = 1, - JOG = 2, - RUN = 3, + Idle = 0, + Walk = 1, + Jog = 2, + Run = 3, } public static class MovementBlend { - public const byte MIN = (byte)MovementKind.IDLE; - public const byte MAX = (byte)MovementKind.RUN; + public const byte MIN = (byte)MovementKind.Idle; + public const byte MAX = (byte)MovementKind.Run; } } diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Settings/OverridableCharacterControllerSettings.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Settings/OverridableCharacterControllerSettings.cs index 3f029dcca73..b3330f6fe11 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Settings/OverridableCharacterControllerSettings.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Settings/OverridableCharacterControllerSettings.cs @@ -26,19 +26,19 @@ private float GetOverrideOrValue(AvatarLocomotionOverrides.OverrideID id, float public float WalkSpeed { - get => GetOverrideOrValue(AvatarLocomotionOverrides.OverrideID.WALK_SPEED, impl.WalkSpeed); + get => GetOverrideOrValue(AvatarLocomotionOverrides.OverrideID.WalkSpeed, impl.WalkSpeed); set => impl.WalkSpeed = value; } public float JogSpeed { - get => GetOverrideOrValue(AvatarLocomotionOverrides.OverrideID.JOG_SPEED, impl.JogSpeed); + get => GetOverrideOrValue(AvatarLocomotionOverrides.OverrideID.JogSpeed, impl.JogSpeed); set => impl.JogSpeed = value; } public float RunSpeed { - get => GetOverrideOrValue(AvatarLocomotionOverrides.OverrideID.RUN_SPEED, impl.RunSpeed); + get => GetOverrideOrValue(AvatarLocomotionOverrides.OverrideID.RunSpeed, impl.RunSpeed); set => impl.RunSpeed = value; } @@ -62,13 +62,13 @@ public float Gravity public float JogJumpHeight { - get => GetOverrideOrValue(AvatarLocomotionOverrides.OverrideID.JUMP_HEIGHT, impl.JogJumpHeight); + get => GetOverrideOrValue(AvatarLocomotionOverrides.OverrideID.JumpHeight, impl.JogJumpHeight); set => impl.JogJumpHeight = value; } public float RunJumpHeight { - get => GetOverrideOrValue(AvatarLocomotionOverrides.OverrideID.RUN_JUMP_HEIGHT, impl.RunJumpHeight); + get => GetOverrideOrValue(AvatarLocomotionOverrides.OverrideID.RunJumpHeight, impl.RunJumpHeight); set => impl.RunJumpHeight = value; } @@ -120,7 +120,7 @@ public int AirJumpCount public float AirJumpHeight { - get => GetOverrideOrValue(AvatarLocomotionOverrides.OverrideID.DOUBLE_JUMP_HEIGHT, impl.AirJumpHeight); + get => GetOverrideOrValue(AvatarLocomotionOverrides.OverrideID.DoubleJumpHeight, impl.AirJumpHeight); set => impl.AirJumpHeight = value; } @@ -148,11 +148,11 @@ public float AirJumpDirectionChangeImpulse set => impl.AirJumpDirectionChangeImpulse = value; } - public float GlideSpeed => GetOverrideOrValue(AvatarLocomotionOverrides.OverrideID.GLIDE_SPEED, impl.GlideSpeed); + public float GlideSpeed => GetOverrideOrValue(AvatarLocomotionOverrides.OverrideID.GlideSpeed, impl.GlideSpeed); public float GlideMinGroundDistance => impl.GlideMinGroundDistance; - public float GlideMaxGravity => GetOverrideOrValue(AvatarLocomotionOverrides.OverrideID.GLIDE_MAX_GRAVITY, impl.GlideMaxGravity); + public float GlideMaxGravity => GetOverrideOrValue(AvatarLocomotionOverrides.OverrideID.GlideMaxGravity, impl.GlideMaxGravity); public float GlideWindResponse => impl.GlideWindResponse; @@ -168,7 +168,7 @@ public float AirJumpDirectionChangeImpulse public float JumpHeightStun => impl.JumpHeightStun; - public float LongFallStunTime => GetOverrideOrValue(AvatarLocomotionOverrides.OverrideID.HARD_LANDING_COOLDOWN, impl.LongFallStunTime); + public float LongFallStunTime => GetOverrideOrValue(AvatarLocomotionOverrides.OverrideID.HardLandingCooldown, impl.LongFallStunTime); public float NoSlipDistance => impl.NoSlipDistance; diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/CalculateCameraFovSystem.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/CalculateCameraFovSystem.cs index f44807d8aea..8af4663c913 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/CalculateCameraFovSystem.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/CalculateCameraFovSystem.cs @@ -36,7 +36,7 @@ private void Interpolate( in MovementInputComponent movementInput, in GlideState glideState) { - if (movementInput.Kind == MovementKind.RUN && glideState.Value == GlideStateValue.PROP_CLOSED) + if (movementInput.Kind == MovementKind.Run && glideState.Value == GlideStateValue.PropClosed) { float speedFactor = rigidTransform.MoveVelocity.Velocity.magnitude / characterControllerSettings.RunSpeed; float targetFov = Mathf.Lerp(0, characterControllerSettings.CameraFOVWhileRunning, speedFactor); diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/CalculateSpeedLimitSystem.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/CalculateSpeedLimitSystem.cs index 8de9541b052..b819f7177c1 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/CalculateSpeedLimitSystem.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/CalculateSpeedLimitSystem.cs @@ -31,7 +31,7 @@ protected override void Update(float t) [None(typeof(RandomAvatar))] private void ComputeLocalAvatarSpeedLimit(in ICharacterControllerSettings settings, in MovementInputComponent movementInput, in GlideState glideState, ref MovementSpeedLimit speedLimit) { - if (glideState.Value == GlideStateValue.GLIDING) + if (glideState.Value == GlideStateValue.Gliding) { speedLimit.Value = settings.GlideSpeed; return; diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/GliderPropControllerSystem.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/GliderPropControllerSystem.cs index cf1128f96b2..a7a1d3b6082 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/GliderPropControllerSystem.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/GliderPropControllerSystem.cs @@ -141,7 +141,7 @@ private void RemoteDisableProp(Entity entity, in GliderProp gliderProp, in Inter private void EnableProp(Entity entity, in GliderProp gliderProp, GlideStateValue glideState) { - if (glideState == GlideStateValue.PROP_CLOSED) return; + if (glideState == GlideStateValue.PropClosed) return; gliderProp.View.gameObject.SetActive(true); World.Add(entity); @@ -149,7 +149,7 @@ private void EnableProp(Entity entity, in GliderProp gliderProp, GlideStateValue private void DisableProp(Entity entity, in GliderProp gliderProp, GlideStateValue glideState) { - if (glideState != GlideStateValue.PROP_CLOSED) return; + if (glideState != GlideStateValue.PropClosed) return; gliderProp.View.PrepareForNextActivation(); gliderProp.View.gameObject.SetActive(false); @@ -187,12 +187,12 @@ private void HandleStateTransition([Data] int tick, ref GlideState glideState, i { switch (glideState.Value) { - case GlideStateValue.OPENING_PROP when gliderProp.View.OpenAnimationCompleted: - glideState.Value = GlideStateValue.GLIDING; + case GlideStateValue.OpeningProp when gliderProp.View.OpenAnimationCompleted: + glideState.Value = GlideStateValue.Gliding; break; - case GlideStateValue.CLOSING_PROP when gliderProp.View.CloseAnimationCompleted: - glideState.Value = GlideStateValue.PROP_CLOSED; + case GlideStateValue.ClosingProp when gliderProp.View.CloseAnimationCompleted: + glideState.Value = GlideStateValue.PropClosed; glideState.CooldownStartedTick = tick; break; } @@ -217,7 +217,7 @@ private void LocalUpdateTrail(in GliderProp gliderProp, in GlideState glideState { float thresholdSq = glidingSettings.TrailVelocityThreshold * glidingSettings.TrailVelocityThreshold; Vector3 velocity = rigidTransform.MoveVelocity.Velocity; - gliderProp.View.TrailEnabled = glideState.Value == GlideStateValue.GLIDING && velocity.sqrMagnitude > thresholdSq; + gliderProp.View.TrailEnabled = glideState.Value == GlideStateValue.Gliding && velocity.sqrMagnitude > thresholdSq; } [Query] @@ -240,7 +240,7 @@ private void RemoteUpdateEngineState([Data] float dt, in CharacterAnimationCompo private void UpdateEngineState(in GlideStateValue glideState, in GliderProp gliderProp, in Vector3 velocity, float dt) { - if (glideState != GlideStateValue.GLIDING) + if (glideState != GlideStateValue.Gliding) { gliderProp.View.UpdateEngineState(false, 0, dt); return; diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/HeadIKSystem.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/HeadIKSystem.cs index ae8cbcc5fa6..c93bd4bc8e4 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/HeadIKSystem.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/HeadIKSystem.cs @@ -83,7 +83,7 @@ protected override void Update(float t) UpdateIKQuery(World, t, in camera.GetCameraComponent(World), World.Has(camera)); - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.HEAD_SYNC) && playerEntity != Entity.Null && World.TryGet(playerEntity, out var playerTransform)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.HeadSync) && playerEntity != Entity.Null && World.TryGet(playerEntity, out var playerTransform)) UpdateRemoteIKQuery(World, t, playerTransform.Position); } diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/MovePlayerWithDurationSystem.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/MovePlayerWithDurationSystem.cs index 3da7ad9c479..b97cecf96a5 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/MovePlayerWithDurationSystem.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/MovePlayerWithDurationSystem.cs @@ -34,7 +34,7 @@ protected override void Update(float t) [Query] private void InterruptMovementOnInput(Entity entity, in MovementInputComponent movementInputComponent, in JumpInputComponent jumpInputComponent, ref PlayerMoveToWithDurationIntent moveIntent, CharacterPlatformComponent platformComponent) { - bool hasMovementInput = movementInputComponent.Kind != MovementKind.IDLE && movementInputComponent.Axes != Vector2.zero; + bool hasMovementInput = movementInputComponent.Kind != MovementKind.Idle && movementInputComponent.Axes != Vector2.zero; bool hasJumpInput = jumpInputComponent.IsPressed; if (!hasMovementInput && !hasJumpInput) diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/PointAtMarkerSystem.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/PointAtMarkerSystem.cs index 961cb70b44e..8a4cf90b6c5 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/PointAtMarkerSystem.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/PointAtMarkerSystem.cs @@ -89,8 +89,8 @@ private void SpawnMarker( if (!pointAt.IsPointing || string.IsNullOrEmpty(profile.UserId) - || (visibilitySetting == PointAtMarkerVisibilitySettings.VisibilitySetting.NONE && !isLocalPlayer) - || (visibilitySetting == PointAtMarkerVisibilitySettings.VisibilitySetting.FRIENDS_ONLY && !isLocalPlayer && (friendsCache == null || !friendsCache.Contains(profile.UserId)))) + || (visibilitySetting == PointAtMarkerVisibilitySettings.VisibilitySetting.None && !isLocalPlayer) + || (visibilitySetting == PointAtMarkerVisibilitySettings.VisibilitySetting.FriendsOnly && !isLocalPlayer && (friendsCache == null || !friendsCache.Contains(profile.UserId)))) return; float distanceSqr = (pointAt.WorldHitPoint - avatarBase.transform.position).sqrMagnitude; diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/StunCharacterSystem.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/StunCharacterSystem.cs index 8df979c7a28..20615e2d006 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/StunCharacterSystem.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/StunCharacterSystem.cs @@ -50,7 +50,7 @@ private static void UpdateNotStunned(float currentTime, { Vector3 currentPosition = characterController.transform.position; - if (glideState.Value == GlideStateValue.GLIDING) + if (glideState.Value == GlideStateValue.Gliding) { // Reset fall height if gliding stunComponent.TopUngroundedHeight = currentPosition.y; diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/UpdateInputJumpSystem.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/UpdateInputJumpSystem.cs index 6bf4e44d139..dfd35b6f54c 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/UpdateInputJumpSystem.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/UpdateInputJumpSystem.cs @@ -50,8 +50,8 @@ private void UpdateInput([Data] int tickValue, ref JumpInputComponent inputToUpd bool isNormalJump = jumpState.JumpCount == 0; bool disableJump = inputModifierComponent.DisableJump; - bool disableDoubleJump = inputModifierComponent.DisableDoubleJump || !FeaturesRegistry.Instance.IsEnabled(FeatureId.DOUBLE_JUMP); - bool disableGliding = inputModifierComponent.DisableGliding || !FeaturesRegistry.Instance.IsEnabled(FeatureId.GLIDING); + bool disableDoubleJump = inputModifierComponent.DisableDoubleJump || !FeaturesRegistry.Instance.IsEnabled(FeatureId.DoubleJump); + bool disableGliding = inputModifierComponent.DisableGliding || !FeaturesRegistry.Instance.IsEnabled(FeatureId.Gliding); if (disableJump && isNormalJump) // Trying to do a normal (ground) jump but jumping is disabled. diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/UpdateInputMovementSystem.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/UpdateInputMovementSystem.cs index beea9d90387..5f82d4bd18b 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/UpdateInputMovementSystem.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/UpdateInputMovementSystem.cs @@ -42,7 +42,7 @@ private void UpdateInput(ref MovementInputComponent inputToUpdate, in InputModif inputToUpdate.Axes = movementAxis.ReadValue(); if (inputToUpdate.Axes == Vector2.zero) - inputToUpdate.Kind = MovementKind.IDLE; + inputToUpdate.Kind = MovementKind.Idle; else { bool runPressed = sprintAction.IsPressed(); @@ -58,28 +58,28 @@ private static MovementKind ProcessInputMovementKind(InputModifierComponent inpu if (runPressed) { if (inputModifierComponent.DisableRun) - return inputModifierComponent.DisableJog ? MovementKind.WALK : MovementKind.JOG; + return inputModifierComponent.DisableJog ? MovementKind.Walk : MovementKind.Jog; - return MovementKind.RUN; + return MovementKind.Run; } if (walkPressed) { if (inputModifierComponent.DisableWalk) - return inputModifierComponent.DisableJog ? MovementKind.RUN : MovementKind.JOG; + return inputModifierComponent.DisableJog ? MovementKind.Run : MovementKind.Jog; - return MovementKind.WALK; + return MovementKind.Walk; } if (inputModifierComponent.DisableJog) { if (inputModifierComponent.DisableWalk) - return MovementKind.RUN; + return MovementKind.Run; - return MovementKind.WALK; + return MovementKind.Walk; } - return MovementKind.JOG; + return MovementKind.Jog; } } } diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/UpdatePointAndClickInputSystem.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/UpdatePointAndClickInputSystem.cs index d43ed73c6e0..1c0cd4f9e35 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Systems/UpdatePointAndClickInputSystem.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Systems/UpdatePointAndClickInputSystem.cs @@ -217,7 +217,7 @@ private void DriveMovement( in ICharacterControllerSettings settings) { // Cancel when the player takes manual control - bool hasManualMovement = movementInput.Kind != MovementKind.IDLE + bool hasManualMovement = movementInput.Kind != MovementKind.Idle || movementInput.Axes != Vector2.zero; if (hasManualMovement) @@ -235,7 +235,7 @@ private void DriveMovement( if (xzDistance <= settings.PointAndClickArrivalDistance) { movementInput.Axes = Vector2.zero; - movementInput.Kind = MovementKind.IDLE; + movementInput.Kind = MovementKind.Idle; entitiesToCancelNavigation.Add(entity); return; } @@ -252,7 +252,7 @@ private void DriveMovement( if (xzMoved < settings.PointAndClickStuckMinMovement) { movementInput.Axes = Vector2.zero; - movementInput.Kind = MovementKind.IDLE; + movementInput.Kind = MovementKind.Idle; entitiesToCancelNavigation.Add(entity); return; } @@ -271,11 +271,11 @@ private void DriveMovement( // Honour sprint/walk modifier keys the same way UpdateInputMovementSystem does if (sprintAction.IsPressed()) - movementInput.Kind = MovementKind.RUN; + movementInput.Kind = MovementKind.Run; else if (walkAction.IsPressed()) - movementInput.Kind = MovementKind.WALK; + movementInput.Kind = MovementKind.Walk; else - movementInput.Kind = MovementKind.JOG; + movementInput.Kind = MovementKind.Jog; } } } diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Tests/ApplyExternalForceShould.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Tests/ApplyExternalForceShould.cs index 895f2e29bc7..6bf198c0af1 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Tests/ApplyExternalForceShould.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Tests/ApplyExternalForceShould.cs @@ -36,7 +36,7 @@ public void ComputeAccelerationFromForce() { CharacterRigidTransform rigidTransform = WithExternalForce(new Vector3(10f, 20f, 0f)); - var glideState = new GlideState { Value = GlideStateValue.PROP_CLOSED }; + var glideState = new GlideState { Value = GlideStateValue.PropClosed }; ApplyExternalForce.Execute(settings, ref rigidTransform, glideState, DT); @@ -49,7 +49,7 @@ public void MultiplyAccelerationWhileGliding() { CharacterRigidTransform rigidTransform = WithExternalForce(new Vector3(10f, 20f, 0f)); - var glideState = new GlideState { Value = GlideStateValue.GLIDING }; + var glideState = new GlideState { Value = GlideStateValue.Gliding }; ApplyExternalForce.Execute(settings, ref rigidTransform, glideState, DT); @@ -62,7 +62,7 @@ public void IntegrateOnlyHorizontalVelocity() { CharacterRigidTransform rigidTransform = WithExternalForce(new Vector3(10f, 20f, 5f)); - var glideState = new GlideState { Value = GlideStateValue.GLIDING }; + var glideState = new GlideState { Value = GlideStateValue.Gliding }; ApplyExternalForce.Execute(settings, ref rigidTransform, glideState, DT); diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Tests/ApplyGlidingShould.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Tests/ApplyGlidingShould.cs index 783ba67ef0a..5d694f5e6a4 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Tests/ApplyGlidingShould.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Tests/ApplyGlidingShould.cs @@ -31,7 +31,7 @@ public void ClampFallSpeedWhileGliding() Execute(rigidTransform, ref glideState); Assert.IsTrue(Mathf.Approximately(-GLIDE_MAX_GRAVITY, rigidTransform.GravityVelocity.y), "Fall speed is clamped to GlideMaxGravity"); - Assert.AreEqual(GlideStateValue.GLIDING, glideState.Value); + Assert.AreEqual(GlideStateValue.Gliding, glideState.Value); } [Test] @@ -76,6 +76,6 @@ private static CharacterRigidTransform GlidingRigidTransform() => }; private static GlideState GlidingState() => - new () { Value = GlideStateValue.GLIDING }; + new () { Value = GlideStateValue.Gliding }; } } diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Tests/CoyoteTimerShould.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Tests/CoyoteTimerShould.cs index 5420b381311..760b022ad60 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Tests/CoyoteTimerShould.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Tests/CoyoteTimerShould.cs @@ -140,7 +140,7 @@ private void SetupFallingPlayer() jumpInputComponent = new JumpInputComponent(); movementInputComponent = new MovementInputComponent() { - Kind = MovementKind.JOG + Kind = MovementKind.Jog }; } } diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Tests/MovePlayerWithDurationSystemShould.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Tests/MovePlayerWithDurationSystemShould.cs index 823614307f5..e33e877fff4 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Tests/MovePlayerWithDurationSystemShould.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Tests/MovePlayerWithDurationSystemShould.cs @@ -47,7 +47,7 @@ private Entity CreatePlayerEntity( var characterTransform = new CharacterTransform(characterGameObject.transform); var rigidTransform = new CharacterRigidTransform(); var animationComponent = new CharacterAnimationComponent(); - var movementInput = new MovementInputComponent { Kind = MovementKind.IDLE, Axes = Vector2.zero }; + var movementInput = new MovementInputComponent { Kind = MovementKind.Idle, Axes = Vector2.zero }; var jumpInput = new JumpInputComponent { IsPressed = false }; completionSource ??= new UniTaskCompletionSource(); var moveIntent = new PlayerMoveToWithDurationIntent(startPosition, targetPosition, cameraTarget, avatarTarget, completionSource, duration); @@ -170,7 +170,7 @@ public void InterruptMovementOnMovementInput() Assert.That(world.Has(e), Is.True); // Simulate movement input - world.Set(e, new MovementInputComponent { Kind = MovementKind.JOG, Axes = new Vector2(1, 0) }); + world.Set(e, new MovementInputComponent { Kind = MovementKind.Jog, Axes = new Vector2(1, 0) }); // Update should detect input and remove intent system.Update(0.1f); @@ -367,7 +367,7 @@ public void SetCompletionSourceToFalseOnMovementInputInterruption() system.Update(0.1f); // Simulate movement input to interrupt - world.Set(e, new MovementInputComponent { Kind = MovementKind.JOG, Axes = new Vector2(1, 0) }); + world.Set(e, new MovementInputComponent { Kind = MovementKind.Jog, Axes = new Vector2(1, 0) }); // Update should detect input and interrupt system.Update(0.1f); @@ -449,7 +449,7 @@ public void ClearPlatformOnMovementInputInterruption() system.Update(0.1f); // Act - world.Set(e, new MovementInputComponent { Kind = MovementKind.JOG, Axes = new Vector2(1, 0) }); + world.Set(e, new MovementInputComponent { Kind = MovementKind.Jog, Axes = new Vector2(1, 0) }); system.Update(0.1f); // Assert diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Utils/MovementSpeedLimitHelper.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Utils/MovementSpeedLimitHelper.cs index 164a8868820..7be0a1bc799 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Utils/MovementSpeedLimitHelper.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Utils/MovementSpeedLimitHelper.cs @@ -10,8 +10,8 @@ public static class MovementSpeedLimitHelper public static float GetMovementSpeedLimit(ICharacterControllerSettings settings, MovementKind movementKind) => movementKind switch { - MovementKind.RUN => settings.RunSpeed, - MovementKind.JOG => settings.JogSpeed, + MovementKind.Run => settings.RunSpeed, + MovementKind.Jog => settings.JogSpeed, _ => settings.WalkSpeed }; @@ -19,8 +19,8 @@ public static float GetMovementSpeedLimit(ICharacterControllerSettings settings, public static float GetAnimationBlendingSpeedLimit(ICharacterControllerSettings settings, MovementKind movementKind) => movementKind switch { - MovementKind.RUN => settings.MoveAnimBlendMaxRunSpeed, - MovementKind.JOG => settings.MoveAnimBlendMaxJogSpeed, + MovementKind.Run => settings.MoveAnimBlendMaxRunSpeed, + MovementKind.Jog => settings.MoveAnimBlendMaxJogSpeed, _ => settings.MoveAnimBlendMaxWalkSpeed }; } diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Velocity/ApplyExternalForce.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Velocity/ApplyExternalForce.cs index 3cc7cfa0284..0053e8bc35d 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Velocity/ApplyExternalForce.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Velocity/ApplyExternalForce.cs @@ -25,7 +25,7 @@ public static void Execute(ICharacterControllerSettings settings, ref CharacterR characterPhysics.ExternalAcceleration = characterPhysics.ExternalForce / settings.CharacterMass; // An open glider catches the airflow with a larger effective area, so continuous external forces act on it stronger - if (glideState.Value == GlideStateValue.GLIDING) + if (glideState.Value == GlideStateValue.Gliding) characterPhysics.ExternalAcceleration *= settings.GlideWindResponse; // v += a * dt (Vertical acceleration is read by ApplyGravity via ExternalAcceleration.y) diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Velocity/ApplyGliding.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Velocity/ApplyGliding.cs index ec0b8fb3241..a3dbfce8431 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Velocity/ApplyGliding.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Velocity/ApplyGliding.cs @@ -34,20 +34,20 @@ public static void Execute(in ICharacterControllerSettings settings, // Once the 'ready' flag becomes true the actual gliding sequence starts bool enoughTimeSinceLastJump = (physicsTick - jumpInput.Trigger.TickWhenJumpWasConsumed) * dt >= settings.JumpToGlideTimeInterval; bool coolingDown = (physicsTick - glideState.CooldownStartedTick) * dt < settings.GlideCooldown; - bool readyToStartGliding = enoughTimeSinceLastJump && !coolingDown && glideState.Value == GlideStateValue.PROP_CLOSED; + bool readyToStartGliding = enoughTimeSinceLastJump && !coolingDown && glideState.Value == GlideStateValue.PropClosed; // Start gliding if want, can and ready if (glideState.WantsToGlide && canTriggerGliding && readyToStartGliding) { - glideState.Value = GlideStateValue.OPENING_PROP; + glideState.Value = GlideStateValue.OpeningProp; return; } - if (glideState.Value == GlideStateValue.GLIDING) + if (glideState.Value == GlideStateValue.Gliding) { if (!jumpInput.IsPressed || !canTriggerGliding) // Stop gliding if the jump button is released or any other condition prevents it - glideState.Value = GlideStateValue.CLOSING_PROP; + glideState.Value = GlideStateValue.ClosingProp; else // Otherwise clamp the fall speed only: upward velocity (jump momentum, external forces like wind) must pass through untouched rigidTransform.GravityVelocity.y = Mathf.Max(rigidTransform.GravityVelocity.y, -settings.GlideMaxGravity); diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Velocity/ApplyJump.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Velocity/ApplyJump.cs index 9b5cb3e8bff..5f79e9e078f 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Velocity/ApplyJump.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Velocity/ApplyJump.cs @@ -130,10 +130,10 @@ private static float GetJumpHeight(ICharacterControllerSettings settings, float minJumpHeight = settings.JogJumpHeight; float maxJumpHeight = movementInput.Kind switch { - MovementKind.WALK => settings.JogJumpHeight, - MovementKind.JOG => settings.JogJumpHeight, - MovementKind.IDLE => settings.JogJumpHeight, - MovementKind.RUN => settings.RunJumpHeight, + MovementKind.Walk => settings.JogJumpHeight, + MovementKind.Jog => settings.JogJumpHeight, + MovementKind.Idle => settings.JogJumpHeight, + MovementKind.Run => settings.RunJumpHeight, _ => throw new ArgumentOutOfRangeException(), }; diff --git a/Explorer/Assets/DCL/Character/CharacterMotion/Velocity/ApplySlopeModifier.cs b/Explorer/Assets/DCL/Character/CharacterMotion/Velocity/ApplySlopeModifier.cs index 71cb0b404a9..ad16db83bf2 100644 --- a/Explorer/Assets/DCL/Character/CharacterMotion/Velocity/ApplySlopeModifier.cs +++ b/Explorer/Assets/DCL/Character/CharacterMotion/Velocity/ApplySlopeModifier.cs @@ -37,7 +37,7 @@ public static Vector3 Execute( direction = Vector3.down, }; - float downwardsSlopeDistance = input.Kind == MovementKind.RUN ? settings.DownwardsSlopeRunRaycastDistance : settings.DownwardsSlopeJogRaycastDistance; + float downwardsSlopeDistance = input.Kind == MovementKind.Run ? settings.DownwardsSlopeRunRaycastDistance : settings.DownwardsSlopeJogRaycastDistance; if (!DCLPhysics.Raycast(ray, out RaycastHit hit, downwardsSlopeDistance, PhysicsLayers.CHARACTER_ONLY_MASK, QueryTriggerInteraction.Ignore)) return Vector3.zero; diff --git a/Explorer/Assets/DCL/Character/CharacterObject/Tests/CharacterTransformDirtyFlagShould.cs b/Explorer/Assets/DCL/Character/CharacterObject/Tests/CharacterTransformDirtyFlagShould.cs index caf987d5ca9..7e58db7e36c 100644 --- a/Explorer/Assets/DCL/Character/CharacterObject/Tests/CharacterTransformDirtyFlagShould.cs +++ b/Explorer/Assets/DCL/Character/CharacterObject/Tests/CharacterTransformDirtyFlagShould.cs @@ -371,7 +371,7 @@ public void SetsDirtyCharacterTransformViaRemotePlayersMovementSystem() rotationY = 45f, velocity = Vector3.zero, velocitySqrMagnitude = 0f, - movementKind = MovementKind.IDLE, + movementKind = MovementKind.Idle, isInstant = false }; @@ -443,7 +443,7 @@ public void CompleteFlow_RemoteMovementSetsDirty_PartitionSystemClearsIt() rotationY = 90f, velocity = Vector3.zero, velocitySqrMagnitude = 0f, - movementKind = MovementKind.IDLE, + movementKind = MovementKind.Idle, isInstant = false }; diff --git a/Explorer/Assets/DCL/Chat/ChatConversationsToolbarViewItem.cs b/Explorer/Assets/DCL/Chat/ChatConversationsToolbarViewItem.cs index 6115e608788..1e8599c4d52 100644 --- a/Explorer/Assets/DCL/Chat/ChatConversationsToolbarViewItem.cs +++ b/Explorer/Assets/DCL/Chat/ChatConversationsToolbarViewItem.cs @@ -72,7 +72,7 @@ public class ChatConversationsToolbarViewItem : MonoBehaviour, IPointerEnterHand private float offlineThumbnailGreyOutOpacity = 0.6f; // This is necessary because the data is set while the script has not awakened yet - private OnlineStatus storedConnectionStatus = OnlineStatus.OFFLINE; + private OnlineStatus storedConnectionStatus = OnlineStatus.Offline; /// /// Gets or sets the identifier of the conversation. @@ -150,10 +150,10 @@ public void ShowMentionSign(bool show) public virtual void SetConnectionStatus(OnlineStatus connectionStatus) { connectionStatusIndicator.color = onlineStatusConfiguration.GetConfiguration(connectionStatus).StatusColor; - connectionStatusIndicatorContainer.SetActive(connectionStatus == OnlineStatus.ONLINE); + connectionStatusIndicatorContainer.SetActive(connectionStatus == OnlineStatus.Online); if(thumbnailView != null && thumbnailView.TryGetComponent(out ProfilePictureView profilePictureView)) - profilePictureView.GreyOut(connectionStatus != OnlineStatus.ONLINE ? offlineThumbnailGreyOutOpacity : 0.0f); + profilePictureView.GreyOut(connectionStatus != OnlineStatus.Online ? offlineThumbnailGreyOutOpacity : 0.0f); storedConnectionStatus = connectionStatus; } diff --git a/Explorer/Assets/DCL/Chat/ChatTitlebarView.cs b/Explorer/Assets/DCL/Chat/ChatTitlebarView.cs index 3a0230ed4b5..a05bf4d35e7 100644 --- a/Explorer/Assets/DCL/Chat/ChatTitlebarView.cs +++ b/Explorer/Assets/DCL/Chat/ChatTitlebarView.cs @@ -46,7 +46,7 @@ private void OnContextMenuButtonClicked() { var request = new ShowChannelContextMenuRequest { - Position = defaultTitlebarView.ButtonOpenContextMenu.transform.position, AnchorPoint = MenuAnchorPoint.TOP_LEFT + Position = defaultTitlebarView.ButtonOpenContextMenu.transform.position, AnchorPoint = MenuAnchorPoint.TopLeft }; OnContextMenuRequested?.Invoke(request); @@ -58,7 +58,7 @@ private void OnProfileContextMenuClicked(TitlebarViewMode mode) { var data = new UserProfileMenuRequest { - WalletAddress = new Web3Address(""), Position = defaultTitlebarView.ButtonOpenProfileContextMenu.transform.position, AnchorPoint = MenuAnchorPoint.TOP_LEFT, Offset = Vector2.zero, + WalletAddress = new Web3Address(""), Position = defaultTitlebarView.ButtonOpenProfileContextMenu.transform.position, AnchorPoint = MenuAnchorPoint.TopLeft, Offset = Vector2.zero, OnShow = defaultTitlebarView.SetContextMenuButtonSelectedAppearance, OnHide = defaultTitlebarView.SetContextMenuButtonNormalAppearance }; @@ -68,7 +68,7 @@ private void OnProfileContextMenuClicked(TitlebarViewMode mode) { var data = new ShowContextMenuRequest { - Position = defaultTitlebarView.ButtonOpenProfileContextMenu.transform.position, AnchorPoint = MenuAnchorPoint.TOP_LEFT, Offset = Vector2.zero, + Position = defaultTitlebarView.ButtonOpenProfileContextMenu.transform.position, AnchorPoint = MenuAnchorPoint.TopLeft, Offset = Vector2.zero, OnShow = defaultTitlebarView.SetContextMenuButtonSelectedAppearance, OnHide = defaultTitlebarView.SetContextMenuButtonNormalAppearance }; diff --git a/Explorer/Assets/DCL/Chat/Commands/ChatTeleporter.cs b/Explorer/Assets/DCL/Chat/Commands/ChatTeleporter.cs index 8fb63b6006b..a3ff610771a 100644 --- a/Explorer/Assets/DCL/Chat/Commands/ChatTeleporter.cs +++ b/Explorer/Assets/DCL/Chat/Commands/ChatTeleporter.cs @@ -67,15 +67,15 @@ public async UniTask TeleportToRealmAsync(string realm, CancellationToke return error.State switch { - ChangeRealmError.MESSAGE_ERROR => $"🔴 Teleport was not fully successful to {realm} world!", - ChangeRealmError.NOT_REACHABLE => $"🔴 Error: The world {realm} doesn't exist or not reachable!", - ChangeRealmError.CHANGE_CANCELLED => "🔴 Error: The operation was canceled!", - ChangeRealmError.LOCAL_SCENE_DEVELOPMENT_BLOCKED => "🔴 Error: Realm changes are not allowed in local scene development mode", - ChangeRealmError.UNAUTHORIZED_WORLD_ACCESS => "🔴 Error: User is not authorized to access the requested world", - ChangeRealmError.TIMEOUT => "🔴 Error: We were unable to connect to the realm. Please verify your connection.", - ChangeRealmError.PASSWORD_REQUIRED => $"🔴 Error: The world {realm} requires a password to access", - ChangeRealmError.PASSWORD_CANCELLED => "🟡 Password entry was cancelled", - ChangeRealmError.WHITELIST_ACCESS_DENIED => $"🔴 Error: You are not on the access list for {realm}", + ChangeRealmError.MessageError => $"🔴 Teleport was not fully successful to {realm} world!", + ChangeRealmError.NotReachable => $"🔴 Error: The world {realm} doesn't exist or not reachable!", + ChangeRealmError.ChangeCancelled => "🔴 Error: The operation was canceled!", + ChangeRealmError.LocalSceneDevelopmentBlocked => "🔴 Error: Realm changes are not allowed in local scene development mode", + ChangeRealmError.UnauthorizedWorldAccess => "🔴 Error: User is not authorized to access the requested world", + ChangeRealmError.Timeout => "🔴 Error: We were unable to connect to the realm. Please verify your connection.", + ChangeRealmError.PasswordRequired => $"🔴 Error: The world {realm} requires a password to access", + ChangeRealmError.PasswordCancelled => "🟡 Password entry was cancelled", + ChangeRealmError.WhitelistAccessDenied => $"🔴 Error: You are not on the access list for {realm}", _ => throw new ArgumentOutOfRangeException() }; } @@ -102,12 +102,12 @@ public async UniTask TeleportToRealmAsync(string realm, Vector2Int targe return error.State switch { - ChangeRealmError.MESSAGE_ERROR => $"🔴 Teleport was not fully successful to {realm} world!", - ChangeRealmError.NOT_REACHABLE => $"🔴 Error: The world {realm} doesn't exist or not reachable!", - ChangeRealmError.CHANGE_CANCELLED => "🔴 Error: The operation was canceled!", - ChangeRealmError.LOCAL_SCENE_DEVELOPMENT_BLOCKED => "🔴 Error: Realm changes are not allowed in local scene development mode", - ChangeRealmError.UNAUTHORIZED_WORLD_ACCESS => "🔴 Error: User is not authorized to access the requested world", - ChangeRealmError.TIMEOUT => "🔴 Error: We were unable to connect to the realm. Please verify your connection.", + ChangeRealmError.MessageError => $"🔴 Teleport was not fully successful to {realm} world!", + ChangeRealmError.NotReachable => $"🔴 Error: The world {realm} doesn't exist or not reachable!", + ChangeRealmError.ChangeCancelled => "🔴 Error: The operation was canceled!", + ChangeRealmError.LocalSceneDevelopmentBlocked => "🔴 Error: Realm changes are not allowed in local scene development mode", + ChangeRealmError.UnauthorizedWorldAccess => "🔴 Error: User is not authorized to access the requested world", + ChangeRealmError.Timeout => "🔴 Error: We were unable to connect to the realm. Please verify your connection.", _ => throw new ArgumentOutOfRangeException() }; } diff --git a/Explorer/Assets/DCL/Chat/MessageBus/ChatMessageOrigins.cs b/Explorer/Assets/DCL/Chat/MessageBus/ChatMessageOrigins.cs index 9399c72ba5e..61a84c9f207 100644 --- a/Explorer/Assets/DCL/Chat/MessageBus/ChatMessageOrigins.cs +++ b/Explorer/Assets/DCL/Chat/MessageBus/ChatMessageOrigins.cs @@ -4,12 +4,12 @@ namespace DCL.Chat.MessageBus { public enum ChatMessageOrigin { - CHAT, - DEBUG_PANEL, - RESTRICTED_ACTION_API, - MINIMAP, - JUMP_IN, - TELEPORT_PROMPT, + Chat, + DebugPanel, + RestrictedActionApi, + Minimap, + JumpIn, + TeleportPrompt, } public static class ChatMessageOriginExtensions @@ -18,12 +18,12 @@ public static string ToStringValue(this ChatMessageOrigin origin) { return origin switch { - ChatMessageOrigin.CHAT => "chat", - ChatMessageOrigin.DEBUG_PANEL => "debug panel", - ChatMessageOrigin.RESTRICTED_ACTION_API => "RestrictedActionAPI", - ChatMessageOrigin.MINIMAP => "minimap", - ChatMessageOrigin.JUMP_IN => "jump in", - ChatMessageOrigin.TELEPORT_PROMPT => "teleport prompt", + ChatMessageOrigin.Chat => "chat", + ChatMessageOrigin.DebugPanel => "debug panel", + ChatMessageOrigin.RestrictedActionApi => "RestrictedActionAPI", + ChatMessageOrigin.Minimap => "minimap", + ChatMessageOrigin.JumpIn => "jump in", + ChatMessageOrigin.TeleportPrompt => "teleport prompt", _ => throw new ArgumentOutOfRangeException(nameof(origin), origin, null), }; } diff --git a/Explorer/Assets/DCL/Chat/MessageBus/IChatMessagesBus.cs b/Explorer/Assets/DCL/Chat/MessageBus/IChatMessagesBus.cs index e397d27766a..ad42393370a 100644 --- a/Explorer/Assets/DCL/Chat/MessageBus/IChatMessagesBus.cs +++ b/Explorer/Assets/DCL/Chat/MessageBus/IChatMessagesBus.cs @@ -36,7 +36,7 @@ public static IChatMessagesBus WithDebugPanel(this IChatMessagesBus messagesBus, { void CreateTestChatEntry() { - messagesBus.SendWithUtcNowTimestamp(ChatChannel.NEARBY_CHANNEL, StringUtils.GenerateRandomString(Random.Range(1, 250)), ChatMessageOrigin.DEBUG_PANEL); + messagesBus.SendWithUtcNowTimestamp(ChatChannel.NEARBY_CHANNEL, StringUtils.GenerateRandomString(Random.Range(1, 250)), ChatMessageOrigin.DebugPanel); } debugContainerBuilder.TryAddWidget(IDebugContainerBuilder.Categories.CHAT)?.AddControl(new DebugButtonDef("Create chat message", CreateTestChatEntry), null!); diff --git a/Explorer/Assets/DCL/Chat/MessageBus/LiveKitChatMessagesBus.cs b/Explorer/Assets/DCL/Chat/MessageBus/LiveKitChatMessagesBus.cs index dc523ef62df..38fcd8d142c 100644 --- a/Explorer/Assets/DCL/Chat/MessageBus/LiveKitChatMessagesBus.cs +++ b/Explorer/Assets/DCL/Chat/MessageBus/LiveKitChatMessagesBus.cs @@ -57,7 +57,7 @@ public LiveKitChatMessagesBus(IMessagePipesHub messagePipesHub, this.identityCache = identityCache; this.messageFactory = messageFactory; - isChatMessageRateLimiterEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.CHAT_MESSAGE_RATE_LIMIT); + isChatMessageRateLimiterEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.ChatMessageRateLimit); if (isChatMessageRateLimiterEnabled) { @@ -65,7 +65,7 @@ public LiveKitChatMessagesBus(IMessagePipesHub messagePipesHub, messageRateLimiter.LoadConfigurationFromFeatureFlag(); } - isNearbyChannelBufferEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.CHAT_MESSAGE_BUFFER); + isNearbyChannelBufferEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.ChatMessageBuffer); if (isNearbyChannelBufferEnabled) { @@ -74,7 +74,7 @@ public LiveKitChatMessagesBus(IMessagePipesHub messagePipesHub, roomHub.IslandRoom().ConnectionUpdated += OnIslandConnectionUpdated; } - isPrivateChatRequiresTopicEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.PRIVATE_CHAT_REQUIRES_TOPIC); + isPrivateChatRequiresTopicEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.PrivateChatRequiresTopic); identityCache.OnIdentityCleared += OnIdentityCleared; diff --git a/Explorer/Assets/DCL/Chat/MessageBus/TeleportPromptChatBridge.cs b/Explorer/Assets/DCL/Chat/MessageBus/TeleportPromptChatBridge.cs index 685f72ecab1..8d8246e14c5 100644 --- a/Explorer/Assets/DCL/Chat/MessageBus/TeleportPromptChatBridge.cs +++ b/Explorer/Assets/DCL/Chat/MessageBus/TeleportPromptChatBridge.cs @@ -27,6 +27,6 @@ public void Dispose() => teleportPromptBus.TeleportApproved -= OnTeleportApproved; private void OnTeleportApproved(Vector2Int coords) => - chatMessagesBus.SendWithUtcNowTimestamp(ChatChannel.NEARBY_CHANNEL, $"/{ChatCommandsUtils.COMMAND_GOTO} {coords.x},{coords.y}", ChatMessageOrigin.TELEPORT_PROMPT); + chatMessagesBus.SendWithUtcNowTimestamp(ChatChannel.NEARBY_CHANNEL, $"/{ChatCommandsUtils.COMMAND_GOTO} {coords.x},{coords.y}", ChatMessageOrigin.TeleportPrompt); } } diff --git a/Explorer/Assets/DCL/Chat/RPCChatPrivacyService.cs b/Explorer/Assets/DCL/Chat/RPCChatPrivacyService.cs index 9803c93b15f..99aa1b3a081 100644 --- a/Explorer/Assets/DCL/Chat/RPCChatPrivacyService.cs +++ b/Explorer/Assets/DCL/Chat/RPCChatPrivacyService.cs @@ -54,7 +54,7 @@ public async UniTask GetOwnSocialSettingsAsync(CancellationToken ct) .AttachExternalCancellation(ct) .Timeout(TimeSpan.FromSeconds(TIMEOUT_SECONDS)); - settingsAsset.OnPrivacyRead(response.Ok?.Settings.PrivateMessagesPrivacy == PrivateMessagePrivacySetting.OnlyFriends ? ChatPrivacySettings.ONLY_FRIENDS : ChatPrivacySettings.ALL); + settingsAsset.OnPrivacyRead(response.Ok?.Settings.PrivateMessagesPrivacy == PrivateMessagePrivacySetting.OnlyFriends ? ChatPrivacySettings.OnlyFriends : ChatPrivacySettings.All); } public async UniTask GetPrivacySettingForUsersAsync(HashSet walletIds, CancellationToken ct) diff --git a/Explorer/Assets/DCL/Chat/Settings/ChatSettingsAsset.cs b/Explorer/Assets/DCL/Chat/Settings/ChatSettingsAsset.cs index b5c3a7ed165..55aefafaaf7 100644 --- a/Explorer/Assets/DCL/Chat/Settings/ChatSettingsAsset.cs +++ b/Explorer/Assets/DCL/Chat/Settings/ChatSettingsAsset.cs @@ -7,10 +7,10 @@ namespace DCL.Settings.Settings //[CreateAssetMenu(fileName = "ChatSettings", menuName = "DCL/Settings/Chat Settings")] public class ChatSettingsAsset : ScriptableObject { - [FormerlySerializedAs("chatSettings")] public ChatAudioSettings chatAudioSettings = ChatAudioSettings.ALL; - public ChatPrivacySettings chatPrivacySettings = ChatPrivacySettings.ALL; - public ChatBubbleVisibilitySettings chatBubblesVisibilitySettings = ChatBubbleVisibilitySettings.ALL; - public ChatPreferredTranslationSettings chatPreferredTranslationSettings = ChatPreferredTranslationSettings.EN; + [FormerlySerializedAs("chatSettings")] public ChatAudioSettings chatAudioSettings = ChatAudioSettings.All; + public ChatPrivacySettings chatPrivacySettings = ChatPrivacySettings.All; + public ChatBubbleVisibilitySettings chatBubblesVisibilitySettings = ChatBubbleVisibilitySettings.All; + public ChatPreferredTranslationSettings chatPreferredTranslationSettings = ChatPreferredTranslationSettings.En; public bool chatReactionsEnabled = true; public string CHAT_TRANSLATION_SETTINGS_HOVER_TOOLTIP @@ -56,35 +56,35 @@ public void SetReactionsEnabled(bool enabled) public enum ChatAudioSettings { - ALL = 0, - MENTIONS_ONLY = 1, - NONE = 2, + All = 0, + MentionsOnly = 1, + None = 2, } public enum ChatPrivacySettings { - ONLY_FRIENDS = 0, - ALL = 1, + OnlyFriends = 0, + All = 1, } public enum ChatBubbleVisibilitySettings { - NONE = 0, - NEARBY_ONLY = 1, - ALL + None = 0, + NearbyOnly = 1, + All } public enum ChatPreferredTranslationSettings { - EN = 0, - ES = 1, - FR = 2, - DE = 3, - RU = 4, - PT = 5, - IT = 6, - ZH = 7, - JA = 8, - KO = 9 + En = 0, + Es = 1, + Fr = 2, + De = 3, + Ru = 4, + Pt = 5, + It = 6, + Zh = 7, + Ja = 8, + Ko = 9 } } diff --git a/Explorer/Assets/DCL/Chat/SharedArea/ChatMainSharedAreaController.cs b/Explorer/Assets/DCL/Chat/SharedArea/ChatMainSharedAreaController.cs index 215b82fe102..25483f427f6 100644 --- a/Explorer/Assets/DCL/Chat/SharedArea/ChatMainSharedAreaController.cs +++ b/Explorer/Assets/DCL/Chat/SharedArea/ChatMainSharedAreaController.cs @@ -34,7 +34,7 @@ public ChatMainSharedAreaController(ViewFactoryMethod viewFactory, this.dclInput = dclInput; } - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.PERSISTENT; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Persistent; protected override void OnViewInstantiated() { diff --git a/Explorer/Assets/DCL/Chat/_Refactor/ChatChannels/ChatChannelsView.cs b/Explorer/Assets/DCL/Chat/_Refactor/ChatChannels/ChatChannelsView.cs index f81ffcced52..0dba2010069 100644 --- a/Explorer/Assets/DCL/Chat/_Refactor/ChatChannels/ChatChannelsView.cs +++ b/Explorer/Assets/DCL/Chat/_Refactor/ChatChannels/ChatChannelsView.cs @@ -118,7 +118,7 @@ public void AddConversation(BaseChannelViewModel viewModel) newItem.SetOfficialIconVisibility(user.IsOfficial); newItem.Configure(isClosable: true); newItem.BindProfileThumbnail(user.ProfilePicture); - newItem.SetConnectionStatus(OnlineStatus.OFFLINE); + newItem.SetConnectionStatus(OnlineStatus.Offline); break; @@ -155,7 +155,7 @@ public void UpdateConversation(BaseChannelViewModel viewModel) itemToUpdate.SetConversationName(user.DisplayName); itemToUpdate.SetClaimedNameIconVisibility(user.HasClaimedName); itemToUpdate.SetOfficialIconVisibility(user.IsOfficial); - itemToUpdate.SetConnectionStatus(user.IsOnline ? OnlineStatus.ONLINE : OnlineStatus.OFFLINE); + itemToUpdate.SetConnectionStatus(user.IsOnline ? OnlineStatus.Online : OnlineStatus.Offline); break; case CommunityChannelViewModel community: @@ -167,7 +167,7 @@ public void UpdateConversation(BaseChannelViewModel viewModel) public void SetOnlineStatus(string channelId, bool isOnline) { - if (items.TryGetValue(new ChatChannel.ChannelId(channelId), out ChatConversationsToolbarViewItem? item)) { item.SetConnectionStatus(isOnline ? OnlineStatus.ONLINE : OnlineStatus.OFFLINE); } + if (items.TryGetValue(new ChatChannel.ChannelId(channelId), out ChatConversationsToolbarViewItem? item)) { item.SetConnectionStatus(isOnline ? OnlineStatus.Online : OnlineStatus.Offline); } } public void AddItem(ChatConversationsToolbarViewItem newItem) diff --git a/Explorer/Assets/DCL/Chat/_Refactor/ChatCommands/GetUserCallStatusCommand.cs b/Explorer/Assets/DCL/Chat/_Refactor/ChatCommands/GetUserCallStatusCommand.cs index 7981650fb12..0cacfd671e6 100644 --- a/Explorer/Assets/DCL/Chat/_Refactor/ChatCommands/GetUserCallStatusCommand.cs +++ b/Explorer/Assets/DCL/Chat/_Refactor/ChatCommands/GetUserCallStatusCommand.cs @@ -24,15 +24,15 @@ public GetUserCallStatusCommand(PrivateConversationUserStateService userStateSer switch (result.Value.Result.ChatUserState) { - case PrivateConversationUserStateService.ChatUserState.CONNECTED: - return CallButtonPresenter.OtherUserCallStatus.USER_AVAILABLE; - case PrivateConversationUserStateService.ChatUserState.PRIVATE_MESSAGES_BLOCKED_BY_OWN_USER: - return CallButtonPresenter.OtherUserCallStatus.OWN_USER_REJECTS_CALLS; - case PrivateConversationUserStateService.ChatUserState.PRIVATE_MESSAGES_BLOCKED: - return CallButtonPresenter.OtherUserCallStatus.USER_REJECTS_CALLS; - case PrivateConversationUserStateService.ChatUserState.BLOCKED_BY_OWN_USER: - case PrivateConversationUserStateService.ChatUserState.DISCONNECTED: - default: return CallButtonPresenter.OtherUserCallStatus.USER_OFFLINE; + case PrivateConversationUserStateService.ChatUserState.Connected: + return CallButtonPresenter.OtherUserCallStatus.UserAvailable; + case PrivateConversationUserStateService.ChatUserState.PrivateMessagesBlockedByOwnUser: + return CallButtonPresenter.OtherUserCallStatus.OwnUserRejectsCalls; + case PrivateConversationUserStateService.ChatUserState.PrivateMessagesBlocked: + return CallButtonPresenter.OtherUserCallStatus.UserRejectsCalls; + case PrivateConversationUserStateService.ChatUserState.BlockedByOwnUser: + case PrivateConversationUserStateService.ChatUserState.Disconnected: + default: return CallButtonPresenter.OtherUserCallStatus.UserOffline; } } } diff --git a/Explorer/Assets/DCL/Chat/_Refactor/ChatCommands/GetUserChatStatusCommand.cs b/Explorer/Assets/DCL/Chat/_Refactor/ChatCommands/GetUserChatStatusCommand.cs index b4389400465..71c43a4ebca 100644 --- a/Explorer/Assets/DCL/Chat/_Refactor/ChatCommands/GetUserChatStatusCommand.cs +++ b/Explorer/Assets/DCL/Chat/_Refactor/ChatCommands/GetUserChatStatusCommand.cs @@ -27,7 +27,7 @@ public GetUserChatStatusCommand(PrivateConversationUserStateService userStateSer if (ct.IsCancellationRequested || !result.Success) { eventBus.RaiseUserStatusUpdatedEvent(new ChatChannel.ChannelId(userId), ChatChannel.ChatChannelType.USER, userId, false); - return new PrivateConversationUserStateService.UserState(false, PrivateConversationUserStateService.ChatUserState.DISCONNECTED); + return new PrivateConversationUserStateService.UserState(false, PrivateConversationUserStateService.ChatUserState.Disconnected); } bool isOnline = result.Value.Result.IsConsideredOnline; diff --git a/Explorer/Assets/DCL/Chat/_Refactor/ChatCommands/ResolveInputStateCommand.cs b/Explorer/Assets/DCL/Chat/_Refactor/ChatCommands/ResolveInputStateCommand.cs index d3ca89f1196..796464a17ca 100644 --- a/Explorer/Assets/DCL/Chat/_Refactor/ChatCommands/ResolveInputStateCommand.cs +++ b/Explorer/Assets/DCL/Chat/_Refactor/ChatCommands/ResolveInputStateCommand.cs @@ -28,7 +28,7 @@ public ResolveInputStateCommand(GetUserChatStatusCommand getUserChatStatusComman { case ChatChannel.ChatChannelType.NEARBY: case ChatChannel.ChatChannelType.COMMUNITY: - return currentChannelService.InputState = Result.SuccessResult(PrivateConversationUserStateService.ChatUserState.CONNECTED); + return currentChannelService.InputState = Result.SuccessResult(PrivateConversationUserStateService.ChatUserState.Connected); case ChatChannel.ChatChannelType.USER: { var status = await getUserChatStatusCommand.ExecuteAsync(currentChannel.Id.Id, ct); diff --git a/Explorer/Assets/DCL/Chat/_Refactor/ChatCommands/SendMessageCommand.cs b/Explorer/Assets/DCL/Chat/_Refactor/ChatCommands/SendMessageCommand.cs index c8ac491fac4..d40c6e64c94 100644 --- a/Explorer/Assets/DCL/Chat/_Refactor/ChatCommands/SendMessageCommand.cs +++ b/Explorer/Assets/DCL/Chat/_Refactor/ChatCommands/SendMessageCommand.cs @@ -37,13 +37,13 @@ public void Execute(SendMessageCommandPayload commandPayload) //TODO: This logic needs to discriminate which notifications to play depending on the type of message (if private or not) //depending on user's settings for notifications. - if (chatSettings.chatAudioSettings == ChatAudioSettings.ALL) + if (chatSettings.chatAudioSettings == ChatAudioSettings.All) UIAudioEventsBus.Instance.SendPlayAudioEvent(sound); chatMessageBus.SendWithUtcNowTimestamp( currentChannelService.CurrentChannel, commandPayload.Body, - ChatMessageOrigin.CHAT); + ChatMessageOrigin.Chat); } } } diff --git a/Explorer/Assets/DCL/Chat/_Refactor/ChatInput/ChatInputPresenter.cs b/Explorer/Assets/DCL/Chat/_Refactor/ChatInput/ChatInputPresenter.cs index 44799a4e707..45d538968be 100644 --- a/Explorer/Assets/DCL/Chat/_Refactor/ChatInput/ChatInputPresenter.cs +++ b/Explorer/Assets/DCL/Chat/_Refactor/ChatInput/ChatInputPresenter.cs @@ -135,7 +135,7 @@ private async UniTaskVoid UpdateStateForChannelAsync() private void OnBlockedUpdated(Result result) { - fsm.CurrentState!.OnBlockedUpdated(result is { Success: true, Value: PrivateConversationUserStateService.ChatUserState.CONNECTED }); + fsm.CurrentState!.OnBlockedUpdated(result is { Success: true, Value: PrivateConversationUserStateService.ChatUserState.Connected }); } public void Dispose() diff --git a/Explorer/Assets/DCL/Chat/_Refactor/ChatInput/States/BlockedChatInputState.cs b/Explorer/Assets/DCL/Chat/_Refactor/ChatInput/States/BlockedChatInputState.cs index 3ce1e97b44a..a3519acaf2c 100644 --- a/Explorer/Assets/DCL/Chat/_Refactor/ChatInput/States/BlockedChatInputState.cs +++ b/Explorer/Assets/DCL/Chat/_Refactor/ChatInput/States/BlockedChatInputState.cs @@ -39,15 +39,15 @@ private void UpdateBlockedReason() if (currentChannelService.InputState.Success) { - Assert.IsTrue(currentChannelService.InputState.Value != PrivateConversationUserStateService.ChatUserState.CONNECTED); + Assert.IsTrue(currentChannelService.InputState.Value != PrivateConversationUserStateService.ChatUserState.Connected); blockedReason = currentChannelService.InputState.Value switch { - PrivateConversationUserStateService.ChatUserState.BLOCKED_BY_OWN_USER => config.BlockedByOwnUserMessage, - PrivateConversationUserStateService.ChatUserState.DISCONNECTED => config.UserOfflineMessage, - PrivateConversationUserStateService.ChatUserState.PRIVATE_MESSAGES_BLOCKED_BY_OWN_USER => config.OnlyFriendsOwnUserMessage, - PrivateConversationUserStateService.ChatUserState.PRIVATE_MESSAGES_BLOCKED => config.OnlyFriendsMessage, - PrivateConversationUserStateService.ChatUserState.OTHER_CLIENT => config.ConnectedFromAnotherClientMessage, + PrivateConversationUserStateService.ChatUserState.BlockedByOwnUser => config.BlockedByOwnUserMessage, + PrivateConversationUserStateService.ChatUserState.Disconnected => config.UserOfflineMessage, + PrivateConversationUserStateService.ChatUserState.PrivateMessagesBlockedByOwnUser => config.OnlyFriendsOwnUserMessage, + PrivateConversationUserStateService.ChatUserState.PrivateMessagesBlocked => config.OnlyFriendsMessage, + PrivateConversationUserStateService.ChatUserState.OtherClient => config.ConnectedFromAnotherClientMessage, _ => string.Empty }; } @@ -55,7 +55,7 @@ private void UpdateBlockedReason() blockedReason = currentChannelService.InputState.ErrorMessage!; view.maskButton.onClick.RemoveListener(BlockedInputClicked); - if (currentChannelService.InputState is { Success: true, Value: PrivateConversationUserStateService.ChatUserState.PRIVATE_MESSAGES_BLOCKED_BY_OWN_USER }) + if (currentChannelService.InputState is { Success: true, Value: PrivateConversationUserStateService.ChatUserState.PrivateMessagesBlockedByOwnUser }) view.maskButton.onClick.AddListener(BlockedInputClicked); view.SetBlocked(blockedReason); diff --git a/Explorer/Assets/DCL/Chat/_Refactor/ChatInput/States/SuggestionPanelChatInputState.cs b/Explorer/Assets/DCL/Chat/_Refactor/ChatInput/States/SuggestionPanelChatInputState.cs index 1637693573e..ed29278b676 100644 --- a/Explorer/Assets/DCL/Chat/_Refactor/ChatInput/States/SuggestionPanelChatInputState.cs +++ b/Explorer/Assets/DCL/Chat/_Refactor/ChatInput/States/SuggestionPanelChatInputState.cs @@ -75,14 +75,14 @@ internal async UniTask TryFindMatchAsync(string inputText, CancellationTok if (wordMatch.Success) { wordMatchIndex = wordMatch.Index; - lastMatch = await suggestionPanelController.HandleSuggestionsSearchAsync(wordMatch.Value, EMOJI_PATTERN_REGEX, InputSuggestionType.EMOJIS, emojiSuggestionsDictionary, ct); + lastMatch = await suggestionPanelController.HandleSuggestionsSearchAsync(wordMatch.Value, EMOJI_PATTERN_REGEX, InputSuggestionType.Emojis, emojiSuggestionsDictionary, ct); if (lastMatch.Success) return true; //If we don't find any emoji pattern only then we look for username patterns UpdateProfileNameMap(); - lastMatch = await suggestionPanelController.HandleSuggestionsSearchAsync(wordMatch.Value, PROFILE_PATTERN_REGEX, InputSuggestionType.PROFILE, profileSuggestionsDictionary, ct); + lastMatch = await suggestionPanelController.HandleSuggestionsSearchAsync(wordMatch.Value, PROFILE_PATTERN_REGEX, InputSuggestionType.Profile, profileSuggestionsDictionary, ct); if (lastMatch.Success) return true; } diff --git a/Explorer/Assets/DCL/Chat/_Refactor/ChatMessages/ChatMessageFeedPresenter.cs b/Explorer/Assets/DCL/Chat/_Refactor/ChatMessages/ChatMessageFeedPresenter.cs index 132353a4cb0..e2618077e9b 100644 --- a/Explorer/Assets/DCL/Chat/_Refactor/ChatMessages/ChatMessageFeedPresenter.cs +++ b/Explorer/Assets/DCL/Chat/_Refactor/ChatMessages/ChatMessageFeedPresenter.cs @@ -324,7 +324,7 @@ private void OnProfileContextMenuRequested(string userId, Vector2 position) { var request = new UserProfileMenuRequest { - WalletAddress = new Web3Address(userId), Position = position, AnchorPoint = MenuAnchorPoint.TOP_RIGHT, Offset = Vector2.zero, + WalletAddress = new Web3Address(userId), Position = position, AnchorPoint = MenuAnchorPoint.TopRight, Offset = Vector2.zero, }; contextMenuService.ShowUserProfileMenuAsync(request).Forget(); @@ -340,7 +340,7 @@ private void OnChatContextMenuRequested(string messageId, ChatEntryView? chatEnt chatConfig.ContextMenuOffset, chatConfig.VerticalPadding, chatConfig.ElementsSpacing, - anchorPoint: ContextMenuOpenDirection.TOP_LEFT); + anchorPoint: ContextMenuOpenDirection.TopLeft); string textToCopy = viewModel.IsTranslated ? viewModel.TranslatedText : viewModel.Message.Message; contextMenu.AddControl(new ButtonContextMenuControlSettings( diff --git a/Explorer/Assets/DCL/Chat/_Refactor/ChatPanelPresenter.cs b/Explorer/Assets/DCL/Chat/_Refactor/ChatPanelPresenter.cs index 54a3bf87695..9f65ba94597 100644 --- a/Explorer/Assets/DCL/Chat/_Refactor/ChatPanelPresenter.cs +++ b/Explorer/Assets/DCL/Chat/_Refactor/ChatPanelPresenter.cs @@ -323,7 +323,7 @@ private void OnMVCViewOpened(ChatSharedAreaEvents.MVCViewOpenEvent evt) //We only need to hide the chat if a fullscreen view is shown switch (evt.ViewSortingLayer) { - case CanvasOrdering.SortingLayer.FULLSCREEN: + case CanvasOrdering.SortingLayer.Fullscreen: chatStateMachine.SetVisibility(false); break; } @@ -331,7 +331,7 @@ private void OnMVCViewOpened(ChatSharedAreaEvents.MVCViewOpenEvent evt) private void OnMVCViewClosed(ChatSharedAreaEvents.MVCViewClosedEvent evt) { - if (evt.ViewSortingLayer is not CanvasOrdering.SortingLayer.FULLSCREEN) return; + if (evt.ViewSortingLayer is not CanvasOrdering.SortingLayer.Fullscreen) return; if (!chatStateMachine.IsFocused) chatStateMachine.PopState(); diff --git a/Explorer/Assets/DCL/Chat/_Refactor/ChatReactions/Core/ChatReactionsFactory.cs b/Explorer/Assets/DCL/Chat/_Refactor/ChatReactions/Core/ChatReactionsFactory.cs index 18ee839c283..783aa2b1faf 100644 --- a/Explorer/Assets/DCL/Chat/_Refactor/ChatReactions/Core/ChatReactionsFactory.cs +++ b/Explorer/Assets/DCL/Chat/_Refactor/ChatReactions/Core/ChatReactionsFactory.cs @@ -93,10 +93,10 @@ public static Result Create( remoteTarget, worldReactor, situationalReactionFacade, streamEmitter); - simulationLoop.WorldReactionsEnabled = chatSettingsAsset.chatBubblesVisibilitySettings != ChatBubbleVisibilitySettings.NONE; + simulationLoop.WorldReactionsEnabled = chatSettingsAsset.chatBubblesVisibilitySettings != ChatBubbleVisibilitySettings.None; simulationLoop.UIReactionsEnabled = chatSettingsAsset.chatReactionsEnabled; - ChatSettingsAsset.ChatBubblesVisibilityDelegate bubblesHandler = visibility => simulationLoop.WorldReactionsEnabled = visibility != ChatBubbleVisibilitySettings.NONE; + ChatSettingsAsset.ChatBubblesVisibilityDelegate bubblesHandler = visibility => simulationLoop.WorldReactionsEnabled = visibility != ChatBubbleVisibilitySettings.None; chatSettingsAsset.BubblesVisibilityChanged += bubblesHandler; ChatSettingsAsset.ChatReactionsEnabledDelegate reactionsHandler = enabled => simulationLoop.UIReactionsEnabled = enabled; diff --git a/Explorer/Assets/DCL/Chat/_Refactor/ChatReactions/Presenters/EmojiPanelReactionBridge.cs b/Explorer/Assets/DCL/Chat/_Refactor/ChatReactions/Presenters/EmojiPanelReactionBridge.cs index e2af737ca51..721d1ec120a 100644 --- a/Explorer/Assets/DCL/Chat/_Refactor/ChatReactions/Presenters/EmojiPanelReactionBridge.cs +++ b/Explorer/Assets/DCL/Chat/_Refactor/ChatReactions/Presenters/EmojiPanelReactionBridge.cs @@ -71,7 +71,7 @@ public void Hide() if (playerMovementBlocked) { - inputBlock.Enable(InputMapComponent.Kind.PLAYER); + inputBlock.Enable(InputMapComponent.Kind.Player); playerMovementBlocked = false; } } @@ -107,7 +107,7 @@ private void Open() if (!playerMovementBlocked) { - inputBlock.Disable(InputMapComponent.Kind.PLAYER); + inputBlock.Disable(InputMapComponent.Kind.Player); playerMovementBlocked = true; } } diff --git a/Explorer/Assets/DCL/Chat/_Refactor/ChatServices/ChatHistoryService.cs b/Explorer/Assets/DCL/Chat/_Refactor/ChatServices/ChatHistoryService.cs index 1464a97a035..27c0d82df1e 100644 --- a/Explorer/Assets/DCL/Chat/_Refactor/ChatServices/ChatHistoryService.cs +++ b/Explorer/Assets/DCL/Chat/_Refactor/ChatServices/ChatHistoryService.cs @@ -81,10 +81,10 @@ private void HandleMessageAudioFeedback(ChatMessage message, ChatChannel.Channel switch (settings) { - case ChatAudioSettings.NONE: + case ChatAudioSettings.None: return; - case ChatAudioSettings.MENTIONS_ONLY when message.IsMention: - case ChatAudioSettings.ALL: + case ChatAudioSettings.MentionsOnly when message.IsMention: + case ChatAudioSettings.All: PlayMessageAudio(message, channelId); break; } diff --git a/Explorer/Assets/DCL/Chat/_Refactor/ChatServices/ChatWorldBubbleService.cs b/Explorer/Assets/DCL/Chat/_Refactor/ChatServices/ChatWorldBubbleService.cs index a16b61eb980..5c3fdaf58d0 100644 --- a/Explorer/Assets/DCL/Chat/_Refactor/ChatServices/ChatWorldBubbleService.cs +++ b/Explorer/Assets/DCL/Chat/_Refactor/ChatServices/ChatWorldBubbleService.cs @@ -67,8 +67,8 @@ private void OnChatMessageAdded(ChatChannel destinationChannel, ChatMessage adde public void CreateChatBubble(ChatChannel channel, ChatMessage chatMessage, bool isSentByOwnUser, string? communityName = null) { if (!nametagsData.showNameTags - || chatSettings.chatBubblesVisibilitySettings == ChatBubbleVisibilitySettings.NONE - || (channel.ChannelType != ChatChannel.ChatChannelType.NEARBY && chatSettings.chatBubblesVisibilitySettings == ChatBubbleVisibilitySettings.NEARBY_ONLY)) + || chatSettings.chatBubblesVisibilitySettings == ChatBubbleVisibilitySettings.None + || (channel.ChannelType != ChatChannel.ChatChannelType.NEARBY && chatSettings.chatBubblesVisibilitySettings == ChatBubbleVisibilitySettings.NearbyOnly)) return; if (chatMessage.IsSentByOwnUser == false && entityParticipantTable.TryGet(chatMessage.SenderWalletAddress, out var entry)) @@ -98,7 +98,7 @@ public void CreateChatBubble(ChatChannel channel, ChatMessage chatMessage, bool break; case ChatChannel.ChatChannelType.USER: // Chat bubbles appear if the channel is nearby or if settings allow them to appear for private conversations - if (chatSettings.chatBubblesVisibilitySettings == ChatBubbleVisibilitySettings.ALL) + if (chatSettings.chatBubblesVisibilitySettings == ChatBubbleVisibilitySettings.All) { if (!profileCache.TryGet(channel.Id.Id, out var profile)) { diff --git a/Explorer/Assets/DCL/Chat/_Refactor/ChatServices/UserStateService/PrivateConversationUserStateService.cs b/Explorer/Assets/DCL/Chat/_Refactor/ChatServices/UserStateService/PrivateConversationUserStateService.cs index fe02c4ad5a5..5506f08a1ca 100644 --- a/Explorer/Assets/DCL/Chat/_Refactor/ChatServices/UserStateService/PrivateConversationUserStateService.cs +++ b/Explorer/Assets/DCL/Chat/_Refactor/ChatServices/UserStateService/PrivateConversationUserStateService.cs @@ -31,12 +31,12 @@ public class PrivateConversationUserStateService : IDisposable, ICurrentChannelU { public enum ChatUserState { - CONNECTED, //Online friends and other users that are not blocked if both users have ALL set in privacy setting. - BLOCKED_BY_OWN_USER, //Own user blocked the other user - PRIVATE_MESSAGES_BLOCKED_BY_OWN_USER, //Own user has privacy settings set to ONLY FRIENDS - PRIVATE_MESSAGES_BLOCKED, //The other user has its privacy settings set to ONLY FRIENDS - DISCONNECTED, //The other user is either offline or has blocked the own user. - OTHER_CLIENT, //The other user is connected with a client that doesn't support DMs + Connected, //Online friends and other users that are not blocked if both users have ALL set in privacy setting. + BlockedByOwnUser, //Own user blocked the other user + PrivateMessagesBlockedByOwnUser, //Own user has privacy settings set to ONLY FRIENDS + PrivateMessagesBlocked, //The other user has its privacy settings set to ONLY FRIENDS + Disconnected, //The other user is either offline or has blocked the own user. + OtherClient, //The other user is connected with a client that doesn't support DMs } public readonly struct UserState @@ -163,7 +163,7 @@ private void UnsubscribeFromEvents() private void OnPrivacySettingsSet(ChatPrivacySettings privacySettings) { - rpcChatPrivacyService.UpsertSocialSettingsAsync(privacySettings == ChatPrivacySettings.ALL, cts.Token).Forget(); + rpcChatPrivacyService.UpsertSocialSettingsAsync(privacySettings == ChatPrivacySettings.All, cts.Token).Forget(); // Simply notify that the ChatUserState should be updated // It will be retrieved via "GetChatUserStateAsync" @@ -179,29 +179,29 @@ public async UniTask GetChatUserStateAsync(string userId, Cancellatio bool isUserConnected = UserIsConsideredAsOnline(userId); //If it's a friend we just return its connection status - if (friendshipStatus == FriendshipStatus.FRIEND) - return new UserState(isUserConnected, isUserConnected ? ChatUserState.CONNECTED : ChatUserState.DISCONNECTED); + if (friendshipStatus == FriendshipStatus.Friend) + return new UserState(isUserConnected, isUserConnected ? ChatUserState.Connected : ChatUserState.Disconnected); //If the user is blocked by us, we show that first - if (friendshipStatus == FriendshipStatus.BLOCKED) - return new UserState(isUserConnected, ChatUserState.BLOCKED_BY_OWN_USER); + if (friendshipStatus == FriendshipStatus.Blocked) + return new UserState(isUserConnected, ChatUserState.BlockedByOwnUser); // If we are being blocked by them, show them as offline - if (friendshipStatus == FriendshipStatus.BLOCKED_BY) - return new UserState(false, ChatUserState.DISCONNECTED); + if (friendshipStatus == FriendshipStatus.BlockedBy) + return new UserState(false, ChatUserState.Disconnected); // This is done because other clients don't connect to chat livekit room, so they are not found in the participant list. // If we are able to find them through either island or scene room, it means we cannot chat with them if (!isUserConnected && (roomHub.TryGetUser(userId, out _, out _) || roomHub.TryGetUser(lowerUserId, out _, out _))) - return new UserState(isUserConnected, ChatUserState.OTHER_CLIENT); + return new UserState(isUserConnected, ChatUserState.OtherClient); // If the user is not reachable by any means, they are simply offline if (!isUserConnected) - return new UserState(false, ChatUserState.DISCONNECTED); + return new UserState(false, ChatUserState.Disconnected); //If the user is connected we need to check our settings and then theirs. - if (settingsAsset.chatPrivacySettings == ChatPrivacySettings.ONLY_FRIENDS) - return new UserState(isUserConnected, ChatUserState.PRIVATE_MESSAGES_BLOCKED_BY_OWN_USER); + if (settingsAsset.chatPrivacySettings == ChatPrivacySettings.OnlyFriends) + return new UserState(isUserConnected, ChatUserState.PrivateMessagesBlockedByOwnUser); // User should be online, but check if they disconnected while processing this data + ensure we have metadata LKParticipant? participant = chatRoom.Participants.RemoteParticipant(userId) @@ -213,10 +213,10 @@ public async UniTask GetChatUserStateAsync(string userId, Cancellatio ParticipantPrivacyMetadata userMetadata = JsonUtility.FromJson(participant.Metadata); if (userMetadata.private_messages_privacy != PRIVACY_SETTING_ALL) - return new UserState(isUserConnected, ChatUserState.PRIVATE_MESSAGES_BLOCKED); + return new UserState(isUserConnected, ChatUserState.PrivateMessagesBlocked); } - return new UserState(isUserConnected, isUserConnected ? ChatUserState.CONNECTED : ChatUserState.DISCONNECTED); + return new UserState(isUserConnected, isUserConnected ? ChatUserState.Connected : ChatUserState.Disconnected); } private void OnRoomConnectionStateChanged(IRoom room, ConnectionUpdate connectionUpdate, LKDisconnectReason? disconnectReason) diff --git a/Explorer/Assets/DCL/Chat/_Refactor/ChatTitleBar/ChatTitlebarPresenter.cs b/Explorer/Assets/DCL/Chat/_Refactor/ChatTitleBar/ChatTitlebarPresenter.cs index 25c98ccb5b6..0b3bcf06464 100644 --- a/Explorer/Assets/DCL/Chat/_Refactor/ChatTitleBar/ChatTitlebarPresenter.cs +++ b/Explorer/Assets/DCL/Chat/_Refactor/ChatTitleBar/ChatTitlebarPresenter.cs @@ -111,7 +111,7 @@ public ChatTitlebarPresenter( contextMenuSettings.Offset, contextMenuSettings.VerticalLayoutPadding, contextMenuSettings.ElementsSpacing, - ContextMenuOpenDirection.TOP_LEFT) + ContextMenuOpenDirection.TopLeft) .AddControl(new ButtonContextMenuControlSettings(contextMenuSettings.ViewCommunityText, contextMenuSettings.ViewCommunitySprite, OpenCommunityCard)); @@ -455,23 +455,23 @@ private void InitializeChannelContextMenu() verticalLayoutPadding: chatConfig.chatContextMenuSettings.VerticalPadding, elementsSpacing: chatConfig.chatContextMenuSettings.ElementsSpacing, offsetFromTarget: chatConfig.chatContextMenuSettings.NotificationPingSubMenuOffsetFromTarget, - anchorPoint: ContextMenuOpenDirection.TOP_LEFT) - .AddControl(notificationPingToggles[(int)ChatAudioSettings.ALL] = + anchorPoint: ContextMenuOpenDirection.TopLeft) + .AddControl(notificationPingToggles[(int)ChatAudioSettings.All] = new ToggleWithCheckContextMenuControlSettings("All Messages", - x => OnNotificationPingOptionSelected(ChatAudioSettings.ALL), toggleGroup)) - .AddControl(notificationPingToggles[(int)ChatAudioSettings.MENTIONS_ONLY] = + x => OnNotificationPingOptionSelected(ChatAudioSettings.All), toggleGroup)) + .AddControl(notificationPingToggles[(int)ChatAudioSettings.MentionsOnly] = new ToggleWithCheckContextMenuControlSettings("Mentions Only", - x => OnNotificationPingOptionSelected(ChatAudioSettings.MENTIONS_ONLY), toggleGroup)) - .AddControl(notificationPingToggles[(int)ChatAudioSettings.NONE] = + x => OnNotificationPingOptionSelected(ChatAudioSettings.MentionsOnly), toggleGroup)) + .AddControl(notificationPingToggles[(int)ChatAudioSettings.None] = new ToggleWithCheckContextMenuControlSettings("None", - x => OnNotificationPingOptionSelected(ChatAudioSettings.NONE), toggleGroup))); + x => OnNotificationPingOptionSelected(ChatAudioSettings.None), toggleGroup))); contextMenuInstance = new GenericContextMenu( chatConfig.chatContextMenuSettings.ContextMenuWidth, chatConfig.chatContextMenuSettings.OffsetFromTarget, chatConfig.chatContextMenuSettings.VerticalPadding, chatConfig.chatContextMenuSettings.ElementsSpacing, - anchorPoint: ContextMenuOpenDirection.TOP_LEFT) + anchorPoint: ContextMenuOpenDirection.TopLeft) .AddControl(subMenuSettings); diff --git a/Explorer/Assets/DCL/Chat/_Refactor/ChatViews/ChannelMemberFeedView.cs b/Explorer/Assets/DCL/Chat/_Refactor/ChatViews/ChannelMemberFeedView.cs index 6078caf89dc..ee737013a2b 100644 --- a/Explorer/Assets/DCL/Chat/_Refactor/ChatViews/ChannelMemberFeedView.cs +++ b/Explorer/Assets/DCL/Chat/_Refactor/ChatViews/ChannelMemberFeedView.cs @@ -79,7 +79,7 @@ private void HandleItemContextMenuRequest(MemberEntryContextMenuRequest request) { var data = new UserProfileMenuRequest { - WalletAddress = new Web3Address(request.UserId), Position = request.Position, AnchorPoint = MenuAnchorPoint.TOP_RIGHT, Offset = Vector2.zero, + WalletAddress = new Web3Address(request.UserId), Position = request.Position, AnchorPoint = MenuAnchorPoint.TopRight, Offset = Vector2.zero, OnHide = request.OnHide }; diff --git a/Explorer/Assets/DCL/Chat/_Refactor/ChatViews/ChatDefaultTitlebarView.cs b/Explorer/Assets/DCL/Chat/_Refactor/ChatViews/ChatDefaultTitlebarView.cs index c4c789d8d65..e9e884a59c4 100644 --- a/Explorer/Assets/DCL/Chat/_Refactor/ChatViews/ChatDefaultTitlebarView.cs +++ b/Explorer/Assets/DCL/Chat/_Refactor/ChatViews/ChatDefaultTitlebarView.cs @@ -90,8 +90,8 @@ public void Setup(ChatTitlebarViewModel model) buttonOpenMembers.gameObject.SetActive(shouldShowMembersButton); bool isUnresolvedPlaceholder = string.IsNullOrEmpty(model.Id) - && model.Thumbnail.Value.ThumbnailState is ProfileThumbnailViewModel.State.LOADING - or ProfileThumbnailViewModel.State.NOT_BOUND; + && model.Thumbnail.Value.ThumbnailState is ProfileThumbnailViewModel.State.Loading + or ProfileThumbnailViewModel.State.NotBound; if (isUnresolvedPlaceholder) { diff --git a/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunitiesBrowserController.cs b/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunitiesBrowserController.cs index 0829c36ca68..8191e618f76 100644 --- a/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunitiesBrowserController.cs +++ b/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunitiesBrowserController.cs @@ -84,8 +84,8 @@ public class CommunitiesBrowserController : ISection, IDisposable private bool isSectionActivated; private string currentSearchText = string.Empty; - private CommunitiesRightSideSections currentSection = CommunitiesRightSideSections.MAIN_SECTION; - private bool isInvitesAndRequestsSectionActive => currentSection == CommunitiesRightSideSections.INVITES_AND_REQUESTS_SECTION; + private CommunitiesRightSideSections currentSection = CommunitiesRightSideSections.MainSection; + private bool isInvitesAndRequestsSectionActive => currentSection == CommunitiesRightSideSections.InvitesAndRequestsSection; public CommunitiesBrowserController( CommunitiesBrowserView view, @@ -263,7 +263,7 @@ public RectTransform GetRectTransform() => private void ViewAllMyCommunitiesResults() { ClearSearchBar(); - SetActiveSection(CommunitiesRightSideSections.MAIN_SECTION); + SetActiveSection(CommunitiesRightSideSections.MainSection); mainRightSectionPresenter.ViewAllMyCommunitiesResults(); } @@ -281,7 +281,7 @@ private void LoadMyCommunities() private void LoadJoinRequestsAndAllCommunities() { - SetActiveSection(CommunitiesRightSideSections.MAIN_SECTION); + SetActiveSection(CommunitiesRightSideSections.MainSection); loadResultsCts = loadResultsCts.SafeRestart(); mainRightSectionPresenter.SetAsLoading(); @@ -298,7 +298,7 @@ async UniTaskVoid LoadJoinRequestsAndAllCommunitiesAsync(CancellationToken ct) private void LoadInvitesAndRequestsResults() { ClearSearchBar(); - SetActiveSection(CommunitiesRightSideSections.INVITES_AND_REQUESTS_SECTION); + SetActiveSection(CommunitiesRightSideSections.InvitesAndRequestsSection); loadResultsCts = loadResultsCts.SafeRestart(); LoadInvitesAndRequestsAsync(loadResultsCts.Token).Forget(); return; @@ -466,10 +466,10 @@ async UniTaskVoid RefreshInvitesCounterAsync(CancellationToken ct) } private void DisableShortcutsInput(string text) => - inputBlock.Disable(InputMapComponent.Kind.SHORTCUTS, InputMapComponent.Kind.IN_WORLD_CAMERA); + inputBlock.Disable(InputMapComponent.Kind.Shortcuts, InputMapComponent.Kind.InWorldCamera); private void RestoreInput(string text) => - inputBlock.Enable(InputMapComponent.Kind.SHORTCUTS, InputMapComponent.Kind.IN_WORLD_CAMERA); + inputBlock.Enable(InputMapComponent.Kind.Shortcuts, InputMapComponent.Kind.InWorldCamera); private void SearchBarValueChanged(string searchText) { @@ -492,7 +492,7 @@ private async UniTaskVoid AwaitAndSendSearchAsync(string searchText, Cancellatio if (currentSearchText == searchText) return; - SetActiveSection(CommunitiesRightSideSections.MAIN_SECTION); + SetActiveSection(CommunitiesRightSideSections.MainSection); if (string.IsNullOrEmpty(searchText)) mainRightSectionPresenter.LoadAllCommunities(); @@ -508,12 +508,12 @@ private void SetActiveSection(CommunitiesRightSideSections activeSection) switch (activeSection) { - case CommunitiesRightSideSections.MAIN_SECTION: + case CommunitiesRightSideSections.MainSection: view.SetResultsSectionActive(true); view.InvitesAndRequestsView.SetSectionActive(false); manageRequestReceivedCts?.SafeCancelAndDispose(); break; - case CommunitiesRightSideSections.INVITES_AND_REQUESTS_SECTION: + case CommunitiesRightSideSections.InvitesAndRequestsSection: view.SetResultsSectionActive(false); view.InvitesAndRequestsView.SetSectionActive(true); break; @@ -898,7 +898,7 @@ private async void OnBlockUserAsync(ICommunityMemberData profile) try { await mvcManager.ShowAsync(BlockUserPromptController.IssueCommand( - new BlockUserPromptParams(new Web3Address(profile.Address), profile.Name, BlockUserPromptParams.UserBlockAction.BLOCK)), CancellationToken.None); + new BlockUserPromptParams(new Web3Address(profile.Address), profile.Name, BlockUserPromptParams.UserBlockAction.Block)), CancellationToken.None); } catch (OperationCanceledException) { } catch (Exception ex) @@ -954,13 +954,13 @@ private async UniTaskVoid CheckCommunityAppArgAsync(CancellationToken ct = defau public enum CommunitiesRightSideSections { - MAIN_SECTION, - INVITES_AND_REQUESTS_SECTION, + MainSection, + InvitesAndRequestsSection, } public enum CommunitiesViews { - BROWSE_ALL_COMMUNITIES, - FILTERED_COMMUNITIES, + BrowseAllCommunities, + FilteredCommunities, } } diff --git a/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunitiesBrowserFilteredCommunitiesPresenter.cs b/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunitiesBrowserFilteredCommunitiesPresenter.cs index 9d5c81c4b31..6f995b9a9c4 100644 --- a/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunitiesBrowserFilteredCommunitiesPresenter.cs +++ b/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunitiesBrowserFilteredCommunitiesPresenter.cs @@ -119,7 +119,7 @@ private void OnBackButtonClicked() public void LoadAllMyCommunities() { view.SetResultsTitleText(MY_COMMUNITIES_RESULTS_TITLE); - view.SetActiveViewSection(FilteredCommunitiesView.ActiveViewSection.MY_COMMUNITIES); + view.SetActiveViewSection(FilteredCommunitiesView.ActiveViewSection.MyCommunities); loadResultsCts = loadResultsCts.SafeRestart(); @@ -135,7 +135,7 @@ public void LoadAllMyCommunities() public void LoadAllStreamingCommunities() { view.SetResultsTitleText(STREAMING_COMMUNITIES_RESULTS_TITLE); - view.SetActiveViewSection(FilteredCommunitiesView.ActiveViewSection.STREAMING); + view.SetActiveViewSection(FilteredCommunitiesView.ActiveViewSection.Streaming); loadResultsCts = loadResultsCts.SafeRestart(); @@ -152,7 +152,7 @@ public void LoadAllStreamingCommunities() public async UniTask LoadAllCommunitiesAsync(CancellationToken ct) { view.SetResultsTitleText(BROWSE_COMMUNITIES_TITLE); - view.SetActiveViewSection(FilteredCommunitiesView.ActiveViewSection.ALL_COMMUNITIES); + view.SetActiveViewSection(FilteredCommunitiesView.ActiveViewSection.AllCommunities); loadResultsCts = loadResultsCts.SafeRestartLinked(ct); await LoadResultsAsync( @@ -256,7 +256,7 @@ private async UniTask LoadResultsAsync( public void LoadSearchResults(string searchText) { - view.SetActiveViewSection(FilteredCommunitiesView.ActiveViewSection.SEARCH_COMMUNITIES); + view.SetActiveViewSection(FilteredCommunitiesView.ActiveViewSection.SearchCommunities); view.SetResultsBackButtonVisible(true); view.SetResultsTitleText(string.Format(SEARCH_RESULTS_TITLE_FORMAT, searchText)); diff --git a/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunitiesBrowserMainRightSectionPresenter.cs b/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunitiesBrowserMainRightSectionPresenter.cs index d746c401c61..e30888d8823 100644 --- a/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunitiesBrowserMainRightSectionPresenter.cs +++ b/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunitiesBrowserMainRightSectionPresenter.cs @@ -53,7 +53,7 @@ public void Dispose() private void OnViewAllStreamingCommunities() { browserEventBus.RaiseClearSearchBarEvent(); - view.SetActiveView(CommunitiesViews.FILTERED_COMMUNITIES); + view.SetActiveView(CommunitiesViews.FilteredCommunities); filteredCommunitiesPresenter.LoadAllStreamingCommunities(); } @@ -64,7 +64,7 @@ private void TryLoadMoreResults() public void LoadSearchResults(string searchText) { - view.SetActiveView(CommunitiesViews.FILTERED_COMMUNITIES); + view.SetActiveView(CommunitiesViews.FilteredCommunities); filteredCommunitiesPresenter.LoadSearchResults(searchText); } @@ -78,7 +78,7 @@ public void Deactivate() public void LoadAllCommunities() { browserEventBus.RaiseClearSearchBarEvent(); - view.SetActiveView(CommunitiesViews.BROWSE_ALL_COMMUNITIES); + view.SetActiveView(CommunitiesViews.BrowseAllCommunities); LoadAllCommunitiesAsync().Forget(); } @@ -86,7 +86,7 @@ public void LoadAllCommunities() public void SetAsLoading() { browserEventBus.RaiseClearSearchBarEvent(); - view.SetActiveView(CommunitiesViews.BROWSE_ALL_COMMUNITIES); + view.SetActiveView(CommunitiesViews.BrowseAllCommunities); loadCts = loadCts.SafeRestart(); streamingCommunitiesPresenter.SetAsLoading(true); filteredCommunitiesPresenter.SetAsLoading(true); @@ -109,7 +109,7 @@ await UniTask.WhenAll( public void ViewAllMyCommunitiesResults() { - view.SetActiveView(CommunitiesViews.FILTERED_COMMUNITIES); + view.SetActiveView(CommunitiesViews.FilteredCommunities); filteredCommunitiesPresenter.LoadAllMyCommunities(); } } diff --git a/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunitiesBrowserRightSectionMainView.cs b/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunitiesBrowserRightSectionMainView.cs index c1737956754..64c7b7f9533 100644 --- a/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunitiesBrowserRightSectionMainView.cs +++ b/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunitiesBrowserRightSectionMainView.cs @@ -39,11 +39,11 @@ public void SetActiveView(CommunitiesViews activeView) { switch (activeView) { - case CommunitiesViews.FILTERED_COMMUNITIES: + case CommunitiesViews.FilteredCommunities: streamingCommunitiesView.HideStreamingSection(); filteredCommunitiesView.SetResultsBackButtonVisible(true); break; - case CommunitiesViews.BROWSE_ALL_COMMUNITIES: + case CommunitiesViews.BrowseAllCommunities: filteredCommunitiesView.SetResultsBackButtonVisible(false); break; } diff --git a/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunitiesBrowserStreamingCommunitiesPresenter.cs b/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunitiesBrowserStreamingCommunitiesPresenter.cs index daef0148517..6067d65f42f 100644 --- a/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunitiesBrowserStreamingCommunitiesPresenter.cs +++ b/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunitiesBrowserStreamingCommunitiesPresenter.cs @@ -36,7 +36,7 @@ public CommunitiesBrowserStreamingCommunitiesPresenter( this.browserStateService = browserStateService; this.commandsLibrary = commandsLibrary; - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.COMMUNITY_VOICE_CHAT)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.CommunityVoiceChat)) { view.InitializeStreamingResultsGrid(0); @@ -48,7 +48,7 @@ public CommunitiesBrowserStreamingCommunitiesPresenter( public void Dispose() { - if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.COMMUNITY_VOICE_CHAT)) + if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.CommunityVoiceChat)) return; view.JoinStream -= JoinStreamClicked; @@ -72,7 +72,7 @@ public async UniTask LoadStreamingCommunitiesAsync(CancellationToken ct) { view.HideStreamingSection(); - if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.COMMUNITY_VOICE_CHAT)) + if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.CommunityVoiceChat)) return; view.HideStreamingSection(); @@ -107,7 +107,7 @@ public async UniTask LoadStreamingCommunitiesAsync(CancellationToken ct) public void SetAsLoading(bool isLoading) { - if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.COMMUNITY_VOICE_CHAT)) + if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.CommunityVoiceChat)) return; view.SetAsLoading(isLoading); diff --git a/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunityRequestsReceivedGroupView.cs b/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunityRequestsReceivedGroupView.cs index 1b9cb1c0d3e..52d4dbe8831 100644 --- a/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunityRequestsReceivedGroupView.cs +++ b/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunityRequestsReceivedGroupView.cs @@ -74,7 +74,7 @@ private void Awake() .AddControl(new SeparatorContextMenuControlSettings(contextMenuSettings.SeparatorHeight, -contextMenuSettings.VerticalPadding.left, -contextMenuSettings.VerticalPadding.right)) .AddControl(blockUserContextMenuElement = new GenericContextMenuElement(new ButtonContextMenuControlSettings(contextMenuSettings.BlockText, contextMenuSettings.BlockSprite, () => BlockUserRequested?.Invoke(lastClickedProfileCtx), iconColor: redColor, textColor: redColor))); - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.REPORT_USER)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.ReportUser)) contextMenu.AddControl(new ButtonContextMenuControlSettings(contextMenuSettings.ReportText, contextMenuSettings.ReportOptionSprite, () => ReportUserRequested?.Invoke(lastClickedProfileCtx), iconColor: redColor, textColor: redColor)); } @@ -133,7 +133,7 @@ private void CreateAndSetupRequestReceivedMembers(ICommunityMemberData memberPro MemberListItemView requestReceivedMemberView = requestsReceivedMembersPool!.Get(); // Setup card data - requestReceivedMemberView.Configure(memberProfile, MembersListView.MemberListSections.REQUESTS, false, profileRepositoryWrapper!); + requestReceivedMemberView.Configure(memberProfile, MembersListView.MemberListSections.Requests, false, profileRepositoryWrapper!); // Setup card events requestReceivedMemberView.SubscribeToInteractions(member => OpenProfilePassportRequested?.Invoke(member), @@ -150,7 +150,7 @@ private void OnContextMenuButtonClicked(ICommunityMemberData profile, Vector2 bu lastClickedProfileCtx = profile; contextMenuCts = contextMenuCts.SafeRestart(); UserProfileContextMenuControlSettings.FriendshipStatus status = profile.FriendshipStatus.Convert(); - userProfileContextMenuControlSettings!.SetInitialData(profile.Profile, status == UserProfileContextMenuControlSettings.FriendshipStatus.FRIEND ? status : UserProfileContextMenuControlSettings.FriendshipStatus.DISABLED); + userProfileContextMenuControlSettings!.SetInitialData(profile.Profile, status == UserProfileContextMenuControlSettings.FriendshipStatus.Friend ? status : UserProfileContextMenuControlSettings.FriendshipStatus.Disabled); elementView.CanUnHover = false; blockUserContextMenuElement!.Enabled = profile.FriendshipStatus != FriendshipStatus.blocked && profile.FriendshipStatus != FriendshipStatus.blocked_by; diff --git a/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunityResultCardView.cs b/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunityResultCardView.cs index 4e83bf920bd..e230f4eafd7 100644 --- a/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunityResultCardView.cs +++ b/Explorer/Assets/DCL/Communities/CommunitiesBrowser/CommunityResultCardView.cs @@ -112,7 +112,7 @@ async UniTask ShowDeleteInvitationConfirmationDialogAsync(CancellationToken ct) Result dialogResult = await ViewDependencies.ConfirmationDialogOpener.OpenConfirmationDialogAsync(new ConfirmationDialogParameter(string.Format(DELETE_COMMUNITY_INVITATION_TEXT_FORMAT, currentCommunityName), DELETE_COMMUNITY_INVITATION_CANCEL_TEXT, DELETE_COMMUNITY_INVITATION_CONFIRM_TEXT, communityThumbnail.ImageSprite, true, false), ct) .SuppressToResultAsync(ReportCategory.COMMUNITIES); - if (ct.IsCancellationRequested || !dialogResult.Success || dialogResult.Value == ConfirmationResult.CANCEL) + if (ct.IsCancellationRequested || !dialogResult.Success || dialogResult.Value == ConfirmationResult.Cancel) return; RejectCommunityInvitationButtonClicked?.Invoke(CommunityId, currentInviteOrRequestId, this); @@ -189,7 +189,7 @@ public void SetPrivacy(CommunityPrivacy privacy) public void SetMembersCount(int memberCount) { - bool isMembersCounterEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.COMMUNITIES_MEMBERS_COUNTER); + bool isMembersCounterEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.CommunitiesMembersCounter); communityMembersSeparator.SetActive(isMembersCounterEnabled); communityMembersCountText.gameObject.SetActive(isMembersCounterEnabled); @@ -203,41 +203,41 @@ public void SetInviteOrRequestId(string id) => public void SetActionButtonsState(CommunityPrivacy privacy, InviteRequestAction type, bool isMember, bool isStreaming = false, bool hasJoined = false) { if (isStreaming) - SetActionButtonsState(hasJoined ? ActionButtonsState.STREAMING_GOTO : ActionButtonsState.STREAMING_JOIN); + SetActionButtonsState(hasJoined ? ActionButtonsState.StreamingGoto : ActionButtonsState.StreamingJoin); else if ((privacy == CommunityPrivacy.@public || isMember) && type == InviteRequestAction.none) - SetActionButtonsState(isMember ? ActionButtonsState.PUBLIC_VIEW : ActionButtonsState.PUBLIC_JOIN); + SetActionButtonsState(isMember ? ActionButtonsState.PublicView : ActionButtonsState.PublicJoin); else if (privacy == CommunityPrivacy.@private && !isMember && type != InviteRequestAction.invite) - SetActionButtonsState(type == InviteRequestAction.request_to_join ? ActionButtonsState.PRIVATE_CANCEL_JOIN : ActionButtonsState.PRIVATE_REQUEST_JOIN); + SetActionButtonsState(type == InviteRequestAction.request_to_join ? ActionButtonsState.PrivateCancelJoin : ActionButtonsState.PrivateRequestJoin); else if (type == InviteRequestAction.invite) - SetActionButtonsState(ActionButtonsState.PRIVATE_WITH_INVITE); + SetActionButtonsState(ActionButtonsState.PrivateWithInvite); } private void SetActionButtonsState(ActionButtonsState buttonsState) { switch (buttonsState) { - case ActionButtonsState.PUBLIC_JOIN: - case ActionButtonsState.PUBLIC_VIEW: + case ActionButtonsState.PublicJoin: + case ActionButtonsState.PublicView: SetPublicState(buttonsState, isActiveState: true); SetStreamingState(buttonsState, isActiveState: false); SetPrivateJoinRequestState(buttonsState, isActiveState: false); SetPrivateInvitationState(isActiveState: false); break; - case ActionButtonsState.STREAMING_JOIN: - case ActionButtonsState.STREAMING_GOTO: + case ActionButtonsState.StreamingJoin: + case ActionButtonsState.StreamingGoto: SetPublicState(buttonsState, isActiveState: false); SetStreamingState(buttonsState, isActiveState: true); SetPrivateJoinRequestState(buttonsState, isActiveState: false); SetPrivateInvitationState(isActiveState: false); break; - case ActionButtonsState.PRIVATE_REQUEST_JOIN: - case ActionButtonsState.PRIVATE_CANCEL_JOIN: + case ActionButtonsState.PrivateRequestJoin: + case ActionButtonsState.PrivateCancelJoin: SetPublicState(buttonsState, isActiveState: false); SetStreamingState(buttonsState, isActiveState: false); SetPrivateJoinRequestState(buttonsState, isActiveState: true); SetPrivateInvitationState(isActiveState: false); break; - case ActionButtonsState.PRIVATE_WITH_INVITE: + case ActionButtonsState.PrivateWithInvite: SetPublicState(buttonsState, isActiveState: false); SetStreamingState(buttonsState, isActiveState: false); SetPrivateJoinRequestState(buttonsState, isActiveState: false); @@ -250,16 +250,16 @@ private void SetPublicState(ActionButtonsState buttonsState, bool isActiveState) { joinOrViewButtonsContainer.SetActive(isActiveState); if (!isActiveState) return; - joinCommunityButton.gameObject.SetActive(buttonsState is ActionButtonsState.PUBLIC_JOIN); - viewCommunityButton.gameObject.SetActive(buttonsState is ActionButtonsState.PUBLIC_VIEW); + joinCommunityButton.gameObject.SetActive(buttonsState is ActionButtonsState.PublicJoin); + viewCommunityButton.gameObject.SetActive(buttonsState is ActionButtonsState.PublicView); } private void SetPrivateJoinRequestState(ActionButtonsState buttonsState, bool isActiveState) { requestOrCancelToJoinButtonsContainer.SetActive(isActiveState); if (!isActiveState) return; - requestToJoinButton.gameObject.SetActive(buttonsState is ActionButtonsState.PRIVATE_REQUEST_JOIN); - cancelJoinRequestButton.gameObject.SetActive(buttonsState is ActionButtonsState.PRIVATE_CANCEL_JOIN); + requestToJoinButton.gameObject.SetActive(buttonsState is ActionButtonsState.PrivateRequestJoin); + cancelJoinRequestButton.gameObject.SetActive(buttonsState is ActionButtonsState.PrivateCancelJoin); } private void SetPrivateInvitationState(bool isActiveState) @@ -274,8 +274,8 @@ private void SetStreamingState(ActionButtonsState buttonsState, bool isActiveSta { joinStreamButtonContainer.SetActive(isActiveState); if (!isActiveState) return; - goToStreamButton.gameObject.SetActive(buttonsState is ActionButtonsState.STREAMING_GOTO); - joinStreamButton.gameObject.SetActive(buttonsState is ActionButtonsState.STREAMING_JOIN); + goToStreamButton.gameObject.SetActive(buttonsState is ActionButtonsState.StreamingGoto); + joinStreamButton.gameObject.SetActive(buttonsState is ActionButtonsState.StreamingJoin); } @@ -418,14 +418,14 @@ public struct MutualThumbnail private enum ActionButtonsState { - PUBLIC_JOIN, - PUBLIC_VIEW, - STREAMING_JOIN, - STREAMING_GOTO, - PRIVATE_REQUEST_JOIN, - PRIVATE_CANCEL_JOIN, - PRIVATE_WITH_INVITE, - DEFAULT, + PublicJoin, + PublicView, + StreamingJoin, + StreamingGoto, + PrivateRequestJoin, + PrivateCancelJoin, + PrivateWithInvite, + Default, } } } diff --git a/Explorer/Assets/DCL/Communities/CommunitiesBrowser/FilteredCommunitiesView.cs b/Explorer/Assets/DCL/Communities/CommunitiesBrowser/FilteredCommunitiesView.cs index 0473eea603c..0574f028b0e 100644 --- a/Explorer/Assets/DCL/Communities/CommunitiesBrowser/FilteredCommunitiesView.cs +++ b/Explorer/Assets/DCL/Communities/CommunitiesBrowser/FilteredCommunitiesView.cs @@ -177,7 +177,7 @@ private LoopGridViewItem SetupCommunityResultCardByIndex(LoopGridView loopGridVi var isStreaming = false; var hasJoined = false; - if (activeViewSection == ActiveViewSection.STREAMING) + if (activeViewSection == ActiveViewSection.Streaming) { isStreaming = true; hasJoined = browserStateService.CurrentCommunityId.Value == communityData.id; @@ -251,10 +251,10 @@ private void OnCommunityJoined(string communityId, CommunityResultCardView cardV public enum ActiveViewSection { - STREAMING, - ALL_COMMUNITIES, - SEARCH_COMMUNITIES, - MY_COMMUNITIES + Streaming, + AllCommunities, + SearchCommunities, + MyCommunities } } } diff --git a/Explorer/Assets/DCL/Communities/CommunitiesCard/Announcements/AnnouncementCardView.cs b/Explorer/Assets/DCL/Communities/CommunitiesCard/Announcements/AnnouncementCardView.cs index 27dea85f947..3e143e78771 100644 --- a/Explorer/Assets/DCL/Communities/CommunitiesCard/Announcements/AnnouncementCardView.cs +++ b/Explorer/Assets/DCL/Communities/CommunitiesCard/Announcements/AnnouncementCardView.cs @@ -146,7 +146,7 @@ async UniTask ShowDeleteConfirmationDialogAsync(CancellationToken ct) deleteSprite, false, false), ct) .SuppressToResultAsync(ReportCategory.COMMUNITIES); - if (ct.IsCancellationRequested || !dialogResult.Success || dialogResult.Value == ConfirmationResult.CANCEL) + if (ct.IsCancellationRequested || !dialogResult.Success || dialogResult.Value == ConfirmationResult.Cancel) return; DeleteAnnouncementButtonClicked?.Invoke(currentAnnouncementId); diff --git a/Explorer/Assets/DCL/Communities/CommunitiesCard/Announcements/AnnouncementEmojiController.cs b/Explorer/Assets/DCL/Communities/CommunitiesCard/Announcements/AnnouncementEmojiController.cs index be4e3d3e9d6..40c2be7ce99 100644 --- a/Explorer/Assets/DCL/Communities/CommunitiesCard/Announcements/AnnouncementEmojiController.cs +++ b/Explorer/Assets/DCL/Communities/CommunitiesCard/Announcements/AnnouncementEmojiController.cs @@ -116,7 +116,7 @@ async UniTaskVoid SearchSuggestionsAndShowPanelAsync(CancellationToken ct) // Fixes https://github.com/decentraland/unity-explorer/issues/6965 // This operation needs to be awaited otherwise a race condition occurs // between the suggested elements generated and the submitted element processed once the panel is activated - lastMatch = await suggestionPanelController.HandleSuggestionsSearchAsync(wordMatch.Value, EMOJI_PATTERN_REGEX, InputSuggestionType.EMOJIS, emojiSuggestionsDictionary, ct); + lastMatch = await suggestionPanelController.HandleSuggestionsSearchAsync(wordMatch.Value, EMOJI_PATTERN_REGEX, InputSuggestionType.Emojis, emojiSuggestionsDictionary, ct); } suggestionPanelController.SetPanelVisibility(lastMatch.Success); diff --git a/Explorer/Assets/DCL/Communities/CommunitiesCard/Announcements/AnnouncementsSectionController.cs b/Explorer/Assets/DCL/Communities/CommunitiesCard/Announcements/AnnouncementsSectionController.cs index fd0517aa693..87a0671679b 100644 --- a/Explorer/Assets/DCL/Communities/CommunitiesCard/Announcements/AnnouncementsSectionController.cs +++ b/Explorer/Assets/DCL/Communities/CommunitiesCard/Announcements/AnnouncementsSectionController.cs @@ -168,7 +168,7 @@ private async UniTaskVoid InitializeViewAsync( return; } - Profile? profile = await profileRepo.GetAsync(identity.Identity!.Address, ct, IProfileRepository.FetchBehaviour.DELAY_UNTIL_RESOLVED); + Profile? profile = await profileRepo.GetAsync(identity.Identity!.Address, ct, IProfileRepository.FetchBehaviour.DelayUntilResolved); view.SetProfile(profile, profileRepositoryWrapper); } diff --git a/Explorer/Assets/DCL/Communities/CommunitiesCard/CommunityCardController.cs b/Explorer/Assets/DCL/Communities/CommunitiesCard/CommunityCardController.cs index 061d0a30514..8817dc66d95 100644 --- a/Explorer/Assets/DCL/Communities/CommunitiesCard/CommunityCardController.cs +++ b/Explorer/Assets/DCL/Communities/CommunitiesCard/CommunityCardController.cs @@ -64,7 +64,7 @@ public class CommunityCardController : ControllerBase CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; private readonly IMVCManager mvcManager; private readonly ICameraReelStorageService cameraReelStorageService; @@ -406,7 +406,7 @@ protected override void OnViewInstantiated() realmNavigator, decentralandUrlsSource); - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.COMMUNITIES_ANNOUNCEMENTS)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.CommunitiesAnnouncements)) announcementsSectionController = new AnnouncementsSectionController( viewInstance.AnnouncementsSectionView, communitiesDataProvider, @@ -443,7 +443,7 @@ async UniTaskVoid LoadCommunityDataAsync(CancellationToken ct) viewInstance!.SetLoadingState(true); //Since it's the tab that is automatically selected when the community card is opened, we set it to loading. - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.COMMUNITIES_ANNOUNCEMENTS)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.CommunitiesAnnouncements)) viewInstance.AnnouncementsSectionView.SetLoadingStateActive(true); else viewInstance.MembersListView.SetLoadingStateActive(true); @@ -580,17 +580,17 @@ private void OnSectionChanged(CommunityCardView.Sections section) sectionCancellationTokenSource = sectionCancellationTokenSource.SafeRestart(); switch (section) { - case CommunityCardView.Sections.PHOTOS: + case CommunityCardView.Sections.Photos: viewInstance!.CameraReelGalleryConfigs.PhotosView.SetAdminEmptyTextActive(communityData.role is CommunityMemberRole.moderator or CommunityMemberRole.owner); cameraReelGalleryController!.ShowPlacesGalleryAsync(communityPlaceIds, sectionCancellationTokenSource.Token).Forget(); break; - case CommunityCardView.Sections.MEMBERS: + case CommunityCardView.Sections.Members: membersListController!.ShowMembersList(communityData, sectionCancellationTokenSource.Token); break; - case CommunityCardView.Sections.PLACES: + case CommunityCardView.Sections.Places: placesSectionController!.ShowPlaces(communityData, communityPlaceIds, sectionCancellationTokenSource.Token); break; - case CommunityCardView.Sections.ANNOUNCEMENTS: + case CommunityCardView.Sections.Announcements: announcementsSectionController!.ShowAnnouncements(communityData, sectionCancellationTokenSource.Token); break; } @@ -802,10 +802,10 @@ private void OnCopyCommunityLinkRequested() } private void DisableShortcutsInput() => - inputBlock.Disable(InputMapComponent.Kind.SHORTCUTS, InputMapComponent.Kind.IN_WORLD_CAMERA); + inputBlock.Disable(InputMapComponent.Kind.Shortcuts, InputMapComponent.Kind.InWorldCamera); private void RestoreInput() => - inputBlock.Enable(InputMapComponent.Kind.SHORTCUTS, InputMapComponent.Kind.IN_WORLD_CAMERA); + inputBlock.Enable(InputMapComponent.Kind.Shortcuts, InputMapComponent.Kind.InWorldCamera); protected override UniTask WaitForCloseIntentAsync(CancellationToken ct) => UniTask.WhenAny(viewInstance!.GetClosingTasks(closeIntentCompletionSource.Task, ct)); diff --git a/Explorer/Assets/DCL/Communities/CommunitiesCard/CommunityCardView.cs b/Explorer/Assets/DCL/Communities/CommunitiesCard/CommunityCardView.cs index 265d9437420..6b7bcd85b44 100644 --- a/Explorer/Assets/DCL/Communities/CommunitiesCard/CommunityCardView.cs +++ b/Explorer/Assets/DCL/Communities/CommunitiesCard/CommunityCardView.cs @@ -42,10 +42,10 @@ public class CommunityCardView : ViewBase, IView public enum Sections { - PHOTOS, - MEMBERS, - PLACES, - ANNOUNCEMENTS, + Photos, + Members, + Places, + Announcements, } [Serializable] @@ -170,30 +170,30 @@ async UniTask ShowDeleteInvitationConfirmationDialogAsync(CancellationToken ct) false, false), ct) .SuppressToResultAsync(ReportCategory.COMMUNITIES); - if (ct.IsCancellationRequested || !dialogResult.Success || dialogResult.Value == ConfirmationResult.CANCEL) return; + if (ct.IsCancellationRequested || !dialogResult.Success || dialogResult.Value == ConfirmationResult.Cancel) return; RejectInvite?.Invoke(); } }); - photosButton.onClick.AddListener(() => ToggleSection(Sections.PHOTOS)); - membersButton.onClick.AddListener(() => ToggleSection(Sections.MEMBERS)); - membersTextButton.onClick.AddListener(() => ToggleSection(Sections.MEMBERS)); - placesButton.onClick.AddListener(() => ToggleSection(Sections.PLACES)); - placesWithSignButton.onClick.AddListener(() => ToggleSection(Sections.PLACES)); + photosButton.onClick.AddListener(() => ToggleSection(Sections.Photos)); + membersButton.onClick.AddListener(() => ToggleSection(Sections.Members)); + membersTextButton.onClick.AddListener(() => ToggleSection(Sections.Members)); + placesButton.onClick.AddListener(() => ToggleSection(Sections.Places)); + placesWithSignButton.onClick.AddListener(() => ToggleSection(Sections.Places)); placesShortcutButton.onClick.AddListener(() => OpenWizardRequested?.Invoke()); - isAnnouncementsFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.COMMUNITIES_ANNOUNCEMENTS); + isAnnouncementsFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.CommunitiesAnnouncements); announcementsButton.gameObject.SetActive(isAnnouncementsFeatureEnabled); if (isAnnouncementsFeatureEnabled) - announcementsButton.onClick.AddListener(() => ToggleSection(Sections.ANNOUNCEMENTS)); + announcementsButton.onClick.AddListener(() => ToggleSection(Sections.Announcements)); contextMenu = new GenericContextMenu(contextMenuSettings.ContextMenuWidth, offsetFromTarget: contextMenuSettings.OffsetFromTarget, verticalLayoutPadding: contextMenuSettings.VerticalPadding, elementsSpacing: contextMenuSettings.ElementsSpacing, - anchorPoint: ContextMenuOpenDirection.BOTTOM_LEFT) + anchorPoint: ContextMenuOpenDirection.BottomLeft) .AddControl(communityNotificationsContextMenuElement = new GenericContextMenuElement( communityNotificationsContextMenuControlSettings = new ToggleWithIconContextMenuControlSettings(contextMenuSettings.CommunityNotificationsSprite, contextMenuSettings.CommunityNotificationsText, OnToggleCommunityNotifications, null, 10))) .AddControl(communityNotificationsSeparatorContextMenuElement = new GenericContextMenuElement( @@ -232,7 +232,7 @@ async UniTask ShowDeleteConfirmationDialogAsync(CancellationToken ct) true, false), ct) .SuppressToResultAsync(ReportCategory.COMMUNITIES); - if (ct.IsCancellationRequested || !dialogResult.Success || dialogResult.Value == ConfirmationResult.CANCEL) return; + if (ct.IsCancellationRequested || !dialogResult.Success || dialogResult.Value == ConfirmationResult.Cancel) return; DeleteCommunityRequested?.Invoke(); } @@ -272,7 +272,7 @@ async UniTask ShowLeaveConfirmationDialogAsync(CancellationToken ct) ct) .SuppressToResultAsync(ReportCategory.COMMUNITIES); - if (ct.IsCancellationRequested || !dialogResult.Success || dialogResult.Value == ConfirmationResult.CANCEL) return; + if (ct.IsCancellationRequested || !dialogResult.Success || dialogResult.Value == ConfirmationResult.Cancel) return; LeaveCommunityRequested?.Invoke(); } @@ -299,7 +299,7 @@ public void SetCardBackgroundColor(Color color, int shaderProperty) public void ResetToggle(bool invokeEvent) { currentSection = null; - ToggleSection(isAnnouncementsFeatureEnabled ? Sections.ANNOUNCEMENTS : Sections.MEMBERS, invokeEvent); + ToggleSection(isAnnouncementsFeatureEnabled ? Sections.Announcements : Sections.Members, invokeEvent); } public void ClearCurrentSection() @@ -331,16 +331,16 @@ private void ToggleSection(Sections section, bool invokeEvent = true) currentSection = section; - photosSectionSelection.SetActive(section == Sections.PHOTOS); - membersSectionSelection.SetActive(section == Sections.MEMBERS); - placesSectionSelection.SetActive(section == Sections.PLACES); - placesWithSignSectionSelection.SetActive(section == Sections.PLACES); - announcementsSelection.SetActive(section == Sections.ANNOUNCEMENTS); + photosSectionSelection.SetActive(section == Sections.Photos); + membersSectionSelection.SetActive(section == Sections.Members); + placesSectionSelection.SetActive(section == Sections.Places); + placesWithSignSectionSelection.SetActive(section == Sections.Places); + announcementsSelection.SetActive(section == Sections.Announcements); - CameraReelGalleryConfigs.PhotosView.SetActive(section == Sections.PHOTOS); - MembersListView.SetActive(section == Sections.MEMBERS); - PlacesSectionView.SetActive(section == Sections.PLACES); - AnnouncementsSectionView.SetActive(section == Sections.ANNOUNCEMENTS); + CameraReelGalleryConfigs.PhotosView.SetActive(section == Sections.Photos); + MembersListView.SetActive(section == Sections.Members); + PlacesSectionView.SetActive(section == Sections.Places); + AnnouncementsSectionView.SetActive(section == Sections.Announcements); if (invokeEvent) SectionChanged?.Invoke(section); diff --git a/Explorer/Assets/DCL/Communities/CommunitiesCard/CommunityCardVoiceChatPresenter.cs b/Explorer/Assets/DCL/Communities/CommunitiesCard/CommunityCardVoiceChatPresenter.cs index 139c942a501..08c05671083 100644 --- a/Explorer/Assets/DCL/Communities/CommunitiesCard/CommunityCardVoiceChatPresenter.cs +++ b/Explorer/Assets/DCL/Communities/CommunitiesCard/CommunityCardVoiceChatPresenter.cs @@ -23,7 +23,7 @@ public CommunityCardVoiceChatPresenter(CommunityCardVoiceChatView view, IVoiceCh currentCommunityId = string.Empty; - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.COMMUNITY_VOICE_CHAT)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.CommunityVoiceChat)) { view.StartStreamButton.onClick.AddListener(StartStream); view.JoinStreamButton.onClick.AddListener(JoinStream); @@ -60,13 +60,13 @@ private void StartStream() { UIAudioEventsBus.Instance.SendPlayAudioEvent(view.StartStreamAudio); ClosePanel?.Invoke(); - voiceChatOrchestrator.StartCall(currentCommunityId, VoiceChatType.COMMUNITY); + voiceChatOrchestrator.StartCall(currentCommunityId, VoiceChatType.Community); SetPanelStatus(true, true, currentCommunityId); } public void Reset() { - if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.COMMUNITY_VOICE_CHAT)) + if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.CommunityVoiceChat)) return; view.VoiceChatPanel.SetActive(false); @@ -74,7 +74,7 @@ public void Reset() public void SetPanelStatus(bool isStreamRunning, bool isModOrAdmin, string communityId) { - if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.COMMUNITY_VOICE_CHAT)) + if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.CommunityVoiceChat)) return; currentCommunityId = communityId; @@ -88,7 +88,7 @@ public void SetPanelStatus(bool isStreamRunning, bool isModOrAdmin, string commu public void SetListenersCount(int listenersCount) { - if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.COMMUNITY_VOICE_CHAT)) + if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.CommunityVoiceChat)) return; stringBuilder.Clear(); @@ -101,7 +101,7 @@ public void SetListenersCount(int listenersCount) public void Dispose() { - if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.COMMUNITY_VOICE_CHAT)) + if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.CommunityVoiceChat)) return; voiceChatOrchestrator.CurrentCommunityId.OnUpdate -= UpdateJoinLeaveButtonState; diff --git a/Explorer/Assets/DCL/Communities/CommunitiesCard/Members/FriendshipHelpers.cs b/Explorer/Assets/DCL/Communities/CommunitiesCard/Members/FriendshipHelpers.cs index 209ce9058e9..64b7b07926f 100644 --- a/Explorer/Assets/DCL/Communities/CommunitiesCard/Members/FriendshipHelpers.cs +++ b/Explorer/Assets/DCL/Communities/CommunitiesCard/Members/FriendshipHelpers.cs @@ -10,12 +10,12 @@ public static UserProfileContextMenuControlSettings.FriendshipStatus Convert(thi { 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, + FriendshipStatus.friend => UserProfileContextMenuControlSettings.FriendshipStatus.Friend, + FriendshipStatus.request_received => UserProfileContextMenuControlSettings.FriendshipStatus.RequestReceived, + FriendshipStatus.request_sent => UserProfileContextMenuControlSettings.FriendshipStatus.RequestSent, + FriendshipStatus.blocked => UserProfileContextMenuControlSettings.FriendshipStatus.Blocked, + FriendshipStatus.blocked_by => UserProfileContextMenuControlSettings.FriendshipStatus.Disabled, + FriendshipStatus.none => UserProfileContextMenuControlSettings.FriendshipStatus.None, _ => throw new ArgumentOutOfRangeException(nameof(status), status, null) }; } @@ -24,12 +24,12 @@ 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, + Friends.FriendshipStatus.Friend => FriendshipStatus.friend, + Friends.FriendshipStatus.RequestReceived => FriendshipStatus.request_received, + Friends.FriendshipStatus.RequestSent => FriendshipStatus.request_sent, + Friends.FriendshipStatus.Blocked => FriendshipStatus.blocked, + Friends.FriendshipStatus.BlockedBy => FriendshipStatus.blocked_by, + Friends.FriendshipStatus.None => FriendshipStatus.none, _ => throw new ArgumentOutOfRangeException(nameof(status), status, null) }; } diff --git a/Explorer/Assets/DCL/Communities/CommunitiesCard/Members/MemberListItemView.cs b/Explorer/Assets/DCL/Communities/CommunitiesCard/Members/MemberListItemView.cs index 6173a8be2c7..f6ee20c848f 100644 --- a/Explorer/Assets/DCL/Communities/CommunitiesCard/Members/MemberListItemView.cs +++ b/Explorer/Assets/DCL/Communities/CommunitiesCard/Members/MemberListItemView.cs @@ -44,7 +44,7 @@ public class MemberListItemView : MonoBehaviour, IPointerEnterHandler, IPointerE private bool canUnHover = true; private bool isUserCard = false; - private MembersListView.MemberListSections currentSection = MembersListView.MemberListSections.MEMBERS; + private MembersListView.MemberListSections currentSection = MembersListView.MemberListSections.Members; public ICommunityMemberData? UserProfile { get; protected set; } @@ -117,20 +117,20 @@ public void Configure(ICommunityMemberData memberProfile, MembersListView.Member currentSection = section; isUserCard = isSelfCard; - addFriendButton.gameObject.SetActive(!isSelfCard && memberProfile.FriendshipStatus == FriendshipStatus.none && currentSection == MembersListView.MemberListSections.MEMBERS); - acceptFriendButton.gameObject.SetActive(!isSelfCard && memberProfile.FriendshipStatus == FriendshipStatus.request_received && currentSection == MembersListView.MemberListSections.MEMBERS); + addFriendButton.gameObject.SetActive(!isSelfCard && memberProfile.FriendshipStatus == FriendshipStatus.none && currentSection == MembersListView.MemberListSections.Members); + acceptFriendButton.gameObject.SetActive(!isSelfCard && memberProfile.FriendshipStatus == FriendshipStatus.request_received && currentSection == MembersListView.MemberListSections.Members); // Disable this button as part of the UI/UX decision to reduce the entry clutter, highlighting only non-friends. The old condition was: // !isSelfCard && memberProfile.friendshipStatus == FriendshipStatus.friend && currentSection == MembersListView.MemberListSections.ALL removeFriendButton.gameObject.SetActive(false); - cancelFriendButton.gameObject.SetActive(!isSelfCard && memberProfile.FriendshipStatus == FriendshipStatus.request_sent && currentSection == MembersListView.MemberListSections.MEMBERS); - unblockFriendButton.gameObject.SetActive(!isSelfCard && memberProfile.FriendshipStatus == FriendshipStatus.blocked && currentSection == MembersListView.MemberListSections.MEMBERS); + cancelFriendButton.gameObject.SetActive(!isSelfCard && memberProfile.FriendshipStatus == FriendshipStatus.request_sent && currentSection == MembersListView.MemberListSections.Members); + unblockFriendButton.gameObject.SetActive(!isSelfCard && memberProfile.FriendshipStatus == FriendshipStatus.blocked && currentSection == MembersListView.MemberListSections.Members); - deleteRequestButton.gameObject.SetActive(currentSection == MembersListView.MemberListSections.REQUESTS); - acceptRequestButton.gameObject.SetActive(currentSection == MembersListView.MemberListSections.REQUESTS); - cancelInviteButton.gameObject.SetActive(currentSection == MembersListView.MemberListSections.INVITES); - unbanButton.gameObject.SetActive(currentSection == MembersListView.MemberListSections.BANNED); + deleteRequestButton.gameObject.SetActive(currentSection == MembersListView.MemberListSections.Requests); + acceptRequestButton.gameObject.SetActive(currentSection == MembersListView.MemberListSections.Requests); + cancelInviteButton.gameObject.SetActive(currentSection == MembersListView.MemberListSections.Invites); + unbanButton.gameObject.SetActive(currentSection == MembersListView.MemberListSections.Banned); } public void SubscribeToInteractions(Action mainButton, diff --git a/Explorer/Assets/DCL/Communities/CommunitiesCard/Members/MembersListController.cs b/Explorer/Assets/DCL/Communities/CommunitiesCard/Members/MembersListController.cs index 8318b68889e..d016f161763 100644 --- a/Explorer/Assets/DCL/Communities/CommunitiesCard/Members/MembersListController.cs +++ b/Explorer/Assets/DCL/Communities/CommunitiesCard/Members/MembersListController.cs @@ -78,7 +78,7 @@ private int RequestsAmount private CancellationTokenSource communityOperationCts = new (); private CancellationTokenSource? reportConfirmationDialogCts; private UniTaskCompletionSource? panelLifecycleTask; - private MembersListView.MemberListSections currentSection = MembersListView.MemberListSections.MEMBERS; + private MembersListView.MemberListSections currentSection = MembersListView.MemberListSections.Members; public MembersListController(MembersListView view, ProfileRepositoryWrapper profileDataProvider, @@ -188,7 +188,7 @@ async UniTaskVoid ManageRequestAsync(CancellationToken ct) if (intention == InviteRequestIntention.accepted) { profile.Role = CommunityMemberRole.member; - List memberList = sectionsFetchData[MembersListView.MemberListSections.MEMBERS].Items; + List memberList = sectionsFetchData[MembersListView.MemberListSections.Members].Items; memberList.Add(profile); } @@ -234,7 +234,7 @@ private async void BlockUserClickedAsync(ICommunityMemberData profile) try { await mvcManager.ShowAsync(BlockUserPromptController.IssueCommand( - new BlockUserPromptParams(new Web3Address(profile.Address), profile.Name, BlockUserPromptParams.UserBlockAction.BLOCK)), + new BlockUserPromptParams(new Web3Address(profile.Address), profile.Name, BlockUserPromptParams.UserBlockAction.Block)), cancellationToken); await FetchFriendshipStatusAndRefreshAsync(profile.Address, cancellationToken); @@ -278,9 +278,9 @@ async UniTaskVoid BanUserAsync(CancellationToken token) return; } - sectionsFetchData[MembersListView.MemberListSections.MEMBERS].Items.Remove(profile); + sectionsFetchData[MembersListView.MemberListSections.Members].Items.Remove(profile); - List memberList = sectionsFetchData[MembersListView.MemberListSections.BANNED].Items; + List memberList = sectionsFetchData[MembersListView.MemberListSections.Banned].Items; profile.Role = CommunityMemberRole.none; memberList.Add(profile); @@ -332,14 +332,14 @@ async UniTaskVoid KickUserAsync(CancellationToken token) return; } - sectionsFetchData[MembersListView.MemberListSections.MEMBERS].Items.Remove(profile); + sectionsFetchData[MembersListView.MemberListSections.Members].Items.Remove(profile); RefreshGrid(true); } } public void TryRemoveLocalUser() { - List memberList = sectionsFetchData[MembersListView.MemberListSections.MEMBERS].Items; + List memberList = sectionsFetchData[MembersListView.MemberListSections.Members].Items; string? userAddress = web3IdentityCache.Identity?.Address; @@ -348,7 +348,7 @@ public void TryRemoveLocalUser() { memberList.RemoveAt(i); - if (currentSection == MembersListView.MemberListSections.MEMBERS) + if (currentSection == MembersListView.MemberListSections.Members) RefreshGrid(true); break; @@ -375,7 +375,7 @@ async UniTaskVoid AddModeratorAsync(CancellationToken token) return; } - List memberList = sectionsFetchData[MembersListView.MemberListSections.MEMBERS].Items; + List memberList = sectionsFetchData[MembersListView.MemberListSections.Members].Items; foreach (ICommunityMemberData member in memberList) if (member.Address.Equals(profile.Address)) @@ -408,7 +408,7 @@ async UniTaskVoid RemoveModeratorAsync(CancellationToken token) return; } - List memberList = sectionsFetchData[MembersListView.MemberListSections.MEMBERS].Items; + List memberList = sectionsFetchData[MembersListView.MemberListSections.Members].Items; foreach (ICommunityMemberData member in memberList) if (member.Address.Equals(profile.Address)) @@ -444,7 +444,7 @@ private void OpenProfilePassport(ICommunityMemberData profile) => public override void Reset() { communityData = null; - currentSection = MembersListView.MemberListSections.MEMBERS; + currentSection = MembersListView.MemberListSections.Members; view.Close(); foreach (var sectionFetchData in sectionsFetchData) @@ -466,32 +466,32 @@ private async void HandleContextMenuUserProfileButtonAsync(Profile.CompactInfo u switch (friendshipStatus) { - case UserProfileContextMenuControlSettings.FriendshipStatus.REQUEST_SENT: + case UserProfileContextMenuControlSettings.FriendshipStatus.RequestSent: await friendsService!.CancelFriendshipAsync(userData.UserId, ct) .SuppressToResultAsync(ReportCategory.COMMUNITIES); break; - case UserProfileContextMenuControlSettings.FriendshipStatus.REQUEST_RECEIVED: + case UserProfileContextMenuControlSettings.FriendshipStatus.RequestReceived: await mvcManager.ShowAsync(FriendRequestController.IssueCommand(new FriendRequestParams { OneShotFriendAccepted = userData, }), ct: ct); break; - case UserProfileContextMenuControlSettings.FriendshipStatus.BLOCKED: + case UserProfileContextMenuControlSettings.FriendshipStatus.Blocked: await mvcManager.ShowAsync(BlockUserPromptController.IssueCommand(new BlockUserPromptParams( - new Web3Address(userData.UserId), userData.Name, BlockUserPromptParams.UserBlockAction.UNBLOCK)), + new Web3Address(userData.UserId), userData.Name, BlockUserPromptParams.UserBlockAction.Unblock)), ct); break; - case UserProfileContextMenuControlSettings.FriendshipStatus.FRIEND: + case UserProfileContextMenuControlSettings.FriendshipStatus.Friend: await mvcManager.ShowAsync(UnfriendConfirmationPopupController.IssueCommand(new UnfriendConfirmationPopupController.Params { UserId = new Web3Address(userData.UserId), }), ct); break; - case UserProfileContextMenuControlSettings.FriendshipStatus.NONE: + case UserProfileContextMenuControlSettings.FriendshipStatus.None: await mvcManager.ShowAsync(FriendRequestController.IssueCommand(new FriendRequestParams { DestinationUser = new Web3Address(userData.UserId), @@ -525,11 +525,11 @@ protected override async UniTask FetchDataAsync(CancellationToken ct) UniTask responseTask = currentSection switch { - MembersListView.MemberListSections.MEMBERS => communitiesDataProvider.GetCommunityMembersAsync(communityData?.id, membersData.PageNumber, PAGE_SIZE, ct), - MembersListView.MemberListSections.BANNED => communitiesDataProvider.GetBannedCommunityMembersAsync(communityData?.id, membersData.PageNumber, PAGE_SIZE, ct), - MembersListView.MemberListSections.REQUESTS => + MembersListView.MemberListSections.Members => communitiesDataProvider.GetCommunityMembersAsync(communityData?.id, membersData.PageNumber, PAGE_SIZE, ct), + MembersListView.MemberListSections.Banned => communitiesDataProvider.GetBannedCommunityMembersAsync(communityData?.id, membersData.PageNumber, PAGE_SIZE, ct), + MembersListView.MemberListSections.Requests => communitiesDataProvider.GetCommunityInviteRequestAsync(communityData?.id, InviteRequestAction.request_to_join, membersData.PageNumber, PAGE_SIZE, ct), - MembersListView.MemberListSections.INVITES => + MembersListView.MemberListSections.Invites => communitiesDataProvider.GetCommunityInviteRequestAsync(communityData?.id, InviteRequestAction.invite, membersData.PageNumber, PAGE_SIZE, ct), _ => throw new ArgumentOutOfRangeException(nameof(currentSection), currentSection, null) }; @@ -549,7 +549,7 @@ protected override async UniTask FetchDataAsync(CancellationToken ct) if (!membersData.Items.Contains(member)) membersData.Items.Add(member); - if (currentSection == MembersListView.MemberListSections.REQUESTS) + if (currentSection == MembersListView.MemberListSections.Requests) RequestsAmount = response.Value.total; return response.Value.total; @@ -628,7 +628,7 @@ async UniTaskVoid UnbanUserAsync(CancellationToken ct) return; } - sectionsFetchData[MembersListView.MemberListSections.BANNED].Items.Remove(profile); + sectionsFetchData[MembersListView.MemberListSections.Banned].Items.Remove(profile); RefreshGrid(false); } } diff --git a/Explorer/Assets/DCL/Communities/CommunitiesCard/Members/MembersListView.cs b/Explorer/Assets/DCL/Communities/CommunitiesCard/Members/MembersListView.cs index 346d35888b3..2944ba3672c 100644 --- a/Explorer/Assets/DCL/Communities/CommunitiesCard/Members/MembersListView.cs +++ b/Explorer/Assets/DCL/Communities/CommunitiesCard/Members/MembersListView.cs @@ -27,10 +27,10 @@ public class MembersListView : MonoBehaviour, ICommunityFetchingView BlockUserRequested?.Invoke(lastClickedProfileCtx!), iconColor: redColor, textColor: redColor))); - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.REPORT_USER)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.ReportUser)) contextMenu.AddControl(new ButtonContextMenuControlSettings(contextMenuSettings.ReportText, contextMenuSettings.ReportOptionSprite, () => ReportUserRequested?.Invoke(lastClickedProfileCtx!), iconColor: redColor, textColor: redColor)); } public void Close() { - ToggleSection(MemberListSections.MEMBERS, false); + ToggleSection(MemberListSections.Members, false); confirmationDialogCts.SafeCancelAndDispose(); contextMenuCts.SafeCancelAndDispose(); } @@ -161,7 +161,7 @@ private void OnContextMenuButtonClicked(ICommunityMemberData profile, Vector2 bu contextMenuCts = contextMenuCts.SafeRestart(); UserProfileContextMenuControlSettings.FriendshipStatus status = profile.FriendshipStatus.Convert(); - userProfileContextMenuControlSettings!.SetInitialData(profile.Profile, status == UserProfileContextMenuControlSettings.FriendshipStatus.FRIEND ? status : UserProfileContextMenuControlSettings.FriendshipStatus.DISABLED); + userProfileContextMenuControlSettings!.SetInitialData(profile.Profile, status == UserProfileContextMenuControlSettings.FriendshipStatus.Friend ? status : UserProfileContextMenuControlSettings.FriendshipStatus.Disabled); elementView.CanUnHover = false; removeModeratorContextMenuElement!.Enabled = profile.Role == CommunityMemberRole.moderator && communityData?.role is CommunityMemberRole.owner; @@ -186,8 +186,8 @@ private void OnContextMenuButtonClicked(ICommunityMemberData profile, Vector2 bu ? profile.Role is not CommunityMemberRole.owner : communityData?.role is CommunityMemberRole.moderator && profile.Role is not CommunityMemberRole.owner && profile.Role is not CommunityMemberRole.moderator; - kickUserContextMenuElement!.Enabled = viewerCanKickOrBan && currentSection == MemberListSections.MEMBERS; - banUserContextMenuElement!.Enabled = viewerCanKickOrBan && currentSection == MemberListSections.MEMBERS; + kickUserContextMenuElement!.Enabled = viewerCanKickOrBan && currentSection == MemberListSections.Members; + banUserContextMenuElement!.Enabled = viewerCanKickOrBan && currentSection == MemberListSections.Members; communityOptionsSeparatorContextMenuElement!.Enabled = removeModeratorContextMenuElement.Enabled || addModeratorContextMenuElement.Enabled || @@ -229,7 +229,7 @@ async UniTaskVoid ShowTransferOwnershipConfirmationDialogAsync(CancellationToken fromUserInfo: ownProfile?.Compact ?? default(Profile.CompactInfo)), ct) .SuppressToResultAsync(ReportCategory.COMMUNITIES); - if (ct.IsCancellationRequested || !dialogResult.Success || dialogResult.Value == ConfirmationResult.CANCEL) return; + if (ct.IsCancellationRequested || !dialogResult.Success || dialogResult.Value == ConfirmationResult.Cancel) return; TransferOwnershipRequested?.Invoke(profile); } @@ -252,7 +252,7 @@ async UniTaskVoid ShowKickConfirmationDialogAsync(CancellationToken ct) ct) .SuppressToResultAsync(ReportCategory.COMMUNITIES); - if (ct.IsCancellationRequested || !dialogResult.Success || dialogResult.Value == ConfirmationResult.CANCEL) return; + if (ct.IsCancellationRequested || !dialogResult.Success || dialogResult.Value == ConfirmationResult.Cancel) return; KickUserRequested?.Invoke(profile); } @@ -275,7 +275,7 @@ async UniTaskVoid ShowBanConfirmationDialogAsync(CancellationToken ct) ct) .SuppressToResultAsync(ReportCategory.COMMUNITIES); - if (ct.IsCancellationRequested || !dialogResult.Success || dialogResult.Value == ConfirmationResult.CANCEL) return; + if (ct.IsCancellationRequested || !dialogResult.Success || dialogResult.Value == ConfirmationResult.Cancel) return; BanUserRequested?.Invoke(profile); } diff --git a/Explorer/Assets/DCL/Communities/CommunitiesCard/Places/PlacesSectionView.cs b/Explorer/Assets/DCL/Communities/CommunitiesCard/Places/PlacesSectionView.cs index 3cacab54f20..32b12f2e7ae 100644 --- a/Explorer/Assets/DCL/Communities/CommunitiesCard/Places/PlacesSectionView.cs +++ b/Explorer/Assets/DCL/Communities/CommunitiesCard/Places/PlacesSectionView.cs @@ -187,7 +187,7 @@ async UniTaskVoid ShowBanConfirmationDialogAsync(CancellationToken ct) ct) .SuppressToResultAsync(ReportCategory.COMMUNITIES); - if (ct.IsCancellationRequested || !dialogResult.Success || dialogResult.Value == ConfirmationResult.CANCEL) return; + if (ct.IsCancellationRequested || !dialogResult.Success || dialogResult.Value == ConfirmationResult.Cancel) return; ElementDeleteButtonClicked?.Invoke(placeInfo); } diff --git a/Explorer/Assets/DCL/Communities/CommunitiesDataProvider/DTOs/CommunitySorting.cs b/Explorer/Assets/DCL/Communities/CommunitiesDataProvider/DTOs/CommunitySorting.cs index a8d71bf1f7a..0e252e5882e 100644 --- a/Explorer/Assets/DCL/Communities/CommunitiesDataProvider/DTOs/CommunitySorting.cs +++ b/Explorer/Assets/DCL/Communities/CommunitiesDataProvider/DTOs/CommunitySorting.cs @@ -3,8 +3,8 @@ namespace DCL.Communities.CommunitiesDataProvider.DTOs { public enum CommunitySorting { - name, - popularity + Name, + Popularity } } diff --git a/Explorer/Assets/DCL/Communities/CommunityCreation/CommunityCreationEditionController.cs b/Explorer/Assets/DCL/Communities/CommunityCreation/CommunityCreationEditionController.cs index 9383b82f506..d0fe86e6de6 100644 --- a/Explorer/Assets/DCL/Communities/CommunityCreation/CommunityCreationEditionController.cs +++ b/Explorer/Assets/DCL/Communities/CommunityCreation/CommunityCreationEditionController.cs @@ -71,7 +71,7 @@ public class CommunityCreationEditionController : ControllerBase USER_IDS_POOL = new (defaultCapacity: 2); - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; private class CommunityPlace { @@ -209,10 +209,10 @@ private void GoToGetNameLink() => webBrowser.OpenUrlMainThreadOnly(DecentralandUrl.MarketplaceClaimName); private void DisableShortcutsInput() => - inputBlock.Disable(InputMapComponent.Kind.SHORTCUTS, InputMapComponent.Kind.IN_WORLD_CAMERA); + inputBlock.Disable(InputMapComponent.Kind.Shortcuts, InputMapComponent.Kind.InWorldCamera); private void RestoreInput() => - inputBlock.Enable(InputMapComponent.Kind.SHORTCUTS, InputMapComponent.Kind.IN_WORLD_CAMERA); + inputBlock.Enable(InputMapComponent.Kind.Shortcuts, InputMapComponent.Kind.InWorldCamera); private void OnCancelAction() => closeTaskCompletionSource.TrySetResult(); diff --git a/Explorer/Assets/DCL/Donations/UI/DonationsPanelController.cs b/Explorer/Assets/DCL/Donations/UI/DonationsPanelController.cs index 5c664e2ffde..7792bf6c367 100644 --- a/Explorer/Assets/DCL/Donations/UI/DonationsPanelController.cs +++ b/Explorer/Assets/DCL/Donations/UI/DonationsPanelController.cs @@ -24,10 +24,10 @@ public class DonationsPanelController : ControllerBase CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; public DonationsPanelController(ViewFactoryMethod viewFactory, IDonationsService donationsService, @@ -165,7 +165,7 @@ private async UniTaskVoid LoadDataAsync(CancellationToken ct) } (Profile.CompactInfo? creatorProfile, decimal currentBalance, decimal manaPriceUsd, string sceneName) = - await UniTask.WhenAll(profileRepository.GetCompactAsync(creatorAddress, ct, batchBehaviour: IProfileRepository.FetchBehaviour.ENFORCE_SINGLE_GET), + await UniTask.WhenAll(profileRepository.GetCompactAsync(creatorAddress, ct, batchBehaviour: IProfileRepository.FetchBehaviour.EnforceSingleGet), donationsService.GetCurrentBalanceAsync(ct), donationsService.GetCurrentManaConversionAsync(ct), donationsService.GetSceneNameAsync(baseParcel, ct)); diff --git a/Explorer/Assets/DCL/Donations/UI/DonationsPanelView.cs b/Explorer/Assets/DCL/Donations/UI/DonationsPanelView.cs index ce7492c689c..1bb7b8a9f9e 100644 --- a/Explorer/Assets/DCL/Donations/UI/DonationsPanelView.cs +++ b/Explorer/Assets/DCL/Donations/UI/DonationsPanelView.cs @@ -10,10 +10,10 @@ public class DonationsPanelView : ViewBase, IView { private enum SubViews { - DEFAULT, - LOADING, - TX_CONFIRMED, - ERROR + Default, + Loading, + TxConfirmed, + Error } public event Action? SendDonationRequested; @@ -36,14 +36,14 @@ private void Awake() donationDefaultView.buyMoreManaButton.onClick.AddListener(() => BuyMoreRequested?.Invoke()); donationErrorView.contactSupportButton.onClick.AddListener(() => ContactSupportRequested?.Invoke()); - donationErrorView.tryAgainButton.onClick.AddListener(() => ShowSubView(SubViews.DEFAULT)); + donationErrorView.tryAgainButton.onClick.AddListener(() => ShowSubView(SubViews.Default)); donationDefaultView.SendDonationRequested += (vm, amount) => SendDonationRequested?.Invoke(vm, amount); } public void SetDefaultLoadingState(bool active) { - ShowSubView(SubViews.DEFAULT); + ShowSubView(SubViews.Default); if (active) donationDefaultView.loadingView.ShowLoading(true); @@ -53,27 +53,27 @@ public void SetDefaultLoadingState(bool active) public void ShowLoading(DonationPanelViewModel viewModel, decimal donationAmount, bool isThirdWeb = false) { - ShowSubView(SubViews.LOADING); + ShowSubView(SubViews.Loading); donationLoadingView.SetWaitingMessage(isThirdWeb); donationLoadingView.ConfigurePanel(viewModel, donationAmount); } public void ShowErrorModal() { - ShowSubView(SubViews.ERROR); + ShowSubView(SubViews.Error); } private void ShowSubView(SubViews newSubView) { - donationDefaultView.gameObject.SetActive(newSubView == SubViews.DEFAULT); - donationConfirmedView.gameObject.SetActive(newSubView == SubViews.TX_CONFIRMED); - donationErrorView.gameObject.SetActive(newSubView == SubViews.ERROR); - donationLoadingView.gameObject.SetActive(newSubView == SubViews.LOADING); + donationDefaultView.gameObject.SetActive(newSubView == SubViews.Default); + donationConfirmedView.gameObject.SetActive(newSubView == SubViews.TxConfirmed); + donationErrorView.gameObject.SetActive(newSubView == SubViews.Error); + donationLoadingView.gameObject.SetActive(newSubView == SubViews.Loading); } public async UniTask ShowTxConfirmedAsync(DonationPanelViewModel viewModel, CancellationToken ct) { - ShowSubView(SubViews.TX_CONFIRMED); + ShowSubView(SubViews.TxConfirmed); await donationConfirmedView.ShowAsync(viewModel, ct); } diff --git a/Explorer/Assets/DCL/EmojiPanel/EmojiPanelPresenter.cs b/Explorer/Assets/DCL/EmojiPanel/EmojiPanelPresenter.cs index 39b79097e62..9c596cbef3f 100644 --- a/Explorer/Assets/DCL/EmojiPanel/EmojiPanelPresenter.cs +++ b/Explorer/Assets/DCL/EmojiPanel/EmojiPanelPresenter.cs @@ -251,7 +251,7 @@ private void BlockShortcuts() if (inputBlock == null || shortcutsBlocked) return; shortcutsBlocked = true; - inputBlock.Disable(InputMapComponent.Kind.SHORTCUTS, InputMapComponent.Kind.IN_WORLD_CAMERA); + inputBlock.Disable(InputMapComponent.Kind.Shortcuts, InputMapComponent.Kind.InWorldCamera); } private void RestoreShortcuts() @@ -259,7 +259,7 @@ private void RestoreShortcuts() if (inputBlock == null || !shortcutsBlocked) return; shortcutsBlocked = false; - inputBlock.Enable(InputMapComponent.Kind.SHORTCUTS, InputMapComponent.Kind.IN_WORLD_CAMERA); + inputBlock.Enable(InputMapComponent.Kind.Shortcuts, InputMapComponent.Kind.InWorldCamera); } private void OnEmojiSelected(string code) diff --git a/Explorer/Assets/DCL/EmotesWheel/EmotesWheelController.cs b/Explorer/Assets/DCL/EmotesWheel/EmotesWheelController.cs index 2cffe5994df..aa424eb4178 100644 --- a/Explorer/Assets/DCL/EmotesWheel/EmotesWheelController.cs +++ b/Explorer/Assets/DCL/EmotesWheel/EmotesWheelController.cs @@ -40,7 +40,7 @@ public class EmotesWheelController : ControllerBase private CancellationTokenSource? slotSetUpCts; - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; public EmotesWheelController(ViewFactoryMethod viewFactory, SelfProfile selfProfile, @@ -234,19 +234,19 @@ private void OpenBackpack() private void UnblockUnwantedInputs() { - inputBlock.Disable(InputMapComponent.Kind.EMOTES); + inputBlock.Disable(InputMapComponent.Kind.Emotes); } // Note: This must be called once the menu has loaded and is ready to be closed private void UnblockShortcutToEmoteSlotsSetup() { - inputBlock.Enable(InputMapComponent.Kind.EMOTE_WHEEL); + inputBlock.Enable(InputMapComponent.Kind.EmoteWheel); } private void BlockUnwantedInputs() { - inputBlock.Disable(InputMapComponent.Kind.EMOTE_WHEEL); - inputBlock.Enable(InputMapComponent.Kind.EMOTES); + inputBlock.Disable(InputMapComponent.Kind.EmoteWheel); + inputBlock.Enable(InputMapComponent.Kind.Emotes); } private void ListenToSlotsInput(InputActionMap inputActionMap) diff --git a/Explorer/Assets/DCL/Events/EventDetailPanelController.cs b/Explorer/Assets/DCL/Events/EventDetailPanelController.cs index d32efadc3f8..5e8fb4854c6 100644 --- a/Explorer/Assets/DCL/Events/EventDetailPanelController.cs +++ b/Explorer/Assets/DCL/Events/EventDetailPanelController.cs @@ -12,7 +12,7 @@ public class EventDetailPanelController : ControllerBase CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; private readonly ThumbnailLoader? eventCardThumbnailLoader; private CancellationTokenSource panelCts = new (); diff --git a/Explorer/Assets/DCL/Events/EventsByDayController.cs b/Explorer/Assets/DCL/Events/EventsByDayController.cs index 8afb8b1f30a..73f4b4b1200 100644 --- a/Explorer/Assets/DCL/Events/EventsByDayController.cs +++ b/Explorer/Assets/DCL/Events/EventsByDayController.cs @@ -74,17 +74,17 @@ public void Dispose() } private void OnBackButtonClicked() => - eventsController.OpenSection(EventsSection.CALENDAR, eventsController.CurrentCalendarFromDate); + eventsController.OpenSection(EventsSection.Calendar, eventsController.CurrentCalendarFromDate); private void OnGoToNextDayButtonClicked() => - eventsController.OpenSection(EventsSection.EVENTS_BY_DAY, currentDay.AddDays(1)); + eventsController.OpenSection(EventsSection.EventsByDay, currentDay.AddDays(1)); private void OnEventCardClicked(EventDTO eventInfo, PlacesData.PlaceInfo? placeInfo, EventCardView eventCardView) => mvcManager.ShowAsync(EventDetailPanelController.IssueCommand(new EventDetailPanelParameter(eventInfo, placeInfo, eventCardView))).Forget(); private void OnSectionOpen(EventsSection section, DateTime date) { - if (section != EventsSection.EVENTS_BY_DAY) + if (section != EventsSection.EventsByDay) return; loadEventsCts = loadEventsCts.SafeRestart(); diff --git a/Explorer/Assets/DCL/Events/EventsCalendarController.cs b/Explorer/Assets/DCL/Events/EventsCalendarController.cs index 3e4f1fe266d..b21a83954e9 100644 --- a/Explorer/Assets/DCL/Events/EventsCalendarController.cs +++ b/Explorer/Assets/DCL/Events/EventsCalendarController.cs @@ -99,7 +99,7 @@ public void Dispose() private void OnSectionOpened(EventsSection section, DateTime fromDate) { - if (section != EventsSection.CALENDAR) + if (section != EventsSection.Calendar) return; loadEventsCts = loadEventsCts.SafeRestart(); @@ -110,7 +110,7 @@ private void OnSectionClosed() => UnloadEvents(); private void OnGoToTodayClicked() => - eventsController.OpenSection(EventsSection.CALENDAR); + eventsController.OpenSection(EventsSection.Calendar); private void OnDaysRangeChanged(DateTime fromDate, int numberOfDays) { @@ -119,7 +119,7 @@ private void OnDaysRangeChanged(DateTime fromDate, int numberOfDays) } private void OnDaySelectorButtonClicked(DateTime date) => - eventsController.OpenSection(EventsSection.EVENTS_BY_DAY, date); + eventsController.OpenSection(EventsSection.EventsByDay, date); private void OnEventCardClicked(EventDTO eventInfo, PlacesData.PlaceInfo? placeInfo, EventCardView eventCardView) { diff --git a/Explorer/Assets/DCL/Events/EventsController.cs b/Explorer/Assets/DCL/Events/EventsController.cs index 16c965921cf..926e9145566 100644 --- a/Explorer/Assets/DCL/Events/EventsController.cs +++ b/Explorer/Assets/DCL/Events/EventsController.cs @@ -99,7 +99,7 @@ public void Activate() isSectionActivated = true; view.SetViewActive(true); cursor.Unlock(); - OpenSection(EventsSection.CALENDAR); + OpenSection(EventsSection.Calendar); } public void Deactivate() diff --git a/Explorer/Assets/DCL/Events/EventsSection.cs b/Explorer/Assets/DCL/Events/EventsSection.cs index 30022e49724..a9ad63c3aa1 100644 --- a/Explorer/Assets/DCL/Events/EventsSection.cs +++ b/Explorer/Assets/DCL/Events/EventsSection.cs @@ -2,7 +2,7 @@ { public enum EventsSection { - CALENDAR, - EVENTS_BY_DAY, + Calendar, + EventsByDay, } } diff --git a/Explorer/Assets/DCL/Events/EventsView.cs b/Explorer/Assets/DCL/Events/EventsView.cs index b05b7ecbc7b..575484e1e42 100644 --- a/Explorer/Assets/DCL/Events/EventsView.cs +++ b/Explorer/Assets/DCL/Events/EventsView.cs @@ -57,8 +57,8 @@ public void ResetAnimator() public void OpenSection(EventsSection section) { - eventsCalendarView.gameObject.SetActive(section == EventsSection.CALENDAR); - eventsByDayView.gameObject.SetActive(section == EventsSection.EVENTS_BY_DAY); + eventsCalendarView.gameObject.SetActive(section == EventsSection.Calendar); + eventsByDayView.gameObject.SetActive(section == EventsSection.EventsByDay); } } } diff --git a/Explorer/Assets/DCL/ExplorePanel/ExplorePanelController.cs b/Explorer/Assets/DCL/ExplorePanel/ExplorePanelController.cs index f2af676a4aa..4dfa308a2a3 100644 --- a/Explorer/Assets/DCL/ExplorePanel/ExplorePanelController.cs +++ b/Explorer/Assets/DCL/ExplorePanel/ExplorePanelController.cs @@ -1,497 +1,497 @@ -using Cysharp.Threading.Tasks; -using DCL.Backpack; -using DCL.Communities; -using DCL.Communities.CommunitiesBrowser; -using DCL.Credits; -using DCL.FeatureFlags; -using DCL.Diagnostics; -using DCL.Events; -using DCL.EventsApi; -using DCL.Input; -using DCL.Input.Component; -using DCL.InWorldCamera.CameraReelGallery; -using DCL.Navmap; -using DCL.NotificationsBus; -using DCL.NotificationsBus.NotificationTypes; -using DCL.Places; -using DCL.Settings; -using DCL.UI; -using DCL.UI.ProfileElements; -using DCL.UI.Profiles; -using DCL.Utilities; -using DCL.Utilities.Extensions; -using DCL.Utility.Types; -using DCL.VoiceChat; -using MVC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using UnityEngine.EventSystems; -using UnityEngine.InputSystem; -using Utility; - -namespace DCL.ExplorePanel -{ - public class ExplorePanelController : ControllerBase - { - private readonly BackpackController backpackController; - private readonly SidebarProfileButtonPresenter profileButtonPresenter; - private readonly ProfileMenuController profileMenuController; - private readonly DCLInput dclInput; - private readonly IInputBlock inputBlock; - private readonly bool includeCameraReel; - private readonly IMVCManager mvcManager; - private readonly bool includeDiscover; - private readonly HttpEventsApiService eventsApiService; - private readonly JoinedCommunitiesVoiceLiveTracker communitiesLiveTracker; - private readonly ICreditsPanelController creditsPanelController; - private bool includeCommunities; - - private ReactivePropertyExtensions.DisposableSubscription? communitiesLiveBadgeSubscription; - - private Dictionary tabsBySections; - private Dictionary exploreSections; - private SectionSelectorController sectionSelectorController; - private CancellationTokenSource? animationCts; - private CancellationTokenSource? profileMenuCts; - private CancellationTokenSource setupExploreSectionsCts; - private CancellationTokenSource checkForLiveEventsCts; - private TabSelectorView? previousSelector; - private ExploreSections lastShownSection; - private bool isControlClosing; - - private CommunitiesBrowserController communitiesBrowserController { get; } - public NavmapController NavmapController { get; } - public CameraReelController CameraReelController { get; } - public SettingsController SettingsController { get; } - public CommunitiesBrowserController CommunitiesBrowserController { get; } - public PlacesController PlacesController { get; } - public EventsController EventsController { get; } - - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.FULLSCREEN; - - public bool CanBeClosedByEscape => State != ControllerState.ViewShowing; - - public event Action? PlacesOpenedFromStartMenu; - public event Action? EventsOpenedFromStartMenu; - - public ExplorePanelController(ViewFactoryMethod viewFactory, - NavmapController navmapController, - SettingsController settingsController, - BackpackController backpackController, - CameraReelController cameraReelController, - SidebarProfileButtonPresenter profileButtonPresenter, - ProfileMenuController profileMenuController, - CommunitiesBrowserController communitiesBrowserController, - PlacesController placesController, - EventsController eventsController, - IInputBlock inputBlock, - HttpEventsApiService eventsApiService, - IMVCManager mvcManager, - JoinedCommunitiesVoiceLiveTracker communitiesLiveTracker, - ICreditsPanelController creditsPanelController) - : base(viewFactory) - { - NavmapController = navmapController; - SettingsController = settingsController; - this.backpackController = backpackController; - CameraReelController = cameraReelController; - this.profileButtonPresenter = profileButtonPresenter; - dclInput = DCLInput.Instance; - this.profileMenuController = profileMenuController; - this.inputBlock = inputBlock; - this.includeCameraReel = FeaturesRegistry.Instance.IsEnabled(FeatureId.CAMERA_REEL); - this.mvcManager = mvcManager; - this.communitiesBrowserController = communitiesBrowserController; - this.includeDiscover = FeaturesRegistry.Instance.IsEnabled(FeatureId.DISCOVER); - this.eventsApiService = eventsApiService; - this.communitiesLiveTracker = communitiesLiveTracker; - this.creditsPanelController = creditsPanelController; - CommunitiesBrowserController = communitiesBrowserController; - PlacesController = placesController; - - NotificationsBusController.Instance.SubscribeToNotificationTypeClick(NotificationType.REWARD_ASSIGNMENT, p => OnShowSectionFromNotificationAsync(p, ExploreSections.Backpack).Forget()); - - EventsController = eventsController; - } - - public override void Dispose() - { - base.Dispose(); - - profileMenuCts.SafeCancelAndDispose(); - setupExploreSectionsCts.SafeCancelAndDispose(); - checkForLiveEventsCts.SafeCancelAndDispose(); - - communitiesLiveBadgeSubscription?.Dispose(); - } - - private async UniTaskVoid OnShowSectionFromNotificationAsync(object[] _, ExploreSections sectionToShow) - { - if (State == ControllerState.ViewHidden) - await mvcManager.ShowAsync(ExplorePanelController.IssueCommand(new ExplorePanelParameter(sectionToShow))); - else - ShowSection(sectionToShow); - } - - protected override void OnViewInstantiated() - { - setupExploreSectionsCts = setupExploreSectionsCts.SafeRestart(); - SetupExploreSectionsAsync(setupExploreSectionsCts.Token).Forget(); - viewInstance!.SetLiveEventsCounter(0); - - viewInstance.CommunitiesLiveBadge.SetActive(communitiesLiveTracker.HasAnyJoinedCommunityLive.Value); - communitiesLiveBadgeSubscription = communitiesLiveTracker.HasAnyJoinedCommunityLive.Subscribe(OnCommunitiesLiveStateChanged); - } - - private void OnCommunitiesLiveStateChanged(bool hasAnyLive) - { - if (viewInstance != null) - viewInstance.CommunitiesLiveBadge.SetActive(hasAnyLive); - } - - private async UniTaskVoid SetupExploreSectionsAsync(CancellationToken ct) - { - exploreSections = new Dictionary - { - { ExploreSections.Navmap, NavmapController }, - { ExploreSections.Settings, SettingsController }, - { ExploreSections.Backpack, backpackController }, - { ExploreSections.CameraReel, CameraReelController }, - { ExploreSections.Communities, CommunitiesBrowserController }, - { ExploreSections.Places, PlacesController }, - { ExploreSections.Events, EventsController }, - }; - - includeCommunities = await CommunitiesFeatureAccess.Instance.IsUserAllowedToUseTheFeatureAsync(ct); - - lastShownSection = includeDiscover ? ExploreSections.Events : includeCommunities ? ExploreSections.Communities : ExploreSections.Navmap; - - sectionSelectorController = new SectionSelectorController(exploreSections, lastShownSection); - - foreach (KeyValuePair keyValuePair in exploreSections) - keyValuePair.Value.Deactivate(); - - tabsBySections = viewInstance!.TabSelectorMappedViews.ToDictionary(map => map.Section, map => map.TabSelectorViews); - - foreach ((ExploreSections section, TabSelectorView? tabSelector) in tabsBySections) - { - tabSelector.TabSelectorToggle.onValueChanged.RemoveAllListeners(); - - if ((section == ExploreSections.CameraReel && !includeCameraReel) || - (section == ExploreSections.Communities && !includeCommunities) || - (section == ExploreSections.Places && !includeDiscover) || - (section == ExploreSections.Events && !includeDiscover)) - { - tabSelector.gameObject.SetActive(false); - continue; - } - - tabSelector.TabSelectorToggle.onValueChanged.AddListener(isOn => - { - ToggleSection(isOn, tabSelector, section, true); - - if (!isOn) return; - - switch (section) - { - case ExploreSections.Places: - PlacesOpenedFromStartMenu?.Invoke(); - break; - case ExploreSections.Events: - EventsOpenedFromStartMenu?.Invoke(); - break; - } - - } - ); - } - - viewInstance?.ProfileWidget?.OpenProfileButton?.Button?.onClick.AddListener(ShowProfileMenuAsync); - } - - protected override void OnViewShow() - { - isControlClosing = false; - sectionSelectorController.ResetAnimators(); - - ExploreSections sectionToShow = inputData.IsSectionProvided ? inputData.Section : lastShownSection; - - foreach ((ExploreSections section, TabSelectorView? tab) in tabsBySections) - { - ToggleSection(section == sectionToShow, tab, section, true); - sectionSelectorController.SetAnimationState(section == sectionToShow, tabsBySections[section]); - } - - if (inputData.BackpackSection != null) - backpackController.Toggle(inputData.BackpackSection.Value); - - if (inputData.SettingsSection != null) - SettingsController.Toggle(inputData.SettingsSection.Value); - - profileButtonPresenter.LoadProfile(); - - profileMenuCts = profileMenuCts.SafeRestart(); - - if (profileMenuController.State is ControllerState.ViewFocused or ControllerState.ViewBlurred) - profileMenuController.HideViewAsync(CancellationToken.None).Forget(); - - BlockUnwantedInputs(); - RegisterHotkeys(); - - checkForLiveEventsCts = checkForLiveEventsCts.SafeRestart(); - FillLiveEventsAsync(checkForLiveEventsCts.Token).Forget(); - - if (inputData.IsSectionProvided) - return; - - // Only triggers OpenedFromStartMenu events if IsSectionProvided is false. - // This means that the section has not opened by shortcut nor sidebar. - switch (sectionToShow) - { - case ExploreSections.Places: - PlacesOpenedFromStartMenu?.Invoke(); - break; - case ExploreSections.Events: - EventsOpenedFromStartMenu?.Invoke(); - break; - } - } - - private void ToggleSection(bool isOn, TabSelectorView tabSelectorView, ExploreSections shownSection, bool animate) - { - if (isOn && animate && shownSection != lastShownSection) - sectionSelectorController.SetAnimationState(false, tabsBySections[lastShownSection]); - - animationCts.SafeCancelAndDispose(); - animationCts = new CancellationTokenSource(); - sectionSelectorController.OnTabSelectorToggleValueChangedAsync(isOn, tabSelectorView, shownSection, animationCts.Token, animate).Forget(); - - if (!isOn) return; - - if (shownSection == lastShownSection) - exploreSections[lastShownSection].Activate(); - - lastShownSection = shownSection; - } - - private void RegisterHotkeys() - { - dclInput.Shortcuts.MainMenu.canceled += OnCloseMainMenu; - dclInput.Shortcuts.Map.performed += OnMapHotkeyPressed; - dclInput.Shortcuts.Settings.performed += OnSettingsHotkeyPressed; - dclInput.Shortcuts.Backpack.performed += OnBackpackHotkeyPressed; - dclInput.Shortcuts.Communities.performed += OnCommunitiesHotkeyPressed; - dclInput.Shortcuts.Places.performed += OnPlacesHotkeyPressed; - dclInput.Shortcuts.Events.performed += OnEventsHotkeyPressed; - dclInput.Shortcuts.CameraReel.performed += OnCameraReelHotkeyPressed; - } - - private void OnCameraReelHotkeyPressed(InputAction.CallbackContext ctx) - { - if (!includeCameraReel) return; - - if (lastShownSection != ExploreSections.CameraReel) - { - sectionSelectorController.SetAnimationState(false, tabsBySections[lastShownSection]); - ShowSection(ExploreSections.CameraReel); - } - else - isControlClosing = true; - } - - private void OnCloseMainMenu(InputAction.CallbackContext obj) - { - // Search bar could be focused when closing the menu, so we need to remove the focus, - // which will also re-enable shortcuts - EventSystem.current.SetSelectedGameObject(null); - - profileMenuController.HideViewAsync(CancellationToken.None).Forget(); - isControlClosing = true; - } - - private void OnMapHotkeyPressed(InputAction.CallbackContext obj) - { - if (lastShownSection != ExploreSections.Navmap) - { - sectionSelectorController.SetAnimationState(false, tabsBySections[lastShownSection]); - ShowSection(ExploreSections.Navmap); - } - else - isControlClosing = true; - } - - private void OnSettingsHotkeyPressed(InputAction.CallbackContext obj) - { - if (lastShownSection != ExploreSections.Settings) - { - sectionSelectorController.SetAnimationState(false, tabsBySections[lastShownSection]); - ShowSection(ExploreSections.Settings); - } - else - isControlClosing = true; - } - - private void OnCommunitiesHotkeyPressed(InputAction.CallbackContext obj) - { - if (!includeCommunities) return; - - if (lastShownSection != ExploreSections.Communities) - { - sectionSelectorController.SetAnimationState(false, tabsBySections[lastShownSection]); - ShowSection(ExploreSections.Communities); - } - else - isControlClosing = true; - } - - private void OnPlacesHotkeyPressed(InputAction.CallbackContext obj) - { - if (!includeDiscover) return; - - if (lastShownSection != ExploreSections.Places) - { - sectionSelectorController.SetAnimationState(false, tabsBySections![lastShownSection]); - ShowSection(ExploreSections.Places); - } - else - isControlClosing = true; - } - - private void OnEventsHotkeyPressed(InputAction.CallbackContext obj) - { - if (!includeDiscover) return; - - if (lastShownSection != ExploreSections.Events) - { - sectionSelectorController.SetAnimationState(false, tabsBySections![lastShownSection]); - ShowSection(ExploreSections.Events); - } - else - isControlClosing = true; - } - - private void OnBackpackHotkeyPressed(InputAction.CallbackContext obj) - { - if (lastShownSection != ExploreSections.Backpack) - { - sectionSelectorController.SetAnimationState(false, tabsBySections[lastShownSection]); - ShowSection(ExploreSections.Backpack); - } - else - isControlClosing = true; - } - - private void ShowSection(ExploreSections section) - { - ToggleSection(true, tabsBySections[section], section, true); - } - - protected override void OnViewClose() - { - foreach (ISection exploreSectionsValue in exploreSections.Values) - exploreSectionsValue.Deactivate(); - - if (profileMenuController.State is ControllerState.ViewFocused or ControllerState.ViewBlurred) - profileMenuController.HideViewAsync(CancellationToken.None).Forget(); - - profileMenuCts.SafeCancelAndDispose(); - checkForLiveEventsCts.SafeCancelAndDispose(); - - UnblockUnwantedInputs(); - UnRegisterHotkeys(); - } - - private void UnRegisterHotkeys() - { - dclInput.Shortcuts.MainMenu.canceled -= OnCloseMainMenu; - dclInput.Shortcuts.Map.performed -= OnMapHotkeyPressed; - dclInput.Shortcuts.Settings.performed -= OnSettingsHotkeyPressed; - dclInput.Shortcuts.Backpack.performed -= OnBackpackHotkeyPressed; - dclInput.Shortcuts.Communities.performed -= OnCommunitiesHotkeyPressed; - dclInput.Shortcuts.Places.performed -= OnPlacesHotkeyPressed; - dclInput.Shortcuts.Events.performed -= OnEventsHotkeyPressed; - dclInput.Shortcuts.CameraReel.performed -= OnCameraReelHotkeyPressed; - } - - private void BlockUnwantedInputs() - { - inputBlock.Disable(InputMapComponent.Kind.CAMERA, InputMapComponent.Kind.PLAYER); - } - - private void UnblockUnwantedInputs() - { - inputBlock.Enable(InputMapComponent.Kind.CAMERA, InputMapComponent.Kind.PLAYER); - } - - protected override async UniTask WaitForCloseIntentAsync(CancellationToken ct) - { - await UniTask.WhenAny(viewInstance!.CloseButton.OnClickAsync(ct), - UniTask.WaitUntil(() => isControlClosing, PlayerLoopTiming.Update, ct), - viewInstance.ProfileMenuView.SystemMenuView.LogoutButton.OnClickAsync(ct)); - } - - private async void ShowProfileMenuAsync() - { - profileMenuCts = profileMenuCts.SafeRestart(); - - if (profileMenuController.State != ControllerState.ViewHidden) - return; - - try - { - viewInstance!.ProfileMenuCloserButton.gameObject.SetActive(true); - viewInstance.ProfileMenuCloserButton.onClick.AddListener(OnProfileMenuCloserClicked); - - await profileMenuController.LaunchViewLifeCycleAsync(new CanvasOrdering(CanvasOrdering.SortingLayer.POPUP, 0), new ControllerNoData(), profileMenuCts.Token); - await profileMenuController.HideViewAsync(CancellationToken.None); - } - catch (OperationCanceledException) - { - // Cancellations ignored - } - finally - { - if (viewInstance != null) - { - viewInstance.ProfileMenuCloserButton.onClick.RemoveListener(OnProfileMenuCloserClicked); - viewInstance.ProfileMenuCloserButton.gameObject.SetActive(false); - } - } - } - - private void OnProfileMenuCloserClicked() => - profileMenuCts?.Cancel(); - - private async UniTaskVoid FillLiveEventsAsync(CancellationToken ct) - { - Result> liveEventsResult = await eventsApiService.GetEventsAsync(ct, onlyLiveEvents: true).SuppressToResultAsync(ReportCategory.EVENTS); - - if (ct.IsCancellationRequested) - return; - - viewInstance!.SetLiveEventsCounter(liveEventsResult.Success ? liveEventsResult.Value.Count : 0); - } - } - - public readonly struct ExplorePanelParameter - { - public readonly ExploreSections Section; - public readonly BackpackSections? BackpackSection; - public readonly SettingsController.SettingsSection? SettingsSection; - - /// - /// Whether a specific section has to be opened when the explore panel is shown or not (using the default one). - /// - public readonly bool IsSectionProvided; - - public ExplorePanelParameter(ExploreSections section, BackpackSections? backpackSection = null, SettingsController.SettingsSection? settingsSection = null) - { - Section = section; - BackpackSection = backpackSection; - SettingsSection = settingsSection; - IsSectionProvided = true; - } - } -} +using Cysharp.Threading.Tasks; +using DCL.Backpack; +using DCL.Communities; +using DCL.Communities.CommunitiesBrowser; +using DCL.Credits; +using DCL.FeatureFlags; +using DCL.Diagnostics; +using DCL.Events; +using DCL.EventsApi; +using DCL.Input; +using DCL.Input.Component; +using DCL.InWorldCamera.CameraReelGallery; +using DCL.Navmap; +using DCL.NotificationsBus; +using DCL.NotificationsBus.NotificationTypes; +using DCL.Places; +using DCL.Settings; +using DCL.UI; +using DCL.UI.ProfileElements; +using DCL.UI.Profiles; +using DCL.Utilities; +using DCL.Utilities.Extensions; +using DCL.Utility.Types; +using DCL.VoiceChat; +using MVC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using UnityEngine.EventSystems; +using UnityEngine.InputSystem; +using Utility; + +namespace DCL.ExplorePanel +{ + public class ExplorePanelController : ControllerBase + { + private readonly BackpackController backpackController; + private readonly SidebarProfileButtonPresenter profileButtonPresenter; + private readonly ProfileMenuController profileMenuController; + private readonly DCLInput dclInput; + private readonly IInputBlock inputBlock; + private readonly bool includeCameraReel; + private readonly IMVCManager mvcManager; + private readonly bool includeDiscover; + private readonly HttpEventsApiService eventsApiService; + private readonly JoinedCommunitiesVoiceLiveTracker communitiesLiveTracker; + private readonly ICreditsPanelController creditsPanelController; + private bool includeCommunities; + + private ReactivePropertyExtensions.DisposableSubscription? communitiesLiveBadgeSubscription; + + private Dictionary tabsBySections; + private Dictionary exploreSections; + private SectionSelectorController sectionSelectorController; + private CancellationTokenSource? animationCts; + private CancellationTokenSource? profileMenuCts; + private CancellationTokenSource setupExploreSectionsCts; + private CancellationTokenSource checkForLiveEventsCts; + private TabSelectorView? previousSelector; + private ExploreSections lastShownSection; + private bool isControlClosing; + + private CommunitiesBrowserController communitiesBrowserController { get; } + public NavmapController NavmapController { get; } + public CameraReelController CameraReelController { get; } + public SettingsController SettingsController { get; } + public CommunitiesBrowserController CommunitiesBrowserController { get; } + public PlacesController PlacesController { get; } + public EventsController EventsController { get; } + + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Fullscreen; + + public bool CanBeClosedByEscape => State != ControllerState.ViewShowing; + + public event Action? PlacesOpenedFromStartMenu; + public event Action? EventsOpenedFromStartMenu; + + public ExplorePanelController(ViewFactoryMethod viewFactory, + NavmapController navmapController, + SettingsController settingsController, + BackpackController backpackController, + CameraReelController cameraReelController, + SidebarProfileButtonPresenter profileButtonPresenter, + ProfileMenuController profileMenuController, + CommunitiesBrowserController communitiesBrowserController, + PlacesController placesController, + EventsController eventsController, + IInputBlock inputBlock, + HttpEventsApiService eventsApiService, + IMVCManager mvcManager, + JoinedCommunitiesVoiceLiveTracker communitiesLiveTracker, + ICreditsPanelController creditsPanelController) + : base(viewFactory) + { + NavmapController = navmapController; + SettingsController = settingsController; + this.backpackController = backpackController; + CameraReelController = cameraReelController; + this.profileButtonPresenter = profileButtonPresenter; + dclInput = DCLInput.Instance; + this.profileMenuController = profileMenuController; + this.inputBlock = inputBlock; + this.includeCameraReel = FeaturesRegistry.Instance.IsEnabled(FeatureId.CameraReel); + this.mvcManager = mvcManager; + this.communitiesBrowserController = communitiesBrowserController; + this.includeDiscover = FeaturesRegistry.Instance.IsEnabled(FeatureId.Discover); + this.eventsApiService = eventsApiService; + this.communitiesLiveTracker = communitiesLiveTracker; + this.creditsPanelController = creditsPanelController; + CommunitiesBrowserController = communitiesBrowserController; + PlacesController = placesController; + + NotificationsBusController.Instance.SubscribeToNotificationTypeClick(NotificationType.REWARD_ASSIGNMENT, p => OnShowSectionFromNotificationAsync(p, ExploreSections.Backpack).Forget()); + + EventsController = eventsController; + } + + public override void Dispose() + { + base.Dispose(); + + profileMenuCts.SafeCancelAndDispose(); + setupExploreSectionsCts.SafeCancelAndDispose(); + checkForLiveEventsCts.SafeCancelAndDispose(); + + communitiesLiveBadgeSubscription?.Dispose(); + } + + private async UniTaskVoid OnShowSectionFromNotificationAsync(object[] _, ExploreSections sectionToShow) + { + if (State == ControllerState.ViewHidden) + await mvcManager.ShowAsync(ExplorePanelController.IssueCommand(new ExplorePanelParameter(sectionToShow))); + else + ShowSection(sectionToShow); + } + + protected override void OnViewInstantiated() + { + setupExploreSectionsCts = setupExploreSectionsCts.SafeRestart(); + SetupExploreSectionsAsync(setupExploreSectionsCts.Token).Forget(); + viewInstance!.SetLiveEventsCounter(0); + + viewInstance.CommunitiesLiveBadge.SetActive(communitiesLiveTracker.HasAnyJoinedCommunityLive.Value); + communitiesLiveBadgeSubscription = communitiesLiveTracker.HasAnyJoinedCommunityLive.Subscribe(OnCommunitiesLiveStateChanged); + } + + private void OnCommunitiesLiveStateChanged(bool hasAnyLive) + { + if (viewInstance != null) + viewInstance.CommunitiesLiveBadge.SetActive(hasAnyLive); + } + + private async UniTaskVoid SetupExploreSectionsAsync(CancellationToken ct) + { + exploreSections = new Dictionary + { + { ExploreSections.Navmap, NavmapController }, + { ExploreSections.Settings, SettingsController }, + { ExploreSections.Backpack, backpackController }, + { ExploreSections.CameraReel, CameraReelController }, + { ExploreSections.Communities, CommunitiesBrowserController }, + { ExploreSections.Places, PlacesController }, + { ExploreSections.Events, EventsController }, + }; + + includeCommunities = await CommunitiesFeatureAccess.Instance.IsUserAllowedToUseTheFeatureAsync(ct); + + lastShownSection = includeDiscover ? ExploreSections.Events : includeCommunities ? ExploreSections.Communities : ExploreSections.Navmap; + + sectionSelectorController = new SectionSelectorController(exploreSections, lastShownSection); + + foreach (KeyValuePair keyValuePair in exploreSections) + keyValuePair.Value.Deactivate(); + + tabsBySections = viewInstance!.TabSelectorMappedViews.ToDictionary(map => map.Section, map => map.TabSelectorViews); + + foreach ((ExploreSections section, TabSelectorView? tabSelector) in tabsBySections) + { + tabSelector.TabSelectorToggle.onValueChanged.RemoveAllListeners(); + + if ((section == ExploreSections.CameraReel && !includeCameraReel) || + (section == ExploreSections.Communities && !includeCommunities) || + (section == ExploreSections.Places && !includeDiscover) || + (section == ExploreSections.Events && !includeDiscover)) + { + tabSelector.gameObject.SetActive(false); + continue; + } + + tabSelector.TabSelectorToggle.onValueChanged.AddListener(isOn => + { + ToggleSection(isOn, tabSelector, section, true); + + if (!isOn) return; + + switch (section) + { + case ExploreSections.Places: + PlacesOpenedFromStartMenu?.Invoke(); + break; + case ExploreSections.Events: + EventsOpenedFromStartMenu?.Invoke(); + break; + } + + } + ); + } + + viewInstance?.ProfileWidget?.OpenProfileButton?.Button?.onClick.AddListener(ShowProfileMenuAsync); + } + + protected override void OnViewShow() + { + isControlClosing = false; + sectionSelectorController.ResetAnimators(); + + ExploreSections sectionToShow = inputData.IsSectionProvided ? inputData.Section : lastShownSection; + + foreach ((ExploreSections section, TabSelectorView? tab) in tabsBySections) + { + ToggleSection(section == sectionToShow, tab, section, true); + sectionSelectorController.SetAnimationState(section == sectionToShow, tabsBySections[section]); + } + + if (inputData.BackpackSection != null) + backpackController.Toggle(inputData.BackpackSection.Value); + + if (inputData.SettingsSection != null) + SettingsController.Toggle(inputData.SettingsSection.Value); + + profileButtonPresenter.LoadProfile(); + + profileMenuCts = profileMenuCts.SafeRestart(); + + if (profileMenuController.State is ControllerState.ViewFocused or ControllerState.ViewBlurred) + profileMenuController.HideViewAsync(CancellationToken.None).Forget(); + + BlockUnwantedInputs(); + RegisterHotkeys(); + + checkForLiveEventsCts = checkForLiveEventsCts.SafeRestart(); + FillLiveEventsAsync(checkForLiveEventsCts.Token).Forget(); + + if (inputData.IsSectionProvided) + return; + + // Only triggers OpenedFromStartMenu events if IsSectionProvided is false. + // This means that the section has not opened by shortcut nor sidebar. + switch (sectionToShow) + { + case ExploreSections.Places: + PlacesOpenedFromStartMenu?.Invoke(); + break; + case ExploreSections.Events: + EventsOpenedFromStartMenu?.Invoke(); + break; + } + } + + private void ToggleSection(bool isOn, TabSelectorView tabSelectorView, ExploreSections shownSection, bool animate) + { + if (isOn && animate && shownSection != lastShownSection) + sectionSelectorController.SetAnimationState(false, tabsBySections[lastShownSection]); + + animationCts.SafeCancelAndDispose(); + animationCts = new CancellationTokenSource(); + sectionSelectorController.OnTabSelectorToggleValueChangedAsync(isOn, tabSelectorView, shownSection, animationCts.Token, animate).Forget(); + + if (!isOn) return; + + if (shownSection == lastShownSection) + exploreSections[lastShownSection].Activate(); + + lastShownSection = shownSection; + } + + private void RegisterHotkeys() + { + dclInput.Shortcuts.MainMenu.canceled += OnCloseMainMenu; + dclInput.Shortcuts.Map.performed += OnMapHotkeyPressed; + dclInput.Shortcuts.Settings.performed += OnSettingsHotkeyPressed; + dclInput.Shortcuts.Backpack.performed += OnBackpackHotkeyPressed; + dclInput.Shortcuts.Communities.performed += OnCommunitiesHotkeyPressed; + dclInput.Shortcuts.Places.performed += OnPlacesHotkeyPressed; + dclInput.Shortcuts.Events.performed += OnEventsHotkeyPressed; + dclInput.Shortcuts.CameraReel.performed += OnCameraReelHotkeyPressed; + } + + private void OnCameraReelHotkeyPressed(InputAction.CallbackContext ctx) + { + if (!includeCameraReel) return; + + if (lastShownSection != ExploreSections.CameraReel) + { + sectionSelectorController.SetAnimationState(false, tabsBySections[lastShownSection]); + ShowSection(ExploreSections.CameraReel); + } + else + isControlClosing = true; + } + + private void OnCloseMainMenu(InputAction.CallbackContext obj) + { + // Search bar could be focused when closing the menu, so we need to remove the focus, + // which will also re-enable shortcuts + EventSystem.current.SetSelectedGameObject(null); + + profileMenuController.HideViewAsync(CancellationToken.None).Forget(); + isControlClosing = true; + } + + private void OnMapHotkeyPressed(InputAction.CallbackContext obj) + { + if (lastShownSection != ExploreSections.Navmap) + { + sectionSelectorController.SetAnimationState(false, tabsBySections[lastShownSection]); + ShowSection(ExploreSections.Navmap); + } + else + isControlClosing = true; + } + + private void OnSettingsHotkeyPressed(InputAction.CallbackContext obj) + { + if (lastShownSection != ExploreSections.Settings) + { + sectionSelectorController.SetAnimationState(false, tabsBySections[lastShownSection]); + ShowSection(ExploreSections.Settings); + } + else + isControlClosing = true; + } + + private void OnCommunitiesHotkeyPressed(InputAction.CallbackContext obj) + { + if (!includeCommunities) return; + + if (lastShownSection != ExploreSections.Communities) + { + sectionSelectorController.SetAnimationState(false, tabsBySections[lastShownSection]); + ShowSection(ExploreSections.Communities); + } + else + isControlClosing = true; + } + + private void OnPlacesHotkeyPressed(InputAction.CallbackContext obj) + { + if (!includeDiscover) return; + + if (lastShownSection != ExploreSections.Places) + { + sectionSelectorController.SetAnimationState(false, tabsBySections![lastShownSection]); + ShowSection(ExploreSections.Places); + } + else + isControlClosing = true; + } + + private void OnEventsHotkeyPressed(InputAction.CallbackContext obj) + { + if (!includeDiscover) return; + + if (lastShownSection != ExploreSections.Events) + { + sectionSelectorController.SetAnimationState(false, tabsBySections![lastShownSection]); + ShowSection(ExploreSections.Events); + } + else + isControlClosing = true; + } + + private void OnBackpackHotkeyPressed(InputAction.CallbackContext obj) + { + if (lastShownSection != ExploreSections.Backpack) + { + sectionSelectorController.SetAnimationState(false, tabsBySections[lastShownSection]); + ShowSection(ExploreSections.Backpack); + } + else + isControlClosing = true; + } + + private void ShowSection(ExploreSections section) + { + ToggleSection(true, tabsBySections[section], section, true); + } + + protected override void OnViewClose() + { + foreach (ISection exploreSectionsValue in exploreSections.Values) + exploreSectionsValue.Deactivate(); + + if (profileMenuController.State is ControllerState.ViewFocused or ControllerState.ViewBlurred) + profileMenuController.HideViewAsync(CancellationToken.None).Forget(); + + profileMenuCts.SafeCancelAndDispose(); + checkForLiveEventsCts.SafeCancelAndDispose(); + + UnblockUnwantedInputs(); + UnRegisterHotkeys(); + } + + private void UnRegisterHotkeys() + { + dclInput.Shortcuts.MainMenu.canceled -= OnCloseMainMenu; + dclInput.Shortcuts.Map.performed -= OnMapHotkeyPressed; + dclInput.Shortcuts.Settings.performed -= OnSettingsHotkeyPressed; + dclInput.Shortcuts.Backpack.performed -= OnBackpackHotkeyPressed; + dclInput.Shortcuts.Communities.performed -= OnCommunitiesHotkeyPressed; + dclInput.Shortcuts.Places.performed -= OnPlacesHotkeyPressed; + dclInput.Shortcuts.Events.performed -= OnEventsHotkeyPressed; + dclInput.Shortcuts.CameraReel.performed -= OnCameraReelHotkeyPressed; + } + + private void BlockUnwantedInputs() + { + inputBlock.Disable(InputMapComponent.Kind.Camera, InputMapComponent.Kind.Player); + } + + private void UnblockUnwantedInputs() + { + inputBlock.Enable(InputMapComponent.Kind.Camera, InputMapComponent.Kind.Player); + } + + protected override async UniTask WaitForCloseIntentAsync(CancellationToken ct) + { + await UniTask.WhenAny(viewInstance!.CloseButton.OnClickAsync(ct), + UniTask.WaitUntil(() => isControlClosing, PlayerLoopTiming.Update, ct), + viewInstance.ProfileMenuView.SystemMenuView.LogoutButton.OnClickAsync(ct)); + } + + private async void ShowProfileMenuAsync() + { + profileMenuCts = profileMenuCts.SafeRestart(); + + if (profileMenuController.State != ControllerState.ViewHidden) + return; + + try + { + viewInstance!.ProfileMenuCloserButton.gameObject.SetActive(true); + viewInstance.ProfileMenuCloserButton.onClick.AddListener(OnProfileMenuCloserClicked); + + await profileMenuController.LaunchViewLifeCycleAsync(new CanvasOrdering(CanvasOrdering.SortingLayer.Popup, 0), new ControllerNoData(), profileMenuCts.Token); + await profileMenuController.HideViewAsync(CancellationToken.None); + } + catch (OperationCanceledException) + { + // Cancellations ignored + } + finally + { + if (viewInstance != null) + { + viewInstance.ProfileMenuCloserButton.onClick.RemoveListener(OnProfileMenuCloserClicked); + viewInstance.ProfileMenuCloserButton.gameObject.SetActive(false); + } + } + } + + private void OnProfileMenuCloserClicked() => + profileMenuCts?.Cancel(); + + private async UniTaskVoid FillLiveEventsAsync(CancellationToken ct) + { + Result> liveEventsResult = await eventsApiService.GetEventsAsync(ct, onlyLiveEvents: true).SuppressToResultAsync(ReportCategory.EVENTS); + + if (ct.IsCancellationRequested) + return; + + viewInstance!.SetLiveEventsCounter(liveEventsResult.Success ? liveEventsResult.Value.Count : 0); + } + } + + public readonly struct ExplorePanelParameter + { + public readonly ExploreSections Section; + public readonly BackpackSections? BackpackSection; + public readonly SettingsController.SettingsSection? SettingsSection; + + /// + /// Whether a specific section has to be opened when the explore panel is shown or not (using the default one). + /// + public readonly bool IsSectionProvided; + + public ExplorePanelParameter(ExploreSections section, BackpackSections? backpackSection = null, SettingsController.SettingsSection? settingsSection = null) + { + Section = section; + BackpackSection = backpackSection; + SettingsSection = settingsSection; + IsSectionProvided = true; + } + } +} diff --git a/Explorer/Assets/DCL/ExternalUrlPrompt/ExternalUrlPromptController.cs b/Explorer/Assets/DCL/ExternalUrlPrompt/ExternalUrlPromptController.cs index c2b9f1304b2..38cde96a64e 100644 --- a/Explorer/Assets/DCL/ExternalUrlPrompt/ExternalUrlPromptController.cs +++ b/Explorer/Assets/DCL/ExternalUrlPrompt/ExternalUrlPromptController.cs @@ -10,7 +10,7 @@ namespace DCL.ExternalUrlPrompt { public partial class ExternalUrlPromptController : ControllerBase { - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; private readonly UnityAppWebBrowser webBrowser; private readonly ICursor cursor; diff --git a/Explorer/Assets/DCL/FeatureFlags/FeaturesRegistry.cs b/Explorer/Assets/DCL/FeatureFlags/FeaturesRegistry.cs index 75b9c2b3469..3ad9e8c32bb 100644 --- a/Explorer/Assets/DCL/FeatureFlags/FeaturesRegistry.cs +++ b/Explorer/Assets/DCL/FeatureFlags/FeaturesRegistry.cs @@ -31,54 +31,54 @@ public FeaturesRegistry( SetFeatureStates(new Dictionary { - [FeatureId.CAMERA_REEL] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.CAMERA_REEL, featureFlags.IsEnabled(FeatureFlagsStrings.CAMERA_REEL) || isEditor), - [FeatureId.FRIENDS] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.FRIENDS, featureFlags.IsEnabled(FeatureFlagsStrings.FRIENDS) || isEditor) && !localSceneDevelopment, - [FeatureId.FRIENDS_USER_BLOCKING] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.FRIENDS_USER_BLOCKING, featureFlags.IsEnabled(FeatureFlagsStrings.FRIENDS_USER_BLOCKING)), - [FeatureId.FRIENDS_ONLINE_STATUS] = appArgs.HasFlag(AppArgsFlags.FRIENDS_ONLINE_STATUS) || featureFlags.IsEnabled(FeatureFlagsStrings.FRIENDS_ONLINE_STATUS), - [FeatureId.PROFILE_NAME_EDITOR] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.PROFILE_NAME_EDITOR, featureFlags.IsEnabled(FeatureFlagsStrings.PROFILE_NAME_EDITOR) || Application.isEditor), - [FeatureId.LOCAL_SCENE_DEVELOPMENT] = localSceneDevelopment, - [FeatureId.CHAT_MESSAGE_RATE_LIMIT] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.CHAT_MESSAGE_RATE_LIMIT, featureFlags.IsEnabled(FeatureFlagsStrings.CHAT_MESSAGE_RATE_LIMIT)), - [FeatureId.CHAT_MESSAGE_BUFFER] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.CHAT_MESSAGE_BUFFER, featureFlags.IsEnabled(FeatureFlagsStrings.CHAT_MESSAGE_BUFFER_CONFIG)), - [FeatureId.MARKETPLACE_CREDITS] = featureFlags.IsEnabled(FeatureFlagsStrings.MARKETPLACE_CREDITS), - [FeatureId.USER_CREDITS] = featureFlags.IsEnabled(FeatureFlagsStrings.USER_CREDITS), - [FeatureId.CREDITS_WEARABLE_PURCHASE] = featureFlags.IsEnabled(FeatureFlagsStrings.CREDITS_WEARABLE_PURCHASE), - [FeatureId.CREDITS_TOPUP] = featureFlags.IsEnabled(FeatureFlagsStrings.CREDITS_TOPUP), - [FeatureId.HEAD_SYNC] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.HEAD_SYNC, featureFlags.IsEnabled(FeatureFlagsStrings.HEAD_SYNC) || isEditor), - [FeatureId.STOP_ON_DUPLICATE_IDENTITY] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.STOP_ON_DUPLICATE_IDENTITY, featureFlags.IsEnabled(FeatureFlagsStrings.STOP_ON_DUPLICATE_IDENTITY)), - [FeatureId.PRIVATE_CHAT_REQUIRES_TOPIC] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.PRIVATE_CHAT_REQUIRES_TOPIC, featureFlags.IsEnabled(FeatureFlagsStrings.PRIVATE_CHAT_REQUIRES_TOPIC)), - [FeatureId.DONATIONS] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.DONATIONS_UI, featureFlags.IsEnabled(FeatureFlagsStrings.DONATIONS)), - [FeatureId.FORCE_BACKFACE_CULLING] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.FORCE_BACKFACE_CULLING, featureFlags.IsEnabled(FeatureFlagsStrings.FORCE_BACKFACE_CULLING), requireDebug: false), - [FeatureId.NAME_COLOR_CHANGE] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.NAME_COLOR_CHANGE, featureFlags.IsEnabled(FeatureFlagsStrings.NAME_COLOR_CHANGE) || isEditor), - [FeatureId.CHAT_TRANSLATIONS] = featureFlags.IsEnabled(FeatureFlagsStrings.CHAT_TRANSLATION_ENABLED), - [FeatureId.GIFTING_ENABLED] = featureFlags.IsEnabled(FeatureFlagsStrings.GIFTING_ENABLED), - [FeatureId.BANNED_USERS_FROM_SCENE] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.BANNED_USERS_FROM_SCENE, featureFlags.IsEnabled(FeatureFlagsStrings.BANNED_USERS_FROM_SCENE) || isEditor), - [FeatureId.BACKPACK_OUTFITS] = featureFlags.IsEnabled(FeatureFlagsStrings.OUTFITS_ENABLED), - [FeatureId.DISCOVER] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.DISCOVER, featureFlags.IsEnabled(FeatureFlagsStrings.DISCOVER) || isEditor), - [FeatureId.FRIENDS_CONNECTIVITY_STATUS] = appArgs.HasFlag(AppArgsFlags.FRIENDS_ONLINE_STATUS) || featureFlags.IsEnabled(FeatureFlagsStrings.FRIENDS_ONLINE_STATUS), - [FeatureId.COMMUNITIES_ANNOUNCEMENTS] = featureFlags.IsEnabled(FeatureFlagsStrings.COMMUNITIES_ANNOUNCEMENTS) || (appArgs.HasDebugFlag() && appArgs.HasFlag(AppArgsFlags.COMMUNITIES_ANNOUNCEMENTS)) || isEditor, - [FeatureId.COMMUNITIES_MEMBERS_COUNTER] = featureFlags.IsEnabled(FeatureFlagsStrings.COMMUNITIES_MEMBERS_COUNTER), - [FeatureId.EMAIL_OTP_AUTH] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.EMAIL_OTP_AUTH, featureFlags.IsEnabled(FeatureFlagsStrings.EMAIL_OTP_AUTH)), - [FeatureId.CHECK_DISK_SPACE] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.CHECK_DISK_SPACE, featureFlags.IsEnabled(FeatureFlagsStrings.CHECK_DISK_SPACE)), - [FeatureId.AVATAR_HIGHLIGHT] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.AVATAR_HIGHLIGHT, featureFlags.IsEnabled(FeatureFlagsStrings.AVATAR_HIGHLIGHT) || isEditor, requireDebug: false), - [FeatureId.DOUBLE_JUMP] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.DOUBLE_JUMP, featureFlags.IsEnabled(FeatureFlagsStrings.DOUBLE_JUMP) || Application.isEditor), - [FeatureId.GLIDING] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.GLIDING, featureFlags.IsEnabled(FeatureFlagsStrings.GLIDING) || Application.isEditor), - [FeatureId.SELF_PREVIEW_BUILDER_COLLECTIONS] = appArgs.HasFlag(AppArgsFlags.SELF_PREVIEW_BUILDER_COLLECTIONS), - [FeatureId.AVATAR_GHOSTS] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.AVATAR_GHOSTS, featureFlags.IsEnabled(FeatureFlagsStrings.AVATAR_GHOSTS)), - [FeatureId.REPORT_USER] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.REPORT_USER, featureFlags.IsEnabled(FeatureFlagsStrings.REPORT_USER) || Application.isEditor), - [FeatureId.POINT_AT] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.POINT_AT, featureFlags.IsEnabled(FeatureFlagsStrings.POINT_AT) || Application.isEditor), - [FeatureId.AVATAR_CONTEXT_MENU] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.AVATAR_CONTEXT_MENU, featureFlags.IsEnabled(FeatureFlagsStrings.AVATAR_CONTEXT_MENU) || Application.isEditor), - [FeatureId.DOUBLE_CLICK_WALK] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.DOUBLE_CLICK_WALK, featureFlags.IsEnabled(FeatureFlagsStrings.DOUBLE_CLICK_WALK)), - [FeatureId.PULSE] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.PULSE_MULTIPLAYER, featureFlags.IsEnabled(FeatureFlagsStrings.PULSE), requireDebug: false) && !localSceneDevelopment, - [FeatureId.AB_DEPS_DIGEST_CACHE_KEY] = featureFlags.IsEnabled(FeatureFlagsStrings.AB_DEPS_DIGEST_CACHE_KEY), - [FeatureId.BYTE_WEIGHTED_LOADING_PROGRESS] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.BYTE_WEIGHTED_LOADING_PROGRESS, featureFlags.IsEnabled(FeatureFlagsStrings.BYTE_WEIGHTED_LOADING_PROGRESS) || isEditor), - [FeatureId.HARDWARE_FINGERPRINT] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.HARDWARE_FINGERPRINT, featureFlags.IsEnabled(FeatureFlagsStrings.HARDWARE_FINGERPRINT)), + [FeatureId.CameraReel] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.CAMERA_REEL, featureFlags.IsEnabled(FeatureFlagsStrings.CAMERA_REEL) || isEditor), + [FeatureId.Friends] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.FRIENDS, featureFlags.IsEnabled(FeatureFlagsStrings.FRIENDS) || isEditor) && !localSceneDevelopment, + [FeatureId.FriendsUserBlocking] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.FRIENDS_USER_BLOCKING, featureFlags.IsEnabled(FeatureFlagsStrings.FRIENDS_USER_BLOCKING)), + [FeatureId.FriendsOnlineStatus] = appArgs.HasFlag(AppArgsFlags.FRIENDS_ONLINE_STATUS) || featureFlags.IsEnabled(FeatureFlagsStrings.FRIENDS_ONLINE_STATUS), + [FeatureId.ProfileNameEditor] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.PROFILE_NAME_EDITOR, featureFlags.IsEnabled(FeatureFlagsStrings.PROFILE_NAME_EDITOR) || Application.isEditor), + [FeatureId.LocalSceneDevelopment] = localSceneDevelopment, + [FeatureId.ChatMessageRateLimit] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.CHAT_MESSAGE_RATE_LIMIT, featureFlags.IsEnabled(FeatureFlagsStrings.CHAT_MESSAGE_RATE_LIMIT)), + [FeatureId.ChatMessageBuffer] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.CHAT_MESSAGE_BUFFER, featureFlags.IsEnabled(FeatureFlagsStrings.CHAT_MESSAGE_BUFFER_CONFIG)), + [FeatureId.MarketplaceCredits] = featureFlags.IsEnabled(FeatureFlagsStrings.MARKETPLACE_CREDITS), + [FeatureId.UserCredits] = featureFlags.IsEnabled(FeatureFlagsStrings.USER_CREDITS), + [FeatureId.CreditsWearablePurchase] = featureFlags.IsEnabled(FeatureFlagsStrings.CREDITS_WEARABLE_PURCHASE), + [FeatureId.CreditsTopup] = featureFlags.IsEnabled(FeatureFlagsStrings.CREDITS_TOPUP), + [FeatureId.HeadSync] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.HEAD_SYNC, featureFlags.IsEnabled(FeatureFlagsStrings.HEAD_SYNC) || isEditor), + [FeatureId.StopOnDuplicateIdentity] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.STOP_ON_DUPLICATE_IDENTITY, featureFlags.IsEnabled(FeatureFlagsStrings.STOP_ON_DUPLICATE_IDENTITY)), + [FeatureId.PrivateChatRequiresTopic] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.PRIVATE_CHAT_REQUIRES_TOPIC, featureFlags.IsEnabled(FeatureFlagsStrings.PRIVATE_CHAT_REQUIRES_TOPIC)), + [FeatureId.Donations] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.DONATIONS_UI, featureFlags.IsEnabled(FeatureFlagsStrings.DONATIONS)), + [FeatureId.ForceBackfaceCulling] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.FORCE_BACKFACE_CULLING, featureFlags.IsEnabled(FeatureFlagsStrings.FORCE_BACKFACE_CULLING), requireDebug: false), + [FeatureId.NameColorChange] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.NAME_COLOR_CHANGE, featureFlags.IsEnabled(FeatureFlagsStrings.NAME_COLOR_CHANGE) || isEditor), + [FeatureId.ChatTranslations] = featureFlags.IsEnabled(FeatureFlagsStrings.CHAT_TRANSLATION_ENABLED), + [FeatureId.GiftingEnabled] = featureFlags.IsEnabled(FeatureFlagsStrings.GIFTING_ENABLED), + [FeatureId.BannedUsersFromScene] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.BANNED_USERS_FROM_SCENE, featureFlags.IsEnabled(FeatureFlagsStrings.BANNED_USERS_FROM_SCENE) || isEditor), + [FeatureId.BackpackOutfits] = featureFlags.IsEnabled(FeatureFlagsStrings.OUTFITS_ENABLED), + [FeatureId.Discover] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.DISCOVER, featureFlags.IsEnabled(FeatureFlagsStrings.DISCOVER) || isEditor), + [FeatureId.FriendsConnectivityStatus] = appArgs.HasFlag(AppArgsFlags.FRIENDS_ONLINE_STATUS) || featureFlags.IsEnabled(FeatureFlagsStrings.FRIENDS_ONLINE_STATUS), + [FeatureId.CommunitiesAnnouncements] = featureFlags.IsEnabled(FeatureFlagsStrings.COMMUNITIES_ANNOUNCEMENTS) || (appArgs.HasDebugFlag() && appArgs.HasFlag(AppArgsFlags.COMMUNITIES_ANNOUNCEMENTS)) || isEditor, + [FeatureId.CommunitiesMembersCounter] = featureFlags.IsEnabled(FeatureFlagsStrings.COMMUNITIES_MEMBERS_COUNTER), + [FeatureId.EmailOTPAuth] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.EMAIL_OTP_AUTH, featureFlags.IsEnabled(FeatureFlagsStrings.EMAIL_OTP_AUTH)), + [FeatureId.CheckDiskSpace] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.CHECK_DISK_SPACE, featureFlags.IsEnabled(FeatureFlagsStrings.CHECK_DISK_SPACE)), + [FeatureId.AvatarHighlight] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.AVATAR_HIGHLIGHT, featureFlags.IsEnabled(FeatureFlagsStrings.AVATAR_HIGHLIGHT) || isEditor, requireDebug: false), + [FeatureId.DoubleJump] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.DOUBLE_JUMP, featureFlags.IsEnabled(FeatureFlagsStrings.DOUBLE_JUMP) || Application.isEditor), + [FeatureId.Gliding] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.GLIDING, featureFlags.IsEnabled(FeatureFlagsStrings.GLIDING) || Application.isEditor), + [FeatureId.SelfPreviewBuilderCollections] = appArgs.HasFlag(AppArgsFlags.SELF_PREVIEW_BUILDER_COLLECTIONS), + [FeatureId.AvatarGhosts] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.AVATAR_GHOSTS, featureFlags.IsEnabled(FeatureFlagsStrings.AVATAR_GHOSTS)), + [FeatureId.ReportUser] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.REPORT_USER, featureFlags.IsEnabled(FeatureFlagsStrings.REPORT_USER) || Application.isEditor), + [FeatureId.PointAt] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.POINT_AT, featureFlags.IsEnabled(FeatureFlagsStrings.POINT_AT) || Application.isEditor), + [FeatureId.AvatarContextMenu] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.AVATAR_CONTEXT_MENU, featureFlags.IsEnabled(FeatureFlagsStrings.AVATAR_CONTEXT_MENU) || Application.isEditor), + [FeatureId.DoubleClickWalk] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.DOUBLE_CLICK_WALK, featureFlags.IsEnabled(FeatureFlagsStrings.DOUBLE_CLICK_WALK)), + [FeatureId.Pulse] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.PULSE_MULTIPLAYER, featureFlags.IsEnabled(FeatureFlagsStrings.PULSE), requireDebug: false) && !localSceneDevelopment, + [FeatureId.ABDepsDigestCacheKey] = featureFlags.IsEnabled(FeatureFlagsStrings.AB_DEPS_DIGEST_CACHE_KEY), + [FeatureId.ByteWeightedLoadingProgress] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.BYTE_WEIGHTED_LOADING_PROGRESS, featureFlags.IsEnabled(FeatureFlagsStrings.BYTE_WEIGHTED_LOADING_PROGRESS) || isEditor), + [FeatureId.HardwareFingerprint] = appArgs.ResolveFeatureFlagArg(AppArgsFlags.HARDWARE_FINGERPRINT, featureFlags.IsEnabled(FeatureFlagsStrings.HARDWARE_FINGERPRINT)), // Note: COMMUNITIES feature is not cached here because it depends on user identity }); //We need to set FRIENDS AND USER BLOCKING before setting VOICE CHAT that depends on them. - SetFeatureState(FeatureId.VOICE_CHAT, IsEnabled(FeatureId.FRIENDS) && IsEnabled(FeatureId.FRIENDS_USER_BLOCKING) && (isEditor || featureFlags.IsEnabled(FeatureFlagsStrings.VOICE_CHAT) || (appArgs.HasDebugFlag() && appArgs.HasFlag(AppArgsFlags.VOICE_CHAT)))); - SetFeatureState(FeatureId.COMMUNITY_VOICE_CHAT, IsEnabled(FeatureId.VOICE_CHAT)); - SetFeatureState(FeatureId.NEARBY_VOICE_CHAT, IsEnabled(FeatureId.VOICE_CHAT) && appArgs.ResolveFeatureFlagArg(AppArgsFlags.NEARBY_VOICE_CHAT, featureFlags.IsEnabled(FeatureFlagsStrings.NEARBY_VOICE_CHAT) || Application.isEditor)); + SetFeatureState(FeatureId.VoiceChat, IsEnabled(FeatureId.Friends) && IsEnabled(FeatureId.FriendsUserBlocking) && (isEditor || featureFlags.IsEnabled(FeatureFlagsStrings.VOICE_CHAT) || (appArgs.HasDebugFlag() && appArgs.HasFlag(AppArgsFlags.VOICE_CHAT)))); + SetFeatureState(FeatureId.CommunityVoiceChat, IsEnabled(FeatureId.VoiceChat)); + SetFeatureState(FeatureId.NearbyVoiceChat, IsEnabled(FeatureId.VoiceChat) && appArgs.ResolveFeatureFlagArg(AppArgsFlags.NEARBY_VOICE_CHAT, featureFlags.IsEnabled(FeatureFlagsStrings.NEARBY_VOICE_CHAT) || Application.isEditor)); } /// @@ -140,74 +140,74 @@ public enum FeatureId // Numbered because we use these to selectively enable settings, // this way we avoid breaking that if we ever change the order here. None = 0, - VOICE_CHAT = 1, - COMMUNITY_VOICE_CHAT = 2, - FRIENDS = 3, - FRIENDS_USER_BLOCKING = 4, - FRIENDS_ONLINE_STATUS = 5, - PROFILE_NAME_EDITOR = 6, - LOCAL_SCENE_DEVELOPMENT = 7, - CAMERA_REEL = 8, - MULTIPLAYER_COMPRESSION_WIN = 9, - MULTIPLAYER_COMPRESSION_MAC = 10, - PORTABLE_EXPERIENCE = 11, - GLOBAL_PORTABLE_EXPERIENCE = 12, - PORTABLE_EXPERIENCE_CHAT_COMMANDS = 13, - MAP_PINS = 14, - CUSTOM_MAP_PINS_ICONS = 15, - USER_ALLOW_LIST = 16, - CSV_VARIANT = 17, - STRING_VARIANT = 18, - WALLETS_VARIANT = 19, - ONBOARDING = 20, - GREETING_ONBOARDING = 21, - ONBOARDING_ENABLED_VARIANT = 22, - ONBOARDING_GREETINGS_VARIANT = 23, - GENESIS_STARTING_PARCEL = 24, - VIDEO_PRIORITIZATION = 25, - ASSET_BUNDLE_FALLBACK = 26, - CHAT_HISTORY_LOCAL_STORAGE = 27, - SCENE_MEMORY_LIMIT = 28, - KTX2_CONVERSION = 29, - MARKETPLACE_CREDITS = 30, - MARKETPLACE_CREDITS_WALLETS_VARIANT = 31, - COMMUNITIES = 32, - COMMUNITIES_MEMBERS_COUNTER = 33, - AUTH_CODE_VALIDATION = 34, - GPUI_ENABLED = 35, - GIFTING_ENABLED = 36, - CHAT_MESSAGE_RATE_LIMIT = 37, - CHAT_MESSAGE_BUFFER = 38, - HEAD_SYNC = 39, - STOP_ON_DUPLICATE_IDENTITY = 40, - PRIVATE_CHAT_REQUIRES_TOPIC = 41, - DONATIONS = 42, - FORCE_BACKFACE_CULLING = 43, - NAME_COLOR_CHANGE = 44, - EMAIL_OTP_AUTH = 45, - CHECK_DISK_SPACE = 46, - DISCOVER = 47, - AVATAR_HIGHLIGHT = 48, - DOUBLE_JUMP = 49, - GLIDING = 50, - AVATAR_GHOSTS = 51, - REPORT_USER = 52, - POINT_AT = 53, - CHAT_TRANSLATIONS = 54, - BANNED_USERS_FROM_SCENE = 55, - BACKPACK_OUTFITS = 56, - FRIENDS_CONNECTIVITY_STATUS = 57, - COMMUNITIES_ANNOUNCEMENTS = 58, - SELF_PREVIEW_BUILDER_COLLECTIONS = 59, - AVATAR_CONTEXT_MENU = 60, - DOUBLE_CLICK_WALK = 61, - NEARBY_VOICE_CHAT = 62, - AB_DEPS_DIGEST_CACHE_KEY = 63, - BYTE_WEIGHTED_LOADING_PROGRESS = 64, - PULSE = 65, - HARDWARE_FINGERPRINT = 66, - USER_CREDITS = 67, - CREDITS_WEARABLE_PURCHASE = 68, - CREDITS_TOPUP = 69, + VoiceChat = 1, + CommunityVoiceChat = 2, + Friends = 3, + FriendsUserBlocking = 4, + FriendsOnlineStatus = 5, + ProfileNameEditor = 6, + LocalSceneDevelopment = 7, + CameraReel = 8, + MultiplayerCompressionWin = 9, + MultiplayerCompressionMac = 10, + PortableExperience = 11, + GlobalPortableExperience = 12, + PortableExperienceChatCommands = 13, + MapPins = 14, + CustomMapPinsIcons = 15, + UserAllowList = 16, + CsvVariant = 17, + StringVariant = 18, + WalletsVariant = 19, + Onboarding = 20, + GreetingOnboarding = 21, + OnboardingEnabledVariant = 22, + OnboardingGreetingsVariant = 23, + GenesisStartingParcel = 24, + VideoPrioritization = 25, + AssetBundleFallback = 26, + ChatHistoryLocalStorage = 27, + SceneMemoryLimit = 28, + KTX2Conversion = 29, + MarketplaceCredits = 30, + MarketplaceCreditsWalletsVariant = 31, + Communities = 32, + CommunitiesMembersCounter = 33, + AuthCodeValidation = 34, + GpuiEnabled = 35, + GiftingEnabled = 36, + ChatMessageRateLimit = 37, + ChatMessageBuffer = 38, + HeadSync = 39, + StopOnDuplicateIdentity = 40, + PrivateChatRequiresTopic = 41, + Donations = 42, + ForceBackfaceCulling = 43, + NameColorChange = 44, + EmailOTPAuth = 45, + CheckDiskSpace = 46, + Discover = 47, + AvatarHighlight = 48, + DoubleJump = 49, + Gliding = 50, + AvatarGhosts = 51, + ReportUser = 52, + PointAt = 53, + ChatTranslations = 54, + BannedUsersFromScene = 55, + BackpackOutfits = 56, + FriendsConnectivityStatus = 57, + CommunitiesAnnouncements = 58, + SelfPreviewBuilderCollections = 59, + AvatarContextMenu = 60, + DoubleClickWalk = 61, + NearbyVoiceChat = 62, + ABDepsDigestCacheKey = 63, + ByteWeightedLoadingProgress = 64, + Pulse = 65, + HardwareFingerprint = 66, + UserCredits = 67, + CreditsWearablePurchase = 68, + CreditsTopup = 69, } } diff --git a/Explorer/Assets/DCL/Friends/FriendsConnectivityStatusTracker.cs b/Explorer/Assets/DCL/Friends/FriendsConnectivityStatusTracker.cs index a726ceca536..64388a17568 100644 --- a/Explorer/Assets/DCL/Friends/FriendsConnectivityStatusTracker.cs +++ b/Explorer/Assets/DCL/Friends/FriendsConnectivityStatusTracker.cs @@ -85,7 +85,7 @@ private void FriendRemoved(string userid) } public OnlineStatus GetFriendStatus(string friendAddress) => - friendsOnlineStatus.GetValueOrDefault(friendAddress, OnlineStatus.OFFLINE); + friendsOnlineStatus.GetValueOrDefault(friendAddress, OnlineStatus.Offline); private bool FriendOnlineStatusChanged(Profile.CompactInfo friendProfile, OnlineStatus onlineStatus) { @@ -97,13 +97,13 @@ private bool FriendOnlineStatusChanged(Profile.CompactInfo friendProfile, Online } private void FriendBecameOnline(Profile.CompactInfo friendProfile) => - DebounceStatusChange(friendProfile, OnlineStatus.ONLINE, () => OnFriendBecameOnline?.Invoke(friendProfile)); + DebounceStatusChange(friendProfile, OnlineStatus.Online, () => OnFriendBecameOnline?.Invoke(friendProfile)); private void FriendBecameAway(Profile.CompactInfo friendProfile) => - DebounceStatusChange(friendProfile, OnlineStatus.AWAY, () => OnFriendBecameAway?.Invoke(friendProfile)); + DebounceStatusChange(friendProfile, OnlineStatus.Away, () => OnFriendBecameAway?.Invoke(friendProfile)); private void FriendBecameOffline(Profile.CompactInfo friendProfile) => - DebounceStatusChange(friendProfile, OnlineStatus.OFFLINE, () => OnFriendBecameOffline?.Invoke(friendProfile)); + DebounceStatusChange(friendProfile, OnlineStatus.Offline, () => OnFriendBecameOffline?.Invoke(friendProfile)); private void DebounceStatusChange(Profile.CompactInfo friendProfile, OnlineStatus newStatus, Action onStatusChange) { diff --git a/Explorer/Assets/DCL/Friends/FriendshipStatus.cs b/Explorer/Assets/DCL/Friends/FriendshipStatus.cs index 266ca0f0d8a..9a3dbd0151d 100644 --- a/Explorer/Assets/DCL/Friends/FriendshipStatus.cs +++ b/Explorer/Assets/DCL/Friends/FriendshipStatus.cs @@ -2,11 +2,11 @@ namespace DCL.Friends { public enum FriendshipStatus { - NONE, - FRIEND, - REQUEST_SENT, - REQUEST_RECEIVED, - BLOCKED, - BLOCKED_BY, + None, + Friend, + RequestSent, + RequestReceived, + Blocked, + BlockedBy, } } diff --git a/Explorer/Assets/DCL/Friends/RPCFriendsService.cs b/Explorer/Assets/DCL/Friends/RPCFriendsService.cs index 571b37b4c98..2aa73905317 100644 --- a/Explorer/Assets/DCL/Friends/RPCFriendsService.cs +++ b/Explorer/Assets/DCL/Friends/RPCFriendsService.cs @@ -341,21 +341,21 @@ public async UniTask GetFriendshipStatusAsync(string userId, C switch (response.Accepted.Status) { case Decentraland.SocialService.V2.FriendshipStatus.Accepted: - return FriendshipStatus.FRIEND; + return FriendshipStatus.Friend; case Decentraland.SocialService.V2.FriendshipStatus.Blocked: - return FriendshipStatus.BLOCKED; + return FriendshipStatus.Blocked; case Decentraland.SocialService.V2.FriendshipStatus.RequestReceived: - return FriendshipStatus.REQUEST_RECEIVED; + return FriendshipStatus.RequestReceived; case Decentraland.SocialService.V2.FriendshipStatus.RequestSent: - return FriendshipStatus.REQUEST_SENT; + return FriendshipStatus.RequestSent; case Decentraland.SocialService.V2.FriendshipStatus.BlockedBy: - return FriendshipStatus.BLOCKED_BY; + return FriendshipStatus.BlockedBy; } break; } - return FriendshipStatus.NONE; + return FriendshipStatus.None; } public async UniTask GetReceivedFriendRequestsAsync(int pageNum, int pageSize, diff --git a/Explorer/Assets/DCL/Friends/Tests/FriendsConnectivityStatusTrackerShould.cs b/Explorer/Assets/DCL/Friends/Tests/FriendsConnectivityStatusTrackerShould.cs index 784100b0cc5..4d2e3b5cb4a 100644 --- a/Explorer/Assets/DCL/Friends/Tests/FriendsConnectivityStatusTrackerShould.cs +++ b/Explorer/Assets/DCL/Friends/Tests/FriendsConnectivityStatusTrackerShould.cs @@ -57,7 +57,7 @@ public async Task RaiseOnlineEventWhenSameStatusIsRebroadcastAfterReset() //Assert Assert.AreEqual(2, onlineEventsCount); - Assert.AreEqual(OnlineStatus.ONLINE, tracker.GetFriendStatus(friendProfile.UserId)); + Assert.AreEqual(OnlineStatus.Online, tracker.GetFriendStatus(friendProfile.UserId)); } [Test] @@ -67,13 +67,13 @@ public async Task ReportFriendAsOfflineAfterReset() var friendProfile = new Profile.CompactInfo(FRIEND_ID, "TestFriend"); eventBus.BroadcastFriendConnected(friendProfile); await UniTask.Delay(DEBOUNCE_WAIT_MS); - Assert.AreEqual(OnlineStatus.ONLINE, tracker.GetFriendStatus(friendProfile.UserId)); + Assert.AreEqual(OnlineStatus.Online, tracker.GetFriendStatus(friendProfile.UserId)); //Act tracker.Reset(); //Assert - Assert.AreEqual(OnlineStatus.OFFLINE, tracker.GetFriendStatus(friendProfile.UserId)); + Assert.AreEqual(OnlineStatus.Offline, tracker.GetFriendStatus(friendProfile.UserId)); } [Test] @@ -91,7 +91,7 @@ public async Task CancelPendingDebounceOnReset() //Assert Assert.AreEqual(0, onlineEventsCount); - Assert.AreEqual(OnlineStatus.OFFLINE, tracker.GetFriendStatus(friendProfile.UserId)); + Assert.AreEqual(OnlineStatus.Offline, tracker.GetFriendStatus(friendProfile.UserId)); } } } diff --git a/Explorer/Assets/DCL/Friends/UI/BlockUserPrompt/BlockUserPromptController.cs b/Explorer/Assets/DCL/Friends/UI/BlockUserPrompt/BlockUserPromptController.cs index 6abe8f0e74f..08c188f018a 100644 --- a/Explorer/Assets/DCL/Friends/UI/BlockUserPrompt/BlockUserPromptController.cs +++ b/Explorer/Assets/DCL/Friends/UI/BlockUserPrompt/BlockUserPromptController.cs @@ -21,7 +21,7 @@ public class BlockUserPromptController : ControllerBase CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; public BlockUserPromptController(ViewFactoryMethod viewFactory, IFriendsService friendsService) diff --git a/Explorer/Assets/DCL/Friends/UI/BlockUserPrompt/BlockUserPromptParams.cs b/Explorer/Assets/DCL/Friends/UI/BlockUserPrompt/BlockUserPromptParams.cs index cef668ad062..13a787f8b0a 100644 --- a/Explorer/Assets/DCL/Friends/UI/BlockUserPrompt/BlockUserPromptParams.cs +++ b/Explorer/Assets/DCL/Friends/UI/BlockUserPrompt/BlockUserPromptParams.cs @@ -17,8 +17,8 @@ public BlockUserPromptParams(Web3Address targetUserId, string targetUserName, Us public enum UserBlockAction { - BLOCK, - UNBLOCK + Block, + Unblock } } } diff --git a/Explorer/Assets/DCL/Friends/UI/BlockUserPrompt/BlockUserPromptView.cs b/Explorer/Assets/DCL/Friends/UI/BlockUserPrompt/BlockUserPromptView.cs index 7dfaf05f385..a19a704b5d0 100644 --- a/Explorer/Assets/DCL/Friends/UI/BlockUserPrompt/BlockUserPromptView.cs +++ b/Explorer/Assets/DCL/Friends/UI/BlockUserPrompt/BlockUserPromptView.cs @@ -23,13 +23,13 @@ public class BlockUserPromptView : ViewBase, IView internal void SetTitle(BlockUserPromptParams.UserBlockAction blockAction, string userName) { - string format = blockAction == BlockUserPromptParams.UserBlockAction.BLOCK ? TITLE_BLOCK_FORMAT : TITLE_UNBLOCK_FORMAT; + string format = blockAction == BlockUserPromptParams.UserBlockAction.Block ? TITLE_BLOCK_FORMAT : TITLE_UNBLOCK_FORMAT; TitleText.text = string.Format(format, userName); } internal void ConfigureButtons(BlockUserPromptParams.UserBlockAction blockAction) { - bool isBlock = blockAction == BlockUserPromptParams.UserBlockAction.BLOCK; + bool isBlock = blockAction == BlockUserPromptParams.UserBlockAction.Block; BlockButton.gameObject.SetActive(isBlock); BlockImage.gameObject.SetActive(isBlock); BlockText.gameObject.SetActive(isBlock); diff --git a/Explorer/Assets/DCL/Friends/UI/FriendPanel/FriendsPanelController.cs b/Explorer/Assets/DCL/Friends/UI/FriendPanel/FriendsPanelController.cs index 2b38c7fbb7e..548aa52ff37 100644 --- a/Explorer/Assets/DCL/Friends/UI/FriendPanel/FriendsPanelController.cs +++ b/Explorer/Assets/DCL/Friends/UI/FriendPanel/FriendsPanelController.cs @@ -26,9 +26,9 @@ public class FriendsPanelController : ControllerBase CanvasOrdering.SortingLayer.FULLSCREEN; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Fullscreen; public event Action? FriendsPanelOpened; public event Action? OnlineFriendClicked; @@ -69,7 +69,7 @@ public FriendsPanelController(ViewFactoryMethod viewFactory, { this.sidebarRequestNotificationIndicator = sidebarRequestNotificationIndicator; - bool isConnectivityStatusEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.FRIENDS_CONNECTIVITY_STATUS); + bool isConnectivityStatusEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.FriendsConnectivityStatus); if (isConnectivityStatusEnabled) { friendSectionControllerConnectivity = new FriendsSectionDoubleCollectionController( @@ -110,7 +110,7 @@ public FriendsPanelController(ViewFactoryMethod viewFactory, mvcManager, new RequestsRequestManager(friendsService, friendEventBus, profileDataProvider, FRIENDS_REQUEST_PAGE_SIZE, instantiatedView.RequestsSection.LoopList), passportBridge, - FeaturesRegistry.Instance.IsEnabled(FeatureId.FRIENDS_USER_BLOCKING), + FeaturesRegistry.Instance.IsEnabled(FeatureId.FriendsUserBlocking), webBrowser, decentralandUrlsSource, selfProfile); @@ -189,25 +189,25 @@ protected override void OnViewInstantiated() viewInstance.CloseButton.onClick.AddListener(CloseFriendsPanel); viewInstance.BackgroundCloseButton.onClick.AddListener(CloseFriendsPanel); - bool isUserBlockingFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.FRIENDS_USER_BLOCKING); + bool isUserBlockingFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.FriendsUserBlocking); viewInstance.BlockedTabButton.gameObject.SetActive(isUserBlockingFeatureEnabled); - ToggleTabs(FriendsPanelTab.FRIENDS); + ToggleTabs(FriendsPanelTab.Friends); } - private void OnFriendsTabButtonClicked() => ToggleTabs(FriendsPanelTab.FRIENDS); - private void OnRequestsTabButtonClicked() => ToggleTabs(FriendsPanelTab.REQUESTS); - private void OnBlockedTabButtonClicked() => ToggleTabs(FriendsPanelTab.BLOCKED); + private void OnFriendsTabButtonClicked() => ToggleTabs(FriendsPanelTab.Friends); + private void OnRequestsTabButtonClicked() => ToggleTabs(FriendsPanelTab.Requests); + private void OnBlockedTabButtonClicked() => ToggleTabs(FriendsPanelTab.Blocked); public void CloseFriendsPanel() => closeTaskCompletionSource.TrySetResult(); private void FriendRequestCountChanged(int count) => sidebarRequestNotificationIndicator.SetNotificationCount(count); internal void ToggleTabs(FriendsPanelTab tab) { - viewInstance!.FriendsTabSelected.SetActive(tab == FriendsPanelTab.FRIENDS); - viewInstance.FriendsSection.SetActive(tab == FriendsPanelTab.FRIENDS); - viewInstance.RequestsTabSelected.SetActive(tab == FriendsPanelTab.REQUESTS); - viewInstance.RequestsSection.SetActive(tab == FriendsPanelTab.REQUESTS); - viewInstance.BlockedTabSelected.SetActive(tab == FriendsPanelTab.BLOCKED); - viewInstance.BlockedSection.SetActive(tab == FriendsPanelTab.BLOCKED); + viewInstance!.FriendsTabSelected.SetActive(tab == FriendsPanelTab.Friends); + viewInstance.FriendsSection.SetActive(tab == FriendsPanelTab.Friends); + viewInstance.RequestsTabSelected.SetActive(tab == FriendsPanelTab.Requests); + viewInstance.RequestsSection.SetActive(tab == FriendsPanelTab.Requests); + viewInstance.BlockedTabSelected.SetActive(tab == FriendsPanelTab.Blocked); + viewInstance.BlockedSection.SetActive(tab == FriendsPanelTab.Blocked); } protected override async UniTask WaitForCloseIntentAsync(CancellationToken ct) => diff --git a/Explorer/Assets/DCL/Friends/UI/FriendPanel/PersistentFriendPanelOpenerController.cs b/Explorer/Assets/DCL/Friends/UI/FriendPanel/PersistentFriendPanelOpenerController.cs index 34f5a2d8bbd..b027d437f16 100644 --- a/Explorer/Assets/DCL/Friends/UI/FriendPanel/PersistentFriendPanelOpenerController.cs +++ b/Explorer/Assets/DCL/Friends/UI/FriendPanel/PersistentFriendPanelOpenerController.cs @@ -25,7 +25,7 @@ public class PersistentFriendPanelOpenerController : ControllerBase CanvasOrdering.SortingLayer.PERSISTENT; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Persistent; public event Action? FriendshipNotificationClicked; @@ -85,13 +85,13 @@ async UniTaskVoid ManageFriendRequestReceivedNotificationAsync(FriendRequestRece switch (friendshipStatus) { - case FriendshipStatus.FRIEND: + case FriendshipStatus.Friend: if (friendsPanelController.State != ControllerState.ViewHidden) - friendsPanelController.ToggleTabs(FriendsPanelController.FriendsPanelTab.FRIENDS); + friendsPanelController.ToggleTabs(FriendsPanelController.FriendsPanelTab.Friends); else - mvcManager.ShowAndForget(FriendsPanelController.IssueCommand(new FriendsPanelParameter(FriendsPanelController.FriendsPanelTab.FRIENDS)), ct); + mvcManager.ShowAndForget(FriendsPanelController.IssueCommand(new FriendsPanelParameter(FriendsPanelController.FriendsPanelTab.Friends)), ct); break; - case FriendshipStatus.REQUEST_RECEIVED: + case FriendshipStatus.RequestReceived: mvcManager.ShowAsync(FriendRequestController.IssueCommand(new FriendRequestParams { Request = new FriendRequest( diff --git a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Blocked/BlockedSectionController.cs b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Blocked/BlockedSectionController.cs index 132e5cc006e..9efd0e9e701 100644 --- a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Blocked/BlockedSectionController.cs +++ b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Blocked/BlockedSectionController.cs @@ -63,14 +63,14 @@ private void HideEmptyState() } private void UnblockUserClicked(BlockedProfile profile) => - mvcManager.ShowAsync(BlockUserPromptController.IssueCommand(new BlockUserPromptParams(profile.Address, profile.Profile.Name, BlockUserPromptParams.UserBlockAction.UNBLOCK))).Forget(); + mvcManager.ShowAsync(BlockUserPromptController.IssueCommand(new BlockUserPromptParams(profile.Address, profile.Profile.Name, BlockUserPromptParams.UserBlockAction.Unblock))).Forget(); private void ContextMenuClicked(BlockedProfile friendProfile, Vector2 buttonPosition, BlockedUserView elementView) { lastClickedProfileCtx = friendProfile; userProfileContextMenuControlSettings.SetInitialData(friendProfile, - UserProfileContextMenuControlSettings.FriendshipStatus.DISABLED); + UserProfileContextMenuControlSettings.FriendshipStatus.Disabled); elementView.CanUnHover = false; mvcManager.ShowAsync(GenericContextMenuController.IssueCommand(new GenericContextMenuParameter(contextMenu, buttonPosition, actionOnHide: () => elementView.CanUnHover = true, diff --git a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Friends/FriendListPagedDoubleCollectionRequestManager.cs b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Friends/FriendListPagedDoubleCollectionRequestManager.cs index f2633f7894a..b0ff05d35c4 100644 --- a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Friends/FriendListPagedDoubleCollectionRequestManager.cs +++ b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Friends/FriendListPagedDoubleCollectionRequestManager.cs @@ -38,7 +38,7 @@ public FriendListPagedDoubleCollectionRequestManager(IFriendsService friendsServ ProfileRepositoryWrapper profileDataProvider, int pageSize, int elementsMissingThreshold - ) : base(friendsService, friendEventBus, profileDataProvider, loopListView, pageSize, elementsMissingThreshold, FriendPanelStatus.ONLINE, FriendPanelStatus.OFFLINE, STATUS_ELEMENT_INDEX, EMPTY_ELEMENT_INDEX, USER_ELEMENT_INDEX) + ) : base(friendsService, friendEventBus, profileDataProvider, loopListView, pageSize, elementsMissingThreshold, FriendPanelStatus.Online, FriendPanelStatus.Offline, STATUS_ELEMENT_INDEX, EMPTY_ELEMENT_INDEX, USER_ELEMENT_INDEX) { this.profileRepository = profileRepository; this.friendsConnectivityStatusTracker = friendsConnectivityStatusTracker; @@ -76,7 +76,7 @@ private void AddNewFriendProfile(Profile.CompactInfo friendProfile, OnlineStatus { int previousTotalCount = offlineFriends.Count + onlineFriends.Count; - if (onlineStatus == OnlineStatus.OFFLINE) + if (onlineStatus == OnlineStatus.Offline) { offlineFriends.Add(friendProfile); FriendsSorter.SortFriendList(offlineFriends); @@ -96,7 +96,7 @@ private void FriendBecameOnline(Profile.CompactInfo friendProfile) offlineFriends.Remove(friendProfile); if (!onlineFriends.Contains(friendProfile)) - AddNewFriendProfile(friendProfile, OnlineStatus.ONLINE); + AddNewFriendProfile(friendProfile, OnlineStatus.Online); RefreshLoopList(); } @@ -106,7 +106,7 @@ private void FriendBecameAway(Profile.CompactInfo friendProfile) offlineFriends.Remove(friendProfile); if (!onlineFriends.Contains(friendProfile)) - AddNewFriendProfile(friendProfile, OnlineStatus.AWAY); + AddNewFriendProfile(friendProfile, OnlineStatus.Away); RefreshLoopList(); } @@ -116,7 +116,7 @@ private void FriendBecameOffline(Profile.CompactInfo friendProfile) onlineFriends.Remove(friendProfile); if (!offlineFriends.Contains(friendProfile)) - AddNewFriendProfile(friendProfile, OnlineStatus.OFFLINE); + AddNewFriendProfile(friendProfile, OnlineStatus.Offline); RefreshLoopList(); } diff --git a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Friends/FriendListSectionUtilities.cs b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Friends/FriendListSectionUtilities.cs index 7d16acd4f5e..b696871864e 100644 --- a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Friends/FriendListSectionUtilities.cs +++ b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Friends/FriendListSectionUtilities.cs @@ -71,7 +71,7 @@ async UniTaskVoid JumpToFriendLocationAsync(CancellationToken ct = default) } public static void BlockUserClicked(IMVCManager mvcManager, Web3Address targetUserAddress, string targetUserName) => - mvcManager.ShowAsync(BlockUserPromptController.IssueCommand(new BlockUserPromptParams(targetUserAddress, targetUserName, BlockUserPromptParams.UserBlockAction.BLOCK))).Forget(); + mvcManager.ShowAsync(BlockUserPromptController.IssueCommand(new BlockUserPromptParams(targetUserAddress, targetUserName, BlockUserPromptParams.UserBlockAction.Block))).Forget(); internal static void OpenProfilePassport(Profile.CompactInfo profile, IPassportBridge passportBridge) => passportBridge.ShowAsync(profile.Address).Forget(); diff --git a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Friends/FriendListUserView.cs b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Friends/FriendListUserView.cs index 7fc42a97247..fbc89678b1f 100644 --- a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Friends/FriendListUserView.cs +++ b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Friends/FriendListUserView.cs @@ -28,7 +28,7 @@ public override void Configure(Profile.CompactInfo profile, ProfileRepositoryWra buttons.Add(ContextMenuButton); buttons.Add(ChatButton); base.Configure(profile, profileDataProvider); - SetOnlineStatus(OnlineStatus.OFFLINE); + SetOnlineStatus(OnlineStatus.Offline); } public void SetOnlineStatus(OnlineStatus onlineStatus) @@ -41,7 +41,7 @@ public void SetOnlineStatus(OnlineStatus onlineStatus) buttons.Add(ContextMenuButton); buttons.Add(ChatButton); - if (onlineStatus != OnlineStatus.OFFLINE) + if (onlineStatus != OnlineStatus.Offline) buttons.Add(JumpInButton); } diff --git a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Friends/FriendSectionController.cs b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Friends/FriendSectionController.cs index 5cd55e1f4cf..6bf5c91a41d 100644 --- a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Friends/FriendSectionController.cs +++ b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Friends/FriendSectionController.cs @@ -62,7 +62,7 @@ private void ContextMenuClicked(Profile.CompactInfo friendProfile, Vector2 butto UniTask menuTask = UniTask.WhenAny(panelLifecycleTask!.Task, contextMenuTask.Task); ViewDependencies.GlobalUIViews.ShowUserProfileContextMenuFromWalletIdAsync(new Web3Address(friendProfile.UserId), buttonPosition, default(Vector2), - popupCts.Token, menuTask, onHide: () => elementView.CanUnHover = true, anchorPoint: MenuAnchorPoint.TOP_RIGHT).Forget(); + popupCts.Token, menuTask, onHide: () => elementView.CanUnHover = true, anchorPoint: MenuAnchorPoint.TopRight).Forget(); } private void JumpInClicked(Profile.CompactInfo profile) => diff --git a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Friends/FriendsSectionDoubleCollectionController.cs b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Friends/FriendsSectionDoubleCollectionController.cs index c39baa0c56d..d52502e94b4 100644 --- a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Friends/FriendsSectionDoubleCollectionController.cs +++ b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Friends/FriendsSectionDoubleCollectionController.cs @@ -102,7 +102,7 @@ private async UniTaskVoid WaitAndOpenPassportAsync(Profile.CompactInfo profile, { elementClicked = true; - if (friendsConnectivityStatusTracker.GetFriendStatus(profile.Address) != OnlineStatus.OFFLINE) + if (friendsConnectivityStatusTracker.GetFriendStatus(profile.Address) != OnlineStatus.Offline) OnlineFriendClicked?.Invoke(profile.Address); await UniTask.Delay(TimeSpan.FromSeconds(DELAY_BETWEEN_CLICKS), cancellationToken: ct); @@ -116,14 +116,14 @@ private void OnContextMenuClicked(Profile.CompactInfo friendProfile, Vector2 but popupCts = popupCts.SafeRestart(); elementView.CanUnHover = false; - bool isFriendOnline = friendsConnectivityStatusTracker.GetFriendStatus(friendProfile.UserId) != OnlineStatus.OFFLINE; + bool isFriendOnline = friendsConnectivityStatusTracker.GetFriendStatus(friendProfile.UserId) != OnlineStatus.Offline; if (isFriendOnline) OnlineFriendClicked?.Invoke(friendProfile.UserId); ViewDependencies.GlobalUIViews.ShowUserProfileContextMenuFromWalletIdAsync(new Web3Address(friendProfile.UserId), buttonPosition, default(Vector2), popupCts.Token, closeMenuTask: panelLifecycleTask!.Task, onHide: () => elementView.CanUnHover = true - ,anchorPoint: MenuAnchorPoint.TOP_RIGHT).Forget(); + ,anchorPoint: MenuAnchorPoint.TopRight).Forget(); } private void OnJumpInClicked(Profile.CompactInfo profile) diff --git a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Requests/RequestUserView.cs b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Requests/RequestUserView.cs index 8d5f6d66728..06b7a5aa48a 100644 --- a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Requests/RequestUserView.cs +++ b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Requests/RequestUserView.cs @@ -38,7 +38,7 @@ public FriendPanelStatus ParentStatus set { parentStatus = value; - if (value == FriendPanelStatus.SENT) + if (value == FriendPanelStatus.Sent) InhibitInteractionButtons(); } } diff --git a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Requests/RequestsRequestManager.cs b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Requests/RequestsRequestManager.cs index 07e210e1743..ae83fe94baa 100644 --- a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Requests/RequestsRequestManager.cs +++ b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Requests/RequestsRequestManager.cs @@ -33,7 +33,7 @@ public RequestsRequestManager(IFriendsService friendsService, ProfileRepositoryWrapper profileDataProvider, int pageSize, LoopListView2 loopListView) - : base(friendsService, friendEventBus, profileDataProvider, loopListView, pageSize, REQUEST_THRESHOLD, FriendPanelStatus.RECEIVED, FriendPanelStatus.SENT, STATUS_ELEMENT_INDEX, EMPTY_ELEMENT_INDEX, USER_ELEMENT_INDEX, true) + : base(friendsService, friendEventBus, profileDataProvider, loopListView, pageSize, REQUEST_THRESHOLD, FriendPanelStatus.Received, FriendPanelStatus.Sent, STATUS_ELEMENT_INDEX, EMPTY_ELEMENT_INDEX, USER_ELEMENT_INDEX, true) { this.loopListView = loopListView; @@ -135,7 +135,7 @@ protected override void CustomiseElement(RequestUserView elementView, int collec { elementView.ParentStatus = section; - if (section != FriendPanelStatus.SENT) + if (section != FriendPanelStatus.Sent) { elementView.DeleteButton.onClick.RemoveAllListeners(); elementView.DeleteButton.onClick.AddListener(() => DeleteRequestClicked?.Invoke(receivedRequests[collectionIndex])); @@ -150,13 +150,13 @@ protected override void CustomiseElement(RequestUserView elementView, int collec } elementView.SafelyResetMainButtonListeners(); - elementView.MainButton.onClick.AddListener(() => RequestClicked?.Invoke(section == FriendPanelStatus.SENT ? sentRequests[collectionIndex] : receivedRequests[collectionIndex])); + elementView.MainButton.onClick.AddListener(() => RequestClicked?.Invoke(section == FriendPanelStatus.Sent ? sentRequests[collectionIndex] : receivedRequests[collectionIndex])); elementView.ContextMenuButton.onClick.RemoveAllListeners(); elementView.ContextMenuButton.onClick.AddListener(() => ContextMenuClicked?.Invoke(elementView.UserProfile, elementView.ContextMenuButton.transform.position, elementView)); thumbnailContextMenuActions[elementView.UserProfile.Address.ToString()] = () => ContextMenuClicked?.Invoke(elementView.UserProfile, elementView.ContextMenuButton.transform.position, elementView); - FriendRequest request = section == FriendPanelStatus.RECEIVED ? receivedRequests[collectionIndex] : sentRequests[collectionIndex]; + FriendRequest request = section == FriendPanelStatus.Received ? receivedRequests[collectionIndex] : sentRequests[collectionIndex]; elementView.RequestDate = request.Timestamp; elementView.HasMessageIndicator.SetActive(!string.IsNullOrEmpty(request.MessageBody)); } diff --git a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Requests/RequestsSectionController.cs b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Requests/RequestsSectionController.cs index 3534b3d3b00..9d62ffa2e26 100644 --- a/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Requests/RequestsSectionController.cs +++ b/Explorer/Assets/DCL/Friends/UI/FriendPanel/Sections/Requests/RequestsSectionController.cs @@ -63,7 +63,7 @@ public RequestsSectionController(RequestsSectionView view, .AddControl(new SeparatorContextMenuControlSettings(CONTEXT_MENU_SEPARATOR_HEIGHT, -CONTEXT_MENU_VERTICAL_LAYOUT_PADDING.left, -CONTEXT_MENU_VERTICAL_LAYOUT_PADDING.right)) .AddControl(new GenericContextMenuElement(new ButtonContextMenuControlSettings(view.ContextMenuSettings.BlockText, view.ContextMenuSettings.BlockSprite, () => BlockUserClicked(lastClickedProfileCtx!.Value), iconColor: redColor, textColor: redColor), includeUserBlocking)); - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.REPORT_USER)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.ReportUser)) contextMenu.AddControl(new ButtonContextMenuControlSettings(view.ContextMenuSettings.ReportText, view.ContextMenuSettings.ReportOptionSprite, () => ReportUserClicked(lastClickedProfileCtx!.Value), iconColor: redColor, textColor: redColor)); requestManager.DeleteRequestClicked += DeleteRequestClicked; @@ -132,9 +132,9 @@ private void HandleContextMenuUserProfileButton(Profile.CompactInfo userData, Us { friendshipOperationCts = friendshipOperationCts.SafeRestart(); - if (friendshipStatus == UserProfileContextMenuControlSettings.FriendshipStatus.REQUEST_SENT) + if (friendshipStatus == UserProfileContextMenuControlSettings.FriendshipStatus.RequestSent) CancelFriendshipRequestAsync(friendshipOperationCts.Token).Forget(); - else if (friendshipStatus == UserProfileContextMenuControlSettings.FriendshipStatus.REQUEST_RECEIVED) + else if (friendshipStatus == UserProfileContextMenuControlSettings.FriendshipStatus.RequestReceived) mvcManager.ShowAsync(FriendRequestController.IssueCommand(new FriendRequestParams { OneShotFriendAccepted = lastClickedProfileCtx }), ct: friendshipOperationCts.Token).Forget(); return; @@ -202,7 +202,7 @@ private void ContextMenuClicked(Profile.CompactInfo friendProfile, Vector2 butto lastClickedProfileCtx = friendProfile; userProfileContextMenuControlSettings.SetInitialData(friendProfile, - elementView.ParentStatus == FriendPanelStatus.SENT ? UserProfileContextMenuControlSettings.FriendshipStatus.REQUEST_SENT : UserProfileContextMenuControlSettings.FriendshipStatus.REQUEST_RECEIVED); + elementView.ParentStatus == FriendPanelStatus.Sent ? UserProfileContextMenuControlSettings.FriendshipStatus.RequestSent : UserProfileContextMenuControlSettings.FriendshipStatus.RequestReceived); elementView.CanUnHover = false; mvcManager.ShowAsync(GenericContextMenuController.IssueCommand(new GenericContextMenuParameter(contextMenu, buttonPosition, actionOnHide: () => elementView.CanUnHover = true, diff --git a/Explorer/Assets/DCL/Friends/UI/FriendPanel/StatusWrapperView.cs b/Explorer/Assets/DCL/Friends/UI/FriendPanel/StatusWrapperView.cs index c4783484866..43e9c33d2a8 100644 --- a/Explorer/Assets/DCL/Friends/UI/FriendPanel/StatusWrapperView.cs +++ b/Explorer/Assets/DCL/Friends/UI/FriendPanel/StatusWrapperView.cs @@ -8,10 +8,10 @@ namespace DCL.Friends.UI.FriendPanel { public enum FriendPanelStatus { - ONLINE, - OFFLINE, - RECEIVED, - SENT, + Online, + Offline, + Received, + Sent, } public class StatusWrapperView : MonoBehaviour @@ -38,10 +38,10 @@ public void SetStatusText(FriendPanelStatus status, int amount) panelStatus = status; string statusText = status switch { - FriendPanelStatus.ONLINE => "ONLINE", - FriendPanelStatus.OFFLINE => "OFFLINE", - FriendPanelStatus.RECEIVED => "RECEIVED", - FriendPanelStatus.SENT => "SENT", + FriendPanelStatus.Online => "ONLINE", + FriendPanelStatus.Offline => "OFFLINE", + FriendPanelStatus.Received => "RECEIVED", + FriendPanelStatus.Sent => "SENT", _ => "Unknown" }; diff --git a/Explorer/Assets/DCL/Friends/UI/PushNotifications/FriendPushNotificationController.cs b/Explorer/Assets/DCL/Friends/UI/PushNotifications/FriendPushNotificationController.cs index 144c0896ea6..e6d3e1d473e 100644 --- a/Explorer/Assets/DCL/Friends/UI/PushNotifications/FriendPushNotificationController.cs +++ b/Explorer/Assets/DCL/Friends/UI/PushNotifications/FriendPushNotificationController.cs @@ -73,7 +73,7 @@ async UniTaskVoid ResolveThumbnailAndShowAsync(CancellationToken ct) } } - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.PERSISTENT; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Persistent; protected override UniTask WaitForCloseIntentAsync(CancellationToken ct) => UniTask.Never(ct); diff --git a/Explorer/Assets/DCL/Friends/UI/Requests/FriendRequestController.cs b/Explorer/Assets/DCL/Friends/UI/Requests/FriendRequestController.cs index 77a4ab43d46..a28a91b5be3 100644 --- a/Explorer/Assets/DCL/Friends/UI/Requests/FriendRequestController.cs +++ b/Explorer/Assets/DCL/Friends/UI/Requests/FriendRequestController.cs @@ -21,13 +21,13 @@ public class FriendRequestController : ControllerBase CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; public FriendRequestController(ViewFactoryMethod viewFactory, IWeb3IdentityCache identityCache, @@ -101,19 +101,19 @@ protected override void OnViewShow() if (inputData.DestinationUser == null) throw new Exception("Destination user must be set for new friend request"); - Toggle(ViewState.SEND_NEW); + Toggle(ViewState.SendNew); SetUpAsNew(); } else { if (selfAddress.ToString() == fr.From.Address) { - Toggle(ViewState.CANCEL); + Toggle(ViewState.Cancel); SetUpAsCancel(); } else if (selfAddress.ToString() == fr.To.Address) { - Toggle(ViewState.RECEIVED); + Toggle(ViewState.Received); SetUpAsReceived(); } } @@ -136,13 +136,13 @@ private void Close() private void Toggle(ViewState state) { - viewInstance!.send.Root.SetActive(state == ViewState.SEND_NEW); - viewInstance.cancel.Root.SetActive(state == ViewState.CANCEL); - viewInstance.received.Root.SetActive(state == ViewState.RECEIVED); - viewInstance.cancelledConfirmed.Root.SetActive(state == ViewState.CONFIRMED_CANCELLED); - viewInstance.acceptedConfirmed.Root.SetActive(state == ViewState.CONFIRMED_ACCEPTED); - viewInstance.rejectedConfirmed.Root.SetActive(state == ViewState.CONFIRMED_REJECTED); - viewInstance.sentConfirmed.Root.SetActive(state == ViewState.CONFIRMED_SENT); + viewInstance!.send.Root.SetActive(state == ViewState.SendNew); + viewInstance.cancel.Root.SetActive(state == ViewState.Cancel); + viewInstance.received.Root.SetActive(state == ViewState.Received); + viewInstance.cancelledConfirmed.Root.SetActive(state == ViewState.ConfirmedCancelled); + viewInstance.acceptedConfirmed.Root.SetActive(state == ViewState.ConfirmedAccepted); + viewInstance.rejectedConfirmed.Root.SetActive(state == ViewState.ConfirmedRejected); + viewInstance.sentConfirmed.Root.SetActive(state == ViewState.ConfirmedSent); } private void SetUpAsNew() @@ -281,7 +281,7 @@ async UniTaskVoid SendAsync(CancellationToken ct) if (result.Success) { await ShowOperationConfirmationAsync( - ViewState.CONFIRMED_SENT, + ViewState.ConfirmedSent, viewInstance.sentConfirmed, result.Value.To, FRIEND_REQUEST_SENT_FORMAT, ct); @@ -305,7 +305,7 @@ async UniTaskVoid RejectThenCloseAsync(CancellationToken ct) // Dont show confirmation on negative actions // await ShowOperationConfirmationAsync( - // ViewState.CONFIRMED_REJECTED, + // ViewState.ConfirmedRejected, // viewInstance!.rejectedConfirmed, inputData.Request.From, // "Friend Request From {0} Rejected", // ct); @@ -327,7 +327,7 @@ async UniTaskVoid AcceptThenCloseAsync(CancellationToken ct) if (result.Success) { await ShowOperationConfirmationAsync( - ViewState.CONFIRMED_ACCEPTED, + ViewState.ConfirmedAccepted, viewInstance!.acceptedConfirmed, target, FRIEND_REQUEST_ACCEPTED_FORMAT, ct); @@ -349,7 +349,7 @@ async UniTaskVoid CancelThenCloseAsync(CancellationToken ct) // Dont show confirmation on negative actions // await ShowOperationConfirmationAsync( - // ViewState.CONFIRMED_CANCELLED, + // ViewState.ConfirmedCancelled, // viewInstance!.cancelledConfirmed, inputData.Request.To, // "Friend Request To {0} Cancelled", // ct); @@ -379,10 +379,10 @@ private void UpdateBodyMessageCharacterCount(string text) => viewInstance!.send.MessageCharacterCountText.text = $"{text.Length}/140"; private void BlockUnwantedInputs() => - inputBlock.Disable(InputMapComponent.Kind.SHORTCUTS, InputMapComponent.Kind.IN_WORLD_CAMERA, InputMapComponent.Kind.CAMERA, InputMapComponent.Kind.PLAYER); + inputBlock.Disable(InputMapComponent.Kind.Shortcuts, InputMapComponent.Kind.InWorldCamera, InputMapComponent.Kind.Camera, InputMapComponent.Kind.Player); private void UnblockUnwantedInputs() => - inputBlock.Enable(InputMapComponent.Kind.SHORTCUTS, InputMapComponent.Kind.IN_WORLD_CAMERA, InputMapComponent.Kind.CAMERA, InputMapComponent.Kind.PLAYER); + inputBlock.Enable(InputMapComponent.Kind.Shortcuts, InputMapComponent.Kind.InWorldCamera, InputMapComponent.Kind.Camera, InputMapComponent.Kind.Player); private async UniTask ShowOperationConfirmationAsync( ViewState state, @@ -394,7 +394,7 @@ private async UniTask ShowOperationConfirmationAsync( if (config.MyThumbnail != null) { - Profile? myProfile = await profileRepository.GetAsync(identityCache.EnsuredIdentity().Address, ct, IProfileRepository.FetchBehaviour.DELAY_UNTIL_RESOLVED); + Profile? myProfile = await profileRepository.GetAsync(identityCache.EnsuredIdentity().Address, ct, IProfileRepository.FetchBehaviour.DelayUntilResolved); if (myProfile != null) config.MyThumbnail.SetupAsync(profileRepositoryWrapper, myProfile.UserNameColor, myProfile.Compact.FaceSnapshotUrl, myProfile.UserId, ct).Forget(); diff --git a/Explorer/Assets/DCL/Friends/UI/UnfriendConfirmationPopupController.cs b/Explorer/Assets/DCL/Friends/UI/UnfriendConfirmationPopupController.cs index 360d1259c0c..9fd8ddc9d2b 100644 --- a/Explorer/Assets/DCL/Friends/UI/UnfriendConfirmationPopupController.cs +++ b/Explorer/Assets/DCL/Friends/UI/UnfriendConfirmationPopupController.cs @@ -20,7 +20,7 @@ public class UnfriendConfirmationPopupController : ControllerBase CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; public UnfriendConfirmationPopupController(ViewFactoryMethod viewFactory, IFriendsService friendsService, diff --git a/Explorer/Assets/DCL/InWorldCamera/CameraReelGallery/CameraReelGalleryController.cs b/Explorer/Assets/DCL/InWorldCamera/CameraReelGallery/CameraReelGalleryController.cs index 756d80f8d2b..9b295716da9 100644 --- a/Explorer/Assets/DCL/InWorldCamera/CameraReelGallery/CameraReelGalleryController.cs +++ b/Explorer/Assets/DCL/InWorldCamera/CameraReelGallery/CameraReelGalleryController.cs @@ -28,8 +28,8 @@ public class CameraReelGalleryController : IDisposable { private enum ScrollDirection { - UP, - DOWN + Up, + Down } private struct ReelToDeleteInfo @@ -202,13 +202,13 @@ async UniTaskVoid DownloadAndOpenAsync(CancellationToken ct) await ReelCommonActions.DownloadReelToFileAsync(response.url, ct); ScreenshotDownloaded?.Invoke(); - view.cameraReelToastMessage?.ShowToastMessage(CameraReelToastMessageType.DOWNLOAD, + view.cameraReelToastMessage?.ShowToastMessage(CameraReelToastMessageType.Download, reelGalleryStringMessages?.PhotoSuccessfullyDownloadedMessage); } catch (Exception e) { ReportHub.LogException(e, new ReportData(ReportCategory.CAMERA_REEL)); - view.cameraReelToastMessage?.ShowToastMessage(CameraReelToastMessageType.FAILURE); + view.cameraReelToastMessage?.ShowToastMessage(CameraReelToastMessageType.Failure); } } @@ -219,7 +219,7 @@ async UniTaskVoid DownloadAndOpenAsync(CancellationToken ct) private void CopyPictureLink(CameraReelResponseCompact response) { ReelCommonActions.CopyReelLink(response.id, decentralandUrlsSource!, systemClipboard!); - view.cameraReelToastMessage?.ShowToastMessage(CameraReelToastMessageType.SUCCESS, reelGalleryStringMessages?.LinkCopiedMessage); + view.cameraReelToastMessage?.ShowToastMessage(CameraReelToastMessageType.Success, reelGalleryStringMessages?.LinkCopiedMessage); } private void ShareToX(CameraReelResponseCompact response) @@ -236,12 +236,12 @@ async UniTaskVoid SetPublicFlagAsync(CancellationToken ct) { await cameraReelStorageService.UpdateScreenshotVisibilityAsync(response.id, isPublic, ct); response.isPublic = isPublic; - view.cameraReelToastMessage?.ShowToastMessage(CameraReelToastMessageType.SUCCESS, reelGalleryStringMessages?.PhotoSuccessfullyUpdatedMessage); + view.cameraReelToastMessage?.ShowToastMessage(CameraReelToastMessageType.Success, reelGalleryStringMessages?.PhotoSuccessfullyUpdatedMessage); } catch (UnityWebRequestException e) { ReportHub.LogException(e, new ReportData(ReportCategory.CAMERA_REEL)); - view.cameraReelToastMessage?.ShowToastMessage(CameraReelToastMessageType.FAILURE); + view.cameraReelToastMessage?.ShowToastMessage(CameraReelToastMessageType.Failure); } } @@ -299,13 +299,13 @@ private async UniTask DeleteScreenshotsAsync(ReelToDeleteInfo reelToDeleteInfo, ScreenshotDeleted?.Invoke(); StorageUpdated?.Invoke(response); - view.cameraReelToastMessage?.ShowToastMessage(CameraReelToastMessageType.SUCCESS, reelGalleryStringMessages?.PhotoSuccessfullyDeletedMessage); + view.cameraReelToastMessage?.ShowToastMessage(CameraReelToastMessageType.Success, reelGalleryStringMessages?.PhotoSuccessfullyDeletedMessage); } catch (UnityWebRequestException e) { ReportHub.LogException(e, new ReportData(ReportCategory.CAMERA_REEL)); - view.cameraReelToastMessage?.ShowToastMessage(CameraReelToastMessageType.FAILURE); + view.cameraReelToastMessage?.ShowToastMessage(CameraReelToastMessageType.Failure); } } @@ -520,7 +520,7 @@ private async UniTask LoadMorePageAsync(CancellationToken ct) return; } - HandleElementsVisibility(ScrollDirection.UP); + HandleElementsVisibility(ScrollDirection.Up); previousY = view.scrollRect.verticalNormalizedPosition; isLoading = false; @@ -540,7 +540,7 @@ private void OnScrollRectValueChanged(Vector2 value) if (view.scrollRect is { verticalNormalizedPosition: >= 1f, velocity: { y: > 0f } } or { verticalNormalizedPosition: <= 0f, velocity: { y: < 0f } }) return; - HandleElementsVisibility(value.y > previousY ? ScrollDirection.UP : ScrollDirection.DOWN); + HandleElementsVisibility(value.y > previousY ? ScrollDirection.Up : ScrollDirection.Down); CheckNeedsToLoadMore(); previousY = value.y; @@ -591,7 +591,7 @@ private void HandleElementsVisibility(ScrollDirection scrollDirection) { if (currentSize == 0) return; - if (scrollDirection == ScrollDirection.UP) + if (scrollDirection == ScrollDirection.Up) { while (beginVisible >= 0 && ViewIntersectsImage(thumbnailImages[beginVisible].view.thumbnailImage)) beginVisible--; diff --git a/Explorer/Assets/DCL/InWorldCamera/CameraReelToast/CameraReelToastMessage.cs b/Explorer/Assets/DCL/InWorldCamera/CameraReelToast/CameraReelToastMessage.cs index 9787365764c..36a23ba3a9e 100644 --- a/Explorer/Assets/DCL/InWorldCamera/CameraReelToast/CameraReelToastMessage.cs +++ b/Explorer/Assets/DCL/InWorldCamera/CameraReelToast/CameraReelToastMessage.cs @@ -9,9 +9,9 @@ namespace DCL.InWorldCamera.CameraReelToast { public enum CameraReelToastMessageType { - FAILURE, - SUCCESS, - DOWNLOAD + Failure, + Success, + Download } public class CameraReelToastMessage : MonoBehaviour @@ -58,13 +58,13 @@ public void ShowToastMessage(CameraReelToastMessageType type, string? message = switch (type) { - case CameraReelToastMessageType.SUCCESS: + case CameraReelToastMessageType.Success: ShowNotificationAsync(message, SuccessToastDefaultMessage, SuccessToastView, SuccessToastDuration, showSuccessCts.Token).Forget(); break; - case CameraReelToastMessageType.FAILURE: + case CameraReelToastMessageType.Failure: ShowNotificationAsync(message, FailureToastDefaultMessage, FailureToastView, FailureToastDuration, showFailureCts.Token).Forget(); break; - case CameraReelToastMessageType.DOWNLOAD: + case CameraReelToastMessageType.Download: DownloadToastView.PrepareToBeClicked(); ShowNotificationAsync(message, SuccessToastDefaultMessage, diff --git a/Explorer/Assets/DCL/InWorldCamera/InWorldCamera/Systems/ToggleInWorldCameraActivitySystem.cs b/Explorer/Assets/DCL/InWorldCamera/InWorldCamera/Systems/ToggleInWorldCameraActivitySystem.cs index 45f0dbff4af..af7c68236d1 100644 --- a/Explorer/Assets/DCL/InWorldCamera/InWorldCamera/Systems/ToggleInWorldCameraActivitySystem.cs +++ b/Explorer/Assets/DCL/InWorldCamera/InWorldCamera/Systems/ToggleInWorldCameraActivitySystem.cs @@ -145,7 +145,7 @@ private void DisableCamera(CameraMode? targetMode) ref CursorComponent cursorComponent = ref World.Get(camera); cursorComponent.CursorState = CursorState.Free; - SwitchCameraInput(to: Kind.PLAYER); + SwitchCameraInput(to: Kind.Player); World.Remove(camera); @@ -177,7 +177,7 @@ private void EnableCamera() ref CursorComponent cursorComponent = ref World.Get(camera); cursorComponent.CursorState = CursorState.Locked; - SwitchCameraInput(to: Kind.IN_WORLD_CAMERA); + SwitchCameraInput(to: Kind.InWorldCamera); World.Add(camera, new InWorldCameraComponent(), @@ -244,14 +244,14 @@ private void SwitchCameraInput(Kind to) switch (to) { - case Kind.IN_WORLD_CAMERA: - inputMapComponent.BlockInput(Kind.PLAYER); - inputMapComponent.BlockInput(Kind.SHORTCUTS); + case Kind.InWorldCamera: + inputMapComponent.BlockInput(Kind.Player); + inputMapComponent.BlockInput(Kind.Shortcuts); break; - case Kind.PLAYER: + case Kind.Player: DCLInput.Instance.Shortcuts.CameraReel.Disable(); - inputMapComponent.UnblockInput(Kind.PLAYER); - inputMapComponent.UnblockInput(Kind.SHORTCUTS); + inputMapComponent.UnblockInput(Kind.Player); + inputMapComponent.UnblockInput(Kind.Shortcuts); break; } } diff --git a/Explorer/Assets/DCL/InWorldCamera/InWorldCamera/UI/InWorldCameraController.cs b/Explorer/Assets/DCL/InWorldCamera/InWorldCamera/UI/InWorldCameraController.cs index 501d32a8892..2686f34b2e5 100644 --- a/Explorer/Assets/DCL/InWorldCamera/InWorldCamera/UI/InWorldCameraController.cs +++ b/Explorer/Assets/DCL/InWorldCamera/InWorldCamera/UI/InWorldCameraController.cs @@ -32,7 +32,7 @@ public class InWorldCameraController : ControllerBase private CancellationTokenSource ctx; - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.OVERLAY; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Overlay; private SingleInstanceEntity? camera => cameraInternal ??= world.CacheCamera(); private SingleInstanceEntity? cameraInternal; diff --git a/Explorer/Assets/DCL/InWorldCamera/PhotoDetail/PhotoDetailController.cs b/Explorer/Assets/DCL/InWorldCamera/PhotoDetail/PhotoDetailController.cs index d13e61a6b1e..c59ee601fc6 100644 --- a/Explorer/Assets/DCL/InWorldCamera/PhotoDetail/PhotoDetailController.cs +++ b/Explorer/Assets/DCL/InWorldCamera/PhotoDetail/PhotoDetailController.cs @@ -50,7 +50,7 @@ public class PhotoDetailController : ControllerBase CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; public PhotoDetailController(ViewFactoryMethod viewFactory, PhotoDetailInfoController photoDetailInfoController, @@ -184,13 +184,13 @@ async UniTaskVoid DownloadAndOpenAsync(CancellationToken ct) ScreenshotDownloaded?.Invoke(); viewInstance!.cameraReelToastMessage?.ShowToastMessage( - CameraReelToastMessageType.DOWNLOAD, + CameraReelToastMessageType.Download, photoDetailStringMessages.PhotoSuccessfullyDownloadedMessage); } catch (Exception e) { ReportHub.LogException(e, new ReportData(ReportCategory.CAMERA_REEL)); - viewInstance!.cameraReelToastMessage?.ShowToastMessage(CameraReelToastMessageType.FAILURE); + viewInstance!.cameraReelToastMessage?.ShowToastMessage(CameraReelToastMessageType.Failure); } } @@ -200,7 +200,7 @@ async UniTaskVoid DownloadAndOpenAsync(CancellationToken ct) private void CopyReelLinkClicked() { ReelCommonActions.CopyReelLink(inputData.AllReels[currentReelIndex].id, decentralandUrlsSource, systemClipboard); - viewInstance!.cameraReelToastMessage?.ShowToastMessage(CameraReelToastMessageType.SUCCESS, photoDetailStringMessages.LinkCopiedMessage); + viewInstance!.cameraReelToastMessage?.ShowToastMessage(CameraReelToastMessageType.Success, photoDetailStringMessages.LinkCopiedMessage); } private void ShareReelClicked() @@ -227,7 +227,7 @@ async UniTaskVoid SetPublicFlagAsync(CancellationToken ct) await cameraReelStorageService.UpdateScreenshotVisibilityAsync(reelId, isPublic, ct); galleryEventBus.ReelPublicStateChanged(reelId, isPublic); - viewInstance!.cameraReelToastMessage?.ShowToastMessage(CameraReelToastMessageType.SUCCESS, + viewInstance!.cameraReelToastMessage?.ShowToastMessage(CameraReelToastMessageType.Success, photoDetailStringMessages.PhotoSuccessfullyUpdatedMessage); if(!isPublic) @@ -237,7 +237,7 @@ await cameraReelStorageService.UpdateScreenshotVisibilityAsync(reelId, catch (Exception e) { ReportHub.LogException(e, new ReportData(ReportCategory.CAMERA_REEL)); - viewInstance!.cameraReelToastMessage?.ShowToastMessage(CameraReelToastMessageType.FAILURE); + viewInstance!.cameraReelToastMessage?.ShowToastMessage(CameraReelToastMessageType.Failure); } } diff --git a/Explorer/Assets/DCL/Infrastructure/CRDT/CRDTTests/Protocol/CRDTProtocolShould.cs b/Explorer/Assets/DCL/Infrastructure/CRDT/CRDTTests/Protocol/CRDTProtocolShould.cs index 9c8ac8f5a37..0082f351e7f 100644 --- a/Explorer/Assets/DCL/Infrastructure/CRDT/CRDTTests/Protocol/CRDTProtocolShould.cs +++ b/Explorer/Assets/DCL/Infrastructure/CRDT/CRDTTests/Protocol/CRDTProtocolShould.cs @@ -43,7 +43,7 @@ private void AssertTestFile(ParsedCRDTTestFile parsedFile) { ParsedCRDTTestFile.TestFileInstruction instruction = parsedFile.fileInstructions[i]; - if (instruction.instructionType == ParsedCRDTTestFile.InstructionType.MESSAGE) + if (instruction.instructionType == ParsedCRDTTestFile.InstructionType.Message) { (CRDTMessage msg, CRDTReconciliationResult? expectedResult) = ParsedCRDTTestFile.InstructionToMessage(instruction, crdtPooledMemoryAllocator); CRDTReconciliationResult result = crdt.ProcessMessage(msg); @@ -54,7 +54,7 @@ private void AssertTestFile(ParsedCRDTTestFile parsedFile) + $"in line:{instruction.lineNumber} for file {instruction.fileName}. Expected: {expectedResult}, actual: {result}"); } } - else if (instruction.instructionType == ParsedCRDTTestFile.InstructionType.FINAL_STATE) + else if (instruction.instructionType == ParsedCRDTTestFile.InstructionType.FinalState) { CRDTProtocol.State finalState = ParsedCRDTTestFile.InstructionToFinalState(instruction); bool sameState = AreStatesEqual(crdt.CRDTState, finalState, out string reason); @@ -75,12 +75,12 @@ private void AssertGetCurrentState(ParsedCRDTTestFile parsedFile) { ParsedCRDTTestFile.TestFileInstruction instruction = parsedFile.fileInstructions[i]; - if (instruction.instructionType == ParsedCRDTTestFile.InstructionType.MESSAGE) + if (instruction.instructionType == ParsedCRDTTestFile.InstructionType.Message) { (CRDTMessage msg, _) = ParsedCRDTTestFile.InstructionToMessage(instruction, crdtPooledMemoryAllocator); crdt.ProcessMessage(msg); } - else if (instruction.instructionType == ParsedCRDTTestFile.InstructionType.FINAL_STATE) + else if (instruction.instructionType == ParsedCRDTTestFile.InstructionType.FinalState) { // The order of messages is not important diff --git a/Explorer/Assets/DCL/Infrastructure/CRDT/CRDTTests/Protocol/CRDTTestsUtils.cs b/Explorer/Assets/DCL/Infrastructure/CRDT/CRDTTests/Protocol/CRDTTestsUtils.cs index 49bc4800f32..586d07a7533 100644 --- a/Explorer/Assets/DCL/Infrastructure/CRDT/CRDTTests/Protocol/CRDTTestsUtils.cs +++ b/Explorer/Assets/DCL/Infrastructure/CRDT/CRDTTests/Protocol/CRDTTestsUtils.cs @@ -42,7 +42,7 @@ public static ParsedCRDTTestFile ParseTestFile(string filePath) parsedFile.fileInstructions.Add(new ParsedCRDTTestFile.TestFileInstruction { fileName = filePath, - instructionType = ParsedCRDTTestFile.InstructionType.FINAL_STATE, + instructionType = ParsedCRDTTestFile.InstructionType.FinalState, instructionValue = line, lineNumber = lineNumber, testSpect = testSpecName, @@ -56,7 +56,7 @@ public static ParsedCRDTTestFile ParseTestFile(string filePath) parsedFile.fileInstructions.Add(new ParsedCRDTTestFile.TestFileInstruction { fileName = filePath, - instructionType = ParsedCRDTTestFile.InstructionType.MESSAGE, + instructionType = ParsedCRDTTestFile.InstructionType.Message, instructionValue = line, lineNumber = lineNumber, testSpect = testSpecName, diff --git a/Explorer/Assets/DCL/Infrastructure/CRDT/CRDTTests/Protocol/ParsedCRDTTestFile.cs b/Explorer/Assets/DCL/Infrastructure/CRDT/CRDTTests/Protocol/ParsedCRDTTestFile.cs index e3806b76bc1..c88cf4b44fd 100644 --- a/Explorer/Assets/DCL/Infrastructure/CRDT/CRDTTests/Protocol/ParsedCRDTTestFile.cs +++ b/Explorer/Assets/DCL/Infrastructure/CRDT/CRDTTests/Protocol/ParsedCRDTTestFile.cs @@ -11,8 +11,8 @@ public class ParsedCRDTTestFile { public enum InstructionType { - MESSAGE = 0, - FINAL_STATE = 1, + Message = 0, + FinalState = 1, } public string fileName; diff --git a/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/ISceneCommunicationPipe.cs b/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/ISceneCommunicationPipe.cs index 6aef631d34e..99d7bf29b4e 100644 --- a/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/ISceneCommunicationPipe.cs +++ b/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/ISceneCommunicationPipe.cs @@ -17,12 +17,12 @@ public enum ConnectivityAssertiveness /// /// Message will be dropped silently if the scene is not connected /// - DROP_IF_NOT_CONNECTED = 0, + DropIfNotConnected = 0, /// /// Additional information will be printed if the scene is not connected /// - DELIVERY_ASSERTED = 1, + DeliveryAsserted = 1, } public delegate void SceneMessageHandler(DecodedMessage message); diff --git a/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/Communications/CommunicationsControllerAPIImplementation.cs b/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/Communications/CommunicationsControllerAPIImplementation.cs index 000d429173e..7d2a2bad563 100644 --- a/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/Communications/CommunicationsControllerAPIImplementation.cs +++ b/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/Communications/CommunicationsControllerAPIImplementation.cs @@ -55,7 +55,7 @@ protected override void OnMessageReceived(ISceneCommunicationPipe.DecodedMessage totalLength += filteredLength; } // Filter RES_CRDT_STATE messages before receiving - else if (commsMessageType == CommsMessageType.RES_CRDT_STATE) + else if (commsMessageType == CommsMessageType.ResCRDTState) { int filteredLength = FilterCRDTStateMessage(sourceData, filteredUnbounded, isTrustedSource); totalLength += filteredLength; diff --git a/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/Communications/CommunicationsControllerAPIImplementationBase.cs b/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/Communications/CommunicationsControllerAPIImplementationBase.cs index d41c9c8f975..bbbf2eba7bb 100644 --- a/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/Communications/CommunicationsControllerAPIImplementationBase.cs +++ b/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/Communications/CommunicationsControllerAPIImplementationBase.cs @@ -19,8 +19,8 @@ public abstract class CommunicationsControllerAPIImplementationBase : ICommunica // https://github.com/decentraland/js-sdk-toolchain/blob/c8695cd9b94e87ad567520089969583d9d36637f/packages/@dcl/sdk/src/network/binary-message-bus.ts#L3-L7 protected enum CommsMessageType { CRDT = 1, - REQ_CRDT_STATE = 2, // Special signal to receive CRDT State from a peer - RES_CRDT_STATE = 3 // Special signal to send CRDT State to a peer + ReqCRDTState = 2, // Special signal to receive CRDT State from a peer + ResCRDTState = 3 // Special signal to send CRDT State to a peer } private readonly List eventsToProcess = new (); @@ -71,9 +71,9 @@ public void SendBinary(IReadOnlyList broadcastData, string? r { byte firstByte = poolable.Span[0]; - ISceneCommunicationPipe.ConnectivityAssertiveness assertiveness = firstByte == (int)CommsMessageType.REQ_CRDT_STATE - ? ISceneCommunicationPipe.ConnectivityAssertiveness.DELIVERY_ASSERTED - : ISceneCommunicationPipe.ConnectivityAssertiveness.DROP_IF_NOT_CONNECTED; + ISceneCommunicationPipe.ConnectivityAssertiveness assertiveness = firstByte == (int)CommsMessageType.ReqCRDTState + ? ISceneCommunicationPipe.ConnectivityAssertiveness.DeliveryAsserted + : ISceneCommunicationPipe.ConnectivityAssertiveness.DropIfNotConnected; // Filter CRDT messages before sending if (firstByte == (int)CommsMessageType.CRDT) @@ -85,7 +85,7 @@ public void SendBinary(IReadOnlyList broadcastData, string? r } // Filter RES_CRDT_STATE messages before sending - if (firstByte == (int)CommsMessageType.RES_CRDT_STATE) + if (firstByte == (int)CommsMessageType.ResCRDTState) { Span filtered = stackalloc byte[poolable.Memory.Span.Length]; int filteredLength = FilterCRDTStateMessage(poolable.Memory.Span, filtered, isTrustedSource: true); diff --git a/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/Communications/SDKMessageBus/SDKMessageBusCommsAPIImplementation.cs b/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/Communications/SDKMessageBus/SDKMessageBusCommsAPIImplementation.cs index a36daa2fcee..7ebaa4b3172 100644 --- a/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/Communications/SDKMessageBus/SDKMessageBusCommsAPIImplementation.cs +++ b/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/Communications/SDKMessageBus/SDKMessageBusCommsAPIImplementation.cs @@ -25,7 +25,7 @@ public void ClearMessages() public void Send(string data) { byte[] dataBytes = Encoding.UTF8.GetBytes(data); - EncodeAndSendMessage(ISceneCommunicationPipe.MsgType.String, dataBytes, ISceneCommunicationPipe.ConnectivityAssertiveness.DROP_IF_NOT_CONNECTED, null); + EncodeAndSendMessage(ISceneCommunicationPipe.MsgType.String, dataBytes, ISceneCommunicationPipe.ConnectivityAssertiveness.DropIfNotConnected, null); } protected override void OnMessageReceived(ISceneCommunicationPipe.DecodedMessage message) diff --git a/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/Communications/SceneCommunicationPipe.cs b/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/Communications/SceneCommunicationPipe.cs index 5f6647457bf..8d400ed08b0 100644 --- a/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/Communications/SceneCommunicationPipe.cs +++ b/Explorer/Assets/DCL/Infrastructure/CrdtEcsBridge/JsModulesImplementation/Communications/SceneCommunicationPipe.cs @@ -28,7 +28,7 @@ public SceneCommunicationPipe(IMessagePipesHub messagePipesHub, IGateKeeperScene { this.sceneRoom = sceneRoom; messagePipe = messagePipesHub.ScenePipe(); - messagePipe.Subscribe(Packet.MessageOneofCase.Scene, InvokeSubscriber, IMessagePipe.ThreadStrict.ORIGIN_THREAD); + messagePipe.Subscribe(Packet.MessageOneofCase.Scene, InvokeSubscriber, IMessagePipe.ThreadStrict.OriginThread); } private void InvokeSubscriber(ReceivedMessage message) diff --git a/Explorer/Assets/DCL/Infrastructure/ECS/Unity/SceneBoundsChecker/ConfigureSceneMaterial.cs b/Explorer/Assets/DCL/Infrastructure/ECS/Unity/SceneBoundsChecker/ConfigureSceneMaterial.cs index 7c6b86ed374..cb62949aa8c 100644 --- a/Explorer/Assets/DCL/Infrastructure/ECS/Unity/SceneBoundsChecker/ConfigureSceneMaterial.cs +++ b/Explorer/Assets/DCL/Infrastructure/ECS/Unity/SceneBoundsChecker/ConfigureSceneMaterial.cs @@ -19,7 +19,7 @@ public static class ConfigureSceneMaterial /// /// When enabled, forces backface culling on all scene materials. - /// Set this from FeaturesRegistry.IsEnabled(FeatureId.FORCE_BACKFACE_CULLING). + /// Set this from FeaturesRegistry.IsEnabled(FeatureId.ForceBackfaceCulling). /// public static bool forceBackfaceCullingEnabled { get; set; } diff --git a/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/AssetBundles/GetAssetBundleIntention.cs b/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/AssetBundles/GetAssetBundleIntention.cs index 5ecb8f2d660..8053c059364 100644 --- a/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/AssetBundles/GetAssetBundleIntention.cs +++ b/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/AssetBundles/GetAssetBundleIntention.cs @@ -46,7 +46,7 @@ public struct GetAssetBundleIntention : ILoadingIntention, IEquatable public CancellationTokenSource CancellationTokenSource => CommonArguments.CancellationTokenSource; - public static GetAssetBundleIntention Create(Type? expectedAssetType, string hash, string name, AssetSource permittedSources = AssetSource.ALL, + public static GetAssetBundleIntention Create(Type? expectedAssetType, string hash, string name, AssetSource permittedSources = AssetSource.All, URLSubdirectory customEmbeddedSubDirectory = default) => new (expectedAssetType, hash: hash, name: name, permittedSources: permittedSources, customEmbeddedSubDirectory: customEmbeddedSubDirectory); - public static GetAssetBundleIntention FromHash(string hash, Type? expectedAssetType = null, AssetSource permittedSources = AssetSource.ALL, + public static GetAssetBundleIntention FromHash(string hash, Type? expectedAssetType = null, AssetSource permittedSources = AssetSource.All, URLSubdirectory customEmbeddedSubDirectory = default, CancellationTokenSource cancellationTokenSource = null, AssetBundleManifestVersion? assetBundleManifestVersion = null, string parentEntityID = "", bool isDependency = false, bool lookForDependencies = false) => new (expectedAssetType, hash: hash, assetBundleVersion: assetBundleManifestVersion, parentEntityID: parentEntityID, permittedSources: permittedSources, customEmbeddedSubDirectory: customEmbeddedSubDirectory, isDependency: isDependency, lookForDependencies: lookForDependencies, cancellationTokenSource: cancellationTokenSource); diff --git a/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/AssetBundles/PrepareAssetBundleLoadingParametersSystemBase.cs b/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/AssetBundles/PrepareAssetBundleLoadingParametersSystemBase.cs index a527a6dbb6c..93c90d8e117 100644 --- a/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/AssetBundles/PrepareAssetBundleLoadingParametersSystemBase.cs +++ b/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/AssetBundles/PrepareAssetBundleLoadingParametersSystemBase.cs @@ -34,14 +34,14 @@ protected void PrepareCommonArguments(in Entity entity, ref GetAssetBundleIntent if (state.Value != StreamableLoadingState.Status.NotStarted) return; // Remove not supported flags - assetBundleIntention.RemovePermittedSource(AssetSource.ADDRESSABLE); // addressables are not implemented + assetBundleIntention.RemovePermittedSource(AssetSource.Addressable); // addressables are not implemented // First priority - if (EnumUtils.HasFlag(assetBundleIntention.CommonArguments.PermittedSources, AssetSource.EMBEDDED)) + if (EnumUtils.HasFlag(assetBundleIntention.CommonArguments.PermittedSources, AssetSource.Embedded)) { CommonLoadingArguments ca = assetBundleIntention.CommonArguments; ca.Attempts = 1; - ca.CurrentSource = AssetSource.EMBEDDED; + ca.CurrentSource = AssetSource.Embedded; ca.URL = GetStreamingAssetsUrl(assetBundleIntention.Hash, assetBundleIntention.CommonArguments.CustomEmbeddedSubDirectory); assetBundleIntention.CommonArguments = ca; @@ -49,7 +49,7 @@ protected void PrepareCommonArguments(in Entity entity, ref GetAssetBundleIntent } // Second priority - if (EnumUtils.HasFlag(assetBundleIntention.CommonArguments.PermittedSources, AssetSource.WEB)) + if (EnumUtils.HasFlag(assetBundleIntention.CommonArguments.PermittedSources, AssetSource.Web)) { if (assetBundleIntention.AssetBundleManifestVersion == null || assetBundleIntention.AssetBundleManifestVersion.assetBundleManifestRequestFailed) { @@ -62,7 +62,7 @@ protected void PrepareCommonArguments(in Entity entity, ref GetAssetBundleIntent CommonLoadingArguments ca = assetBundleIntention.CommonArguments; ca.Attempts = StreamableLoadingDefaults.ATTEMPTS_COUNT; ca.Timeout = StreamableLoadingDefaults.TIMEOUT; - ca.CurrentSource = AssetSource.WEB; + ca.CurrentSource = AssetSource.Web; assetBundleIntention.Hash = assetBundleIntention.AssetBundleManifestVersion.CheckCasing(assetBundleIntention.Hash); ca.URL = GetAssetBundleURL(assetBundleIntention.AssetBundleManifestVersion.HasHashInPath(), assetBundleIntention.Hash, assetBundleIntention.ParentEntityID, assetBundleIntention.AssetBundleManifestVersion.GetAssetBundleManifestVersion()); assetBundleIntention.CommonArguments = ca; diff --git a/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/AssetBundles/Tests/LoadAssetBundlePartialSystemShould.cs b/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/AssetBundles/Tests/LoadAssetBundlePartialSystemShould.cs index 29419f65ac2..815e19f78e0 100644 --- a/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/AssetBundles/Tests/LoadAssetBundlePartialSystemShould.cs +++ b/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/AssetBundles/Tests/LoadAssetBundlePartialSystemShould.cs @@ -137,7 +137,7 @@ private ABPromise NewABPromiseRemoteAsset(int index) private ABPromise NewABPromise() { - var intention = GetAssetBundleIntention.FromHash("bafkreid3xecd44iujaz5qekbdrt5orqdqj3wivg5zc5mya3zkorjhyrkda", typeof(GameObject), permittedSources: AssetSource.WEB); + var intention = GetAssetBundleIntention.FromHash("bafkreid3xecd44iujaz5qekbdrt5orqdqj3wivg5zc5mya3zkorjhyrkda", typeof(GameObject), permittedSources: AssetSource.Web); var partition = PartitionComponent.TOP_PRIORITY; var assetPromise = ABPromise.Create(world, intention, partition); world.Get(assetPromise.Entity).SetAllowed(Substitute.For()); diff --git a/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/AssetBundles/Tests/PrepareAssetBundleLoadingParametersSystemShould.cs b/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/AssetBundles/Tests/PrepareAssetBundleLoadingParametersSystemShould.cs index 49c658a1028..49b4ecbb6b1 100644 --- a/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/AssetBundles/Tests/PrepareAssetBundleLoadingParametersSystemShould.cs +++ b/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/AssetBundles/Tests/PrepareAssetBundleLoadingParametersSystemShould.cs @@ -34,7 +34,7 @@ public void LoadFromEmbeddedFirst() { LogAssert.ignoreFailingMessages = true; - var intent = GetAssetBundleIntention.FromHash(typeof(GameObject), "TEST", permittedSources: AssetSource.EMBEDDED | AssetSource.WEB); + var intent = GetAssetBundleIntention.FromHash(typeof(GameObject), "TEST", permittedSources: AssetSource.Embedded | AssetSource.Web); Entity e = world.Create(intent, new StreamableLoadingState()); @@ -43,7 +43,7 @@ public void LoadFromEmbeddedFirst() intent = world.Get(e); Assert.That(intent.CommonArguments.Attempts, Is.EqualTo(1)); - Assert.That(intent.CommonArguments.CurrentSource, Is.EqualTo(AssetSource.EMBEDDED)); + Assert.That(intent.CommonArguments.CurrentSource, Is.EqualTo(AssetSource.Embedded)); Assert.That(intent.CommonArguments.URL, Is.EqualTo(path + "TEST")); } @@ -55,14 +55,14 @@ public void LoadFromWebWithOldPath() sceneData.AssetBundleManifest.Returns(new SceneAssetBundleManifest(FAKE_AB_PATH, version, new[] { "abcd" }, "hash", "04_10_2024")); - var intent = GetAssetBundleIntention.FromHash(typeof(GameObject), "abcd", permittedSources: AssetSource.WEB); + var intent = GetAssetBundleIntention.FromHash(typeof(GameObject), "abcd", permittedSources: AssetSource.Web); Entity e = world.Create(intent, new StreamableLoadingState()); system.Update(0); intent = world.Get(e); Assert.That(intent.CommonArguments.Attempts, Is.EqualTo(StreamableLoadingDefaults.ATTEMPTS_COUNT)); - Assert.That(intent.CommonArguments.CurrentSource, Is.EqualTo(AssetSource.WEB)); + Assert.That(intent.CommonArguments.CurrentSource, Is.EqualTo(AssetSource.Web)); Assert.That(intent.CommonArguments.URL, Is.EqualTo($"http://www.fakepath.com/{version}/abcd")); Assert.That(intent.cacheHash, Is.Not.Null); } @@ -74,14 +74,14 @@ public void LoadFromWebWithNewPath() string version = "v" + SceneAssetBundleManifest.ASSET_BUNDLE_VERSION_REQUIRES_HASH; sceneData.AssetBundleManifest.Returns(new SceneAssetBundleManifest(FAKE_AB_PATH, version, new[] { "abcd" }, "hash", "04_10_2024")); - var intent = GetAssetBundleIntention.FromHash(typeof(GameObject), "abcd", permittedSources: AssetSource.WEB); + var intent = GetAssetBundleIntention.FromHash(typeof(GameObject), "abcd", permittedSources: AssetSource.Web); Entity e = world.Create(intent, new StreamableLoadingState()); system.Update(0); intent = world.Get(e); Assert.That(intent.CommonArguments.Attempts, Is.EqualTo(StreamableLoadingDefaults.ATTEMPTS_COUNT)); - Assert.That(intent.CommonArguments.CurrentSource, Is.EqualTo(AssetSource.WEB)); + Assert.That(intent.CommonArguments.CurrentSource, Is.EqualTo(AssetSource.Web)); Assert.That(intent.CommonArguments.URL, Is.EqualTo($"http://www.fakepath.com/{version}/hash/abcd")); Assert.That(intent.cacheHash, Is.Not.Null); } @@ -93,7 +93,7 @@ public void FailIfAbsentInManifestOldHash() sceneData.AssetBundleManifest.Returns(new SceneAssetBundleManifest(FAKE_AB_PATH, "v" + (SceneAssetBundleManifest.ASSET_BUNDLE_VERSION_REQUIRES_HASH - 1), Array.Empty(), "hash", "04_10_2024")); - var intent = GetAssetBundleIntention.FromHash(typeof(GameObject), "abcd", permittedSources: AssetSource.WEB); + var intent = GetAssetBundleIntention.FromHash(typeof(GameObject), "abcd", permittedSources: AssetSource.Web); Entity e = world.Create(intent, new StreamableLoadingState()); system.Update(0); @@ -111,7 +111,7 @@ public void FailIfAbsentInManifestNewHash() sceneData.AssetBundleManifest.Returns(new SceneAssetBundleManifest(FAKE_AB_PATH, "v" + (SceneAssetBundleManifest.ASSET_BUNDLE_VERSION_REQUIRES_HASH), Array.Empty(), "hash", "04_10_2024")); - var intent = GetAssetBundleIntention.FromHash(typeof(GameObject), "abcd", permittedSources: AssetSource.WEB); + var intent = GetAssetBundleIntention.FromHash(typeof(GameObject), "abcd", permittedSources: AssetSource.Web); Entity e = world.Create(intent, new StreamableLoadingState()); system.Update(0); @@ -128,7 +128,7 @@ public void ReturnSameCacheValuesForDifferentVersions() //First, we simulate creation of a scene and the resolving of one asset budnle string version = "v" + SceneAssetBundleManifest.ASSET_BUNDLE_VERSION_REQUIRES_HASH; sceneData.AssetBundleManifest.Returns(new SceneAssetBundleManifest(FAKE_AB_PATH, version, new[] { "abcd" }, "scene_hash_1", "04_10_2024")); - var intent = GetAssetBundleIntention.FromHash(typeof(GameObject), "abcd", permittedSources: AssetSource.WEB); + var intent = GetAssetBundleIntention.FromHash(typeof(GameObject), "abcd", permittedSources: AssetSource.Web); Entity entity1 = world.Create(intent, new StreamableLoadingState()); system.Update(0); intent = world.Get(entity1); @@ -138,7 +138,7 @@ public void ReturnSameCacheValuesForDifferentVersions() //Now, we simulate another scene, that has a different asset bundle version version = "v" + (SceneAssetBundleManifest.ASSET_BUNDLE_VERSION_REQUIRES_HASH + 1); sceneData.AssetBundleManifest.Returns(new SceneAssetBundleManifest(FAKE_AB_PATH, version, new[] { "abcd" }, "scene_hash_1", "04_10_2024")); - var intent2 = GetAssetBundleIntention.FromHash(typeof(GameObject), "abcd", permittedSources: AssetSource.WEB); + var intent2 = GetAssetBundleIntention.FromHash(typeof(GameObject), "abcd", permittedSources: AssetSource.Web); Entity entity2 = world.Create(intent2, new StreamableLoadingState()); system.Update(0); intent2 = world.Get(entity2); @@ -154,7 +154,7 @@ public void ReturnSameCacheValuesForScenes() //First, we simulate creation of a scene and the resolving of one asset budnle string version = "v" + SceneAssetBundleManifest.ASSET_BUNDLE_VERSION_REQUIRES_HASH; sceneData.AssetBundleManifest.Returns(new SceneAssetBundleManifest(FAKE_AB_PATH, version, new[] { "abcd" }, "scene_hash_1", "04_10_2024")); - var intent = GetAssetBundleIntention.FromHash(typeof(GameObject), "abcd", permittedSources: AssetSource.WEB); + var intent = GetAssetBundleIntention.FromHash(typeof(GameObject), "abcd", permittedSources: AssetSource.Web); Entity entity1 = world.Create(intent, new StreamableLoadingState()); system.Update(0); intent = world.Get(entity1); @@ -163,7 +163,7 @@ public void ReturnSameCacheValuesForScenes() //Now, we simulate another scene, that has a differente scene hash but same version sceneData.AssetBundleManifest.Returns(new SceneAssetBundleManifest(FAKE_AB_PATH, version, new[] { "abcd" }, "scene_hash_2", "04_10_2024")); - var intent2 = GetAssetBundleIntention.FromHash(typeof(GameObject), "abcd", permittedSources: AssetSource.WEB); + var intent2 = GetAssetBundleIntention.FromHash(typeof(GameObject), "abcd", permittedSources: AssetSource.Web); Entity entity2 = world.Create(intent2, new StreamableLoadingState()); system.Update(0); intent2 = world.Get(entity2); diff --git a/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/Common/Components/CommonLoadingArguments.cs b/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/Common/Components/CommonLoadingArguments.cs index 9ba041fe7fc..e83c7fa65c1 100644 --- a/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/Common/Components/CommonLoadingArguments.cs +++ b/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/Common/Components/CommonLoadingArguments.cs @@ -32,8 +32,8 @@ public struct CommonLoadingArguments public CommonLoadingArguments(URLAddress url, URLSubdirectory customEmbeddedSubDirectory = default, int timeout = StreamableLoadingDefaults.TIMEOUT, int attempts = StreamableLoadingDefaults.ATTEMPTS_COUNT, - AssetSource permittedSources = AssetSource.WEB, - AssetSource currentSource = AssetSource.WEB, + AssetSource permittedSources = AssetSource.Web, + AssetSource currentSource = AssetSource.Web, CancellationTokenSource? cancellationTokenSource = null) { URL = url; @@ -51,8 +51,8 @@ public CommonLoadingArguments(URLAddress url, URLSubdirectory customEmbeddedSubD public CommonLoadingArguments(string url, URLSubdirectory customEmbeddedSubDirectory = default, int timeout = StreamableLoadingDefaults.TIMEOUT, int attempts = StreamableLoadingDefaults.ATTEMPTS_COUNT, - AssetSource permittedSources = AssetSource.WEB, - AssetSource currentSource = AssetSource.WEB, + AssetSource permittedSources = AssetSource.Web, + AssetSource currentSource = AssetSource.Web, CancellationTokenSource cancellationTokenSource = null) : this(URLAddress.FromString(url), customEmbeddedSubDirectory, timeout, attempts, permittedSources, currentSource, cancellationTokenSource) { } diff --git a/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/Common/Components/ILoadingIntention.cs b/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/Common/Components/ILoadingIntention.cs index 0b121ab2a01..aabd65d549f 100644 --- a/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/Common/Components/ILoadingIntention.cs +++ b/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/Common/Components/ILoadingIntention.cs @@ -70,7 +70,7 @@ public static void SetSources(this ref T loadingIntention, AssetSource permit /// Only assets downloaded from web can be cached on disk, otherwise the asset is already stored locally on disk /// public static bool IsQualifiedForDiskCache(this ref T loadingIntention) where T: struct, ILoadingIntention => - loadingIntention.CommonArguments.CurrentSource == AssetSource.WEB; + loadingIntention.CommonArguments.CurrentSource == AssetSource.Web; public static bool AreUrlEquals(this TIntention intention, TIntention other) where TIntention: struct, ILoadingIntention => intention.CommonArguments.URL == other.CommonArguments.URL; diff --git a/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/Common/Components/SubIntention.cs b/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/Common/Components/SubIntention.cs index 98f32991555..f10a9d587fd 100644 --- a/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/Common/Components/SubIntention.cs +++ b/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/Common/Components/SubIntention.cs @@ -10,7 +10,7 @@ public struct SubIntention : ILoadingIntention { public SubIntention(CommonLoadingArguments commonArguments) { - commonArguments.PermittedSources = AssetSource.NONE; + commonArguments.PermittedSources = AssetSource.None; CommonArguments = commonArguments; } diff --git a/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/Tests/LoadSystemBaseAbandonedResultShould.cs b/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/Tests/LoadSystemBaseAbandonedResultShould.cs index 868157dcd3f..336f0f67dd4 100644 --- a/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/Tests/LoadSystemBaseAbandonedResultShould.cs +++ b/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/Tests/LoadSystemBaseAbandonedResultShould.cs @@ -45,8 +45,8 @@ public async Task DisposeAbandonedResultWhenIntentionCancelledMidFlow() CommunicationData.URLHelpers.URLAddress.EMPTY, cancellationTokenSource: cts, attempts: 1, - permittedSources: AssetSource.EMBEDDED, - currentSource: AssetSource.EMBEDDED), + permittedSources: AssetSource.Embedded, + currentSource: AssetSource.Embedded), }; var promise = AssetPromise.Create(world, intention, PartitionComponent.TOP_PRIORITY); diff --git a/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/Tests/LoadSystemBaseShould.cs b/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/Tests/LoadSystemBaseShould.cs index e0ea19b7436..d4b474948a1 100644 --- a/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/Tests/LoadSystemBaseShould.cs +++ b/Explorer/Assets/DCL/Infrastructure/ECS/Unity/StreamableLoading/Tests/LoadSystemBaseShould.cs @@ -114,7 +114,7 @@ public async Task ConcludeFailIfNotFound() public async Task RemoveCurrentSourceFromPermittedSources() { TIntention intent = CreateSuccessIntention(); - intent.SetSources(AssetSource.EMBEDDED, AssetSource.EMBEDDED); + intent.SetSources(AssetSource.Embedded, AssetSource.Embedded); promise = AssetPromise.Create(world, intent, PartitionComponent.TOP_PRIORITY); ForceAllowed(); @@ -123,7 +123,7 @@ public async Task RemoveCurrentSourceFromPermittedSources() system.Update(0); await promise.ToUniTaskWithoutDestroyAsync(world, cancellationToken: promise.LoadingIntention.CommonArguments.CancellationToken); - Assert.AreEqual(AssetSource.NONE, world.Get(promise.Entity).CommonArguments.PermittedSources); + Assert.AreEqual(AssetSource.None, world.Get(promise.Entity).CommonArguments.PermittedSources); } [Test] diff --git a/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/Bootstraper.cs b/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/Bootstraper.cs index 0d89dbe1791..d01edbec028 100644 --- a/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/Bootstraper.cs +++ b/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/Bootstraper.cs @@ -226,7 +226,7 @@ public void InitializeFeaturesRegistry() // Gate the v49 deps-digest cache-keying scheme behind the feature flag. Off by default means every // manifest reports SupportsDepsDigests() == false and the entire pipeline takes the legacy code path. - AssetBundleManifestVersion.DepsDigestKeyingEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.AB_DEPS_DIGEST_CACHE_KEY); + AssetBundleManifestVersion.DepsDigestKeyingEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.ABDepsDigestCacheKey); } public GlobalWorld CreateGlobalWorld( diff --git a/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/CommsContainer.cs b/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/CommsContainer.cs index 8b09410fc99..84ba715c57a 100644 --- a/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/CommsContainer.cs +++ b/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/CommsContainer.cs @@ -121,7 +121,7 @@ public static CommsContainer Create( SceneRoomLogMetaDataSource playSceneMetaDataSource = new SceneRoomMetaDataSource(staticContainer.RealmData, staticContainer.CharacterContainer.Transform, globalWorld, isolateScenesCommunication, bootstrapContainer.DecentralandUrlsSource).WithLog(); SceneRoomLogMetaDataSource localDevelopmentMetaDataSource = new LocalSceneDevelopmentSceneRoomMetaDataSource(staticContainer.WebRequestsContainer.WebRequestController).WithLog(); - Option hardwareFingerprintProvider = FeaturesRegistry.Instance.IsEnabled(FeatureId.HARDWARE_FINGERPRINT) + Option hardwareFingerprintProvider = FeaturesRegistry.Instance.IsEnabled(FeatureId.HardwareFingerprint) ? Option.Some(new HardwareFingerprintProvider()) : Option.None; diff --git a/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/DynamicWorldContainer.cs b/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/DynamicWorldContainer.cs index 08c2cbc3238..62156c7a93f 100644 --- a/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/DynamicWorldContainer.cs +++ b/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/DynamicWorldContainer.cs @@ -240,7 +240,7 @@ public override void Dispose() IFriendsEventBus friendsEventBus = new DefaultFriendsEventBus(); - IUserBlockingCache userBlockingCache = FeaturesRegistry.Instance.IsEnabled(FeatureId.FRIENDS_USER_BLOCKING) + IUserBlockingCache userBlockingCache = FeaturesRegistry.Instance.IsEnabled(FeatureId.FriendsUserBlocking) ? new UserBlockingCache(friendsEventBus) : new NullUserBlockingCache(); @@ -322,10 +322,10 @@ await LODContainer // Deferred: CommunityDataService needs chat history (only available now) but is owned by CommunitiesContainer. CommunityDataService communitiesDataService = communitiesContainer.CreateDataService(chatContainer.ChatHistory, uiShellContainer.MvcManager, identityCache); - bool includeCameraReel = FeaturesRegistry.Instance.IsEnabled(FeatureId.CAMERA_REEL); - bool includeFriends = FeaturesRegistry.Instance.IsEnabled(FeatureId.FRIENDS); - bool includeMarketplaceCredits = FeaturesRegistry.Instance.IsEnabled(FeatureId.MARKETPLACE_CREDITS); - bool includeBannedUsersFromScene = FeaturesRegistry.Instance.IsEnabled(FeatureId.BANNED_USERS_FROM_SCENE); + bool includeCameraReel = FeaturesRegistry.Instance.IsEnabled(FeatureId.CameraReel); + bool includeFriends = FeaturesRegistry.Instance.IsEnabled(FeatureId.Friends); + bool includeMarketplaceCredits = FeaturesRegistry.Instance.IsEnabled(FeatureId.MarketplaceCredits); + bool includeBannedUsersFromScene = FeaturesRegistry.Instance.IsEnabled(FeatureId.BannedUsersFromScene); var moderationDataProvider = new ModerationDataProvider(staticContainer.WebRequestsContainer.WebRequestController, bootstrapContainer.DecentralandUrlsSource); @@ -441,7 +441,7 @@ await MapRendererContainer creditsChainConfig, identityCache, dynamicWorldDependencies.CompositeWeb3Provider, - FeaturesRegistry.Instance.IsEnabled(FeatureId.CREDITS_WEARABLE_PURCHASE) && FeaturesRegistry.Instance.IsEnabled(FeatureId.USER_CREDITS)); + FeaturesRegistry.Instance.IsEnabled(FeatureId.CreditsWearablePurchase) && FeaturesRegistry.Instance.IsEnabled(FeatureId.UserCredits)); var cameraReelContainer = CameraReelContainer.Create(staticContainer.WebRequestsContainer.WebRequestController, bootstrapContainer.DecentralandUrlsSource, identityCache.Identity?.Address); var userCalendar = new GoogleUserCalendar(webBrowser); @@ -697,7 +697,7 @@ await MapRendererContainer assetsProvisioner, uiShellContainer.MvcManager, uiShellContainer.Cursor, - realmUrl => chatContainer.ChatMessagesBus.SendWithUtcNowTimestamp(ChatChannel.NEARBY_CHANNEL, $"/{ChatCommandsUtils.COMMAND_GOTO} {realmUrl}", ChatMessageOrigin.RESTRICTED_ACTION_API)), + realmUrl => chatContainer.ChatMessagesBus.SendWithUtcNowTimestamp(ChatChannel.NEARBY_CHANNEL, $"/{ChatCommandsUtils.COMMAND_GOTO} {realmUrl}", ChatMessageOrigin.RestrictedActionApi)), new NftPromptPlugin(assetsProvisioner, webBrowser, uiShellContainer.MvcManager, nftInfoAPIClient, staticContainer.ImageControllerProvider, uiShellContainer.Cursor), staticContainer.CharacterContainer.CreateGlobalPlugin(), staticContainer.QualityContainer.CreatePlugin(), @@ -791,7 +791,7 @@ await MapRendererContainer dynamicWorldDependencies.CompositeWeb3Provider)); // ReSharper disable once MethodHasAsyncOverloadWithCancellation - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.STOP_ON_DUPLICATE_IDENTITY)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.StopOnDuplicateIdentity)) globalPlugins.Add(new DuplicateIdentityPlugin(commsContainer.RoomHub, uiShellContainer.MvcManager, assetsProvisioner)); // No comms/internet popup while developing against a local scene. @@ -804,7 +804,7 @@ await MapRendererContainer bootstrapContainer.DecentralandUrlsSource)); // ReSharper disable once MethodHasAsyncOverloadWithCancellation - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.VOICE_CHAT)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.VoiceChat)) globalPlugins.Add( new VoiceChatPlugin( commsContainer.RoomHub, @@ -842,7 +842,7 @@ await MapRendererContainer globalPlugins.Add(lodContainer.RoadPlugin); } - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.LOCAL_SCENE_DEVELOPMENT) || FeaturesRegistry.Instance.IsEnabled(FeatureId.SELF_PREVIEW_BUILDER_COLLECTIONS)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.LocalSceneDevelopment) || FeaturesRegistry.Instance.IsEnabled(FeatureId.SelfPreviewBuilderCollections)) globalPlugins.Add(new GlobalGLTFLoadingPlugin(staticContainer.WebRequestsContainer.WebRequestController, staticContainer.RealmData, wearableContainer.BuilderContentURL.Value, localSceneDevelopment, staticContainer.ComponentsContainer.ComponentPoolsRegistry.RootContainerTransform())); globalPlugins.AddRange(staticContainer.SharedPlugins); diff --git a/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/GlobalWorldFactory.cs b/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/GlobalWorldFactory.cs index d33ee5e0a7b..4d5ccbd5562 100644 --- a/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/GlobalWorldFactory.cs +++ b/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/GlobalWorldFactory.cs @@ -122,7 +122,7 @@ public GlobalWorldFactory(in StaticContainer staticContainer, this.hybridSceneParams = hybridSceneParams; this.currentSceneInfo = currentSceneInfo; this.lodCache = lodCache; - this.localSceneDevelopment = FeaturesRegistry.Instance.IsEnabled(FeatureId.LOCAL_SCENE_DEVELOPMENT); + this.localSceneDevelopment = FeaturesRegistry.Instance.IsEnabled(FeatureId.LocalSceneDevelopment); this.sceneReadinessReportQueue = sceneReadinessReportQueue; this.sceneRoomStatus = sceneRoomStatus; this.world = world; @@ -132,7 +132,7 @@ public GlobalWorldFactory(in StaticContainer staticContainer, this.useRemoteAssetBundles = useRemoteAssetBundles; this.roadAssetPool = roadAssetPool; this.sceneLoadingLimit = sceneLoadingLimit; - this.isBuilderCollectionPreview = FeaturesRegistry.Instance.IsEnabled(FeatureId.SELF_PREVIEW_BUILDER_COLLECTIONS); + this.isBuilderCollectionPreview = FeaturesRegistry.Instance.IsEnabled(FeatureId.SelfPreviewBuilderCollections); this.entitiesAnalytics = entitiesAnalytics; memoryBudget = staticContainer.SingletonSharedDependencies.MemoryBudget; diff --git a/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/InitialRealm.cs b/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/InitialRealm.cs index 89c0f434ac8..8ae342ed188 100644 --- a/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/InitialRealm.cs +++ b/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/InitialRealm.cs @@ -3,7 +3,7 @@ namespace Global.Dynamic public enum InitialRealm { GenesisCity, - SDK, + Sdk, Goerli, StreamingWorld, TestScenes, diff --git a/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/Landscapes/Landscape.cs b/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/Landscapes/Landscape.cs index 279d2155c14..04c8e488b78 100644 --- a/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/Landscapes/Landscape.cs +++ b/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/Landscapes/Landscape.cs @@ -66,12 +66,12 @@ await genesisTerrain.GenerateGenesisTerrainAndShowAsync( ? await GenerateStaticScenesTerrainAsync(landscapeLoadReport, ct) : await GenerateFixedScenesTerrainAsync(realmController.RealmData.WorldManifest, landscapeLoadReport, ct); - if (result != WorldsTerrainResult.GENERATED) + if (result != WorldsTerrainResult.Generated) { worldsTerrain.Hide(); landscapeLoadReport.SetProgress(1f); - return result == WorldsTerrainResult.DISABLED + return result == WorldsTerrainResult.Disabled ? EnumResult.SuccessResult() : EnumResult.ErrorResult(LandscapeError.TerrainDataUnavailable); } @@ -104,20 +104,20 @@ public Result IsParcelInsideTerrain(Vector2Int parcel, bool isLocal) private async UniTask GenerateStaticScenesTerrainAsync(AsyncLoadProcessReport landscapeLoadReport, CancellationToken ct) { if (!worldsTerrain.IsInitialized) - return WorldsTerrainResult.DISABLED; + return WorldsTerrainResult.Disabled; SceneDefinitions? staticScenesEntityDefinitions = await realmController.WaitForStaticScenesEntityDefinitionsAsync(ct); if (!staticScenesEntityDefinitions.HasValue) { ReportHub.LogWarning(ReportCategory.LANDSCAPE, "Static scenes definitions are unavailable, worlds terrain generation skipped"); - return WorldsTerrainResult.UNAVAILABLE; + return WorldsTerrainResult.Unavailable; } List sceneDefinitions = staticScenesEntityDefinitions.Value.Value; if (IsLandscapeTerrainDisabledByScene(sceneDefinitions)) - return WorldsTerrainResult.DISABLED; + return WorldsTerrainResult.Disabled; int parcelsAmount = sceneDefinitions.Count; @@ -131,22 +131,22 @@ private async UniTask GenerateStaticScenesTerrainAsync(Asyn worldsTerrain.GenerateTerrain(parcels, landscapeLoadReport); } - return WorldsTerrainResult.GENERATED; + return WorldsTerrainResult.Generated; } private async UniTask GenerateFixedScenesTerrainAsync(WorldManifest worldManifest, AsyncLoadProcessReport landscapeLoadReport, CancellationToken ct) { if (!worldsTerrain.IsInitialized) - return WorldsTerrainResult.DISABLED; + return WorldsTerrainResult.Disabled; List sceneEntityDefinitions = await realmController.WaitForFixedScenePromisesAsync(ct); if (IsLandscapeTerrainDisabledByScene(sceneEntityDefinitions)) - return WorldsTerrainResult.DISABLED; + return WorldsTerrainResult.Disabled; if (!worldManifest.IsEmpty) { worldsTerrain.GenerateTerrain(worldManifest.GetOccupiedParcels(), landscapeLoadReport); - return WorldsTerrainResult.GENERATED; + return WorldsTerrainResult.Generated; } var parcelsAmount = 0; @@ -165,7 +165,7 @@ private async UniTask GenerateFixedScenesTerrainAsync(World worldsTerrain.GenerateTerrain(parcels, landscapeLoadReport); } - return WorldsTerrainResult.GENERATED; + return WorldsTerrainResult.Generated; } private static bool IsLandscapeTerrainDisabledByScene(IReadOnlyList sceneDefinitions) => @@ -174,13 +174,13 @@ private static bool IsLandscapeTerrainDisabledByScene(IReadOnlyListTerrain was generated and is shown. - GENERATED, + Generated, /// Terrain is intentionally off: generator not initialized or the scene opted out via scene.json. - DISABLED, + Disabled, /// Scene definitions required to build the terrain could not be loaded. - UNAVAILABLE, + Unavailable, } } } diff --git a/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/MainSceneLoader.cs b/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/MainSceneLoader.cs index 65a49807dff..cfac566b9ba 100644 --- a/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/MainSceneLoader.cs +++ b/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/MainSceneLoader.cs @@ -347,7 +347,7 @@ await bootstrap.InitializeFeatureFlagsAsync(bootstrapContainer.IdentityCache!.Id var specResults = await VerifyMinimumHardwareRequirementMetAsync(applicationParametersParser, bootstrapContainer.WebBrowser, bootstrapContainer.Analytics.Controller, ct); - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.CHECK_DISK_SPACE)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.CheckDiskSpace)) await BlockOnInsufficientDiskSpaceAsync(specResults, applicationParametersParser, ct); if (!await IsTrustedRealmAsync(decentralandUrlsSource, ct)) @@ -400,7 +400,7 @@ async UniTask LoadStartingRealmAsync(CancellationToken ct) try { await bootstrap.LoadStartingRealmAsync(dynamicWorldContainer!, ct); } catch (RealmChangeException) { - if (await ShowLoadErrorPopupAsync(ct) == ErrorPopupWithRetryController.Result.RESTART) + if (await ShowLoadErrorPopupAsync(ct) == ErrorPopupWithRetryController.Result.Restart) await LoadStartingRealmAsync(ct); else ExitUtils.Exit(); @@ -412,14 +412,14 @@ async UniTask LoadUserFlowAsync(Entity playerEntity, CancellationToken ct) try { await bootstrap.UserInitializationAsync(dynamicWorldContainer!, bootstrapContainer, globalWorld, playerEntity, ct); } catch (TimeoutException) { - if (await ShowLoadErrorPopupAsync(ct) == ErrorPopupWithRetryController.Result.RESTART) + if (await ShowLoadErrorPopupAsync(ct) == ErrorPopupWithRetryController.Result.Restart) await LoadUserFlowAsync(playerEntity, ct); else throw; } catch (RealmChangeException) { - if (await ShowLoadErrorPopupAsync(ct) == ErrorPopupWithRetryController.Result.RESTART) + if (await ShowLoadErrorPopupAsync(ct) == ErrorPopupWithRetryController.Result.Restart) await LoadUserFlowAsync(playerEntity, ct); else ExitUtils.Exit(); @@ -644,8 +644,8 @@ private void RestoreInputs() { // We enable Inputs through the inputBlock so the block counters can be properly updated and the component Active flags are up-to-date as well // We restore all inputs except EmoteWheel and FreeCamera as they should be disabled by default - staticContainer!.InputBlock.EnableAll(InputMapComponent.Kind.FREE_CAMERA, - InputMapComponent.Kind.EMOTE_WHEEL); + staticContainer!.InputBlock.EnableAll(InputMapComponent.Kind.FreeCamera, + InputMapComponent.Kind.EmoteWheel); DCLInput.Instance.UI.Enable(); } @@ -778,7 +778,7 @@ private async UniTask ShowUntrustedRealmConfirmationAsync(CancellationToke var input = new ErrorPopupWithRetryController.Input( title: "Load Error", description: "A loading error was encountered. Please reload to try again.", - iconType: ErrorPopupWithRetryController.IconType.ERROR); + iconType: ErrorPopupWithRetryController.IconType.Error); await mvcManager.ShowAsync(ErrorPopupWithRetryController.IssueCommand(input), ct); @@ -872,7 +872,7 @@ public void Dispose() var input = new ErrorPopupWithRetryController.Input( title: "Time sync needed", description: "Your clock may be out of sync. Turn on “Set time automatically” in Date & Time settings and try again.", - iconType: ErrorPopupWithRetryController.IconType.CLOCK); + iconType: ErrorPopupWithRetryController.IconType.Clock); var ordering = new CanvasOrdering(controller.Layer, splashScreen.Value.GetComponent().sortingOrder + 1); @@ -884,14 +884,14 @@ public void Dispose() switch (input.SelectedOption) { - case ErrorPopupWithRetryController.Result.EXIT: + case ErrorPopupWithRetryController.Result.Exit: // The error popup will automatically request application exit - return EnsureClockSync.Result.CONTINUE; - case ErrorPopupWithRetryController.Result.RESTART: - return EnsureClockSync.Result.RESTART; + return EnsureClockSync.Result.Continue; + case ErrorPopupWithRetryController.Result.Restart: + return EnsureClockSync.Result.Restart; } - return EnsureClockSync.Result.CONTINUE; + return EnsureClockSync.Result.Continue; } private static Vector2Int? GetResolutionFromAppArgs(IAppArgs appArgs) diff --git a/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/PortableExperiences/ECSPortableExperiencesController.cs b/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/PortableExperiences/ECSPortableExperiencesController.cs index eaba16549d8..bacc7912932 100644 --- a/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/PortableExperiences/ECSPortableExperiencesController.cs +++ b/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/PortableExperiences/ECSPortableExperiencesController.cs @@ -132,7 +132,7 @@ public ECSPortableExperiencesController( world.Add(portableExperienceEntity, new PortableExperienceRealmComponent(realmData, parentSceneName, isGlobalPortableExperience), new PortableExperienceComponent(ens)); world.Add(portableExperienceEntity, new PortableExperienceMetadata { - Type = isGlobalPortableExperience ? PortableExperienceType.GLOBAL : PortableExperienceType.LOCAL, + Type = isGlobalPortableExperience ? PortableExperienceType.Global : PortableExperienceType.Local, Ens = portableExperienceId, Id = portableExperienceEntity.Id.ToString(), Name = realmData.RealmName, @@ -160,17 +160,17 @@ public bool CanKillPortableExperience(string id) switch (metadata.Type) { - case PortableExperienceType.GLOBAL: + case PortableExperienceType.Global: // Cannot kill a Global PX ever return false; - case PortableExperienceType.LOCAL: + case PortableExperienceType.Local: if (!FeatureFlagsConfiguration.Instance.IsEnabled(FeatureFlagsStrings.PORTABLE_EXPERIENCE)) return false; ISceneFacade currentSceneFacade = scenesCache.CurrentScene.Value; return currentSceneFacade != null && metadata.ParentSceneId == currentSceneFacade.Info.Name; - case PortableExperienceType.SMART_WEARABLE: + case PortableExperienceType.SmartWearable: // Can always kill a Smart Wearable PX return true; } diff --git a/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/RealmController.cs b/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/RealmController.cs index 1f3ede99a27..a7c8ecf6f55 100644 --- a/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/RealmController.cs +++ b/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/RealmController.cs @@ -340,7 +340,7 @@ private void RemoveUnfinishedScenes(World world) { world.Remove>(entity); world.Add(entity); - sceneLoadingState.VisualSceneState = VisualSceneState.UNINITIALIZED; + sceneLoadingState.VisualSceneState = VisualSceneState.Uninitialized; sceneLoadingState.PromiseCreated = false; } }); diff --git a/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/RealmUrl/RealmUrls.cs b/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/RealmUrl/RealmUrls.cs index 0a0fb5a1ca7..16015054baf 100644 --- a/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/RealmUrl/RealmUrls.cs +++ b/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/RealmUrl/RealmUrls.cs @@ -26,7 +26,7 @@ public async UniTask StartingRealmAsync(CancellationToken ct) return realmLaunchSettings.initialRealm switch { InitialRealm.GenesisCity => decentralandUrlsSource.Url(DecentralandUrl.Genesis), - InitialRealm.SDK => IRealmNavigator.SDK_TEST_SCENES_URL, + InitialRealm.Sdk => IRealmNavigator.SDK_TEST_SCENES_URL, InitialRealm.Goerli => IRealmNavigator.GOERLI_URL, InitialRealm.StreamingWorld => IRealmNavigator.STREAM_WORLD_URL, InitialRealm.TestScenes => IRealmNavigator.TEST_SCENES_URL, diff --git a/Explorer/Assets/DCL/Infrastructure/Global/Editor/RealmLaunchSettingsDrawer.cs b/Explorer/Assets/DCL/Infrastructure/Global/Editor/RealmLaunchSettingsDrawer.cs index 3ec1ccc2856..408e422271a 100644 --- a/Explorer/Assets/DCL/Infrastructure/Global/Editor/RealmLaunchSettingsDrawer.cs +++ b/Explorer/Assets/DCL/Infrastructure/Global/Editor/RealmLaunchSettingsDrawer.cs @@ -34,7 +34,7 @@ public class RealmLaunchSettingsDrawer : PropertyDrawer { "Restricted Actions", new Vector2Int(80, -4) }, }; - private static readonly InitialRealm[] TEST_REALMS = { InitialRealm.SDK, InitialRealm.Goerli, InitialRealm.StreamingWorld, InitialRealm.TestScenes }; + private static readonly InitialRealm[] TEST_REALMS = { InitialRealm.Sdk, InitialRealm.Goerli, InitialRealm.StreamingWorld, InitialRealm.TestScenes }; private static float singleLineHeight => EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; diff --git a/Explorer/Assets/DCL/Infrastructure/Global/UntrustedRealmConfirmationController.cs b/Explorer/Assets/DCL/Infrastructure/Global/UntrustedRealmConfirmationController.cs index 45af4f8aad8..3c0e5c9eba6 100644 --- a/Explorer/Assets/DCL/Infrastructure/Global/UntrustedRealmConfirmationController.cs +++ b/Explorer/Assets/DCL/Infrastructure/Global/UntrustedRealmConfirmationController.cs @@ -14,7 +14,7 @@ public UntrustedRealmConfirmationController(ViewFactoryMethod viewFactory) : bas { } - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; protected override void OnViewInstantiated() { diff --git a/Explorer/Assets/DCL/Infrastructure/MVC/CanvasOrdering.cs b/Explorer/Assets/DCL/Infrastructure/MVC/CanvasOrdering.cs index b5cf9a07d40..7f83328a268 100644 --- a/Explorer/Assets/DCL/Infrastructure/MVC/CanvasOrdering.cs +++ b/Explorer/Assets/DCL/Infrastructure/MVC/CanvasOrdering.cs @@ -6,18 +6,18 @@ public readonly struct CanvasOrdering { public enum SortingLayer { - FULLSCREEN, - POPUP, - PERSISTENT, //TODO: persistent needs blur handling on fullscreen and Overlay - OVERLAY, + Fullscreen, + Popup, + Persistent, //TODO: persistent needs blur handling on fullscreen and Overlay + Overlay, } private static IReadOnlyDictionary sortingLayerOffsets => new Dictionary { - {SortingLayer.PERSISTENT, 0}, - {SortingLayer.FULLSCREEN, 200}, - {SortingLayer.POPUP, 400}, - {SortingLayer.OVERLAY, 600}, + {SortingLayer.Persistent, 0}, + {SortingLayer.Fullscreen, 200}, + {SortingLayer.Popup, 400}, + {SortingLayer.Overlay, 600}, }; public readonly SortingLayer Layer; diff --git a/Explorer/Assets/DCL/Infrastructure/MVC/Examples/ExampleControllerWithSystem.cs b/Explorer/Assets/DCL/Infrastructure/MVC/Examples/ExampleControllerWithSystem.cs index e537f4ba095..f526910953a 100644 --- a/Explorer/Assets/DCL/Infrastructure/MVC/Examples/ExampleControllerWithSystem.cs +++ b/Explorer/Assets/DCL/Infrastructure/MVC/Examples/ExampleControllerWithSystem.cs @@ -14,7 +14,7 @@ public ExampleControllerWithSystem(ViewFactoryMethod viewFactory, ExampleControl binding = new BridgeSystemBinding(this, QueryDataQuery, system); } - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.FULLSCREEN; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Fullscreen; [Query] private void QueryData(in MVCCheetSheet.ExampleViewDataComponent component) diff --git a/Explorer/Assets/DCL/Infrastructure/MVC/Examples/MVCCheetSheet.cs b/Explorer/Assets/DCL/Infrastructure/MVC/Examples/MVCCheetSheet.cs index a5de5649ad5..5cbe5026c13 100644 --- a/Explorer/Assets/DCL/Infrastructure/MVC/Examples/MVCCheetSheet.cs +++ b/Explorer/Assets/DCL/Infrastructure/MVC/Examples/MVCCheetSheet.cs @@ -49,7 +49,7 @@ public class ExampleController : ControllerBase { public ExampleController(ViewFactoryMethod viewFactory) : base(viewFactory) { } - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.FULLSCREEN; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Fullscreen; protected override UniTask WaitForCloseIntentAsync(CancellationToken ct) => viewInstance.CloseButton.OnClickAsync(ct); diff --git a/Explorer/Assets/DCL/Infrastructure/MVC/IController.cs b/Explorer/Assets/DCL/Infrastructure/MVC/IController.cs index 851cadf78b1..1035b46bd70 100644 --- a/Explorer/Assets/DCL/Infrastructure/MVC/IController.cs +++ b/Explorer/Assets/DCL/Infrastructure/MVC/IController.cs @@ -11,7 +11,7 @@ public interface IController /// Overridable flag indicating whether the view can be closed by Escape key /// Default: true for Popup and Fullscreen layers, false for Persistent and Overlay layers as they shouldn't be able to be closed at all /// - bool CanBeClosedByEscape => Layer is not CanvasOrdering.SortingLayer.PERSISTENT and not CanvasOrdering.SortingLayer.OVERLAY; + bool CanBeClosedByEscape => Layer is not CanvasOrdering.SortingLayer.Persistent and not CanvasOrdering.SortingLayer.Overlay; CanvasOrdering.SortingLayer Layer { get; } diff --git a/Explorer/Assets/DCL/Infrastructure/MVC/MVCFacade/MVCManagerMenusAccessFacade.cs b/Explorer/Assets/DCL/Infrastructure/MVC/MVCFacade/MVCManagerMenusAccessFacade.cs index 78c51f545df..b5af2105310 100644 --- a/Explorer/Assets/DCL/Infrastructure/MVC/MVCFacade/MVCManagerMenusAccessFacade.cs +++ b/Explorer/Assets/DCL/Infrastructure/MVC/MVCFacade/MVCManagerMenusAccessFacade.cs @@ -113,7 +113,7 @@ public async UniTask ShowChatEntryMenuPopupAsync(ChatEntryMenuPopupData data, Ca await mvcManager.ShowAsync(ChatEntryMenuPopupController.IssueCommand(data), ct); public async UniTask ShowUserProfileContextMenuFromWalletIdAsync(Web3Address walletId, Vector3 position, Vector2 offset, CancellationToken ct, UniTask closeMenuTask, - Action? onHide = null, MenuAnchorPoint anchorPoint = MenuAnchorPoint.DEFAULT, Action? onShow = null, bool isOpenedOnWorldAvatar = false) + Action? onHide = null, MenuAnchorPoint anchorPoint = MenuAnchorPoint.Default, Action? onShow = null, bool isOpenedOnWorldAvatar = false) { Profile.CompactInfo? profile = await profileRepository.GetCompactAsync(walletId, ct); @@ -123,7 +123,7 @@ public async UniTask ShowUserProfileContextMenuFromWalletIdAsync(Web3Address wal await ShowUserProfileContextMenuAsync(profile.Value, position, offset, ct, onHide, onShow, closeMenuTask, anchorPoint, isOpenedOnWorldAvatar); } - public async UniTask ShowCommunityPlayerEntryContextMenuAsync(string participantWalletId, bool isSpeaker, Vector3 position, Vector2 offset, CancellationToken ct, UniTask closeMenuTask, Action? onHide = null, MenuAnchorPoint anchorPoint = MenuAnchorPoint.DEFAULT) + public async UniTask ShowCommunityPlayerEntryContextMenuAsync(string participantWalletId, bool isSpeaker, Vector3 position, Vector2 offset, CancellationToken ct, UniTask closeMenuTask, Action? onHide = null, MenuAnchorPoint anchorPoint = MenuAnchorPoint.Default) { if (string.IsNullOrEmpty(participantWalletId)) return; @@ -149,14 +149,14 @@ public async UniTaskVoid ShowChatContextMenuAsync(Vector3 transformPosition, Cha } private async UniTask ShowUserProfileContextMenuAsync(Profile.CompactInfo profile, Vector3 position, Vector2 offset, CancellationToken ct, Action? onContextMenuHide, Action? onContextMenuShow, - UniTask closeMenuTask, MenuAnchorPoint anchorPoint = MenuAnchorPoint.DEFAULT, bool isOpenedOnWorldAvatar = false) + UniTask closeMenuTask, MenuAnchorPoint anchorPoint = MenuAnchorPoint.Default, bool isOpenedOnWorldAvatar = false) { genericUserProfileContextMenuController ??= new GenericUserProfileContextMenuController(friendsService, chatEventBus, mvcManager, contextMenuSettings, analytics, onlineUsersProvider, realmNavigator, friendOnlineStatusCache, includeCommunities, communitiesDataProvider, voiceChatOrchestrator, webBrowser, decentralandUrlsSource, selfProfile, nearbyMuteService); await genericUserProfileContextMenuController.ShowUserProfileContextMenuAsync(profile, position, offset, ct, closeMenuTask, onContextMenuHide, ConvertMenuAnchorPoint(anchorPoint), onContextMenuShow, isOpenedOnWorldAvatar); } private async UniTask ShowCommunityPlayerEntryContextMenuAsync(Profile.CompactInfo profile, Vector3 position, Vector2 offset, CancellationToken ct, Action? onContextMenuHide, - UniTask closeMenuTask, MenuAnchorPoint anchorPoint = MenuAnchorPoint.DEFAULT, bool isSpeaker = false) + UniTask closeMenuTask, MenuAnchorPoint anchorPoint = MenuAnchorPoint.Default, bool isSpeaker = false) { communityPlayerEntryContextMenu ??= new CommunityPlayerEntryContextMenu( friendsService, mvcManager, @@ -182,21 +182,21 @@ private ContextMenuOpenDirection ConvertMenuAnchorPoint(MenuAnchorPoint anchorPo { switch (anchorPoint) { - case MenuAnchorPoint.TOP_LEFT: - return ContextMenuOpenDirection.TOP_LEFT; - case MenuAnchorPoint.TOP_RIGHT: - return ContextMenuOpenDirection.TOP_RIGHT; - case MenuAnchorPoint.BOTTOM_LEFT: - return ContextMenuOpenDirection.BOTTOM_LEFT; - case MenuAnchorPoint.BOTTOM_RIGHT: - return ContextMenuOpenDirection.BOTTOM_RIGHT; - case MenuAnchorPoint.CENTER_LEFT: - return ContextMenuOpenDirection.CENTER_LEFT; - case MenuAnchorPoint.CENTER_RIGHT: - return ContextMenuOpenDirection.CENTER_RIGHT; + case MenuAnchorPoint.TopLeft: + return ContextMenuOpenDirection.TopLeft; + case MenuAnchorPoint.TopRight: + return ContextMenuOpenDirection.TopRight; + case MenuAnchorPoint.BottomLeft: + return ContextMenuOpenDirection.BottomLeft; + case MenuAnchorPoint.BottomRight: + return ContextMenuOpenDirection.BottomRight; + case MenuAnchorPoint.CenterLeft: + return ContextMenuOpenDirection.CenterLeft; + case MenuAnchorPoint.CenterRight: + return ContextMenuOpenDirection.CenterRight; default: - case MenuAnchorPoint.DEFAULT: - return ContextMenuOpenDirection.BOTTOM_RIGHT; + case MenuAnchorPoint.Default: + return ContextMenuOpenDirection.BottomRight; } } } diff --git a/Explorer/Assets/DCL/Infrastructure/MVC/Manager/MVCManager.cs b/Explorer/Assets/DCL/Infrastructure/MVC/Manager/MVCManager.cs index 76e24e06446..ec83c250a75 100644 --- a/Explorer/Assets/DCL/Infrastructure/MVC/Manager/MVCManager.cs +++ b/Explorer/Assets/DCL/Infrastructure/MVC/Manager/MVCManager.cs @@ -111,16 +111,16 @@ public async UniTask ShowAsync(ShowCommand switch (controller.Layer) { - case CanvasOrdering.SortingLayer.POPUP: + case CanvasOrdering.SortingLayer.Popup: await ShowPopupAsync(command, controller, ct); break; - case CanvasOrdering.SortingLayer.FULLSCREEN: + case CanvasOrdering.SortingLayer.Fullscreen: await ShowFullScreenAsync(command, controller, ct); break; - case CanvasOrdering.SortingLayer.PERSISTENT: + case CanvasOrdering.SortingLayer.Persistent: await ShowPersistentAsync(command, controller, ct); break; - case CanvasOrdering.SortingLayer.OVERLAY: + case CanvasOrdering.SortingLayer.Overlay: await ShowOverlayAsync(command, controller, ct); break; } diff --git a/Explorer/Assets/DCL/Infrastructure/MVC/Tests/ControllerBaseShould.cs b/Explorer/Assets/DCL/Infrastructure/MVC/Tests/ControllerBaseShould.cs index 73fbc7e545d..f86957ef853 100644 --- a/Explorer/Assets/DCL/Infrastructure/MVC/Tests/ControllerBaseShould.cs +++ b/Explorer/Assets/DCL/Infrastructure/MVC/Tests/ControllerBaseShould.cs @@ -27,7 +27,7 @@ public void SetUp() [Test] public async Task LaunchViewLifeCycle() { - var canvasOrdering = new CanvasOrdering(CanvasOrdering.SortingLayer.FULLSCREEN, 100); + var canvasOrdering = new CanvasOrdering(CanvasOrdering.SortingLayer.Fullscreen, 100); var input = new TestInputData { Value = 123 }; // Fire the closing intent @@ -58,7 +58,7 @@ public async Task HideView() { // Show first - var canvasOrdering = new CanvasOrdering(CanvasOrdering.SortingLayer.FULLSCREEN, 100); + var canvasOrdering = new CanvasOrdering(CanvasOrdering.SortingLayer.Fullscreen, 100); controller.CompletionSource.TrySetResult(); await controller.LaunchViewLifeCycleAsync(canvasOrdering, new TestInputData(), CancellationToken.None); @@ -115,7 +115,7 @@ public class TestController : ControllerBase public readonly IMVCControllerModule Module; - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.FULLSCREEN; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Fullscreen; internal TestInputData Input => inputData; diff --git a/Explorer/Assets/DCL/Infrastructure/MVC/Tests/MVCManagerShould.cs b/Explorer/Assets/DCL/Infrastructure/MVC/Tests/MVCManagerShould.cs index 4c4d603cb46..7a1ef755d9b 100644 --- a/Explorer/Assets/DCL/Infrastructure/MVC/Tests/MVCManagerShould.cs +++ b/Explorer/Assets/DCL/Infrastructure/MVC/Tests/MVCManagerShould.cs @@ -51,10 +51,10 @@ public void RegisterControllerThrowsExceptionWhenSameControllerIsAddedTwice() } [Test] - [TestCase(CanvasOrdering.SortingLayer.POPUP)] - [TestCase(CanvasOrdering.SortingLayer.FULLSCREEN)] - [TestCase(CanvasOrdering.SortingLayer.OVERLAY)] - [TestCase(CanvasOrdering.SortingLayer.PERSISTENT)] + [TestCase(CanvasOrdering.SortingLayer.Popup)] + [TestCase(CanvasOrdering.SortingLayer.Fullscreen)] + [TestCase(CanvasOrdering.SortingLayer.Overlay)] + [TestCase(CanvasOrdering.SortingLayer.Persistent)] public async Task Show(CanvasOrdering.SortingLayer layer) { IController controller = Substitute.For>(); @@ -66,19 +66,19 @@ public async Task Show(CanvasOrdering.SortingLayer layer) switch (layer) { - case CanvasOrdering.SortingLayer.POPUP: + case CanvasOrdering.SortingLayer.Popup: await popupCloserView.Received().ShowAsync(Arg.Any()); windowsStackManager.Received().PushPopup(controller); break; - case CanvasOrdering.SortingLayer.FULLSCREEN: + case CanvasOrdering.SortingLayer.Fullscreen: await popupCloserView.DidNotReceive().ShowAsync(Arg.Any()); windowsStackManager.Received().PushFullscreen(controller); break; - case CanvasOrdering.SortingLayer.OVERLAY: + case CanvasOrdering.SortingLayer.Overlay: await popupCloserView.DidNotReceive().ShowAsync(Arg.Any()); windowsStackManager.Received().PushOverlay(controller); break; - case CanvasOrdering.SortingLayer.PERSISTENT: + case CanvasOrdering.SortingLayer.Persistent: await popupCloserView.DidNotReceive().ShowAsync(Arg.Any()); windowsStackManager.Received().PushPersistent(controller); break; diff --git a/Explorer/Assets/DCL/Infrastructure/MVC/ViewDependencies/IMVCManagerMenusAccessFacade.cs b/Explorer/Assets/DCL/Infrastructure/MVC/ViewDependencies/IMVCManagerMenusAccessFacade.cs index 2a8d09c27cf..12cd50eb8e7 100644 --- a/Explorer/Assets/DCL/Infrastructure/MVC/ViewDependencies/IMVCManagerMenusAccessFacade.cs +++ b/Explorer/Assets/DCL/Infrastructure/MVC/ViewDependencies/IMVCManagerMenusAccessFacade.cs @@ -20,11 +20,11 @@ public interface IMVCManagerMenusAccessFacade UniTask ShowChatEntryMenuPopupAsync(ChatEntryMenuPopupData data, CancellationToken ct); - UniTask ShowUserProfileContextMenuFromWalletIdAsync(Web3Address walletId, Vector3 position, Vector2 offset, CancellationToken ct, UniTask closeMenuTask, Action onHide = null, MenuAnchorPoint anchorPoint = MenuAnchorPoint.DEFAULT, Action onShow = null, bool isOpenedOnWorldAvatar = false); + UniTask ShowUserProfileContextMenuFromWalletIdAsync(Web3Address walletId, Vector3 position, Vector2 offset, CancellationToken ct, UniTask closeMenuTask, Action onHide = null, MenuAnchorPoint anchorPoint = MenuAnchorPoint.Default, Action onShow = null, bool isOpenedOnWorldAvatar = false); UniTask ShowUserProfileContextMenuFromUserNameAsync(string userName, Vector3 position, Vector2 offset, CancellationToken ct, UniTask closeMenuTask, Action? onHide = null, Action? onShow = null); - UniTask ShowCommunityPlayerEntryContextMenuAsync(string participantWalletId, bool isSpeaker, Vector3 position, Vector2 offset, CancellationToken ct, UniTask closeMenuTask, Action? onHide = null, MenuAnchorPoint anchorPoint = MenuAnchorPoint.DEFAULT); + UniTask ShowCommunityPlayerEntryContextMenuAsync(string participantWalletId, bool isSpeaker, Vector3 position, Vector2 offset, CancellationToken ct, UniTask closeMenuTask, Action? onHide = null, MenuAnchorPoint anchorPoint = MenuAnchorPoint.Default); /// /// Directly opens the passport for the specified user ID without showing a context menu. @@ -53,12 +53,12 @@ public struct CommunityContextMenuData public enum MenuAnchorPoint { - TOP_LEFT, - TOP_RIGHT, - BOTTOM_LEFT, - BOTTOM_RIGHT, - CENTER_LEFT, - CENTER_RIGHT, - DEFAULT + TopLeft, + TopRight, + BottomLeft, + BottomRight, + CenterLeft, + CenterRight, + Default } } diff --git a/Explorer/Assets/DCL/Infrastructure/MVC/WindowsStackManager/WindowStackManager.cs b/Explorer/Assets/DCL/Infrastructure/MVC/WindowsStackManager/WindowStackManager.cs index 9cc014884cf..973c1f463f9 100644 --- a/Explorer/Assets/DCL/Infrastructure/MVC/WindowsStackManager/WindowStackManager.cs +++ b/Explorer/Assets/DCL/Infrastructure/MVC/WindowsStackManager/WindowStackManager.cs @@ -64,8 +64,8 @@ public PopupPushInfo PushPopup(IController controller) persistant.Blur(); return new PopupPushInfo( - new CanvasOrdering(CanvasOrdering.SortingLayer.POPUP, currentMaxOrderInLayer), - new CanvasOrdering(CanvasOrdering.SortingLayer.POPUP, currentMaxOrderInLayer - 1), + new CanvasOrdering(CanvasOrdering.SortingLayer.Popup, currentMaxOrderInLayer), + new CanvasOrdering(CanvasOrdering.SortingLayer.Popup, currentMaxOrderInLayer - 1), popupStack.Count >= 2 ? popupStack[^2].controller : null, onClose); } @@ -85,7 +85,7 @@ public FullscreenPushInfo PushFullscreen(IController controller) if(persistentController.State == ControllerState.ViewFocused) persistentController.Blur(); - return new FullscreenPushInfo(popupStack, new CanvasOrdering(CanvasOrdering.SortingLayer.FULLSCREEN, 0), onClose); + return new FullscreenPushInfo(popupStack, new CanvasOrdering(CanvasOrdering.SortingLayer.Fullscreen, 0), onClose); } public void PopFullscreen(IController? controller) @@ -108,7 +108,7 @@ public PersistentPushInfo PushPersistent(IController controller) { persistentStack.Add(controller); controllersClosures.Add((controller, new UniTaskCompletionSource())); - return new PersistentPushInfo(new CanvasOrdering(CanvasOrdering.SortingLayer.PERSISTENT, -20)); + return new PersistentPushInfo(new CanvasOrdering(CanvasOrdering.SortingLayer.Persistent, -20)); } public void RemovePersistent(IController controller) @@ -121,7 +121,7 @@ public OverlayPushInfo PushOverlay(IController controller) { overlayController = controller; controllersClosures.Add((controller, new UniTaskCompletionSource())); - return new OverlayPushInfo(popupStack, fullscreenController, new CanvasOrdering(CanvasOrdering.SortingLayer.OVERLAY, 1)); + return new OverlayPushInfo(popupStack, fullscreenController, new CanvasOrdering(CanvasOrdering.SortingLayer.Overlay, 1)); } private void TryGracefulClose(IController controller) @@ -171,7 +171,7 @@ public PopupPopInfo PopPopup(IController controller, bool shouldGracefullyClose (IController controller, int orderInLayer) topMostPopup = TopMostPopup; return new PopupPopInfo( - new CanvasOrdering(CanvasOrdering.SortingLayer.POPUP, topMostPopup.controller == null ? MINIMUM_POPUP_CLOSER_ODER_IN_LAYER : topMostPopup.orderInLayer - 1), + new CanvasOrdering(CanvasOrdering.SortingLayer.Popup, topMostPopup.controller == null ? MINIMUM_POPUP_CLOSER_ODER_IN_LAYER : topMostPopup.orderInLayer - 1), topMostPopup.controller); } diff --git a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Components/SceneLoadingState.cs b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Components/SceneLoadingState.cs index fb8ca52c8d2..425dd202120 100644 --- a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Components/SceneLoadingState.cs +++ b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Components/SceneLoadingState.cs @@ -13,7 +13,7 @@ public static SceneLoadingState CreateRoad() => { PromiseCreated = false, FullQuality = true, - VisualSceneState = VisualSceneState.ROAD, + VisualSceneState = VisualSceneState.Road, }; public static SceneLoadingState CreatePortableExperience() => @@ -21,7 +21,7 @@ public static SceneLoadingState CreatePortableExperience() => { PromiseCreated = true, FullQuality = true, - VisualSceneState = VisualSceneState.SHOWING_SCENE, + VisualSceneState = VisualSceneState.ShowingScene, }; //Testing purpose @@ -30,7 +30,7 @@ public static SceneLoadingState CreateBuiltScene() => { PromiseCreated = true, FullQuality = true, - VisualSceneState = VisualSceneState.SHOWING_SCENE, + VisualSceneState = VisualSceneState.ShowingScene, }; //Testing purpose @@ -39,15 +39,15 @@ public static SceneLoadingState CreateHighQualityLOD() => { PromiseCreated = true, FullQuality = true, - VisualSceneState = VisualSceneState.SHOWING_LOD, + VisualSceneState = VisualSceneState.ShowingLod, }; } public enum VisualSceneState { - UNINITIALIZED, - SHOWING_SCENE, - SHOWING_LOD, - ROAD, + Uninitialized, + ShowingScene, + ShowingLod, + Road, } } diff --git a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Debug/SceneAbortKind.cs b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Debug/SceneAbortKind.cs index 67c5180ecc4..0ff5cf70937 100644 --- a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Debug/SceneAbortKind.cs +++ b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Debug/SceneAbortKind.cs @@ -2,8 +2,8 @@ { public enum SceneAbortKind : byte { - NONE = 0, - EXCEPTION = 1, - CANCEL = 2, + None = 0, + Exception = 1, + Cancel = 2, } } diff --git a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Debug/Systems/AbortSceneLoadingDebugSystem.cs b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Debug/Systems/AbortSceneLoadingDebugSystem.cs index 41c285aa67c..5ea5d7c19e7 100644 --- a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Debug/Systems/AbortSceneLoadingDebugSystem.cs +++ b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Debug/Systems/AbortSceneLoadingDebugSystem.cs @@ -25,7 +25,7 @@ public partial class AbortSceneLoadingDebugSystem : BaseUnityLoopSystem private AbortSceneLoadingDebugSystem(World world, DebugWidgetBuilder debugWidgetBuilder) : base(world) { - debugWidgetBuilder.AddControl(new DebugDropdownDef(abortKind = new EnumElementBinding(SceneAbortKind.NONE), "Type"), + debugWidgetBuilder.AddControl(new DebugDropdownDef(abortKind = new EnumElementBinding(SceneAbortKind.None), "Type"), null, debugHintDef: new DebugHintDef("Abort Scene Loading")); @@ -34,7 +34,7 @@ private AbortSceneLoadingDebugSystem(World world, DebugWidgetBuilder debugWidget protected override void Update(float t) { - if (abortKind.Value == SceneAbortKind.NONE) + if (abortKind.Value == SceneAbortKind.None) return; TryAbortLoadingQuery(World); @@ -48,7 +48,7 @@ private void TryAbortLoading(Entity entity, in GetSceneFacadeIntention intention Exception exceptionToReport = abortKind.Value switch { - SceneAbortKind.CANCEL => new OperationCanceledException(), + SceneAbortKind.Cancel => new OperationCanceledException(), _ => new Exception($"Loading of Scene {intention.DefinitionComponent.Definition.metadata.scene.DecodedBase} has been manually interrupted"), }; diff --git a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Debug/Systems/RapidSceneReloadDebugSystem.cs b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Debug/Systems/RapidSceneReloadDebugSystem.cs index 49fe62fb484..1f6769483f4 100644 --- a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Debug/Systems/RapidSceneReloadDebugSystem.cs +++ b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Debug/Systems/RapidSceneReloadDebugSystem.cs @@ -87,7 +87,7 @@ protected override void Update(float t) [None(typeof(DeleteEntityIntention), typeof(PortableExperienceComponent), typeof(SmartWearableId))] private void ForceUnloadLoadedScenes(in Entity entity, ref SceneLoadingState sceneLoadingState) { - sceneLoadingState.VisualSceneState = VisualSceneState.UNINITIALIZED; + sceneLoadingState.VisualSceneState = VisualSceneState.Uninitialized; sceneLoadingState.PromiseCreated = false; sceneLoadingState.FullQuality = false; World.Add(entity, new DeleteEntityIntention { DeferDeletion = true }); @@ -98,7 +98,7 @@ private void ForceUnloadLoadedScenes(in Entity entity, ref SceneLoadingState sce [None(typeof(ISceneFacade), typeof(DeleteEntityIntention), typeof(PortableExperienceComponent), typeof(SmartWearableId))] private void AbortLoadingScenes(in Entity entity, ref SceneLoadingState sceneLoadingState) { - sceneLoadingState.VisualSceneState = VisualSceneState.UNINITIALIZED; + sceneLoadingState.VisualSceneState = VisualSceneState.Uninitialized; sceneLoadingState.PromiseCreated = false; sceneLoadingState.FullQuality = false; World.Add(entity, new DeleteEntityIntention { DeferDeletion = true }); diff --git a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/ECSBannedScene.cs b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/ECSBannedScene.cs index cd9cf88b60d..a15b6f4a7aa 100644 --- a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/ECSBannedScene.cs +++ b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/ECSBannedScene.cs @@ -55,7 +55,7 @@ await UniTask.WaitUntil(() => sceneInCache.SceneStateProvider.State.Value() == S if (world.IsAlive(foundEntity)) { SceneLoadingState sceneLoadingState = world.Get(foundEntity); - sceneLoadingState.VisualSceneState = VisualSceneState.UNINITIALIZED; + sceneLoadingState.VisualSceneState = VisualSceneState.Uninitialized; sceneLoadingState.PromiseCreated = false; } diff --git a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/ECSReloadScene.cs b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/ECSReloadScene.cs index 6a4fe64319b..9d48dcfca39 100644 --- a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/ECSReloadScene.cs +++ b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/ECSReloadScene.cs @@ -87,7 +87,7 @@ private async UniTask DisposeAndRestartAsync(Entity entity, ISceneFacade current if (world.IsAlive(entity)) { SceneLoadingState sceneLoadingState = world.Get(entity); - sceneLoadingState.VisualSceneState = VisualSceneState.UNINITIALIZED; + sceneLoadingState.VisualSceneState = VisualSceneState.Uninitialized; sceneLoadingState.PromiseCreated = false; } diff --git a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/IncreasingRadius/ResolveSceneStateByIncreasingRadiusSystem.cs b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/IncreasingRadius/ResolveSceneStateByIncreasingRadiusSystem.cs index ba3cd3eb237..1f3d9fd33ea 100644 --- a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/IncreasingRadius/ResolveSceneStateByIncreasingRadiusSystem.cs +++ b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/IncreasingRadius/ResolveSceneStateByIncreasingRadiusSystem.cs @@ -268,7 +268,7 @@ private void TryUnload(in Entity entity, ref SceneLoadingState sceneState) private void Unload(in Entity entity, ref SceneLoadingState sceneState) { - sceneState.VisualSceneState = VisualSceneState.UNINITIALIZED; + sceneState.VisualSceneState = VisualSceneState.Uninitialized; sceneState.PromiseCreated = false; sceneState.FullQuality = false; @@ -289,13 +289,13 @@ VisualSceneState candidateBy = visualSceneStateResolver.ResolveVisualSceneState(partitionComponent, sceneDefinitionComponent, sceneState.VisualSceneState, ipfsRealm.SceneUrns.Count > 0, issDescriptor); //If we are over the amount of scenes that can be loaded, we downgrade quality to LOD - if (candidateBy == VisualSceneState.SHOWING_SCENE && !sceneLoadingLimit.CanLoadScene(sceneDefinitionComponent)) + if (candidateBy == VisualSceneState.ShowingScene && !sceneLoadingLimit.CanLoadScene(sceneDefinitionComponent)) { //Lets do a quality reduction analysis - candidateBy = VisualSceneState.SHOWING_LOD; + candidateBy = VisualSceneState.ShowingLod; } //Reduce quality - if (candidateBy == VisualSceneState.SHOWING_LOD) + if (candidateBy == VisualSceneState.ShowingLod) { if (sceneLoadingLimit.CanLoadLOD(sceneDefinitionComponent)) { @@ -308,7 +308,7 @@ VisualSceneState candidateBy { //This wasnt previously quality reducted. Lets try to unload it and on next iteration we will try to load TryUnload(entity, ref sceneState); - candidateBy = VisualSceneState.UNINITIALIZED; + candidateBy = VisualSceneState.Uninitialized; } // Reduce the quality of this LOD if we have not yet hit the quality-reduction limit sceneState.FullQuality = false; @@ -317,12 +317,12 @@ VisualSceneState candidateBy { // Nothing else can load. And we need to unload the loaded which are still inside the loading range TryUnload(entity, ref sceneState); - candidateBy = VisualSceneState.UNINITIALIZED; + candidateBy = VisualSceneState.Uninitialized; } } //No new promise is required - if (candidateBy == VisualSceneState.UNINITIALIZED + if (candidateBy == VisualSceneState.Uninitialized || sceneState.VisualSceneState == candidateBy) return; @@ -347,7 +347,7 @@ VisualSceneState candidateBy switch (sceneState.VisualSceneState) { - case VisualSceneState.SHOWING_LOD: + case VisualSceneState.ShowingLod: //The SceneLODInfo may still be in the entity, since it remains there until SceneIsReady (Check UnloadSceneLODInfoSystem) //Therefore, we need to make this check because we dont want to break the entity mutual exclusive state if (!World.Has(entity)) diff --git a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/IncreasingRadius/VisualSceneStateResolver.cs b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/IncreasingRadius/VisualSceneStateResolver.cs index eeaf867804f..bba1c43601d 100644 --- a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/IncreasingRadius/VisualSceneStateResolver.cs +++ b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/IncreasingRadius/VisualSceneStateResolver.cs @@ -23,19 +23,19 @@ public VisualSceneState ResolveVisualSceneState(PartitionComponent partition, Sc //In worlds, only SDK7 scenes with a resolved ISS descriptor participate in LODs. //Anything else keeps the legacy always-full-scene behavior if (scenesAreFixed && (!sceneDefinitionComponent.IsSDK7 || !issDescriptor.SupportsDescriptor())) - return VisualSceneState.SHOWING_SCENE; + return VisualSceneState.ShowingScene; //For SDK6 scenes, we just show lod0 if (!sceneDefinitionComponent.IsSDK7) - return VisualSceneState.SHOWING_LOD; + return VisualSceneState.ShowingLod; - int isSceneLoaded = currentVisualSceneState == VisualSceneState.SHOWING_SCENE + int isSceneLoaded = currentVisualSceneState == VisualSceneState.ShowingScene ? unloadTolerance : 0; return partition.Bucket < sdk7LodThreshold + isSceneLoaded - ? VisualSceneState.SHOWING_SCENE - : VisualSceneState.SHOWING_LOD; + ? VisualSceneState.ShowingScene + : VisualSceneState.ShowingLod; } } diff --git a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Realm/IRealmNavigator.cs b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Realm/IRealmNavigator.cs index a5b4f8579fc..5ee1e9480f9 100644 --- a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Realm/IRealmNavigator.cs +++ b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Realm/IRealmNavigator.cs @@ -9,27 +9,27 @@ namespace ECS.SceneLifeCycle.Realm { public enum ChangeRealmError { - MESSAGE_ERROR, - CHANGE_CANCELLED, - NOT_REACHABLE, - LOCAL_SCENE_DEVELOPMENT_BLOCKED, - UNAUTHORIZED_WORLD_ACCESS, - TIMEOUT, + MessageError, + ChangeCancelled, + NotReachable, + LocalSceneDevelopmentBlocked, + UnauthorizedWorldAccess, + Timeout, /// /// World requires a password to access. /// - PASSWORD_REQUIRED, + PasswordRequired, /// /// User cancelled the password entry. /// - PASSWORD_CANCELLED, + PasswordCancelled, /// /// User is not on the allow-list for this world. /// - WHITELIST_ACCESS_DENIED + WhitelistAccessDenied } public static class ChangeRealmErrors @@ -37,25 +37,25 @@ public static class ChangeRealmErrors public static TaskError AsTaskError(this ChangeRealmError e) => e switch { - ChangeRealmError.MESSAGE_ERROR => TaskError.MessageError, - ChangeRealmError.CHANGE_CANCELLED => TaskError.Cancelled, - ChangeRealmError.NOT_REACHABLE => TaskError.MessageError, - ChangeRealmError.LOCAL_SCENE_DEVELOPMENT_BLOCKED => TaskError.MessageError, - ChangeRealmError.TIMEOUT => TaskError.Timeout, - ChangeRealmError.PASSWORD_REQUIRED => TaskError.MessageError, - ChangeRealmError.PASSWORD_CANCELLED => TaskError.Cancelled, - ChangeRealmError.WHITELIST_ACCESS_DENIED => TaskError.MessageError, - ChangeRealmError.UNAUTHORIZED_WORLD_ACCESS => TaskError.MessageError, + ChangeRealmError.MessageError => TaskError.MessageError, + ChangeRealmError.ChangeCancelled => TaskError.Cancelled, + ChangeRealmError.NotReachable => TaskError.MessageError, + ChangeRealmError.LocalSceneDevelopmentBlocked => TaskError.MessageError, + ChangeRealmError.Timeout => TaskError.Timeout, + ChangeRealmError.PasswordRequired => TaskError.MessageError, + ChangeRealmError.PasswordCancelled => TaskError.Cancelled, + ChangeRealmError.WhitelistAccessDenied => TaskError.MessageError, + ChangeRealmError.UnauthorizedWorldAccess => TaskError.MessageError, _ => throw new ArgumentOutOfRangeException(nameof(e), e, null) }; public static ChangeRealmError AsChangeRealmError(this TaskError e) => e switch { - TaskError.MessageError => ChangeRealmError.MESSAGE_ERROR, - TaskError.Timeout => ChangeRealmError.TIMEOUT, - TaskError.Cancelled => ChangeRealmError.CHANGE_CANCELLED, - TaskError.UnexpectedException => ChangeRealmError.MESSAGE_ERROR, + TaskError.MessageError => ChangeRealmError.MessageError, + TaskError.Timeout => ChangeRealmError.Timeout, + TaskError.Cancelled => ChangeRealmError.ChangeCancelled, + TaskError.UnexpectedException => ChangeRealmError.MessageError, _ => throw new ArgumentOutOfRangeException(nameof(e), e, null) }; diff --git a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Realm/PortableExperienceMetadata.cs b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Realm/PortableExperienceMetadata.cs index 8d7944a6a18..a77dae14fe4 100644 --- a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Realm/PortableExperienceMetadata.cs +++ b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Realm/PortableExperienceMetadata.cs @@ -22,16 +22,16 @@ public enum PortableExperienceType /// /// A PX loaded explicitly by the user. /// - LOCAL, + Local, /// /// A PX that runs for all users. /// - GLOBAL, + Global, /// /// A PX attached to a Smart Wearable. /// - SMART_WEARABLE + SmartWearable } } diff --git a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/SceneLoadingLimit/SceneLimitsKey.cs b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/SceneLoadingLimit/SceneLimitsKey.cs index a4682cd3d06..e3c8868be84 100644 --- a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/SceneLoadingLimit/SceneLimitsKey.cs +++ b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/SceneLoadingLimit/SceneLimitsKey.cs @@ -1,9 +1,9 @@ namespace ECS.SceneLifeCycle.IncreasingRadius { public enum SceneLimitsKey { - WARNING, - LOW_MEMORY, - MEDIUM_MEMORY, - MAX_MEMORY, + Warning, + LowMemory, + MediumMemory, + MaxMemory, } } diff --git a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/SceneLoadingLimit/SceneLoadingLimit.cs b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/SceneLoadingLimit/SceneLoadingLimit.cs index 12890f13921..2791e795772 100644 --- a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/SceneLoadingLimit/SceneLoadingLimit.cs +++ b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/SceneLoadingLimit/SceneLoadingLimit.cs @@ -13,16 +13,16 @@ public class SceneLoadingLimit private readonly Dictionary constantSceneLimits = new () { // 1 scene, 1 high quality LOD, 10 low quality LODs. Limit: 561MB - { SceneLimitsKey.LOW_MEMORY, new SceneLimits(SceneLoadingMemoryConstants.MAX_SCENE_SIZE + SceneLoadingMemoryConstants.MAX_SCENE_LOD, 10 * SceneLoadingMemoryConstants.MAX_SCENE_LOWQUALITY_LOD) }, + { SceneLimitsKey.LowMemory, new SceneLimits(SceneLoadingMemoryConstants.MAX_SCENE_SIZE + SceneLoadingMemoryConstants.MAX_SCENE_LOD, 10 * SceneLoadingMemoryConstants.MAX_SCENE_LOWQUALITY_LOD) }, // 3 scenes, 5 high quality LODs, 30 low quality LODs. Limit: 1925MB - { SceneLimitsKey.MEDIUM_MEMORY, new SceneLimits((3 * SceneLoadingMemoryConstants.MAX_SCENE_SIZE) + (5 * SceneLoadingMemoryConstants.MAX_SCENE_LOD), 30 * SceneLoadingMemoryConstants.MAX_SCENE_LOWQUALITY_LOD) }, + { SceneLimitsKey.MediumMemory, new SceneLimits((3 * SceneLoadingMemoryConstants.MAX_SCENE_SIZE) + (5 * SceneLoadingMemoryConstants.MAX_SCENE_LOD), 30 * SceneLoadingMemoryConstants.MAX_SCENE_LOWQUALITY_LOD) }, // No limits. - { SceneLimitsKey.MAX_MEMORY, new SceneLimits(float.MaxValue, float.MaxValue) }, + { SceneLimitsKey.MaxMemory, new SceneLimits(float.MaxValue, float.MaxValue) }, // 1 scene, 1 high quality LOD. Could be useful for debugging single scenes - { SceneLimitsKey.WARNING, new SceneLimits(1, 5 * SceneLoadingMemoryConstants.MAX_SCENE_LOWQUALITY_LOD) }, + { SceneLimitsKey.Warning, new SceneLimits(1, 5 * SceneLoadingMemoryConstants.MAX_SCENE_LOWQUALITY_LOD) }, }; //Initial setup @@ -44,10 +44,10 @@ public class SceneLoadingLimit public SceneLoadingLimit(ISystemMemoryCap memoryCap) { - sceneTransitionState = SceneTransitionState.NORMAL; + sceneTransitionState = SceneTransitionState.Normal; systemMemoryCap = memoryCap; - initialKey = SceneLimitsKey.MAX_MEMORY; + initialKey = SceneLimitsKey.MaxMemory; currentSceneLimits = constantSceneLimits[initialKey]; } @@ -99,15 +99,15 @@ public void UpdateMemoryCap() return; if (systemMemoryCap.MemoryCapInMB < SceneLoadingMemoryConstants.LOW_MEMORY_RIG_THRESHOLD) - initialKey = SceneLimitsKey.LOW_MEMORY; + initialKey = SceneLimitsKey.LowMemory; else if (systemMemoryCap.MemoryCapInMB < SceneLoadingMemoryConstants.MEDIUM_MEMORY_RIGH_THRESHOLD) - initialKey = SceneLimitsKey.MEDIUM_MEMORY; + initialKey = SceneLimitsKey.MediumMemory; else - initialKey = SceneLimitsKey.MAX_MEMORY; + initialKey = SceneLimitsKey.MaxMemory; //We reset any possible transition and let it re-acomodate again currentSceneLimits = constantSceneLimits[initialKey]; - sceneTransitionState = SceneTransitionState.NORMAL; + sceneTransitionState = SceneTransitionState.Normal; currentTransitionFrames = 0; } @@ -119,37 +119,37 @@ public void ReportMemoryState(bool isMemoryNormal, bool isAbundance) if (!isMemoryNormal) { - if (sceneTransitionState is SceneTransitionState.NORMAL or SceneTransitionState.TRANSITIONING_TO_NORMAL) + if (sceneTransitionState is SceneTransitionState.Normal or SceneTransitionState.TransitioningToNormal) { currentTransitionFrames = 0; - sceneTransitionState = SceneTransitionState.TRANSITIONING_TO_REDUCED; + sceneTransitionState = SceneTransitionState.TransitioningToReduced; transitionStartSceneLimits = currentSceneLimits; } - if (sceneTransitionState == SceneTransitionState.TRANSITIONING_TO_REDUCED) + if (sceneTransitionState == SceneTransitionState.TransitioningToReduced) { currentTransitionFrames++; float interpolationProgress = Mathf.Lerp(0, 1, currentTransitionFrames / totalFramesToComplete); - currentSceneLimits = SceneLimits.Lerp(transitionStartSceneLimits, constantSceneLimits[SceneLimitsKey.WARNING], interpolationProgress); + currentSceneLimits = SceneLimits.Lerp(transitionStartSceneLimits, constantSceneLimits[SceneLimitsKey.Warning], interpolationProgress); if (currentTransitionFrames >= totalFramesToComplete) { - sceneTransitionState = SceneTransitionState.REDUCED; - currentSceneLimits = constantSceneLimits[SceneLimitsKey.WARNING]; + sceneTransitionState = SceneTransitionState.Reduced; + currentSceneLimits = constantSceneLimits[SceneLimitsKey.Warning]; } } } if (isAbundance) { - if (sceneTransitionState is SceneTransitionState.REDUCED or SceneTransitionState.TRANSITIONING_TO_REDUCED) + if (sceneTransitionState is SceneTransitionState.Reduced or SceneTransitionState.TransitioningToReduced) { currentTransitionFrames = 0; - sceneTransitionState = SceneTransitionState.TRANSITIONING_TO_NORMAL; + sceneTransitionState = SceneTransitionState.TransitioningToNormal; transitionStartSceneLimits = currentSceneLimits; } - if (sceneTransitionState == SceneTransitionState.TRANSITIONING_TO_NORMAL) + if (sceneTransitionState == SceneTransitionState.TransitioningToNormal) { currentTransitionFrames++; float interpolationProgress = Mathf.Lerp(0, 1, currentTransitionFrames / totalFramesToComplete); @@ -157,7 +157,7 @@ public void ReportMemoryState(bool isMemoryNormal, bool isAbundance) if (currentTransitionFrames >= totalFramesToComplete) { - sceneTransitionState = SceneTransitionState.NORMAL; + sceneTransitionState = SceneTransitionState.Normal; currentSceneLimits = constantSceneLimits[initialKey]; } } diff --git a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/SceneLoadingLimit/SceneTransitionState.cs b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/SceneLoadingLimit/SceneTransitionState.cs index c0c9eb30625..7e8ef986274 100644 --- a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/SceneLoadingLimit/SceneTransitionState.cs +++ b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/SceneLoadingLimit/SceneTransitionState.cs @@ -2,9 +2,9 @@ namespace ECS.SceneLifeCycle.IncreasingRadius { public enum SceneTransitionState { - NORMAL, - REDUCED, - TRANSITIONING_TO_REDUCED, - TRANSITIONING_TO_NORMAL, + Normal, + Reduced, + TransitioningToReduced, + TransitioningToNormal, } } diff --git a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Systems/UnloadSceneSystem.cs b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Systems/UnloadSceneSystem.cs index 10fe6289869..74dfe640526 100644 --- a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Systems/UnloadSceneSystem.cs +++ b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Systems/UnloadSceneSystem.cs @@ -52,7 +52,7 @@ public void FinalizeComponents(in Query query) private void CleanSceneFacadeWhenLOD(in Entity entity, ref SceneDefinitionComponent sceneDefinitionComponent, ref ISceneFacade sceneFacade, ref SceneLoadingState sceneLoadingState) { - if (sceneLoadingState.VisualSceneState == VisualSceneState.SHOWING_LOD) + if (sceneLoadingState.VisualSceneState == VisualSceneState.ShowingLod) { var state = sceneFacade.SceneStateProvider.State.Value(); @@ -86,7 +86,7 @@ private void CleanSceneFacadeWhenLOD(in Entity entity, ref SceneDefinitionCompon private void CleanScenePromiseWhenLOD(in Entity entity, ref AssetPromise promise, ref SceneLoadingState sceneLoadingState) { - if (sceneLoadingState.VisualSceneState == VisualSceneState.SHOWING_LOD) + if (sceneLoadingState.VisualSceneState == VisualSceneState.ShowingLod) { //TODO: Wait until LOD is Ready //Dispose scene diff --git a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Tests/VisualSceneStateResolverShould.cs b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Tests/VisualSceneStateResolverShould.cs index a79ea75f8fe..309f53a5d39 100644 --- a/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Tests/VisualSceneStateResolverShould.cs +++ b/Explorer/Assets/DCL/Infrastructure/SceneLifeCycle/Tests/VisualSceneStateResolverShould.cs @@ -31,63 +31,63 @@ public void SetUp() public void ShowLODInWorldWhenDescriptorResolvedAndOverThreshold() { VisualSceneState result = resolver.ResolveVisualSceneState(CreatePartition(SDK7_LOD_THRESHOLD), CreateSceneDefinition(SDK7_RUNTIME), - VisualSceneState.UNINITIALIZED, true, CreateResolvedDescriptor()); + VisualSceneState.Uninitialized, true, CreateResolvedDescriptor()); - Assert.That(result, Is.EqualTo(VisualSceneState.SHOWING_LOD)); + Assert.That(result, Is.EqualTo(VisualSceneState.ShowingLod)); } [Test] public void ShowSceneInWorldWhenDescriptorResolvedAndUnderThreshold() { VisualSceneState result = resolver.ResolveVisualSceneState(CreatePartition(SDK7_LOD_THRESHOLD - 1), CreateSceneDefinition(SDK7_RUNTIME), - VisualSceneState.UNINITIALIZED, true, CreateResolvedDescriptor()); + VisualSceneState.Uninitialized, true, CreateResolvedDescriptor()); - Assert.That(result, Is.EqualTo(VisualSceneState.SHOWING_SCENE)); + Assert.That(result, Is.EqualTo(VisualSceneState.ShowingScene)); } [Test] public void ShowSceneInWorldWhenDescriptorIsNone() { VisualSceneState result = resolver.ResolveVisualSceneState(CreatePartition(byte.MaxValue), CreateSceneDefinition(SDK7_RUNTIME), - VisualSceneState.UNINITIALIZED, true, ISSDescriptor.NONE); + VisualSceneState.Uninitialized, true, ISSDescriptor.NONE); - Assert.That(result, Is.EqualTo(VisualSceneState.SHOWING_SCENE)); + Assert.That(result, Is.EqualTo(VisualSceneState.ShowingScene)); } [Test] public void ShowSceneInWorldWhenDescriptorIsUninitialized() { VisualSceneState result = resolver.ResolveVisualSceneState(CreatePartition(byte.MaxValue), CreateSceneDefinition(SDK7_RUNTIME), - VisualSceneState.UNINITIALIZED, true, ISSDescriptor.CreateUninitialized()); + VisualSceneState.Uninitialized, true, ISSDescriptor.CreateUninitialized()); - Assert.That(result, Is.EqualTo(VisualSceneState.SHOWING_SCENE)); + Assert.That(result, Is.EqualTo(VisualSceneState.ShowingScene)); } [Test] public void ShowSceneInWorldForSDK6EvenWithResolvedDescriptor() { VisualSceneState result = resolver.ResolveVisualSceneState(CreatePartition(byte.MaxValue), CreateSceneDefinition(null), - VisualSceneState.UNINITIALIZED, true, CreateResolvedDescriptor()); + VisualSceneState.Uninitialized, true, CreateResolvedDescriptor()); - Assert.That(result, Is.EqualTo(VisualSceneState.SHOWING_SCENE)); + Assert.That(result, Is.EqualTo(VisualSceneState.ShowingScene)); } [Test] public void ShowLODInVolatileRealmForSDK6() { VisualSceneState result = resolver.ResolveVisualSceneState(CreatePartition(0), CreateSceneDefinition(null), - VisualSceneState.UNINITIALIZED, false, ISSDescriptor.NONE); + VisualSceneState.Uninitialized, false, ISSDescriptor.NONE); - Assert.That(result, Is.EqualTo(VisualSceneState.SHOWING_LOD)); + Assert.That(result, Is.EqualTo(VisualSceneState.ShowingLod)); } [Test] public void ShowLODInVolatileRealmWhenOverThreshold() { VisualSceneState result = resolver.ResolveVisualSceneState(CreatePartition(SDK7_LOD_THRESHOLD), CreateSceneDefinition(SDK7_RUNTIME), - VisualSceneState.UNINITIALIZED, false, ISSDescriptor.NONE); + VisualSceneState.Uninitialized, false, ISSDescriptor.NONE); - Assert.That(result, Is.EqualTo(VisualSceneState.SHOWING_LOD)); + Assert.That(result, Is.EqualTo(VisualSceneState.ShowingLod)); } [Test] @@ -95,18 +95,18 @@ public void KeepSceneShownWithinUnloadTolerance() { //Bucket is over the threshold, but the scene is already shown and within the unload tolerance VisualSceneState result = resolver.ResolveVisualSceneState(CreatePartition(SDK7_LOD_THRESHOLD), CreateSceneDefinition(SDK7_RUNTIME), - VisualSceneState.SHOWING_SCENE, false, ISSDescriptor.NONE); + VisualSceneState.ShowingScene, false, ISSDescriptor.NONE); - Assert.That(result, Is.EqualTo(VisualSceneState.SHOWING_SCENE)); + Assert.That(result, Is.EqualTo(VisualSceneState.ShowingScene)); } [Test] public void KeepSceneShownInWorldWithinUnloadTolerance() { VisualSceneState result = resolver.ResolveVisualSceneState(CreatePartition(SDK7_LOD_THRESHOLD), CreateSceneDefinition(SDK7_RUNTIME), - VisualSceneState.SHOWING_SCENE, true, CreateResolvedDescriptor()); + VisualSceneState.ShowingScene, true, CreateResolvedDescriptor()); - Assert.That(result, Is.EqualTo(VisualSceneState.SHOWING_SCENE)); + Assert.That(result, Is.EqualTo(VisualSceneState.ShowingScene)); } private static PartitionComponent CreatePartition(byte bucket) => diff --git a/Explorer/Assets/DCL/Infrastructure/SceneRuntime/Apis/Modules/CommsApi/CommsApiWrap.cs b/Explorer/Assets/DCL/Infrastructure/SceneRuntime/Apis/Modules/CommsApi/CommsApiWrap.cs index 16d2db337f9..38a72323ccf 100644 --- a/Explorer/Assets/DCL/Infrastructure/SceneRuntime/Apis/Modules/CommsApi/CommsApiWrap.cs +++ b/Explorer/Assets/DCL/Infrastructure/SceneRuntime/Apis/Modules/CommsApi/CommsApiWrap.cs @@ -174,7 +174,7 @@ public void PublishData(string topic, string data) sceneCommunicationPipe.SendMessage( encoded, sceneId, - ISceneCommunicationPipe.ConnectivityAssertiveness.DROP_IF_NOT_CONNECTED, + ISceneCommunicationPipe.ConnectivityAssertiveness.DropIfNotConnected, disposeCts.Token); } catch (Exception e) diff --git a/Explorer/Assets/DCL/Infrastructure/SceneRuntime/Apis/Modules/CommsApi/GetActiveVideoStreamsResponse.cs b/Explorer/Assets/DCL/Infrastructure/SceneRuntime/Apis/Modules/CommsApi/GetActiveVideoStreamsResponse.cs index 57937482741..3b3eee921da 100644 --- a/Explorer/Assets/DCL/Infrastructure/SceneRuntime/Apis/Modules/CommsApi/GetActiveVideoStreamsResponse.cs +++ b/Explorer/Assets/DCL/Infrastructure/SceneRuntime/Apis/Modules/CommsApi/GetActiveVideoStreamsResponse.cs @@ -13,11 +13,11 @@ public static class GetActiveVideoStreamsResponse private static VideoTrackSourceType From(TrackSource trackSource) => trackSource switch { - TrackSource.SourceUnknown => VideoTrackSourceType.VTST_UNKNOWN, - TrackSource.SourceCamera => VideoTrackSourceType.VTST_CAMERA, - TrackSource.SourceMicrophone => VideoTrackSourceType.VTST_UNKNOWN, - TrackSource.SourceScreenshare => VideoTrackSourceType.VTST_SCREEN_SHARE, - TrackSource.SourceScreenshareAudio => VideoTrackSourceType.VTST_SCREEN_SHARE, + TrackSource.SourceUnknown => VideoTrackSourceType.VtstUnknown, + TrackSource.SourceCamera => VideoTrackSourceType.VtstCamera, + TrackSource.SourceMicrophone => VideoTrackSourceType.VtstUnknown, + TrackSource.SourceScreenshare => VideoTrackSourceType.VtstScreenShare, + TrackSource.SourceScreenshareAudio => VideoTrackSourceType.VtstScreenShare, _ => throw new ArgumentOutOfRangeException() }; @@ -64,9 +64,9 @@ public static void WriteAsCurrentTo(JsonWriter writer, string identity, LKPartic public enum VideoTrackSourceType { - VTST_UNKNOWN = 0, - VTST_CAMERA = 1, - VTST_SCREEN_SHARE = 2, + VtstUnknown = 0, + VtstCamera = 1, + VtstScreenShare = 2, } } } diff --git a/Explorer/Assets/DCL/Infrastructure/SceneRuntime/Apis/Modules/Ethereums/EthereumApiWrapper.cs b/Explorer/Assets/DCL/Infrastructure/SceneRuntime/Apis/Modules/Ethereums/EthereumApiWrapper.cs index 569f92aac0e..997b946efc4 100644 --- a/Explorer/Assets/DCL/Infrastructure/SceneRuntime/Apis/Modules/Ethereums/EthereumApiWrapper.cs +++ b/Explorer/Assets/DCL/Infrastructure/SceneRuntime/Apis/Modules/Ethereums/EthereumApiWrapper.cs @@ -74,7 +74,7 @@ async UniTask RequestPersonalSignatureAsync(CancellationTok hex, web3IdentityCache.Identity!.Address.ToString(), }, - }, Web3RequestSource.SDKScene, ct); + }, Web3RequestSource.SdkScene, ct); return new SignMessageResponse(hex, message, (string)response.result); } @@ -103,7 +103,7 @@ async UniTask SendAndFormatAsync(double id, string id = (long)id, method = method, @params = @params, - }, Web3RequestSource.SDKScene, ct); + }, Web3RequestSource.SdkScene, ct); return new SendEthereumMessageResponse { diff --git a/Explorer/Assets/DCL/Infrastructure/SceneRuntime/Apis/Modules/Players/PlayersWrap.cs b/Explorer/Assets/DCL/Infrastructure/SceneRuntime/Apis/Modules/Players/PlayersWrap.cs index 503d6a04d73..157fdb4c054 100644 --- a/Explorer/Assets/DCL/Infrastructure/SceneRuntime/Apis/Modules/Players/PlayersWrap.cs +++ b/Explorer/Assets/DCL/Infrastructure/SceneRuntime/Apis/Modules/Players/PlayersWrap.cs @@ -37,7 +37,7 @@ public object PlayerData(string walletId) async UniTask ExecuteAsync() { Profile? profile = await profileRepository.GetAsync(walletId, 0, remoteMetadata.GetLambdaDomainOrNull(walletId), disposeCts.Token, - batchBehaviour: IProfileRepository.FetchBehaviour.DELAY_UNTIL_RESOLVED); + batchBehaviour: IProfileRepository.FetchBehaviour.DelayUntilResolved); return new PlayersGetUserDataResponse(profile, walletId); } diff --git a/Explorer/Assets/DCL/Infrastructure/SceneRuntime/Apis/Modules/UserIdentityApi/UserIdentityApiWrapper.cs b/Explorer/Assets/DCL/Infrastructure/SceneRuntime/Apis/Modules/UserIdentityApi/UserIdentityApiWrapper.cs index f2bde171969..a852e8db1c4 100644 --- a/Explorer/Assets/DCL/Infrastructure/SceneRuntime/Apis/Modules/UserIdentityApi/UserIdentityApiWrapper.cs +++ b/Explorer/Assets/DCL/Infrastructure/SceneRuntime/Apis/Modules/UserIdentityApi/UserIdentityApiWrapper.cs @@ -46,7 +46,7 @@ async UniTask GetOwnUserDataAsync(CancellationToken ct) if (identity == null) return new GetUserDataResponse(null); - Profile? profile = await profileRepository.GetAsync(identity.Address, ct, IProfileRepository.FetchBehaviour.ENFORCE_SINGLE_GET | IProfileRepository.FetchBehaviour.DELAY_UNTIL_RESOLVED); + Profile? profile = await profileRepository.GetAsync(identity.Address, ct, IProfileRepository.FetchBehaviour.EnforceSingleGet | IProfileRepository.FetchBehaviour.DelayUntilResolved); if (profile == null) return new GetUserDataResponse(null); diff --git a/Explorer/Assets/DCL/Input/Component/InputMapComponent.cs b/Explorer/Assets/DCL/Input/Component/InputMapComponent.cs index 1036fc7cca0..f48d0ade070 100644 --- a/Explorer/Assets/DCL/Input/Component/InputMapComponent.cs +++ b/Explorer/Assets/DCL/Input/Component/InputMapComponent.cs @@ -11,26 +11,26 @@ public struct InputMapComponent public static readonly Kind[] BLOCK_USER_INPUT = { - Kind.IN_WORLD_CAMERA, - Kind.CAMERA, - Kind.SHORTCUTS, - Kind.PLAYER, - Kind.VOICE_CHAT + Kind.InWorldCamera, + Kind.Camera, + Kind.Shortcuts, + Kind.Player, + Kind.VoiceChat }; [Flags] public enum Kind { - NONE = 0, - PLAYER = 1, - CAMERA = 1 << 1, - FREE_CAMERA = 1 << 2, - EMOTE_WHEEL = 1 << 3, - EMOTES = 1 << 4, - SHORTCUTS = 1 << 5, - IN_WORLD_CAMERA = 1 << 6, - VOICE_CHAT = 1 << 7, + None = 0, + Player = 1, + Camera = 1 << 1, + FreeCamera = 1 << 2, + EmoteWheel = 1 << 3, + Emotes = 1 << 4, + Shortcuts = 1 << 5, + InWorldCamera = 1 << 6, + VoiceChat = 1 << 7, } private Kind active; diff --git a/Explorer/Assets/DCL/Input/Systems/ApplyInputMapsSystem.cs b/Explorer/Assets/DCL/Input/Systems/ApplyInputMapsSystem.cs index 032e25d0d69..3896f409d65 100644 --- a/Explorer/Assets/DCL/Input/Systems/ApplyInputMapsSystem.cs +++ b/Explorer/Assets/DCL/Input/Systems/ApplyInputMapsSystem.cs @@ -41,28 +41,28 @@ protected override void Update(float t) switch (value) { - case InputMapComponent.Kind.CAMERA: + case InputMapComponent.Kind.Camera: SetActionMapEnabled(isActive, DCLInput.Instance.Camera); break; - case InputMapComponent.Kind.FREE_CAMERA: + case InputMapComponent.Kind.FreeCamera: SetActionMapEnabled(isActive, DCLInput.Instance.FreeCamera); break; - case InputMapComponent.Kind.PLAYER: + case InputMapComponent.Kind.Player: SetActionMapEnabled(isActive, DCLInput.Instance.Player); break; - case InputMapComponent.Kind.EMOTE_WHEEL: + case InputMapComponent.Kind.EmoteWheel: SetActionMapEnabled(isActive, DCLInput.Instance.EmoteWheel); break; - case InputMapComponent.Kind.EMOTES: + case InputMapComponent.Kind.Emotes: SetActionMapEnabled(isActive, DCLInput.Instance.Emotes); break; - case InputMapComponent.Kind.SHORTCUTS: + case InputMapComponent.Kind.Shortcuts: SetActionMapEnabled(isActive, DCLInput.Instance.Shortcuts); break; - case InputMapComponent.Kind.IN_WORLD_CAMERA: + case InputMapComponent.Kind.InWorldCamera: SetActionMapEnabled(isActive, DCLInput.Instance.InWorldCamera); break; - case InputMapComponent.Kind.VOICE_CHAT: + case InputMapComponent.Kind.VoiceChat: SetActionMapEnabled(isActive, DCLInput.Instance.VoiceChat); break; } diff --git a/Explorer/Assets/DCL/Input/Systems/UpdateCursorInputSystem.cs b/Explorer/Assets/DCL/Input/Systems/UpdateCursorInputSystem.cs index d5062c536d0..c5594fb88d7 100644 --- a/Explorer/Assets/DCL/Input/Systems/UpdateCursorInputSystem.cs +++ b/Explorer/Assets/DCL/Input/Systems/UpdateCursorInputSystem.cs @@ -151,13 +151,13 @@ private void UpdateCursorLockStateFromIntention(in Entity entity, { if (intention.WithUI) { - if (cursorComponent.CursorState == CursorState.LockedWithUI) + if (cursorComponent.CursorState == CursorState.LockedWithUi) { World.Remove(entity); return; } - UpdateState(ref cursorComponent, CursorState.LockedWithUI); + UpdateState(ref cursorComponent, CursorState.LockedWithUi); } else { @@ -226,13 +226,13 @@ private void UpdateCursorVisualState(ref CursorComponent cursorComponent, IReadO case CursorState.Panning: cursorStyle = CursorStyle.CameraPan; break; - case CursorState.LockedWithUI: + case CursorState.LockedWithUi: cursorStyle = CursorStyle.Interaction; break; } cursor.SetStyle(cursorStyle); - crosshairCanvas.SetCursorStyle(cursorStyle, exposedCameraData.CameraMode == CameraMode.SDKCamera || exposedCameraData.CameraMode == CameraMode.InWorld); + crosshairCanvas.SetCursorStyle(cursorStyle, exposedCameraData.CameraMode == CameraMode.SdkCamera || exposedCameraData.CameraMode == CameraMode.InWorld); } // We check if the gameObject is interactable or not, at least once. @@ -244,7 +244,7 @@ private void UpdateCursorLockState(ref CursorComponent cursorComponent, Vector2 CursorState nextState = cursorComponent.CursorState; // Opened a menu while locked - if (nextState == CursorState.LockedWithUI) + if (nextState == CursorState.LockedWithUi) { UpdateState(ref cursorComponent, nextState); @@ -279,7 +279,7 @@ private void UpdateCursorLockState(ref CursorComponent cursorComponent, Vector2 if (!cursor.IsLocked() && cursorComponent is { CursorState: CursorState.Locked }) nextState = CursorState.Free; - if (!isMouseOutOfBounds && isTemporalLock && exposedCameraData.CameraMode != CameraMode.SDKCamera && cursorComponent is { CursorState: CursorState.Free, PositionIsDirty: true, IsOverUI: false }) + if (!isMouseOutOfBounds && isTemporalLock && exposedCameraData.CameraMode != CameraMode.SdkCamera && cursorComponent is { CursorState: CursorState.Free, PositionIsDirty: true, IsOverUI: false }) nextState = CursorState.Panning; if (!isTemporalLock && cursorComponent is { CursorState: CursorState.Panning }) @@ -321,7 +321,7 @@ private void UpdateState(ref CursorComponent cursorComponent, CursorState nextSt cursor.SetVisibility(false); break; - case CursorState.LockedWithUI: + case CursorState.LockedWithUi: crosshairCanvas.SetDisplayed(false); cursor.SetVisibility(true); cursor.Unlock(); diff --git a/Explorer/Assets/DCL/Interaction/Systems/ProcessOtherAvatarsInteractionSystem.cs b/Explorer/Assets/DCL/Interaction/Systems/ProcessOtherAvatarsInteractionSystem.cs index a5b0ff0cc4c..06022657bef 100644 --- a/Explorer/Assets/DCL/Interaction/Systems/ProcessOtherAvatarsInteractionSystem.cs +++ b/Explorer/Assets/DCL/Interaction/Systems/ProcessOtherAvatarsInteractionSystem.cs @@ -60,7 +60,7 @@ internal ProcessOtherAvatarsInteractionSystem( this.mvcManager = mvcManager; this.cameraEntityProxy = cameraEntityProxy; - useContextMenu = FeaturesRegistry.Instance.IsEnabled(FeatureId.AVATAR_CONTEXT_MENU); + useContextMenu = FeaturesRegistry.Instance.IsEnabled(FeatureId.AvatarContextMenu); if (useContextMenu) { @@ -168,7 +168,7 @@ private void OpenOptionsContextMenu(InputAction.CallbackContext context) new Vector2(50, 0), disposeCts.Token, contextMenuTask.Task, - anchorPoint: MenuAnchorPoint.CENTER_RIGHT, + anchorPoint: MenuAnchorPoint.CenterRight, isOpenedOnWorldAvatar: true, onHide: OnContextMenuClosed).Forget(); } diff --git a/Explorer/Assets/DCL/Interaction/Systems/Tests/ProcessOtherAvatarsInteractionSystemShould.cs b/Explorer/Assets/DCL/Interaction/Systems/Tests/ProcessOtherAvatarsInteractionSystemShould.cs index b023a1a2be0..657c1458850 100644 --- a/Explorer/Assets/DCL/Interaction/Systems/Tests/ProcessOtherAvatarsInteractionSystemShould.cs +++ b/Explorer/Assets/DCL/Interaction/Systems/Tests/ProcessOtherAvatarsInteractionSystemShould.cs @@ -41,7 +41,7 @@ private void SetUpWithFeatureFlag(bool enableContextMenu) base.Setup(); EcsTestsUtils.SetUpFeaturesRegistry(); - OverrideFeatureFlag(FeatureId.AVATAR_CONTEXT_MENU, enableContextMenu); + OverrideFeatureFlag(FeatureId.AvatarContextMenu, enableContextMenu); world = World.Create(); mouse = InputSystem.AddDevice(); diff --git a/Explorer/Assets/DCL/LOD/Components/InitialSceneStateLOD.cs b/Explorer/Assets/DCL/LOD/Components/InitialSceneStateLOD.cs index d52e520ab05..26a0eb1c114 100644 --- a/Explorer/Assets/DCL/LOD/Components/InitialSceneStateLOD.cs +++ b/Explorer/Assets/DCL/LOD/Components/InitialSceneStateLOD.cs @@ -23,10 +23,10 @@ public class InitialSceneStateLOD public enum State { - UNINITIALIZED, - PROCESSING, - FAILED, - RESOLVED + Uninitialized, + Processing, + Failed, + Resolved } public State CurrentState; @@ -37,12 +37,12 @@ public enum State public void ForgetLoading(World world) { - if (CurrentState is State.FAILED or State.RESOLVED) + if (CurrentState is State.Failed or State.Resolved) return; AssetBundlePromise.ForgetLoading(world); - if (CurrentState is State.PROCESSING) + if (CurrentState is State.Processing) { Generation++; Clear(); @@ -56,7 +56,7 @@ public void ForgetLoading(World world) UnityObjectUtils.SafeDestroy(ParentContainer); } - CurrentState = State.UNINITIALIZED; + CurrentState = State.Uninitialized; } private void Clear() @@ -98,7 +98,7 @@ public bool AllAssetsInstantiated() => ParentContainer != null && Assets.Count == TotalAssetsToInstantiate; public bool IsProcessing() => - CurrentState is State.PROCESSING; + CurrentState is State.Processing; public void Initialize(string sceneID, Vector3 sceneGeometryBaseParcelPosition, AssetBundleData resultAsset, IGltfContainerAssetsCache gltfContainerAssetsCache, int assetHashCount) diff --git a/Explorer/Assets/DCL/LOD/Components/SceneLODInfo.cs b/Explorer/Assets/DCL/LOD/Components/SceneLODInfo.cs index 3d15a4437b1..992692bcb98 100644 --- a/Explorer/Assets/DCL/LOD/Components/SceneLODInfo.cs +++ b/Explorer/Assets/DCL/LOD/Components/SceneLODInfo.cs @@ -166,7 +166,7 @@ public void ForgetAllLoadings(World world) public void ClearISS(float defaultFOV, float defaultLodBias, int loadingDistance, int sceneParcels) { - if (InitialSceneStateLOD.CurrentState == InitialSceneStateLOD.State.RESOLVED) + if (InitialSceneStateLOD.CurrentState == InitialSceneStateLOD.State.Resolved) { metadata.SuccessfullLODs = SceneLODInfoUtils.ClearLODResult(metadata.SuccessfullLODs, 0); UnityEngine.LOD[] currentLODs = metadata.LodGroup.GetLODs(); diff --git a/Explorer/Assets/DCL/LOD/Systems/InstantiateSceneLODInfoSystem.cs b/Explorer/Assets/DCL/LOD/Systems/InstantiateSceneLODInfoSystem.cs index 51231a0d745..157595c0bfb 100644 --- a/Explorer/Assets/DCL/LOD/Systems/InstantiateSceneLODInfoSystem.cs +++ b/Explorer/Assets/DCL/LOD/Systems/InstantiateSceneLODInfoSystem.cs @@ -88,7 +88,7 @@ private void ResolveInitialSceneStateDescriptorLOD(in SceneDefinitionComponent s sceneLODInfo.AddSuccessLOD(sceneLODInfo.InitialSceneStateLOD.ParentContainer, null, defaultFOV, defaultLodBias, realmPartitionSettings.MaxLoadingDistanceInParcels, sceneDefinitionComponent.Parcels.Count); - sceneLODInfo.InitialSceneStateLOD.CurrentState = InitialSceneStateLOD.State.RESOLVED; + sceneLODInfo.InitialSceneStateLOD.CurrentState = InitialSceneStateLOD.State.Resolved; } } diff --git a/Explorer/Assets/DCL/LOD/Systems/ResolveISSLODSystem.cs b/Explorer/Assets/DCL/LOD/Systems/ResolveISSLODSystem.cs index 919574b85b5..0f46d78ac2c 100644 --- a/Explorer/Assets/DCL/LOD/Systems/ResolveISSLODSystem.cs +++ b/Explorer/Assets/DCL/LOD/Systems/ResolveISSLODSystem.cs @@ -49,7 +49,7 @@ private void ResolveInitialSceneStateLODDescriptor(ref SceneLODInfo sceneLODInfo { InitialSceneStateLOD initialSceneStateLOD = sceneLODInfo.InitialSceneStateLOD; - if (initialSceneStateLOD.CurrentState != InitialSceneStateLOD.State.PROCESSING) return; + if (initialSceneStateLOD.CurrentState != InitialSceneStateLOD.State.Processing) return; // Only the descriptor-mode path is owned by this query. if (issDescriptor.CurrentState != ISSDescriptorState.Descriptor) return; diff --git a/Explorer/Assets/DCL/LOD/Systems/UnloadSceneLODSystem.cs b/Explorer/Assets/DCL/LOD/Systems/UnloadSceneLODSystem.cs index 244ed91a7f6..17552aa5fa6 100644 --- a/Explorer/Assets/DCL/LOD/Systems/UnloadSceneLODSystem.cs +++ b/Explorer/Assets/DCL/LOD/Systems/UnloadSceneLODSystem.cs @@ -70,9 +70,9 @@ public void FinalizeComponents(in Query query) private void UnloadLODForISS(in Entity entity, ref SceneLODInfo sceneLODInfo, ref PartitionComponent partitionComponent, ref SceneDefinitionComponent sceneDefinitionComponent, ref SceneLoadingState sceneLoadingState) { - if (sceneLoadingState.VisualSceneState == VisualSceneState.SHOWING_SCENE) + if (sceneLoadingState.VisualSceneState == VisualSceneState.ShowingScene) { - if (sceneLODInfo.InitialSceneStateLOD.CurrentState != InitialSceneStateLOD.State.RESOLVED) + if (sceneLODInfo.InitialSceneStateLOD.CurrentState != InitialSceneStateLOD.State.Resolved) return; sceneLODInfo.InitialSceneStateLOD.AssetsShouldGoToTheBridge = LODUtils.ShouldGoToTheBridge(partitionComponent); @@ -97,7 +97,7 @@ private void UnloadLOD(in Entity entity, ref SceneDefinitionComponent sceneDefin private void UnloadLODWhenSceneReady(in Entity entity, ref SceneDefinitionComponent sceneDefinitionComponent, ref SceneLODInfo sceneLODInfo, ref ISceneFacade sceneFacade, ref SceneLoadingState sceneLoadingState) { - if (sceneLoadingState.VisualSceneState == VisualSceneState.SHOWING_SCENE) + if (sceneLoadingState.VisualSceneState == VisualSceneState.ShowingScene) { if (!sceneFacade.IsSceneReady()) return; diff --git a/Explorer/Assets/DCL/LOD/Systems/UpdateSceneLODInfoSystem.cs b/Explorer/Assets/DCL/LOD/Systems/UpdateSceneLODInfoSystem.cs index da6363c1ac9..1273ca68a83 100644 --- a/Explorer/Assets/DCL/LOD/Systems/UpdateSceneLODInfoSystem.cs +++ b/Explorer/Assets/DCL/LOD/Systems/UpdateSceneLODInfoSystem.cs @@ -72,14 +72,14 @@ private void StartLODPromise(ref SceneLODInfo sceneLODInfo, ref PartitionCompone { sceneLODInfo.ForgetAllLoadings(World); - if (level == 0 && sceneLODInfo.InitialSceneStateLOD.CurrentState != InitialSceneStateLOD.State.FAILED) + if (level == 0 && sceneLODInfo.InitialSceneStateLOD.CurrentState != InitialSceneStateLOD.State.Failed) { // ResolveSceneStateByIncreasingRadiusSystem gates SHOWING_LOD/SHOWING_SCENE transitions on // descriptor resolution, so by the time we reach this point the descriptor is guaranteed to // be either None (no ISS for this scene) or a resolved Bundle/Descriptor. if (issDescriptor.SupportsDescriptor()) { - sceneLODInfo.InitialSceneStateLOD.CurrentState = InitialSceneStateLOD.State.PROCESSING; + sceneLODInfo.InitialSceneStateLOD.CurrentState = InitialSceneStateLOD.State.Processing; sceneLODInfo.CurrentLODLevelPromise = level; return; } @@ -91,7 +91,7 @@ private void StartLODPromise(ref SceneLODInfo sceneLODInfo, ref PartitionCompone var assetBundleIntention = GetAssetBundleIntention.FromHash( platformLODKey, typeof(GameObject), - permittedSources: AssetSource.ALL, + permittedSources: AssetSource.All, customEmbeddedSubDirectory: LODUtils.LOD_EMBEDDED_SUBDIRECTORIES, assetBundleManifestVersion: AssetBundleManifestVersion.CreateForLOD($"LOD/{level.ToString()}", "dummyDate"), lookForDependencies: true diff --git a/Explorer/Assets/DCL/LOD/Tests/EditMode/ResolveISSLODSystemShould.cs b/Explorer/Assets/DCL/LOD/Tests/EditMode/ResolveISSLODSystemShould.cs index 1dbbc9b33f9..4b77ef6f935 100644 --- a/Explorer/Assets/DCL/LOD/Tests/EditMode/ResolveISSLODSystemShould.cs +++ b/Explorer/Assets/DCL/LOD/Tests/EditMode/ResolveISSLODSystemShould.cs @@ -292,7 +292,7 @@ private InitialSceneStateLOD CreateLODEntity(ISSDescriptor descriptor) { var lodInfo = SceneLODInfo.Create(); lodInfo.id = SCENE_ID; - lodInfo.InitialSceneStateLOD.CurrentState = InitialSceneStateLOD.State.PROCESSING; + lodInfo.InitialSceneStateLOD.CurrentState = InitialSceneStateLOD.State.Processing; world.Create(lodInfo, sceneDefinition, descriptor); return lodInfo.InitialSceneStateLOD; diff --git a/Explorer/Assets/DCL/Landscape/Jobs/NoiseComposeJob.cs b/Explorer/Assets/DCL/Landscape/Jobs/NoiseComposeJob.cs index 8a768c959dc..c5e15c541b7 100644 --- a/Explorer/Assets/DCL/Landscape/Jobs/NoiseComposeJob.cs +++ b/Explorer/Assets/DCL/Landscape/Jobs/NoiseComposeJob.cs @@ -25,13 +25,13 @@ public void Execute(int index) switch (operation) { - case NoiseJobOperation.SET: + case NoiseJobOperation.Set: originalValue = composeValue; break; - case NoiseJobOperation.ADD: + case NoiseJobOperation.Add: originalValue += composeValue; break; - case NoiseJobOperation.MULTIPLY: + case NoiseJobOperation.Multiply: originalValue *= composeValue; break; - case NoiseJobOperation.SUBTRACT: + case NoiseJobOperation.Subtract: originalValue -= composeValue; break; } diff --git a/Explorer/Assets/DCL/Landscape/Jobs/NoiseJob.cs b/Explorer/Assets/DCL/Landscape/Jobs/NoiseJob.cs index b68c432cc48..d5edaf7b5c9 100644 --- a/Explorer/Assets/DCL/Landscape/Jobs/NoiseJob.cs +++ b/Explorer/Assets/DCL/Landscape/Jobs/NoiseJob.cs @@ -10,10 +10,10 @@ namespace DCL.Landscape.Jobs { public enum NoiseJobOperation { - SET, - ADD, - MULTIPLY, - SUBTRACT, + Set, + Add, + Multiply, + Subtract, } [BurstCompile(CompileSynchronously = true)] @@ -69,13 +69,13 @@ public void Execute(int index) switch (noiseSettings.noiseType) { - case NoiseType.PERLIN: + case NoiseType.Perlin: noiseValue = noise.cnoise(new float2(sampleX, sampleY)); break; - case NoiseType.SIMPLEX: + case NoiseType.Simplex: noiseValue = noise.snoise(new float2(sampleX, sampleY)); break; - case NoiseType.CELLULAR: + case NoiseType.Cellular: noiseValue = noise.cellular(new float2(sampleX, sampleY)).x; break; default: throw new ArgumentOutOfRangeException(); @@ -105,16 +105,16 @@ public void Execute(int index) switch (operation) { - case NoiseJobOperation.SET: + case NoiseJobOperation.Set: result[index] = tempValue; break; - case NoiseJobOperation.ADD: + case NoiseJobOperation.Add: result[index] += tempValue; break; - case NoiseJobOperation.MULTIPLY: + case NoiseJobOperation.Multiply: result[index] *= tempValue; break; - case NoiseJobOperation.SUBTRACT: + case NoiseJobOperation.Subtract: result[index] -= tempValue; break; } diff --git a/Explorer/Assets/DCL/Landscape/Jobs/NoiseSimpleOperation.cs b/Explorer/Assets/DCL/Landscape/Jobs/NoiseSimpleOperation.cs index 96fe4069fc7..4e3486913e1 100644 --- a/Explorer/Assets/DCL/Landscape/Jobs/NoiseSimpleOperation.cs +++ b/Explorer/Assets/DCL/Landscape/Jobs/NoiseSimpleOperation.cs @@ -24,13 +24,13 @@ public void Execute(int index) switch (operation) { - case NoiseJobOperation.SET: + case NoiseJobOperation.Set: originalValue = value; break; - case NoiseJobOperation.ADD: + case NoiseJobOperation.Add: originalValue += value; break; - case NoiseJobOperation.MULTIPLY: + case NoiseJobOperation.Multiply: originalValue *= value; break; - case NoiseJobOperation.SUBTRACT: + case NoiseJobOperation.Subtract: originalValue -= value; break; } diff --git a/Explorer/Assets/DCL/Landscape/Noise.cs b/Explorer/Assets/DCL/Landscape/Noise.cs index a002ea774ba..dc5983453b1 100644 --- a/Explorer/Assets/DCL/Landscape/Noise.cs +++ b/Explorer/Assets/DCL/Landscape/Noise.cs @@ -59,8 +59,8 @@ public void ValidateValues() public enum NoiseType { - PERLIN, - SIMPLEX, - CELLULAR, + Perlin, + Simplex, + Cellular, } } diff --git a/Explorer/Assets/DCL/Landscape/NoiseGeneration/CompositeNoiseGenerator.cs b/Explorer/Assets/DCL/Landscape/NoiseGeneration/CompositeNoiseGenerator.cs index e3c5abe71dc..103dc6b3793 100644 --- a/Explorer/Assets/DCL/Landscape/NoiseGeneration/CompositeNoiseGenerator.cs +++ b/Explorer/Assets/DCL/Landscape/NoiseGeneration/CompositeNoiseGenerator.cs @@ -35,7 +35,7 @@ protected override JobHandle OnSchedule(NoiseDataPointer noiseDataPointer, JobHa noiseDataPointer.size, in noiseData.settings, maxHeight, new float2(noiseDataPointer.offsetX, noiseDataPointer.offsetZ), - NoiseJobOperation.SET); + NoiseJobOperation.Set); JobHandle jobHandle = noiseJob.Schedule(noiseDataPointer.size * noiseDataPointer.size, batchCount, parentJobHandle); diff --git a/Explorer/Assets/DCL/Landscape/NoiseGeneration/NoiseGenerator.cs b/Explorer/Assets/DCL/Landscape/NoiseGeneration/NoiseGenerator.cs index 8749f9afd01..cf63817367b 100644 --- a/Explorer/Assets/DCL/Landscape/NoiseGeneration/NoiseGenerator.cs +++ b/Explorer/Assets/DCL/Landscape/NoiseGeneration/NoiseGenerator.cs @@ -19,7 +19,7 @@ protected override JobHandle OnSchedule(NoiseDataPointer noiseDataPointer, JobHa noiseDataPointer.size, in noiseData.settings, maxHeight, new float2(noiseDataPointer.offsetX, noiseDataPointer.offsetZ), - NoiseJobOperation.SET); + NoiseJobOperation.Set); return noiseJob.Schedule(noiseDataPointer.size * noiseDataPointer.size, batchCount, parentJobHandle); } diff --git a/Explorer/Assets/DCL/Landscape/Settings/LandscapeData.cs b/Explorer/Assets/DCL/Landscape/Settings/LandscapeData.cs index 9291f606aee..65823169b3b 100644 --- a/Explorer/Assets/DCL/Landscape/Settings/LandscapeData.cs +++ b/Explorer/Assets/DCL/Landscape/Settings/LandscapeData.cs @@ -58,9 +58,9 @@ private void OnEnable() private enum GroundMeshPiece { - MIDDLE, - EDGE, - CORNER, + Middle, + Edge, + Corner, } } diff --git a/Explorer/Assets/DCL/MapRenderer/MapLayers/Pins/IPinMarker.cs b/Explorer/Assets/DCL/MapRenderer/MapLayers/Pins/IPinMarker.cs index 0034c8e2def..8344f5afa47 100644 --- a/Explorer/Assets/DCL/MapRenderer/MapLayers/Pins/IPinMarker.cs +++ b/Explorer/Assets/DCL/MapRenderer/MapLayers/Pins/IPinMarker.cs @@ -10,8 +10,8 @@ public interface IPinMarker : IMapRendererMarker, IMapPositionProvider, IDisposa { public enum ScaleType { - MINIMAP, - NAVMAP, + Minimap, + Navmap, } bool IsVisible { get; } diff --git a/Explorer/Assets/DCL/MapRenderer/MapLayers/Pins/PinMarker.cs b/Explorer/Assets/DCL/MapRenderer/MapLayers/Pins/PinMarker.cs index 18a483e00db..d799f012a13 100644 --- a/Explorer/Assets/DCL/MapRenderer/MapLayers/Pins/PinMarker.cs +++ b/Explorer/Assets/DCL/MapRenderer/MapLayers/Pins/PinMarker.cs @@ -154,7 +154,7 @@ public void SetZoom(float baseScale, float baseZoom, float zoom) public void ResetScale(IPinMarker.ScaleType type) { - currentTargetScale = type == IPinMarker.ScaleType.MINIMAP ? MINIMAP_PIN_MIN_SCALE : NAVMAP_PIN_MIN_SCALE; + currentTargetScale = type == IPinMarker.ScaleType.Minimap ? MINIMAP_PIN_MIN_SCALE : NAVMAP_PIN_MIN_SCALE; poolablePin.instance?.SetScale(currentTargetScale); } diff --git a/Explorer/Assets/DCL/MapRenderer/MapLayers/Pins/PinMarkerController.cs b/Explorer/Assets/DCL/MapRenderer/MapLayers/Pins/PinMarkerController.cs index 545ce6195bb..fddb7642bd0 100644 --- a/Explorer/Assets/DCL/MapRenderer/MapLayers/Pins/PinMarkerController.cs +++ b/Explorer/Assets/DCL/MapRenderer/MapLayers/Pins/PinMarkerController.cs @@ -165,7 +165,7 @@ public void ApplyCameraZoom(float baseZoom, float zoom, int zoomLevel) public void ResetToBaseScale() { foreach (IPinMarker marker in markers.Values) - marker.ResetScale(IPinMarker.ScaleType.MINIMAP); + marker.ResetScale(IPinMarker.ScaleType.Minimap); } public UniTask Disable(CancellationToken cancellationToken) diff --git a/Explorer/Assets/DCL/MapRenderer/MapPath/MapPathController.cs b/Explorer/Assets/DCL/MapRenderer/MapPath/MapPathController.cs index 56580db1b62..f4a567fe480 100644 --- a/Explorer/Assets/DCL/MapRenderer/MapPath/MapPathController.cs +++ b/Explorer/Assets/DCL/MapRenderer/MapPath/MapPathController.cs @@ -187,7 +187,7 @@ public void ApplyCameraZoom(float baseZoom, float newZoom, int zoomLevel) public void ResetToBaseScale() { - internalPinMarker.ResetScale(IPinMarker.ScaleType.MINIMAP); + internalPinMarker.ResetScale(IPinMarker.ScaleType.Minimap); mapPathRenderer.ResetScale(); } } diff --git a/Explorer/Assets/DCL/MarketplaceCredits/CreditsUnlockedController.cs b/Explorer/Assets/DCL/MarketplaceCredits/CreditsUnlockedController.cs index 3a77c81f4a4..70ba4695941 100644 --- a/Explorer/Assets/DCL/MarketplaceCredits/CreditsUnlockedController.cs +++ b/Explorer/Assets/DCL/MarketplaceCredits/CreditsUnlockedController.cs @@ -8,7 +8,7 @@ public partial class CreditsUnlockedController : ControllerBase CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; public CreditsUnlockedController(ViewFactoryMethod viewFactory) : base(viewFactory) { } diff --git a/Explorer/Assets/DCL/MarketplaceCredits/MarketplaceCreditsMenuController.cs b/Explorer/Assets/DCL/MarketplaceCredits/MarketplaceCreditsMenuController.cs index 7286de4ee96..6ee7a039a8e 100644 --- a/Explorer/Assets/DCL/MarketplaceCredits/MarketplaceCreditsMenuController.cs +++ b/Explorer/Assets/DCL/MarketplaceCredits/MarketplaceCreditsMenuController.cs @@ -29,7 +29,7 @@ public partial class MarketplaceCreditsMenuController : ControllerBase CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; public event Action MarketplaceCreditsOpened; @@ -156,7 +156,7 @@ protected override void OnViewInstantiated() protected override void OnBeforeViewShow() { closeTaskCompletionSource = new UniTaskCompletionSource(); - OpenSection(MarketplaceCreditsSection.WELCOME); + OpenSection(MarketplaceCreditsSection.Welcome); SetSidebarButtonAnimationAsPaused(true); MarketplaceCreditsOpened.Invoke(inputData.IsOpenedFromNotification); } @@ -185,16 +185,16 @@ public void OpenSection(MarketplaceCreditsSection section) switch (section) { - case MarketplaceCreditsSection.WELCOME: + case MarketplaceCreditsSection.Welcome: viewInstance.SetInfoLinkButtonActive(false); marketplaceCreditsWelcomeSubController?.OpenSection(); break; - case MarketplaceCreditsSection.VERIFY_EMAIL: + case MarketplaceCreditsSection.VerifyEmail: haveJustClaimedCredits = false; marketplaceCreditsVerifyEmailSubController?.OpenSection(); viewInstance.TotalCreditsWidget.gameObject.SetActive(false); break; - case MarketplaceCreditsSection.GOALS_OF_THE_WEEK: + case MarketplaceCreditsSection.GoalsOfTheWeek: if (marketplaceCreditsGoalsOfTheWeekSubController != null) { marketplaceCreditsGoalsOfTheWeekSubController.HasToPlayClaimCreditsAnimation = haveJustClaimedCredits; @@ -202,12 +202,12 @@ public void OpenSection(MarketplaceCreditsSection section) } viewInstance.TotalCreditsWidget.gameObject.SetActive(true); break; - case MarketplaceCreditsSection.WEEK_GOALS_COMPLETED: + case MarketplaceCreditsSection.WeekGoalsCompleted: haveJustClaimedCredits = false; marketplaceCreditsWeekGoalsCompletedSubController?.OpenSection(); viewInstance.TotalCreditsWidget.gameObject.SetActive(true); break; - case MarketplaceCreditsSection.PROGRAM_ENDED: + case MarketplaceCreditsSection.ProgramEnded: haveJustClaimedCredits = false; viewInstance.TotalCreditsWidget.SetAsProgramEndVersion(isProgramEndVersion: true); marketplaceCreditsProgramEndedSubController?.OpenSection(); @@ -225,7 +225,7 @@ public async UniTaskVoid ShowCreditsUnlockedPanelAsync(float claimedCredits) // We open the welcome section after closing the credits unlocked panel isCreditsUnlockedPanelOpen = false; haveJustClaimedCredits = true; - OpenSection(MarketplaceCreditsSection.WELCOME); + OpenSection(MarketplaceCreditsSection.Welcome); } public void ShowErrorNotification(string message) @@ -296,8 +296,8 @@ private void OnMarketplaceCreditsNotificationReceived(INotification notification SetSidebarButtonAsClaimIndicator(true); // If the user is in the Goals of the Week section, we need to refresh the information - if (currentSection == MarketplaceCreditsSection.GOALS_OF_THE_WEEK && !isCreditsUnlockedPanelOpen) - OpenSection(MarketplaceCreditsSection.WELCOME); + if (currentSection == MarketplaceCreditsSection.GoalsOfTheWeek && !isCreditsUnlockedPanelOpen) + OpenSection(MarketplaceCreditsSection.Welcome); } private void OnMarketplaceCreditsNotificationClicked(object[] parameters) diff --git a/Explorer/Assets/DCL/MarketplaceCredits/MarketplaceCreditsMenuView.cs b/Explorer/Assets/DCL/MarketplaceCredits/MarketplaceCreditsMenuView.cs index 2d2b56d57d6..432ab89bf83 100644 --- a/Explorer/Assets/DCL/MarketplaceCredits/MarketplaceCreditsMenuView.cs +++ b/Explorer/Assets/DCL/MarketplaceCredits/MarketplaceCreditsMenuView.cs @@ -11,11 +11,11 @@ namespace DCL.MarketplaceCredits { public enum MarketplaceCreditsSection { - WELCOME, - VERIFY_EMAIL, - GOALS_OF_THE_WEEK, - WEEK_GOALS_COMPLETED, - PROGRAM_ENDED, + Welcome, + VerifyEmail, + GoalsOfTheWeek, + WeekGoalsCompleted, + ProgramEnded, } public class MarketplaceCreditsMenuView : ViewBaseWithAnimationElement, IView, IPointerClickHandler diff --git a/Explorer/Assets/DCL/MarketplaceCredits/Purchase/CreditsPurchaseService.cs b/Explorer/Assets/DCL/MarketplaceCredits/Purchase/CreditsPurchaseService.cs index ed57898402f..3f5386adef7 100644 --- a/Explorer/Assets/DCL/MarketplaceCredits/Purchase/CreditsPurchaseService.cs +++ b/Explorer/Assets/DCL/MarketplaceCredits/Purchase/CreditsPurchaseService.cs @@ -54,30 +54,30 @@ public CreditsPurchaseService( public async UniTask PurchaseAsync(string tradeId, int expectedPriceCredits, CancellationToken ct) { if (!isFeatureEnabled) - return new CreditsPurchaseResult(CreditsPurchaseError.FEATURE_DISABLED); + return new CreditsPurchaseResult(CreditsPurchaseError.FeatureDisabled); IWeb3Identity? identity = identityCache.Identity; if (identity == null) - return new CreditsPurchaseResult(CreditsPurchaseError.UNKNOWN_ERROR, message: "No web3 identity"); + return new CreditsPurchaseResult(CreditsPurchaseError.UnknownError, message: "No web3 identity"); string buyer = identity.Address; try { return await PurchaseInternalAsync(tradeId, expectedPriceCredits, buyer, ct); } catch (OperationCanceledException) { - return new CreditsPurchaseResult(CreditsPurchaseError.CANCELLED); + return new CreditsPurchaseResult(CreditsPurchaseError.Cancelled); } catch (Exception e) { ReportHub.LogException(e, new ReportData(ReportCategory.CREDITS_PURCHASE)); - return new CreditsPurchaseResult(CreditsPurchaseError.UNKNOWN_ERROR, message: e.Message); + return new CreditsPurchaseResult(CreditsPurchaseError.UnknownError, message: e.Message); } } private async UniTask PurchaseInternalAsync(string tradeId, int expectedPriceCredits, string buyer, CancellationToken ct) { - SetState(CreditsPurchaseState.RESOLVING_LISTING); + SetState(CreditsPurchaseState.ResolvingListing); TradeDto? trade; @@ -86,27 +86,27 @@ private async UniTask PurchaseInternalAsync(string tradeI catch (Exception e) { ReportHub.LogWarning(ReportCategory.CREDITS_PURCHASE, $"Trade {tradeId} could not be fetched: {e.Message}"); - return Fail(CreditsPurchaseError.LISTING_NOT_AVAILABLE, message: e.Message); + return Fail(CreditsPurchaseError.ListingNotAvailable, message: e.Message); } if (trade == null) - return Fail(CreditsPurchaseError.LISTING_NOT_AVAILABLE); + return Fail(CreditsPurchaseError.ListingNotAvailable); if (string.Equals(trade.signer, buyer, StringComparison.OrdinalIgnoreCase)) - return Fail(CreditsPurchaseError.OWN_LISTING); + return Fail(CreditsPurchaseError.OwnListing); if (trade.received.Length == 0 || trade.received[0].assetType != CreditsTradeEncoder.ASSET_TYPE_USD_PEGGED_MANA) - return Fail(CreditsPurchaseError.LISTING_NOT_AVAILABLE, message: "Trade is not listed as credits"); + return Fail(CreditsPurchaseError.ListingNotAvailable, message: "Trade is not listed as credits"); int usdCents = CreditsTradeEncoder.UsdWeiToCents(trade.received[0].amount); if (usdCents <= 0) - return Fail(CreditsPurchaseError.LISTING_NOT_AVAILABLE, message: "Trade has no price"); + return Fail(CreditsPurchaseError.ListingNotAvailable, message: "Trade has no price"); if (usdCents != expectedPriceCredits * CENTS_PER_CREDIT) - return Fail(CreditsPurchaseError.PRICE_CHANGED, message: $"Listed for {usdCents} cents, expected {expectedPriceCredits * CENTS_PER_CREDIT}"); + return Fail(CreditsPurchaseError.PriceChanged, message: $"Listed for {usdCents} cents, expected {expectedPriceCredits * CENTS_PER_CREDIT}"); - SetState(CreditsPurchaseState.AUTHORIZING); + SetState(CreditsPurchaseState.Authorizing); AuthorizeCreditResponse authorization; @@ -117,12 +117,12 @@ private async UniTask PurchaseInternalAsync(string tradeI bool insufficient = (e.Text ?? string.Empty).IndexOf("insufficient", StringComparison.OrdinalIgnoreCase) >= 0 || (e.Text ?? string.Empty).IndexOf("balance", StringComparison.OrdinalIgnoreCase) >= 0; - return Fail(insufficient ? CreditsPurchaseError.INSUFFICIENT_CREDITS : CreditsPurchaseError.AUTHORIZATION_FAILED, message: e.Text); + return Fail(insufficient ? CreditsPurchaseError.InsufficientCredits : CreditsPurchaseError.AuthorizationFailed, message: e.Text); } catch (Exception e) { ReportHub.LogException(e, new ReportData(ReportCategory.CREDITS_PURCHASE)); - return Fail(CreditsPurchaseError.AUTHORIZATION_FAILED, message: e.Message); + return Fail(CreditsPurchaseError.AuthorizationFailed, message: e.Message); } string useCreditsCalldata; @@ -138,10 +138,10 @@ private async UniTask PurchaseInternalAsync(string tradeI { ReportHub.LogException(e, new ReportData(ReportCategory.CREDITS_PURCHASE)); await ReleaseIntentAsync(authorization.credit.id); - return Fail(CreditsPurchaseError.ENCODING_FAILED, message: e.Message); + return Fail(CreditsPurchaseError.EncodingFailed, message: e.Message); } - SetState(CreditsPurchaseState.SIGNING); + SetState(CreditsPurchaseState.Signing); RelayResult relay; @@ -155,26 +155,26 @@ private async UniTask PurchaseInternalAsync(string tradeI switch (relay.Outcome) { - case RelayOutcome.BROADCAST: + case RelayOutcome.Broadcast: txHash = relay.TxHash; break; - case RelayOutcome.SIGNATURE_REJECTED: + case RelayOutcome.SignatureRejected: await ReleaseIntentAsync(authorization.credit.id); - return Fail(CreditsPurchaseError.SIGNATURE_REJECTED, message: relay.Message); - case RelayOutcome.SIGNING_FAILED: + return Fail(CreditsPurchaseError.SignatureRejected, message: relay.Message); + case RelayOutcome.SigningFailed: await ReleaseIntentAsync(authorization.credit.id); - return Fail(CreditsPurchaseError.SIGNING_FAILED, message: relay.Message); - case RelayOutcome.AMBIGUOUS_BROADCAST: - SetState(CreditsPurchaseState.FAILED); - return new CreditsPurchaseResult(CreditsPurchaseError.SETTLEMENT_PENDING, message: relay.Message); - case RelayOutcome.RELAYER_REJECTED: + return Fail(CreditsPurchaseError.SigningFailed, message: relay.Message); + case RelayOutcome.AmbiguousBroadcast: + SetState(CreditsPurchaseState.Failed); + return new CreditsPurchaseResult(CreditsPurchaseError.SettlementPending, message: relay.Message); + case RelayOutcome.RelayerRejected: if (web3Provider.IsThirdWebOTP) { await ReleaseIntentAsync(authorization.credit.id); - return Fail(CreditsPurchaseError.RELAYER_UNAVAILABLE, message: relay.Message); + return Fail(CreditsPurchaseError.RelayerUnavailable, message: relay.Message); } - SetState(CreditsPurchaseState.SUBMITTING); + SetState(CreditsPurchaseState.Submitting); CreditsPurchaseResult? fallbackFailure = null; try { txHash = await SendWalletTransactionAsync(buyer, useCreditsCalldata, ct); } @@ -191,7 +191,7 @@ private async UniTask PurchaseInternalAsync(string tradeI if (!userRejected) ReportHub.LogException(e, new ReportData(ReportCategory.CREDITS_PURCHASE)); - fallbackFailure = Fail(userRejected ? CreditsPurchaseError.SIGNATURE_REJECTED : CreditsPurchaseError.RELAYER_UNAVAILABLE, message: e.Message); + fallbackFailure = Fail(userRejected ? CreditsPurchaseError.SignatureRejected : CreditsPurchaseError.RelayerUnavailable, message: e.Message); } if (fallbackFailure != null) @@ -206,24 +206,24 @@ private async UniTask PurchaseInternalAsync(string tradeI if (string.IsNullOrEmpty(txHash)) { await ReleaseIntentAsync(authorization.credit.id); - return Fail(CreditsPurchaseError.RELAYER_UNAVAILABLE, message: "No transaction hash"); + return Fail(CreditsPurchaseError.RelayerUnavailable, message: "No transaction hash"); } - SetState(CreditsPurchaseState.WAITING_SETTLEMENT); + SetState(CreditsPurchaseState.WaitingSettlement); SettlementOutcome settlement = await settlementPoller.WaitForSettlementAsync(txHash!, SETTLEMENT_TIMEOUT, ct); // non-null: guarded by IsNullOrEmpty check at line 195 switch (settlement) { - case SettlementOutcome.CONFIRMED: - SetState(CreditsPurchaseState.SUCCESS); + case SettlementOutcome.Confirmed: + SetState(CreditsPurchaseState.Success); return CreditsPurchaseResult.Ok(txHash!); - case SettlementOutcome.REVERTED: + case SettlementOutcome.Reverted: await ReleaseIntentAsync(authorization.credit.id); - return Fail(CreditsPurchaseError.TRANSACTION_REVERTED, txHash); + return Fail(CreditsPurchaseError.TransactionReverted, txHash); default: - SetState(CreditsPurchaseState.FAILED); - return new CreditsPurchaseResult(CreditsPurchaseError.SETTLEMENT_PENDING, txHash); + SetState(CreditsPurchaseState.Failed); + return new CreditsPurchaseResult(CreditsPurchaseError.SettlementPending, txHash); } } @@ -261,7 +261,7 @@ private async UniTask ReleaseIntentAsync(string creditId) private CreditsPurchaseResult Fail(CreditsPurchaseError error, string? txHash = null, string? message = null) { - SetState(CreditsPurchaseState.FAILED); + SetState(CreditsPurchaseState.Failed); return new CreditsPurchaseResult(error, txHash, message); } diff --git a/Explorer/Assets/DCL/MarketplaceCredits/Purchase/CreditsPurchaseTypes.cs b/Explorer/Assets/DCL/MarketplaceCredits/Purchase/CreditsPurchaseTypes.cs index 90b85af058c..54cd28d3fed 100644 --- a/Explorer/Assets/DCL/MarketplaceCredits/Purchase/CreditsPurchaseTypes.cs +++ b/Explorer/Assets/DCL/MarketplaceCredits/Purchase/CreditsPurchaseTypes.cs @@ -2,32 +2,32 @@ namespace DCL.MarketplaceCredits.Purchase { public enum CreditsPurchaseState { - RESOLVING_LISTING, - AUTHORIZING, - SIGNING, - SUBMITTING, - WAITING_SETTLEMENT, - SUCCESS, - FAILED, + ResolvingListing, + Authorizing, + Signing, + Submitting, + WaitingSettlement, + Success, + Failed, } public enum CreditsPurchaseError { - NONE, - FEATURE_DISABLED, - LISTING_NOT_AVAILABLE, - OWN_LISTING, - PRICE_CHANGED, - INSUFFICIENT_CREDITS, - AUTHORIZATION_FAILED, - SIGNATURE_REJECTED, - SIGNING_FAILED, - RELAYER_UNAVAILABLE, - TRANSACTION_REVERTED, - SETTLEMENT_PENDING, - CANCELLED, - ENCODING_FAILED, - UNKNOWN_ERROR, + None, + FeatureDisabled, + ListingNotAvailable, + OwnListing, + PriceChanged, + InsufficientCredits, + AuthorizationFailed, + SignatureRejected, + SigningFailed, + RelayerUnavailable, + TransactionReverted, + SettlementPending, + Cancelled, + EncodingFailed, + UnknownError, } public readonly struct CreditsPurchaseResult @@ -36,7 +36,7 @@ public readonly struct CreditsPurchaseResult public readonly string? TxHash; public readonly string? Message; - public bool Success => Error == CreditsPurchaseError.NONE; + public bool Success => Error == CreditsPurchaseError.None; public CreditsPurchaseResult(CreditsPurchaseError error, string? txHash = null, string? message = null) { @@ -46,6 +46,6 @@ public CreditsPurchaseResult(CreditsPurchaseError error, string? txHash = null, } public static CreditsPurchaseResult Ok(string txHash) => - new (CreditsPurchaseError.NONE, txHash); + new (CreditsPurchaseError.None, txHash); } } diff --git a/Explorer/Assets/DCL/MarketplaceCredits/Purchase/Relay/CreditsManagerMetaTxRelayer.cs b/Explorer/Assets/DCL/MarketplaceCredits/Purchase/Relay/CreditsManagerMetaTxRelayer.cs index 9a0368b4813..66c400c5779 100644 --- a/Explorer/Assets/DCL/MarketplaceCredits/Purchase/Relay/CreditsManagerMetaTxRelayer.cs +++ b/Explorer/Assets/DCL/MarketplaceCredits/Purchase/Relay/CreditsManagerMetaTxRelayer.cs @@ -14,11 +14,11 @@ namespace DCL.MarketplaceCredits.Purchase { public enum RelayOutcome { - BROADCAST, - SIGNATURE_REJECTED, - SIGNING_FAILED, - RELAYER_REJECTED, - AMBIGUOUS_BROADCAST, + Broadcast, + SignatureRejected, + SigningFailed, + RelayerRejected, + AmbiguousBroadcast, } public readonly struct RelayResult @@ -67,7 +67,7 @@ public virtual async UniTask RelayUseCreditsAsync(string buyer, str catch (Exception e) { ReportHub.LogException(e, new ReportData(ReportCategory.CREDITS_PURCHASE)); - return new RelayResult(RelayOutcome.SIGNING_FAILED, message: $"Nonce read failed: {e.Message}"); + return new RelayResult(RelayOutcome.SigningFailed, message: $"Nonce read failed: {e.Message}"); } string typedDataJson = CreditsTradeEncoder.BuildMetaTxTypedDataJson(chainConfig, nonce, buyer, useCreditsCalldata); @@ -86,7 +86,7 @@ public virtual async UniTask RelayUseCreditsAsync(string buyer, str signature = signResponse.result?.ToString() ?? string.Empty; if (string.IsNullOrEmpty(signature)) - return new RelayResult(RelayOutcome.SIGNATURE_REJECTED, message: "Empty signature returned"); + return new RelayResult(RelayOutcome.SignatureRejected, message: "Empty signature returned"); } catch (OperationCanceledException) { throw; } catch (Exception e) @@ -97,7 +97,7 @@ public virtual async UniTask RelayUseCreditsAsync(string buyer, str if (!userRejected) ReportHub.LogException(e, new ReportData(ReportCategory.CREDITS_PURCHASE)); - return new RelayResult(userRejected ? RelayOutcome.SIGNATURE_REJECTED : RelayOutcome.SIGNING_FAILED, message: e.Message); + return new RelayResult(userRejected ? RelayOutcome.SignatureRejected : RelayOutcome.SigningFailed, message: e.Message); } string txData = CreditsTradeEncoder.BuildExecuteMetaTxCalldata(buyer, useCreditsCalldata, signature); @@ -122,25 +122,25 @@ public virtual async UniTask RelayUseCreditsAsync(string buyer, str string? txHash = response["txHash"]?.ToString(); if (string.IsNullOrEmpty(txHash)) - return new RelayResult(RelayOutcome.RELAYER_REJECTED, message: response["message"]?.ToString() ?? "Relayer returned no txHash"); + return new RelayResult(RelayOutcome.RelayerRejected, message: response["message"]?.ToString() ?? "Relayer returned no txHash"); - return new RelayResult(RelayOutcome.BROADCAST, txHash); + return new RelayResult(RelayOutcome.Broadcast, txHash); } catch (OperationCanceledException) { - return new RelayResult(RelayOutcome.AMBIGUOUS_BROADCAST, message: "Cancelled while awaiting relayer response"); + return new RelayResult(RelayOutcome.AmbiguousBroadcast, message: "Cancelled while awaiting relayer response"); } catch (UnityWebRequestException e) { if (e.ResponseCode > 0) - return new RelayResult(RelayOutcome.RELAYER_REJECTED, message: $"Relayer {e.ResponseCode}: {e.Text}"); + return new RelayResult(RelayOutcome.RelayerRejected, message: $"Relayer {e.ResponseCode}: {e.Text}"); - return new RelayResult(RelayOutcome.AMBIGUOUS_BROADCAST, message: e.Message); + return new RelayResult(RelayOutcome.AmbiguousBroadcast, message: e.Message); } catch (Exception e) { ReportHub.LogException(e, new ReportData(ReportCategory.CREDITS_PURCHASE)); - return new RelayResult(RelayOutcome.AMBIGUOUS_BROADCAST, message: e.Message); + return new RelayResult(RelayOutcome.AmbiguousBroadcast, message: e.Message); } } diff --git a/Explorer/Assets/DCL/MarketplaceCredits/Purchase/Relay/PolygonSettlementPoller.cs b/Explorer/Assets/DCL/MarketplaceCredits/Purchase/Relay/PolygonSettlementPoller.cs index 6272f975261..5d471b2585a 100644 --- a/Explorer/Assets/DCL/MarketplaceCredits/Purchase/Relay/PolygonSettlementPoller.cs +++ b/Explorer/Assets/DCL/MarketplaceCredits/Purchase/Relay/PolygonSettlementPoller.cs @@ -9,9 +9,9 @@ namespace DCL.MarketplaceCredits.Purchase { public enum SettlementOutcome { - CONFIRMED, - REVERTED, - PENDING, + Confirmed, + Reverted, + Pending, } // This poller waits for a broadcast transaction to land on Polygon, this is needed to confirm or not if a transaction has been confirmed or not @@ -39,7 +39,7 @@ public virtual async UniTask WaitForSettlementAsync(string tx while (DateTime.UtcNow < deadline) { if (ct.IsCancellationRequested) - return SettlementOutcome.PENDING; + return SettlementOutcome.Pending; try { @@ -58,15 +58,15 @@ public virtual async UniTask WaitForSettlementAsync(string tx string? status = receipt[STATUS_FIELD]?.ToString(); if (string.Equals(status, CONFIRMED_STATUS, StringComparison.OrdinalIgnoreCase)) - return SettlementOutcome.CONFIRMED; + return SettlementOutcome.Confirmed; if (string.Equals(status, REVERTED_STATUS, StringComparison.OrdinalIgnoreCase)) - return SettlementOutcome.REVERTED; + return SettlementOutcome.Reverted; } } catch (OperationCanceledException) { - return SettlementOutcome.PENDING; + return SettlementOutcome.Pending; } catch (Exception e) { @@ -76,10 +76,10 @@ public virtual async UniTask WaitForSettlementAsync(string tx bool cancelled = await UniTask.Delay(POLL_INTERVAL, cancellationToken: ct).SuppressCancellationThrow(); if (cancelled) - return SettlementOutcome.PENDING; + return SettlementOutcome.Pending; } - return SettlementOutcome.PENDING; + return SettlementOutcome.Pending; } } } diff --git a/Explorer/Assets/DCL/MarketplaceCredits/Purchase/Tests/CreditsPurchaseServiceShould.cs b/Explorer/Assets/DCL/MarketplaceCredits/Purchase/Tests/CreditsPurchaseServiceShould.cs index fbb5e6e34b9..a77d276c8e6 100644 --- a/Explorer/Assets/DCL/MarketplaceCredits/Purchase/Tests/CreditsPurchaseServiceShould.cs +++ b/Explorer/Assets/DCL/MarketplaceCredits/Purchase/Tests/CreditsPurchaseServiceShould.cs @@ -53,10 +53,10 @@ public void SetUp() .Returns(UniTask.FromResult(CreateAuthorization())); metaTxRelayer.RelayUseCreditsAsync(Arg.Any(), Arg.Any(), Arg.Any()) - .Returns(UniTask.FromResult(new RelayResult(RelayOutcome.BROADCAST, TX_HASH))); + .Returns(UniTask.FromResult(new RelayResult(RelayOutcome.Broadcast, TX_HASH))); settlementPoller.WaitForSettlementAsync(Arg.Any(), Arg.Any(), Arg.Any()) - .Returns(UniTask.FromResult(SettlementOutcome.CONFIRMED)); + .Returns(UniTask.FromResult(SettlementOutcome.Confirmed)); service = new CreditsPurchaseService( shopAPIClient, creditsAPIClient, metaTxRelayer, settlementPoller, @@ -131,7 +131,7 @@ public async Task CompletePurchaseThroughGaslessPath() Assert.IsTrue(result.Success); Assert.AreEqual(TX_HASH, result.TxHash); CollectionAssert.AreEqual( - new[] { CreditsPurchaseState.RESOLVING_LISTING, CreditsPurchaseState.AUTHORIZING, CreditsPurchaseState.SIGNING, CreditsPurchaseState.WAITING_SETTLEMENT, CreditsPurchaseState.SUCCESS }, + new[] { CreditsPurchaseState.ResolvingListing, CreditsPurchaseState.Authorizing, CreditsPurchaseState.Signing, CreditsPurchaseState.WaitingSettlement, CreditsPurchaseState.Success }, recordedStates); await creditsAPIClient.DidNotReceive().ReleaseUsdIntentsAsync(Arg.Any(), Arg.Any()); } @@ -148,7 +148,7 @@ public async Task FailWhenFeatureIsDisabled() CreditsPurchaseResult result = await disabledService.PurchaseAsync(TRADE_ID, PRICE_CREDITS, CancellationToken.None); // Assert - Assert.AreEqual(CreditsPurchaseError.FEATURE_DISABLED, result.Error); + Assert.AreEqual(CreditsPurchaseError.FeatureDisabled, result.Error); await shopAPIClient.DidNotReceive().GetTradeAsync(Arg.Any(), Arg.Any()); } @@ -164,7 +164,7 @@ public async Task RejectBuyingOwnListingBeforeCharging() CreditsPurchaseResult result = await service.PurchaseAsync(TRADE_ID, PRICE_CREDITS, CancellationToken.None); // Assert - Assert.AreEqual(CreditsPurchaseError.OWN_LISTING, result.Error); + Assert.AreEqual(CreditsPurchaseError.OwnListing, result.Error); await creditsAPIClient.DidNotReceive().AuthorizeUsdCreditAsync(Arg.Any(), Arg.Any(), Arg.Any()); } @@ -175,7 +175,7 @@ public async Task RejectPurchaseWhenPriceChangedBeforeCharging() CreditsPurchaseResult result = await service.PurchaseAsync(TRADE_ID, PRICE_CREDITS + 5, CancellationToken.None); // Assert - Assert.AreEqual(CreditsPurchaseError.PRICE_CHANGED, result.Error); + Assert.AreEqual(CreditsPurchaseError.PriceChanged, result.Error); await creditsAPIClient.DidNotReceive().AuthorizeUsdCreditAsync(Arg.Any(), Arg.Any(), Arg.Any()); } @@ -192,7 +192,7 @@ public async Task MapAuthorizationFailureWithoutReleasingAnything() CreditsPurchaseResult result = await service.PurchaseAsync(TRADE_ID, PRICE_CREDITS, CancellationToken.None); // Assert - Assert.AreEqual(CreditsPurchaseError.AUTHORIZATION_FAILED, result.Error); + Assert.AreEqual(CreditsPurchaseError.AuthorizationFailed, result.Error); await creditsAPIClient.DidNotReceive().ReleaseUsdIntentsAsync(Arg.Any(), Arg.Any()); } @@ -201,13 +201,13 @@ public async Task ReleaseReservationWhenSignatureIsRejected() { // Arrange metaTxRelayer.RelayUseCreditsAsync(Arg.Any(), Arg.Any(), Arg.Any()) - .Returns(UniTask.FromResult(new RelayResult(RelayOutcome.SIGNATURE_REJECTED))); + .Returns(UniTask.FromResult(new RelayResult(RelayOutcome.SignatureRejected))); // Act CreditsPurchaseResult result = await service.PurchaseAsync(TRADE_ID, PRICE_CREDITS, CancellationToken.None); // Assert - Assert.AreEqual(CreditsPurchaseError.SIGNATURE_REJECTED, result.Error); + Assert.AreEqual(CreditsPurchaseError.SignatureRejected, result.Error); await creditsAPIClient.Received(1).ReleaseUsdIntentsAsync(Arg.Is(salts => salts.Length == 1 && salts[0] == CREDIT_ID), Arg.Any()); } @@ -216,7 +216,7 @@ public async Task FailWithoutWalletFallbackOnThirdWebWallets() { // Arrange metaTxRelayer.RelayUseCreditsAsync(Arg.Any(), Arg.Any(), Arg.Any()) - .Returns(UniTask.FromResult(new RelayResult(RelayOutcome.RELAYER_REJECTED, message: "down"))); + .Returns(UniTask.FromResult(new RelayResult(RelayOutcome.RelayerRejected, message: "down"))); web3Provider.IsThirdWebOTP.Returns(true); @@ -224,7 +224,7 @@ public async Task FailWithoutWalletFallbackOnThirdWebWallets() CreditsPurchaseResult result = await service.PurchaseAsync(TRADE_ID, PRICE_CREDITS, CancellationToken.None); // Assert - Assert.AreEqual(CreditsPurchaseError.RELAYER_UNAVAILABLE, result.Error); + Assert.AreEqual(CreditsPurchaseError.RelayerUnavailable, result.Error); await web3Provider.DidNotReceive().SendAsync(Arg.Any(), Arg.Any(), Arg.Any()); await creditsAPIClient.Received(1).ReleaseUsdIntentsAsync(Arg.Is(salts => salts[0] == CREDIT_ID), Arg.Any()); } @@ -236,7 +236,7 @@ public async Task FallBackToWalletTransactionOnDappWallets() const string FALLBACK_TX_HASH = "0xfa11bacc"; metaTxRelayer.RelayUseCreditsAsync(Arg.Any(), Arg.Any(), Arg.Any()) - .Returns(UniTask.FromResult(new RelayResult(RelayOutcome.RELAYER_REJECTED, message: "down"))); + .Returns(UniTask.FromResult(new RelayResult(RelayOutcome.RelayerRejected, message: "down"))); web3Provider.IsThirdWebOTP.Returns(false); @@ -258,13 +258,13 @@ public async Task ReleaseReservationWhenTransactionReverts() { // Arrange settlementPoller.WaitForSettlementAsync(Arg.Any(), Arg.Any(), Arg.Any()) - .Returns(UniTask.FromResult(SettlementOutcome.REVERTED)); + .Returns(UniTask.FromResult(SettlementOutcome.Reverted)); // Act CreditsPurchaseResult result = await service.PurchaseAsync(TRADE_ID, PRICE_CREDITS, CancellationToken.None); // Assert - Assert.AreEqual(CreditsPurchaseError.TRANSACTION_REVERTED, result.Error); + Assert.AreEqual(CreditsPurchaseError.TransactionReverted, result.Error); await creditsAPIClient.Received(1).ReleaseUsdIntentsAsync(Arg.Is(salts => salts[0] == CREDIT_ID), Arg.Any()); } @@ -273,13 +273,13 @@ public async Task KeepReservationWhenSettlementIsPending() { // Arrange settlementPoller.WaitForSettlementAsync(Arg.Any(), Arg.Any(), Arg.Any()) - .Returns(UniTask.FromResult(SettlementOutcome.PENDING)); + .Returns(UniTask.FromResult(SettlementOutcome.Pending)); // Act CreditsPurchaseResult result = await service.PurchaseAsync(TRADE_ID, PRICE_CREDITS, CancellationToken.None); // Assert - Assert.AreEqual(CreditsPurchaseError.SETTLEMENT_PENDING, result.Error); + Assert.AreEqual(CreditsPurchaseError.SettlementPending, result.Error); Assert.AreEqual(TX_HASH, result.TxHash); await creditsAPIClient.DidNotReceive().ReleaseUsdIntentsAsync(Arg.Any(), Arg.Any()); } @@ -289,13 +289,13 @@ public async Task KeepReservationWhenBroadcastIsAmbiguous() { // Arrange metaTxRelayer.RelayUseCreditsAsync(Arg.Any(), Arg.Any(), Arg.Any()) - .Returns(UniTask.FromResult(new RelayResult(RelayOutcome.AMBIGUOUS_BROADCAST, message: "timeout"))); + .Returns(UniTask.FromResult(new RelayResult(RelayOutcome.AmbiguousBroadcast, message: "timeout"))); // Act CreditsPurchaseResult result = await service.PurchaseAsync(TRADE_ID, PRICE_CREDITS, CancellationToken.None); // Assert - Assert.AreEqual(CreditsPurchaseError.SETTLEMENT_PENDING, result.Error); + Assert.AreEqual(CreditsPurchaseError.SettlementPending, result.Error); await creditsAPIClient.DidNotReceive().ReleaseUsdIntentsAsync(Arg.Any(), Arg.Any()); await settlementPoller.DidNotReceive().WaitForSettlementAsync(Arg.Any(), Arg.Any(), Arg.Any()); } @@ -312,7 +312,7 @@ public async Task RejectTradesThatAreNotUsdPegged() CreditsPurchaseResult result = await service.PurchaseAsync(TRADE_ID, PRICE_CREDITS, CancellationToken.None); // Assert - Assert.AreEqual(CreditsPurchaseError.LISTING_NOT_AVAILABLE, result.Error); + Assert.AreEqual(CreditsPurchaseError.ListingNotAvailable, result.Error); await creditsAPIClient.DidNotReceive().AuthorizeUsdCreditAsync(Arg.Any(), Arg.Any(), Arg.Any()); } } diff --git a/Explorer/Assets/DCL/MarketplaceCredits/Purchase/Tests/CreditsTopUpServiceShould.cs b/Explorer/Assets/DCL/MarketplaceCredits/Purchase/Tests/CreditsTopUpServiceShould.cs index 0e809674f9e..60dd03ed8fc 100644 --- a/Explorer/Assets/DCL/MarketplaceCredits/Purchase/Tests/CreditsTopUpServiceShould.cs +++ b/Explorer/Assets/DCL/MarketplaceCredits/Purchase/Tests/CreditsTopUpServiceShould.cs @@ -62,12 +62,12 @@ public async Task OpenBrowserAndReachWaitingStateWhenCheckoutSucceeds() // Act service.StartTopUp(PACK); - await WaitForStageAsync(CreditsTopUpStage.WAITING_FOR_PAYMENT); + await WaitForStageAsync(CreditsTopUpStage.WaitingForPayment); // Assert webBrowser.Received(1).OpenUrlMainThreadOnly(CHECKOUT_URL); Assert.AreEqual(ORDER_ID, service.CurrentStatus.OrderId); - Assert.AreEqual(CreditsTopUpStage.CREATING_CHECKOUT, recordedStatuses[0].Stage); + Assert.AreEqual(CreditsTopUpStage.CreatingCheckout, recordedStatuses[0].Stage); } [TestCase(CreditsCheckoutError.FeatureDisabled)] @@ -83,7 +83,7 @@ public async Task FailWithoutOpeningBrowserWhenCheckoutFails(CreditsCheckoutErro // Act service.StartTopUp(PACK); - await WaitForStageAsync(CreditsTopUpStage.FAILED); + await WaitForStageAsync(CreditsTopUpStage.Failed); // Assert Assert.AreEqual(checkoutError, service.CurrentStatus.CheckoutError); @@ -100,7 +100,7 @@ public async Task ResetToIdleWhenCheckoutIsCancelled() // Act service.StartTopUp(PACK); - await WaitForStageAsync(CreditsTopUpStage.IDLE); + await WaitForStageAsync(CreditsTopUpStage.Idle); // Assert webBrowser.DidNotReceive().OpenUrlMainThreadOnly(Arg.Any()); @@ -118,7 +118,7 @@ public async Task TransitionToCreditedAndRefreshBalance() // Act service.StartTopUp(PACK); - await WaitForStageAsync(CreditsTopUpStage.CREDITED); + await WaitForStageAsync(CreditsTopUpStage.Credited); // Assert Assert.AreEqual(50, service.CurrentStatus.CreditsGranted); @@ -136,7 +136,7 @@ public async Task TransitionToFailedWhenOrderFails() // Act service.StartTopUp(PACK); - await WaitForStageAsync(CreditsTopUpStage.FAILED); + await WaitForStageAsync(CreditsTopUpStage.Failed); // Assert Assert.AreEqual("card_declined", service.CurrentStatus.ErrorMessage); @@ -155,11 +155,11 @@ public async Task EnterPendingTimeoutWhenPollDeadlineElapses() // Act service.StartTopUp(PACK); - await WaitForStageAsync(CreditsTopUpStage.PENDING_TIMEOUT); + await WaitForStageAsync(CreditsTopUpStage.PendingTimeout); // Assert: the background window also expires and the soft state persists. await UniTask.Delay(200); - Assert.AreEqual(CreditsTopUpStage.PENDING_TIMEOUT, service.CurrentStatus.Stage); + Assert.AreEqual(CreditsTopUpStage.PendingTimeout, service.CurrentStatus.Stage); } [Test] @@ -169,13 +169,13 @@ public async Task ResolveLateCreditAfterPendingTimeout() CreateService(foregroundTimeoutMs: 30, backgroundTimeoutMs: 5000); creditsAPIClient.GetCheckoutOrderAsync(ORDER_ID, Arg.Any()) - .Returns(_ => service.CurrentStatus.Stage == CreditsTopUpStage.PENDING_TIMEOUT + .Returns(_ => service.CurrentStatus.Stage == CreditsTopUpStage.PendingTimeout ? Order(CreditsOrderStatusResponse.STATUS_CREDITED, creditsGranted: 50, newBalance: 62) : Order(CreditsOrderStatusResponse.STATUS_PROCESSING)); // Act service.StartTopUp(PACK); - await WaitForStageAsync(CreditsTopUpStage.CREDITED); + await WaitForStageAsync(CreditsTopUpStage.Credited); // Assert Assert.AreEqual(50, service.CurrentStatus.CreditsGranted); @@ -196,17 +196,17 @@ public async Task RefreshBalanceSilentlyWhenPendingWasAcknowledged() : Order(CreditsOrderStatusResponse.STATUS_PROCESSING)); service.StartTopUp(PACK); - await WaitForStageAsync(CreditsTopUpStage.PENDING_TIMEOUT); + await WaitForStageAsync(CreditsTopUpStage.PendingTimeout); // Act service.AcknowledgeTerminalState(); - Assert.AreEqual(CreditsTopUpStage.IDLE, service.CurrentStatus.Stage); + Assert.AreEqual(CreditsTopUpStage.Idle, service.CurrentStatus.Stage); releaseCredit = true; await UniTask.Delay(200); // Assert: the late grant refreshed the balance without re-surfacing a UI state. await creditsAPIClient.Received(1).GetUserCreditsAsync(Arg.Any(), Arg.Any()); - Assert.AreEqual(CreditsTopUpStage.IDLE, service.CurrentStatus.Stage); + Assert.AreEqual(CreditsTopUpStage.Idle, service.CurrentStatus.Stage); } [Test] @@ -217,20 +217,20 @@ public async Task HandOffToBackgroundPollAndStillCreditWhenBrowserWaitStopped() // user closed the browser tab). The foreground timeout is long, so the hand-off can only // come from StopWaitingForBrowser, not from a timeout. creditsAPIClient.GetCheckoutOrderAsync(ORDER_ID, Arg.Any()) - .Returns(_ => service.CurrentStatus.Stage == CreditsTopUpStage.PENDING_TIMEOUT + .Returns(_ => service.CurrentStatus.Stage == CreditsTopUpStage.PendingTimeout ? Order(CreditsOrderStatusResponse.STATUS_CREDITED, creditsGranted: 50, newBalance: 62) : Order(CreditsOrderStatusResponse.STATUS_PROCESSING)); service.StartTopUp(PACK); - await WaitForStageAsync(CreditsTopUpStage.WAITING_FOR_PAYMENT); + await WaitForStageAsync(CreditsTopUpStage.WaitingForPayment); // Act service.StopWaitingForBrowser(); // Assert - await WaitForStageAsync(CreditsTopUpStage.CREDITED); + await WaitForStageAsync(CreditsTopUpStage.Credited); Assert.AreEqual(50, service.CurrentStatus.CreditsGranted); - Assert.IsTrue(recordedStatuses.Exists(s => s.Stage == CreditsTopUpStage.PENDING_TIMEOUT)); + Assert.IsTrue(recordedStatuses.Exists(s => s.Stage == CreditsTopUpStage.PendingTimeout)); } [Test] @@ -241,13 +241,13 @@ public async Task IgnoreStopWaitingForBrowserWhenNotWaiting() .Returns(Order(CreditsOrderStatusResponse.STATUS_FAILED, error: "card_declined")); service.StartTopUp(PACK); - await WaitForStageAsync(CreditsTopUpStage.FAILED); + await WaitForStageAsync(CreditsTopUpStage.Failed); // Act service.StopWaitingForBrowser(); // Assert - Assert.AreEqual(CreditsTopUpStage.FAILED, service.CurrentStatus.Stage); + Assert.AreEqual(CreditsTopUpStage.Failed, service.CurrentStatus.Stage); } [Test] @@ -258,7 +258,7 @@ public async Task IgnoreStartTopUpWhileOrderInFlight() .Returns(Order(CreditsOrderStatusResponse.STATUS_PROCESSING)); service.StartTopUp(PACK); - await WaitForStageAsync(CreditsTopUpStage.WAITING_FOR_PAYMENT); + await WaitForStageAsync(CreditsTopUpStage.WaitingForPayment); // Act service.StartTopUp(PACK); @@ -279,7 +279,7 @@ public async Task SurvivePollErrorsUntilCredited() // Act service.StartTopUp(PACK); - await WaitForStageAsync(CreditsTopUpStage.CREDITED); + await WaitForStageAsync(CreditsTopUpStage.Credited); // Assert Assert.AreEqual(50, service.CurrentStatus.CreditsGranted); @@ -297,7 +297,7 @@ public async Task StayCreditedWhenBalanceRefreshFails() // Act service.StartTopUp(PACK); - await WaitForStageAsync(CreditsTopUpStage.CREDITED); + await WaitForStageAsync(CreditsTopUpStage.Credited); // Assert Assert.AreEqual(50, service.CurrentStatus.CreditsGranted); @@ -311,13 +311,13 @@ public async Task ResetTerminalStateToIdleOnAcknowledge() .Returns(Order(CreditsOrderStatusResponse.STATUS_FAILED, error: "card_declined")); service.StartTopUp(PACK); - await WaitForStageAsync(CreditsTopUpStage.FAILED); + await WaitForStageAsync(CreditsTopUpStage.Failed); // Act service.AcknowledgeTerminalState(); // Assert - Assert.AreEqual(CreditsTopUpStage.IDLE, service.CurrentStatus.Stage); + Assert.AreEqual(CreditsTopUpStage.Idle, service.CurrentStatus.Stage); Assert.IsFalse(service.IsOrderInFlight); } diff --git a/Explorer/Assets/DCL/MarketplaceCredits/Purchase/TopUp/CreditsTopUpService.cs b/Explorer/Assets/DCL/MarketplaceCredits/Purchase/TopUp/CreditsTopUpService.cs index 46c91511857..643d98ec2c0 100644 --- a/Explorer/Assets/DCL/MarketplaceCredits/Purchase/TopUp/CreditsTopUpService.cs +++ b/Explorer/Assets/DCL/MarketplaceCredits/Purchase/TopUp/CreditsTopUpService.cs @@ -13,10 +13,10 @@ public class CreditsTopUpService : ICreditsTopUpService { private enum PollOutcome { - CREDITED, - FAILED, - TIMED_OUT, - CANCELLED, + Credited, + Failed, + TimedOut, + Cancelled, } private static readonly TimeSpan FOREGROUND_POLL_INTERVAL = TimeSpan.FromSeconds(1.5); @@ -39,7 +39,7 @@ private enum PollOutcome public CreditsTopUpStatus CurrentStatus { get; private set; } = CreditsTopUpStatus.Idle(); public bool IsOrderInFlight => - CurrentStatus.Stage is CreditsTopUpStage.CREATING_CHECKOUT or CreditsTopUpStage.WAITING_FOR_PAYMENT; + CurrentStatus.Stage is CreditsTopUpStage.CreatingCheckout or CreditsTopUpStage.WaitingForPayment; public event Action? StatusChanged; @@ -86,7 +86,7 @@ public void StartTopUp(CreditPack pack) public void StopWaitingForBrowser() { - if (CurrentStatus.Stage != CreditsTopUpStage.WAITING_FOR_PAYMENT) + if (CurrentStatus.Stage != CreditsTopUpStage.WaitingForPayment) return; // Cancels only the foreground poll; RunTopUpAsync then hands the order off to the @@ -98,11 +98,11 @@ public void AcknowledgeTerminalState() { switch (CurrentStatus.Stage) { - case CreditsTopUpStage.CREDITED: - case CreditsTopUpStage.FAILED: + case CreditsTopUpStage.Credited: + case CreditsTopUpStage.Failed: SetStatus(CreditsTopUpStatus.Idle()); break; - case CreditsTopUpStage.PENDING_TIMEOUT: + case CreditsTopUpStage.PendingTimeout: pendingAcknowledged = true; SetStatus(CreditsTopUpStatus.Idle()); break; @@ -141,10 +141,10 @@ private async UniTaskVoid RunTopUpAsync(CreditPack pack, CancellationToken ct) skipForegroundCts = null; // Only the skip token fired (the user stopped waiting), not the outer ct: fall through to the background poll. - if (outcome == PollOutcome.CANCELLED && !ct.IsCancellationRequested) - outcome = PollOutcome.TIMED_OUT; + if (outcome == PollOutcome.Cancelled && !ct.IsCancellationRequested) + outcome = PollOutcome.TimedOut; - if (outcome == PollOutcome.TIMED_OUT) + if (outcome == PollOutcome.TimedOut) { SetStatus(CreditsTopUpStatus.PendingTimeout(pack, orderId)); (outcome, order) = await PollOrderAsync(orderId, backgroundPollInterval, backgroundPollTimeout, ct); @@ -152,13 +152,13 @@ private async UniTaskVoid RunTopUpAsync(CreditPack pack, CancellationToken ct) switch (outcome) { - case PollOutcome.CREDITED: + case PollOutcome.Credited: await RefreshBalanceAsync(ct); if (!pendingAcknowledged) SetStatus(CreditsTopUpStatus.Credited(pack, orderId, order.creditsGranted, order.newBalance)); break; - case PollOutcome.FAILED: + case PollOutcome.Failed: if (!pendingAcknowledged) SetStatus(CreditsTopUpStatus.GrantFailed(pack, orderId, order.error)); break; @@ -178,7 +178,7 @@ private async UniTaskVoid RunTopUpAsync(CreditPack pack, CancellationToken ct) while (DateTime.UtcNow < deadline) { if (ct.IsCancellationRequested) - return (PollOutcome.CANCELLED, default(CreditsOrderStatusResponse)); + return (PollOutcome.Cancelled, default(CreditsOrderStatusResponse)); EnumResult result = await creditsAPIClient.GetCheckoutOrderAsync(orderId, ct); @@ -187,15 +187,15 @@ private async UniTaskVoid RunTopUpAsync(CreditPack pack, CancellationToken ct) switch (result.Value.status) { case CreditsOrderStatusResponse.STATUS_CREDITED: - return (PollOutcome.CREDITED, result.Value); + return (PollOutcome.Credited, result.Value); case CreditsOrderStatusResponse.STATUS_FAILED: - return (PollOutcome.FAILED, result.Value); + return (PollOutcome.Failed, result.Value); } } else { if (result.Error!.Value.State == CreditsOrderPollError.Cancelled) - return (PollOutcome.CANCELLED, default(CreditsOrderStatusResponse)); + return (PollOutcome.Cancelled, default(CreditsOrderStatusResponse)); ReportHub.LogWarning(ReportCategory.CREDITS_PURCHASE, $"Order status poll failed for {orderId}: {result.Error.Value.State} {result.Error.Value.Message}"); } @@ -203,10 +203,10 @@ private async UniTaskVoid RunTopUpAsync(CreditPack pack, CancellationToken ct) bool cancelled = await UniTask.Delay(interval, cancellationToken: ct).SuppressCancellationThrow(); if (cancelled) - return (PollOutcome.CANCELLED, default(CreditsOrderStatusResponse)); + return (PollOutcome.Cancelled, default(CreditsOrderStatusResponse)); } - return (PollOutcome.TIMED_OUT, default(CreditsOrderStatusResponse)); + return (PollOutcome.TimedOut, default(CreditsOrderStatusResponse)); } private async UniTask RefreshBalanceAsync(CancellationToken ct) diff --git a/Explorer/Assets/DCL/MarketplaceCredits/Purchase/TopUp/CreditsTopUpTypes.cs b/Explorer/Assets/DCL/MarketplaceCredits/Purchase/TopUp/CreditsTopUpTypes.cs index 7ffd264ceec..2bac90318e1 100644 --- a/Explorer/Assets/DCL/MarketplaceCredits/Purchase/TopUp/CreditsTopUpTypes.cs +++ b/Explorer/Assets/DCL/MarketplaceCredits/Purchase/TopUp/CreditsTopUpTypes.cs @@ -2,12 +2,12 @@ namespace DCL.MarketplaceCredits.Purchase.TopUp { public enum CreditsTopUpStage { - IDLE, - CREATING_CHECKOUT, - WAITING_FOR_PAYMENT, - PENDING_TIMEOUT, - CREDITED, - FAILED, + Idle, + CreatingCheckout, + WaitingForPayment, + PendingTimeout, + Credited, + Failed, } public readonly struct CreditsTopUpStatus @@ -33,24 +33,24 @@ private CreditsTopUpStatus(CreditsTopUpStage stage, CreditPack pack, string? ord } public static CreditsTopUpStatus Idle() => - new (CreditsTopUpStage.IDLE, default(CreditPack)); + new (CreditsTopUpStage.Idle, default(CreditPack)); public static CreditsTopUpStatus CreatingCheckout(CreditPack pack) => - new (CreditsTopUpStage.CREATING_CHECKOUT, pack); + new (CreditsTopUpStage.CreatingCheckout, pack); public static CreditsTopUpStatus WaitingForPayment(CreditPack pack, string orderId) => - new (CreditsTopUpStage.WAITING_FOR_PAYMENT, pack, orderId); + new (CreditsTopUpStage.WaitingForPayment, pack, orderId); public static CreditsTopUpStatus PendingTimeout(CreditPack pack, string orderId) => - new (CreditsTopUpStage.PENDING_TIMEOUT, pack, orderId); + new (CreditsTopUpStage.PendingTimeout, pack, orderId); public static CreditsTopUpStatus Credited(CreditPack pack, string orderId, int creditsGranted, int newBalance) => - new (CreditsTopUpStage.CREDITED, pack, orderId, creditsGranted, newBalance); + new (CreditsTopUpStage.Credited, pack, orderId, creditsGranted, newBalance); public static CreditsTopUpStatus CheckoutFailed(CreditPack pack, CreditsCheckoutError error, string? errorMessage) => - new (CreditsTopUpStage.FAILED, pack, errorMessage: errorMessage, checkoutError: error); + new (CreditsTopUpStage.Failed, pack, errorMessage: errorMessage, checkoutError: error); public static CreditsTopUpStatus GrantFailed(CreditPack pack, string orderId, string? errorMessage) => - new (CreditsTopUpStage.FAILED, pack, orderId, errorMessage: errorMessage); + new (CreditsTopUpStage.Failed, pack, orderId, errorMessage: errorMessage); } } diff --git a/Explorer/Assets/DCL/MarketplaceCredits/Purchase/TopUp/UI/CreditsTopUpModalController.cs b/Explorer/Assets/DCL/MarketplaceCredits/Purchase/TopUp/UI/CreditsTopUpModalController.cs index 8d5793ec799..f59281b3de4 100644 --- a/Explorer/Assets/DCL/MarketplaceCredits/Purchase/TopUp/UI/CreditsTopUpModalController.cs +++ b/Explorer/Assets/DCL/MarketplaceCredits/Purchase/TopUp/UI/CreditsTopUpModalController.cs @@ -12,12 +12,12 @@ public class CreditsTopUpModalController : ControllerBase CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; public event Action? BuyCreditsStarted; public event Action? RedirectedToStripe; @@ -89,9 +89,9 @@ protected override void OnViewClose() viewInstance.RetryButton.onClick.RemoveListener(OnRetryClicked); } - if (currentState == ModalState.WAITING_FOR_BROWSER) + if (currentState == ModalState.WaitingForBrowser) topUpService.StopWaitingForBrowser(); - else if (currentState is ModalState.SUCCESS or ModalState.FAILED or ModalState.PENDING) + else if (currentState is ModalState.Success or ModalState.Failed or ModalState.Pending) topUpService.AcknowledgeTerminalState(); lifeCts.SafeCancelAndDispose(); @@ -128,7 +128,7 @@ private void BindPackItems() private void OnPackClicked(CreditPack pack) { - if (currentState != ModalState.PACK_SELECTION || topUpService.IsOrderInFlight) + if (currentState != ModalState.PackSelection || topUpService.IsOrderInFlight) return; BuyCreditsStarted?.Invoke(pack, inputData.Source); @@ -137,7 +137,7 @@ private void OnPackClicked(CreditPack pack) private void OnRetryClicked() { - if (currentState != ModalState.FAILED) + if (currentState != ModalState.Failed) return; topUpService.AcknowledgeTerminalState(); @@ -149,16 +149,16 @@ private void OnServiceStatusChanged(CreditsTopUpStatus status) { switch (status.Stage) { - case CreditsTopUpStage.WAITING_FOR_PAYMENT: + case CreditsTopUpStage.WaitingForPayment: RedirectedToStripe?.Invoke(status.OrderId!, status.Pack); break; - case CreditsTopUpStage.PENDING_TIMEOUT: + case CreditsTopUpStage.PendingTimeout: BuyCreditsPending?.Invoke(status.Pack); break; - case CreditsTopUpStage.CREDITED: + case CreditsTopUpStage.Credited: BuyCreditsCompleted?.Invoke(status.OrderId!, status.Pack); break; - case CreditsTopUpStage.FAILED: + case CreditsTopUpStage.Failed: BuyCreditsFailed?.Invoke( status.CheckoutError != null ? ANALYTICS_STEP_CHECKOUT : ANALYTICS_STEP_GRANT, MapAnalyticsErrorCode(status), @@ -183,11 +183,11 @@ private void ApplyStatus(in CreditsTopUpStatus status) switch (status.Stage) { - case CreditsTopUpStage.CREDITED: + case CreditsTopUpStage.Credited: viewInstance.ResultText.text = string.Format(SUCCESS_TEXT, status.CreditsGranted, status.NewBalance); viewInstance.BalanceCreditsText.text = string.Format(AVAILABLE_CREDITS_TEXT, status.NewBalance); break; - case CreditsTopUpStage.FAILED: + case CreditsTopUpStage.Failed: (string reason, bool allowRetry) = MapFailureCopy(status); viewInstance.FailedReasonText.text = reason; viewInstance.RetryButton.gameObject.SetActive(allowRetry); @@ -202,24 +202,24 @@ private void SetUiState(ModalState newState) if (viewInstance == null) return; - bool packsVisible = newState is ModalState.PACK_SELECTION or ModalState.CREATING_CHECKOUT; - bool fullScreenState = newState is ModalState.WAITING_FOR_BROWSER or ModalState.SUCCESS; + bool packsVisible = newState is ModalState.PackSelection or ModalState.CreatingCheckout; + bool fullScreenState = newState is ModalState.WaitingForBrowser or ModalState.Success; viewInstance.HeaderContainer.SetActive(!fullScreenState); viewInstance.BalanceContainer.SetActive(!fullScreenState); viewInstance.PackSelectionContainer.SetActive(packsVisible); - viewInstance.WaitingForBrowserContainer.SetActive(newState == ModalState.WAITING_FOR_BROWSER); - viewInstance.SuccessContainer.SetActive(newState == ModalState.SUCCESS); - viewInstance.FailedContainer.SetActive(newState == ModalState.FAILED); - viewInstance.DoneButton.gameObject.SetActive(newState is ModalState.SUCCESS or ModalState.PENDING); + viewInstance.WaitingForBrowserContainer.SetActive(newState == ModalState.WaitingForBrowser); + viewInstance.SuccessContainer.SetActive(newState == ModalState.Success); + viewInstance.FailedContainer.SetActive(newState == ModalState.Failed); + viewInstance.DoneButton.gameObject.SetActive(newState is ModalState.Success or ModalState.Pending); foreach (CreditsTopUpPackItemView packItem in viewInstance.PackItems) - packItem.BuyButton.interactable = newState == ModalState.PACK_SELECTION; + packItem.BuyButton.interactable = newState == ModalState.PackSelection; // Close is locked only while creating the checkout; during the browser wait the X acts as // "stop waiting" and hands the order off to the background poll. - viewInstance.CloseButton.interactable = newState != ModalState.CREATING_CHECKOUT; + viewInstance.CloseButton.interactable = newState != ModalState.CreatingCheckout; } private async UniTask LoadBalanceAsync(CancellationToken ct) @@ -254,12 +254,12 @@ private async UniTask LoadBalanceAsync(CancellationToken ct) private static ModalState MapStage(CreditsTopUpStage stage) => stage switch { - CreditsTopUpStage.CREATING_CHECKOUT => ModalState.CREATING_CHECKOUT, - CreditsTopUpStage.WAITING_FOR_PAYMENT => ModalState.WAITING_FOR_BROWSER, - CreditsTopUpStage.PENDING_TIMEOUT => ModalState.PENDING, - CreditsTopUpStage.CREDITED => ModalState.SUCCESS, - CreditsTopUpStage.FAILED => ModalState.FAILED, - _ => ModalState.PACK_SELECTION, + CreditsTopUpStage.CreatingCheckout => ModalState.CreatingCheckout, + CreditsTopUpStage.WaitingForPayment => ModalState.WaitingForBrowser, + CreditsTopUpStage.PendingTimeout => ModalState.Pending, + CreditsTopUpStage.Credited => ModalState.Success, + CreditsTopUpStage.Failed => ModalState.Failed, + _ => ModalState.PackSelection, }; private static (string reason, bool allowRetry) MapFailureCopy(in CreditsTopUpStatus status) diff --git a/Explorer/Assets/DCL/MarketplaceCredits/Purchase/UI/CreditPurchaseModalController.cs b/Explorer/Assets/DCL/MarketplaceCredits/Purchase/UI/CreditPurchaseModalController.cs index 5618187b96d..1bb5730a939 100644 --- a/Explorer/Assets/DCL/MarketplaceCredits/Purchase/UI/CreditPurchaseModalController.cs +++ b/Explorer/Assets/DCL/MarketplaceCredits/Purchase/UI/CreditPurchaseModalController.cs @@ -14,12 +14,12 @@ public class CreditPurchaseModalController : ControllerBase CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; public CreditPurchaseModalController( ViewFactoryMethod viewFactory, @@ -120,7 +120,7 @@ await UniTask.WhenAny( private async UniTask LoadBalanceAndArmAsync(CancellationToken ct) { - SetUiState(ModalState.LOADING_BALANCE); + SetUiState(ModalState.LoadingBalance); IWeb3Identity? identity = identityCache.Identity; @@ -140,7 +140,7 @@ private async UniTask LoadBalanceAndArmAsync(CancellationToken ct) if (viewInstance != null) viewInstance.BalanceCreditsText.text = credits.usd.credits.ToString(); - SetUiState(CanAfford(inputData.Listing, credits) ? ModalState.READY_TO_CONFIRM : ModalState.INSUFFICIENT_CREDITS); + SetUiState(CanAfford(inputData.Listing, credits) ? ModalState.ReadyToConfirm : ModalState.InsufficientCredits); } catch (OperationCanceledException) { } catch (Exception e) @@ -152,7 +152,7 @@ private async UniTask LoadBalanceAndArmAsync(CancellationToken ct) private void OnConfirmClicked() { - if (currentState != ModalState.READY_TO_CONFIRM || lifeCts == null || lifeCts.IsCancellationRequested) + if (currentState != ModalState.ReadyToConfirm || lifeCts == null || lifeCts.IsCancellationRequested) return; PurchaseAsync(lifeCts.Token).Forget(); @@ -160,7 +160,7 @@ private void OnConfirmClicked() private void OnRetryClicked() { - if (currentState != ModalState.FAILED || settlementPending || lifeCts == null || lifeCts.IsCancellationRequested) + if (currentState != ModalState.Failed || settlementPending || lifeCts == null || lifeCts.IsCancellationRequested) return; LoadBalanceAndArmAsync(lifeCts.Token).Forget(); @@ -180,7 +180,7 @@ private void OnOpenMarketplaceClicked() private async UniTask PurchaseAsync(CancellationToken ct) { - SetUiState(ModalState.PURCHASING); + SetUiState(ModalState.Purchasing); NativeWindowManager.RequestTemporaryWindowMode(); try @@ -189,7 +189,7 @@ private async UniTask PurchaseAsync(CancellationToken ct) if (result.Success) { - SetUiState(ModalState.SUCCESS); + SetUiState(ModalState.Success); RefreshBalanceAsync(lifeCts?.Token ?? CancellationToken.None).Forget(); } else @@ -210,32 +210,32 @@ private void ShowPurchaseError(in CreditsPurchaseResult result) { switch (result.Error) { - case CreditsPurchaseError.CANCELLED: - SetUiState(ModalState.READY_TO_CONFIRM); + case CreditsPurchaseError.Cancelled: + SetUiState(ModalState.ReadyToConfirm); break; - case CreditsPurchaseError.INSUFFICIENT_CREDITS: - SetUiState(ModalState.INSUFFICIENT_CREDITS); + case CreditsPurchaseError.InsufficientCredits: + SetUiState(ModalState.InsufficientCredits); break; - case CreditsPurchaseError.SETTLEMENT_PENDING: + case CreditsPurchaseError.SettlementPending: settlementPending = true; ShowFailure("Your purchase is still processing. Your credits are reserved and the purchase will complete automatically — check back soon.", allowRetry: false); break; - case CreditsPurchaseError.SIGNATURE_REJECTED: + case CreditsPurchaseError.SignatureRejected: ShowFailure("The signature request was rejected.", allowRetry: true); break; - case CreditsPurchaseError.PRICE_CHANGED: + case CreditsPurchaseError.PriceChanged: ShowFailure("The price of this item changed. Please reopen the item to see the new price.", allowRetry: false); break; - case CreditsPurchaseError.LISTING_NOT_AVAILABLE: + case CreditsPurchaseError.ListingNotAvailable: ShowFailure("This item is no longer available for purchase with credits.", allowRetry: false); break; - case CreditsPurchaseError.OWN_LISTING: + case CreditsPurchaseError.OwnListing: ShowFailure("You cannot buy your own listing.", allowRetry: false); break; - case CreditsPurchaseError.TRANSACTION_REVERTED: + case CreditsPurchaseError.TransactionReverted: ShowFailure("The purchase failed on-chain. Your credits were not spent.", allowRetry: true); break; - case CreditsPurchaseError.RELAYER_UNAVAILABLE: + case CreditsPurchaseError.RelayerUnavailable: ShowFailure("The purchase service is temporarily unavailable. Please try again later.", allowRetry: true); break; default: @@ -246,16 +246,16 @@ private void ShowPurchaseError(in CreditsPurchaseResult result) private void OnPurchaseStateChanged(CreditsPurchaseState state) { - if (viewInstance == null || currentState != ModalState.PURCHASING) + if (viewInstance == null || currentState != ModalState.Purchasing) return; viewInstance.ProgressStatusText.text = state switch { - CreditsPurchaseState.RESOLVING_LISTING => "Checking availability...", - CreditsPurchaseState.AUTHORIZING => "Reserving your credits...", - CreditsPurchaseState.SIGNING => "Waiting for your signature...", - CreditsPurchaseState.SUBMITTING => "Submitting the purchase...", - CreditsPurchaseState.WAITING_SETTLEMENT => "Completing the purchase...", + CreditsPurchaseState.ResolvingListing => "Checking availability...", + CreditsPurchaseState.Authorizing => "Reserving your credits...", + CreditsPurchaseState.Signing => "Waiting for your signature...", + CreditsPurchaseState.Submitting => "Submitting the purchase...", + CreditsPurchaseState.WaitingSettlement => "Completing the purchase...", _ => viewInstance.ProgressStatusText.text, }; } @@ -293,7 +293,7 @@ private async UniTask OpenGetCreditsAfterCloseAsync(CancellationToken ct) private void ShowFailure(string reason, bool allowRetry) { - SetUiState(ModalState.FAILED); + SetUiState(ModalState.Failed); if (viewInstance == null) return; @@ -309,16 +309,16 @@ private void SetUiState(ModalState newState) if (viewInstance == null) return; - bool purchasing = newState == ModalState.PURCHASING; + bool purchasing = newState == ModalState.Purchasing; - viewInstance.ConfirmStateContainer.SetActive(newState is ModalState.LOADING_BALANCE or ModalState.READY_TO_CONFIRM or ModalState.INSUFFICIENT_CREDITS); + viewInstance.ConfirmStateContainer.SetActive(newState is ModalState.LoadingBalance or ModalState.ReadyToConfirm or ModalState.InsufficientCredits); viewInstance.ProgressStateContainer.SetActive(purchasing); - viewInstance.SuccessStateContainer.SetActive(newState == ModalState.SUCCESS); - viewInstance.FailedStateContainer.SetActive(newState == ModalState.FAILED); - viewInstance.InsufficientCreditsContainer.SetActive(newState == ModalState.INSUFFICIENT_CREDITS); - viewInstance.BalanceLoadingSpinner.SetActive(newState == ModalState.LOADING_BALANCE); + viewInstance.SuccessStateContainer.SetActive(newState == ModalState.Success); + viewInstance.FailedStateContainer.SetActive(newState == ModalState.Failed); + viewInstance.InsufficientCreditsContainer.SetActive(newState == ModalState.InsufficientCredits); + viewInstance.BalanceLoadingSpinner.SetActive(newState == ModalState.LoadingBalance); - viewInstance.ConfirmButton.interactable = newState == ModalState.READY_TO_CONFIRM; + viewInstance.ConfirmButton.interactable = newState == ModalState.ReadyToConfirm; viewInstance.CloseButton.interactable = !purchasing; viewInstance.CancelButton.interactable = !purchasing; } diff --git a/Explorer/Assets/DCL/MarketplaceCredits/Sections/MarketplaceCreditsVerifyEmailSubController.cs b/Explorer/Assets/DCL/MarketplaceCredits/Sections/MarketplaceCreditsVerifyEmailSubController.cs index ddb7aa62be3..352d03ebc73 100644 --- a/Explorer/Assets/DCL/MarketplaceCredits/Sections/MarketplaceCreditsVerifyEmailSubController.cs +++ b/Explorer/Assets/DCL/MarketplaceCredits/Sections/MarketplaceCreditsVerifyEmailSubController.cs @@ -84,7 +84,7 @@ private async UniTaskVoid CheckEmailVerificationAsync(CancellationToken ct) continue; await marketplaceCreditsAPIClient.MarkUserAsStartedProgramAsync(ct); - marketplaceCreditsMenuController.OpenSection(MarketplaceCreditsSection.WELCOME); + marketplaceCreditsMenuController.OpenSection(MarketplaceCreditsSection.Welcome); break; } } @@ -115,7 +115,7 @@ private async UniTaskVoid UpdateEmailAsync(CancellationToken ct) { // Removes email subscription await marketplaceCreditsAPIClient.SubscribeEmailAsync(string.Empty, ct); - marketplaceCreditsMenuController.OpenSection(MarketplaceCreditsSection.WELCOME); + marketplaceCreditsMenuController.OpenSection(MarketplaceCreditsSection.Welcome); } } catch (OperationCanceledException) { } diff --git a/Explorer/Assets/DCL/MarketplaceCredits/Sections/MarketplaceCreditsWelcomeSubController.cs b/Explorer/Assets/DCL/MarketplaceCredits/Sections/MarketplaceCreditsWelcomeSubController.cs index 40a5d3039fa..daaf7baa2b2 100644 --- a/Explorer/Assets/DCL/MarketplaceCredits/Sections/MarketplaceCreditsWelcomeSubController.cs +++ b/Explorer/Assets/DCL/MarketplaceCredits/Sections/MarketplaceCreditsWelcomeSubController.cs @@ -201,7 +201,7 @@ private void RedirectToSection(bool ignoreHasUserStartedProgramFlag = false) if (currentCreditsProgramProgress.IsProgramEnded()) { marketplaceCreditsProgramEndedSubController.Setup(currentCreditsProgramProgress); - marketplaceCreditsMenuController.OpenSection(MarketplaceCreditsSection.PROGRAM_ENDED); + marketplaceCreditsMenuController.OpenSection(MarketplaceCreditsSection.ProgramEnded); totalCreditsWidgetView.gameObject.SetActive( currentCreditsProgramProgress.currentSeason.state != nameof(MarketplaceCreditsUtils.SeasonState.ERR_PROGRAM_PAUSED)); return; @@ -225,7 +225,7 @@ private void RedirectToSection(bool ignoreHasUserStartedProgramFlag = false) if (!currentCreditsProgramProgress.IsUserEmailVerified()) { marketplaceCreditsVerifyEmailSubController.Setup(currentCreditsProgramProgress.user.email); - marketplaceCreditsMenuController.OpenSection(MarketplaceCreditsSection.VERIFY_EMAIL); + marketplaceCreditsMenuController.OpenSection(MarketplaceCreditsSection.VerifyEmail); return; } @@ -233,12 +233,12 @@ private void RedirectToSection(bool ignoreHasUserStartedProgramFlag = false) if (currentCreditsProgramProgress.AreWeekGoalsCompleted()) { marketplaceCreditsWeekGoalsCompletedSubController.Setup(currentCreditsProgramProgress); - marketplaceCreditsMenuController.OpenSection(MarketplaceCreditsSection.WEEK_GOALS_COMPLETED); + marketplaceCreditsMenuController.OpenSection(MarketplaceCreditsSection.WeekGoalsCompleted); } else { marketplaceCreditsGoalsOfTheWeekSubController.Setup(currentCreditsProgramProgress); - marketplaceCreditsMenuController.OpenSection(MarketplaceCreditsSection.GOALS_OF_THE_WEEK); + marketplaceCreditsMenuController.OpenSection(MarketplaceCreditsSection.GoalsOfTheWeek); } } diff --git a/Explorer/Assets/DCL/Minimap/MinimapController.cs b/Explorer/Assets/DCL/Minimap/MinimapController.cs index 0a0623a24d4..c1259615e02 100644 --- a/Explorer/Assets/DCL/Minimap/MinimapController.cs +++ b/Explorer/Assets/DCL/Minimap/MinimapController.cs @@ -92,7 +92,7 @@ public partial class MinimapController : ControllerBase, IMapActivi public IReadOnlyDictionary LayersParameters { get; } = new Dictionary { { MapLayer.PlayerMarker, new PlayerMarkerParameter { BackgroundIsActive = false } } }; - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.PERSISTENT; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Persistent; public MinimapController( MinimapView minimapView, @@ -603,7 +603,7 @@ private UnityAction GetContextualButtonAction(bool isGenesisModeActivated) private void ReloadScene() => chatMessagesBus.SendWithUtcNowTimestamp( - ChatChannel.NEARBY_CHANNEL, $"/{reloadSceneCommand.Command}", ChatMessageOrigin.MINIMAP + ChatChannel.NEARBY_CHANNEL, $"/{reloadSceneCommand.Command}", ChatMessageOrigin.Minimap ); private void SetAnimatorController(bool isGenesisModeActivated) diff --git a/Explorer/Assets/DCL/Minimap/SceneRestrictionsController.cs b/Explorer/Assets/DCL/Minimap/SceneRestrictionsController.cs index d72cba07444..896c50d9210 100644 --- a/Explorer/Assets/DCL/Minimap/SceneRestrictionsController.cs +++ b/Explorer/Assets/DCL/Minimap/SceneRestrictionsController.cs @@ -19,13 +19,13 @@ public class SceneRestrictionsController : IDisposable private readonly Dictionary restrictionsGameObjects = new(); private readonly Dictionary restrictionsTexts = new() { - { SceneRestrictions.CAMERA_LOCKED, "• Camera locked" }, - { SceneRestrictions.AVATAR_HIDDEN, "• Avatars hidden" }, - { SceneRestrictions.AVATAR_MOVEMENTS_BLOCKED, "• Avatar movement disabled" }, - { SceneRestrictions.PASSPORT_CANNOT_BE_OPENED, "• User Options Menu disabled" }, - { SceneRestrictions.EXPERIENCES_BLOCKED, "• Experiences disabled" }, - { SceneRestrictions.SKYBOX_TIME_UI_BLOCKED, "• Day/Night controller disabled"}, - { SceneRestrictions.NEARBY_VOICE_CHAT_BLOCKED, "• Nearby voice disabled" }, + { SceneRestrictions.CameraLocked, "• Camera locked" }, + { SceneRestrictions.AvatarHidden, "• Avatars hidden" }, + { SceneRestrictions.AvatarMovementsBlocked, "• Avatar movement disabled" }, + { SceneRestrictions.PassportCannotBeOpened, "• User Options Menu disabled" }, + { SceneRestrictions.ExperiencesBlocked, "• Experiences disabled" }, + { SceneRestrictions.SkyboxTimeUiBlocked, "• Day/Night controller disabled"}, + { SceneRestrictions.NearbyVoiceChatBlocked, "• Nearby voice disabled" }, }; public SceneRestrictionsController(ISceneRestrictionsView restrictionsView, ISceneRestrictionBusController sceneRestrictionBusController) @@ -72,7 +72,7 @@ private void ManageSceneRestrictions(SceneRestriction sceneRestriction) { int currentRestrictionCounter = restrictionsRegistry[sceneRestriction.Type]; - currentRestrictionCounter += sceneRestriction.Action == SceneRestrictionsAction.APPLIED ? 1 : -1; + currentRestrictionCounter += sceneRestriction.Action == SceneRestrictionsAction.Applied ? 1 : -1; currentRestrictionCounter = Mathf.Clamp(currentRestrictionCounter, 0, int.MaxValue); restrictionsRegistry[sceneRestriction.Type] = currentRestrictionCounter; diff --git a/Explorer/Assets/DCL/Minimap/Tests/SceneRestrictionControllerShould.cs b/Explorer/Assets/DCL/Minimap/Tests/SceneRestrictionControllerShould.cs index 97972ebd8c7..03279e3786c 100644 --- a/Explorer/Assets/DCL/Minimap/Tests/SceneRestrictionControllerShould.cs +++ b/Explorer/Assets/DCL/Minimap/Tests/SceneRestrictionControllerShould.cs @@ -57,69 +57,69 @@ public void ShowAllRestrictions() //Act - sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateAvatarHidden(SceneRestrictionsAction.APPLIED)); + sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateAvatarHidden(SceneRestrictionsAction.Applied)); //Assert Assert.IsTrue(sceneRestrictionsIcon.gameObject.activeSelf); - Assert.IsTrue(restrictionTexts[SceneRestrictions.AVATAR_HIDDEN].gameObject.activeSelf); + Assert.IsTrue(restrictionTexts[SceneRestrictions.AvatarHidden].gameObject.activeSelf); //Act - sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateAvatarHidden(SceneRestrictionsAction.REMOVED)); + sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateAvatarHidden(SceneRestrictionsAction.Removed)); //Assert Assert.IsFalse(sceneRestrictionsIcon.gameObject.activeSelf); - Assert.IsFalse(restrictionTexts[SceneRestrictions.AVATAR_HIDDEN].gameObject.activeSelf); + Assert.IsFalse(restrictionTexts[SceneRestrictions.AvatarHidden].gameObject.activeSelf); //Act - sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateAvatarHidden(SceneRestrictionsAction.APPLIED)); - sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateCameraLocked(SceneRestrictionsAction.APPLIED)); + sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateAvatarHidden(SceneRestrictionsAction.Applied)); + sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateCameraLocked(SceneRestrictionsAction.Applied)); //Assert Assert.IsTrue(sceneRestrictionsIcon.gameObject.activeSelf); - Assert.IsTrue(restrictionTexts[SceneRestrictions.AVATAR_HIDDEN].gameObject.activeSelf); - Assert.IsTrue(restrictionTexts[SceneRestrictions.CAMERA_LOCKED].gameObject.activeSelf); + Assert.IsTrue(restrictionTexts[SceneRestrictions.AvatarHidden].gameObject.activeSelf); + Assert.IsTrue(restrictionTexts[SceneRestrictions.CameraLocked].gameObject.activeSelf); //Act - sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateAvatarHidden(SceneRestrictionsAction.REMOVED)); - sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateCameraLocked(SceneRestrictionsAction.REMOVED)); + sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateAvatarHidden(SceneRestrictionsAction.Removed)); + sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateCameraLocked(SceneRestrictionsAction.Removed)); //Assert Assert.IsFalse(sceneRestrictionsIcon.gameObject.activeSelf); - Assert.IsFalse(restrictionTexts[SceneRestrictions.AVATAR_HIDDEN].gameObject.activeSelf); - Assert.IsFalse(restrictionTexts[SceneRestrictions.CAMERA_LOCKED].gameObject.activeSelf); + Assert.IsFalse(restrictionTexts[SceneRestrictions.AvatarHidden].gameObject.activeSelf); + Assert.IsFalse(restrictionTexts[SceneRestrictions.CameraLocked].gameObject.activeSelf); //Act - sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateAvatarHidden(SceneRestrictionsAction.APPLIED)); - sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateCameraLocked(SceneRestrictionsAction.APPLIED)); - sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateCameraLocked(SceneRestrictionsAction.APPLIED)); + sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateAvatarHidden(SceneRestrictionsAction.Applied)); + sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateCameraLocked(SceneRestrictionsAction.Applied)); + sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateCameraLocked(SceneRestrictionsAction.Applied)); //Assert Assert.IsTrue(sceneRestrictionsIcon.gameObject.activeSelf); - Assert.IsTrue(restrictionTexts[SceneRestrictions.AVATAR_HIDDEN].gameObject.activeSelf); - Assert.IsTrue(restrictionTexts[SceneRestrictions.CAMERA_LOCKED].gameObject.activeSelf); + Assert.IsTrue(restrictionTexts[SceneRestrictions.AvatarHidden].gameObject.activeSelf); + Assert.IsTrue(restrictionTexts[SceneRestrictions.CameraLocked].gameObject.activeSelf); //Act - sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateCameraLocked(SceneRestrictionsAction.REMOVED)); + sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateCameraLocked(SceneRestrictionsAction.Removed)); //Assert Assert.IsTrue(sceneRestrictionsIcon.gameObject.activeSelf); - Assert.IsTrue(restrictionTexts[SceneRestrictions.AVATAR_HIDDEN].gameObject.activeSelf); - Assert.IsTrue(restrictionTexts[SceneRestrictions.CAMERA_LOCKED].gameObject.activeSelf); + Assert.IsTrue(restrictionTexts[SceneRestrictions.AvatarHidden].gameObject.activeSelf); + Assert.IsTrue(restrictionTexts[SceneRestrictions.CameraLocked].gameObject.activeSelf); //Act - sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateCameraLocked(SceneRestrictionsAction.REMOVED)); + sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateCameraLocked(SceneRestrictionsAction.Removed)); //Assert Assert.IsTrue(sceneRestrictionsIcon.gameObject.activeSelf); - Assert.IsTrue(restrictionTexts[SceneRestrictions.AVATAR_HIDDEN].gameObject.activeSelf); - Assert.IsFalse(restrictionTexts[SceneRestrictions.CAMERA_LOCKED].gameObject.activeSelf); + Assert.IsTrue(restrictionTexts[SceneRestrictions.AvatarHidden].gameObject.activeSelf); + Assert.IsFalse(restrictionTexts[SceneRestrictions.CameraLocked].gameObject.activeSelf); //Act - sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateAvatarHidden(SceneRestrictionsAction.REMOVED)); + sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateAvatarHidden(SceneRestrictionsAction.Removed)); //Assert Assert.IsFalse(sceneRestrictionsIcon.gameObject.activeSelf); - Assert.IsFalse(restrictionTexts[SceneRestrictions.AVATAR_HIDDEN].gameObject.activeSelf); + Assert.IsFalse(restrictionTexts[SceneRestrictions.AvatarHidden].gameObject.activeSelf); } } } diff --git a/Explorer/Assets/DCL/Multiplayer/Connections/Archipelago/Rooms/VoiceChatActivatableConnectiveRoom.cs b/Explorer/Assets/DCL/Multiplayer/Connections/Archipelago/Rooms/VoiceChatActivatableConnectiveRoom.cs index 28cba03bc87..3f978cf5fad 100644 --- a/Explorer/Assets/DCL/Multiplayer/Connections/Archipelago/Rooms/VoiceChatActivatableConnectiveRoom.cs +++ b/Explorer/Assets/DCL/Multiplayer/Connections/Archipelago/Rooms/VoiceChatActivatableConnectiveRoom.cs @@ -33,7 +33,7 @@ public class VoiceChatActivatableConnectiveRoom : IActivatableConnectiveRoom private static readonly TimeSpan CONNECTION_LOOP_RECOVER_INTERVAL = TimeSpan.FromSeconds(5); private readonly InteriorRoom room = new (); private readonly Atomic connectionLoopHealth = new (IConnectiveRoom.ConnectionLoopHealth.Stopped); - private readonly Atomic attemptToConnectState = new (AttemptToConnectState.NONE); + private readonly Atomic attemptToConnectState = new (AttemptToConnectState.None); private readonly Atomic roomState = new (IConnectiveRoom.State.Stopped); private CancellationTokenSource? cts; private string connectionString = string.Empty; @@ -84,7 +84,7 @@ public async UniTask StartAsync() throw new WarningException("Room is already running"); cts = cts.SafeRestart(); - attemptToConnectState.Set(AttemptToConnectState.NONE); + attemptToConnectState.Set(AttemptToConnectState.None); if (connectionString == string.Empty) { @@ -98,15 +98,15 @@ public async UniTask StartAsync() roomState.Set(IConnectiveRoom.State.Starting); RunAsync(cts.Token).Forget(); - await UniTask.WaitWhile(() => attemptToConnectState.Value() is AttemptToConnectState.NONE); + await UniTask.WaitWhile(() => attemptToConnectState.Value() is AttemptToConnectState.None); - if (attemptToConnectState.Value() is AttemptToConnectState.ERROR) + if (attemptToConnectState.Value() is AttemptToConnectState.Error) { // A failed attempt (e.g. revoked token → 401) is terminal; cancel the loop so it stops re-attempting the same credentials forever. cts.SafeCancelAndDispose(); cts = null; roomState.Set(IConnectiveRoom.State.Stopped); - attemptToConnectState.Set(AttemptToConnectState.NONE); + attemptToConnectState.Set(AttemptToConnectState.None); return false; } @@ -180,7 +180,7 @@ private async UniTask TryConnectToRoomAsync(CancellationToken ct) Result connectResult = await freshRoom.ConnectAsync(credentials.Url, credentials.AuthToken, ct, true); - AttemptToConnectState connectionState = connectResult.Success ? AttemptToConnectState.SUCCESS : AttemptToConnectState.ERROR; + AttemptToConnectState connectionState = connectResult.Success ? AttemptToConnectState.Success : AttemptToConnectState.Error; attemptToConnectState.Set(connectionState); if (connectResult.Success) diff --git a/Explorer/Assets/DCL/Multiplayer/Connections/GateKeeper/Rooms/GateKeeperSceneRoom.cs b/Explorer/Assets/DCL/Multiplayer/Connections/GateKeeper/Rooms/GateKeeperSceneRoom.cs index 219da07bcf3..f4d9e0840f8 100644 --- a/Explorer/Assets/DCL/Multiplayer/Connections/GateKeeper/Rooms/GateKeeperSceneRoom.cs +++ b/Explorer/Assets/DCL/Multiplayer/Connections/GateKeeper/Rooms/GateKeeperSceneRoom.cs @@ -43,7 +43,7 @@ public override void Dispose() public bool IsSceneRoomSettled(string sceneId) { // States in which the room will never connect must not hold callers waiting - if (!Activated || origin.options.IsCommsOffline || AttemptToConnectState is AttemptToConnectState.FORBIDDEN_ACCESS) + if (!Activated || origin.options.IsCommsOffline || AttemptToConnectState is AttemptToConnectState.ForbiddenAccess) return true; return IsSceneConnected(sceneId); @@ -116,7 +116,7 @@ protected override void OnForbiddenAccess() } protected override RoomSelection SelectValidRoom() => - options.SceneRoomMetaDataSource.GetMetadataInput().Equals(currentMetaData.GetValueOrDefault()) ? RoomSelection.PREVIOUS : RoomSelection.NEW; + options.SceneRoomMetaDataSource.GetMetadataInput().Equals(currentMetaData.GetValueOrDefault()) ? RoomSelection.Previous : RoomSelection.New; protected override UniTask PrewarmAsync(CancellationToken token) => UniTask.CompletedTask; @@ -125,7 +125,7 @@ protected override async UniTask CycleStepAsync(CancellationToken token) { if (options.IsCommsOffline) { - if (AttemptToConnectState is not AttemptToConnectState.NO_CONNECTION_REQUIRED) + if (AttemptToConnectState is not AttemptToConnectState.NoConnectionRequired) SetNoConnectionRequired(); return; } @@ -179,7 +179,7 @@ async UniTask WaitForMetadataInputChangedAsync(MetaData.Input usedInput, Cancell CurrentSceneRoomConnected?.Invoke(); - if (roomSelection == RoomSelection.NEW) + if (roomSelection == RoomSelection.New) currentMetaData = meta; } diff --git a/Explorer/Assets/DCL/Multiplayer/Connections/Messaging/Hubs/MessagePipesHub.cs b/Explorer/Assets/DCL/Multiplayer/Connections/Messaging/Hubs/MessagePipesHub.cs index c4e59d84638..097bff7da37 100644 --- a/Explorer/Assets/DCL/Multiplayer/Connections/Messaging/Hubs/MessagePipesHub.cs +++ b/Explorer/Assets/DCL/Multiplayer/Connections/Messaging/Hubs/MessagePipesHub.cs @@ -22,11 +22,11 @@ public MessagePipesHub( ThroughputBufferBunch sceneBufferBunch, ThroughputBufferBunch chatBufferBunch ) : this( - new MessagePipe(roomHub.SceneRoom().Room().DataPipe.WithThroughputMeasure(sceneBufferBunch), multiPool, memoryPool, RoomSource.GATEKEEPER) + new MessagePipe(roomHub.SceneRoom().Room().DataPipe.WithThroughputMeasure(sceneBufferBunch), multiPool, memoryPool, RoomSource.Gatekeeper) .WithLog("Scene"), - new MessagePipe(roomHub.IslandRoom().DataPipe.WithThroughputMeasure(islandBufferBunch), multiPool, memoryPool, RoomSource.ISLAND) + new MessagePipe(roomHub.IslandRoom().DataPipe.WithThroughputMeasure(islandBufferBunch), multiPool, memoryPool, RoomSource.Island) .WithLog("Island"), - new MessagePipe(roomHub.ChatRoom().DataPipe.WithThroughputMeasure(chatBufferBunch), multiPool, memoryPool, RoomSource.CHAT) + new MessagePipe(roomHub.ChatRoom().DataPipe.WithThroughputMeasure(chatBufferBunch), multiPool, memoryPool, RoomSource.Chat) .WithLog("Chat") ) { } diff --git a/Explorer/Assets/DCL/Multiplayer/Connections/Messaging/Pipe/IMessagePipe.cs b/Explorer/Assets/DCL/Multiplayer/Connections/Messaging/Pipe/IMessagePipe.cs index 2d0bea26b07..1d56f803973 100644 --- a/Explorer/Assets/DCL/Multiplayer/Connections/Messaging/Pipe/IMessagePipe.cs +++ b/Explorer/Assets/DCL/Multiplayer/Connections/Messaging/Pipe/IMessagePipe.cs @@ -12,16 +12,16 @@ enum ThreadStrict /// /// Requires to receive the events on main thread. /// - MAIN_THREAD_ONLY, + MainThreadOnly, /// /// States to receive the events on any thread that the original message comes from. /// - ORIGIN_THREAD + OriginThread } MessageWrap NewMessage(string topic = "") where T: class, IMessage, new(); - void Subscribe(Packet.MessageOneofCase ofCase, Action> onMessageReceived, ThreadStrict threadStrict = ThreadStrict.MAIN_THREAD_ONLY) where T: class, IMessage, new(); + void Subscribe(Packet.MessageOneofCase ofCase, Action> onMessageReceived, ThreadStrict threadStrict = ThreadStrict.MainThreadOnly) where T: class, IMessage, new(); class Null : IMessagePipe { diff --git a/Explorer/Assets/DCL/Multiplayer/Connections/Messaging/Pipe/MessagePipe.cs b/Explorer/Assets/DCL/Multiplayer/Connections/Messaging/Pipe/MessagePipe.cs index 6dfffc7e914..d118e39dc7c 100644 --- a/Explorer/Assets/DCL/Multiplayer/Connections/Messaging/Pipe/MessagePipe.cs +++ b/Explorer/Assets/DCL/Multiplayer/Connections/Messaging/Pipe/MessagePipe.cs @@ -106,7 +106,7 @@ private async UniTaskVoid NotifySubscribersAsync(Packet.MessageOneofCase name, P var r = receiver.Value; - if (r.strict is IMessagePipe.ThreadStrict.MAIN_THREAD_ONLY) + if (r.strict is IMessagePipe.ThreadStrict.MainThreadOnly) await UniTask.SwitchToMainThread(); foreach (Action<(Packet, LKParticipant, string)>? action in r.list) diff --git a/Explorer/Assets/DCL/Multiplayer/Connections/Pulse/ENet/ENetTransport.cs b/Explorer/Assets/DCL/Multiplayer/Connections/Pulse/ENet/ENetTransport.cs index 755dc91b801..22fa6ef22f9 100644 --- a/Explorer/Assets/DCL/Multiplayer/Connections/Pulse/ENet/ENetTransport.cs +++ b/Explorer/Assets/DCL/Multiplayer/Connections/Pulse/ENet/ENetTransport.cs @@ -38,29 +38,29 @@ public ITransport.TransportState State { get { - if (serverPeer == null) return ITransport.TransportState.NONE; + if (serverPeer == null) return ITransport.TransportState.None; switch (serverPeer.Value.State) { case PeerState.AcknowledgingConnect: case PeerState.Connecting: case PeerState.ConnectionPending: - return ITransport.TransportState.CONNECTING; + return ITransport.TransportState.Connecting; case PeerState.ConnectionSucceeded: case PeerState.Connected: - return ITransport.TransportState.CONNECTED; + return ITransport.TransportState.Connected; case PeerState.Disconnected: - return ITransport.TransportState.DISCONNECTED; + return ITransport.TransportState.Disconnected; case PeerState.AcknowledgingDisconnect: case PeerState.DisconnectLater: case PeerState.Disconnecting: - return ITransport.TransportState.DISCONNECTING; + return ITransport.TransportState.Disconnecting; default: - return ITransport.TransportState.NONE; + return ITransport.TransportState.None; } } } @@ -113,7 +113,7 @@ public async UniTask ConnectAsync(string ip, int port, CancellationToken ct) try { - await UniTask.WaitUntil(() => State == ITransport.TransportState.CONNECTED, cancellationToken: ct) + await UniTask.WaitUntil(() => State == ITransport.TransportState.Connected, cancellationToken: ct) .Timeout(TimeSpan.FromMilliseconds(options.ConnectTimeoutMs)); } catch (TimeoutException) diff --git a/Explorer/Assets/DCL/Multiplayer/Connections/Pulse/ITransport.cs b/Explorer/Assets/DCL/Multiplayer/Connections/Pulse/ITransport.cs index a1ca8cbec0c..59e57750473 100644 --- a/Explorer/Assets/DCL/Multiplayer/Connections/Pulse/ITransport.cs +++ b/Explorer/Assets/DCL/Multiplayer/Connections/Pulse/ITransport.cs @@ -26,11 +26,11 @@ public interface ITransport : IDisposable public enum TransportState { - NONE, - CONNECTING, - CONNECTED, - DISCONNECTING, - DISCONNECTED, + None, + Connecting, + Connected, + Disconnecting, + Disconnected, } } } diff --git a/Explorer/Assets/DCL/Multiplayer/Connections/Pulse/PeerIdCache.cs b/Explorer/Assets/DCL/Multiplayer/Connections/Pulse/PeerIdCache.cs index 7566e28d905..d249f637c7f 100644 --- a/Explorer/Assets/DCL/Multiplayer/Connections/Pulse/PeerIdCache.cs +++ b/Explorer/Assets/DCL/Multiplayer/Connections/Pulse/PeerIdCache.cs @@ -8,9 +8,9 @@ public class PeerIdCache { public enum LookupResult : byte { - FOUND, - UNKNOWN_PEER, - REALM_MISMATCH, + Found, + UnknownPeer, + RealmMismatch, } private readonly object sync = new (); @@ -73,17 +73,17 @@ public LookupResult GetWalletInRealm(uint peerId, string realm, out Web3Address if (!peersByWallet.TryGetValue(peerId, out (Web3Address wallet, string realm) entry)) { wallet = default(Web3Address); - return LookupResult.UNKNOWN_PEER; + return LookupResult.UnknownPeer; } if (entry.realm != realm) { wallet = default(Web3Address); - return LookupResult.REALM_MISMATCH; + return LookupResult.RealmMismatch; } wallet = entry.wallet; - return LookupResult.FOUND; + return LookupResult.Found; } } diff --git a/Explorer/Assets/DCL/Multiplayer/Connections/Pulse/PulseMultiplayerService.cs b/Explorer/Assets/DCL/Multiplayer/Connections/Pulse/PulseMultiplayerService.cs index d0007cdab48..20f43551db8 100644 --- a/Explorer/Assets/DCL/Multiplayer/Connections/Pulse/PulseMultiplayerService.cs +++ b/Explorer/Assets/DCL/Multiplayer/Connections/Pulse/PulseMultiplayerService.cs @@ -79,7 +79,7 @@ public void UnregisterAllHandlers() public async UniTask ConnectAsync(CancellationToken ct, int maxAttempts = int.MaxValue) { - if (transport.State is ITransport.TransportState.CONNECTED or ITransport.TransportState.CONNECTING) + if (transport.State is ITransport.TransportState.Connected or ITransport.TransportState.Connecting) return true; return await ConnectWithRetriesAsync(ct, maxAttempts); @@ -104,7 +104,7 @@ private void ResetConnectionLifecycle() public void Send(OutgoingMessage outgoingMessage) { - if (transport.State != ITransport.TransportState.CONNECTED) + if (transport.State != ITransport.TransportState.Connected) { outgoingMessage.Dispose(); return; diff --git a/Explorer/Assets/DCL/Multiplayer/Connections/Pulse/Tests/PulseMultiplayerServiceShould.cs b/Explorer/Assets/DCL/Multiplayer/Connections/Pulse/Tests/PulseMultiplayerServiceShould.cs index a7ec9364a81..62b82127e7e 100644 --- a/Explorer/Assets/DCL/Multiplayer/Connections/Pulse/Tests/PulseMultiplayerServiceShould.cs +++ b/Explorer/Assets/DCL/Multiplayer/Connections/Pulse/Tests/PulseMultiplayerServiceShould.cs @@ -22,7 +22,7 @@ public class PulseMultiplayerServiceShould public void SetUp() { transport = Substitute.For(); - transport.State.Returns(ITransport.TransportState.NONE); + transport.State.Returns(ITransport.TransportState.None); urlsSource = Substitute.For(); @@ -59,7 +59,7 @@ public void ReturnFalseWhenUnreachableWithinMaxAttempts() public void NotAttemptConnectionWhenAlreadyConnected() { // Arrange - transport.State.Returns(ITransport.TransportState.CONNECTED); + transport.State.Returns(ITransport.TransportState.Connected); // Act bool connected = service.ConnectAsync(cts.Token, maxAttempts: 1).GetAwaiter().GetResult(); diff --git a/Explorer/Assets/DCL/Multiplayer/Connections/Rooms/Connective/ActivatableConnectiveRoom.cs b/Explorer/Assets/DCL/Multiplayer/Connections/Rooms/Connective/ActivatableConnectiveRoom.cs index 6673a1500cf..27735d4da7f 100644 --- a/Explorer/Assets/DCL/Multiplayer/Connections/Rooms/Connective/ActivatableConnectiveRoom.cs +++ b/Explorer/Assets/DCL/Multiplayer/Connections/Rooms/Connective/ActivatableConnectiveRoom.cs @@ -20,7 +20,7 @@ public class ActivatableConnectiveRoom : IActivatableConnectiveRoom public IConnectiveRoom.ConnectionLoopHealth CurrentConnectionLoopHealth => Activated ? origin.CurrentConnectionLoopHealth : IConnectiveRoom.ConnectionLoopHealth.Stopped; - public AttemptToConnectState AttemptToConnectState => Activated ? origin.AttemptToConnectState : AttemptToConnectState.NONE; + public AttemptToConnectState AttemptToConnectState => Activated ? origin.AttemptToConnectState : AttemptToConnectState.None; public ActivatableConnectiveRoom(IConnectiveRoom origin, bool initialState = true) { diff --git a/Explorer/Assets/DCL/Multiplayer/Connections/Rooms/Connective/ConnectiveRoom.cs b/Explorer/Assets/DCL/Multiplayer/Connections/Rooms/Connective/ConnectiveRoom.cs index 3b63fe3a1f3..74580a92713 100644 --- a/Explorer/Assets/DCL/Multiplayer/Connections/Rooms/Connective/ConnectiveRoom.cs +++ b/Explorer/Assets/DCL/Multiplayer/Connections/Rooms/Connective/ConnectiveRoom.cs @@ -28,23 +28,23 @@ namespace DCL.Multiplayer.Connections.Rooms.Connective { public enum RoomSelection : byte { - NEW, - PREVIOUS, + New, + Previous, } public enum AttemptToConnectState { - NONE, - SUCCESS, - ERROR, + None, + Success, + Error, /// /// Indicates that the loop was successfully launched but in the current context connection was not required /// - NO_CONNECTION_REQUIRED, + NoConnectionRequired, /// /// Indicates that the connection failed due to a 403 Forbidden Access error /// - FORBIDDEN_ACCESS, + ForbiddenAccess, } /// @@ -58,7 +58,7 @@ public abstract class ConnectiveRoom : IConnectiveRoom private readonly string logPrefix; private readonly InteriorRoom room = new (); private readonly Atomic connectionLoopHealth = new (IConnectiveRoom.ConnectionLoopHealth.Stopped); - private readonly Atomic attemptToConnectState = new (AttemptToConnectState.NONE); + private readonly Atomic attemptToConnectState = new (AttemptToConnectState.None); private readonly Atomic roomState = new (IConnectiveRoom.State.Stopped); private readonly IObjectPool roomPool; private readonly bool isDuplicateIdentityStopFeatureEnabled; @@ -70,7 +70,7 @@ public abstract class ConnectiveRoom : IConnectiveRoom protected ConnectiveRoom() { - isDuplicateIdentityStopFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.STOP_ON_DUPLICATE_IDENTITY); + isDuplicateIdentityStopFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.StopOnDuplicateIdentity); logPrefix = GetType().Name; @@ -113,7 +113,7 @@ public void Dispose() /// When the new room is connected, it can be invalid so it's possible to revert to the previous one /// protected virtual RoomSelection SelectValidRoom() => - RoomSelection.NEW; + RoomSelection.New; public async UniTask StartAsync() { @@ -121,12 +121,12 @@ public async UniTask StartAsync() throw new InvalidOperationException("Room is already running"); isDuplicateIdentityDetected = false; - attemptToConnectState.Set(AttemptToConnectState.NONE); + attemptToConnectState.Set(AttemptToConnectState.None); roomState.Set(IConnectiveRoom.State.Starting); room.ConnectionUpdated += OnConnectionUpdated; RunAsync((cancellationTokenSource = new CancellationTokenSource()).Token).Forget(); - await UniTask.WaitWhile(() => attemptToConnectState.Value() is AttemptToConnectState.NONE); - return attemptToConnectState.Value() is not AttemptToConnectState.ERROR; + await UniTask.WaitWhile(() => attemptToConnectState.Value() is AttemptToConnectState.None); + return attemptToConnectState.Value() is not AttemptToConnectState.Error; } public virtual async UniTask StopAsync() @@ -144,7 +144,7 @@ public virtual async UniTask StopAsync() } protected virtual void OnForbiddenAccess() => - attemptToConnectState.Set(AttemptToConnectState.FORBIDDEN_ACCESS); + attemptToConnectState.Set(AttemptToConnectState.ForbiddenAccess); public IConnectiveRoom.State CurrentState() => roomState.Value(); @@ -171,7 +171,7 @@ private async UniTaskVoid RunAsync(CancellationToken token) { ReportHub.LogWarning(ReportCategory.LIVEKIT, $"{logPrefix} - DuplicateIdentity detected, stopping reconnection loop"); connectionLoopHealth.Set(IConnectiveRoom.ConnectionLoopHealth.Stopped); - attemptToConnectState.Set(AttemptToConnectState.NO_CONNECTION_REQUIRED); + attemptToConnectState.Set(AttemptToConnectState.NoConnectionRequired); } else { @@ -217,7 +217,7 @@ protected async UniTask DisconnectCurrentRoomAsync(bool connectionIsNoLongerRequ roomState.Set(IConnectiveRoom.State.Stopped); if (connectionIsNoLongerRequired) - attemptToConnectState.Set(AttemptToConnectState.NO_CONNECTION_REQUIRED); + attemptToConnectState.Set(AttemptToConnectState.NoConnectionRequired); ReportHub .WithReport(ReportCategory.LIVEKIT) @@ -226,7 +226,7 @@ protected async UniTask DisconnectCurrentRoomAsync(bool connectionIsNoLongerRequ protected void SetNoConnectionRequired() { - attemptToConnectState.Set(AttemptToConnectState.NO_CONNECTION_REQUIRED); + attemptToConnectState.Set(AttemptToConnectState.NoConnectionRequired); } protected async UniTask TryConnectToRoomAsync(string connectionString, CancellationToken token) @@ -237,7 +237,7 @@ protected async UniTask TryConnectToRoomAsync(string connectionSt (Result connectResult, RoomSelection roomSelection) = await ChangeRoomsAsync(roomPool, credentials, token); - AttemptToConnectState connectionState = connectResult.Success ? AttemptToConnectState.SUCCESS : AttemptToConnectState.ERROR; + AttemptToConnectState connectionState = connectResult.Success ? AttemptToConnectState.Success : AttemptToConnectState.Error; attemptToConnectState.Set(connectionState); if (connectResult.Success == false) @@ -248,12 +248,12 @@ protected async UniTask TryConnectToRoomAsync(string connectionSt switch (roomSelection) { - case RoomSelection.NEW: + case RoomSelection.New: roomState.Set(IConnectiveRoom.State.Running); ReportHub.Log(ReportCategory.LIVEKIT, $"{logPrefix} - Trying to connect to finished successfully {connectionString}"); break; - case RoomSelection.PREVIOUS: + case RoomSelection.Previous: // preserve the previous state (for whatever reason) ReportHub.Log(ReportCategory.LIVEKIT, $"{logPrefix} - Connection to the previous room was preserved"); break; @@ -290,7 +290,7 @@ protected async UniTask TryConnectToRoomAsync(string connectionSt if (connectResult.Success == false) { roomsPool.Release(newRoom); - return (connectResult, RoomSelection.PREVIOUS); + return (connectResult, RoomSelection.Previous); } // now it's a moment to check if we should drop the new room and keep the previous one diff --git a/Explorer/Assets/DCL/Multiplayer/Connections/Rooms/Connective/IConnectiveRoom.cs b/Explorer/Assets/DCL/Multiplayer/Connections/Rooms/Connective/IConnectiveRoom.cs index 923470ad3f4..90e5b625437 100644 --- a/Explorer/Assets/DCL/Multiplayer/Connections/Rooms/Connective/IConnectiveRoom.cs +++ b/Explorer/Assets/DCL/Multiplayer/Connections/Rooms/Connective/IConnectiveRoom.cs @@ -62,7 +62,7 @@ public UniTask StopAsync() => public State CurrentState() => State.Stopped; - public AttemptToConnectState AttemptToConnectState => AttemptToConnectState.NONE; + public AttemptToConnectState AttemptToConnectState => AttemptToConnectState.None; public ConnectionLoopHealth CurrentConnectionLoopHealth => ConnectionLoopHealth.Stopped; @@ -95,11 +95,11 @@ public static string ParticipantCountInfo(this IConnectiveRoom room) => public static string ToStringNonAlloc(this AttemptToConnectState state) => state switch { - AttemptToConnectState.NONE => "None", - AttemptToConnectState.SUCCESS => "Success", - AttemptToConnectState.ERROR => "Error", - AttemptToConnectState.NO_CONNECTION_REQUIRED => "NoConnectionRequired", - AttemptToConnectState.FORBIDDEN_ACCESS => "ForbiddenAccess", + AttemptToConnectState.None => "None", + AttemptToConnectState.Success => "Success", + AttemptToConnectState.Error => "Error", + AttemptToConnectState.NoConnectionRequired => "NoConnectionRequired", + AttemptToConnectState.ForbiddenAccess => "ForbiddenAccess", _ => UNDEFINED, }; diff --git a/Explorer/Assets/DCL/Multiplayer/Connections/Rooms/Connective/ProxiedConnectiveRoomBase.cs b/Explorer/Assets/DCL/Multiplayer/Connections/Rooms/Connective/ProxiedConnectiveRoomBase.cs index d3c382b0a3f..535a671cbb6 100644 --- a/Explorer/Assets/DCL/Multiplayer/Connections/Rooms/Connective/ProxiedConnectiveRoomBase.cs +++ b/Explorer/Assets/DCL/Multiplayer/Connections/Rooms/Connective/ProxiedConnectiveRoomBase.cs @@ -68,7 +68,7 @@ public virtual UniTask StopAsync() return current.StopAsync(); } - public AttemptToConnectState AttemptToConnectState => current?.AttemptToConnectState ?? AttemptToConnectState.NONE; + public AttemptToConnectState AttemptToConnectState => current?.AttemptToConnectState ?? AttemptToConnectState.None; public virtual IConnectiveRoom.State CurrentState() => current?.CurrentState() ?? IConnectiveRoom.State.Stopped; diff --git a/Explorer/Assets/DCL/Multiplayer/Connections/Rooms/InteriorRoom.cs b/Explorer/Assets/DCL/Multiplayer/Connections/Rooms/InteriorRoom.cs index 40e38e740d9..8da8e71ddcb 100644 --- a/Explorer/Assets/DCL/Multiplayer/Connections/Rooms/InteriorRoom.cs +++ b/Explorer/Assets/DCL/Multiplayer/Connections/Rooms/InteriorRoom.cs @@ -93,7 +93,7 @@ public void Assign(IRoom room, out IRoom? previous) /// Disconnects from the current room and connects to the /// public UniTask ResetRoom(IObjectPool roomsPool, CancellationToken ct) => - SwapRoomsAsync(RoomSelection.NEW, assigned, NullRoom.INSTANCE, roomsPool, ct); + SwapRoomsAsync(RoomSelection.New, assigned, NullRoom.INSTANCE, roomsPool, ct); /// /// Disconnects from the current room and connects to the without using the RoomPool @@ -115,7 +115,7 @@ internal async UniTask SwapRoomsAsync(RoomSelection roomSelection, IRoom previou { switch (roomSelection) { - case RoomSelection.NEW: + case RoomSelection.New: // Disconnect the previous room, but make its callbacks pass through try { await previous.DisconnectAsync(ct); } finally @@ -135,7 +135,7 @@ internal async UniTask SwapRoomsAsync(RoomSelection roomSelection, IRoom previou } break; - case RoomSelection.PREVIOUS: + case RoomSelection.Previous: // drop the new room await newRoom.DisconnectAsync(ct); diff --git a/Explorer/Assets/DCL/Multiplayer/Connections/Rooms/RoomSource.cs b/Explorer/Assets/DCL/Multiplayer/Connections/Rooms/RoomSource.cs index 56b3dec6ca3..0da8e957f0b 100644 --- a/Explorer/Assets/DCL/Multiplayer/Connections/Rooms/RoomSource.cs +++ b/Explorer/Assets/DCL/Multiplayer/Connections/Rooms/RoomSource.cs @@ -8,10 +8,10 @@ namespace DCL.Multiplayer.Connections.Rooms [Flags] public enum RoomSource : byte { - NONE = 0, - GATEKEEPER = 1, - ISLAND = 1 << 1, - CHAT = 1 << 2, - PULSE = 1 << 3, + None = 0, + Gatekeeper = 1, + Island = 1 << 1, + Chat = 1 << 2, + Pulse = 1 << 3, } } diff --git a/Explorer/Assets/DCL/Multiplayer/Connections/Systems/Debug/DebugPulseSystem.cs b/Explorer/Assets/DCL/Multiplayer/Connections/Systems/Debug/DebugPulseSystem.cs index 52badb7e494..89174d320ed 100644 --- a/Explorer/Assets/DCL/Multiplayer/Connections/Systems/Debug/DebugPulseSystem.cs +++ b/Explorer/Assets/DCL/Multiplayer/Connections/Systems/Debug/DebugPulseSystem.cs @@ -164,7 +164,7 @@ private bool CanConnect() { return transport.State switch { - ITransport.TransportState.DISCONNECTED or ITransport.TransportState.NONE => true, + ITransport.TransportState.Disconnected or ITransport.TransportState.None => true, _ => false, }; } diff --git a/Explorer/Assets/DCL/Multiplayer/Connections/Systems/RoomIndicator/DebugRoomsSystem.Indicator.cs b/Explorer/Assets/DCL/Multiplayer/Connections/Systems/RoomIndicator/DebugRoomsSystem.Indicator.cs index 10f5127b8b8..48b89c52f1c 100644 --- a/Explorer/Assets/DCL/Multiplayer/Connections/Systems/RoomIndicator/DebugRoomsSystem.Indicator.cs +++ b/Explorer/Assets/DCL/Multiplayer/Connections/Systems/RoomIndicator/DebugRoomsSystem.Indicator.cs @@ -27,7 +27,7 @@ private void UpdateIndicator(in AvatarShapeComponent avatarShapeComponent, Namet { RoomSource prevValue = indicatorComponent.ConnectedTo; - indicatorComponent.ConnectedTo = entityParticipantTable.TryGet(avatarShapeComponent.ID, out IReadOnlyEntityParticipantTable.Entry entry) ? entry.ConnectedTo : RoomSource.NONE; + indicatorComponent.ConnectedTo = entityParticipantTable.TryGet(avatarShapeComponent.ID, out IReadOnlyEntityParticipantTable.Entry entry) ? entry.ConnectedTo : RoomSource.None; if (prevValue != indicatorComponent.ConnectedTo) nametagHolder.Nametag.DebugText = indicatorComponent.ConnectedTo.ToString(); diff --git a/Explorer/Assets/DCL/Multiplayer/Movement/Settings/MultiplayerMovementSettings.cs b/Explorer/Assets/DCL/Multiplayer/Movement/Settings/MultiplayerMovementSettings.cs index 5782bd59fc5..be439659927 100644 --- a/Explorer/Assets/DCL/Multiplayer/Movement/Settings/MultiplayerMovementSettings.cs +++ b/Explorer/Assets/DCL/Multiplayer/Movement/Settings/MultiplayerMovementSettings.cs @@ -42,8 +42,8 @@ public class MultiplayerMovementSettings : ScriptableObject, IMultiplayerMovemen [field: SerializeField] public float IdleSlowDownSpeed { get; private set; } public Dictionary MoveKindByDistance => new() { - { MovementKind.WALK, 1f }, - { MovementKind.JOG, 2f }, + { MovementKind.Walk, 1f }, + { MovementKind.Jog, 2f }, }; } } diff --git a/Explorer/Assets/DCL/Multiplayer/Movement/Systems/MultiplayerContainer.cs b/Explorer/Assets/DCL/Multiplayer/Movement/Systems/MultiplayerContainer.cs index 0fe568e6369..16d3705a068 100644 --- a/Explorer/Assets/DCL/Multiplayer/Movement/Systems/MultiplayerContainer.cs +++ b/Explorer/Assets/DCL/Multiplayer/Movement/Systems/MultiplayerContainer.cs @@ -231,7 +231,7 @@ public static async UniTask CreateAsync( { // Single session-wide source of truth for whether Pulse is the active transport. // Shared with the Pulse container, the LiveKit broadcaster, and the start-up operation that may deactivate it on fallback. - var pulseActivation = new PulseActivation(FeaturesRegistry.Instance.IsEnabled(FeatureId.PULSE)); + var pulseActivation = new PulseActivation(FeaturesRegistry.Instance.IsEnabled(FeatureId.Pulse)); PulseContainer pulseContainer = await PulseContainer.CreateAsync(pluginSettingsContainer, identityCache, movementInbox, landscapeData, urlsSource, selfProfile, realmData, pulseActivation, ct); var liveKitContainer = new LiveKitMultiplayerContainer(roomHub, messagePipesHub, movementInbox, selfProfile, userBlockingCache, multiplayerDebugSettings, pulseActivation); diff --git a/Explorer/Assets/DCL/Multiplayer/Movement/Systems/MultiplayerMovementDebugSystem.cs b/Explorer/Assets/DCL/Multiplayer/Movement/Systems/MultiplayerMovementDebugSystem.cs index 2c352e1ded7..e943fdbc29a 100644 --- a/Explorer/Assets/DCL/Multiplayer/Movement/Systems/MultiplayerMovementDebugSystem.cs +++ b/Explorer/Assets/DCL/Multiplayer/Movement/Systems/MultiplayerMovementDebugSystem.cs @@ -194,7 +194,7 @@ private void InstantiateSelfReplica(World world) { Profile playerProfiler = world.Get(playerEntity); var profile = Profile.NewProfileWithAvatar(RemotePlayerMovementComponent.TEST_ID, playerProfiler.Avatar); - var remoteProfile = new RemoteProfile(profile, RemotePlayerMovementComponent.TEST_ID, RoomSource.ISLAND); + var remoteProfile = new RemoteProfile(profile, RemotePlayerMovementComponent.TEST_ID, RoomSource.Island); selfReplicaEntity = remoteEntities.TryCreateOrUpdateRemoteEntity(remoteProfile, world); if (world.TryGet(selfReplicaEntity.Value, out CharacterTransform transformComp)) @@ -221,7 +221,7 @@ private void RemoveSelfReplica(World world) debugSettings.SelfSending = false; if (remoteEntities == null) return; - remoteEntities.TryRemove(RemotePlayerMovementComponent.TEST_ID, RoomSource.ISLAND, world); + remoteEntities.TryRemove(RemotePlayerMovementComponent.TEST_ID, RoomSource.Island, world); selfReplicaEntity = null; } diff --git a/Explorer/Assets/DCL/Multiplayer/Movement/Systems/PlayerMovementNetSendSystem.cs b/Explorer/Assets/DCL/Multiplayer/Movement/Systems/PlayerMovementNetSendSystem.cs index fea6595a407..7c1e1459b37 100644 --- a/Explorer/Assets/DCL/Multiplayer/Movement/Systems/PlayerMovementNetSendSystem.cs +++ b/Explorer/Assets/DCL/Multiplayer/Movement/Systems/PlayerMovementNetSendSystem.cs @@ -192,7 +192,7 @@ private void SendMessage(ref PlayerMovementNetworkComponent playerMovement, // Debug purposes. Simulate package lost when Running if (debugSettings.SelfSending - && input.Kind != MovementKind.RUN // simulate package lost when Running + && input.Kind != MovementKind.Run // simulate package lost when Running ) messageBus.SelfSendWithDelayAsync(playerMovement.LastSentMessage, debugSettings.Latency + (debugSettings.Latency * Random.Range(0, debugSettings.LatencyJitter))) diff --git a/Explorer/Assets/DCL/Multiplayer/Movement/Systems/PulseMultiplayerBus.PlayerState.cs b/Explorer/Assets/DCL/Multiplayer/Movement/Systems/PulseMultiplayerBus.PlayerState.cs index cb19ed06761..86bb8934826 100644 --- a/Explorer/Assets/DCL/Multiplayer/Movement/Systems/PulseMultiplayerBus.PlayerState.cs +++ b/Explorer/Assets/DCL/Multiplayer/Movement/Systems/PulseMultiplayerBus.PlayerState.cs @@ -441,13 +441,13 @@ private static GlideStateValue ToNetworkMovementGlideState(GlideState glideState switch (glideState) { case GlideState.ClosingProp: - return GlideStateValue.CLOSING_PROP; + return GlideStateValue.ClosingProp; case GlideState.Gliding: - return GlideStateValue.GLIDING; + return GlideStateValue.Gliding; case GlideState.OpeningProp: - return GlideStateValue.OPENING_PROP; + return GlideStateValue.OpeningProp; case GlideState.PropClosed: - return GlideStateValue.PROP_CLOSED; + return GlideStateValue.PropClosed; default: throw new ArgumentOutOfRangeException(nameof(glideState), glideState, null); } } diff --git a/Explorer/Assets/DCL/Multiplayer/Movement/Systems/PulseMultiplayerBus.cs b/Explorer/Assets/DCL/Multiplayer/Movement/Systems/PulseMultiplayerBus.cs index cd10b49147d..c3eb2c35cda 100644 --- a/Explorer/Assets/DCL/Multiplayer/Movement/Systems/PulseMultiplayerBus.cs +++ b/Explorer/Assets/DCL/Multiplayer/Movement/Systems/PulseMultiplayerBus.cs @@ -75,10 +75,10 @@ private bool TryGetWalletInCurrentRealm(uint subjectId, string messageType, out { switch (peerIdCache.GetWalletInRealm(subjectId, realmData.RealmName, out wallet)) { - case PeerIdCache.LookupResult.UNKNOWN_PEER: + case PeerIdCache.LookupResult.UnknownPeer: ReportHub.LogWarning(ReportCategory.MULTIPLAYER, $"Received {messageType} from unknown peer {subjectId}"); return false; - case PeerIdCache.LookupResult.REALM_MISMATCH: + case PeerIdCache.LookupResult.RealmMismatch: // Expected while a realm-change purge is pending, so not a warning ReportHub.Log(ReportCategory.MULTIPLAYER, $"Dropped {messageType} from peer {subjectId} in a different realm"); return false; diff --git a/Explorer/Assets/DCL/Multiplayer/Movement/Systems/RemotePlayerAnimationSystem.cs b/Explorer/Assets/DCL/Multiplayer/Movement/Systems/RemotePlayerAnimationSystem.cs index c770dc80b3a..0f412de02a1 100644 --- a/Explorer/Assets/DCL/Multiplayer/Movement/Systems/RemotePlayerAnimationSystem.cs +++ b/Explorer/Assets/DCL/Multiplayer/Movement/Systems/RemotePlayerAnimationSystem.cs @@ -88,7 +88,7 @@ private static void UpdateAnimations(IAvatarView view, ref CharacterAnimationCom // other states bool jumpTriggered = message.animState.JumpCount > animationComponent.States.JumpCount; - bool glidingTriggered = message.animState.GlideState == GlideStateValue.OPENING_PROP && animationComponent.States.GlideState != GlideStateValue.OPENING_PROP; + bool glidingTriggered = message.animState.GlideState == GlideStateValue.OpeningProp && animationComponent.States.GlideState != GlideStateValue.OpeningProp; animationComponent.States.IsGrounded = message.animState.IsGrounded; animationComponent.States.JumpCount = message.animState.JumpCount; animationComponent.States.IsLongJump = message.animState.IsLongJump; diff --git a/Explorer/Assets/DCL/Multiplayer/Movement/Systems/RemotePlayersMovementSystem.cs b/Explorer/Assets/DCL/Multiplayer/Movement/Systems/RemotePlayersMovementSystem.cs index 06f44822b5e..8895f841433 100644 --- a/Explorer/Assets/DCL/Multiplayer/Movement/Systems/RemotePlayersMovementSystem.cs +++ b/Explorer/Assets/DCL/Multiplayer/Movement/Systems/RemotePlayersMovementSystem.cs @@ -218,7 +218,7 @@ private void StartInterpolation(float deltaTime, ref CharacterTransform transCom bool useLinear = remotePlayerMovement.PastMessage.velocitySqrMagnitude < RemotePlayerUtils.ZERO_VELOCITY_SQR_THRESHOLD || remote.velocitySqrMagnitude < RemotePlayerUtils.ZERO_VELOCITY_SQR_THRESHOLD || remotePlayerMovement.PastMessage.animState.IsGrounded != remote.animState.IsGrounded || remotePlayerMovement.PastMessage.animState.JumpCount != remote.animState.JumpCount - || remotePlayerMovement.PastMessage.movementKind == MovementKind.IDLE || remote.movementKind == MovementKind.IDLE; + || remotePlayerMovement.PastMessage.movementKind == MovementKind.Idle || remote.movementKind == MovementKind.Idle; // Interpolate linearly to/from zero velocities to avoid position overshooting InterpolationType spline = intSettings.UseBlend ? intSettings.BlendType : @@ -284,12 +284,12 @@ private void AccelerateVerySlowTransition(ref InterpolationComponent intComp) if (intComp.TotalDuration < settings.AccelerationTimeThreshold) return; float distance = Vector3.Distance(intComp.Start.position, intComp.End.position); - MovementKind movementKind = MovementKind.RUN; + MovementKind movementKind = MovementKind.Run; - if (distance < settings.MoveKindByDistance[MovementKind.WALK]) - movementKind = MovementKind.WALK; - else if (distance < settings.MoveKindByDistance[MovementKind.JOG]) - movementKind = MovementKind.JOG; + if (distance < settings.MoveKindByDistance[MovementKind.Walk]) + movementKind = MovementKind.Walk; + else if (distance < settings.MoveKindByDistance[MovementKind.Jog]) + movementKind = MovementKind.Jog; float speed = MovementSpeedLimitHelper.GetMovementSpeedLimit(characterControllerSettings, movementKind); diff --git a/Explorer/Assets/DCL/Multiplayer/Movement/Tests/MovementMessageCompressionTests.cs b/Explorer/Assets/DCL/Multiplayer/Movement/Tests/MovementMessageCompressionTests.cs index cb17b533c2c..55a8a5f0e23 100644 --- a/Explorer/Assets/DCL/Multiplayer/Movement/Tests/MovementMessageCompressionTests.cs +++ b/Explorer/Assets/DCL/Multiplayer/Movement/Tests/MovementMessageCompressionTests.cs @@ -82,10 +82,10 @@ public void ShouldResetBlendsToZeroOnDecompress(float moveBlend, float slideBlen Assert.That(decompressedMessage.animState.SlideBlendValue, Is.EqualTo(0f)); } - [TestCase(MovementKind.JOG, false, false, false, 0, false, false, false)] - [TestCase(MovementKind.RUN, true, true, true, 1, true, true, true)] - [TestCase(MovementKind.WALK, true, false, true, 0, true, false, false)] - [TestCase(MovementKind.IDLE, false, true, true, 0, false, true, true)] + [TestCase(MovementKind.Jog, false, false, false, 0, false, false, false)] + [TestCase(MovementKind.Run, true, true, true, 1, true, true, true)] + [TestCase(MovementKind.Walk, true, false, true, 0, true, false, false)] + [TestCase(MovementKind.Idle, false, true, true, 0, false, true, true)] public void ShouldCorrectlyEncodeAndDecodeAnimations(MovementKind movementKind, bool isSliding, bool isStunned, bool isGrounded, int jumpCount, bool isLongJump, bool isLongFall, bool isFalling) { diff --git a/Explorer/Assets/DCL/Multiplayer/Movement/Tests/PulseMultiplayerBusRealmFilteringShould.cs b/Explorer/Assets/DCL/Multiplayer/Movement/Tests/PulseMultiplayerBusRealmFilteringShould.cs index 483779b7504..e483c7ac11a 100644 --- a/Explorer/Assets/DCL/Multiplayer/Movement/Tests/PulseMultiplayerBusRealmFilteringShould.cs +++ b/Explorer/Assets/DCL/Multiplayer/Movement/Tests/PulseMultiplayerBusRealmFilteringShould.cs @@ -173,7 +173,7 @@ public void PurgeDifferentRealmPeersOnTeleport() using (OwnedBunch bunch = removeIntentions.Bunch()) { CollectionAssert.AreEquivalent( - new[] { new RemoveIntention(WALLET_1, RoomSource.PULSE), new RemoveIntention(WALLET_2, RoomSource.PULSE) }, + new[] { new RemoveIntention(WALLET_1, RoomSource.Pulse), new RemoveIntention(WALLET_2, RoomSource.Pulse) }, bunch.Collection()); } @@ -235,7 +235,7 @@ public void RemovePeerOnTeleportToDifferentRealm() Assert.IsFalse(peerIdCache.TryGetWallet(7, out _)); using (OwnedBunch bunch = removeIntentions.Bunch()) - CollectionAssert.AreEquivalent(new[] { new RemoveIntention(WALLET_1, RoomSource.PULSE) }, bunch.Collection()); + CollectionAssert.AreEquivalent(new[] { new RemoveIntention(WALLET_1, RoomSource.Pulse) }, bunch.Collection()); } [Test] @@ -287,7 +287,7 @@ public void ProcessPlayerLeftForStaleRealmPeer() Handle(new ServerMessage { PlayerLeft = new PlayerLeft { SubjectId = 7 } }); using (OwnedBunch bunch = removeIntentions.Bunch()) - CollectionAssert.AreEquivalent(new[] { new RemoveIntention(WALLET_1, RoomSource.PULSE) }, bunch.Collection()); + CollectionAssert.AreEquivalent(new[] { new RemoveIntention(WALLET_1, RoomSource.Pulse) }, bunch.Collection()); Assert.IsFalse(peerIdCache.TryGetWallet(7, out _)); } @@ -323,7 +323,7 @@ private List DrainAnnouncements() participantTable.TryGet(wallet, out Arg.Any()) .Returns(ci => { - ci[1] = new IReadOnlyEntityParticipantTable.Entry(wallet, entity, RoomSource.PULSE); + ci[1] = new IReadOnlyEntityParticipantTable.Entry(wallet, entity, RoomSource.Pulse); return true; }); diff --git a/Explorer/Assets/DCL/Multiplayer/Profiles/Announcements/PulseIncomingProfileAnnouncements.cs b/Explorer/Assets/DCL/Multiplayer/Profiles/Announcements/PulseIncomingProfileAnnouncements.cs index e3cea8d8047..813dd0243bc 100644 --- a/Explorer/Assets/DCL/Multiplayer/Profiles/Announcements/PulseIncomingProfileAnnouncements.cs +++ b/Explorer/Assets/DCL/Multiplayer/Profiles/Announcements/PulseIncomingProfileAnnouncements.cs @@ -10,7 +10,7 @@ public class PulseIncomingProfileAnnouncements : IRemoteAnnouncements private readonly DCLConcurrentQueue queue = new (); public void Enqueue(string userId, int version) => - queue.Enqueue(new RemoteAnnouncement(version, userId, RoomSource.PULSE)); + queue.Enqueue(new RemoteAnnouncement(version, userId, RoomSource.Pulse)); public void Fill(List announcements) { diff --git a/Explorer/Assets/DCL/Multiplayer/Profiles/BroadcastProfiles/LiveKitMessagesBroadcaster.cs b/Explorer/Assets/DCL/Multiplayer/Profiles/BroadcastProfiles/LiveKitMessagesBroadcaster.cs index 213b664eeea..1cb53de9191 100644 --- a/Explorer/Assets/DCL/Multiplayer/Profiles/BroadcastProfiles/LiveKitMessagesBroadcaster.cs +++ b/Explorer/Assets/DCL/Multiplayer/Profiles/BroadcastProfiles/LiveKitMessagesBroadcaster.cs @@ -56,10 +56,10 @@ public void Send(Action buildMessage, TInput foreach ((string walletId, RoomSource rooms) in announcedWallets) { - if (EnumUtils.HasFlag(rooms, RoomSource.ISLAND)) + if (EnumUtils.HasFlag(rooms, RoomSource.Island)) islandList.Add(walletId); - if (EnumUtils.HasFlag(rooms, RoomSource.GATEKEEPER)) + if (EnumUtils.HasFlag(rooms, RoomSource.Gatekeeper)) sceneList.Add(walletId); } @@ -106,7 +106,7 @@ public void Remove(string walletId, RoomSource roomSource) { currentSource.RemoveFlag(roomSource); - if (currentSource == RoomSource.NONE) + if (currentSource == RoomSource.None) announcedWallets.Remove(walletId); else announcedWallets[walletId] = currentSource; diff --git a/Explorer/Assets/DCL/Multiplayer/Profiles/Entities/RemoteEntities.cs b/Explorer/Assets/DCL/Multiplayer/Profiles/Entities/RemoteEntities.cs index b385970fec5..d53239dd2b5 100644 --- a/Explorer/Assets/DCL/Multiplayer/Profiles/Entities/RemoteEntities.cs +++ b/Explorer/Assets/DCL/Multiplayer/Profiles/Entities/RemoteEntities.cs @@ -84,7 +84,7 @@ public void ForceRemoveAll(World world) { tempRemoveAll.Clear(); tempRemoveAll.AddRange(entityParticipantTable.Wallets()); - foreach (string wallet in tempRemoveAll) Remove(wallet, RoomSource.GATEKEEPER | RoomSource.ISLAND, world); + foreach (string wallet in tempRemoveAll) Remove(wallet, RoomSource.Gatekeeper | RoomSource.Island, world); } public void TryRemove(string walletId, RoomSource roomSource, World world) diff --git a/Explorer/Assets/DCL/Multiplayer/Profiles/RemoteProfiles/RemoteProfiles.cs b/Explorer/Assets/DCL/Multiplayer/Profiles/RemoteProfiles/RemoteProfiles.cs index 800b2ead8b3..f5e0cd6e332 100644 --- a/Explorer/Assets/DCL/Multiplayer/Profiles/RemoteProfiles/RemoteProfiles.cs +++ b/Explorer/Assets/DCL/Multiplayer/Profiles/RemoteProfiles/RemoteProfiles.cs @@ -112,7 +112,7 @@ private async UniTaskVoid TryDownloadAsync(RemoteAnnouncement remoteAnnouncement // Delay the profile resolution in case it's not found, as otherwise it will be re-requested every frame - it's not the desired behaviour // In case it needs to be retrieved, force it to the catalyst, otherwise we get outdated profiles Profile? profile = await profileRepository.GetAsync(remoteAnnouncement.WalletId, remoteAnnouncement.Version, lambdasEndpoint, cts.Token, - batchBehaviour: IProfileRepository.FetchBehaviour.DELAY_UNTIL_RESOLVED); + batchBehaviour: IProfileRepository.FetchBehaviour.DelayUntilResolved); if (profile is null) return; diff --git a/Explorer/Assets/DCL/Multiplayer/Profiles/RemoveIntentions/LiveKitRemoveIntentions.cs b/Explorer/Assets/DCL/Multiplayer/Profiles/RemoveIntentions/LiveKitRemoveIntentions.cs index bb66e515f15..74d3c6c2f54 100644 --- a/Explorer/Assets/DCL/Multiplayer/Profiles/RemoveIntentions/LiveKitRemoveIntentions.cs +++ b/Explorer/Assets/DCL/Multiplayer/Profiles/RemoveIntentions/LiveKitRemoveIntentions.cs @@ -30,22 +30,22 @@ public LiveKitRemoveIntentions(IRoomHub roomHub) // TODO how to remove boiler-plate methods and preserve RoomSource? private void OnConnectionUpdateFromIsland(IRoom room, ConnectionUpdate connectionUpdate, LKDisconnectReason? disconnectReason = null) { - OnConnectionUpdated(room, connectionUpdate, RoomSource.ISLAND); + OnConnectionUpdated(room, connectionUpdate, RoomSource.Island); } private void OnConnectionUpdateFromScene(IRoom room, ConnectionUpdate connectionUpdate, LKDisconnectReason? disconnectReason = null) { - OnConnectionUpdated(room, connectionUpdate, RoomSource.GATEKEEPER); + OnConnectionUpdated(room, connectionUpdate, RoomSource.Gatekeeper); } private void OnParticipantUpdateFromIsland(LKParticipant participant, UpdateFromParticipant update) { - ParticipantsOnUpdatesFromParticipant(participant, update, RoomSource.ISLAND); + ParticipantsOnUpdatesFromParticipant(participant, update, RoomSource.Island); } private void OnParticipantUpdateFromScene(LKParticipant participant, UpdateFromParticipant update) { - ParticipantsOnUpdatesFromParticipant(participant, update, RoomSource.GATEKEEPER); + ParticipantsOnUpdatesFromParticipant(participant, update, RoomSource.Gatekeeper); } private void OnConnectionUpdated(IRoom room, ConnectionUpdate connectionUpdate, RoomSource roomSource) diff --git a/Explorer/Assets/DCL/Multiplayer/Profiles/RemoveIntentions/PulseRemoveIntentions.cs b/Explorer/Assets/DCL/Multiplayer/Profiles/RemoveIntentions/PulseRemoveIntentions.cs index 784acccb8d5..389293c1bd3 100644 --- a/Explorer/Assets/DCL/Multiplayer/Profiles/RemoveIntentions/PulseRemoveIntentions.cs +++ b/Explorer/Assets/DCL/Multiplayer/Profiles/RemoveIntentions/PulseRemoveIntentions.cs @@ -13,14 +13,14 @@ public class PulseRemoveIntentions : IRemoveIntentions public void Enqueue(string walletId) { using (mutexSync.GetScope()) - set.Add(new RemoveIntention(walletId, RoomSource.PULSE)); + set.Add(new RemoveIntention(walletId, RoomSource.Pulse)); } /// Drops a pending remove so a newer re-join supersedes a not-yet-applied leave. public void Cancel(string walletId) { using (mutexSync.GetScope()) - set.Remove(new RemoveIntention(walletId, RoomSource.PULSE)); + set.Remove(new RemoveIntention(walletId, RoomSource.Pulse)); } public OwnedBunch Bunch() => diff --git a/Explorer/Assets/DCL/Multiplayer/Profiles/Tables/EntityParticipantTable.cs b/Explorer/Assets/DCL/Multiplayer/Profiles/Tables/EntityParticipantTable.cs index 63974d9413a..542921b96db 100644 --- a/Explorer/Assets/DCL/Multiplayer/Profiles/Tables/EntityParticipantTable.cs +++ b/Explorer/Assets/DCL/Multiplayer/Profiles/Tables/EntityParticipantTable.cs @@ -52,7 +52,7 @@ public bool Release(string walletId, RoomSource fromRoom) IReadOnlyEntityParticipantTable.Entry entry = walletIdToEntity[walletId]; entry = entry.WithoutRoomSource(fromRoom); - if (entry.ConnectedTo == RoomSource.NONE) + if (entry.ConnectedTo == RoomSource.None) { walletIdToEntity.Remove(walletId); entityToWalletId.Remove(entry.Entity); diff --git a/Explorer/Assets/DCL/NameTags/Systems/NametagPlacementSystem.cs b/Explorer/Assets/DCL/NameTags/Systems/NametagPlacementSystem.cs index 3e75b3c1412..7e8d9b7b676 100644 --- a/Explorer/Assets/DCL/NameTags/Systems/NametagPlacementSystem.cs +++ b/Explorer/Assets/DCL/NameTags/Systems/NametagPlacementSystem.cs @@ -54,7 +54,7 @@ NametagsData nametagsData { this.nametagHolderPool = nametagHolderPool; this.nametagsData = nametagsData; - includeGhosts = FeaturesRegistry.Instance.IsEnabled(FeatureId.AVATAR_GHOSTS); + includeGhosts = FeaturesRegistry.Instance.IsEnabled(FeatureId.AvatarGhosts); } public override void Initialize() @@ -164,7 +164,7 @@ private void UpdateNametagSpeakingState(Entity e, in NametagHolder nametagHolder return; } - nametagHolder.Nametag.VoiceChat = voiceChatComponent.Type == VoiceChatType.NEARBY || voiceChatComponent.IsSpeaking; + nametagHolder.Nametag.VoiceChat = voiceChatComponent.Type == VoiceChatType.Nearby || voiceChatComponent.IsSpeaking; nametagHolder.Nametag.Speaking = voiceChatComponent.IsSpeaking; nametagHolder.Nametag.Hushed = voiceChatComponent.IsHushed; // hushed is cleared to false when changing room diff --git a/Explorer/Assets/DCL/Navmap/EventInfoPanelController.cs b/Explorer/Assets/DCL/Navmap/EventInfoPanelController.cs index 4b03746a0ad..e5a0d89852c 100644 --- a/Explorer/Assets/DCL/Navmap/EventInfoPanelController.cs +++ b/Explorer/Assets/DCL/Navmap/EventInfoPanelController.cs @@ -198,7 +198,7 @@ private void Share() private void JumpIn() { navmapBus.JumpIn(place!); - chatMessagesBus.SendWithUtcNowTimestamp(ChatChannel.NEARBY_CHANNEL, $"/{ChatCommandsUtils.COMMAND_GOTO} {@event?.x},{@event?.y}", ChatMessageOrigin.JUMP_IN); + chatMessagesBus.SendWithUtcNowTimestamp(ChatChannel.NEARBY_CHANNEL, $"/{ChatCommandsUtils.COMMAND_GOTO} {@event?.x},{@event?.y}", ChatMessageOrigin.JumpIn); } } } diff --git a/Explorer/Assets/DCL/Navmap/NavmapSearchBarController.cs b/Explorer/Assets/DCL/Navmap/NavmapSearchBarController.cs index a7ce33001bf..e90bcb72fe5 100644 --- a/Explorer/Assets/DCL/Navmap/NavmapSearchBarController.cs +++ b/Explorer/Assets/DCL/Navmap/NavmapSearchBarController.cs @@ -1,225 +1,225 @@ -using Cysharp.Threading.Tasks; -using DCL.Input; -using DCL.Input.Component; -using DCL.MapRenderer.MapLayers.Categories; -using DCL.Navmap.ScriptableObjects; -using DCL.UI; -using System; -using System.Threading; -using Utility; - -namespace DCL.Navmap -{ - public class NavmapSearchBarController : IDisposable - { - public event Action? TogglePanel; - - private readonly SearchBarView view; - private readonly HistoryRecordPanelView historyRecordPanelView; - private readonly SearchFiltersView searchFiltersView; - private readonly IInputBlock inputBlock; - private readonly INavmapBus navmapBus; - private readonly CategoryMappingSO categoryMappingSO; - - private CancellationTokenSource? searchCancellationToken; - private CancellationTokenSource? backCancellationToken; - private NavmapSearchPlaceFilter currentPlaceFilter = NavmapSearchPlaceFilter.All; - private NavmapSearchPlaceSorting currentPlaceSorting = NavmapSearchPlaceSorting.MostActive; - private string? currentCategory; - private string currentSearchText = string.Empty; - - public bool Interactable - { - get => view.inputField.interactable; - set => view.inputField.interactable = value; - } - - public NavmapSearchBarController( - SearchBarView view, - HistoryRecordPanelView historyRecordPanelView, - SearchFiltersView searchFiltersView, - IInputBlock inputBlock, - INavmapBus navmapBus, - CategoryMappingSO categoryMappingSO) - { - this.view = view; - this.historyRecordPanelView = historyRecordPanelView; - this.searchFiltersView = searchFiltersView; - this.inputBlock = inputBlock; - this.navmapBus = navmapBus; - this.categoryMappingSO = categoryMappingSO; - - navmapBus.OnJumpIn += _ => ClearInput(); - navmapBus.OnFilterByCategory += SearchByCategory; - view.inputField.onSelect.AddListener(_ => OnSearchBarSelected(true)); - view.inputField.onDeselect.AddListener(_ => OnSearchBarSelected(false)); - view.inputField.onValueChanged.AddListener(OnInputValueChanged); - view.inputField.onSubmit.AddListener(OnSubmitSearch); - view.clearSearchButton.onClick.AddListener(ClearInput); - view.BackButton.onClick.AddListener(OnBackClicked); - view.clearSearchButton.gameObject.SetActive(false); - historyRecordPanelView.gameObject.SetActive(false); - searchFiltersView.NewestButton.onClick.AddListener(() => Search(NavmapSearchPlaceSorting.Newest)); - searchFiltersView.BestRatedButton.onClick.AddListener(() => Search(NavmapSearchPlaceSorting.BestRated)); - searchFiltersView.MostActiveButton.onClick.AddListener(() => Search(NavmapSearchPlaceSorting.MostActive)); - searchFiltersView.Toggle(currentPlaceSorting); - searchFiltersView.Toggle(currentPlaceFilter); - } - - public void Dispose() - { - searchCancellationToken.SafeCancelAndDispose(); - view.inputField.onSelect.RemoveAllListeners(); - view.inputField.onValueChanged.RemoveAllListeners(); - view.inputField.onSubmit.RemoveAllListeners(); - view.clearSearchButton.onClick.RemoveAllListeners(); - } - - public void ToggleClearButton(bool isActive) - { - view.clearSearchButton.gameObject.SetActive(isActive); - } - - public void SetInputFieldCategory(string? category) - { - view.clearSearchButton.gameObject.SetActive(!string.IsNullOrEmpty(category) || !string.IsNullOrEmpty(currentSearchText)); - view.inputFieldCategoryImage.gameObject.SetActive(!string.IsNullOrEmpty(category)); - - if (string.IsNullOrEmpty(category)) - return; - - if(Enum.TryParse(category, true, out CategoriesEnum categoryEnum)) - view.inputFieldCategoryImage.sprite = categoryMappingSO.GetCategoryImage(categoryEnum); - } - - public void SetInputText(string text) - { - view.inputField.SetTextWithoutNotify(text); - } - - public void ClearInput() - { - view.inputField.SetTextWithoutNotify(string.Empty); - view.inputFieldCategoryImage.gameObject.SetActive(false); - view.clearSearchButton.gameObject.SetActive(false); - view.BackButton.gameObject.SetActive(false); - - currentCategory = string.Empty; - currentSearchText = string.Empty; - TogglePanel?.Invoke(false); - Interactable = true; - navmapBus.ClearFilter(); - navmapBus.ClearPlacesFromMap(); - if (view.inputField.isFocused) - RestoreInput(); - } - - public void EnableBack() - { - view.inputFieldCategoryImage.gameObject.SetActive(false); - view.BackButton.gameObject.SetActive(true); - view.SearchIcon.SetActive(false); - } - - public void DisableBack() - { - view.inputFieldCategoryImage.gameObject.SetActive(false); - view.BackButton.gameObject.SetActive(false); - view.SearchIcon.SetActive(true); - } - - public void UpdateFilterAndSorting(NavmapSearchPlaceFilter filter, NavmapSearchPlaceSorting sorting) - { - navmapBus.ClearPlacesFromMap(); - currentPlaceFilter = filter; - searchFiltersView.Toggle(currentPlaceFilter); - - currentPlaceSorting = sorting; - searchFiltersView.Toggle(currentPlaceSorting); - } - - private void OnBackClicked() - { - backCancellationToken = backCancellationToken.SafeRestart(); - navmapBus.GoBackAsync(backCancellationToken.Token).Forget(); - } - - private void OnInputValueChanged(string searchText) - { - currentCategory = string.Empty; - view.clearSearchButton.gameObject.SetActive(!string.IsNullOrEmpty(searchText)); - currentSearchText = searchText; - } - - private void OnSubmitSearch(string searchText) - { - searchCancellationToken = searchCancellationToken.SafeRestart(); - SearchAsync(searchCancellationToken.Token) - .Forget(); - - async UniTaskVoid SearchAsync(CancellationToken ct) - { - UpdateFilterAndSorting(NavmapSearchPlaceFilter.All, currentPlaceSorting); - - TogglePanel?.Invoke(!string.IsNullOrEmpty(searchText)); - await navmapBus.SearchForPlaceAsync(INavmapBus.SearchPlaceParams.CreateWithDefaultParams( - page: 0, - filter: currentPlaceFilter, - sorting: currentPlaceSorting, - text: currentSearchText), ct) - .SuppressCancellationThrow(); - } - } - - private void OnSearchBarSelected(bool isSelected) - { - if (isSelected) - DisableShortcutsInput(); - else - RestoreInput(); - } - - private void DisableShortcutsInput() => - inputBlock.Disable(InputMapComponent.Kind.SHORTCUTS, InputMapComponent.Kind.IN_WORLD_CAMERA); - - private void RestoreInput() => - inputBlock.Enable(InputMapComponent.Kind.SHORTCUTS, InputMapComponent.Kind.IN_WORLD_CAMERA); - - private void Search(NavmapSearchPlaceSorting sorting) - { - UpdateFilterAndSorting(currentPlaceFilter, sorting); - - searchCancellationToken = searchCancellationToken.SafeRestart(); - - navmapBus.SearchForPlaceAsync(INavmapBus.SearchPlaceParams.CreateWithDefaultParams( - page: 0, - text: currentSearchText, - filter: currentPlaceFilter, - sorting: sorting, - category: currentCategory), searchCancellationToken.Token) - .Forget(); - } - - private void SearchByCategory(string? category) - { - UpdateFilterAndSorting(category is "Favorites" ? NavmapSearchPlaceFilter.Favorites : NavmapSearchPlaceFilter.All, currentPlaceSorting); - - if (string.IsNullOrEmpty(category)) - { - ClearInput(); - return; - } - - TogglePanel?.Invoke(true); - currentSearchText = string.Empty; - currentCategory = category; - searchCancellationToken = searchCancellationToken.SafeRestart(); - navmapBus.SearchForPlaceAsync(INavmapBus.SearchPlaceParams.CreateWithDefaultParams( - page: 0, - filter: currentPlaceFilter, - sorting: currentPlaceSorting, - category: category), searchCancellationToken.Token) - .Forget(); - } - } -} +using Cysharp.Threading.Tasks; +using DCL.Input; +using DCL.Input.Component; +using DCL.MapRenderer.MapLayers.Categories; +using DCL.Navmap.ScriptableObjects; +using DCL.UI; +using System; +using System.Threading; +using Utility; + +namespace DCL.Navmap +{ + public class NavmapSearchBarController : IDisposable + { + public event Action? TogglePanel; + + private readonly SearchBarView view; + private readonly HistoryRecordPanelView historyRecordPanelView; + private readonly SearchFiltersView searchFiltersView; + private readonly IInputBlock inputBlock; + private readonly INavmapBus navmapBus; + private readonly CategoryMappingSO categoryMappingSO; + + private CancellationTokenSource? searchCancellationToken; + private CancellationTokenSource? backCancellationToken; + private NavmapSearchPlaceFilter currentPlaceFilter = NavmapSearchPlaceFilter.All; + private NavmapSearchPlaceSorting currentPlaceSorting = NavmapSearchPlaceSorting.MostActive; + private string? currentCategory; + private string currentSearchText = string.Empty; + + public bool Interactable + { + get => view.inputField.interactable; + set => view.inputField.interactable = value; + } + + public NavmapSearchBarController( + SearchBarView view, + HistoryRecordPanelView historyRecordPanelView, + SearchFiltersView searchFiltersView, + IInputBlock inputBlock, + INavmapBus navmapBus, + CategoryMappingSO categoryMappingSO) + { + this.view = view; + this.historyRecordPanelView = historyRecordPanelView; + this.searchFiltersView = searchFiltersView; + this.inputBlock = inputBlock; + this.navmapBus = navmapBus; + this.categoryMappingSO = categoryMappingSO; + + navmapBus.OnJumpIn += _ => ClearInput(); + navmapBus.OnFilterByCategory += SearchByCategory; + view.inputField.onSelect.AddListener(_ => OnSearchBarSelected(true)); + view.inputField.onDeselect.AddListener(_ => OnSearchBarSelected(false)); + view.inputField.onValueChanged.AddListener(OnInputValueChanged); + view.inputField.onSubmit.AddListener(OnSubmitSearch); + view.clearSearchButton.onClick.AddListener(ClearInput); + view.BackButton.onClick.AddListener(OnBackClicked); + view.clearSearchButton.gameObject.SetActive(false); + historyRecordPanelView.gameObject.SetActive(false); + searchFiltersView.NewestButton.onClick.AddListener(() => Search(NavmapSearchPlaceSorting.Newest)); + searchFiltersView.BestRatedButton.onClick.AddListener(() => Search(NavmapSearchPlaceSorting.BestRated)); + searchFiltersView.MostActiveButton.onClick.AddListener(() => Search(NavmapSearchPlaceSorting.MostActive)); + searchFiltersView.Toggle(currentPlaceSorting); + searchFiltersView.Toggle(currentPlaceFilter); + } + + public void Dispose() + { + searchCancellationToken.SafeCancelAndDispose(); + view.inputField.onSelect.RemoveAllListeners(); + view.inputField.onValueChanged.RemoveAllListeners(); + view.inputField.onSubmit.RemoveAllListeners(); + view.clearSearchButton.onClick.RemoveAllListeners(); + } + + public void ToggleClearButton(bool isActive) + { + view.clearSearchButton.gameObject.SetActive(isActive); + } + + public void SetInputFieldCategory(string? category) + { + view.clearSearchButton.gameObject.SetActive(!string.IsNullOrEmpty(category) || !string.IsNullOrEmpty(currentSearchText)); + view.inputFieldCategoryImage.gameObject.SetActive(!string.IsNullOrEmpty(category)); + + if (string.IsNullOrEmpty(category)) + return; + + if(Enum.TryParse(category, true, out CategoriesEnum categoryEnum)) + view.inputFieldCategoryImage.sprite = categoryMappingSO.GetCategoryImage(categoryEnum); + } + + public void SetInputText(string text) + { + view.inputField.SetTextWithoutNotify(text); + } + + public void ClearInput() + { + view.inputField.SetTextWithoutNotify(string.Empty); + view.inputFieldCategoryImage.gameObject.SetActive(false); + view.clearSearchButton.gameObject.SetActive(false); + view.BackButton.gameObject.SetActive(false); + + currentCategory = string.Empty; + currentSearchText = string.Empty; + TogglePanel?.Invoke(false); + Interactable = true; + navmapBus.ClearFilter(); + navmapBus.ClearPlacesFromMap(); + if (view.inputField.isFocused) + RestoreInput(); + } + + public void EnableBack() + { + view.inputFieldCategoryImage.gameObject.SetActive(false); + view.BackButton.gameObject.SetActive(true); + view.SearchIcon.SetActive(false); + } + + public void DisableBack() + { + view.inputFieldCategoryImage.gameObject.SetActive(false); + view.BackButton.gameObject.SetActive(false); + view.SearchIcon.SetActive(true); + } + + public void UpdateFilterAndSorting(NavmapSearchPlaceFilter filter, NavmapSearchPlaceSorting sorting) + { + navmapBus.ClearPlacesFromMap(); + currentPlaceFilter = filter; + searchFiltersView.Toggle(currentPlaceFilter); + + currentPlaceSorting = sorting; + searchFiltersView.Toggle(currentPlaceSorting); + } + + private void OnBackClicked() + { + backCancellationToken = backCancellationToken.SafeRestart(); + navmapBus.GoBackAsync(backCancellationToken.Token).Forget(); + } + + private void OnInputValueChanged(string searchText) + { + currentCategory = string.Empty; + view.clearSearchButton.gameObject.SetActive(!string.IsNullOrEmpty(searchText)); + currentSearchText = searchText; + } + + private void OnSubmitSearch(string searchText) + { + searchCancellationToken = searchCancellationToken.SafeRestart(); + SearchAsync(searchCancellationToken.Token) + .Forget(); + + async UniTaskVoid SearchAsync(CancellationToken ct) + { + UpdateFilterAndSorting(NavmapSearchPlaceFilter.All, currentPlaceSorting); + + TogglePanel?.Invoke(!string.IsNullOrEmpty(searchText)); + await navmapBus.SearchForPlaceAsync(INavmapBus.SearchPlaceParams.CreateWithDefaultParams( + page: 0, + filter: currentPlaceFilter, + sorting: currentPlaceSorting, + text: currentSearchText), ct) + .SuppressCancellationThrow(); + } + } + + private void OnSearchBarSelected(bool isSelected) + { + if (isSelected) + DisableShortcutsInput(); + else + RestoreInput(); + } + + private void DisableShortcutsInput() => + inputBlock.Disable(InputMapComponent.Kind.Shortcuts, InputMapComponent.Kind.InWorldCamera); + + private void RestoreInput() => + inputBlock.Enable(InputMapComponent.Kind.Shortcuts, InputMapComponent.Kind.InWorldCamera); + + private void Search(NavmapSearchPlaceSorting sorting) + { + UpdateFilterAndSorting(currentPlaceFilter, sorting); + + searchCancellationToken = searchCancellationToken.SafeRestart(); + + navmapBus.SearchForPlaceAsync(INavmapBus.SearchPlaceParams.CreateWithDefaultParams( + page: 0, + text: currentSearchText, + filter: currentPlaceFilter, + sorting: sorting, + category: currentCategory), searchCancellationToken.Token) + .Forget(); + } + + private void SearchByCategory(string? category) + { + UpdateFilterAndSorting(category is "Favorites" ? NavmapSearchPlaceFilter.Favorites : NavmapSearchPlaceFilter.All, currentPlaceSorting); + + if (string.IsNullOrEmpty(category)) + { + ClearInput(); + return; + } + + TogglePanel?.Invoke(true); + currentSearchText = string.Empty; + currentCategory = category; + searchCancellationToken = searchCancellationToken.SafeRestart(); + navmapBus.SearchForPlaceAsync(INavmapBus.SearchPlaceParams.CreateWithDefaultParams( + page: 0, + filter: currentPlaceFilter, + sorting: currentPlaceSorting, + category: category), searchCancellationToken.Token) + .Forget(); + } + } +} diff --git a/Explorer/Assets/DCL/Navmap/PlaceInfoPanelController.cs b/Explorer/Assets/DCL/Navmap/PlaceInfoPanelController.cs index c9fb9a69698..3279a6fd2cd 100644 --- a/Explorer/Assets/DCL/Navmap/PlaceInfoPanelController.cs +++ b/Explorer/Assets/DCL/Navmap/PlaceInfoPanelController.cs @@ -118,17 +118,17 @@ public PlaceInfoPanelController(PlaceInfoPanelView view, view.EventsTabButton.onClick.AddListener(() => { - if (Toggle(Section.EVENTS)) + if (Toggle(Section.Events)) FetchAndShowEventsOfThePlace(); }); view.PhotosTabButton.onClick.AddListener(() => { - if (Toggle(Section.PHOTOS)) + if (Toggle(Section.Photos)) FetchPhotos(); }); - view.OverviewTabButton.onClick.AddListener(() => Toggle(Section.OVERVIEW)); + view.OverviewTabButton.onClick.AddListener(() => Toggle(Section.Overview)); dislikeButton = new MultiStateButtonController(view.DislikeButton, true); dislikeButton.OnButtonClicked += OnDislikeButtonClick; @@ -254,18 +254,18 @@ public bool Toggle(Section section) if (currentSection == section) return false; - if (section != Section.PHOTOS) + if (section != Section.Photos) { showPlaceGalleryCancellationToken?.SafeCancelAndDispose(); view.SetPhotoTabText(-1); } - view.EventsTabContainer.SetActive(section == Section.EVENTS); - view.EventsTabSelected.SetActive(section == Section.EVENTS); - view.OverviewTabContainer.SetActive(section == Section.OVERVIEW); - view.OverviewTabSelected.SetActive(section == Section.OVERVIEW); - view.PhotosTabContainer.SetActive(section == Section.PHOTOS); - view.PhotosTabSelected.SetActive(section == Section.PHOTOS); + view.EventsTabContainer.SetActive(section == Section.Events); + view.EventsTabSelected.SetActive(section == Section.Events); + view.OverviewTabContainer.SetActive(section == Section.Overview); + view.OverviewTabSelected.SetActive(section == Section.Overview); + view.PhotosTabContainer.SetActive(section == Section.Photos); + view.PhotosTabSelected.SetActive(section == Section.Photos); currentSection = section; return true; @@ -369,7 +369,7 @@ private void JumpIn() chatMessagesBus .SendWithUtcNowTimestamp(ChatChannel.NEARBY_CHANNEL, $"/{ChatCommandsUtils.COMMAND_GOTO} {place.world_name}", - ChatMessageOrigin.JUMP_IN); + ChatMessageOrigin.JumpIn); return; } @@ -379,7 +379,7 @@ private void JumpIn() chatMessagesBus .SendWithUtcNowTimestamp(ChatChannel.NEARBY_CHANNEL, $"/{ChatCommandsUtils.COMMAND_GOTO} {destinationParcel?.x},{destinationParcel?.y}", - ChatMessageOrigin.JUMP_IN); + ChatMessageOrigin.JumpIn); } private void Share() @@ -539,9 +539,9 @@ private void UpdatePhotosTabText(int count) => public enum Section { - OVERVIEW, - PHOTOS, - EVENTS, + Overview, + Photos, + Events, } } } diff --git a/Explorer/Assets/DCL/Navmap/PlacesAndEventsPanelController.cs b/Explorer/Assets/DCL/Navmap/PlacesAndEventsPanelController.cs index 830e91106c1..340a41ce3f9 100644 --- a/Explorer/Assets/DCL/Navmap/PlacesAndEventsPanelController.cs +++ b/Explorer/Assets/DCL/Navmap/PlacesAndEventsPanelController.cs @@ -76,17 +76,17 @@ public void Toggle(Section section) { switch (section) { - case Section.SEARCH: + case Section.Search: searchResultController.Show(); placeInfoPanelController.Hide(); eventInfoPanelController.Hide(); break; - case Section.PLACE: + case Section.Place: searchResultController.Hide(); placeInfoPanelController.Show(); eventInfoPanelController.Hide(); break; - case Section.EVENT: + case Section.Event: searchResultController.Hide(); placeInfoPanelController.Hide(); eventInfoPanelController.Show(); @@ -141,9 +141,9 @@ private void DisableMapZoom() => public enum Section { - SEARCH, - PLACE, - EVENT, + Search, + Place, + Event, } } } diff --git a/Explorer/Assets/DCL/Navmap/SearchForPlaceAndShowResultsCommand.cs b/Explorer/Assets/DCL/Navmap/SearchForPlaceAndShowResultsCommand.cs index ea09c97c577..1aa1d8b1a70 100644 --- a/Explorer/Assets/DCL/Navmap/SearchForPlaceAndShowResultsCommand.cs +++ b/Explorer/Assets/DCL/Navmap/SearchForPlaceAndShowResultsCommand.cs @@ -40,7 +40,7 @@ public SearchForPlaceAndShowResultsCommand( public async UniTask ExecuteAsync(CancellationToken ct) { - placesAndEventsPanelController.Toggle(PlacesAndEventsPanelController.Section.SEARCH); + placesAndEventsPanelController.Toggle(PlacesAndEventsPanelController.Section.Search); searchResultPanelController.ClearResults(); searchResultPanelController.SetLoadingState(); searchBarController.SetInputText((string.IsNullOrEmpty(@params.text) ? @params.category : @params.text) ?? string.Empty); diff --git a/Explorer/Assets/DCL/Navmap/ShowEventInfoCommand.cs b/Explorer/Assets/DCL/Navmap/ShowEventInfoCommand.cs index 2f0f51499ad..a5533b1d8b7 100644 --- a/Explorer/Assets/DCL/Navmap/ShowEventInfoCommand.cs +++ b/Explorer/Assets/DCL/Navmap/ShowEventInfoCommand.cs @@ -37,7 +37,7 @@ public void Dispose() public async UniTask ExecuteAsync(CancellationToken ct) { - placesAndEventsPanelController.Toggle(PlacesAndEventsPanelController.Section.EVENT); + placesAndEventsPanelController.Toggle(PlacesAndEventsPanelController.Section.Event); placesAndEventsPanelController.Expand(); placeInfo ??= await placesAPIService.GetPlaceAsync(new Vector2Int(@event.coordinates[0], @event.coordinates[1]), ct, true) ?? new PlacesData.PlaceInfo(new Vector2Int(@event.coordinates[0], @event.coordinates[1])); diff --git a/Explorer/Assets/DCL/Navmap/ShowPlaceInfoCommand.cs b/Explorer/Assets/DCL/Navmap/ShowPlaceInfoCommand.cs index f4204f2529a..340d6f92d2c 100644 --- a/Explorer/Assets/DCL/Navmap/ShowPlaceInfoCommand.cs +++ b/Explorer/Assets/DCL/Navmap/ShowPlaceInfoCommand.cs @@ -35,12 +35,12 @@ public void Dispose() public async UniTask ExecuteAsync(AdditionalParams? additionalParams, CancellationToken ct) { - placesAndEventsPanelController.Toggle(PlacesAndEventsPanelController.Section.PLACE); + placesAndEventsPanelController.Toggle(PlacesAndEventsPanelController.Section.Place); placesAndEventsPanelController.Expand(); placeInfoPanelController.Set(placeInfo); placeInfoPanelController.SetOriginParcel(additionalParams?.OriginalParcel); - placeInfoPanelController.Toggle(PlaceInfoPanelController.Section.OVERVIEW); + placeInfoPanelController.Toggle(PlaceInfoPanelController.Section.Overview); placeInfoPanelController.HideLiveEvent(); searchBarController.ToggleClearButton(true); searchBarController.SetInputText(placeInfo.title); diff --git a/Explorer/Assets/DCL/NetworkDefinitions/Browser/DecentralandUrlsSource.cs b/Explorer/Assets/DCL/NetworkDefinitions/Browser/DecentralandUrlsSource.cs index cf7f3af870e..cd0b2f3327b 100644 --- a/Explorer/Assets/DCL/NetworkDefinitions/Browser/DecentralandUrlsSource.cs +++ b/Explorer/Assets/DCL/NetworkDefinitions/Browser/DecentralandUrlsSource.cs @@ -18,17 +18,17 @@ protected enum CacheBehaviour /// /// URL is static and can be safely cached /// - STATIC = 0, + Static = 0, /// /// URL should be invalidated upon realm change /// - REALM_DEPENDENT = 1, + RealmDependent = 1, /// /// URL can't be cached if FF are not yet configured /// - FEATURE_FLAGS_DEPENDENT = 2, + FeatureFlagsDependent = 2, } protected const string ENV = "{ENV}"; @@ -143,10 +143,10 @@ public string Url(DecentralandUrl decentralandUrl) switch (urlData.Caching) { - case CacheBehaviour.REALM_DEPENDENT when !realmData.Configured: + case CacheBehaviour.RealmDependent when !realmData.Configured: return REALM_DEPENDENT; - case CacheBehaviour.FEATURE_FLAGS_DEPENDENT when FeatureFlagsConfiguration.Instance.IsEmpty: + case CacheBehaviour.FeatureFlagsDependent when FeatureFlagsConfiguration.Instance.IsEmpty: return urlData.Url ?? FEATURE_FLAG_DEPENDENT; default: @@ -177,7 +177,7 @@ private void ResetRealmDependentUrls(RealmKind realmKind) { using PooledObject> _ = ListPool.Get(out List? realmDependentCachedUrls); - realmDependentCachedUrls.AddRange(cache.Where(kvp => kvp.Value.Caching == CacheBehaviour.REALM_DEPENDENT).Select(kvp => kvp.Key)); + realmDependentCachedUrls.AddRange(cache.Where(kvp => kvp.Value.Caching == CacheBehaviour.RealmDependent).Select(kvp => kvp.Key)); foreach (DecentralandUrl url in realmDependentCachedUrls) cache.Remove(url); @@ -188,27 +188,27 @@ private string ResolveGatekeeperBaseUrl(string defaultBaseUrl) => /// /// The "--optimized-assets-url" arg or the flag variant payload override the base url, otherwise - /// https://abcdn.decentraland.{ENV}. FEATURE_FLAGS_DEPENDENT means it is re-resolved (not cached) until flags load. + /// https://abcdn.decentraland.{ENV}. FeatureFlagsDependent means it is re-resolved (not cached) until flags load. /// private UrlData ResolveOptimizedAssetsUrl(string dedicatedHostUrl) { if (optimizedAssetsBaseOverride is { Length: > 0 }) - return new UrlData(CacheBehaviour.FEATURE_FLAGS_DEPENDENT, optimizedAssetsBaseOverride); + return new UrlData(CacheBehaviour.FeatureFlagsDependent, optimizedAssetsBaseOverride); FeatureFlagsConfiguration featureFlags = FeatureFlagsConfiguration.Instance; if (featureFlags.IsEmpty) return isTodayEnvironment - ? dedicatedHostUrl // STATIC — pinned on construction before the domain switches to org - : new UrlData(CacheBehaviour.FEATURE_FLAGS_DEPENDENT, dedicatedHostUrl.Replace(ENV, decentralandDomain)); + ? dedicatedHostUrl // Static — pinned on construction before the domain switches to org + : new UrlData(CacheBehaviour.FeatureFlagsDependent, dedicatedHostUrl.Replace(ENV, decentralandDomain)); if (!featureFlags.IsEnabled(FeatureFlagsStrings.OPTIMIZED_ASSETS)) return dedicatedHostUrl; if (featureFlags.TryGetTextPayload(FeatureFlagsStrings.OPTIMIZED_ASSETS, FeatureFlagsStrings.OPTIMIZED_ASSETS_BASE_URL_VARIANT, out string? customBaseUrl) && customBaseUrl is { Length: > 0 }) - return new UrlData(CacheBehaviour.FEATURE_FLAGS_DEPENDENT, customBaseUrl.TrimEnd('/')); + return new UrlData(CacheBehaviour.FeatureFlagsDependent, customBaseUrl.TrimEnd('/')); - return new UrlData(CacheBehaviour.FEATURE_FLAGS_DEPENDENT, $"https://abcdn.decentraland.{ENV}"); + return new UrlData(CacheBehaviour.FeatureFlagsDependent, $"https://abcdn.decentraland.{ENV}"); } /// Registry-composed endpoints inherit the registry base's caching so a flag-driven base is not cached early. @@ -343,10 +343,10 @@ public UrlData(CacheBehaviour caching, string? url) } public static UrlData RealmDependent(string? url) => - new (CacheBehaviour.REALM_DEPENDENT, url); + new (CacheBehaviour.RealmDependent, url); public static implicit operator UrlData(string rawUrl) => - new (CacheBehaviour.STATIC, rawUrl); + new (CacheBehaviour.Static, rawUrl); public override string ToString() => Url ?? ""; diff --git a/Explorer/Assets/DCL/NetworkDefinitions/Browser/GatewayUrlsSource.cs b/Explorer/Assets/DCL/NetworkDefinitions/Browser/GatewayUrlsSource.cs index 9fb2871867b..0d53f311d6c 100644 --- a/Explorer/Assets/DCL/NetworkDefinitions/Browser/GatewayUrlsSource.cs +++ b/Explorer/Assets/DCL/NetworkDefinitions/Browser/GatewayUrlsSource.cs @@ -145,15 +145,15 @@ protected override UrlData RawUrl(DecentralandUrl decentralandUrl) if (!enabled || serviceUrl.Url == null || !SUPPORTED_URLS.Contains(decentralandUrl)) return serviceUrl; - // FEATURE_FLAGS_DEPENDENT from base.RawUrl() signals a consolidated / optimized-assets URL that + // FeatureFlagsDependent from base.RawUrl() signals a consolidated / optimized-assets URL that // must NOT be gateway-rewritten (it resolves to its own origin). If a future URL legitimately - // needs FEATURE_FLAGS_DEPENDENT caching AND gateway routing, give UrlData a dedicated skipGateway + // needs FeatureFlagsDependent caching AND gateway routing, give UrlData a dedicated skipGateway // field instead of widening this guard. Custom hosts also pass through untouched. - if (serviceUrl.Caching == CacheBehaviour.FEATURE_FLAGS_DEPENDENT || !IsGatewayTransformable(serviceUrl.Url)) + if (serviceUrl.Caching == CacheBehaviour.FeatureFlagsDependent || !IsGatewayTransformable(serviceUrl.Url)) return serviceUrl; // it is called only once and then cached in the base class - return new UrlData(CacheBehaviour.FEATURE_FLAGS_DEPENDENT, TransformToGateway(serviceUrl.Url)); + return new UrlData(CacheBehaviour.FeatureFlagsDependent, TransformToGateway(serviceUrl.Url)); } /// diff --git a/Explorer/Assets/DCL/NftPrompt/NftPromptController.cs b/Explorer/Assets/DCL/NftPrompt/NftPromptController.cs index c5896016b61..3a1f287358a 100644 --- a/Explorer/Assets/DCL/NftPrompt/NftPromptController.cs +++ b/Explorer/Assets/DCL/NftPrompt/NftPromptController.cs @@ -19,7 +19,7 @@ public partial class NftPromptController : ControllerBase CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; private readonly UnityAppWebBrowser webBrowser; private readonly ICursor cursor; diff --git a/Explorer/Assets/DCL/Notifications/NewNotification/NewNotificationController.cs b/Explorer/Assets/DCL/Notifications/NewNotification/NewNotificationController.cs index 9f3e22cd47e..b52a7559309 100644 --- a/Explorer/Assets/DCL/Notifications/NewNotification/NewNotificationController.cs +++ b/Explorer/Assets/DCL/Notifications/NewNotification/NewNotificationController.cs @@ -40,7 +40,7 @@ public class NewNotificationController : ControllerBase private ImageController communityThumbnailImageController; private ImageController giftToastImageController; private CancellationTokenSource cts; - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.OVERLAY; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Overlay; public NewNotificationController( ViewFactoryMethod viewFactory, @@ -75,7 +75,7 @@ protected override void OnViewInstantiated() giftToastImageController = imageControllerProvider.Create(viewInstance.GiftToastView.NotificationImage); viewInstance.GiftToastView.NotificationClicked += ClickedNotification; - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.COMMUNITY_VOICE_CHAT)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.CommunityVoiceChat)) { communityThumbnailImageController = imageControllerProvider.Create(viewInstance.CommunityVoiceChatNotificationView.NotificationImage); viewInstance.CommunityVoiceChatNotificationView.NotificationClicked += ClickedNotification; @@ -126,7 +126,7 @@ private async UniTaskVoid DisplayNewNotificationAsync() await ProcessArrivedNotificationAsync(notification); break; case NotificationType.COMMUNITY_VOICE_CHAT_STARTED: - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.COMMUNITY_VOICE_CHAT)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.CommunityVoiceChat)) await ProcessCommunityVoiceChatStartedNotificationAsync(notification); break; @@ -248,7 +248,7 @@ private async UniTask ProcessTipReceivedNotificationAsync(INotification notifica if (!tipReceivedNotification.SenderProfile.HasValue) { - Profile.CompactInfo? profile = await profileRepository.GetCompactAsync(tipReceivedNotification.Metadata.SenderAddress, CancellationToken.None, batchBehaviour: IProfileRepository.FetchBehaviour.ENFORCE_SINGLE_GET); + Profile.CompactInfo? profile = await profileRepository.GetCompactAsync(tipReceivedNotification.Metadata.SenderAddress, CancellationToken.None, batchBehaviour: IProfileRepository.FetchBehaviour.EnforceSingleGet); tipReceivedNotification.SenderProfile = profile; } diff --git a/Explorer/Assets/DCL/Notifications/NotificationsMenu/NotificationsPanelController.cs b/Explorer/Assets/DCL/Notifications/NotificationsMenu/NotificationsPanelController.cs index f9ebc21e943..db722aa1d6d 100644 --- a/Explorer/Assets/DCL/Notifications/NotificationsMenu/NotificationsPanelController.cs +++ b/Explorer/Assets/DCL/Notifications/NotificationsMenu/NotificationsPanelController.cs @@ -105,7 +105,7 @@ protected override void OnBeforeViewShow() InitialNotificationRequestAsync(lifeCycleCts.Token).SuppressCancellationThrow().Forget(); } - public override CanvasOrdering.SortingLayer Layer { get; } = CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer { get; } = CanvasOrdering.SortingLayer.Popup; protected override async UniTask WaitForCloseIntentAsync(CancellationToken ct) { diff --git a/Explorer/Assets/DCL/Notifications/NotificationsRequestController.cs b/Explorer/Assets/DCL/Notifications/NotificationsRequestController.cs index 9042c0bf528..6a8c54ad49d 100644 --- a/Explorer/Assets/DCL/Notifications/NotificationsRequestController.cs +++ b/Explorer/Assets/DCL/Notifications/NotificationsRequestController.cs @@ -47,7 +47,7 @@ IWeb3IdentityCache web3IdentityCache serializerSettings = new () { Converters = new JsonConverter[] { - new NotificationJsonDtoConverter(FeaturesRegistry.Instance.IsEnabled(FeatureId.FRIENDS)) + new NotificationJsonDtoConverter(FeaturesRegistry.Instance.IsEnabled(FeatureId.Friends)) } }; lastPolledTimestamp = DateTime.UtcNow.UnixTimeAsMilliseconds(); diff --git a/Explorer/Assets/DCL/Notifications/Serialization/NotificationJsonDtoConverter.cs b/Explorer/Assets/DCL/Notifications/Serialization/NotificationJsonDtoConverter.cs index 3cb3c53a167..3a49cd3ce0f 100644 --- a/Explorer/Assets/DCL/Notifications/Serialization/NotificationJsonDtoConverter.cs +++ b/Explorer/Assets/DCL/Notifications/Serialization/NotificationJsonDtoConverter.cs @@ -116,7 +116,7 @@ public override void WriteJson(JsonWriter writer, List? value, Js COMMUNITY_INVITE_RECEIVED_TYPE => new CommunityUserInvitedNotification(), COMMUNITY_REQUEST_TO_JOIN_ACCEPTED_TYPE => new CommunityUserRequestToJoinAcceptedNotification(), COMMUNITY_DELETED_CONTENT_VIOLATION_TYPE => new CommunityDeletedContenViolationNotification(), - COMMUNITY_POST_ADDED_TYPE => FeaturesRegistry.Instance.IsEnabled(FeatureId.COMMUNITIES_ANNOUNCEMENTS) ? new CommunityPostAddedNotification() : null, + COMMUNITY_POST_ADDED_TYPE => FeaturesRegistry.Instance.IsEnabled(FeatureId.CommunitiesAnnouncements) ? new CommunityPostAddedNotification() : null, COMMUNITY_OWNERSHIP_TRANSFERRED_TYPE => new CommunityOwnershipTransferredNotification(), USER_BANNED_FROM_SCENE_TYPE => new UserBannedFromSceneNotification(), USER_UNBANNED_FROM_SCENE_TYPE => new UserUnbannedFromSceneNotification(), diff --git a/Explorer/Assets/DCL/Passport/Configuration/PassportAdditionalFieldsConfigurationSO.cs b/Explorer/Assets/DCL/Passport/Configuration/PassportAdditionalFieldsConfigurationSO.cs index 9d5ef8aeb0f..2d7aa318a02 100644 --- a/Explorer/Assets/DCL/Passport/Configuration/PassportAdditionalFieldsConfigurationSO.cs +++ b/Explorer/Assets/DCL/Passport/Configuration/PassportAdditionalFieldsConfigurationSO.cs @@ -23,16 +23,16 @@ public class AdditionalFieldConfiguration public enum AdditionalFieldType { - GENDER, - COUNTRY, - BIRTH_DATE, - PRONOUNS, - RELATIONSHIP_STATUS, - SEXUAL_ORIENTATION, - LANGUAGE, - PROFESSION, - EMPLOYMENT_STATUS, - HOBBIES, - REAL_NAME, + Gender, + Country, + BirthDate, + Pronouns, + RelationshipStatus, + SexualOrientation, + Language, + Profession, + EmploymentStatus, + Hobbies, + RealName, } } diff --git a/Explorer/Assets/DCL/Passport/Modules/UserAdditionalFieldsPassportSubModuleController.cs b/Explorer/Assets/DCL/Passport/Modules/UserAdditionalFieldsPassportSubModuleController.cs index a45f4b9546b..29bfcd3c65e 100644 --- a/Explorer/Assets/DCL/Passport/Modules/UserAdditionalFieldsPassportSubModuleController.cs +++ b/Explorer/Assets/DCL/Passport/Modules/UserAdditionalFieldsPassportSubModuleController.cs @@ -89,91 +89,91 @@ private void LoadAdditionalFields() { if (!string.IsNullOrEmpty(currentProfile.Gender)) { - AddAdditionalField(AdditionalFieldType.GENDER, currentProfile.Gender, false); - AddAdditionalField(AdditionalFieldType.GENDER, currentProfile.Gender, true); + AddAdditionalField(AdditionalFieldType.Gender, currentProfile.Gender, false); + AddAdditionalField(AdditionalFieldType.Gender, currentProfile.Gender, true); } else - AddAdditionalField(AdditionalFieldType.GENDER, string.Empty, true); + AddAdditionalField(AdditionalFieldType.Gender, string.Empty, true); if (!string.IsNullOrEmpty(currentProfile.Country)) { - AddAdditionalField(AdditionalFieldType.COUNTRY, currentProfile.Country, false); - AddAdditionalField(AdditionalFieldType.COUNTRY, currentProfile.Country, true); + AddAdditionalField(AdditionalFieldType.Country, currentProfile.Country, false); + AddAdditionalField(AdditionalFieldType.Country, currentProfile.Country, true); } else - AddAdditionalField(AdditionalFieldType.COUNTRY, string.Empty, true); + AddAdditionalField(AdditionalFieldType.Country, string.Empty, true); if (currentProfile.Birthdate != null && currentProfile.Birthdate.Value != new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)) { - AddAdditionalField(AdditionalFieldType.BIRTH_DATE, currentProfile.Birthdate.Value.ToString("dd/MM/yyyy"), false); - AddAdditionalField(AdditionalFieldType.BIRTH_DATE, currentProfile.Birthdate.Value.ToString("dd/MM/yyyy"), true); + AddAdditionalField(AdditionalFieldType.BirthDate, currentProfile.Birthdate.Value.ToString("dd/MM/yyyy"), false); + AddAdditionalField(AdditionalFieldType.BirthDate, currentProfile.Birthdate.Value.ToString("dd/MM/yyyy"), true); } else - AddAdditionalField(AdditionalFieldType.BIRTH_DATE, string.Empty, true); + AddAdditionalField(AdditionalFieldType.BirthDate, string.Empty, true); if (!string.IsNullOrEmpty(currentProfile.Pronouns)) { - AddAdditionalField(AdditionalFieldType.PRONOUNS, currentProfile.Pronouns, false); - AddAdditionalField(AdditionalFieldType.PRONOUNS, currentProfile.Pronouns, true); + AddAdditionalField(AdditionalFieldType.Pronouns, currentProfile.Pronouns, false); + AddAdditionalField(AdditionalFieldType.Pronouns, currentProfile.Pronouns, true); } else - AddAdditionalField(AdditionalFieldType.PRONOUNS, string.Empty, true); + AddAdditionalField(AdditionalFieldType.Pronouns, string.Empty, true); if (!string.IsNullOrEmpty(currentProfile.RelationshipStatus)) { - AddAdditionalField(AdditionalFieldType.RELATIONSHIP_STATUS, currentProfile.RelationshipStatus, false); - AddAdditionalField(AdditionalFieldType.RELATIONSHIP_STATUS, currentProfile.RelationshipStatus, true); + AddAdditionalField(AdditionalFieldType.RelationshipStatus, currentProfile.RelationshipStatus, false); + AddAdditionalField(AdditionalFieldType.RelationshipStatus, currentProfile.RelationshipStatus, true); } else - AddAdditionalField(AdditionalFieldType.RELATIONSHIP_STATUS, string.Empty, true); + AddAdditionalField(AdditionalFieldType.RelationshipStatus, string.Empty, true); if (!string.IsNullOrEmpty(currentProfile.SexualOrientation)) { - AddAdditionalField(AdditionalFieldType.SEXUAL_ORIENTATION, currentProfile.SexualOrientation, false); - AddAdditionalField(AdditionalFieldType.SEXUAL_ORIENTATION, currentProfile.SexualOrientation, true); + AddAdditionalField(AdditionalFieldType.SexualOrientation, currentProfile.SexualOrientation, false); + AddAdditionalField(AdditionalFieldType.SexualOrientation, currentProfile.SexualOrientation, true); } else - AddAdditionalField(AdditionalFieldType.SEXUAL_ORIENTATION, string.Empty, true); + AddAdditionalField(AdditionalFieldType.SexualOrientation, string.Empty, true); if (!string.IsNullOrEmpty(currentProfile.Language)) { - AddAdditionalField(AdditionalFieldType.LANGUAGE, currentProfile.Language, false); - AddAdditionalField(AdditionalFieldType.LANGUAGE, currentProfile.Language, true); + AddAdditionalField(AdditionalFieldType.Language, currentProfile.Language, false); + AddAdditionalField(AdditionalFieldType.Language, currentProfile.Language, true); } else - AddAdditionalField(AdditionalFieldType.LANGUAGE, string.Empty, true); + AddAdditionalField(AdditionalFieldType.Language, string.Empty, true); if (!string.IsNullOrEmpty(currentProfile.Profession)) { - AddAdditionalField(AdditionalFieldType.PROFESSION, currentProfile.Profession, false); - AddAdditionalField(AdditionalFieldType.PROFESSION, currentProfile.Profession, true); + AddAdditionalField(AdditionalFieldType.Profession, currentProfile.Profession, false); + AddAdditionalField(AdditionalFieldType.Profession, currentProfile.Profession, true); } else - AddAdditionalField(AdditionalFieldType.PROFESSION, string.Empty, true); + AddAdditionalField(AdditionalFieldType.Profession, string.Empty, true); if (!string.IsNullOrEmpty(currentProfile.EmploymentStatus)) { - AddAdditionalField(AdditionalFieldType.EMPLOYMENT_STATUS, currentProfile.EmploymentStatus, false); - AddAdditionalField(AdditionalFieldType.EMPLOYMENT_STATUS, currentProfile.EmploymentStatus, true); + AddAdditionalField(AdditionalFieldType.EmploymentStatus, currentProfile.EmploymentStatus, false); + AddAdditionalField(AdditionalFieldType.EmploymentStatus, currentProfile.EmploymentStatus, true); } else - AddAdditionalField(AdditionalFieldType.EMPLOYMENT_STATUS, string.Empty, true); + AddAdditionalField(AdditionalFieldType.EmploymentStatus, string.Empty, true); if (!string.IsNullOrEmpty(currentProfile.Hobbies)) { - AddAdditionalField(AdditionalFieldType.HOBBIES, currentProfile.Hobbies, false); - AddAdditionalField(AdditionalFieldType.HOBBIES, currentProfile.Hobbies, true); + AddAdditionalField(AdditionalFieldType.Hobbies, currentProfile.Hobbies, false); + AddAdditionalField(AdditionalFieldType.Hobbies, currentProfile.Hobbies, true); } else - AddAdditionalField(AdditionalFieldType.HOBBIES, string.Empty, true); + AddAdditionalField(AdditionalFieldType.Hobbies, string.Empty, true); if (!string.IsNullOrEmpty(currentProfile.RealName)) { - AddAdditionalField(AdditionalFieldType.REAL_NAME, currentProfile.RealName, false); - AddAdditionalField(AdditionalFieldType.REAL_NAME, currentProfile.RealName, true); + AddAdditionalField(AdditionalFieldType.RealName, currentProfile.RealName, false); + AddAdditionalField(AdditionalFieldType.RealName, currentProfile.RealName, true); } else - AddAdditionalField(AdditionalFieldType.REAL_NAME, string.Empty, true); + AddAdditionalField(AdditionalFieldType.RealName, string.Empty, true); view.AdditionalInfoContainer.gameObject.SetActive(instantiatedAdditionalFields.Count > 0); } @@ -189,7 +189,7 @@ private void AddAdditionalField(AdditionalFieldType type, string value, bool isE newAdditionalField.EditionDropdown.options.Clear(); newAdditionalField.EditionDropdown.options.Add(new TMP_Dropdown.OptionData { text = EDITION_DROPDOWN_DEFAULT_OPTION }); newAdditionalField.EditionTextInput.text = string.Empty; - newAdditionalField.EditionTextInputPlaceholder.text = type == AdditionalFieldType.BIRTH_DATE ? EDITION_PLACE_HOLDER_FOR_DATES : EDITION_PLACE_HOLDER; + newAdditionalField.EditionTextInputPlaceholder.text = type == AdditionalFieldType.BirthDate ? EDITION_PLACE_HOLDER_FOR_DATES : EDITION_PLACE_HOLDER; foreach (AdditionalFieldConfiguration additionalFieldConfig in view.AdditionalFieldsConfiguration.additionalFields) { @@ -236,40 +236,40 @@ public void SaveDataIntoProfile(Profile profile) string? valueToSave = !string.IsNullOrEmpty(additionalFieldForEdition.EditionTextInput.text) ? additionalFieldForEdition.EditionTextInput.text : null; switch (additionalFieldForEdition.Type) { - case AdditionalFieldType.GENDER: + case AdditionalFieldType.Gender: profile.Gender = valueToSave; break; - case AdditionalFieldType.COUNTRY: + case AdditionalFieldType.Country: profile.Country = valueToSave; break; - case AdditionalFieldType.BIRTH_DATE: + case AdditionalFieldType.BirthDate: if (valueToSave != null) profile.Birthdate = DateTime.SpecifyKind(DateTime.ParseExact(valueToSave, validInputFormatsForDate, CultureInfo.InvariantCulture, DateTimeStyles.None), DateTimeKind.Utc); else profile.Birthdate = null; break; - case AdditionalFieldType.PRONOUNS: + case AdditionalFieldType.Pronouns: profile.Pronouns = valueToSave; break; - case AdditionalFieldType.RELATIONSHIP_STATUS: + case AdditionalFieldType.RelationshipStatus: profile.RelationshipStatus = valueToSave; break; - case AdditionalFieldType.SEXUAL_ORIENTATION: + case AdditionalFieldType.SexualOrientation: profile.SexualOrientation = valueToSave; break; - case AdditionalFieldType.LANGUAGE: + case AdditionalFieldType.Language: profile.Language = valueToSave; break; - case AdditionalFieldType.PROFESSION: + case AdditionalFieldType.Profession: profile.Profession = valueToSave; break; - case AdditionalFieldType.EMPLOYMENT_STATUS: + case AdditionalFieldType.EmploymentStatus: profile.EmploymentStatus = valueToSave; break; - case AdditionalFieldType.HOBBIES: + case AdditionalFieldType.Hobbies: profile.Hobbies = valueToSave; break; - case AdditionalFieldType.REAL_NAME: + case AdditionalFieldType.RealName: profile.RealName = valueToSave; break; } diff --git a/Explorer/Assets/DCL/Passport/Modules/UserBasicInfoPassportModuleController.cs b/Explorer/Assets/DCL/Passport/Modules/UserBasicInfoPassportModuleController.cs index c6447451e09..0511cd91698 100644 --- a/Explorer/Assets/DCL/Passport/Modules/UserBasicInfoPassportModuleController.cs +++ b/Explorer/Assets/DCL/Passport/Modules/UserBasicInfoPassportModuleController.cs @@ -52,7 +52,7 @@ NameColorPickerController colorPickerController this.nftNamesProvider = nftNamesProvider; this.decentralandUrlsSource = decentralandUrlsSource; this.colorPickerController = colorPickerController; - isNameEditorFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.PROFILE_NAME_EDITOR); + isNameEditorFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.ProfileNameEditor); userNameElementPresenter = new UserNameElementPresenter(view.UserNameElement); walletAddressElementPresenter = new UserWalletAddressElementPresenter(view.UserWalletAddressElement); @@ -103,7 +103,7 @@ private async UniTaskVoid CheckForEditionAvailabilityAsync(CancellationToken ct) view.ClaimNameButton.gameObject.SetActive(false); view.NameColorPickerView.gameObject.SetActive( - FeaturesRegistry.Instance.IsEnabled(FeatureId.NAME_COLOR_CHANGE) && ownProfile.HasClaimedName + FeaturesRegistry.Instance.IsEnabled(FeatureId.NameColorChange) && ownProfile.HasClaimedName ); colorPickerController.SetColor(ownProfile.UserNameColor); diff --git a/Explorer/Assets/DCL/Passport/PassportController.cs b/Explorer/Assets/DCL/Passport/PassportController.cs index b8d728125d4..a91614e11ea 100644 --- a/Explorer/Assets/DCL/Passport/PassportController.cs +++ b/Explorer/Assets/DCL/Passport/PassportController.cs @@ -159,7 +159,7 @@ private enum OpenBadgeSectionOrigin private CancellationTokenSource jumpToFriendLocationCts = new (); private CancellationTokenSource? reportConfirmationDialogCts; - public override CanvasOrdering.SortingLayer Layer { get; } = CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer { get; } = CanvasOrdering.SortingLayer.Popup; public event Action? PassportOpened; public event Action? BadgesSectionOpened; @@ -252,11 +252,11 @@ public PassportController( this.webRequestController = webRequestController; this.marketplaceShopAPIClient = marketplaceShopAPIClient; - isCameraReelFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.CAMERA_REEL); - isFriendsFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.FRIENDS); - isUserBlockingFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.FRIENDS_USER_BLOCKING); - isVoiceCallFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.VOICE_CHAT); - isGiftFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.GIFTING_ENABLED); + isCameraReelFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.CameraReel); + isFriendsFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.Friends); + isUserBlockingFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.FriendsUserBlocking); + isVoiceCallFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.VoiceChat); + isGiftFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.GiftingEnabled); passportProfileInfoController = new PassportProfileInfoController(selfProfile, world, playerEntity); NotificationsBusController.Instance.SubscribeToNotificationTypeReceived(NotificationType.BADGE_GRANTED, OnBadgeNotificationReceived); @@ -318,8 +318,8 @@ protected override void OnViewInstantiated() passportErrorsController, passportProfileInfoController)); - bool isCreditPurchaseEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.CREDITS_WEARABLE_PURCHASE) - && FeaturesRegistry.Instance.IsEnabled(FeatureId.USER_CREDITS); + bool isCreditPurchaseEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.CreditsWearablePurchase) + && FeaturesRegistry.Instance.IsEnabled(FeatureId.UserCredits); var creditPurchaseBuyHandler = new CreditPurchaseBuyHandler(mvcManager, marketplaceShopAPIClient, webBrowser, isCreditPurchaseEnabled); @@ -396,7 +396,7 @@ protected override void OnViewInstantiated() PassportSection passportSection = section.PassportSection; section.ButtonWithState.Button.onClick.AddListener(() => OpenSection(passportSection)); - if (passportSection == PassportSection.PHOTOS) + if (passportSection == PassportSection.Photos) section.ButtonWithState.Button.gameObject.SetActive(isCameraReelFeatureEnabled); } @@ -473,7 +473,7 @@ protected override void OnViewInstantiated() textColor: redColor), false)); - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.REPORT_USER)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.ReportUser)) contextMenu.AddControl(new ButtonContextMenuControlSettings(viewInstance.ReportText, viewInstance.ReportOptionSprite, ReportUserClicked, @@ -523,7 +523,7 @@ protected override void OnViewShow() { currentUserId = inputData.UserId; isOwnProfile = inputData.IsOwnProfile; - alreadyLoadedSections = PassportSection.NONE; + alreadyLoadedSections = PassportSection.None; cursor.Unlock(); if (string.IsNullOrEmpty(inputData.BadgeIdSelected)) @@ -572,7 +572,7 @@ protected override void OnViewClose() foreach (IPassportModuleController module in creationsPassportModules) module.Clear(); - currentSection = PassportSection.NONE; + currentSection = PassportSection.None; contextMenuCloseTask?.TrySetResult(); badge3DPreviewCamera.gameObject.SetActive(false); @@ -654,19 +654,19 @@ private async UniTaskVoid LoadPassportSectionAsync(string userId, PassportSectio // Ensure the view is initialized before fetching the profile to prevent rendering artifacts // that may appear while the profile is still loading - if (sectionToLoad == PassportSection.OVERVIEW) + if (sectionToLoad == PassportSection.Overview) characterPreviewController!.OnBeforeShow(); // Load user profile Profile? profile = await profileRepository.GetAsync(userId, 0, remoteMetadata.GetLambdaDomainOrNull(userId), ct, - batchBehaviour: IProfileRepository.FetchBehaviour.ENFORCE_SINGLE_GET | IProfileRepository.FetchBehaviour.DELAY_UNTIL_RESOLVED); + batchBehaviour: IProfileRepository.FetchBehaviour.EnforceSingleGet | IProfileRepository.FetchBehaviour.DelayUntilResolved); if (profile == null) return; UpdateBackgroundColor(profile.UserNameColor); - if (sectionToLoad == PassportSection.OVERVIEW) + if (sectionToLoad == PassportSection.Overview) { // Load avatar preview characterPreviewController!.Initialize(profile.Avatar, CharacterPreviewUtils.PASSPORT_PREVIEW_POSITION); @@ -711,8 +711,8 @@ private void SetupPassportModules(Profile profile, PassportSection passportSecti List passportModulesToSetup = passportSection switch { - PassportSection.OVERVIEW => overviewPassportModules, - PassportSection.CREATIONS => creationsPassportModules, + PassportSection.Overview => overviewPassportModules, + PassportSection.Creations => creationsPassportModules, _ => badgesPassportModules, }; @@ -726,22 +726,22 @@ private void SetupPassportModules(Profile profile, PassportSection passportSecti } private void OnProfilePublished(Profile profile) => - SetupPassportModules(profile, PassportSection.OVERVIEW); + SetupPassportModules(profile, PassportSection.Overview); private void OpenSection(PassportSection selectedSection) { switch (selectedSection) { - case PassportSection.OVERVIEW: + case PassportSection.Overview: OpenOverviewSection(); break; - case PassportSection.BADGES: + case PassportSection.Badges: OpenBadgesSection(); break; - case PassportSection.PHOTOS: + case PassportSection.Photos: OpenPhotosSection(); break; - case PassportSection.CREATIONS: + case PassportSection.Creations: OpenCreationsSection(); break; } @@ -749,20 +749,20 @@ private void OpenSection(PassportSection selectedSection) private void OpenCreationsSection() { - if (currentSection == PassportSection.CREATIONS) + if (currentSection == PassportSection.Creations) return; characterPreviewLoadingCts = characterPreviewLoadingCts.SafeRestart(); - LoadPassportSectionAsync(currentUserId!, PassportSection.CREATIONS, characterPreviewLoadingCts.Token).Forget(); + LoadPassportSectionAsync(currentUserId!, PassportSection.Creations, characterPreviewLoadingCts.Token).Forget(); - currentSection = PassportSection.CREATIONS; + currentSection = PassportSection.Creations; viewInstance!.OpenSection(currentSection); SetCharacterPreviewVisible(true); } private void OpenPhotosSection() { - if (currentSection == PassportSection.PHOTOS) + if (currentSection == PassportSection.Photos) return; photoLoadingCts = photoLoadingCts.SafeRestart(); @@ -771,7 +771,7 @@ private void OpenPhotosSection() cameraReelGalleryController!.TryEnableContextMenuButton(isOwnProfile); cameraReelGalleryController.ShowWalletGalleryAsync(currentUserId!, photoLoadingCts.Token).Forget(); - currentSection = PassportSection.PHOTOS; + currentSection = PassportSection.Photos; viewInstance!.OpenSection(currentSection); SetCharacterPreviewVisible(true); @@ -779,13 +779,13 @@ private void OpenPhotosSection() private void OpenOverviewSection() { - if (currentSection == PassportSection.OVERVIEW) + if (currentSection == PassportSection.Overview) return; characterPreviewLoadingCts = characterPreviewLoadingCts.SafeRestart(); - LoadPassportSectionAsync(currentUserId!, PassportSection.OVERVIEW, characterPreviewLoadingCts.Token).Forget(); + LoadPassportSectionAsync(currentUserId!, PassportSection.Overview, characterPreviewLoadingCts.Token).Forget(); - currentSection = PassportSection.OVERVIEW; + currentSection = PassportSection.Overview; viewInstance!.OpenSection(currentSection); SetCharacterPreviewVisible(true); @@ -793,13 +793,13 @@ private void OpenOverviewSection() private void OpenBadgesSection(string? badgeIdSelected = null) { - if (currentSection == PassportSection.BADGES) + if (currentSection == PassportSection.Badges) return; characterPreviewLoadingCts = characterPreviewLoadingCts.SafeRestart(); - LoadPassportSectionAsync(currentUserId!, PassportSection.BADGES, characterPreviewLoadingCts.Token, badgeIdSelected).Forget(); + LoadPassportSectionAsync(currentUserId!, PassportSection.Badges, characterPreviewLoadingCts.Token, badgeIdSelected).Forget(); - currentSection = PassportSection.BADGES; + currentSection = PassportSection.Badges; viewInstance!.OpenSection(currentSection); SetCharacterPreviewVisible(false, false); @@ -912,28 +912,28 @@ async UniTaskVoid FetchFriendshipStatusAndShowInteractionAsync(CancellationToken switch (friendshipStatus) { - case FriendshipStatus.NONE: + case FriendshipStatus.None: viewInstance!.AddFriendButton.gameObject.SetActive(true); break; - case FriendshipStatus.FRIEND: + case FriendshipStatus.Friend: viewInstance!.RemoveFriendButton.gameObject.SetActive(true); break; - case FriendshipStatus.REQUEST_SENT: + case FriendshipStatus.RequestSent: viewInstance!.CancelFriendButton.gameObject.SetActive(true); break; - case FriendshipStatus.REQUEST_RECEIVED: + case FriendshipStatus.RequestReceived: viewInstance!.AcceptFriendButton.gameObject.SetActive(true); break; - case FriendshipStatus.BLOCKED: + case FriendshipStatus.Blocked: viewInstance!.UnblockFriendButton.gameObject.SetActive(true); break; } - bool friendOnlineStatus = friendOnlineStatusCache!.GetFriendStatus(inputData.UserId) != OnlineStatus.OFFLINE; + bool friendOnlineStatus = friendOnlineStatusCache!.GetFriendStatus(inputData.UserId) != OnlineStatus.Offline; viewInstance!.JumpInButton.gameObject.SetActive(friendOnlineStatus); //For now this button will not appear if the user is blocked - viewInstance.ChatButton.gameObject.SetActive(friendshipStatus != FriendshipStatus.BLOCKED && friendshipStatus != FriendshipStatus.BLOCKED_BY); + viewInstance.ChatButton.gameObject.SetActive(friendshipStatus != FriendshipStatus.Blocked && friendshipStatus != FriendshipStatus.BlockedBy); await SetupContextMenuAsync(friendshipStatus, ct); } @@ -961,11 +961,11 @@ private async UniTask SetupContextMenuAsync(FriendshipStatus friendshipStatus, C viewInstance!.ContextMenuButton.gameObject.SetActive(true); - contextMenuJumpInButton.Enabled = friendOnlineStatusCache!.GetFriendStatus(inputData.UserId) != OnlineStatus.OFFLINE; - contextMenuBlockUserButton.Enabled = friendshipStatus != FriendshipStatus.BLOCKED && isUserBlockingFeatureEnabled; + contextMenuJumpInButton.Enabled = friendOnlineStatusCache!.GetFriendStatus(inputData.UserId) != OnlineStatus.Offline; + contextMenuBlockUserButton.Enabled = friendshipStatus != FriendshipStatus.Blocked && isUserBlockingFeatureEnabled; contextMenuSeparator.Enabled = contextMenuJumpInButton.Enabled || contextMenuBlockUserButton.Enabled; - userProfileContextMenuControlSettings.SetInitialData(targetProfile.Compact, UserProfileContextMenuControlSettings.FriendshipStatus.DISABLED); + userProfileContextMenuControlSettings.SetInitialData(targetProfile.Compact, UserProfileContextMenuControlSettings.FriendshipStatus.Disabled); } private void GiftUserClicked() @@ -990,7 +990,7 @@ private void BlockUserClicked() async UniTaskVoid BlockUserClickedAsync(CancellationToken ct) { - await mvcManager.ShowAsync(BlockUserPromptController.IssueCommand(new BlockUserPromptParams(new Web3Address(targetProfile!.UserId), targetProfile.Name, BlockUserPromptParams.UserBlockAction.BLOCK)), ct); + await mvcManager.ShowAsync(BlockUserPromptController.IssueCommand(new BlockUserPromptParams(new Web3Address(targetProfile!.UserId), targetProfile.Name, BlockUserPromptParams.UserBlockAction.Block)), ct); ShowFriendshipInteraction(); } @@ -1093,7 +1093,7 @@ private void UnblockUser() async UniTaskVoid UnblockAndThenChangeInteractionStatusAsync(CancellationToken ct) { - await mvcManager.ShowAsync(BlockUserPromptController.IssueCommand(new BlockUserPromptParams(new Web3Address(targetProfile!.UserId), targetProfile.Name, BlockUserPromptParams.UserBlockAction.UNBLOCK)), ct); + await mvcManager.ShowAsync(BlockUserPromptController.IssueCommand(new BlockUserPromptParams(new Web3Address(targetProfile!.UserId), targetProfile.Name, BlockUserPromptParams.UserBlockAction.Unblock)), ct); ShowFriendshipInteraction(); } diff --git a/Explorer/Assets/DCL/Passport/PassportSection.cs b/Explorer/Assets/DCL/Passport/PassportSection.cs index a30f114e697..91271113941 100644 --- a/Explorer/Assets/DCL/Passport/PassportSection.cs +++ b/Explorer/Assets/DCL/Passport/PassportSection.cs @@ -5,10 +5,10 @@ namespace DCL.Passport [Flags] public enum PassportSection { - NONE, - OVERVIEW = 1 << 0, - BADGES = 1 << 1, - PHOTOS = 1 << 2, - CREATIONS = 1 << 3, + None, + Overview = 1 << 0, + Badges = 1 << 1, + Photos = 1 << 2, + Creations = 1 << 3, } } diff --git a/Explorer/Assets/DCL/Passport/PassportView.cs b/Explorer/Assets/DCL/Passport/PassportView.cs index a884fb2c249..21ffe82fb26 100644 --- a/Explorer/Assets/DCL/Passport/PassportView.cs +++ b/Explorer/Assets/DCL/Passport/PassportView.cs @@ -186,9 +186,9 @@ public void OpenSection(PassportSection passportSection) MainScroll.content = section.Panel.transform as RectTransform; } - BadgeInfoModuleView.gameObject.SetActive(passportSection == PassportSection.BADGES); + BadgeInfoModuleView.gameObject.SetActive(passportSection == PassportSection.Badges); - bool isNotPhotos = passportSection != PassportSection.PHOTOS; + bool isNotPhotos = passportSection != PassportSection.Photos; ViewportSoftMask.enabled = isNotPhotos; ViewportMaskGraphic.enabled = isNotPhotos; diff --git a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/AnalyticsConfiguration.cs b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/AnalyticsConfiguration.cs index 380e2f658b0..58f31d6fdd8 100644 --- a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/AnalyticsConfiguration.cs +++ b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/AnalyticsConfiguration.cs @@ -6,9 +6,9 @@ namespace DCL.PerformanceAndDiagnostics.Analytics { public enum AnalyticsMode { - DEBUG_LOG, - SEGMENT, - DISABLED, + DebugLog, + Segment, + Disabled, } [CreateAssetMenu(fileName = "AnalyticsConfiguration", menuName = "DCL/Diagnostics/Analytics Configuration")] @@ -38,7 +38,7 @@ [SerializeField] [HideInInspector] public float PerformanceReportInterval { get; private set; } = 1.0f; [field: SerializeField] - public AnalyticsMode Mode { get; private set; } = AnalyticsMode.SEGMENT; + public AnalyticsMode Mode { get; private set; } = AnalyticsMode.Segment; private Configuration segmentConfiguration; diff --git a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/EventBased/EventsAnalytics.cs b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/EventBased/EventsAnalytics.cs index 3a87723a39b..c4e33e02eda 100644 --- a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/EventBased/EventsAnalytics.cs +++ b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/EventBased/EventsAnalytics.cs @@ -51,7 +51,7 @@ private void OnEventsOpenedFromStartMenu() => private void OnSectionOpen(EventsSection section, DateTime fromDate) { - if (section != EventsSection.EVENTS_BY_DAY) + if (section != EventsSection.EventsByDay) return; analytics.Track(AnalyticsEvents.Events.EVENTS_BY_DAY_OPENED, new JObject { { "date", fromDate.ToString("yyyy-MM-dd") } }); diff --git a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/EventBased/ExplorePanelAnalytics.cs b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/EventBased/ExplorePanelAnalytics.cs index 1029abb3ffb..24b890e49ae 100644 --- a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/EventBased/ExplorePanelAnalytics.cs +++ b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/EventBased/ExplorePanelAnalytics.cs @@ -74,7 +74,7 @@ private void OnChatBubblesVisibilityChanged(ChatBubbleVisibilitySettings visibil { analytics.Track(AnalyticsEvents.Settings.CHAT_BUBBLES_VISIBILITY_CHANGED, new JObject { - { "visibility", visibility == ChatBubbleVisibilitySettings.NONE ? "none" : visibility == ChatBubbleVisibilitySettings.NEARBY_ONLY ? "nearby" : "all"}, + { "visibility", visibility == ChatBubbleVisibilitySettings.None ? "none" : visibility == ChatBubbleVisibilitySettings.NearbyOnly ? "nearby" : "all"}, }); } } diff --git a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/Systems/AnalyticsContainer.cs b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/Systems/AnalyticsContainer.cs index 8d89c8d244c..c95c5d9a29f 100644 --- a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/Systems/AnalyticsContainer.cs +++ b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/Systems/AnalyticsContainer.cs @@ -19,7 +19,7 @@ namespace DCL.PerformanceAndDiagnostics.Analytics /// public class AnalyticsContainer : DCLGlobalContainer { - public bool Enabled => settings.AnalyticsConfig.Mode != AnalyticsMode.DISABLED; + public bool Enabled => settings.AnalyticsConfig.Mode != AnalyticsMode.Disabled; public IAnalyticsController Controller { get; private set; } = null!; @@ -75,9 +75,9 @@ private static IAnalyticsService CreateAnalyticsService(AnalyticsConfiguration a return analyticsConfig.Mode switch { - AnalyticsMode.SEGMENT => CreateSegmentAnalyticsOrFallbackToDebug(analyticsConfig, launcherTraits, token), - AnalyticsMode.DEBUG_LOG => new DebugAnalyticsService(), - AnalyticsMode.DISABLED => throw new InvalidOperationException("Trying to create analytics when it is disabled"), + AnalyticsMode.Segment => CreateSegmentAnalyticsOrFallbackToDebug(analyticsConfig, launcherTraits, token), + AnalyticsMode.DebugLog => new DebugAnalyticsService(), + AnalyticsMode.Disabled => throw new InvalidOperationException("Trying to create analytics when it is disabled"), _ => throw new ArgumentOutOfRangeException(), }; } diff --git a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/AdaptivePerformance/Systems/AdaptPhysicsSystem.cs b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/AdaptivePerformance/Systems/AdaptPhysicsSystem.cs index 0a863b444df..b088b40b5fc 100644 --- a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/AdaptivePerformance/Systems/AdaptPhysicsSystem.cs +++ b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/AdaptivePerformance/Systems/AdaptPhysicsSystem.cs @@ -30,7 +30,7 @@ protected override void Update(float t) { UpdatePhysicsProfiling(); - if (settings.Mode == PhysSimulationMode.ADAPTIVE && loadingStatus.CurrentStage.Value == LoadingStatus.LoadingStage.Completed + if (settings.Mode == PhysSimulationMode.Adaptive && loadingStatus.CurrentStage.Value == LoadingStatus.LoadingStage.Completed && UnityEngine.Time.unscaledTime - lastTimeChanged > settings.changeCooldown && profiler.MainThreadFrameTimes.SamplesAmount > settings.minFrameTimeAmount) { diff --git a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/AdaptivePerformance/Systems/AdaptivePerformancePlugin.cs b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/AdaptivePerformance/Systems/AdaptivePerformancePlugin.cs index 701615122f3..7a7f67c0cf2 100644 --- a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/AdaptivePerformance/Systems/AdaptivePerformancePlugin.cs +++ b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/AdaptivePerformance/Systems/AdaptivePerformancePlugin.cs @@ -27,7 +27,7 @@ public UniTask InitializeAsync(AdaptivePerformanceSettings settings, Cancellatio { physicsSettings = settings.phyiscsSettings; - Physics.simulationMode = physicsSettings.Mode == PhysSimulationMode.MANUAL ? SimulationMode.Script : SimulationMode.FixedUpdate; + Physics.simulationMode = physicsSettings.Mode == PhysSimulationMode.Manual ? SimulationMode.Script : SimulationMode.FixedUpdate; return UniTask.CompletedTask; } diff --git a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/AdaptivePerformance/Systems/AdaptivePhysicsSettings.cs b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/AdaptivePerformance/Systems/AdaptivePhysicsSettings.cs index 67df5344d06..4ce98233ee8 100644 --- a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/AdaptivePerformance/Systems/AdaptivePhysicsSettings.cs +++ b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/AdaptivePerformance/Systems/AdaptivePhysicsSettings.cs @@ -6,9 +6,9 @@ namespace DCL.Optimization.AdaptivePerformance.Systems [Serializable] public enum PhysSimulationMode { - DEFAULT, // [Fixed time step] Unity default approach - Physics.Simulate called in FixedUpdate with fixedDeltaTime (0.02 sec by default) - ADAPTIVE, // [Semi-fixed time step] We adjust fixedDeltaTime to the median frame rate - MANUAL, // [Variable time step] We call Physics.Simulate manually in FixedUpdate with the UnityEngine.Time.deltaTime, ensuring to have only one call per frame + Default, // [Fixed time step] Unity default approach - Physics.Simulate called in FixedUpdate with fixedDeltaTime (0.02 sec by default) + Adaptive, // [Semi-fixed time step] We adjust fixedDeltaTime to the median frame rate + Manual, // [Variable time step] We call Physics.Simulate manually in FixedUpdate with the UnityEngine.Time.deltaTime, ensuring to have only one call per frame } [CreateAssetMenu(fileName = "AdaptivePhysicsSettings", menuName = "DCL/AdaptivePhysicsSettings", order = 0)] @@ -18,7 +18,7 @@ public class AdaptivePhysicsSettings : ScriptableObject "DEFAULT: Uses Unity's default fixed step approach.\n" + "ADAPTIVE: Dynamically adjusts fixedDeltaTime based on the median frame rate.\n" + "MANUAL: Simulates physics manually in each frame.")] - [field: SerializeField] internal PhysSimulationMode Mode = PhysSimulationMode.MANUAL; + [field: SerializeField] internal PhysSimulationMode Mode = PhysSimulationMode.Manual; [field: Header("Fixed DeltaTime Clamp")] [field: Tooltip("The minimum value that UnityEngine.Time.fixedDeltaTime can be clamped to, preventing the simulation from running too frequently.")] diff --git a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/AdaptivePerformance/Systems/UpdatePhysicsSimulationSystem.cs b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/AdaptivePerformance/Systems/UpdatePhysicsSimulationSystem.cs index ca4dadf7b28..16ec7abe797 100644 --- a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/AdaptivePerformance/Systems/UpdatePhysicsSimulationSystem.cs +++ b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/AdaptivePerformance/Systems/UpdatePhysicsSimulationSystem.cs @@ -26,7 +26,7 @@ protected override void Update(float t) { switch (settings.Mode) { - case PhysSimulationMode.MANUAL: + case PhysSimulationMode.Manual: { if (profiler.PhysicsSimulationInFrame == 0) { @@ -36,8 +36,8 @@ protected override void Update(float t) break; } - case PhysSimulationMode.DEFAULT: - case PhysSimulationMode.ADAPTIVE: + case PhysSimulationMode.Default: + case PhysSimulationMode.Adaptive: default: { if (loadingStatus.CurrentStage.Value == LoadingStatus.LoadingStage.Completed) diff --git a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/PerformanceBudgeting/Memory/MemoryBudget.cs b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/PerformanceBudgeting/Memory/MemoryBudget.cs index 85f44749515..a3ca5c91782 100644 --- a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/PerformanceBudgeting/Memory/MemoryBudget.cs +++ b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/PerformanceBudgeting/Memory/MemoryBudget.cs @@ -8,10 +8,10 @@ namespace DCL.Optimization.PerformanceBudgeting { public enum MemoryUsageStatus { - ABUNDANCE, - NORMAL, - WARNING, - FULL, + Abundance, + Normal, + Warning, + Full, } public class MemoryBudget : IMemoryUsageProvider, IPerformanceBudget @@ -31,7 +31,7 @@ public class MemoryBudget : IMemoryUsageProvider, IPerformanceBudget public MemoryBudget(ISystemMemoryCap systemMemoryCap, IBudgetProfiler profiler, IReadOnlyDictionary memoryThreshold) { - SimulatedMemoryUsage = ABUNDANCE; + SimulatedMemoryUsage = Abundance; this.systemMemoryCap = systemMemoryCap; this.profiler = profiler; @@ -48,10 +48,10 @@ private MemoryUsageStatus GetMemoryUsageStatus() cachedStatus = usedMemory switch { - _ when usedMemory > totalSystemMemory * memoryThreshold[FULL] => FULL, - _ when usedMemory > totalSystemMemory * memoryThreshold[WARNING] => WARNING, - _ when usedMemory < totalSystemMemory * memoryThreshold[ABUNDANCE] => ABUNDANCE, - _ => NORMAL, + _ when usedMemory > totalSystemMemory * memoryThreshold[Full] => Full, + _ when usedMemory > totalSystemMemory * memoryThreshold[Warning] => Warning, + _ when usedMemory < totalSystemMemory * memoryThreshold[Abundance] => Abundance, + _ => Normal, }; cachedFrame = UnityEngine.Time.frameCount; @@ -61,7 +61,7 @@ private MemoryUsageStatus GetMemoryUsageStatus() public (int warning, int full) GetMemoryRanges() { long totalSizeInMB = GetTotalSystemMemoryInMB(); - return ((int) (totalSizeInMB * memoryThreshold[WARNING]), (int)(totalSizeInMB * memoryThreshold[FULL])); + return ((int) (totalSizeInMB * memoryThreshold[Warning]), (int)(totalSizeInMB * memoryThreshold[Full])); } public bool TrySpendBudget() => @@ -71,14 +71,14 @@ public long GetTotalSystemMemoryInMB() { return SimulatedMemoryUsage switch { - FULL => NO_MEMORY, - WARNING => CalculateSystemMemoryForWarningThreshold(), + Full => NO_MEMORY, + Warning => CalculateSystemMemoryForWarningThreshold(), _ => systemMemoryCap.MemoryCapInMB, }; // ReSharper disable once PossibleLossOfFraction long CalculateSystemMemoryForWarningThreshold() => // Increase the threshold halfway between warning and full - (long)(profiler.SystemUsedMemoryInBytes / BYTES_IN_MEGABYTE / (memoryThreshold[WARNING] * GetHalfwayBetweenLimits(FULL, WARNING))); + (long)(profiler.SystemUsedMemoryInBytes / BYTES_IN_MEGABYTE / (memoryThreshold[Warning] * GetHalfwayBetweenLimits(Full, Warning))); float GetHalfwayBetweenLimits(MemoryUsageStatus upperLimit, MemoryUsageStatus bottomLimit) => 1 + ((memoryThreshold[upperLimit] - memoryThreshold[bottomLimit])/2f); @@ -89,24 +89,24 @@ public bool IsInAbundance() if (SimulateLackOfAbundance) return false; - return GetMemoryUsageStatus() == ABUNDANCE; + return GetMemoryUsageStatus() == Abundance; } public bool IsMemoryNormal() { MemoryUsageStatus status = GetMemoryUsageStatus(); - return status is NORMAL or ABUNDANCE; + return status is Normal or Abundance; } public bool IsMemoryFull() => - GetMemoryUsageStatus() == FULL; + GetMemoryUsageStatus() == Full; public class Default : IPerformanceBudget { private static readonly IReadOnlyDictionary MEMORY_THRESHOLD = new Dictionary { - { WARNING, 0.65f }, - { FULL, 0.75f } + { Warning, 0.65f }, + { Full, 0.75f } }; private readonly IPerformanceBudget performanceBudget = new MemoryBudget( diff --git a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/PerformanceBudgeting/Memory/SystemMemoryCap.cs b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/PerformanceBudgeting/Memory/SystemMemoryCap.cs index efb2bd8626b..90f5ecea578 100644 --- a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/PerformanceBudgeting/Memory/SystemMemoryCap.cs +++ b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/PerformanceBudgeting/Memory/SystemMemoryCap.cs @@ -5,8 +5,8 @@ namespace DCL.Optimization.PerformanceBudgeting { public enum MemoryCapMode { - REAL_MEMORY, - SIMULATED_MEMORY, + RealMemory, + SimulatedMemory, } public class SystemMemoryCap : ISystemMemoryCap @@ -15,14 +15,14 @@ public class SystemMemoryCap : ISystemMemoryCap public SystemMemoryCap() { - mode = MemoryCapMode.REAL_MEMORY; + mode = MemoryCapMode.RealMemory; //Default value will be later set in `MemoryLimitSettingController`. We start with the max value MemoryCap = -1; } public SystemMemoryCap(int simulatedMemory) { - mode = MemoryCapMode.SIMULATED_MEMORY; + mode = MemoryCapMode.SimulatedMemory; MemoryCapInMB = simulatedMemory; } @@ -33,7 +33,7 @@ public int MemoryCap set { //Memory cannot be changed if we are simulating it - if (mode == MemoryCapMode.SIMULATED_MEMORY) + if (mode == MemoryCapMode.SimulatedMemory) return; //-1 means set to max diff --git a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/PerformanceBudgeting/Tests/MemoryBudgetProviderShould.cs b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/PerformanceBudgeting/Tests/MemoryBudgetProviderShould.cs index 5912bfeaa16..7c407799941 100644 --- a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/PerformanceBudgeting/Tests/MemoryBudgetProviderShould.cs +++ b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Optimization/PerformanceBudgeting/Tests/MemoryBudgetProviderShould.cs @@ -11,9 +11,9 @@ internal class MemoryBudgetProviderShould private readonly Dictionary memoryThreshold = new () { - { MemoryUsageStatus.ABUNDANCE, 0.6f }, - { MemoryUsageStatus.WARNING, 0.8f }, - { MemoryUsageStatus.FULL, 0.9f }, + { MemoryUsageStatus.Abundance, 0.6f }, + { MemoryUsageStatus.Warning, 0.8f }, + { MemoryUsageStatus.Full, 0.9f }, }; private MemoryBudget memoryBudget; diff --git a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Profiling/ECS/DebugViewProfilingSystem.cs b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Profiling/ECS/DebugViewProfilingSystem.cs index e06ec477a16..1f65e5b0c0e 100644 --- a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Profiling/ECS/DebugViewProfilingSystem.cs +++ b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Profiling/ECS/DebugViewProfilingSystem.cs @@ -130,9 +130,9 @@ void CreateView() .AddCustomMarker("Gc Used Memory [MB]:", gcUsedMemory = new ElementBinding(string.Empty)) .AddCustomMarker("Memory Budget Thresholds [MB]:", memoryCheckpoints = new ElementBinding(string.Empty)) .AddCustomMarker("Is In Abundances:", isInAbundance = new ElementBinding("YES")) - .AddSingleButton("Memory NORMAL", () => this.memoryBudget.SimulatedMemoryUsage = MemoryUsageStatus.NORMAL) - .AddSingleButton("Memory WARNING", () => this.memoryBudget.SimulatedMemoryUsage = MemoryUsageStatus.WARNING) - .AddSingleButton("Memory FULL", () => this.memoryBudget.SimulatedMemoryUsage = MemoryUsageStatus.FULL) + .AddSingleButton("Memory NORMAL", () => this.memoryBudget.SimulatedMemoryUsage = MemoryUsageStatus.Normal) + .AddSingleButton("Memory WARNING", () => this.memoryBudget.SimulatedMemoryUsage = MemoryUsageStatus.Warning) + .AddSingleButton("Memory FULL", () => this.memoryBudget.SimulatedMemoryUsage = MemoryUsageStatus.Full) .AddSingleButton("Toggle Abundance", () => this.memoryBudget.SimulateLackOfAbundance = !this.memoryBudget.SimulateLackOfAbundance) .AddToggleField("Enable Scene Metrics", evt => sceneMetricsEnabled = evt.newValue, sceneMetricsEnabled) .AddCustomMarker("Js-Heap Total [MB]:", jsHeapTotalSize = new ElementBinding(string.Empty)) @@ -174,13 +174,13 @@ private static IndexedElementBinding CreatePhysicsModeBinding(AdaptivePhysicsSet if (Enum.TryParse(evt.value, out PhysSimulationMode mode)) switch (mode) { - case PhysSimulationMode.DEFAULT: - case PhysSimulationMode.ADAPTIVE: + case PhysSimulationMode.Default: + case PhysSimulationMode.Adaptive: adpativePhysicsSettings.Mode = mode; Physics.simulationMode = SimulationMode.FixedUpdate; UnityEngine.Time.fixedDeltaTime = UNITY_DEFAULT_FIXED_DELTA_TIME; break; - case PhysSimulationMode.MANUAL: + case PhysSimulationMode.Manual: adpativePhysicsSettings.Mode = mode; Physics.simulationMode = SimulationMode.Script; break; diff --git a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Profiling/PerformanceBottleneckDetector.cs b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Profiling/PerformanceBottleneckDetector.cs index d1c92ad2fdc..0fa1a7cfb4c 100644 --- a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Profiling/PerformanceBottleneckDetector.cs +++ b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Profiling/PerformanceBottleneckDetector.cs @@ -6,11 +6,11 @@ public class PerformanceBottleneckDetector { public enum PerformanceBottleneck { - INDETERMINATE, // Cannot be determined - PRESENT_LIMITED, // Limited by presentation (vsync or framerate cap) - CPU, // Limited by CPU (main and/or render thread) - GPU, // Limited by GPU - BALANCED, // Limited by both CPU and GPU, i.e. well balanced + Indeterminate, // Cannot be determined + PresentLimited, // Limited by presentation (vsync or framerate cap) + Cpu, // Limited by CPU (main and/or render thread) + Gpu, // Limited by GPU + Balanced, // Limited by both CPU and GPU, i.e. well balanced } private const float K_NEAR_FULL_FRAME_TIME_THRESHOLD_PERCENT = 0.2f; @@ -33,7 +33,7 @@ public PerformanceBottleneck DetermineBottleneck() => private static PerformanceBottleneck DetermineBottleneck(FrameTiming timing) { if (timing.gpuFrameTime == 0) - return PerformanceBottleneck.INDETERMINATE; + return PerformanceBottleneck.Indeterminate; float fullFrameTime = Mathf.Max((float)timing.cpuFrameTime, (float)timing.gpuFrameTime); double fullFrameTimeWithMargin = (1.0 - K_NEAR_FULL_FRAME_TIME_THRESHOLD_PERCENT) * fullFrameTime; @@ -42,12 +42,12 @@ private static PerformanceBottleneck DetermineBottleneck(FrameTiming timing) if (timing.gpuFrameTime > fullFrameTimeWithMargin && timing.cpuMainThreadFrameTime < fullFrameTimeWithMargin && timing.cpuRenderThreadFrameTime < fullFrameTimeWithMargin) - return PerformanceBottleneck.GPU; + return PerformanceBottleneck.Gpu; // One of the CPU times is close to frame time, GPU is not if (timing.gpuFrameTime < fullFrameTimeWithMargin && (timing.cpuMainThreadFrameTime > fullFrameTimeWithMargin || timing.cpuRenderThreadFrameTime > fullFrameTimeWithMargin)) - return PerformanceBottleneck.CPU; + return PerformanceBottleneck.Cpu; // Check if we're limited by vsync or target frame rate if (timing.syncInterval > 0) @@ -56,10 +56,10 @@ private static PerformanceBottleneck DetermineBottleneck(FrameTiming timing) if (timing.gpuFrameTime < fullFrameTimeWithMargin && timing.cpuMainThreadFrameTime < fullFrameTimeWithMargin && timing.cpuRenderThreadFrameTime < fullFrameTimeWithMargin) - return PerformanceBottleneck.PRESENT_LIMITED; + return PerformanceBottleneck.PresentLimited; } - return PerformanceBottleneck.BALANCED; + return PerformanceBottleneck.Balanced; } } } diff --git a/Explorer/Assets/DCL/Places/PlaceDetailPanelController.cs b/Explorer/Assets/DCL/Places/PlaceDetailPanelController.cs index 0a1e589e0fa..f1e2a0ab3a3 100644 --- a/Explorer/Assets/DCL/Places/PlaceDetailPanelController.cs +++ b/Explorer/Assets/DCL/Places/PlaceDetailPanelController.cs @@ -17,7 +17,7 @@ namespace DCL.Places { public class PlaceDetailPanelController : ControllerBase { - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; private readonly ThumbnailLoader thumbnailLoader; private readonly IProfileRepository profileRepository; diff --git a/Explorer/Assets/DCL/Places/PlacesController.cs b/Explorer/Assets/DCL/Places/PlacesController.cs index f8ae990f45c..0381f10f456 100644 --- a/Explorer/Assets/DCL/Places/PlacesController.cs +++ b/Explorer/Assets/DCL/Places/PlacesController.cs @@ -87,7 +87,7 @@ public void Activate() view.ResetCurrentFilters(); view.ResetFiltersDropdown(); view.SetCategories(placesCategories.categories); - view.OpenSection(PlacesSection.BROWSE, force: true); + view.OpenSection(PlacesSection.Browse, force: true); cursor.Unlock(); } @@ -114,21 +114,21 @@ public RectTransform GetRectTransform() => public void OpenSection(PlacesSection section, bool force = false, bool invokeEvent = true, bool cleanSearch = true, bool resetCategory = false) { - view.SetFiltersVisible(section == PlacesSection.BROWSE); + view.SetFiltersVisible(section == PlacesSection.Browse); view.OpenSection(section, force, invokeEvent, cleanSearch, resetCategory); } private void OnAnyFilterChanged(PlacesFilters newFilters) { - view.SetFiltersVisible(newFilters.Section == PlacesSection.BROWSE); - view.SetCategoriesVisible(newFilters.Section == PlacesSection.BROWSE && string.IsNullOrEmpty(newFilters.SearchText)); + view.SetFiltersVisible(newFilters.Section == PlacesSection.Browse); + view.SetCategoriesVisible(newFilters.Section == PlacesSection.Browse && string.IsNullOrEmpty(newFilters.SearchText)); FiltersChanged?.Invoke(newFilters); } private void DisableShortcutsInput() => - inputBlock.Disable(InputMapComponent.Kind.SHORTCUTS, InputMapComponent.Kind.IN_WORLD_CAMERA); + inputBlock.Disable(InputMapComponent.Kind.Shortcuts, InputMapComponent.Kind.InWorldCamera); private void RestoreShortcutsInput() => - inputBlock.Enable(InputMapComponent.Kind.SHORTCUTS, InputMapComponent.Kind.IN_WORLD_CAMERA); + inputBlock.Enable(InputMapComponent.Kind.Shortcuts, InputMapComponent.Kind.InWorldCamera); } } diff --git a/Explorer/Assets/DCL/Places/PlacesResultsController.cs b/Explorer/Assets/DCL/Places/PlacesResultsController.cs index d1a403ebbfb..2d365d3af81 100644 --- a/Explorer/Assets/DCL/Places/PlacesResultsController.cs +++ b/Explorer/Assets/DCL/Places/PlacesResultsController.cs @@ -56,7 +56,7 @@ public class PlacesResultsController : IDisposable private int currentPlacesPageNumber = 1; private bool isPlacesGridLoadingItems; private int currentPlacesTotalAmount; - private PlacesSection sectionOpenedBeforeSearching = PlacesSection.BROWSE; + private PlacesSection sectionOpenedBeforeSearching = PlacesSection.Browse; private bool allFriendsLoaded; private bool liveEventsLoaded; @@ -137,7 +137,7 @@ private void OnBackButtonClicked() => placesController.OpenSection(sectionOpenedBeforeSearching, force: true); private void OnExplorePlacesClicked() => - placesController.OpenSection(PlacesSection.BROWSE, force: true, resetCategory: true); + placesController.OpenSection(PlacesSection.Browse, force: true, resetCategory: true); private void GetANameClicked() => webBrowser.OpenUrlMainThreadOnly(DecentralandUrl.MarketplaceClaimName); @@ -203,8 +203,8 @@ private void LoadPlaces(int pageNumber) if (!string.IsNullOrEmpty(currentFilters.SearchText)) { sectionOpenedBeforeSearching = currentFilters.Section!.Value; - placesController.OpenSection(PlacesSection.BROWSE, invokeEvent: false, cleanSearch: false); - sectionToLoad = PlacesSection.BROWSE; + placesController.OpenSection(PlacesSection.Browse, invokeEvent: false, cleanSearch: false); + sectionToLoad = PlacesSection.Browse; } loadPlacesCts = loadPlacesCts.SafeRestart(); @@ -220,20 +220,20 @@ private async UniTask LoadPlacesAsync(int pageNumber, PlacesSection section, Can placesStateService.ClearPlaces(); view.ClearPlacesResults(currentFilters.Section); view.SetPlacesGridAsLoading(true); - view.SetPlacesCounterActive(currentFilters.Section != PlacesSection.BROWSE || !string.IsNullOrEmpty(currentFilters.SearchText)); + view.SetPlacesCounterActive(currentFilters.Section != PlacesSection.Browse || !string.IsNullOrEmpty(currentFilters.SearchText)); if (!string.IsNullOrEmpty(currentFilters.SearchText)) view.SetPlacesCounter(string.Format(SEARCH_COUNTER_TITLE, currentFilters.SearchText, string.Empty), showBackButton: true); else switch (currentFilters.Section) { - case PlacesSection.RECENTLY_VISITED: + case PlacesSection.RecentlyVisited: view.SetPlacesCounter(string.Format(RECENT_VISITED_COUNTER_TITLE, string.Empty)); break; - case PlacesSection.FAVORITES: + case PlacesSection.Favorites: view.SetPlacesCounter(string.Format(FAVORITES_COUNTER_TITLE, string.Empty)); break; - case PlacesSection.MY_PLACES: + case PlacesSection.MyPlaces: view.SetPlacesCounter(string.Format(MY_PLACES_COUNTER_TITLE, string.Empty)); break; } @@ -286,11 +286,11 @@ private async UniTask LoadPlacesCoreAsync(int pageNumber, PlacesSection section, switch (section) { - case PlacesSection.BROWSE: + case PlacesSection.Browse: placesResult = await placesAPIService.SearchDestinationsAsync( pageNumber: pageNumber, pageSize: PLACES_PER_PAGE, ct: ct, searchText: currentFilters.SearchText, - sortBy: currentFilters.Section == PlacesSection.BROWSE ? currentFilters.SortBy : IPlacesAPIService.SortBy.NONE, + sortBy: currentFilters.Section == PlacesSection.Browse ? currentFilters.SortBy : IPlacesAPIService.SortBy.NONE, sortDirection: IPlacesAPIService.SortDirection.DESC, category: !string.IsNullOrEmpty(currentFilters.SearchText) ? null : currentFilters.CategoryId, withConnectedUsers: true, @@ -298,7 +298,7 @@ private async UniTask LoadPlacesCoreAsync(int pageNumber, PlacesSection section, withLiveEvents: true) .SuppressToResultAsync(ReportCategory.PLACES); break; - case PlacesSection.FAVORITES: + case PlacesSection.Favorites: placesResult = await placesAPIService.GetFavoritesDestinationsAsync( ct: ct, pageNumber: pageNumber, pageSize: PLACES_PER_PAGE, sortByBy: currentFilters.SortBy, sortDirection: IPlacesAPIService.SortDirection.DESC, @@ -307,7 +307,7 @@ private async UniTask LoadPlacesCoreAsync(int pageNumber, PlacesSection section, withLiveEvents: true) .SuppressToResultAsync(ReportCategory.PLACES); break; - case PlacesSection.MY_PLACES: + case PlacesSection.MyPlaces: Profile? ownProfile = await selfProfile.ProfileAsync(ct); if (ownProfile == null) return; placesResult = await placesAPIService.GetDestinationsByOwnerAsync( @@ -318,7 +318,7 @@ private async UniTask LoadPlacesCoreAsync(int pageNumber, PlacesSection section, withLiveEvents: true) .SuppressToResultAsync(ReportCategory.PLACES); break; - case PlacesSection.RECENTLY_VISITED: + case PlacesSection.RecentlyVisited: var recentlyVisitedPlacesIds = placesAPIService.GetRecentlyVisitedPlaces(); var placesByIdResult = await placesAPIService.GetDestinationsByIdsAsync(recentlyVisitedPlacesIds, ct, withConnectedUsers: true) .SuppressToResultAsync(ReportCategory.PLACES); @@ -362,13 +362,13 @@ private async UniTask LoadPlacesCoreAsync(int pageNumber, PlacesSection section, { switch (currentFilters.Section) { - case PlacesSection.RECENTLY_VISITED: + case PlacesSection.RecentlyVisited: view.SetPlacesCounter(string.Format(RECENT_VISITED_COUNTER_TITLE, $"({placesResult.Value.Total})")); break; - case PlacesSection.FAVORITES: + case PlacesSection.Favorites: view.SetPlacesCounter(string.Format(FAVORITES_COUNTER_TITLE, $"({placesResult.Value.Total})")); break; - case PlacesSection.MY_PLACES: + case PlacesSection.MyPlaces: view.SetPlacesCounter(string.Format(MY_PLACES_COUNTER_TITLE, $"({placesResult.Value.Total})")); break; } diff --git a/Explorer/Assets/DCL/Places/PlacesResultsView.cs b/Explorer/Assets/DCL/Places/PlacesResultsView.cs index 9d94ea1d264..d99d31e1a40 100644 --- a/Explorer/Assets/DCL/Places/PlacesResultsView.cs +++ b/Explorer/Assets/DCL/Places/PlacesResultsView.cs @@ -254,10 +254,10 @@ private void SetPlacesGridAsEmpty(bool isEmpty, PlacesSection? section) switch (section) { - case PlacesSection.FAVORITES: + case PlacesSection.Favorites: favoritesResultsEmptyContainer.SetActive(isEmpty); break; - case PlacesSection.MY_PLACES: + case PlacesSection.MyPlaces: myPlacesResultsEmptyContainer.SetActive(isEmpty); break; default: diff --git a/Explorer/Assets/DCL/Places/PlacesSection.cs b/Explorer/Assets/DCL/Places/PlacesSection.cs index 93361e42d6a..5261faca986 100644 --- a/Explorer/Assets/DCL/Places/PlacesSection.cs +++ b/Explorer/Assets/DCL/Places/PlacesSection.cs @@ -2,9 +2,9 @@ { public enum PlacesSection { - BROWSE, - RECENTLY_VISITED, - FAVORITES, - MY_PLACES, + Browse, + RecentlyVisited, + Favorites, + MyPlaces, } } diff --git a/Explorer/Assets/DCL/Places/PlacesSortByFilter.cs b/Explorer/Assets/DCL/Places/PlacesSortByFilter.cs index 02be94e4c01..d1196cd03bf 100644 --- a/Explorer/Assets/DCL/Places/PlacesSortByFilter.cs +++ b/Explorer/Assets/DCL/Places/PlacesSortByFilter.cs @@ -2,7 +2,7 @@ { public enum PlacesSortByFilter { - MOST_ACTIVE, - BEST_RATED, + MostActive, + BestRated, } } diff --git a/Explorer/Assets/DCL/Places/PlacesView.cs b/Explorer/Assets/DCL/Places/PlacesView.cs index e3baf434fbf..534bcc6f7f4 100644 --- a/Explorer/Assets/DCL/Places/PlacesView.cs +++ b/Explorer/Assets/DCL/Places/PlacesView.cs @@ -57,10 +57,10 @@ public class PlacesView : MonoBehaviour private void Awake() { // Tabs subscriptions - browseSectionTab.Button.onClick.AddListener(() => OpenSection(PlacesSection.BROWSE)); - favoritesSectionTab.Button.onClick.AddListener(() => OpenSection(PlacesSection.FAVORITES)); - recentlyVisitedSectionTab.Button.onClick.AddListener(() => OpenSection(PlacesSection.RECENTLY_VISITED)); - myPlacesSectionTab.Button.onClick.AddListener(() => OpenSection(PlacesSection.MY_PLACES)); + browseSectionTab.Button.onClick.AddListener(() => OpenSection(PlacesSection.Browse)); + favoritesSectionTab.Button.onClick.AddListener(() => OpenSection(PlacesSection.Favorites)); + recentlyVisitedSectionTab.Button.onClick.AddListener(() => OpenSection(PlacesSection.RecentlyVisited)); + myPlacesSectionTab.Button.onClick.AddListener(() => OpenSection(PlacesSection.MyPlaces)); // Filters subscriptions filtersDropdown.SortByBestRatedSelected += OnSortByBestRatedSelected; @@ -144,16 +144,16 @@ public void OpenSection(PlacesSection section, bool force = false, bool invokeEv switch (section) { - case PlacesSection.BROWSE: + case PlacesSection.Browse: browseSectionTab.SetSelected(true); break; - case PlacesSection.FAVORITES: + case PlacesSection.Favorites: favoritesSectionTab.SetSelected(true); break; - case PlacesSection.RECENTLY_VISITED: + case PlacesSection.RecentlyVisited: recentlyVisitedSectionTab.SetSelected(true); break; - case PlacesSection.MY_PLACES: + case PlacesSection.MyPlaces: myPlacesSectionTab.SetSelected(true); break; } diff --git a/Explorer/Assets/DCL/PluginSystem/Global/AvatarPlugin.cs b/Explorer/Assets/DCL/PluginSystem/Global/AvatarPlugin.cs index be914c030bb..13def16338a 100644 --- a/Explorer/Assets/DCL/PluginSystem/Global/AvatarPlugin.cs +++ b/Explorer/Assets/DCL/PluginSystem/Global/AvatarPlugin.cs @@ -173,7 +173,7 @@ public void InjectToWorld(ref ArchSystemsWorldBuilder builder, AvatarLoaderSystem.InjectToWorld(ref builder); ResetDirtyFlagSystem.InjectToWorld(ref builder); - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.AVATAR_HIGHLIGHT)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.AvatarHighlight)) AvatarHighlightSystem.InjectToWorld(ref builder, highlightData); cacheCleaner.Register(avatarPoolRegistry); @@ -182,7 +182,7 @@ public void InjectToWorld(ref ArchSystemsWorldBuilder builder, foreach (var extendedObjectPool in avatarMaterialPoolHandler.GetAllMaterialsPools()) cacheCleaner.Register(extendedObjectPool.Pool); - bool includeGhosts = FeaturesRegistry.Instance.IsEnabled(FeatureId.AVATAR_GHOSTS); + bool includeGhosts = FeaturesRegistry.Instance.IsEnabled(FeatureId.AvatarGhosts); if (includeGhosts) AvatarGhostSystem.InjectToWorld(ref builder, ghostMaterial); diff --git a/Explorer/Assets/DCL/PluginSystem/Global/CharacterMotionPlugin.cs b/Explorer/Assets/DCL/PluginSystem/Global/CharacterMotionPlugin.cs index 1409dd71ba4..170541099ff 100644 --- a/Explorer/Assets/DCL/PluginSystem/Global/CharacterMotionPlugin.cs +++ b/Explorer/Assets/DCL/PluginSystem/Global/CharacterMotionPlugin.cs @@ -129,7 +129,7 @@ public void InjectToWorld(ref ArchSystemsWorldBuilder builder, new HandPointAtComponent(), new TorsoIKComponent()); - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.DOUBLE_CLICK_WALK)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.DoubleClickWalk)) UpdatePointAndClickInputSystem.InjectToWorld(ref builder, destinationMarkerPrefab); InterpolateCharacterSystem.InjectToWorld(ref builder, scenesCache); TeleportPositionCalculationSystem.InjectToWorld(ref builder, landscape); @@ -152,7 +152,7 @@ public void InjectToWorld(ref ArchSystemsWorldBuilder builder, GroundDistanceSystem.InjectToWorld(ref builder); GliderPropControllerSystem.InjectToWorld(ref builder, settings.Gliding, gliderPropPrefab, componentPoolsRegistry); - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.POINT_AT)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.PointAt)) { HandPointAtSystem.InjectToWorld(ref builder); PointAtMarkerSystem.InjectToWorld(ref builder, pointAtMarkerPool, web3IdentityCache, friendsCache, settings.PointAtMarkerVisibilitySettings); diff --git a/Explorer/Assets/DCL/PluginSystem/Global/ChatPlugin.cs b/Explorer/Assets/DCL/PluginSystem/Global/ChatPlugin.cs index dfba2e786b7..4d5c10b2fe8 100644 --- a/Explorer/Assets/DCL/PluginSystem/Global/ChatPlugin.cs +++ b/Explorer/Assets/DCL/PluginSystem/Global/ChatPlugin.cs @@ -434,7 +434,7 @@ public async UniTask InitializeAsync(ChatPluginSettings settings, CancellationTo } private void OnChatClickableBlockedInputClickedEventAsync(ChatEvents.ClickableBlockedInputClickedEvent evt) => - mvcManager.ShowAndForget(ExplorePanelController.IssueCommand(new ExplorePanelParameter(ExploreSections.Settings, settingsSection: SettingsController.SettingsSection.CHAT))); + mvcManager.ShowAndForget(ExplorePanelController.IssueCommand(new ExplorePanelParameter(ExploreSections.Settings, settingsSection: SettingsController.SettingsSection.Chat))); private void OnLoadingStatusUpdate(LoadingStatus.LoadingStage status) { diff --git a/Explorer/Assets/DCL/PluginSystem/Global/CreditPurchasePlugin.cs b/Explorer/Assets/DCL/PluginSystem/Global/CreditPurchasePlugin.cs index 890a6f1b0db..e5a120d47ad 100644 --- a/Explorer/Assets/DCL/PluginSystem/Global/CreditPurchasePlugin.cs +++ b/Explorer/Assets/DCL/PluginSystem/Global/CreditPurchasePlugin.cs @@ -83,7 +83,7 @@ public async UniTask InitializeAsync(CreditPurchaseSettings settings, Cancellati } private UniTask OpenGetCreditsPanelAsync(CancellationToken ct) => - FeaturesRegistry.Instance.IsEnabled(FeatureId.CREDITS_TOPUP) + FeaturesRegistry.Instance.IsEnabled(FeatureId.CreditsTopup) ? mvcManager.ShowAsync(CreditsTopUpModalController.IssueCommand(new CreditsTopUpModalControllerParams(CreditsTopUpModalControllerParams.SOURCE_PURCHASE_MODAL)), ct) : mvcManager.ShowAsync(MarketplaceCreditsMenuController.IssueCommand(new MarketplaceCreditsMenuController.Params(isOpenedFromNotification: false)), ct); diff --git a/Explorer/Assets/DCL/PluginSystem/Global/EmotePlugin.cs b/Explorer/Assets/DCL/PluginSystem/Global/EmotePlugin.cs index b393c80b9c4..9d888542260 100644 --- a/Explorer/Assets/DCL/PluginSystem/Global/EmotePlugin.cs +++ b/Explorer/Assets/DCL/PluginSystem/Global/EmotePlugin.cs @@ -114,7 +114,7 @@ public EmotePlugin(IWebRequestController webRequestController, this.world = world; this.playerEntity = playerEntity; this.inputBlock = inputBlock; - this.localSceneDevelopment = FeaturesRegistry.Instance.IsEnabled(FeatureId.LOCAL_SCENE_DEVELOPMENT); + this.localSceneDevelopment = FeaturesRegistry.Instance.IsEnabled(FeatureId.LocalSceneDevelopment); this.thumbnailProvider = thumbnailProvider; this.scenesCache = scenesCache; this.entitiesAnalytics = entitiesAnalytics; diff --git a/Explorer/Assets/DCL/PluginSystem/Global/EnsureClockSync.cs b/Explorer/Assets/DCL/PluginSystem/Global/EnsureClockSync.cs index 263a9b257c2..7f7e6172783 100644 --- a/Explorer/Assets/DCL/PluginSystem/Global/EnsureClockSync.cs +++ b/Explorer/Assets/DCL/PluginSystem/Global/EnsureClockSync.cs @@ -33,9 +33,9 @@ public EnsureClockSync(RealmClock realmClock, public async UniTask ExecuteAsync(CancellationToken ct) { - Result response = Result.RESTART; + Result response = Result.Restart; - while (response == Result.RESTART) + while (response == Result.Restart) { await TryProbeServerTimeAsync(ct); @@ -75,8 +75,8 @@ await webRequestController.IsHeadReachableAsync( public enum Result { - CONTINUE, - RESTART, + Continue, + Restart, } } } diff --git a/Explorer/Assets/DCL/PluginSystem/Global/EnsureClockSyncPlugin.cs b/Explorer/Assets/DCL/PluginSystem/Global/EnsureClockSyncPlugin.cs index 996d329b33e..56cd04eb7eb 100644 --- a/Explorer/Assets/DCL/PluginSystem/Global/EnsureClockSyncPlugin.cs +++ b/Explorer/Assets/DCL/PluginSystem/Global/EnsureClockSyncPlugin.cs @@ -58,20 +58,20 @@ private void CheckForClockSync(Vector2Int obj) title: "Time sync needed", description: "Your clock may be out of sync. Turn on “Set time automatically” in Date & Time settings and try again.", retryText: "Retry", - iconType: ErrorPopupWithRetryController.IconType.CLOCK); + iconType: ErrorPopupWithRetryController.IconType.Clock); await mvcManager.ShowAsync(ErrorPopupWithRetryController.IssueCommand(input), ct); switch (input.SelectedOption) { - case ErrorPopupWithRetryController.Result.EXIT: + case ErrorPopupWithRetryController.Result.Exit: // The error popup will automatically request application exit - return EnsureClockSync.Result.CONTINUE; - case ErrorPopupWithRetryController.Result.RESTART: - return EnsureClockSync.Result.RESTART; + return EnsureClockSync.Result.Continue; + case ErrorPopupWithRetryController.Result.Restart: + return EnsureClockSync.Result.Restart; } - return EnsureClockSync.Result.CONTINUE; + return EnsureClockSync.Result.Continue; } [Serializable] diff --git a/Explorer/Assets/DCL/PluginSystem/Global/ExplorePanelPlugin.cs b/Explorer/Assets/DCL/PluginSystem/Global/ExplorePanelPlugin.cs index 72d9cd4eb4b..c6b628a0448 100644 --- a/Explorer/Assets/DCL/PluginSystem/Global/ExplorePanelPlugin.cs +++ b/Explorer/Assets/DCL/PluginSystem/Global/ExplorePanelPlugin.cs @@ -367,10 +367,10 @@ public async UniTask InitializeAsync(ExplorePanelSettings settings, Cancellation dclInput.Shortcuts.Settings.performed += OnInputShortcutsSettingsPerformedAsync; dclInput.Shortcuts.Backpack.performed += OnInputShortcutsBackpackPerformedAsync; - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.DISCOVER)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.Discover)) dclInput.Shortcuts.Places.performed += OnInputShortcutsPlacesPerformed; - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.CAMERA_REEL)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.CameraReel)) dclInput.Shortcuts.CameraReel.performed += OnInputShortcutsCameraReelPerformedAsync; var outfitsRepository = new OutfitsRepository(publishIpfsEntityCommand, nftNamesProvider, selfProfile); @@ -584,12 +584,12 @@ public async UniTask InitializeAsync(ExplorePanelSettings settings, Cancellation eventCardActionsController); mvcManager.RegisterController(eventDetailPanelController); - bool userCreditsEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.USER_CREDITS); + bool userCreditsEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.UserCredits); explorePanelView.CreditsPanelView.gameObject.SetActive(userCreditsEnabled); if (userCreditsEnabled) creditsPanelController = new CreditsPanelController(explorePanelView.CreditsPanelView, marketplaceCreditsAPIClient, profileChangesBus, web3IdentityCache, - topUpEnabled: FeaturesRegistry.Instance.IsEnabled(FeatureId.CREDITS_TOPUP), + topUpEnabled: FeaturesRegistry.Instance.IsEnabled(FeatureId.CreditsTopup), openTopUpPanel: () => mvcManager.ShowAsync(CreditsTopUpModalController.IssueCommand(new CreditsTopUpModalControllerParams(CreditsTopUpModalControllerParams.SOURCE_HUD))).Forget()); explorePanelController = new diff --git a/Explorer/Assets/DCL/PluginSystem/Global/FriendsContainer.cs b/Explorer/Assets/DCL/PluginSystem/Global/FriendsContainer.cs index d72df446fa8..6308bd9f110 100644 --- a/Explorer/Assets/DCL/PluginSystem/Global/FriendsContainer.cs +++ b/Explorer/Assets/DCL/PluginSystem/Global/FriendsContainer.cs @@ -99,7 +99,7 @@ public FriendsContainer( this.profileRepository = profileRepository; this.loadingStatus = loadingStatus; this.inputBlock = inputBlock; - this.isUserBlockingFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.FRIENDS_USER_BLOCKING); + this.isUserBlockingFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.FriendsUserBlocking); this.socialServiceEventBus = socialServiceEventBus; this.friendsEventBus = friendsEventBus; this.injectedUserBlockingCache = injectedUserBlockingCache; @@ -113,8 +113,8 @@ public FriendsContainer( friendsConnectivityStatusTracker = friendsServices.ConnectivityStatusTracker; this.socialServiceEventBus.TransportClosed += OnTransportClosed; - this.isConnectivityStatusEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.FRIENDS_CONNECTIVITY_STATUS); - this.includeUserBlocking = FeaturesRegistry.Instance.IsEnabled(FeatureId.FRIENDS_USER_BLOCKING); + this.isConnectivityStatusEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.FriendsConnectivityStatus); + this.includeUserBlocking = FeaturesRegistry.Instance.IsEnabled(FeatureId.FriendsUserBlocking); friendsPanelController = new FriendsPanelController(() => { diff --git a/Explorer/Assets/DCL/PluginSystem/Global/FriendsServicesContainer.cs b/Explorer/Assets/DCL/PluginSystem/Global/FriendsServicesContainer.cs index e801688c119..13a37a3012b 100644 --- a/Explorer/Assets/DCL/PluginSystem/Global/FriendsServicesContainer.cs +++ b/Explorer/Assets/DCL/PluginSystem/Global/FriendsServicesContainer.cs @@ -29,7 +29,7 @@ public FriendsServicesContainer( FriendsCache = new FriendsCache(); RpcFriendsService = new RPCFriendsService(friendsEventBus, FriendsCache, selfProfile, socialServicesRPC); FriendsService = useAnalytics ? new FriendServiceAnalyticsDecorator(RpcFriendsService, analyticsController!) : RpcFriendsService; - ConnectivityStatusTracker = new FriendsConnectivityStatusTracker(friendsEventBus, FeaturesRegistry.Instance.IsEnabled(FeatureId.FRIENDS_CONNECTIVITY_STATUS)); + ConnectivityStatusTracker = new FriendsConnectivityStatusTracker(friendsEventBus, FeaturesRegistry.Instance.IsEnabled(FeatureId.FriendsConnectivityStatus)); } public void Dispose() diff --git a/Explorer/Assets/DCL/PluginSystem/Global/InputPlugin.cs b/Explorer/Assets/DCL/PluginSystem/Global/InputPlugin.cs index bed9c725dba..a2ffdc959cf 100644 --- a/Explorer/Assets/DCL/PluginSystem/Global/InputPlugin.cs +++ b/Explorer/Assets/DCL/PluginSystem/Global/InputPlugin.cs @@ -79,7 +79,7 @@ public async UniTask InitializeAsync(InputSettings settings, CancellationToken c public void InjectToWorld(ref ArchSystemsWorldBuilder builder, in GlobalPluginArguments arguments) { - builder.World.Create(new InputMapComponent(InputMapComponent.Kind.NONE)); + builder.World.Create(new InputMapComponent(InputMapComponent.Kind.None)); ApplyInputMapsSystem.InjectToWorld(ref builder); UpdateInputJumpSystem.InjectToWorld(ref builder, DCLInput.Instance.Player.Jump); diff --git a/Explorer/Assets/DCL/PluginSystem/Global/MultiplayerConnectionWatchdog.cs b/Explorer/Assets/DCL/PluginSystem/Global/MultiplayerConnectionWatchdog.cs index 4a6371c117a..eb9c75c6489 100644 --- a/Explorer/Assets/DCL/PluginSystem/Global/MultiplayerConnectionWatchdog.cs +++ b/Explorer/Assets/DCL/PluginSystem/Global/MultiplayerConnectionWatchdog.cs @@ -152,7 +152,7 @@ private async UniTask EvaluateOnceAsync(CancellationToken ct) /// reconnect handshake are not mistaken for a connectivity loss. /// private bool IsMultiplayerConnected() => - roomHub.HasAnyRoomConnected() || pulseTransport.State == ITransport.TransportState.CONNECTED; + roomHub.HasAnyRoomConnected() || pulseTransport.State == ITransport.TransportState.Connected; private async UniTask IsInternetUnreachableAsync(CancellationToken ct) { @@ -183,7 +183,7 @@ private async UniTaskVoid ShowConnectionLostPopupAsync(CancellationToken ct) title: "Connection Lost", description: "You appear to be offline. Please check your internet connection and retry.", retryText: "Retry", - iconType: ErrorPopupWithRetryController.IconType.CONNECTION_LOST); + iconType: ErrorPopupWithRetryController.IconType.ConnectionLost); // Returns when the user clicks Retry/Exit, or when DismissPopupIfShowing cancels popupCts on recovery. await mvcManager.ShowAsync(ErrorPopupWithRetryController.IssueCommand(input), popupCts.Token); diff --git a/Explorer/Assets/DCL/PluginSystem/Global/SocialServicesContainer.cs b/Explorer/Assets/DCL/PluginSystem/Global/SocialServicesContainer.cs index 85198e08d76..a4e94e74443 100644 --- a/Explorer/Assets/DCL/PluginSystem/Global/SocialServicesContainer.cs +++ b/Explorer/Assets/DCL/PluginSystem/Global/SocialServicesContainer.cs @@ -79,7 +79,7 @@ private static IDonationsService CreateDonationsService( IAnalyticsController analyticsController, bool enableAnalytics) { - if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.DONATIONS)) + if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.Donations)) return new DonationsServiceDisabled(); IDonationsService core = new DonationsService(scenesCache, ethereumApi, webRequestController, realmData, diff --git a/Explorer/Assets/DCL/PluginSystem/Global/StaticSettings.cs b/Explorer/Assets/DCL/PluginSystem/Global/StaticSettings.cs index 216cb980018..6b7aae93c40 100644 --- a/Explorer/Assets/DCL/PluginSystem/Global/StaticSettings.cs +++ b/Explorer/Assets/DCL/PluginSystem/Global/StaticSettings.cs @@ -45,9 +45,9 @@ public int FrameTimeCap public Dictionary MemoryThresholds { get; private set; } = new () { - { MemoryUsageStatus.ABUNDANCE, 0.65f }, - { MemoryUsageStatus.WARNING, 0.7f }, - { MemoryUsageStatus.FULL, 0.75f } + { MemoryUsageStatus.Abundance, 0.65f }, + { MemoryUsageStatus.Warning, 0.7f }, + { MemoryUsageStatus.Full, 0.75f } }; [field: Space] diff --git a/Explorer/Assets/DCL/PluginSystem/Global/VoiceChatPlugin.cs b/Explorer/Assets/DCL/PluginSystem/Global/VoiceChatPlugin.cs index 3954a740dd1..145ddcb8105 100644 --- a/Explorer/Assets/DCL/PluginSystem/Global/VoiceChatPlugin.cs +++ b/Explorer/Assets/DCL/PluginSystem/Global/VoiceChatPlugin.cs @@ -150,7 +150,7 @@ public void Dispose() public void InjectToWorld(ref ArchSystemsWorldBuilder builder, in GlobalPluginArguments arguments) { - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.NEARBY_VOICE_CHAT)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.NearbyVoiceChat)) { var listenerState = new NearbyListenerState(); @@ -183,7 +183,7 @@ public async UniTask InitializeAsync(Settings settings, CancellationToken ct) microphoneStateManager = new VoiceChatMicrophoneStateManager(voiceChatHandler, voiceChatOrchestrator); pluginScope.Add(microphoneStateManager); - microphonePublisher = new MicrophoneTrackPublisher(roomHub.VoiceChatRoom().Room(), voiceChatConfiguration, VoiceChatType.COMMUNITY); + microphonePublisher = new MicrophoneTrackPublisher(roomHub.VoiceChatRoom().Room(), voiceChatConfiguration, VoiceChatType.Community); var callPlaybackSourcesHub = new PlaybackSourcesHub("Call", voiceChatConfiguration.ChatAudioMixerGroup.EnsureNotNull()); remoteListener = new RemoteTrackListener( @@ -214,7 +214,7 @@ public async UniTask InitializeAsync(Settings settings, CancellationToken ct) voiceChatDebugContainer = new VoiceChatDebugContainer(debugContainer, microphonePublisher, roomHub.VoiceChatRoom().Room(), callPlaybackSourcesHub); pluginScope.Add(voiceChatDebugContainer); - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.NEARBY_VOICE_CHAT)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.NearbyVoiceChat)) { IRoom islandRoom = roomHub.IslandRoom(); diff --git a/Explorer/Assets/DCL/PluginSystem/Global/WearablePlugin.cs b/Explorer/Assets/DCL/PluginSystem/Global/WearablePlugin.cs index fff02d4dadf..740d5fa7dd2 100644 --- a/Explorer/Assets/DCL/PluginSystem/Global/WearablePlugin.cs +++ b/Explorer/Assets/DCL/PluginSystem/Global/WearablePlugin.cs @@ -56,7 +56,7 @@ public WearablePlugin(IWebRequestController webRequestController, this.realmData = realmData; this.urlsSource = urlsSource; this.builderContentURL = builderContentURL; - this.builderCollectionsPreview = FeaturesRegistry.Instance.IsEnabled(FeatureId.SELF_PREVIEW_BUILDER_COLLECTIONS); + this.builderCollectionsPreview = FeaturesRegistry.Instance.IsEnabled(FeatureId.SelfPreviewBuilderCollections); this.entitiesAnalytics = entitiesAnalytics; cacheCleaner.Register(this.wearableStorage); diff --git a/Explorer/Assets/DCL/PluginSystem/Global/Web3AuthenticationPlugin.cs b/Explorer/Assets/DCL/PluginSystem/Global/Web3AuthenticationPlugin.cs index e30f96da162..4b1b1d05cef 100644 --- a/Explorer/Assets/DCL/PluginSystem/Global/Web3AuthenticationPlugin.cs +++ b/Explorer/Assets/DCL/PluginSystem/Global/Web3AuthenticationPlugin.cs @@ -132,7 +132,7 @@ public async UniTask InitializeAsync(Web3AuthPluginSettings settings, Cancellati private void InitializeTransactionConfirmationPopup(Web3ConfirmationPopupView popupPrefab) { transactionConfirmationView = Object.Instantiate(popupPrefab); - transactionConfirmationView.SetDrawOrder(new CanvasOrdering(CanvasOrdering.SortingLayer.POPUP, 500)); + transactionConfirmationView.SetDrawOrder(new CanvasOrdering(CanvasOrdering.SortingLayer.Popup, 500)); transactionConfirmationView.gameObject.SetActive(false); web3Authenticator.SetTransactionConfirmationCallback(transactionConfirmationView.ShowAsync); } diff --git a/Explorer/Assets/DCL/PluginSystem/World/AssetBundlesPlugin.cs b/Explorer/Assets/DCL/PluginSystem/World/AssetBundlesPlugin.cs index 4ea8651e942..be4dbef8e8e 100644 --- a/Explorer/Assets/DCL/PluginSystem/World/AssetBundlesPlugin.cs +++ b/Explorer/Assets/DCL/PluginSystem/World/AssetBundlesPlugin.cs @@ -64,7 +64,7 @@ public void InjectToWorld(ref ArchSystemsWorldBuilder builder, // Asset Bundles PrepareAssetBundleLoadingParametersSystem.InjectToWorld(ref builder, sharedDependencies.SceneData, STREAMING_ASSETS_URL, assetBundleURL); - bool byteWeightedProgress = FeaturesRegistry.Instance.IsEnabled(FeatureId.BYTE_WEIGHTED_LOADING_PROGRESS); + bool byteWeightedProgress = FeaturesRegistry.Instance.IsEnabled(FeatureId.ByteWeightedLoadingProgress); // TODO create a runtime ref-counting cache LoadAssetBundleSystem.InjectToWorld(ref builder, assetBundleCache, webRequestController, buffersPool, assetBundleLoadingMutex, partialsDiskCache, byteWeightedProgress); @@ -77,7 +77,7 @@ public void InjectToWorld(ref ArchSystemsWorldBuilder builder, LoadAssetBundleManifestSystem.InjectToWorld(ref builder, new NoCache(true, true), assetBundleURL, webRequestController); - bool byteWeightedProgress = FeaturesRegistry.Instance.IsEnabled(FeatureId.BYTE_WEIGHTED_LOADING_PROGRESS); + bool byteWeightedProgress = FeaturesRegistry.Instance.IsEnabled(FeatureId.ByteWeightedLoadingProgress); // TODO create a runtime ref-counting cache LoadGlobalAssetBundleSystem.InjectToWorld(ref builder, assetBundleCache, webRequestController, assetBundleLoadingMutex, buffersPool, partialsDiskCache, byteWeightedProgress); diff --git a/Explorer/Assets/DCL/PluginSystem/World/MaterialWorldPlugin.cs b/Explorer/Assets/DCL/PluginSystem/World/MaterialWorldPlugin.cs index 9280e5a109a..84c7f96bf96 100644 --- a/Explorer/Assets/DCL/PluginSystem/World/MaterialWorldPlugin.cs +++ b/Explorer/Assets/DCL/PluginSystem/World/MaterialWorldPlugin.cs @@ -36,7 +36,7 @@ public MaterialsPlugin(ECSWorldSingletonSharedDependencies sharedDependencies, M { memoryBudgetProvider = sharedDependencies.MemoryBudget; capFrameTimeBudget = sharedDependencies.FrameTimeBudget; - ConfigureSceneMaterial.forceBackfaceCullingEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.FORCE_BACKFACE_CULLING); + ConfigureSceneMaterial.forceBackfaceCullingEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.ForceBackfaceCulling); this.mediaFactory = mediaFactory; } diff --git a/Explorer/Assets/DCL/Profiles/Repository/RealmProfileRepository.cs b/Explorer/Assets/DCL/Profiles/Repository/RealmProfileRepository.cs index da39f19a21c..c93e84fd099 100644 --- a/Explorer/Assets/DCL/Profiles/Repository/RealmProfileRepository.cs +++ b/Explorer/Assets/DCL/Profiles/Repository/RealmProfileRepository.cs @@ -250,8 +250,8 @@ private bool TryRemoveOngoingRequest(string userId, out UniTaskCompletionSource< Assert.IsTrue(!versionSpecified || tier > ProfileTier.Kind.Compact, "Specifying version for compact profile is not supported by design"); - bool delayBatchResolution = EnumUtils.HasFlag(fetchBehaviour, IProfileRepository.FetchBehaviour.DELAY_UNTIL_RESOLVED); - bool forceCatalyst = EnumUtils.HasFlag(fetchBehaviour, IProfileRepository.FetchBehaviour.FORCE_FETCH_FROM_CATALYST); + bool delayBatchResolution = EnumUtils.HasFlag(fetchBehaviour, IProfileRepository.FetchBehaviour.DelayUntilResolved); + bool forceCatalyst = EnumUtils.HasFlag(fetchBehaviour, IProfileRepository.FetchBehaviour.ForceFetchFromCatalyst); // Compact Tiers are not supported on catalysts if (!useCentralizedProfiles || forceCatalyst) @@ -283,7 +283,7 @@ private bool TryRemoveOngoingRequest(string userId, out UniTaskCompletionSource< { // Two paths // Forcing from catalyst dispatches the current batch. Its current usage is to retrieve an update profile, so we need it straight away - if (forceCatalyst || EnumUtils.HasFlag(fetchBehaviour, IProfileRepository.FetchBehaviour.ENFORCE_SINGLE_GET)) + if (forceCatalyst || EnumUtils.HasFlag(fetchBehaviour, IProfileRepository.FetchBehaviour.EnforceSingleGet)) return await EnforceSingleGetAsync(); else { diff --git a/Explorer/Assets/DCL/Profiles/Self/SelfProfile.cs b/Explorer/Assets/DCL/Profiles/Self/SelfProfile.cs index 97c9942503f..a52f931a22b 100644 --- a/Explorer/Assets/DCL/Profiles/Self/SelfProfile.cs +++ b/Explorer/Assets/DCL/Profiles/Self/SelfProfile.cs @@ -75,7 +75,7 @@ public void Dispose() Profile? profile = await profileRepository.GetAsync( web3IdentityCache.Identity.Address, ct, - batchBehaviour: IProfileRepository.FetchBehaviour.ENFORCE_SINGLE_GET + batchBehaviour: IProfileRepository.FetchBehaviour.EnforceSingleGet ); if (profile == null) return null; @@ -145,7 +145,7 @@ public void Dispose() Profile? savedProfile = await profileRepository.GetAsync(newProfile.UserId, newProfile.Version, ct, // force to fetch the profile: there are some fields that might change, like the profile picture url - false, IProfileRepository.FetchBehaviour.FORCE_FETCH_FROM_CATALYST | IProfileRepository.FetchBehaviour.DELAY_UNTIL_RESOLVED); + false, IProfileRepository.FetchBehaviour.ForceFetchFromCatalyst | IProfileRepository.FetchBehaviour.DelayUntilResolved); if (savedProfile != null) { @@ -169,7 +169,7 @@ public void Dispose() Profile? savedProfile = await profileRepository.GetAsync(newProfile.UserId, newProfile.Version, ct, // force to fetch the profile: there are some fields that might change, like the profile picture url - false, IProfileRepository.FetchBehaviour.FORCE_FETCH_FROM_CATALYST | IProfileRepository.FetchBehaviour.DELAY_UNTIL_RESOLVED); + false, IProfileRepository.FetchBehaviour.ForceFetchFromCatalyst | IProfileRepository.FetchBehaviour.DelayUntilResolved); if (savedProfile == null) throw new Exception($"Profile not found after save for user {newProfile.UserId}"); diff --git a/Explorer/Assets/DCL/Profiles/SharedAPI/IProfileRepository.cs b/Explorer/Assets/DCL/Profiles/SharedAPI/IProfileRepository.cs index 8d07561bbf9..720e3039fde 100644 --- a/Explorer/Assets/DCL/Profiles/SharedAPI/IProfileRepository.cs +++ b/Explorer/Assets/DCL/Profiles/SharedAPI/IProfileRepository.cs @@ -14,27 +14,27 @@ public enum FetchBehaviour : byte /// /// Individual requests will be delayed and batched together /// - DEFAULT = 0, + Default = 0, /// /// Individual request will be dispatched immediately /// Use it with caution to enforce a single request when "foreground" strictly requires only one profile /// - ENFORCE_SINGLE_GET = 1, + EnforceSingleGet = 1, /// /// The request can be delayed according to the retry policy until the required version or non-null profile is provided
/// The request can still return `null` as a last measure (if all attempts exceeded)
/// When the request is not resolved it will be repeated in a non-batched mode ///
- DELAY_UNTIL_RESOLVED = 2, + DelayUntilResolved = 2, /// /// Forces the request to go directly to the catalyst (lambdas) instead of the centralized profiles service.
/// Implicitly enforces a single GET request (not batched).
/// Compact tiers are not supported on catalysts, so the tier is forced to Full. ///
- FORCE_FETCH_FROM_CATALYST = 4, + ForceFetchFromCatalyst = 4, } public const string PROFILE_FRAGMENTATION_OBSOLESCENCE = "Should be moved to the unified POST originated from the client"; diff --git a/Explorer/Assets/DCL/Profiles/SharedAPI/Profile.CompactInfo.cs b/Explorer/Assets/DCL/Profiles/SharedAPI/Profile.CompactInfo.cs index 2bed663c5dd..1bba1c5aec4 100644 --- a/Explorer/Assets/DCL/Profiles/SharedAPI/Profile.CompactInfo.cs +++ b/Explorer/Assets/DCL/Profiles/SharedAPI/Profile.CompactInfo.cs @@ -128,7 +128,7 @@ public Color? ClaimedNameColor } claimedNameColor = value; - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.NAME_COLOR_CHANGE) && value is { a: > 0 }) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.NameColorChange) && value is { a: > 0 }) UserNameColor = value.Value; } } @@ -258,7 +258,7 @@ private void GenerateAndValidateName() MentionName = new string(mentionBuffer); } - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.NAME_COLOR_CHANGE) && claimedNameColor is { a: > 0 }) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.NameColorChange) && claimedNameColor is { a: > 0 }) UserNameColor = claimedNameColor.Value; else UserNameColor = NameColorHelper.GetNameColor(DisplayName); diff --git a/Explorer/Assets/DCL/Profiles/SharedAPI/ProfileRepositoryExtensions.cs b/Explorer/Assets/DCL/Profiles/SharedAPI/ProfileRepositoryExtensions.cs index 4b7381eea28..8fa88f5be11 100644 --- a/Explorer/Assets/DCL/Profiles/SharedAPI/ProfileRepositoryExtensions.cs +++ b/Explorer/Assets/DCL/Profiles/SharedAPI/ProfileRepositoryExtensions.cs @@ -17,7 +17,7 @@ public static class ProfileRepositoryExtensions /// public static UniTask GetAsync(this IProfileRepository profileRepository, string id, int version, URLDomain? fromCatalyst, CancellationToken ct, bool getFromCacheIfPossible = true, - IProfileRepository.FetchBehaviour batchBehaviour = IProfileRepository.FetchBehaviour.DEFAULT, + IProfileRepository.FetchBehaviour batchBehaviour = IProfileRepository.FetchBehaviour.Default, IPartitionComponent? partition = null) => profileRepository.GetAsync(id, version, fromCatalyst, ct, getFromCacheIfPossible, batchBehaviour, ProfileTier.Kind.Full, partition) .ContinueWith(static pt => pt.ToProfile()); @@ -27,7 +27,7 @@ public static class ProfileRepositoryExtensions /// public static UniTask GetCompactAsync(this IProfileRepository profileRepository, string id, CancellationToken ct, IPartitionComponent? partition = null, - IProfileRepository.FetchBehaviour batchBehaviour = IProfileRepository.FetchBehaviour.DEFAULT) => + IProfileRepository.FetchBehaviour batchBehaviour = IProfileRepository.FetchBehaviour.Default) => profileRepository.GetAsync(id, 0, null, ct, true, batchBehaviour, ProfileTier.Kind.Compact, partition: partition) .ContinueWith(static pt => pt.ToCompact()); @@ -46,7 +46,7 @@ public static async UniTask> GetAsync(this IProfileRepository prof async UniTask WaitForProfileAsync(string id) { - Result profile = await profileRepository.GetAsync(id, 0, fromCatalyst, ct, true, IProfileRepository.FetchBehaviour.DEFAULT, ProfileTier.Kind.Full) + Result profile = await profileRepository.GetAsync(id, 0, fromCatalyst, ct, true, IProfileRepository.FetchBehaviour.Default, ProfileTier.Kind.Full) .SuppressToResultAsync(); if (profile is { Success: true, Value: not null }) @@ -98,11 +98,11 @@ async UniTask WaitForProfileAsync(string id) /// /// Suppresses inner exceptions to 'Null' return value /// - public static UniTask GetAsync(this IProfileRepository profileRepository, string id, CancellationToken ct, IProfileRepository.FetchBehaviour batchBehaviour = IProfileRepository.FetchBehaviour.DEFAULT) => + public static UniTask GetAsync(this IProfileRepository profileRepository, string id, CancellationToken ct, IProfileRepository.FetchBehaviour batchBehaviour = IProfileRepository.FetchBehaviour.Default) => profileRepository.GetAsync(id, 0, null, ct, batchBehaviour: batchBehaviour).SuppressAnyExceptionWithFallback(null); public static UniTask GetAsync(this IProfileRepository profileRepository, string id, int version, CancellationToken ct, bool getFromCacheIfPossible = true, - IProfileRepository.FetchBehaviour batchBehaviour = IProfileRepository.FetchBehaviour.DEFAULT) => + IProfileRepository.FetchBehaviour batchBehaviour = IProfileRepository.FetchBehaviour.Default) => profileRepository.GetAsync(id, version, null, ct, getFromCacheIfPossible, batchBehaviour); } } diff --git a/Explorer/Assets/DCL/RealmNavigation/ITeleportController.cs b/Explorer/Assets/DCL/RealmNavigation/ITeleportController.cs index d6fb1a3e811..c6dcdb8c3d6 100644 --- a/Explorer/Assets/DCL/RealmNavigation/ITeleportController.cs +++ b/Explorer/Assets/DCL/RealmNavigation/ITeleportController.cs @@ -49,10 +49,10 @@ public bool IsConsumed() => public AssignResult Assign(Vector2Int newParcel, string? newSpawnPointName = null) { - if (consumed) return AssignResult.PARCEL_ALREADY_CONSUMED; + if (consumed) return AssignResult.ParcelAlreadyConsumed; value = newParcel; SpawnPointName = newSpawnPointName; - return AssignResult.OK; + return AssignResult.Ok; } public Vector2Int ConsumeByTeleportOperation() @@ -67,7 +67,7 @@ public Vector2Int Peek() => public enum AssignResult { - OK, - PARCEL_ALREADY_CONSUMED, + Ok, + ParcelAlreadyConsumed, } } diff --git a/Explorer/Assets/DCL/RealmNavigation/PrivateWorlds/UI/PrivateWorldPopupController.cs b/Explorer/Assets/DCL/RealmNavigation/PrivateWorlds/UI/PrivateWorldPopupController.cs index c78e92145e1..f93a1b7ce13 100644 --- a/Explorer/Assets/DCL/RealmNavigation/PrivateWorlds/UI/PrivateWorldPopupController.cs +++ b/Explorer/Assets/DCL/RealmNavigation/PrivateWorlds/UI/PrivateWorldPopupController.cs @@ -24,7 +24,7 @@ public class PrivateWorldPopupController : ControllerBase CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; public PrivateWorldPopupController(ViewFactoryMethod viewFactory, IInputBlock inputBlock, IWorldPermissionsService worldPermissionsService) : base(viewFactory) diff --git a/Explorer/Assets/DCL/RealmNavigation/RealmNavigator.cs b/Explorer/Assets/DCL/RealmNavigation/RealmNavigator.cs index ff0523adbb6..218cd03aaf5 100644 --- a/Explorer/Assets/DCL/RealmNavigation/RealmNavigator.cs +++ b/Explorer/Assets/DCL/RealmNavigation/RealmNavigator.cs @@ -95,13 +95,13 @@ public async UniTask> TryChangeRealmAsync( ) { if (ct.IsCancellationRequested) - return EnumResult.ErrorResult(ChangeRealmError.CHANGE_CANCELLED); + return EnumResult.ErrorResult(ChangeRealmError.ChangeCancelled); if (realmController.RealmData.IsLocalSceneDevelopment) - return EnumResult.ErrorResult(ChangeRealmError.LOCAL_SCENE_DEVELOPMENT_BLOCKED); + return EnumResult.ErrorResult(ChangeRealmError.LocalSceneDevelopmentBlocked); if (await realmController.IsReachableAsync(realm, ct) == false) - return EnumResult.ErrorResult(ChangeRealmError.NOT_REACHABLE); + return EnumResult.ErrorResult(ChangeRealmError.NotReachable); // We use worldName != null to determine if the target is a world, instead of // RealmData.IsWorld(), because RealmData reflects the *current* realm — not the target. @@ -116,7 +116,7 @@ public async UniTask> TryChangeRealmAsync( { ReportHub.LogWarning(ReportCategory.REALM, $"[RealmNavigator] Permission check failed for '{worldName}'"); NotificationsBusController.Instance.AddNotification(new ServerErrorNotification(PERMISSION_CHECK_FAILED_MESSAGE)); - return EnumResult.ErrorResult(ChangeRealmError.UNAUTHORIZED_WORLD_ACCESS); + return EnumResult.ErrorResult(ChangeRealmError.UnauthorizedWorldAccess); } if (result != WorldAccessResult.Allowed) @@ -163,9 +163,9 @@ private async UniTask CheckWorldAccessAsync(string worldName, private static EnumResult MapToChangeRealmError(WorldAccessResult result) => result switch { - WorldAccessResult.Denied => EnumResult.ErrorResult(ChangeRealmError.WHITELIST_ACCESS_DENIED), - WorldAccessResult.PasswordCancelled => EnumResult.ErrorResult(ChangeRealmError.PASSWORD_CANCELLED), - _ => EnumResult.ErrorResult(ChangeRealmError.PASSWORD_REQUIRED) + WorldAccessResult.Denied => EnumResult.ErrorResult(ChangeRealmError.WhitelistAccessDenied), + WorldAccessResult.PasswordCancelled => EnumResult.ErrorResult(ChangeRealmError.PasswordCancelled), + _ => EnumResult.ErrorResult(ChangeRealmError.PasswordRequired) }; private static bool TryExtractWorldName(URLDomain realm, out string worldName) diff --git a/Explorer/Assets/DCL/RealmNavigation/TeleportOperations/UnloadCacheImmediateTeleportOperation.cs b/Explorer/Assets/DCL/RealmNavigation/TeleportOperations/UnloadCacheImmediateTeleportOperation.cs index 1e65bb5f51f..c711a09ad25 100644 --- a/Explorer/Assets/DCL/RealmNavigation/TeleportOperations/UnloadCacheImmediateTeleportOperation.cs +++ b/Explorer/Assets/DCL/RealmNavigation/TeleportOperations/UnloadCacheImmediateTeleportOperation.cs @@ -23,7 +23,7 @@ public UniTask> ExecuteAsync(TeleportParams teleportParams { teleportParams.LoadingStatus.SetCurrentStage(LoadingStatus.LoadingStage.UnloadCacheChecking); //Only unload if the memory usage is normal. If its different, the regular `ReleaseMemorySystem` will take care of it. - //if (memoryUsageProvider.GetMemoryUsageStatus() == MemoryUsageStatus.NORMAL) + //if (memoryUsageProvider.GetMemoryUsageStatus() == MemoryUsageStatus.Normal) // cacheCleaner.UnloadCache(false); Resources.UnloadUnusedAssets(); return UniTask.FromResult(EnumResult.SuccessResult()); diff --git a/Explorer/Assets/DCL/RewardPanel/RewardPanelController.cs b/Explorer/Assets/DCL/RewardPanel/RewardPanelController.cs index 7407fb59edf..7f2d93ef230 100644 --- a/Explorer/Assets/DCL/RewardPanel/RewardPanelController.cs +++ b/Explorer/Assets/DCL/RewardPanel/RewardPanelController.cs @@ -12,7 +12,7 @@ public class RewardPanelController : ControllerBase CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; private ImageController imageController; public RewardPanelController( diff --git a/Explorer/Assets/DCL/RuntimeDeepLink/DeepLinkHandle.cs b/Explorer/Assets/DCL/RuntimeDeepLink/DeepLinkHandle.cs index 4cabc14fbdd..03009ee8a32 100644 --- a/Explorer/Assets/DCL/RuntimeDeepLink/DeepLinkHandle.cs +++ b/Explorer/Assets/DCL/RuntimeDeepLink/DeepLinkHandle.cs @@ -2,8 +2,8 @@ namespace DCL.RuntimeDeepLink { public enum DeepLinkHandleResult { - CONSUMED, - NO_MATCHES, + Consumed, + NoMatches, /// /// A signin deep link arrived that this instance must not consume: either no login here is waiting @@ -12,7 +12,7 @@ public enum DeepLinkHandleResult /// concurrent or idle Explorer instance consuming and deleting it first. Kept until claimed by the /// matching login (bounded by a timeout). /// - DEFERRED, + Deferred, } public interface IDeepLinkHandle @@ -27,7 +27,7 @@ private Null() { } public DeepLinkHandleResult HandleDeepLink(DeepLink deeplink) => - DeepLinkHandleResult.CONSUMED; + DeepLinkHandleResult.Consumed; } } } diff --git a/Explorer/Assets/DCL/RuntimeDeepLink/DeepLinkHandleImplementation.cs b/Explorer/Assets/DCL/RuntimeDeepLink/DeepLinkHandleImplementation.cs index 6194f5e60b1..d64bf47cdfe 100644 --- a/Explorer/Assets/DCL/RuntimeDeepLink/DeepLinkHandleImplementation.cs +++ b/Explorer/Assets/DCL/RuntimeDeepLink/DeepLinkHandleImplementation.cs @@ -50,17 +50,17 @@ public DeepLinkHandleResult HandleDeepLink(DeepLink deeplink) // Guard: only consume a signin while a login here is waiting for one, and only if the link // was minted for that login. if (string.IsNullOrEmpty(awaitedRequestId) || deeplink.ValueOf(AppArgsFlags.AUTH_REQUEST_ID) != awaitedRequestId) - return DeepLinkHandleResult.DEFERRED; + return DeepLinkHandleResult.Deferred; // The id persists in the property until it is overwritten or cleared. deeplinkSigninIdentityId.Value = signin; - return DeepLinkHandleResult.CONSUMED; + return DeepLinkHandleResult.Consumed; } if (!routeNavigationDeepLinks) { ReportHub.Log(ReportCategory.RUNTIME_DEEPLINKS, $"navigation deep link routing is disabled, dropping: {deeplink}"); - return DeepLinkHandleResult.CONSUMED; + return DeepLinkHandleResult.Consumed; } Vector2Int? position = deeplink.Position(); @@ -103,7 +103,7 @@ public DeepLinkHandleResult HandleDeepLink(DeepLink deeplink) handled = true; } - return handled ? DeepLinkHandleResult.CONSUMED : DeepLinkHandleResult.NO_MATCHES; + return handled ? DeepLinkHandleResult.Consumed : DeepLinkHandleResult.NoMatches; } } } diff --git a/Explorer/Assets/DCL/RuntimeDeepLink/DeepLinkSentinel.cs b/Explorer/Assets/DCL/RuntimeDeepLink/DeepLinkSentinel.cs index 0ef1385ad1f..db92a55ff27 100644 --- a/Explorer/Assets/DCL/RuntimeDeepLink/DeepLinkSentinel.cs +++ b/Explorer/Assets/DCL/RuntimeDeepLink/DeepLinkSentinel.cs @@ -73,7 +73,7 @@ public static async UniTaskVoid StartListenForDeepLinksAsync(this IDeepLinkHandl DeepLinkHandleResult result = handle.HandleDeepLink(deepLinkCreateResult.Value); - if (result == DeepLinkHandleResult.DEFERRED) + if (result == DeepLinkHandleResult.Deferred) { // Leave the file in place so the awaiting login can claim it. if (!deferralTimer.IsRunning) @@ -92,10 +92,10 @@ public static async UniTaskVoid StartListenForDeepLinksAsync(this IDeepLinkHandl switch (result) { - case DeepLinkHandleResult.CONSUMED: + case DeepLinkHandleResult.Consumed: ReportHub.Log(ReportCategory.RUNTIME_DEEPLINKS, "successfully handled deeplink"); break; - case DeepLinkHandleResult.NO_MATCHES: + case DeepLinkHandleResult.NoMatches: ReportHub.LogWarning(ReportCategory.RUNTIME_DEEPLINKS, "found no actionable content in deeplink"); break; } diff --git a/Explorer/Assets/DCL/SDKComponents/AvatarAttach/Tests/AvatarAttachHandlerSystemShould.cs b/Explorer/Assets/DCL/SDKComponents/AvatarAttach/Tests/AvatarAttachHandlerSystemShould.cs index e505f0bd84f..2d7d52776e9 100644 --- a/Explorer/Assets/DCL/SDKComponents/AvatarAttach/Tests/AvatarAttachHandlerSystemShould.cs +++ b/Explorer/Assets/DCL/SDKComponents/AvatarAttach/Tests/AvatarAttachHandlerSystemShould.cs @@ -685,7 +685,7 @@ public async Task UseEntityParticipantTableForLookup() ); // Set up the EntityParticipantTable mock to return the target entity - var entry = new IReadOnlyEntityParticipantTable.Entry(targetAvatarId, targetEntity, RoomSource.GATEKEEPER); + var entry = new IReadOnlyEntityParticipantTable.Entry(targetAvatarId, targetEntity, RoomSource.Gatekeeper); entityParticipantTable.TryGet(targetAvatarId, out _).Returns(x => { x[1] = entry; return true; diff --git a/Explorer/Assets/DCL/SDKComponents/AvatarLocomotionOverrides/Components/AvatarLocomotionOverrides.cs b/Explorer/Assets/DCL/SDKComponents/AvatarLocomotionOverrides/Components/AvatarLocomotionOverrides.cs index 6f48d80fb76..09f3782162b 100644 --- a/Explorer/Assets/DCL/SDKComponents/AvatarLocomotionOverrides/Components/AvatarLocomotionOverrides.cs +++ b/Explorer/Assets/DCL/SDKComponents/AvatarLocomotionOverrides/Components/AvatarLocomotionOverrides.cs @@ -9,15 +9,15 @@ public struct AvatarLocomotionOverrides [Flags] public enum OverrideID { - WALK_SPEED = 1, - JOG_SPEED = 1 << 1, - RUN_SPEED = 1 << 2, - JUMP_HEIGHT = 1 << 3, - RUN_JUMP_HEIGHT = 1 << 4, - HARD_LANDING_COOLDOWN = 1 << 5, - DOUBLE_JUMP_HEIGHT = 1 << 6, - GLIDE_SPEED = 1 << 7, - GLIDE_MAX_GRAVITY = 1 << 8, + WalkSpeed = 1, + JogSpeed = 1 << 1, + RunSpeed = 1 << 2, + JumpHeight = 1 << 3, + RunJumpHeight = 1 << 4, + HardLandingCooldown = 1 << 5, + DoubleJumpHeight = 1 << 6, + GlideSpeed = 1 << 7, + GlideMaxGravity = 1 << 8, } public OverrideID WriteMask; diff --git a/Explorer/Assets/DCL/SDKComponents/AvatarLocomotionOverrides/SharedAPI/AvatarLocomotionOverridesHelper.cs b/Explorer/Assets/DCL/SDKComponents/AvatarLocomotionOverrides/SharedAPI/AvatarLocomotionOverridesHelper.cs index d6a4e4757e3..aabeaeac096 100644 --- a/Explorer/Assets/DCL/SDKComponents/AvatarLocomotionOverrides/SharedAPI/AvatarLocomotionOverridesHelper.cs +++ b/Explorer/Assets/DCL/SDKComponents/AvatarLocomotionOverrides/SharedAPI/AvatarLocomotionOverridesHelper.cs @@ -9,15 +9,15 @@ public static void SetValue(ref AvatarLocomotionOverrides locomotionOverrides, A { switch (id) { - case AvatarLocomotionOverrides.OverrideID.WALK_SPEED: locomotionOverrides.WalkSpeed = value; break; - case AvatarLocomotionOverrides.OverrideID.JOG_SPEED: locomotionOverrides.JogSpeed = value; break; - case AvatarLocomotionOverrides.OverrideID.RUN_SPEED: locomotionOverrides.RunSpeed = value; break; - case AvatarLocomotionOverrides.OverrideID.JUMP_HEIGHT: locomotionOverrides.JumpHeight = value; break; - case AvatarLocomotionOverrides.OverrideID.RUN_JUMP_HEIGHT: locomotionOverrides.RunJumpHeight = value; break; - case AvatarLocomotionOverrides.OverrideID.HARD_LANDING_COOLDOWN: locomotionOverrides.HardLandingCooldown = value; break; - case AvatarLocomotionOverrides.OverrideID.DOUBLE_JUMP_HEIGHT: locomotionOverrides.DoubleJumpHeight = value; break; - case AvatarLocomotionOverrides.OverrideID.GLIDE_SPEED: locomotionOverrides.GlidingSpeed = value; break; - case AvatarLocomotionOverrides.OverrideID.GLIDE_MAX_GRAVITY: locomotionOverrides.GlidingMaxGravity = value; break; + case AvatarLocomotionOverrides.OverrideID.WalkSpeed: locomotionOverrides.WalkSpeed = value; break; + case AvatarLocomotionOverrides.OverrideID.JogSpeed: locomotionOverrides.JogSpeed = value; break; + case AvatarLocomotionOverrides.OverrideID.RunSpeed: locomotionOverrides.RunSpeed = value; break; + case AvatarLocomotionOverrides.OverrideID.JumpHeight: locomotionOverrides.JumpHeight = value; break; + case AvatarLocomotionOverrides.OverrideID.RunJumpHeight: locomotionOverrides.RunJumpHeight = value; break; + case AvatarLocomotionOverrides.OverrideID.HardLandingCooldown: locomotionOverrides.HardLandingCooldown = value; break; + case AvatarLocomotionOverrides.OverrideID.DoubleJumpHeight: locomotionOverrides.DoubleJumpHeight = value; break; + case AvatarLocomotionOverrides.OverrideID.GlideSpeed: locomotionOverrides.GlidingSpeed = value; break; + case AvatarLocomotionOverrides.OverrideID.GlideMaxGravity: locomotionOverrides.GlidingMaxGravity = value; break; default: throw new ArgumentException(); } @@ -43,15 +43,15 @@ public static bool TryOverride(in AvatarLocomotionOverrides locomotionOverrides, private static float GetValue(in AvatarLocomotionOverrides locomotionOverrides, AvatarLocomotionOverrides.OverrideID id) => id switch { - AvatarLocomotionOverrides.OverrideID.WALK_SPEED => locomotionOverrides.WalkSpeed, - AvatarLocomotionOverrides.OverrideID.JOG_SPEED => locomotionOverrides.JogSpeed, - AvatarLocomotionOverrides.OverrideID.RUN_SPEED => locomotionOverrides.RunSpeed, - AvatarLocomotionOverrides.OverrideID.JUMP_HEIGHT => locomotionOverrides.JumpHeight, - AvatarLocomotionOverrides.OverrideID.RUN_JUMP_HEIGHT => locomotionOverrides.RunJumpHeight, - AvatarLocomotionOverrides.OverrideID.HARD_LANDING_COOLDOWN => locomotionOverrides.HardLandingCooldown, - AvatarLocomotionOverrides.OverrideID.DOUBLE_JUMP_HEIGHT => locomotionOverrides.DoubleJumpHeight, - AvatarLocomotionOverrides.OverrideID.GLIDE_SPEED => locomotionOverrides.GlidingSpeed, - AvatarLocomotionOverrides.OverrideID.GLIDE_MAX_GRAVITY => locomotionOverrides.GlidingMaxGravity, + AvatarLocomotionOverrides.OverrideID.WalkSpeed => locomotionOverrides.WalkSpeed, + AvatarLocomotionOverrides.OverrideID.JogSpeed => locomotionOverrides.JogSpeed, + AvatarLocomotionOverrides.OverrideID.RunSpeed => locomotionOverrides.RunSpeed, + AvatarLocomotionOverrides.OverrideID.JumpHeight => locomotionOverrides.JumpHeight, + AvatarLocomotionOverrides.OverrideID.RunJumpHeight => locomotionOverrides.RunJumpHeight, + AvatarLocomotionOverrides.OverrideID.HardLandingCooldown => locomotionOverrides.HardLandingCooldown, + AvatarLocomotionOverrides.OverrideID.DoubleJumpHeight => locomotionOverrides.DoubleJumpHeight, + AvatarLocomotionOverrides.OverrideID.GlideSpeed => locomotionOverrides.GlidingSpeed, + AvatarLocomotionOverrides.OverrideID.GlideMaxGravity => locomotionOverrides.GlidingMaxGravity, _ => throw new ArgumentException(), }; } diff --git a/Explorer/Assets/DCL/SDKComponents/AvatarLocomotionOverrides/Systems/PropagateAvatarLocomotionOverridesSystem.cs b/Explorer/Assets/DCL/SDKComponents/AvatarLocomotionOverrides/Systems/PropagateAvatarLocomotionOverridesSystem.cs index 5441c7f6d9e..4fdf6b57616 100644 --- a/Explorer/Assets/DCL/SDKComponents/AvatarLocomotionOverrides/Systems/PropagateAvatarLocomotionOverridesSystem.cs +++ b/Explorer/Assets/DCL/SDKComponents/AvatarLocomotionOverrides/Systems/PropagateAvatarLocomotionOverridesSystem.cs @@ -65,15 +65,15 @@ private static void GetLocomotionOverrides(PBAvatarLocomotionSettings pbSettings { locomotionOverrides = new AvatarLocomotionOverrides(); - if (pbSettings.HasWalkSpeed) AvatarLocomotionOverridesHelper.SetValue(ref locomotionOverrides, AvatarLocomotionOverrides.OverrideID.WALK_SPEED, pbSettings.WalkSpeed); - if (pbSettings.HasJogSpeed) AvatarLocomotionOverridesHelper.SetValue(ref locomotionOverrides, AvatarLocomotionOverrides.OverrideID.JOG_SPEED, pbSettings.JogSpeed); - if (pbSettings.HasRunSpeed) AvatarLocomotionOverridesHelper.SetValue(ref locomotionOverrides, AvatarLocomotionOverrides.OverrideID.RUN_SPEED, pbSettings.RunSpeed); - if (pbSettings.HasJumpHeight) AvatarLocomotionOverridesHelper.SetValue(ref locomotionOverrides, AvatarLocomotionOverrides.OverrideID.JUMP_HEIGHT, pbSettings.JumpHeight); - if (pbSettings.HasRunJumpHeight) AvatarLocomotionOverridesHelper.SetValue(ref locomotionOverrides, AvatarLocomotionOverrides.OverrideID.RUN_JUMP_HEIGHT, pbSettings.RunJumpHeight); - if (pbSettings.HasHardLandingCooldown) AvatarLocomotionOverridesHelper.SetValue(ref locomotionOverrides, AvatarLocomotionOverrides.OverrideID.HARD_LANDING_COOLDOWN, pbSettings.HardLandingCooldown); - if (pbSettings.HasDoubleJumpHeight) AvatarLocomotionOverridesHelper.SetValue(ref locomotionOverrides, AvatarLocomotionOverrides.OverrideID.DOUBLE_JUMP_HEIGHT, pbSettings.DoubleJumpHeight); - if (pbSettings.HasGlidingSpeed) AvatarLocomotionOverridesHelper.SetValue(ref locomotionOverrides, AvatarLocomotionOverrides.OverrideID.GLIDE_SPEED, pbSettings.GlidingSpeed); - if (pbSettings.HasGlidingFallingSpeed) AvatarLocomotionOverridesHelper.SetValue(ref locomotionOverrides, AvatarLocomotionOverrides.OverrideID.GLIDE_MAX_GRAVITY, pbSettings.GlidingFallingSpeed); + if (pbSettings.HasWalkSpeed) AvatarLocomotionOverridesHelper.SetValue(ref locomotionOverrides, AvatarLocomotionOverrides.OverrideID.WalkSpeed, pbSettings.WalkSpeed); + if (pbSettings.HasJogSpeed) AvatarLocomotionOverridesHelper.SetValue(ref locomotionOverrides, AvatarLocomotionOverrides.OverrideID.JogSpeed, pbSettings.JogSpeed); + if (pbSettings.HasRunSpeed) AvatarLocomotionOverridesHelper.SetValue(ref locomotionOverrides, AvatarLocomotionOverrides.OverrideID.RunSpeed, pbSettings.RunSpeed); + if (pbSettings.HasJumpHeight) AvatarLocomotionOverridesHelper.SetValue(ref locomotionOverrides, AvatarLocomotionOverrides.OverrideID.JumpHeight, pbSettings.JumpHeight); + if (pbSettings.HasRunJumpHeight) AvatarLocomotionOverridesHelper.SetValue(ref locomotionOverrides, AvatarLocomotionOverrides.OverrideID.RunJumpHeight, pbSettings.RunJumpHeight); + if (pbSettings.HasHardLandingCooldown) AvatarLocomotionOverridesHelper.SetValue(ref locomotionOverrides, AvatarLocomotionOverrides.OverrideID.HardLandingCooldown, pbSettings.HardLandingCooldown); + if (pbSettings.HasDoubleJumpHeight) AvatarLocomotionOverridesHelper.SetValue(ref locomotionOverrides, AvatarLocomotionOverrides.OverrideID.DoubleJumpHeight, pbSettings.DoubleJumpHeight); + if (pbSettings.HasGlidingSpeed) AvatarLocomotionOverridesHelper.SetValue(ref locomotionOverrides, AvatarLocomotionOverrides.OverrideID.GlideSpeed, pbSettings.GlidingSpeed); + if (pbSettings.HasGlidingFallingSpeed) AvatarLocomotionOverridesHelper.SetValue(ref locomotionOverrides, AvatarLocomotionOverrides.OverrideID.GlideMaxGravity, pbSettings.GlidingFallingSpeed); } public void OnSceneIsCurrentChanged(bool isCurrent) diff --git a/Explorer/Assets/DCL/SDKComponents/AvatarModifierArea/Systems/AvatarModifierAreaHandlerSystem.cs b/Explorer/Assets/DCL/SDKComponents/AvatarModifierArea/Systems/AvatarModifierAreaHandlerSystem.cs index ebb8f09dbce..56b80f67efc 100644 --- a/Explorer/Assets/DCL/SDKComponents/AvatarModifierArea/Systems/AvatarModifierAreaHandlerSystem.cs +++ b/Explorer/Assets/DCL/SDKComponents/AvatarModifierArea/Systems/AvatarModifierAreaHandlerSystem.cs @@ -197,7 +197,7 @@ private void ShowAvatar(Entity entity, Transform avatarTransform) if (avatarTransform == localAvatarTransform) { localAvatarTransform = null; - sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateAvatarHidden(SceneRestrictionsAction.REMOVED)); + sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateAvatarHidden(SceneRestrictionsAction.Removed)); } } @@ -214,7 +214,7 @@ private void HideAvatar(Entity entity, Transform avatarTransform, HashSet excludedIds if (profile.UserId == web3IdentityCache.Identity?.Address) { ownAvatarEntity = entity; - sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreatePassportCannotBeOpened(SceneRestrictionsAction.APPLIED)); + sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreatePassportCannotBeOpened(SceneRestrictionsAction.Applied)); } } else @@ -262,7 +262,7 @@ private void EnableAvatarInteraction(Entity entity) globalWorld.TryRemove(entity); if (ownAvatarEntity == entity) - sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreatePassportCannotBeOpened(SceneRestrictionsAction.REMOVED)); + sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreatePassportCannotBeOpened(SceneRestrictionsAction.Removed)); } private bool TryGetAvatarEntity(Transform transform, out Entity entity) diff --git a/Explorer/Assets/DCL/SDKComponents/CameraControl/CameraModeArea/Systems/CameraModeAreaHandlerSystem.cs b/Explorer/Assets/DCL/SDKComponents/CameraControl/CameraModeArea/Systems/CameraModeAreaHandlerSystem.cs index 16d4b9c605e..fd8048bc3a8 100644 --- a/Explorer/Assets/DCL/SDKComponents/CameraControl/CameraModeArea/Systems/CameraModeAreaHandlerSystem.cs +++ b/Explorer/Assets/DCL/SDKComponents/CameraControl/CameraModeArea/Systems/CameraModeAreaHandlerSystem.cs @@ -74,7 +74,7 @@ private void UpdateCameraModeArea(Entity entity, ref PBCameraModeArea pbCameraMo if (pbCameraModeArea.IsDirty) sdkEntityTriggerAreaComponent.UpdateAreaSize(pbCameraModeArea.Area); - if (cameraData.CameraMode == CameraMode.SDKCamera) return; + if (cameraData.CameraMode == CameraMode.SdkCamera) return; if (sdkEntityTriggerAreaComponent.EnteredEntitiesToBeProcessed.Count > 0) { @@ -125,7 +125,7 @@ internal void OnEnteredCameraModeArea(CameraMode targetCameraMode) camera.Mode = targetCameraMode; camera.AddCameraInputLock(); - sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateCameraLocked(SceneRestrictionsAction.APPLIED)); + sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateCameraLocked(SceneRestrictionsAction.Applied)); } internal void OnExitedCameraModeArea() @@ -138,7 +138,7 @@ internal void OnExitedCameraModeArea() if (camera.CameraInputChangeEnabled) camera.Mode = cameraModeBeforeLastAreaEnter == CameraMode.InWorld? CameraMode.ThirdPerson : cameraModeBeforeLastAreaEnter; - sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateCameraLocked(SceneRestrictionsAction.REMOVED)); + sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateCameraLocked(SceneRestrictionsAction.Removed)); } [Query] diff --git a/Explorer/Assets/DCL/SDKComponents/CameraControl/MainCamera/Systems/MainCameraSystem.cs b/Explorer/Assets/DCL/SDKComponents/CameraControl/MainCamera/Systems/MainCameraSystem.cs index 78551b1956c..cc1f61ec115 100644 --- a/Explorer/Assets/DCL/SDKComponents/CameraControl/MainCamera/Systems/MainCameraSystem.cs +++ b/Explorer/Assets/DCL/SDKComponents/CameraControl/MainCamera/Systems/MainCameraSystem.cs @@ -106,7 +106,7 @@ private void HandleVirtualCameraChange(Entity entity, ref MainCameraComponent ma if (hasPreviousVirtualCamera) { previousVirtualCamera!.enabled = false; - sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateCameraLocked(SceneRestrictionsAction.REMOVED)); + sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateCameraLocked(SceneRestrictionsAction.Removed)); } UpdateGlobalWorldCameraMode(mainCameraComponent.virtualCameraInstance != null); @@ -174,7 +174,7 @@ private bool TryApplyVirtualCamera(ref MainCameraComponent mainCameraComponent, mainCameraComponent.virtualCameraInstance = virtualCameraInstance; virtualCameraInstance.enabled = true; - sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateCameraLocked(SceneRestrictionsAction.APPLIED)); + sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateCameraLocked(SceneRestrictionsAction.Applied)); return true; } @@ -184,13 +184,13 @@ private void UpdateGlobalWorldCameraMode(bool isAnyVirtualCameraActive) ref CameraComponent cameraComponent = ref globalWorld.Get(cameraData.CameraEntityProxy.Object); if (isAnyVirtualCameraActive) { - if (cameraComponent.Mode != CameraMode.SDKCamera) + if (cameraComponent.Mode != CameraMode.SdkCamera) { lastNonSDKCameraMode = cameraComponent.Mode; - cameraComponent.Mode = CameraMode.SDKCamera; + cameraComponent.Mode = CameraMode.SdkCamera; } } - else if (cameraComponent.Mode == CameraMode.SDKCamera) + else if (cameraComponent.Mode == CameraMode.SdkCamera) { cameraComponent.Mode = lastNonSDKCameraMode; } @@ -217,7 +217,7 @@ public void FinalizeComponents(in Query query) private void FinalizeMainCameraComponent(in MainCameraComponent mainCameraComponent) { DisableActiveVirtualCamera(mainCameraComponent); - sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateCameraLocked(SceneRestrictionsAction.REMOVED)); + sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateCameraLocked(SceneRestrictionsAction.Removed)); } // User leaves the scene diff --git a/Explorer/Assets/DCL/SDKComponents/CameraControl/MainCamera/Tests/EditMode/MainCameraSystemShould.cs b/Explorer/Assets/DCL/SDKComponents/CameraControl/MainCamera/Tests/EditMode/MainCameraSystemShould.cs index d931420079f..4fa24767483 100644 --- a/Explorer/Assets/DCL/SDKComponents/CameraControl/MainCamera/Tests/EditMode/MainCameraSystemShould.cs +++ b/Explorer/Assets/DCL/SDKComponents/CameraControl/MainCamera/Tests/EditMode/MainCameraSystemShould.cs @@ -216,7 +216,7 @@ public void UpdateGlobalWorldCameraModeCorrectly() { sceneStateProvider.IsCurrent.Returns(true); SystemUpdate(); - Assert.AreNotEqual(CameraMode.SDKCamera, globalWorld.Get(globalWorldCameraEntity).Mode); + Assert.AreNotEqual(CameraMode.SdkCamera, globalWorld.Get(globalWorldCameraEntity).Mode); // Set virtualCameraEntity1 as active vCam var pbMainCameraComponent = new PBMainCamera() { VirtualCameraEntity = (uint)world.Get(virtualCameraEntity1).Id }; @@ -224,7 +224,7 @@ public void UpdateGlobalWorldCameraModeCorrectly() sceneStateProvider.IsCurrent.Returns(true); // Keep scene current for update SystemUpdate(); - Assert.AreEqual(CameraMode.SDKCamera, globalWorld.Get(globalWorldCameraEntity).Mode); + Assert.AreEqual(CameraMode.SdkCamera, globalWorld.Get(globalWorldCameraEntity).Mode); // Release active vCam in MainCameraComponent pbMainCameraComponent.ClearVirtualCameraEntity(); @@ -232,7 +232,7 @@ public void UpdateGlobalWorldCameraModeCorrectly() sceneStateProvider.IsCurrent.Returns(true); // Keep scene current for update SystemUpdate(); - Assert.AreNotEqual(CameraMode.SDKCamera, globalWorld.Get(globalWorldCameraEntity).Mode); + Assert.AreNotEqual(CameraMode.SdkCamera, globalWorld.Get(globalWorldCameraEntity).Mode); } [Test] @@ -344,7 +344,7 @@ public void HandleComponentRemoveCorrectly() Assert.AreSame(sdkCinemachineCam1, world.Get(mainCameraEntity).virtualCameraInstance); Assert.AreSame(sdkCinemachineCam1.gameObject, cinemachineBrain.ActiveVirtualCamera.VirtualCameraGameObject); Assert.IsTrue(sdkCinemachineCam1.enabled); - Assert.AreEqual(CameraMode.SDKCamera, globalWorld.Get(globalWorldCameraEntity).Mode); + Assert.AreEqual(CameraMode.SdkCamera, globalWorld.Get(globalWorldCameraEntity).Mode); // Remove PB component world.Remove(mainCameraEntity); @@ -353,7 +353,7 @@ public void HandleComponentRemoveCorrectly() Assert.IsFalse(sdkCinemachineCam1.enabled); Assert.IsFalse(sdkCinemachineCam2.enabled); Assert.AreSame(defaultCinemachineCam.gameObject, cinemachineBrain.ActiveVirtualCamera.VirtualCameraGameObject); - Assert.AreNotEqual(CameraMode.SDKCamera, globalWorld.Get(globalWorldCameraEntity).Mode); + Assert.AreNotEqual(CameraMode.SdkCamera, globalWorld.Get(globalWorldCameraEntity).Mode); } [Test] @@ -372,7 +372,7 @@ public void HandleEntityDestructionCorrectly() Assert.AreSame(sdkCinemachineCam1, world.Get(mainCameraEntity).virtualCameraInstance); Assert.AreSame(sdkCinemachineCam1.gameObject, cinemachineBrain.ActiveVirtualCamera.VirtualCameraGameObject); Assert.IsTrue(sdkCinemachineCam1.enabled); - Assert.AreEqual(CameraMode.SDKCamera, globalWorld.Get(globalWorldCameraEntity).Mode); + Assert.AreEqual(CameraMode.SdkCamera, globalWorld.Get(globalWorldCameraEntity).Mode); // Add DeleteEntityIntention component world.Add(mainCameraEntity); @@ -381,7 +381,7 @@ public void HandleEntityDestructionCorrectly() Assert.IsFalse(sdkCinemachineCam1.enabled); Assert.IsFalse(sdkCinemachineCam2.enabled); Assert.AreSame(defaultCinemachineCam.gameObject, cinemachineBrain.ActiveVirtualCamera.VirtualCameraGameObject); - Assert.AreNotEqual(CameraMode.SDKCamera, globalWorld.Get(globalWorldCameraEntity).Mode); + Assert.AreNotEqual(CameraMode.SdkCamera, globalWorld.Get(globalWorldCameraEntity).Mode); } [Test] diff --git a/Explorer/Assets/DCL/SDKComponents/InputModifier/Components/InputModifierComponent.cs b/Explorer/Assets/DCL/SDKComponents/InputModifier/Components/InputModifierComponent.cs index e0979db967b..5a3dc401821 100644 --- a/Explorer/Assets/DCL/SDKComponents/InputModifier/Components/InputModifierComponent.cs +++ b/Explorer/Assets/DCL/SDKComponents/InputModifier/Components/InputModifierComponent.cs @@ -12,20 +12,20 @@ public struct InputModifierComponent [Flags] private enum ModifierId { - NONE, - WALK = 1, - JOG = 1 << 1, - RUN = 1 << 2, - JUMP = 1 << 3, - EMOTE = 1 << 4, - DOUBLE_JUMP = 1 << 5, - GLIDING = 1 << 6, - ALL = 1 << 31 + None, + Walk = 1, + Jog = 1 << 1, + Run = 1 << 2, + Jump = 1 << 3, + Emote = 1 << 4, + DoubleJump = 1 << 5, + Gliding = 1 << 6, + All = 1 << 31 } private ModifierId disabledMask; - public bool EverythingEnabled => disabledMask == ModifierId.NONE; + public bool EverythingEnabled => disabledMask == ModifierId.None; /// /// When set to true, disables all related properties (Walk, Jog, Run, Jump, Emote). @@ -33,8 +33,8 @@ private enum ModifierId /// public bool DisableAll { - get => (disabledMask & ModifierId.ALL) != 0; - set => disabledMask = value ? disabledMask | ModifierId.ALL : disabledMask & ~ModifierId.ALL; + get => (disabledMask & ModifierId.All) != 0; + set => disabledMask = value ? disabledMask | ModifierId.All : disabledMask & ~ModifierId.All; } /// @@ -44,8 +44,8 @@ public bool DisableAll /// public bool DisableWalk { - get => IsDisabled(ModifierId.WALK); - set => disabledMask = value ? disabledMask | ModifierId.WALK : disabledMask & ~ModifierId.WALK; + get => IsDisabled(ModifierId.Walk); + set => disabledMask = value ? disabledMask | ModifierId.Walk : disabledMask & ~ModifierId.Walk; } /// @@ -55,8 +55,8 @@ public bool DisableWalk /// public bool DisableJog { - get => IsDisabled(ModifierId.JOG); - set => disabledMask = value ? disabledMask | ModifierId.JOG : disabledMask & ~ModifierId.JOG; + get => IsDisabled(ModifierId.Jog); + set => disabledMask = value ? disabledMask | ModifierId.Jog : disabledMask & ~ModifierId.Jog; } /// @@ -66,8 +66,8 @@ public bool DisableJog /// public bool DisableRun { - get => IsDisabled(ModifierId.RUN); - set => disabledMask = value ? disabledMask | ModifierId.RUN : disabledMask & ~ModifierId.RUN; + get => IsDisabled(ModifierId.Run); + set => disabledMask = value ? disabledMask | ModifierId.Run : disabledMask & ~ModifierId.Run; } /// @@ -77,8 +77,8 @@ public bool DisableRun /// public bool DisableJump { - get => IsDisabled(ModifierId.JUMP); - set => disabledMask = value ? disabledMask | ModifierId.JUMP : disabledMask & ~ModifierId.JUMP; + get => IsDisabled(ModifierId.Jump); + set => disabledMask = value ? disabledMask | ModifierId.Jump : disabledMask & ~ModifierId.Jump; } /// @@ -88,8 +88,8 @@ public bool DisableJump /// public bool DisableEmote { - get => IsDisabled(ModifierId.EMOTE); - set => disabledMask = value ? disabledMask | ModifierId.EMOTE : disabledMask & ~ModifierId.EMOTE; + get => IsDisabled(ModifierId.Emote); + set => disabledMask = value ? disabledMask | ModifierId.Emote : disabledMask & ~ModifierId.Emote; } /// @@ -99,8 +99,8 @@ public bool DisableEmote /// public bool DisableDoubleJump { - get => IsDisabled(ModifierId.DOUBLE_JUMP); - set => disabledMask = value ? disabledMask | ModifierId.DOUBLE_JUMP : disabledMask & ~ModifierId.DOUBLE_JUMP; + get => IsDisabled(ModifierId.DoubleJump); + set => disabledMask = value ? disabledMask | ModifierId.DoubleJump : disabledMask & ~ModifierId.DoubleJump; } /// @@ -110,14 +110,14 @@ public bool DisableDoubleJump /// public bool DisableGliding { - get => IsDisabled(ModifierId.GLIDING); - set => disabledMask = value ? disabledMask | ModifierId.GLIDING : disabledMask & ~ModifierId.GLIDING; + get => IsDisabled(ModifierId.Gliding); + set => disabledMask = value ? disabledMask | ModifierId.Gliding : disabledMask & ~ModifierId.Gliding; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - private bool IsDisabled(ModifierId modifier) => (disabledMask & (ModifierId.ALL | modifier)) != 0; + private bool IsDisabled(ModifierId modifier) => (disabledMask & (ModifierId.All | modifier)) != 0; public void RemoveAllModifiers() => - disabledMask = ModifierId.NONE; + disabledMask = ModifierId.None; } } diff --git a/Explorer/Assets/DCL/SDKComponents/InputModifier/Systems/InputModifierHandlerSystem.cs b/Explorer/Assets/DCL/SDKComponents/InputModifier/Systems/InputModifierHandlerSystem.cs index 9710d75d34c..adf1ae729bf 100644 --- a/Explorer/Assets/DCL/SDKComponents/InputModifier/Systems/InputModifierHandlerSystem.cs +++ b/Explorer/Assets/DCL/SDKComponents/InputModifier/Systems/InputModifierHandlerSystem.cs @@ -22,7 +22,7 @@ public partial class InputModifierHandlerSystem : BaseUnityLoopSystem, ISceneIsC private readonly ISceneStateProvider sceneStateProvider; private readonly ISceneRestrictionBusController sceneRestrictionBusController; - private SceneRestrictionsAction lastBusMessageAction = SceneRestrictionsAction.REMOVED; + private SceneRestrictionsAction lastBusMessageAction = SceneRestrictionsAction.Removed; public InputModifierHandlerSystem(World world, World globalWorld, Entity playerEntity, ISceneStateProvider sceneStateProvider, ISceneRestrictionBusController sceneRestrictionBusController) : base(world) { @@ -42,7 +42,7 @@ protected override void Update(float t) private void SendBusMessage(in InputModifierComponent inputModifier) { - SceneRestrictionsAction currentAction = inputModifier is { DisableAll: false, DisableWalk: false, DisableJog: false, DisableRun: false, DisableJump: false, DisableEmote: false } ? SceneRestrictionsAction.REMOVED : SceneRestrictionsAction.APPLIED; + SceneRestrictionsAction currentAction = inputModifier is { DisableAll: false, DisableWalk: false, DisableJog: false, DisableRun: false, DisableJump: false, DisableEmote: false } ? SceneRestrictionsAction.Removed : SceneRestrictionsAction.Applied; if (currentAction == lastBusMessageAction) return; @@ -109,14 +109,14 @@ public void OnSceneIsCurrentChanged(bool value) ApplyModifiersQuery(World, true); // Only reset the shared global modifier if this scene was the one actively asserting it. - else if (lastBusMessageAction == SceneRestrictionsAction.APPLIED) + else if (lastBusMessageAction == SceneRestrictionsAction.Applied) ResetModifiers(); } public void FinalizeComponents(in Query query) { // Only reset the shared global modifier if this scene was the one actively asserting it. - if (lastBusMessageAction == SceneRestrictionsAction.APPLIED) + if (lastBusMessageAction == SceneRestrictionsAction.Applied) ResetModifiers(); } } diff --git a/Explorer/Assets/DCL/SDKComponents/InputModifier/Tests/InputModifierHandlerSystemShould.cs b/Explorer/Assets/DCL/SDKComponents/InputModifier/Tests/InputModifierHandlerSystemShould.cs index 1f8833f0a97..7f91771815f 100644 --- a/Explorer/Assets/DCL/SDKComponents/InputModifier/Tests/InputModifierHandlerSystemShould.cs +++ b/Explorer/Assets/DCL/SDKComponents/InputModifier/Tests/InputModifierHandlerSystemShould.cs @@ -68,7 +68,7 @@ public void ApplyModifiers_ShouldUpdateGlobalWorld_WhenSceneIsCurrent_AndEntityI Assert.IsTrue(inputModifier.DisableRun); Assert.IsFalse(inputModifier.DisableJump); - sceneRestrictionBusController.Received(1).PushSceneRestriction(Arg.Is(r => r.Action == SceneRestrictionsAction.APPLIED)); + sceneRestrictionBusController.Received(1).PushSceneRestriction(Arg.Is(r => r.Action == SceneRestrictionsAction.Applied)); // Check component was added to track removal Assert.IsTrue(world.Has(entity)); @@ -103,7 +103,7 @@ public void ApplyAllModifiers_WhenDisableAllIsTrue() Assert.IsTrue(inputModifier.DisableJump); Assert.IsTrue(inputModifier.DisableEmote); - sceneRestrictionBusController.Received(1).PushSceneRestriction(Arg.Is(r => r.Action == SceneRestrictionsAction.APPLIED)); + sceneRestrictionBusController.Received(1).PushSceneRestriction(Arg.Is(r => r.Action == SceneRestrictionsAction.Applied)); } [Test] @@ -171,7 +171,7 @@ public void ResetModifiers_ShouldBeCalled_WhenComponentRemoved() Assert.IsFalse(inputModifier.DisableWalk); // Should receive REMOVED action - sceneRestrictionBusController.Received().PushSceneRestriction(Arg.Is(r => r.Action == SceneRestrictionsAction.REMOVED)); + sceneRestrictionBusController.Received().PushSceneRestriction(Arg.Is(r => r.Action == SceneRestrictionsAction.Removed)); // Should remove tracking component Assert.IsFalse(world.Has(entity)); @@ -198,7 +198,7 @@ public void ResetModifiers_ShouldBeCalled_WhenSceneIsNotCurrent() var inputModifier = globalWorld.Get(playerEntity); Assert.IsFalse(inputModifier.DisableWalk); - sceneRestrictionBusController.Received().PushSceneRestriction(Arg.Is(r => r.Action == SceneRestrictionsAction.REMOVED)); + sceneRestrictionBusController.Received().PushSceneRestriction(Arg.Is(r => r.Action == SceneRestrictionsAction.Removed)); } [Test] @@ -329,7 +329,7 @@ public void ReapplyModifiers_WhenSceneBecomesCurrent() Assert.IsTrue(inputModifier.DisableWalk); Assert.IsTrue(inputModifier.DisableJump); - sceneRestrictionBusController.Received(1).PushSceneRestriction(Arg.Is(r => r.Action == SceneRestrictionsAction.APPLIED)); + sceneRestrictionBusController.Received(1).PushSceneRestriction(Arg.Is(r => r.Action == SceneRestrictionsAction.Applied)); } [Test] @@ -366,7 +366,7 @@ public void ResetAllModifiers_WhenFinalizeComponentsCalled() Assert.IsFalse(inputModifier.DisableJump); Assert.IsFalse(inputModifier.DisableEmote); - sceneRestrictionBusController.Received(1).PushSceneRestriction(Arg.Is(r => r.Action == SceneRestrictionsAction.REMOVED)); + sceneRestrictionBusController.Received(1).PushSceneRestriction(Arg.Is(r => r.Action == SceneRestrictionsAction.Removed)); } [Test] @@ -388,7 +388,7 @@ public void NotSendDuplicateBusMessages_WhenStateUnchanged() system.Update(0); // Assert - Should only receive one APPLIED message (deduplicated) - sceneRestrictionBusController.Received(1).PushSceneRestriction(Arg.Is(r => r.Action == SceneRestrictionsAction.APPLIED)); + sceneRestrictionBusController.Received(1).PushSceneRestriction(Arg.Is(r => r.Action == SceneRestrictionsAction.Applied)); } [Test] diff --git a/Explorer/Assets/DCL/SDKComponents/LightSource/Components/LightSourceComponent.cs b/Explorer/Assets/DCL/SDKComponents/LightSource/Components/LightSourceComponent.cs index 3dfd9c7ced8..4ca8f975765 100644 --- a/Explorer/Assets/DCL/SDKComponents/LightSource/Components/LightSourceComponent.cs +++ b/Explorer/Assets/DCL/SDKComponents/LightSource/Components/LightSourceComponent.cs @@ -24,7 +24,7 @@ public struct LightSourceComponent public CullingFlags Culling; public CookieInfo Cookie; - public bool IsCulled => Culling != CullingFlags.NONE; + public bool IsCulled => Culling != CullingFlags.None; public LightSourceComponent(Light lightSourceInstance) : this() { @@ -34,9 +34,9 @@ public LightSourceComponent(Light lightSourceInstance) : this() [Flags] public enum CullingFlags { - NONE = 0, - TOO_MANY_LIGHT_SOURCES = 1, - CULLED_BY_LOD = 1 << 1 + None = 0, + TooManyLightSources = 1, + CulledByLod = 1 << 1 } public struct CookieInfo diff --git a/Explorer/Assets/DCL/SDKComponents/LightSource/Systems/LightSourceCullingSystem.cs b/Explorer/Assets/DCL/SDKComponents/LightSource/Systems/LightSourceCullingSystem.cs index 2e08bcd7873..e5d15c19eb6 100644 --- a/Explorer/Assets/DCL/SDKComponents/LightSource/Systems/LightSourceCullingSystem.cs +++ b/Explorer/Assets/DCL/SDKComponents/LightSource/Systems/LightSourceCullingSystem.cs @@ -49,7 +49,7 @@ private void ClearLightSourceCulling(ref LightSourceComponent lightSourceCompone lightSourceComponent.Index = -1; lightSourceComponent.Rank = -1; lightSourceComponent.TypeRank = -1; - lightSourceComponent.Culling = LightSourceComponent.CullingFlags.NONE; + lightSourceComponent.Culling = LightSourceComponent.CullingFlags.None; } [Query] @@ -131,7 +131,7 @@ private void CullLightSources([Data] NativeArray<(int, int)> ranks, [Data] int m lightSourceComponent.TypeRank = typeRank; if (lightSourceComponent.Rank >= maxLightCount) - lightSourceComponent.Culling |= LightSourceComponent.CullingFlags.TOO_MANY_LIGHT_SOURCES; + lightSourceComponent.Culling |= LightSourceComponent.CullingFlags.TooManyLightSources; bool shouldDisableShadows = (pbLightSource.TypeCase == PBLightSource.TypeOneofCase.Point && lightSourceComponent.TypeRank >= settings.SceneLimitations.MaxPointLightShadows) || (pbLightSource.TypeCase == PBLightSource.TypeOneofCase.Spot && lightSourceComponent.TypeRank >= settings.SceneLimitations.MaxSpotLightShadows); diff --git a/Explorer/Assets/DCL/SDKComponents/LightSource/Systems/LightSourceLodSystem.cs b/Explorer/Assets/DCL/SDKComponents/LightSource/Systems/LightSourceLodSystem.cs index d5bc7d4c6be..7f67751ffa2 100644 --- a/Explorer/Assets/DCL/SDKComponents/LightSource/Systems/LightSourceLodSystem.cs +++ b/Explorer/Assets/DCL/SDKComponents/LightSource/Systems/LightSourceLodSystem.cs @@ -43,7 +43,7 @@ private void SelectLOD(in PBLightSource pbLightSource, ref LightSourceComponent if (lightSourceComponent.LOD < 0) { - lightSourceComponent.Culling |= LightSourceComponent.CullingFlags.CULLED_BY_LOD; + lightSourceComponent.Culling |= LightSourceComponent.CullingFlags.CulledByLod; return; } diff --git a/Explorer/Assets/DCL/SDKComponents/MediaStream/LivekitPlayer.cs b/Explorer/Assets/DCL/SDKComponents/MediaStream/LivekitPlayer.cs index fc5e5d123c9..5c120178c33 100644 --- a/Explorer/Assets/DCL/SDKComponents/MediaStream/LivekitPlayer.cs +++ b/Explorer/Assets/DCL/SDKComponents/MediaStream/LivekitPlayer.cs @@ -89,7 +89,7 @@ public LivekitPlayer(IRoom streamingRoom, AvatarPlaceHolderTextureSource? placeh public void EnsureVideoIsPlaying() { - if (State != PlayerState.PLAYING) return; + if (State != PlayerState.Playing) return; if (playingAddress == null) return; // Consume the flag even when IsVideoOpened: prevents stale-flag pile-up while the stream is healthy. @@ -117,7 +117,7 @@ public void EnsureVideoIsPlaying() public void EnsureAudioIsPlaying() { - if (State != PlayerState.PLAYING) return; + if (State != PlayerState.Playing) return; if (playingAddress == null) return; bool forceRediscover = pendingAudioRediscovery; @@ -150,7 +150,7 @@ public void OpenMedia(LivekitAddress livekitAddress) OpenVideoStream(livekitAddress); OpenMissingAudioStreams(); - playerState = PlayerState.PLAYING; + playerState = PlayerState.Playing; } private void OpenVideoStream(LivekitAddress livekitAddress) @@ -360,13 +360,13 @@ public void CloseCurrentStream() { // Doesn't need to dispose the stream, because it's responsibility of the owning room. cvs = null; - playerState = PlayerState.STOPPED; + playerState = PlayerState.Stopped; ReleaseAllAudioSources(); } public Texture? LastTexture() { - if (playerState is not PlayerState.PLAYING) + if (playerState is not PlayerState.Playing) return null; if (!cvs.HasValue || !cvs.Value.videoStream.Resource.Has) @@ -469,7 +469,7 @@ private void OnRoomParticipantUpdate(LKParticipant _, UpdateFromParticipant upda public void Play() { - playerState = PlayerState.PLAYING; + playerState = PlayerState.Playing; foreach (var (source, _) in audioSources.Values) source.Play(); @@ -477,7 +477,7 @@ public void Play() public void Pause() { - playerState = PlayerState.PAUSED; + playerState = PlayerState.Paused; // There is no "pause" for a streaming source. foreach (var (source, _) in audioSources.Values) @@ -486,7 +486,7 @@ public void Pause() public void Stop() { - playerState = PlayerState.STOPPED; + playerState = PlayerState.Stopped; foreach (var (source, _) in audioSources.Values) source.Stop(); diff --git a/Explorer/Assets/DCL/SDKComponents/MediaStream/MediaPlayerExtensions.cs b/Explorer/Assets/DCL/SDKComponents/MediaStream/MediaPlayerExtensions.cs index 7b51e94054c..8352d612a88 100644 --- a/Explorer/Assets/DCL/SDKComponents/MediaStream/MediaPlayerExtensions.cs +++ b/Explorer/Assets/DCL/SDKComponents/MediaStream/MediaPlayerExtensions.cs @@ -52,7 +52,7 @@ public static void UpdatePlayback(this LivekitPlayer mediaPlayer, bool hasPlayin if (hasPlaying) { - if (playing != mediaPlayer.State is PlayerState.PLAYING) + if (playing != mediaPlayer.State is PlayerState.Playing) { if (playing) mediaPlayer.Play(); @@ -60,7 +60,7 @@ public static void UpdatePlayback(this LivekitPlayer mediaPlayer, bool hasPlayin mediaPlayer.Pause(); } } - else if (mediaPlayer.State is PlayerState.PLAYING) + else if (mediaPlayer.State is PlayerState.Playing) mediaPlayer.Stop(); } diff --git a/Explorer/Assets/DCL/SDKComponents/MediaStream/MultiMediaPlayer.cs b/Explorer/Assets/DCL/SDKComponents/MediaStream/MultiMediaPlayer.cs index e996825a9cd..e911d74c216 100644 --- a/Explorer/Assets/DCL/SDKComponents/MediaStream/MultiMediaPlayer.cs +++ b/Explorer/Assets/DCL/SDKComponents/MediaStream/MultiMediaPlayer.cs @@ -8,9 +8,9 @@ namespace DCL.SDKComponents.MediaStream { public enum PlayerState { - PAUSED, - PLAYING, - STOPPED, + Paused, + Playing, + Stopped, } public class AvProPlayer @@ -42,7 +42,7 @@ public partial struct MultiMediaPlayer { public bool IsPlaying => Match( static avPro => avPro.AvProMediaPlayer.Control.IsPlaying(), - static livekitPlayer => livekitPlayer.State is PlayerState.PLAYING + static livekitPlayer => livekitPlayer.State is PlayerState.Playing ); public float CurrentTime => Match( @@ -57,12 +57,12 @@ public partial struct MultiMediaPlayer public bool IsFinished => Match( static avPro => avPro.AvProMediaPlayer.Control.IsFinished(), - static livekitPlayer => livekitPlayer.State is PlayerState.STOPPED + static livekitPlayer => livekitPlayer.State is PlayerState.Stopped ); public bool IsPaused => Match( static avPro => avPro.AvProMediaPlayer.Control.IsPaused(), - static livekitPlayer => livekitPlayer.State is PlayerState.PAUSED + static livekitPlayer => livekitPlayer.State is PlayerState.Paused ); public bool IsSeeking => Match( diff --git a/Explorer/Assets/DCL/SDKComponents/SceneUI/Utils/Extensions.cs b/Explorer/Assets/DCL/SDKComponents/SceneUI/Utils/Extensions.cs index d80f013913b..58bcc2deb2f 100644 --- a/Explorer/Assets/DCL/SDKComponents/SceneUI/Utils/Extensions.cs +++ b/Explorer/Assets/DCL/SDKComponents/SceneUI/Utils/Extensions.cs @@ -227,13 +227,13 @@ public static void RegisterInputCallbacks(this UIInputComponent uiInputComponent EventCallback newOnFocusInCallback = evt => { evt.StopPropagation(); - inputBlock.Disable(InputMapComponent.Kind.CAMERA , InputMapComponent.Kind.SHORTCUTS , InputMapComponent.Kind.PLAYER, InputMapComponent.Kind.IN_WORLD_CAMERA); + inputBlock.Disable(InputMapComponent.Kind.Camera , InputMapComponent.Kind.Shortcuts , InputMapComponent.Kind.Player, InputMapComponent.Kind.InWorldCamera); }; EventCallback newOnFocusOutCallback = evt => { evt.StopPropagation(); - inputBlock.Enable(InputMapComponent.Kind.CAMERA , InputMapComponent.Kind.SHORTCUTS , InputMapComponent.Kind.PLAYER, InputMapComponent.Kind.IN_WORLD_CAMERA); + inputBlock.Enable(InputMapComponent.Kind.Camera , InputMapComponent.Kind.Shortcuts , InputMapComponent.Kind.Player, InputMapComponent.Kind.InWorldCamera); }; uiInputComponent.UnregisterInputCallbacks(); diff --git a/Explorer/Assets/DCL/SDKComponents/TriggerArea/Tests/TriggerAreaHandlerSystemShould.cs b/Explorer/Assets/DCL/SDKComponents/TriggerArea/Tests/TriggerAreaHandlerSystemShould.cs index 0c932e95c11..34e01132e69 100644 --- a/Explorer/Assets/DCL/SDKComponents/TriggerArea/Tests/TriggerAreaHandlerSystemShould.cs +++ b/Explorer/Assets/DCL/SDKComponents/TriggerArea/Tests/TriggerAreaHandlerSystemShould.cs @@ -68,7 +68,7 @@ public void SetupSDKEntityTriggerAreaComponentCorrectly() Assert.IsTrue(world.Has(entity)); Assert.IsTrue(world.TryGet(entity, out SDKEntityTriggerAreaComponent triggerAreaComponent)); - Assert.AreEqual(SDKEntityTriggerAreaMeshType.SPHERE, triggerAreaComponent.MeshType); + Assert.AreEqual(SDKEntityTriggerAreaMeshType.Sphere, triggerAreaComponent.MeshType); Assert.AreEqual(ColliderLayer.ClCustom3, triggerAreaComponent.LayerMask); } diff --git a/Explorer/Assets/DCL/SDKEntityTriggerArea/Components/SDKEntityTriggerAreaComponent.cs b/Explorer/Assets/DCL/SDKEntityTriggerArea/Components/SDKEntityTriggerAreaComponent.cs index e7bc779e43c..567a89a9c01 100644 --- a/Explorer/Assets/DCL/SDKEntityTriggerArea/Components/SDKEntityTriggerAreaComponent.cs +++ b/Explorer/Assets/DCL/SDKEntityTriggerArea/Components/SDKEntityTriggerAreaComponent.cs @@ -11,8 +11,8 @@ namespace DCL.SDKEntityTriggerArea.Components { public enum SDKEntityTriggerAreaMeshType { - BOX, - SPHERE + Box, + Sphere } public struct SDKEntityTriggerAreaComponent : IDirtyMarker @@ -46,7 +46,7 @@ public SDKEntityTriggerAreaComponent( Vector3 areaSize, bool targetOnlyMainPlayer = false, SDKEntityTriggerArea? monoBehaviour = null, - SDKEntityTriggerAreaMeshType meshType = SDKEntityTriggerAreaMeshType.BOX, + SDKEntityTriggerAreaMeshType meshType = SDKEntityTriggerAreaMeshType.Box, ColliderLayer layerMask = ColliderLayer.ClPlayer) { AreaSize = areaSize; @@ -80,12 +80,12 @@ public void TryAssignArea(IComponentPool pool, Transform m switch (MeshType) { - case SDKEntityTriggerAreaMeshType.BOX: + case SDKEntityTriggerAreaMeshType.Box: monoBehaviour!.SphereCollider.enabled = false; monoBehaviour.BoxCollider.enabled = true; monoBehaviour.BoxCollider.size = useTransformScaleAsAreaSize ? Vector3.one : AreaSize; break; - case SDKEntityTriggerAreaMeshType.SPHERE: + case SDKEntityTriggerAreaMeshType.Sphere: monoBehaviour!.BoxCollider.enabled = false; monoBehaviour.SphereCollider.enabled = true; monoBehaviour.SphereCollider.radius = useTransformScaleAsAreaSize ? 0.5f : AreaSize.magnitude / 2; diff --git a/Explorer/Assets/DCL/SDKEntityTriggerArea/Tests/PlayMode/SDKEntityTriggerAreaHandlerSystemShould.cs b/Explorer/Assets/DCL/SDKEntityTriggerArea/Tests/PlayMode/SDKEntityTriggerAreaHandlerSystemShould.cs index e1628997091..b3aed6e4ba7 100644 --- a/Explorer/Assets/DCL/SDKEntityTriggerArea/Tests/PlayMode/SDKEntityTriggerAreaHandlerSystemShould.cs +++ b/Explorer/Assets/DCL/SDKEntityTriggerArea/Tests/PlayMode/SDKEntityTriggerAreaHandlerSystemShould.cs @@ -358,8 +358,8 @@ public async Task DiscriminateCharacterTypeCorrectly(bool onlyMainPlayer) } [Test] - [TestCase(SDKEntityTriggerAreaMeshType.BOX)] - [TestCase(SDKEntityTriggerAreaMeshType.SPHERE)] + [TestCase(SDKEntityTriggerAreaMeshType.Box)] + [TestCase(SDKEntityTriggerAreaMeshType.Sphere)] public async Task SetupColliderTypeCorrectly(SDKEntityTriggerAreaMeshType meshType) { // Workaround for Unity bug not awaiting async Setup correctly @@ -372,7 +372,7 @@ public async Task SetupColliderTypeCorrectly(SDKEntityTriggerAreaMeshType meshTy system.Update(0); - if (meshType == SDKEntityTriggerAreaMeshType.BOX) + if (meshType == SDKEntityTriggerAreaMeshType.Box) { Assert.IsTrue(sdkEntityTriggerArea.BoxCollider.enabled); Assert.IsFalse(sdkEntityTriggerArea.SphereCollider.enabled); diff --git a/Explorer/Assets/DCL/SceneLoadingScreens/SceneLoadingScreenController.cs b/Explorer/Assets/DCL/SceneLoadingScreens/SceneLoadingScreenController.cs index 0ad8e4fb240..09ef0f61925 100644 --- a/Explorer/Assets/DCL/SceneLoadingScreens/SceneLoadingScreenController.cs +++ b/Explorer/Assets/DCL/SceneLoadingScreens/SceneLoadingScreenController.cs @@ -37,7 +37,7 @@ public partial class SceneLoadingScreenController : ControllerBase CanvasOrdering.SortingLayer.OVERLAY; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Overlay; public SceneLoadingScreenController(ViewFactoryMethod viewFactory, ISceneTipsProvider sceneTipsProvider, diff --git a/Explorer/Assets/DCL/SceneRestrictionBusController/SceneRestriction/SceneRestriction.cs b/Explorer/Assets/DCL/SceneRestrictionBusController/SceneRestriction/SceneRestriction.cs index 82584faa80d..9782bf50272 100644 --- a/Explorer/Assets/DCL/SceneRestrictionBusController/SceneRestriction/SceneRestriction.cs +++ b/Explorer/Assets/DCL/SceneRestrictionBusController/SceneRestriction/SceneRestriction.cs @@ -8,67 +8,67 @@ public struct SceneRestriction public static SceneRestriction CreateCameraLocked(SceneRestrictionsAction action) => new() { - Type = SceneRestrictions.CAMERA_LOCKED, + Type = SceneRestrictions.CameraLocked, Action = action, }; public static SceneRestriction CreateAvatarHidden(SceneRestrictionsAction action) => new() { - Type = SceneRestrictions.AVATAR_HIDDEN, + Type = SceneRestrictions.AvatarHidden, Action = action, }; public static SceneRestriction CreateAvatarMovementsBlocked(SceneRestrictionsAction action) => new() { - Type = SceneRestrictions.AVATAR_MOVEMENTS_BLOCKED, + Type = SceneRestrictions.AvatarMovementsBlocked, Action = action, }; public static SceneRestriction CreatePassportCannotBeOpened(SceneRestrictionsAction action) => new() { - Type = SceneRestrictions.PASSPORT_CANNOT_BE_OPENED, + Type = SceneRestrictions.PassportCannotBeOpened, Action = action, }; public static SceneRestriction CreateExperiencesBlocked(SceneRestrictionsAction action) => new() { - Type = SceneRestrictions.EXPERIENCES_BLOCKED, + Type = SceneRestrictions.ExperiencesBlocked, Action = action, }; public static SceneRestriction CreateSkyboxTimeUILocked(SceneRestrictionsAction action) => new () { - Type = SceneRestrictions.SKYBOX_TIME_UI_BLOCKED, + Type = SceneRestrictions.SkyboxTimeUiBlocked, Action = action, }; public static SceneRestriction CreateNearbyVoiceChatBlocked(SceneRestrictionsAction action) => new () { - Type = SceneRestrictions.NEARBY_VOICE_CHAT_BLOCKED, + Type = SceneRestrictions.NearbyVoiceChatBlocked, Action = action, }; } public enum SceneRestrictions { - CAMERA_LOCKED, - AVATAR_HIDDEN, - AVATAR_MOVEMENTS_BLOCKED, - PASSPORT_CANNOT_BE_OPENED, - EXPERIENCES_BLOCKED, - SKYBOX_TIME_UI_BLOCKED, - NEARBY_VOICE_CHAT_BLOCKED, + CameraLocked, + AvatarHidden, + AvatarMovementsBlocked, + PassportCannotBeOpened, + ExperiencesBlocked, + SkyboxTimeUiBlocked, + NearbyVoiceChatBlocked, } public enum SceneRestrictionsAction { - APPLIED, - REMOVED, + Applied, + Removed, } } diff --git a/Explorer/Assets/DCL/SceneRestrictionBusController/SceneRestrictionBus/SceneRestrictionBusController.cs b/Explorer/Assets/DCL/SceneRestrictionBusController/SceneRestrictionBus/SceneRestrictionBusController.cs index baf33e3a998..3f46ac65712 100644 --- a/Explorer/Assets/DCL/SceneRestrictionBusController/SceneRestrictionBus/SceneRestrictionBusController.cs +++ b/Explorer/Assets/DCL/SceneRestrictionBusController/SceneRestrictionBus/SceneRestrictionBusController.cs @@ -11,7 +11,7 @@ public class SceneRestrictionBusController : ISceneRestrictionBusController public void PushSceneRestriction(SceneRestriction.SceneRestriction sceneRestriction) { - if (sceneRestriction.Action == SceneRestriction.SceneRestrictionsAction.APPLIED) + if (sceneRestriction.Action == SceneRestriction.SceneRestrictionsAction.Applied) activeRestrictions[sceneRestriction.Type] = sceneRestriction; else activeRestrictions.Remove(sceneRestriction.Type); diff --git a/Explorer/Assets/DCL/Settings/Configuration/DropdownModuleBinding.cs b/Explorer/Assets/DCL/Settings/Configuration/DropdownModuleBinding.cs index 11f71c6f135..10dc54c1b9a 100644 --- a/Explorer/Assets/DCL/Settings/Configuration/DropdownModuleBinding.cs +++ b/Explorer/Assets/DCL/Settings/Configuration/DropdownModuleBinding.cs @@ -30,22 +30,22 @@ public class DropdownModuleBinding : SettingsModuleBinding CreateModuleAsync( @@ -69,34 +69,34 @@ public override async UniTask CreateModuleAsync( SettingsFeatureController controller = Feature switch { - DropdownFeatures.GRAPHICS_QUALITY_FEATURE => new GraphicsPresetSettingsController(viewInstance, qualitySettingsController), - DropdownFeatures.CAMERA_LOCK_FEATURE => new CameraLockSettingsController(viewInstance), - DropdownFeatures.CAMERA_SHOULDER_FEATURE => new CameraShoulderSettingsController(viewInstance), - DropdownFeatures.RESOLUTION_FEATURE => new ResolutionSettingsController(viewInstance), - DropdownFeatures.FPS_LIMIT_FEATURE => new FpsLimitSettingsController(viewInstance, qualitySettingsController), + DropdownFeatures.GraphicsQualityFeature => new GraphicsPresetSettingsController(viewInstance, qualitySettingsController), + DropdownFeatures.CameraLockFeature => new CameraLockSettingsController(viewInstance), + DropdownFeatures.CameraShoulderFeature => new CameraShoulderSettingsController(viewInstance), + DropdownFeatures.ResolutionFeature => new ResolutionSettingsController(viewInstance), + DropdownFeatures.FpsLimitFeature => new FpsLimitSettingsController(viewInstance, qualitySettingsController), - DropdownFeatures.MEMORY_LIMIT_FEATURE => new MemoryLimitSettingController(viewInstance, + DropdownFeatures.MemoryLimitFeature => new MemoryLimitSettingController(viewInstance, systemMemoryCap, sceneLoadingLimit), - DropdownFeatures.CHAT_NEARBY_AUDIO_MODES_FEATURE => new ChatSoundsSettingsController(viewInstance, + DropdownFeatures.ChatNearbyAudioModesFeature => new ChatSoundsSettingsController(viewInstance, generalAudioMixer, chatSettingsAsset), - DropdownFeatures.CHAT_DMS_MODES_FEATURE => new ChatPrivacySettingsController(viewInstance, + DropdownFeatures.ChatDmsModesFeature => new ChatPrivacySettingsController(viewInstance, chatSettingsAsset), - DropdownFeatures.CHAT_BUBBLES_MODES_FEATURE => CreateChatBubblesController(viewInstance, chatSettingsAsset, settingsEventListener), + DropdownFeatures.ChatBubblesModesFeature => CreateChatBubblesController(viewInstance, chatSettingsAsset, settingsEventListener), - DropdownFeatures.VOICECHAT_INPUT_DEVICE => new InputDeviceController(viewInstance), + DropdownFeatures.VoicechatInputDevice => new InputDeviceController(viewInstance), - DropdownFeatures.CHAT_TRANSLATE_FEATURE => new ChatTranslationSettingsController(viewInstance, + DropdownFeatures.ChatTranslateFeature => new ChatTranslationSettingsController(viewInstance, chatSettingsAsset, eventBus), - DropdownFeatures.MSAA_FEATURE => CreateDropdownQualityController(viewInstance, qualitySettingsController, MSAA_LEVELS, qualitySettingsController.SetMsaa, x => x.Msaa), - DropdownFeatures.SHADOWS_QUALITY_FEATURE => CreateDropdownQualityController(viewInstance, qualitySettingsController, SHADOW_QUALITY_LEVELS, qualitySettingsController.SetShadowQuality, x => x.SceneShadowQuality), + DropdownFeatures.MsaaFeature => CreateDropdownQualityController(viewInstance, qualitySettingsController, MSAA_LEVELS, qualitySettingsController.SetMsaa, x => x.Msaa), + DropdownFeatures.ShadowsQualityFeature => CreateDropdownQualityController(viewInstance, qualitySettingsController, SHADOW_QUALITY_LEVELS, qualitySettingsController.SetShadowQuality, x => x.SceneShadowQuality), - DropdownFeatures.POINT_AT_MARKER_FEATURE => new PointAtMarkerVisibilityController(viewInstance, pointAtMarkerVisibilitySettings), + DropdownFeatures.PointAtMarkerFeature => new PointAtMarkerVisibilityController(viewInstance, pointAtMarkerVisibilitySettings), // add other cases... _ => throw new ArgumentOutOfRangeException(nameof(viewInstance)) }; diff --git a/Explorer/Assets/DCL/Settings/Configuration/SliderModuleBinding.cs b/Explorer/Assets/DCL/Settings/Configuration/SliderModuleBinding.cs index e6bbbdc7c6a..bac248a5de6 100644 --- a/Explorer/Assets/DCL/Settings/Configuration/SliderModuleBinding.cs +++ b/Explorer/Assets/DCL/Settings/Configuration/SliderModuleBinding.cs @@ -24,20 +24,20 @@ public class SliderModuleBinding : SettingsModuleBinding CreateModuleAsync( @@ -61,20 +61,20 @@ public override async UniTask CreateModuleAsync( SettingsFeatureController controller = Feature switch { - SliderFeatures.SCENE_DISTANCE_FEATURE => CreateSimpleSlider(viewInstance, qualitySettingsController, v => qualitySettingsController.SetSceneDistance((int)v), x => x.SceneDistance), - SliderFeatures.ENVIRONMENT_DISTANCE_FEATURE => CreateSimpleSlider(viewInstance, qualitySettingsController, qualitySettingsController.SetLandscapeDistance, x => x.LandscapeDistance), - SliderFeatures.MOUSE_VERTICAL_SENSITIVITY_FEATURE => new MouseVerticalSensitivitySettingsController(viewInstance, controlsSettingsAsset), - SliderFeatures.MOUSE_HORIZONTAL_SENSITIVITY_FEATURE => new MouseHorizontalSensitivitySettingsController(viewInstance, controlsSettingsAsset), - SliderFeatures.MASTER_VOLUME_FEATURE => new MasterVolumeSettingsController(viewInstance, generalAudioMixer, volumeBus), - SliderFeatures.WORLD_SOUNDS_VOLUME_FEATURE => new WorldSoundsVolumeSettingsController(viewInstance, generalAudioMixer, volumeBus), - SliderFeatures.MUSIC_SFX_SOUND_VOLUME_FEATURE => new MusicAndSFXVolumeSettingsController(viewInstance, generalAudioMixer, volumeBus), - SliderFeatures.MUSIC_VOLUME_FEATURE => new MusicVolumeSettingsController(viewInstance, generalAudioMixer), - SliderFeatures.UI_SOUNDS_VOLUME_FEATURE => new UISoundsVolumeSettingsController(viewInstance, generalAudioMixer), - SliderFeatures.AVATAR_SOUNDS_VOLUME_FEATURE => new AvatarSoundsVolumeSettingsController(viewInstance, generalAudioMixer), - SliderFeatures.VOICE_CHAT_VOLUME_FEATURE => new VoiceChatVolumeSettingsController(viewInstance, generalAudioMixer, volumeBus), - SliderFeatures.UPSCALER_FEATURE => new UpscalingSettingsController(viewInstance, qualitySettingsController), - SliderFeatures.MAX_SCENE_LIGHTS_FEATURE => CreateSimpleSlider(viewInstance, qualitySettingsController, v => qualitySettingsController.SetMaxSceneLights((int)v), x => x.MaxSceneLights), - SliderFeatures.SHADOW_DISTANCE_FEATURE => CreateSimpleSlider(viewInstance, qualitySettingsController, v => qualitySettingsController.SetShadowDistance((int)v), x => x.ShadowDistance), + SliderFeatures.SceneDistanceFeature => CreateSimpleSlider(viewInstance, qualitySettingsController, v => qualitySettingsController.SetSceneDistance((int)v), x => x.SceneDistance), + SliderFeatures.EnvironmentDistanceFeature => CreateSimpleSlider(viewInstance, qualitySettingsController, qualitySettingsController.SetLandscapeDistance, x => x.LandscapeDistance), + SliderFeatures.MouseVerticalSensitivityFeature => new MouseVerticalSensitivitySettingsController(viewInstance, controlsSettingsAsset), + SliderFeatures.MouseHorizontalSensitivityFeature => new MouseHorizontalSensitivitySettingsController(viewInstance, controlsSettingsAsset), + SliderFeatures.MasterVolumeFeature => new MasterVolumeSettingsController(viewInstance, generalAudioMixer, volumeBus), + SliderFeatures.WorldSoundsVolumeFeature => new WorldSoundsVolumeSettingsController(viewInstance, generalAudioMixer, volumeBus), + SliderFeatures.MusicSFXSoundVolumeFeature => new MusicAndSFXVolumeSettingsController(viewInstance, generalAudioMixer, volumeBus), + SliderFeatures.MusicVolumeFeature => new MusicVolumeSettingsController(viewInstance, generalAudioMixer), + SliderFeatures.UiSoundsVolumeFeature => new UISoundsVolumeSettingsController(viewInstance, generalAudioMixer), + SliderFeatures.AvatarSoundsVolumeFeature => new AvatarSoundsVolumeSettingsController(viewInstance, generalAudioMixer), + SliderFeatures.VoiceChatVolumeFeature => new VoiceChatVolumeSettingsController(viewInstance, generalAudioMixer, volumeBus), + SliderFeatures.UpscalerFeature => new UpscalingSettingsController(viewInstance, qualitySettingsController), + SliderFeatures.MaxSceneLightsFeature => CreateSimpleSlider(viewInstance, qualitySettingsController, v => qualitySettingsController.SetMaxSceneLights((int)v), x => x.MaxSceneLights), + SliderFeatures.ShadowDistanceFeature => CreateSimpleSlider(viewInstance, qualitySettingsController, v => qualitySettingsController.SetShadowDistance((int)v), x => x.ShadowDistance), // add other cases... _ => throw new ArgumentOutOfRangeException(), }; diff --git a/Explorer/Assets/DCL/Settings/Configuration/ToggleModuleBinding.cs b/Explorer/Assets/DCL/Settings/Configuration/ToggleModuleBinding.cs index 3531c6f8092..4f6dc6ede77 100644 --- a/Explorer/Assets/DCL/Settings/Configuration/ToggleModuleBinding.cs +++ b/Explorer/Assets/DCL/Settings/Configuration/ToggleModuleBinding.cs @@ -25,23 +25,23 @@ public class ToggleModuleBinding : SettingsModuleBinding CreateModuleAsync( @@ -65,22 +65,22 @@ public override async UniTask CreateModuleAsync( SettingsFeatureController controller = Feature switch { - ToggleFeatures.GRAPHICS_VSYNC_TOGGLE_FEATURE => new GraphicsVSyncController(viewInstance, qualitySettingsController), - ToggleFeatures.HIDE_BLOCKED_USER_CHAT_MESSAGES_FEATURE => new HideBlockedUsersChatMessagesController(viewInstance, userBlockingCache), - ToggleFeatures.HEAD_SYNC_FEATURE => new HeadSyncController(viewInstance), - ToggleFeatures.CHAT_REACTIONS_ENABLED_FEATURE => CreateChatReactionsController(viewInstance, chatSettingsAsset), - ToggleFeatures.HDR_FEATURE => CreateSimpleToggle(viewInstance, qualitySettingsController, qualitySettingsController.SetHdr, x => x.Hdr), - ToggleFeatures.BLOOM_FEATURE => CreateSimpleToggle(viewInstance, qualitySettingsController, qualitySettingsController.SetBloom, x => x.Bloom), - ToggleFeatures.AVATAR_OUTLINE_FEATURE => CreateSimpleToggle(viewInstance, qualitySettingsController, qualitySettingsController.SetAvatarOutline, x => x.AvatarOutline), - ToggleFeatures.SUN_SHADOWS_FEATURE => CreateSimpleToggle(viewInstance, qualitySettingsController, qualitySettingsController.SetSunShadows, x => x.SunShadows), - ToggleFeatures.SUN_LENS_FLARE_FEATURE => CreateSimpleToggle(viewInstance, qualitySettingsController, qualitySettingsController.SetSunLensFlare, x => x.SunLensFlare), - ToggleFeatures.SCENE_SHADOWS_FEATURE => CreateSimpleToggle(viewInstance, qualitySettingsController, qualitySettingsController.SetSceneLightShadows, x => x.SceneLightShadows), - ToggleFeatures.SCENE_LIGHTS_FEATURE => CreateSimpleToggle(viewInstance, qualitySettingsController, qualitySettingsController.SetSceneLights, x => x.SceneLights), - ToggleFeatures.FULLSCREEN_FEATURE => new FullscreenSettingsController(viewInstance), - ToggleFeatures.PLAY_CURRENT_SCENE_STREAM_ONLY_FEATURE => new PlayCurrentSceneStreamSettingsController(viewInstance, videoPrioritizationSettings, qualitySettingsController), - ToggleFeatures.DOUBLE_TAP_TO_MOVE => new DoubleTapToMoveSettingsController(viewInstance), - ToggleFeatures.MUTE_MIC_IN_BACKGROUND_FEATURE => new MuteMicInBackgroundController(viewInstance), - ToggleFeatures.SPRING_BONE_SIMULATION_FEATURE => CreateSimpleToggle(viewInstance, qualitySettingsController, qualitySettingsController.SetSpringBoneSimulation, x => x.SpringBoneSimulation), + ToggleFeatures.GraphicsVsyncToggleFeature => new GraphicsVSyncController(viewInstance, qualitySettingsController), + ToggleFeatures.HideBlockedUserChatMessagesFeature => new HideBlockedUsersChatMessagesController(viewInstance, userBlockingCache), + ToggleFeatures.HeadSyncFeature => new HeadSyncController(viewInstance), + ToggleFeatures.ChatReactionsEnabledFeature => CreateChatReactionsController(viewInstance, chatSettingsAsset), + ToggleFeatures.HdrFeature => CreateSimpleToggle(viewInstance, qualitySettingsController, qualitySettingsController.SetHdr, x => x.Hdr), + ToggleFeatures.BloomFeature => CreateSimpleToggle(viewInstance, qualitySettingsController, qualitySettingsController.SetBloom, x => x.Bloom), + ToggleFeatures.AvatarOutlineFeature => CreateSimpleToggle(viewInstance, qualitySettingsController, qualitySettingsController.SetAvatarOutline, x => x.AvatarOutline), + ToggleFeatures.SunShadowsFeature => CreateSimpleToggle(viewInstance, qualitySettingsController, qualitySettingsController.SetSunShadows, x => x.SunShadows), + ToggleFeatures.SunLensFlareFeature => CreateSimpleToggle(viewInstance, qualitySettingsController, qualitySettingsController.SetSunLensFlare, x => x.SunLensFlare), + ToggleFeatures.SceneShadowsFeature => CreateSimpleToggle(viewInstance, qualitySettingsController, qualitySettingsController.SetSceneLightShadows, x => x.SceneLightShadows), + ToggleFeatures.SceneLightsFeature => CreateSimpleToggle(viewInstance, qualitySettingsController, qualitySettingsController.SetSceneLights, x => x.SceneLights), + ToggleFeatures.FullscreenFeature => new FullscreenSettingsController(viewInstance), + ToggleFeatures.PlayCurrentSceneStreamOnlyFeature => new PlayCurrentSceneStreamSettingsController(viewInstance, videoPrioritizationSettings, qualitySettingsController), + ToggleFeatures.DoubleTapToMove => new DoubleTapToMoveSettingsController(viewInstance), + ToggleFeatures.MuteMicInBackgroundFeature => new MuteMicInBackgroundController(viewInstance), + ToggleFeatures.SpringBoneSimulationFeature => CreateSimpleToggle(viewInstance, qualitySettingsController, qualitySettingsController.SetSpringBoneSimulation, x => x.SpringBoneSimulation), // add other cases... _ => throw new ArgumentOutOfRangeException(nameof(viewInstance)) }; diff --git a/Explorer/Assets/DCL/Settings/ModuleControllers/ChatBubblesVisibilityController.cs b/Explorer/Assets/DCL/Settings/ModuleControllers/ChatBubblesVisibilityController.cs index 2ae8473d06b..77e4ee35b57 100644 --- a/Explorer/Assets/DCL/Settings/ModuleControllers/ChatBubblesVisibilityController.cs +++ b/Explorer/Assets/DCL/Settings/ModuleControllers/ChatBubblesVisibilityController.cs @@ -27,17 +27,17 @@ private void SetSettings(int index) { switch (index) { - case (int)ChatBubbleVisibilitySettings.ALL: - chatSettingsAsset.SetBubblesVisibility(ChatBubbleVisibilitySettings.ALL); - settingsEventListener.NotifyChatBubblesVisibilityChanged(ChatBubbleVisibilitySettings.ALL); + case (int)ChatBubbleVisibilitySettings.All: + chatSettingsAsset.SetBubblesVisibility(ChatBubbleVisibilitySettings.All); + settingsEventListener.NotifyChatBubblesVisibilityChanged(ChatBubbleVisibilitySettings.All); break; - case (int)ChatBubbleVisibilitySettings.NEARBY_ONLY: - chatSettingsAsset.SetBubblesVisibility(ChatBubbleVisibilitySettings.NEARBY_ONLY); - settingsEventListener.NotifyChatBubblesVisibilityChanged(ChatBubbleVisibilitySettings.NEARBY_ONLY); + case (int)ChatBubbleVisibilitySettings.NearbyOnly: + chatSettingsAsset.SetBubblesVisibility(ChatBubbleVisibilitySettings.NearbyOnly); + settingsEventListener.NotifyChatBubblesVisibilityChanged(ChatBubbleVisibilitySettings.NearbyOnly); break; - case (int)ChatBubbleVisibilitySettings.NONE: - chatSettingsAsset.SetBubblesVisibility(ChatBubbleVisibilitySettings.NONE); - settingsEventListener.NotifyChatBubblesVisibilityChanged(ChatBubbleVisibilitySettings.NONE); + case (int)ChatBubbleVisibilitySettings.None: + chatSettingsAsset.SetBubblesVisibility(ChatBubbleVisibilitySettings.None); + settingsEventListener.NotifyChatBubblesVisibilityChanged(ChatBubbleVisibilitySettings.None); break; default: ReportHub.LogWarning(ReportCategory.SETTINGS_MENU, $"Invalid index value for ChatPrivacySettingsController: {index}"); diff --git a/Explorer/Assets/DCL/Settings/ModuleControllers/ChatPrivacySettingsController.cs b/Explorer/Assets/DCL/Settings/ModuleControllers/ChatPrivacySettingsController.cs index 7b704ea21f7..910c163c017 100644 --- a/Explorer/Assets/DCL/Settings/ModuleControllers/ChatPrivacySettingsController.cs +++ b/Explorer/Assets/DCL/Settings/ModuleControllers/ChatPrivacySettingsController.cs @@ -27,11 +27,11 @@ private void SetSettings(int index) { switch (index) { - case (int)ChatPrivacySettings.ALL: - chatSettingsAsset.OnPrivacySet(ChatPrivacySettings.ALL); + case (int)ChatPrivacySettings.All: + chatSettingsAsset.OnPrivacySet(ChatPrivacySettings.All); break; - case (int)ChatPrivacySettings.ONLY_FRIENDS: - chatSettingsAsset.OnPrivacySet(ChatPrivacySettings.ONLY_FRIENDS); + case (int)ChatPrivacySettings.OnlyFriends: + chatSettingsAsset.OnPrivacySet(ChatPrivacySettings.OnlyFriends); break; default: ReportHub.LogWarning(ReportCategory.SETTINGS_MENU, $"Invalid index value for ChatPrivacySettingsController: {index}"); diff --git a/Explorer/Assets/DCL/Settings/ModuleControllers/ChatSoundsSettingsController.cs b/Explorer/Assets/DCL/Settings/ModuleControllers/ChatSoundsSettingsController.cs index b420d758421..b6d9f251e8f 100644 --- a/Explorer/Assets/DCL/Settings/ModuleControllers/ChatSoundsSettingsController.cs +++ b/Explorer/Assets/DCL/Settings/ModuleControllers/ChatSoundsSettingsController.cs @@ -31,16 +31,16 @@ private void SetChatSoundsSettings(int index) { switch (index) { - case (int)ChatAudioSettings.NONE: - chatSettingsAsset.chatAudioSettings = ChatAudioSettings.NONE; + case (int)ChatAudioSettings.None: + chatSettingsAsset.chatAudioSettings = ChatAudioSettings.None; generalAudioMixer.SetFloat(CHAT_VOLUME_EXPOSED_PARAM, AudioUtils.PercentageVolumeToDecibel(0f)); break; - case (int)ChatAudioSettings.MENTIONS_ONLY: - chatSettingsAsset.chatAudioSettings = ChatAudioSettings.MENTIONS_ONLY; + case (int)ChatAudioSettings.MentionsOnly: + chatSettingsAsset.chatAudioSettings = ChatAudioSettings.MentionsOnly; generalAudioMixer.SetFloat(CHAT_VOLUME_EXPOSED_PARAM, AudioUtils.PercentageVolumeToDecibel(100f)); break; - case (int)ChatAudioSettings.ALL: - chatSettingsAsset.chatAudioSettings = ChatAudioSettings.ALL; + case (int)ChatAudioSettings.All: + chatSettingsAsset.chatAudioSettings = ChatAudioSettings.All; generalAudioMixer.SetFloat(CHAT_VOLUME_EXPOSED_PARAM, AudioUtils.PercentageVolumeToDecibel(100f)); break; default: diff --git a/Explorer/Assets/DCL/Settings/ModuleControllers/ChatTranslationSettingsController.cs b/Explorer/Assets/DCL/Settings/ModuleControllers/ChatTranslationSettingsController.cs index e0eaeb084c3..47082cd11cc 100644 --- a/Explorer/Assets/DCL/Settings/ModuleControllers/ChatTranslationSettingsController.cs +++ b/Explorer/Assets/DCL/Settings/ModuleControllers/ChatTranslationSettingsController.cs @@ -35,7 +35,7 @@ public ChatTranslationSettingsController(SettingsDropdownModuleView view, view.DropdownView.Dropdown.template.sizeDelta = new Vector2(view.DropdownView.Dropdown.template.sizeDelta.x, 300f); view.DropdownView.Dropdown.onValueChanged.AddListener(SetPreferredLanguageSettings); - bool isTranslationChatEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.CHAT_TRANSLATIONS); + bool isTranslationChatEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.ChatTranslations); view.gameObject.SetActive(isTranslationChatEnabled); if (view.TooltipButtonView != null) diff --git a/Explorer/Assets/DCL/Settings/ModuleControllers/DoubleTapToMoveSettingsController.cs b/Explorer/Assets/DCL/Settings/ModuleControllers/DoubleTapToMoveSettingsController.cs index 77f6239a424..88296c39218 100644 --- a/Explorer/Assets/DCL/Settings/ModuleControllers/DoubleTapToMoveSettingsController.cs +++ b/Explorer/Assets/DCL/Settings/ModuleControllers/DoubleTapToMoveSettingsController.cs @@ -12,7 +12,7 @@ public DoubleTapToMoveSettingsController(SettingsToggleModuleView view) { this.view = view; - if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.DOUBLE_CLICK_WALK)) + if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.DoubleClickWalk)) { view.SetActive(false); return; diff --git a/Explorer/Assets/DCL/Settings/ModuleControllers/PointAtMarkerVisibilityController.cs b/Explorer/Assets/DCL/Settings/ModuleControllers/PointAtMarkerVisibilityController.cs index 841a559638d..c2f123f7684 100644 --- a/Explorer/Assets/DCL/Settings/ModuleControllers/PointAtMarkerVisibilityController.cs +++ b/Explorer/Assets/DCL/Settings/ModuleControllers/PointAtMarkerVisibilityController.cs @@ -31,14 +31,14 @@ private void SetSettings(int index) { switch (index) { - case (int)PointAtMarkerVisibilitySettings.VisibilitySetting.FRIENDS_ONLY: - pointAtMarkerVisibilitySettings.SetMarkerVisibility(PointAtMarkerVisibilitySettings.VisibilitySetting.FRIENDS_ONLY); + case (int)PointAtMarkerVisibilitySettings.VisibilitySetting.FriendsOnly: + pointAtMarkerVisibilitySettings.SetMarkerVisibility(PointAtMarkerVisibilitySettings.VisibilitySetting.FriendsOnly); break; - case (int)PointAtMarkerVisibilitySettings.VisibilitySetting.ALL: - pointAtMarkerVisibilitySettings.SetMarkerVisibility(PointAtMarkerVisibilitySettings.VisibilitySetting.ALL); + case (int)PointAtMarkerVisibilitySettings.VisibilitySetting.All: + pointAtMarkerVisibilitySettings.SetMarkerVisibility(PointAtMarkerVisibilitySettings.VisibilitySetting.All); break; - case (int)PointAtMarkerVisibilitySettings.VisibilitySetting.NONE: - pointAtMarkerVisibilitySettings.SetMarkerVisibility(PointAtMarkerVisibilitySettings.VisibilitySetting.NONE); + case (int)PointAtMarkerVisibilitySettings.VisibilitySetting.None: + pointAtMarkerVisibilitySettings.SetMarkerVisibility(PointAtMarkerVisibilitySettings.VisibilitySetting.None); break; default: ReportHub.LogWarning(ReportCategory.SETTINGS_MENU, $"Invalid index value for PointAtMarkerVisibilityController: {index}"); diff --git a/Explorer/Assets/DCL/Settings/ModuleControllers/VoiceChatVolumeSettingsController.cs b/Explorer/Assets/DCL/Settings/ModuleControllers/VoiceChatVolumeSettingsController.cs index f84898de44f..41f5dc5a296 100644 --- a/Explorer/Assets/DCL/Settings/ModuleControllers/VoiceChatVolumeSettingsController.cs +++ b/Explorer/Assets/DCL/Settings/ModuleControllers/VoiceChatVolumeSettingsController.cs @@ -29,7 +29,7 @@ public VoiceChatVolumeSettingsController(SettingsSliderModuleView view, AudioMix volumeBus.OnVoiceChatVolumeChanged += OnVoiceChatVolumeChangedExternally; - bool isVoiceChatEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.VOICE_CHAT); + bool isVoiceChatEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.VoiceChat); view.SetActive(isVoiceChatEnabled); } diff --git a/Explorer/Assets/DCL/Settings/Settings/PointAtMarkerVisibilitySettings.cs b/Explorer/Assets/DCL/Settings/Settings/PointAtMarkerVisibilitySettings.cs index 92aee5673e8..976ce5014df 100644 --- a/Explorer/Assets/DCL/Settings/Settings/PointAtMarkerVisibilitySettings.cs +++ b/Explorer/Assets/DCL/Settings/Settings/PointAtMarkerVisibilitySettings.cs @@ -5,16 +5,16 @@ namespace DCL.Settings.Settings [CreateAssetMenu(fileName = "PointAtMarkerVisibilitySettings", menuName = "DCL/Settings/Point at marker Settings")] public class PointAtMarkerVisibilitySettings : ScriptableObject { - public VisibilitySetting MarkerVisibilitySetting = VisibilitySetting.FRIENDS_ONLY; + public VisibilitySetting MarkerVisibilitySetting = VisibilitySetting.FriendsOnly; public void SetMarkerVisibility(VisibilitySetting visibilitySetting) => MarkerVisibilitySetting = visibilitySetting; public enum VisibilitySetting { - FRIENDS_ONLY = 0, - ALL = 1, - NONE = 2, + FriendsOnly = 0, + All = 1, + None = 2, } } } diff --git a/Explorer/Assets/DCL/Settings/SettingsController.cs b/Explorer/Assets/DCL/Settings/SettingsController.cs index e932fcb2fd5..463a0e5cd00 100644 --- a/Explorer/Assets/DCL/Settings/SettingsController.cs +++ b/Explorer/Assets/DCL/Settings/SettingsController.cs @@ -1,239 +1,239 @@ -using Cysharp.Threading.Tasks; -using DCL.AssetsProvision; -using DCL.Audio; -using DCL.Diagnostics; -using DCL.FeatureFlags; -using DCL.Friends.UserBlocking; -using DCL.Optimization.PerformanceBudgeting; -using DCL.Quality.Runtime; -using DCL.SDKComponents.MediaStream.Settings; -using DCL.Settings.Configuration; -using DCL.Settings.ModuleControllers; -using DCL.Settings.Settings; -using DCL.UI; -using ECS.SceneLifeCycle.IncreasingRadius; -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.Audio; -using Utility; - -namespace DCL.Settings -{ - public class SettingsController : ISection, IDisposable, ISettingsModuleEventListener - { - public enum SettingsSection - { - GENERAL, - GRAPHICS, - SOUND, - CONTROLS, - CHAT - } - - private readonly SettingsView view; - private readonly SettingsMenuConfiguration settingsMenuConfiguration; - private readonly QualitySettingsController qualitySettingsController; - private readonly AudioMixer generalAudioMixer; - private readonly VideoPrioritizationSettings videoPrioritizationSettings; - private readonly ISystemMemoryCap memoryCap; - private readonly SceneLoadingLimit sceneLoadingLimit; - private readonly VolumeBus volumeBus; - private readonly ControlsSettingsAsset controlsSettingsAsset; - private readonly RectTransform rectTransform; - private readonly List controllers = new (); - private readonly ChatSettingsAsset chatSettingsAsset; - private readonly IUserBlockingCache userBlockingCache; - private readonly IAssetsProvisioner assetsProvisioner; - private readonly IEventBus eventBus; - private readonly PointAtMarkerVisibilitySettings pointAtMarkerVisibilitySettings; - - private readonly IReadOnlyDictionary sections; - - public event Action? ChatBubblesVisibilityChanged; - - public SettingsController( - SettingsView view, - SettingsMenuConfiguration settingsMenuConfiguration, - QualitySettingsController qualitySettingsController, - AudioMixer generalAudioMixer, - VideoPrioritizationSettings videoPrioritizationSettings, - ControlsSettingsAsset controlsSettingsAsset, - ISystemMemoryCap memoryCap, - ChatSettingsAsset chatSettingsAsset, - IUserBlockingCache userBlockingCache, - SceneLoadingLimit sceneLoadingLimit, - VolumeBus volumeBus, - IAssetsProvisioner assetsProvisioner, - IEventBus eventBus, - PointAtMarkerVisibilitySettings pointAtMarkerVisibilitySettings) - { - this.view = view; - this.settingsMenuConfiguration = settingsMenuConfiguration; - this.qualitySettingsController = qualitySettingsController; - this.generalAudioMixer = generalAudioMixer; - this.memoryCap = memoryCap; - this.chatSettingsAsset = chatSettingsAsset; - this.volumeBus = volumeBus; - this.userBlockingCache = userBlockingCache; - this.controlsSettingsAsset = controlsSettingsAsset; - this.videoPrioritizationSettings = videoPrioritizationSettings; - this.sceneLoadingLimit = sceneLoadingLimit; - this.assetsProvisioner = assetsProvisioner; - this.eventBus = eventBus; - this.pointAtMarkerVisibilitySettings = pointAtMarkerVisibilitySettings; - rectTransform = view.transform.parent.GetComponent(); - - sections = new Dictionary - { - [SettingsSection.GENERAL] = (view.GeneralSectionContainer, view.GeneralSectionButton, view.GeneralSectionBackground, settingsMenuConfiguration.GeneralSectionConfig), - [SettingsSection.GRAPHICS] = (view.GraphicsSectionContainer, view.GraphicsSectionButton, view.GraphicsSectionBackground, settingsMenuConfiguration.GraphicsSectionConfig), - [SettingsSection.SOUND] = (view.SoundSectionContainer, view.SoundSectionButton, view.SoundSectionBackground, settingsMenuConfiguration.SoundSectionConfig), - [SettingsSection.CONTROLS] = (view.ControlsSectionContainer, view.ControlsSectionButton, view.ControlsSectionBackground, settingsMenuConfiguration.ControlsSectionConfig), - [SettingsSection.CHAT] = (view.ChatSectionContainer, view.ChatSectionButton, view.ChatSectionBackground, settingsMenuConfiguration.ChatSectionConfig), - }; - - foreach (var pair in sections) - pair.Value.button!.Button.onClick!.AddListener(() => OpenSection(pair.Key, pair.Value.config!.SettingsGroups.Count)); - } - - public UniTask InitializeAsync() => - GenerateSettingsAsync(); - - public void Activate() - { - view.gameObject.SetActive(true); - } - - public void Deactivate() - { - view.gameObject.SetActive(false); - } - - public void Toggle(SettingsSection section) - { - var config = sections[section]; - OpenSection(section, config.config!.SettingsGroups.Count); - } - - public void Animate(int triggerId) - { - view.PanelAnimator.SetTrigger(triggerId); - view.HeaderAnimator.SetTrigger(triggerId); - } - - public void ResetAnimator() - { - view.PanelAnimator.Rebind(); - view.HeaderAnimator.Rebind(); - view.PanelAnimator.Update(0); - view.HeaderAnimator.Update(0); - } - - public RectTransform GetRectTransform() => - rectTransform; - - public void NotifyChatBubblesVisibilityChanged(ChatBubbleVisibilitySettings newVisibility) - { - ChatBubblesVisibilityChanged?.Invoke(newVisibility); - } - - private async UniTask GenerateSettingsAsync() - { - if (settingsMenuConfiguration.SettingsGroupPrefab == null) - { - ReportHub.LogError(ReportCategory.SETTINGS_MENU, $"Settings Group prefab not found! Please set it the SettingsMenuConfiguration asset."); - return; - } - - foreach (var pair in sections) - await GenerateSettingsSectionAsync(pair.Value.config!, pair.Value.container!); - - foreach (var controller in controllers) - controller.OnAllControllersInstantiated(controllers); - - SetInitialSectionsVisibility(); - } - - private async UniTask GenerateSettingsSectionAsync(SettingsSectionConfig sectionConfig, Transform sectionContainer) - { - foreach (SettingsGroup group in sectionConfig.SettingsGroups) - { - if (group.FeatureFlagName != FeatureFlag.None && !FeatureFlagsConfiguration.Instance.IsEnabled(group.FeatureFlagName.GetStringValue())) - return; - - if (group.FeatureId != FeatureId.None && !FeaturesRegistry.Instance.IsEnabled(group.FeatureId)) return; - - SettingsGroupView generalGroupView = (await assetsProvisioner.ProvideInstanceAsync(settingsMenuConfiguration.SettingsGroupPrefab!, sectionContainer)).Value; - - if (!string.IsNullOrEmpty(group.GroupTitle)) - generalGroupView.GroupTitle.text = group.GroupTitle; - else - generalGroupView.GroupTitle.gameObject.SetActive(false); - - foreach (SettingsModuleBindingBase module in group.Modules) - if (module != null) - { - if (module.FeatureId != FeatureId.None && !FeaturesRegistry.Instance.IsEnabled(module.FeatureId)) - continue; - - var controller = - await module.CreateModuleAsync - ( - generalGroupView.ModulesContainer, - qualitySettingsController, - videoPrioritizationSettings, - generalAudioMixer, - controlsSettingsAsset, - chatSettingsAsset, - memoryCap, - sceneLoadingLimit, - userBlockingCache, - this, - assetsProvisioner, - volumeBus, - eventBus, - pointAtMarkerVisibilitySettings); - - if (controller != null) - controllers.Add(controller); - } - } - } - - private void SetInitialSectionsVisibility() - { - foreach (var pair in sections) - pair.Value.button!.gameObject.SetActive(pair.Value.config!.SettingsGroups.Count > 0); - - foreach (var pair in sections) - if (pair.Value.config!.SettingsGroups.Count > 0) - { - OpenSection(pair.Key, pair.Value.config.SettingsGroups.Count); - break; - } - } - - private void OpenSection(SettingsSection section, int settingsGroupCount) - { - foreach ((SettingsSection current, (Transform container, ButtonWithSelectableStateView button, Sprite _, SettingsSectionConfig _)) in sections) - { - bool opened = section == current; - container.gameObject.SetActive(opened && settingsGroupCount > 0); - button.SetSelected(opened); - } - - view.BackgroundImage.sprite = sections[section].background!; - view.ContentScrollRect.verticalNormalizedPosition = 1; - } - - public void Dispose() - { - foreach (SettingsFeatureController controller in controllers) - controller.Dispose(); - - foreach (var pair in sections) - pair.Value.button!.Button.onClick!.RemoveAllListeners(); - } - } -} +using Cysharp.Threading.Tasks; +using DCL.AssetsProvision; +using DCL.Audio; +using DCL.Diagnostics; +using DCL.FeatureFlags; +using DCL.Friends.UserBlocking; +using DCL.Optimization.PerformanceBudgeting; +using DCL.Quality.Runtime; +using DCL.SDKComponents.MediaStream.Settings; +using DCL.Settings.Configuration; +using DCL.Settings.ModuleControllers; +using DCL.Settings.Settings; +using DCL.UI; +using ECS.SceneLifeCycle.IncreasingRadius; +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Audio; +using Utility; + +namespace DCL.Settings +{ + public class SettingsController : ISection, IDisposable, ISettingsModuleEventListener + { + public enum SettingsSection + { + General, + Graphics, + Sound, + Controls, + Chat + } + + private readonly SettingsView view; + private readonly SettingsMenuConfiguration settingsMenuConfiguration; + private readonly QualitySettingsController qualitySettingsController; + private readonly AudioMixer generalAudioMixer; + private readonly VideoPrioritizationSettings videoPrioritizationSettings; + private readonly ISystemMemoryCap memoryCap; + private readonly SceneLoadingLimit sceneLoadingLimit; + private readonly VolumeBus volumeBus; + private readonly ControlsSettingsAsset controlsSettingsAsset; + private readonly RectTransform rectTransform; + private readonly List controllers = new (); + private readonly ChatSettingsAsset chatSettingsAsset; + private readonly IUserBlockingCache userBlockingCache; + private readonly IAssetsProvisioner assetsProvisioner; + private readonly IEventBus eventBus; + private readonly PointAtMarkerVisibilitySettings pointAtMarkerVisibilitySettings; + + private readonly IReadOnlyDictionary sections; + + public event Action? ChatBubblesVisibilityChanged; + + public SettingsController( + SettingsView view, + SettingsMenuConfiguration settingsMenuConfiguration, + QualitySettingsController qualitySettingsController, + AudioMixer generalAudioMixer, + VideoPrioritizationSettings videoPrioritizationSettings, + ControlsSettingsAsset controlsSettingsAsset, + ISystemMemoryCap memoryCap, + ChatSettingsAsset chatSettingsAsset, + IUserBlockingCache userBlockingCache, + SceneLoadingLimit sceneLoadingLimit, + VolumeBus volumeBus, + IAssetsProvisioner assetsProvisioner, + IEventBus eventBus, + PointAtMarkerVisibilitySettings pointAtMarkerVisibilitySettings) + { + this.view = view; + this.settingsMenuConfiguration = settingsMenuConfiguration; + this.qualitySettingsController = qualitySettingsController; + this.generalAudioMixer = generalAudioMixer; + this.memoryCap = memoryCap; + this.chatSettingsAsset = chatSettingsAsset; + this.volumeBus = volumeBus; + this.userBlockingCache = userBlockingCache; + this.controlsSettingsAsset = controlsSettingsAsset; + this.videoPrioritizationSettings = videoPrioritizationSettings; + this.sceneLoadingLimit = sceneLoadingLimit; + this.assetsProvisioner = assetsProvisioner; + this.eventBus = eventBus; + this.pointAtMarkerVisibilitySettings = pointAtMarkerVisibilitySettings; + rectTransform = view.transform.parent.GetComponent(); + + sections = new Dictionary + { + [SettingsSection.General] = (view.GeneralSectionContainer, view.GeneralSectionButton, view.GeneralSectionBackground, settingsMenuConfiguration.GeneralSectionConfig), + [SettingsSection.Graphics] = (view.GraphicsSectionContainer, view.GraphicsSectionButton, view.GraphicsSectionBackground, settingsMenuConfiguration.GraphicsSectionConfig), + [SettingsSection.Sound] = (view.SoundSectionContainer, view.SoundSectionButton, view.SoundSectionBackground, settingsMenuConfiguration.SoundSectionConfig), + [SettingsSection.Controls] = (view.ControlsSectionContainer, view.ControlsSectionButton, view.ControlsSectionBackground, settingsMenuConfiguration.ControlsSectionConfig), + [SettingsSection.Chat] = (view.ChatSectionContainer, view.ChatSectionButton, view.ChatSectionBackground, settingsMenuConfiguration.ChatSectionConfig), + }; + + foreach (var pair in sections) + pair.Value.button!.Button.onClick!.AddListener(() => OpenSection(pair.Key, pair.Value.config!.SettingsGroups.Count)); + } + + public UniTask InitializeAsync() => + GenerateSettingsAsync(); + + public void Activate() + { + view.gameObject.SetActive(true); + } + + public void Deactivate() + { + view.gameObject.SetActive(false); + } + + public void Toggle(SettingsSection section) + { + var config = sections[section]; + OpenSection(section, config.config!.SettingsGroups.Count); + } + + public void Animate(int triggerId) + { + view.PanelAnimator.SetTrigger(triggerId); + view.HeaderAnimator.SetTrigger(triggerId); + } + + public void ResetAnimator() + { + view.PanelAnimator.Rebind(); + view.HeaderAnimator.Rebind(); + view.PanelAnimator.Update(0); + view.HeaderAnimator.Update(0); + } + + public RectTransform GetRectTransform() => + rectTransform; + + public void NotifyChatBubblesVisibilityChanged(ChatBubbleVisibilitySettings newVisibility) + { + ChatBubblesVisibilityChanged?.Invoke(newVisibility); + } + + private async UniTask GenerateSettingsAsync() + { + if (settingsMenuConfiguration.SettingsGroupPrefab == null) + { + ReportHub.LogError(ReportCategory.SETTINGS_MENU, $"Settings Group prefab not found! Please set it the SettingsMenuConfiguration asset."); + return; + } + + foreach (var pair in sections) + await GenerateSettingsSectionAsync(pair.Value.config!, pair.Value.container!); + + foreach (var controller in controllers) + controller.OnAllControllersInstantiated(controllers); + + SetInitialSectionsVisibility(); + } + + private async UniTask GenerateSettingsSectionAsync(SettingsSectionConfig sectionConfig, Transform sectionContainer) + { + foreach (SettingsGroup group in sectionConfig.SettingsGroups) + { + if (group.FeatureFlagName != FeatureFlag.None && !FeatureFlagsConfiguration.Instance.IsEnabled(group.FeatureFlagName.GetStringValue())) + return; + + if (group.FeatureId != FeatureId.None && !FeaturesRegistry.Instance.IsEnabled(group.FeatureId)) return; + + SettingsGroupView generalGroupView = (await assetsProvisioner.ProvideInstanceAsync(settingsMenuConfiguration.SettingsGroupPrefab!, sectionContainer)).Value; + + if (!string.IsNullOrEmpty(group.GroupTitle)) + generalGroupView.GroupTitle.text = group.GroupTitle; + else + generalGroupView.GroupTitle.gameObject.SetActive(false); + + foreach (SettingsModuleBindingBase module in group.Modules) + if (module != null) + { + if (module.FeatureId != FeatureId.None && !FeaturesRegistry.Instance.IsEnabled(module.FeatureId)) + continue; + + var controller = + await module.CreateModuleAsync + ( + generalGroupView.ModulesContainer, + qualitySettingsController, + videoPrioritizationSettings, + generalAudioMixer, + controlsSettingsAsset, + chatSettingsAsset, + memoryCap, + sceneLoadingLimit, + userBlockingCache, + this, + assetsProvisioner, + volumeBus, + eventBus, + pointAtMarkerVisibilitySettings); + + if (controller != null) + controllers.Add(controller); + } + } + } + + private void SetInitialSectionsVisibility() + { + foreach (var pair in sections) + pair.Value.button!.gameObject.SetActive(pair.Value.config!.SettingsGroups.Count > 0); + + foreach (var pair in sections) + if (pair.Value.config!.SettingsGroups.Count > 0) + { + OpenSection(pair.Key, pair.Value.config.SettingsGroups.Count); + break; + } + } + + private void OpenSection(SettingsSection section, int settingsGroupCount) + { + foreach ((SettingsSection current, (Transform container, ButtonWithSelectableStateView button, Sprite _, SettingsSectionConfig _)) in sections) + { + bool opened = section == current; + container.gameObject.SetActive(opened && settingsGroupCount > 0); + button.SetSelected(opened); + } + + view.BackgroundImage.sprite = sections[section].background!; + view.ContentScrollRect.verticalNormalizedPosition = 1; + } + + public void Dispose() + { + foreach (SettingsFeatureController controller in controllers) + controller.Dispose(); + + foreach (var pair in sections) + pair.Value.button!.Button.onClick!.RemoveAllListeners(); + } + } +} diff --git a/Explorer/Assets/DCL/SkyBox/RealmSkyboxState.cs b/Explorer/Assets/DCL/SkyBox/RealmSkyboxState.cs index 7a9c293fc27..6e610bc8c6a 100644 --- a/Explorer/Assets/DCL/SkyBox/RealmSkyboxState.cs +++ b/Explorer/Assets/DCL/SkyBox/RealmSkyboxState.cs @@ -35,7 +35,7 @@ public bool Applies() => public void Enter() { sceneRestrictionController.PushSceneRestriction( - SceneRestriction.CreateSkyboxTimeUILocked(SceneRestrictionsAction.APPLIED)); + SceneRestriction.CreateSkyboxTimeUILocked(SceneRestrictionsAction.Applied)); settings.IsDayCycleEnabled = false; settings.TransitionMode = SceneMetadata.TransitionMode.FORWARD; @@ -52,7 +52,7 @@ public void Update(float dt) public void Exit() { sceneRestrictionController.PushSceneRestriction( - SceneRestriction.CreateSkyboxTimeUILocked(SceneRestrictionsAction.REMOVED)); + SceneRestriction.CreateSkyboxTimeUILocked(SceneRestrictionsAction.Removed)); transition.Exit(); } diff --git a/Explorer/Assets/DCL/SkyBox/SDKComponentState.cs b/Explorer/Assets/DCL/SkyBox/SDKComponentState.cs index fb84b864825..edf8beb4329 100644 --- a/Explorer/Assets/DCL/SkyBox/SDKComponentState.cs +++ b/Explorer/Assets/DCL/SkyBox/SDKComponentState.cs @@ -30,7 +30,7 @@ public bool Applies() => public void Enter() { transition.Enter(); - sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateSkyboxTimeUILocked(SceneRestrictionsAction.APPLIED)); + sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateSkyboxTimeUILocked(SceneRestrictionsAction.Applied)); } public void Update(float dt) @@ -41,7 +41,7 @@ public void Update(float dt) public void Exit() { transition.Exit(); - sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateSkyboxTimeUILocked(SceneRestrictionsAction.REMOVED)); + sceneRestrictionBusController.PushSceneRestriction(SceneRestriction.CreateSkyboxTimeUILocked(SceneRestrictionsAction.Removed)); } } } diff --git a/Explorer/Assets/DCL/SkyBox/SceneMetadataState.cs b/Explorer/Assets/DCL/SkyBox/SceneMetadataState.cs index ee1b7f7b2bb..3a4b33c3fed 100644 --- a/Explorer/Assets/DCL/SkyBox/SceneMetadataState.cs +++ b/Explorer/Assets/DCL/SkyBox/SceneMetadataState.cs @@ -34,7 +34,7 @@ public bool Applies() public void Enter() { sceneRestrictionController.PushSceneRestriction( - SceneRestriction.CreateSkyboxTimeUILocked(SceneRestrictionsAction.APPLIED)); + SceneRestriction.CreateSkyboxTimeUILocked(SceneRestrictionsAction.Applied)); settings.IsDayCycleEnabled = false; TryApplySceneMetadata(); @@ -44,7 +44,7 @@ public void Enter() public void Exit() { sceneRestrictionController.PushSceneRestriction( - SceneRestriction.CreateSkyboxTimeUILocked(SceneRestrictionsAction.REMOVED)); + SceneRestriction.CreateSkyboxTimeUILocked(SceneRestrictionsAction.Removed)); transition.Exit(); } diff --git a/Explorer/Assets/DCL/SmartWearables/Systems/SmartWearableSystem.cs b/Explorer/Assets/DCL/SmartWearables/Systems/SmartWearableSystem.cs index 946a0a1fb6f..e15f736f7f5 100644 --- a/Explorer/Assets/DCL/SmartWearables/Systems/SmartWearableSystem.cs +++ b/Explorer/Assets/DCL/SmartWearables/Systems/SmartWearableSystem.cs @@ -285,7 +285,7 @@ private void AddPortableExperience(IWearable smartWearable, Entity scene) var metadata = new PortableExperienceMetadata { - Type = PortableExperienceType.SMART_WEARABLE, + Type = PortableExperienceType.SmartWearable, Ens = string.Empty, Id = id, Name = smartWearable.DTO.Metadata.name, diff --git a/Explorer/Assets/DCL/TeleportPrompt/TeleportPromptController.cs b/Explorer/Assets/DCL/TeleportPrompt/TeleportPromptController.cs index 823d61ed679..4cccf28c64d 100644 --- a/Explorer/Assets/DCL/TeleportPrompt/TeleportPromptController.cs +++ b/Explorer/Assets/DCL/TeleportPrompt/TeleportPromptController.cs @@ -22,7 +22,7 @@ public partial class TeleportPromptController : ControllerBase resultCallback; private CancellationTokenSource cts; - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; public TeleportPromptController( ViewFactoryMethod viewFactory, diff --git a/Explorer/Assets/DCL/Translation/Tests/TranslationUnitTests/HyperlinkTextFormatterShould.cs b/Explorer/Assets/DCL/Translation/Tests/TranslationUnitTests/HyperlinkTextFormatterShould.cs index d92ad0fcb10..fa280d3d2ba 100644 --- a/Explorer/Assets/DCL/Translation/Tests/TranslationUnitTests/HyperlinkTextFormatterShould.cs +++ b/Explorer/Assets/DCL/Translation/Tests/TranslationUnitTests/HyperlinkTextFormatterShould.cs @@ -147,13 +147,13 @@ public void GetMatchesWithVariousPatterns() // Assert Assert.AreEqual(3, matchesResult.Count); - Assert.AreEqual(TextFormatMatchType.SCENE, matchesResult[0].Item1); + Assert.AreEqual(TextFormatMatchType.Scene, matchesResult[0].Item1); Assert.AreEqual("10,20", matchesResult[0].Item2.Value); - Assert.AreEqual(TextFormatMatchType.URL, matchesResult[1].Item1); + Assert.AreEqual(TextFormatMatchType.Url, matchesResult[1].Item1); Assert.AreEqual("https://decentraland.org", matchesResult[1].Item2.Value); - Assert.AreEqual(TextFormatMatchType.WORLD, matchesResult[2].Item1); + Assert.AreEqual(TextFormatMatchType.World, matchesResult[2].Item1); Assert.AreEqual("myworld.dcl.eth", matchesResult[2].Item2.Value); } } diff --git a/Explorer/Assets/DCL/UI/ChatEntryMenuPopup/ChatEntryMenuPopupController.cs b/Explorer/Assets/DCL/UI/ChatEntryMenuPopup/ChatEntryMenuPopupController.cs index a8a60b068ce..038ad18b12b 100644 --- a/Explorer/Assets/DCL/UI/ChatEntryMenuPopup/ChatEntryMenuPopupController.cs +++ b/Explorer/Assets/DCL/UI/ChatEntryMenuPopup/ChatEntryMenuPopupController.cs @@ -31,7 +31,7 @@ private void OnCopyButtonClicked() clipboardManager.CopyAndSanitize(this, inputData.CopiedText); } - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; protected override async UniTask WaitForCloseIntentAsync(CancellationToken ct) => await UniTask.WhenAny(inputData.CloseTask ?? UniTask.Never(ct), diff --git a/Explorer/Assets/DCL/UI/ColorPicker/ColorPickerController.cs b/Explorer/Assets/DCL/UI/ColorPicker/ColorPickerController.cs index 01bfd84225b..f6542f5b4c0 100644 --- a/Explorer/Assets/DCL/UI/ColorPicker/ColorPickerController.cs +++ b/Explorer/Assets/DCL/UI/ColorPicker/ColorPickerController.cs @@ -18,7 +18,7 @@ public class ColorPickerController : ControllerBase usedColorToggles = new (); private RectTransform viewRectTransform; - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; public ColorPickerController( ViewFactoryMethod viewFactory, diff --git a/Explorer/Assets/DCL/UI/Communities/CommunityTitleView.cs b/Explorer/Assets/DCL/UI/Communities/CommunityTitleView.cs index 6582a13ed5a..7db3046f01c 100644 --- a/Explorer/Assets/DCL/UI/Communities/CommunityTitleView.cs +++ b/Explorer/Assets/DCL/UI/Communities/CommunityTitleView.cs @@ -43,7 +43,7 @@ public class CommunityTitleView : MonoBehaviour public async UniTaskVoid SetupAsync(ISpriteCache thumbnailCache, string communityId, string communityName, string thumbnailUrl, OpenContextMenuDelegate openContextMenuAction, CancellationToken ct) { - contextMenuConfig = new GenericContextMenu(contextMenuSettings.Width, contextMenuSettings.Offset, contextMenuSettings.VerticalLayoutPadding, contextMenuSettings.ElementsSpacing, ContextMenuOpenDirection.TOP_LEFT) + contextMenuConfig = new GenericContextMenu(contextMenuSettings.Width, contextMenuSettings.Offset, contextMenuSettings.VerticalLayoutPadding, contextMenuSettings.ElementsSpacing, ContextMenuOpenDirection.TopLeft) .AddControl(new ButtonContextMenuControlSettings(contextMenuSettings.ViewCommunityText, contextMenuSettings.ViewCommunitySprite, () => ViewCommunityRequested?.Invoke())); openContextMenu = openContextMenuAction; diff --git a/Explorer/Assets/DCL/UI/ConfirmationDialog/ConfirmationDialogController.cs b/Explorer/Assets/DCL/UI/ConfirmationDialog/ConfirmationDialogController.cs index bf6bf6e936f..285ec4868da 100644 --- a/Explorer/Assets/DCL/UI/ConfirmationDialog/ConfirmationDialogController.cs +++ b/Explorer/Assets/DCL/UI/ConfirmationDialog/ConfirmationDialogController.cs @@ -9,7 +9,7 @@ namespace DCL.UI.ConfirmationDialog public class ConfirmationDialogController : ControllerBase { private readonly ProfileRepositoryWrapper profileRepositoryWrapper; - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; public ConfirmationDialogController(ViewFactoryMethod viewFactory, ProfileRepositoryWrapper profileRepositoryWrapper) @@ -40,7 +40,7 @@ protected override async UniTask WaitForCloseIntentAsync(CancellationToken ct) { int index = await UniTask.WhenAny(viewInstance!.GetCloseTasks(ct)); - inputData.ResultCallback?.Invoke(index > 1 ? ConfirmationResult.CONFIRM : ConfirmationResult.CANCEL); + inputData.ResultCallback?.Invoke(index > 1 ? ConfirmationResult.Confirm : ConfirmationResult.Cancel); } } } diff --git a/Explorer/Assets/DCL/UI/ConfirmationDialog/ConfirmationDialogOpener.cs b/Explorer/Assets/DCL/UI/ConfirmationDialog/ConfirmationDialogOpener.cs index 46bd3121e47..4b5b22b9f05 100644 --- a/Explorer/Assets/DCL/UI/ConfirmationDialog/ConfirmationDialogOpener.cs +++ b/Explorer/Assets/DCL/UI/ConfirmationDialog/ConfirmationDialogOpener.cs @@ -20,7 +20,7 @@ public ConfirmationDialogOpener(IMVCManager mvcManager) /// public async UniTask OpenConfirmationDialogAsync(ConfirmationDialogParameter dialogData, CancellationToken ct) { - ConfirmationResult result = ConfirmationResult.CANCEL; + ConfirmationResult result = ConfirmationResult.Cancel; dialogData.ResultCallback = res => result = res; await mvcManager.ShowAsync(ConfirmationDialogController.IssueCommand(dialogData), ct); return result; diff --git a/Explorer/Assets/DCL/UI/ConfirmationDialog/Opener/ConfirmationDialogParameter.cs b/Explorer/Assets/DCL/UI/ConfirmationDialog/Opener/ConfirmationDialogParameter.cs index 460bbb4dfb1..222b8e534bd 100644 --- a/Explorer/Assets/DCL/UI/ConfirmationDialog/Opener/ConfirmationDialogParameter.cs +++ b/Explorer/Assets/DCL/UI/ConfirmationDialog/Opener/ConfirmationDialogParameter.cs @@ -45,7 +45,7 @@ public ConfirmationDialogParameter(string text, string cancelButtonText, string public enum ConfirmationResult { - CONFIRM, - CANCEL, + Confirm, + Cancel, } } diff --git a/Explorer/Assets/DCL/UI/ConfirmationDialog/Opener/ReportUserConfirmationDialog.cs b/Explorer/Assets/DCL/UI/ConfirmationDialog/Opener/ReportUserConfirmationDialog.cs index d16b479f3b8..415fc89ff91 100644 --- a/Explorer/Assets/DCL/UI/ConfirmationDialog/Opener/ReportUserConfirmationDialog.cs +++ b/Explorer/Assets/DCL/UI/ConfirmationDialog/Opener/ReportUserConfirmationDialog.cs @@ -31,7 +31,7 @@ public static async UniTask ShowAsync( ct) .SuppressToResultAsync(reportCategory); - return !ct.IsCancellationRequested && dialogResult.Success && dialogResult.Value != ConfirmationResult.CANCEL; + return !ct.IsCancellationRequested && dialogResult.Success && dialogResult.Value != ConfirmationResult.Cancel; } } } diff --git a/Explorer/Assets/DCL/UI/Controls/ControlsPanelController.cs b/Explorer/Assets/DCL/UI/Controls/ControlsPanelController.cs index f2eba5eed7c..41193168a89 100644 --- a/Explorer/Assets/DCL/UI/Controls/ControlsPanelController.cs +++ b/Explorer/Assets/DCL/UI/Controls/ControlsPanelController.cs @@ -6,7 +6,7 @@ namespace DCL.UI.Controls { public class ControlsPanelController : ControllerBase { - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.FULLSCREEN; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Fullscreen; private UniTaskCompletionSource? closeViewTask; diff --git a/Explorer/Assets/DCL/UI/DebugMenu/ConsolePanelView.cs b/Explorer/Assets/DCL/UI/DebugMenu/ConsolePanelView.cs index b2e1f1d8b50..c8eeade9e34 100644 --- a/Explorer/Assets/DCL/UI/DebugMenu/ConsolePanelView.cs +++ b/Explorer/Assets/DCL/UI/DebugMenu/ConsolePanelView.cs @@ -66,8 +66,8 @@ public ConsolePanelView(VisualElement root, Button sidebarButton, Action closeCl showErrorsToggle.RegisterValueChangedCallback(_ => RefreshFilters()); // Input blocking - searchField.RegisterCallback(static (_, c) => c.inputBlock.Disable(InputMapComponent.Kind.SHORTCUTS, InputMapComponent.Kind.IN_WORLD_CAMERA, InputMapComponent.Kind.CAMERA, InputMapComponent.Kind.PLAYER), this); - searchField.RegisterCallback(static (_, c) => c.inputBlock.Enable(InputMapComponent.Kind.SHORTCUTS, InputMapComponent.Kind.IN_WORLD_CAMERA, InputMapComponent.Kind.CAMERA, InputMapComponent.Kind.PLAYER), this); + searchField.RegisterCallback(static (_, c) => c.inputBlock.Disable(InputMapComponent.Kind.Shortcuts, InputMapComponent.Kind.InWorldCamera, InputMapComponent.Kind.Camera, InputMapComponent.Kind.Player), this); + searchField.RegisterCallback(static (_, c) => c.inputBlock.Enable(InputMapComponent.Kind.Shortcuts, InputMapComponent.Kind.InWorldCamera, InputMapComponent.Kind.Camera, InputMapComponent.Kind.Player), this); } public override void Toggle() diff --git a/Explorer/Assets/DCL/UI/DuplicateIdentityPopup/DuplicateIdentityWindowController.cs b/Explorer/Assets/DCL/UI/DuplicateIdentityPopup/DuplicateIdentityWindowController.cs index a30b1bf8963..8dbb38d11bd 100644 --- a/Explorer/Assets/DCL/UI/DuplicateIdentityPopup/DuplicateIdentityWindowController.cs +++ b/Explorer/Assets/DCL/UI/DuplicateIdentityPopup/DuplicateIdentityWindowController.cs @@ -21,7 +21,7 @@ private void OnExitButtonClicked() ExitUtils.Exit(); } - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.OVERLAY; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Overlay; protected override UniTask WaitForCloseIntentAsync(CancellationToken ct) => UniTask.Never(ct); } diff --git a/Explorer/Assets/DCL/UI/ErrorPopup/ErrorPopupController.cs b/Explorer/Assets/DCL/UI/ErrorPopup/ErrorPopupController.cs index 9fcdda35a79..8e7e0eddb9c 100644 --- a/Explorer/Assets/DCL/UI/ErrorPopup/ErrorPopupController.cs +++ b/Explorer/Assets/DCL/UI/ErrorPopup/ErrorPopupController.cs @@ -7,7 +7,7 @@ namespace DCL.UI.ErrorPopup { public partial class ErrorPopupController : ControllerBase { - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; public static ViewFactoryMethod CreateLazily(ErrorPopupView prefab, Transform? root = null) => () => Object.Instantiate(prefab, Vector3.zero, Quaternion.identity, root!)!; diff --git a/Explorer/Assets/DCL/UI/ErrorPopup/ErrorPopupWithRetryController.cs b/Explorer/Assets/DCL/UI/ErrorPopup/ErrorPopupWithRetryController.cs index 0423956445e..339d61e687c 100644 --- a/Explorer/Assets/DCL/UI/ErrorPopup/ErrorPopupWithRetryController.cs +++ b/Explorer/Assets/DCL/UI/ErrorPopup/ErrorPopupWithRetryController.cs @@ -9,7 +9,7 @@ public class ErrorPopupWithRetryController : ControllerBase CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; protected override void OnViewInstantiated() { @@ -18,10 +18,10 @@ protected override void OnViewInstantiated() viewInstance!.ExitButton.onClick.AddListener(() => { ExitUtils.Exit(); - inputData.SelectedOption = Result.EXIT; + inputData.SelectedOption = Result.Exit; }); - viewInstance.RestartButton.onClick.AddListener(() => inputData.SelectedOption = Result.RESTART); + viewInstance.RestartButton.onClick.AddListener(() => inputData.SelectedOption = Result.Restart); } protected override void OnBeforeViewShow() @@ -32,10 +32,10 @@ protected override void OnBeforeViewShow() viewInstance!.TitleText.text = inputData.Title; viewInstance!.RetryButtonText.text = inputData.RetryText; viewInstance!.ExitButtonText.text = inputData.ExitText; - viewInstance.InternetLostIcon.SetActive(inputData.IconType == IconType.CONNECTION_LOST); - viewInstance.ErrorIcon.SetActive(inputData.IconType == IconType.ERROR); - viewInstance.WarningIcon.SetActive(inputData.IconType == IconType.WARNING); - viewInstance.ClockIcon.SetActive(inputData.IconType == IconType.CLOCK); + viewInstance.InternetLostIcon.SetActive(inputData.IconType == IconType.ConnectionLost); + viewInstance.ErrorIcon.SetActive(inputData.IconType == IconType.Error); + viewInstance.WarningIcon.SetActive(inputData.IconType == IconType.Warning); + viewInstance.ClockIcon.SetActive(inputData.IconType == IconType.Clock); } protected override UniTask WaitForCloseIntentAsync(CancellationToken ct) => @@ -43,16 +43,16 @@ protected override UniTask WaitForCloseIntentAsync(CancellationToken ct) => public enum Result { - EXIT, - RESTART, + Exit, + Restart, } public enum IconType { - WARNING, - ERROR, - CONNECTION_LOST, - CLOCK + Warning, + Error, + ConnectionLost, + Clock } public class Input @@ -72,7 +72,7 @@ public Input(string title = "Error", string description = "An error was encountered. Please reload to try again.", string retryText = "Reload", string exitText = "Exit Application", - IconType iconType = IconType.ERROR) + IconType iconType = IconType.Error) { Title = title; Description = description; diff --git a/Explorer/Assets/DCL/UI/GenericContextMenu/Controllers/ChatOptionsContextMenuController.cs b/Explorer/Assets/DCL/UI/GenericContextMenu/Controllers/ChatOptionsContextMenuController.cs index 59b66cc2069..8ca2098b52e 100644 --- a/Explorer/Assets/DCL/UI/GenericContextMenu/Controllers/ChatOptionsContextMenuController.cs +++ b/Explorer/Assets/DCL/UI/GenericContextMenu/Controllers/ChatOptionsContextMenuController.cs @@ -28,7 +28,7 @@ public ChatOptionsContextMenuController(IMVCManager mvcManager, Sprite deleteCha this.mvcManager = mvcManager; var deleteChatHistoryButton = new ButtonContextMenuControlSettings(deleteChatHistoryText, deleteChatHistoryIcon, onDeleteChatHistoryClicked); - contextMenu = new GenericContextMenu(CONTEXT_MENU_WIDTH, CONTEXT_MENU_OFFSET, CONTEXT_MENU_VERTICAL_LAYOUT_PADDING, CONTEXT_MENU_ELEMENTS_SPACING, anchorPoint: ContextMenuOpenDirection.TOP_LEFT) + contextMenu = new GenericContextMenu(CONTEXT_MENU_WIDTH, CONTEXT_MENU_OFFSET, CONTEXT_MENU_VERTICAL_LAYOUT_PADDING, CONTEXT_MENU_ELEMENTS_SPACING, anchorPoint: ContextMenuOpenDirection.TopLeft) .AddControl(deleteChatHistoryButton); //Disabled until we got multiple channels working diff --git a/Explorer/Assets/DCL/UI/GenericContextMenu/Controllers/CommunityPlayerEntryContextMenu.cs b/Explorer/Assets/DCL/UI/GenericContextMenu/Controllers/CommunityPlayerEntryContextMenu.cs index 8b5427e1140..5cc470917d1 100644 --- a/Explorer/Assets/DCL/UI/GenericContextMenu/Controllers/CommunityPlayerEntryContextMenu.cs +++ b/Explorer/Assets/DCL/UI/GenericContextMenu/Controllers/CommunityPlayerEntryContextMenu.cs @@ -116,7 +116,7 @@ public CommunityPlayerEntryContextMenu( viewProfileButton = new GenericContextMenuElement(openUserProfileButtonControlSettings, false); chatButton = new GenericContextMenuElement(openConversationControlSettings, false); - contextMenu = new GenericContextMenu(voiceChatContextMenuSettings.ContextMenuWidth, CONTEXT_MENU_OFFSET, voiceChatContextMenuSettings.VerticalPadding, voiceChatContextMenuSettings.ElementsSpacing, anchorPoint: ContextMenuOpenDirection.BOTTOM_RIGHT) + contextMenu = new GenericContextMenu(voiceChatContextMenuSettings.ContextMenuWidth, CONTEXT_MENU_OFFSET, voiceChatContextMenuSettings.VerticalPadding, voiceChatContextMenuSettings.ElementsSpacing, anchorPoint: ContextMenuOpenDirection.BottomRight) .AddControl(userProfileControlSettings) .AddControl(new SeparatorContextMenuControlSettings(voiceChatContextMenuSettings.SeparatorHeight, -voiceChatContextMenuSettings.VerticalPadding.left, -voiceChatContextMenuSettings.VerticalPadding.right)) .AddControl(demoteSpeakerButton) @@ -132,19 +132,19 @@ public CommunityPlayerEntryContextMenu( public async UniTask ShowUserProfileContextMenuAsync(Profile.CompactInfo targetProfile, Vector3 position, Vector2 offset, CancellationToken ct, UniTask closeMenuTask, Action? onContextMenuHide = null, - ContextMenuOpenDirection anchorPoint = ContextMenuOpenDirection.BOTTOM_RIGHT, + ContextMenuOpenDirection anchorPoint = ContextMenuOpenDirection.BottomRight, bool targetIsSpeaker = false) { var localParticipant = voiceChatOrchestrator.ParticipantsStateService.LocalParticipantState; bool targetIsLocalParticipant = targetProfile.UserId.Equals(localParticipant.WalletId, StringComparison.InvariantCultureIgnoreCase); - bool localParticipantIsMod = voiceChatOrchestrator.ParticipantsStateService.LocalParticipantState.Role.Value is VoiceChatParticipantCommunityRole.MODERATOR or VoiceChatParticipantCommunityRole.OWNER; + bool localParticipantIsMod = voiceChatOrchestrator.ParticipantsStateService.LocalParticipantState.Role.Value is VoiceChatParticipantCommunityRole.Moderator or VoiceChatParticipantCommunityRole.Owner; closeContextMenuTask.TrySetResult(); closeContextMenuTask = new UniTaskCompletionSource(); UniTask closeTask = UniTask.WhenAny(closeContextMenuTask.Task, closeMenuTask); - UserProfileContextMenuControlSettings.FriendshipStatus contextMenuFriendshipStatus = UserProfileContextMenuControlSettings.FriendshipStatus.DISABLED; + UserProfileContextMenuControlSettings.FriendshipStatus contextMenuFriendshipStatus = UserProfileContextMenuControlSettings.FriendshipStatus.Disabled; if (!targetIsLocalParticipant && friendsService != null) { @@ -152,8 +152,8 @@ public async UniTask ShowUserProfileContextMenuAsync(Profile.CompactInfo targetP contextMenuFriendshipStatus = ConvertFriendshipStatus(friendshipStatus); jumpInButtonControlSettings.SetData(targetProfile.UserId); - jumpInButton.Enabled = friendshipStatus == FriendshipStatus.FRIEND && friendOnlineStatusCache != null && - friendOnlineStatusCache.GetFriendStatus(targetProfile.UserId) != OnlineStatus.OFFLINE; + jumpInButton.Enabled = friendshipStatus == FriendshipStatus.Friend && friendOnlineStatusCache != null && + friendOnlineStatusCache.GetFriendStatus(targetProfile.UserId) != OnlineStatus.Offline; } userProfileControlSettings.SetInitialData(targetProfile, contextMenuFriendshipStatus); @@ -188,12 +188,12 @@ private UserProfileContextMenuControlSettings.FriendshipStatus ConvertFriendship { return friendshipStatus switch { - FriendshipStatus.NONE => UserProfileContextMenuControlSettings.FriendshipStatus.NONE, - FriendshipStatus.FRIEND => UserProfileContextMenuControlSettings.FriendshipStatus.FRIEND, - FriendshipStatus.REQUEST_SENT => UserProfileContextMenuControlSettings.FriendshipStatus.REQUEST_SENT, - FriendshipStatus.REQUEST_RECEIVED => UserProfileContextMenuControlSettings.FriendshipStatus.REQUEST_RECEIVED, - FriendshipStatus.BLOCKED => UserProfileContextMenuControlSettings.FriendshipStatus.BLOCKED, - _ => UserProfileContextMenuControlSettings.FriendshipStatus.NONE, + FriendshipStatus.None => UserProfileContextMenuControlSettings.FriendshipStatus.None, + FriendshipStatus.Friend => UserProfileContextMenuControlSettings.FriendshipStatus.Friend, + FriendshipStatus.RequestSent => UserProfileContextMenuControlSettings.FriendshipStatus.RequestSent, + FriendshipStatus.RequestReceived => UserProfileContextMenuControlSettings.FriendshipStatus.RequestReceived, + FriendshipStatus.Blocked => UserProfileContextMenuControlSettings.FriendshipStatus.Blocked, + _ => UserProfileContextMenuControlSettings.FriendshipStatus.None, }; } @@ -201,19 +201,19 @@ private void OnFriendsButtonClicked(Profile.CompactInfo userData, UserProfileCon { switch (friendshipStatus) { - case UserProfileContextMenuControlSettings.FriendshipStatus.NONE: + case UserProfileContextMenuControlSettings.FriendshipStatus.None: SendFriendRequest(userData.UserId); break; - case UserProfileContextMenuControlSettings.FriendshipStatus.FRIEND: + case UserProfileContextMenuControlSettings.FriendshipStatus.Friend: RemoveFriend(userData.UserId); break; - case UserProfileContextMenuControlSettings.FriendshipStatus.REQUEST_SENT: + case UserProfileContextMenuControlSettings.FriendshipStatus.RequestSent: CancelFriendRequest(userData.UserId); break; - case UserProfileContextMenuControlSettings.FriendshipStatus.REQUEST_RECEIVED: + case UserProfileContextMenuControlSettings.FriendshipStatus.RequestReceived: AcceptFriendship(userData.UserId); break; - case UserProfileContextMenuControlSettings.FriendshipStatus.BLOCKED: break; + case UserProfileContextMenuControlSettings.FriendshipStatus.Blocked: break; default: throw new ArgumentOutOfRangeException(nameof(friendshipStatus), friendshipStatus, null); } } @@ -356,7 +356,7 @@ async UniTaskVoid ShowBanConfirmationDialogAsync(CancellationToken ct) ct) .SuppressToResultAsync(ReportCategory.COMMUNITIES); - if (ct.IsCancellationRequested || !dialogResult.Success || dialogResult.Value == ConfirmationResult.CANCEL) return; + if (ct.IsCancellationRequested || !dialogResult.Success || dialogResult.Value == ConfirmationResult.Cancel) return; BanUser(walletId, currentCommunityId); } diff --git a/Explorer/Assets/DCL/UI/GenericContextMenu/Controllers/GenericUserProfileContextMenuController.cs b/Explorer/Assets/DCL/UI/GenericContextMenu/Controllers/GenericUserProfileContextMenuController.cs index 9aa9f0f4d30..fcc890cb6d1 100644 --- a/Explorer/Assets/DCL/UI/GenericContextMenu/Controllers/GenericUserProfileContextMenuController.cs +++ b/Explorer/Assets/DCL/UI/GenericContextMenu/Controllers/GenericUserProfileContextMenuController.cs @@ -131,12 +131,12 @@ public GenericUserProfileContextMenuController( this.chatEventBus = chatEventBus; this.mvcManager = mvcManager; this.analytics = analytics; - this.isUserBlockingFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.FRIENDS_USER_BLOCKING); + this.isUserBlockingFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.FriendsUserBlocking); this.onlineUsersProvider = onlineUsersProvider; this.realmNavigator = realmNavigator; this.friendOnlineStatusCache = friendOnlineStatusCache; - this.isVoiceChatFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.VOICE_CHAT); - this.isNearbyVoiceChatFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.NEARBY_VOICE_CHAT); + this.isVoiceChatFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.VoiceChat); + this.isNearbyVoiceChatFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.NearbyVoiceChat); this.webBrowser = webBrowser; this.decentralandUrlsSource = decentralandUrlsSource; this.selfProfile = selfProfile; @@ -163,7 +163,7 @@ public GenericUserProfileContextMenuController( contextMenuMentionButton = new GenericContextMenuElement(mentionUserButtonControlSettings, false); - contextMenu = new GenericContextMenu(CONTEXT_MENU_WIDTH, SUBMENU_CONTEXT_MENU_OFFSET, CONTEXT_MENU_VERTICAL_LAYOUT_PADDING, CONTEXT_MENU_ELEMENTS_SPACING, anchorPoint: ContextMenuOpenDirection.BOTTOM_RIGHT) + contextMenu = new GenericContextMenu(CONTEXT_MENU_WIDTH, SUBMENU_CONTEXT_MENU_OFFSET, CONTEXT_MENU_VERTICAL_LAYOUT_PADDING, CONTEXT_MENU_ELEMENTS_SPACING, anchorPoint: ContextMenuOpenDirection.BottomRight) .AddControl(userProfileControlSettings) .AddControl(new SeparatorContextMenuControlSettings(CONTEXT_MENU_SEPARATOR_HEIGHT, -CONTEXT_MENU_VERTICAL_LAYOUT_PADDING.left, -CONTEXT_MENU_VERTICAL_LAYOUT_PADDING.right)) .AddControl(contextMenuMentionButton) @@ -195,7 +195,7 @@ public GenericUserProfileContextMenuController( contextMenu.AddControl(new SeparatorContextMenuControlSettings(CONTEXT_MENU_SEPARATOR_HEIGHT, -CONTEXT_MENU_VERTICAL_LAYOUT_PADDING.left, -CONTEXT_MENU_VERTICAL_LAYOUT_PADDING.right)); - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.REPORT_USER)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.ReportUser)) contextMenu.AddControl(reportButtonControlSettings); contextMenu.AddControl(contextMenuBlockUserButton); @@ -203,13 +203,13 @@ public GenericUserProfileContextMenuController( public async UniTask ShowUserProfileContextMenuAsync(Profile.CompactInfo profile, Vector3 position, Vector2 offset, CancellationToken ct, UniTask closeMenuTask, Action? onContextMenuHide = null, - ContextMenuOpenDirection anchorPoint = ContextMenuOpenDirection.BOTTOM_RIGHT, Action? onContextMenuShow = null, + ContextMenuOpenDirection anchorPoint = ContextMenuOpenDirection.BottomRight, Action? onContextMenuShow = null, bool isOpenedOnWorldAvatar = false) { closeContextMenuTask.TrySetResult(); closeContextMenuTask = new UniTaskCompletionSource(); UniTask closeTask = UniTask.WhenAny(closeContextMenuTask.Task, closeMenuTask); - UserProfileContextMenuControlSettings.FriendshipStatus contextMenuFriendshipStatus = UserProfileContextMenuControlSettings.FriendshipStatus.DISABLED; + UserProfileContextMenuControlSettings.FriendshipStatus contextMenuFriendshipStatus = UserProfileContextMenuControlSettings.FriendshipStatus.Disabled; targetProfile = profile; if (friendsService != null) @@ -233,10 +233,10 @@ public async UniTask ShowUserProfileContextMenuAsync(Profile.CompactInfo profile string? json = JsonUtility.ToJson(new GiftData(profile.UserId, profile.DisplayName)); giftButtonControlSettings.SetData(json); - contextMenuBlockUserButton.Enabled = isUserBlockingFeatureEnabled && friendshipStatus != FriendshipStatus.BLOCKED; - contextMenuJumpInButton.Enabled = friendshipStatus == FriendshipStatus.FRIEND && + contextMenuBlockUserButton.Enabled = isUserBlockingFeatureEnabled && friendshipStatus != FriendshipStatus.Blocked; + contextMenuJumpInButton.Enabled = friendshipStatus == FriendshipStatus.Friend && friendOnlineStatusCache != null && - friendOnlineStatusCache.GetFriendStatus(profile.UserId) != OnlineStatus.OFFLINE; + friendOnlineStatusCache.GetFriendStatus(profile.UserId) != OnlineStatus.Offline; } } @@ -299,12 +299,12 @@ private UserProfileContextMenuControlSettings.FriendshipStatus ConvertFriendship { return friendshipStatus switch { - FriendshipStatus.NONE => UserProfileContextMenuControlSettings.FriendshipStatus.NONE, - FriendshipStatus.FRIEND => UserProfileContextMenuControlSettings.FriendshipStatus.FRIEND, - FriendshipStatus.REQUEST_SENT => UserProfileContextMenuControlSettings.FriendshipStatus.REQUEST_SENT, - FriendshipStatus.REQUEST_RECEIVED => UserProfileContextMenuControlSettings.FriendshipStatus.REQUEST_RECEIVED, - FriendshipStatus.BLOCKED => UserProfileContextMenuControlSettings.FriendshipStatus.BLOCKED, - _ => UserProfileContextMenuControlSettings.FriendshipStatus.NONE, + FriendshipStatus.None => UserProfileContextMenuControlSettings.FriendshipStatus.None, + FriendshipStatus.Friend => UserProfileContextMenuControlSettings.FriendshipStatus.Friend, + FriendshipStatus.RequestSent => UserProfileContextMenuControlSettings.FriendshipStatus.RequestSent, + FriendshipStatus.RequestReceived => UserProfileContextMenuControlSettings.FriendshipStatus.RequestReceived, + FriendshipStatus.Blocked => UserProfileContextMenuControlSettings.FriendshipStatus.Blocked, + _ => UserProfileContextMenuControlSettings.FriendshipStatus.None, }; } @@ -312,19 +312,19 @@ private void OnFriendsButtonClicked(Profile.CompactInfo userData, UserProfileCon { switch (friendshipStatus) { - case UserProfileContextMenuControlSettings.FriendshipStatus.NONE: + case UserProfileContextMenuControlSettings.FriendshipStatus.None: SendFriendRequest(userData.UserId); break; - case UserProfileContextMenuControlSettings.FriendshipStatus.FRIEND: + case UserProfileContextMenuControlSettings.FriendshipStatus.Friend: RemoveFriend(userData.UserId); break; - case UserProfileContextMenuControlSettings.FriendshipStatus.REQUEST_SENT: + case UserProfileContextMenuControlSettings.FriendshipStatus.RequestSent: CancelFriendRequest(userData.UserId); break; - case UserProfileContextMenuControlSettings.FriendshipStatus.REQUEST_RECEIVED: + case UserProfileContextMenuControlSettings.FriendshipStatus.RequestReceived: AcceptFriendship(userData.UserId); break; - case UserProfileContextMenuControlSettings.FriendshipStatus.BLOCKED: break; + case UserProfileContextMenuControlSettings.FriendshipStatus.Blocked: break; default: throw new ArgumentOutOfRangeException(nameof(friendshipStatus), friendshipStatus, null); } } @@ -460,7 +460,7 @@ private void OnReportUserClicked(string userId) private async UniTaskVoid ShowBlockUserPromptAsync(Profile.CompactInfo profile) { - await mvcManager.ShowAsync(BlockUserPromptController.IssueCommand(new BlockUserPromptParams(new Web3Address(profile.UserId), profile.Name, BlockUserPromptParams.UserBlockAction.BLOCK))); + await mvcManager.ShowAsync(BlockUserPromptController.IssueCommand(new BlockUserPromptParams(new Web3Address(profile.UserId), profile.Name, BlockUserPromptParams.UserBlockAction.Block))); } private void OnJumpInClicked(string userId) diff --git a/Explorer/Assets/DCL/UI/GenericContextMenu/Controls/Configs/UserProfileContextMenuControlSettings.cs b/Explorer/Assets/DCL/UI/GenericContextMenu/Controls/Configs/UserProfileContextMenuControlSettings.cs index f5b1d1d66ba..1e58b357fe9 100644 --- a/Explorer/Assets/DCL/UI/GenericContextMenu/Controls/Configs/UserProfileContextMenuControlSettings.cs +++ b/Explorer/Assets/DCL/UI/GenericContextMenu/Controls/Configs/UserProfileContextMenuControlSettings.cs @@ -11,12 +11,12 @@ public class UserProfileContextMenuControlSettings : IContextMenuControlSettings public enum FriendshipStatus { - NONE, - FRIEND, - REQUEST_SENT, - REQUEST_RECEIVED, - BLOCKED, - DISABLED, + None, + Friend, + RequestSent, + RequestReceived, + Blocked, + Disabled, } internal Profile.CompactInfo userData; diff --git a/Explorer/Assets/DCL/UI/GenericContextMenu/Controls/GenericContextMenuUserProfileView.cs b/Explorer/Assets/DCL/UI/GenericContextMenu/Controls/GenericContextMenuUserProfileView.cs index 8dd0ac114cc..740e2178a67 100644 --- a/Explorer/Assets/DCL/UI/GenericContextMenu/Controls/GenericContextMenuUserProfileView.cs +++ b/Explorer/Assets/DCL/UI/GenericContextMenu/Controls/GenericContextMenuUserProfileView.cs @@ -25,8 +25,8 @@ public class GenericContextMenuUserProfileView : GenericContextMenuComponentBase private enum CopyUserInfoSection { - NAME, - ADDRESS, + Name, + Address, } [field: SerializeField] public TMP_Text UserName { get; private set; } @@ -108,8 +108,8 @@ public void Configure(UserProfileContextMenuControlSettings settings) copyAnimationCts = copyAnimationCts.SafeRestart(); - CopyNameButton.onClick.AddListener(() => CopyUserInfo(settings, CopyUserInfoSection.NAME)); - CopyAddressButton.onClick.AddListener(() => CopyUserInfo(settings, CopyUserInfoSection.ADDRESS)); + CopyNameButton.onClick.AddListener(() => CopyUserInfo(settings, CopyUserInfoSection.Name)); + CopyAddressButton.onClick.AddListener(() => CopyUserInfo(settings, CopyUserInfoSection.Address)); } private void LoadProfilePicture(Profile.CompactInfo userData) @@ -126,12 +126,12 @@ private void InvokeSettingsAction(UserProfileContextMenuControlSettings settings private void CopyUserInfo(UserProfileContextMenuControlSettings settings, CopyUserInfoSection section) { - ViewDependencies.ClipboardManager.Copy(this, section == CopyUserInfoSection.NAME ? settings.userData.Name : settings.userData.UserId); + ViewDependencies.ClipboardManager.Copy(this, section == CopyUserInfoSection.Name ? settings.userData.Name : settings.userData.UserId); CopyNameAnimationAsync(copyAnimationCts.Token).Forget(); async UniTaskVoid CopyNameAnimationAsync(CancellationToken ct) { - WarningNotificationView toast = section == CopyUserInfoSection.NAME ? CopyNameToast : CopyAddressToast; + WarningNotificationView toast = section == CopyUserInfoSection.Name ? CopyNameToast : CopyAddressToast; toast.Show(ct); await UniTask.Delay(COPY_ANIMATION_DURATION, cancellationToken: ct); toast.Hide(ct: ct); @@ -184,7 +184,7 @@ private float CalculateComponentHeight() private void ConfigureFriendshipButton(UserProfileContextMenuControlSettings settings) { - if (settings.friendshipStatus == UserProfileContextMenuControlSettings.FriendshipStatus.DISABLED) + if (settings.friendshipStatus == UserProfileContextMenuControlSettings.FriendshipStatus.Disabled) { FriendsButtonsContainer.gameObject.SetActive(false); return; @@ -199,10 +199,10 @@ private void ConfigureFriendshipButton(UserProfileContextMenuControlSettings set Button buttonToActivate = settings.friendshipStatus switch { - UserProfileContextMenuControlSettings.FriendshipStatus.NONE => AddFriendButton, - UserProfileContextMenuControlSettings.FriendshipStatus.FRIEND => RemoveFriendButton, - UserProfileContextMenuControlSettings.FriendshipStatus.REQUEST_SENT => CancelFriendButton, - UserProfileContextMenuControlSettings.FriendshipStatus.REQUEST_RECEIVED => AcceptFriendButton, + UserProfileContextMenuControlSettings.FriendshipStatus.None => AddFriendButton, + UserProfileContextMenuControlSettings.FriendshipStatus.Friend => RemoveFriendButton, + UserProfileContextMenuControlSettings.FriendshipStatus.RequestSent => CancelFriendButton, + UserProfileContextMenuControlSettings.FriendshipStatus.RequestReceived => AcceptFriendButton, _ => null, }; diff --git a/Explorer/Assets/DCL/UI/GenericContextMenu/GenericContextMenuController.cs b/Explorer/Assets/DCL/UI/GenericContextMenu/GenericContextMenuController.cs index b5383c79f56..54b6f5206e8 100644 --- a/Explorer/Assets/DCL/UI/GenericContextMenu/GenericContextMenuController.cs +++ b/Explorer/Assets/DCL/UI/GenericContextMenu/GenericContextMenuController.cs @@ -36,7 +36,7 @@ public DeferredConfig(GenericContextMenu config, GenericContextMenuSubMenuButton private const float SEVERE_BOUNDARY_VIOLATION_THRESHOLD = 0.4f; - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; private readonly ControlsPoolManager controlsPoolManager; private NativeArray worldRectCorners; @@ -316,17 +316,17 @@ private static Vector2 GetOffsetByDirection(ContextMenuOpenDirection direction, { return direction switch { - ContextMenuOpenDirection.BOTTOM_RIGHT => offsetFromTarget, - ContextMenuOpenDirection.BOTTOM_LEFT => new Vector2(-offsetFromTarget.x, offsetFromTarget.y), - ContextMenuOpenDirection.TOP_RIGHT => new Vector2(offsetFromTarget.x, -offsetFromTarget.y), - ContextMenuOpenDirection.TOP_LEFT => new Vector2(-offsetFromTarget.x, -offsetFromTarget.y), - ContextMenuOpenDirection.CENTER_RIGHT => new Vector2(offsetFromTarget.x, 0), - ContextMenuOpenDirection.CENTER_LEFT => new Vector2(-offsetFromTarget.x, 0), + ContextMenuOpenDirection.BottomRight => offsetFromTarget, + ContextMenuOpenDirection.BottomLeft => new Vector2(-offsetFromTarget.x, offsetFromTarget.y), + ContextMenuOpenDirection.TopRight => new Vector2(offsetFromTarget.x, -offsetFromTarget.y), + ContextMenuOpenDirection.TopLeft => new Vector2(-offsetFromTarget.x, -offsetFromTarget.y), + ContextMenuOpenDirection.CenterRight => new Vector2(offsetFromTarget.x, 0), + ContextMenuOpenDirection.CenterLeft => new Vector2(-offsetFromTarget.x, 0), _ => Vector2.zero, }; } - private Vector3 GetControlsPosition(ControlsContainerView container, Vector2 anchorPosition, Vector2 offsetFromTarget, Rect? overlapRect, ContextMenuOpenDirection initialDirection = ContextMenuOpenDirection.TOP_LEFT, bool exactPosition = false) + private Vector3 GetControlsPosition(ControlsContainerView container, Vector2 anchorPosition, Vector2 offsetFromTarget, Rect? overlapRect, ContextMenuOpenDirection initialDirection = ContextMenuOpenDirection.TopLeft, bool exactPosition = false) { Vector3 position = viewRectTransform.InverseTransformPoint(anchorPosition); var float3Position = new float3(position.x, position.y, position.z); @@ -465,14 +465,14 @@ private static ContextMenuOpenDirection GetSmartDirection( { ContextMenuOpenDirection smartDirection = initialDirection; - if (initialHorizontal == HorizontalPosition.RIGHT && outOfBoundsOnRight) + if (initialHorizontal == HorizontalPosition.Right && outOfBoundsOnRight) smartDirection = GetOppositeHorizontalDirection(initialDirection); - else if (initialHorizontal == HorizontalPosition.LEFT && outOfBoundsOnLeft) + else if (initialHorizontal == HorizontalPosition.Left && outOfBoundsOnLeft) smartDirection = GetOppositeHorizontalDirection(initialDirection); - if (initialVertical == VerticalPosition.TOP && outOfBoundsOnTop) + if (initialVertical == VerticalPosition.Top && outOfBoundsOnTop) smartDirection = GetOppositeVerticalDirection(smartDirection); - else if (initialVertical == VerticalPosition.BOTTOM && outOfBoundsOnBottom) + else if (initialVertical == VerticalPosition.Bottom && outOfBoundsOnBottom) smartDirection = GetOppositeVerticalDirection(smartDirection); return smartDirection; @@ -553,11 +553,11 @@ private void GetFallbackDirections(ControlsContainerView container, ContextMenuO bool avoidRight = outOfBoundsPercentRight > 0; bool avoidLeft = outOfBoundsPercentLeft > 0; - if ((initialVertical == VerticalPosition.TOP && !avoidTop) || - (initialVertical == VerticalPosition.BOTTOM && !avoidBottom) || - initialVertical == VerticalPosition.CENTER || - (initialHorizontal == HorizontalPosition.LEFT && !avoidLeft) || - (initialHorizontal == HorizontalPosition.RIGHT && !avoidRight)) + if ((initialVertical == VerticalPosition.Top && !avoidTop) || + (initialVertical == VerticalPosition.Bottom && !avoidBottom) || + initialVertical == VerticalPosition.Center || + (initialHorizontal == HorizontalPosition.Left && !avoidLeft) || + (initialHorizontal == HorizontalPosition.Right && !avoidRight)) AddToFallbackDirections(initialDirection); ProcessTopBoundaryViolation( @@ -599,42 +599,42 @@ private void ProcessTopBoundaryViolation( { if (outOfBoundsPercentTop <= outOfBoundsPercentBottom || outOfBoundsPercentTop <= 0) return; - if (initialHorizontal == HorizontalPosition.LEFT) + if (initialHorizontal == HorizontalPosition.Left) { - AddToFallbackDirections(ContextMenuOpenDirection.BOTTOM_LEFT); + AddToFallbackDirections(ContextMenuOpenDirection.BottomLeft); if (!skipCenter && !avoidBottom) - AddToFallbackDirections(ContextMenuOpenDirection.CENTER_LEFT); + AddToFallbackDirections(ContextMenuOpenDirection.CenterLeft); if (!avoidRight) { - AddToFallbackDirections(ContextMenuOpenDirection.BOTTOM_RIGHT); + AddToFallbackDirections(ContextMenuOpenDirection.BottomRight); if (!skipCenter && !avoidBottom) - AddToFallbackDirections(ContextMenuOpenDirection.CENTER_RIGHT); + AddToFallbackDirections(ContextMenuOpenDirection.CenterRight); } } else { - AddToFallbackDirections(ContextMenuOpenDirection.BOTTOM_RIGHT); + AddToFallbackDirections(ContextMenuOpenDirection.BottomRight); if (!skipCenter && !avoidBottom) - AddToFallbackDirections(ContextMenuOpenDirection.CENTER_RIGHT); + AddToFallbackDirections(ContextMenuOpenDirection.CenterRight); if (!avoidLeft) { - AddToFallbackDirections(ContextMenuOpenDirection.BOTTOM_LEFT); + AddToFallbackDirections(ContextMenuOpenDirection.BottomLeft); if (!skipCenter && !avoidBottom) - AddToFallbackDirections(ContextMenuOpenDirection.CENTER_LEFT); + AddToFallbackDirections(ContextMenuOpenDirection.CenterLeft); } } - if (!ContainsDirection(ContextMenuOpenDirection.TOP_LEFT) && !avoidLeft) - AddToFallbackDirections(ContextMenuOpenDirection.TOP_LEFT); + if (!ContainsDirection(ContextMenuOpenDirection.TopLeft) && !avoidLeft) + AddToFallbackDirections(ContextMenuOpenDirection.TopLeft); - if (!ContainsDirection(ContextMenuOpenDirection.TOP_RIGHT) && !avoidRight) - AddToFallbackDirections(ContextMenuOpenDirection.TOP_RIGHT); + if (!ContainsDirection(ContextMenuOpenDirection.TopRight) && !avoidRight) + AddToFallbackDirections(ContextMenuOpenDirection.TopRight); } private void ProcessBottomBoundaryViolation( @@ -647,57 +647,57 @@ private void ProcessBottomBoundaryViolation( { if (outOfBoundsPercentBottom <= 0) return; - if (initialHorizontal == HorizontalPosition.LEFT) + if (initialHorizontal == HorizontalPosition.Left) { - AddToFallbackDirections(ContextMenuOpenDirection.TOP_LEFT); + AddToFallbackDirections(ContextMenuOpenDirection.TopLeft); if (!skipCenter && !avoidTop) - AddToFallbackDirections(ContextMenuOpenDirection.CENTER_LEFT); + AddToFallbackDirections(ContextMenuOpenDirection.CenterLeft); if (!avoidRight) { - AddToFallbackDirections(ContextMenuOpenDirection.TOP_RIGHT); + AddToFallbackDirections(ContextMenuOpenDirection.TopRight); if (!skipCenter && !avoidTop) - AddToFallbackDirections(ContextMenuOpenDirection.CENTER_RIGHT); + AddToFallbackDirections(ContextMenuOpenDirection.CenterRight); } } else { - AddToFallbackDirections(ContextMenuOpenDirection.TOP_RIGHT); + AddToFallbackDirections(ContextMenuOpenDirection.TopRight); if (!skipCenter && !avoidTop) - AddToFallbackDirections(ContextMenuOpenDirection.CENTER_RIGHT); + AddToFallbackDirections(ContextMenuOpenDirection.CenterRight); if (!avoidLeft) { - AddToFallbackDirections(ContextMenuOpenDirection.TOP_LEFT); + AddToFallbackDirections(ContextMenuOpenDirection.TopLeft); if (!skipCenter && !avoidTop) - AddToFallbackDirections(ContextMenuOpenDirection.CENTER_LEFT); + AddToFallbackDirections(ContextMenuOpenDirection.CenterLeft); } } - if (!ContainsDirection(ContextMenuOpenDirection.BOTTOM_LEFT) && !avoidLeft) - AddToFallbackDirections(ContextMenuOpenDirection.BOTTOM_LEFT); + if (!ContainsDirection(ContextMenuOpenDirection.BottomLeft) && !avoidLeft) + AddToFallbackDirections(ContextMenuOpenDirection.BottomLeft); - if (!ContainsDirection(ContextMenuOpenDirection.BOTTOM_RIGHT) && !avoidRight) - AddToFallbackDirections(ContextMenuOpenDirection.BOTTOM_RIGHT); + if (!ContainsDirection(ContextMenuOpenDirection.BottomRight) && !avoidRight) + AddToFallbackDirections(ContextMenuOpenDirection.BottomRight); } private void ProcessHorizontalBoundaryViolation(bool avoidLeft, bool avoidRight) { if (avoidLeft) { - AddToFallbackDirections(ContextMenuOpenDirection.TOP_RIGHT); - AddToFallbackDirections(ContextMenuOpenDirection.CENTER_RIGHT); - AddToFallbackDirections(ContextMenuOpenDirection.BOTTOM_RIGHT); + AddToFallbackDirections(ContextMenuOpenDirection.TopRight); + AddToFallbackDirections(ContextMenuOpenDirection.CenterRight); + AddToFallbackDirections(ContextMenuOpenDirection.BottomRight); } else if (avoidRight) { - AddToFallbackDirections(ContextMenuOpenDirection.TOP_LEFT); - AddToFallbackDirections(ContextMenuOpenDirection.CENTER_LEFT); - AddToFallbackDirections(ContextMenuOpenDirection.BOTTOM_LEFT); + AddToFallbackDirections(ContextMenuOpenDirection.TopLeft); + AddToFallbackDirections(ContextMenuOpenDirection.CenterLeft); + AddToFallbackDirections(ContextMenuOpenDirection.BottomLeft); } } @@ -709,35 +709,35 @@ private void ProcessNoBoundaryViolation( { if (outOfBoundsPercentTop > 0 || outOfBoundsPercentBottom > 0) return; - if (initialHorizontal == HorizontalPosition.LEFT) + if (initialHorizontal == HorizontalPosition.Left) { - if (initialVertical != VerticalPosition.TOP && !ContainsDirection(ContextMenuOpenDirection.TOP_LEFT)) - AddToFallbackDirections(ContextMenuOpenDirection.TOP_LEFT); + if (initialVertical != VerticalPosition.Top && !ContainsDirection(ContextMenuOpenDirection.TopLeft)) + AddToFallbackDirections(ContextMenuOpenDirection.TopLeft); - if (initialVertical != VerticalPosition.CENTER && !ContainsDirection(ContextMenuOpenDirection.CENTER_LEFT)) - AddToFallbackDirections(ContextMenuOpenDirection.CENTER_LEFT); + if (initialVertical != VerticalPosition.Center && !ContainsDirection(ContextMenuOpenDirection.CenterLeft)) + AddToFallbackDirections(ContextMenuOpenDirection.CenterLeft); - if (initialVertical != VerticalPosition.BOTTOM && !ContainsDirection(ContextMenuOpenDirection.BOTTOM_LEFT)) - AddToFallbackDirections(ContextMenuOpenDirection.BOTTOM_LEFT); + if (initialVertical != VerticalPosition.Bottom && !ContainsDirection(ContextMenuOpenDirection.BottomLeft)) + AddToFallbackDirections(ContextMenuOpenDirection.BottomLeft); - AddToFallbackDirections(ContextMenuOpenDirection.TOP_RIGHT); - AddToFallbackDirections(ContextMenuOpenDirection.CENTER_RIGHT); - AddToFallbackDirections(ContextMenuOpenDirection.BOTTOM_RIGHT); + AddToFallbackDirections(ContextMenuOpenDirection.TopRight); + AddToFallbackDirections(ContextMenuOpenDirection.CenterRight); + AddToFallbackDirections(ContextMenuOpenDirection.BottomRight); } else { - if (initialVertical != VerticalPosition.TOP && !ContainsDirection(ContextMenuOpenDirection.TOP_RIGHT)) - AddToFallbackDirections(ContextMenuOpenDirection.TOP_RIGHT); + if (initialVertical != VerticalPosition.Top && !ContainsDirection(ContextMenuOpenDirection.TopRight)) + AddToFallbackDirections(ContextMenuOpenDirection.TopRight); - if (initialVertical != VerticalPosition.CENTER && !ContainsDirection(ContextMenuOpenDirection.CENTER_RIGHT)) - AddToFallbackDirections(ContextMenuOpenDirection.CENTER_RIGHT); + if (initialVertical != VerticalPosition.Center && !ContainsDirection(ContextMenuOpenDirection.CenterRight)) + AddToFallbackDirections(ContextMenuOpenDirection.CenterRight); - if (initialVertical != VerticalPosition.BOTTOM && !ContainsDirection(ContextMenuOpenDirection.BOTTOM_RIGHT)) - AddToFallbackDirections(ContextMenuOpenDirection.BOTTOM_RIGHT); + if (initialVertical != VerticalPosition.Bottom && !ContainsDirection(ContextMenuOpenDirection.BottomRight)) + AddToFallbackDirections(ContextMenuOpenDirection.BottomRight); - AddToFallbackDirections(ContextMenuOpenDirection.TOP_LEFT); - AddToFallbackDirections(ContextMenuOpenDirection.CENTER_LEFT); - AddToFallbackDirections(ContextMenuOpenDirection.BOTTOM_LEFT); + AddToFallbackDirections(ContextMenuOpenDirection.TopLeft); + AddToFallbackDirections(ContextMenuOpenDirection.CenterLeft); + AddToFallbackDirections(ContextMenuOpenDirection.BottomLeft); } } @@ -759,15 +759,15 @@ private bool ContainsDirection(ContextMenuOpenDirection direction) private enum HorizontalPosition { - LEFT, - RIGHT, + Left, + Right, } private enum VerticalPosition { - TOP, - CENTER, - BOTTOM, + Top, + Center, + Bottom, } [BurstCompile] @@ -775,18 +775,18 @@ private static HorizontalPosition GetHorizontalPosition(ContextMenuOpenDirection { switch (direction) { - case ContextMenuOpenDirection.TOP_LEFT: - case ContextMenuOpenDirection.CENTER_LEFT: - case ContextMenuOpenDirection.BOTTOM_LEFT: - return HorizontalPosition.LEFT; + case ContextMenuOpenDirection.TopLeft: + case ContextMenuOpenDirection.CenterLeft: + case ContextMenuOpenDirection.BottomLeft: + return HorizontalPosition.Left; - case ContextMenuOpenDirection.TOP_RIGHT: - case ContextMenuOpenDirection.CENTER_RIGHT: - case ContextMenuOpenDirection.BOTTOM_RIGHT: - return HorizontalPosition.RIGHT; + case ContextMenuOpenDirection.TopRight: + case ContextMenuOpenDirection.CenterRight: + case ContextMenuOpenDirection.BottomRight: + return HorizontalPosition.Right; default: - return HorizontalPosition.RIGHT; + return HorizontalPosition.Right; } } @@ -795,20 +795,20 @@ private static VerticalPosition GetVerticalPosition(ContextMenuOpenDirection dir { switch (direction) { - case ContextMenuOpenDirection.TOP_LEFT: - case ContextMenuOpenDirection.TOP_RIGHT: - return VerticalPosition.TOP; + case ContextMenuOpenDirection.TopLeft: + case ContextMenuOpenDirection.TopRight: + return VerticalPosition.Top; - case ContextMenuOpenDirection.CENTER_LEFT: - case ContextMenuOpenDirection.CENTER_RIGHT: - return VerticalPosition.CENTER; + case ContextMenuOpenDirection.CenterLeft: + case ContextMenuOpenDirection.CenterRight: + return VerticalPosition.Center; - case ContextMenuOpenDirection.BOTTOM_LEFT: - case ContextMenuOpenDirection.BOTTOM_RIGHT: - return VerticalPosition.BOTTOM; + case ContextMenuOpenDirection.BottomLeft: + case ContextMenuOpenDirection.BottomRight: + return VerticalPosition.Bottom; default: - return VerticalPosition.BOTTOM; + return VerticalPosition.Bottom; } } @@ -821,30 +821,30 @@ private float3 GetPositionForDirection(ControlsContainerView container, ContextM switch (direction) { - case ContextMenuOpenDirection.TOP_LEFT: - case ContextMenuOpenDirection.BOTTOM_LEFT: - case ContextMenuOpenDirection.CENTER_LEFT: + case ContextMenuOpenDirection.TopLeft: + case ContextMenuOpenDirection.BottomLeft: + case ContextMenuOpenDirection.CenterLeft: result.x -= halfWidth; break; - case ContextMenuOpenDirection.TOP_RIGHT: - case ContextMenuOpenDirection.BOTTOM_RIGHT: - case ContextMenuOpenDirection.CENTER_RIGHT: + case ContextMenuOpenDirection.TopRight: + case ContextMenuOpenDirection.BottomRight: + case ContextMenuOpenDirection.CenterRight: result.x += halfWidth; break; } switch (direction) { - case ContextMenuOpenDirection.TOP_LEFT: - case ContextMenuOpenDirection.TOP_RIGHT: + case ContextMenuOpenDirection.TopLeft: + case ContextMenuOpenDirection.TopRight: result.y += halfHeight; break; - case ContextMenuOpenDirection.BOTTOM_LEFT: - case ContextMenuOpenDirection.BOTTOM_RIGHT: + case ContextMenuOpenDirection.BottomLeft: + case ContextMenuOpenDirection.BottomRight: result.y -= halfHeight; break; - case ContextMenuOpenDirection.CENTER_LEFT: - case ContextMenuOpenDirection.CENTER_RIGHT: + case ContextMenuOpenDirection.CenterLeft: + case ContextMenuOpenDirection.CenterRight: break; } @@ -896,12 +896,12 @@ private static ContextMenuOpenDirection GetOppositeHorizontalDirection(ContextMe { return direction switch { - ContextMenuOpenDirection.TOP_LEFT => ContextMenuOpenDirection.TOP_RIGHT, - ContextMenuOpenDirection.CENTER_LEFT => ContextMenuOpenDirection.CENTER_RIGHT, - ContextMenuOpenDirection.BOTTOM_LEFT => ContextMenuOpenDirection.BOTTOM_RIGHT, - ContextMenuOpenDirection.TOP_RIGHT => ContextMenuOpenDirection.TOP_LEFT, - ContextMenuOpenDirection.CENTER_RIGHT => ContextMenuOpenDirection.CENTER_LEFT, - ContextMenuOpenDirection.BOTTOM_RIGHT => ContextMenuOpenDirection.BOTTOM_LEFT, + ContextMenuOpenDirection.TopLeft => ContextMenuOpenDirection.TopRight, + ContextMenuOpenDirection.CenterLeft => ContextMenuOpenDirection.CenterRight, + ContextMenuOpenDirection.BottomLeft => ContextMenuOpenDirection.BottomRight, + ContextMenuOpenDirection.TopRight => ContextMenuOpenDirection.TopLeft, + ContextMenuOpenDirection.CenterRight => ContextMenuOpenDirection.CenterLeft, + ContextMenuOpenDirection.BottomRight => ContextMenuOpenDirection.BottomLeft, _ => direction, }; } @@ -911,10 +911,10 @@ private static ContextMenuOpenDirection GetOppositeVerticalDirection(ContextMenu { return direction switch { - ContextMenuOpenDirection.TOP_LEFT => ContextMenuOpenDirection.BOTTOM_LEFT, - ContextMenuOpenDirection.TOP_RIGHT => ContextMenuOpenDirection.BOTTOM_RIGHT, - ContextMenuOpenDirection.BOTTOM_LEFT => ContextMenuOpenDirection.TOP_LEFT, - ContextMenuOpenDirection.BOTTOM_RIGHT => ContextMenuOpenDirection.TOP_RIGHT, + ContextMenuOpenDirection.TopLeft => ContextMenuOpenDirection.BottomLeft, + ContextMenuOpenDirection.TopRight => ContextMenuOpenDirection.BottomRight, + ContextMenuOpenDirection.BottomLeft => ContextMenuOpenDirection.TopLeft, + ContextMenuOpenDirection.BottomRight => ContextMenuOpenDirection.TopRight, _ => direction, }; } diff --git a/Explorer/Assets/DCL/UI/GenericContextMenuParameter/ContextMenuOpenDirection.cs b/Explorer/Assets/DCL/UI/GenericContextMenuParameter/ContextMenuOpenDirection.cs index 1a00f03c145..c11a95b1874 100644 --- a/Explorer/Assets/DCL/UI/GenericContextMenuParameter/ContextMenuOpenDirection.cs +++ b/Explorer/Assets/DCL/UI/GenericContextMenuParameter/ContextMenuOpenDirection.cs @@ -2,11 +2,11 @@ namespace DCL.UI { public enum ContextMenuOpenDirection { - BOTTOM_RIGHT, - TOP_RIGHT, - CENTER_RIGHT, - BOTTOM_LEFT, - TOP_LEFT, - CENTER_LEFT, + BottomRight, + TopRight, + CenterRight, + BottomLeft, + TopLeft, + CenterLeft, } } diff --git a/Explorer/Assets/DCL/UI/GenericContextMenuParameter/GenericContextMenu.cs b/Explorer/Assets/DCL/UI/GenericContextMenuParameter/GenericContextMenu.cs index 7389a26b2d2..e5a5625737f 100644 --- a/Explorer/Assets/DCL/UI/GenericContextMenuParameter/GenericContextMenu.cs +++ b/Explorer/Assets/DCL/UI/GenericContextMenuParameter/GenericContextMenu.cs @@ -33,7 +33,7 @@ public class GenericContextMenu /// offsetFromTarget has the default value of (11, 18). /// horizontalLayoutPadding has the default value of (8, 8, 4, 12). /// - public GenericContextMenu(float width = 186, Vector2? offsetFromTarget = null, RectOffset verticalLayoutPadding = null, int elementsSpacing = 1, ContextMenuOpenDirection anchorPoint = ContextMenuOpenDirection.BOTTOM_RIGHT, + public GenericContextMenu(float width = 186, Vector2? offsetFromTarget = null, RectOffset verticalLayoutPadding = null, int elementsSpacing = 1, ContextMenuOpenDirection anchorPoint = ContextMenuOpenDirection.BottomRight, bool showRim = false) { this.width = width; diff --git a/Explorer/Assets/DCL/UI/InputSuggestions/BaseSuggestionElement.cs b/Explorer/Assets/DCL/UI/InputSuggestions/BaseSuggestionElement.cs index a87ac633ca2..444b0b78fcb 100644 --- a/Explorer/Assets/DCL/UI/InputSuggestions/BaseSuggestionElement.cs +++ b/Explorer/Assets/DCL/UI/InputSuggestions/BaseSuggestionElement.cs @@ -52,7 +52,7 @@ protected void OnSuggestionSelected() } public virtual InputSuggestionType GetSuggestionType() => - InputSuggestionType.NONE; + InputSuggestionType.None; } public abstract class BaseInputSuggestionElement : BaseInputSuggestionElement @@ -107,8 +107,8 @@ public override void SetSelectionState(bool isSelected) public enum InputSuggestionType { - NONE, - EMOJIS, - PROFILE, + None, + Emojis, + Profile, } } diff --git a/Explorer/Assets/DCL/UI/InputSuggestions/EmojiInputSuggestionData.cs b/Explorer/Assets/DCL/UI/InputSuggestions/EmojiInputSuggestionData.cs index bb4ebffd692..ef2f371b7c5 100644 --- a/Explorer/Assets/DCL/UI/InputSuggestions/EmojiInputSuggestionData.cs +++ b/Explorer/Assets/DCL/UI/InputSuggestions/EmojiInputSuggestionData.cs @@ -15,6 +15,6 @@ public string GetId() => EmojiCode; public InputSuggestionType GetInputSuggestionType() => - InputSuggestionType.EMOJIS; + InputSuggestionType.Emojis; } } diff --git a/Explorer/Assets/DCL/UI/InputSuggestions/InputSuggestionPanelController.cs b/Explorer/Assets/DCL/UI/InputSuggestions/InputSuggestionPanelController.cs index 9b19466262c..af4094c9eaf 100644 --- a/Explorer/Assets/DCL/UI/InputSuggestions/InputSuggestionPanelController.cs +++ b/Explorer/Assets/DCL/UI/InputSuggestions/InputSuggestionPanelController.cs @@ -66,7 +66,7 @@ public async UniTask HandleSuggestionsSearchAsync(string inputText, Re private async UniTask SearchAndSetSuggestionsAsync(string value, InputSuggestionType suggestionType, Dictionary suggestionDataMap, CancellationToken ct) where T : IInputSuggestionElementData { var resultList = new List(); - string searchValue = suggestionType == InputSuggestionType.EMOJIS ? value.Replace(":", "") : value; + string searchValue = suggestionType == InputSuggestionType.Emojis ? value.Replace(":", "") : value; await DictionaryUtils.GetKeysContainingTextAsync(suggestionDataMap, searchValue, resultList, ct); suggestionPanel.SetSuggestionValues(suggestionType, resultList); diff --git a/Explorer/Assets/DCL/UI/InputSuggestions/InputSuggestionPanelView.cs b/Explorer/Assets/DCL/UI/InputSuggestions/InputSuggestionPanelView.cs index 409bead1b4d..8b1f9c7820d 100644 --- a/Explorer/Assets/DCL/UI/InputSuggestions/InputSuggestionPanelView.cs +++ b/Explorer/Assets/DCL/UI/InputSuggestions/InputSuggestionPanelView.cs @@ -161,7 +161,7 @@ public void SetSuggestionValues(InputSuggestionType suggestionType, IList { noResultsIndicator.gameObject.SetActive(foundSuggestions.Count == 0); - if (suggestionType == InputSuggestionType.NONE) return; + if (suggestionType == InputSuggestionType.None) return; int maxVisibleSuggestions = suggestionDataPerType[suggestionType].MaxSuggestionAmount; @@ -186,7 +186,7 @@ public void SetSuggestionValues(InputSuggestionType suggestionType, IList //if the suggestion type is different, we release all items from the pool, //otherwise, we only release the elements that are over the found suggestion amount. - if (currentSuggestionType != InputSuggestionType.NONE) + if (currentSuggestionType != InputSuggestionType.None) { if (currentSuggestionType != suggestionType) { diff --git a/Explorer/Assets/DCL/UI/InputSuggestions/ProfileInputSuggestionData.cs b/Explorer/Assets/DCL/UI/InputSuggestions/ProfileInputSuggestionData.cs index e7a3f568078..ed5b3918bab 100644 --- a/Explorer/Assets/DCL/UI/InputSuggestions/ProfileInputSuggestionData.cs +++ b/Explorer/Assets/DCL/UI/InputSuggestions/ProfileInputSuggestionData.cs @@ -18,6 +18,6 @@ public string GetId() => ProfileData.UserId; public InputSuggestionType GetInputSuggestionType() => - InputSuggestionType.PROFILE; + InputSuggestionType.Profile; } } diff --git a/Explorer/Assets/DCL/UI/MainUIContainer/MainUIController.cs b/Explorer/Assets/DCL/UI/MainUIContainer/MainUIController.cs index 4f3bb387e2b..ac73dc15eb0 100644 --- a/Explorer/Assets/DCL/UI/MainUIContainer/MainUIController.cs +++ b/Explorer/Assets/DCL/UI/MainUIContainer/MainUIController.cs @@ -31,7 +31,7 @@ public class MainUIController : ControllerBase private CancellationTokenSource showSidebarCancellationTokenSource = new (); private CancellationTokenSource hideSidebarCancellationTokenSource = new (); - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.PERSISTENT; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Persistent; public MainUIController( ViewFactoryMethod viewFactory, diff --git a/Explorer/Assets/DCL/UI/OTPInput/OTPInputFieldView.cs b/Explorer/Assets/DCL/UI/OTPInput/OTPInputFieldView.cs index 5240b0ab455..aa383ec2e13 100644 --- a/Explorer/Assets/DCL/UI/OTPInput/OTPInputFieldView.cs +++ b/Explorer/Assets/DCL/UI/OTPInput/OTPInputFieldView.cs @@ -48,7 +48,7 @@ private void Awake() hiddenInput.onFocusSelectAll = false; foreach (OTPSlotView slot in slots) - slot.SetState(OTPSlotView.SlotState.UNSELECTED); + slot.SetState(OTPSlotView.SlotState.Unselected); caretImage.gameObject.SetActive(false); } @@ -68,7 +68,7 @@ private void Update() // set slot selected with caret disabled if (!prevIsFocused && textLength >= slots.Length) - slots[textLength - 1].SetState(OTPSlotView.SlotState.SELECTED); + slots[textLength - 1].SetState(OTPSlotView.SlotState.Selected); } prevIsFocused = hiddenInput.isFocused; @@ -110,14 +110,14 @@ private void UnselectAll(string _) { caretImage.gameObject.SetActive(false); foreach (OTPSlotView slot in slots) - slot.SetState(OTPSlotView.SlotState.UNSELECTED); + slot.SetState(OTPSlotView.SlotState.Unselected); } private void UpdateSlotsWithText(string text) { for (var i = 0; i < slots.Length; i++) { - slots[i].SetState(OTPSlotView.SlotState.UNSELECTED); + slots[i].SetState(OTPSlotView.SlotState.Unselected); slots[i].Text = i < text.Length ? text[i].ToString() : string.Empty; } @@ -132,7 +132,7 @@ private void UpdateSlotsWithText(string text) else { OTPSlotView activeSlot = slots[text.Length]; - activeSlot.SetState(OTPSlotView.SlotState.SELECTED); + activeSlot.SetState(OTPSlotView.SlotState.Selected); caretImage.rectTransform.position = activeSlot.Center; } @@ -186,7 +186,7 @@ public void SetSuccess() hiddenInput.interactable = false; foreach (OTPSlotView slot in slots) - slot.SetState(OTPSlotView.SlotState.SUCCESS); + slot.SetState(OTPSlotView.SlotState.Success); resultText.gameObject.SetActive(true); resultText.text = "Success"; @@ -200,7 +200,7 @@ public void SetFailure() hiddenInput.interactable = false; foreach (OTPSlotView slot in slots) - slot.SetState(OTPSlotView.SlotState.ERROR); + slot.SetState(OTPSlotView.SlotState.Error); ShakeAnimation(); diff --git a/Explorer/Assets/DCL/UI/OTPInput/OTPSlotView.cs b/Explorer/Assets/DCL/UI/OTPInput/OTPSlotView.cs index 04c23ab6d88..b3970f3058c 100644 --- a/Explorer/Assets/DCL/UI/OTPInput/OTPSlotView.cs +++ b/Explorer/Assets/DCL/UI/OTPInput/OTPSlotView.cs @@ -8,10 +8,10 @@ public class OTPSlotView : MonoBehaviour { public enum SlotState { - UNSELECTED, - SELECTED, - ERROR, - SUCCESS, + Unselected, + Selected, + Error, + Success, } [SerializeField] private TMP_Text text; @@ -31,18 +31,18 @@ public string Text private void Awake() { - SetState(SlotState.UNSELECTED); + SetState(SlotState.Unselected); } public void SetState(SlotState state) { - outline.gameObject.SetActive(state == SlotState.SELECTED); + outline.gameObject.SetActive(state == SlotState.Selected); background.color = state switch { - SlotState.UNSELECTED or SlotState.SELECTED => normalColor, - SlotState.ERROR => errorColor, - SlotState.SUCCESS => successColor, + SlotState.Unselected or SlotState.Selected => normalColor, + SlotState.Error => errorColor, + SlotState.Success => successColor, _ => background.color, }; } diff --git a/Explorer/Assets/DCL/UI/OnlineStatusConfiguration.cs b/Explorer/Assets/DCL/UI/OnlineStatusConfiguration.cs index 0322829b8f2..f20091fb675 100644 --- a/Explorer/Assets/DCL/UI/OnlineStatusConfiguration.cs +++ b/Explorer/Assets/DCL/UI/OnlineStatusConfiguration.cs @@ -36,8 +36,8 @@ public class OnlineStatusConfigurationData public enum OnlineStatus { - ONLINE, - AWAY, - OFFLINE + Online, + Away, + Offline } } diff --git a/Explorer/Assets/DCL/UI/PastePopupToast/PastePopupToastController.cs b/Explorer/Assets/DCL/UI/PastePopupToast/PastePopupToastController.cs index aa5f072139f..22c6dad3687 100644 --- a/Explorer/Assets/DCL/UI/PastePopupToast/PastePopupToastController.cs +++ b/Explorer/Assets/DCL/UI/PastePopupToast/PastePopupToastController.cs @@ -32,7 +32,7 @@ private void OnPasteButtonClicked() clipboardManager.Paste(this); } - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; protected override UniTask WaitForCloseIntentAsync(CancellationToken ct) => UniTask.WhenAny(inputData.CloseTask ?? UniTask.Never(ct), diff --git a/Explorer/Assets/DCL/UI/Profiles/Names/ProfileNameEditorController.cs b/Explorer/Assets/DCL/UI/Profiles/Names/ProfileNameEditorController.cs index cd87bc327da..c239cded092 100644 --- a/Explorer/Assets/DCL/UI/Profiles/Names/ProfileNameEditorController.cs +++ b/Explorer/Assets/DCL/UI/Profiles/Names/ProfileNameEditorController.cs @@ -26,7 +26,7 @@ public class ProfileNameEditorController : ControllerBase private CancellationTokenSource? saveCancellationToken; private CancellationTokenSource? setupCancellationToken; - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; public event Action? NameChanged; public event Action? NameClaimRequested; diff --git a/Explorer/Assets/DCL/UI/Profiles/ProfileElements/GetProfileThumbnailCommand.cs b/Explorer/Assets/DCL/UI/Profiles/ProfileElements/GetProfileThumbnailCommand.cs index c145466d7aa..e60deee2c90 100644 --- a/Explorer/Assets/DCL/UI/Profiles/ProfileElements/GetProfileThumbnailCommand.cs +++ b/Explorer/Assets/DCL/UI/Profiles/ProfileElements/GetProfileThumbnailCommand.cs @@ -36,7 +36,7 @@ public async UniTask ExecuteAsync(IReactiveProperty p } // Wait until the property is bound - while (property.Value.ThumbnailState == ProfileThumbnailViewModel.State.NOT_BOUND) + while (property.Value.ThumbnailState == ProfileThumbnailViewModel.State.NotBound) await UniTask.Yield(); if (ct.IsCancellationRequested) @@ -47,7 +47,7 @@ public async UniTask ExecuteAsync(IReactiveProperty p Sprite? previousUserSprite = profileRepository.GetLatestThumbnailForUser(userId); bool seededPreviousSprite = previousUserSprite != null; - property.UpdateValue(new ProfileThumbnailViewModel(ProfileThumbnailViewModel.State.LOADING, previousUserSprite, property.Value.ProfileColor, property.Value.FitAndCenterImage)); + property.UpdateValue(new ProfileThumbnailViewModel(ProfileThumbnailViewModel.State.Loading, previousUserSprite, property.Value.ProfileColor, property.Value.FitAndCenterImage)); try { diff --git a/Explorer/Assets/DCL/UI/Profiles/ProfileElements/ProfilePictureView.cs b/Explorer/Assets/DCL/UI/Profiles/ProfileElements/ProfilePictureView.cs index de20d35514b..c7653feb512 100644 --- a/Explorer/Assets/DCL/UI/Profiles/ProfileElements/ProfilePictureView.cs +++ b/Explorer/Assets/DCL/UI/Profiles/ProfileElements/ProfilePictureView.cs @@ -70,7 +70,7 @@ private void OnThumbnailUpdated(ProfileThumbnailViewModel model) switch (model.ThumbnailState) { - case ProfileThumbnailViewModel.State.LOADING: + case ProfileThumbnailViewModel.State.Loading: if (model.Sprite != null) { thumbnailImageView.SetImage(model.Sprite, model.FitAndCenterImage); @@ -83,13 +83,13 @@ private void OnThumbnailUpdated(ProfileThumbnailViewModel model) thumbnailImageView.Alpha = 0f; } break; - case ProfileThumbnailViewModel.State.FALLBACK: - case ProfileThumbnailViewModel.State.LOADED_FROM_CACHE: + case ProfileThumbnailViewModel.State.Fallback: + case ProfileThumbnailViewModel.State.LoadedFromCache: thumbnailImageView.SetImage(model.Sprite!, model.FitAndCenterImage); SetLoadingState(false); thumbnailImageView.Alpha = 1f; break; - case ProfileThumbnailViewModel.State.LOADED_REMOTELY: + case ProfileThumbnailViewModel.State.LoadedRemotely: SetThumbnailImageWithAnimationAsync(model.Sprite!, destroyCancellationToken, model.FitAndCenterImage).Forget(); break; default: diff --git a/Explorer/Assets/DCL/UI/Profiles/ProfileElements/ProfileThumbnailViewModel.cs b/Explorer/Assets/DCL/UI/Profiles/ProfileElements/ProfileThumbnailViewModel.cs index 896da0b77c6..b4212c75e5f 100644 --- a/Explorer/Assets/DCL/UI/Profiles/ProfileElements/ProfileThumbnailViewModel.cs +++ b/Explorer/Assets/DCL/UI/Profiles/ProfileElements/ProfileThumbnailViewModel.cs @@ -13,12 +13,12 @@ public enum State : byte /// /// If the view model is not bound the loading won't be started /// - NOT_BOUND, - LOADING, - LOADED_FROM_CACHE, - LOADED_REMOTELY, - FALLBACK, - ERROR, + NotBound, + Loading, + LoadedFromCache, + LoadedRemotely, + Fallback, + Error, } public readonly State ThumbnailState; @@ -35,19 +35,19 @@ internal ProfileThumbnailViewModel(State thumbnailState, Sprite? sprite, Color? } public static ProfileThumbnailViewModel ReadyToLoad(Color? color = null) => - new (State.LOADING, null, color); + new (State.Loading, null, color); public static ProfileThumbnailViewModel Default(Color? color = null) => - new (State.NOT_BOUND, null, color); + new (State.NotBound, null, color); public static ProfileThumbnailViewModel FromFallback(Sprite sprite, Color? color = null) => - new (State.FALLBACK, sprite, color); + new (State.Fallback, sprite, color); public static ProfileThumbnailViewModel Error(Color? color = null) => - new (State.ERROR, null, color); + new (State.Error, null, color); public static ProfileThumbnailViewModel FromLoaded(Sprite sprite, bool fromCache, Color? color = null, bool fitAndCenter = false) => - new (fromCache ? State.LOADED_FROM_CACHE : State.LOADED_REMOTELY, sprite, color, fitAndCenter); + new (fromCache ? State.LoadedFromCache : State.LoadedRemotely, sprite, color, fitAndCenter); [BurstDiscard] public bool Equals(ProfileThumbnailViewModel other) => diff --git a/Explorer/Assets/DCL/UI/Profiles/ProfileElements/ProfileThumbnailViewModelExtensions.cs b/Explorer/Assets/DCL/UI/Profiles/ProfileElements/ProfileThumbnailViewModelExtensions.cs index 6fce28f8745..226933f1a67 100644 --- a/Explorer/Assets/DCL/UI/Profiles/ProfileElements/ProfileThumbnailViewModelExtensions.cs +++ b/Explorer/Assets/DCL/UI/Profiles/ProfileElements/ProfileThumbnailViewModelExtensions.cs @@ -7,7 +7,7 @@ namespace DCL.UI.ProfileElements public static class ProfileThumbnailViewModelExtensions { public static void SetLoading(this IReactiveProperty property, Color color) => - property.UpdateValue(new ProfileThumbnailViewModel(State.LOADING, null, color)); + property.UpdateValue(new ProfileThumbnailViewModel(State.Loading, null, color)); public static void SetLoaded(this IReactiveProperty property, Sprite sprite, bool fromCache) => property.UpdateValue(FromLoaded(sprite, fromCache, property.Value.ProfileColor, property.Value.FitAndCenterImage)); @@ -17,9 +17,9 @@ public static void SetColor(this IReactiveProperty pr public static void TryBind(this IReactiveProperty property) { - if (property.Value.ThumbnailState == State.NOT_BOUND) + if (property.Value.ThumbnailState == State.NotBound) - property.UpdateValue(new ProfileThumbnailViewModel(State.LOADING, property.Value.Sprite, property.Value.ProfileColor, property.Value.FitAndCenterImage)); + property.UpdateValue(new ProfileThumbnailViewModel(State.Loading, property.Value.Sprite, property.Value.ProfileColor, property.Value.FitAndCenterImage)); } } } diff --git a/Explorer/Assets/DCL/UI/Profiles/ProfileElements/SimpleProfileView.cs b/Explorer/Assets/DCL/UI/Profiles/ProfileElements/SimpleProfileView.cs index 0f264ca1919..ec850b1157f 100644 --- a/Explorer/Assets/DCL/UI/Profiles/ProfileElements/SimpleProfileView.cs +++ b/Explorer/Assets/DCL/UI/Profiles/ProfileElements/SimpleProfileView.cs @@ -64,8 +64,8 @@ private void Awake() public void SetConnectionStatus(OnlineStatus connectionStatus) { connectionStatusIndicator.color = onlineStatusConfiguration.GetConfiguration(connectionStatus).StatusColor; - connectionStatusIndicatorContainer.gameObject.SetActive(connectionStatus == OnlineStatus.ONLINE); - profilePictureView.GreyOut(connectionStatus != OnlineStatus.ONLINE ? offlineThumbnailGreyOutOpacity : 0.0f); + connectionStatusIndicatorContainer.gameObject.SetActive(connectionStatus == OnlineStatus.Online); + profilePictureView.GreyOut(connectionStatus != OnlineStatus.Online ? offlineThumbnailGreyOutOpacity : 0.0f); } private void OnOpenProfileClicked() @@ -77,7 +77,7 @@ private void OnOpenProfileClicked() cts = cts.SafeRestart(); ProfileContextMenuOpened?.Invoke(); openProfileButton.OnSelect(null); - ViewDependencies.GlobalUIViews.ShowUserProfileContextMenuFromWalletIdAsync(currentWalledId, openProfileButton.transform.position, CONTEXT_MENU_OFFSET, cts.Token, contextMenuTask.Task, OnProfileContextMenuClosed, MenuAnchorPoint.TOP_LEFT).Forget(); + ViewDependencies.GlobalUIViews.ShowUserProfileContextMenuFromWalletIdAsync(currentWalledId, openProfileButton.transform.position, CONTEXT_MENU_OFFSET, cts.Token, contextMenuTask.Task, OnProfileContextMenuClosed, MenuAnchorPoint.TopLeft).Forget(); } private void OnProfileContextMenuClosed() diff --git a/Explorer/Assets/DCL/UI/Profiles/ProfileMenuController.cs b/Explorer/Assets/DCL/UI/Profiles/ProfileMenuController.cs index 662c9888a73..0a59d54ef74 100644 --- a/Explorer/Assets/DCL/UI/Profiles/ProfileMenuController.cs +++ b/Explorer/Assets/DCL/UI/Profiles/ProfileMenuController.cs @@ -64,7 +64,7 @@ protected override void OnViewInstantiated() systemSectionPresenter.OnClosed += OnClose; } - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; protected override void OnViewShow() { diff --git a/Explorer/Assets/DCL/UI/Profiles/SidebarProfileMenuController.cs b/Explorer/Assets/DCL/UI/Profiles/SidebarProfileMenuController.cs index 9aeb5d8fac9..c3517349d18 100644 --- a/Explorer/Assets/DCL/UI/Profiles/SidebarProfileMenuController.cs +++ b/Explorer/Assets/DCL/UI/Profiles/SidebarProfileMenuController.cs @@ -11,7 +11,7 @@ public SidebarProfileMenuController(ViewFactoryMethod viewFactory) : base(viewFa { } - public override CanvasOrdering.SortingLayer Layer { get; } = CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer { get; } = CanvasOrdering.SortingLayer.Popup; protected override UniTask WaitForCloseIntentAsync(CancellationToken ct) => UniTask.Never(ct); diff --git a/Explorer/Assets/DCL/UI/Sidebar/HelpMenu/HelpMenuController.cs b/Explorer/Assets/DCL/UI/Sidebar/HelpMenu/HelpMenuController.cs index 4c4637f7fd4..938435c7643 100644 --- a/Explorer/Assets/DCL/UI/Sidebar/HelpMenu/HelpMenuController.cs +++ b/Explorer/Assets/DCL/UI/Sidebar/HelpMenu/HelpMenuController.cs @@ -17,7 +17,7 @@ public class HelpMenuController : ControllerBase private UniTaskCompletionSource? closeViewTask; private CancellationTokenSource openControlsCts = new (); - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; public HelpMenuController(ViewFactoryMethod viewFactory, IMVCManager mvcManager, UnityAppWebBrowser webBrowser, SupportRequestService supportRequestService) : base(viewFactory) diff --git a/Explorer/Assets/DCL/UI/Sidebar/SidebarController.cs b/Explorer/Assets/DCL/UI/Sidebar/SidebarController.cs index 1970e5fba29..0ae549cb929 100644 --- a/Explorer/Assets/DCL/UI/Sidebar/SidebarController.cs +++ b/Explorer/Assets/DCL/UI/Sidebar/SidebarController.cs @@ -78,7 +78,7 @@ public class SidebarController : ControllerBase private SingleInstanceEntity? cameraInternal; private bool isMarketplaceCreditsFeatureEnabled; - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.PERSISTENT; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Persistent; private SingleInstanceEntity? camera => cameraInternal ??= globalWorld.CacheCamera(); @@ -114,11 +114,11 @@ public SidebarController(ViewFactoryMethod viewFactory, this.eventsApiService = eventsApiService; this.helpMenuController = helpMenuController; this.communitiesLiveTracker = communitiesLiveTracker; - isCameraReelFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.CAMERA_REEL); - isFriendsFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.FRIENDS); - isMarketplaceCreditsFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.MARKETPLACE_CREDITS); - isDiscoverFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.DISCOVER); - isNearbyVoiceChatEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.NEARBY_VOICE_CHAT); + isCameraReelFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.CameraReel); + isFriendsFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.Friends); + isMarketplaceCreditsFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.MarketplaceCredits); + isDiscoverFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.Discover); + isNearbyVoiceChatEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.NearbyVoiceChat); chatEventBusSubscription = chatEventBus.Subscribe(OnChatStateChanged); } @@ -416,7 +416,7 @@ private void OnBackpackButtonClicked() private void OnUnreadMessagesButtonClicked() => chatEventBus.RaiseToggleChatEvent(); private void OnEmotesWheelButtonClicked() => OpenPanelAsync(viewInstance!.emotesWheelButton, EmotesWheelController.IssueCommand()).Forget(); private void OnFriendsButtonClicked() => - OpenPanelAsync(viewInstance!.friendsButton, FriendsPanelController.IssueCommand(new FriendsPanelParameter(FriendsPanelController.FriendsPanelTab.FRIENDS))).Forget(); + OpenPanelAsync(viewInstance!.friendsButton, FriendsPanelController.IssueCommand(new FriendsPanelParameter(FriendsPanelController.FriendsPanelTab.Friends))).Forget(); private void OnMarketplaceCreditsButtonClicked() => OpenPanelAsync(viewInstance!.marketplaceCreditsButton, diff --git a/Explorer/Assets/DCL/UI/Sidebar/SidebarSettingsWidgetController.cs b/Explorer/Assets/DCL/UI/Sidebar/SidebarSettingsWidgetController.cs index 1b142bd0506..d6651bb2d2c 100644 --- a/Explorer/Assets/DCL/UI/Sidebar/SidebarSettingsWidgetController.cs +++ b/Explorer/Assets/DCL/UI/Sidebar/SidebarSettingsWidgetController.cs @@ -6,7 +6,7 @@ namespace DCL.UI.Sidebar { public class SidebarSettingsWidgetController : ControllerBase { - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; private UniTaskCompletionSource? closeViewTask; diff --git a/Explorer/Assets/DCL/UI/Skybox/SkyboxMenuController.cs b/Explorer/Assets/DCL/UI/Skybox/SkyboxMenuController.cs index 7437baae10f..29ffca4ef85 100644 --- a/Explorer/Assets/DCL/UI/Skybox/SkyboxMenuController.cs +++ b/Explorer/Assets/DCL/UI/Skybox/SkyboxMenuController.cs @@ -18,7 +18,7 @@ public class SkyboxMenuController : ControllerBase private bool? pendingInteractableState; private bool isRestrictedByScene; - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; public SkyboxMenuController(ViewFactoryMethod viewFactory, SkyboxSettingsAsset skyboxSettings, ISceneRestrictionBusController sceneRestrictionBusController) : base(viewFactory) { @@ -117,9 +117,9 @@ private static string GetFormatedTime(float time) private void OnSceneRestrictionChanged(SceneRestriction restriction) { - if (restriction.Type != SceneRestrictions.SKYBOX_TIME_UI_BLOCKED) return; + if (restriction.Type != SceneRestrictions.SkyboxTimeUiBlocked) return; - isRestrictedByScene = restriction.Action == SceneRestrictionsAction.APPLIED; + isRestrictedByScene = restriction.Action == SceneRestrictionsAction.Applied; SetInteractable(!isRestrictedByScene); } diff --git a/Explorer/Assets/DCL/UI/SmartWearables/SmartWearablesSideBarTooltipController.cs b/Explorer/Assets/DCL/UI/SmartWearables/SmartWearablesSideBarTooltipController.cs index b10664292b2..197fe010f51 100644 --- a/Explorer/Assets/DCL/UI/SmartWearables/SmartWearablesSideBarTooltipController.cs +++ b/Explorer/Assets/DCL/UI/SmartWearables/SmartWearablesSideBarTooltipController.cs @@ -17,7 +17,7 @@ public SmartWearablesSideBarTooltipController(ViewFactoryMethod viewFactory, Sma this.smartWearableCache = smartWearableCache; } - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; protected override async UniTask WaitForCloseIntentAsync(CancellationToken ct) { diff --git a/Explorer/Assets/DCL/UI/TextFormatter/HyperlinkTextFormatter.cs b/Explorer/Assets/DCL/UI/TextFormatter/HyperlinkTextFormatter.cs index 6b739e32855..1be7380602d 100644 --- a/Explorer/Assets/DCL/UI/TextFormatter/HyperlinkTextFormatter.cs +++ b/Explorer/Assets/DCL/UI/TextFormatter/HyperlinkTextFormatter.cs @@ -101,15 +101,15 @@ public void GetMatches(string text, List<(TextFormatMatchType, Match)> matchesRe while (currentMatch.Success) { if (currentMatch.Groups[URL_GROUP_NAME].Success) - matchesResult.Add((TextFormatMatchType.URL, currentMatch)); + matchesResult.Add((TextFormatMatchType.Url, currentMatch)); else if (currentMatch.Groups[SCENE_GROUP_NAME].Success && AreCoordsValid( int.Parse(currentMatch.Groups[X_COORD_GROUP_NAME].Value), int.Parse(currentMatch.Groups[Y_COORD_GROUP_NAME].Value))) - matchesResult.Add((TextFormatMatchType.SCENE, currentMatch)); + matchesResult.Add((TextFormatMatchType.Scene, currentMatch)); else if (currentMatch.Groups[WORLD_GROUP_NAME].Success) - matchesResult.Add((TextFormatMatchType.WORLD, currentMatch)); + matchesResult.Add((TextFormatMatchType.World, currentMatch)); else if (currentMatch.Groups[USERNAME_FULL_GROUP_NAME].Success && IsUserNameValid(currentMatch.Groups[USERNAME_NAME_GROUP_NAME].Value)) - matchesResult.Add((TextFormatMatchType.NAME, currentMatch)); + matchesResult.Add((TextFormatMatchType.Name, currentMatch)); currentMatch = currentMatch.NextMatch(); } diff --git a/Explorer/Assets/DCL/UI/TextFormatter/ITextFormatter.cs b/Explorer/Assets/DCL/UI/TextFormatter/ITextFormatter.cs index 275167bc51b..0b4ed046a40 100644 --- a/Explorer/Assets/DCL/UI/TextFormatter/ITextFormatter.cs +++ b/Explorer/Assets/DCL/UI/TextFormatter/ITextFormatter.cs @@ -13,9 +13,9 @@ public interface ITextFormatter public enum TextFormatMatchType { - URL, - SCENE, - WORLD, - NAME + Url, + Scene, + World, + Name } } diff --git a/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs b/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs index 7ea1443c8be..f7b5aadb6b9 100644 --- a/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs +++ b/Explorer/Assets/DCL/UserInAppInitializationFlow/RealUserInAppInitializationFlow.cs @@ -349,7 +349,7 @@ private UniTask ShowErrorPopupIfRequired(EnumResult result, Cancellat return mvcManager.ShowAsync(ErrorPopupWithRetryController.IssueCommand(new ErrorPopupWithRetryController.Input( title: "Connection Error", description: "We were unable to connect to Decentraland. Please verify your connection and retry.", - iconType: ErrorPopupWithRetryController.IconType.CONNECTION_LOST, + iconType: ErrorPopupWithRetryController.IconType.ConnectionLost, retryText: "Continue")), ct); var message = $"{ToMessage(result)}\nPlease try again"; diff --git a/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityStreamButtonPresenter.cs b/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityStreamButtonPresenter.cs index 17c7abe3f86..ebad1c0f61c 100644 --- a/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityStreamButtonPresenter.cs +++ b/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityStreamButtonPresenter.cs @@ -57,7 +57,7 @@ public void Dispose() private void OnCommunityCallStatusChanged(VoiceChatStatus status) { - if (status is VoiceChatStatus.DISCONNECTED or VoiceChatStatus.VOICE_CHAT_GENERIC_ERROR or VoiceChatStatus.VOICE_CHAT_ENDING_CALL or VoiceChatStatus.VOICE_CHAT_BUSY) + if (status is VoiceChatStatus.Disconnected or VoiceChatStatus.VoiceChatGenericError or VoiceChatStatus.VoiceChatEndingCall or VoiceChatStatus.VoiceChatBusy) OnCurrentChannelChanged(currentChannel.Value); } @@ -76,7 +76,7 @@ private async UniTaskVoid ResetAsync() private void OnCallButtonClicked() { - orchestrator.StartCall(ChatChannel.GetCommunityIdFromChannelId(currentChannel.Value.Id), VoiceChatType.COMMUNITY); + orchestrator.StartCall(ChatChannel.GetCommunityIdFromChannelId(currentChannel.Value.Id), VoiceChatType.Community); } private void OnCurrentCommunityActiveCallStatusChanged(bool hasActiveCall) diff --git a/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatCallStatusService.cs b/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatCallStatusService.cs index 4524b6ecb9b..101ecd99000 100644 --- a/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatCallStatusService.cs +++ b/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatCallStatusService.cs @@ -15,7 +15,7 @@ public class CommunityVoiceChatCallStatusService : ICommunityVoiceChatCallStatus { private const string TAG = nameof(CommunityVoiceChatCallStatusService); - private readonly ReactiveProperty status = new (VoiceChatStatus.DISCONNECTED); + private readonly ReactiveProperty status = new (VoiceChatStatus.Disconnected); private readonly ReactiveProperty callId = new (string.Empty); private readonly ICommunityVoiceService voiceChatService; @@ -49,7 +49,7 @@ public void StartCall(string communityId) cts = cts.SafeRestart(); - UpdateStatus(VoiceChatStatus.VOICE_CHAT_STARTING_CALL); + UpdateStatus(VoiceChatStatus.VoiceChatStartingCall); // Track that WE started this community call locallyStartedCommunityId = communityId; @@ -77,7 +77,7 @@ private async UniTaskVoid StartCallAsync(string communityId, CancellationToken c case StartCommunityVoiceChatResponse.ResponseOneofCase.Ok: connectionUrl = result.Value.Ok.Credentials.ConnectionUrl; SetCallId(communityId); - UpdateStatus(VoiceChatStatus.VOICE_CHAT_IN_CALL); + UpdateStatus(VoiceChatStatus.VoiceChatInCall); // The backend does not echo the CommunityVoiceChatStarted websocket update // back to the originator (mirrored by the asymmetric handling in EndStreamInCurrentCall), @@ -90,11 +90,11 @@ private async UniTaskVoid StartCallAsync(string communityId, CancellationToken c case StartCommunityVoiceChatResponse.ResponseOneofCase.InvalidRequest: case StartCommunityVoiceChatResponse.ResponseOneofCase.ConflictingError: ResetVoiceChatData(); - UpdateStatus(VoiceChatStatus.VOICE_CHAT_BUSY); + UpdateStatus(VoiceChatStatus.VoiceChatBusy); break; default: ResetVoiceChatData(); - UpdateStatus(VoiceChatStatus.VOICE_CHAT_GENERIC_ERROR); + UpdateStatus(VoiceChatStatus.VoiceChatGenericError); break; } } @@ -102,7 +102,7 @@ private async UniTaskVoid StartCallAsync(string communityId, CancellationToken c public void HangUp() { ResetVoiceChatData(); - UpdateStatus(VoiceChatStatus.VOICE_CHAT_ENDING_CALL); + UpdateStatus(VoiceChatStatus.VoiceChatEndingCall); } public async UniTaskVoid JoinCommunityVoiceChatAsync(string communityId, CancellationToken ct) @@ -110,7 +110,7 @@ public async UniTaskVoid JoinCommunityVoiceChatAsync(string communityId, Cancell if (!status.Value.IsNotConnected()) return; - UpdateStatus(VoiceChatStatus.VOICE_CHAT_STARTING_CALL); + UpdateStatus(VoiceChatStatus.VoiceChatStartingCall); Result result = await voiceChatService.JoinCommunityVoiceChatAsync(communityId, ct) .SuppressToResultAsync(ReportCategory.COMMUNITY_VOICE_CHAT); @@ -121,7 +121,7 @@ public async UniTaskVoid JoinCommunityVoiceChatAsync(string communityId, Cancell if (!result.Success) { ResetVoiceChatData(); - UpdateStatus(VoiceChatStatus.VOICE_CHAT_GENERIC_ERROR); + UpdateStatus(VoiceChatStatus.VoiceChatGenericError); return; } @@ -130,19 +130,19 @@ public async UniTaskVoid JoinCommunityVoiceChatAsync(string communityId, Cancell case JoinCommunityVoiceChatResponse.ResponseOneofCase.Ok: connectionUrl = result.Value.Ok.Credentials.ConnectionUrl; SetCallId(communityId); - UpdateStatus(VoiceChatStatus.VOICE_CHAT_IN_CALL); + UpdateStatus(VoiceChatStatus.VoiceChatInCall); break; default: ReportHub.Log(ReportCategory.COMMUNITY_VOICE_CHAT, $"{TAG} Error when connecting to call {result.Value}"); ResetVoiceChatData(); - UpdateStatus(VoiceChatStatus.VOICE_CHAT_GENERIC_ERROR); + UpdateStatus(VoiceChatStatus.VoiceChatGenericError); break; } } public void RequestToSpeakInCurrentCall() { - if (status.Value is not VoiceChatStatus.VOICE_CHAT_IN_CALL || string.IsNullOrEmpty(callId.Value)) return; + if (status.Value is not VoiceChatStatus.VoiceChatInCall || string.IsNullOrEmpty(callId.Value)) return; cts = cts.SafeRestart(); RequestToSpeakAsync(callId.Value, cts.Token).Forget(); @@ -163,7 +163,7 @@ async UniTaskVoid RequestToSpeakAsync(string communityId, CancellationToken ct) public void LowerHandInCurrentCall() { - if (status.Value is not VoiceChatStatus.VOICE_CHAT_IN_CALL || string.IsNullOrEmpty(callId.Value)) return; + if (status.Value is not VoiceChatStatus.VoiceChatInCall || string.IsNullOrEmpty(callId.Value)) return; cts = cts.SafeRestart(); LowerHandAsync(callId.Value, cts.Token).Forget(); @@ -185,7 +185,7 @@ async UniTaskVoid LowerHandAsync(string communityId, CancellationToken ct) public void PromoteToSpeakerInCurrentCall(string walletId) { if (string.IsNullOrEmpty(callId.Value)) return; - if (status.Value is not VoiceChatStatus.VOICE_CHAT_IN_CALL) return; + if (status.Value is not VoiceChatStatus.VoiceChatInCall) return; cts = cts.SafeRestart(); PromoteToSpeakerAsync(callId.Value).Forget(); @@ -207,7 +207,7 @@ async UniTaskVoid PromoteToSpeakerAsync(string communityId) public void DenySpeakerInCurrentCall(string walletId) { if (string.IsNullOrEmpty(callId.Value)) return; - if (status.Value is not VoiceChatStatus.VOICE_CHAT_IN_CALL) return; + if (status.Value is not VoiceChatStatus.VoiceChatInCall) return; cts = cts.SafeRestart(); DenySpeakerAsync(callId.Value, cts.Token).Forget(); @@ -236,7 +236,7 @@ async UniTaskVoid DenySpeakerAsync(string communityId, CancellationToken ct) public void DemoteFromSpeakerInCurrentCall(string walletId) { if (string.IsNullOrEmpty(callId.Value)) return; - if (status.Value is not VoiceChatStatus.VOICE_CHAT_IN_CALL) return; + if (status.Value is not VoiceChatStatus.VoiceChatInCall) return; cts = cts.SafeRestart(); DemoteFromSpeakerAsync(callId.Value, cts.Token).Forget(); @@ -258,7 +258,7 @@ async UniTaskVoid DemoteFromSpeakerAsync(string communityId, CancellationToken c public void KickPlayerFromCurrentCall(string walletId) { if (string.IsNullOrEmpty(callId.Value)) return; - if (status.Value is not VoiceChatStatus.VOICE_CHAT_IN_CALL) return; + if (status.Value is not VoiceChatStatus.VoiceChatInCall) return; cts = cts.SafeRestart(); KickPlayerAsync(callId.Value, cts.Token).Forget(); @@ -280,7 +280,7 @@ async UniTaskVoid KickPlayerAsync(string communityId, CancellationToken ct) public void MuteSpeakerInCurrentCall(string walletId, bool muted) { if (string.IsNullOrEmpty(callId.Value)) return; - if (status.Value is not VoiceChatStatus.VOICE_CHAT_IN_CALL) return; + if (status.Value is not VoiceChatStatus.VoiceChatInCall) return; cts = cts.SafeRestart(); MuteSpeakerAsync(callId.Value, cts.Token).Forget(); @@ -305,7 +305,7 @@ async UniTaskVoid MuteSpeakerAsync(string communityId, CancellationToken ct) public void EndStreamInCurrentCall() { if (string.IsNullOrEmpty(callId.Value)) return; - if (status.Value is not VoiceChatStatus.VOICE_CHAT_IN_CALL) return; + if (status.Value is not VoiceChatStatus.VoiceChatInCall) return; cts = cts.SafeRestart(); EndStreamAsync(callId.Value, cts.Token).Forget(); @@ -344,15 +344,15 @@ async UniTaskVoid EndStreamAsync(string communityId, CancellationToken ct) public void HandleLivekitConnectionFailed() { ResetVoiceChatData(); - UpdateStatus(VoiceChatStatus.VOICE_CHAT_GENERIC_ERROR); + UpdateStatus(VoiceChatStatus.VoiceChatGenericError); } public void HandleLivekitConnectionEnded() { - if (status.Value == VoiceChatStatus.DISCONNECTED) return; + if (status.Value == VoiceChatStatus.Disconnected) return; ResetVoiceChatData(); - UpdateStatus(VoiceChatStatus.DISCONNECTED); + UpdateStatus(VoiceChatStatus.Disconnected); } public void UpdateStatus(VoiceChatStatus newStatus) diff --git a/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatCallStatusServiceNull.cs b/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatCallStatusServiceNull.cs index ef8de0b2704..0999632bd72 100644 --- a/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatCallStatusServiceNull.cs +++ b/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatCallStatusServiceNull.cs @@ -7,7 +7,7 @@ namespace DCL.VoiceChat { public class CommunityVoiceChatCallStatusServiceNull : ICommunityVoiceChatCallStatusService { - public IReadonlyReactiveProperty Status { get; } = new ReactiveProperty(VoiceChatStatus.DISCONNECTED); + public IReadonlyReactiveProperty Status { get; } = new ReactiveProperty(VoiceChatStatus.Disconnected); public IReadonlyReactiveProperty CallId { get; } = new ReactiveProperty(string.Empty); public string ConnectionUrl { get; } = string.Empty; diff --git a/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatInCallButtonsPresenter.cs b/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatInCallButtonsPresenter.cs index 82d4611d877..459de9504c5 100644 --- a/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatInCallButtonsPresenter.cs +++ b/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatInCallButtonsPresenter.cs @@ -62,7 +62,7 @@ private void OnMicrophoneStateChanged(bool isEnabled) private void OnCommunityCallStateChanged(VoiceChatStatus callStatus) { - if (callStatus != VoiceChatStatus.VOICE_CHAT_IN_CALL) return; + if (callStatus != VoiceChatStatus.VoiceChatInCall) return; bool isSpeaker = orchestrator.ParticipantsStateService.LocalParticipantState.IsSpeaker.Value; OnIsSpeakerChanged(isSpeaker); diff --git a/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatInCallPresenter.cs b/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatInCallPresenter.cs index 5ff1950bf6e..053d5c5bf1d 100644 --- a/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatInCallPresenter.cs +++ b/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatInCallPresenter.cs @@ -61,7 +61,7 @@ private void OnPanelStateChanged(VoiceChatPanelState state) private void OnPanelSizeChanged(VoiceChatPanelSize panelSize) { - bool isPanelCollapsed = panelSize == VoiceChatPanelSize.COLLAPSED; + bool isPanelCollapsed = panelSize == VoiceChatPanelSize.Collapsed; view.SetCollapsedState(isPanelCollapsed); SetInCallElementsVisibility(voiceChatOrchestrator.CurrentVoiceChatPanelState.Value, panelSize); @@ -69,7 +69,7 @@ private void OnPanelSizeChanged(VoiceChatPanelSize panelSize) private void SetInCallElementsVisibility(VoiceChatPanelState panelState, VoiceChatPanelSize panelSize) { - view.SetButtonsVisibility(panelState is not VoiceChatPanelState.UNFOCUSED, panelSize); + view.SetButtonsVisibility(panelState is not VoiceChatPanelState.Unfocused, panelSize); view.SetScrollAndMasksVisibility(speakersCount > MAX_VISIBLE_SPEAKERS); } @@ -138,8 +138,8 @@ public void SetTalkingStatus(int speakingCount, string username) private void OnToggleCollapseButtonClicked() { - bool isPanelCollapsed = currentVoiceChatPanelSize.Value == VoiceChatPanelSize.COLLAPSED; - voiceChatOrchestrator.ChangePanelSize(isPanelCollapsed ? VoiceChatPanelSize.EXPANDED : VoiceChatPanelSize.COLLAPSED); + bool isPanelCollapsed = currentVoiceChatPanelSize.Value == VoiceChatPanelSize.Collapsed; + voiceChatOrchestrator.ChangePanelSize(isPanelCollapsed ? VoiceChatPanelSize.Expanded : VoiceChatPanelSize.Collapsed); } } } diff --git a/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatInCallView.cs b/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatInCallView.cs index 349d8ff6da8..56b5d667704 100644 --- a/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatInCallView.cs +++ b/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatInCallView.cs @@ -129,7 +129,7 @@ async UniTask ShowDeleteInvitationConfirmationDialogAsync(CancellationToken ct) false, false), ct) .SuppressToResultAsync(ReportCategory.COMMUNITIES); - if (ct.IsCancellationRequested || !dialogResult.Success || dialogResult.Value == ConfirmationResult.CANCEL) return; + if (ct.IsCancellationRequested || !dialogResult.Success || dialogResult.Value == ConfirmationResult.Cancel) return; EndStreamButtonCLicked?.Invoke(); } @@ -184,8 +184,8 @@ public void SetCollapsedState(bool isCollapsed) public void SetButtonsVisibility(bool isVisible, VoiceChatPanelSize size) { - bool showExpanded = isVisible && size is VoiceChatPanelSize.EXPANDED; - bool showCollapsed = isVisible && size is VoiceChatPanelSize.COLLAPSED; + bool showExpanded = isVisible && size is VoiceChatPanelSize.Expanded; + bool showCollapsed = isVisible && size is VoiceChatPanelSize.Collapsed; FooterPanel.SetActive(showExpanded); ExpandedPanelRightLayoutContainer.SetActive(showExpanded); diff --git a/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatPresenter.cs b/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatPresenter.cs index 1e8068e7f43..49bb4190f83 100644 --- a/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatPresenter.cs +++ b/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatPresenter.cs @@ -94,8 +94,8 @@ private void OnCommunityCallStatusUpdate(VoiceChatStatus status) { switch (status) { - case VoiceChatStatus.DISCONNECTED: - case VoiceChatStatus.VOICE_CHAT_GENERIC_ERROR: + case VoiceChatStatus.Disconnected: + case VoiceChatStatus.VoiceChatGenericError: ClearPool(); break; } @@ -137,7 +137,7 @@ private void DenySpeaker(string walletId) private void OnConnectionEstablished() { - if (voiceChatOrchestrator.CurrentVoiceChatType.Value == VoiceChatType.COMMUNITY) + if (voiceChatOrchestrator.CurrentVoiceChatType.Value == VoiceChatType.Community) { view.SetConnectedPanel(true); bool isModeratorOrOwner = VoiceChatRoleHelper.IsModeratorOrOwner(voiceChatOrchestrator.ParticipantsStateService.LocalParticipantState.Role.Value); @@ -155,7 +155,7 @@ private void CloseListenersSection() private void OpenListenersSection() { - voiceChatOrchestrator.ChangePanelSize(VoiceChatPanelSize.EXPANDED); + voiceChatOrchestrator.ChangePanelSize(VoiceChatPanelSize.Expanded); view.CommunityVoiceChatSearchView.gameObject.SetActive(true); view.CommunityVoiceChatInCallView.gameObject.SetActive(false); @@ -163,7 +163,7 @@ private void OpenListenersSection() private void OnParticipantLeft(string participantId) { - if (voiceChatOrchestrator.CurrentVoiceChatType.Value != VoiceChatType.COMMUNITY) return; + if (voiceChatOrchestrator.CurrentVoiceChatType.Value != VoiceChatType.Community) return; RemoveParticipant(participantId); @@ -172,7 +172,7 @@ private void OnParticipantLeft(string participantId) private void OnParticipantJoined(string participantId, VoiceChatParticipantState participantState) { - if (voiceChatOrchestrator.CurrentVoiceChatType.Value != VoiceChatType.COMMUNITY) return; + if (voiceChatOrchestrator.CurrentVoiceChatType.Value != VoiceChatType.Community) return; if (participantState.IsSpeaker) AddSpeaker(participantState); @@ -184,7 +184,7 @@ private void OnParticipantJoined(string participantId, VoiceChatParticipantState private void OnParticipantStateRefreshed(List<(string participantId, VoiceChatParticipantState state)> joinedParticipants, List leftParticipantIds) { - if (voiceChatOrchestrator.CurrentVoiceChatType.Value != VoiceChatType.COMMUNITY) return; + if (voiceChatOrchestrator.CurrentVoiceChatType.Value != VoiceChatType.Community) return; if (!usedPlayerEntriesPresenters.ContainsKey(voiceChatOrchestrator.ParticipantsStateService.LocalParticipantState.WalletId)) { @@ -224,12 +224,12 @@ private void OnVoiceChatTypeChanged(VoiceChatType voiceChatType) { switch (voiceChatType) { - case VoiceChatType.COMMUNITY: - voiceChatOrchestrator.ChangePanelSize(VoiceChatPanelSize.EXPANDED); + case VoiceChatType.Community: + voiceChatOrchestrator.ChangePanelSize(VoiceChatPanelSize.Expanded); view.Show(); break; - case VoiceChatType.PRIVATE: - case VoiceChatType.NONE: + case VoiceChatType.Private: + case VoiceChatType.None: default: contextMenuTask.TrySetResult(); popupCts.SafeCancelAndDispose(); @@ -306,7 +306,7 @@ private void OnContextMenuButtonClicked(VoiceChatParticipantState participant, V default(Vector2), popupCts.Token, contextMenuTask.Task, - anchorPoint: MenuAnchorPoint.BOTTOM_RIGHT).Forget(); + anchorPoint: MenuAnchorPoint.BottomRight).Forget(); } private void OnUserIsRequestingToSpeak(string playerName) diff --git a/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatSubTitleButtonPresenter.cs b/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatSubTitleButtonPresenter.cs index 02ebf8e87af..b8870d565ab 100644 --- a/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatSubTitleButtonPresenter.cs +++ b/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/CommunityVoiceChatSubTitleButtonPresenter.cs @@ -38,7 +38,7 @@ public CommunityVoiceChatSubTitleButtonPresenter( this.currentChannel = currentChannel; this.communityDataProvider = communityDataProvider; - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.VOICE_CHAT)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.VoiceChat)) { currentChannelSubscription = currentChannel.Subscribe(OnCurrentChannelChanged); statusSubscription = communityCallOrchestrator.CommunityCallStatus.Subscribe(OnCommunityCallStatusChanged); @@ -147,12 +147,12 @@ private void OnCommunityCallStatusChanged(VoiceChatStatus status) switch (status) { // If we just ended a call, we need to re-check the call status, etc., in case we need to show the button - case VoiceChatStatus.DISCONNECTED or VoiceChatStatus.VOICE_CHAT_GENERIC_ERROR or VoiceChatStatus.VOICE_CHAT_ENDING_CALL: + case VoiceChatStatus.Disconnected or VoiceChatStatus.VoiceChatGenericError or VoiceChatStatus.VoiceChatEndingCall: OnCurrentChannelChanged(currentChannel.Value); break; // When we join a call, if it is for THIS community, we need to hide the button. If it's another community's call, we keep it. - case VoiceChatStatus.VOICE_CHAT_STARTING_CALL or VoiceChatStatus.VOICE_CHAT_IN_CALL when + case VoiceChatStatus.VoiceChatStartingCall or VoiceChatStatus.VoiceChatInCall when communityCallOrchestrator.IsEqualToCurrentStreamingCommunity(ChatChannel.GetCommunityIdFromChannelId(currentChannel.Value.Id)): view.gameObject.SetActive(false); break; diff --git a/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/SceneVoiceChatPresenter.cs b/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/SceneVoiceChatPresenter.cs index ab7c48ad98e..c500b439040 100644 --- a/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/SceneVoiceChatPresenter.cs +++ b/Explorer/Assets/DCL/VoiceChat/CommunityVoiceChat/SceneVoiceChatPresenter.cs @@ -34,7 +34,7 @@ private void OnJoinStreamClicked() private void OnCallStatusChanged(VoiceChatStatus status) { - if (status is not (VoiceChatStatus.DISCONNECTED or VoiceChatStatus.VOICE_CHAT_GENERIC_ERROR or VoiceChatStatus.VOICE_CHAT_ENDING_CALL)) + if (status is not (VoiceChatStatus.Disconnected or VoiceChatStatus.VoiceChatGenericError or VoiceChatStatus.VoiceChatEndingCall)) { view.VoiceChatContainer.gameObject.SetActive(false); return; @@ -55,7 +55,7 @@ private void OnCallStatusChanged(VoiceChatStatus status) private void OnActiveCommunityChanged(ActiveCommunityVoiceChat? activeCommunityVoiceChat) { - if (voiceChatOrchestrator.CurrentCallStatus.Value is not (VoiceChatStatus.DISCONNECTED or VoiceChatStatus.VOICE_CHAT_GENERIC_ERROR or VoiceChatStatus.VOICE_CHAT_ENDING_CALL)) + if (voiceChatOrchestrator.CurrentCallStatus.Value is not (VoiceChatStatus.Disconnected or VoiceChatStatus.VoiceChatGenericError or VoiceChatStatus.VoiceChatEndingCall)) { view.VoiceChatContainer.gameObject.SetActive(false); return; diff --git a/Explorer/Assets/DCL/VoiceChat/Core/IVoiceChatOrchestrator.cs b/Explorer/Assets/DCL/VoiceChat/Core/IVoiceChatOrchestrator.cs index f169aeb872b..fa72b6d0775 100644 --- a/Explorer/Assets/DCL/VoiceChat/Core/IVoiceChatOrchestrator.cs +++ b/Explorer/Assets/DCL/VoiceChat/Core/IVoiceChatOrchestrator.cs @@ -5,25 +5,25 @@ namespace DCL.VoiceChat { public enum VoiceChatType { - NONE, - PRIVATE, - COMMUNITY, - NEARBY, + None, + Private, + Community, + Nearby, } public enum VoiceChatPanelSize { - COLLAPSED, - EXPANDED, + Collapsed, + Expanded, } public enum VoiceChatPanelState { - SELECTED, //When the user clicked on the panel - FOCUSED, //When the user hovers over the panel/chat or clicks on the chat - UNFOCUSED, //When the user deselects the panel AND unhovers from the panel/chat - HIDDEN, - NONE, + Selected, //When the user clicked on the panel + Focused, //When the user hovers over the panel/chat or clicks on the chat + Unfocused, //When the user deselects the panel AND unhovers from the panel/chat + Hidden, + None, } /// diff --git a/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatCallTypeValidator.cs b/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatCallTypeValidator.cs index 4f59f5e36b6..211fbef5ed1 100644 --- a/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatCallTypeValidator.cs +++ b/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatCallTypeValidator.cs @@ -9,7 +9,7 @@ internal static class VoiceChatCallTypeValidator public static bool IsNoActiveCall(VoiceChatType currentType, [CallerMemberName] string? callerName = null) { - if (currentType != VoiceChatType.NONE) + if (currentType != VoiceChatType.None) { ReportHub.Log(ReportCategory.VOICE_CHAT, $"{TAG} Cannot {callerName} when already in a call"); return false; @@ -19,7 +19,7 @@ public static bool IsNoActiveCall(VoiceChatType currentType, [CallerMemberName] public static bool IsPrivateCall(VoiceChatType currentType, [CallerMemberName] string? callerName = null) { - if (currentType != VoiceChatType.PRIVATE) + if (currentType != VoiceChatType.Private) { ReportHub.Log(ReportCategory.VOICE_CHAT, $"{TAG} Cannot {callerName} when not in PRIVATE call"); return false; @@ -29,7 +29,7 @@ public static bool IsPrivateCall(VoiceChatType currentType, [CallerMemberName] s public static bool IsCommunityCall(VoiceChatType currentType, [CallerMemberName] string? callerName = null) { - if (currentType != VoiceChatType.COMMUNITY) + if (currentType != VoiceChatType.Community) { ReportHub.Log(ReportCategory.VOICE_CHAT, $"{TAG} Cannot {callerName} when not in COMMUNITY call"); return false; diff --git a/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatOrchestrator.cs b/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatOrchestrator.cs index 05376958e70..bfab2acfdb3 100644 --- a/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatOrchestrator.cs +++ b/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatOrchestrator.cs @@ -33,10 +33,10 @@ public class VoiceChatOrchestrator : IDisposable, IVoiceChatOrchestrator private UniTaskCompletionSource? channelChangedSource; private ChatChannel.ChannelId? pendingChannelTarget; - private readonly ReactiveProperty currentVoiceChatType = new (VoiceChatType.NONE); - private readonly ReactiveProperty currentCallStatus = new (VoiceChatStatus.DISCONNECTED); - private readonly ReactiveProperty currentVoiceChatPanelSize = new (VoiceChatPanelSize.COLLAPSED); - private readonly ReactiveProperty currentVoiceChatPanelState = new (VoiceChatPanelState.NONE); + private readonly ReactiveProperty currentVoiceChatType = new (VoiceChatType.None); + private readonly ReactiveProperty currentCallStatus = new (VoiceChatStatus.Disconnected); + private readonly ReactiveProperty currentVoiceChatPanelSize = new (VoiceChatPanelSize.Collapsed); + private readonly ReactiveProperty currentVoiceChatPanelState = new (VoiceChatPanelState.None); private readonly ReactiveProperty currentSceneActiveCommunityData = new (null); private IVoiceChatCallStatusServiceBase? activeCallStatusService; @@ -72,7 +72,7 @@ public VoiceChatOrchestrator( this.currentChannelService = currentChannelService; ParticipantsStateService = participantsStateService; - if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.VOICE_CHAT)) return; + if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.VoiceChat)) return; NotificationsBusController.Instance.SubscribeToNotificationTypeClick(NotificationType.COMMUNITY_VOICE_CHAT_STARTED, OnClickedNotification); @@ -133,7 +133,7 @@ public void StartCall(string callId, VoiceChatType callType) SetActiveCallService(callType); activeCallStatusService?.StartCall(callId); } - else if (callType == VoiceChatType.COMMUNITY) + else if (callType == VoiceChatType.Community) { HangUpAndStartCallAsync().Forget(); } @@ -175,7 +175,7 @@ private async UniTaskVoid StartCallWithUserIdAsync(string userId, CancellationTo if (currentChannelService.CurrentChannelId.Equals(targetChannelId)) { chatEventBus.RaiseOpenPrivateConversationRequestedEvent(userId); - StartCall(userId, VoiceChatType.PRIVATE); + StartCall(userId, VoiceChatType.Private); return; } @@ -195,7 +195,7 @@ private async UniTaskVoid StartCallWithUserIdAsync(string userId, CancellationTo UniTask.Delay(TimeSpan.FromSeconds(2), cancellationToken: ct)); if (winningTaskIndex == 0) - StartCall(userId, VoiceChatType.PRIVATE); + StartCall(userId, VoiceChatType.Private); } finally { @@ -239,30 +239,30 @@ public void HandleConnectionError() private void OnPrivateVoiceChatUpdateReceived(PrivateVoiceChatUpdate update) { - if (currentVoiceChatType.Value != VoiceChatType.COMMUNITY) + if (currentVoiceChatType.Value != VoiceChatType.Community) { privateVoiceChatCallStatusService.OnPrivateVoiceChatUpdateReceived(update); if (update.Status is not (PrivateVoiceChatStatus.VoiceChatEnded or PrivateVoiceChatStatus.VoiceChatExpired or PrivateVoiceChatStatus.VoiceChatRejected)) - SetActiveCallService(VoiceChatType.PRIVATE); + SetActiveCallService(VoiceChatType.Private); } } private void OnPrivateVoiceChatStatusChanged(VoiceChatStatus status) { // Update call status if we're already in a private call - if (currentVoiceChatType.Value == VoiceChatType.PRIVATE) { currentCallStatus.Value = status; } + if (currentVoiceChatType.Value == VoiceChatType.Private) { currentCallStatus.Value = status; } // Handle transitions to/from private call if (status.IsNotConnected()) { - if (currentVoiceChatType.Value == VoiceChatType.PRIVATE) SetActiveCallService(VoiceChatType.NONE); + if (currentVoiceChatType.Value == VoiceChatType.Private) SetActiveCallService(VoiceChatType.None); } - else if (status is VoiceChatStatus.VOICE_CHAT_STARTING_CALL - or VoiceChatStatus.VOICE_CHAT_RECEIVED_CALL - or VoiceChatStatus.VOICE_CHAT_STARTED_CALL - or VoiceChatStatus.VOICE_CHAT_IN_CALL) + else if (status is VoiceChatStatus.VoiceChatStartingCall + or VoiceChatStatus.VoiceChatReceivedCall + or VoiceChatStatus.VoiceChatStartedCall + or VoiceChatStatus.VoiceChatInCall) { - SetActiveCallService(VoiceChatType.PRIVATE); + SetActiveCallService(VoiceChatType.Private); currentCallStatus.Value = status; } @@ -283,19 +283,19 @@ private void OnActiveVoiceChatStoppedInScene() private void OnCommunityVoiceChatStatusChanged(VoiceChatStatus status) { // Update call status if we're already in a community call - if (currentVoiceChatType.Value == VoiceChatType.COMMUNITY) { currentCallStatus.Value = status; } + if (currentVoiceChatType.Value == VoiceChatType.Community) { currentCallStatus.Value = status; } // Handle transitions to/from community call if (status.IsNotConnected()) { - if (currentVoiceChatType.Value == VoiceChatType.COMMUNITY) SetActiveCallService(VoiceChatType.NONE); + if (currentVoiceChatType.Value == VoiceChatType.Community) SetActiveCallService(VoiceChatType.None); } - else if (status is VoiceChatStatus.VOICE_CHAT_STARTING_CALL - or VoiceChatStatus.VOICE_CHAT_RECEIVED_CALL - or VoiceChatStatus.VOICE_CHAT_STARTED_CALL - or VoiceChatStatus.VOICE_CHAT_IN_CALL) + else if (status is VoiceChatStatus.VoiceChatStartingCall + or VoiceChatStatus.VoiceChatReceivedCall + or VoiceChatStatus.VoiceChatStartedCall + or VoiceChatStatus.VoiceChatInCall) { - SetActiveCallService(VoiceChatType.COMMUNITY); + SetActiveCallService(VoiceChatType.Community); currentCallStatus.Value = status; } @@ -308,16 +308,16 @@ private void SetActiveCallService(VoiceChatType newType) switch (newType) { - case VoiceChatType.NONE: + case VoiceChatType.None: activeCallStatusService = null; - ChangePanelState(VoiceChatPanelState.NONE); + ChangePanelState(VoiceChatPanelState.None); break; - case VoiceChatType.PRIVATE: - ChangePanelState(VoiceChatPanelState.SELECTED, force: true); + case VoiceChatType.Private: + ChangePanelState(VoiceChatPanelState.Selected, force: true); activeCallStatusService = privateVoiceChatCallStatusService; break; - case VoiceChatType.COMMUNITY: - ChangePanelState(VoiceChatPanelState.SELECTED, force: true); + case VoiceChatType.Community: + ChangePanelState(VoiceChatPanelState.Selected, force: true); activeCallStatusService = communityVoiceChatCallStatusService; break; } @@ -330,7 +330,7 @@ public void ChangePanelSize(VoiceChatPanelSize panelSize) public void ChangePanelState(VoiceChatPanelState panelState, bool force = false) { - if (force || currentVoiceChatPanelState.Value != VoiceChatPanelState.HIDDEN) + if (force || currentVoiceChatPanelState.Value != VoiceChatPanelState.Hidden) currentVoiceChatPanelState.Value = panelState; } @@ -413,7 +413,7 @@ public IReadonlyReactiveProperty CommunityConnectionUpdates(string communi communityVoiceChatCallStatusService.CommunityConnectionUpdates(communityId); public bool IsEqualToCurrentStreamingCommunity(string communityId) => - CommunityCallStatus.Value == VoiceChatStatus.VOICE_CHAT_IN_CALL && + CommunityCallStatus.Value == VoiceChatStatus.VoiceChatInCall && string.Equals(communityVoiceChatCallStatusService.CallId.Value, communityId, StringComparison.InvariantCultureIgnoreCase); } } diff --git a/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatParticipantState.cs b/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatParticipantState.cs index 188ea3fc2ee..8b02d03651b 100644 --- a/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatParticipantState.cs +++ b/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatParticipantState.cs @@ -35,17 +35,17 @@ public static VoiceChatParticipantState CreateDefault(string walletId) => new ReactiveProperty(false), new ReactiveProperty(false), new ReactiveProperty(false), - new ReactiveProperty(VoiceChatParticipantCommunityRole.NONE), + new ReactiveProperty(VoiceChatParticipantCommunityRole.None), new ReactiveProperty(false) ); } public enum VoiceChatParticipantCommunityRole { - NONE, - USER, - MODERATOR, - OWNER, + None, + User, + Moderator, + Owner, } } diff --git a/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatParticipantsStateService.cs b/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatParticipantsStateService.cs index 9a980583abb..8b946d756be 100644 --- a/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatParticipantsStateService.cs +++ b/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatParticipantsStateService.cs @@ -483,7 +483,7 @@ private void ResetLocalParticipantState() LocalParticipantState.IsRequestingToSpeak.Value = false; LocalParticipantState.IsSpeaker.Value = false; LocalParticipantState.IsMuted.Value = false; - LocalParticipantState.Role.Value = VoiceChatParticipantCommunityRole.NONE; + LocalParticipantState.Role.Value = VoiceChatParticipantCommunityRole.None; ReportHub.Log(ReportCategory.VOICE_CHAT, $"{TAG} Reset local participant state to defaults"); } @@ -504,14 +504,14 @@ public struct ParticipantCallMetadata private static VoiceChatParticipantCommunityRole ParseRole(string? roleString) { if (string.IsNullOrEmpty(roleString)) - return VoiceChatParticipantCommunityRole.NONE; + return VoiceChatParticipantCommunityRole.None; return roleString.ToLowerInvariant() switch { - "user" => VoiceChatParticipantCommunityRole.USER, - "moderator" => VoiceChatParticipantCommunityRole.MODERATOR, - "owner" => VoiceChatParticipantCommunityRole.OWNER, - _ => VoiceChatParticipantCommunityRole.NONE, + "user" => VoiceChatParticipantCommunityRole.User, + "moderator" => VoiceChatParticipantCommunityRole.Moderator, + "owner" => VoiceChatParticipantCommunityRole.Owner, + _ => VoiceChatParticipantCommunityRole.None, }; } diff --git a/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatRoleHelper.cs b/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatRoleHelper.cs index d294f5992d9..ca78104741d 100644 --- a/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatRoleHelper.cs +++ b/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatRoleHelper.cs @@ -6,6 +6,6 @@ namespace DCL.VoiceChat public static class VoiceChatRoleHelper { public static bool IsModeratorOrOwner(VoiceChatParticipantCommunityRole role) => - role is VoiceChatParticipantCommunityRole.MODERATOR or VoiceChatParticipantCommunityRole.OWNER; + role is VoiceChatParticipantCommunityRole.Moderator or VoiceChatParticipantCommunityRole.Owner; } } diff --git a/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatRoomManager.cs b/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatRoomManager.cs index 336d9d98b62..066e5eda7e0 100644 --- a/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatRoomManager.cs +++ b/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatRoomManager.cs @@ -125,15 +125,15 @@ private void OnCallStatusChanged(VoiceChatStatus newStatus) switch (newStatus) { - case VoiceChatStatus.VOICE_CHAT_ENDING_CALL: + case VoiceChatStatus.VoiceChatEndingCall: isClientInitiatedDisconnection = true; DisconnectFromRoomAsync().Forget(); break; - case VoiceChatStatus.DISCONNECTED: - case VoiceChatStatus.VOICE_CHAT_GENERIC_ERROR: + case VoiceChatStatus.Disconnected: + case VoiceChatStatus.VoiceChatGenericError: //We ignore these states as they are final states. If we reach these we should be already disconnected from the room altogether. break; - case VoiceChatStatus.VOICE_CHAT_IN_CALL: + case VoiceChatStatus.VoiceChatInCall: ConnectToRoomAsync().Forget(); break; } @@ -143,7 +143,7 @@ private void OnCallStatusChanged(VoiceChatStatus newStatus) private void OnLocalParticipantIsSpeakerUpdated(bool isSpeaker) { - if (isSpeaker && voiceChatOrchestrator.CurrentCallStatus.Value == VoiceChatStatus.VOICE_CHAT_IN_CALL && roomHub.VoiceChatRoom().Activated) + if (isSpeaker && voiceChatOrchestrator.CurrentCallStatus.Value == VoiceChatStatus.VoiceChatInCall && roomHub.VoiceChatRoom().Activated) { voiceChatMicrophoneStateManager.OnRoomConnectionChangedMuted(true); microphonePublisher.PublishAsync(micAutoStart: voiceChatMicrophoneHandler.IsMicrophoneEnabled.Value, CancellationToken.None).Forget(); @@ -235,7 +235,7 @@ async UniTaskVoid OnConnectionUpdatedInternalAsync() ReportHub.Log(ReportCategory.VOICE_CHAT, $"{TAG} Reconnected successfully"); bool canSpeak = voiceChatOrchestrator.ParticipantsStateService.LocalParticipantState.IsSpeaker.Value || - voiceChatOrchestrator.CurrentVoiceChatType.Value == VoiceChatType.PRIVATE; + voiceChatOrchestrator.CurrentVoiceChatType.Value == VoiceChatType.Private; if (canSpeak) voiceChatMicrophoneStateManager.OnRoomConnectionChanged(true); break; @@ -281,7 +281,7 @@ private void OnConnectionEstablished() // If it's a community chat but local participant is not a speaker, we don't publish the track. bool canSpeak = voiceChatOrchestrator.ParticipantsStateService.LocalParticipantState.IsSpeaker.Value || - voiceChatOrchestrator.CurrentVoiceChatType.Value == VoiceChatType.PRIVATE; + voiceChatOrchestrator.CurrentVoiceChatType.Value == VoiceChatType.Private; if (canSpeak) { diff --git a/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatStatus.cs b/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatStatus.cs index d44c36da844..db7bfe04076 100644 --- a/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatStatus.cs +++ b/Explorer/Assets/DCL/VoiceChat/Core/VoiceChatStatus.cs @@ -3,42 +3,42 @@ namespace DCL.VoiceChat public enum VoiceChatStatus { //Default status when no voice chat is started - DISCONNECTED, + Disconnected, //Remote state when backend detects an incoming call - VOICE_CHAT_RECEIVED_CALL, + VoiceChatReceivedCall, //Local state when user starts a call - VOICE_CHAT_STARTING_CALL, + VoiceChatStartingCall, //Remote state when backend confirms a voice chat started - VOICE_CHAT_STARTED_CALL, + VoiceChatStartedCall, //Remote state when backend confirms a voice chat is in progress - VOICE_CHAT_IN_CALL, + VoiceChatInCall, //Local state when user ends a call - VOICE_CHAT_ENDING_CALL, + VoiceChatEndingCall, //Local state when user rejects a call - VOICE_CHAT_REJECTING_CALL, + VoiceChatRejectingCall, //Remote status when user is busy - VOICE_CHAT_BUSY, + VoiceChatBusy, //Generic error for unhandled exceptions - VOICE_CHAT_GENERIC_ERROR, + VoiceChatGenericError, } public static class VoiceChatStatusExtensionMethods { public static bool IsNotConnected(this VoiceChatStatus status) => status is - VoiceChatStatus.DISCONNECTED or - VoiceChatStatus.VOICE_CHAT_BUSY or - VoiceChatStatus.VOICE_CHAT_GENERIC_ERROR; + VoiceChatStatus.Disconnected or + VoiceChatStatus.VoiceChatBusy or + VoiceChatStatus.VoiceChatGenericError; public static bool IsInCall(this VoiceChatStatus status) => - status is VoiceChatStatus.VOICE_CHAT_IN_CALL; + status is VoiceChatStatus.VoiceChatInCall; } } diff --git a/Explorer/Assets/DCL/VoiceChat/Microphone/VoiceChatMicrophoneHandler.cs b/Explorer/Assets/DCL/VoiceChat/Microphone/VoiceChatMicrophoneHandler.cs index 9228d183ae5..8d160f8dbbe 100644 --- a/Explorer/Assets/DCL/VoiceChat/Microphone/VoiceChatMicrophoneHandler.cs +++ b/Explorer/Assets/DCL/VoiceChat/Microphone/VoiceChatMicrophoneHandler.cs @@ -144,7 +144,7 @@ public void DisableMicrophoneForCall() private void NotifyMicrophoneStateChange(bool isEnabled) { if (orchestrator != null && - orchestrator.CommunityCallStatus.Value == VoiceChatStatus.VOICE_CHAT_IN_CALL && + orchestrator.CommunityCallStatus.Value == VoiceChatStatus.VoiceChatInCall && orchestrator.ParticipantsStateService.LocalParticipantState.IsSpeaker.Value) { string localParticipantId = orchestrator.ParticipantsStateService.LocalParticipantId; diff --git a/Explorer/Assets/DCL/VoiceChat/Microphone/VoiceChatMicrophoneStateManager.cs b/Explorer/Assets/DCL/VoiceChat/Microphone/VoiceChatMicrophoneStateManager.cs index 036390fdbbe..5123c01e3da 100644 --- a/Explorer/Assets/DCL/VoiceChat/Microphone/VoiceChatMicrophoneStateManager.cs +++ b/Explorer/Assets/DCL/VoiceChat/Microphone/VoiceChatMicrophoneStateManager.cs @@ -67,12 +67,12 @@ private void OnCallStatusChanged(VoiceChatStatus newStatus) private void UpdateMicrophoneState() { - bool shouldEnableMicrophone = currentCallStatus == VoiceChatStatus.VOICE_CHAT_IN_CALL && isRoomConnected; + bool shouldEnableMicrophone = currentCallStatus == VoiceChatStatus.VoiceChatInCall && isRoomConnected; - bool shouldDisableMicrophone = currentCallStatus == VoiceChatStatus.DISCONNECTED || - currentCallStatus == VoiceChatStatus.VOICE_CHAT_ENDING_CALL || - (!isRoomConnected && currentCallStatus != VoiceChatStatus.VOICE_CHAT_STARTING_CALL && - currentCallStatus != VoiceChatStatus.VOICE_CHAT_STARTED_CALL); + bool shouldDisableMicrophone = currentCallStatus == VoiceChatStatus.Disconnected || + currentCallStatus == VoiceChatStatus.VoiceChatEndingCall || + (!isRoomConnected && currentCallStatus != VoiceChatStatus.VoiceChatStartingCall && + currentCallStatus != VoiceChatStatus.VoiceChatStartedCall); if (shouldEnableMicrophone) { microphoneHandler.EnableMicrophoneForCall(); } else if (shouldDisableMicrophone) { microphoneHandler.DisableMicrophoneForCall(); } diff --git a/Explorer/Assets/DCL/VoiceChat/Nametags/VoiceChatNametagsHandler.cs b/Explorer/Assets/DCL/VoiceChat/Nametags/VoiceChatNametagsHandler.cs index b9381c05c1e..a2149052bc9 100644 --- a/Explorer/Assets/DCL/VoiceChat/Nametags/VoiceChatNametagsHandler.cs +++ b/Explorer/Assets/DCL/VoiceChat/Nametags/VoiceChatNametagsHandler.cs @@ -158,14 +158,14 @@ void OnCallStatusChangedInternal() switch (status) { - case VoiceChatStatus.VOICE_CHAT_IN_CALL: + case VoiceChatStatus.VoiceChatInCall: world.AddOrSet(playerEntity, new VoiceChatNametagComponent(false, currentType)); OnActiveSpeakersUpdated(); break; - case VoiceChatStatus.VOICE_CHAT_ENDING_CALL: - case VoiceChatStatus.DISCONNECTED: - case VoiceChatStatus.VOICE_CHAT_GENERIC_ERROR: + case VoiceChatStatus.VoiceChatEndingCall: + case VoiceChatStatus.Disconnected: + case VoiceChatStatus.VoiceChatGenericError: world.AddOrSet(playerEntity, new VoiceChatNametagComponent(false, currentType) { IsRemoving = true }); activeSpeakers.Clear(); diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyMicrophoneHandler.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyMicrophoneHandler.cs index dc0d087121d..102d631ad95 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyMicrophoneHandler.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyMicrophoneHandler.cs @@ -44,7 +44,7 @@ public NearbyMicrophoneHandler(NearbyVoiceChatStateModel stateModel, IRoom islan this.islandRoom = islandRoom; this.configuration = configuration; - micPublisher = new MicrophoneTrackPublisher(islandRoom, configuration, VoiceChatType.NEARBY); + micPublisher = new MicrophoneTrackPublisher(islandRoom, configuration, VoiceChatType.Nearby); islandRoom.ConnectionUpdated += OnConnectionUpdated; islandRoom.ActiveSpeakers.Updated += OnActiveSpeakersUpdated; diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyVoiceBannedPlayerWatcher.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyVoiceBannedPlayerWatcher.cs index 342e0aa7596..73ac5bd50f0 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyVoiceBannedPlayerWatcher.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyVoiceBannedPlayerWatcher.cs @@ -55,12 +55,12 @@ private void SetBanned(bool banned) if (banned) { - restrictionBus.PushSceneRestriction(SceneRestriction.CreateNearbyVoiceChatBlocked(SceneRestrictionsAction.APPLIED)); + restrictionBus.PushSceneRestriction(SceneRestriction.CreateNearbyVoiceChatBlocked(SceneRestrictionsAction.Applied)); stateModel.Suppress(SuppressionReason.SceneBan); } else { - restrictionBus.PushSceneRestriction(SceneRestriction.CreateNearbyVoiceChatBlocked(SceneRestrictionsAction.REMOVED)); + restrictionBus.PushSceneRestriction(SceneRestriction.CreateNearbyVoiceChatBlocked(SceneRestrictionsAction.Removed)); stateModel.Resume(SuppressionReason.SceneBan); } } diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyVoiceSceneRestrictionWatcher.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyVoiceSceneRestrictionWatcher.cs index c46d5d2bfec..245fbf74813 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyVoiceSceneRestrictionWatcher.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Core/NearbyVoiceSceneRestrictionWatcher.cs @@ -47,12 +47,12 @@ private void SetBlocked(bool blocksVoice) if (blocksVoice) { - restrictionBus.PushSceneRestriction(SceneRestriction.CreateNearbyVoiceChatBlocked(SceneRestrictionsAction.APPLIED)); + restrictionBus.PushSceneRestriction(SceneRestriction.CreateNearbyVoiceChatBlocked(SceneRestrictionsAction.Applied)); stateModel.Suppress(SuppressionReason.Scene); } else { - restrictionBus.PushSceneRestriction(SceneRestriction.CreateNearbyVoiceChatBlocked(SceneRestrictionsAction.REMOVED)); + restrictionBus.PushSceneRestriction(SceneRestriction.CreateNearbyVoiceChatBlocked(SceneRestrictionsAction.Removed)); stateModel.Resume(SuppressionReason.Scene); } } diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Systems/NearbyVoiceChatNametagSystem.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Systems/NearbyVoiceChatNametagSystem.cs index 2dbf29adad8..60b87e9929c 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Systems/NearbyVoiceChatNametagSystem.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Systems/NearbyVoiceChatNametagSystem.cs @@ -55,8 +55,8 @@ protected override void Update(float t) [None(typeof(DeleteEntityIntention))] private void FlagNearbyNametagsForRemoval(ref VoiceChatNametagComponent c) { - if (c is { Type: VoiceChatType.NEARBY, IsRemoving: false }) - c = new VoiceChatNametagComponent(false, VoiceChatType.NEARBY) { IsRemoving = true }; + if (c is { Type: VoiceChatType.Nearby, IsRemoving: false }) + c = new VoiceChatNametagComponent(false, VoiceChatType.Nearby) { IsRemoving = true }; } [Query] @@ -64,10 +64,10 @@ private void FlagNearbyNametagsForRemoval(ref VoiceChatNametagComponent c) [All(typeof(AvatarBase))] private void UpdateExistingNearbyNametags(Entity entity, in Profile profile, ref VoiceChatNametagComponent badgeComponent) { - if (badgeComponent.Type != VoiceChatType.NEARBY) return; + if (badgeComponent.Type != VoiceChatType.Nearby) return; VoiceChatNametagComponent next = Resolve(entity, profile.UserId) - ?? new VoiceChatNametagComponent(false, VoiceChatType.NEARBY) { IsRemoving = true }; + ?? new VoiceChatNametagComponent(false, VoiceChatType.Nearby) { IsRemoving = true }; if (badgeComponent.IsSpeaking != next.IsSpeaking || badgeComponent.IsHushed != next.IsHushed || badgeComponent.IsRemoving != next.IsRemoving) badgeComponent = next; @@ -98,7 +98,7 @@ private void AddMissingNearbyNametags(Entity entity, in Profile profile) if (!localMicOpen) return null; bool isSpeaking = registry.IsActiveSpeaker(walletId); - return new VoiceChatNametagComponent(isSpeaking, VoiceChatType.NEARBY); + return new VoiceChatNametagComponent(isSpeaking, VoiceChatType.Nearby); } private VoiceChatNametagComponent? ResolveRemote(string walletId) @@ -106,7 +106,7 @@ private void AddMissingNearbyNametags(Entity entity, in Profile profile) if (!registry.IsActiveSpeaker(walletId)) return null; bool isHushed = muteService.IsMuted(walletId); - return new VoiceChatNametagComponent(isSpeaking: true, VoiceChatType.NEARBY, isHushed); + return new VoiceChatNametagComponent(isSpeaking: true, VoiceChatType.Nearby, isHushed); } } } diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceBannedPlayerWatcherShould.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceBannedPlayerWatcherShould.cs index c04a0a82d49..48a9bd8de48 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceBannedPlayerWatcherShould.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceBannedPlayerWatcherShould.cs @@ -51,7 +51,7 @@ public void SuppressOnForbiddenAccess() Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.Suppressed)); Assert.That(stateModel.ActiveSuppression.Value, Is.EqualTo(SuppressionReason.SceneBan)); restrictionBus.Received(1).PushSceneRestriction(Arg.Is(r => - r.Type == SceneRestrictions.NEARBY_VOICE_CHAT_BLOCKED && r.Action == SceneRestrictionsAction.APPLIED)); + r.Type == SceneRestrictions.NearbyVoiceChatBlocked && r.Action == SceneRestrictionsAction.Applied)); } [Test] @@ -65,7 +65,7 @@ public void ResumeOnSceneRoomConnected() Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.Idle)); Assert.That(stateModel.ActiveSuppression.Value, Is.Null); restrictionBus.Received(1).PushSceneRestriction(Arg.Is(r => - r.Type == SceneRestrictions.NEARBY_VOICE_CHAT_BLOCKED && r.Action == SceneRestrictionsAction.REMOVED)); + r.Type == SceneRestrictions.NearbyVoiceChatBlocked && r.Action == SceneRestrictionsAction.Removed)); } [Test] @@ -78,7 +78,7 @@ public void ResumeOnSceneRoomDisconnected() Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.Idle)); restrictionBus.Received(1).PushSceneRestriction(Arg.Is(r => - r.Action == SceneRestrictionsAction.REMOVED)); + r.Action == SceneRestrictionsAction.Removed)); } [Test] @@ -119,7 +119,7 @@ public void RestoreSuppressionAfterConnectedAndForbiddenAgain() Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.Suppressed)); Assert.That(stateModel.ActiveSuppression.Value, Is.EqualTo(SuppressionReason.SceneBan)); restrictionBus.Received(1).PushSceneRestriction(Arg.Is(r => - r.Type == SceneRestrictions.NEARBY_VOICE_CHAT_BLOCKED && r.Action == SceneRestrictionsAction.APPLIED)); + r.Type == SceneRestrictions.NearbyVoiceChatBlocked && r.Action == SceneRestrictionsAction.Applied)); } [Test] @@ -136,7 +136,7 @@ public void RestoreSuppressionAfterDisconnectedAndForbiddenAgain() Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.Suppressed)); Assert.That(stateModel.ActiveSuppression.Value, Is.EqualTo(SuppressionReason.SceneBan)); restrictionBus.Received(1).PushSceneRestriction(Arg.Is(r => - r.Type == SceneRestrictions.NEARBY_VOICE_CHAT_BLOCKED && r.Action == SceneRestrictionsAction.APPLIED)); + r.Type == SceneRestrictions.NearbyVoiceChatBlocked && r.Action == SceneRestrictionsAction.Applied)); } [Test] @@ -150,7 +150,7 @@ public void ReleaseSuppressionOnDisposeWhileBanned() Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.Idle)); restrictionBus.Received(1).PushSceneRestriction(Arg.Is(r => - r.Action == SceneRestrictionsAction.REMOVED)); + r.Action == SceneRestrictionsAction.Removed)); } } } diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceChatManagerShould.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceChatManagerShould.cs index b9bb6c1a72a..3218a3bac5e 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceChatManagerShould.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceChatManagerShould.cs @@ -20,7 +20,7 @@ public class NearbyVoiceChatManagerShould public void SetUp() { stateModel = new NearbyVoiceChatStateModel(NearbyVoiceChatState.Idle); - callStatus = new ReactiveProperty(VoiceChatStatus.DISCONNECTED); + callStatus = new ReactiveProperty(VoiceChatStatus.Disconnected); loadingStatus = new FakeLoadingStatus(LoadingStatus.LoadingStage.Completed); } @@ -75,7 +75,7 @@ public void SuppressOnCallInCall() using var manager = new NearbyVoiceChatSuppressor(stateModel, callStatus, loadingStatus); // Act - callStatus.Value = VoiceChatStatus.VOICE_CHAT_IN_CALL; + callStatus.Value = VoiceChatStatus.VoiceChatInCall; // Assert Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.Suppressed)); @@ -87,10 +87,10 @@ public void ResumeOnCallDisconnected() { // Arrange using var manager = new NearbyVoiceChatSuppressor(stateModel, callStatus, loadingStatus); - callStatus.Value = VoiceChatStatus.VOICE_CHAT_IN_CALL; + callStatus.Value = VoiceChatStatus.VoiceChatInCall; // Act - callStatus.Value = VoiceChatStatus.DISCONNECTED; + callStatus.Value = VoiceChatStatus.Disconnected; // Assert Assert.That(stateModel.State.Value, Is.EqualTo(NearbyVoiceChatState.Idle)); @@ -104,7 +104,7 @@ public void UnsubscribeAfterDispose() manager.Dispose(); // Act — should not trigger further state changes - callStatus.Value = VoiceChatStatus.VOICE_CHAT_IN_CALL; + callStatus.Value = VoiceChatStatus.VoiceChatInCall; loadingStatus.CurrentStageMut.Value = LoadingStatus.LoadingStage.Init; // Assert diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceChatNametagSystemShould.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceChatNametagSystemShould.cs index 21cd4bee593..96dfc3d0bfb 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceChatNametagSystemShould.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/EditMode/NearbyVoiceChatNametagSystemShould.cs @@ -68,9 +68,9 @@ public void TearDown() [Test] public void SuppressedStateFlagsAllNearbyComponentsForRemoval() { - Entity a = CreateNametaggedAvatarEntity("wallet-a", new VoiceChatNametagComponent(true, VoiceChatType.NEARBY)); - Entity b = CreateNametaggedAvatarEntity("wallet-b", new VoiceChatNametagComponent(true, VoiceChatType.NEARBY)); - Entity c = CreateNametaggedAvatarEntity("wallet-c", new VoiceChatNametagComponent(false, VoiceChatType.NEARBY)); + Entity a = CreateNametaggedAvatarEntity("wallet-a", new VoiceChatNametagComponent(true, VoiceChatType.Nearby)); + Entity b = CreateNametaggedAvatarEntity("wallet-b", new VoiceChatNametagComponent(true, VoiceChatType.Nearby)); + Entity c = CreateNametaggedAvatarEntity("wallet-c", new VoiceChatNametagComponent(false, VoiceChatType.Nearby)); stateModel.Suppress(SuppressionReason.Call); system.Update(0); @@ -83,7 +83,7 @@ public void SuppressedStateFlagsAllNearbyComponentsForRemoval() [Test] public void DisabledStateFlagsAllNearbyComponentsForRemoval() { - Entity a = CreateNametaggedAvatarEntity("wallet-a", new VoiceChatNametagComponent(true, VoiceChatType.NEARBY)); + Entity a = CreateNametaggedAvatarEntity("wallet-a", new VoiceChatNametagComponent(true, VoiceChatType.Nearby)); stateModel.Disable(); system.Update(0); @@ -95,13 +95,13 @@ public void DisabledStateFlagsAllNearbyComponentsForRemoval() public void SuppressedStateLeavesNonNearbyComponentsAlone() { Entity community = CreateNametaggedAvatarEntity("wallet-community", - new VoiceChatNametagComponent(true, VoiceChatType.COMMUNITY)); + new VoiceChatNametagComponent(true, VoiceChatType.Community)); stateModel.Suppress(SuppressionReason.Call); system.Update(0); ref var c = ref world.Get(community); - Assert.That(c.Type, Is.EqualTo(VoiceChatType.COMMUNITY)); + Assert.That(c.Type, Is.EqualTo(VoiceChatType.Community)); Assert.That(c.IsRemoving, Is.False, "community/private components belong to a different handler"); } @@ -129,7 +129,7 @@ public void RemoteStoppedSpeakingFlagsForRemoval() { const string WALLET = "wallet-a"; Entity e = CreateNametaggedAvatarEntity(WALLET, - new VoiceChatNametagComponent(isSpeaking: true, type: VoiceChatType.NEARBY)); + new VoiceChatNametagComponent(isSpeaking: true, type: VoiceChatType.Nearby)); // ActiveSpeakers does NOT contain WALLET → predicate flips to "should not show". system.Update(0); @@ -142,7 +142,7 @@ public void RemoteHushFlipUpdatesIsHushed() { const string WALLET = "wallet-a"; Entity e = CreateNametaggedAvatarEntity(WALLET, - new VoiceChatNametagComponent(isSpeaking: true, type: VoiceChatType.NEARBY, isHushed: false) + new VoiceChatNametagComponent(isSpeaking: true, type: VoiceChatType.Nearby, isHushed: false) { IsDirty = false }); registry.IsActiveSpeaker(WALLET).Returns(true); muteCache.IsMuted(WALLET).Returns(true); @@ -163,7 +163,7 @@ public void LocalOpenMicSpeakingFlipUpdatesIsSpeaking() // Replace the empty playerEntity with a full avatar entity, and re-create the system to capture it. world.Destroy(playerEntity); playerEntity = CreateAvatarEntity(LOCAL); - world.Add(playerEntity, new VoiceChatNametagComponent(isSpeaking: false, type: VoiceChatType.NEARBY) + world.Add(playerEntity, new VoiceChatNametagComponent(isSpeaking: false, type: VoiceChatType.Nearby) { IsDirty = false }); system = new NearbyVoiceChatNametagSystem(world, playerEntity, registry, stateModel, muteService); @@ -184,7 +184,7 @@ public void IdempotencyNoMutationWhenSteadyState() { const string WALLET = "wallet-a"; Entity e = CreateNametaggedAvatarEntity(WALLET, - new VoiceChatNametagComponent(isSpeaking: true, type: VoiceChatType.NEARBY, isHushed: false) + new VoiceChatNametagComponent(isSpeaking: true, type: VoiceChatType.Nearby, isHushed: false) { IsDirty = false }); registry.IsActiveSpeaker(WALLET).Returns(true); muteCache.IsMuted(WALLET).Returns(false); @@ -206,7 +206,7 @@ public void NonNearbyComponentNotTouched() { const string WALLET = "wallet-community"; Entity e = CreateNametaggedAvatarEntity(WALLET, - new VoiceChatNametagComponent(isSpeaking: true, type: VoiceChatType.COMMUNITY) + new VoiceChatNametagComponent(isSpeaking: true, type: VoiceChatType.Community) { IsDirty = false }); registry.IsActiveSpeaker(WALLET).Returns(true); muteCache.IsMuted(WALLET).Returns(true); // would otherwise flip IsHushed @@ -214,7 +214,7 @@ public void NonNearbyComponentNotTouched() system.Update(0); ref var c = ref world.Get(e); - Assert.That(c.Type, Is.EqualTo(VoiceChatType.COMMUNITY)); + Assert.That(c.Type, Is.EqualTo(VoiceChatType.Community)); Assert.That(c.IsHushed, Is.False, "non-nearby component must not be touched by this system"); Assert.That(c.IsDirty, Is.False); Assert.That(c.IsRemoving, Is.False); @@ -232,7 +232,7 @@ public void RemoteSpeakerWithoutComponentGetsComponentAdded() system.Update(0); ref var c = ref world.Get(e); - Assert.That(c.Type, Is.EqualTo(VoiceChatType.NEARBY)); + Assert.That(c.Type, Is.EqualTo(VoiceChatType.Nearby)); Assert.That(c.IsSpeaking, Is.True); Assert.That(c.IsHushed, Is.False); Assert.That(c.IsRemoving, Is.False); @@ -278,7 +278,7 @@ public void LocalPlayerOpenMicGetsComponentAdded() system.Update(0); ref var c = ref world.Get(playerEntity); - Assert.That(c.Type, Is.EqualTo(VoiceChatType.NEARBY)); + Assert.That(c.Type, Is.EqualTo(VoiceChatType.Nearby)); Assert.That(c.IsSpeaking, Is.False); } diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/PerformanceTests/NearbyVoiceChatNametagSystemPerformanceTest.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/PerformanceTests/NearbyVoiceChatNametagSystemPerformanceTest.cs index 31e6580601f..b7f4df7bbc4 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/PerformanceTests/NearbyVoiceChatNametagSystemPerformanceTest.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/Tests/PerformanceTests/NearbyVoiceChatNametagSystemPerformanceTest.cs @@ -76,7 +76,7 @@ public void UpdateMixedAvatarsWithNAvatars(int avatarCount) if (i < half) { registry.IsActiveSpeaker(wallet).Returns(true); - world.Add(e, new VoiceChatNametagComponent(isSpeaking: true, type: VoiceChatType.NEARBY)); + world.Add(e, new VoiceChatNametagComponent(isSpeaking: true, type: VoiceChatType.Nearby)); } } diff --git a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/UI/NearbyVoicePanelController.cs b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/UI/NearbyVoicePanelController.cs index df6f43a9f24..6a58cb08595 100644 --- a/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/UI/NearbyVoicePanelController.cs +++ b/Explorer/Assets/DCL/VoiceChat/NearbyVoiceChat/UI/NearbyVoicePanelController.cs @@ -8,7 +8,7 @@ public class NearbyVoicePanelController : ControllerBase { private UniTaskCompletionSource? closeViewTask; - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.POPUP; + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Popup; public NearbyVoicePanelController(ViewFactoryMethod viewFactory) : base(viewFactory) { } diff --git a/Explorer/Assets/DCL/VoiceChat/PrivateVoiceChat/PrivateVoiceChatCallStatusService.cs b/Explorer/Assets/DCL/VoiceChat/PrivateVoiceChat/PrivateVoiceChatCallStatusService.cs index 89151f1f47f..725c07a1ff7 100644 --- a/Explorer/Assets/DCL/VoiceChat/PrivateVoiceChat/PrivateVoiceChatCallStatusService.cs +++ b/Explorer/Assets/DCL/VoiceChat/PrivateVoiceChat/PrivateVoiceChatCallStatusService.cs @@ -23,7 +23,7 @@ public class PrivateVoiceChatCallStatusService : IPrivateVoiceChatCallStatusServ private readonly IVoiceService voiceChatService; private CancellationTokenSource cts; - private readonly ReactiveProperty status = new (VoiceChatStatus.DISCONNECTED); + private readonly ReactiveProperty status = new (VoiceChatStatus.Disconnected); private readonly ReactiveProperty callId = new (string.Empty); private string connectionUrl = string.Empty; @@ -66,18 +66,18 @@ public void OnPrivateVoiceChatUpdateReceived(PrivateVoiceChatUpdate update) { case PrivateVoiceChatStatus.VoiceChatAccepted: connectionUrl = update.Credentials.ConnectionUrl; - UpdateStatus(VoiceChatStatus.VOICE_CHAT_IN_CALL); + UpdateStatus(VoiceChatStatus.VoiceChatInCall); break; case PrivateVoiceChatStatus.VoiceChatRejected: case PrivateVoiceChatStatus.VoiceChatEnded: case PrivateVoiceChatStatus.VoiceChatExpired: ResetVoiceChatData(); - UpdateStatus(VoiceChatStatus.DISCONNECTED); + UpdateStatus(VoiceChatStatus.Disconnected); break; case PrivateVoiceChatStatus.VoiceChatRequested: SetCallId(update.CallId); CurrentTargetWallet = new Web3Address(update.Caller.Address); - UpdateStatus(VoiceChatStatus.VOICE_CHAT_RECEIVED_CALL); + UpdateStatus(VoiceChatStatus.VoiceChatReceivedCall); break; } } @@ -96,7 +96,7 @@ private async UniTaskVoid CheckIncomingCallAsync(CancellationToken ct) if (response.ResponseCase == GetIncomingPrivateVoiceChatRequestResponse.ResponseOneofCase.Ok) { SetCallId(response.Ok.CallId); - UpdateStatus(VoiceChatStatus.VOICE_CHAT_RECEIVED_CALL); + UpdateStatus(VoiceChatStatus.VoiceChatReceivedCall); } } catch (Exception e) { HandleVoiceChatServiceDisabled(e, resetData: false); } @@ -104,10 +104,10 @@ private async UniTaskVoid CheckIncomingCallAsync(CancellationToken ct) private void OnRCPDisconnected() { - if (status.Value is not VoiceChatStatus.VOICE_CHAT_IN_CALL) + if (status.Value is not VoiceChatStatus.VoiceChatInCall) { ResetVoiceChatData(); - UpdateStatus(VoiceChatStatus.VOICE_CHAT_GENERIC_ERROR); + UpdateStatus(VoiceChatStatus.VoiceChatGenericError); } } @@ -123,7 +123,7 @@ public void StartCall(string walletId) cts = cts.SafeRestart(); //Setting starting call status to instantly disable call button - UpdateStatus(VoiceChatStatus.VOICE_CHAT_STARTING_CALL); + UpdateStatus(VoiceChatStatus.VoiceChatStartingCall); StartCallAsync(cts.Token).Forget(); return; @@ -139,18 +139,18 @@ async UniTaskVoid StartCallAsync(CancellationToken ct) //When the call can be started case StartPrivateVoiceChatResponse.ResponseOneofCase.Ok: SetCallId(response.Ok.CallId); - UpdateStatus(VoiceChatStatus.VOICE_CHAT_STARTED_CALL); + UpdateStatus(VoiceChatStatus.VoiceChatStartedCall); break; //When the other user is already in a call or is already being called case StartPrivateVoiceChatResponse.ResponseOneofCase.InvalidRequest: case StartPrivateVoiceChatResponse.ResponseOneofCase.ConflictingError: ResetVoiceChatData(); - UpdateStatus(VoiceChatStatus.VOICE_CHAT_BUSY); + UpdateStatus(VoiceChatStatus.VoiceChatBusy); break; default: ResetVoiceChatData(); - UpdateStatus(VoiceChatStatus.VOICE_CHAT_GENERIC_ERROR); + UpdateStatus(VoiceChatStatus.VoiceChatGenericError); break; } } @@ -161,10 +161,10 @@ async UniTaskVoid StartCallAsync(CancellationToken ct) public void AcceptCall() { //We can accept a call only if we are receiving a call - if (status.Value is not VoiceChatStatus.VOICE_CHAT_RECEIVED_CALL) return; + if (status.Value is not VoiceChatStatus.VoiceChatReceivedCall) return; cts = cts.SafeRestart(); - UpdateStatus(VoiceChatStatus.VOICE_CHAT_STARTED_CALL); + UpdateStatus(VoiceChatStatus.VoiceChatStartedCall); AcceptCallAsync(callId.Value, cts.Token).Forget(); return; @@ -180,10 +180,10 @@ async UniTaskVoid AcceptCallAsync(string callId, CancellationToken ct) //When the call has been ended case AcceptPrivateVoiceChatResponse.ResponseOneofCase.Ok: connectionUrl = response.Ok.Credentials.ConnectionUrl; - UpdateStatus(VoiceChatStatus.VOICE_CHAT_IN_CALL); + UpdateStatus(VoiceChatStatus.VoiceChatInCall); break; default: - UpdateStatus(VoiceChatStatus.VOICE_CHAT_GENERIC_ERROR); + UpdateStatus(VoiceChatStatus.VoiceChatGenericError); break; } } @@ -194,10 +194,10 @@ async UniTaskVoid AcceptCallAsync(string callId, CancellationToken ct) public void HangUp() { //We can stop a call only if we are starting a call or inside a call - if (status.Value is not (VoiceChatStatus.VOICE_CHAT_STARTED_CALL or VoiceChatStatus.VOICE_CHAT_STARTING_CALL or VoiceChatStatus.VOICE_CHAT_IN_CALL)) return; + if (status.Value is not (VoiceChatStatus.VoiceChatStartedCall or VoiceChatStatus.VoiceChatStartingCall or VoiceChatStatus.VoiceChatInCall)) return; cts = cts.SafeRestart(); - UpdateStatus(VoiceChatStatus.VOICE_CHAT_ENDING_CALL); + UpdateStatus(VoiceChatStatus.VoiceChatEndingCall); HangUpAsync(callId.Value, cts.Token).Forget(); return; @@ -212,11 +212,11 @@ async UniTaskVoid HangUpAsync(string callId, CancellationToken ct) //When the call has been ended case EndPrivateVoiceChatResponse.ResponseOneofCase.Ok: ResetVoiceChatData(); - UpdateStatus(VoiceChatStatus.DISCONNECTED); + UpdateStatus(VoiceChatStatus.Disconnected); break; default: ResetVoiceChatData(); - UpdateStatus(VoiceChatStatus.VOICE_CHAT_GENERIC_ERROR); + UpdateStatus(VoiceChatStatus.VoiceChatGenericError); break; } } @@ -227,10 +227,10 @@ async UniTaskVoid HangUpAsync(string callId, CancellationToken ct) public void RejectCall() { //We can reject a call only if we are receiving a call - if (status.Value is not VoiceChatStatus.VOICE_CHAT_RECEIVED_CALL) return; + if (status.Value is not VoiceChatStatus.VoiceChatReceivedCall) return; cts = cts.SafeRestart(); - UpdateStatus(VoiceChatStatus.VOICE_CHAT_REJECTING_CALL); + UpdateStatus(VoiceChatStatus.VoiceChatRejectingCall); RejectCallAsync(callId.Value, cts.Token).Forget(); return; @@ -245,10 +245,10 @@ async UniTaskVoid RejectCallAsync(string callId, CancellationToken ct) { //When the call has been ended case RejectPrivateVoiceChatResponse.ResponseOneofCase.Ok: - UpdateStatus(VoiceChatStatus.DISCONNECTED); + UpdateStatus(VoiceChatStatus.Disconnected); break; default: - UpdateStatus(VoiceChatStatus.VOICE_CHAT_GENERIC_ERROR); + UpdateStatus(VoiceChatStatus.VoiceChatGenericError); break; } } @@ -269,24 +269,24 @@ private void HandleVoiceChatServiceDisabled(Exception e, bool resetData = false) if (resetData) { ResetVoiceChatData(); } - UpdateStatus(VoiceChatStatus.VOICE_CHAT_GENERIC_ERROR); + UpdateStatus(VoiceChatStatus.VoiceChatGenericError); } public void HandleLivekitConnectionFailed() { - if (status.Value is VoiceChatStatus.VOICE_CHAT_IN_CALL or VoiceChatStatus.VOICE_CHAT_STARTED_CALL) + if (status.Value is VoiceChatStatus.VoiceChatInCall or VoiceChatStatus.VoiceChatStartedCall) { ResetVoiceChatData(); - UpdateStatus(VoiceChatStatus.VOICE_CHAT_GENERIC_ERROR); + UpdateStatus(VoiceChatStatus.VoiceChatGenericError); } } public void HandleLivekitConnectionEnded() { - if (status.Value is VoiceChatStatus.VOICE_CHAT_IN_CALL or VoiceChatStatus.VOICE_CHAT_STARTED_CALL) + if (status.Value is VoiceChatStatus.VoiceChatInCall or VoiceChatStatus.VoiceChatStartedCall) { ResetVoiceChatData(); - UpdateStatus(VoiceChatStatus.DISCONNECTED); + UpdateStatus(VoiceChatStatus.Disconnected); } } diff --git a/Explorer/Assets/DCL/VoiceChat/PrivateVoiceChat/PrivateVoiceChatCallStatusServiceNull.cs b/Explorer/Assets/DCL/VoiceChat/PrivateVoiceChat/PrivateVoiceChatCallStatusServiceNull.cs index 312b02d96bc..e4da9b68e1f 100644 --- a/Explorer/Assets/DCL/VoiceChat/PrivateVoiceChat/PrivateVoiceChatCallStatusServiceNull.cs +++ b/Explorer/Assets/DCL/VoiceChat/PrivateVoiceChat/PrivateVoiceChatCallStatusServiceNull.cs @@ -8,7 +8,7 @@ public class PrivateVoiceChatCallStatusServiceNull : IPrivateVoiceChatCallStatus { public string CurrentTargetWallet { get; } public event Action? PrivateVoiceChatUpdateReceived; - public IReadonlyReactiveProperty Status { get; } = new ReactiveProperty(VoiceChatStatus.DISCONNECTED); + public IReadonlyReactiveProperty Status { get; } = new ReactiveProperty(VoiceChatStatus.Disconnected); public IReadonlyReactiveProperty CallId { get; } = new ReactiveProperty(string.Empty); public string ConnectionUrl { get; } diff --git a/Explorer/Assets/DCL/VoiceChat/PrivateVoiceChat/PrivateVoiceChatPresenter.cs b/Explorer/Assets/DCL/VoiceChat/PrivateVoiceChat/PrivateVoiceChatPresenter.cs index 7f8cdaeb7ea..ce25ecf1a7a 100644 --- a/Explorer/Assets/DCL/VoiceChat/PrivateVoiceChat/PrivateVoiceChatPresenter.cs +++ b/Explorer/Assets/DCL/VoiceChat/PrivateVoiceChat/PrivateVoiceChatPresenter.cs @@ -62,7 +62,7 @@ private void OnConnectionUpdated(IRoom room, ConnectionUpdate connectionUpdate, if (connectionUpdate != ConnectionUpdate.Connected) return; // The LiveKit room is shared between private and community calls - if (privateCallOrchestrator.CurrentVoiceChatType.Value != VoiceChatType.PRIVATE) return; + if (privateCallOrchestrator.CurrentVoiceChatType.Value != VoiceChatType.Private) return; view.SetInCallSection(); } @@ -100,15 +100,15 @@ private void OnPrivateVoiceChatStatusChanged(VoiceChatStatus status) { switch (status) { - case VoiceChatStatus.VOICE_CHAT_STARTING_CALL or VoiceChatStatus.VOICE_CHAT_RECEIVED_CALL: + case VoiceChatStatus.VoiceChatStartingCall or VoiceChatStatus.VoiceChatReceivedCall: view.Show(); break; - case VoiceChatStatus.DISCONNECTED or VoiceChatStatus.VOICE_CHAT_ENDING_CALL: + case VoiceChatStatus.Disconnected or VoiceChatStatus.VoiceChatEndingCall: view.Hide(); break; } - if (status is VoiceChatStatus.VOICE_CHAT_STARTED_CALL or VoiceChatStatus.VOICE_CHAT_RECEIVED_CALL) + if (status is VoiceChatStatus.VoiceChatStartedCall or VoiceChatStatus.VoiceChatReceivedCall) UIAudioEventsBus.Instance.SendPlayContinuousAudioEvent(view.CallTuneAudio); else UIAudioEventsBus.Instance.SendStopPlayingContinuousAudioEvent(view.CallTuneAudio); diff --git a/Explorer/Assets/DCL/VoiceChat/PrivateVoiceChat/PrivateVoiceChatView.cs b/Explorer/Assets/DCL/VoiceChat/PrivateVoiceChat/PrivateVoiceChatView.cs index 558d09602c8..febf965bb72 100644 --- a/Explorer/Assets/DCL/VoiceChat/PrivateVoiceChat/PrivateVoiceChatView.cs +++ b/Explorer/Assets/DCL/VoiceChat/PrivateVoiceChat/PrivateVoiceChatView.cs @@ -115,26 +115,26 @@ public void SetActiveSection(VoiceChatStatus status, string walletId, ProfileRep { cts = cts.SafeRestart(); DisableAllSections(); - if (status is VoiceChatStatus.DISCONNECTED or VoiceChatStatus.VOICE_CHAT_ENDING_CALL) return; + if (status is VoiceChatStatus.Disconnected or VoiceChatStatus.VoiceChatEndingCall) return; Web3Address wallet = new Web3Address(walletId); switch (status) { - case VoiceChatStatus.VOICE_CHAT_IN_CALL: + case VoiceChatStatus.VoiceChatInCall: ConnectingView.gameObject.SetActive(true); ConnectingView.ProfileView.SetupAsync(wallet, profileDataProvider, cts.Token).Forget(); InCallView.ProfileView.SetupAsync(wallet, profileDataProvider, cts.Token).Forget(); break; - case VoiceChatStatus.VOICE_CHAT_RECEIVED_CALL: + case VoiceChatStatus.VoiceChatReceivedCall: IncomingCallView.SetActive(true); IncomingCallView.ProfileView.SetupAsync(wallet, profileDataProvider, cts.Token).Forget(); break; - case VoiceChatStatus.VOICE_CHAT_STARTED_CALL: + case VoiceChatStatus.VoiceChatStartedCall: OutgoingCallView.gameObject.SetActive(true); OutgoingCallView.ProfileView.SetupAsync(wallet, profileDataProvider, cts.Token).Forget(); break; - case VoiceChatStatus.VOICE_CHAT_BUSY: - case VoiceChatStatus.VOICE_CHAT_GENERIC_ERROR: + case VoiceChatStatus.VoiceChatBusy: + case VoiceChatStatus.VoiceChatGenericError: ErrorView.SetActive(true); ErrorView.StartErrorPanelDisableFlow(); break; diff --git a/Explorer/Assets/DCL/VoiceChat/Services/RPCPrivateVoiceChatService.cs b/Explorer/Assets/DCL/VoiceChat/Services/RPCPrivateVoiceChatService.cs index 13b4d547897..9bb8f94591a 100644 --- a/Explorer/Assets/DCL/VoiceChat/Services/RPCPrivateVoiceChatService.cs +++ b/Explorer/Assets/DCL/VoiceChat/Services/RPCPrivateVoiceChatService.cs @@ -43,7 +43,7 @@ public RPCPrivateVoiceChatService( this.socialServiceEventBus = socialServiceEventBus; this.identityCache = identityCache; - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.VOICE_CHAT)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.VoiceChat)) { socialServiceEventBus.TransportClosed += OnTransportClosed; socialServiceEventBus.RPCClientReconnected += OnTransportReconnected; @@ -54,7 +54,7 @@ public RPCPrivateVoiceChatService( public override void Dispose() { - if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.VOICE_CHAT)) return; + if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.VoiceChat)) return; socialServiceEventBus.TransportClosed -= OnTransportClosed; socialServiceEventBus.RPCClientReconnected -= OnTransportReconnected; diff --git a/Explorer/Assets/DCL/VoiceChat/Services/SceneVoiceChatTrackerService.cs b/Explorer/Assets/DCL/VoiceChat/Services/SceneVoiceChatTrackerService.cs index 29d3c9fb348..1f048ce7408 100644 --- a/Explorer/Assets/DCL/VoiceChat/Services/SceneVoiceChatTrackerService.cs +++ b/Explorer/Assets/DCL/VoiceChat/Services/SceneVoiceChatTrackerService.cs @@ -41,7 +41,7 @@ public SceneVoiceChatTrackerService( this.realmNavigator = realmNavigator; this.realmData = realmData; - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.COMMUNITY_VOICE_CHAT)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.CommunityVoiceChat)) { this.realmNavigator.NavigationExecuted += OnRealmNavigatorOperationExecuted; parcelSubscription = scenesCache.CurrentParcel.Subscribe(OnParcelChanged); diff --git a/Explorer/Assets/DCL/VoiceChat/UI/CallButtonPresenter.cs b/Explorer/Assets/DCL/VoiceChat/UI/CallButtonPresenter.cs index bf2cc5cd525..0fce27c8e0c 100644 --- a/Explorer/Assets/DCL/VoiceChat/UI/CallButtonPresenter.cs +++ b/Explorer/Assets/DCL/VoiceChat/UI/CallButtonPresenter.cs @@ -15,11 +15,11 @@ public class CallButtonPresenter { public enum OtherUserCallStatus { - USER_OFFLINE, - USER_REJECTS_CALLS, - USER_AVAILABLE, - OWN_USER_IN_CALL, - OWN_USER_REJECTS_CALLS, + UserOffline, + UserRejectsCalls, + UserAvailable, + OwnUserInCall, + OwnUserRejectsCalls, } private const string USER_OFFLINE_TOOLTIP_TEXT = "[{0}] is offline."; @@ -60,7 +60,7 @@ public CallButtonPresenter( this.view.CallButton.onClick.AddListener(OnCallButtonClicked); cts = new CancellationTokenSource(); - if (FeaturesRegistry.Instance.IsEnabled(FeatureId.VOICE_CHAT)) + if (FeaturesRegistry.Instance.IsEnabled(FeatureId.VoiceChat)) { statusSubscription = privateCallOrchestrator.CurrentCallStatus.Subscribe(OnVoiceChatStatusChanged); currentChannelSubscription = currentChannel.Subscribe(OnCurrentChannelChanged); @@ -83,7 +83,7 @@ private void OnChatEventBusStartCall() private void Reset() { - if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.VOICE_CHAT)) return; + if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.VoiceChat)) return; if (!PlayerLoopHelper.IsMainThread) ResetAsync().Forget(); @@ -103,7 +103,7 @@ async UniTaskVoid ResetAsync() public void SetCallStatusForUser(OtherUserCallStatus status, string userId, string userName) { - if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.VOICE_CHAT)) return; + if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.VoiceChat)) return; currentUserName = userName; currentUserId = userId; @@ -131,7 +131,7 @@ private async UniTaskVoid HandleCallButtonClickAsync(CancellationToken ct) isClickedOnce = true; // Check if we're in a community call first - if (privateCallOrchestrator.CurrentVoiceChatType.Value == VoiceChatType.COMMUNITY) + if (privateCallOrchestrator.CurrentVoiceChatType.Value == VoiceChatType.Community) { await ShowTooltipWithAutoCloseAsync(COMMUNITY_CALL_ACTIVE_TOOLTIP_TEXT, ct); return; @@ -139,9 +139,9 @@ private async UniTaskVoid HandleCallButtonClickAsync(CancellationToken ct) // Check if we're already in a call if (privateCallOrchestrator.CurrentCallStatus.Value is - VoiceChatStatus.VOICE_CHAT_IN_CALL or - VoiceChatStatus.VOICE_CHAT_STARTED_CALL or - VoiceChatStatus.VOICE_CHAT_STARTING_CALL) + VoiceChatStatus.VoiceChatInCall or + VoiceChatStatus.VoiceChatStartedCall or + VoiceChatStatus.VoiceChatStartingCall) { await ShowTooltipWithAutoCloseAsync(OWN_USER_ALREADY_IN_CALL_TOOLTIP_TEXT, ct); return; @@ -149,22 +149,22 @@ VoiceChatStatus.VOICE_CHAT_STARTED_CALL or switch (otherUserStatus) { - case OtherUserCallStatus.USER_OFFLINE: + case OtherUserCallStatus.UserOffline: await ShowTooltipWithAutoCloseAsync(USER_OFFLINE_TOOLTIP_TEXT, ct); break; - case OtherUserCallStatus.USER_AVAILABLE: + case OtherUserCallStatus.UserAvailable: // For available users, immediately start call without showing tooltip view.TooltipParent.gameObject.SetActive(false); isClickedOnce = false; - privateCallOrchestrator.StartCall(new Web3Address(currentUserId), VoiceChatType.PRIVATE); + privateCallOrchestrator.StartCall(new Web3Address(currentUserId), VoiceChatType.Private); break; - case OtherUserCallStatus.OWN_USER_IN_CALL: + case OtherUserCallStatus.OwnUserInCall: await ShowTooltipWithAutoCloseAsync(OWN_USER_ALREADY_IN_CALL_TOOLTIP_TEXT, ct); break; - case OtherUserCallStatus.USER_REJECTS_CALLS: + case OtherUserCallStatus.UserRejectsCalls: await ShowTooltipWithAutoCloseAsync(USER_REJECTS_CALLS_TOOLTIP_TEXT, ct); break; - case OtherUserCallStatus.OWN_USER_REJECTS_CALLS: + case OtherUserCallStatus.OwnUserRejectsCalls: await ShowTooltipWithAutoCloseAsync(OWN_USER_REJECTS_CALLS_TOOLTIP_TEXT, ct); break; } @@ -191,13 +191,13 @@ private async UniTask ShowTooltipWithAutoCloseAsync(string tooltipText, Cancella private void OnVoiceChatStatusChanged(VoiceChatStatus newStatus) { - if (newStatus == VoiceChatStatus.VOICE_CHAT_BUSY) + if (newStatus == VoiceChatStatus.VoiceChatBusy) ShowTooltipWithAutoCloseAsync(USER_ALREADY_IN_CALL_TOOLTIP_TEXT, cts.Token).Forget(); } public void Dispose() { - if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.VOICE_CHAT)) return; + if (!FeaturesRegistry.Instance.IsEnabled(FeatureId.VoiceChat)) return; statusSubscription?.Dispose(); orchestratorTypeSubscription?.Dispose(); diff --git a/Explorer/Assets/DCL/VoiceChat/UI/VoiceChatPanelPresenter.cs b/Explorer/Assets/DCL/VoiceChat/UI/VoiceChatPanelPresenter.cs index ba73aeef35f..1201e113f18 100644 --- a/Explorer/Assets/DCL/VoiceChat/UI/VoiceChatPanelPresenter.cs +++ b/Explorer/Assets/DCL/VoiceChat/UI/VoiceChatPanelPresenter.cs @@ -67,26 +67,26 @@ public VoiceChatPanelPresenter(VoiceChatPanelView view, private void OnMVCViewOpened(ChatSharedAreaEvents.MVCViewOpenEvent evt) { - if (evt.ViewSortingLayer is not CanvasOrdering.SortingLayer.FULLSCREEN) return; + if (evt.ViewSortingLayer is not CanvasOrdering.SortingLayer.Fullscreen) return; stateBeforeFullscreen ??= voiceChatPanelState.Value; - voiceChatOrchestrator.ChangePanelState(VoiceChatPanelState.HIDDEN, force: true); + voiceChatOrchestrator.ChangePanelState(VoiceChatPanelState.Hidden, force: true); clickDetectionHandler.Pause(); } private void OnMVCViewClosed(ChatSharedAreaEvents.MVCViewClosedEvent evt) { - if (evt.ViewSortingLayer is not CanvasOrdering.SortingLayer.FULLSCREEN) return; + if (evt.ViewSortingLayer is not CanvasOrdering.SortingLayer.Fullscreen) return; if (stateBeforeFullscreen is null) return; VoiceChatPanelState previous = stateBeforeFullscreen.Value; stateBeforeFullscreen = null; // Never restore to HIDDEN; NONE re-activates the panel container without focus side-effects - VoiceChatPanelState restoreTo = previous is VoiceChatPanelState.NONE or VoiceChatPanelState.HIDDEN - ? VoiceChatPanelState.NONE - : VoiceChatPanelState.UNFOCUSED; + VoiceChatPanelState restoreTo = previous is VoiceChatPanelState.None or VoiceChatPanelState.Hidden + ? VoiceChatPanelState.None + : VoiceChatPanelState.Unfocused; voiceChatOrchestrator.ChangePanelState(restoreTo, force: true); clickDetectionHandler.Resume(); @@ -102,37 +102,37 @@ private void OnCallStatusChanged(VoiceChatStatus status) private void HandleChatPanelToggle(ChatSharedAreaEvents.ToggleChatPanelEvent evt) { - if (voiceChatOrchestrator.CurrentVoiceChatPanelState.Value is VoiceChatPanelState.HIDDEN) + if (voiceChatOrchestrator.CurrentVoiceChatPanelState.Value is VoiceChatPanelState.Hidden) { - voiceChatOrchestrator.ChangePanelState(VoiceChatPanelState.FOCUSED, force: true); + voiceChatOrchestrator.ChangePanelState(VoiceChatPanelState.Focused, force: true); clickDetectionHandler.Resume(); } } private void OnPointerExit() { - if (voiceChatPanelState.Value == VoiceChatPanelState.FOCUSED) - voiceChatOrchestrator.ChangePanelState(VoiceChatPanelState.UNFOCUSED); + if (voiceChatPanelState.Value == VoiceChatPanelState.Focused) + voiceChatOrchestrator.ChangePanelState(VoiceChatPanelState.Unfocused); } private void OnPointerEnter() { - if (voiceChatPanelState.Value == VoiceChatPanelState.UNFOCUSED) - voiceChatOrchestrator.ChangePanelState(VoiceChatPanelState.FOCUSED); + if (voiceChatPanelState.Value == VoiceChatPanelState.Unfocused) + voiceChatOrchestrator.ChangePanelState(VoiceChatPanelState.Focused); } private void HandleClickInside() { - if (voiceChatPanelState.Value == VoiceChatPanelState.SELECTED) return; + if (voiceChatPanelState.Value == VoiceChatPanelState.Selected) return; - voiceChatOrchestrator.ChangePanelState(VoiceChatPanelState.SELECTED); + voiceChatOrchestrator.ChangePanelState(VoiceChatPanelState.Selected); } private void HandleClickOutside() { - if (voiceChatPanelState.Value == VoiceChatPanelState.UNFOCUSED) return; + if (voiceChatPanelState.Value == VoiceChatPanelState.Unfocused) return; - voiceChatOrchestrator.ChangePanelState(VoiceChatPanelState.UNFOCUSED); + voiceChatOrchestrator.ChangePanelState(VoiceChatPanelState.Unfocused); } public void Dispose() diff --git a/Explorer/Assets/DCL/VoiceChat/UI/VoiceChatPanelResizePresenter.cs b/Explorer/Assets/DCL/VoiceChat/UI/VoiceChatPanelResizePresenter.cs index 738e93ef67a..1726002bc1a 100644 --- a/Explorer/Assets/DCL/VoiceChat/UI/VoiceChatPanelResizePresenter.cs +++ b/Explorer/Assets/DCL/VoiceChat/UI/VoiceChatPanelResizePresenter.cs @@ -33,7 +33,7 @@ public VoiceChatPanelResizePresenter(VoiceChatPanelResizeView view, IVoiceChatOr private void OnUpdateVoiceChatPanelState(VoiceChatPanelState state) { - if (state == VoiceChatPanelState.HIDDEN) + if (state == VoiceChatPanelState.Hidden) { view.gameObject.SetActive(false); return; @@ -41,18 +41,18 @@ private void OnUpdateVoiceChatPanelState(VoiceChatPanelState state) view.gameObject.SetActive(true); - if (voiceChatState.CurrentVoiceChatType.Value != VoiceChatType.COMMUNITY) return; + if (voiceChatState.CurrentVoiceChatType.Value != VoiceChatType.Community) return; - if (voiceChatState.CurrentVoiceChatPanelSize.Value == VoiceChatPanelSize.COLLAPSED) return; + if (voiceChatState.CurrentVoiceChatPanelSize.Value == VoiceChatPanelSize.Collapsed) return; CalculateExpandedCommunitiesLayoutHeight(voiceChatState.ParticipantsStateService.Speakers.Count); } private void OnSpeakersUpdated(int speakersAmount) { - if (voiceChatState.CurrentVoiceChatType.Value != VoiceChatType.COMMUNITY) return; + if (voiceChatState.CurrentVoiceChatType.Value != VoiceChatType.Community) return; - if (voiceChatState.CurrentVoiceChatPanelSize.Value == VoiceChatPanelSize.COLLAPSED) return; + if (voiceChatState.CurrentVoiceChatPanelSize.Value == VoiceChatPanelSize.Collapsed) return; CalculateExpandedCommunitiesLayoutHeight(speakersAmount); } @@ -61,20 +61,20 @@ private void CalculateExpandedCommunitiesLayoutHeight(int speakersAmount) { int newHeight = speakersAmount <= MAX_SPEAKERS_PER_LINE ? EXPANDED_COMMUNITY_VOICE_CHAT_1_LINE_SIZE : EXPANDED_COMMUNITY_VOICE_CHAT_2_LINES_SIZE; - view.Resize(newHeight - (voiceChatState.CurrentVoiceChatPanelState.Value == VoiceChatPanelState.UNFOCUSED? HIDDEN_BUTTONS_SIZE_DIFFERENCE : 0)); + view.Resize(newHeight - (voiceChatState.CurrentVoiceChatPanelState.Value == VoiceChatPanelState.Unfocused? HIDDEN_BUTTONS_SIZE_DIFFERENCE : 0)); } private void OnCurrentVoiceChatTypeChanged(VoiceChatType type) { switch (type) { - case VoiceChatType.PRIVATE: + case VoiceChatType.Private: view.Resize(COLLAPSED_PRIVATE_VOICE_CHAT_SIZE); break; - case VoiceChatType.COMMUNITY: + case VoiceChatType.Community: CalculateExpandedCommunitiesLayoutHeight(voiceChatState.ParticipantsStateService.Speakers.Count); break; - case VoiceChatType.NONE: + case VoiceChatType.None: default: view.Resize(DEFAULT_VOICE_CHAT_SIZE); break; @@ -85,17 +85,17 @@ private void OnUpdateVoiceChatPanelSize(VoiceChatPanelSize chatPanelSize) { switch (voiceChatState.CurrentVoiceChatType.Value) { - case VoiceChatType.NONE: + case VoiceChatType.None: view.Resize(DEFAULT_VOICE_CHAT_SIZE); break; - case VoiceChatType.PRIVATE: + case VoiceChatType.Private: view.gameObject.SetActive(true); view.Resize(COLLAPSED_PRIVATE_VOICE_CHAT_SIZE); break; - case VoiceChatType.COMMUNITY: + case VoiceChatType.Community: switch (chatPanelSize) { - case VoiceChatPanelSize.EXPANDED: + case VoiceChatPanelSize.Expanded: view.gameObject.SetActive(true); CalculateExpandedCommunitiesLayoutHeight(voiceChatState.ParticipantsStateService.Speakers.Count); break; diff --git a/Explorer/Assets/DCL/VoiceChat/VoiceChatContainer.cs b/Explorer/Assets/DCL/VoiceChat/VoiceChatContainer.cs index 422a9fd02d2..b77cdd845d6 100644 --- a/Explorer/Assets/DCL/VoiceChat/VoiceChatContainer.cs +++ b/Explorer/Assets/DCL/VoiceChat/VoiceChatContainer.cs @@ -48,14 +48,14 @@ public VoiceChatContainer( ICommunityDataService communityDataService) { rpcPrivateVoiceChatService = new RPCPrivateVoiceChatService(socialServiceRPC, socialServiceEventBus, identityCache); - privateVoiceChatCallStatusService = FeaturesRegistry.Instance.IsEnabled(FeatureId.VOICE_CHAT) + privateVoiceChatCallStatusService = FeaturesRegistry.Instance.IsEnabled(FeatureId.VoiceChat) ? new PrivateVoiceChatCallStatusService(rpcPrivateVoiceChatService) : new PrivateVoiceChatCallStatusServiceNull(); participantsStateService = new VoiceChatParticipantsStateService(roomHub.VoiceChatRoom().Room(), identityCache); rpcCommunityVoiceChatService = new RPCCommunityVoiceChatService(socialServiceRPC, socialServiceEventBus, webRequestController, urlsSource, identityCache); sceneVoiceChatTrackerService = new SceneVoiceChatTrackerService(scenesCache, realmNavigator, realmData); - communityVoiceChatCallStatusService = FeaturesRegistry.Instance.IsEnabled(FeatureId.COMMUNITY_VOICE_CHAT) + communityVoiceChatCallStatusService = FeaturesRegistry.Instance.IsEnabled(FeatureId.CommunityVoiceChat) ? new CommunityVoiceChatCallStatusService(rpcCommunityVoiceChatService, sceneVoiceChatTrackerService) : new CommunityVoiceChatCallStatusServiceNull(); VoiceChatOrchestrator = new VoiceChatOrchestrator( privateVoiceChatCallStatusService, @@ -67,13 +67,13 @@ public VoiceChatContainer( JoinedCommunitiesVoiceLiveTracker = new JoinedCommunitiesVoiceLiveTracker(VoiceChatOrchestrator, communityDataService); - NearbyMuteService = FeaturesRegistry.Instance.IsEnabled(FeatureId.NEARBY_VOICE_CHAT) + NearbyMuteService = FeaturesRegistry.Instance.IsEnabled(FeatureId.NearbyVoiceChat) ? new NearbyMuteService( new NearbyMuteCache(), new RestNearbyMuteRepository(webRequestController, urlsSource)) : null; - NearbyStateModel = FeaturesRegistry.Instance.IsEnabled(FeatureId.NEARBY_VOICE_CHAT) + NearbyStateModel = FeaturesRegistry.Instance.IsEnabled(FeatureId.NearbyVoiceChat) ? new NearbyVoiceChatStateModel( DCLPlayerPrefs.GetBool(DCLPrefKeys.NEARBY_VOICE_CHAT_DISABLED) ? NearbyVoiceChatState.Disabled diff --git a/Explorer/Assets/DCL/Web3/Authenticators/Exceptions/DeeplinkSigninRetrievalException.cs b/Explorer/Assets/DCL/Web3/Authenticators/Exceptions/DeeplinkSigninRetrievalException.cs index eb8b22d7350..3882af49042 100644 --- a/Explorer/Assets/DCL/Web3/Authenticators/Exceptions/DeeplinkSigninRetrievalException.cs +++ b/Explorer/Assets/DCL/Web3/Authenticators/Exceptions/DeeplinkSigninRetrievalException.cs @@ -9,13 +9,13 @@ public class DeeplinkSigninRetrievalException : Web3Exception public enum ErrorReason { /// 404: the identity does not exist or has already been retrieved (identities are single-use). - NOT_FOUND, + NotFound, /// 410: the identity expired before retrieval (server-side TTL is 15 minutes). - EXPIRED, + Expired, /// 403: the retrieval came from a different IP than the one that stored the identity (commonly a VPN or private relay). - IP_MISMATCH, + IpMismatch, } public ErrorReason Reason { get; } @@ -29,9 +29,9 @@ public DeeplinkSigninRetrievalException(ErrorReason reason, string identityId) private static string MessageFor(ErrorReason reason, string identityId) => reason switch { - ErrorReason.NOT_FOUND => $"Signin identity {identityId} was not found or was already retrieved", - ErrorReason.EXPIRED => $"Signin identity {identityId} expired before it was retrieved", - ErrorReason.IP_MISMATCH => $"Signin identity {identityId} was stored from a different IP: a VPN or private relay is likely interfering", + ErrorReason.NotFound => $"Signin identity {identityId} was not found or was already retrieved", + ErrorReason.Expired => $"Signin identity {identityId} expired before it was retrieved", + ErrorReason.IpMismatch => $"Signin identity {identityId} was stored from a different IP: a VPN or private relay is likely interfering", _ => $"Signin identity {identityId} retrieval failed: {reason}", }; } diff --git a/Explorer/Assets/DCL/Web3/Authenticators/Implementations/CompositeWeb3Provider.cs b/Explorer/Assets/DCL/Web3/Authenticators/Implementations/CompositeWeb3Provider.cs index 6c9856791f9..74214f3613c 100644 --- a/Explorer/Assets/DCL/Web3/Authenticators/Implementations/CompositeWeb3Provider.cs +++ b/Explorer/Assets/DCL/Web3/Authenticators/Implementations/CompositeWeb3Provider.cs @@ -111,7 +111,7 @@ public UniTask TryAutoLoginAsync(CancellationToken ct) return thirdWebAuth.TryAutoLoginAsync(ct); } - bool OtpIsDisabled() => !FeaturesRegistry.Instance.IsEnabled(FeatureId.EMAIL_OTP_AUTH); + bool OtpIsDisabled() => !FeaturesRegistry.Instance.IsEnabled(FeatureId.EmailOTPAuth); } // IEthereumApi diff --git a/Explorer/Assets/DCL/Web3/Authenticators/Implementations/Dapp/DappDeepLinkAuthenticator.cs b/Explorer/Assets/DCL/Web3/Authenticators/Implementations/Dapp/DappDeepLinkAuthenticator.cs index 4c184abc351..3a12df28e8c 100644 --- a/Explorer/Assets/DCL/Web3/Authenticators/Implementations/Dapp/DappDeepLinkAuthenticator.cs +++ b/Explorer/Assets/DCL/Web3/Authenticators/Implementations/Dapp/DappDeepLinkAuthenticator.cs @@ -131,9 +131,9 @@ private async UniTask FetchIdentityByIdAsync(string identi .CreateFromNewtonsoftJsonAsync() .WithCustomExceptionAsync(e => e.ResponseCode switch { - 404 => new DeeplinkSigninRetrievalException(DeeplinkSigninRetrievalException.ErrorReason.NOT_FOUND, identityId), - 410 => new DeeplinkSigninRetrievalException(DeeplinkSigninRetrievalException.ErrorReason.EXPIRED, identityId), - 403 => new DeeplinkSigninRetrievalException(DeeplinkSigninRetrievalException.ErrorReason.IP_MISMATCH, identityId), + 404 => new DeeplinkSigninRetrievalException(DeeplinkSigninRetrievalException.ErrorReason.NotFound, identityId), + 410 => new DeeplinkSigninRetrievalException(DeeplinkSigninRetrievalException.ErrorReason.Expired, identityId), + 403 => new DeeplinkSigninRetrievalException(DeeplinkSigninRetrievalException.ErrorReason.IpMismatch, identityId), _ => e, }); @@ -166,7 +166,7 @@ private async UniTask FetchIdentityByIdAsync(string identi DateTime expiration = DateTime.Parse(json.identity.expiration, null, DateTimeStyles.RoundtripKind); - return new DecentralandIdentity(new Web3Address(signerAddress), ephemeralAccount, expiration, authChain, IWeb3Identity.Web3IdentitySource.DEEPLINK); + return new DecentralandIdentity(new Web3Address(signerAddress), ephemeralAccount, expiration, authChain, IWeb3Identity.Web3IdentitySource.Deeplink); } // Field names mirror the auth server's JSON payloads verbatim, so they intentionally break the naming rules. diff --git a/Explorer/Assets/DCL/Web3/Authenticators/Implementations/Dapp/DappWeb3EthereumApi.cs b/Explorer/Assets/DCL/Web3/Authenticators/Implementations/Dapp/DappWeb3EthereumApi.cs index 3f147bcda02..3ed12c72b1b 100644 --- a/Explorer/Assets/DCL/Web3/Authenticators/Implementations/Dapp/DappWeb3EthereumApi.cs +++ b/Explorer/Assets/DCL/Web3/Authenticators/Implementations/Dapp/DappWeb3EthereumApi.cs @@ -79,7 +79,7 @@ public void Dispose() } public UniTask SendAsync(EthApiRequest request, CancellationToken ct) => - SendAsync(request, Web3RequestSource.SDKScene, ct); + SendAsync(request, Web3RequestSource.SdkScene, ct); public async UniTask SendAsync(EthApiRequest request, Web3RequestSource source, CancellationToken ct) { @@ -191,7 +191,7 @@ private async UniTask LoginAsync(LoginPayload payload, Cancellati // To keep cohesiveness between the platform, convert the user address to lower case return new DecentralandIdentity(new Web3Address(response.sender), - ephemeralAccount, sessionExpiration, authChain, IWeb3Identity.Web3IdentitySource.DAPP); + ephemeralAccount, sessionExpiration, authChain, IWeb3Identity.Web3IdentitySource.Dapp); } catch (Exception) { diff --git a/Explorer/Assets/DCL/Web3/Authenticators/Implementations/PrivateKeyAuthenticator.cs b/Explorer/Assets/DCL/Web3/Authenticators/Implementations/PrivateKeyAuthenticator.cs index 9594ef1e261..40a0333c38a 100644 --- a/Explorer/Assets/DCL/Web3/Authenticators/Implementations/PrivateKeyAuthenticator.cs +++ b/Explorer/Assets/DCL/Web3/Authenticators/Implementations/PrivateKeyAuthenticator.cs @@ -34,7 +34,7 @@ public void Dispose() { } public bool IsExpired => false; public AuthChain AuthChain { get; } - public IWeb3Identity.Web3IdentitySource Source { get; set; } = IWeb3Identity.Web3IdentitySource.NONE; + public IWeb3Identity.Web3IdentitySource Source { get; set; } = IWeb3Identity.Web3IdentitySource.None; public AuthChain Sign(string entityId) { diff --git a/Explorer/Assets/DCL/Web3/Authenticators/Implementations/RandomGeneratedWeb3Authenticator.cs b/Explorer/Assets/DCL/Web3/Authenticators/Implementations/RandomGeneratedWeb3Authenticator.cs index 2fb637fba6c..4beec1ca5ee 100644 --- a/Explorer/Assets/DCL/Web3/Authenticators/Implementations/RandomGeneratedWeb3Authenticator.cs +++ b/Explorer/Assets/DCL/Web3/Authenticators/Implementations/RandomGeneratedWeb3Authenticator.cs @@ -45,7 +45,7 @@ public UniTask LoginAsync(LoginPayload payload, CancellationToken ephemeralAccount, expiration, authChain, - IWeb3Identity.Web3IdentitySource.NONE + IWeb3Identity.Web3IdentitySource.None ).AsUniTaskResult(); } diff --git a/Explorer/Assets/DCL/Web3/Authenticators/Implementations/TokenFileAuthenticator.cs b/Explorer/Assets/DCL/Web3/Authenticators/Implementations/TokenFileAuthenticator.cs index b14af50a27c..7f3e9f933b8 100644 --- a/Explorer/Assets/DCL/Web3/Authenticators/Implementations/TokenFileAuthenticator.cs +++ b/Explorer/Assets/DCL/Web3/Authenticators/Implementations/TokenFileAuthenticator.cs @@ -93,7 +93,7 @@ private async UniTask LoginAsync(CancellationToken ct) DateTime expiration = DateTime.Parse(json.identity.expiration, null, DateTimeStyles.RoundtripKind); return new DecentralandIdentity(new Web3Address(address), ephemeralAccount, expiration, authChain, - IWeb3Identity.Web3IdentitySource.TOKEN_FILE); + IWeb3Identity.Web3IdentitySource.TokenFile); } public UniTask RequestTransferAsync(string giftUrn, string recipientAddress, CancellationToken ct) diff --git a/Explorer/Assets/DCL/Web3/Identities/IWeb3Identity.cs b/Explorer/Assets/DCL/Web3/Identities/IWeb3Identity.cs index 21aa395d288..ae9d63bf04b 100644 --- a/Explorer/Assets/DCL/Web3/Identities/IWeb3Identity.cs +++ b/Explorer/Assets/DCL/Web3/Identities/IWeb3Identity.cs @@ -18,12 +18,12 @@ public interface IWeb3Identity : IDisposable enum Web3IdentitySource { - NONE, - CACHED, - TOKEN_FILE, - DAPP, + None, + Cached, + TokenFile, + Dapp, OTP, - DEEPLINK, + Deeplink, } class Random : IWeb3Identity @@ -56,7 +56,7 @@ private Random(Web3Address address, DateTime expiration, IWeb3Account ephemeralA public IWeb3Account EphemeralAccount { get; } public bool IsExpired { get; } public AuthChain AuthChain { get; } - public Web3IdentitySource Source { get; set; } = Web3IdentitySource.NONE; + public Web3IdentitySource Source { get; set; } = Web3IdentitySource.None; public AuthChain Sign(string entityId) => throw new Exception("RandomIdentity cannot sign anything"); diff --git a/Explorer/Assets/DCL/Web3/Identities/PlayerPrefsIdentityProvider.DecentralandIdentityWithNethereumAccountJsonSerializer.cs b/Explorer/Assets/DCL/Web3/Identities/PlayerPrefsIdentityProvider.DecentralandIdentityWithNethereumAccountJsonSerializer.cs index 6809bf73594..6a48a08ae53 100644 --- a/Explorer/Assets/DCL/Web3/Identities/PlayerPrefsIdentityProvider.DecentralandIdentityWithNethereumAccountJsonSerializer.cs +++ b/Explorer/Assets/DCL/Web3/Identities/PlayerPrefsIdentityProvider.DecentralandIdentityWithNethereumAccountJsonSerializer.cs @@ -35,7 +35,7 @@ public DecentralandIdentityWithNethereumAccountJsonSerializer(IWeb3AccountFactor accountFactory.CreateAccount(new EthECKey(jsonRoot.key)), DateTime.Parse(jsonRoot.expiration, null, DateTimeStyles.RoundtripKind), authChain, - IWeb3Identity.Web3IdentitySource.CACHED); + IWeb3Identity.Web3IdentitySource.Cached); } public string Serialize(IWeb3Identity identity) diff --git a/Explorer/Assets/DCL/Web3/RestrictedEthereumApi.cs b/Explorer/Assets/DCL/Web3/RestrictedEthereumApi.cs index 21c71fd4be0..b72c20b7c8b 100644 --- a/Explorer/Assets/DCL/Web3/RestrictedEthereumApi.cs +++ b/Explorer/Assets/DCL/Web3/RestrictedEthereumApi.cs @@ -16,7 +16,7 @@ public RestrictedEthereumApi(IEthereumApi impl, IJsApiPermissionsProvider jsApiP } public UniTask SendAsync(EthApiRequest request, CancellationToken ct) => - SendAsync(request, Web3RequestSource.SDKScene, ct); + SendAsync(request, Web3RequestSource.SdkScene, ct); public UniTask SendAsync(EthApiRequest request, Web3RequestSource source, CancellationToken ct) { diff --git a/Explorer/Assets/DCL/Web3/Web3RequestSource.cs b/Explorer/Assets/DCL/Web3/Web3RequestSource.cs index f0ad29eebe2..f4a71e14067 100644 --- a/Explorer/Assets/DCL/Web3/Web3RequestSource.cs +++ b/Explorer/Assets/DCL/Web3/Web3RequestSource.cs @@ -8,7 +8,7 @@ public enum Web3RequestSource /// /// Request comes from an SDK scene (external). /// - SDKScene, + SdkScene, /// /// Request comes from internal Explorer features (Gifting, Donations, etc.). diff --git a/Explorer/Assets/DCL/WebRequests/Dumper/EnvelopeJsonConverter.cs b/Explorer/Assets/DCL/WebRequests/Dumper/EnvelopeJsonConverter.cs index ca13121187b..2ca105fa3c1 100644 --- a/Explorer/Assets/DCL/WebRequests/Dumper/EnvelopeJsonConverter.cs +++ b/Explorer/Assets/DCL/WebRequests/Dumper/EnvelopeJsonConverter.cs @@ -66,7 +66,7 @@ public override void WriteJson(JsonWriter writer, WebRequestDump.Envelope? value WebRequestHeadersInfo? headersInfo = null; DateTime startTime = DateTime.MinValue; DateTime endTime = DateTime.MinValue; - WebRequestDump.Envelope.StatusKind statusKind = WebRequestDump.Envelope.StatusKind.NOT_CONCLUDED; + WebRequestDump.Envelope.StatusKind statusKind = WebRequestDump.Envelope.StatusKind.NotConcluded; // First pass: read argsType to know how to deserialize args while (reader.Read() && reader.TokenType != JsonToken.EndObject) diff --git a/Explorer/Assets/DCL/WebRequests/Dumper/GenericPostArgumentsJsonConverter.cs b/Explorer/Assets/DCL/WebRequests/Dumper/GenericPostArgumentsJsonConverter.cs index ad4e141cf7b..4cc13f2de8e 100644 --- a/Explorer/Assets/DCL/WebRequests/Dumper/GenericPostArgumentsJsonConverter.cs +++ b/Explorer/Assets/DCL/WebRequests/Dumper/GenericPostArgumentsJsonConverter.cs @@ -11,9 +11,9 @@ public class GenericPostArgumentsJsonConverter : JsonConverter true; @@ -26,7 +26,7 @@ public override void WriteJson(JsonWriter writer, GenericPostArguments value, Js { writer.WriteStartObject(); writer.WritePropertyName("kind"); - writer.WriteValue((int)Kind.MULTI_FORM); + writer.WriteValue((int)Kind.MultiForm); writer.WriteStartArray(); foreach (IMultipartFormSection? section in value.MultipartFormSections) @@ -46,7 +46,7 @@ public override void WriteJson(JsonWriter writer, GenericPostArguments value, Js { writer.WriteStartObject(); writer.WritePropertyName("kind"); - writer.WriteValue((int)Kind.WWW_FORM); + writer.WriteValue((int)Kind.WwwForm); // TODO support @@ -58,7 +58,7 @@ public override void WriteJson(JsonWriter writer, GenericPostArguments value, Js writer.WriteStartObject(); writer.WritePropertyName("kind"); - writer.WriteValue((int)Kind.RAW); + writer.WriteValue((int)Kind.Raw); writer.WritePropertyName("postData"); if (value.UploadHandler != null) @@ -82,7 +82,7 @@ public override GenericPostArguments ReadJson(JsonReader reader, Type objectType switch (kind) { - case Kind.RAW: + case Kind.Raw: reader.Read(); // Read property name "postData" string postData = reader.ReadAsString() ?? string.Empty; reader.Read(); // Read property name "contentType" @@ -90,12 +90,12 @@ public override GenericPostArguments ReadJson(JsonReader reader, Type objectType reader.Read(); // End object return GenericPostArguments.Create(postData, contentType); - case Kind.WWW_FORM: + case Kind.WwwForm: // TODO: implement WWWForm deserialization when WriteJson is completed reader.Read(); // End object throw new NotImplementedException("WWWForm deserialization is not yet supported"); - case Kind.MULTI_FORM: + case Kind.MultiForm: reader.Read(); // Start array var sections = new List(); diff --git a/Explorer/Assets/DCL/WebRequests/Dumper/WebRequestDumpAnalyticsHandler.cs b/Explorer/Assets/DCL/WebRequests/Dumper/WebRequestDumpAnalyticsHandler.cs index ce179394765..ef68431c8e6 100644 --- a/Explorer/Assets/DCL/WebRequests/Dumper/WebRequestDumpAnalyticsHandler.cs +++ b/Explorer/Assets/DCL/WebRequests/Dumper/WebRequestDumpAnalyticsHandler.cs @@ -98,7 +98,7 @@ public void OnRequestFinished(T request, TimeSpan duration) where T: ITypedWe flat.OnRequestEnded(request, duration); if (dumpEnvelopes.Remove(request.UnityWebRequest, out WebRequestDump.Envelope? dumpEnvelope)) - dumpEnvelope.Conclude(WebRequestDump.Envelope.StatusKind.SUCCESS, DateTime.Now); + dumpEnvelope.Conclude(WebRequestDump.Envelope.StatusKind.Success, DateTime.Now); } public void OnProcessDataFinished(T request) where T: ITypedWebRequest { } @@ -106,13 +106,13 @@ public void OnProcessDataFinished(T request) where T: ITypedWebRequest { } public void OnException(T request, Exception exception, TimeSpan duration) where T: ITypedWebRequest { if (dumpEnvelopes.Remove(request.UnityWebRequest, out WebRequestDump.Envelope? dumpEnvelope)) - dumpEnvelope.Conclude(WebRequestDump.Envelope.StatusKind.FAILURE, DateTime.Now); + dumpEnvelope.Conclude(WebRequestDump.Envelope.StatusKind.Failure, DateTime.Now); } public void OnException(T request, UnityWebRequestException exception, TimeSpan duration) where T: ITypedWebRequest { if (dumpEnvelopes.Remove(request.UnityWebRequest, out WebRequestDump.Envelope? dumpEnvelope)) - dumpEnvelope.Conclude(WebRequestDump.Envelope.StatusKind.FAILURE, DateTime.Now); + dumpEnvelope.Conclude(WebRequestDump.Envelope.StatusKind.Failure, DateTime.Now); } } } diff --git a/Explorer/Assets/DCL/WebRequests/Dumper/WebRequestsDumper.cs b/Explorer/Assets/DCL/WebRequests/Dumper/WebRequestsDumper.cs index 9e876873469..6fda8230334 100644 --- a/Explorer/Assets/DCL/WebRequests/Dumper/WebRequestsDumper.cs +++ b/Explorer/Assets/DCL/WebRequests/Dumper/WebRequestsDumper.cs @@ -142,9 +142,9 @@ public class Envelope public enum StatusKind { // Request is either not sent due to budgeting or is still processing - NOT_CONCLUDED = 0, - FAILURE = 1, - SUCCESS = 2, + NotConcluded = 0, + Failure = 1, + Success = 2, } public readonly object Args; @@ -176,7 +176,7 @@ internal Envelope(Type requestType, CommonArguments commonArguments, Type argsTy Args = args; HeadersInfo = headersInfo; RequestType = requestType; - Status = StatusKind.NOT_CONCLUDED; + Status = StatusKind.NotConcluded; StartTime = startTime; EffectiveUrl = effectiveUrl; } diff --git a/Explorer/Assets/DCL/WebRequests/RetryPolicy.cs b/Explorer/Assets/DCL/WebRequests/RetryPolicy.cs index 6702ccd3067..69cbbbeeb67 100644 --- a/Explorer/Assets/DCL/WebRequests/RetryPolicy.cs +++ b/Explorer/Assets/DCL/WebRequests/RetryPolicy.cs @@ -18,17 +18,17 @@ public enum Strictness : byte /// /// Repetitions can follow the default rules /// - NONE = 0, + None = 0, /// /// Repetitions can only be done if the server explicitly requires it /// - RETRY_AFTER_REQUIRED = 1, + RetryAfterRequired = 1, /// /// Repetitions are manually enforced /// - ENFORCED = 2, + Enforced = 2, } public const int MAX_RETRIES_COUNT = 2; @@ -39,11 +39,11 @@ public enum Strictness : byte public const int BACKOFF_MULTIPLIER = 3; - public static readonly RetryPolicy NONE = new (0, Strictness.NONE); + public static readonly RetryPolicy NONE = new (0, Strictness.None); - public static readonly RetryPolicy DEFAULT = new (MAX_RETRIES_COUNT, Strictness.NONE); + public static readonly RetryPolicy DEFAULT = new (MAX_RETRIES_COUNT, Strictness.None); - public static readonly RetryPolicy HEADER_REQUIRED = new (MAX_RETRIES_COUNT, Strictness.RETRY_AFTER_REQUIRED); + public static readonly RetryPolicy HEADER_REQUIRED = new (MAX_RETRIES_COUNT, Strictness.RetryAfterRequired); internal readonly int minDelayBetweenAttemptsMs; internal readonly int backoffMultiplier; @@ -66,10 +66,10 @@ private RetryPolicy(int maxRetriesCount, Strictness strictness, int minDelayBetw /// /// public static RetryPolicy Enforce(int retriesCount = MAX_RETRIES_COUNT, int minDelayBetweenAttemptsMs = MIN_DELAY_BETWEEN_ATTEMPTS_MS, int backoffMultiplier = BACKOFF_MULTIPLIER, ISet? forceRecoverableCodes = null) => - new (retriesCount, Strictness.ENFORCED, minDelayBetweenAttemptsMs, backoffMultiplier, forceRecoverableCodes); + new (retriesCount, Strictness.Enforced, minDelayBetweenAttemptsMs, backoffMultiplier, forceRecoverableCodes); public static RetryPolicy WithRetries(int retriesCount, int minDelayBetweenAttemptsMs = MIN_DELAY_BETWEEN_ATTEMPTS_MS, int backoffMultiplier = BACKOFF_MULTIPLIER, ISet? forceRecoverableCodes = null) => - new (retriesCount, Strictness.NONE, minDelayBetweenAttemptsMs, backoffMultiplier, forceRecoverableCodes); + new (retriesCount, Strictness.None, minDelayBetweenAttemptsMs, backoffMultiplier, forceRecoverableCodes); public override string ToString() => $"MaxRetriesCount={maxRetriesCount}, Strictness={strictness}, MinDelayBetweenAttemptsMs={minDelayBetweenAttemptsMs}, BackoffMultiplier={backoffMultiplier}"; diff --git a/Explorer/Assets/DCL/WebRequests/WebRequestUtils.cs b/Explorer/Assets/DCL/WebRequests/WebRequestUtils.cs index db79b550bc5..0e8b29b71c2 100644 --- a/Explorer/Assets/DCL/WebRequests/WebRequestUtils.cs +++ b/Explorer/Assets/DCL/WebRequests/WebRequestUtils.cs @@ -38,7 +38,7 @@ public static (bool canBeRepeated, TimeSpan retryDelay) CanBeRepeated(int attemp return (false, TimeSpan.Zero); // Unless repetitions are enforced, non-idempotent requests should not be retried - if (!idempotent && retryPolicy.strictness != RetryPolicy.Strictness.ENFORCED) + if (!idempotent && retryPolicy.strictness != RetryPolicy.Strictness.Enforced) return (false, TimeSpan.Zero); // Handle "Retry-After" header. Applicable for 429 Too Many Requests and 503 Service Unavailable @@ -85,7 +85,7 @@ public static (bool canBeRepeated, TimeSpan retryDelay) CanBeRepeated(int attemp return (true, retryDelay); } - if (retryPolicy.strictness == RetryPolicy.Strictness.RETRY_AFTER_REQUIRED) + if (retryPolicy.strictness == RetryPolicy.Strictness.RetryAfterRequired) // If default policy is not applied, return immediately return (false, TimeSpan.Zero); diff --git a/Explorer/Assets/Protocol/DecentralandProtocol/CommsApi.gen.cs b/Explorer/Assets/Protocol/DecentralandProtocol/CommsApi.gen.cs index 6f5039149b4..db79a158959 100644 --- a/Explorer/Assets/Protocol/DecentralandProtocol/CommsApi.gen.cs +++ b/Explorer/Assets/Protocol/DecentralandProtocol/CommsApi.gen.cs @@ -80,9 +80,9 @@ static CommsApiReflection() { } #region Enums public enum VideoTrackSourceType { - [pbr::OriginalName("VTST_UNKNOWN")] VtstUnknown = 0, - [pbr::OriginalName("VTST_CAMERA")] VtstCamera = 1, - [pbr::OriginalName("VTST_SCREEN_SHARE")] VtstScreenShare = 2, + [pbr::OriginalName("VtstUnknown")] VtstUnknown = 0, + [pbr::OriginalName("VtstCamera")] VtstCamera = 1, + [pbr::OriginalName("VtstScreenShare")] VtstScreenShare = 2, } #endregion diff --git a/Explorer/Assets/Protocol/DecentralandProtocol/SocialServiceV2.gen.cs b/Explorer/Assets/Protocol/DecentralandProtocol/SocialServiceV2.gen.cs index 70abcb629fc..a4f53d7d0f4 100644 --- a/Explorer/Assets/Protocol/DecentralandProtocol/SocialServiceV2.gen.cs +++ b/Explorer/Assets/Protocol/DecentralandProtocol/SocialServiceV2.gen.cs @@ -609,15 +609,15 @@ public enum ConnectivityStatus { } public enum FriendshipStatus { - [pbr::OriginalName("REQUEST_SENT")] RequestSent = 0, - [pbr::OriginalName("REQUEST_RECEIVED")] RequestReceived = 1, + [pbr::OriginalName("RequestSent")] RequestSent = 0, + [pbr::OriginalName("RequestReceived")] RequestReceived = 1, [pbr::OriginalName("CANCELED")] Canceled = 2, [pbr::OriginalName("ACCEPTED")] Accepted = 3, [pbr::OriginalName("REJECTED")] Rejected = 4, [pbr::OriginalName("DELETED")] Deleted = 5, - [pbr::OriginalName("BLOCKED")] Blocked = 6, - [pbr::OriginalName("NONE")] None = 7, - [pbr::OriginalName("BLOCKED_BY")] BlockedBy = 8, + [pbr::OriginalName("Blocked")] Blocked = 6, + [pbr::OriginalName("None")] None = 7, + [pbr::OriginalName("BlockedBy")] BlockedBy = 8, } public enum PrivateMessagePrivacySetting { From c977e57427142db804d69b877b167542dc53dd1e Mon Sep 17 00:00:00 2001 From: Vitaly Popuzin Date: Fri, 24 Jul 2026 13:34:15 +0200 Subject: [PATCH 6/8] ci: refresh lint PR comment on every run + status banners Post a Pending banner when Unity Test starts and always upsert the warning-ratchet comment on completion (Passed / Blocked / Skipped / Unavailable), so a failed or lint-skipped run no longer leaves a stale banner. Mirrors the build comment's shields.io badge style. --- .github/workflows/pr-comment-warnings.yml | 142 +++++++++++++++++----- 1 file changed, 113 insertions(+), 29 deletions(-) diff --git a/.github/workflows/pr-comment-warnings.yml b/.github/workflows/pr-comment-warnings.yml index 8df51429544..7f847aa8c04 100644 --- a/.github/workflows/pr-comment-warnings.yml +++ b/.github/workflows/pr-comment-warnings.yml @@ -2,12 +2,19 @@ --- name: Comment Warning Ratchet on PR -# Runs in the trusted base-repo context after the (possibly fork) "Unity Test" -# run completes, so it can comment with write permissions without exposing them -# to the untrusted lint job. Mirrors pr-comment-artifact-url.yml. +# Runs in the trusted base-repo context alongside the (possibly fork) "Unity Test" +# workflow, so it can comment with write permissions without exposing them to the +# untrusted lint job. Mirrors pr-comment-artifact-url.yml. +# +# 'requested' -> post a "Lint pending" banner the moment Unity Test starts, so a +# stale Passed/Blocked banner from a previous run never lingers. +# 'completed' -> ALWAYS refresh the banner: Passed / Blocked / Skipped (no C# +# changes) / Unavailable (lint did not finish). Keyed on the hidden +# marker so every state edits the same comment. on: workflow_run: types: + - "requested" - "completed" workflows: - "Unity Test" @@ -18,7 +25,50 @@ permissions: pull-requests: write jobs: + pending: + if: github.event.action == 'requested' && github.event.workflow_run.event == 'pull_request' + runs-on: ubuntu-latest + steps: + - name: Resolve PR number + id: pr + env: + WORKFLOW_RUN_EVENT_OBJ: ${{ toJSON(github.event.workflow_run) }} + run: | + PR_NUMBER=$(jq -r '.pull_requests[0].number' <<< "$WORKFLOW_RUN_EVENT_OBJ") + echo "PR number: $PR_NUMBER" + if [[ -z "$PR_NUMBER" || "$PR_NUMBER" == "null" ]]; then + echo "No PR associated with this run, skipping." + echo "pr-number=" >> "$GITHUB_OUTPUT" + else + echo "pr-number=$PR_NUMBER" >> "$GITHUB_OUTPUT" + fi + + - name: Find existing comment + if: steps.pr.outputs.pr-number != '' + uses: peter-evans/find-comment@v2 + id: find-comment + with: + issue-number: ${{ steps.pr.outputs.pr-number }} + comment-author: 'github-actions[bot]' + body-includes: '' + + - name: Upsert pending banner + if: steps.pr.outputs.pr-number != '' + uses: peter-evans/create-or-update-comment@v3 + with: + issue-number: ${{ steps.pr.outputs.pr-number }} + comment-id: ${{ steps.find-comment.outputs.comment-id }} + edit-mode: replace + body: |- + + ![badge] + + Lint in progress, come back later! + + [badge]: https://img.shields.io/badge/Lint-Pending!-ffff00?logo=github&style=for-the-badge + comment: + if: github.event.action == 'completed' runs-on: ubuntu-latest steps: - name: Resolve PR number @@ -50,7 +100,7 @@ jobs: id: result run: | if [ ! -f warning-result.json ]; then - echo "No warning-result.json found, skipping." + echo "No warning-result.json found, treating as absent." echo "found=false" >> "$GITHUB_OUTPUT" exit 0 fi @@ -62,52 +112,86 @@ jobs: echo "baseline=$baseline" >> "$GITHUB_OUTPUT" echo "allow-equal=$allow_equal" >> "$GITHUB_OUTPUT" + # Always compose a body, even when the artifact is absent (lint skipped or the + # Unity Test run failed before counting), so the banner never goes stale. - name: Compose comment body - if: steps.result.outputs.found == 'true' + if: steps.pr.outputs.pr-number != '' id: body env: + FOUND: ${{ steps.result.outputs.found }} COUNT: ${{ steps.result.outputs.count }} BASELINE: ${{ steps.result.outputs.baseline }} ALLOW_EQUAL: ${{ steps.result.outputs.allow-equal }} + CONCLUSION: ${{ github.event.workflow_run.conclusion }} + RUN_URL: ${{ github.event.workflow_run.html_url }} run: | DELIM="EOF_$(uuidgen)" - { - echo "body<<$DELIM" - echo "" - blocked=false + LOGO='' + BADGE_STYLE="?logo=github&style=for-the-badge" + DETAILS="" + + if [ "$FOUND" != "true" ]; then + if [ "$CONCLUSION" = "success" ]; then + BADGE="https://img.shields.io/badge/Lint-Skipped-lightgrey${BADGE_STYLE}" + MSG="No C# files changed — lint ratchet skipped." + elif [ "$CONCLUSION" = "skipped" ]; then + BADGE="https://img.shields.io/badge/Lint-Skipped-lightgrey${BADGE_STYLE}" + MSG="Lint ratchet not evaluated for this run." + else + BADGE="https://img.shields.io/badge/Lint-Unavailable-ff0000${BADGE_STYLE}" + MSG="Lint did not finish (\`${CONCLUSION}\`) — the warning ratchet could not be evaluated. [See logs](${RUN_URL})." + fi + else if [ -z "$BASELINE" ]; then - echo "**Warnings counted: $COUNT** (no baseline established yet)" + MSG="**Warnings counted: $COUNT** (no baseline established yet)" + BADGE="https://img.shields.io/badge/Lint-Passed!-3fb950${BADGE_STYLE}" elif [ "$COUNT" -lt "$BASELINE" ]; then - echo "**Warnings count reduced: $BASELINE => $COUNT**" + MSG="**Warnings count reduced: $BASELINE => $COUNT**" + BADGE="https://img.shields.io/badge/Lint-Passed!-3fb950${BADGE_STYLE}" elif [ "$ALLOW_EQUAL" = "true" ] && [ "$COUNT" -eq "$BASELINE" ]; then - echo "**Warnings unchanged: $BASELINE => $COUNT** — allowed on release/hotfix branches." + MSG="**Warnings unchanged: $BASELINE => $COUNT** — allowed on release/hotfix branches." + BADGE="https://img.shields.io/badge/Lint-Passed!-3fb950${BADGE_STYLE}" else - echo "**Warnings not reduced: $BASELINE => $COUNT** — remove at least one warning to merge." - blocked=true + MSG="**Warnings not reduced: $BASELINE => $COUNT** — remove at least one warning to merge." + BADGE="https://img.shields.io/badge/Lint-Blocked!-ff0000${BADGE_STYLE}" fi - # Always list the warnings/errors in files this PR changed, collapsed by default. + # List the warnings/errors in files this PR changed, collapsed by default. total=$(jq -r '.pr_findings_total // 0' warning-result.json) if [ "$total" -gt 0 ]; then - echo "" - echo "
Warnings/errors in files changed by this PR ($total)" - echo "" - echo '```' - jq -r '.pr_findings[] | "\(.file):\(.line) \(.rule) \(.message | gsub("[\r\n]"; " "))"' warning-result.json - shown=$(jq -r '.pr_findings | length' warning-result.json) - if [ "$total" -gt "$shown" ]; then + { echo "" - echo "…and $((total - shown)) more (see the csharp-lint-reports artifact)." - fi - echo '```' - echo "" - echo "
" + echo "
Warnings/errors in files changed by this PR ($total)" + echo "" + echo '```' + jq -r '.pr_findings[] | "\(.file):\(.line) \(.rule) \(.message | gsub("[\r\n]"; " "))"' warning-result.json + shown=$(jq -r '.pr_findings | length' warning-result.json) + if [ "$total" -gt "$shown" ]; then + echo "" + echo "…and $((total - shown)) more (see the csharp-lint-reports artifact)." + fi + echo '```' + echo "" + echo "
" + } > details.md + DETAILS="details.md" fi + fi + + { + echo "body<<$DELIM" + echo "" + echo "![badge] $LOGO" + echo "" + echo "$MSG" + [ -n "$DETAILS" ] && cat "$DETAILS" + echo "" + echo "[badge]: $BADGE" echo "$DELIM" } >> "$GITHUB_OUTPUT" - name: Find existing comment - if: steps.result.outputs.found == 'true' + if: steps.pr.outputs.pr-number != '' uses: peter-evans/find-comment@v2 id: find-comment with: @@ -116,7 +200,7 @@ jobs: body-includes: '' - name: Upsert comment - if: steps.result.outputs.found == 'true' + if: steps.pr.outputs.pr-number != '' uses: peter-evans/create-or-update-comment@v3 with: issue-number: ${{ steps.pr.outputs.pr-number }} From aca08f064a39f352fb89130a9ee88dea9c3eab59 Mon Sep 17 00:00:00 2001 From: Vitaly Popuzin Date: Fri, 24 Jul 2026 16:51:49 +0200 Subject: [PATCH 7/8] fix: update MCP tool enum refs to PascalCase after dev merge The MCP server feature (#9339) merged from dev references enum members this branch renamed to PascalCase: ChatMessageOrigin.CHAT / RESTRICTED_ACTION_API and CameraMode.SDKCamera. Update the call sites so the merged tree compiles. --- Explorer/Assets/DCL/McpServer/Tests/McpWireEnumShould.cs | 2 +- Explorer/Assets/DCL/McpServer/Tools/SendChatTool.cs | 2 +- Explorer/Assets/DCL/McpServer/Tools/SetCameraModeTool.cs | 4 ++-- Explorer/Assets/DCL/McpServer/Tools/TeleportTool.cs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Explorer/Assets/DCL/McpServer/Tests/McpWireEnumShould.cs b/Explorer/Assets/DCL/McpServer/Tests/McpWireEnumShould.cs index db843223405..5ffaab26352 100644 --- a/Explorer/Assets/DCL/McpServer/Tests/McpWireEnumShould.cs +++ b/Explorer/Assets/DCL/McpServer/Tests/McpWireEnumShould.cs @@ -9,7 +9,7 @@ public class McpWireEnumShould /// /// Deliberately mixes every member-naming style the snake_case conversion must handle — PascalCase, /// an acronym run, SCREAMING and SCREAMING_SNAKE — mirroring the real wire enums (CameraMode.FirstPerson, - /// CameraMode.SDKCamera, MovementKind.Walk). The members are read only through + /// CameraMode.SdkCamera, MovementKind.Walk). The members are read only through /// reflection by McpWireEnum, hence the suppressions. /// [SuppressMessage("ReSharper", "InconsistentNaming")] diff --git a/Explorer/Assets/DCL/McpServer/Tools/SendChatTool.cs b/Explorer/Assets/DCL/McpServer/Tools/SendChatTool.cs index 72cf71c8ddb..aa3124765d4 100644 --- a/Explorer/Assets/DCL/McpServer/Tools/SendChatTool.cs +++ b/Explorer/Assets/DCL/McpServer/Tools/SendChatTool.cs @@ -44,7 +44,7 @@ public override UniTask ExecuteAsync(JObject arguments, Cancellat if (message.Length > MAX_MESSAGE_LENGTH) return UniTask.FromResult(McpToolResult.Error($"message exceeds the {MAX_MESSAGE_LENGTH} character limit.")); - chatMessagesBus.SendWithUtcNowTimestamp(ChatChannel.NEARBY_CHANNEL, message, ChatMessageOrigin.CHAT); + chatMessagesBus.SendWithUtcNowTimestamp(ChatChannel.NEARBY_CHANNEL, message, ChatMessageOrigin.Chat); return UniTask.FromResult(McpToolResult.Text($"Sent to Nearby: {message}")); } diff --git a/Explorer/Assets/DCL/McpServer/Tools/SetCameraModeTool.cs b/Explorer/Assets/DCL/McpServer/Tools/SetCameraModeTool.cs index d3db59f81f0..7b916fb1c08 100644 --- a/Explorer/Assets/DCL/McpServer/Tools/SetCameraModeTool.cs +++ b/Explorer/Assets/DCL/McpServer/Tools/SetCameraModeTool.cs @@ -72,7 +72,7 @@ internal static bool IsModeChangeAllowed(World world) SingleInstanceEntity cameraEntity = world.CacheCamera(); ref readonly CameraComponent camera = ref cameraEntity.GetCameraComponent(world); - return camera.Mode != CameraMode.SDKCamera + return camera.Mode != CameraMode.SdkCamera && camera.CameraInputChangeEnabled && !world.Has(cameraEntity); } @@ -83,7 +83,7 @@ internal static bool IsModeChangeAllowed(World world) ref CameraComponent camera = ref cameraEntity.GetCameraComponent(world); previousMode = camera.Mode; - if (camera.Mode == CameraMode.SDKCamera) + if (camera.Mode == CameraMode.SdkCamera) return "A scene virtual camera controls the view right now (mode SDKCamera); the mode cannot change until the scene releases it."; if (!camera.CameraInputChangeEnabled) diff --git a/Explorer/Assets/DCL/McpServer/Tools/TeleportTool.cs b/Explorer/Assets/DCL/McpServer/Tools/TeleportTool.cs index b3a4e8f6908..6c29ef907bf 100644 --- a/Explorer/Assets/DCL/McpServer/Tools/TeleportTool.cs +++ b/Explorer/Assets/DCL/McpServer/Tools/TeleportTool.cs @@ -57,7 +57,7 @@ public override async UniTask ExecuteAsync(JObject arguments, Can bool waitForReady = arguments.GetBool("waitForReady", true); float timeoutSec = Mathf.Clamp(arguments.GetFloat("timeoutSec", DEFAULT_TIMEOUT_SEC), MIN_TIMEOUT_SEC, MAX_TIMEOUT_SEC); - chatMessagesBus.SendWithUtcNowTimestamp(ChatChannel.NEARBY_CHANNEL, $"/{ChatCommandsUtils.COMMAND_GOTO} {x},{y}", ChatMessageOrigin.RESTRICTED_ACTION_API); + chatMessagesBus.SendWithUtcNowTimestamp(ChatChannel.NEARBY_CHANNEL, $"/{ChatCommandsUtils.COMMAND_GOTO} {x},{y}", ChatMessageOrigin.RestrictedActionApi); if (!waitForReady) return McpToolResult.Text($"Teleport to ({x},{y}) requested."); From 7dea5a55130b4c977ee68515aed9271716ae896f Mon Sep 17 00:00:00 2001 From: Vitaly Popuzin Date: Mon, 27 Jul 2026 11:01:52 +0200 Subject: [PATCH 8/8] style: restore CRLF endings on 3 enum-renamed files The rename script rewrote ExplorePanelController, SettingsController and NavmapSearchBarController with LF while their dev blobs are CRLF, so the whole file showed as changed. Restore CRLF verbatim (bypassing text=auto normalization) so the diff shows only the enum renames. --- .../ExplorePanel/ExplorePanelController.cs | 994 +++++++++--------- .../DCL/Navmap/NavmapSearchBarController.cs | 450 ++++---- .../Assets/DCL/Settings/SettingsController.cs | 478 ++++----- 3 files changed, 961 insertions(+), 961 deletions(-) diff --git a/Explorer/Assets/DCL/ExplorePanel/ExplorePanelController.cs b/Explorer/Assets/DCL/ExplorePanel/ExplorePanelController.cs index 4dfa308a2a3..fcc497b89b3 100644 --- a/Explorer/Assets/DCL/ExplorePanel/ExplorePanelController.cs +++ b/Explorer/Assets/DCL/ExplorePanel/ExplorePanelController.cs @@ -1,497 +1,497 @@ -using Cysharp.Threading.Tasks; -using DCL.Backpack; -using DCL.Communities; -using DCL.Communities.CommunitiesBrowser; -using DCL.Credits; -using DCL.FeatureFlags; -using DCL.Diagnostics; -using DCL.Events; -using DCL.EventsApi; -using DCL.Input; -using DCL.Input.Component; -using DCL.InWorldCamera.CameraReelGallery; -using DCL.Navmap; -using DCL.NotificationsBus; -using DCL.NotificationsBus.NotificationTypes; -using DCL.Places; -using DCL.Settings; -using DCL.UI; -using DCL.UI.ProfileElements; -using DCL.UI.Profiles; -using DCL.Utilities; -using DCL.Utilities.Extensions; -using DCL.Utility.Types; -using DCL.VoiceChat; -using MVC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using UnityEngine.EventSystems; -using UnityEngine.InputSystem; -using Utility; - -namespace DCL.ExplorePanel -{ - public class ExplorePanelController : ControllerBase - { - private readonly BackpackController backpackController; - private readonly SidebarProfileButtonPresenter profileButtonPresenter; - private readonly ProfileMenuController profileMenuController; - private readonly DCLInput dclInput; - private readonly IInputBlock inputBlock; - private readonly bool includeCameraReel; - private readonly IMVCManager mvcManager; - private readonly bool includeDiscover; - private readonly HttpEventsApiService eventsApiService; - private readonly JoinedCommunitiesVoiceLiveTracker communitiesLiveTracker; - private readonly ICreditsPanelController creditsPanelController; - private bool includeCommunities; - - private ReactivePropertyExtensions.DisposableSubscription? communitiesLiveBadgeSubscription; - - private Dictionary tabsBySections; - private Dictionary exploreSections; - private SectionSelectorController sectionSelectorController; - private CancellationTokenSource? animationCts; - private CancellationTokenSource? profileMenuCts; - private CancellationTokenSource setupExploreSectionsCts; - private CancellationTokenSource checkForLiveEventsCts; - private TabSelectorView? previousSelector; - private ExploreSections lastShownSection; - private bool isControlClosing; - - private CommunitiesBrowserController communitiesBrowserController { get; } - public NavmapController NavmapController { get; } - public CameraReelController CameraReelController { get; } - public SettingsController SettingsController { get; } - public CommunitiesBrowserController CommunitiesBrowserController { get; } - public PlacesController PlacesController { get; } - public EventsController EventsController { get; } - - public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Fullscreen; - - public bool CanBeClosedByEscape => State != ControllerState.ViewShowing; - - public event Action? PlacesOpenedFromStartMenu; - public event Action? EventsOpenedFromStartMenu; - - public ExplorePanelController(ViewFactoryMethod viewFactory, - NavmapController navmapController, - SettingsController settingsController, - BackpackController backpackController, - CameraReelController cameraReelController, - SidebarProfileButtonPresenter profileButtonPresenter, - ProfileMenuController profileMenuController, - CommunitiesBrowserController communitiesBrowserController, - PlacesController placesController, - EventsController eventsController, - IInputBlock inputBlock, - HttpEventsApiService eventsApiService, - IMVCManager mvcManager, - JoinedCommunitiesVoiceLiveTracker communitiesLiveTracker, - ICreditsPanelController creditsPanelController) - : base(viewFactory) - { - NavmapController = navmapController; - SettingsController = settingsController; - this.backpackController = backpackController; - CameraReelController = cameraReelController; - this.profileButtonPresenter = profileButtonPresenter; - dclInput = DCLInput.Instance; - this.profileMenuController = profileMenuController; - this.inputBlock = inputBlock; - this.includeCameraReel = FeaturesRegistry.Instance.IsEnabled(FeatureId.CameraReel); - this.mvcManager = mvcManager; - this.communitiesBrowserController = communitiesBrowserController; - this.includeDiscover = FeaturesRegistry.Instance.IsEnabled(FeatureId.Discover); - this.eventsApiService = eventsApiService; - this.communitiesLiveTracker = communitiesLiveTracker; - this.creditsPanelController = creditsPanelController; - CommunitiesBrowserController = communitiesBrowserController; - PlacesController = placesController; - - NotificationsBusController.Instance.SubscribeToNotificationTypeClick(NotificationType.REWARD_ASSIGNMENT, p => OnShowSectionFromNotificationAsync(p, ExploreSections.Backpack).Forget()); - - EventsController = eventsController; - } - - public override void Dispose() - { - base.Dispose(); - - profileMenuCts.SafeCancelAndDispose(); - setupExploreSectionsCts.SafeCancelAndDispose(); - checkForLiveEventsCts.SafeCancelAndDispose(); - - communitiesLiveBadgeSubscription?.Dispose(); - } - - private async UniTaskVoid OnShowSectionFromNotificationAsync(object[] _, ExploreSections sectionToShow) - { - if (State == ControllerState.ViewHidden) - await mvcManager.ShowAsync(ExplorePanelController.IssueCommand(new ExplorePanelParameter(sectionToShow))); - else - ShowSection(sectionToShow); - } - - protected override void OnViewInstantiated() - { - setupExploreSectionsCts = setupExploreSectionsCts.SafeRestart(); - SetupExploreSectionsAsync(setupExploreSectionsCts.Token).Forget(); - viewInstance!.SetLiveEventsCounter(0); - - viewInstance.CommunitiesLiveBadge.SetActive(communitiesLiveTracker.HasAnyJoinedCommunityLive.Value); - communitiesLiveBadgeSubscription = communitiesLiveTracker.HasAnyJoinedCommunityLive.Subscribe(OnCommunitiesLiveStateChanged); - } - - private void OnCommunitiesLiveStateChanged(bool hasAnyLive) - { - if (viewInstance != null) - viewInstance.CommunitiesLiveBadge.SetActive(hasAnyLive); - } - - private async UniTaskVoid SetupExploreSectionsAsync(CancellationToken ct) - { - exploreSections = new Dictionary - { - { ExploreSections.Navmap, NavmapController }, - { ExploreSections.Settings, SettingsController }, - { ExploreSections.Backpack, backpackController }, - { ExploreSections.CameraReel, CameraReelController }, - { ExploreSections.Communities, CommunitiesBrowserController }, - { ExploreSections.Places, PlacesController }, - { ExploreSections.Events, EventsController }, - }; - - includeCommunities = await CommunitiesFeatureAccess.Instance.IsUserAllowedToUseTheFeatureAsync(ct); - - lastShownSection = includeDiscover ? ExploreSections.Events : includeCommunities ? ExploreSections.Communities : ExploreSections.Navmap; - - sectionSelectorController = new SectionSelectorController(exploreSections, lastShownSection); - - foreach (KeyValuePair keyValuePair in exploreSections) - keyValuePair.Value.Deactivate(); - - tabsBySections = viewInstance!.TabSelectorMappedViews.ToDictionary(map => map.Section, map => map.TabSelectorViews); - - foreach ((ExploreSections section, TabSelectorView? tabSelector) in tabsBySections) - { - tabSelector.TabSelectorToggle.onValueChanged.RemoveAllListeners(); - - if ((section == ExploreSections.CameraReel && !includeCameraReel) || - (section == ExploreSections.Communities && !includeCommunities) || - (section == ExploreSections.Places && !includeDiscover) || - (section == ExploreSections.Events && !includeDiscover)) - { - tabSelector.gameObject.SetActive(false); - continue; - } - - tabSelector.TabSelectorToggle.onValueChanged.AddListener(isOn => - { - ToggleSection(isOn, tabSelector, section, true); - - if (!isOn) return; - - switch (section) - { - case ExploreSections.Places: - PlacesOpenedFromStartMenu?.Invoke(); - break; - case ExploreSections.Events: - EventsOpenedFromStartMenu?.Invoke(); - break; - } - - } - ); - } - - viewInstance?.ProfileWidget?.OpenProfileButton?.Button?.onClick.AddListener(ShowProfileMenuAsync); - } - - protected override void OnViewShow() - { - isControlClosing = false; - sectionSelectorController.ResetAnimators(); - - ExploreSections sectionToShow = inputData.IsSectionProvided ? inputData.Section : lastShownSection; - - foreach ((ExploreSections section, TabSelectorView? tab) in tabsBySections) - { - ToggleSection(section == sectionToShow, tab, section, true); - sectionSelectorController.SetAnimationState(section == sectionToShow, tabsBySections[section]); - } - - if (inputData.BackpackSection != null) - backpackController.Toggle(inputData.BackpackSection.Value); - - if (inputData.SettingsSection != null) - SettingsController.Toggle(inputData.SettingsSection.Value); - - profileButtonPresenter.LoadProfile(); - - profileMenuCts = profileMenuCts.SafeRestart(); - - if (profileMenuController.State is ControllerState.ViewFocused or ControllerState.ViewBlurred) - profileMenuController.HideViewAsync(CancellationToken.None).Forget(); - - BlockUnwantedInputs(); - RegisterHotkeys(); - - checkForLiveEventsCts = checkForLiveEventsCts.SafeRestart(); - FillLiveEventsAsync(checkForLiveEventsCts.Token).Forget(); - - if (inputData.IsSectionProvided) - return; - - // Only triggers OpenedFromStartMenu events if IsSectionProvided is false. - // This means that the section has not opened by shortcut nor sidebar. - switch (sectionToShow) - { - case ExploreSections.Places: - PlacesOpenedFromStartMenu?.Invoke(); - break; - case ExploreSections.Events: - EventsOpenedFromStartMenu?.Invoke(); - break; - } - } - - private void ToggleSection(bool isOn, TabSelectorView tabSelectorView, ExploreSections shownSection, bool animate) - { - if (isOn && animate && shownSection != lastShownSection) - sectionSelectorController.SetAnimationState(false, tabsBySections[lastShownSection]); - - animationCts.SafeCancelAndDispose(); - animationCts = new CancellationTokenSource(); - sectionSelectorController.OnTabSelectorToggleValueChangedAsync(isOn, tabSelectorView, shownSection, animationCts.Token, animate).Forget(); - - if (!isOn) return; - - if (shownSection == lastShownSection) - exploreSections[lastShownSection].Activate(); - - lastShownSection = shownSection; - } - - private void RegisterHotkeys() - { - dclInput.Shortcuts.MainMenu.canceled += OnCloseMainMenu; - dclInput.Shortcuts.Map.performed += OnMapHotkeyPressed; - dclInput.Shortcuts.Settings.performed += OnSettingsHotkeyPressed; - dclInput.Shortcuts.Backpack.performed += OnBackpackHotkeyPressed; - dclInput.Shortcuts.Communities.performed += OnCommunitiesHotkeyPressed; - dclInput.Shortcuts.Places.performed += OnPlacesHotkeyPressed; - dclInput.Shortcuts.Events.performed += OnEventsHotkeyPressed; - dclInput.Shortcuts.CameraReel.performed += OnCameraReelHotkeyPressed; - } - - private void OnCameraReelHotkeyPressed(InputAction.CallbackContext ctx) - { - if (!includeCameraReel) return; - - if (lastShownSection != ExploreSections.CameraReel) - { - sectionSelectorController.SetAnimationState(false, tabsBySections[lastShownSection]); - ShowSection(ExploreSections.CameraReel); - } - else - isControlClosing = true; - } - - private void OnCloseMainMenu(InputAction.CallbackContext obj) - { - // Search bar could be focused when closing the menu, so we need to remove the focus, - // which will also re-enable shortcuts - EventSystem.current.SetSelectedGameObject(null); - - profileMenuController.HideViewAsync(CancellationToken.None).Forget(); - isControlClosing = true; - } - - private void OnMapHotkeyPressed(InputAction.CallbackContext obj) - { - if (lastShownSection != ExploreSections.Navmap) - { - sectionSelectorController.SetAnimationState(false, tabsBySections[lastShownSection]); - ShowSection(ExploreSections.Navmap); - } - else - isControlClosing = true; - } - - private void OnSettingsHotkeyPressed(InputAction.CallbackContext obj) - { - if (lastShownSection != ExploreSections.Settings) - { - sectionSelectorController.SetAnimationState(false, tabsBySections[lastShownSection]); - ShowSection(ExploreSections.Settings); - } - else - isControlClosing = true; - } - - private void OnCommunitiesHotkeyPressed(InputAction.CallbackContext obj) - { - if (!includeCommunities) return; - - if (lastShownSection != ExploreSections.Communities) - { - sectionSelectorController.SetAnimationState(false, tabsBySections[lastShownSection]); - ShowSection(ExploreSections.Communities); - } - else - isControlClosing = true; - } - - private void OnPlacesHotkeyPressed(InputAction.CallbackContext obj) - { - if (!includeDiscover) return; - - if (lastShownSection != ExploreSections.Places) - { - sectionSelectorController.SetAnimationState(false, tabsBySections![lastShownSection]); - ShowSection(ExploreSections.Places); - } - else - isControlClosing = true; - } - - private void OnEventsHotkeyPressed(InputAction.CallbackContext obj) - { - if (!includeDiscover) return; - - if (lastShownSection != ExploreSections.Events) - { - sectionSelectorController.SetAnimationState(false, tabsBySections![lastShownSection]); - ShowSection(ExploreSections.Events); - } - else - isControlClosing = true; - } - - private void OnBackpackHotkeyPressed(InputAction.CallbackContext obj) - { - if (lastShownSection != ExploreSections.Backpack) - { - sectionSelectorController.SetAnimationState(false, tabsBySections[lastShownSection]); - ShowSection(ExploreSections.Backpack); - } - else - isControlClosing = true; - } - - private void ShowSection(ExploreSections section) - { - ToggleSection(true, tabsBySections[section], section, true); - } - - protected override void OnViewClose() - { - foreach (ISection exploreSectionsValue in exploreSections.Values) - exploreSectionsValue.Deactivate(); - - if (profileMenuController.State is ControllerState.ViewFocused or ControllerState.ViewBlurred) - profileMenuController.HideViewAsync(CancellationToken.None).Forget(); - - profileMenuCts.SafeCancelAndDispose(); - checkForLiveEventsCts.SafeCancelAndDispose(); - - UnblockUnwantedInputs(); - UnRegisterHotkeys(); - } - - private void UnRegisterHotkeys() - { - dclInput.Shortcuts.MainMenu.canceled -= OnCloseMainMenu; - dclInput.Shortcuts.Map.performed -= OnMapHotkeyPressed; - dclInput.Shortcuts.Settings.performed -= OnSettingsHotkeyPressed; - dclInput.Shortcuts.Backpack.performed -= OnBackpackHotkeyPressed; - dclInput.Shortcuts.Communities.performed -= OnCommunitiesHotkeyPressed; - dclInput.Shortcuts.Places.performed -= OnPlacesHotkeyPressed; - dclInput.Shortcuts.Events.performed -= OnEventsHotkeyPressed; - dclInput.Shortcuts.CameraReel.performed -= OnCameraReelHotkeyPressed; - } - - private void BlockUnwantedInputs() - { - inputBlock.Disable(InputMapComponent.Kind.Camera, InputMapComponent.Kind.Player); - } - - private void UnblockUnwantedInputs() - { - inputBlock.Enable(InputMapComponent.Kind.Camera, InputMapComponent.Kind.Player); - } - - protected override async UniTask WaitForCloseIntentAsync(CancellationToken ct) - { - await UniTask.WhenAny(viewInstance!.CloseButton.OnClickAsync(ct), - UniTask.WaitUntil(() => isControlClosing, PlayerLoopTiming.Update, ct), - viewInstance.ProfileMenuView.SystemMenuView.LogoutButton.OnClickAsync(ct)); - } - - private async void ShowProfileMenuAsync() - { - profileMenuCts = profileMenuCts.SafeRestart(); - - if (profileMenuController.State != ControllerState.ViewHidden) - return; - - try - { - viewInstance!.ProfileMenuCloserButton.gameObject.SetActive(true); - viewInstance.ProfileMenuCloserButton.onClick.AddListener(OnProfileMenuCloserClicked); - - await profileMenuController.LaunchViewLifeCycleAsync(new CanvasOrdering(CanvasOrdering.SortingLayer.Popup, 0), new ControllerNoData(), profileMenuCts.Token); - await profileMenuController.HideViewAsync(CancellationToken.None); - } - catch (OperationCanceledException) - { - // Cancellations ignored - } - finally - { - if (viewInstance != null) - { - viewInstance.ProfileMenuCloserButton.onClick.RemoveListener(OnProfileMenuCloserClicked); - viewInstance.ProfileMenuCloserButton.gameObject.SetActive(false); - } - } - } - - private void OnProfileMenuCloserClicked() => - profileMenuCts?.Cancel(); - - private async UniTaskVoid FillLiveEventsAsync(CancellationToken ct) - { - Result> liveEventsResult = await eventsApiService.GetEventsAsync(ct, onlyLiveEvents: true).SuppressToResultAsync(ReportCategory.EVENTS); - - if (ct.IsCancellationRequested) - return; - - viewInstance!.SetLiveEventsCounter(liveEventsResult.Success ? liveEventsResult.Value.Count : 0); - } - } - - public readonly struct ExplorePanelParameter - { - public readonly ExploreSections Section; - public readonly BackpackSections? BackpackSection; - public readonly SettingsController.SettingsSection? SettingsSection; - - /// - /// Whether a specific section has to be opened when the explore panel is shown or not (using the default one). - /// - public readonly bool IsSectionProvided; - - public ExplorePanelParameter(ExploreSections section, BackpackSections? backpackSection = null, SettingsController.SettingsSection? settingsSection = null) - { - Section = section; - BackpackSection = backpackSection; - SettingsSection = settingsSection; - IsSectionProvided = true; - } - } -} +using Cysharp.Threading.Tasks; +using DCL.Backpack; +using DCL.Communities; +using DCL.Communities.CommunitiesBrowser; +using DCL.Credits; +using DCL.FeatureFlags; +using DCL.Diagnostics; +using DCL.Events; +using DCL.EventsApi; +using DCL.Input; +using DCL.Input.Component; +using DCL.InWorldCamera.CameraReelGallery; +using DCL.Navmap; +using DCL.NotificationsBus; +using DCL.NotificationsBus.NotificationTypes; +using DCL.Places; +using DCL.Settings; +using DCL.UI; +using DCL.UI.ProfileElements; +using DCL.UI.Profiles; +using DCL.Utilities; +using DCL.Utilities.Extensions; +using DCL.Utility.Types; +using DCL.VoiceChat; +using MVC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using UnityEngine.EventSystems; +using UnityEngine.InputSystem; +using Utility; + +namespace DCL.ExplorePanel +{ + public class ExplorePanelController : ControllerBase + { + private readonly BackpackController backpackController; + private readonly SidebarProfileButtonPresenter profileButtonPresenter; + private readonly ProfileMenuController profileMenuController; + private readonly DCLInput dclInput; + private readonly IInputBlock inputBlock; + private readonly bool includeCameraReel; + private readonly IMVCManager mvcManager; + private readonly bool includeDiscover; + private readonly HttpEventsApiService eventsApiService; + private readonly JoinedCommunitiesVoiceLiveTracker communitiesLiveTracker; + private readonly ICreditsPanelController creditsPanelController; + private bool includeCommunities; + + private ReactivePropertyExtensions.DisposableSubscription? communitiesLiveBadgeSubscription; + + private Dictionary tabsBySections; + private Dictionary exploreSections; + private SectionSelectorController sectionSelectorController; + private CancellationTokenSource? animationCts; + private CancellationTokenSource? profileMenuCts; + private CancellationTokenSource setupExploreSectionsCts; + private CancellationTokenSource checkForLiveEventsCts; + private TabSelectorView? previousSelector; + private ExploreSections lastShownSection; + private bool isControlClosing; + + private CommunitiesBrowserController communitiesBrowserController { get; } + public NavmapController NavmapController { get; } + public CameraReelController CameraReelController { get; } + public SettingsController SettingsController { get; } + public CommunitiesBrowserController CommunitiesBrowserController { get; } + public PlacesController PlacesController { get; } + public EventsController EventsController { get; } + + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Fullscreen; + + public bool CanBeClosedByEscape => State != ControllerState.ViewShowing; + + public event Action? PlacesOpenedFromStartMenu; + public event Action? EventsOpenedFromStartMenu; + + public ExplorePanelController(ViewFactoryMethod viewFactory, + NavmapController navmapController, + SettingsController settingsController, + BackpackController backpackController, + CameraReelController cameraReelController, + SidebarProfileButtonPresenter profileButtonPresenter, + ProfileMenuController profileMenuController, + CommunitiesBrowserController communitiesBrowserController, + PlacesController placesController, + EventsController eventsController, + IInputBlock inputBlock, + HttpEventsApiService eventsApiService, + IMVCManager mvcManager, + JoinedCommunitiesVoiceLiveTracker communitiesLiveTracker, + ICreditsPanelController creditsPanelController) + : base(viewFactory) + { + NavmapController = navmapController; + SettingsController = settingsController; + this.backpackController = backpackController; + CameraReelController = cameraReelController; + this.profileButtonPresenter = profileButtonPresenter; + dclInput = DCLInput.Instance; + this.profileMenuController = profileMenuController; + this.inputBlock = inputBlock; + this.includeCameraReel = FeaturesRegistry.Instance.IsEnabled(FeatureId.CameraReel); + this.mvcManager = mvcManager; + this.communitiesBrowserController = communitiesBrowserController; + this.includeDiscover = FeaturesRegistry.Instance.IsEnabled(FeatureId.Discover); + this.eventsApiService = eventsApiService; + this.communitiesLiveTracker = communitiesLiveTracker; + this.creditsPanelController = creditsPanelController; + CommunitiesBrowserController = communitiesBrowserController; + PlacesController = placesController; + + NotificationsBusController.Instance.SubscribeToNotificationTypeClick(NotificationType.REWARD_ASSIGNMENT, p => OnShowSectionFromNotificationAsync(p, ExploreSections.Backpack).Forget()); + + EventsController = eventsController; + } + + public override void Dispose() + { + base.Dispose(); + + profileMenuCts.SafeCancelAndDispose(); + setupExploreSectionsCts.SafeCancelAndDispose(); + checkForLiveEventsCts.SafeCancelAndDispose(); + + communitiesLiveBadgeSubscription?.Dispose(); + } + + private async UniTaskVoid OnShowSectionFromNotificationAsync(object[] _, ExploreSections sectionToShow) + { + if (State == ControllerState.ViewHidden) + await mvcManager.ShowAsync(ExplorePanelController.IssueCommand(new ExplorePanelParameter(sectionToShow))); + else + ShowSection(sectionToShow); + } + + protected override void OnViewInstantiated() + { + setupExploreSectionsCts = setupExploreSectionsCts.SafeRestart(); + SetupExploreSectionsAsync(setupExploreSectionsCts.Token).Forget(); + viewInstance!.SetLiveEventsCounter(0); + + viewInstance.CommunitiesLiveBadge.SetActive(communitiesLiveTracker.HasAnyJoinedCommunityLive.Value); + communitiesLiveBadgeSubscription = communitiesLiveTracker.HasAnyJoinedCommunityLive.Subscribe(OnCommunitiesLiveStateChanged); + } + + private void OnCommunitiesLiveStateChanged(bool hasAnyLive) + { + if (viewInstance != null) + viewInstance.CommunitiesLiveBadge.SetActive(hasAnyLive); + } + + private async UniTaskVoid SetupExploreSectionsAsync(CancellationToken ct) + { + exploreSections = new Dictionary + { + { ExploreSections.Navmap, NavmapController }, + { ExploreSections.Settings, SettingsController }, + { ExploreSections.Backpack, backpackController }, + { ExploreSections.CameraReel, CameraReelController }, + { ExploreSections.Communities, CommunitiesBrowserController }, + { ExploreSections.Places, PlacesController }, + { ExploreSections.Events, EventsController }, + }; + + includeCommunities = await CommunitiesFeatureAccess.Instance.IsUserAllowedToUseTheFeatureAsync(ct); + + lastShownSection = includeDiscover ? ExploreSections.Events : includeCommunities ? ExploreSections.Communities : ExploreSections.Navmap; + + sectionSelectorController = new SectionSelectorController(exploreSections, lastShownSection); + + foreach (KeyValuePair keyValuePair in exploreSections) + keyValuePair.Value.Deactivate(); + + tabsBySections = viewInstance!.TabSelectorMappedViews.ToDictionary(map => map.Section, map => map.TabSelectorViews); + + foreach ((ExploreSections section, TabSelectorView? tabSelector) in tabsBySections) + { + tabSelector.TabSelectorToggle.onValueChanged.RemoveAllListeners(); + + if ((section == ExploreSections.CameraReel && !includeCameraReel) || + (section == ExploreSections.Communities && !includeCommunities) || + (section == ExploreSections.Places && !includeDiscover) || + (section == ExploreSections.Events && !includeDiscover)) + { + tabSelector.gameObject.SetActive(false); + continue; + } + + tabSelector.TabSelectorToggle.onValueChanged.AddListener(isOn => + { + ToggleSection(isOn, tabSelector, section, true); + + if (!isOn) return; + + switch (section) + { + case ExploreSections.Places: + PlacesOpenedFromStartMenu?.Invoke(); + break; + case ExploreSections.Events: + EventsOpenedFromStartMenu?.Invoke(); + break; + } + + } + ); + } + + viewInstance?.ProfileWidget?.OpenProfileButton?.Button?.onClick.AddListener(ShowProfileMenuAsync); + } + + protected override void OnViewShow() + { + isControlClosing = false; + sectionSelectorController.ResetAnimators(); + + ExploreSections sectionToShow = inputData.IsSectionProvided ? inputData.Section : lastShownSection; + + foreach ((ExploreSections section, TabSelectorView? tab) in tabsBySections) + { + ToggleSection(section == sectionToShow, tab, section, true); + sectionSelectorController.SetAnimationState(section == sectionToShow, tabsBySections[section]); + } + + if (inputData.BackpackSection != null) + backpackController.Toggle(inputData.BackpackSection.Value); + + if (inputData.SettingsSection != null) + SettingsController.Toggle(inputData.SettingsSection.Value); + + profileButtonPresenter.LoadProfile(); + + profileMenuCts = profileMenuCts.SafeRestart(); + + if (profileMenuController.State is ControllerState.ViewFocused or ControllerState.ViewBlurred) + profileMenuController.HideViewAsync(CancellationToken.None).Forget(); + + BlockUnwantedInputs(); + RegisterHotkeys(); + + checkForLiveEventsCts = checkForLiveEventsCts.SafeRestart(); + FillLiveEventsAsync(checkForLiveEventsCts.Token).Forget(); + + if (inputData.IsSectionProvided) + return; + + // Only triggers OpenedFromStartMenu events if IsSectionProvided is false. + // This means that the section has not opened by shortcut nor sidebar. + switch (sectionToShow) + { + case ExploreSections.Places: + PlacesOpenedFromStartMenu?.Invoke(); + break; + case ExploreSections.Events: + EventsOpenedFromStartMenu?.Invoke(); + break; + } + } + + private void ToggleSection(bool isOn, TabSelectorView tabSelectorView, ExploreSections shownSection, bool animate) + { + if (isOn && animate && shownSection != lastShownSection) + sectionSelectorController.SetAnimationState(false, tabsBySections[lastShownSection]); + + animationCts.SafeCancelAndDispose(); + animationCts = new CancellationTokenSource(); + sectionSelectorController.OnTabSelectorToggleValueChangedAsync(isOn, tabSelectorView, shownSection, animationCts.Token, animate).Forget(); + + if (!isOn) return; + + if (shownSection == lastShownSection) + exploreSections[lastShownSection].Activate(); + + lastShownSection = shownSection; + } + + private void RegisterHotkeys() + { + dclInput.Shortcuts.MainMenu.canceled += OnCloseMainMenu; + dclInput.Shortcuts.Map.performed += OnMapHotkeyPressed; + dclInput.Shortcuts.Settings.performed += OnSettingsHotkeyPressed; + dclInput.Shortcuts.Backpack.performed += OnBackpackHotkeyPressed; + dclInput.Shortcuts.Communities.performed += OnCommunitiesHotkeyPressed; + dclInput.Shortcuts.Places.performed += OnPlacesHotkeyPressed; + dclInput.Shortcuts.Events.performed += OnEventsHotkeyPressed; + dclInput.Shortcuts.CameraReel.performed += OnCameraReelHotkeyPressed; + } + + private void OnCameraReelHotkeyPressed(InputAction.CallbackContext ctx) + { + if (!includeCameraReel) return; + + if (lastShownSection != ExploreSections.CameraReel) + { + sectionSelectorController.SetAnimationState(false, tabsBySections[lastShownSection]); + ShowSection(ExploreSections.CameraReel); + } + else + isControlClosing = true; + } + + private void OnCloseMainMenu(InputAction.CallbackContext obj) + { + // Search bar could be focused when closing the menu, so we need to remove the focus, + // which will also re-enable shortcuts + EventSystem.current.SetSelectedGameObject(null); + + profileMenuController.HideViewAsync(CancellationToken.None).Forget(); + isControlClosing = true; + } + + private void OnMapHotkeyPressed(InputAction.CallbackContext obj) + { + if (lastShownSection != ExploreSections.Navmap) + { + sectionSelectorController.SetAnimationState(false, tabsBySections[lastShownSection]); + ShowSection(ExploreSections.Navmap); + } + else + isControlClosing = true; + } + + private void OnSettingsHotkeyPressed(InputAction.CallbackContext obj) + { + if (lastShownSection != ExploreSections.Settings) + { + sectionSelectorController.SetAnimationState(false, tabsBySections[lastShownSection]); + ShowSection(ExploreSections.Settings); + } + else + isControlClosing = true; + } + + private void OnCommunitiesHotkeyPressed(InputAction.CallbackContext obj) + { + if (!includeCommunities) return; + + if (lastShownSection != ExploreSections.Communities) + { + sectionSelectorController.SetAnimationState(false, tabsBySections[lastShownSection]); + ShowSection(ExploreSections.Communities); + } + else + isControlClosing = true; + } + + private void OnPlacesHotkeyPressed(InputAction.CallbackContext obj) + { + if (!includeDiscover) return; + + if (lastShownSection != ExploreSections.Places) + { + sectionSelectorController.SetAnimationState(false, tabsBySections![lastShownSection]); + ShowSection(ExploreSections.Places); + } + else + isControlClosing = true; + } + + private void OnEventsHotkeyPressed(InputAction.CallbackContext obj) + { + if (!includeDiscover) return; + + if (lastShownSection != ExploreSections.Events) + { + sectionSelectorController.SetAnimationState(false, tabsBySections![lastShownSection]); + ShowSection(ExploreSections.Events); + } + else + isControlClosing = true; + } + + private void OnBackpackHotkeyPressed(InputAction.CallbackContext obj) + { + if (lastShownSection != ExploreSections.Backpack) + { + sectionSelectorController.SetAnimationState(false, tabsBySections[lastShownSection]); + ShowSection(ExploreSections.Backpack); + } + else + isControlClosing = true; + } + + private void ShowSection(ExploreSections section) + { + ToggleSection(true, tabsBySections[section], section, true); + } + + protected override void OnViewClose() + { + foreach (ISection exploreSectionsValue in exploreSections.Values) + exploreSectionsValue.Deactivate(); + + if (profileMenuController.State is ControllerState.ViewFocused or ControllerState.ViewBlurred) + profileMenuController.HideViewAsync(CancellationToken.None).Forget(); + + profileMenuCts.SafeCancelAndDispose(); + checkForLiveEventsCts.SafeCancelAndDispose(); + + UnblockUnwantedInputs(); + UnRegisterHotkeys(); + } + + private void UnRegisterHotkeys() + { + dclInput.Shortcuts.MainMenu.canceled -= OnCloseMainMenu; + dclInput.Shortcuts.Map.performed -= OnMapHotkeyPressed; + dclInput.Shortcuts.Settings.performed -= OnSettingsHotkeyPressed; + dclInput.Shortcuts.Backpack.performed -= OnBackpackHotkeyPressed; + dclInput.Shortcuts.Communities.performed -= OnCommunitiesHotkeyPressed; + dclInput.Shortcuts.Places.performed -= OnPlacesHotkeyPressed; + dclInput.Shortcuts.Events.performed -= OnEventsHotkeyPressed; + dclInput.Shortcuts.CameraReel.performed -= OnCameraReelHotkeyPressed; + } + + private void BlockUnwantedInputs() + { + inputBlock.Disable(InputMapComponent.Kind.Camera, InputMapComponent.Kind.Player); + } + + private void UnblockUnwantedInputs() + { + inputBlock.Enable(InputMapComponent.Kind.Camera, InputMapComponent.Kind.Player); + } + + protected override async UniTask WaitForCloseIntentAsync(CancellationToken ct) + { + await UniTask.WhenAny(viewInstance!.CloseButton.OnClickAsync(ct), + UniTask.WaitUntil(() => isControlClosing, PlayerLoopTiming.Update, ct), + viewInstance.ProfileMenuView.SystemMenuView.LogoutButton.OnClickAsync(ct)); + } + + private async void ShowProfileMenuAsync() + { + profileMenuCts = profileMenuCts.SafeRestart(); + + if (profileMenuController.State != ControllerState.ViewHidden) + return; + + try + { + viewInstance!.ProfileMenuCloserButton.gameObject.SetActive(true); + viewInstance.ProfileMenuCloserButton.onClick.AddListener(OnProfileMenuCloserClicked); + + await profileMenuController.LaunchViewLifeCycleAsync(new CanvasOrdering(CanvasOrdering.SortingLayer.Popup, 0), new ControllerNoData(), profileMenuCts.Token); + await profileMenuController.HideViewAsync(CancellationToken.None); + } + catch (OperationCanceledException) + { + // Cancellations ignored + } + finally + { + if (viewInstance != null) + { + viewInstance.ProfileMenuCloserButton.onClick.RemoveListener(OnProfileMenuCloserClicked); + viewInstance.ProfileMenuCloserButton.gameObject.SetActive(false); + } + } + } + + private void OnProfileMenuCloserClicked() => + profileMenuCts?.Cancel(); + + private async UniTaskVoid FillLiveEventsAsync(CancellationToken ct) + { + Result> liveEventsResult = await eventsApiService.GetEventsAsync(ct, onlyLiveEvents: true).SuppressToResultAsync(ReportCategory.EVENTS); + + if (ct.IsCancellationRequested) + return; + + viewInstance!.SetLiveEventsCounter(liveEventsResult.Success ? liveEventsResult.Value.Count : 0); + } + } + + public readonly struct ExplorePanelParameter + { + public readonly ExploreSections Section; + public readonly BackpackSections? BackpackSection; + public readonly SettingsController.SettingsSection? SettingsSection; + + /// + /// Whether a specific section has to be opened when the explore panel is shown or not (using the default one). + /// + public readonly bool IsSectionProvided; + + public ExplorePanelParameter(ExploreSections section, BackpackSections? backpackSection = null, SettingsController.SettingsSection? settingsSection = null) + { + Section = section; + BackpackSection = backpackSection; + SettingsSection = settingsSection; + IsSectionProvided = true; + } + } +} diff --git a/Explorer/Assets/DCL/Navmap/NavmapSearchBarController.cs b/Explorer/Assets/DCL/Navmap/NavmapSearchBarController.cs index e90bcb72fe5..e16ec63e501 100644 --- a/Explorer/Assets/DCL/Navmap/NavmapSearchBarController.cs +++ b/Explorer/Assets/DCL/Navmap/NavmapSearchBarController.cs @@ -1,225 +1,225 @@ -using Cysharp.Threading.Tasks; -using DCL.Input; -using DCL.Input.Component; -using DCL.MapRenderer.MapLayers.Categories; -using DCL.Navmap.ScriptableObjects; -using DCL.UI; -using System; -using System.Threading; -using Utility; - -namespace DCL.Navmap -{ - public class NavmapSearchBarController : IDisposable - { - public event Action? TogglePanel; - - private readonly SearchBarView view; - private readonly HistoryRecordPanelView historyRecordPanelView; - private readonly SearchFiltersView searchFiltersView; - private readonly IInputBlock inputBlock; - private readonly INavmapBus navmapBus; - private readonly CategoryMappingSO categoryMappingSO; - - private CancellationTokenSource? searchCancellationToken; - private CancellationTokenSource? backCancellationToken; - private NavmapSearchPlaceFilter currentPlaceFilter = NavmapSearchPlaceFilter.All; - private NavmapSearchPlaceSorting currentPlaceSorting = NavmapSearchPlaceSorting.MostActive; - private string? currentCategory; - private string currentSearchText = string.Empty; - - public bool Interactable - { - get => view.inputField.interactable; - set => view.inputField.interactable = value; - } - - public NavmapSearchBarController( - SearchBarView view, - HistoryRecordPanelView historyRecordPanelView, - SearchFiltersView searchFiltersView, - IInputBlock inputBlock, - INavmapBus navmapBus, - CategoryMappingSO categoryMappingSO) - { - this.view = view; - this.historyRecordPanelView = historyRecordPanelView; - this.searchFiltersView = searchFiltersView; - this.inputBlock = inputBlock; - this.navmapBus = navmapBus; - this.categoryMappingSO = categoryMappingSO; - - navmapBus.OnJumpIn += _ => ClearInput(); - navmapBus.OnFilterByCategory += SearchByCategory; - view.inputField.onSelect.AddListener(_ => OnSearchBarSelected(true)); - view.inputField.onDeselect.AddListener(_ => OnSearchBarSelected(false)); - view.inputField.onValueChanged.AddListener(OnInputValueChanged); - view.inputField.onSubmit.AddListener(OnSubmitSearch); - view.clearSearchButton.onClick.AddListener(ClearInput); - view.BackButton.onClick.AddListener(OnBackClicked); - view.clearSearchButton.gameObject.SetActive(false); - historyRecordPanelView.gameObject.SetActive(false); - searchFiltersView.NewestButton.onClick.AddListener(() => Search(NavmapSearchPlaceSorting.Newest)); - searchFiltersView.BestRatedButton.onClick.AddListener(() => Search(NavmapSearchPlaceSorting.BestRated)); - searchFiltersView.MostActiveButton.onClick.AddListener(() => Search(NavmapSearchPlaceSorting.MostActive)); - searchFiltersView.Toggle(currentPlaceSorting); - searchFiltersView.Toggle(currentPlaceFilter); - } - - public void Dispose() - { - searchCancellationToken.SafeCancelAndDispose(); - view.inputField.onSelect.RemoveAllListeners(); - view.inputField.onValueChanged.RemoveAllListeners(); - view.inputField.onSubmit.RemoveAllListeners(); - view.clearSearchButton.onClick.RemoveAllListeners(); - } - - public void ToggleClearButton(bool isActive) - { - view.clearSearchButton.gameObject.SetActive(isActive); - } - - public void SetInputFieldCategory(string? category) - { - view.clearSearchButton.gameObject.SetActive(!string.IsNullOrEmpty(category) || !string.IsNullOrEmpty(currentSearchText)); - view.inputFieldCategoryImage.gameObject.SetActive(!string.IsNullOrEmpty(category)); - - if (string.IsNullOrEmpty(category)) - return; - - if(Enum.TryParse(category, true, out CategoriesEnum categoryEnum)) - view.inputFieldCategoryImage.sprite = categoryMappingSO.GetCategoryImage(categoryEnum); - } - - public void SetInputText(string text) - { - view.inputField.SetTextWithoutNotify(text); - } - - public void ClearInput() - { - view.inputField.SetTextWithoutNotify(string.Empty); - view.inputFieldCategoryImage.gameObject.SetActive(false); - view.clearSearchButton.gameObject.SetActive(false); - view.BackButton.gameObject.SetActive(false); - - currentCategory = string.Empty; - currentSearchText = string.Empty; - TogglePanel?.Invoke(false); - Interactable = true; - navmapBus.ClearFilter(); - navmapBus.ClearPlacesFromMap(); - if (view.inputField.isFocused) - RestoreInput(); - } - - public void EnableBack() - { - view.inputFieldCategoryImage.gameObject.SetActive(false); - view.BackButton.gameObject.SetActive(true); - view.SearchIcon.SetActive(false); - } - - public void DisableBack() - { - view.inputFieldCategoryImage.gameObject.SetActive(false); - view.BackButton.gameObject.SetActive(false); - view.SearchIcon.SetActive(true); - } - - public void UpdateFilterAndSorting(NavmapSearchPlaceFilter filter, NavmapSearchPlaceSorting sorting) - { - navmapBus.ClearPlacesFromMap(); - currentPlaceFilter = filter; - searchFiltersView.Toggle(currentPlaceFilter); - - currentPlaceSorting = sorting; - searchFiltersView.Toggle(currentPlaceSorting); - } - - private void OnBackClicked() - { - backCancellationToken = backCancellationToken.SafeRestart(); - navmapBus.GoBackAsync(backCancellationToken.Token).Forget(); - } - - private void OnInputValueChanged(string searchText) - { - currentCategory = string.Empty; - view.clearSearchButton.gameObject.SetActive(!string.IsNullOrEmpty(searchText)); - currentSearchText = searchText; - } - - private void OnSubmitSearch(string searchText) - { - searchCancellationToken = searchCancellationToken.SafeRestart(); - SearchAsync(searchCancellationToken.Token) - .Forget(); - - async UniTaskVoid SearchAsync(CancellationToken ct) - { - UpdateFilterAndSorting(NavmapSearchPlaceFilter.All, currentPlaceSorting); - - TogglePanel?.Invoke(!string.IsNullOrEmpty(searchText)); - await navmapBus.SearchForPlaceAsync(INavmapBus.SearchPlaceParams.CreateWithDefaultParams( - page: 0, - filter: currentPlaceFilter, - sorting: currentPlaceSorting, - text: currentSearchText), ct) - .SuppressCancellationThrow(); - } - } - - private void OnSearchBarSelected(bool isSelected) - { - if (isSelected) - DisableShortcutsInput(); - else - RestoreInput(); - } - - private void DisableShortcutsInput() => - inputBlock.Disable(InputMapComponent.Kind.Shortcuts, InputMapComponent.Kind.InWorldCamera); - - private void RestoreInput() => - inputBlock.Enable(InputMapComponent.Kind.Shortcuts, InputMapComponent.Kind.InWorldCamera); - - private void Search(NavmapSearchPlaceSorting sorting) - { - UpdateFilterAndSorting(currentPlaceFilter, sorting); - - searchCancellationToken = searchCancellationToken.SafeRestart(); - - navmapBus.SearchForPlaceAsync(INavmapBus.SearchPlaceParams.CreateWithDefaultParams( - page: 0, - text: currentSearchText, - filter: currentPlaceFilter, - sorting: sorting, - category: currentCategory), searchCancellationToken.Token) - .Forget(); - } - - private void SearchByCategory(string? category) - { - UpdateFilterAndSorting(category is "Favorites" ? NavmapSearchPlaceFilter.Favorites : NavmapSearchPlaceFilter.All, currentPlaceSorting); - - if (string.IsNullOrEmpty(category)) - { - ClearInput(); - return; - } - - TogglePanel?.Invoke(true); - currentSearchText = string.Empty; - currentCategory = category; - searchCancellationToken = searchCancellationToken.SafeRestart(); - navmapBus.SearchForPlaceAsync(INavmapBus.SearchPlaceParams.CreateWithDefaultParams( - page: 0, - filter: currentPlaceFilter, - sorting: currentPlaceSorting, - category: category), searchCancellationToken.Token) - .Forget(); - } - } -} +using Cysharp.Threading.Tasks; +using DCL.Input; +using DCL.Input.Component; +using DCL.MapRenderer.MapLayers.Categories; +using DCL.Navmap.ScriptableObjects; +using DCL.UI; +using System; +using System.Threading; +using Utility; + +namespace DCL.Navmap +{ + public class NavmapSearchBarController : IDisposable + { + public event Action? TogglePanel; + + private readonly SearchBarView view; + private readonly HistoryRecordPanelView historyRecordPanelView; + private readonly SearchFiltersView searchFiltersView; + private readonly IInputBlock inputBlock; + private readonly INavmapBus navmapBus; + private readonly CategoryMappingSO categoryMappingSO; + + private CancellationTokenSource? searchCancellationToken; + private CancellationTokenSource? backCancellationToken; + private NavmapSearchPlaceFilter currentPlaceFilter = NavmapSearchPlaceFilter.All; + private NavmapSearchPlaceSorting currentPlaceSorting = NavmapSearchPlaceSorting.MostActive; + private string? currentCategory; + private string currentSearchText = string.Empty; + + public bool Interactable + { + get => view.inputField.interactable; + set => view.inputField.interactable = value; + } + + public NavmapSearchBarController( + SearchBarView view, + HistoryRecordPanelView historyRecordPanelView, + SearchFiltersView searchFiltersView, + IInputBlock inputBlock, + INavmapBus navmapBus, + CategoryMappingSO categoryMappingSO) + { + this.view = view; + this.historyRecordPanelView = historyRecordPanelView; + this.searchFiltersView = searchFiltersView; + this.inputBlock = inputBlock; + this.navmapBus = navmapBus; + this.categoryMappingSO = categoryMappingSO; + + navmapBus.OnJumpIn += _ => ClearInput(); + navmapBus.OnFilterByCategory += SearchByCategory; + view.inputField.onSelect.AddListener(_ => OnSearchBarSelected(true)); + view.inputField.onDeselect.AddListener(_ => OnSearchBarSelected(false)); + view.inputField.onValueChanged.AddListener(OnInputValueChanged); + view.inputField.onSubmit.AddListener(OnSubmitSearch); + view.clearSearchButton.onClick.AddListener(ClearInput); + view.BackButton.onClick.AddListener(OnBackClicked); + view.clearSearchButton.gameObject.SetActive(false); + historyRecordPanelView.gameObject.SetActive(false); + searchFiltersView.NewestButton.onClick.AddListener(() => Search(NavmapSearchPlaceSorting.Newest)); + searchFiltersView.BestRatedButton.onClick.AddListener(() => Search(NavmapSearchPlaceSorting.BestRated)); + searchFiltersView.MostActiveButton.onClick.AddListener(() => Search(NavmapSearchPlaceSorting.MostActive)); + searchFiltersView.Toggle(currentPlaceSorting); + searchFiltersView.Toggle(currentPlaceFilter); + } + + public void Dispose() + { + searchCancellationToken.SafeCancelAndDispose(); + view.inputField.onSelect.RemoveAllListeners(); + view.inputField.onValueChanged.RemoveAllListeners(); + view.inputField.onSubmit.RemoveAllListeners(); + view.clearSearchButton.onClick.RemoveAllListeners(); + } + + public void ToggleClearButton(bool isActive) + { + view.clearSearchButton.gameObject.SetActive(isActive); + } + + public void SetInputFieldCategory(string? category) + { + view.clearSearchButton.gameObject.SetActive(!string.IsNullOrEmpty(category) || !string.IsNullOrEmpty(currentSearchText)); + view.inputFieldCategoryImage.gameObject.SetActive(!string.IsNullOrEmpty(category)); + + if (string.IsNullOrEmpty(category)) + return; + + if(Enum.TryParse(category, true, out CategoriesEnum categoryEnum)) + view.inputFieldCategoryImage.sprite = categoryMappingSO.GetCategoryImage(categoryEnum); + } + + public void SetInputText(string text) + { + view.inputField.SetTextWithoutNotify(text); + } + + public void ClearInput() + { + view.inputField.SetTextWithoutNotify(string.Empty); + view.inputFieldCategoryImage.gameObject.SetActive(false); + view.clearSearchButton.gameObject.SetActive(false); + view.BackButton.gameObject.SetActive(false); + + currentCategory = string.Empty; + currentSearchText = string.Empty; + TogglePanel?.Invoke(false); + Interactable = true; + navmapBus.ClearFilter(); + navmapBus.ClearPlacesFromMap(); + if (view.inputField.isFocused) + RestoreInput(); + } + + public void EnableBack() + { + view.inputFieldCategoryImage.gameObject.SetActive(false); + view.BackButton.gameObject.SetActive(true); + view.SearchIcon.SetActive(false); + } + + public void DisableBack() + { + view.inputFieldCategoryImage.gameObject.SetActive(false); + view.BackButton.gameObject.SetActive(false); + view.SearchIcon.SetActive(true); + } + + public void UpdateFilterAndSorting(NavmapSearchPlaceFilter filter, NavmapSearchPlaceSorting sorting) + { + navmapBus.ClearPlacesFromMap(); + currentPlaceFilter = filter; + searchFiltersView.Toggle(currentPlaceFilter); + + currentPlaceSorting = sorting; + searchFiltersView.Toggle(currentPlaceSorting); + } + + private void OnBackClicked() + { + backCancellationToken = backCancellationToken.SafeRestart(); + navmapBus.GoBackAsync(backCancellationToken.Token).Forget(); + } + + private void OnInputValueChanged(string searchText) + { + currentCategory = string.Empty; + view.clearSearchButton.gameObject.SetActive(!string.IsNullOrEmpty(searchText)); + currentSearchText = searchText; + } + + private void OnSubmitSearch(string searchText) + { + searchCancellationToken = searchCancellationToken.SafeRestart(); + SearchAsync(searchCancellationToken.Token) + .Forget(); + + async UniTaskVoid SearchAsync(CancellationToken ct) + { + UpdateFilterAndSorting(NavmapSearchPlaceFilter.All, currentPlaceSorting); + + TogglePanel?.Invoke(!string.IsNullOrEmpty(searchText)); + await navmapBus.SearchForPlaceAsync(INavmapBus.SearchPlaceParams.CreateWithDefaultParams( + page: 0, + filter: currentPlaceFilter, + sorting: currentPlaceSorting, + text: currentSearchText), ct) + .SuppressCancellationThrow(); + } + } + + private void OnSearchBarSelected(bool isSelected) + { + if (isSelected) + DisableShortcutsInput(); + else + RestoreInput(); + } + + private void DisableShortcutsInput() => + inputBlock.Disable(InputMapComponent.Kind.Shortcuts, InputMapComponent.Kind.InWorldCamera); + + private void RestoreInput() => + inputBlock.Enable(InputMapComponent.Kind.Shortcuts, InputMapComponent.Kind.InWorldCamera); + + private void Search(NavmapSearchPlaceSorting sorting) + { + UpdateFilterAndSorting(currentPlaceFilter, sorting); + + searchCancellationToken = searchCancellationToken.SafeRestart(); + + navmapBus.SearchForPlaceAsync(INavmapBus.SearchPlaceParams.CreateWithDefaultParams( + page: 0, + text: currentSearchText, + filter: currentPlaceFilter, + sorting: sorting, + category: currentCategory), searchCancellationToken.Token) + .Forget(); + } + + private void SearchByCategory(string? category) + { + UpdateFilterAndSorting(category is "Favorites" ? NavmapSearchPlaceFilter.Favorites : NavmapSearchPlaceFilter.All, currentPlaceSorting); + + if (string.IsNullOrEmpty(category)) + { + ClearInput(); + return; + } + + TogglePanel?.Invoke(true); + currentSearchText = string.Empty; + currentCategory = category; + searchCancellationToken = searchCancellationToken.SafeRestart(); + navmapBus.SearchForPlaceAsync(INavmapBus.SearchPlaceParams.CreateWithDefaultParams( + page: 0, + filter: currentPlaceFilter, + sorting: currentPlaceSorting, + category: category), searchCancellationToken.Token) + .Forget(); + } + } +} diff --git a/Explorer/Assets/DCL/Settings/SettingsController.cs b/Explorer/Assets/DCL/Settings/SettingsController.cs index 463a0e5cd00..cdf3f8c1d53 100644 --- a/Explorer/Assets/DCL/Settings/SettingsController.cs +++ b/Explorer/Assets/DCL/Settings/SettingsController.cs @@ -1,239 +1,239 @@ -using Cysharp.Threading.Tasks; -using DCL.AssetsProvision; -using DCL.Audio; -using DCL.Diagnostics; -using DCL.FeatureFlags; -using DCL.Friends.UserBlocking; -using DCL.Optimization.PerformanceBudgeting; -using DCL.Quality.Runtime; -using DCL.SDKComponents.MediaStream.Settings; -using DCL.Settings.Configuration; -using DCL.Settings.ModuleControllers; -using DCL.Settings.Settings; -using DCL.UI; -using ECS.SceneLifeCycle.IncreasingRadius; -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.Audio; -using Utility; - -namespace DCL.Settings -{ - public class SettingsController : ISection, IDisposable, ISettingsModuleEventListener - { - public enum SettingsSection - { - General, - Graphics, - Sound, - Controls, - Chat - } - - private readonly SettingsView view; - private readonly SettingsMenuConfiguration settingsMenuConfiguration; - private readonly QualitySettingsController qualitySettingsController; - private readonly AudioMixer generalAudioMixer; - private readonly VideoPrioritizationSettings videoPrioritizationSettings; - private readonly ISystemMemoryCap memoryCap; - private readonly SceneLoadingLimit sceneLoadingLimit; - private readonly VolumeBus volumeBus; - private readonly ControlsSettingsAsset controlsSettingsAsset; - private readonly RectTransform rectTransform; - private readonly List controllers = new (); - private readonly ChatSettingsAsset chatSettingsAsset; - private readonly IUserBlockingCache userBlockingCache; - private readonly IAssetsProvisioner assetsProvisioner; - private readonly IEventBus eventBus; - private readonly PointAtMarkerVisibilitySettings pointAtMarkerVisibilitySettings; - - private readonly IReadOnlyDictionary sections; - - public event Action? ChatBubblesVisibilityChanged; - - public SettingsController( - SettingsView view, - SettingsMenuConfiguration settingsMenuConfiguration, - QualitySettingsController qualitySettingsController, - AudioMixer generalAudioMixer, - VideoPrioritizationSettings videoPrioritizationSettings, - ControlsSettingsAsset controlsSettingsAsset, - ISystemMemoryCap memoryCap, - ChatSettingsAsset chatSettingsAsset, - IUserBlockingCache userBlockingCache, - SceneLoadingLimit sceneLoadingLimit, - VolumeBus volumeBus, - IAssetsProvisioner assetsProvisioner, - IEventBus eventBus, - PointAtMarkerVisibilitySettings pointAtMarkerVisibilitySettings) - { - this.view = view; - this.settingsMenuConfiguration = settingsMenuConfiguration; - this.qualitySettingsController = qualitySettingsController; - this.generalAudioMixer = generalAudioMixer; - this.memoryCap = memoryCap; - this.chatSettingsAsset = chatSettingsAsset; - this.volumeBus = volumeBus; - this.userBlockingCache = userBlockingCache; - this.controlsSettingsAsset = controlsSettingsAsset; - this.videoPrioritizationSettings = videoPrioritizationSettings; - this.sceneLoadingLimit = sceneLoadingLimit; - this.assetsProvisioner = assetsProvisioner; - this.eventBus = eventBus; - this.pointAtMarkerVisibilitySettings = pointAtMarkerVisibilitySettings; - rectTransform = view.transform.parent.GetComponent(); - - sections = new Dictionary - { - [SettingsSection.General] = (view.GeneralSectionContainer, view.GeneralSectionButton, view.GeneralSectionBackground, settingsMenuConfiguration.GeneralSectionConfig), - [SettingsSection.Graphics] = (view.GraphicsSectionContainer, view.GraphicsSectionButton, view.GraphicsSectionBackground, settingsMenuConfiguration.GraphicsSectionConfig), - [SettingsSection.Sound] = (view.SoundSectionContainer, view.SoundSectionButton, view.SoundSectionBackground, settingsMenuConfiguration.SoundSectionConfig), - [SettingsSection.Controls] = (view.ControlsSectionContainer, view.ControlsSectionButton, view.ControlsSectionBackground, settingsMenuConfiguration.ControlsSectionConfig), - [SettingsSection.Chat] = (view.ChatSectionContainer, view.ChatSectionButton, view.ChatSectionBackground, settingsMenuConfiguration.ChatSectionConfig), - }; - - foreach (var pair in sections) - pair.Value.button!.Button.onClick!.AddListener(() => OpenSection(pair.Key, pair.Value.config!.SettingsGroups.Count)); - } - - public UniTask InitializeAsync() => - GenerateSettingsAsync(); - - public void Activate() - { - view.gameObject.SetActive(true); - } - - public void Deactivate() - { - view.gameObject.SetActive(false); - } - - public void Toggle(SettingsSection section) - { - var config = sections[section]; - OpenSection(section, config.config!.SettingsGroups.Count); - } - - public void Animate(int triggerId) - { - view.PanelAnimator.SetTrigger(triggerId); - view.HeaderAnimator.SetTrigger(triggerId); - } - - public void ResetAnimator() - { - view.PanelAnimator.Rebind(); - view.HeaderAnimator.Rebind(); - view.PanelAnimator.Update(0); - view.HeaderAnimator.Update(0); - } - - public RectTransform GetRectTransform() => - rectTransform; - - public void NotifyChatBubblesVisibilityChanged(ChatBubbleVisibilitySettings newVisibility) - { - ChatBubblesVisibilityChanged?.Invoke(newVisibility); - } - - private async UniTask GenerateSettingsAsync() - { - if (settingsMenuConfiguration.SettingsGroupPrefab == null) - { - ReportHub.LogError(ReportCategory.SETTINGS_MENU, $"Settings Group prefab not found! Please set it the SettingsMenuConfiguration asset."); - return; - } - - foreach (var pair in sections) - await GenerateSettingsSectionAsync(pair.Value.config!, pair.Value.container!); - - foreach (var controller in controllers) - controller.OnAllControllersInstantiated(controllers); - - SetInitialSectionsVisibility(); - } - - private async UniTask GenerateSettingsSectionAsync(SettingsSectionConfig sectionConfig, Transform sectionContainer) - { - foreach (SettingsGroup group in sectionConfig.SettingsGroups) - { - if (group.FeatureFlagName != FeatureFlag.None && !FeatureFlagsConfiguration.Instance.IsEnabled(group.FeatureFlagName.GetStringValue())) - return; - - if (group.FeatureId != FeatureId.None && !FeaturesRegistry.Instance.IsEnabled(group.FeatureId)) return; - - SettingsGroupView generalGroupView = (await assetsProvisioner.ProvideInstanceAsync(settingsMenuConfiguration.SettingsGroupPrefab!, sectionContainer)).Value; - - if (!string.IsNullOrEmpty(group.GroupTitle)) - generalGroupView.GroupTitle.text = group.GroupTitle; - else - generalGroupView.GroupTitle.gameObject.SetActive(false); - - foreach (SettingsModuleBindingBase module in group.Modules) - if (module != null) - { - if (module.FeatureId != FeatureId.None && !FeaturesRegistry.Instance.IsEnabled(module.FeatureId)) - continue; - - var controller = - await module.CreateModuleAsync - ( - generalGroupView.ModulesContainer, - qualitySettingsController, - videoPrioritizationSettings, - generalAudioMixer, - controlsSettingsAsset, - chatSettingsAsset, - memoryCap, - sceneLoadingLimit, - userBlockingCache, - this, - assetsProvisioner, - volumeBus, - eventBus, - pointAtMarkerVisibilitySettings); - - if (controller != null) - controllers.Add(controller); - } - } - } - - private void SetInitialSectionsVisibility() - { - foreach (var pair in sections) - pair.Value.button!.gameObject.SetActive(pair.Value.config!.SettingsGroups.Count > 0); - - foreach (var pair in sections) - if (pair.Value.config!.SettingsGroups.Count > 0) - { - OpenSection(pair.Key, pair.Value.config.SettingsGroups.Count); - break; - } - } - - private void OpenSection(SettingsSection section, int settingsGroupCount) - { - foreach ((SettingsSection current, (Transform container, ButtonWithSelectableStateView button, Sprite _, SettingsSectionConfig _)) in sections) - { - bool opened = section == current; - container.gameObject.SetActive(opened && settingsGroupCount > 0); - button.SetSelected(opened); - } - - view.BackgroundImage.sprite = sections[section].background!; - view.ContentScrollRect.verticalNormalizedPosition = 1; - } - - public void Dispose() - { - foreach (SettingsFeatureController controller in controllers) - controller.Dispose(); - - foreach (var pair in sections) - pair.Value.button!.Button.onClick!.RemoveAllListeners(); - } - } -} +using Cysharp.Threading.Tasks; +using DCL.AssetsProvision; +using DCL.Audio; +using DCL.Diagnostics; +using DCL.FeatureFlags; +using DCL.Friends.UserBlocking; +using DCL.Optimization.PerformanceBudgeting; +using DCL.Quality.Runtime; +using DCL.SDKComponents.MediaStream.Settings; +using DCL.Settings.Configuration; +using DCL.Settings.ModuleControllers; +using DCL.Settings.Settings; +using DCL.UI; +using ECS.SceneLifeCycle.IncreasingRadius; +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Audio; +using Utility; + +namespace DCL.Settings +{ + public class SettingsController : ISection, IDisposable, ISettingsModuleEventListener + { + public enum SettingsSection + { + General, + Graphics, + Sound, + Controls, + Chat + } + + private readonly SettingsView view; + private readonly SettingsMenuConfiguration settingsMenuConfiguration; + private readonly QualitySettingsController qualitySettingsController; + private readonly AudioMixer generalAudioMixer; + private readonly VideoPrioritizationSettings videoPrioritizationSettings; + private readonly ISystemMemoryCap memoryCap; + private readonly SceneLoadingLimit sceneLoadingLimit; + private readonly VolumeBus volumeBus; + private readonly ControlsSettingsAsset controlsSettingsAsset; + private readonly RectTransform rectTransform; + private readonly List controllers = new (); + private readonly ChatSettingsAsset chatSettingsAsset; + private readonly IUserBlockingCache userBlockingCache; + private readonly IAssetsProvisioner assetsProvisioner; + private readonly IEventBus eventBus; + private readonly PointAtMarkerVisibilitySettings pointAtMarkerVisibilitySettings; + + private readonly IReadOnlyDictionary sections; + + public event Action? ChatBubblesVisibilityChanged; + + public SettingsController( + SettingsView view, + SettingsMenuConfiguration settingsMenuConfiguration, + QualitySettingsController qualitySettingsController, + AudioMixer generalAudioMixer, + VideoPrioritizationSettings videoPrioritizationSettings, + ControlsSettingsAsset controlsSettingsAsset, + ISystemMemoryCap memoryCap, + ChatSettingsAsset chatSettingsAsset, + IUserBlockingCache userBlockingCache, + SceneLoadingLimit sceneLoadingLimit, + VolumeBus volumeBus, + IAssetsProvisioner assetsProvisioner, + IEventBus eventBus, + PointAtMarkerVisibilitySettings pointAtMarkerVisibilitySettings) + { + this.view = view; + this.settingsMenuConfiguration = settingsMenuConfiguration; + this.qualitySettingsController = qualitySettingsController; + this.generalAudioMixer = generalAudioMixer; + this.memoryCap = memoryCap; + this.chatSettingsAsset = chatSettingsAsset; + this.volumeBus = volumeBus; + this.userBlockingCache = userBlockingCache; + this.controlsSettingsAsset = controlsSettingsAsset; + this.videoPrioritizationSettings = videoPrioritizationSettings; + this.sceneLoadingLimit = sceneLoadingLimit; + this.assetsProvisioner = assetsProvisioner; + this.eventBus = eventBus; + this.pointAtMarkerVisibilitySettings = pointAtMarkerVisibilitySettings; + rectTransform = view.transform.parent.GetComponent(); + + sections = new Dictionary + { + [SettingsSection.General] = (view.GeneralSectionContainer, view.GeneralSectionButton, view.GeneralSectionBackground, settingsMenuConfiguration.GeneralSectionConfig), + [SettingsSection.Graphics] = (view.GraphicsSectionContainer, view.GraphicsSectionButton, view.GraphicsSectionBackground, settingsMenuConfiguration.GraphicsSectionConfig), + [SettingsSection.Sound] = (view.SoundSectionContainer, view.SoundSectionButton, view.SoundSectionBackground, settingsMenuConfiguration.SoundSectionConfig), + [SettingsSection.Controls] = (view.ControlsSectionContainer, view.ControlsSectionButton, view.ControlsSectionBackground, settingsMenuConfiguration.ControlsSectionConfig), + [SettingsSection.Chat] = (view.ChatSectionContainer, view.ChatSectionButton, view.ChatSectionBackground, settingsMenuConfiguration.ChatSectionConfig), + }; + + foreach (var pair in sections) + pair.Value.button!.Button.onClick!.AddListener(() => OpenSection(pair.Key, pair.Value.config!.SettingsGroups.Count)); + } + + public UniTask InitializeAsync() => + GenerateSettingsAsync(); + + public void Activate() + { + view.gameObject.SetActive(true); + } + + public void Deactivate() + { + view.gameObject.SetActive(false); + } + + public void Toggle(SettingsSection section) + { + var config = sections[section]; + OpenSection(section, config.config!.SettingsGroups.Count); + } + + public void Animate(int triggerId) + { + view.PanelAnimator.SetTrigger(triggerId); + view.HeaderAnimator.SetTrigger(triggerId); + } + + public void ResetAnimator() + { + view.PanelAnimator.Rebind(); + view.HeaderAnimator.Rebind(); + view.PanelAnimator.Update(0); + view.HeaderAnimator.Update(0); + } + + public RectTransform GetRectTransform() => + rectTransform; + + public void NotifyChatBubblesVisibilityChanged(ChatBubbleVisibilitySettings newVisibility) + { + ChatBubblesVisibilityChanged?.Invoke(newVisibility); + } + + private async UniTask GenerateSettingsAsync() + { + if (settingsMenuConfiguration.SettingsGroupPrefab == null) + { + ReportHub.LogError(ReportCategory.SETTINGS_MENU, $"Settings Group prefab not found! Please set it the SettingsMenuConfiguration asset."); + return; + } + + foreach (var pair in sections) + await GenerateSettingsSectionAsync(pair.Value.config!, pair.Value.container!); + + foreach (var controller in controllers) + controller.OnAllControllersInstantiated(controllers); + + SetInitialSectionsVisibility(); + } + + private async UniTask GenerateSettingsSectionAsync(SettingsSectionConfig sectionConfig, Transform sectionContainer) + { + foreach (SettingsGroup group in sectionConfig.SettingsGroups) + { + if (group.FeatureFlagName != FeatureFlag.None && !FeatureFlagsConfiguration.Instance.IsEnabled(group.FeatureFlagName.GetStringValue())) + return; + + if (group.FeatureId != FeatureId.None && !FeaturesRegistry.Instance.IsEnabled(group.FeatureId)) return; + + SettingsGroupView generalGroupView = (await assetsProvisioner.ProvideInstanceAsync(settingsMenuConfiguration.SettingsGroupPrefab!, sectionContainer)).Value; + + if (!string.IsNullOrEmpty(group.GroupTitle)) + generalGroupView.GroupTitle.text = group.GroupTitle; + else + generalGroupView.GroupTitle.gameObject.SetActive(false); + + foreach (SettingsModuleBindingBase module in group.Modules) + if (module != null) + { + if (module.FeatureId != FeatureId.None && !FeaturesRegistry.Instance.IsEnabled(module.FeatureId)) + continue; + + var controller = + await module.CreateModuleAsync + ( + generalGroupView.ModulesContainer, + qualitySettingsController, + videoPrioritizationSettings, + generalAudioMixer, + controlsSettingsAsset, + chatSettingsAsset, + memoryCap, + sceneLoadingLimit, + userBlockingCache, + this, + assetsProvisioner, + volumeBus, + eventBus, + pointAtMarkerVisibilitySettings); + + if (controller != null) + controllers.Add(controller); + } + } + } + + private void SetInitialSectionsVisibility() + { + foreach (var pair in sections) + pair.Value.button!.gameObject.SetActive(pair.Value.config!.SettingsGroups.Count > 0); + + foreach (var pair in sections) + if (pair.Value.config!.SettingsGroups.Count > 0) + { + OpenSection(pair.Key, pair.Value.config.SettingsGroups.Count); + break; + } + } + + private void OpenSection(SettingsSection section, int settingsGroupCount) + { + foreach ((SettingsSection current, (Transform container, ButtonWithSelectableStateView button, Sprite _, SettingsSectionConfig _)) in sections) + { + bool opened = section == current; + container.gameObject.SetActive(opened && settingsGroupCount > 0); + button.SetSelected(opened); + } + + view.BackgroundImage.sprite = sections[section].background!; + view.ContentScrollRect.verticalNormalizedPosition = 1; + } + + public void Dispose() + { + foreach (SettingsFeatureController controller in controllers) + controller.Dispose(); + + foreach (var pair in sections) + pair.Value.button!.Button.onClick!.RemoveAllListeners(); + } + } +}