mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2024-12-17 17:20:21 +01:00
ui: reset hints in dev tools (#4613)
* ui: reset hints in dev tools * fix disabled, icon, remove damage * icon
This commit is contained in:
+10
@@ -227,6 +227,16 @@ class AppPreferences {
|
||||
|
||||
val oneHandUI = mkBoolPreference(SHARED_PREFS_ONE_HAND_UI, appPlatform.isAndroid)
|
||||
|
||||
val hintPreferences: List<Pair<SharedPreference<Boolean>, Boolean>> = listOf(
|
||||
laNoticeShown to false,
|
||||
// SHARED_PREFS_ONE_HAND_UI_CARD_SHOWN to false,
|
||||
liveMessageAlertShown to false,
|
||||
showHiddenProfilesNotice to true,
|
||||
showMuteProfileAlert to true,
|
||||
showDeleteConversationNotice to true,
|
||||
showDeleteContactNotice to true,
|
||||
)
|
||||
|
||||
private fun mkIntPreference(prefName: String, default: Int) =
|
||||
SharedPreference(
|
||||
get = fun() = settings.getInt(prefName, default),
|
||||
|
||||
+3
@@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalUriHandler
|
||||
import chat.simplex.common.model.*
|
||||
@@ -30,9 +31,11 @@ fun DeveloperView(
|
||||
AppBarTitle(stringResource(MR.strings.settings_developer_tools))
|
||||
val developerTools = m.controller.appPrefs.developerTools
|
||||
val devTools = remember { developerTools.state }
|
||||
val unchangedHints = mutableStateOf(unchangedHintPreferences())
|
||||
SectionView {
|
||||
InstallTerminalAppItem(uriHandler)
|
||||
ChatConsoleItem { withAuth(generalGetString(MR.strings.auth_open_chat_console), generalGetString(MR.strings.auth_log_in_using_credential), showCustomModal { it, close -> TerminalView(it, close) }) }
|
||||
ResetHintsItem(unchangedHints)
|
||||
SettingsPreferenceItem(painterResource(MR.images.ic_code), stringResource(MR.strings.show_developer_options), developerTools)
|
||||
SectionTextFooter(
|
||||
generalGetString(if (devTools.value) MR.strings.show_dev_options else MR.strings.hide_dev_options) + " " +
|
||||
|
||||
+25
@@ -330,6 +330,31 @@ fun ChatLockItem(
|
||||
}
|
||||
}
|
||||
|
||||
@Composable fun ResetHintsItem(unchangedHints: MutableState<Boolean>) {
|
||||
SectionItemView({
|
||||
resetHintPreferences()
|
||||
unchangedHints.value = true
|
||||
}, disabled = unchangedHints.value) {
|
||||
Icon(
|
||||
painter = painterResource(MR.images.ic_lightbulb),
|
||||
contentDescription = "Lightbulb",
|
||||
tint = MaterialTheme.colors.secondary,
|
||||
)
|
||||
TextIconSpaced()
|
||||
Text(generalGetString(MR.strings.reset_all_hints), color = if (unchangedHints.value) MaterialTheme.colors.secondary else MaterialTheme.colors.primary)
|
||||
}
|
||||
}
|
||||
|
||||
private fun resetHintPreferences() {
|
||||
for ((pref, def) in appPreferences.hintPreferences) {
|
||||
pref.set(def)
|
||||
}
|
||||
}
|
||||
|
||||
fun unchangedHintPreferences(): Boolean = appPreferences.hintPreferences.all { (pref, def) ->
|
||||
pref.state.value == def
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun AppVersionItem(showVersion: () -> Unit) {
|
||||
SectionItemViewWithIcon(showVersion) { AppVersionText() }
|
||||
|
||||
@@ -739,6 +739,7 @@
|
||||
<string name="xftp_servers_other">Other XFTP servers</string>
|
||||
<string name="subscription_percentage">Show percentage</string>
|
||||
<string name="install_simplex_chat_for_terminal">Install SimpleX Chat for terminal</string>
|
||||
<string name="reset_all_hints">Reset all hints</string>
|
||||
<string name="star_on_github">Star on GitHub</string>
|
||||
<string name="contribute">Contribute</string>
|
||||
<string name="rate_the_app">Rate the app</string>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368">
|
||||
<path
|
||||
d="M480-84.5q-33.5 0-56.75-23.25T400-164.5h160q0 33.5-23.25 56.75T480-84.5Zm-160-143V-285h320v57.5H320Zm4.5-119.5q-65-42.5-102.75-106T184-595.87q0-120.39 87.76-208.26 87.77-87.87 208-87.87Q600-892 688-804.13q88 87.87 88 208.26 0 79.37-37.25 142.87T635.5-347h-311Zm21.32-57.5h269.3q47.88-32 75.63-82.51 27.75-50.51 27.75-108.95 0-98.04-70.04-168.29-70.04-70.25-168.37-70.25-98.34 0-168.46 70.12-70.13 70.12-70.13 168.57 0 58.49 28 108.9 28 50.41 76.32 82.41Zm134.18 0Z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 604 B |
Reference in New Issue
Block a user