parent
00b2710d27
commit
6d05ba133e
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright 2024 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import com.android.build.gradle.LibraryExtension
|
||||
import com.google.samples.apps.nowinandroid.configureGradleManagedDevices
|
||||
import com.google.samples.apps.nowinandroid.libs
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.kotlin.dsl.dependencies
|
||||
|
||||
// Convention plugin for the Compose Multiplatform feature module
|
||||
class CmpFeatureConventionPlugin : Plugin<Project> {
|
||||
override fun apply(target: Project) {
|
||||
with(target) {
|
||||
pluginManager.apply {
|
||||
apply("nowinandroid.kmp.library")
|
||||
apply("nowinandroid.kmp.inject")
|
||||
}
|
||||
extensions.configure<LibraryExtension> {
|
||||
defaultConfig {
|
||||
testInstrumentationRunner =
|
||||
"com.google.samples.apps.nowinandroid.core.testing.NiaTestRunner"
|
||||
}
|
||||
testOptions.animationsDisabled = true
|
||||
configureGradleManagedDevices(this)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
add("commonMainImplementation", project(":core:ui"))
|
||||
add("commonMainImplementation", project(":core:designsystem"))
|
||||
add("commonMainImplementation", libs.findLibrary("jetbrains.compose.viewmodel").get())
|
||||
add("commonMainImplementation", libs.findLibrary("jetbrains.compose.navigation").get())
|
||||
|
||||
add("androidMainImplementation", libs.findLibrary("androidx.hilt.navigation.compose").get())
|
||||
add("androidMainImplementation", libs.findLibrary("androidx.lifecycle.runtimeCompose").get())
|
||||
add("androidMainImplementation", libs.findLibrary("androidx.lifecycle.viewModelCompose").get())
|
||||
add("androidMainImplementation", libs.findLibrary("androidx.tracing.ktx").get())
|
||||
|
||||
add("androidInstrumentedTestImplementation", libs.findLibrary("androidx.lifecycle.runtimeTesting").get())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 2024 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.samples.apps.nowinandroid.core.ui
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.State
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
// collectAsStateWithLifecycle is an Android-only API
|
||||
// Replaced with collectAsState in shared code
|
||||
@Composable
|
||||
fun <T> StateFlow<T>.collectAsStateWithLifecycle(): State<T> = collectAsState()
|
||||
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2024 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.samples.apps.nowinandroid.feature.bookmarks.di
|
||||
|
||||
import com.google.samples.apps.nowinandroid.feature.bookmarks.BookmarksViewModel
|
||||
import me.tatarka.inject.annotations.Component
|
||||
|
||||
@Component
|
||||
abstract class BookmarkComponent {
|
||||
abstract val viewModel: BookmarksViewModel
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2022 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<manifest />
|
||||
Loading…
Reference in new issue