@@ -122,7 +122,6 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemClickListener {
122122 val signOutButton = findViewById<Button >(R .id.signOutButton)
123123 val launchWalletButton = findViewById<Button >(R .id.launchWalletButton)
124124 val signMsgButton = findViewById<Button >(R .id.signMsgButton)
125- val signResultButton = findViewById<Button >(R .id.signResultButton)
126125 val btnSetUpMfa = findViewById<Button >(R .id.btnSetUpMfa)
127126 val spinner = findViewById<TextInputLayout >(R .id.verifierList)
128127 val hintEmailEditText = findViewById<EditText >(R .id.etEmailHint)
@@ -135,6 +134,7 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemClickListener {
135134 print (ex)
136135 }
137136
137+
138138 if (userInfo != null ) {
139139 val jsonObject = JSONObject (gson.toJson(web3Auth.getWeb3AuthResponse()))
140140 contentTextView.text = jsonObject.toString(4 ) + " \n Private Key: " + key
@@ -155,7 +155,6 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemClickListener {
155155 btnSetUpMfa.visibility = View .GONE
156156 launchWalletButton.visibility = View .GONE
157157 signMsgButton.visibility = View .GONE
158- signResultButton.visibility = View .GONE
159158 spinner.visibility = View .VISIBLE
160159 }
161160 }
@@ -165,7 +164,6 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemClickListener {
165164 setContentView(R .layout.activity_main)
166165
167166 val options = Web3AuthOptions (
168- context = this ,
169167 clientId = " BFuUqebV5I8Pz5F7a5A2ihW7YVmbv_OHXnHYDv6OltAD5NGr6e-ViNvde3U4BHdn6HvwfkgobhVu4VwC-OSJkik" ,
170168 network = Network .SAPPHIRE_DEVNET ,
171169 redirectUrl = Uri .parse(" torusapp://org.torusresearch.web3authexample" ),
@@ -186,15 +184,15 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemClickListener {
186184 clientId = " d84f6xvbdV75VTGmHiMWfZLeSPk8M07C" ,
187185 )
188186 ),
189- buildEnv = BuildEnv .TESTING ,
187+ buildEnv = BuildEnv .PRODUCTION ,
190188 sessionTime = 86400 ,
191189 )
192190
193191 println (" params: $options " )
194192
195193 // Configure Web3Auth
196194 web3Auth = Web3Auth (
197- options
195+ options, this
198196 )
199197
200198 web3Auth.setResultUrl(intent.data)
@@ -237,7 +235,6 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemClickListener {
237235 }
238236 }
239237
240- val signResultButton = findViewById<Button >(R .id.signResultButton)
241238 val signMsgButton = findViewById<Button >(R .id.signMsgButton)
242239 signMsgButton.setOnClickListener {
243240 val credentials: Credentials = Credentials .create(web3Auth.getPrivkey())
@@ -251,24 +248,17 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemClickListener {
251248 chainId = " 0x89" ,
252249 rpcTarget = " https://polygon-rpc.com/" ,
253250 chainNamespace = ChainNamespace .EIP155
254- ), " personal_sign" , requestParams = params
251+ ), " personal_sign" , requestParams = params, appState = " web3Auth "
255252 )
256- signMsgCompletableFuture.whenComplete { _ , error ->
253+ signMsgCompletableFuture.whenComplete { signResult , error ->
257254 if (error == null ) {
258- Log .d(" MainActivity_Web3Auth" , " Message signed successfully" )
259- signResultButton.visibility = View .VISIBLE
255+ showAlertDialog(" Sign Result" , signResult.toString())
260256 } else {
261257 Log .d(" MainActivity_Web3Auth" , error.message ? : " Something went wrong" )
262- signResultButton.visibility = View .GONE
263258 }
264259 }
265260 }
266261
267- signResultButton.setOnClickListener {
268- val signResult = Web3Auth .getSignResponse()
269- showAlertDialog(" Sign Result" , signResult.toString())
270- }
271-
272262 val btnSetUpMfa = findViewById<Button >(R .id.btnSetUpMfa)
273263 btnSetUpMfa.setOnClickListener {
274264 val setupMfaCf = web3Auth.enableMFA()
0 commit comments