Skip to content

Commit

Permalink
feat: add source param to web avatar creator (#186)
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-677](https://ready-player-me.atlassian.net/browse/SDK-677)

## Description

-   Add source parameter to the URLs

<!-- Testability -->

## How to Test

- Check, that the event is sent to amplitude with the given source, when
opening the avatar creator

<!-- Update your progress with the task here -->

## 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-677]:
https://ready-player-me.atlassian.net/browse/SDK-677?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
  • Loading branch information
rk132 authored Dec 13, 2023
2 parents 9825f7c + ea58e9c commit dafbb07
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
8 changes: 8 additions & 0 deletions Runtime/WebView/Data/UrlConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class UrlConfig
private const string TAG = nameof(UrlConfig);
private const string CLEAR_CACHE_PARAM = "clearCache";
private const string FRAME_API_PARAM = "frameApi";
private const string SOURCE_PARAM = "source";
private const string QUICK_START_PARAM = "quickStart";
private const string SELECT_BODY_PARAM = "selectBodyType";
private const string LOGIN_TOKEN_PARAM = "token";
Expand Down Expand Up @@ -41,6 +42,13 @@ public string BuildUrl(string loginToken = "")
var builder = new StringBuilder($"https://{CoreSettingsHandler.CoreSettings.Subdomain}.readyplayer.me/");
builder.Append(language != Language.Default ? $"{language.GetValue()}/" : string.Empty);
builder.Append($"avatar?{FRAME_API_PARAM}");
#if UNITY_ANDROID
builder.Append($"&{SOURCE_PARAM}=unity-android-avatar-creator");
#elif UNITY_IOS
builder.Append($"&{SOURCE_PARAM}=unity-ios-avatar-creator");
#else
builder.Append($"&{SOURCE_PARAM}=unity-avatar-creator");
#endif
builder.Append(clearCache ? $"&{CLEAR_CACHE_PARAM}" : string.Empty);
if (loginToken != string.Empty)
{
Expand Down
20 changes: 10 additions & 10 deletions Tests/Editor/UrlConfigTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ namespace ReadyPlayerMe.Core.Tests
public class UrlConfigTests : MonoBehaviour
{
private static readonly string URL_BASE = $"https://{CoreSettingsHandler.CoreSettings.Subdomain}.readyplayer.me";
private readonly string URL_DEFAULT = $"{URL_BASE}/avatar?frameApi&selectBodyType";
private readonly string URL_LANG_GERMAN = $"{URL_BASE}/de/avatar?frameApi&selectBodyType";
private readonly string URL_LANG_BRAZIL = $"{URL_BASE}/pt-BR/avatar?frameApi&selectBodyType";
private readonly string URL_DEFAULT = $"{URL_BASE}/avatar?frameApi&source=unity-avatar-creator&selectBodyType";
private readonly string URL_LANG_GERMAN = $"{URL_BASE}/de/avatar?frameApi&source=unity-avatar-creator&selectBodyType";
private readonly string URL_LANG_BRAZIL = $"{URL_BASE}/pt-BR/avatar?frameApi&source=unity-avatar-creator&selectBodyType";

private readonly string URL_GENDER_MALE = $"{URL_BASE}/avatar?frameApi&gender=male&selectBodyType";
private readonly string URL_GENDER_NONE = $"{URL_BASE}/avatar?frameApi&gender=male&selectBodyType";
private readonly string URL_GENDER_MALE = $"{URL_BASE}/avatar?frameApi&source=unity-avatar-creator&gender=male&selectBodyType";
private readonly string URL_GENDER_NONE = $"{URL_BASE}/avatar?frameApi&source=unity-avatar-creator&gender=male&selectBodyType";

private readonly string URL_TYPE_FULLBODY = $"{URL_BASE}/avatar?frameApi&bodyType=fullbody";
private readonly string URL_TYPE_HALFBODY = $"{URL_BASE}/avatar?frameApi&bodyType=halfbody";
private readonly string URL_TYPE_FULLBODY = $"{URL_BASE}/avatar?frameApi&source=unity-avatar-creator&bodyType=fullbody";
private readonly string URL_TYPE_HALFBODY = $"{URL_BASE}/avatar?frameApi&source=unity-avatar-creator&bodyType=halfbody";

private readonly string URL_CLEAR_CACHE = $"{URL_BASE}/avatar?frameApi&clearCache&selectBodyType";
private readonly string URL_CLEAR_CACHE = $"{URL_BASE}/avatar?frameApi&source=unity-avatar-creator&clearCache&selectBodyType";

private readonly string URL_QUICK_START = $"{URL_BASE}/avatar?frameApi&quickStart";
private readonly string URL_TOKEN = $"{URL_BASE}/avatar?frameApi&token=TOKEN&selectBodyType";
private readonly string URL_QUICK_START = $"{URL_BASE}/avatar?frameApi&source=unity-avatar-creator&quickStart";
private readonly string URL_TOKEN = $"{URL_BASE}/avatar?frameApi&source=unity-avatar-creator&token=TOKEN&selectBodyType";
private const string LOGIN_TOKEN = "TOKEN";

public UrlConfig config;
Expand Down

0 comments on commit dafbb07

Please sign in to comment.