feat: Update send icon to ArrowUp in TelegramCaptionBar and MultiImageEditorScreen

This commit is contained in:
k1ngsterr1
2026-02-07 19:34:16 +05:00
parent fdc4f42e1d
commit 0eddd448c7
5 changed files with 169 additions and 42 deletions

View File

@@ -7,6 +7,7 @@ import androidx.datastore.preferences.core.booleanPreferencesKey
import androidx.datastore.preferences.core.edit
import androidx.datastore.preferences.core.intPreferencesKey
import androidx.datastore.preferences.core.stringPreferencesKey
import androidx.datastore.preferences.core.stringSetPreferencesKey
import androidx.datastore.preferences.preferencesDataStore
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
@@ -45,6 +46,9 @@ class PreferencesManager(private val context: Context) {
// Appearance / Customization
val BACKGROUND_BLUR_COLOR_ID = stringPreferencesKey("background_blur_color_id") // id from BackgroundBlurPresets
// Pinned Chats (max 3)
val PINNED_CHATS = stringSetPreferencesKey("pinned_chats") // Set of opponent public keys
}
// ═════════════════════════════════════════════════════════════
@@ -205,4 +209,33 @@ class PreferencesManager(private val context: Context) {
suspend fun setBackgroundBlurColorId(value: String) {
context.dataStore.edit { preferences -> preferences[BACKGROUND_BLUR_COLOR_ID] = value }
}
// ═════════════════════════════════════════════════════════════
// 📌 PINNED CHATS
// ═════════════════════════════════════════════════════════════
val pinnedChats: Flow<Set<String>> =
context.dataStore.data.map { preferences ->
preferences[PINNED_CHATS] ?: emptySet()
}
suspend fun setPinnedChats(value: Set<String>) {
context.dataStore.edit { preferences -> preferences[PINNED_CHATS] = value }
}
suspend fun togglePinChat(opponentKey: String): Boolean {
var wasPinned = false
context.dataStore.edit { preferences ->
val current = preferences[PINNED_CHATS] ?: emptySet()
if (current.contains(opponentKey)) {
// Unpin
preferences[PINNED_CHATS] = current - opponentKey
wasPinned = true
} else if (current.size < 3) {
// Pin (max 3)
preferences[PINNED_CHATS] = current + opponentKey
}
}
return wasPinned
}
}