Skip to content

Commit 521ab45

Browse files
committed
feat: Resolved PR comments
Signed-off-by: Gaurav Goel <[email protected]>
1 parent cea3066 commit 521ab45

File tree

4 files changed

+22
-24
lines changed

4 files changed

+22
-24
lines changed

core/src/main/java/com/web3auth/core/Web3Auth.kt

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -231,32 +231,16 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions, context: Context) : WebViewResu
231231
//fetch project config
232232
fetchProjectConfig().whenComplete { _, err ->
233233
if (err == null) {
234+
val chainIds = web3AuthOption.chains?.chainId?.let { arrayOf(it) } ?: emptyArray()
234235
val properties = mutableMapOf(
235-
"chain_ids" to listOf("eip155", "solana", "other"),
236+
"chain_ids" to chainIds,
237+
"chain_nameSpaces" to listOf("eip155", "solana", "other"),
236238
"logging_enabled" to web3AuthOption.enableLogging,
237239
"auth_build_env" to web3AuthOption.authBuildEnv,
238-
"auth_ux_mode" to "popup",
239-
"auth_mfa_settings" to emptyList<String>(),
240+
"auth_mfa_settings" to web3AuthOption.mfaSettings,
240241
"whitelabel_logo_light_enabled" to (web3AuthOption.whiteLabel?.logoLight != null),
241242
"whitelabel_logo_dark_enabled" to (web3AuthOption.whiteLabel?.logoDark != null),
242243
"whitelabel_theme_mode" to (web3AuthOption.whiteLabel?.theme),
243-
"ui_login_methods_order" to listOf(
244-
"google",
245-
"twitter",
246-
"facebook",
247-
"discord",
248-
"farcaster",
249-
"apple",
250-
"github",
251-
"reddit",
252-
"line",
253-
"kakao",
254-
"linkedin",
255-
"twitch",
256-
"wechat",
257-
"email_passwordless",
258-
"sms_passwordless"
259-
),
260244
"duration" to System.currentTimeMillis() - startTime,
261245
"integration_type" to "android",
262246
"dapp_url" to this.loginParams?.dappUrl,
@@ -485,7 +469,6 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions, context: Context) : WebViewResu
485469
"dapp_url" to loginParams.dappUrl.toString(),
486470
"chain_id" to web3AuthOption.defaultChainId.toString(),
487471
"chains" to (web3AuthOption.chains?.toString() ?: "[]"),
488-
"auth_ux_mode" to "popup",
489472
)
490473

491474
if (loginParams.idToken.isNullOrEmpty()) {
@@ -892,6 +875,9 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions, context: Context) : WebViewResu
892875
}
893876
web3AuthOption.authConnectionConfig =
894877
(web3AuthOption.authConnectionConfig.orEmpty() + projectConfigResponse?.embeddedWalletAuth.orEmpty())
878+
web3AuthOption.mfaSettings =
879+
web3AuthOption.mfaSettings?.merge(projectConfigResponse?.mfaSettings)
880+
?: projectConfigResponse?.mfaSettings
895881
projectConfigCompletableFuture.complete(true)
896882
} else {
897883
projectConfigCompletableFuture.completeExceptionally(
@@ -1256,7 +1242,6 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions, context: Context) : WebViewResu
12561242
"dapp_url" to loginParams?.dappUrl.toString(),
12571243
"chain_id" to web3AuthOption.defaultChainId.toString(),
12581244
"chains" to (web3AuthOption.chains?.toString() ?: "[]"),
1259-
"auth_ux_mode" to "popup",
12601245
"duration" to System.currentTimeMillis() - startTime,
12611246
"error_message" to (error?.name ?: "Unknown Error")
12621247
)

core/src/main/java/com/web3auth/core/types/MfaSettings.kt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,16 @@ data class MfaSettings(
1010
@Keep private var passwordFactor: MfaSetting? = null,
1111
@Keep private var passkeysFactor: MfaSetting? = null,
1212
@Keep private var authenticatorFactor: MfaSetting? = null,
13-
)
13+
) {
14+
fun merge(other: MfaSettings?): MfaSettings {
15+
if (other == null) return this
16+
return MfaSettings(
17+
deviceShareFactor = other.deviceShareFactor ?: this.deviceShareFactor,
18+
backUpShareFactor = other.backUpShareFactor ?: this.backUpShareFactor,
19+
socialBackupFactor = other.socialBackupFactor ?: this.socialBackupFactor,
20+
passwordFactor = other.passwordFactor ?: this.passwordFactor,
21+
passkeysFactor = other.passkeysFactor ?: this.passkeysFactor,
22+
authenticatorFactor = other.authenticatorFactor ?: this.authenticatorFactor
23+
)
24+
}
25+
}

core/src/main/java/com/web3auth/core/types/ProjectConfigResponse.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ data class ProjectConfigResponse(
2424
@Keep val walletConnectProjectId: String?,
2525
@Keep val whitelabel: WhiteLabelData? = null,
2626
@Keep val teamId: Int? = null,
27+
@Keep val mfaSettings: MfaSettings? = null
2728
)
2829

2930
@Keep

core/src/main/java/com/web3auth/core/types/Web3AuthOptions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ data class Web3AuthOptions(
2828
@Keep val web3AuthNetwork: Web3AuthNetwork,
2929
@Keep val useSFAKey: Boolean? = false,
3030
@Keep val walletServicesConfig: WalletServicesConfig? = null,
31-
@Keep val mfaSettings: MfaSettings? = null,
31+
@Keep var mfaSettings: MfaSettings? = null,
3232
) {
3333
init {
3434
if (dashboardUrl == null) {

0 commit comments

Comments
 (0)