Skip to content

Commit b133e08

Browse files
committed
Instantiate login webview by lazy to ensure only one is ever created.
1 parent 59772b8 commit b133e08

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

libs/SalesforceSDK/src/com/salesforce/androidsdk/ui/LoginActivity.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,8 @@ open class LoginActivity : FragmentActivity() {
182182
// Webview and Clients
183183
protected open val webViewClient = AuthWebViewClient()
184184
protected open val webChromeClient = WebChromeClient()
185-
open val webView: WebView
186-
@SuppressLint("SetJavaScriptEnabled")
187-
get() = WebView(this.baseContext).apply {
185+
open val webView: WebView by lazy {
186+
WebView(this.baseContext).apply {
188187
layoutParams = ViewGroup.LayoutParams(
189188
ViewGroup.LayoutParams.MATCH_PARENT,
190189
ViewGroup.LayoutParams.MATCH_PARENT,
@@ -193,8 +192,10 @@ open class LoginActivity : FragmentActivity() {
193192
webChromeClient = this@LoginActivity.webChromeClient
194193
setBackgroundColor(Color.Transparent.toArgb())
195194
settings.domStorageEnabled = true /* Salesforce Welcome Discovery requires this */
195+
@SuppressLint("SetJavaScriptEnabled")
196196
settings.javaScriptEnabled = true
197197
}
198+
}
198199

199200
// Private variables
200201
private var wasBackgrounded = false

0 commit comments

Comments
 (0)