-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from Web3Auth/feat/config_api
Feat/config api
- Loading branch information
Showing
10 changed files
with
233 additions
and
28 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
Assets/Plugins/Web3AuthSDK/Api/Models/ProjectConfigResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System.Collections.Generic; | ||
|
||
public class WhitelistResponse | ||
{ | ||
public List<string> urls { get; set; } | ||
public Dictionary<string, string> signed_urls { get; set; } | ||
} | ||
|
||
public class ProjectConfigResponse | ||
{ | ||
public WhiteLabelData whitelabel { get; set; } | ||
public bool sms_otp_enabled { get; set; } | ||
public bool wallet_connect_enabled { get; set; } | ||
public string wallet_connect_project_id { get; set; } | ||
public WhitelistResponse whitelist { get; set; } | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/Plugins/Web3AuthSDK/Api/Models/ProjectConfigResponse.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
Assets/Plugins/Web3AuthSDK/Api/WhiteLabelDataExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System.Collections.Generic; | ||
|
||
public static class WhiteLabelDataExtensions | ||
{ | ||
public static WhiteLabelData merge(this WhiteLabelData target, WhiteLabelData other) | ||
{ | ||
if (target == null) | ||
return other; | ||
if (other == null) | ||
return target; | ||
|
||
return new WhiteLabelData | ||
{ | ||
appName = target.appName ?? other.appName, | ||
appUrl = target.appUrl ?? other.appUrl, | ||
logoLight = target.logoLight ?? other.logoLight, | ||
logoDark = target.logoDark ?? other.logoDark, | ||
defaultLanguage = target.defaultLanguage ?? other.defaultLanguage, | ||
mode = target.mode ?? other.mode, | ||
useLogoLoader = target.useLogoLoader ?? other.useLogoLoader, | ||
theme = mergeThemes(target.theme, other.theme) | ||
}; | ||
} | ||
|
||
private static Dictionary<string, string> mergeThemes(Dictionary<string, string> targetTheme, Dictionary<string, string> otherTheme) | ||
{ | ||
if (otherTheme == null || otherTheme.Count == 0) | ||
return targetTheme; | ||
if (targetTheme == null || targetTheme.Count == 0) | ||
return otherTheme; | ||
|
||
var mergedTheme = new Dictionary<string, string>(targetTheme); | ||
foreach (var kvp in targetTheme) | ||
{ | ||
mergedTheme[kvp.Key] = kvp.Value; | ||
} | ||
foreach (var kvp in otherTheme) | ||
{ | ||
if (!mergedTheme.ContainsKey(kvp.Key)) | ||
{ | ||
mergedTheme.Add(kvp.Key, kvp.Value); | ||
} | ||
} | ||
return mergedTheme; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/Plugins/Web3AuthSDK/Api/WhiteLabelDataExtensions.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System.Collections.Generic; | ||
|
||
public static class DictionaryExtensions | ||
{ | ||
public static Dictionary<string, string> mergeMaps(this Dictionary<string, string> source, Dictionary<string, string> other) | ||
{ | ||
if (source == null && other == null) | ||
{ | ||
return null; | ||
} | ||
else if (source == null) | ||
{ | ||
return new Dictionary<string, string>(other); | ||
} | ||
else if (other == null) | ||
{ | ||
return new Dictionary<string, string>(source); | ||
} | ||
|
||
var mergedMap = new Dictionary<string, string>(source); | ||
foreach (var entry in other) | ||
{ | ||
mergedMap[entry.Key] = entry.Value; | ||
} | ||
|
||
return mergedMap; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/Plugins/Web3AuthSDK/Types/DictionaryExtensions.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters