From 2063bf5c9aa4be6cbb7004a729be8df5268dced8 Mon Sep 17 00:00:00 2001 From: Xavier Gouchet Date: Tue, 19 Sep 2023 19:07:21 +0200 Subject: [PATCH] RUM-985 fix the WebView fragment in sample app --- .../kotlin/com/datadog/android/sample/webview/WebFragment.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sample/kotlin/src/main/kotlin/com/datadog/android/sample/webview/WebFragment.kt b/sample/kotlin/src/main/kotlin/com/datadog/android/sample/webview/WebFragment.kt index 7a9f1e3e9c..f275d9f41c 100644 --- a/sample/kotlin/src/main/kotlin/com/datadog/android/sample/webview/WebFragment.kt +++ b/sample/kotlin/src/main/kotlin/com/datadog/android/sample/webview/WebFragment.kt @@ -15,6 +15,7 @@ import android.webkit.WebViewClient import androidx.fragment.app.Fragment import androidx.lifecycle.ViewModelProviders import com.datadog.android.sample.R +import com.datadog.android.sample.SampleApplication import com.datadog.android.webview.WebViewTracking internal class WebFragment : Fragment() { @@ -44,7 +45,8 @@ internal class WebFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - viewModel = ViewModelProviders.of(this).get(WebViewModel::class.java) + val factory = SampleApplication.getViewModelFactory(requireContext()) + viewModel = ViewModelProviders.of(this, factory).get(WebViewModel::class.java) } override fun onResume() {