Промежуточный результат для 1.0.4 версии

This commit is contained in:
2026-02-22 08:54:46 +05:00
parent 3aa18fa9ac
commit 5b9b3f83f7
37 changed files with 5643 additions and 928 deletions

View File

@@ -40,6 +40,7 @@ class PreferencesManager(private val context: Context) {
val AUTO_DOWNLOAD_PHOTOS = booleanPreferencesKey("auto_download_photos")
val AUTO_DOWNLOAD_VIDEOS = booleanPreferencesKey("auto_download_videos")
val AUTO_DOWNLOAD_FILES = booleanPreferencesKey("auto_download_files")
val CAMERA_FLASH_MODE = intPreferencesKey("camera_flash_mode") // 0=off, 1=auto, 2=on
// Privacy
val SHOW_ONLINE_STATUS = booleanPreferencesKey("show_online_status")
@@ -158,6 +159,11 @@ class PreferencesManager(private val context: Context) {
val autoDownloadFiles: Flow<Boolean> =
context.dataStore.data.map { preferences -> preferences[AUTO_DOWNLOAD_FILES] ?: false }
val cameraFlashMode: Flow<Int> =
context.dataStore.data.map { preferences ->
normalizeCameraFlashMode(preferences[CAMERA_FLASH_MODE])
}
suspend fun setMessageTextSize(value: Int) {
context.dataStore.edit { preferences -> preferences[MESSAGE_TEXT_SIZE] = value }
}
@@ -178,6 +184,23 @@ class PreferencesManager(private val context: Context) {
context.dataStore.edit { preferences -> preferences[AUTO_DOWNLOAD_FILES] = value }
}
suspend fun getCameraFlashMode(): Int {
return normalizeCameraFlashMode(context.dataStore.data.first()[CAMERA_FLASH_MODE])
}
suspend fun setCameraFlashMode(value: Int) {
context.dataStore.edit { preferences ->
preferences[CAMERA_FLASH_MODE] = normalizeCameraFlashMode(value)
}
}
private fun normalizeCameraFlashMode(value: Int?): Int {
return when (value) {
0, 1, 2 -> value
else -> 1
}
}
// ═════════════════════════════════════════════════════════════
// 🔐 PRIVACY
// ═════════════════════════════════════════════════════════════