Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update libs #83

Merged
merged 5 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/android_deploy_beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ jobs:
- name: Update Version
run: bash ./.github/scripts/update_versions.sh

- uses: ruby/setup-ruby@v1.152.0
- uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7.0'
ruby-version: '3.3'

- name: Cache Ruby - Bundler
uses: actions/cache@v2
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/android_deploy_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
- name: Update Version
run: bash ./.github/scripts/update_versions.sh

- uses: ruby/setup-ruby@v1.152.0
- uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7.0'
ruby-version: '3.3'

- name: Cache Ruby - Bundler
uses: actions/cache@v2
Expand Down Expand Up @@ -94,4 +94,4 @@ jobs:
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PUSH_TOKEN }}
branch: ${{ github.ref }}
branch: ${{ github.ref }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.iml
.gradle
.idea
.kotlin
/local.properties
.DS_Store
/build
Expand Down
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
alias(libs.plugins.convention.application)
alias(libs.plugins.convention.application.compose)
alias(libs.plugins.composeCompiler)
}

dependencies {
Expand Down
10 changes: 6 additions & 4 deletions app/src/main/java/st/slex/csplashscreen/ui/InitialApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,27 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.Stable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.navigation.NavHostController
import com.google.accompanist.systemuicontroller.rememberSystemUiController
import st.slex.csplashscreen.core.navigation.AppDestination
import st.slex.csplashscreen.core.navigation.navigator.NavigationTarget
import st.slex.csplashscreen.ui.components.NavHostControllerHolder
import st.slex.csplashscreen.ui.components.NavigationHost
import st.slex.csplashscreen.ui.components.bottom_appbar.BottomAppBarResource
import st.slex.csplashscreen.ui.components.bottom_appbar.MainBottomAppBar

@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter")
@Composable
@Stable
fun InitialApp(
navController: NavHostController,
navControllerHolder: NavHostControllerHolder,
onBottomAppBarClick: (NavigationTarget.Screen) -> Unit,
modifier: Modifier = Modifier,
) {
Expand All @@ -42,7 +44,7 @@ fun InitialApp(
mutableStateOf<AppDestination?>(AppDestination.HOME)
}

navController.addOnDestinationChangedListener { _, destination, _ ->
navControllerHolder.navController.addOnDestinationChangedListener { _, destination, _ ->
currentDestination = AppDestination.findByRoute(destination.route)
}

Expand Down Expand Up @@ -76,7 +78,7 @@ fun InitialApp(
modifier = Modifier
.background(MaterialTheme.colorScheme.background)
.systemBarsPadding(),
navController = navController,
holder = navControllerHolder,
)
},
)
Expand Down
14 changes: 8 additions & 6 deletions app/src/main/java/st/slex/csplashscreen/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Stable
import androidx.compose.runtime.remember
import androidx.core.view.WindowCompat
import androidx.navigation.NavHostController
import androidx.navigation.compose.rememberNavController
import org.koin.androidx.compose.getKoin
import org.koin.androidx.compose.koinViewModel
import st.slex.csplashscreen.core.navigation.di.moduleCoreNavigation
import st.slex.csplashscreen.core.ui.theme.AppTheme
import st.slex.csplashscreen.ui.components.NavHostControllerHolder

class MainActivity : ComponentActivity() {

Expand All @@ -21,15 +22,15 @@ class MainActivity : ComponentActivity() {
WindowCompat.setDecorFitsSystemWindows(window, false)
setContent {
AppTheme {
val navHostController = rememberNavController()
SetupComposeDependencies(navHostController)
val navHostControllerHolder = NavHostControllerHolder(rememberNavController())
SetupComposeDependencies(navHostControllerHolder)

val viewModel = koinViewModel<InitialAppViewModel>()
InitialApp(
/*TODO AFTER reconfiguration controller in VM don't change it State,
so it need to have latest instance.
Need Research to find more efficient way */
navController = navHostController,
navControllerHolder = navHostControllerHolder,
onBottomAppBarClick = remember {
{ viewModel.navigate(it) }
}
Expand All @@ -39,12 +40,13 @@ class MainActivity : ComponentActivity() {
}

@Composable
@Stable
private fun SetupComposeDependencies(
navController: NavHostController
holder: NavHostControllerHolder
) {
getKoin().loadModules(
listOf(
moduleCoreNavigation(navController),
moduleCoreNavigation(holder.navController),
)
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package st.slex.csplashscreen.ui.components

import androidx.compose.runtime.Composable
import androidx.compose.runtime.Stable
import androidx.compose.ui.Modifier
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
Expand All @@ -12,14 +13,18 @@ import st.slex.csplashscreen.feature.home.navigation.homeGraph
import st.slex.csplashscreen.feature.search.navigation.searchPhotosGraph
import st.slex.csplashscreen.feature.user.navigation.userGraph

@Stable
class NavHostControllerHolder(val navController: NavHostController)

@Composable
@Stable
fun NavigationHost(
navController: NavHostController,
holder: NavHostControllerHolder,
modifier: Modifier = Modifier,
startDestination: AppDestination = AppDestination.HOME
) {
NavHost(
navController = navController,
navController = holder.navController,
startDestination = startDestination.navigationRoute
) {
homeGraph(modifier)
Expand Down
4 changes: 3 additions & 1 deletion build-logic/dependencies/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ dependencies {
compileOnly(libs.ksp.gradlePlugin)
compileOnly(libs.room.gradlePlugin)
compileOnly(libs.android.tools.common)
compileOnly(libs.vkompose.gradlePlugin)
compileOnly(libs.composeCompiler.gradlePlugin)
}

tasks {
Expand Down Expand Up @@ -38,7 +40,7 @@ gradlePlugin {
id = "csplashscreen.android.library"
implementationClass = "AndroidLibraryConventionPlugin"
}
register("roomLibrary"){
register("roomLibrary") {
id = "csplashscreen.room.library"
implementationClass = "RoomLibraryConventionPlugin"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import AppExt.findPluginId
import AppExt.libs
import com.android.build.api.dsl.ApplicationExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
Expand All @@ -7,11 +9,15 @@ import st.slex.csplashscreen.configureAndroidCompose
class AndroidApplicationComposeConventionPlugin : Plugin<Project> {

override fun apply(target: Project) {

with(target) {
pluginManager.apply("com.android.application")
val extension = extensions.getByType<ApplicationExtension>()
configureAndroidCompose(extension)
pluginManager.apply(libs.findPluginId("kotlin"))
pluginManager.apply(libs.findPluginId("composeCompiler"))
pluginManager.apply(libs.findPluginId("vkompose"))

configureAndroidCompose(
commonExtension = extensions.getByType<ApplicationExtension>()
)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import AppExt.currentLibs
import AppExt.findVersionInt
import AppExt.findVersionString
import AppExt.libs
import com.android.build.api.dsl.ApplicationExtension
import com.google.devtools.ksp.gradle.KspExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
Expand All @@ -16,7 +15,6 @@ class AndroidApplicationConventionPlugin : Plugin<Project> {

override fun apply(target: Project) {
with(target) {
val libs = currentLibs
with(pluginManager) {
apply("com.android.application")
apply("org.jetbrains.kotlin.android")
Expand All @@ -36,10 +34,6 @@ class AndroidApplicationConventionPlugin : Plugin<Project> {
configureSigning(target)
}
}

extensions.configure<KspExtension> {
arg("KOIN_CONFIG_CHECK", "true")
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import AppExt.findPluginId
import AppExt.libs
import com.android.build.gradle.LibraryExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
Expand All @@ -9,8 +11,13 @@ class AndroidLibraryComposeConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
pluginManager.apply("com.android.library")
val extension = extensions.getByType<LibraryExtension>()
configureAndroidCompose(extension)
pluginManager.apply(libs.findPluginId("kotlin"))
pluginManager.apply(libs.findPluginId("composeCompiler"))
pluginManager.apply(libs.findPluginId("vkompose"))

configureAndroidCompose(
commonExtension = extensions.getByType<LibraryExtension>()
)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import AppExt.findPluginId
import AppExt.libs
import com.android.build.gradle.LibraryExtension
import com.google.devtools.ksp.gradle.KspExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.artifacts.VersionCatalogsExtension
Expand Down Expand Up @@ -37,10 +38,6 @@ class AndroidLibraryConventionPlugin : Plugin<Project> {
}
}

extensions.configure<KspExtension> {
arg("KOIN_CONFIG_CHECK", "true")
}

val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")
configurations.configureEach {
resolutionStrategy {
Expand Down
Loading