Skip to content

Commit

Permalink
[SDK-705] - feat: clean up demo subdomain toggle (#184)
Browse files Browse the repository at this point in the history
<!-- Copy the TICKETID for this task from Jira and add it to the PR name
in brackets -->
<!-- PR name should look like: [TICKETID] My Pull Request -->

<!-- Add link for the ticket here editing the TICKETID-->

## [SDK-705](https://ready-player-me.atlassian.net/browse/SDK-705)

## Description

- Remove I don't have an account check, so that the subdomain is not
reset, when opening from new computer.

<!-- Fill the section below with Added, Updated and Removed information.
-->
<!-- If there is no item under one of the lists remove it's title. -->

<!-- Testability -->

## How to Test

- Add to new project to verify, that it defaults to demo
- When subdomain is set 

## Checklist

-   [ ] Tests written or updated for the changes.
-   [ ] Documentation is updated.
-   [ ] Changelog is updated.

<!--- Remember to copy the Changes Section into the commit message when
you close the PR -->





[SDK-705]:
https://ready-player-me.atlassian.net/browse/SDK-705?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
  • Loading branch information
rk132 authored Dec 7, 2023
2 parents c976f09 + 1ec508f commit 9825f7c
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 47 deletions.
27 changes: 0 additions & 27 deletions Editor/UI/EditorWindows/SetupGuide/SetupGuide.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public class SetupGuide : EditorWindow
private const string ANALYTICS_PRIVACY_URL = "https://docs.readyplayer.me/ready-player-me/integration-guides/unity/help-us-improve-the-unity-sdk";
private const string SUBDOMAIN_PANEL = "SubdomainPanel";
private const string STUDIO_URL_LABEL = "StudioUrl";
private const string USE_DEMO_SUBDOMAIN_TOGGLE = "UseDemoSubdomainToggle";
private const string ANALYTICS_PANEL = "AnalyticsPanel";
private const string ANALYTICS_ENABLED_TOGGLE = "AnalyticsEnabledToggle";
private const string NEXT_BUTTON = "NextButton";
Expand Down Expand Up @@ -86,32 +85,6 @@ private VisualElement InitializeSubdomainPanel()
ToggleNextButton();
};

if (!ProjectPrefs.GetBool(USE_DEMO_SUBDOMAIN_TOGGLE) && CoreSettingsHandler.CoreSettings.Subdomain == CoreSettings.DEFAULT_SUBDOMAIN)
{
subdomainTemplate.ClearSubdomain();
nextButton.SetEnabled(false);
}
var demoSubdomainToggle = subdomainPanel.Q<Toggle>(USE_DEMO_SUBDOMAIN_TOGGLE);
demoSubdomainToggle.value = ProjectPrefs.GetBool(USE_DEMO_SUBDOMAIN_TOGGLE);
subdomainTemplate.SetFieldEnabled(!ProjectPrefs.GetBool(USE_DEMO_SUBDOMAIN_TOGGLE));
demoSubdomainToggle.RegisterValueChangedCallback(x =>
{
if (x.newValue)
{
subdomainTemplate.SetDefaultSubdomain();
subdomainTemplate.SetFieldEnabled(false);
nextButton.SetEnabled(true);
ProjectPrefs.SetBool(USE_DEMO_SUBDOMAIN_TOGGLE, true);
}
else
{
subdomainTemplate.ClearSubdomain();
subdomainTemplate.SetFieldEnabled(true);
nextButton.SetEnabled(false);
ProjectPrefs.SetBool(USE_DEMO_SUBDOMAIN_TOGGLE, false);
}
});

return subdomainPanel;
}

Expand Down
1 change: 0 additions & 1 deletion Editor/UI/EditorWindows/SetupGuide/SetupGuide.uxml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
</ui:VisualElement>
<ReadyPlayerMe.Core.Editor.SubdomainTemplate class="SubdomainTemplate" style="margin-top: 15px; flex-shrink: 0;" />
<ReadyPlayerMe.Core.Editor.AppIdTemplate style="flex-shrink: 0;" />
<ui:Toggle label="I don&apos;t have an account. Use demo subdomain instead." name="UseDemoSubdomainToggle" style="margin-left: 15px; margin-right: 15px; flex-direction: row-reverse; align-items: center; justify-content: space-between; align-self: flex-start; margin-top: 15px; margin-bottom: 15px; display: none;" />
</ui:VisualElement>
<ui:VisualElement name="AnalyticsPanel" style="flex-grow: 0; background-color: rgba(0, 0, 0, 0); margin-top: 0; height: 230px; flex-shrink: 0; display: flex; width: 500px;">
<ui:VisualElement name="Heading" class="heading" style="flex-grow: 0; background-color: rgba(0, 0, 0, 0);">
Expand Down
19 changes: 0 additions & 19 deletions Editor/UI/EditorWindows/Templates/SubdomainTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,6 @@ public SubdomainTemplate()
subdomainField.RegisterCallback<FocusOutEvent>(OnSubdomainFocusOut);
}

public void SetDefaultSubdomain()
{
partnerSubdomain = CoreSettings.DEFAULT_SUBDOMAIN;
subdomainField.value = partnerSubdomain;
SaveSubdomain();
}

public void ClearSubdomain()
{
partnerSubdomain = "";
subdomainField.value = partnerSubdomain;
}

public void SetFieldEnabled(bool enabled)
{
isSubdomainFieldEnabled = enabled;
subdomainField.SetEnabled(isSubdomainFieldEnabled);
}

private static void OnSubdomainHelpClicked()
{
AnalyticsEditorLogger.EventLogger.LogFindOutMore(HelpSubject.Subdomain);
Expand Down

0 comments on commit 9825f7c

Please sign in to comment.