Skip to content

Commit d054578

Browse files
committed
allow emailOTP only for epic store
1 parent cfea475 commit d054578

4 files changed

Lines changed: 27 additions & 11 deletions

File tree

Explorer/Assets/DCL/AuthenticationScreenFlow/Assets/Prefabs/LoginSelection.Screen.prefab

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3216,6 +3216,8 @@ MonoBehaviour:
32163216
<CancelLoginButton>k__BackingField: {fileID: 9108319191272288200}
32173217
<EmailOTPContainer>k__BackingField: {fileID: 5285033395635913484}
32183218
<EmailInputField>k__BackingField: {fileID: 2001940849056367380}
3219+
<OtherLoginContainer>k__BackingField: {fileID: 5887702060069110797}
3220+
<ContinueWithTextContainer>k__BackingField: {fileID: 3844889584895123327}
32193221
<LoginMetamaskButton>k__BackingField: {fileID: 4481630630708771614}
32203222
<LoginGoogleButton>k__BackingField: {fileID: 9078712830092277137}
32213223
<LoginDiscordButton>k__BackingField: {fileID: 8034867738283704265}

Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenController.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,15 @@
1212
using DCL.Profiles;
1313
using DCL.Profiles.Self;
1414
using DCL.SceneLoadingScreens.SplashScreen;
15-
using DCL.Settings.Utils;
1615
using DCL.UI;
1716
using DCL.Utilities;
1817
using DCL.Utility;
1918
using DCL.Web3.Authenticators;
2019
using DCL.Web3.Identities;
2120
using DCL.WebRequests;
22-
using Global.AppArgs;
2321
using MVC;
2422
using System;
25-
using System.Collections.Generic;
2623
using System.Threading;
27-
using UnityEngine;
2824
using Utility;
2925

3026
namespace DCL.AuthenticationScreenFlow
@@ -49,6 +45,7 @@ public enum AuthStatus
4945

5046
internal const int ANIMATION_DELAY = 300;
5147
internal const string LOADING_TRANSACTION_NAME = "loading_process";
48+
private const string EPIC_STORE_INSTALL_SOURCE = "epic";
5249

5350
private readonly ICompositeWeb3Provider web3Authenticator;
5451
private readonly ISelfProfile selfProfile;
@@ -150,9 +147,13 @@ protected override void OnViewInstantiated()
150147
base.OnViewInstantiated();
151148

152149
audio = new AuthenticationScreenAudio(viewInstance, audioMixerVolumesController, backgroundMusic);
153-
characterPreviewController = new AuthenticationScreenCharacterPreviewController(viewInstance.CharacterPreviewView, emotesSettings, characterPreviewFactory, world, characterPreviewEventBus);
150+
characterPreviewController = new AuthenticationScreenCharacterPreviewController(viewInstance!.CharacterPreviewView, emotesSettings, characterPreviewFactory, world, characterPreviewEventBus);
154151

155-
bool enableEmailOTP = FeaturesRegistry.Instance.IsEnabled(FeatureId.EmailOTPAuth);
152+
bool isEpicBuild = installSource == EPIC_STORE_INSTALL_SOURCE;
153+
// Epic builds only support emailOTP due to deeplink limitations
154+
// See: https://github.com/decentraland/unity-explorer/issues/9554
155+
bool enableEmailOTP = FeaturesRegistry.Instance.IsEnabled(FeatureId.EmailOTPAuth) || isEpicBuild;
156+
bool otherLoginMethodsEnabled = !isEpicBuild;
156157
viewInstance.LoginSelectionAuthView.EmailOTPContainer.SetActive(enableEmailOTP);
157158

158159
viewInstance.DiscordButton.onClick.AddListener(OpenSupportUrl);
@@ -163,7 +164,8 @@ protected override void OnViewInstantiated()
163164

