Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions sample/Assets/Scripts/Passport/ImxRegister/ImxRegisterScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,16 @@ public async void RegisterOffchain()
}
catch (PassportException e)
{
ShowOutput($"Unable to register off-chain: {e.Message} ({e.Type})");
// Handle 409 - account already registered
if (e.Type == PassportErrorType.USER_REGISTRATION_ERROR &&
(e.Message.Contains("409") || e.Message.Contains("already registered")))
{
ShowOutput("Passport account already registered");
}
else
{
ShowOutput($"Unable to register off-chain: {e.Message} ({e.Type})");
}
}
catch (Exception e)
{
Expand All @@ -58,4 +67,4 @@ private void ShowOutput(string message)
Output.text = message;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Immutable.Passport.Model
public enum MarketingConsentStatus
{
OptedIn,
Subscribed,
Unsubscribed
}

Expand All @@ -27,6 +28,7 @@ public static string ToApiString(this MarketingConsentStatus status)
return status switch
{
MarketingConsentStatus.OptedIn => "opted_in",
MarketingConsentStatus.Subscribed => "subscribed",
MarketingConsentStatus.Unsubscribed => "unsubscribed",
_ => throw new ArgumentOutOfRangeException(nameof(status), status, "Unknown MarketingConsentStatus value")
};
Expand Down
3 changes: 3 additions & 0 deletions src/Packages/Passport/Runtime/Scripts/Public/PassportUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,9 @@ private async void HandleLoginData(string jsonData)
case "opted_in":
loginOptions.marketingConsentStatus = MarketingConsentStatus.OptedIn;
break;
case "subscribed":
loginOptions.marketingConsentStatus = MarketingConsentStatus.Subscribed;
break;
case "unsubscribed":
loginOptions.marketingConsentStatus = MarketingConsentStatus.Unsubscribed;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,16 @@ public async void RegisterOffchain()
}
catch (PassportException e)
{
ShowOutput($"Unable to register off-chain: {e.Message} ({e.Type})");
// Handle 409 - account already registered
if (e.Type == PassportErrorType.USER_REGISTRATION_ERROR &&
(e.Message.Contains("409") || e.Message.Contains("already registered")))
{
ShowOutput("Passport account already registered");
}
else
{
ShowOutput($"Unable to register off-chain: {e.Message} ({e.Type})");
}
}
catch (Exception e)
{
Expand All @@ -58,4 +67,4 @@ private void ShowOutput(string message)
Output.text = message;
}
}
}
}
Loading