Skip to content
This repository has been archived by the owner on Jul 7, 2024. It is now read-only.

Commit

Permalink
(chore) Move dependencies to version catalog (#70)
Browse files Browse the repository at this point in the history
* Move libs to version catalog

* Add plugins to version catalog

* Bump dependencies
  • Loading branch information
wingio authored Jan 23, 2024
1 parent d9c717e commit 4d815df
Show file tree
Hide file tree
Showing 21 changed files with 202 additions and 239 deletions.
82 changes: 19 additions & 63 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import java.io.ByteArrayOutputStream

plugins {
id("com.android.application")
kotlin("android")
kotlin("plugin.serialization") version "1.7.20"
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.serialization)
}

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

composeOptions {
kotlinCompilerExtensionVersion = "1.3.2"
kotlinCompilerExtensionVersion = "1.5.6"
}

androidComponents {
Expand Down Expand Up @@ -90,68 +90,24 @@ android {
}

dependencies {
implementation("androidx.core:core-ktx:1.9.0")
implementation("androidx.core:core-splashscreen:1.0.1")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.0")
implementation("androidx.paging:paging-compose:1.0.0-alpha18")
implementation("androidx.work:work-runtime-ktx:2.8.1")
implementation(platform(libs.compose.bom))

implementation(platform("androidx.compose:compose-bom:2022.10.00"))
implementation("androidx.activity:activity-compose:1.7.1")
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-graphics")
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.compose.material3:material3")
implementation("androidx.compose.material:material-icons-extended")
implementation(libs.bundles.accompanist)
implementation(libs.bundles.androidx)
implementation(libs.bundles.coil)
implementation(libs.bundles.compose)
implementation(libs.bundles.koin)
implementation(libs.bundles.ktor)
implementation(libs.bundles.shizuku)
implementation(libs.bundles.voyager)

val koinVersion = "3.2.0"

implementation("io.insert-koin:koin-core:$koinVersion")
implementation("io.insert-koin:koin-android:$koinVersion")
implementation("io.insert-koin:koin-androidx-compose:$koinVersion")

val accompanistVersion = "0.29.1-alpha"

implementation("com.google.accompanist:accompanist-systemuicontroller:$accompanistVersion")
implementation("com.google.accompanist:accompanist-pager:$accompanistVersion")
implementation("com.google.accompanist:accompanist-permissions:$accompanistVersion")

val voyagerVersion = "1.0.0-rc03"

implementation("cafe.adriel.voyager:voyager-navigator:$voyagerVersion")
implementation("cafe.adriel.voyager:voyager-tab-navigator:$voyagerVersion")
implementation("cafe.adriel.voyager:voyager-transitions:$voyagerVersion")
implementation("cafe.adriel.voyager:voyager-koin:$voyagerVersion")

val coilVersion = "2.2.2"

implementation("io.coil-kt:coil:$coilVersion")
implementation("io.coil-kt:coil-compose:$coilVersion")

val ktorVersion = "2.1.1"

implementation("io.ktor:ktor-client-core:$ktorVersion")
implementation("io.ktor:ktor-client-cio:$ktorVersion")
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
implementation("io.ktor:ktor-client-logging:$ktorVersion")

val shizukuVersion = "13.1.0"

implementation("dev.rikka.shizuku:api:$shizukuVersion")
implementation("dev.rikka.shizuku:provider:$shizukuVersion")

implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.1")
implementation("io.github.diamondminer88:zip-android:2.1.1@aar")
implementation(files("libs/lspatch.aar"))

testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
androidTestImplementation(platform("androidx.compose:compose-bom:2022.10.00"))
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
debugImplementation("androidx.compose.ui:ui-tooling")
debugImplementation("androidx.compose.ui:ui-test-manifest")
implementation(libs.kotlinx.datetime)
implementation(libs.zip.android) {
artifact {
type = "aar"
}
}
}

fun getCurrentBranch(): String? =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ package dev.beefers.vendetta.manager.di

import dev.beefers.vendetta.manager.ui.viewmodel.home.HomeViewModel
import dev.beefers.vendetta.manager.ui.viewmodel.installer.InstallerViewModel
import dev.beefers.vendetta.manager.ui.viewmodel.main.MainViewModel
import dev.beefers.vendetta.manager.ui.viewmodel.settings.AdvancedSettingsViewModel
import org.koin.core.module.dsl.factoryOf
import org.koin.dsl.module

val viewModelModule = module {
factoryOf(::InstallerViewModel)
factoryOf(::AdvancedSettingsViewModel)
factoryOf(::MainViewModel)
factoryOf(::HomeViewModel)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import io.ktor.client.request.HttpRequestBuilder
import io.ktor.client.request.request
import io.ktor.client.statement.bodyAsText
import io.ktor.http.isSuccess
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json

class HttpService(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.content.pm.PackageManager
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.core.app.ActivityCompat
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
Expand All @@ -26,9 +27,9 @@ class MainActivity : ComponentActivity() {

private val preferences: PreferenceManager by inject()

@OptIn(ExperimentalAnimationApi::class)
override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()
enableEdgeToEdge()
super.onCreate(savedInstanceState)
val version = intent.getStringExtra(Intents.Extras.VERSION)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun SettingsTextField(
label: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@ package dev.beefers.vendetta.manager.ui.screen.home

import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.basicMarquee
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.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Delete
Expand All @@ -23,8 +18,6 @@ import androidx.compose.material.icons.filled.OpenInNew
import androidx.compose.material.icons.filled.Refresh
import androidx.compose.material.icons.outlined.Settings
import androidx.compose.material3.Button
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Divider
import androidx.compose.material3.ElevatedCard
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
Expand All @@ -39,14 +32,10 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.paging.LoadState
import androidx.paging.compose.collectAsLazyPagingItems
import androidx.paging.compose.itemsIndexed
import cafe.adriel.voyager.core.screen.Screen
import cafe.adriel.voyager.koin.getScreenModel
import cafe.adriel.voyager.navigator.LocalNavigator
Expand All @@ -60,7 +49,6 @@ import dev.beefers.vendetta.manager.ui.screen.settings.SettingsScreen
import dev.beefers.vendetta.manager.ui.viewmodel.home.HomeViewModel
import dev.beefers.vendetta.manager.ui.widgets.AppIcon
import dev.beefers.vendetta.manager.ui.widgets.dialog.StoragePermissionsDialog
import dev.beefers.vendetta.manager.ui.widgets.home.Commit
import dev.beefers.vendetta.manager.ui.widgets.home.CommitList
import dev.beefers.vendetta.manager.ui.widgets.updater.UpdateDialog
import dev.beefers.vendetta.manager.utils.Constants
Expand All @@ -70,7 +58,7 @@ import org.koin.androidx.compose.get

class HomeScreen : Screen {

@OptIn(ExperimentalFoundationApi::class, ExperimentalMaterial3Api::class)
@OptIn(ExperimentalFoundationApi::class)
@Composable
override fun Content() {
val navigator = LocalNavigator.currentOrThrow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.core.util.Consumer
import cafe.adriel.voyager.core.screen.Screen
import cafe.adriel.voyager.core.screen.ScreenKey
import cafe.adriel.voyager.koin.getScreenModel
Expand All @@ -45,7 +44,6 @@ import dev.beefers.vendetta.manager.ui.widgets.dialog.BackWarningDialog
import dev.beefers.vendetta.manager.ui.widgets.dialog.DownloadFailedDialog
import dev.beefers.vendetta.manager.ui.widgets.installer.StepGroupCard
import dev.beefers.vendetta.manager.utils.DiscordVersion
import kotlinx.coroutines.delay
import org.koin.core.parameter.parametersOf
import java.util.UUID

Expand All @@ -56,7 +54,6 @@ class InstallerScreen(
override val key: ScreenKey = "Installer-${UUID.randomUUID()}"

@Composable
@OptIn(ExperimentalMaterial3Api::class)
override fun Content() {
val nav = LocalNavigator.currentOrThrow
val activity = LocalContext.current as? ComponentActivity
Expand Down Expand Up @@ -135,7 +132,7 @@ class InstallerScreen(
.padding(16.dp)
.verticalScroll(rememberScrollState())
) {
for (group in InstallerViewModel.InstallStepGroup.values()) {
for (group in InstallerViewModel.InstallStepGroup.entries) {
StepGroupCard(
name = stringResource(group.nameRes),
isCurrent = expandedGroup == group,
Expand Down
16 changes: 1 addition & 15 deletions app/src/main/java/dev/beefers/vendetta/manager/ui/theme/Theme.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package dev.beefers.vendetta.manager.ui.theme

import android.app.Activity
import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
Expand All @@ -9,12 +8,7 @@ import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalView
import androidx.core.view.WindowCompat
import com.google.accompanist.systemuicontroller.rememberSystemUiController
import dev.beefers.vendetta.manager.domain.manager.PreferenceManager
import dev.beefers.vendetta.manager.domain.manager.Theme
import org.koin.androidx.compose.get
Expand All @@ -30,7 +24,7 @@ fun VendettaManagerTheme(
Theme.DARK -> true
Theme.LIGHT -> false
}
val systemUiController = rememberSystemUiController()

val colorScheme = when {
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
val context = LocalContext.current
Expand All @@ -40,14 +34,6 @@ fun VendettaManagerTheme(
darkTheme -> darkColorScheme()
else -> lightColorScheme()
}
val view = LocalView.current
if (!view.isInEditMode) {
SideEffect {
val window = (view.context as Activity).window
WindowCompat.setDecorFitsSystemWindows(window, false)
systemUiController.setSystemBarsColor(Color.Transparent, darkIcons = !darkTheme)
}
}

MaterialTheme(
colorScheme = colorScheme,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import androidx.paging.Pager
import androidx.paging.PagingConfig
import androidx.paging.cachedIn
import cafe.adriel.voyager.core.model.ScreenModel
import cafe.adriel.voyager.core.model.coroutineScope
import cafe.adriel.voyager.core.model.screenModelScope
import dev.beefers.vendetta.manager.BuildConfig
import dev.beefers.vendetta.manager.domain.manager.DownloadManager
import dev.beefers.vendetta.manager.domain.manager.InstallManager
Expand Down Expand Up @@ -52,15 +52,15 @@ class HomeViewModel(

var showUpdateDialog by mutableStateOf(false)
var isUpdating by mutableStateOf(false)
val commits = Pager(PagingConfig(pageSize = 30)) { CommitsPagingSource(repo) }.flow.cachedIn(coroutineScope)
val commits = Pager(PagingConfig(pageSize = 30)) { CommitsPagingSource(repo) }.flow.cachedIn(screenModelScope)

init {
getDiscordVersions()
checkForUpdate()
}

fun getDiscordVersions() {
coroutineScope.launch {
screenModelScope.launch {
discordVersions = repo.getLatestDiscordVersions().dataOrNull
if (prefs.autoClearCache) autoClearCache()
}
Expand Down Expand Up @@ -106,7 +106,7 @@ class HomeViewModel(
}

private fun checkForUpdate() {
coroutineScope.launch {
screenModelScope.launch {
release = repo.getLatestRelease("VendettaManager").dataOrNull
release?.let {
showUpdateDialog = it.tagName.toInt() > BuildConfig.VERSION_CODE
Expand All @@ -122,7 +122,7 @@ class HomeViewModel(
}

fun downloadAndInstallUpdate() {
coroutineScope.launch {
screenModelScope.launch {
val update = File(cacheDir, "update.apk")
if (update.exists()) update.delete()
isUpdating = true
Expand Down
Loading

0 comments on commit 4d815df

Please sign in to comment.