164165
fsm.AddStates(
165166
new InitAuthState(viewInstance, installSource),
166-
new LoginSelectionAuthState(fsm, viewInstance, this, CurrentState, splashScreen, web3Authenticator, webBrowser, enableEmailOTP),
167+
new LoginSelectionAuthState(fsm, viewInstance, this, CurrentState, splashScreen, web3Authenticator, webBrowser,
168+
enableEmailOTP, otherLoginMethodsEnabled),
167169
new ProfileFetchingAuthState(fsm, viewInstance, this, CurrentState, selfProfile, storedIdentityProvider),
168170
new IdentityVerificationDappDeepLinkAuthState(fsm, viewInstance, this, CurrentState, web3Authenticator),
169171
new LobbyForExistingAccountAuthState(fsm, viewInstance, this, splashScreen, CurrentState, characterPreviewController),

Explorer/Assets/DCL/AuthenticationScreenFlow/States/LoginSelectionAuthState.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,14 @@ public class LoginSelectionAuthState : AuthStateBase, IState, IPayloadedState<Er
2424
private readonly ICompositeWeb3Provider compositeWeb3Provider;
2525
private readonly UnityAppWebBrowser webBrowser;
2626
private readonly bool enableEmailOTP;
27+
private readonly bool otherLoginMethodsEnabled;
2728

2829
public LoginSelectionAuthState(MVCStateMachine<AuthStateBase> machine,
2930
AuthenticationScreenView viewInstance, AuthenticationScreenController controller,
3031
ReactiveProperty<AuthStatus> currentState, SplashScreen splashScreen,
31-
ICompositeWeb3Provider compositeWeb3Provider, UnityAppWebBrowser webBrowser, bool enableEmailOTP) : base(viewInstance)
32+
ICompositeWeb3Provider compositeWeb3Provider, UnityAppWebBrowser webBrowser,
33+
bool enableEmailOTP,
34+
bool otherLoginMethodsEnabled) : base(viewInstance)
3235
{
3336
view = viewInstance.LoginSelectionAuthView;
3437

@@ -39,6 +42,7 @@ public LoginSelectionAuthState(MVCStateMachine<AuthStateBase> machine,
3942
this.compositeWeb3Provider = compositeWeb3Provider;
4043
this.webBrowser = webBrowser;
4144
this.enableEmailOTP = enableEmailOTP;
45+
this.otherLoginMethodsEnabled = otherLoginMethodsEnabled;
4246

4347
// Cancel button persists in the Verification state (until code is shown)
4448
view.CancelLoginButton.onClick.AddListener(OnCancelBeforeVerification);
@@ -136,7 +140,7 @@ public void Enter(int animHash)
136140
if (splashScreen != null) // it can be destroyed after first login
137141
splashScreen.FadeOutAndHide();
138142

139-
view.Show(animHash, moreOptionsExpanded: !enableEmailOTP);
143+
view.Show(animHash, moreOptionsExpanded: !enableEmailOTP, otherLoginMethodsEnabled);
140144
Enter();
141145
}
142146

Explorer/Assets/DCL/AuthenticationScreenFlow/Views/LoginSelectionAuthView.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ public class LoginSelectionAuthView : ViewBase
2323
public EmailInputFieldView EmailInputField { get; private set; } = null!;
2424

2525
[field: Header("SECONDARY LOGINS")]
26+
[field: SerializeField]
27+
public GameObject OtherLoginContainer { get; private set; } = null!;
28+
29+
[field: SerializeField]
30+
public GameObject ContinueWithTextContainer { get; private set; } = null!;
31+
2632
[field: SerializeField]
2733
public Button LoginMetamaskButton { get; private set; } = null!;
2834

@@ -103,13 +109,15 @@ private void SetOptionsPanelVisibility(bool isExpanded)
103109
moreOptionsPanel.SetActive(isExpanded);
104110
}
105111

106-
public void Show(int animHash, bool moreOptionsExpanded)
112+
public void Show(int animHash, bool moreOptionsExpanded, bool otherLoginMethodsEnabled)
107113
{
108114
showAnimHash = animHash;
109115
ShowAsync(CancellationToken.None).Forget();
110116

111117
areOptionsExpanded = moreOptionsExpanded;
112-
SetOptionsPanelVisibility(areOptionsExpanded);
118+
OtherLoginContainer.SetActive(otherLoginMethodsEnabled);
119+
ContinueWithTextContainer.SetActive(otherLoginMethodsEnabled && !moreOptionsExpanded);
120+
SetOptionsPanelVisibility(areOptionsExpanded && otherLoginMethodsEnabled);
113121

114122
SetLoadingSpinnerVisibility(false);
115123
}

0 commit comments

Comments
 (0)