diff --git a/app/src/main/kotlin/com/meloda/app/fast/MainViewModel.kt b/app/src/main/kotlin/com/meloda/app/fast/MainViewModel.kt index 5d8b82c3..1b31d419 100644 --- a/app/src/main/kotlin/com/meloda/app/fast/MainViewModel.kt +++ b/app/src/main/kotlin/com/meloda/app/fast/MainViewModel.kt @@ -65,8 +65,8 @@ class MainViewModelImpl( ) override val startOnlineService = MutableStateFlow( SettingsController.getBoolean( - SettingsKeys.KEY_VISIBILITY_SEND_ONLINE_STATUS, - SettingsKeys.DEFAULT_VALUE_KEY_VISIBILITY_SEND_ONLINE_STATUS + SettingsKeys.KEY_ACTIVITY_SEND_ONLINE_STATUS, + SettingsKeys.DEFAULT_VALUE_KEY_ACTIVITY_SEND_ONLINE_STATUS ) ) diff --git a/core/datastore/src/main/kotlin/com/meloda/app/fast/datastore/SettingsKeys.kt b/core/datastore/src/main/kotlin/com/meloda/app/fast/datastore/SettingsKeys.kt index 1f11ab5b..023ce664 100644 --- a/core/datastore/src/main/kotlin/com/meloda/app/fast/datastore/SettingsKeys.kt +++ b/core/datastore/src/main/kotlin/com/meloda/app/fast/datastore/SettingsKeys.kt @@ -27,19 +27,17 @@ object SettingsKeys { const val KEY_APPEARANCE_BLUR = "appearance_blur" const val DEFAULT_VALUE_KEY_APPEARANCE_BLUR = false - const val KEY_FEATURES_HIDE_KEYBOARD_ON_SCROLL = "features_hide_keyboard_on_scroll" const val KEY_FEATURES_FAST_TEXT = "features_fast_text" const val DEFAULT_VALUE_FEATURES_FAST_TEXT = "¯\\_(ツ)_/¯" const val KEY_FEATURES_LONG_POLL_IN_BACKGROUND = "features_lp_background" const val DEFAULT_VALUE_FEATURES_LONG_POLL_IN_BACKGROUND = false - const val KEY_VISIBILITY_SEND_ONLINE_STATUS = "visibility_send_online_status" - const val DEFAULT_VALUE_KEY_VISIBILITY_SEND_ONLINE_STATUS = false + const val KEY_ACTIVITY_SEND_ONLINE_STATUS = "activity_send_online_status" + const val DEFAULT_VALUE_KEY_ACTIVITY_SEND_ONLINE_STATUS = false const val KEY_DEBUG_PERFORM_CRASH = "debug_perform_crash" const val KEY_DEBUG_SHOW_CRASH_ALERT = "debug_show_crash_alert" const val KEY_DEBUG_HIDE_DEBUG_LIST = "debug_hide_debug_list" - const val KEY_SHOW_EXACT_TIME_ON_TIME_STAMP = "wip_show_exact_time_on_time_stamp" const val KEY_SHOW_NAME_IN_BUBBLES = "debug_show_title_in_bubbles" const val KEY_SHOW_DATE_UNDER_BUBBLES = "debug_show_date_under_bubbles" const val KEY_ENABLE_ANIMATIONS_IN_MESSAGES = "debug_enable_animations_in_messages" diff --git a/core/datastore/src/main/kotlin/com/meloda/app/fast/datastore/UserSettings.kt b/core/datastore/src/main/kotlin/com/meloda/app/fast/datastore/UserSettings.kt index c5ff9f9d..40b4014f 100644 --- a/core/datastore/src/main/kotlin/com/meloda/app/fast/datastore/UserSettings.kt +++ b/core/datastore/src/main/kotlin/com/meloda/app/fast/datastore/UserSettings.kt @@ -50,8 +50,8 @@ class UserSettingsImpl( ) override val online = MutableStateFlow( SettingsController.getBoolean( - SettingsKeys.KEY_VISIBILITY_SEND_ONLINE_STATUS, - SettingsKeys.DEFAULT_VALUE_KEY_VISIBILITY_SEND_ONLINE_STATUS + SettingsKeys.KEY_ACTIVITY_SEND_ONLINE_STATUS, + SettingsKeys.DEFAULT_VALUE_KEY_ACTIVITY_SEND_ONLINE_STATUS ) ) diff --git a/core/designsystem/src/main/res/values-ru/strings.xml b/core/designsystem/src/main/res/values-ru/strings.xml index 8857d455..422e4f33 100644 --- a/core/designsystem/src/main/res/values-ru/strings.xml +++ b/core/designsystem/src/main/res/values-ru/strings.xml @@ -171,4 +171,21 @@ Все В сети Нет элементов + Аккаунт + Выйти из аккаунта + Выход из аккаунта удалит все связанные с текущим аккаунтом данные + Основное + Использовать имена контактов + Приложение будет использовать доступные имена контактов для пользователей + Внешний вид + Многострочные заголовки и сообщения + Заголовок чата и текст сообщения смогут занимать несколько строчек + Фичи + Fast текст + [WIP] LongPoll в фоне + Ваши сообщения будут обновляться, даже если приложение находится в фоне + Активность + Быть «в сети» + Статус «в сети» будет отправляться каждые 5 минут + Отладка diff --git a/core/designsystem/src/main/res/values/strings.xml b/core/designsystem/src/main/res/values/strings.xml index 30d696da..757330ef 100644 --- a/core/designsystem/src/main/res/values/strings.xml +++ b/core/designsystem/src/main/res/values/strings.xml @@ -229,5 +229,22 @@ All Online No items + Account + Log out + Log out from account and delete all local data related to this account + General + Use contact names + App will use available contact names for users + Appearance + Multiline titles and messages + The title of the conversation and the text of the message can take up multiple lines + Features + Fast text + [WIP] LongPoll in background + Your messages will be updates even when app is not on the screen + Activity + Send online status + Online status will be sent every five minutes + Debug diff --git a/feature/settings/src/main/kotlin/com/meloda/app/fast/settings/SettingsViewModel.kt b/feature/settings/src/main/kotlin/com/meloda/app/fast/settings/SettingsViewModel.kt index b8527ab8..652c96a3 100644 --- a/feature/settings/src/main/kotlin/com/meloda/app/fast/settings/SettingsViewModel.kt +++ b/feature/settings/src/main/kotlin/com/meloda/app/fast/settings/SettingsViewModel.kt @@ -137,7 +137,7 @@ class SettingsViewModelImpl( override fun onSettingsItemLongClicked(key: String) { when (key) { - SettingsKeys.KEY_VISIBILITY_SEND_ONLINE_STATUS -> { + SettingsKeys.KEY_ACTIVITY_SEND_ONLINE_STATUS -> { val showDebugCategory = isDebugSettingsShown() if (showDebugCategory) return @@ -190,38 +190,38 @@ class SettingsViewModelImpl( val accountVisible = UserConfig.isLoggedIn() val accountTitle = SettingsItem.Title.build( key = SettingsKeys.KEY_ACCOUNT, - title = UiText.Simple("Account") + title = UiText.Resource(UiR.string.settings_account_title) ) { isVisible = accountVisible } val accountLogOut = SettingsItem.TitleSummary.build( key = SettingsKeys.KEY_ACCOUNT_LOGOUT, - title = UiText.Simple("Log out"), - summary = UiText.Simple("Log out from account and delete all local data related to this account") + title = UiText.Resource(UiR.string.settings_account_logout_title), + summary = UiText.Resource(UiR.string.settings_account_logout_summary) ) { isVisible = accountVisible } val generalTitle = SettingsItem.Title.build( key = SettingsKeys.KEY_GENERAL, - title = UiText.Simple("General") + title = UiText.Resource(UiR.string.settings_general_title) ) val generalUseContactNames = SettingsItem.Switch.build( key = SettingsKeys.KEY_USE_CONTACT_NAMES, - title = UiText.Simple("Use contact names"), - summary = UiText.Simple("App will use available contact names for users"), + title = UiText.Resource(UiR.string.settings_general_contact_names_title), + summary = UiText.Resource(UiR.string.settings_general_contact_names_summary), defaultValue = SettingsKeys.DEFAULT_VALUE_USE_CONTACT_NAMES ) val appearanceTitle = SettingsItem.Title.build( key = SettingsKeys.KEY_APPEARANCE, - title = UiText.Simple("Appearance") + title = UiText.Resource(UiR.string.settings_appearance_title) ) val appearanceMultiline = SettingsItem.Switch.build( key = SettingsKeys.KEY_APPEARANCE_MULTILINE, defaultValue = SettingsKeys.DEFAULT_VALUE_MULTILINE, - title = UiText.Simple("Multiline titles and messages"), - summary = UiText.Simple("The title of the dialog and the text of the message can take up two lines") + title = UiText.Resource(UiR.string.settings_appearance_multiline_title), + summary = UiText.Resource(UiR.string.settings_appearance_multiline_summary) ) val darkThemeValues = listOf( @@ -271,17 +271,11 @@ class SettingsViewModelImpl( val featuresTitle = SettingsItem.Title.build( key = "features", - title = UiText.Simple("Features") - ) - val featuresHideKeyboardOnScroll = SettingsItem.Switch.build( - key = SettingsKeys.KEY_FEATURES_HIDE_KEYBOARD_ON_SCROLL, - defaultValue = true, - title = UiText.Simple("Hide keyboard on scroll"), - summary = UiText.Simple("Hides keyboard when you scrolling messages up in messages history screen") + title = UiText.Resource(UiR.string.settings_features_title) ) val featuresFastText = SettingsItem.TextField.build( key = SettingsKeys.KEY_FEATURES_FAST_TEXT, - title = UiText.Simple("Fast text"), + title = UiText.Resource(UiR.string.settings_features_fast_text_title), defaultValue = SettingsKeys.DEFAULT_VALUE_FEATURES_FAST_TEXT ).apply { summaryProvider = SettingsItem.SummaryProvider { settingsItem -> @@ -291,29 +285,27 @@ class SettingsViewModelImpl( ) } } - val featuresLongPollBackground = SettingsItem.Switch.build( + val debugLongPollBackground = SettingsItem.Switch.build( key = SettingsKeys.KEY_FEATURES_LONG_POLL_IN_BACKGROUND, defaultValue = SettingsKeys.DEFAULT_VALUE_FEATURES_LONG_POLL_IN_BACKGROUND, - title = UiText.Simple("LongPoll in background"), - summary = UiText.Simple( - "Your messages will be updates even when app is not on the screen.\nApp will be restarted" - ) + title = UiText.Resource(UiR.string.settings_features_long_poll_in_background_title), + summary = UiText.Resource(UiR.string.settings_features_long_poll_in_background_summary) ) - val visibilityTitle = SettingsItem.Title.build( - key = "visibility", - title = UiText.Simple("Visibility") + val activityTitle = SettingsItem.Title.build( + key = "activity", + title = UiText.Resource(UiR.string.settings_activity_title) ) val visibilitySendOnlineStatus = SettingsItem.Switch.build( - key = SettingsKeys.KEY_VISIBILITY_SEND_ONLINE_STATUS, - defaultValue = SettingsKeys.DEFAULT_VALUE_KEY_VISIBILITY_SEND_ONLINE_STATUS, - title = UiText.Simple("Send online status"), - summary = UiText.Simple("Online status will be sent every five minutes") + key = SettingsKeys.KEY_ACTIVITY_SEND_ONLINE_STATUS, + defaultValue = SettingsKeys.DEFAULT_VALUE_KEY_ACTIVITY_SEND_ONLINE_STATUS, + title = UiText.Resource(UiR.string.settings_activity_send_online_title), + summary = UiText.Resource(UiR.string.settings_activity_send_online_summary) ) val debugTitle = SettingsItem.Title.build( key = "debug", - title = UiText.Simple("Debug") + title = UiText.Resource(UiR.string.settings_debug_title) ) val debugPerformCrash = SettingsItem.TitleSummary.build( key = SettingsKeys.KEY_DEBUG_PERFORM_CRASH, @@ -326,12 +318,6 @@ class SettingsViewModelImpl( title = UiText.Simple("Show alert after crash"), summary = UiText.Simple("Shows alert dialog with stacktrace after app crashed\n(it will be not shown if you perform crash manually)") ) - val debugShowExactTimeOnTimeStamp = SettingsItem.Switch.build( - key = SettingsKeys.KEY_SHOW_EXACT_TIME_ON_TIME_STAMP, - title = UiText.Simple("[WIP] Show exact time on time stamp"), - summary = UiText.Simple("Shows hours and minutes on time stamp in messages history"), - defaultValue = false - ) val debugUseBlur = SettingsItem.Switch.build( key = SettingsKeys.KEY_APPEARANCE_BLUR, defaultValue = SettingsKeys.DEFAULT_VALUE_KEY_APPEARANCE_BLUR, @@ -368,12 +354,10 @@ class SettingsViewModelImpl( ) val featuresList = listOf( featuresTitle, - featuresHideKeyboardOnScroll, - featuresFastText, - featuresLongPollBackground + featuresFastText ) val visibilityList = listOf( - visibilityTitle, + activityTitle, visibilitySendOnlineStatus, ) val debugList = mutableListOf>() @@ -381,7 +365,7 @@ class SettingsViewModelImpl( debugTitle, debugPerformCrash, debugShowCrashAlert, - debugShowExactTimeOnTimeStamp, + debugLongPollBackground, debugUseBlur, debugShowEmojiButton ).forEach(debugList::add) diff --git a/feature/settings/src/main/kotlin/com/meloda/app/fast/settings/presentation/SettingsScreen.kt b/feature/settings/src/main/kotlin/com/meloda/app/fast/settings/presentation/SettingsScreen.kt index ccf8c59f..72c60a92 100644 --- a/feature/settings/src/main/kotlin/com/meloda/app/fast/settings/presentation/SettingsScreen.kt +++ b/feature/settings/src/main/kotlin/com/meloda/app/fast/settings/presentation/SettingsScreen.kt @@ -147,7 +147,7 @@ fun SettingsScreen( userSettings.setLongPollBackground(isUsing) } - SettingsKeys.KEY_VISIBILITY_SEND_ONLINE_STATUS -> { + SettingsKeys.KEY_ACTIVITY_SEND_ONLINE_STATUS -> { val isUsing = newValue as? Boolean ?: false userSettings.setOnline(isUsing) }