Skip to content

Commit

Permalink
Updated dependencies. 1.0.2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamKobus committed Aug 12, 2022
1 parent 4ca8471 commit 32aa4b0
Show file tree
Hide file tree
Showing 20 changed files with 247 additions and 287 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

### Changes

# 1.0.2

### Changes

- Updated AGP to 7.2.2

# 1.0.1

### Fixes
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ repositories {
dependencies {
// LifecycleObserverKtx
implementation "com.adamkobus:lifecycle-observer-ktx:1.0.1"
implementation "com.adamkobus:lifecycle-observer-ktx:1.0.2"
// LifecycleObserverKtx + LifecycleAwareViewModel + ViewParam
implementation "com.adamkobus:lifecycle-observer-viewmodel-ktx:1.0.1"
implementation "com.adamkobus:lifecycle-observer-viewmodel-ktx:1.0.2"
}
```

Expand All @@ -39,10 +39,10 @@ repositories {
dependencies {
// LifecycleObserverKtx
implementation "com.adamkobus:lifecycle-observer-ktx:1.0.1-SNAPSHOT"
implementation "com.adamkobus:lifecycle-observer-ktx:1.0.2-SNAPSHOT"
// LifecycleObserverKtx + LifecycleAwareViewModel + ViewParam
implementation "com.adamkobus:lifecycle-observer-viewmodel-ktx:1.0.1-SNAPSHOT"
implementation "com.adamkobus:lifecycle-observer-viewmodel-ktx:1.0.2-SNAPSHOT"
}
```

Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ apply plugin: "com.github.ben-manes.versions"
buildscript {
ext {
// https://github.com/JLLeitschuh/ktlint-gradle/releases
ktlintPluginVersion = "10.2.1"
ktlintPluginVersion = "10.3.0"

// https://github.com/detekt/detekt/releases
detektPluginVersion = "1.19.0"
detektPluginVersion = "1.21.0"

// https://github.com/ben-manes/gradle-versions-plugin/releases
versionsPluginVersion = "0.41.0"
versionsPluginVersion = "0.42.0"

// https://github.com/gradle-nexus/publish-plugin/releases
publishPluginVersion = "1.1.0"

// https://developer.android.com/studio/releases/gradle-plugin
androidGradlePluginVersion = "7.1.0"
androidGradlePluginVersion = "7.2.2"

// https://kotlinlang.org/docs/releases.html#release-details
kotlinVersion = "1.6.0"
kotlinVersion = "1.7.10"
}

repositories {
Expand Down
26 changes: 14 additions & 12 deletions buildSrc/src/main/java/com/adamkobus/vm/Libs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,39 @@ object Libs {
/**
* [Kotlint Coroutines Releases](https://github.com/Kotlin/kotlinx.coroutines/releases)
*/
const val KOTLIN_COROUTINES_VERSION = "1.6.0"
const val KOTLIN_COROUTINES_VERSION = "1.6.4"

/**
* [Jetpack Compose Releases](https://developer.android.com/jetpack/androidx/versions/all-channel)
*/
const val COMPOSE_VERSION = "1.1.0-rc01"
const val COMPOSE_VERSION = "1.2.1"

const val COMPOSE_COMPILER_VERSION = "1.3.0"

/**
* [Accompanist Version](https://github.com/google/accompanist/releases)
*/
const val ACCOMPANIST_VERSION = "0.22.0-rc"
const val ACCOMPANIST_VERSION = "0.25.1"

/**
* [Ktlint Releases](https://github.com/pinterest/ktlint/releases)
*/
const val KTLINT_VERSION = "0.43.2"
const val KTLINT_VERSION = "0.42.1"

/**
* [AndroidX Lifecycle Releases](https://developer.android.com/jetpack/androidx/releases/lifecycle)
*/
const val ANDROIDX_LIFECYCLE_VERSION = "2.4.0"
const val ANDROIDX_LIFECYCLE_VERSION = "2.5.1"

/**
* [AndroidX Appcompat Releases](https://developer.android.com/jetpack/androidx/releases/appcompat)
*/
const val ANDROIDX_APPCOMPAT_VERSION = "1.4.1"
const val ANDROIDX_APPCOMPAT_VERSION = "1.5.0"

/**
* [Hilt Releases](https://github.com/google/dagger/releases)
*/
const val HILT_VERSION = "2.40.5"
const val HILT_VERSION = "2.43.2"

object Kotlin {
const val Coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-android:$KOTLIN_COROUTINES_VERSION"
Expand All @@ -49,7 +51,7 @@ object Libs {
/**
* [Compose Activity Releases](https://androidx.tech/artifacts/activity/activity-compose/)
*/
const val Activity = "androidx.activity:activity-compose:1.4.0"
const val Activity = "androidx.activity:activity-compose:1.5.1"
const val Ui = "androidx.compose.ui:ui:$COMPOSE_VERSION"
const val Material = "androidx.compose.material:material:$COMPOSE_VERSION"
const val ToolingPreview = "androidx.compose.ui:ui-tooling-preview:$COMPOSE_VERSION"
Expand All @@ -72,7 +74,7 @@ object Libs {
/**
* [Material Releases](https://github.com/material-components/material-components-android/releases)
*/
const val Material = "com.google.android.material:material:1.5.0"
const val Material = "com.google.android.material:material:1.6.1"
const val Hilt = "com.google.dagger:hilt-android:$HILT_VERSION"
const val HiltCompiler = "com.google.dagger:hilt-android-compiler:$HILT_VERSION"

Expand All @@ -86,7 +88,7 @@ object Libs {
/**
* [Compose Navigation Releases](https://github.com/AdamKobus/compose-navigation/releases)
*/
const val Navigation = "com.adamkobus:compose-navigation:0.1.0"
const val Navigation = "com.adamkobus:compose-navigation:0.3.0"
}

object Test {
Expand All @@ -98,8 +100,8 @@ object Libs {
/**
* [Mockk Releases](https://github.com/mockk/mockk/releases)
*/
const val Mockk = "io.mockk:mockk:1.12.2"
const val Mockk = "io.mockk:mockk:1.12.5"

const val CoroutinesTest = "org.jetbrains.kotlinx:kotlinx-coroutines-test:$KOTLIN_VERSION"
const val CoroutinesTest = "org.jetbrains.kotlinx:kotlinx-coroutines-test:$KOTLIN_COROUTINES_VERSION"
}
}
2 changes: 1 addition & 1 deletion demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ android {
}

composeOptions {
kotlinCompilerExtensionVersion Libs.COMPOSE_VERSION
kotlinCompilerExtensionVersion Libs.COMPOSE_COMPILER_VERSION
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
package com.adamkobus.android.vm.demo.app

import android.app.Application
import com.adamkobus.android.vm.demo.nav.ComposeNavigationConfigurator
import dagger.hilt.android.HiltAndroidApp
import javax.inject.Inject

@HiltAndroidApp
class DemoApplication : Application()
class DemoApplication : Application() {

@Inject
lateinit var composeNavigationConfigStep: ComposeNavigationConfigurator

override fun onCreate() {
super.onCreate()
composeNavigationConfigStep.configure()
}
}
18 changes: 0 additions & 18 deletions demo/src/main/java/com/adamkobus/android/vm/demo/di/DemoBinds.kt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.adamkobus.android.vm.demo.di

import com.adamkobus.android.vm.demo.nav.DemoNavActionVerifier
import com.adamkobus.compose.navigation.ComposeNavigation
import com.adamkobus.compose.navigation.NavActionVerifier
import com.adamkobus.compose.navigation.NavigationConsumer
import com.adamkobus.compose.navigation.NavigationStateSource
import dagger.Binds
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import dagger.multibindings.IntoSet

@Module(includes = [NavigationModuleBinds::class])
@InstallIn(SingletonComponent::class)
object NavigationModule {

@Provides
fun providesNavigationConsumer(): NavigationConsumer {
return ComposeNavigation.getNavigationConsumer()
}

@Provides
fun provideNavigationStateSource(): NavigationStateSource =
ComposeNavigation.getNavigationStateSource()
}

@InstallIn(SingletonComponent::class)
@Module
internal interface NavigationModuleBinds {

@Binds
@IntoSet
fun bindDefaultNavActionVerifier(impl: DemoNavActionVerifier): NavActionVerifier
}
24 changes: 9 additions & 15 deletions demo/src/main/java/com/adamkobus/android/vm/demo/nav/Actions.kt
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
package com.adamkobus.android.vm.demo.nav

import com.adamkobus.compose.navigation.data.NavAction
import com.adamkobus.compose.navigation.data.PopBackStackDestination
import com.adamkobus.compose.navigation.action.NavAction
import com.adamkobus.compose.navigation.action.NavActionWrapper

sealed class FromHome(navAction: NavAction) : NavAction(navAction) {
sealed class FromHome(navAction: NavAction) : NavActionWrapper(navAction) {

object ToLogsList : FromHome(DemoGraph.Home to DemoGraph.LogsList)
object ToLogsList : FromHome(DemoGraph.Home goTo DemoGraph.LogsList)
}

sealed class FromDemoDialog(navAction: NavAction) : NavAction(navAction) {
object Dismiss : FromDemoDialog(
NavAction(
DemoGraph.DemoDialog,
PopBackStackDestination,
navigateWithController = { it.popBackStack() }
)
)
sealed class FromDemoDialog(navAction: NavAction) : NavActionWrapper(navAction) {
object Dismiss : FromDemoDialog(DemoGraph.DemoDialog.pop())
}

sealed class FromLogs(navAction: NavAction) : NavAction(navAction) {
class ToDemoDialog(logId: Int) : NavAction(DemoGraph.LogsList to DemoGraph.DemoDialog arg logId)
object Back : NavAction(DemoGraph.LogsList, PopBackStackDestination, navigateWithController = { it.popBackStack() })
sealed class FromLogs(navAction: NavAction) : NavActionWrapper(navAction) {
class ToDemoDialog(logId: Int) : FromLogs(DemoGraph.LogsList goTo DemoGraph.DemoDialog arg logId)
object Back : FromLogs(DemoGraph.LogsList.pop())
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.adamkobus.android.vm.demo.nav

import android.util.Log
import com.adamkobus.compose.navigation.BuildConfig
import com.adamkobus.compose.navigation.ComposeNavigation
import com.adamkobus.compose.navigation.NavActionVerifier
import javax.inject.Inject

class ComposeNavigationConfigurator @Inject constructor(
private val navVerifiers: Set<@JvmSuppressWildcards NavActionVerifier>,
) {

fun configure() {
val logLevel = if (BuildConfig.DEBUG) {
Log.VERBOSE
} else {
Log.WARN
}
ComposeNavigation
.addNavActionVerifiers(navVerifiers)
.setLogLevel(logLevel)
}
}
21 changes: 10 additions & 11 deletions demo/src/main/java/com/adamkobus/android/vm/demo/nav/DemoGraph.kt
Original file line number Diff line number Diff line change
@@ -1,37 +1,36 @@
package com.adamkobus.android.vm.demo.nav

import androidx.compose.animation.ExperimentalAnimationApi
import androidx.navigation.NavBackStackEntry
import androidx.navigation.NavGraphBuilder
import com.adamkobus.android.vm.demo.ui.dialog.DemoDialog
import com.adamkobus.android.vm.demo.ui.home.HomeScreen
import com.adamkobus.android.vm.demo.ui.logs.LogsScreen
import com.adamkobus.compose.navigation.data.NavGraph
import com.adamkobus.compose.navigation.destination.NavGraph
import com.adamkobus.compose.navigation.destination.NavStackEntry
import com.adamkobus.compose.navigation.ext.composableDestination
import com.adamkobus.compose.navigation.ext.composableDialog
import com.adamkobus.compose.navigation.ext.composableNavigation
import com.adamkobus.compose.navigation.ext.getInt

object DemoGraph : NavGraph {
override val name: String = "demoGraph"
object DemoGraph : NavGraph("demoGraph") {

const val PARAM_LOG_ID = "logId"

val Home = navDestination("home")
val LogsList = navDestination("logs")
val Home = screenDestination("home")
val LogsList = screenDestination("logs")

val DemoDialog = navDestination("demoDialog") {
val DemoDialog = dialogDestination("demoDialog") {
param(PARAM_LOG_ID)
}

override fun startDestination() = Home
}

fun NavBackStackEntry.logId(): Int = getInt(DemoGraph.PARAM_LOG_ID)
fun NavStackEntry.logId(): Int = getInt(DemoGraph.PARAM_LOG_ID)

@OptIn(ExperimentalAnimationApi::class)
fun NavGraphBuilder.demoGraph() {
composableNavigation(
graph = DemoGraph,
startDestination = DemoGraph.Home
graph = DemoGraph
) {
composableDestination(DemoGraph.Home) {
HomeScreen()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
package com.adamkobus.android.vm.demo.nav

import com.adamkobus.compose.navigation.NavActionVerifier
import com.adamkobus.compose.navigation.data.INavDestination
import com.adamkobus.compose.navigation.data.NavAction
import com.adamkobus.compose.navigation.VerifyResult
import com.adamkobus.compose.navigation.action.NavAction
import com.adamkobus.compose.navigation.destination.GlobalGraph
import com.adamkobus.compose.navigation.destination.NavState
import javax.inject.Inject

class DemoNavActionVerifier @Inject constructor() : NavActionVerifier {

override fun isNavActionAllowed(currentDestination: INavDestination, action: NavAction): Boolean {
return action.fromDestination == currentDestination
override fun isNavActionAllowed(navState: NavState, action: NavAction): VerifyResult {
if (action.fromDestination.graph == GlobalGraph) return VerifyResult.Allow
return if (navState.isCurrent(action.fromDestination)) {
VerifyResult.Allow
} else {
VerifyResult.Discard
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.adamkobus.android.vm.demo.nav

import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.adamkobus.compose.navigation.ui.NavComposable
import com.google.accompanist.navigation.animation.AnimatedNavHost
import com.adamkobus.compose.navigation.ComposeNavHost
import com.adamkobus.compose.navigation.NavigationId
import com.google.accompanist.navigation.animation.rememberAnimatedNavController

@OptIn(ExperimentalAnimationApi::class)
Expand All @@ -13,11 +14,11 @@ fun DemoNavHost(
modifier: Modifier = Modifier
) {
val navHostController = rememberAnimatedNavController()
NavComposable(navController = navHostController)
AnimatedNavHost(
navController = navHostController,
startDestination = DemoGraph.name,
modifier = modifier
ComposeNavHost(
startGraph = DemoGraph,
controller = navHostController,
navigationId = NavigationId.DEFAULT,
modifier = Modifier.fillMaxSize()
) {
demoGraph()
}
Expand Down
Loading

0 comments on commit 32aa4b0

Please sign in to comment.