Skip to content

Commit

Permalink
Round of dependency updates (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
gchristov authored Mar 20, 2024
1 parent bf71390 commit c026e0a
Show file tree
Hide file tree
Showing 117 changed files with 981 additions and 802 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ master ]

env:
JAVA_VERSION: "11"
JAVA_VERSION: "17"
XCODE_VERSION: "13.3"
XCODE_CACHE: "CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++"
IOS_SIMULATOR: "platform=iOS Simulator,name=iPhone 11,OS=15.4"
Expand Down
9 changes: 6 additions & 3 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
plugins {
id("android-application-binary-plugin")
alias(libs.plugins.newsfeed.android.applicationBinary)
}

android {
defaultConfig {
namespace = "com.gchristov.newsfeed"
applicationId = "com.gchristov.newsfeed"
versionCode = 1
versionName = "1.0"
}
}

dependencies {
implementation(projects.multiplatform.common.di)
// Multiplatform leaf modules
implementation(projects.multiplatform.feed.feature)
implementation(projects.multiplatform.post.feature)
// Android leaf modules
implementation(projects.android.common.design)
// Feature modules
implementation(projects.android.feed.feature)
implementation(projects.android.post.feature)
}
3 changes: 1 addition & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gchristov.newsfeed">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:name=".android.app.NewsfeedApp"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.gchristov.newsfeed.android.app

import android.content.Context
import com.gchristov.newsfeed.android.common.navigation.NavigationModule
import com.gchristov.newsfeed.multiplatform.common.kotlin.AppContext
import com.gchristov.newsfeed.multiplatform.common.kotlin.MplCommonKotlinModule
import com.gchristov.newsfeed.multiplatform.common.kotlin.di.DependencyInjector
import com.gchristov.newsfeed.multiplatform.common.kotlin.di.DependencyModule
import com.gchristov.newsfeed.multiplatform.common.kotlin.di.register
import com.gchristov.newsfeed.multiplatform.common.network.MplCommonNetworkModule
import com.gchristov.newsfeed.multiplatform.common.persistence.MplCommonPersistenceModule
import com.gchristov.newsfeed.multiplatform.feed.data.MplFeedDataModule
import com.gchristov.newsfeed.multiplatform.feed.feature.MplFeedModule
import com.gchristov.newsfeed.multiplatform.post.data.MplPostDataModule
import com.gchristov.newsfeed.multiplatform.post.feature.MplPostModule

/**
* Initialises the dependency graph for Android.
*
* When making changes, consider also updating the multiplatform/umbrella module.
*/

