Skip to content

Commit

Permalink
refactor: switch to version catalogs (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
X1nto authored Apr 11, 2023
1 parent c89ec24 commit bf28b00
Show file tree
Hide file tree
Showing 16 changed files with 134 additions and 374 deletions.
51 changes: 25 additions & 26 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@file:Suppress("UnstableApiUsage")

plugins {
id("com.android.application")
id("com.google.devtools.ksp")
kotlin("android")
kotlin("plugin.parcelize")
kotlin("plugin.serialization")
alias(libs.plugins.android.application)
alias(libs.plugins.ksp)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.kotlin.parcelize)
}

android {
Expand Down Expand Up @@ -77,7 +77,7 @@ android {
}

composeOptions {
kotlinCompilerExtensionVersion = Dependencies.Compose.compilerVersion
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
}

androidComponents {
Expand Down Expand Up @@ -136,24 +136,23 @@ dependencies {

// Use java.time.* on Android <= 8
// https://developer.android.com/studio/write/java8-support#library-desugaring-versions
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.2")

Dependencies.Koin(this)
Dependencies.Ktor(this)
Dependencies.KotlinX(this)
Dependencies.HCaptcha(this)
Dependencies.AndroidxCore(this)
Dependencies.AndroidxPreferences(this)
Dependencies.AndroidxMedia3(this)
Dependencies.AndroidxRoom(this)
Dependencies.Material(this)
Dependencies.Compose(this)
Dependencies.Paging(this)
Dependencies.Accompanist(this)
Dependencies.Shimmer(this)
Dependencies.Coil(this)
Dependencies.Partials(this)
Dependencies.EnumUtil(this)
Dependencies.ReimaginedNav(this)
Dependencies.Panels(this)
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.3")

implementation(libs.bundles.androidx.core)
implementation(libs.bundles.androidx.compose)
implementation(libs.bundles.androidx.room)
implementation(libs.bundles.androidx.paging)
implementation(libs.bundles.androidx.media3)
implementation(libs.bundles.accompanist)
implementation(libs.bundles.coil)
implementation(libs.bundles.materii)
implementation(libs.bundles.kotlinx)
implementation(libs.bundles.ktor)
implementation(libs.koin.compose)
implementation(libs.navreimagined)
implementation(libs.hcaptcha)
implementation(libs.shimmer)

ksp(libs.materii.partial.ksp)
ksp(libs.materii.enumutil.ksp)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import androidx.compose.runtime.DisposableEffect
import androidx.compose.ui.platform.LocalContext
import com.hcaptcha.sdk.HCaptcha
import com.hcaptcha.sdk.HCaptchaError
import org.koin.androidx.compose.get
import org.koin.compose.koinInject
import org.koin.core.parameter.parametersOf

@Composable
Expand All @@ -14,7 +14,7 @@ fun HCaptcha(
onFailure: (HCaptchaError, code: Int) -> Unit,
) {
val context = LocalContext.current
val captcha: HCaptcha = get { parametersOf(context) }
val captcha: HCaptcha = koinInject { parametersOf(context) }
DisposableEffect(captcha) {
captcha.verifyWithHCaptcha()
.addOnSuccessListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import androidx.compose.animation.slideOutHorizontally
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.LocalContentColor
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.xinto.opencord.ui.components.guild.list
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material.LocalContentColor
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.slideInHorizontally
import androidx.compose.animation.slideOutHorizontally
import androidx.compose.foundation.layout.*
import androidx.compose.material.ContentAlpha
import androidx.compose.material.LocalContentAlpha
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Send
import androidx.compose.material3.*
Expand Down Expand Up @@ -71,7 +69,7 @@ private fun InputInnerTextField(
) {
innerTextField()
CompositionLocalProvider(
LocalContentAlpha provides ContentAlpha.medium,
LocalContentColor provides LocalContentColor.current.copy(alpha = 0.7f),
LocalTextStyle provides MaterialTheme.typography.bodyMedium,
) {
if (isEmpty) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.xinto.opencord.ui.screens.login

import androidx.compose.foundation.layout.*
import androidx.compose.material.ContentAlpha
import androidx.compose.material.LocalContentAlpha
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
Expand Down Expand Up @@ -38,7 +36,7 @@ fun LoginLandingScreen(
style = MaterialTheme.typography.displaySmall,
textAlign = TextAlign.Center,
)
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
CompositionLocalProvider(LocalContentColor provides LocalContentColor.current.copy(alpha = 0.7f)) {
Text(
text = stringResource(R.string.login_landing_subtitle),
style = MaterialTheme.typography.bodyMedium,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package com.xinto.opencord.ui.screens.login
import android.widget.Toast
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.ContentAlpha
import androidx.compose.material.LocalContentAlpha
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.ArrowBack
import androidx.compose.material3.*
Expand Down Expand Up @@ -71,7 +69,7 @@ fun LoginScreen(
text = stringResource(R.string.login_login_title),
style = MaterialTheme.typography.displaySmall,
)
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
CompositionLocalProvider(LocalContentColor provides LocalContentColor.current.copy(alpha = 0.7f)) {
Text(
text = stringResource(R.string.login_login_subtitle),
style = MaterialTheme.typography.bodyMedium,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ inline fun <reified T : ViewModel> getLocalViewModel(

return getViewModel(
qualifier = qualifier,
owner = owner,
viewModelStoreOwner = owner,
scope = scope,
parameters = parameters,
)
Expand Down
9 changes: 9 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.serialization) apply false
alias(libs.plugins.kotlin.parcelize) apply false
alias(libs.plugins.ksp) apply false
}

allprojects {
repositories {
google()
Expand Down
2 changes: 0 additions & 2 deletions buildSrc/.gitignore

This file was deleted.

16 changes: 0 additions & 16 deletions buildSrc/build.gradle.kts

This file was deleted.

Loading

0 comments on commit bf28b00

Please sign in to comment.