handle screen rotation in LoginWebViewActivity (#2390)
This commit is contained in:
parent
e6f7d9d5af
commit
0dc32774ec
|
@ -127,19 +127,29 @@ class LoginWebViewActivity : BaseActivity(), Injectable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
webView.setBackgroundColor(Color.TRANSPARENT)
|
webView.setBackgroundColor(Color.TRANSPARENT)
|
||||||
|
|
||||||
|
if (savedInstanceState == null) {
|
||||||
webView.loadUrl(data.url.toString())
|
webView.loadUrl(data.url.toString())
|
||||||
|
} else {
|
||||||
|
webView.restoreState(savedInstanceState)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onSaveInstanceState(outState: Bundle) {
|
||||||
|
super.onSaveInstanceState(outState)
|
||||||
|
binding.loginWebView.saveState(outState)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
|
if (isFinishing) {
|
||||||
// We don't want to keep user session in WebView, we just want our own accessToken
|
// We don't want to keep user session in WebView, we just want our own accessToken
|
||||||
WebStorage.getInstance().deleteAllData()
|
WebStorage.getInstance().deleteAllData()
|
||||||
CookieManager.getInstance().removeAllCookies(null)
|
CookieManager.getInstance().removeAllCookies(null)
|
||||||
|
}
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun requiresLogin(): Boolean {
|
override fun requiresLogin() = false
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun sendResult(result: LoginResult) {
|
private fun sendResult(result: LoginResult) {
|
||||||
setResult(Activity.RESULT_OK, OauthLogin.makeResultIntent(result))
|
setResult(Activity.RESULT_OK, OauthLogin.makeResultIntent(result))
|
||||||
|
|
Loading…
Reference in New Issue