internal fun DependencyInjector.initialise(context: Context) {
AppContext = context
val modules = mutableListOf<DependencyModule>().apply {
// Multiplatform modules
add(MplCommonKotlinModule)
add(MplCommonNetworkModule)
add(MplCommonPersistenceModule)
add(MplFeedModule)
add(MplFeedDataModule)
add(MplPostModule)
add(MplPostDataModule)
// Android modules
add(NavigationModule)
}
register(modules)
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.gchristov.newsfeed.android.app

import android.app.Application
import com.gchristov.newsfeed.multiplatform.common.di.AppContext
import com.gchristov.newsfeed.multiplatform.common.kotlin.di.DependencyInjector

class NewsfeedApp : Application() {
override fun onCreate() {
Expand All @@ -10,6 +10,6 @@ class NewsfeedApp : Application() {
}

private fun setupDependencyInjection() {
AppContext = this
DependencyInjector.initialise(this)
}
}
16 changes: 10 additions & 6 deletions android/common/compose-test/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import com.gchristov.newsfeed.gradleplugins.Deps

plugins {
id("android-module-plugin")
id("android-compose-plugin")
alias(libs.plugins.newsfeed.android.module)
alias(libs.plugins.newsfeed.android.compose)
}

android {
defaultConfig {
namespace = "com.gchristov.newsfeed.android.common.composetest"
}
}

/*
Expand All @@ -12,6 +16,6 @@ dependencies and code are local to the relevant module and cannot be accesses by
*/
dependencies {
implementation(projects.android.common.compose)
api(Deps.Android.Compose.uiTestJunit)
debugApi(Deps.Android.Compose.uiTestManifest)
api(libs.androidx.compose.ui.test.junit)
debugApi(libs.androidx.compose.ui.test.manifest)
}
3 changes: 1 addition & 2 deletions android/common/compose-test/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gchristov.newsfeed.android.common.composetest">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application>
<activity
Expand Down
33 changes: 18 additions & 15 deletions android/common/compose/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import com.gchristov.newsfeed.gradleplugins.Deps

plugins {
id("android-module-plugin")
id("android-compose-plugin")
alias(libs.plugins.newsfeed.android.module)
alias(libs.plugins.newsfeed.android.compose)
}

android {
defaultConfig {
namespace = "com.gchristov.newsfeed.android.common.compose"
}
}

dependencies {
api(Deps.Android.Compose.liveData)
api(Deps.Android.Compose.compiler)
api(Deps.Android.Compose.activity)
api(Deps.Android.Compose.uiTooling)
api(Deps.Android.Compose.foundation)
api(Deps.Android.Compose.foundationLayout)
api(Deps.Android.Compose.materialIcons)
implementation(Deps.Android.Compose.material)
implementation(Deps.Android.Compose.coil)
implementation(Deps.Android.Compose.html)
implementation(Deps.Android.Accompanist.swipeRefresh)
api(libs.androidx.compose.liveData)
api(libs.androidx.compose.compiler)
api(libs.androidx.activityCompose)
api(libs.androidx.compose.ui.tooling)
api(libs.androidx.compose.foundation)
api(libs.androidx.compose.foundation.layout)
api(libs.androidx.compose.material.icons)
implementation(libs.androidx.compose.material)
implementation(libs.coil)
implementation(libs.composeHtml)
implementation(projects.android.common.design)
}
2 changes: 0 additions & 2 deletions android/common/compose/src/main/AndroidManifest.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.app.Activity
import androidx.compose.foundation.layout.RowScope
import androidx.compose.material.TopAppBar
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
Expand Down Expand Up @@ -33,7 +33,7 @@ fun AppBar(
navigationIcon = if (showBack) {
@Composable {
AppIconButton(
icon = Icons.Filled.ArrowBack,
icon = Icons.AutoMirrored.Filled.ArrowBack,
tint = contentColor,
onClick = { activity?.finish() }
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import androidx.compose.foundation.Image
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.ContentScale
import coil.compose.rememberImagePainter
import coil.compose.rememberAsyncImagePainter

@Composable
fun AppImage(
Expand All @@ -15,7 +15,7 @@ fun AppImage(
) {
Image(
modifier = modifier,
painter = rememberImagePainter(imageUrl),
painter = rememberAsyncImagePainter(imageUrl),
contentDescription = contentDescription,
contentScale = contentScale,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
package com.gchristov.newsfeed.android.common.compose.elements

import androidx.compose.foundation.layout.Box
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.pullrefresh.PullRefreshIndicator
import androidx.compose.material.pullrefresh.pullRefresh
import androidx.compose.material.pullrefresh.rememberPullRefreshState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import com.google.accompanist.swiperefresh.SwipeRefresh
import com.google.accompanist.swiperefresh.rememberSwipeRefreshState

@OptIn(ExperimentalMaterialApi::class)
@Composable
fun AppPullRefresh(
modifier: Modifier = Modifier,
loading: Boolean,
onRefresh: () -> Unit,
content: @Composable () -> Unit,
) {
SwipeRefresh(
modifier = modifier,
state = rememberSwipeRefreshState(loading),
val pullRefreshState = rememberPullRefreshState(
refreshing = loading,
onRefresh = onRefresh,
content = content
)

Box(
modifier = modifier.pullRefresh(pullRefreshState),
contentAlignment = Alignment.TopCenter,
) {
content()

PullRefreshIndicator(
refreshing = loading,
state = pullRefreshState,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package com.gchristov.newsfeed.android.common.compose.elements.avatar
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.colorResource
import com.gchristov.newsfeed.android.common.compose.R
import java.util.*
import java.util.Collections
import java.util.Stack
import com.gchristov.newsfeed.android.common.design.R as DesignR

internal class ColorGenerator {
private val recycle = Stack<Color>()
Expand All @@ -26,27 +27,27 @@ internal class ColorGenerator {

@Composable
private fun palette() = listOf(
colorResource(R.color.red),
colorResource(R.color.red_2),
colorResource(R.color.red_3),
colorResource(R.color.blue),
colorResource(R.color.blue_2),
colorResource(R.color.blue_3),
colorResource(R.color.blue_4),
colorResource(R.color.blue_5),
colorResource(R.color.blue_6),
colorResource(R.color.green),
colorResource(R.color.green_2),
colorResource(R.color.green_3),
colorResource(R.color.green_4),
colorResource(R.color.yellow),
colorResource(R.color.yellow_2),
colorResource(R.color.yellow_3),
colorResource(R.color.yellow_4),
colorResource(R.color.yellow_5),
colorResource(R.color.brown),
colorResource(R.color.gray),
colorResource(R.color.gray_2),
colorResource(R.color.gray_3),
colorResource(DesignR.color.red),
colorResource(DesignR.color.red_2),
colorResource(DesignR.color.red_3),
colorResource(DesignR.color.blue),
colorResource(DesignR.color.blue_2),
colorResource(DesignR.color.blue_3),
colorResource(DesignR.color.blue_4),
colorResource(DesignR.color.blue_5),
colorResource(DesignR.color.blue_6),
colorResource(DesignR.color.green),
colorResource(DesignR.color.green_2),
colorResource(DesignR.color.green_3),
colorResource(DesignR.color.green_4),
colorResource(DesignR.color.yellow),
colorResource(DesignR.color.yellow_2),
colorResource(DesignR.color.yellow_3),
colorResource(DesignR.color.yellow_4),
colorResource(DesignR.color.yellow_5),
colorResource(DesignR.color.brown),
colorResource(DesignR.color.gray),
colorResource(DesignR.color.gray_2),
colorResource(DesignR.color.gray_3),
)
}
8 changes: 7 additions & 1 deletion android/common/design/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
plugins {
id("android-module-plugin")
alias(libs.plugins.newsfeed.android.module)
}

android {
defaultConfig {
namespace = "com.gchristov.newsfeed.android.common.design"
}
}
2 changes: 0 additions & 2 deletions android/common/design/src/main/AndroidManifest.xml

This file was deleted.

10 changes: 8 additions & 2 deletions android/common/navigation/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
plugins {
id("android-module-plugin")
alias(libs.plugins.newsfeed.android.module)
}

android {
defaultConfig {
namespace = "com.gchristov.newsfeed.android.common.navigation"
}
}

dependencies {
implementation(projects.multiplatform.common.di)
implementation(projects.multiplatform.common.kotlin)
}
2 changes: 0 additions & 2 deletions android/common/navigation/src/main/AndroidManifest.xml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
package com.gchristov.newsfeed.android.common.navigation

import android.content.Context
import com.gchristov.newsfeed.multiplatform.common.di.DiModule
import com.gchristov.newsfeed.multiplatform.common.di.inject
import com.gchristov.newsfeed.multiplatform.common.kotlin.di.DependencyModule
import org.kodein.di.DI
import org.kodein.di.bindFactory

object NavigationModule : DiModule() {
object NavigationModule : DependencyModule() {
override fun name() = "common-navigation"

override fun bindLocalDependencies(builder: DI.Builder) {
override fun bindDependencies(builder: DI.Builder) {
builder.apply {
bindFactory<Context, Navigator> { context: Context ->
RealNavigator(context = context)
}
}
}

fun injectNavigator(context: Context): Navigator = inject(arg = context)
}
Loading

0 comments on commit c026e0a

Please sign in to comment.