requireNotNull(webPageUrl){"no web_page_url provided in Intent extras"}
state=intent.getStringExtra(INTENT_STATE)
requireNotNull(state){"no state provided in Intent extras"}
setupToolbar()
}
overridefunonResume(){
super.onResume()
if(!isWebViewSetUp){
setupWebView()
isWebViewSetUp=true
}
}
overridefunonBackPressed(){
if(web_view.canGoBack()){
web_view.goBack()
}else{
closeView()
}
}
privatefunsetupToolbar(){
with(toolbar){
title=getString(R.string.title_authentication)
setNavigationIcon(R.drawable.ic_close_white_24dp)
setNavigationOnClickListener{closeView()}
}
}
@SuppressLint("SetJavaScriptEnabled")
privatefunsetupWebView(){
with(web_view.settings){
javaScriptEnabled=true
// TODO This is required to make Google OAuth work, but we shoud use Custom Tabs instead. See https://github.com/RocketChat/Rocket.Chat.Android/issues/968
userAgentString="Mozilla/5.0 (Linux; Android 4.1.1; Galaxy Nexus Build/JRO03C) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19"