refactor: move DebugFragment to separate ViewModel

This commit is contained in:
andrekir 2024-04-07 16:56:24 -03:00
parent 76151e153f
commit 54435fc031
3 changed files with 42 additions and 15 deletions

View file

@ -5,7 +5,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import androidx.fragment.app.viewModels
import androidx.lifecycle.asLiveData
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
@ -13,7 +13,7 @@ import com.geeksville.mesh.CoroutineDispatchers
import com.geeksville.mesh.R
import com.geeksville.mesh.database.entity.MeshLog
import com.geeksville.mesh.databinding.FragmentDebugBinding
import com.geeksville.mesh.model.UIViewModel
import com.geeksville.mesh.model.DebugViewModel
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.map
@ -28,7 +28,7 @@ class DebugFragment : Fragment() {
// This property is only valid between onCreateView and onDestroyView.
private val binding get() = _binding!!
private val model: UIViewModel by activityViewModels()
private val model: DebugViewModel by viewModels()
@Inject
lateinit var dispatchers: CoroutineDispatchers