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
@@ -86,7 +86,6 @@ import javax.crypto.Cipher
import javax.crypto.SecretKeyFactory
import javax.crypto.spec.IvParameterSpec
import javax.crypto.spec.PBEKeySpec
import kotlin.collections.iterator
import kotlin.random.Random
import kotlin.random.nextInt
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) {
fun title(title: CharSequence): QuickAlertDialogBuilder {
setTitle(title)
return this
}
fun title(@StringRes titleRes: Int): QuickAlertDialogBuilder {
setTitle(titleRes)
return this
@@ -1,6 +1,5 @@
package com.pr0gramm3r101.utils.settings
import android.content.Context
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
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.map
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>
get() = DataStoreSingleton.dataStore
override fun putString(key: String, value: String) {
runBlocking {
dataStore.edit { preferences ->
@@ -9,7 +9,6 @@ import androidx.datastore.preferences.core.intPreferencesKey
import androidx.datastore.preferences.core.longPreferencesKey
import androidx.datastore.preferences.core.stringPreferencesKey
import androidx.datastore.preferences.core.stringSetPreferencesKey
import com.pr0gramm3r101.utils.settings.DataStoreSingleton
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.map
@@ -1,5 +1,3 @@
package com.pr0gramm3r101.utils.settings
import com.pr0gramm3r101.utils.UtilsLibrary
actual val settings: Settings get() = AndroidSettings(UtilsLibrary.context)
actual val settings: Settings get() = AndroidSettings()
@@ -26,6 +26,7 @@ import tech.annexflow.constraintlayout.compose.ConstraintLayoutBaseScope
import tech.annexflow.constraintlayout.compose.HorizontalAnchorable
import tech.annexflow.constraintlayout.compose.VerticalAnchorable
@Suppress("ComposableNaming")
@Composable
fun Typography(fontRes: FontResource) = Typography().let {
val font = FontFamily(Font(fontRes))
@@ -19,7 +19,7 @@ object ServerConfigStorage {
suspend fun getServerUrl(): String? {
val url = storage.getString(SERVER_URL_KEY)
return if (url.isEmpty()) null else url
return url.ifEmpty { null }
}
suspend fun setServerUrl(url: String) {
@@ -2,8 +2,8 @@ package com.pr0gramm3r101.utils.settings
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import platform.Foundation.NSUserDefaults
import platform.Foundation.NSBundle
import platform.Foundation.NSUserDefaults
class IosAsyncSettings : AsyncSettings {
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) {
val value = defaults.integerForKey(key)
if (value != null) value.toInt() else default
defaults.integerForKey(key).toInt()
}
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) {
val value = defaults.floatForKey(key)
if (value != null) value.toFloat() else default
defaults.floatForKey(key)
}
override suspend fun putBoolean(key: String, value: Boolean): Unit = withContext(Dispatchers.Default) {