chore: inject VM with Lifecycle-ViewModel-Compose integration

This commit is contained in:
Harsh Shandilya 2022-11-18 14:24:07 +05:30
parent 11f192532f
commit a981b6b9f7
No known key found for this signature in database
2 changed files with 3 additions and 1 deletions

View file

@ -72,6 +72,7 @@ dependencies {
implementation(libs.androidx.documentfile) implementation(libs.androidx.documentfile)
implementation(libs.androidx.fragment.ktx) implementation(libs.androidx.fragment.ktx)
implementation(libs.bundles.androidxLifecycle) implementation(libs.bundles.androidxLifecycle)
implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.androidx.material) implementation(libs.androidx.material)
implementation(libs.androidx.preference) implementation(libs.androidx.preference)
implementation(libs.androidx.recyclerview) implementation(libs.androidx.recyclerview)

View file

@ -17,6 +17,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.lifecycle.viewmodel.compose.viewModel
import app.passwordstore.R import app.passwordstore.R
import app.passwordstore.ui.APSAppBar import app.passwordstore.ui.APSAppBar
import app.passwordstore.ui.compose.theme.APSTheme import app.passwordstore.ui.compose.theme.APSTheme
@ -70,8 +71,8 @@ class PGPKeyListActivity : ComponentActivity() {
@Composable @Composable
fun PGPKeyList( fun PGPKeyList(
viewModel: PGPKeyListViewModel,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
viewModel: PGPKeyListViewModel = viewModel(),
) { ) {
KeyList( KeyList(
identifiers = viewModel.keys, identifiers = viewModel.keys,