Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ minSdk = "21"

jvmTarget = "17"
# https://developer.android.com/build/releases/gradle-plugin#compatibility
agp = "8.10.1"
agp = "8.11.1"

#https://github.com/JetBrains/compose-multiplatform
compose-multiplatform = "1.8.2"
kotlin = "2.1.21"
compose-multiplatform = "1.9.0"
kotlin = "2.2.20"
# https://github.com/google/ksp
ksp = "2.1.21-2.0.1"
ksp = "2.2.20-2.0.3"
kotlin-inject = "0.8.0"

# https://developer.android.com/jetpack/androidx/releases/activity
Expand All @@ -31,7 +31,7 @@ kotlinxDatetime = "0.7.1"
# https://github.com/Kotlin/kotlinx-atomicfu
kotlinxAtomicfu = "0.28.0"

kotlinxBrowser = "0.3"
kotlinxBrowser = "0.5.0"

# https://github.com/slackhq/circuit/releases
circuit = "0.28.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,25 @@ internal class WebPopupFlow(
internal companion object {
@ExperimentalOpenIdConnect
fun handleRedirect() {
if (window.opener != null) {
postMessage(
url = window.location.toString(),
targetOrigin = getOpenerOrigin()
val opener = window.opener as Window?
if (opener != null) {
opener.postMessage(
message = window.location.toString().toJsString(),
targetOrigin = opener.location.origin
)

closeTheWindow(delay = 0)
window.setTimeout(
handler = {
window.close()
null
},
timeout = 0
)
} else {
println("No window opener, not a popup flow.")
}
}
}
}

private fun getEventData(event: MessageEvent): String = js("JSON.stringify(event.data)")

private fun getOpenerOrigin(): String = js("window.opener.location.origin")

private fun postMessage(url: String, targetOrigin: String) {
js("window.opener.postMessage(url, targetOrigin)")
}

private fun closeTheWindow(delay: Int = 100) {
js("setTimeout(() => window.close(), delay)")
}
Loading