Skip to content

Commit 78cc6bd

Browse files
committed
resolved PR comments
Signed-off-by: Gaurav Goel <[email protected]>
1 parent 4c53ce0 commit 78cc6bd

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

Assets/Plugins/Web3AuthSDK/Samples/Web3AuthSample.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ void Start()
5757
appName = "Web3Auth Sample App",
5858
logoLight = null,
5959
logoDark = null,
60-
defaultLanguage = Language.EN.ToString().ToLower(),
61-
mode = ThemeModes.LIGHT.ToString().ToLower(),
60+
defaultLanguage = Language.en,
61+
mode = ThemeModes.dark,
6262
theme = new Dictionary<string, string>
6363
{
6464
{ "primary", "#123456" }

Assets/Plugins/Web3AuthSDK/Types/WhiteLabelData.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
using System.Collections.Generic;
2+
using Newtonsoft.Json;
23

3-
public class WhiteLabelData {
4+
public class WhiteLabelData {
45
public string? appName { get; set; }
56
public string? logoLight { get; set; }
67
public string? logoDark { get; set; }
7-
public string? defaultLanguage { get; set; } = "en";
8-
public string? mode { get; set; } = "light";
8+
public Web3Auth.Language? defaultLanguage { get; set; } = Web3Auth.Language.en;
9+
public Web3Auth.ThemeModes? mode { get; set; } = Web3Auth.ThemeModes.light;
910
public Dictionary<string, string>? theme { get; set; }
1011
public string? appUrl { get; set; }
1112
public bool? useLogoLoader { get; set; } = false;

Assets/Plugins/Web3AuthSDK/Web3Auth.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Newtonsoft.Json;
2+
using Newtonsoft.Json.Converters;
23
using System;
34
using System.Collections.Generic;
45
using System.Text;
@@ -28,12 +29,12 @@ public enum BuildEnv
2829

2930
public enum ThemeModes
3031
{
31-
LIGHT, DARK, AUTO
32+
light, dark, auto
3233
}
3334

3435
public enum Language
3536
{
36-
EN, DE, JA, KO, ZH, ES, FR, PT, NL
37+
en, de, ja, ko, zh, es, fr, pt, nl
3738
}
3839

3940
private Web3AuthOptions web3AuthOptions;
@@ -89,27 +90,31 @@ public void Awake()
8990

9091
public void setOptions(Web3AuthOptions web3AuthOptions)
9192
{
93+
JsonSerializerSettings settings = new JsonSerializerSettings
94+
{
95+
Converters = new List<JsonConverter> { new StringEnumConverter() },
96+
Formatting = Formatting.Indented
97+
};
9298

9399
this.web3AuthOptions = web3AuthOptions;
94100

95101
if (this.web3AuthOptions.redirectUrl != null)
96102
this.initParams["redirectUrl"] = this.web3AuthOptions.redirectUrl;
97103

98104
if (this.web3AuthOptions.whiteLabel != null)
99-
this.initParams["whiteLabel"] = JsonConvert.SerializeObject(this.web3AuthOptions.whiteLabel);
105+
this.initParams["whiteLabel"] = JsonConvert.SerializeObject(this.web3AuthOptions.whiteLabel, settings);
100106

101107
if (this.web3AuthOptions.loginConfig != null)
102-
this.initParams["loginConfig"] = JsonConvert.SerializeObject(this.web3AuthOptions.loginConfig);
108+
this.initParams["loginConfig"] = JsonConvert.SerializeObject(this.web3AuthOptions.loginConfig, settings);
103109

104110
if (this.web3AuthOptions.clientId != null)
105111
this.initParams["clientId"] = this.web3AuthOptions.clientId;
106112

107-
if (this.web3AuthOptions.clientId != null)
113+
if (this.web3AuthOptions.clientId != null)
108114
this.initParams["buildEnv"] = this.web3AuthOptions.buildEnv.ToString().ToLower();
109115

110116
this.initParams["network"] = this.web3AuthOptions.network.ToString().ToLower();
111117

112-
113118
if (this.web3AuthOptions.useCoreKitKey.HasValue)
114119
this.initParams["useCoreKitKey"] = this.web3AuthOptions.useCoreKitKey.Value;
115120

0 commit comments

Comments
 (0)