android / codelab-android-paging

Jetpack Paging codelab
Apache License 2.0
494 stars 263 forks source link

codelab step 19 correction #219

Closed amazingvoice closed 2 years ago

amazingvoice commented 2 years ago

When updating the Injection file, the code segment shown in the codelab is written as:

object Injection {
    private fun provideGithubRepository(context: Context): GithubRepository {
        return GithubRepository(GithubService.create(), RepoDatabase.getInstance(context))
    }

    fun provideViewModelFactory(context: Context): ViewModelProvider.Factory {
        return ViewModelFactory(provideGithubRepository(context))
    }
}

However the constructor of ViewModelFactory needs 2 parameters. The parameter SavedStateRegistryOwner is missing.

tunjid commented 2 years ago

This has been fixed in the current iteration of the codelab.