settings reorganization;
implement long press on emoji button for fast text; some deprecations fixed; some typos fixed; etc
This commit is contained in:
@@ -3,8 +3,8 @@ package dev.meloda.fast.auth.captcha.di
|
||||
import dev.meloda.fast.auth.captcha.CaptchaViewModel
|
||||
import dev.meloda.fast.auth.captcha.CaptchaViewModelImpl
|
||||
import dev.meloda.fast.auth.captcha.validation.CaptchaValidator
|
||||
import org.koin.androidx.viewmodel.dsl.viewModelOf
|
||||
import org.koin.core.module.dsl.singleOf
|
||||
import org.koin.core.module.dsl.viewModelOf
|
||||
import org.koin.dsl.bind
|
||||
import org.koin.dsl.module
|
||||
|
||||
|
||||
@@ -368,7 +368,7 @@ class LoginViewModelImpl(
|
||||
|
||||
private fun startLongPoll() {
|
||||
longPollController.setStateToApply(
|
||||
if (AppSettings.Debug.longPollInBackground) {
|
||||
if (AppSettings.Experimental.longPollInBackground) {
|
||||
LongPollState.Background
|
||||
} else {
|
||||
LongPollState.InApp
|
||||
|
||||
@@ -4,8 +4,8 @@ import dev.meloda.fast.auth.login.LoginViewModelImpl
|
||||
import dev.meloda.fast.domain.OAuthUseCase
|
||||
import dev.meloda.fast.domain.OAuthUseCaseImpl
|
||||
import dev.meloda.fast.auth.login.validation.LoginValidator
|
||||
import org.koin.androidx.viewmodel.dsl.viewModelOf
|
||||
import org.koin.core.module.dsl.singleOf
|
||||
import org.koin.core.module.dsl.viewModelOf
|
||||
import org.koin.dsl.bind
|
||||
import org.koin.dsl.module
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ import dev.meloda.fast.domain.AuthUseCaseImpl
|
||||
import dev.meloda.fast.auth.validation.ValidationViewModel
|
||||
import dev.meloda.fast.auth.validation.ValidationViewModelImpl
|
||||
import dev.meloda.fast.auth.validation.validation.ValidationValidator
|
||||
import org.koin.androidx.viewmodel.dsl.viewModelOf
|
||||
import org.koin.core.module.dsl.singleOf
|
||||
import org.koin.core.module.dsl.viewModelOf
|
||||
import org.koin.dsl.bind
|
||||
import org.koin.dsl.module
|
||||
|
||||
|
||||
-8
@@ -70,11 +70,9 @@ import dev.meloda.fast.chatmaterials.ChatMaterialsViewModel
|
||||
import dev.meloda.fast.chatmaterials.ChatMaterialsViewModelImpl
|
||||
import dev.meloda.fast.chatmaterials.model.ChatMaterialsScreenState
|
||||
import dev.meloda.fast.chatmaterials.model.UiChatMaterial
|
||||
import dev.meloda.fast.datastore.UserSettings
|
||||
import dev.meloda.fast.ui.R
|
||||
import dev.meloda.fast.ui.theme.LocalThemeConfig
|
||||
import org.koin.androidx.compose.koinViewModel
|
||||
import org.koin.compose.koinInject
|
||||
|
||||
@Composable
|
||||
fun ChatMaterialsRoute(
|
||||
@@ -82,15 +80,10 @@ fun ChatMaterialsRoute(
|
||||
onPhotoClicked: (url: String) -> Unit,
|
||||
viewModel: ChatMaterialsViewModel = koinViewModel<ChatMaterialsViewModelImpl>()
|
||||
) {
|
||||
val userSettings: UserSettings = koinInject()
|
||||
|
||||
val enablePullToRefresh by userSettings.enablePullToRefresh.collectAsStateWithLifecycle()
|
||||
|
||||
val screenState by viewModel.screenState.collectAsStateWithLifecycle()
|
||||
|
||||
ChatMaterialsScreen(
|
||||
screenState = screenState,
|
||||
enablePullToRefresh = enablePullToRefresh,
|
||||
onBack = onBack,
|
||||
onTypeChanged = viewModel::onTypeChanged,
|
||||
onRefreshDropdownItemClicked = viewModel::onRefresh,
|
||||
@@ -107,7 +100,6 @@ fun ChatMaterialsRoute(
|
||||
@Composable
|
||||
fun ChatMaterialsScreen(
|
||||
screenState: ChatMaterialsScreenState = ChatMaterialsScreenState.EMPTY,
|
||||
enablePullToRefresh: Boolean = false,
|
||||
onBack: () -> Unit = {},
|
||||
onTypeChanged: (String) -> Unit = {},
|
||||
onRefreshDropdownItemClicked: () -> Unit = {},
|
||||
|
||||
+3
-3
@@ -1,14 +1,14 @@
|
||||
package dev.meloda.fast.conversations.di
|
||||
|
||||
import dev.meloda.fast.conversations.ConversationsViewModelImpl
|
||||
import dev.meloda.fast.domain.ConversationsUseCaseImpl
|
||||
import dev.meloda.fast.domain.ConversationsUseCase
|
||||
import org.koin.androidx.viewmodel.dsl.viewModelOf
|
||||
import dev.meloda.fast.domain.ConversationsUseCaseImpl
|
||||
import org.koin.core.module.dsl.singleOf
|
||||
import org.koin.core.module.dsl.viewModelOf
|
||||
import org.koin.dsl.bind
|
||||
import org.koin.dsl.module
|
||||
|
||||
val conversationsModule = module {
|
||||
singleOf(::ConversationsUseCaseImpl) bind dev.meloda.fast.domain.ConversationsUseCase::class
|
||||
singleOf(::ConversationsUseCaseImpl) bind ConversationsUseCase::class
|
||||
viewModelOf(::ConversationsViewModelImpl)
|
||||
}
|
||||
|
||||
+1
-1
@@ -310,7 +310,7 @@ fun ConversationsScreen(
|
||||
) {
|
||||
FloatingActionButton(
|
||||
onClick = {
|
||||
if (AppSettings.Debug.enableHaptic) {
|
||||
if (AppSettings.General.enableHaptic) {
|
||||
view.performHapticFeedback(HapticFeedbackConstantsCompat.REJECT)
|
||||
}
|
||||
scope.launch {
|
||||
|
||||
@@ -3,13 +3,12 @@ package dev.meloda.fast.friends.di
|
||||
import dev.meloda.fast.domain.FriendsUseCase
|
||||
import dev.meloda.fast.friends.FriendsViewModelImpl
|
||||
import dev.meloda.fast.domain.FriendsUseCaseImpl
|
||||
import org.koin.androidx.viewmodel.dsl.viewModelOf
|
||||
import org.koin.core.module.dsl.singleOf
|
||||
import org.koin.core.module.dsl.viewModelOf
|
||||
import org.koin.dsl.bind
|
||||
import org.koin.dsl.module
|
||||
|
||||
val friendsModule = module {
|
||||
singleOf(::FriendsUseCaseImpl) bind dev.meloda.fast.domain.FriendsUseCase::class
|
||||
|
||||
singleOf(::FriendsUseCaseImpl) bind FriendsUseCase::class
|
||||
viewModelOf(::FriendsViewModelImpl)
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package dev.meloda.fast.languagepicker.di
|
||||
|
||||
import dev.meloda.fast.languagepicker.LanguagePickerViewModelImpl
|
||||
import org.koin.androidx.viewmodel.dsl.viewModelOf
|
||||
import org.koin.core.module.dsl.viewModelOf
|
||||
import org.koin.dsl.module
|
||||
|
||||
val languagePickerModule = module {
|
||||
|
||||
+12
-3
@@ -2,6 +2,7 @@ package dev.meloda.fast.messageshistory
|
||||
|
||||
import android.content.SharedPreferences
|
||||
import android.util.Log
|
||||
import androidx.compose.ui.text.TextRange
|
||||
import androidx.compose.ui.text.input.TextFieldValue
|
||||
import androidx.core.content.edit
|
||||
import androidx.lifecycle.SavedStateHandle
|
||||
@@ -10,6 +11,7 @@ import androidx.lifecycle.viewModelScope
|
||||
import com.conena.nanokt.collections.indexOfFirstOrNull
|
||||
import com.conena.nanokt.collections.indexOfOrNull
|
||||
import com.conena.nanokt.text.isEmptyOrBlank
|
||||
import com.conena.nanokt.text.isNotEmptyOrBlank
|
||||
import dev.meloda.fast.common.extensions.listenValue
|
||||
import dev.meloda.fast.common.extensions.setValue
|
||||
import dev.meloda.fast.common.provider.ResourceProvider
|
||||
@@ -54,7 +56,7 @@ interface MessagesHistoryViewModel {
|
||||
fun onRefresh()
|
||||
fun onAttachmentButtonClicked()
|
||||
fun onMessageInputChanged(newText: TextFieldValue)
|
||||
fun onEmojiButtonClicked()
|
||||
fun onEmojiButtonLongClicked()
|
||||
fun onActionButtonClicked()
|
||||
|
||||
fun onPaginationConditionsMet()
|
||||
@@ -123,8 +125,15 @@ class MessagesHistoryViewModelImpl(
|
||||
screenState.setValue { old -> old.copy(message = newText) }
|
||||
}
|
||||
|
||||
override fun onEmojiButtonClicked() {
|
||||
|
||||
override fun onEmojiButtonLongClicked() {
|
||||
AppSettings.Features.fastText.takeIf { it.isNotEmptyOrBlank() }?.let { text ->
|
||||
screenState.setValue { old ->
|
||||
val newText = "${old.message.text}$text"
|
||||
old.copy(
|
||||
message = TextFieldValue(text = newText, selection = TextRange(newText.length))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActionButtonClicked() {
|
||||
|
||||
+3
-3
@@ -1,17 +1,17 @@
|
||||
package dev.meloda.fast.messageshistory.di
|
||||
|
||||
import dev.meloda.fast.domain.MessagesUseCase
|
||||
import dev.meloda.fast.domain.MessagesUseCaseImpl
|
||||
import dev.meloda.fast.messageshistory.MessagesHistoryViewModel
|
||||
import dev.meloda.fast.messageshistory.MessagesHistoryViewModelImpl
|
||||
import dev.meloda.fast.domain.MessagesUseCaseImpl
|
||||
import dev.meloda.fast.messageshistory.validation.MessagesHistoryValidator
|
||||
import org.koin.androidx.viewmodel.dsl.viewModelOf
|
||||
import org.koin.core.module.dsl.singleOf
|
||||
import org.koin.core.module.dsl.viewModelOf
|
||||
import org.koin.dsl.bind
|
||||
import org.koin.dsl.module
|
||||
|
||||
val messagesHistoryModule = module {
|
||||
singleOf(::MessagesUseCaseImpl) bind dev.meloda.fast.domain.MessagesUseCase::class
|
||||
singleOf(::MessagesUseCaseImpl) bind MessagesUseCase::class
|
||||
singleOf(::MessagesHistoryValidator)
|
||||
viewModelOf(::MessagesHistoryViewModelImpl) bind MessagesHistoryViewModel::class
|
||||
}
|
||||
|
||||
+14
-6
@@ -37,7 +37,6 @@ import androidx.compose.material3.DropdownMenuItem
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.LinearProgressIndicator
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Scaffold
|
||||
@@ -86,6 +85,7 @@ import dev.meloda.fast.messageshistory.model.MessagesHistoryScreenState
|
||||
import dev.meloda.fast.messageshistory.util.firstMessage
|
||||
import dev.meloda.fast.messageshistory.util.indexOfMessageByCmId
|
||||
import dev.meloda.fast.model.BaseError
|
||||
import dev.meloda.fast.ui.components.IconButton
|
||||
import dev.meloda.fast.ui.theme.LocalThemeConfig
|
||||
import dev.meloda.fast.ui.util.ImmutableList
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -119,7 +119,8 @@ fun MessagesHistoryRoute(
|
||||
onPaginationConditionsMet = viewModel::onPaginationConditionsMet,
|
||||
onMessageInputChanged = viewModel::onMessageInputChanged,
|
||||
onAttachmentButtonClicked = viewModel::onAttachmentButtonClicked,
|
||||
onActionButtonClicked = viewModel::onActionButtonClicked
|
||||
onActionButtonClicked = viewModel::onActionButtonClicked,
|
||||
onEmojiButtonLongClicked = viewModel::onEmojiButtonLongClicked
|
||||
)
|
||||
}
|
||||
|
||||
@@ -141,7 +142,8 @@ fun MessagesHistoryScreen(
|
||||
onPaginationConditionsMet: () -> Unit = {},
|
||||
onMessageInputChanged: (TextFieldValue) -> Unit = {},
|
||||
onAttachmentButtonClicked: () -> Unit = {},
|
||||
onActionButtonClicked: () -> Unit = {}
|
||||
onActionButtonClicked: () -> Unit = {},
|
||||
onEmojiButtonLongClicked: () -> Unit = {}
|
||||
) {
|
||||
val view = LocalView.current
|
||||
|
||||
@@ -371,7 +373,7 @@ fun MessagesHistoryScreen(
|
||||
Column(verticalArrangement = Arrangement.Bottom) {
|
||||
IconButton(
|
||||
onClick = {
|
||||
if (AppSettings.Debug.enableHaptic) {
|
||||
if (AppSettings.General.enableHaptic) {
|
||||
view.performHapticFeedback(HapticFeedbackConstantsCompat.REJECT)
|
||||
}
|
||||
scope.launch {
|
||||
@@ -389,6 +391,12 @@ fun MessagesHistoryScreen(
|
||||
}
|
||||
}
|
||||
},
|
||||
onLongClick = {
|
||||
if (AppSettings.General.enableHaptic) {
|
||||
view.performHapticFeedback(HapticFeedbackConstantsCompat.LONG_PRESS)
|
||||
}
|
||||
onEmojiButtonLongClicked()
|
||||
},
|
||||
modifier = Modifier.rotate(rotation.value)
|
||||
) {
|
||||
Icon(
|
||||
@@ -427,7 +435,7 @@ fun MessagesHistoryScreen(
|
||||
Column(verticalArrangement = Arrangement.Bottom) {
|
||||
IconButton(
|
||||
onClick = {
|
||||
if (AppSettings.Debug.enableHaptic) {
|
||||
if (AppSettings.General.enableHaptic) {
|
||||
view.performHapticFeedback(HapticFeedbackConstantsCompat.REJECT)
|
||||
}
|
||||
scope.launch {
|
||||
@@ -463,7 +471,7 @@ fun MessagesHistoryScreen(
|
||||
IconButton(
|
||||
onClick = {
|
||||
if (screenState.actionMode == ActionMode.Record) {
|
||||
if (AppSettings.Debug.enableHaptic) {
|
||||
if (AppSettings.General.enableHaptic) {
|
||||
view.performHapticFeedback(HapticFeedbackConstantsCompat.REJECT)
|
||||
}
|
||||
scope.launch {
|
||||
|
||||
@@ -2,7 +2,7 @@ package dev.meloda.fast.photoviewer.di
|
||||
|
||||
import dev.meloda.fast.photoviewer.PhotoViewViewModel
|
||||
import dev.meloda.fast.photoviewer.PhotoViewViewModelImpl
|
||||
import org.koin.androidx.viewmodel.dsl.viewModelOf
|
||||
import org.koin.core.module.dsl.viewModelOf
|
||||
import org.koin.dsl.bind
|
||||
import org.koin.dsl.module
|
||||
|
||||
|
||||
+1
-1
@@ -123,7 +123,7 @@ fun TopBar(
|
||||
}
|
||||
},
|
||||
actions = {
|
||||
// IconButton(
|
||||
// IconButton.kt(
|
||||
// onClick = { dropdownMenuShown = true }
|
||||
// ) {
|
||||
// Icon(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package dev.meloda.fast.profile.di
|
||||
|
||||
import dev.meloda.fast.profile.ProfileViewModelImpl
|
||||
import org.koin.androidx.viewmodel.dsl.viewModelOf
|
||||
import org.koin.core.module.dsl.viewModelOf
|
||||
import org.koin.dsl.module
|
||||
|
||||
val profileModule = module {
|
||||
|
||||
@@ -154,13 +154,6 @@ class SettingsViewModelImpl(
|
||||
userSettings.onUseContactNamesChanged(isUsing)
|
||||
}
|
||||
|
||||
SettingsKeys.KEY_ENABLE_PULL_TO_REFRESH -> {
|
||||
val enable =
|
||||
newValue as? Boolean ?: SettingsKeys.DEFAULT_VALUE_ENABLE_PULL_TO_REFRESH
|
||||
userSettings.onEnablePullToRefreshChanged(enable)
|
||||
}
|
||||
|
||||
|
||||
SettingsKeys.KEY_APPEARANCE_MULTILINE -> {
|
||||
val isUsing = newValue as? Boolean ?: SettingsKeys.DEFAULT_VALUE_MULTILINE
|
||||
userSettings.onEnableMultilineChanged(isUsing)
|
||||
@@ -206,9 +199,9 @@ class SettingsViewModelImpl(
|
||||
userSettings.onShowAlertAfterCrashChanged(show)
|
||||
}
|
||||
|
||||
SettingsKeys.KEY_FEATURES_LONG_POLL_IN_BACKGROUND -> {
|
||||
SettingsKeys.KEY_LONG_POLL_IN_BACKGROUND -> {
|
||||
val inBackground = newValue as? Boolean
|
||||
?: SettingsKeys.DEFAULT_VALUE_FEATURES_LONG_POLL_IN_BACKGROUND
|
||||
?: SettingsKeys.DEFAULT_LONG_POLL_IN_BACKGROUND
|
||||
userSettings.onLongPollInBackgroundChanged(inBackground)
|
||||
|
||||
longPollController.setStateToApply(
|
||||
@@ -221,9 +214,9 @@ class SettingsViewModelImpl(
|
||||
)
|
||||
}
|
||||
|
||||
SettingsKeys.KEY_APPEARANCE_USE_BLUR -> {
|
||||
SettingsKeys.KEY_USE_BLUR -> {
|
||||
val isUsing =
|
||||
newValue as? Boolean ?: SettingsKeys.DEFAULT_VALUE_KEY_APPEARANCE_USE_BLUR
|
||||
newValue as? Boolean ?: SettingsKeys.DEFAULT_USE_BLUR
|
||||
userSettings.onUseBlurChanged(isUsing)
|
||||
}
|
||||
|
||||
@@ -232,14 +225,14 @@ class SettingsViewModelImpl(
|
||||
userSettings.onShowEmojiButtonChanged(show)
|
||||
}
|
||||
|
||||
SettingsKeys.KEY_APPEARANCE_SHOW_TIME_IN_ACTION_MESSAGES -> {
|
||||
SettingsKeys.KEY_SHOW_TIME_IN_ACTION_MESSAGES -> {
|
||||
val show = newValue as? Boolean
|
||||
?: SettingsKeys.DEFAULT_VALUE_APPEARANCE_SHOW_TIME_IN_ACTION_MESSAGES
|
||||
?: SettingsKeys.DEFAULT_SHOW_TIME_IN_ACTION_MESSAGES
|
||||
userSettings.onShowTimeInActionMessagesChanged(show)
|
||||
}
|
||||
|
||||
SettingsKeys.KEY_DEBUG_USE_SYSTEM_FONT -> {
|
||||
val use = newValue as? Boolean ?: SettingsKeys.DEFAULT_DEBUG_USE_SYSTEM_FONT
|
||||
SettingsKeys.KEY_USE_SYSTEM_FONT -> {
|
||||
val use = newValue as? Boolean ?: SettingsKeys.DEFAULT_USE_SYSTEM_FONT
|
||||
userSettings.onUseSystemFontChanged(use)
|
||||
}
|
||||
|
||||
@@ -283,10 +276,16 @@ class SettingsViewModelImpl(
|
||||
text = UiText.Resource(UiR.string.settings_general_contact_names_summary),
|
||||
defaultValue = SettingsKeys.DEFAULT_VALUE_USE_CONTACT_NAMES
|
||||
)
|
||||
val generalEnablePullToRefresh = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_ENABLE_PULL_TO_REFRESH,
|
||||
defaultValue = SettingsKeys.DEFAULT_VALUE_ENABLE_PULL_TO_REFRESH,
|
||||
title = UiText.Resource(UiR.string.settings_general_enable_pull_to_refresh_title)
|
||||
val generalShowEmojiButton = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_SHOW_EMOJI_BUTTON,
|
||||
title = UiText.Simple("Show emoji button"),
|
||||
text = UiText.Simple("Show emoji button in chat panel"),
|
||||
defaultValue = SettingsKeys.DEFAULT_VALUE_KEY_SHOW_EMOJI_BUTTON
|
||||
)
|
||||
val generalEnableHaptic = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_ENABLE_HAPTIC,
|
||||
defaultValue = SettingsKeys.DEFAULT_ENABLE_HAPTIC,
|
||||
title = UiText.Simple("Enable haptic")
|
||||
)
|
||||
|
||||
val appearanceTitle = SettingsItem.Title(
|
||||
@@ -340,7 +339,11 @@ class SettingsViewModelImpl(
|
||||
text = UiText.Resource(UiR.string.settings_dynamic_colors_description),
|
||||
defaultValue = SettingsKeys.DEFAULT_VALUE_USE_DYNAMIC_COLORS
|
||||
)
|
||||
|
||||
val appearanceUseSystemFont = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_USE_SYSTEM_FONT,
|
||||
defaultValue = SettingsKeys.DEFAULT_USE_SYSTEM_FONT,
|
||||
title = UiText.Simple("Use system font")
|
||||
)
|
||||
val appearanceLanguage = SettingsItem.TitleText(
|
||||
key = SettingsKeys.KEY_APPEARANCE_LANGUAGE,
|
||||
title = UiText.Resource(UiR.string.settings_application_language),
|
||||
@@ -374,6 +377,28 @@ class SettingsViewModelImpl(
|
||||
text = UiText.Resource(UiR.string.settings_activity_send_online_summary)
|
||||
)
|
||||
|
||||
val experimentalTitle = SettingsItem.Title(
|
||||
key = "experimental",
|
||||
title = UiText.Simple("Experimental - VERY unstable")
|
||||
)
|
||||
val experimentalLongPollBackground = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_LONG_POLL_IN_BACKGROUND,
|
||||
defaultValue = SettingsKeys.DEFAULT_LONG_POLL_IN_BACKGROUND,
|
||||
title = UiText.Resource(UiR.string.settings_features_long_poll_in_background_title),
|
||||
text = UiText.Resource(UiR.string.settings_features_long_poll_in_background_summary)
|
||||
)
|
||||
val experimentalUseBlur = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_USE_BLUR,
|
||||
defaultValue = SettingsKeys.DEFAULT_USE_BLUR,
|
||||
title = UiText.Simple("Use blur"),
|
||||
text = UiText.Simple("Adds blur wherever possible\nWorks on android 12 and newer"),
|
||||
)
|
||||
val experimentalShowTimeInActionMessages = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_SHOW_TIME_IN_ACTION_MESSAGES,
|
||||
defaultValue = SettingsKeys.DEFAULT_SHOW_TIME_IN_ACTION_MESSAGES,
|
||||
title = UiText.Simple("Show time in action messages")
|
||||
)
|
||||
|
||||
val debugTitle = SettingsItem.Title(
|
||||
key = "debug",
|
||||
title = UiText.Resource(UiR.string.settings_debug_title)
|
||||
@@ -389,34 +414,6 @@ class SettingsViewModelImpl(
|
||||
title = UiText.Simple("Show alert after crash"),
|
||||
text = UiText.Simple("Shows alert dialog with stacktrace after app crashed\n(it will be not shown if you perform crash manually)")
|
||||
)
|
||||
val debugLongPollBackground = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_FEATURES_LONG_POLL_IN_BACKGROUND,
|
||||
defaultValue = SettingsKeys.DEFAULT_VALUE_FEATURES_LONG_POLL_IN_BACKGROUND,
|
||||
title = UiText.Resource(UiR.string.settings_features_long_poll_in_background_title),
|
||||
text = UiText.Resource(UiR.string.settings_features_long_poll_in_background_summary)
|
||||
)
|
||||
val debugUseBlur = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_APPEARANCE_USE_BLUR,
|
||||
defaultValue = SettingsKeys.DEFAULT_VALUE_KEY_APPEARANCE_USE_BLUR,
|
||||
title = UiText.Simple("[WIP] Use blur"),
|
||||
text = UiText.Simple("Adds blur wherever possible\nWorks on android 12 and newer"),
|
||||
)
|
||||
val debugShowEmojiButton = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_SHOW_EMOJI_BUTTON,
|
||||
title = UiText.Simple("Show emoji button"),
|
||||
text = UiText.Simple("Show emoji button in chat panel"),
|
||||
defaultValue = SettingsKeys.DEFAULT_VALUE_KEY_SHOW_EMOJI_BUTTON
|
||||
)
|
||||
val debugShowTimeInActionMessages = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_APPEARANCE_SHOW_TIME_IN_ACTION_MESSAGES,
|
||||
defaultValue = SettingsKeys.DEFAULT_VALUE_APPEARANCE_SHOW_TIME_IN_ACTION_MESSAGES,
|
||||
title = UiText.Simple("Show time in action messages")
|
||||
)
|
||||
val debugEnableHaptic = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_DEBUG_ENABLE_HAPTIC,
|
||||
defaultValue = SettingsKeys.DEFAULT_DEBUG_ENABLE_HAPTIC,
|
||||
title = UiText.Simple("Enable haptic")
|
||||
)
|
||||
|
||||
val logLevelValues = listOf(
|
||||
LogLevel.NONE to UiText.Simple("None"),
|
||||
@@ -440,12 +437,6 @@ class SettingsViewModelImpl(
|
||||
}
|
||||
}
|
||||
|
||||
val debugUseSystemFont = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_DEBUG_USE_SYSTEM_FONT,
|
||||
defaultValue = SettingsKeys.DEFAULT_DEBUG_USE_SYSTEM_FONT,
|
||||
title = UiText.Simple("Use system font")
|
||||
)
|
||||
|
||||
val debugHideDebugList = SettingsItem.TitleText(
|
||||
key = SettingsKeys.KEY_DEBUG_HIDE_DEBUG_LIST,
|
||||
title = UiText.Simple("Hide debug list")
|
||||
@@ -458,7 +449,8 @@ class SettingsViewModelImpl(
|
||||
val generalList = listOf(
|
||||
generalTitle,
|
||||
generalUseContactNames,
|
||||
generalEnablePullToRefresh
|
||||
generalShowEmojiButton,
|
||||
generalEnableHaptic
|
||||
)
|
||||
val appearanceList = listOf(
|
||||
appearanceTitle,
|
||||
@@ -466,6 +458,7 @@ class SettingsViewModelImpl(
|
||||
appearanceDarkTheme,
|
||||
appearanceUseAmoledDarkTheme,
|
||||
appearanceUseDynamicColors,
|
||||
appearanceUseSystemFont,
|
||||
appearanceLanguage
|
||||
)
|
||||
val featuresList = listOf(
|
||||
@@ -476,18 +469,18 @@ class SettingsViewModelImpl(
|
||||
activityTitle,
|
||||
visibilitySendOnlineStatus,
|
||||
)
|
||||
val experimentalList = listOf(
|
||||
experimentalTitle,
|
||||
experimentalLongPollBackground,
|
||||
experimentalShowTimeInActionMessages,
|
||||
experimentalUseBlur
|
||||
)
|
||||
val debugList = mutableListOf<SettingsItem<*>>()
|
||||
listOf(
|
||||
debugTitle,
|
||||
debugPerformCrash,
|
||||
debugShowCrashAlert,
|
||||
debugLongPollBackground,
|
||||
debugUseBlur,
|
||||
debugShowEmojiButton,
|
||||
debugShowTimeInActionMessages,
|
||||
debugEnableHaptic,
|
||||
debugNetworkLogLevel,
|
||||
debugUseSystemFont
|
||||
).forEach(debugList::add)
|
||||
|
||||
debugList += debugHideDebugList
|
||||
@@ -499,6 +492,7 @@ class SettingsViewModelImpl(
|
||||
appearanceList,
|
||||
featuresList,
|
||||
visibilityList,
|
||||
experimentalList,
|
||||
debugList,
|
||||
).forEach(settingsList::addAll)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package dev.meloda.fast.settings.di
|
||||
|
||||
import dev.meloda.fast.settings.SettingsViewModel
|
||||
import dev.meloda.fast.settings.SettingsViewModelImpl
|
||||
import org.koin.androidx.viewmodel.dsl.viewModelOf
|
||||
import org.koin.core.module.dsl.viewModelOf
|
||||
import org.koin.dsl.bind
|
||||
import org.koin.dsl.module
|
||||
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ fun SettingsScreen(
|
||||
|
||||
LaunchedEffect(hapticType) {
|
||||
if (hapticType != null) {
|
||||
if (AppSettings.Debug.enableHaptic) {
|
||||
if (AppSettings.General.enableHaptic) {
|
||||
view.performHapticFeedback(hapticType.getHaptic())
|
||||
}
|
||||
onHapticPerformed()
|
||||
|
||||
Reference in New Issue
Block a user