Caution: A ViewModel usually shouldn't reference a view, Lifecycle, or any class that may hold a reference to the activity context. Because the ViewModel lifecycle is larger than the UI's, holding a lifecycle-related API in the ViewModel could cause memory leaks.
Is it supposed should be refactoring that related code?
I just notice
lifeCycleOwner
passed to viewModel function. https://github.com/android/socialite/blob/67d823a1ecf9e615765bda894ccc83133c1b6427/app/src/main/java/com/google/android/samples/socialite/ui/camera/CameraViewModel.kt#L142-L148But in the ViewModel documentation, that gives a caution that situation. https://developer.android.com/topic/libraries/architecture/viewmodel#implement-viewmodel
Is it supposed should be refactoring that related code?