fix: optimizations (#341); closes #340

* fix: drawer sorting

* chore: remove fonts

* chore: optimize dependencies

* refactor: limit coil image cache size

* chore: add proguard rules
This commit is contained in:
Diego Beraldin 2023-12-22 11:39:20 +01:00 committed by GitHub
parent d72f075efa
commit 4eb2c59117
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
63 changed files with 134 additions and 106 deletions

View File

@ -33,7 +33,13 @@ android {
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
isMinifyEnabled = true
setProguardFiles(
listOf(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
)
}
}
compileOptions {
@ -49,6 +55,7 @@ dependencies {
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material3)
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.splashscreen)
implementation(libs.koin.core)

21
androidApp/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /home/wojta/adt-bundle/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
-dontwarn org.slf4j.impl.StaticLoggerBinder
-keep class net.database.sqlcipher.* { *; }
-keep class net.sqlcipher.** { *; }

View File

@ -1,14 +1,12 @@
package com.github.diegoberaldin.raccoonforlemmy.android
import android.app.Application
import android.os.Build
import coil.ImageLoader
import coil.ImageLoaderFactory
import coil.decode.GifDecoder
import coil.decode.ImageDecoderDecoder
import com.github.diegoberaldin.raccoonforlemmy.core.utils.debug.AppInfo
import com.github.diegoberaldin.raccoonforlemmy.core.utils.debug.CrashReportConfiguration
import com.github.diegoberaldin.raccoonforlemmy.core.utils.debug.CrashReportWriter
import com.github.diegoberaldin.raccoonforlemmy.core.utils.imagepreload.getCoilImageLoader
import com.github.diegoberaldin.raccoonforlemmy.di.sharedHelperModule
import org.koin.android.ext.android.inject
import org.koin.android.ext.koin.androidContext
@ -49,14 +47,5 @@ class MainApplication : Application(), ImageLoaderFactory {
}
}
override fun newImageLoader(): ImageLoader {
return ImageLoader.Builder(this)
.components {
if (Build.VERSION.SDK_INT >= 28) {
add(ImageDecoderDecoder.Factory())
} else {
add(GifDecoder.Factory())
}
}.build()
}
override fun newImageLoader(): ImageLoader = getCoilImageLoader(this)
}

View File

