Skip to content

Commit

Permalink
sdk url default
Browse files Browse the repository at this point in the history
  • Loading branch information
chaitanyapotti committed Oct 31, 2023
1 parent 6bc1413 commit ebe3650
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 24 additions & 21 deletions app/src/main/java/com/web3auth/app/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -114,31 +114,34 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemClickListener {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

// Configure Web3Auth
web3Auth = Web3Auth(
Web3AuthOptions(
context = this,
clientId = getString(R.string.web3auth_project_id),
network = Network.SAPPHIRE_DEVNET,
buildEnv = BuildEnv.TESTING,
redirectUrl = Uri.parse("torusapp://org.torusresearch.web3authexample"),
whiteLabel = WhiteLabelData(
"Web3Auth Sample App", null, null, null,
Language.EN, ThemeModes.LIGHT, true,
hashMapOf(
"primary" to "#123456"
)
),
loginConfig = hashMapOf(
"loginConfig" to LoginConfigItem(
"torus",
typeOfLogin = TypeOfLogin.GOOGLE,
name = ""
)
val options = Web3AuthOptions(
context = this,
clientId = getString(R.string.web3auth_project_id),
network = Network.SAPPHIRE_DEVNET,
redirectUrl = Uri.parse("torusapp://org.torusresearch.web3authexample"),
whiteLabel = WhiteLabelData(
"Web3Auth Sample App", null, null, null,
Language.EN, ThemeModes.LIGHT, true,
hashMapOf(
"primary" to "#123456"
)
),
loginConfig = hashMapOf(
"loginConfig" to LoginConfigItem(
"torus",
typeOfLogin = TypeOfLogin.GOOGLE,
name = ""
)
)
)

println("params: $options")

// Configure Web3Auth
web3Auth = Web3Auth(
options
)

web3Auth.setResultUrl(intent.data)

// for session response
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/com/web3auth/core/types/Web3AuthOptions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ data class Web3AuthOptions(
var context: Context,
val clientId: String,
val network: Network,
var buildEnv: BuildEnv,
var buildEnv: BuildEnv? = BuildEnv.PRODUCTION,
@Transient var redirectUrl: Uri? = null,
var sdkUrl: String = getSdkUrl(buildEnv),
val whiteLabel: WhiteLabelData? = null,
Expand All @@ -17,7 +17,7 @@ data class Web3AuthOptions(
val mfaSettings: MfaSettings? = null
)

fun getSdkUrl(buildEnv: BuildEnv): String {
fun getSdkUrl(buildEnv: BuildEnv?): String {
val sdkUrl: String = when (buildEnv) {
BuildEnv.STAGING -> {
"https://staging-auth.web3auth.io/$openLoginVersion"
Expand Down

0 comments on commit ebe3650

Please sign in to comment.