Skip to content

Commit

Permalink
Cleaning WebView after login
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslanys committed Sep 14, 2018
1 parent 723dd40 commit d0f055c
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,17 @@ class LoginController(
val engine = webView.engine
engine.isJavaScriptEnabled = true
engine.userAgent = USER_AGENT

webView.engine.loadWorker.stateProperty().addListener(this)

//webView.isVisible = false
view.children.add(webView)

webView.engine.load(LOGIN_PATH)
}

override fun changed(observable: ObservableValue<out Worker.State>?, oldValue: Worker.State?, newValue: Worker.State?) {
if (webView.engine.location == null || webView.engine.location == "about:blank" || webView.engine.location == "") {
return
}

when (newValue) {
Worker.State.SUCCEEDED -> {
webView.isVisible = true
Expand Down Expand Up @@ -113,6 +114,7 @@ class LoginController(
}

private fun openMainStage() {
webView.engine.load(null)
mainController.refreshTable()

val stage = view.sceneProperty().get().window as Stage
Expand Down

0 comments on commit d0f055c

Please sign in to comment.