@ -33,8 +33,6 @@ kotlin {
}
val commonMain by getting {
dependencies {
implementation(libs.koin.core)
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material3)
@ -42,6 +40,7 @@ kotlin {
implementation(compose.components.resources)
implementation(compose.materialIconsExtended)
implementation(libs.koin.core)
implementation(libs.materialKolor)
implementation(projects.resources)

View File

@ -6,8 +6,6 @@ import dev.icerock.moko.resources.compose.stringResource
enum class UiFontFamily {
TitilliumWeb,
Dosis,
EBGaramond,
NotoSans,
CharisSIL,
Comfortaa,
@ -21,8 +19,6 @@ fun Int.toUiFontFamily() = when (this) {
5 -> UiFontFamily.Comfortaa
4 -> UiFontFamily.CharisSIL
3 -> UiFontFamily.NotoSans
2 -> UiFontFamily.EBGaramond
1 -> UiFontFamily.Dosis
else -> UiFontFamily.Poppins
}
@ -31,8 +27,6 @@ fun UiFontFamily.toInt() = when (this) {
UiFontFamily.Comfortaa -> 5
UiFontFamily.CharisSIL -> 4
UiFontFamily.NotoSans -> 3
UiFontFamily.EBGaramond -> 2
UiFontFamily.Dosis -> 1
UiFontFamily.TitilliumWeb -> 6
UiFontFamily.Default -> 7
}
@ -44,7 +38,5 @@ fun UiFontFamily.toReadableName() = when (this) {
UiFontFamily.Comfortaa -> "Comfortaa"
UiFontFamily.CharisSIL -> "Charis SIL"
UiFontFamily.NotoSans -> "Noto Sans"
UiFontFamily.EBGaramond -> "EB Garamond"
UiFontFamily.Dosis -> "Dosis"
else -> "Titillium Web"
}

View File

@ -15,8 +15,6 @@ fun UiFontFamily.toTypography(): Typography {
val fontFamily = when (this) {
UiFontFamily.CharisSIL -> fontFamilyResource(MR.fonts.CharisSIL.regular)
UiFontFamily.NotoSans -> fontFamilyResource(MR.fonts.NotoSans.regular)
UiFontFamily.EBGaramond -> fontFamilyResource(MR.fonts.EBGaramond.regular)
UiFontFamily.Dosis -> fontFamilyResource(MR.fonts.Dosis.regular)
UiFontFamily.Comfortaa -> fontFamilyResource(MR.fonts.Comfortaa.regular)
UiFontFamily.Poppins -> fontFamilyResource(MR.fonts.Poppins.regular)
UiFontFamily.TitilliumWeb -> fontFamilyResource(MR.fonts.TitilliumWeb.regular)

View File

@ -41,8 +41,6 @@ kotlin {
implementation(compose.components.resources)
implementation(compose.materialIconsExtended)
implementation(libs.kamel)
implementation(projects.core.utils)
implementation(projects.core.appearance)
implementation(projects.resources)
@ -53,6 +51,11 @@ kotlin {
implementation(kotlin("test"))
}
}
val iosMain by getting {
dependencies {
implementation(libs.kamel)
}
}
}
}

View File

@ -41,7 +41,6 @@ kotlin {
implementation(compose.components.resources)
implementation(compose.materialIconsExtended)
implementation(libs.kamel)
implementation(libs.koin.core)
implementation(projects.core.utils)

View File

@ -9,7 +9,7 @@ import androidx.compose.ui.platform.LocalUriHandler
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.di.getThemeRepository
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.toTypography
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.CustomMarkdown
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.model.markdownTypography
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model.markdownTypography
import com.github.diegoberaldin.raccoonforlemmy.core.navigation.di.getNavigationCoordinator
import com.github.diegoberaldin.raccoonforlemmy.core.persistence.di.getSettingsRepository
import com.github.diegoberaldin.raccoonforlemmy.core.utils.compose.rememberCallbackArgs

View File

@ -10,7 +10,7 @@ import androidx.compose.ui.text.font.FontWeight
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.di.getThemeRepository
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.toTypography
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.CustomMarkdown
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.model.markdownTypography
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model.markdownTypography
import com.github.diegoberaldin.raccoonforlemmy.core.navigation.di.getNavigationCoordinator
import com.github.diegoberaldin.raccoonforlemmy.core.persistence.di.getSettingsRepository
import com.github.diegoberaldin.raccoonforlemmy.core.utils.compose.rememberCallbackArgs

View File

@ -33,9 +33,7 @@ class FontFamilyBottomSheet(
UiFontFamily.Poppins,
UiFontFamily.TitilliumWeb,
UiFontFamily.NotoSans,
UiFontFamily.Dosis,
UiFontFamily.CharisSIL,
UiFontFamily.EBGaramond,
UiFontFamily.Comfortaa,
UiFontFamily.Default,
),
@ -92,8 +90,6 @@ class FontFamilyBottomSheet(
val fontFamily = when (value) {
UiFontFamily.CharisSIL -> fontFamilyResource(MR.fonts.CharisSIL.regular)
UiFontFamily.NotoSans -> fontFamilyResource(MR.fonts.NotoSans.regular)
UiFontFamily.EBGaramond -> fontFamilyResource(MR.fonts.EBGaramond.regular)
UiFontFamily.Dosis -> fontFamilyResource(MR.fonts.Dosis.regular)
UiFontFamily.Comfortaa -> fontFamilyResource(MR.fonts.Comfortaa.regular)
UiFontFamily.Poppins -> fontFamilyResource(MR.fonts.Poppins.regular)
UiFontFamily.TitilliumWeb -> fontFamilyResource(MR.fonts.TitilliumWeb.regular)

View File

@ -41,17 +41,22 @@ kotlin {
}
val commonMain by getting {
dependencies {
implementation(libs.koin.core)
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material3)
api(libs.markdown)
implementation(libs.koin.core)
implementation(projects.core.commonui.components)
implementation(projects.core.utils)
implementation(projects.resources)
}
}
val iosMain by getting {
dependencies {
implementation(libs.markdown)
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))

View File

@ -30,16 +30,15 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.viewinterop.AndroidView
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model.MarkdownColors
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model.MarkdownPadding
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model.MarkdownTypography
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model.ReferenceLinkHandlerImpl
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.di.getMarkwonProvider
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.model.MarkdownColors
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.model.MarkdownPadding
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.model.MarkdownTypography
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.model.ReferenceLinkHandlerImpl
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.provider.MarkwonProvider
import com.github.diegoberaldin.raccoonforlemmy.core.utils.datetime.DateTime
import io.noties.markwon.image.AsyncDrawableSpan
import kotlinx.coroutines.delay
import org.intellij.markdown.flavours.MarkdownFlavourDescriptor
/*
* CREDITS:
@ -52,7 +51,6 @@ actual fun CustomMarkdown(
typography: MarkdownTypography,
padding: MarkdownPadding,
modifier: Modifier,
flavour: MarkdownFlavourDescriptor,
onOpenUrl: ((String) -> Unit)?,
inlineImages: Boolean,
autoLoadImages: Boolean,
@ -76,11 +74,13 @@ actual fun CustomMarkdown(
BoxWithConstraints(
modifier = modifier
) {
val style = LocalMarkdownTypography.current.text
val style =
com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.LocalMarkdownTypography.current.text
val fontScale = LocalDensity.current.fontScale * 1.3f
val canvasWidthMaybe = with(LocalDensity.current) { maxWidth.toPx() }.toInt()
val textSizeMaybe = with(LocalDensity.current) { (style.fontSize * fontScale).toPx() }
val defaultColor = LocalMarkdownColors.current.text
val defaultColor =
com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.LocalMarkdownColors.current.text
val resolver: FontFamily.Resolver = LocalFontFamilyResolver.current
val typeface: Typeface = remember(resolver, style) {
resolver.resolve(

View File

@ -1,16 +1,13 @@
package com.github.diegoberaldin.raccoonforlemmy.core.markdown.provider
import android.content.Context
import android.os.Build
import android.text.Spanned
import android.text.util.Linkify
import android.widget.TextView
import coil.ImageLoader
import coil.decode.GifDecoder
import coil.decode.ImageDecoderDecoder
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.plugins.ClickableImagesPlugin
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.plugins.MarkwonLemmyLinkPlugin
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.plugins.MarkwonSpoilerPlugin
import com.github.diegoberaldin.raccoonforlemmy.core.utils.imagepreload.getCoilImageLoader
import io.noties.markwon.AbstractMarkwonPlugin
import io.noties.markwon.Markwon
import io.noties.markwon.MarkwonConfiguration
@ -47,16 +44,7 @@ class DefaultMarkwonProvider(
.usePlugin(HtmlPlugin.create())
.usePlugin(MarkwonSpoilerPlugin.create(true))
.run {
val imageLoader = ImageLoader.Builder(context)
.components {
if (Build.VERSION.SDK_INT >= 28) {
add(ImageDecoderDecoder.Factory())
} else {
add(GifDecoder.Factory())
}
}
.crossfade(true)
.build()
val imageLoader = getCoilImageLoader(context)
usePlugin(CoilImagesPlugin.create(context, imageLoader))
}
.usePlugin(object : AbstractMarkwonPlugin() {

View File

@ -2,11 +2,11 @@ package com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose
import androidx.compose.runtime.compositionLocalOf
import androidx.compose.runtime.staticCompositionLocalOf
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.model.BulletHandler
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.model.MarkdownColors
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.model.MarkdownPadding
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.model.MarkdownTypography
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.model.ReferenceLinkHandler
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model.BulletHandler
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model.MarkdownColors
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model.MarkdownPadding
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model.MarkdownTypography
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model.ReferenceLinkHandler
/**
* The CompositionLocal to provide functionality related to transforming the bullet of an ordered list

View File

@ -4,14 +4,12 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.model.MarkdownColors
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.model.MarkdownPadding
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.model.MarkdownTypography
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.model.markdownColor
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.model.markdownPadding
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.model.markdownTypography
import org.intellij.markdown.flavours.MarkdownFlavourDescriptor
import org.intellij.markdown.flavours.gfm.GFMFlavourDescriptor
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model.MarkdownColors
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model.MarkdownPadding
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model.MarkdownTypography
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model.markdownColor
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model.markdownPadding
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model.markdownTypography
@Composable
expect fun CustomMarkdown(
@ -32,7 +30,6 @@ expect fun CustomMarkdown(
),
padding: MarkdownPadding = markdownPadding(),
modifier: Modifier = Modifier.fillMaxSize(),
flavour: MarkdownFlavourDescriptor = GFMFlavourDescriptor(),
onOpenUrl: ((String) -> Unit)? = null,
inlineImages: Boolean = true,
autoLoadImages: Boolean = true,

View File

@ -1,4 +1,4 @@
package com.github.diegoberaldin.raccoonforlemmy.core.markdown.model
package com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model
/** An interface of providing use case specific un/ordered list handling.*/
fun interface BulletHandler {

View File

@ -1,4 +1,4 @@
package com.github.diegoberaldin.raccoonforlemmy.core.markdown.model
package com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable

View File

@ -1,4 +1,4 @@
package com.github.diegoberaldin.raccoonforlemmy.core.markdown.model
package com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable

View File

@ -1,4 +1,4 @@
package com.github.diegoberaldin.raccoonforlemmy.core.markdown.model
package com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable

View File

@ -1,4 +1,4 @@
package com.github.diegoberaldin.raccoonforlemmy.core.markdown.model
package com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model
/**
* Interface to describe the [ReferenceLinkHandler]

View File

@ -15,10 +15,10 @@ import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.elements.M
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.elements.MarkdownOrderedList
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.elements.MarkdownParagraph
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.elements.MarkdownText
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.model.MarkdownColors
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.model.MarkdownPadding
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.model.MarkdownTypography
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.model.ReferenceLinkHandlerImpl
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model.MarkdownColors
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model.MarkdownPadding
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model.MarkdownTypography
import com.github.diegoberaldin.raccoonforlemmy.core.markdown.compose.model.ReferenceLinkHandlerImpl
import com.github.diegoberaldin.raccoonforlemmy.core.utils.compose.onClick
import org.intellij.markdown.MarkdownElementTypes
import org.intellij.markdown.MarkdownElementTypes.ATX_1
@ -40,7 +40,7 @@ import org.intellij.markdown.MarkdownTokenTypes.Companion.TEXT
import org.intellij.markdown.ast.ASTNode
import org.intellij.markdown.ast.findChildOfType
import org.intellij.markdown.ast.getTextInNode
import org.intellij.markdown.flavours.MarkdownFlavourDescriptor
import org.intellij.markdown.flavours.gfm.GFMFlavourDescriptor
import org.intellij.markdown.parser.MarkdownParser
/**
@ -54,7 +54,6 @@ actual fun CustomMarkdown(
typography: MarkdownTypography,
padding: MarkdownPadding,
modifier: Modifier,
flavour: MarkdownFlavourDescriptor,
onOpenUrl: ((String) -> Unit)?,
inlineImages: Boolean,
autoLoadImages: Boolean,
@ -104,7 +103,8 @@ actual fun CustomMarkdown(
onLongClick = onLongClick ?: {},
)
) {
val parsedTree = MarkdownParser(flavour).buildMarkdownTreeFromString(mangledContent)
val parsedTree =
MarkdownParser(GFMFlavourDescriptor()).buildMarkdownTreeFromString(mangledContent)
parsedTree.children.forEach { node ->
if (!node.handleElement(
content = mangledContent,

View File

@ -28,9 +28,11 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation(libs.koin.core)
implementation(compose.runtime)
implementation(compose.foundation)
implementation(libs.koin.core)
implementation(projects.core.appearance)
implementation(projects.domain.lemmy.data)
implementation(projects.core.persistence)

View File

@ -55,6 +55,7 @@ kotlin {
implementation(libs.androidx.activity)
implementation(libs.ktor.android)
implementation(libs.coil)
implementation(libs.coil.gif)
implementation(libs.firebase.crashlytics)
}
}

View File

@ -0,0 +1,31 @@
package com.github.diegoberaldin.raccoonforlemmy.core.utils.imagepreload
import android.content.Context
import android.os.Build
import coil.ImageLoader
import coil.decode.GifDecoder
import coil.decode.ImageDecoderDecoder
import coil.disk.DiskCache
import coil.memory.MemoryCache
fun getCoilImageLoader(context: Context): ImageLoader = ImageLoader.Builder(context)
.components {
if (Build.VERSION.SDK_INT >= 28) {
add(ImageDecoderDecoder.Factory())
} else {
add(GifDecoder.Factory())
}
}
.memoryCache {
MemoryCache.Builder(context)
.maxSizePercent(0.25)
.build()
}
.diskCache {
DiskCache.Builder()
.directory(context.cacheDir.resolve("image_cache"))
.maxSizePercent(0.02)
.build()
}
.crossfade(true)
.build()

View File

@ -28,9 +28,11 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation(libs.koin.core)
implementation(compose.foundation)
implementation(compose.runtime)
implementation(libs.koin.core)
implementation(projects.core.preferences)
implementation(projects.core.api)
implementation(projects.core.utils)

View File

@ -28,9 +28,11 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation(libs.koin.core)
implementation(compose.foundation)
implementation(compose.runtime)
implementation(libs.koin.core)
implementation(projects.domain.identity)
implementation(projects.domain.lemmy.data)
implementation(projects.domain.lemmy.repository)

View File

@ -28,8 +28,6 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation(libs.koin.core)
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material3)
@ -38,6 +36,7 @@ kotlin {
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
implementation(compose.components.resources)
implementation(libs.koin.core)
implementation(libs.voyager.navigator)
implementation(libs.voyager.screenmodel)
implementation(libs.voyager.tab)

View File

@ -28,8 +28,6 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation(libs.koin.core)
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material)
@ -38,6 +36,7 @@ kotlin {
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
implementation(compose.components.resources)
implementation(libs.koin.core)
implementation(libs.voyager.navigator)
implementation(libs.voyager.screenmodel)
implementation(libs.voyager.tab)

View File

@ -28,8 +28,6 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation(libs.koin.core)
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material3)
@ -38,6 +36,7 @@ kotlin {
implementation(compose.components.resources)
implementation(compose.material)
implementation(libs.koin.core)
implementation(libs.voyager.navigator)
implementation(libs.voyager.screenmodel)
implementation(libs.voyager.tab)

View File

@ -28,8 +28,6 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation(libs.koin.core)
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material3)
@ -37,6 +35,7 @@ kotlin {
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
implementation(compose.components.resources)
implementation(libs.koin.core)
implementation(libs.voyager.navigator)
implementation(libs.voyager.screenmodel)
implementation(libs.voyager.tab)

View File

@ -27,8 +27,6 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation(libs.koin.core)
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material3)
@ -36,6 +34,7 @@ kotlin {
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
implementation(compose.components.resources)
implementation(libs.koin.core)
implementation(libs.voyager.navigator)
implementation(libs.voyager.screenmodel)
implementation(libs.voyager.transition)

View File

@ -28,8 +28,6 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation(libs.koin.core)
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material3)
@ -37,6 +35,7 @@ kotlin {
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
implementation(compose.components.resources)
implementation(libs.koin.core)
implementation(libs.voyager.navigator)
implementation(libs.voyager.screenmodel)

View File

@ -43,7 +43,7 @@ class ModalDrawerViewModel(
) : ModalDrawerMviModel,
MviModel<ModalDrawerMviModel.Intent, ModalDrawerMviModel.UiState, ModalDrawerMviModel.Effect> by mvi {
@OptIn(FlowPreview::class, ExperimentalCoroutinesApi::class)
@OptIn(FlowPreview::class)
override fun onStarted() {
mvi.onStarted()
mvi.scope?.launch(Dispatchers.Main) {
@ -146,7 +146,11 @@ class ModalDrawerViewModel(
community.copy(favorite = community.id in favoriteCommunityIds)
}
.sortedBy { it.name }
.sortedByDescending { it.favorite }
.let {
val favorites = it.filter { e -> e.favorite }
val res = it - favorites.toSet()
favorites + res
}
val multiCommunitites = multiCommunityRepository.getAll(accountId).sortedBy { it.name }
mvi.updateState {

View File

@ -28,8 +28,6 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation(libs.koin.core)
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material3)
@ -38,6 +36,7 @@ kotlin {
implementation(compose.materialIconsExtended)
implementation(compose.material)
implementation(libs.koin.core)
implementation(libs.voyager.navigator)
implementation(libs.voyager.screenmodel)
implementation(libs.voyager.bottomsheet)

View File

@ -28,8 +28,6 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation(libs.koin.core)
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material3)
@ -38,6 +36,7 @@ kotlin {
implementation(compose.materialIconsExtended)
implementation(compose.material)
implementation(libs.koin.core)
implementation(libs.voyager.navigator)
implementation(libs.voyager.screenmodel)
implementation(libs.voyager.bottomsheet)