Fix errors

This commit is contained in:
2025-12-16 21:22:50 +03:00
Unverified
parent fe4ea2f91b
commit dd4f6f5552
19 changed files with 26 additions and 63 deletions
+8
View File
@@ -29,6 +29,7 @@
<inspection_tool class="GlancePreviewNotSupportedInUnitTestFiles" enabled="true" level="ERROR" enabled_by_default="true"> <inspection_tool class="GlancePreviewNotSupportedInUnitTestFiles" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" /> <option name="composableFile" value="true" />
</inspection_tool> </inspection_tool>
<inspection_tool class="LocalVariableName" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="NestedLambdaShadowedImplicitParameter" enabled="false" level="WEAK WARNING" enabled_by_default="false" /> <inspection_tool class="NestedLambdaShadowedImplicitParameter" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="PreviewAnnotationInFunctionWithParameters" enabled="true" level="ERROR" enabled_by_default="true"> <inspection_tool class="PreviewAnnotationInFunctionWithParameters" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" /> <option name="composableFile" value="true" />
@@ -58,7 +59,14 @@
<option name="composableFile" value="true" /> <option name="composableFile" value="true" />
<option name="previewFile" value="true" /> <option name="previewFile" value="true" />
</inspection_tool> </inspection_tool>
<inspection_tool class="PrivatePropertyName" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="PropertyName" enabled="false" level="WEAK WARNING" enabled_by_default="false" /> <inspection_tool class="PropertyName" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
<option name="processCode" value="true" />
<option name="processLiterals" value="true" />
<option name="processComments" value="true" />
</inspection_tool>
<inspection_tool class="UnnecessaryModuleDependencyInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnusedSymbol" enabled="true" level="WEAK WARNING" enabled_by_default="true" editorAttributes="INFO_ATTRIBUTES" /> <inspection_tool class="UnusedSymbol" enabled="true" level="WEAK WARNING" enabled_by_default="true" editorAttributes="INFO_ATTRIBUTES" />
</profile> </profile>
</component> </component>
-11
View File
@@ -19,14 +19,3 @@
# If you keep the line number information, uncomment this to # If you keep the line number information, uncomment this to
# hide the original source file name. # hide the original source file name.
#-renamesourcefileattribute SourceFile #-renamesourcefileattribute SourceFile
# Keep Ktor classes
-keep class io.ktor.** { *; }
-keep class kotlinx.coroutines.** { *; }
-dontwarn io.ktor.**
# Keep HttpTimeout plugin specifically
-keep class io.ktor.client.plugins.HttpTimeout { *; }
-keep class io.ktor.client.plugins.HttpTimeout$* { *; }
-keep class io.ktor.client.plugins.HttpTimeout$Plugin { *; }
-keep class io.ktor.client.plugins.HttpTimeout$Config { *; }
@@ -1,7 +1,7 @@
<vector <vector
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:width="1000dp" android:width="200dp"
android:height="1000dp" android:height="200dp"
android:viewportWidth="1000" android:viewportWidth="1000"
android:viewportHeight="1000"> android:viewportHeight="1000">
<group <group
@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorSurface">#141218</color>
</resources>
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="colorSurface">#FEF7FF</color>
</resources>
@@ -1,7 +1,5 @@
package ru.fromchat.ui.chat package ru.fromchat.ui.chat
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
@@ -32,11 +30,6 @@ fun Avatar(
modifier: Modifier = Modifier modifier: Modifier = Modifier
) { ) {
var imageLoadFailed by remember { mutableStateOf(false) } var imageLoadFailed by remember { mutableStateOf(false) }
val alpha by animateFloatAsState(
targetValue = if (imageLoadFailed) 0f else 1f,
animationSpec = tween(300),
label = "avatar_fade"
)
val gradient = remember(displayName) { generateGradientFromName(displayName) } val gradient = remember(displayName) { generateGradientFromName(displayName) }
val initials = remember(displayName) { getInitials(displayName) } val initials = remember(displayName) { getInitials(displayName) }
@@ -2,7 +2,6 @@ package ru.fromchat.ui.chat
import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.material3.MaterialTheme
import kotlin.math.abs import kotlin.math.abs
/** /**
@@ -48,6 +48,7 @@ data class ContextMenuState(
val position: IntOffset = IntOffset(0, 0) val position: IntOffset = IntOffset(0, 0)
) )
@Suppress("AssignedValueIsNeverRead")
@Composable @Composable
fun MessageContextMenu( fun MessageContextMenu(
state: ContextMenuState, state: ContextMenuState,
@@ -26,12 +26,11 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.shadow import androidx.compose.ui.draw.shadow
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import kotlinx.datetime.TimeZone import kotlinx.datetime.TimeZone
@@ -20,7 +20,6 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
@@ -31,14 +30,12 @@ import ru.fromchat.coming_soon
import ru.fromchat.contacts import ru.fromchat.contacts
import ru.fromchat.dms import ru.fromchat.dms
import ru.fromchat.settings import ru.fromchat.settings
import ru.fromchat.ui.LocalNavController
import ru.fromchat.utils.exclude import ru.fromchat.utils.exclude
@Suppress("AssignedValueIsNeverRead") @Suppress("AssignedValueIsNeverRead")
@Composable @Composable
fun MainScreen(onLogout: () -> Unit = {}) { fun MainScreen(onLogout: () -> Unit = {}) {
var selectedTab by rememberSaveable { mutableStateOf("chats") } var selectedTab by rememberSaveable { mutableStateOf("chats") }
val navController = LocalNavController.current
Scaffold( Scaffold(
bottomBar = { bottomBar = {
@@ -56,7 +56,7 @@ inline fun HttpClientConfig<*>.defaultRequest(
/** /**
* Installs [Logging] in a Ktor client config. * Installs [Logging] in a Ktor client config.
* @param settings Lambda to configure the [Logging.Config]. * @param settings Lambda to configure the [LoggingConfig].
*/ */
inline fun HttpClientConfig<*>.logging( inline fun HttpClientConfig<*>.logging(
crossinline settings: LoggingConfig.() -> Unit crossinline settings: LoggingConfig.() -> Unit
+2 -4
View File
@@ -1,11 +1,12 @@
[versions] [versions]
agp = "8.13.1" agp = "8.13.2"
androidx-activityCompose = "1.12.1" androidx-activityCompose = "1.12.1"
androidx-appcompat = "1.7.1" androidx-appcompat = "1.7.1"
androidx-core-ktx = "1.17.0" androidx-core-ktx = "1.17.0"
androidx-lifecycle = "2.9.6" androidx-lifecycle = "2.9.6"
coilCompose = "3.3.0" coilCompose = "3.3.0"
compose-multiplatform = "1.9.3" compose-multiplatform = "1.9.3"
#noinspection NewerVersionAvailable
constraintlayout = "0.6.1-shaded" constraintlayout = "0.6.1-shaded"
coreSplashscreen = "1.2.0" coreSplashscreen = "1.2.0"
haze = "1.7.1" haze = "1.7.1"
@@ -31,8 +32,6 @@ androidx-core-splashscreen = { module = "androidx.core:core-splashscreen", versi
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidx-core-ktx" } androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidx-core-ktx" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidx-appcompat" } androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidx-appcompat" }
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" } androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" }
androidx-lifecycle-viewmodel = { group = "org.jetbrains.androidx.lifecycle", name = "lifecycle-viewmodel", version.ref = "androidx-lifecycle" }
androidx-lifecycle-runtime-compose = { group = "org.jetbrains.androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "androidx-lifecycle" }
coil-compose = { module = "io.coil-kt.coil3:coil-compose", version.ref = "coilCompose" } coil-compose = { module = "io.coil-kt.coil3:coil-compose", version.ref = "coilCompose" }
coil-network-ktor3 = { module = "io.coil-kt.coil3:coil-network-ktor3", version.ref = "coilCompose" } coil-network-ktor3 = { module = "io.coil-kt.coil3:coil-network-ktor3", version.ref = "coilCompose" }
constraintlayout = { module = "tech.annexflow.compose:constraintlayout-compose-multiplatform", version.ref = "constraintlayout" } constraintlayout = { module = "tech.annexflow.compose:constraintlayout-compose-multiplatform", version.ref = "constraintlayout" }
@@ -56,7 +55,6 @@ ktor-client-content-negotiation = { module = "io.ktor:ktor-client-content-negoti
ktor-client-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" } ktor-client-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
ktor-client-websockets = { module = "io.ktor:ktor-client-websockets", version.ref = "ktor" } ktor-client-websockets = { module = "io.ktor:ktor-client-websockets", version.ref = "ktor" }
ktor-client-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor" } ktor-client-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor" }
ktor-client-android = { module = "io.ktor:ktor-client-android", version.ref = "ktor" }
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" } ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
ktor-client-darwin = { module = "io.ktor:ktor-client-darwin", version.ref = "ktor" } ktor-client-darwin = { module = "io.ktor:ktor-client-darwin", version.ref = "ktor" }
slf4j-android = { module = "org.slf4j:slf4j-android", version.ref = "slf4j" } slf4j-android = { module = "org.slf4j:slf4j-android", version.ref = "slf4j" }
@@ -86,7 +86,6 @@ import javax.crypto.Cipher
import javax.crypto.SecretKeyFactory import javax.crypto.SecretKeyFactory
import javax.crypto.spec.IvParameterSpec import javax.crypto.spec.IvParameterSpec
import javax.crypto.spec.PBEKeySpec import javax.crypto.spec.PBEKeySpec
import kotlin.collections.iterator
import kotlin.random.Random import kotlin.random.Random
import kotlin.random.nextInt import kotlin.random.nextInt
import kotlin.reflect.KClass import kotlin.reflect.KClass
@@ -291,12 +290,13 @@ fun Activity.resolveAttr(@AttrRes id: Int): Int? {
} }
} }
@Suppress("UNUSED_PARAMETER", "unused", "MemberVisibilityCanBePrivate") @Suppress("unused", "MemberVisibilityCanBePrivate")
class QuickAlertDialogBuilder(context: Context): MaterialAlertDialogBuilder(context) { class QuickAlertDialogBuilder(context: Context): MaterialAlertDialogBuilder(context) {
fun title(title: CharSequence): QuickAlertDialogBuilder { fun title(title: CharSequence): QuickAlertDialogBuilder {
setTitle(title) setTitle(title)
return this return this
} }
fun title(@StringRes titleRes: Int): QuickAlertDialogBuilder { fun title(@StringRes titleRes: Int): QuickAlertDialogBuilder {
setTitle(titleRes) setTitle(titleRes)
return this return this
@@ -1,6 +1,5 @@
package com.pr0gramm3r101.utils.settings package com.pr0gramm3r101.utils.settings
import android.content.Context
import androidx.datastore.core.DataStore import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.core.booleanPreferencesKey import androidx.datastore.preferences.core.booleanPreferencesKey
@@ -13,11 +12,11 @@ import androidx.datastore.preferences.core.stringSetPreferencesKey
import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.map
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import com.pr0gramm3r101.utils.settings.DataStoreSingleton
class AndroidSettings(private val context: Context): Settings { class AndroidSettings(): Settings {
private val dataStore: DataStore<Preferences> private val dataStore: DataStore<Preferences>
get() = DataStoreSingleton.dataStore get() = DataStoreSingleton.dataStore
override fun putString(key: String, value: String) { override fun putString(key: String, value: String) {
runBlocking { runBlocking {
dataStore.edit { preferences -> dataStore.edit { preferences ->
@@ -9,7 +9,6 @@ import androidx.datastore.preferences.core.intPreferencesKey
import androidx.datastore.preferences.core.longPreferencesKey import androidx.datastore.preferences.core.longPreferencesKey
import androidx.datastore.preferences.core.stringPreferencesKey import androidx.datastore.preferences.core.stringPreferencesKey
import androidx.datastore.preferences.core.stringSetPreferencesKey import androidx.datastore.preferences.core.stringSetPreferencesKey
import com.pr0gramm3r101.utils.settings.DataStoreSingleton
import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.map
@@ -1,5 +1,3 @@
package com.pr0gramm3r101.utils.settings package com.pr0gramm3r101.utils.settings
import com.pr0gramm3r101.utils.UtilsLibrary actual val settings: Settings get() = AndroidSettings()
actual val settings: Settings get() = AndroidSettings(UtilsLibrary.context)
@@ -26,6 +26,7 @@ import tech.annexflow.constraintlayout.compose.ConstraintLayoutBaseScope
import tech.annexflow.constraintlayout.compose.HorizontalAnchorable import tech.annexflow.constraintlayout.compose.HorizontalAnchorable
import tech.annexflow.constraintlayout.compose.VerticalAnchorable import tech.annexflow.constraintlayout.compose.VerticalAnchorable
@Suppress("ComposableNaming")
@Composable @Composable
fun Typography(fontRes: FontResource) = Typography().let { fun Typography(fontRes: FontResource) = Typography().let {
val font = FontFamily(Font(fontRes)) val font = FontFamily(Font(fontRes))
@@ -19,7 +19,7 @@ object ServerConfigStorage {
suspend fun getServerUrl(): String? { suspend fun getServerUrl(): String? {
val url = storage.getString(SERVER_URL_KEY) val url = storage.getString(SERVER_URL_KEY)
return if (url.isEmpty()) null else url return url.ifEmpty { null }
} }
suspend fun setServerUrl(url: String) { suspend fun setServerUrl(url: String) {
@@ -2,8 +2,8 @@ package com.pr0gramm3r101.utils.settings
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import platform.Foundation.NSUserDefaults
import platform.Foundation.NSBundle import platform.Foundation.NSBundle
import platform.Foundation.NSUserDefaults
class IosAsyncSettings : AsyncSettings { class IosAsyncSettings : AsyncSettings {
private val defaults: NSUserDefaults = NSUserDefaults.standardUserDefaults private val defaults: NSUserDefaults = NSUserDefaults.standardUserDefaults
@@ -23,8 +23,7 @@ class IosAsyncSettings : AsyncSettings {
} }
override suspend fun getInt(key: String, default: Int): Int = withContext(Dispatchers.Default) { override suspend fun getInt(key: String, default: Int): Int = withContext(Dispatchers.Default) {
val value = defaults.integerForKey(key) defaults.integerForKey(key).toInt()
if (value != null) value.toInt() else default
} }
override suspend fun putLong(key: String, value: Long): Unit = withContext(Dispatchers.Default) { override suspend fun putLong(key: String, value: Long): Unit = withContext(Dispatchers.Default) {
@@ -42,8 +41,7 @@ class IosAsyncSettings : AsyncSettings {
} }
override suspend fun getFloat(key: String, default: Float): Float = withContext(Dispatchers.Default) { override suspend fun getFloat(key: String, default: Float): Float = withContext(Dispatchers.Default) {
val value = defaults.floatForKey(key) defaults.floatForKey(key)
if (value != null) value.toFloat() else default
} }
override suspend fun putBoolean(key: String, value: Boolean): Unit = withContext(Dispatchers.Default) { override suspend fun putBoolean(key: String, value: Boolean): Unit = withContext(Dispatchers.Default) {