From ec778f53323aa3844eadc0aae4c647d2e3a23d20 Mon Sep 17 00:00:00 2001 From: Iván Ávalos Date: Wed, 12 Jan 2022 18:54:51 -0600 Subject: Fix code style and replaced this to viewLifecycleOwner in observers to avoid leaks --- .../java/mx/trackermap/TrackerMap/android/session/LoginFragment.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'androidApp/src/main/java/mx/trackermap/TrackerMap/android/session') diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/session/LoginFragment.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/session/LoginFragment.kt index cc84f06..674c2d3 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/session/LoginFragment.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/session/LoginFragment.kt @@ -10,10 +10,12 @@ import android.widget.Toast import androidx.core.widget.doAfterTextChanged import androidx.fragment.app.Fragment import com.zhuinden.liveevent.observe +import kotlinx.coroutines.DelicateCoroutinesApi import mx.trackermap.TrackerMap.android.databinding.LoginBinding import mx.trackermap.TrackerMap.android.units.UnitsActivity import org.koin.androidx.viewmodel.ext.android.viewModel +@DelicateCoroutinesApi class LoginFragment : Fragment() { private var _binding: LoginBinding? = null private val binding get() = _binding!! @@ -54,7 +56,7 @@ class LoginFragment : Fragment() { } private fun setupObservers() { - loginViewModel.loginState.observe(this) { result -> + loginViewModel.loginState.observe(viewLifecycleOwner) { result -> Log.d("LoginFragment", result.toString()) when (result) { LoginViewModel.LoginState.Loading -> { -- cgit v1.2.3