@@ -24,7 +24,7 @@ internal class WebPopupFlow(
2424 private class WindowHolder (var window : Window ? )
2525
2626 override suspend fun startWebFlow (requestUrl : Url , redirectUrl : String ): WebAuthenticationFlowResult {
27- val result = suspendCoroutine<WebAuthenticationFlowResult > { continuation ->
27+ val result = suspendCoroutine<Url > { continuation ->
2828
2929 val popupHolder = WindowHolder (null )
3030 lateinit var messageHandler: (Event ) -> Unit
@@ -40,7 +40,7 @@ internal class WebPopupFlow(
4040 val urlString: String = Json .decodeFromString(getEventData(event))
4141 val url = Url (urlString)
4242 window.removeEventListener(" message" , messageHandler)
43- continuation.resume(WebAuthenticationFlowResult . Success ( url) )
43+ continuation.resume(url)
4444 } else {
4545 // Log an advisory but stay registered for the true callback
4646 println (" ${WebPopupFlow ::class .simpleName} skipping message from unknown source: ${event.source} " )
@@ -53,13 +53,8 @@ internal class WebPopupFlow(
5353 popupHolder.window = window.open(requestUrl.toString(), windowTarget, windowFeatures)
5454 ? : throw TechnicalFailure (" Could not open popup" , null )
5555 }
56- if (result is WebAuthenticationFlowResult .Success ) {
57- // TODO refactor wasm code to just set preferences in event handler
58- result.responseUri?.let {
59- preferences.setResponseUri(it)
60- }
61- }
62- return result
56+ preferences.setResponseUri(result)
57+ return WebAuthenticationFlowResult .Success (result)
6358 }
6459
6560 internal companion object {
0 commit comments