diff --git a/.github/workflows/auto-publish-snapshot.yml b/.github/workflows/auto-publish-snapshot.yml index 36a63545..938b4cda 100644 --- a/.github/workflows/auto-publish-snapshot.yml +++ b/.github/workflows/auto-publish-snapshot.yml @@ -26,4 +26,4 @@ jobs: JAVA_HOME: ${{ steps.setup-java.outputs.path }} run: | chmod u+x ./gradlew - ./gradlew publishMavenPublicationToStyxRepository publishDesktopPublicationToStyxRepository publishAndroidReleasePublicationToStyxRepository -Pversion=${{ env.SNAPSHOT_COMMIT }} -Dorg.gradle.parallel=false --stacktrace --no-configuration-cache \ No newline at end of file + ./gradlew publishAllPublicationsToStyxRepository -Pversion=${{ env.SNAPSHOT_COMMIT }} -Dorg.gradle.parallel=false --stacktrace --no-configuration-cache \ No newline at end of file diff --git a/build-config/src/main/kotlin/configuration/configure-kotlin-android.gradle.kts b/build-config/src/main/kotlin/configuration/configure-kotlin-android.gradle.kts deleted file mode 100644 index a40eb2ff..00000000 --- a/build-config/src/main/kotlin/configuration/configure-kotlin-android.gradle.kts +++ /dev/null @@ -1,8 +0,0 @@ -import extensions.kotlinAndroid -import org.jetbrains.kotlin.gradle.dsl.JvmTarget - -kotlinAndroid { - compilerOptions { - jvmTarget = JvmTarget.JVM_1_8 - } -} diff --git a/build-config/src/main/kotlin/extensions/ProjectExtensions.kt b/build-config/src/main/kotlin/extensions/ProjectExtensions.kt index 0cbf33b9..713d0209 100644 --- a/build-config/src/main/kotlin/extensions/ProjectExtensions.kt +++ b/build-config/src/main/kotlin/extensions/ProjectExtensions.kt @@ -2,7 +2,6 @@ package extensions import org.gradle.api.Project import org.gradle.kotlin.dsl.configure -import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidExtension import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension fun Project.hasPlugin(id: String) = plugins.hasPlugin(id) @@ -15,6 +14,3 @@ fun Project.isMultiplatformModule() = hasPlugin("org.jetbrains.kotlin.multiplatf fun Project.kotlinMultiplatform(block: KotlinMultiplatformExtension.() -> Unit) = extensions.configure(block) - -fun Project.kotlinAndroid(block: KotlinAndroidExtension.() -> Unit) = - extensions.configure(block) diff --git a/build-config/src/main/kotlin/samples-module.gradle.kts b/build-config/src/main/kotlin/samples-module.gradle.kts deleted file mode 100644 index 88bb9f41..00000000 --- a/build-config/src/main/kotlin/samples-module.gradle.kts +++ /dev/null @@ -1,14 +0,0 @@ -import org.jetbrains.kotlin.gradle.dsl.JvmTarget -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - -plugins { - id("configure-android") - id("configure-opt-in") - id("configure-ktlint") -} - -tasks.withType { - compilerOptions { - jvmTarget = JvmTarget.JVM_1_8 - } -} diff --git a/build-config/src/main/kotlin/voyager-android-module.gradle.kts b/build-config/src/main/kotlin/voyager-android-module.gradle.kts deleted file mode 100644 index a4198b22..00000000 --- a/build-config/src/main/kotlin/voyager-android-module.gradle.kts +++ /dev/null @@ -1,4 +0,0 @@ -plugins { - id("voyager-base-module") - id("configure-kotlin-android") -} diff --git a/build.gradle.kts b/build.gradle.kts index 61250b22..495692a5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,14 +18,6 @@ plugins { } apiValidation { - with(ignoredProjects) { - add(projects.samples.android) - add(projects.samples.multiplatform) - add(projects.samples.multiModule.app) - add(projects.samples.multiModule.featureHome) - add(projects.samples.multiModule.featurePosts) - add(projects.samples.multiModule.navigation) - } with(nonPublicMarkers) { add("cafe.adriel.voyager.core.annotation.InternalVoyagerApi") } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 814e3f37..2921caa7 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] agp = "8.7.2" -kotlin = "2.1.0" +kotlin = "2.0.21" mavenPublish = "0.30.0" composeMultiplatform = "1.7.1" binaryCompatibilityValidator = "0.16.3" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e2847c82..dedd5d1e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/includes.gradle.kts b/includes.gradle.kts index 4d521b14..e25b164e 100644 --- a/includes.gradle.kts +++ b/includes.gradle.kts @@ -1,12 +1,4 @@ include( - ":samples:android", - ":samples:multiplatform", - - ":samples:multi-module:app", - ":samples:multi-module:navigation", - ":samples:multi-module:feature-home", - ":samples:multi-module:feature-posts", - ":voyager-core", ":voyager-screenmodel", ":voyager-navigator", diff --git a/samples/android/build.gradle.kts b/samples/android/build.gradle.kts deleted file mode 100644 index e4bacd4a..00000000 --- a/samples/android/build.gradle.kts +++ /dev/null @@ -1,47 +0,0 @@ -plugins { - alias(libs.plugins.android.application) - alias(libs.plugins.kotlin.android) - alias(libs.plugins.kotlin.compose) - alias(libs.plugins.kotlin.kapt) - alias(libs.plugins.kotlin.parcelize) - alias(libs.plugins.hilt) - id("samples-module") -} - -android { - namespace = "cafe.adriel.voyager.sample" - defaultConfig { - applicationId = "cafe.adriel.voyager.sample" - } -} - -kapt { - correctErrorTypes = true -} - -dependencies { - implementation(projects.voyagerScreenmodel) - implementation(projects.voyagerNavigator) - implementation(projects.voyagerTabNavigator) - implementation(projects.voyagerBottomSheetNavigator) - implementation(projects.voyagerTransitions) - implementation(projects.voyagerHilt) - implementation(projects.voyagerKodein) - implementation(projects.voyagerKoin) - implementation(projects.voyagerRxjava) - implementation(projects.voyagerLivedata) - - kapt(libs.hilt.compiler) - implementation(libs.hilt.android) - implementation(libs.kodein) - implementation(libs.androidx.lifecycle.viewModelKtx) - implementation(libs.androidx.lifecycle.viewModelCompose) - implementation(libs.androidx.activity.compose) - implementation(samples.koin) - implementation(samples.compose.rxjava) - implementation(samples.compose.livedata) - implementation(samples.compose.material) - implementation(samples.compose.materialIcons) - - debugImplementation(samples.leakCanary) -} diff --git a/samples/android/src/main/AndroidManifest.xml b/samples/android/src/main/AndroidManifest.xml deleted file mode 100644 index 27a6a8a6..00000000 --- a/samples/android/src/main/AndroidManifest.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/App.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/App.kt deleted file mode 100644 index 37214dcf..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/App.kt +++ /dev/null @@ -1,53 +0,0 @@ -package cafe.adriel.voyager.sample - -import android.app.Application -import cafe.adriel.voyager.kodein.ScreenLifecycleScope -import cafe.adriel.voyager.sample.androidViewModel.AndroidDetailsViewModel -import cafe.adriel.voyager.sample.androidViewModel.AndroidListViewModel -import cafe.adriel.voyager.sample.kodeinIntegration.KodeinScopedDependencySample -import cafe.adriel.voyager.sample.kodeinIntegration.KodeinScreenModel -import cafe.adriel.voyager.sample.koinIntegration.KoinScreenModel -import dagger.hilt.android.HiltAndroidApp -import org.kodein.di.DI -import org.kodein.di.DIAware -import org.kodein.di.android.x.androidXModule -import org.kodein.di.bind -import org.kodein.di.bindProvider -import org.kodein.di.scoped -import org.kodein.di.singleton -import org.koin.android.ext.koin.androidContext -import org.koin.core.context.startKoin -import org.koin.core.module.dsl.factoryOf -import org.koin.core.module.dsl.viewModel -import org.koin.dsl.module - -@HiltAndroidApp -class App : Application(), DIAware { - - override val di by DI.lazy { - androidXModule(this@App) - bindProvider { KodeinScreenModel() } - bind() with scoped(ScreenLifecycleScope).singleton { - KodeinScopedDependencySample(context.screen.key) - } - } - - override fun onCreate() { - super.onCreate() - startKoin { - androidContext(this@App) - modules( - module { - factoryOf(::KoinScreenModel) - - viewModel { - AndroidListViewModel(handle = get()) - } - viewModel { parameters -> - AndroidDetailsViewModel(index = parameters.get()) - } - } - ) - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/SampleActivity.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/SampleActivity.kt deleted file mode 100644 index 7ecbf302..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/SampleActivity.kt +++ /dev/null @@ -1,86 +0,0 @@ -package cafe.adriel.voyager.sample - -import android.app.Activity -import android.content.Intent -import android.os.Bundle -import androidx.activity.ComponentActivity -import androidx.activity.compose.setContent -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.material.Button -import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.unit.dp -import cafe.adriel.voyager.sample.androidLegacy.LegacyActivity -import cafe.adriel.voyager.sample.androidViewModel.AndroidViewModelActivity -import cafe.adriel.voyager.sample.basicNavigation.BasicNavigationActivity -import cafe.adriel.voyager.sample.bottomSheetNavigation.BottomSheetNavigationActivity -import cafe.adriel.voyager.sample.hiltIntegration.HiltMainActivity -import cafe.adriel.voyager.sample.kodeinIntegration.KodeinIntegrationActivity -import cafe.adriel.voyager.sample.koinIntegration.KoinIntegrationActivity -import cafe.adriel.voyager.sample.liveDataIntegration.LiveDataIntegrationActivity -import cafe.adriel.voyager.sample.nestedNavigation.NestedNavigationActivity -import cafe.adriel.voyager.sample.parcelableScreen.ParcelableActivity -import cafe.adriel.voyager.sample.rxJavaIntegration.RxJavaIntegrationActivity -import cafe.adriel.voyager.sample.screenModel.ScreenModelActivity -import cafe.adriel.voyager.sample.screenTransition.ScreenTransitionActivity -import cafe.adriel.voyager.sample.stateStack.StateStackActivity -import cafe.adriel.voyager.sample.tabNavigation.TabNavigationActivity - -class SampleActivity : ComponentActivity() { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - setContent { - Content() - } - } - - @Composable - fun Content() { - LazyColumn( - verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally, - modifier = Modifier.fillMaxSize(), - contentPadding = PaddingValues(24.dp) - ) { - item { - StartSampleButton("SnapshotStateStack") - StartSampleButton("Basic Navigation") - StartSampleButton("Basic Navigation with Parcelable") - StartSampleButton("Tab Navigation") - StartSampleButton("BottomSheet Navigation") - StartSampleButton("Nested Navigation") - StartSampleButton("Android ViewModel") - StartSampleButton("ScreenModel") - StartSampleButton("Koin Integration") - StartSampleButton("Kodein Integration") - StartSampleButton("RxJava Integration") - StartSampleButton("LiveData Integration") - StartSampleButton("Hilt Integration") - StartSampleButton("Legacy Integration") - StartSampleButton("Screen Transition") - } - } - } - - @Composable - private inline fun StartSampleButton(text: String) { - val context = LocalContext.current - - Button( - onClick = { context.startActivity(Intent(this, T::class.java)) }, - modifier = Modifier.fillMaxWidth().padding(vertical = 8.dp) - ) { - Text(text = text) - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/SampleContent.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/SampleContent.kt deleted file mode 100644 index 87a3609b..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/SampleContent.kt +++ /dev/null @@ -1,76 +0,0 @@ -package cafe.adriel.voyager.sample - -import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.foundation.lazy.itemsIndexed -import androidx.compose.material.Button -import androidx.compose.material.CircularProgressIndicator -import androidx.compose.material.ExperimentalMaterialApi -import androidx.compose.material.ListItem -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.dp -import java.util.UUID - -val sampleItems: List - get() = (0..99).map { "Item #$it | ${UUID.randomUUID().toString().substringBefore('-')}" } - -@Composable -fun LoadingContent() { - Box( - contentAlignment = Alignment.Center, - modifier = Modifier.fillMaxSize() - ) { - CircularProgressIndicator() - } -} - -@OptIn(ExperimentalMaterialApi::class) -@Composable -fun ListContent(items: List, onClick: ((Int) -> Unit)? = null) { - LazyColumn { - itemsIndexed(items) { index, item -> - ListItem( - text = { Text(text = item) }, - modifier = if (onClick == null) Modifier else Modifier.clickable { onClick(index) } - ) - } - } -} - -@Composable -fun DetailsContent(instance: Any, item: String, onClick: () -> Unit) { - Column( - verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally, - modifier = Modifier.fillMaxSize() - ) { - Text( - text = item, - style = MaterialTheme.typography.h5 - ) - - Spacer(modifier = Modifier.height(16.dp)) - - Text( - text = instance.toString().substringAfterLast('.'), - style = MaterialTheme.typography.body2 - ) - - Spacer(modifier = Modifier.height(16.dp)) - - Button( - onClick = onClick, - content = { Text(text = "Back") } - ) - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/androidLegacy/LegacyActivity.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/androidLegacy/LegacyActivity.kt deleted file mode 100644 index 3d70b265..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/androidLegacy/LegacyActivity.kt +++ /dev/null @@ -1,20 +0,0 @@ -package cafe.adriel.voyager.sample.androidLegacy - -import android.os.Bundle -import androidx.appcompat.app.AppCompatActivity -import androidx.compose.ui.platform.ComposeView -import cafe.adriel.voyager.navigator.Navigator -import cafe.adriel.voyager.sample.R -import dagger.hilt.android.AndroidEntryPoint - -@AndroidEntryPoint -class LegacyActivity : AppCompatActivity() { - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_legacy) - val composeView = findViewById(R.id.composeView) - composeView.setContent { - Navigator(LegacyScreenOne()) - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/androidLegacy/LegacyModule.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/androidLegacy/LegacyModule.kt deleted file mode 100644 index 56a8d156..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/androidLegacy/LegacyModule.kt +++ /dev/null @@ -1,23 +0,0 @@ -package cafe.adriel.voyager.sample.androidLegacy - -import cafe.adriel.voyager.core.model.ScreenModel -import cafe.adriel.voyager.hilt.ScreenModelKey -import dagger.Binds -import dagger.Module -import dagger.hilt.InstallIn -import dagger.hilt.android.components.ActivityComponent -import dagger.multibindings.IntoMap - -@Module -@InstallIn(ActivityComponent::class) -abstract class LegacyModule { - @Binds - @IntoMap - @ScreenModelKey(LegacyOneScreenModel::class) - abstract fun bindLegacyOneScreenModel(legacyOneScreenModel: LegacyOneScreenModel): ScreenModel - - @Binds - @IntoMap - @ScreenModelKey(LegacyTwoScreenModel::class) - abstract fun bindLegacyTwoScreenModel(legacyTwoScreenModel: LegacyTwoScreenModel): ScreenModel -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/androidLegacy/LegacyOneScreenModel.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/androidLegacy/LegacyOneScreenModel.kt deleted file mode 100644 index bf8d9b83..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/androidLegacy/LegacyOneScreenModel.kt +++ /dev/null @@ -1,13 +0,0 @@ -package cafe.adriel.voyager.sample.androidLegacy - -import cafe.adriel.voyager.core.model.ScreenModel -import javax.inject.Inject - -class LegacyOneScreenModel @Inject constructor() : ScreenModel { - val text = "I'm legacy one screen model" - - override fun onDispose() { - println(">>>> disposing $this") - super.onDispose() - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/androidLegacy/LegacyScreenOne.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/androidLegacy/LegacyScreenOne.kt deleted file mode 100644 index 63bff5e0..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/androidLegacy/LegacyScreenOne.kt +++ /dev/null @@ -1,55 +0,0 @@ -package cafe.adriel.voyager.sample.androidLegacy - -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.height -import androidx.compose.material.Button -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.dp -import cafe.adriel.voyager.core.screen.Screen -import cafe.adriel.voyager.core.screen.ScreenKey -import cafe.adriel.voyager.core.screen.uniqueScreenKey -import cafe.adriel.voyager.hilt.getScreenModel -import cafe.adriel.voyager.navigator.LocalNavigator -import cafe.adriel.voyager.navigator.currentOrThrow - -class LegacyScreenOne : Screen { - override val key: ScreenKey = uniqueScreenKey - - @Composable - override fun Content() { - val navigator = LocalNavigator.currentOrThrow - val model: LegacyOneScreenModel = getScreenModel() - - Column( - verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally, - modifier = Modifier.fillMaxSize() - ) { - Text( - text = model.text, - style = MaterialTheme.typography.h5 - ) - - Spacer(modifier = Modifier.height(16.dp)) - - Text( - text = model.toString().substringAfterLast('.'), - style = MaterialTheme.typography.body2 - ) - - Spacer(modifier = Modifier.height(16.dp)) - - Button( - onClick = { navigator.push(LegacyScreenTwo()) }, - content = { Text(text = "Go to Two") } - ) - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/androidLegacy/LegacyScreenTwo.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/androidLegacy/LegacyScreenTwo.kt deleted file mode 100644 index deceb287..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/androidLegacy/LegacyScreenTwo.kt +++ /dev/null @@ -1,55 +0,0 @@ -package cafe.adriel.voyager.sample.androidLegacy - -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.height -import androidx.compose.material.Button -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.dp -import cafe.adriel.voyager.core.screen.Screen -import cafe.adriel.voyager.core.screen.ScreenKey -import cafe.adriel.voyager.core.screen.uniqueScreenKey -import cafe.adriel.voyager.hilt.getScreenModel -import cafe.adriel.voyager.navigator.LocalNavigator -import cafe.adriel.voyager.navigator.currentOrThrow - -class LegacyScreenTwo : Screen { - override val key: ScreenKey = uniqueScreenKey - - @Composable - override fun Content() { - val navigator = LocalNavigator.currentOrThrow - val model: LegacyTwoScreenModel = getScreenModel() - - Column( - verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally, - modifier = Modifier.fillMaxSize() - ) { - Text( - text = model.text, - style = MaterialTheme.typography.h5 - ) - - Spacer(modifier = Modifier.height(16.dp)) - - Text( - text = model.toString().substringAfterLast('.'), - style = MaterialTheme.typography.body2 - ) - - Spacer(modifier = Modifier.height(16.dp)) - - Button( - onClick = navigator::pop, - content = { Text(text = "Go to One") } - ) - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/androidLegacy/LegacyTwoScreenModel.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/androidLegacy/LegacyTwoScreenModel.kt deleted file mode 100644 index 57ea8c4c..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/androidLegacy/LegacyTwoScreenModel.kt +++ /dev/null @@ -1,13 +0,0 @@ -package cafe.adriel.voyager.sample.androidLegacy - -import cafe.adriel.voyager.core.model.ScreenModel -import javax.inject.Inject - -class LegacyTwoScreenModel @Inject constructor() : ScreenModel { - val text = "I'm legacy two screen model" - - override fun onDispose() { - println(">>>> disposing $this") - super.onDispose() - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/androidViewModel/AndroidDetailsScreen.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/androidViewModel/AndroidDetailsScreen.kt deleted file mode 100644 index 8412a03a..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/androidViewModel/AndroidDetailsScreen.kt +++ /dev/null @@ -1,25 +0,0 @@ -package cafe.adriel.voyager.sample.androidViewModel - -import androidx.compose.runtime.Composable -import cafe.adriel.voyager.core.screen.Screen -import cafe.adriel.voyager.core.screen.ScreenKey -import cafe.adriel.voyager.core.screen.uniqueScreenKey -import cafe.adriel.voyager.navigator.LocalNavigator -import cafe.adriel.voyager.navigator.currentOrThrow -import cafe.adriel.voyager.sample.DetailsContent -import org.koin.androidx.compose.koinViewModel -import org.koin.core.parameter.parametersOf - -data class AndroidDetailsScreen( - val index: Int -) : Screen { - override val key: ScreenKey = uniqueScreenKey - - @Composable - override fun Content() { - val navigator = LocalNavigator.currentOrThrow - val viewModel = koinViewModel { parametersOf(index) } - - DetailsContent(viewModel, "Item #${viewModel.index}", navigator::pop) - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/androidViewModel/AndroidDetailsViewModel.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/androidViewModel/AndroidDetailsViewModel.kt deleted file mode 100644 index 7fc08d34..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/androidViewModel/AndroidDetailsViewModel.kt +++ /dev/null @@ -1,12 +0,0 @@ -package cafe.adriel.voyager.sample.androidViewModel - -import androidx.lifecycle.ViewModel - -class AndroidDetailsViewModel( - val index: Int -) : ViewModel() { - - override fun onCleared() { - println("ViewModel: clear details") - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/androidViewModel/AndroidListScreen.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/androidViewModel/AndroidListScreen.kt deleted file mode 100644 index fb2093c4..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/androidViewModel/AndroidListScreen.kt +++ /dev/null @@ -1,22 +0,0 @@ -package cafe.adriel.voyager.sample.androidViewModel - -import androidx.compose.runtime.Composable -import androidx.lifecycle.viewmodel.compose.viewModel -import cafe.adriel.voyager.core.screen.Screen -import cafe.adriel.voyager.core.screen.ScreenKey -import cafe.adriel.voyager.core.screen.uniqueScreenKey -import cafe.adriel.voyager.navigator.LocalNavigator -import cafe.adriel.voyager.navigator.currentOrThrow -import cafe.adriel.voyager.sample.ListContent - -class AndroidListScreen : Screen { - override val key: ScreenKey = uniqueScreenKey - - @Composable - override fun Content() { - val navigator = LocalNavigator.currentOrThrow - val viewModel = viewModel() - - ListContent(viewModel.items, onClick = { index -> navigator.push(AndroidDetailsScreen(index)) }) - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/androidViewModel/AndroidListViewModel.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/androidViewModel/AndroidListViewModel.kt deleted file mode 100644 index b0052a55..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/androidViewModel/AndroidListViewModel.kt +++ /dev/null @@ -1,21 +0,0 @@ -package cafe.adriel.voyager.sample.androidViewModel - -import androidx.lifecycle.SavedStateHandle -import androidx.lifecycle.ViewModel -import cafe.adriel.voyager.sample.sampleItems - -class AndroidListViewModel(private val handle: SavedStateHandle) : ViewModel() { - - init { - if (handle.get>("items").isNullOrEmpty()) { - handle["items"] = sampleItems - } - } - - val items: List - get() = handle["items"] ?: error("Items not found") - - override fun onCleared() { - println("ViewModel: clear list") - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/androidViewModel/AndroidViewModelActivity.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/androidViewModel/AndroidViewModelActivity.kt deleted file mode 100644 index 8fdc4250..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/androidViewModel/AndroidViewModelActivity.kt +++ /dev/null @@ -1,17 +0,0 @@ -package cafe.adriel.voyager.sample.androidViewModel - -import android.os.Bundle -import androidx.activity.ComponentActivity -import androidx.activity.compose.setContent -import cafe.adriel.voyager.navigator.Navigator - -class AndroidViewModelActivity : ComponentActivity() { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - setContent { - Navigator(AndroidListScreen()) - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/basicNavigation/BasicNavigationActivity.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/basicNavigation/BasicNavigationActivity.kt deleted file mode 100644 index babfc127..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/basicNavigation/BasicNavigationActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package cafe.adriel.voyager.sample.basicNavigation - -import android.os.Bundle -import android.util.Log -import androidx.activity.ComponentActivity -import androidx.activity.compose.setContent -import cafe.adriel.voyager.navigator.Navigator - -class BasicNavigationActivity : ComponentActivity() { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - setContent { - Navigator( - screen = BasicNavigationScreen(index = 0), - onBackPressed = { currentScreen -> - Log.d("Navigator", "Pop screen #${(currentScreen as BasicNavigationScreen).index}") - true - } - ) - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/basicNavigation/BasicNavigationScreen.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/basicNavigation/BasicNavigationScreen.kt deleted file mode 100644 index 50e4673a..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/basicNavigation/BasicNavigationScreen.kt +++ /dev/null @@ -1,106 +0,0 @@ -package cafe.adriel.voyager.sample.basicNavigation - -import android.util.Log -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.wrapContentHeight -import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.material.Button -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.dp -import cafe.adriel.voyager.core.lifecycle.LifecycleEffect -import cafe.adriel.voyager.core.lifecycle.LifecycleEffectOnce -import cafe.adriel.voyager.core.screen.Screen -import cafe.adriel.voyager.core.screen.uniqueScreenKey -import cafe.adriel.voyager.navigator.LocalNavigator -import cafe.adriel.voyager.navigator.currentOrThrow - -data class BasicNavigationScreen( - val index: Int, - val wrapContent: Boolean = false -) : Screen { - - override val key = uniqueScreenKey - - @Composable - override fun Content() { - LifecycleEffect( - onStarted = { Log.d("Navigator", "Start screen #$index") }, - onDisposed = { Log.d("Navigator", "Dispose screen #$index") } - ) - LifecycleEffectOnce { - Log.d("Navigator", "On screen first appear #$index") - onDispose { - Log.d("Navigator", "On screen dispose") - } - } - - val navigator = LocalNavigator.currentOrThrow - - Column( - verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally, - modifier = Modifier.run { - if (wrapContent) { - padding(vertical = 16.dp).wrapContentHeight() - } else { - fillMaxSize() - } - } - ) { - Text( - text = "Screen #$index", - style = MaterialTheme.typography.h5 - ) - - Spacer(modifier = Modifier.height(24.dp)) - - Row( - modifier = Modifier.padding(16.dp) - ) { - Button( - enabled = navigator.canPop, - onClick = navigator::pop, - modifier = Modifier.weight(.5f) - ) { - Text(text = "Pop") - } - - Spacer(modifier = Modifier.weight(.1f)) - - Button( - onClick = { navigator.push(BasicNavigationScreen(index.inc(), wrapContent)) }, - modifier = Modifier.weight(.5f) - ) { - Text(text = "Push") - } - - Spacer(modifier = Modifier.weight(.1f)) - - Button( - onClick = { navigator.replace(BasicNavigationScreen(index.inc(), wrapContent)) }, - modifier = Modifier.weight(.5f) - ) { - Text(text = "Replace") - } - } - - LazyColumn( - modifier = Modifier.height(100.dp) - ) { - items(100) { - Text("Item #$it") - } - } - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/bottomSheetNavigation/BackScreen.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/bottomSheetNavigation/BackScreen.kt deleted file mode 100644 index 041dce87..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/bottomSheetNavigation/BackScreen.kt +++ /dev/null @@ -1,31 +0,0 @@ -package cafe.adriel.voyager.sample.bottomSheetNavigation - -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.material.Button -import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import cafe.adriel.voyager.core.screen.Screen -import cafe.adriel.voyager.navigator.bottomSheet.LocalBottomSheetNavigator -import cafe.adriel.voyager.sample.basicNavigation.BasicNavigationScreen - -class BackScreen : Screen { - - @Composable - override fun Content() { - val bottomSheetNavigator = LocalBottomSheetNavigator.current - - Box( - contentAlignment = Alignment.Center, - modifier = Modifier.fillMaxSize() - ) { - Button( - onClick = { bottomSheetNavigator.show(BasicNavigationScreen(index = 0, wrapContent = true)) } - ) { - Text(text = "Show BottomSheet") - } - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/bottomSheetNavigation/BottomSheetNavigationActivity.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/bottomSheetNavigation/BottomSheetNavigationActivity.kt deleted file mode 100644 index d8c7ab2c..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/bottomSheetNavigation/BottomSheetNavigationActivity.kt +++ /dev/null @@ -1,22 +0,0 @@ -package cafe.adriel.voyager.sample.bottomSheetNavigation - -import android.os.Bundle -import androidx.activity.ComponentActivity -import androidx.activity.compose.setContent -import androidx.compose.material.ExperimentalMaterialApi -import cafe.adriel.voyager.navigator.Navigator -import cafe.adriel.voyager.navigator.bottomSheet.BottomSheetNavigator - -class BottomSheetNavigationActivity : ComponentActivity() { - - @OptIn(ExperimentalMaterialApi::class) - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - setContent { - BottomSheetNavigator { - Navigator(BackScreen()) - } - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/hiltIntegration/HiltDetailsScreen.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/hiltIntegration/HiltDetailsScreen.kt deleted file mode 100644 index 83f2559c..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/hiltIntegration/HiltDetailsScreen.kt +++ /dev/null @@ -1,33 +0,0 @@ -package cafe.adriel.voyager.sample.hiltIntegration - -import androidx.compose.runtime.Composable -import cafe.adriel.voyager.core.screen.Screen -import cafe.adriel.voyager.core.screen.ScreenKey -import cafe.adriel.voyager.core.screen.uniqueScreenKey -import cafe.adriel.voyager.hilt.getScreenModel -import cafe.adriel.voyager.navigator.LocalNavigator -import cafe.adriel.voyager.navigator.currentOrThrow -import cafe.adriel.voyager.sample.DetailsContent - -data class HiltDetailsScreen( - val index: Int -) : Screen { - override val key: ScreenKey = uniqueScreenKey - - @Composable - override fun Content() { - val navigator = LocalNavigator.currentOrThrow - - // Uncomment version below if you want keep using ViewModel instead of to convert it to ScreenModel - // ViewModelProvider.Factory is not required. Until now Hilt has no support to Assisted Injection by default - // val viewModel: HiltDetailsViewModel = getViewModel { factory -> factory.create(index) } - - // This version include more boilerplate because we are simulating support - // to Assisted Injection using ScreenModel. See [HiltListScreen] for a simple version - val viewModel = getScreenModel { factory -> - factory.create(index) - } - - DetailsContent(viewModel, "Item #${viewModel.index}", navigator::pop) - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/hiltIntegration/HiltDetailsScreenModel.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/hiltIntegration/HiltDetailsScreenModel.kt deleted file mode 100644 index 2bb80721..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/hiltIntegration/HiltDetailsScreenModel.kt +++ /dev/null @@ -1,18 +0,0 @@ -package cafe.adriel.voyager.sample.hiltIntegration - -import cafe.adriel.voyager.core.model.ScreenModel -import cafe.adriel.voyager.hilt.ScreenModelFactory -import dagger.assisted.Assisted -import dagger.assisted.AssistedFactory -import dagger.assisted.AssistedInject - -// Working with Assisted Injection here to simulate a custom param in the constructor -class HiltDetailsScreenModel @AssistedInject constructor( - @Assisted val index: Int -) : ScreenModel { - - @AssistedFactory - interface Factory : ScreenModelFactory { - fun create(index: Int): HiltDetailsScreenModel - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/hiltIntegration/HiltDetailsViewModel.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/hiltIntegration/HiltDetailsViewModel.kt deleted file mode 100644 index 8546b01e..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/hiltIntegration/HiltDetailsViewModel.kt +++ /dev/null @@ -1,18 +0,0 @@ -package cafe.adriel.voyager.sample.hiltIntegration - -import androidx.lifecycle.ViewModel -import dagger.assisted.Assisted -import dagger.assisted.AssistedFactory -import dagger.assisted.AssistedInject -import dagger.hilt.android.lifecycle.HiltViewModel - -@HiltViewModel(assistedFactory = HiltDetailsViewModel.Factory::class) -class HiltDetailsViewModel @AssistedInject constructor( - @Assisted val index: Int -) : ViewModel() { - - @AssistedFactory - interface Factory { - fun create(index: Int): HiltDetailsViewModel - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/hiltIntegration/HiltListScreen.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/hiltIntegration/HiltListScreen.kt deleted file mode 100644 index af0a7214..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/hiltIntegration/HiltListScreen.kt +++ /dev/null @@ -1,22 +0,0 @@ -package cafe.adriel.voyager.sample.hiltIntegration - -import androidx.compose.runtime.Composable -import cafe.adriel.voyager.core.screen.Screen -import cafe.adriel.voyager.hilt.getViewModel -import cafe.adriel.voyager.navigator.LocalNavigator -import cafe.adriel.voyager.navigator.currentOrThrow -import cafe.adriel.voyager.sample.ListContent - -class HiltListScreen : Screen { - - @Composable - override fun Content() { - val navigator = LocalNavigator.currentOrThrow - val viewModel: HiltListViewModel = getViewModel() - - // Uncomment version below if you want to use ScreenModel - // val viewModel: HiltListScreenModel = getScreenModel() - - ListContent(viewModel.items, onClick = { index -> navigator.push(HiltDetailsScreen(index)) }) - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/hiltIntegration/HiltListScreenModel.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/hiltIntegration/HiltListScreenModel.kt deleted file mode 100644 index c1bebbee..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/hiltIntegration/HiltListScreenModel.kt +++ /dev/null @@ -1,10 +0,0 @@ -package cafe.adriel.voyager.sample.hiltIntegration - -import cafe.adriel.voyager.core.model.ScreenModel -import cafe.adriel.voyager.sample.sampleItems -import javax.inject.Inject - -class HiltListScreenModel @Inject constructor() : ScreenModel { - - val items = sampleItems -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/hiltIntegration/HiltListViewModel.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/hiltIntegration/HiltListViewModel.kt deleted file mode 100644 index ebeb971d..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/hiltIntegration/HiltListViewModel.kt +++ /dev/null @@ -1,22 +0,0 @@ -package cafe.adriel.voyager.sample.hiltIntegration - -import androidx.lifecycle.SavedStateHandle -import androidx.lifecycle.ViewModel -import cafe.adriel.voyager.sample.sampleItems -import dagger.hilt.android.lifecycle.HiltViewModel -import javax.inject.Inject - -@HiltViewModel -class HiltListViewModel @Inject constructor( - private val handle: SavedStateHandle -) : ViewModel() { - - init { - if (handle.get>("items").isNullOrEmpty()) { - handle["items"] = sampleItems - } - } - - val items: List - get() = handle["items"] ?: error("Items not found") -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/hiltIntegration/HiltMainActivity.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/hiltIntegration/HiltMainActivity.kt deleted file mode 100644 index 3ab7ea5a..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/hiltIntegration/HiltMainActivity.kt +++ /dev/null @@ -1,19 +0,0 @@ -package cafe.adriel.voyager.sample.hiltIntegration - -import android.os.Bundle -import androidx.activity.ComponentActivity -import androidx.activity.compose.setContent -import cafe.adriel.voyager.navigator.Navigator -import dagger.hilt.android.AndroidEntryPoint - -@AndroidEntryPoint -class HiltMainActivity : ComponentActivity() { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - setContent { - Navigator(HiltListScreen()) - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/hiltIntegration/HiltModule.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/hiltIntegration/HiltModule.kt deleted file mode 100644 index 7cd7011c..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/hiltIntegration/HiltModule.kt +++ /dev/null @@ -1,27 +0,0 @@ -package cafe.adriel.voyager.sample.hiltIntegration - -import cafe.adriel.voyager.core.model.ScreenModel -import cafe.adriel.voyager.hilt.ScreenModelFactory -import cafe.adriel.voyager.hilt.ScreenModelFactoryKey -import cafe.adriel.voyager.hilt.ScreenModelKey -import dagger.Binds -import dagger.Module -import dagger.hilt.InstallIn -import dagger.hilt.android.components.ActivityComponent -import dagger.multibindings.IntoMap - -@Module -@InstallIn(ActivityComponent::class) -abstract class HiltModule { - @Binds - @IntoMap - @ScreenModelKey(HiltListScreenModel::class) - abstract fun bindHiltScreenModel(hiltListScreenModel: HiltListScreenModel): ScreenModel - - @Binds - @IntoMap - @ScreenModelFactoryKey(HiltDetailsScreenModel.Factory::class) - abstract fun bindHiltDetailsScreenModelFactory( - hiltDetailsScreenModelFactory: HiltDetailsScreenModel.Factory - ): ScreenModelFactory -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/kodeinIntegration/KodeinIntegrationActivity.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/kodeinIntegration/KodeinIntegrationActivity.kt deleted file mode 100644 index 5866f42e..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/kodeinIntegration/KodeinIntegrationActivity.kt +++ /dev/null @@ -1,17 +0,0 @@ -package cafe.adriel.voyager.sample.kodeinIntegration - -import android.os.Bundle -import androidx.activity.ComponentActivity -import androidx.activity.compose.setContent -import cafe.adriel.voyager.navigator.Navigator - -class KodeinIntegrationActivity : ComponentActivity() { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - setContent { - Navigator(KodeinScreen()) - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/kodeinIntegration/KodeinScopedDependencySample.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/kodeinIntegration/KodeinScopedDependencySample.kt deleted file mode 100644 index 48638b48..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/kodeinIntegration/KodeinScopedDependencySample.kt +++ /dev/null @@ -1,11 +0,0 @@ -package cafe.adriel.voyager.sample.kodeinIntegration - -import org.kodein.di.bindings.ScopeCloseable - -data class KodeinScopedDependencySample( - val screenKey: String -) : ScopeCloseable { - override fun close() { - println("Being disposed") - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/kodeinIntegration/KodeinScreen.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/kodeinIntegration/KodeinScreen.kt deleted file mode 100644 index 2f7310dc..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/kodeinIntegration/KodeinScreen.kt +++ /dev/null @@ -1,30 +0,0 @@ -package cafe.adriel.voyager.sample.kodeinIntegration - -import androidx.compose.foundation.layout.Column -import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import cafe.adriel.voyager.core.screen.Screen -import cafe.adriel.voyager.core.screen.ScreenKey -import cafe.adriel.voyager.core.screen.uniqueScreenKey -import cafe.adriel.voyager.kodein.ScreenContext -import cafe.adriel.voyager.kodein.rememberScreenModel -import cafe.adriel.voyager.sample.ListContent -import org.kodein.di.compose.localDI -import org.kodein.di.instance -import org.kodein.di.on - -class KodeinScreen : Screen { - - override val key: ScreenKey = uniqueScreenKey - - @Composable - override fun Content() { - val screenModel = rememberScreenModel() - val scopedDependency by localDI().on(ScreenContext(this)).instance() - - Column { - Text(scopedDependency.toString()) - ListContent(screenModel.items) - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/kodeinIntegration/KodeinScreenModel.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/kodeinIntegration/KodeinScreenModel.kt deleted file mode 100644 index 47f21519..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/kodeinIntegration/KodeinScreenModel.kt +++ /dev/null @@ -1,9 +0,0 @@ -package cafe.adriel.voyager.sample.kodeinIntegration - -import cafe.adriel.voyager.core.model.ScreenModel -import cafe.adriel.voyager.sample.sampleItems - -class KodeinScreenModel : ScreenModel { - - val items = sampleItems -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/koinIntegration/KoinIntegrationActivity.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/koinIntegration/KoinIntegrationActivity.kt deleted file mode 100644 index 2db5b6cd..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/koinIntegration/KoinIntegrationActivity.kt +++ /dev/null @@ -1,17 +0,0 @@ -package cafe.adriel.voyager.sample.koinIntegration - -import android.os.Bundle -import androidx.activity.ComponentActivity -import androidx.activity.compose.setContent -import cafe.adriel.voyager.navigator.Navigator - -class KoinIntegrationActivity : ComponentActivity() { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - setContent { - Navigator(KoinScreen()) - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/koinIntegration/KoinScreen.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/koinIntegration/KoinScreen.kt deleted file mode 100644 index 6a1172f5..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/koinIntegration/KoinScreen.kt +++ /dev/null @@ -1,20 +0,0 @@ -package cafe.adriel.voyager.sample.koinIntegration - -import androidx.compose.runtime.Composable -import cafe.adriel.voyager.core.screen.Screen -import cafe.adriel.voyager.core.screen.ScreenKey -import cafe.adriel.voyager.core.screen.uniqueScreenKey -import cafe.adriel.voyager.koin.koinScreenModel -import cafe.adriel.voyager.sample.ListContent - -class KoinScreen : Screen { - - override val key: ScreenKey = uniqueScreenKey - - @Composable - override fun Content() { - val screenModel = koinScreenModel() - - ListContent(screenModel.items) - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/koinIntegration/KoinScreenModel.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/koinIntegration/KoinScreenModel.kt deleted file mode 100644 index b602046f..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/koinIntegration/KoinScreenModel.kt +++ /dev/null @@ -1,9 +0,0 @@ -package cafe.adriel.voyager.sample.koinIntegration - -import cafe.adriel.voyager.core.model.ScreenModel -import cafe.adriel.voyager.sample.sampleItems - -class KoinScreenModel : ScreenModel { - - val items = sampleItems -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/liveDataIntegration/LiveDataIntegrationActivity.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/liveDataIntegration/LiveDataIntegrationActivity.kt deleted file mode 100644 index ee4f197b..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/liveDataIntegration/LiveDataIntegrationActivity.kt +++ /dev/null @@ -1,17 +0,0 @@ -package cafe.adriel.voyager.sample.liveDataIntegration - -import android.os.Bundle -import androidx.activity.ComponentActivity -import androidx.activity.compose.setContent -import cafe.adriel.voyager.navigator.Navigator - -class LiveDataIntegrationActivity : ComponentActivity() { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - setContent { - Navigator(LiveDataScreen()) - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/liveDataIntegration/LiveDataScreen.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/liveDataIntegration/LiveDataScreen.kt deleted file mode 100644 index ead1a7ea..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/liveDataIntegration/LiveDataScreen.kt +++ /dev/null @@ -1,34 +0,0 @@ -package cafe.adriel.voyager.sample.liveDataIntegration - -import androidx.compose.runtime.Composable -import androidx.compose.runtime.LaunchedEffect -import androidx.compose.runtime.currentCompositeKeyHash -import androidx.compose.runtime.getValue -import androidx.compose.runtime.livedata.observeAsState -import cafe.adriel.voyager.core.model.rememberScreenModel -import cafe.adriel.voyager.core.screen.Screen -import cafe.adriel.voyager.core.screen.ScreenKey -import cafe.adriel.voyager.core.screen.uniqueScreenKey -import cafe.adriel.voyager.sample.ListContent -import cafe.adriel.voyager.sample.LoadingContent - -class LiveDataScreen : Screen { - - override val key: ScreenKey = uniqueScreenKey - - @Composable - override fun Content() { - val screenModel = rememberScreenModel { LiveDataScreenModel() } - val state by screenModel.state.observeAsState() - - when (val result = state) { - is LiveDataScreenModel.State.Loading -> LoadingContent() - is LiveDataScreenModel.State.Result -> ListContent(result.items) - else -> Unit - } - - LaunchedEffect(currentCompositeKeyHash) { - screenModel.getItems() - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/liveDataIntegration/LiveDataScreenModel.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/liveDataIntegration/LiveDataScreenModel.kt deleted file mode 100644 index 0426fa87..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/liveDataIntegration/LiveDataScreenModel.kt +++ /dev/null @@ -1,24 +0,0 @@ -package cafe.adriel.voyager.sample.liveDataIntegration - -import cafe.adriel.voyager.core.model.screenModelScope -import cafe.adriel.voyager.livedata.LiveScreenModel -import cafe.adriel.voyager.sample.sampleItems -import kotlinx.coroutines.delay -import kotlinx.coroutines.launch - -class LiveDataScreenModel : LiveScreenModel(State.Loading) { - - sealed class State { - object Loading : State() - data class Result(val items: List) : State() - } - - private val items = sampleItems - - fun getItems() { - screenModelScope.launch { - delay(1_000) - mutableState.postValue(State.Result(items)) - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/nestedNavigation/NestedNavigationActivity.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/nestedNavigation/NestedNavigationActivity.kt deleted file mode 100644 index d8f22a22..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/nestedNavigation/NestedNavigationActivity.kt +++ /dev/null @@ -1,77 +0,0 @@ -package cafe.adriel.voyager.sample.nestedNavigation - -import android.os.Bundle -import androidx.activity.ComponentActivity -import androidx.activity.compose.setContent -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.material.Button -import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.unit.dp -import cafe.adriel.voyager.navigator.CurrentScreen -import cafe.adriel.voyager.navigator.Navigator -import cafe.adriel.voyager.navigator.NavigatorContent -import cafe.adriel.voyager.sample.basicNavigation.BasicNavigationScreen - -class NestedNavigationActivity : ComponentActivity() { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - setContent { - LazyColumn { - item { - Content() - } - } - } - } - - @Composable - private fun Content() { - NestedNavigation(backgroundColor = Color.Gray) { - CurrentScreen() - NestedNavigation(backgroundColor = Color.LightGray) { - CurrentScreen() - NestedNavigation(backgroundColor = Color.White) { navigator -> - CurrentScreen() - Button( - onClick = { navigator.popUntilRoot() }, - modifier = Modifier.padding(bottom = 16.dp) - ) { - Text(text = "Pop Until Root") - } - } - } - } - } - - @Composable - private fun NestedNavigation( - backgroundColor: Color, - content: NavigatorContent = { CurrentScreen() } - ) { - Navigator( - screen = BasicNavigationScreen(index = 0, wrapContent = true) - ) { navigator -> - Column( - horizontalAlignment = Alignment.CenterHorizontally, - modifier = Modifier - .padding(16.dp) - .background(backgroundColor) - ) { - Text( - text = "Level #${navigator.level}", - modifier = Modifier.padding(8.dp) - ) - content(navigator) - } - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/parcelableScreen/ParcelableActivity.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/parcelableScreen/ParcelableActivity.kt deleted file mode 100644 index 91ff5c87..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/parcelableScreen/ParcelableActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package cafe.adriel.voyager.sample.parcelableScreen - -import android.os.Bundle -import android.util.Log -import androidx.activity.ComponentActivity -import androidx.activity.compose.setContent -import cafe.adriel.voyager.navigator.Navigator - -class ParcelableActivity : ComponentActivity() { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - setContent { - Navigator( - screen = SampleParcelableScreen(parcelable = ParcelableContent(index = 0)), - onBackPressed = { currentScreen -> - Log.d("Navigator", "Pop screen #${(currentScreen as SampleParcelableScreen).parcelable.index}") - true - } - ) - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/parcelableScreen/SampleParcelableScreen.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/parcelableScreen/SampleParcelableScreen.kt deleted file mode 100644 index 3e94016e..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/parcelableScreen/SampleParcelableScreen.kt +++ /dev/null @@ -1,115 +0,0 @@ -package cafe.adriel.voyager.sample.parcelableScreen - -import android.os.Parcelable -import android.util.Log -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.wrapContentHeight -import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.material.Button -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.dp -import cafe.adriel.voyager.core.lifecycle.LifecycleEffect -import cafe.adriel.voyager.core.screen.Screen -import cafe.adriel.voyager.core.screen.uniqueScreenKey -import cafe.adriel.voyager.navigator.LocalNavigator -import cafe.adriel.voyager.navigator.currentOrThrow -import kotlinx.parcelize.Parcelize - -@Parcelize -data class ParcelableContent( - val index: Int -) : Parcelable - -@Parcelize -data class SampleParcelableScreen( - val parcelable: ParcelableContent, - val wrapContent: Boolean = false -) : Screen, Parcelable { - - override val key = uniqueScreenKey - - @Composable - override fun Content() { - LifecycleEffect( - onStarted = { Log.d("Navigator", "Start screen #${parcelable.index}") }, - onDisposed = { Log.d("Navigator", "Dispose screen #${parcelable.index}") } - ) - - val navigator = LocalNavigator.currentOrThrow - - Column( - verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally, - modifier = Modifier.run { - if (wrapContent) { - padding(vertical = 16.dp).wrapContentHeight() - } else { - fillMaxSize() - } - } - ) { - Text( - text = "Screen #${parcelable.index}", - style = MaterialTheme.typography.h5 - ) - - Spacer(modifier = Modifier.height(24.dp)) - - Row( - modifier = Modifier.padding(16.dp) - ) { - Button( - enabled = navigator.canPop, - onClick = navigator::pop, - modifier = Modifier.weight(.5f) - ) { - Text(text = "Pop") - } - - Spacer(modifier = Modifier.weight(.1f)) - - Button( - onClick = { - navigator.push( - SampleParcelableScreen(parcelable.copy(index = parcelable.index.inc()), wrapContent) - ) - }, - modifier = Modifier.weight(.5f) - ) { - Text(text = "Push") - } - - Spacer(modifier = Modifier.weight(.1f)) - - Button( - onClick = { - navigator.replace( - SampleParcelableScreen(parcelable.copy(index = parcelable.index.inc()), wrapContent) - ) - }, - modifier = Modifier.weight(.5f) - ) { - Text(text = "Replace") - } - } - - LazyColumn( - modifier = Modifier.height(100.dp) - ) { - items(100) { - Text("Item #$it") - } - } - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/rxjavaIntegration/RxJavaIntegrationActivity.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/rxjavaIntegration/RxJavaIntegrationActivity.kt deleted file mode 100644 index d452007f..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/rxjavaIntegration/RxJavaIntegrationActivity.kt +++ /dev/null @@ -1,17 +0,0 @@ -package cafe.adriel.voyager.sample.rxJavaIntegration - -import android.os.Bundle -import androidx.activity.ComponentActivity -import androidx.activity.compose.setContent -import cafe.adriel.voyager.navigator.Navigator - -class RxJavaIntegrationActivity : ComponentActivity() { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - setContent { - Navigator(RxJavaScreen()) - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/rxjavaIntegration/RxJavaScreen.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/rxjavaIntegration/RxJavaScreen.kt deleted file mode 100644 index 4b450013..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/rxjavaIntegration/RxJavaScreen.kt +++ /dev/null @@ -1,33 +0,0 @@ -package cafe.adriel.voyager.sample.rxJavaIntegration - -import androidx.compose.runtime.Composable -import androidx.compose.runtime.LaunchedEffect -import androidx.compose.runtime.currentCompositeKeyHash -import androidx.compose.runtime.getValue -import androidx.compose.runtime.rxjava3.subscribeAsState -import cafe.adriel.voyager.core.model.rememberScreenModel -import cafe.adriel.voyager.core.screen.Screen -import cafe.adriel.voyager.core.screen.ScreenKey -import cafe.adriel.voyager.core.screen.uniqueScreenKey -import cafe.adriel.voyager.sample.ListContent -import cafe.adriel.voyager.sample.LoadingContent - -class RxJavaScreen : Screen { - - override val key: ScreenKey = uniqueScreenKey - - @Composable - override fun Content() { - val screenModel = rememberScreenModel { RxJavaScreenModel() } - val state by screenModel.state.subscribeAsState(initial = RxJavaScreenModel.State.Loading) - - when (val result = state) { - is RxJavaScreenModel.State.Loading -> LoadingContent() - is RxJavaScreenModel.State.Result -> ListContent(result.items) - } - - LaunchedEffect(currentCompositeKeyHash) { - screenModel.getItems() - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/rxjavaIntegration/RxJavaScreenModel.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/rxjavaIntegration/RxJavaScreenModel.kt deleted file mode 100644 index 070ec5c9..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/rxjavaIntegration/RxJavaScreenModel.kt +++ /dev/null @@ -1,26 +0,0 @@ -package cafe.adriel.voyager.sample.rxJavaIntegration - -import cafe.adriel.voyager.rxjava.RxScreenModel -import cafe.adriel.voyager.rxjava.disposables -import cafe.adriel.voyager.sample.sampleItems -import io.reactivex.rxjava3.core.Single -import java.util.concurrent.TimeUnit - -class RxJavaScreenModel : RxScreenModel() { - - sealed class State { - object Loading : State() - data class Result(val items: List) : State() - } - - private val items = sampleItems - - fun getItems() { - Single - .just(items) - .delay(1_000, TimeUnit.MILLISECONDS) - .doOnSubscribe { mutableState.onNext(State.Loading) } - .subscribe { items -> mutableState.onNext(State.Result(items)) } - .let(disposables::add) - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/screenModel/DetailsScreen.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/screenModel/DetailsScreen.kt deleted file mode 100644 index 1529a679..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/screenModel/DetailsScreen.kt +++ /dev/null @@ -1,38 +0,0 @@ -package cafe.adriel.voyager.sample.screenModel - -import androidx.compose.runtime.Composable -import androidx.compose.runtime.LaunchedEffect -import androidx.compose.runtime.collectAsState -import androidx.compose.runtime.currentCompositeKeyHash -import androidx.compose.runtime.getValue -import cafe.adriel.voyager.core.model.rememberScreenModel -import cafe.adriel.voyager.core.screen.Screen -import cafe.adriel.voyager.core.screen.ScreenKey -import cafe.adriel.voyager.core.screen.uniqueScreenKey -import cafe.adriel.voyager.navigator.LocalNavigator -import cafe.adriel.voyager.navigator.currentOrThrow -import cafe.adriel.voyager.sample.DetailsContent -import cafe.adriel.voyager.sample.LoadingContent - -data class DetailsScreen( - val index: Int -) : Screen { - - override val key: ScreenKey = uniqueScreenKey - - @Composable - override fun Content() { - val navigator = LocalNavigator.currentOrThrow - val screenModel = rememberScreenModel { DetailsScreenModel(index) } - val state by screenModel.state.collectAsState() - - when (val result = state) { - is DetailsScreenModel.State.Loading -> LoadingContent() - is DetailsScreenModel.State.Result -> DetailsContent(screenModel, result.item, navigator::pop) - } - - LaunchedEffect(currentCompositeKeyHash) { - screenModel.getItem(index) - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/screenModel/DetailsScreenModel.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/screenModel/DetailsScreenModel.kt deleted file mode 100644 index 3e31e1e5..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/screenModel/DetailsScreenModel.kt +++ /dev/null @@ -1,27 +0,0 @@ -package cafe.adriel.voyager.sample.screenModel - -import cafe.adriel.voyager.core.model.StateScreenModel -import cafe.adriel.voyager.core.model.screenModelScope -import kotlinx.coroutines.delay -import kotlinx.coroutines.launch - -class DetailsScreenModel( - val index: Int -) : StateScreenModel(State.Loading) { - - sealed class State { - object Loading : State() - data class Result(val item: String) : State() - } - - fun getItem(index: Int) { - screenModelScope.launch { - delay(1_000) - mutableState.value = State.Result("Item #$index") - } - } - - override fun onDispose() { - println("ScreenModel: dispose details") - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/screenModel/ListScreen.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/screenModel/ListScreen.kt deleted file mode 100644 index d52789bb..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/screenModel/ListScreen.kt +++ /dev/null @@ -1,23 +0,0 @@ -package cafe.adriel.voyager.sample.screenModel - -import androidx.compose.runtime.Composable -import cafe.adriel.voyager.core.model.rememberScreenModel -import cafe.adriel.voyager.core.screen.Screen -import cafe.adriel.voyager.core.screen.ScreenKey -import cafe.adriel.voyager.core.screen.uniqueScreenKey -import cafe.adriel.voyager.navigator.LocalNavigator -import cafe.adriel.voyager.navigator.currentOrThrow -import cafe.adriel.voyager.sample.ListContent - -class ListScreen : Screen { - - override val key: ScreenKey = uniqueScreenKey - - @Composable - override fun Content() { - val navigator = LocalNavigator.currentOrThrow - val screenModel = rememberScreenModel { ListScreenModel() } - - ListContent(screenModel.items, onClick = { index -> navigator.push(DetailsScreen(index)) }) - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/screenModel/ListScreenModel.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/screenModel/ListScreenModel.kt deleted file mode 100644 index 45e3e0cd..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/screenModel/ListScreenModel.kt +++ /dev/null @@ -1,13 +0,0 @@ -package cafe.adriel.voyager.sample.screenModel - -import cafe.adriel.voyager.core.model.ScreenModel -import cafe.adriel.voyager.sample.sampleItems - -class ListScreenModel : ScreenModel { - - val items = sampleItems - - override fun onDispose() { - println("ScreenModel: dispose list") - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/screenModel/ScreenModelActivity.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/screenModel/ScreenModelActivity.kt deleted file mode 100644 index 73673012..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/screenModel/ScreenModelActivity.kt +++ /dev/null @@ -1,17 +0,0 @@ -package cafe.adriel.voyager.sample.screenModel - -import android.os.Bundle -import androidx.activity.ComponentActivity -import androidx.activity.compose.setContent -import cafe.adriel.voyager.navigator.Navigator - -class ScreenModelActivity : ComponentActivity() { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - setContent { - Navigator(ListScreen()) - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/screenTransition/SampleScreens.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/screenTransition/SampleScreens.kt deleted file mode 100644 index 7ca887dc..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/screenTransition/SampleScreens.kt +++ /dev/null @@ -1,103 +0,0 @@ -package cafe.adriel.voyager.sample.screenTransition - -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding -import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import androidx.compose.runtime.remember -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.text.font.FontWeight -import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.sp -import cafe.adriel.voyager.core.model.ScreenModel -import cafe.adriel.voyager.core.model.rememberScreenModel -import cafe.adriel.voyager.core.screen.Screen -import cafe.adriel.voyager.core.screen.ScreenKey -import cafe.adriel.voyager.transitions.ScreenTransition - -private val colors = listOf( - Color.Red, - Color.Yellow, - Color.Green, - Color.Blue, - Color.Black -) - -class BaseSampleScreenModel( - val index: Int -) : ScreenModel { - - init { - println("Init BaseSampleScreenModel $index") - } - override fun onDispose() { - println("Disposing BaseSampleScreenModel $index") - } -} - -abstract class BaseSampleScreen( - private val transitionType: String -) : Screen { - - abstract val index: Int - - override val key: ScreenKey get() = "SampleScreen$index" - - @Composable - override fun Content() { - val model = rememberScreenModel { - BaseSampleScreenModel(index) - } - val color = remember { - colors.getOrNull(index % colors.size) ?: colors.random() - } - val contentColor = remember { - color.average() - } - - Column( - modifier = Modifier - .fillMaxSize() - .background(color) - .padding(40.dp), - verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally - ) { - Text( - text = "Screen $index", - fontSize = 24.sp, - fontWeight = FontWeight.Bold, - color = contentColor - ) - Spacer(modifier = Modifier.height(8.dp)) - Text( - text = transitionType, - fontSize = 18.sp, - color = contentColor - ) - } - } -} - -private fun Color.average(): Color { - return Color((255 - red * 255) / 255, (255 - green * 255) / 255, (255 - blue * 255) / 255, alpha) -} - -data class NoCustomAnimationSampleScreen( - override val index: Int -) : BaseSampleScreen("Default transition") - -data class FadeAnimationSampleScreen( - override val index: Int -) : BaseSampleScreen("Fade transition"), ScreenTransition by FadeTransition() - -data class SlideInVerticallyAnimationSampleScreen( - override val index: Int -) : BaseSampleScreen("slide in vertically transition"), ScreenTransition by SlideInVerticallyTransition(index) diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/screenTransition/SampleTransitions.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/screenTransition/SampleTransitions.kt deleted file mode 100644 index 61c7d6ef..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/screenTransition/SampleTransitions.kt +++ /dev/null @@ -1,65 +0,0 @@ -package cafe.adriel.voyager.sample.screenTransition - -import androidx.compose.animation.EnterTransition -import androidx.compose.animation.ExitTransition -import androidx.compose.animation.core.tween -import androidx.compose.animation.fadeIn -import androidx.compose.animation.fadeOut -import androidx.compose.animation.slideIn -import androidx.compose.animation.slideInVertically -import androidx.compose.animation.slideOut -import androidx.compose.animation.slideOutVertically -import androidx.compose.ui.unit.IntOffset -import cafe.adriel.voyager.core.stack.StackEvent -import cafe.adriel.voyager.transitions.ScreenTransition - -class FadeTransition : ScreenTransition { - - override fun enter(lastEvent: StackEvent): EnterTransition { - return fadeIn(tween(500, delayMillis = 500)) - } - - override fun exit(lastEvent: StackEvent): ExitTransition { - return fadeOut(tween(500)) - } -} - -class SlideTransition : ScreenTransition { - - override fun enter(lastEvent: StackEvent): EnterTransition { - return slideIn { size -> - val x = if (lastEvent == StackEvent.Pop) -size.width else size.width - IntOffset(x = x, y = 0) - } - } - - override fun exit(lastEvent: StackEvent): ExitTransition { - return slideOut { size -> - val x = if (lastEvent == StackEvent.Pop) size.width else -size.width - IntOffset(x = x, y = 0) - } - } -} - -class SlideInVerticallyTransition(val index: Int) : ScreenTransition { - - override fun enter(lastEvent: StackEvent): EnterTransition { - return if (lastEvent == StackEvent.Pop) { - fadeIn(initialAlpha = 0.9f) - } else { - slideInVertically { it } - } - } - - override fun exit(lastEvent: StackEvent): ExitTransition { - return if (lastEvent == StackEvent.Pop) { - slideOutVertically { it } - } else { - fadeOut(targetAlpha = 0.9f) - } - } - - override fun zIndex(lastEvent: StackEvent): Float { - return if (lastEvent == StackEvent.Pop) (index).toFloat() else (index + 1).toFloat() - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/screenTransition/ScreenTransitionActivity.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/screenTransition/ScreenTransitionActivity.kt deleted file mode 100644 index 9f308b9a..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/screenTransition/ScreenTransitionActivity.kt +++ /dev/null @@ -1,116 +0,0 @@ -package cafe.adriel.voyager.sample.screenTransition - -import android.os.Bundle -import androidx.activity.ComponentActivity -import androidx.activity.compose.setContent -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding -import androidx.compose.material.Button -import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.dp -import cafe.adriel.voyager.navigator.Navigator -import cafe.adriel.voyager.navigator.NavigatorDisposeBehavior -import cafe.adriel.voyager.transitions.ScreenTransition -import kotlin.random.Random - -class ScreenTransitionActivity : ComponentActivity() { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - setContent { - Content() - } - } - - @Composable - fun Content() { - Navigator( - screen = NoCustomAnimationSampleScreen(0), - disposeBehavior = NavigatorDisposeBehavior(disposeSteps = false) - ) { navigator -> - Box(modifier = Modifier.fillMaxSize()) { - ScreenTransition( - navigator = navigator, - defaultTransition = SlideTransition(), - disposeScreenAfterTransitionEnd = true - ) - - Column( - modifier = Modifier - .align(Alignment.BottomCenter) - .fillMaxWidth() - ) { - Row( - modifier = Modifier - .fillMaxWidth() - .padding(10.dp), - horizontalArrangement = Arrangement.spacedBy(20.dp) - ) { - Button( - onClick = { navigator.push(FadeAnimationSampleScreen(navigator.items.size)) }, - modifier = Modifier.weight(1f) - ) { - Text(text = "Fade") - } - - Button( - onClick = { navigator.push(SlideInVerticallyAnimationSampleScreen(navigator.items.size)) }, - modifier = Modifier.weight(1f) - ) { - Text(text = "SlideInVertically") - } - } - Row( - modifier = Modifier - .fillMaxWidth() - .padding(10.dp), - horizontalArrangement = Arrangement.spacedBy(20.dp) - ) { - Button( - onClick = { navigator.push(NoCustomAnimationSampleScreen(navigator.items.size)) }, - modifier = Modifier.weight(1f) - ) { - Text(text = "Default") - } - - Button( - onClick = { navigator.pop() }, - modifier = Modifier.weight(1f) - ) { - Text(text = "Pop") - } - } - Row( - modifier = Modifier - .fillMaxWidth() - .padding(10.dp), - horizontalArrangement = Arrangement.spacedBy(20.dp) - ) { - Button( - onClick = { navigator.replace(NoCustomAnimationSampleScreen(Random.nextInt())) }, - modifier = Modifier.weight(1f) - ) { - Text(text = "Replace") - } - - Button( - onClick = { navigator.replaceAll(NoCustomAnimationSampleScreen(Random.nextInt())) }, - modifier = Modifier.weight(1f) - ) { - Text(text = "ReplaceAll") - } - } - } - } - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/stateStack/StateStackActivity.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/stateStack/StateStackActivity.kt deleted file mode 100644 index ee4e355b..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/stateStack/StateStackActivity.kt +++ /dev/null @@ -1,147 +0,0 @@ -package cafe.adriel.voyager.sample.stateStack - -import android.os.Bundle -import android.widget.Toast -import androidx.activity.ComponentActivity -import androidx.activity.compose.setContent -import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.RowScope -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.foundation.lazy.LazyItemScope -import androidx.compose.foundation.lazy.itemsIndexed -import androidx.compose.material.Button -import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.saveable.rememberSaveable -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.text.font.FontFamily -import androidx.compose.ui.text.font.FontWeight -import androidx.compose.ui.text.style.TextAlign -import androidx.compose.ui.unit.dp -import cafe.adriel.voyager.core.stack.rememberStateStack -import java.util.UUID - -class StateStackActivity : ComponentActivity() { - - private val randomValue: String - get() = UUID.randomUUID().toString().substringBefore('-') - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - setContent { - Content() - } - } - - @Composable - private fun Content() { - val stateStack = rememberStateStack() - val (selectedItem, selectItem) = rememberSaveable { mutableStateOf("") } - val context = LocalContext.current - - Column { - LazyColumn( - contentPadding = PaddingValues(16.dp), - reverseLayout = true, - modifier = Modifier.weight(.8f) - ) { - itemsIndexed(stateStack.items) { index, item -> - ListItem( - index = index, - item = item, - isLast = stateStack.lastItemOrNull == item, - isSelected = selectedItem == item, - onSelected = selectItem - ) - } - if (stateStack.isEmpty) { - item { - Text( - text = "EMPTY", - textAlign = TextAlign.Center, - color = Color.DarkGray, - fontWeight = FontWeight.Normal, - fontFamily = FontFamily.Monospace, - modifier = Modifier.fillMaxWidth() - ) - } - } - } - Row( - modifier = Modifier.weight(.1f) - ) { - ActionButton(text = "Pop", enabled = stateStack.canPop) { - if (stateStack.lastItemOrNull == selectedItem) { - selectItem("") - } - stateStack.pop() - } - ActionButton(text = "Pop Until", enabled = stateStack.canPop) { - if (selectedItem.isBlank()) { - Toast.makeText(context, "Select an item first", Toast.LENGTH_SHORT).show() - return@ActionButton - } - selectItem("") - stateStack.popUntil { it == selectedItem } - } - ActionButton(text = "Push") { - stateStack.push(randomValue) - } - } - Row( - modifier = Modifier.weight(.1f) - ) { - ActionButton(text = "Replace") { - stateStack.replace(randomValue) - } - ActionButton(text = "Replace All") { - stateStack.replaceAll(randomValue) - } - } - } - } - - @Composable - private fun LazyItemScope.ListItem( - index: Int, - item: String, - isLast: Boolean, - isSelected: Boolean, - onSelected: (String) -> Unit - ) { - val formattedIndex = index.toString().padStart(3, ' ') - Text( - text = "$formattedIndex: $item", - color = if (isSelected) Color.Red else Color.Black, - fontWeight = if (isLast) FontWeight.Bold else FontWeight.Normal, - fontFamily = FontFamily.Monospace, - modifier = Modifier.clickable { onSelected(item) } - ) - } - - @Composable - private fun RowScope.ActionButton( - text: String, - enabled: Boolean = true, - onClick: () -> Unit - ) { - Button( - onClick = onClick, - enabled = enabled, - modifier = Modifier - .weight(.1f) - .padding(8.dp) - ) { - Text(text = text) - } - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/tabNavigation/TabNavigationActivity.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/tabNavigation/TabNavigationActivity.kt deleted file mode 100644 index 26e73ad6..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/tabNavigation/TabNavigationActivity.kt +++ /dev/null @@ -1,74 +0,0 @@ -package cafe.adriel.voyager.sample.tabNavigation - -import android.os.Bundle -import androidx.activity.ComponentActivity -import androidx.activity.compose.setContent -import androidx.compose.foundation.layout.RowScope -import androidx.compose.material.BottomNavigation -import androidx.compose.material.BottomNavigationItem -import androidx.compose.material.Icon -import androidx.compose.material.Scaffold -import androidx.compose.material.Text -import androidx.compose.material.TopAppBar -import androidx.compose.runtime.Composable -import cafe.adriel.voyager.navigator.tab.CurrentTab -import cafe.adriel.voyager.navigator.tab.LocalTabNavigator -import cafe.adriel.voyager.navigator.tab.Tab -import cafe.adriel.voyager.navigator.tab.TabDisposable -import cafe.adriel.voyager.navigator.tab.TabNavigator -import cafe.adriel.voyager.sample.tabNavigation.tabs.FavoritesTab -import cafe.adriel.voyager.sample.tabNavigation.tabs.HomeTab -import cafe.adriel.voyager.sample.tabNavigation.tabs.ProfileTab - -class TabNavigationActivity : ComponentActivity() { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - setContent { - Content() - } - } - - @Composable - fun Content() { - TabNavigator( - HomeTab, - tabDisposable = { - TabDisposable( - navigator = it, - tabs = listOf(HomeTab, FavoritesTab, ProfileTab) - ) - } - ) { tabNavigator -> - Scaffold( - topBar = { - TopAppBar( - title = { Text(text = tabNavigator.current.options.title) } - ) - }, - content = { - CurrentTab() - }, - bottomBar = { - BottomNavigation { - TabNavigationItem(HomeTab) - TabNavigationItem(FavoritesTab) - TabNavigationItem(ProfileTab) - } - } - ) - } - } - - @Composable - private fun RowScope.TabNavigationItem(tab: Tab) { - val tabNavigator = LocalTabNavigator.current - - BottomNavigationItem( - selected = tabNavigator.current.key == tab.key, - onClick = { tabNavigator.current = tab }, - icon = { Icon(painter = tab.options.icon!!, contentDescription = tab.options.title) } - ) - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/tabNavigation/tabs/FavoritesTab.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/tabNavigation/tabs/FavoritesTab.kt deleted file mode 100644 index c8498751..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/tabNavigation/tabs/FavoritesTab.kt +++ /dev/null @@ -1,31 +0,0 @@ -package cafe.adriel.voyager.sample.tabNavigation.tabs - -import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.Favorite -import androidx.compose.runtime.Composable -import androidx.compose.runtime.remember -import androidx.compose.ui.graphics.vector.rememberVectorPainter -import cafe.adriel.voyager.navigator.tab.Tab -import cafe.adriel.voyager.navigator.tab.TabOptions - -object FavoritesTab : Tab { - - override val options: TabOptions - @Composable - get() { - val icon = rememberVectorPainter(Icons.Default.Favorite) - - return remember { - TabOptions( - index = 1u, - title = "Favorites", - icon = icon - ) - } - } - - @Composable - override fun Content() { - TabContent() - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/tabNavigation/tabs/HomeTab.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/tabNavigation/tabs/HomeTab.kt deleted file mode 100644 index 783c4de1..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/tabNavigation/tabs/HomeTab.kt +++ /dev/null @@ -1,31 +0,0 @@ -package cafe.adriel.voyager.sample.tabNavigation.tabs - -import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.Home -import androidx.compose.runtime.Composable -import androidx.compose.runtime.remember -import androidx.compose.ui.graphics.vector.rememberVectorPainter -import cafe.adriel.voyager.navigator.tab.Tab -import cafe.adriel.voyager.navigator.tab.TabOptions - -object HomeTab : Tab { - - override val options: TabOptions - @Composable - get() { - val icon = rememberVectorPainter(Icons.Default.Home) - - return remember { - TabOptions( - index = 0u, - title = "Home", - icon = icon - ) - } - } - - @Composable - override fun Content() { - TabContent() - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/tabNavigation/tabs/ProfileTab.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/tabNavigation/tabs/ProfileTab.kt deleted file mode 100644 index 19d25c4f..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/tabNavigation/tabs/ProfileTab.kt +++ /dev/null @@ -1,31 +0,0 @@ -package cafe.adriel.voyager.sample.tabNavigation.tabs - -import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.Person -import androidx.compose.runtime.Composable -import androidx.compose.runtime.remember -import androidx.compose.ui.graphics.vector.rememberVectorPainter -import cafe.adriel.voyager.navigator.tab.Tab -import cafe.adriel.voyager.navigator.tab.TabOptions - -object ProfileTab : Tab { - - override val options: TabOptions - @Composable - get() { - val icon = rememberVectorPainter(Icons.Default.Person) - - return remember { - TabOptions( - index = 2u, - title = "Profile", - icon = icon - ) - } - } - - @Composable - override fun Content() { - TabContent() - } -} diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/tabNavigation/tabs/TabContent.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/tabNavigation/tabs/TabContent.kt deleted file mode 100644 index aab8f17b..00000000 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/tabNavigation/tabs/TabContent.kt +++ /dev/null @@ -1,73 +0,0 @@ -package cafe.adriel.voyager.sample.tabNavigation.tabs - -import android.util.Log -import androidx.compose.animation.ExperimentalAnimationApi -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.RowScope -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.padding -import androidx.compose.material.Button -import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.dp -import cafe.adriel.voyager.core.lifecycle.LifecycleEffect -import cafe.adriel.voyager.navigator.Navigator -import cafe.adriel.voyager.navigator.tab.LocalTabNavigator -import cafe.adriel.voyager.navigator.tab.Tab -import cafe.adriel.voyager.sample.basicNavigation.BasicNavigationScreen -import cafe.adriel.voyager.transitions.SlideTransition - -@OptIn(ExperimentalAnimationApi::class) -@Composable -fun Tab.TabContent() { - val tabTitle = options.title - - LifecycleEffect( - onStarted = { Log.d("Navigator", "Start tab $tabTitle") }, - onDisposed = { Log.d("Navigator", "Dispose tab $tabTitle") } - ) - - Navigator(BasicNavigationScreen(index = 0)) { navigator -> - SlideTransition(navigator) { screen -> - Column { - InnerTabNavigation() - screen.Content() - Log.d("Navigator", "Last Event: ${navigator.lastEvent}") - } - } - } -} - -@Composable -private fun InnerTabNavigation() { - Row( - modifier = Modifier.padding(16.dp) - ) { - TabNavigationButton(HomeTab) - - Spacer(modifier = Modifier.weight(.05f)) - - TabNavigationButton(FavoritesTab) - - Spacer(modifier = Modifier.weight(.05f)) - - TabNavigationButton(ProfileTab) - } -} - -@Composable -private fun RowScope.TabNavigationButton( - tab: Tab -) { - val tabNavigator = LocalTabNavigator.current - - Button( - enabled = tabNavigator.current.key != tab.key, - onClick = { tabNavigator.current = tab }, - modifier = Modifier.weight(1f) - ) { - Text(text = tab.options.title) - } -} diff --git a/samples/android/src/main/res/drawable-v24/ic_launcher_foreground.xml b/samples/android/src/main/res/drawable-v24/ic_launcher_foreground.xml deleted file mode 100644 index 2b068d11..00000000 --- a/samples/android/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/samples/android/src/main/res/drawable/ic_launcher_background.xml b/samples/android/src/main/res/drawable/ic_launcher_background.xml deleted file mode 100644 index 07d5da9c..00000000 --- a/samples/android/src/main/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/android/src/main/res/layout/activity_legacy.xml b/samples/android/src/main/res/layout/activity_legacy.xml deleted file mode 100644 index 8127bc0f..00000000 --- a/samples/android/src/main/res/layout/activity_legacy.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - diff --git a/samples/android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/samples/android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml deleted file mode 100644 index eca70cfe..00000000 --- a/samples/android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/samples/android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/samples/android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index eca70cfe..00000000 --- a/samples/android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/samples/android/src/main/res/mipmap-hdpi/ic_launcher.webp b/samples/android/src/main/res/mipmap-hdpi/ic_launcher.webp deleted file mode 100644 index c209e78e..00000000 Binary files a/samples/android/src/main/res/mipmap-hdpi/ic_launcher.webp and /dev/null differ diff --git a/samples/android/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/samples/android/src/main/res/mipmap-hdpi/ic_launcher_round.webp deleted file mode 100644 index b2dfe3d1..00000000 Binary files a/samples/android/src/main/res/mipmap-hdpi/ic_launcher_round.webp and /dev/null differ diff --git a/samples/android/src/main/res/mipmap-mdpi/ic_launcher.webp b/samples/android/src/main/res/mipmap-mdpi/ic_launcher.webp deleted file mode 100644 index 4f0f1d64..00000000 Binary files a/samples/android/src/main/res/mipmap-mdpi/ic_launcher.webp and /dev/null differ diff --git a/samples/android/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/samples/android/src/main/res/mipmap-mdpi/ic_launcher_round.webp deleted file mode 100644 index 62b611da..00000000 Binary files a/samples/android/src/main/res/mipmap-mdpi/ic_launcher_round.webp and /dev/null differ diff --git a/samples/android/src/main/res/mipmap-xhdpi/ic_launcher.webp b/samples/android/src/main/res/mipmap-xhdpi/ic_launcher.webp deleted file mode 100644 index 948a3070..00000000 Binary files a/samples/android/src/main/res/mipmap-xhdpi/ic_launcher.webp and /dev/null differ diff --git a/samples/android/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/samples/android/src/main/res/mipmap-xhdpi/ic_launcher_round.webp deleted file mode 100644 index 1b9a6956..00000000 Binary files a/samples/android/src/main/res/mipmap-xhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/samples/android/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/samples/android/src/main/res/mipmap-xxhdpi/ic_launcher.webp deleted file mode 100644 index 28d4b77f..00000000 Binary files a/samples/android/src/main/res/mipmap-xxhdpi/ic_launcher.webp and /dev/null differ diff --git a/samples/android/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/samples/android/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp deleted file mode 100644 index 9287f508..00000000 Binary files a/samples/android/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/samples/android/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/samples/android/src/main/res/mipmap-xxxhdpi/ic_launcher.webp deleted file mode 100644 index aa7d6427..00000000 Binary files a/samples/android/src/main/res/mipmap-xxxhdpi/ic_launcher.webp and /dev/null differ diff --git a/samples/android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/samples/android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp deleted file mode 100644 index 9126ae37..00000000 Binary files a/samples/android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/samples/android/src/main/res/values/strings.xml b/samples/android/src/main/res/values/strings.xml deleted file mode 100644 index e1a0c38e..00000000 --- a/samples/android/src/main/res/values/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ - - Voyager - This is a legacy content - diff --git a/samples/multi-module/app/.gitignore b/samples/multi-module/app/.gitignore deleted file mode 100644 index a285baf6..00000000 --- a/samples/multi-module/app/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -debug/ -release/ diff --git a/samples/multi-module/app/build.gradle.kts b/samples/multi-module/app/build.gradle.kts deleted file mode 100644 index 5f21d709..00000000 --- a/samples/multi-module/app/build.gradle.kts +++ /dev/null @@ -1,26 +0,0 @@ -plugins { - alias(libs.plugins.android.application) - alias(libs.plugins.kotlin.android) - alias(libs.plugins.kotlin.compose) - id("samples-module") -} - -android { - namespace = "cafe.adriel.voyager.sample.multimodule" - defaultConfig { - applicationId = "cafe.adriel.voyager.sample.multimodule" - } -} - -dependencies { - implementation(projects.voyagerNavigator) - - implementation(projects.samples.multiModule.featureHome) - implementation(projects.samples.multiModule.featurePosts) - - implementation(libs.androidx.activity.compose) - implementation(samples.compose.runtime) - implementation(samples.compose.material) - - debugImplementation(samples.leakCanary) -} diff --git a/samples/multi-module/app/src/main/AndroidManifest.xml b/samples/multi-module/app/src/main/AndroidManifest.xml deleted file mode 100644 index f6275cb8..00000000 --- a/samples/multi-module/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - diff --git a/samples/multi-module/app/src/main/java/cafe/adriel/voyager/sample/multimodule/SampleActivity.kt b/samples/multi-module/app/src/main/java/cafe/adriel/voyager/sample/multimodule/SampleActivity.kt deleted file mode 100644 index 1e52090b..00000000 --- a/samples/multi-module/app/src/main/java/cafe/adriel/voyager/sample/multimodule/SampleActivity.kt +++ /dev/null @@ -1,18 +0,0 @@ -package cafe.adriel.voyager.sample.multimodule - -import android.os.Bundle -import androidx.activity.ComponentActivity -import androidx.activity.compose.setContent -import cafe.adriel.voyager.navigator.Navigator -import cafe.adriel.voyager.sample.multimodule.home.HomeScreen - -class SampleActivity : ComponentActivity() { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - setContent { - Navigator(HomeScreen()) - } - } -} diff --git a/samples/multi-module/app/src/main/java/cafe/adriel/voyager/sample/multimodule/SampleApp.kt b/samples/multi-module/app/src/main/java/cafe/adriel/voyager/sample/multimodule/SampleApp.kt deleted file mode 100644 index 0883622e..00000000 --- a/samples/multi-module/app/src/main/java/cafe/adriel/voyager/sample/multimodule/SampleApp.kt +++ /dev/null @@ -1,16 +0,0 @@ -package cafe.adriel.voyager.sample.multimodule - -import android.app.Application -import cafe.adriel.voyager.core.registry.ScreenRegistry -import cafe.adriel.voyager.sample.multimodule.posts.featurePostsScreenModule - -class SampleApp : Application() { - - override fun onCreate() { - super.onCreate() - - ScreenRegistry { - featurePostsScreenModule() - } - } -} diff --git a/samples/multi-module/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/samples/multi-module/app/src/main/res/drawable-v24/ic_launcher_foreground.xml deleted file mode 100644 index 2b068d11..00000000 --- a/samples/multi-module/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/samples/multi-module/app/src/main/res/drawable/ic_launcher_background.xml b/samples/multi-module/app/src/main/res/drawable/ic_launcher_background.xml deleted file mode 100644 index 07d5da9c..00000000 --- a/samples/multi-module/app/src/main/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/multi-module/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/samples/multi-module/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml deleted file mode 100644 index eca70cfe..00000000 --- a/samples/multi-module/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/samples/multi-module/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/samples/multi-module/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index eca70cfe..00000000 --- a/samples/multi-module/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/samples/multi-module/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/samples/multi-module/app/src/main/res/mipmap-hdpi/ic_launcher.webp deleted file mode 100644 index c209e78e..00000000 Binary files a/samples/multi-module/app/src/main/res/mipmap-hdpi/ic_launcher.webp and /dev/null differ diff --git a/samples/multi-module/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/samples/multi-module/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp deleted file mode 100644 index b2dfe3d1..00000000 Binary files a/samples/multi-module/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp and /dev/null differ diff --git a/samples/multi-module/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/samples/multi-module/app/src/main/res/mipmap-mdpi/ic_launcher.webp deleted file mode 100644 index 4f0f1d64..00000000 Binary files a/samples/multi-module/app/src/main/res/mipmap-mdpi/ic_launcher.webp and /dev/null differ diff --git a/samples/multi-module/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/samples/multi-module/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp deleted file mode 100644 index 62b611da..00000000 Binary files a/samples/multi-module/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp and /dev/null differ diff --git a/samples/multi-module/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/samples/multi-module/app/src/main/res/mipmap-xhdpi/ic_launcher.webp deleted file mode 100644 index 948a3070..00000000 Binary files a/samples/multi-module/app/src/main/res/mipmap-xhdpi/ic_launcher.webp and /dev/null differ diff --git a/samples/multi-module/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/samples/multi-module/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp deleted file mode 100644 index 1b9a6956..00000000 Binary files a/samples/multi-module/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/samples/multi-module/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/samples/multi-module/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp deleted file mode 100644 index 28d4b77f..00000000 Binary files a/samples/multi-module/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp and /dev/null differ diff --git a/samples/multi-module/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/samples/multi-module/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp deleted file mode 100644 index 9287f508..00000000 Binary files a/samples/multi-module/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/samples/multi-module/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/samples/multi-module/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp deleted file mode 100644 index aa7d6427..00000000 Binary files a/samples/multi-module/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp and /dev/null differ diff --git a/samples/multi-module/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/samples/multi-module/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp deleted file mode 100644 index 9126ae37..00000000 Binary files a/samples/multi-module/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/samples/multi-module/app/src/main/res/values/strings.xml b/samples/multi-module/app/src/main/res/values/strings.xml deleted file mode 100644 index e5ec7b91..00000000 --- a/samples/multi-module/app/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - Voyager MultiModule - diff --git a/samples/multi-module/feature-home/build.gradle.kts b/samples/multi-module/feature-home/build.gradle.kts deleted file mode 100644 index 713928af..00000000 --- a/samples/multi-module/feature-home/build.gradle.kts +++ /dev/null @@ -1,19 +0,0 @@ -plugins { - alias(libs.plugins.android.library) - alias(libs.plugins.kotlin.android) - alias(libs.plugins.kotlin.compose) - id("samples-module") -} - -android { - namespace = "cafe.adriel.voyager.sample.multimodule.home" -} - -dependencies { - implementation(projects.voyagerNavigator) - - implementation(projects.samples.multiModule.navigation) - - implementation(libs.androidx.activity.compose) - implementation(samples.compose.material) -} diff --git a/samples/multi-module/feature-home/src/main/AndroidManifest.xml b/samples/multi-module/feature-home/src/main/AndroidManifest.xml deleted file mode 100644 index 27400f42..00000000 --- a/samples/multi-module/feature-home/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/samples/multi-module/feature-home/src/main/java/cafe/adriel/voyager/sample/multimodule/home/HomeScreen.kt b/samples/multi-module/feature-home/src/main/java/cafe/adriel/voyager/sample/multimodule/home/HomeScreen.kt deleted file mode 100644 index 52d5a82b..00000000 --- a/samples/multi-module/feature-home/src/main/java/cafe/adriel/voyager/sample/multimodule/home/HomeScreen.kt +++ /dev/null @@ -1,66 +0,0 @@ -package cafe.adriel.voyager.sample.multimodule.home - -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.height -import androidx.compose.material.Button -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.dp -import cafe.adriel.voyager.core.registry.rememberScreen -import cafe.adriel.voyager.core.screen.Screen -import cafe.adriel.voyager.navigator.LocalNavigator -import cafe.adriel.voyager.navigator.currentOrThrow -import cafe.adriel.voyager.sample.multimodule.navigation.SharedScreen -import java.util.UUID - -class HomeScreen : Screen { - - private val randomId: String - get() = UUID.randomUUID().toString() - - @Composable - override fun Content() { - val navigator = LocalNavigator.currentOrThrow - val postListScreen = rememberScreen(SharedScreen.PostList) - val postDetailsScreen = rememberScreen(SharedScreen.PostDetails(id = randomId)) - - Column( - verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally, - modifier = Modifier.fillMaxSize() - ) { - Text( - text = "Home", - style = MaterialTheme.typography.h5 - ) - - Spacer(modifier = Modifier.height(16.dp)) - - Button( - onClick = { navigator.push(postListScreen) } - ) { - Text( - text = "To Post List", - style = MaterialTheme.typography.button - ) - } - - Spacer(modifier = Modifier.height(16.dp)) - - Button( - onClick = { navigator.push(postDetailsScreen) } - ) { - Text( - text = "To Post Details", - style = MaterialTheme.typography.button - ) - } - } - } -} diff --git a/samples/multi-module/feature-posts/build.gradle.kts b/samples/multi-module/feature-posts/build.gradle.kts deleted file mode 100644 index 4d24a421..00000000 --- a/samples/multi-module/feature-posts/build.gradle.kts +++ /dev/null @@ -1,20 +0,0 @@ -plugins { - alias(libs.plugins.android.library) - alias(libs.plugins.kotlin.android) - alias(libs.plugins.kotlin.compose) - id("samples-module") -} - -android { - namespace = "cafe.adriel.voyager.sample.multimodule.posts" -} - -dependencies { - implementation(projects.voyagerScreenmodel) - implementation(projects.voyagerNavigator) - - implementation(projects.samples.multiModule.navigation) - - implementation(libs.androidx.activity.compose) - implementation(samples.compose.material) -} diff --git a/samples/multi-module/feature-posts/src/main/AndroidManifest.xml b/samples/multi-module/feature-posts/src/main/AndroidManifest.xml deleted file mode 100644 index 89653bd0..00000000 --- a/samples/multi-module/feature-posts/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/samples/multi-module/feature-posts/src/main/java/cafe/adriel/voyager/sample/multimodule/posts/DetailsScreen.kt b/samples/multi-module/feature-posts/src/main/java/cafe/adriel/voyager/sample/multimodule/posts/DetailsScreen.kt deleted file mode 100644 index 8081006a..00000000 --- a/samples/multi-module/feature-posts/src/main/java/cafe/adriel/voyager/sample/multimodule/posts/DetailsScreen.kt +++ /dev/null @@ -1,56 +0,0 @@ -package cafe.adriel.voyager.sample.multimodule.posts - -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.height -import androidx.compose.material.Button -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.dp -import cafe.adriel.voyager.core.screen.Screen -import cafe.adriel.voyager.navigator.LocalNavigator -import cafe.adriel.voyager.navigator.currentOrThrow - -data class DetailsScreen( - val id: String -) : Screen { - - @Composable - override fun Content() { - val navigator = LocalNavigator.currentOrThrow - - Column( - verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally, - modifier = Modifier.fillMaxSize() - ) { - Text( - text = "Post Details", - style = MaterialTheme.typography.h5 - ) - - Spacer(modifier = Modifier.height(16.dp)) - - Text( - text = "ID: $id", - style = MaterialTheme.typography.body1 - ) - - Spacer(modifier = Modifier.height(16.dp)) - - Button( - onClick = { navigator.pop() } - ) { - Text( - text = "Return", - style = MaterialTheme.typography.button - ) - } - } - } -} diff --git a/samples/multi-module/feature-posts/src/main/java/cafe/adriel/voyager/sample/multimodule/posts/ListScreen.kt b/samples/multi-module/feature-posts/src/main/java/cafe/adriel/voyager/sample/multimodule/posts/ListScreen.kt deleted file mode 100644 index 7f7baa9a..00000000 --- a/samples/multi-module/feature-posts/src/main/java/cafe/adriel/voyager/sample/multimodule/posts/ListScreen.kt +++ /dev/null @@ -1,47 +0,0 @@ -package cafe.adriel.voyager.sample.multimodule.posts - -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.height -import androidx.compose.material.Button -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.dp -import cafe.adriel.voyager.core.screen.Screen -import cafe.adriel.voyager.navigator.LocalNavigator -import cafe.adriel.voyager.navigator.currentOrThrow - -class ListScreen : Screen { - - @Composable - override fun Content() { - val navigator = LocalNavigator.currentOrThrow - - Column( - verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally, - modifier = Modifier.fillMaxSize() - ) { - Text( - text = "Post List", - style = MaterialTheme.typography.h5 - ) - - Spacer(modifier = Modifier.height(16.dp)) - - Button( - onClick = { navigator.pop() } - ) { - Text( - text = "Return", - style = MaterialTheme.typography.button - ) - } - } - } -} diff --git a/samples/multi-module/feature-posts/src/main/java/cafe/adriel/voyager/sample/multimodule/posts/ScreenModule.kt b/samples/multi-module/feature-posts/src/main/java/cafe/adriel/voyager/sample/multimodule/posts/ScreenModule.kt deleted file mode 100644 index e017d6f7..00000000 --- a/samples/multi-module/feature-posts/src/main/java/cafe/adriel/voyager/sample/multimodule/posts/ScreenModule.kt +++ /dev/null @@ -1,13 +0,0 @@ -package cafe.adriel.voyager.sample.multimodule.posts - -import cafe.adriel.voyager.core.registry.screenModule -import cafe.adriel.voyager.sample.multimodule.navigation.SharedScreen - -val featurePostsScreenModule = screenModule { - register { - ListScreen() - } - register { provider -> - DetailsScreen(id = provider.id) - } -} diff --git a/samples/multi-module/navigation/build.gradle.kts b/samples/multi-module/navigation/build.gradle.kts deleted file mode 100644 index 3b002b3c..00000000 --- a/samples/multi-module/navigation/build.gradle.kts +++ /dev/null @@ -1,15 +0,0 @@ -plugins { - alias(libs.plugins.android.library) - alias(libs.plugins.kotlin.android) - alias(libs.plugins.kotlin.compose) - id("samples-module") -} - -android { - namespace = "cafe.adriel.voyager.sample.multimodule.navigation" -} - -dependencies { - implementation(projects.voyagerCore) - implementation(samples.compose.runtime) -} diff --git a/samples/multi-module/navigation/src/main/AndroidManifest.xml b/samples/multi-module/navigation/src/main/AndroidManifest.xml deleted file mode 100644 index 98b02a61..00000000 --- a/samples/multi-module/navigation/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/samples/multi-module/navigation/src/main/java/cafe/adriel/voyager/sample/multimodule/navigation/SharedScreen.kt b/samples/multi-module/navigation/src/main/java/cafe/adriel/voyager/sample/multimodule/navigation/SharedScreen.kt deleted file mode 100644 index a40a982f..00000000 --- a/samples/multi-module/navigation/src/main/java/cafe/adriel/voyager/sample/multimodule/navigation/SharedScreen.kt +++ /dev/null @@ -1,8 +0,0 @@ -package cafe.adriel.voyager.sample.multimodule.navigation - -import cafe.adriel.voyager.core.registry.ScreenProvider - -sealed class SharedScreen : ScreenProvider { - object PostList : SharedScreen() - data class PostDetails(val id: String) : SharedScreen() -} diff --git a/samples/multiplatform-iosApp/Configuration/Config.xcconfig b/samples/multiplatform-iosApp/Configuration/Config.xcconfig deleted file mode 100644 index 26af9854..00000000 --- a/samples/multiplatform-iosApp/Configuration/Config.xcconfig +++ /dev/null @@ -1,3 +0,0 @@ -TEAM_ID= -BUNDLE_ID=org.example.project.KotlinProject -APP_NAME=KotlinProject \ No newline at end of file diff --git a/samples/multiplatform-iosApp/iosApp.xcodeproj/project.pbxproj b/samples/multiplatform-iosApp/iosApp.xcodeproj/project.pbxproj deleted file mode 100644 index 762ea787..00000000 --- a/samples/multiplatform-iosApp/iosApp.xcodeproj/project.pbxproj +++ /dev/null @@ -1,379 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 50; - objects = { - -/* Begin PBXBuildFile section */ - 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557BA273AAA24004C7B11 /* Assets.xcassets */; }; - 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */; }; - 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iOSApp.swift */; }; - 7555FF83242A565900829871 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF82242A565900829871 /* ContentView.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 058557BA273AAA24004C7B11 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; - 2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = ""; }; - 7555FF7B242A565900829871 /* KotlinProject.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = KotlinProject.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 7555FF82242A565900829871 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; - 7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - AB3632DC29227652001CCB65 /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXGroup section */ - 058557D7273AAEEB004C7B11 /* Preview Content */ = { - isa = PBXGroup; - children = ( - 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */, - ); - path = "Preview Content"; - sourceTree = ""; - }; - 42799AB246E5F90AF97AA0EF /* Frameworks */ = { - isa = PBXGroup; - children = ( - ); - name = Frameworks; - sourceTree = ""; - }; - 7555FF72242A565900829871 = { - isa = PBXGroup; - children = ( - AB1DB47929225F7C00F7AF9C /* Configuration */, - 7555FF7D242A565900829871 /* iosApp */, - 7555FF7C242A565900829871 /* Products */, - 42799AB246E5F90AF97AA0EF /* Frameworks */, - ); - sourceTree = ""; - }; - 7555FF7C242A565900829871 /* Products */ = { - isa = PBXGroup; - children = ( - 7555FF7B242A565900829871 /* KotlinProject.app */, - ); - name = Products; - sourceTree = ""; - }; - 7555FF7D242A565900829871 /* iosApp */ = { - isa = PBXGroup; - children = ( - 058557BA273AAA24004C7B11 /* Assets.xcassets */, - 7555FF82242A565900829871 /* ContentView.swift */, - 7555FF8C242A565B00829871 /* Info.plist */, - 2152FB032600AC8F00CF470E /* iOSApp.swift */, - 058557D7273AAEEB004C7B11 /* Preview Content */, - ); - path = iosApp; - sourceTree = ""; - }; - AB1DB47929225F7C00F7AF9C /* Configuration */ = { - isa = PBXGroup; - children = ( - AB3632DC29227652001CCB65 /* Config.xcconfig */, - ); - path = Configuration; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 7555FF7A242A565900829871 /* iosApp */ = { - isa = PBXNativeTarget; - buildConfigurationList = 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */; - buildPhases = ( - F36B1CEB2AD83DDC00CB74D5 /* Compile Kotlin Framework */, - 7555FF77242A565900829871 /* Sources */, - 7555FF79242A565900829871 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = iosApp; - productName = iosApp; - productReference = 7555FF7B242A565900829871 /* KotlinProject.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 7555FF73242A565900829871 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 1130; - LastUpgradeCheck = 1130; - ORGANIZATIONNAME = orgName; - TargetAttributes = { - 7555FF7A242A565900829871 = { - CreatedOnToolsVersion = 11.3.1; - }; - }; - }; - buildConfigurationList = 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */; - compatibilityVersion = "Xcode 9.3"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 7555FF72242A565900829871; - productRefGroup = 7555FF7C242A565900829871 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 7555FF7A242A565900829871 /* iosApp */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 7555FF79242A565900829871 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */, - 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - F36B1CEB2AD83DDC00CB74D5 /* Compile Kotlin Framework */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - name = "Compile Kotlin Framework"; - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "if [ \"YES\" = \"$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED\" ]; then\n echo \"Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \\\"YES\\\"\"\n exit 0\nfi\ncd \"$SRCROOT/../..\"\n./gradlew :samples:multiplatform:embedAndSignAppleFrameworkForXcode\n"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 7555FF77242A565900829871 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */, - 7555FF83242A565900829871 /* ContentView.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 7555FFA3242A565B00829871 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = AB3632DC29227652001CCB65 /* Config.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 14.1; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - 7555FFA4242A565B00829871 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = AB3632DC29227652001CCB65 /* Config.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 14.1; - MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; - SDKROOT = iphoneos; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 7555FFA6242A565B00829871 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; - DEVELOPMENT_TEAM = "${TEAM_ID}"; - ENABLE_PREVIEWS = YES; - FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../multiplatform/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)"; - INFOPLIST_FILE = iosApp/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.1; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - OTHER_LDFLAGS = ( - "$(inherited)", - "-framework", - composeApp, - ); - PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_ID}${TEAM_ID}"; - PRODUCT_NAME = "${APP_NAME}"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 7555FFA7242A565B00829871 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; - DEVELOPMENT_TEAM = "${TEAM_ID}"; - ENABLE_PREVIEWS = YES; - FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../multiplatform/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)"; - INFOPLIST_FILE = iosApp/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.1; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - OTHER_LDFLAGS = ( - "$(inherited)", - "-framework", - composeApp, - ); - PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_ID}${TEAM_ID}"; - PRODUCT_NAME = "${APP_NAME}"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 7555FFA3242A565B00829871 /* Debug */, - 7555FFA4242A565B00829871 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 7555FFA6242A565B00829871 /* Debug */, - 7555FFA7242A565B00829871 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 7555FF73242A565900829871 /* Project object */; -} diff --git a/samples/multiplatform-iosApp/iosApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/samples/multiplatform-iosApp/iosApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a6..00000000 --- a/samples/multiplatform-iosApp/iosApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/samples/multiplatform-iosApp/iosApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/samples/multiplatform-iosApp/iosApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d98100..00000000 --- a/samples/multiplatform-iosApp/iosApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/samples/multiplatform-iosApp/iosApp.xcodeproj/project.xcworkspace/xcuserdata/gabriel.lopes.xcuserdatad/UserInterfaceState.xcuserstate b/samples/multiplatform-iosApp/iosApp.xcodeproj/project.xcworkspace/xcuserdata/gabriel.lopes.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 667b40b5..00000000 Binary files a/samples/multiplatform-iosApp/iosApp.xcodeproj/project.xcworkspace/xcuserdata/gabriel.lopes.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/samples/multiplatform-iosApp/iosApp.xcodeproj/xcuserdata/gabriel.lopes.xcuserdatad/xcschemes/xcschememanagement.plist b/samples/multiplatform-iosApp/iosApp.xcodeproj/xcuserdata/gabriel.lopes.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 56b5955f..00000000 --- a/samples/multiplatform-iosApp/iosApp.xcodeproj/xcuserdata/gabriel.lopes.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - SchemeUserState - - iosApp.xcscheme_^#shared#^_ - - orderHint - 0 - - - - diff --git a/samples/multiplatform-iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json b/samples/multiplatform-iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json deleted file mode 100644 index ee7e3ca0..00000000 --- a/samples/multiplatform-iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "colors" : [ - { - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} \ No newline at end of file diff --git a/samples/multiplatform-iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/samples/multiplatform-iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 8edf56e7..00000000 --- a/samples/multiplatform-iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "images" : [ - { - "filename" : "app-icon-1024.png", - "idiom" : "universal", - "platform" : "ios", - "size" : "1024x1024" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/samples/multiplatform-iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png b/samples/multiplatform-iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png deleted file mode 100644 index 53fc536f..00000000 Binary files a/samples/multiplatform-iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png and /dev/null differ diff --git a/samples/multiplatform-iosApp/iosApp/Assets.xcassets/Contents.json b/samples/multiplatform-iosApp/iosApp/Assets.xcassets/Contents.json deleted file mode 100644 index 4aa7c535..00000000 --- a/samples/multiplatform-iosApp/iosApp/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} \ No newline at end of file diff --git a/samples/multiplatform-iosApp/iosApp/ContentView.swift b/samples/multiplatform-iosApp/iosApp/ContentView.swift deleted file mode 100644 index 3cd5c325..00000000 --- a/samples/multiplatform-iosApp/iosApp/ContentView.swift +++ /dev/null @@ -1,21 +0,0 @@ -import UIKit -import SwiftUI -import ComposeApp - -struct ComposeView: UIViewControllerRepresentable { - func makeUIViewController(context: Context) -> UIViewController { - MainViewControllerKt.MainViewController() - } - - func updateUIViewController(_ uiViewController: UIViewController, context: Context) {} -} - -struct ContentView: View { - var body: some View { - ComposeView() - .ignoresSafeArea(.keyboard) // Compose has own keyboard handler - } -} - - - diff --git a/samples/multiplatform-iosApp/iosApp/Info.plist b/samples/multiplatform-iosApp/iosApp/Info.plist deleted file mode 100644 index 412e3781..00000000 --- a/samples/multiplatform-iosApp/iosApp/Info.plist +++ /dev/null @@ -1,50 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - LSRequiresIPhoneOS - - CADisableMinimumFrameDurationOnPhone - - UIApplicationSceneManifest - - UIApplicationSupportsMultipleScenes - - - UILaunchScreen - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/samples/multiplatform-iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json b/samples/multiplatform-iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json deleted file mode 100644 index 4aa7c535..00000000 --- a/samples/multiplatform-iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} \ No newline at end of file diff --git a/samples/multiplatform-iosApp/iosApp/iOSApp.swift b/samples/multiplatform-iosApp/iosApp/iOSApp.swift deleted file mode 100644 index 0648e860..00000000 --- a/samples/multiplatform-iosApp/iosApp/iOSApp.swift +++ /dev/null @@ -1,10 +0,0 @@ -import SwiftUI - -@main -struct iOSApp: App { - var body: some Scene { - WindowGroup { - ContentView() - } - } -} \ No newline at end of file diff --git a/samples/multiplatform/README.md b/samples/multiplatform/README.md deleted file mode 100644 index ae6e2fdd..00000000 --- a/samples/multiplatform/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# multiplatform sample - -### Running iOS -- Open Xcode project with: `open samples/multiplatform-iosApp/iosApp.xcodeproj` -- Run/Build in Xcode - -### Running MacOS Native app (Desktop using Kotlin Native) -```shell -./gradlew :samples:multiplatform:runNativeDebug -``` - -### Running JVM Native app (Desktop) -```shell -./gradlew :samples:multiplatform:run -``` - -### Running Web Compose Canvas -```shell -./gradlew :samples:multiplatform:jsBrowserDevelopmentRun -``` - -### Building Android App -```shell -./gradlew :samples:multiplatform:assembleDebug -``` - -If you want to run Android sample in the emulator, you can open the project and run the application configuration `samples.multiplatform` on Android Studio. diff --git a/samples/multiplatform/build.gradle.kts b/samples/multiplatform/build.gradle.kts deleted file mode 100644 index 9b4a6bc7..00000000 --- a/samples/multiplatform/build.gradle.kts +++ /dev/null @@ -1,142 +0,0 @@ -import extensions.capitalize -import org.jetbrains.compose.desktop.application.dsl.TargetFormat -import org.jetbrains.compose.desktop.application.tasks.AbstractNativeMacApplicationPackageTask -import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl -import org.jetbrains.kotlin.gradle.dsl.JvmTarget - -plugins { - alias(libs.plugins.android.application) - alias(libs.plugins.kotlin.multiplatform) - alias(libs.plugins.kotlin.compose) - alias(libs.plugins.kotlin.parcelize) - alias(libs.plugins.compose.multiplatform) - id("samples-module") -} - -android { - namespace = "cafe.adriel.voyager.sample.multiplatform" - defaultConfig { - applicationId = "cafe.adriel.voyager.sample.multiplatform" - } -} - -kotlin { - applyDefaultHierarchyTemplate() - - listOf( - macosX64(), - macosArm64() - ).forEach { macosTarget -> - macosTarget.binaries { - executable { - entryPoint = "main" - freeCompilerArgs += listOf( - "-linker-option", - "-framework", - "-linker-option", - "Metal" - ) - } - } - } - - listOf( - iosX64(), - iosArm64(), - iosSimulatorArm64() - ).forEach { iosTarget -> - iosTarget.binaries.framework { - baseName = "ComposeApp" - isStatic = true - } - } - - androidTarget { - compilerOptions { - jvmTarget = JvmTarget.JVM_1_8 - } - } - jvm("desktop") { - compilerOptions { - jvmTarget = JvmTarget.JVM_1_8 - } - } - - @OptIn(ExperimentalWasmDsl::class) - wasmJs { - moduleName = "composeApp" - browser { - commonWebpackConfig { - outputFileName = "composeApp.js" - } - } - binaries.executable() - } - - js(IR) { - browser() - binaries.executable() - } - - sourceSets { - commonMain.dependencies { - implementation(projects.voyagerCore) - implementation(projects.voyagerNavigator) - - implementation(compose.runtime) - implementation(compose.ui) - implementation(compose.material) - implementation(libs.coroutines.core) - } - - androidMain.dependencies { - implementation(libs.androidx.activity.compose) - } - - jvmMain.dependencies { - implementation(compose.desktop.currentOs) - } - } -} - -compose { - desktop { - application { - mainClass = "cafe.adriel.voyager.sample.multiplatform.AppKt" - nativeDistributions { - targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb) - packageName = "jvm" - packageVersion = "1.0.0" - } - } - nativeApplication { - targets(kotlin.targets.getByName("macosX64")) - distributions { - targetFormats(TargetFormat.Dmg) - packageName = "MultiplatformSample" - packageVersion = "1.0.0" - } - } - } -} - -afterEvaluate { - val baseTask = "createDistributableNative" - listOf("debug", "release").forEach { buildType -> - val createAppTaskName = baseTask + buildType.capitalize() + "macosX64".capitalize() - - val createAppTask = tasks.findByName(createAppTaskName) as? AbstractNativeMacApplicationPackageTask? - ?: return@forEach - - val destinationDir = createAppTask.destinationDir.get().asFile - val packageName = createAppTask.packageName.get() - - tasks.create("runNative" + buildType.capitalize()) { - group = createAppTask.group - dependsOn(createAppTaskName) - doLast { - ProcessBuilder("open", destinationDir.absolutePath + "/" + packageName + ".app").start().waitFor() - } - } - } -} diff --git a/samples/multiplatform/src/androidMain/AndroidManifest.xml b/samples/multiplatform/src/androidMain/AndroidManifest.xml deleted file mode 100644 index c78c55fa..00000000 --- a/samples/multiplatform/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - diff --git a/samples/multiplatform/src/androidMain/kotlin/cafe/adriel/voyager/sample/multiplatform/SampleActivity.kt b/samples/multiplatform/src/androidMain/kotlin/cafe/adriel/voyager/sample/multiplatform/SampleActivity.kt deleted file mode 100644 index d677ce78..00000000 --- a/samples/multiplatform/src/androidMain/kotlin/cafe/adriel/voyager/sample/multiplatform/SampleActivity.kt +++ /dev/null @@ -1,15 +0,0 @@ -package cafe.adriel.voyager.sample.multiplatform - -import android.os.Bundle -import androidx.activity.ComponentActivity -import androidx.activity.compose.setContent - -public class SampleActivity : ComponentActivity() { - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - setContent { - SampleApplication() - } - } -} diff --git a/samples/multiplatform/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml b/samples/multiplatform/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml deleted file mode 100644 index 2b068d11..00000000 --- a/samples/multiplatform/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/samples/multiplatform/src/androidMain/res/drawable/ic_launcher_background.xml b/samples/multiplatform/src/androidMain/res/drawable/ic_launcher_background.xml deleted file mode 100644 index 07d5da9c..00000000 --- a/samples/multiplatform/src/androidMain/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/multiplatform/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml b/samples/multiplatform/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml deleted file mode 100644 index eca70cfe..00000000 --- a/samples/multiplatform/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/samples/multiplatform/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml b/samples/multiplatform/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index eca70cfe..00000000 --- a/samples/multiplatform/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/samples/multiplatform/src/androidMain/res/mipmap-hdpi/ic_launcher.webp b/samples/multiplatform/src/androidMain/res/mipmap-hdpi/ic_launcher.webp deleted file mode 100644 index c209e78e..00000000 Binary files a/samples/multiplatform/src/androidMain/res/mipmap-hdpi/ic_launcher.webp and /dev/null differ diff --git a/samples/multiplatform/src/androidMain/res/mipmap-hdpi/ic_launcher_round.webp b/samples/multiplatform/src/androidMain/res/mipmap-hdpi/ic_launcher_round.webp deleted file mode 100644 index b2dfe3d1..00000000 Binary files a/samples/multiplatform/src/androidMain/res/mipmap-hdpi/ic_launcher_round.webp and /dev/null differ diff --git a/samples/multiplatform/src/androidMain/res/mipmap-mdpi/ic_launcher.webp b/samples/multiplatform/src/androidMain/res/mipmap-mdpi/ic_launcher.webp deleted file mode 100644 index 4f0f1d64..00000000 Binary files a/samples/multiplatform/src/androidMain/res/mipmap-mdpi/ic_launcher.webp and /dev/null differ diff --git a/samples/multiplatform/src/androidMain/res/mipmap-mdpi/ic_launcher_round.webp b/samples/multiplatform/src/androidMain/res/mipmap-mdpi/ic_launcher_round.webp deleted file mode 100644 index 62b611da..00000000 Binary files a/samples/multiplatform/src/androidMain/res/mipmap-mdpi/ic_launcher_round.webp and /dev/null differ diff --git a/samples/multiplatform/src/androidMain/res/mipmap-xhdpi/ic_launcher.webp b/samples/multiplatform/src/androidMain/res/mipmap-xhdpi/ic_launcher.webp deleted file mode 100644 index 948a3070..00000000 Binary files a/samples/multiplatform/src/androidMain/res/mipmap-xhdpi/ic_launcher.webp and /dev/null differ diff --git a/samples/multiplatform/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.webp b/samples/multiplatform/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.webp deleted file mode 100644 index 1b9a6956..00000000 Binary files a/samples/multiplatform/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/samples/multiplatform/src/androidMain/res/mipmap-xxhdpi/ic_launcher.webp b/samples/multiplatform/src/androidMain/res/mipmap-xxhdpi/ic_launcher.webp deleted file mode 100644 index 28d4b77f..00000000 Binary files a/samples/multiplatform/src/androidMain/res/mipmap-xxhdpi/ic_launcher.webp and /dev/null differ diff --git a/samples/multiplatform/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.webp b/samples/multiplatform/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.webp deleted file mode 100644 index 9287f508..00000000 Binary files a/samples/multiplatform/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/samples/multiplatform/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.webp b/samples/multiplatform/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.webp deleted file mode 100644 index aa7d6427..00000000 Binary files a/samples/multiplatform/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.webp and /dev/null differ diff --git a/samples/multiplatform/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.webp b/samples/multiplatform/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.webp deleted file mode 100644 index 9126ae37..00000000 Binary files a/samples/multiplatform/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/samples/multiplatform/src/androidMain/res/values/strings.xml b/samples/multiplatform/src/androidMain/res/values/strings.xml deleted file mode 100644 index d94f3eba..00000000 --- a/samples/multiplatform/src/androidMain/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - Voyager - diff --git a/samples/multiplatform/src/commonMain/kotlin/cafe/adriel/voyager/sample/multiplatform/Application.kt b/samples/multiplatform/src/commonMain/kotlin/cafe/adriel/voyager/sample/multiplatform/Application.kt deleted file mode 100644 index e470d24b..00000000 --- a/samples/multiplatform/src/commonMain/kotlin/cafe/adriel/voyager/sample/multiplatform/Application.kt +++ /dev/null @@ -1,15 +0,0 @@ -package cafe.adriel.voyager.sample.multiplatform - -import androidx.compose.runtime.Composable -import cafe.adriel.voyager.navigator.Navigator - -@Composable -public fun SampleApplication() { - Navigator( - screen = BasicNavigationScreen(index = 0), - onBackPressed = { currentScreen -> - println("Navigator: Pop screen #${(currentScreen as BasicNavigationScreen).index}") - true - } - ) -} diff --git a/samples/multiplatform/src/commonMain/kotlin/cafe/adriel/voyager/sample/multiplatform/BasicNavigationScreen.kt b/samples/multiplatform/src/commonMain/kotlin/cafe/adriel/voyager/sample/multiplatform/BasicNavigationScreen.kt deleted file mode 100644 index 9794f0d3..00000000 --- a/samples/multiplatform/src/commonMain/kotlin/cafe/adriel/voyager/sample/multiplatform/BasicNavigationScreen.kt +++ /dev/null @@ -1,101 +0,0 @@ -package cafe.adriel.voyager.sample.multiplatform - -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.wrapContentHeight -import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.material.Button -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import androidx.compose.runtime.DisposableEffect -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.dp -import cafe.adriel.voyager.core.screen.Screen -import cafe.adriel.voyager.core.screen.ScreenKey -import cafe.adriel.voyager.core.screen.uniqueScreenKey -import cafe.adriel.voyager.navigator.LocalNavigator -import cafe.adriel.voyager.navigator.currentOrThrow - -public data class BasicNavigationScreen( - val index: Int, - val wrapContent: Boolean = false -) : Screen { - - override val key: ScreenKey = uniqueScreenKey - - @Composable - override fun Content() { - DisposableEffect(key) { - println("Navigator: Start screen #$index") - onDispose { - println("Navigator: Dispose screen #$index") - } - } - - val navigator = LocalNavigator.currentOrThrow - - Column( - verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally, - modifier = Modifier.run { - if (wrapContent) { - padding(vertical = 16.dp).wrapContentHeight() - } else { - fillMaxSize() - } - } - ) { - Text( - text = "Screen #$index", - style = MaterialTheme.typography.h5 - ) - - Spacer(modifier = Modifier.height(24.dp)) - - Row( - modifier = Modifier.padding(16.dp) - ) { - Button( - enabled = navigator.canPop, - onClick = navigator::pop, - modifier = Modifier.weight(.5f) - ) { - Text(text = "Pop") - } - - Spacer(modifier = Modifier.weight(.1f)) - - Button( - onClick = { navigator.push(BasicNavigationScreen(index.inc(), wrapContent)) }, - modifier = Modifier.weight(.5f) - ) { - Text(text = "Push") - } - - Spacer(modifier = Modifier.weight(.1f)) - - Button( - onClick = { navigator.replace(BasicNavigationScreen(index.inc(), wrapContent)) }, - modifier = Modifier.weight(.5f) - ) { - Text(text = "Replace") - } - } - - LazyColumn( - modifier = Modifier.height(100.dp) - ) { - items(100) { - Text("Item #$it") - } - } - } - } -} diff --git a/samples/multiplatform/src/desktopMain/kotlin/cafe/adriel/voyager/sample/multiplatform/App.kt b/samples/multiplatform/src/desktopMain/kotlin/cafe/adriel/voyager/sample/multiplatform/App.kt deleted file mode 100644 index df419a10..00000000 --- a/samples/multiplatform/src/desktopMain/kotlin/cafe/adriel/voyager/sample/multiplatform/App.kt +++ /dev/null @@ -1,12 +0,0 @@ -package cafe.adriel.voyager.sample.multiplatform - -import androidx.compose.ui.window.Window -import androidx.compose.ui.window.application - -public fun main() { - application { - Window(onCloseRequest = ::exitApplication) { - SampleApplication() - } - } -} diff --git a/samples/multiplatform/src/iosMain/kotlin/MainViewController.kt b/samples/multiplatform/src/iosMain/kotlin/MainViewController.kt deleted file mode 100644 index dee0b397..00000000 --- a/samples/multiplatform/src/iosMain/kotlin/MainViewController.kt +++ /dev/null @@ -1,4 +0,0 @@ -import androidx.compose.ui.window.ComposeUIViewController -import cafe.adriel.voyager.sample.multiplatform.SampleApplication - -fun MainViewController() = ComposeUIViewController { SampleApplication() } diff --git a/samples/multiplatform/src/jsMain/kotlin/main.js.kt b/samples/multiplatform/src/jsMain/kotlin/main.js.kt deleted file mode 100644 index bd681dff..00000000 --- a/samples/multiplatform/src/jsMain/kotlin/main.js.kt +++ /dev/null @@ -1,13 +0,0 @@ -import androidx.compose.ui.ExperimentalComposeUiApi -import androidx.compose.ui.window.CanvasBasedWindow -import cafe.adriel.voyager.sample.multiplatform.SampleApplication -import org.jetbrains.skiko.wasm.onWasmReady - -@OptIn(ExperimentalComposeUiApi::class) -fun main() { - onWasmReady { - CanvasBasedWindow("Voyager Sample") { - SampleApplication() - } - } -} diff --git a/samples/multiplatform/src/jsMain/resources/index.html b/samples/multiplatform/src/jsMain/resources/index.html deleted file mode 100644 index 51ff82d3..00000000 --- a/samples/multiplatform/src/jsMain/resources/index.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - Voyager Sample - Compose Multiplatform - - - - -

Voyager Sample - Compose Multiplatform

-
- -
- - - \ No newline at end of file diff --git a/samples/multiplatform/src/jsMain/resources/style.css b/samples/multiplatform/src/jsMain/resources/style.css deleted file mode 100644 index e5b3293a..00000000 --- a/samples/multiplatform/src/jsMain/resources/style.css +++ /dev/null @@ -1,8 +0,0 @@ -#root { - width: 100%; - height: 100vh; -} - -#root > .compose-web-column > div { - position: relative; -} \ No newline at end of file diff --git a/samples/multiplatform/src/macosMain/kotlin/main.macos.kt b/samples/multiplatform/src/macosMain/kotlin/main.macos.kt deleted file mode 100644 index 9f344e8f..00000000 --- a/samples/multiplatform/src/macosMain/kotlin/main.macos.kt +++ /dev/null @@ -1,12 +0,0 @@ -import androidx.compose.ui.window.Window -import cafe.adriel.voyager.sample.multiplatform.SampleApplication -import platform.AppKit.NSApp -import platform.AppKit.NSApplication - -fun main() { - NSApplication.sharedApplication() - Window("VoyagerMultiplatform") { - SampleApplication() - } - NSApp?.run() -} diff --git a/samples/multiplatform/src/wasmJsMain/kotlin/main.wasmJs.kt b/samples/multiplatform/src/wasmJsMain/kotlin/main.wasmJs.kt deleted file mode 100644 index 28aba8e4..00000000 --- a/samples/multiplatform/src/wasmJsMain/kotlin/main.wasmJs.kt +++ /dev/null @@ -1,8 +0,0 @@ -import androidx.compose.ui.ExperimentalComposeUiApi -import androidx.compose.ui.window.CanvasBasedWindow -import cafe.adriel.voyager.sample.multiplatform.SampleApplication - -@OptIn(ExperimentalComposeUiApi::class) -fun main() { - CanvasBasedWindow(canvasElementId = "ComposeTarget") { SampleApplication() } -} diff --git a/samples/multiplatform/src/wasmJsMain/resources/index.html b/samples/multiplatform/src/wasmJsMain/resources/index.html deleted file mode 100644 index 9ba000fe..00000000 --- a/samples/multiplatform/src/wasmJsMain/resources/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Compose App - - - - - - - \ No newline at end of file diff --git a/voyager-hilt/api/voyager-hilt.api b/voyager-hilt/api/voyager-hilt.api deleted file mode 100644 index d0011c69..00000000 --- a/voyager-hilt/api/voyager-hilt.api +++ /dev/null @@ -1,56 +0,0 @@ -public abstract interface class cafe/adriel/voyager/hilt/HiltWrapper_VoyagerHiltViewModelFactories_ViewModelFactoryEntryPoint : cafe/adriel/voyager/hilt/VoyagerHiltViewModelFactories$ViewModelFactoryEntryPoint { -} - -public abstract class cafe/adriel/voyager/hilt/OptionalMultibindingsModule { - public static final field $stable I - public fun ()V - public abstract fun screenModelFactories ()Ljava/util/Map; - public abstract fun screenModels ()Ljava/util/Map; -} - -public abstract interface class cafe/adriel/voyager/hilt/ScreenModelEntryPoint { - public abstract fun screenModelFactories ()Ljava/util/Map; - public abstract fun screenModels ()Ljava/util/Map; -} - -public abstract interface class cafe/adriel/voyager/hilt/ScreenModelFactory { -} - -public abstract interface annotation class cafe/adriel/voyager/hilt/ScreenModelFactoryKey : java/lang/annotation/Annotation { - public abstract fun value ()Ljava/lang/Class; -} - -public abstract interface annotation class cafe/adriel/voyager/hilt/ScreenModelKey : java/lang/annotation/Annotation { - public abstract fun value ()Ljava/lang/Class; -} - -public final class cafe/adriel/voyager/hilt/VoyagerHiltViewModelFactories { - public static final field $stable I - public static final field INSTANCE Lcafe/adriel/voyager/hilt/VoyagerHiltViewModelFactories; - public final fun getVoyagerFactory (Landroidx/activity/ComponentActivity;Landroidx/lifecycle/ViewModelProvider$Factory;)Landroidx/lifecycle/ViewModelProvider$Factory; -} - -public final class cafe/adriel/voyager/hilt/VoyagerHiltViewModelFactories_InternalViewModelFactory_Factory : dagger/internal/Factory { - public fun (Ljavax/inject/Provider;Ljavax/inject/Provider;)V - public static fun create (Ljavax/inject/Provider;Ljavax/inject/Provider;)Lcafe/adriel/voyager/hilt/VoyagerHiltViewModelFactories_InternalViewModelFactory_Factory; - public fun get ()Lcafe/adriel/voyager/hilt/VoyagerHiltViewModelFactories$InternalViewModelFactory; - public synthetic fun get ()Ljava/lang/Object; - public static fun newInstance (Ljava/util/Map;Ldagger/hilt/android/internal/builders/ViewModelComponentBuilder;)Lcafe/adriel/voyager/hilt/VoyagerHiltViewModelFactories$InternalViewModelFactory; -} - -public final class cafe/adriel/voyager/hilt/internal/ContextExtKt { - public static final fun getComponentActivity (Landroid/content/Context;)Landroidx/activity/ComponentActivity; -} - -public class hilt_aggregated_deps/_cafe_adriel_voyager_hilt_HiltWrapper_VoyagerHiltViewModelFactories_ViewModelFactoryEntryPoint { - public fun ()V -} - -public class hilt_aggregated_deps/_cafe_adriel_voyager_hilt_OptionalMultibindingsModule { - public fun ()V -} - -public class hilt_aggregated_deps/_cafe_adriel_voyager_hilt_ScreenModelEntryPoint { - public fun ()V -} - diff --git a/voyager-hilt/build.gradle.kts b/voyager-hilt/build.gradle.kts deleted file mode 100644 index 57c3f7f1..00000000 --- a/voyager-hilt/build.gradle.kts +++ /dev/null @@ -1,29 +0,0 @@ -plugins { - alias(libs.plugins.android.library) - alias(libs.plugins.kotlin.android) - alias(libs.plugins.kotlin.compose) - alias(libs.plugins.kotlin.kapt) - id("voyager-android-module") -} - -android { - namespace = "cafe.adriel.voyager.hilt" -} - -kapt { - correctErrorTypes = true -} - -dependencies { - api(projects.voyagerScreenmodel) - api(projects.voyagerNavigator) - - implementation(libs.androidx.lifecycle.savedState) - implementation(libs.androidx.lifecycle.viewModelKtx) - implementation(libs.androidx.lifecycle.viewModelCompose) - implementation(libs.hilt.android) - kapt(libs.hilt.compiler) - - testRuntimeOnly(libs.junit.engine) - testImplementation(libs.junit.api) -} diff --git a/voyager-hilt/gradle.properties b/voyager-hilt/gradle.properties deleted file mode 100644 index 80dbee2a..00000000 --- a/voyager-hilt/gradle.properties +++ /dev/null @@ -1,2 +0,0 @@ -POM_NAME=VoyagerHilt -POM_ARTIFACT_ID=voyager-hilt \ No newline at end of file diff --git a/voyager-hilt/src/main/AndroidManifest.xml b/voyager-hilt/src/main/AndroidManifest.xml deleted file mode 100644 index 2b36cf6b..00000000 --- a/voyager-hilt/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/OptionalMultibindingsModule.kt b/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/OptionalMultibindingsModule.kt deleted file mode 100644 index cf16deca..00000000 --- a/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/OptionalMultibindingsModule.kt +++ /dev/null @@ -1,21 +0,0 @@ -package cafe.adriel.voyager.hilt - -import cafe.adriel.voyager.core.model.ScreenModel -import dagger.Module -import dagger.hilt.InstallIn -import dagger.hilt.android.components.ActivityRetainedComponent -import dagger.multibindings.Multibinds - -/** - * By default Dagger Multibindings are required to have at least one definition. - * This module says to Dagger that a map with [ScreenModel] or [ScreenModelFactory] can be empty. - */ -@Module -@InstallIn(ActivityRetainedComponent::class) -public abstract class OptionalMultibindingsModule { - @Multibinds - public abstract fun screenModelFactories(): Map, ScreenModelFactory> - - @Multibinds - public abstract fun screenModels(): Map, ScreenModel> -} diff --git a/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/ScreenModel.kt b/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/ScreenModel.kt deleted file mode 100644 index b78c44e5..00000000 --- a/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/ScreenModel.kt +++ /dev/null @@ -1,112 +0,0 @@ -package cafe.adriel.voyager.hilt - -import androidx.compose.runtime.Composable -import androidx.compose.ui.platform.LocalContext -import cafe.adriel.voyager.core.model.ScreenModel -import cafe.adriel.voyager.core.model.rememberNavigatorScreenModel -import cafe.adriel.voyager.core.model.rememberScreenModel -import cafe.adriel.voyager.core.screen.Screen -import cafe.adriel.voyager.hilt.internal.componentActivity -import cafe.adriel.voyager.navigator.Navigator -import dagger.hilt.android.EntryPointAccessors - -/** - * Provide a [ScreenModel] getting from Hilt graph. - * - * @return A new instance of [ScreenModel] or the same instance remembered by the composition - */ -@Composable -public inline fun Screen.getScreenModel( - tag: String? = null -): T { - val context = LocalContext.current - return rememberScreenModel(tag) { - val screenModels = EntryPointAccessors - .fromActivity(context.componentActivity, ScreenModelEntryPoint::class.java) - .screenModels() - val model = screenModels[T::class.java]?.get() - ?: error( - "${T::class.java} not found in hilt graph.\nPlease, check if you have a Multibinding " + - "declaration to your ScreenModel using @IntoMap and " + - "@ScreenModelKey(${T::class.qualifiedName}::class)" - ) - model as T - } -} - -/** - * Provide a [ScreenModel] using a custom [ScreenModelFactory]. The [ScreenModelFactory] is provided by Hilt graph. - * - * @param factory A function that receives a [ScreenModelFactory] and returns a [ScreenModel] created by the custom factory - * @return A new instance of [ScreenModel] or the same instance remembered by the composition - */ -@Composable -public inline fun Screen.getScreenModel( - tag: String? = null, - noinline factory: (F) -> T -): T { - val context = LocalContext.current - return rememberScreenModel(tag) { - val screenFactories = EntryPointAccessors - .fromActivity(context.componentActivity, ScreenModelEntryPoint::class.java) - .screenModelFactories() - val screenFactory = screenFactories[F::class.java]?.get() - ?: error( - "${F::class.java} not found in hilt graph.\nPlease, check if you have a Multibinding " + - "declaration to your ScreenModelFactory using @IntoMap and " + - "@ScreenModelFactoryKey(${F::class.qualifiedName}::class)" - ) - factory.invoke(screenFactory as F) - } -} - -/** - * Provide a [ScreenModel] getting from Hilt graph, lifecycle bounded to the Navigator. - * - * @return A new instance of [ScreenModel] or the same instance remembered by the composition - */ -@Composable -public inline fun Navigator.getNavigatorScreenModel( - tag: String? = null -): T { - val context = LocalContext.current - return rememberNavigatorScreenModel(tag) { - val screenModels = EntryPointAccessors - .fromActivity(context.componentActivity, ScreenModelEntryPoint::class.java) - .screenModels() - val model = screenModels[T::class.java]?.get() - ?: error( - "${T::class.java} not found in hilt graph.\nPlease, check if you have a Multibinding " + - "declaration to your ScreenModel using @IntoMap and " + - "@ScreenModelKey(${T::class.qualifiedName}::class)" - ) - model as T - } -} - -/** - * Provide a [ScreenModel] using a custom [ScreenModelFactory], lifecycle bounded to the Navigator. - * The [ScreenModelFactory] is provided by Hilt graph. - * - * @param factory A function that receives a [ScreenModelFactory] and returns a [ScreenModel] created by the custom factory - * @return A new instance of [ScreenModel] or the same instance remembered by the composition - */ -@Composable -public inline fun Navigator.getNavigatorScreenModel( - tag: String? = null, - noinline factory: (F) -> T -): T { - val context = LocalContext.current - return rememberNavigatorScreenModel(tag) { - val screenFactories = EntryPointAccessors - .fromActivity(context.componentActivity, ScreenModelEntryPoint::class.java) - .screenModelFactories() - val screenFactory = screenFactories[F::class.java]?.get() - ?: error( - "${F::class.java} not found in hilt graph.\nPlease, check if you have a Multibinding " + - "declaration to your ScreenModelFactory using @IntoMap and " + - "@ScreenModelFactoryKey(${F::class.qualifiedName}::class)" - ) - factory.invoke(screenFactory as F) - } -} diff --git a/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/ScreenModelEntryPoint.kt b/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/ScreenModelEntryPoint.kt deleted file mode 100644 index 55dd914e..00000000 --- a/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/ScreenModelEntryPoint.kt +++ /dev/null @@ -1,27 +0,0 @@ -package cafe.adriel.voyager.hilt - -import cafe.adriel.voyager.core.model.ScreenModel -import dagger.hilt.EntryPoint -import dagger.hilt.InstallIn -import dagger.hilt.android.components.ActivityComponent -import javax.inject.Provider - -/** - * A Hilt entry point that provide all [ScreenModelFactory] and [ScreenModel] in the graph. - * To have all [ScreenModelFactory] and [ScreenModel] in the graph they must be declared using Multibinding - */ -@EntryPoint -@InstallIn(ActivityComponent::class) -public interface ScreenModelEntryPoint { - - /** - * Provide all custom factories declared using multibinding - */ - public fun screenModelFactories(): - Map, @JvmSuppressWildcards Provider> - - /** - * Provide all screen models declared using multibinding - */ - public fun screenModels(): Map, @JvmSuppressWildcards Provider> -} diff --git a/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/ScreenModelFactory.kt b/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/ScreenModelFactory.kt deleted file mode 100644 index 07043ba5..00000000 --- a/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/ScreenModelFactory.kt +++ /dev/null @@ -1,7 +0,0 @@ -package cafe.adriel.voyager.hilt - -/** - * A custom factory used to instantiate objects with custom constructor. - * Frequently used with Assisted Injection - */ -public interface ScreenModelFactory diff --git a/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/ScreenModelFactoryKey.kt b/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/ScreenModelFactoryKey.kt deleted file mode 100644 index 50628863..00000000 --- a/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/ScreenModelFactoryKey.kt +++ /dev/null @@ -1,17 +0,0 @@ -package cafe.adriel.voyager.hilt - -import dagger.MapKey -import kotlin.reflect.KClass - -/** - * A Dagger multibinding key used to identify a [ScreenModelFactory] - */ -@MustBeDocumented -@Target( - AnnotationTarget.FUNCTION, - AnnotationTarget.PROPERTY_GETTER, - AnnotationTarget.PROPERTY_SETTER -) -@Retention(AnnotationRetention.RUNTIME) -@MapKey -public annotation class ScreenModelFactoryKey(val value: KClass) diff --git a/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/ScreenModelKey.kt b/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/ScreenModelKey.kt deleted file mode 100644 index f00856d9..00000000 --- a/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/ScreenModelKey.kt +++ /dev/null @@ -1,18 +0,0 @@ -package cafe.adriel.voyager.hilt - -import cafe.adriel.voyager.core.model.ScreenModel -import dagger.MapKey -import kotlin.reflect.KClass - -/** - * A Dagger multibinding key used to identify a [ScreenModel] - */ -@MustBeDocumented -@Target( - AnnotationTarget.FUNCTION, - AnnotationTarget.PROPERTY_GETTER, - AnnotationTarget.PROPERTY_SETTER -) -@Retention(AnnotationRetention.RUNTIME) -@MapKey -public annotation class ScreenModelKey(val value: KClass) diff --git a/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/ViewModel.kt b/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/ViewModel.kt deleted file mode 100644 index 77c2c704..00000000 --- a/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/ViewModel.kt +++ /dev/null @@ -1,102 +0,0 @@ -package cafe.adriel.voyager.hilt - -import androidx.compose.runtime.Composable -import androidx.compose.runtime.remember -import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.platform.LocalLifecycleOwner -import androidx.lifecycle.HasDefaultViewModelProviderFactory -import androidx.lifecycle.ViewModel -import androidx.lifecycle.ViewModelProvider -import androidx.lifecycle.ViewModelStore -import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner -import cafe.adriel.voyager.core.annotation.ExperimentalVoyagerApi -import cafe.adriel.voyager.core.screen.Screen -import cafe.adriel.voyager.hilt.internal.componentActivity -import dagger.hilt.android.lifecycle.withCreationCallback - -/** - * A function to provide a [dagger.hilt.android.lifecycle.HiltViewModel] managed by voyager ViewModelLifecycleOwner - * instead of using Activity ViewModelLifecycleOwner. - * There is compatibility with Activity ViewModelLifecycleOwner too but it must be avoided because your ViewModels - * will be cleared when activity is totally destroyed only. - * - * @param viewModelProviderFactory A custom factory commonly used with Assisted Injection - * @return A new instance of [ViewModel] or the existent instance in the [ViewModelStore] - */ -@Composable -public inline fun Screen.getViewModel( - viewModelProviderFactory: ViewModelProvider.Factory? = null -): T { - val context = LocalContext.current - val lifecycleOwner = LocalLifecycleOwner.current - val viewModelStoreOwner = checkNotNull(LocalViewModelStoreOwner.current) { - "No ViewModelStoreOwner was provided via LocalViewModelStoreOwner" - } - return remember(key1 = T::class) { - val hasDefaultViewModelProviderFactory = requireNotNull(lifecycleOwner as? HasDefaultViewModelProviderFactory) { - "$lifecycleOwner is not a androidx.lifecycle.HasDefaultViewModelProviderFactory" - } - val viewModelStore = requireNotNull(viewModelStoreOwner?.viewModelStore) { - "$viewModelStoreOwner is null or have a null viewModelStore" - } - val factory = VoyagerHiltViewModelFactories.getVoyagerFactory( - activity = context.componentActivity, - delegateFactory = viewModelProviderFactory - ?: hasDefaultViewModelProviderFactory.defaultViewModelProviderFactory - ) - val provider = ViewModelProvider( - store = viewModelStore, - factory = factory, - defaultCreationExtras = hasDefaultViewModelProviderFactory.defaultViewModelCreationExtras - ) - provider[T::class.java] - } -} - -/** - * A function to provide a [dagger.hilt.android.lifecycle.HiltViewModel] managed by Voyager ViewModelLifecycleOwner - * instead of using Activity ViewModelLifecycleOwner. - * There is compatibility with Activity ViewModelLifecycleOwner too but it must be avoided because your ViewModels - * will be cleared when activity is totally destroyed only. - * - * @param viewModelProviderFactory A custom factory commonly used with Assisted Injection - * @param viewModelFactory A custom factory to assist with creation of ViewModels - * @return A new instance of [ViewModel] or the existent instance in the [ViewModelStore] - */ -@Composable -@ExperimentalVoyagerApi -public inline fun Screen.getViewModel( - viewModelProviderFactory: ViewModelProvider.Factory? = null, - noinline viewModelFactory: (F) -> VM -): VM { - val context = LocalContext.current - val lifecycleOwner = LocalLifecycleOwner.current - val viewModelStoreOwner = checkNotNull(LocalViewModelStoreOwner.current) { - "No ViewModelStoreOwner was provided via LocalViewModelStoreOwner" - } - return remember(key1 = VM::class) { - val hasDefaultViewModelProviderFactory = requireNotNull(lifecycleOwner as? HasDefaultViewModelProviderFactory) { - "$lifecycleOwner is not a androidx.lifecycle.HasDefaultViewModelProviderFactory" - } - val viewModelStore = requireNotNull(viewModelStoreOwner?.viewModelStore) { - "$viewModelStoreOwner is null or have a null viewModelStore" - } - - val creationExtras = hasDefaultViewModelProviderFactory.defaultViewModelCreationExtras - .withCreationCallback(viewModelFactory) - - val factory = VoyagerHiltViewModelFactories.getVoyagerFactory( - activity = context.componentActivity, - delegateFactory = viewModelProviderFactory - ?: hasDefaultViewModelProviderFactory.defaultViewModelProviderFactory - ) - - val provider = ViewModelProvider( - store = viewModelStore, - factory = factory, - defaultCreationExtras = creationExtras - ) - - provider[VM::class.java] - } -} diff --git a/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/VoyagerHiltViewModelFactories.kt b/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/VoyagerHiltViewModelFactories.kt deleted file mode 100644 index 88a36930..00000000 --- a/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/VoyagerHiltViewModelFactories.kt +++ /dev/null @@ -1,41 +0,0 @@ -package cafe.adriel.voyager.hilt - -import androidx.activity.ComponentActivity -import androidx.lifecycle.ViewModelProvider -import dagger.hilt.EntryPoint -import dagger.hilt.EntryPoints -import dagger.hilt.InstallIn -import dagger.hilt.android.components.ActivityComponent -import dagger.hilt.android.internal.builders.ViewModelComponentBuilder -import dagger.hilt.android.internal.lifecycle.HiltViewModelFactory -import dagger.hilt.android.internal.lifecycle.HiltViewModelMap -import javax.inject.Inject - -public object VoyagerHiltViewModelFactories { - - public fun getVoyagerFactory( - activity: ComponentActivity, - delegateFactory: ViewModelProvider.Factory - ): ViewModelProvider.Factory { - return EntryPoints.get(activity, ViewModelFactoryEntryPoint::class.java) - .internalViewModelFactory() - .fromActivity(delegateFactory) - } - - internal class InternalViewModelFactory @Inject internal constructor( - @HiltViewModelMap.KeySet private val keySet: Map, Boolean>, - private val viewModelComponentBuilder: ViewModelComponentBuilder - ) { - fun fromActivity( - delegateFactory: ViewModelProvider.Factory - ): ViewModelProvider.Factory { - return HiltViewModelFactory(keySet, delegateFactory, viewModelComponentBuilder) - } - } - - @EntryPoint - @InstallIn(ActivityComponent::class) - internal interface ViewModelFactoryEntryPoint { - fun internalViewModelFactory(): InternalViewModelFactory - } -} diff --git a/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/internal/ContextExt.kt b/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/internal/ContextExt.kt deleted file mode 100644 index 1ce20563..00000000 --- a/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/internal/ContextExt.kt +++ /dev/null @@ -1,21 +0,0 @@ -package cafe.adriel.voyager.hilt.internal - -import android.content.Context -import android.content.ContextWrapper -import androidx.activity.ComponentActivity - -private inline fun findOwner(context: Context): T? { - var innerContext = context - while (innerContext is ContextWrapper) { - if (innerContext is T) { - return innerContext - } - innerContext = innerContext.baseContext - } - return null -} - -@PublishedApi -internal val Context.componentActivity: ComponentActivity - get() = findOwner(this) - ?: error("Context must be a androidx.activity.ComponentActivity. Current is $this") diff --git a/voyager-kodein/api/android/voyager-kodein.api b/voyager-kodein/api/android/voyager-kodein.api deleted file mode 100644 index fc38a88d..00000000 --- a/voyager-kodein/api/android/voyager-kodein.api +++ /dev/null @@ -1,3 +0,0 @@ -public final class cafe/adriel/voyager/kodein/ScreenLifecycleScopeKt { -} - diff --git a/voyager-kodein/api/desktop/voyager-kodein.api b/voyager-kodein/api/desktop/voyager-kodein.api deleted file mode 100644 index fc38a88d..00000000 --- a/voyager-kodein/api/desktop/voyager-kodein.api +++ /dev/null @@ -1,3 +0,0 @@ -public final class cafe/adriel/voyager/kodein/ScreenLifecycleScopeKt { -} - diff --git a/voyager-kodein/build.gradle.kts b/voyager-kodein/build.gradle.kts deleted file mode 100644 index bcf78fcd..00000000 --- a/voyager-kodein/build.gradle.kts +++ /dev/null @@ -1,28 +0,0 @@ -plugins { - alias(libs.plugins.android.library) - alias(libs.plugins.kotlin.multiplatform) - alias(libs.plugins.kotlin.compose) - alias(libs.plugins.compose.multiplatform) - id("voyager-kmp-module") -} - -android { - namespace = "cafe.adriel.voyager.kodein" -} - -kotlin { - sourceSets { - commonMain.dependencies { - api(projects.voyagerCore) - api(projects.voyagerScreenmodel) - api(projects.voyagerNavigator) - compileOnly(libs.kodein) - implementation(compose.runtime) - implementation(compose.runtimeSaveable) - } - jvmTest.dependencies { - implementation(libs.junit.api) - runtimeOnly(libs.junit.engine) - } - } -} diff --git a/voyager-kodein/gradle.properties b/voyager-kodein/gradle.properties deleted file mode 100644 index 332551aa..00000000 --- a/voyager-kodein/gradle.properties +++ /dev/null @@ -1,2 +0,0 @@ -POM_NAME=VoyagerKodein -POM_ARTIFACT_ID=voyager-kodein \ No newline at end of file diff --git a/voyager-kodein/src/androidMain/AndroidManifest.xml b/voyager-kodein/src/androidMain/AndroidManifest.xml deleted file mode 100644 index 1364a3e5..00000000 --- a/voyager-kodein/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/voyager-kodein/src/commonMain/kotlin/cafe/adriel/voyager/kodein/ScreenLifecycleScope.kt b/voyager-kodein/src/commonMain/kotlin/cafe/adriel/voyager/kodein/ScreenLifecycleScope.kt deleted file mode 100644 index a54a8f19..00000000 --- a/voyager-kodein/src/commonMain/kotlin/cafe/adriel/voyager/kodein/ScreenLifecycleScope.kt +++ /dev/null @@ -1,77 +0,0 @@ -package cafe.adriel.voyager.kodein - -import androidx.compose.runtime.Composable -import androidx.compose.runtime.remember -import cafe.adriel.voyager.core.annotation.ExperimentalVoyagerApi -import cafe.adriel.voyager.core.lifecycle.ScreenLifecycleOwner -import cafe.adriel.voyager.core.lifecycle.ScreenLifecycleStore -import cafe.adriel.voyager.core.screen.Screen -import cafe.adriel.voyager.navigator.LocalNavigator -import cafe.adriel.voyager.navigator.currentOrThrow -import org.kodein.di.bindings.Scope -import org.kodein.di.bindings.ScopeRegistry -import org.kodein.di.bindings.StandardScopeRegistry -import org.kodein.di.internal.synchronizedIfNull - -@ExperimentalVoyagerApi -@Composable -public fun rememberScreenContext(): ScreenContext { - val navigator = LocalNavigator.currentOrThrow - - return remember(navigator.lastItem) { ScreenContext(navigator.lastItem) } -} - -@ExperimentalVoyagerApi -public class ScreenContext( - public val screen: Screen -) { - internal var disposeCallback: () -> Unit = {} - - internal fun onRegistryScope() { - ScreenLifecycleStore.get(screen) { - ScreenScopeLifecycleOwner(disposeCallback) - } - } - - override fun hashCode(): Int = screen.key.hashCode() - - override fun equals(other: Any?): Boolean = - (other as? Screen?)?.key == screen.key -} - -@ExperimentalVoyagerApi -public open class ScreenLifecycleScope private constructor( - private val newRegistry: () -> ScopeRegistry -) : Scope { - - @ExperimentalVoyagerApi - public companion object multiItem : ScreenLifecycleScope(::StandardScopeRegistry) - - private val map = HashMap() - - override fun getRegistry(context: ScreenContext): ScopeRegistry { - return synchronizedIfNull( - lock = map, - predicate = { map[context] }, - ifNotNull = { it }, - ifNull = { - val registry = newRegistry() - map[context] = registry - context.disposeCallback = { - registry.clear() - map.remove(context) - } - context.onRegistryScope() - registry - } - ) - } -} - -private class ScreenScopeLifecycleOwner( - val onDispose: () -> Unit -) : ScreenLifecycleOwner { - override fun onDispose(screen: Screen) { - onDispose() - } -} diff --git a/voyager-kodein/src/commonMain/kotlin/cafe/adriel/voyager/kodein/ScreenModel.kt b/voyager-kodein/src/commonMain/kotlin/cafe/adriel/voyager/kodein/ScreenModel.kt deleted file mode 100644 index 54630006..00000000 --- a/voyager-kodein/src/commonMain/kotlin/cafe/adriel/voyager/kodein/ScreenModel.kt +++ /dev/null @@ -1,41 +0,0 @@ -package cafe.adriel.voyager.kodein - -import androidx.compose.runtime.Composable -import cafe.adriel.voyager.core.model.ScreenModel -import cafe.adriel.voyager.core.model.rememberNavigatorScreenModel -import cafe.adriel.voyager.core.model.rememberScreenModel -import cafe.adriel.voyager.core.screen.Screen -import cafe.adriel.voyager.navigator.Navigator -import org.kodein.di.compose.localDI -import org.kodein.di.direct -import org.kodein.di.provider - -@Composable -public inline fun Screen.rememberScreenModel( - tag: Any? = null -): T = with(localDI()) { - rememberScreenModel(tag = tag?.toString()) { direct.provider(tag)() } -} - -@Composable -public inline fun Screen.rememberScreenModel( - tag: Any? = null, - arg: A -): T = with(localDI()) { - rememberScreenModel(tag = tag?.toString()) { direct.provider(tag, arg)() } -} - -@Composable -public inline fun Navigator.rememberNavigatorScreenModel( - tag: Any? = null -): T = with(localDI()) { - rememberNavigatorScreenModel(tag = tag?.toString()) { direct.provider(tag)() } -} - -@Composable -public inline fun Navigator.rememberNavigatorScreenModel( - tag: Any? = null, - arg: A -): T = with(localDI()) { - rememberNavigatorScreenModel(tag = tag?.toString()) { direct.provider(tag, arg)() } -} diff --git a/voyager-livedata/api/voyager-livedata.api b/voyager-livedata/api/voyager-livedata.api deleted file mode 100644 index aceaa254..00000000 --- a/voyager-livedata/api/voyager-livedata.api +++ /dev/null @@ -1,8 +0,0 @@ -public abstract class cafe/adriel/voyager/livedata/LiveScreenModel : cafe/adriel/voyager/core/model/ScreenModel { - public static final field $stable I - public fun (Ljava/lang/Object;)V - protected final fun getMutableState ()Landroidx/lifecycle/MutableLiveData; - public final fun getState ()Landroidx/lifecycle/LiveData; - public fun onDispose ()V -} - diff --git a/voyager-livedata/build.gradle.kts b/voyager-livedata/build.gradle.kts deleted file mode 100644 index bb6d2dab..00000000 --- a/voyager-livedata/build.gradle.kts +++ /dev/null @@ -1,19 +0,0 @@ -plugins { - alias(libs.plugins.android.library) - alias(libs.plugins.kotlin.android) - id("voyager-android-module") -} - -android { - namespace = "cafe.adriel.voyager.livedata" -} - -dependencies { - api(projects.voyagerCore) - api(projects.voyagerScreenmodel) - - implementation(libs.androidx.lifecycle.livedata) - - testRuntimeOnly(libs.junit.engine) - testImplementation(libs.junit.api) -} diff --git a/voyager-livedata/gradle.properties b/voyager-livedata/gradle.properties deleted file mode 100644 index 4e03bd03..00000000 --- a/voyager-livedata/gradle.properties +++ /dev/null @@ -1,2 +0,0 @@ -POM_NAME=VoyagerLiveData -POM_ARTIFACT_ID=voyager-livedata \ No newline at end of file diff --git a/voyager-livedata/src/main/AndroidManifest.xml b/voyager-livedata/src/main/AndroidManifest.xml deleted file mode 100644 index 11787495..00000000 --- a/voyager-livedata/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/voyager-livedata/src/main/java/cafe/adriel/voyager/livedata/LiveScreenModel.kt b/voyager-livedata/src/main/java/cafe/adriel/voyager/livedata/LiveScreenModel.kt deleted file mode 100644 index ae02ae61..00000000 --- a/voyager-livedata/src/main/java/cafe/adriel/voyager/livedata/LiveScreenModel.kt +++ /dev/null @@ -1,11 +0,0 @@ -package cafe.adriel.voyager.livedata - -import androidx.lifecycle.LiveData -import androidx.lifecycle.MutableLiveData -import cafe.adriel.voyager.core.model.ScreenModel - -public abstract class LiveScreenModel(initialState: S) : ScreenModel { - - protected val mutableState: MutableLiveData = MutableLiveData(initialState) - public val state: LiveData = mutableState -}