Skip to content

Commit

Permalink
fix: remove urls bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmo314 committed Sep 3, 2021
1 parent 5bef7fc commit 45c9641
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions android/app/src/main/kotlin/com/rtirl/chat/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ class MainActivity : FlutterActivity() {
when (call.method) {
"set" -> {
val urls = (call.argument<List<String>>("urls") ?: listOf()).toHashSet()
(urls subtract views.keys).forEach {
val add = (urls subtract views.keys)
val remove = (views.keys subtract urls)
add.forEach {
val view = WebView(context)
view.settings.javaScriptEnabled = true
view.settings.mediaPlaybackRequiresUserGesture = false
Expand Down Expand Up @@ -73,7 +75,7 @@ class MainActivity : FlutterActivity() {
views[it] = view
result.success(true)
}
(views.keys subtract urls).forEach {
remove.forEach {
wm.removeView(views[it])
views.remove(it)?.destroy()
}
Expand Down

0 comments on commit 45c9641

Please sign in to comment.