Glad to hear that :)
In the suggested solution
ViewModelFactory itself isn’t scoped and neither are the dependencies. All we’re doing is deferring creation of these dependencies until
onCreate is called. Using Provider or Lazy for that is just very handy and works out of the box with Dagger (anywhere where you are injecting
T you can inject eg.
Provider<T> instead and Dagger will generate code for you).
ViewModelFactory would also solve the problem, but using Singleton/AppScope would be in most cases too much though, because we usually need ViewModelFactory just for the Activity/Fragment lifetime.
Hope that clears things up :)