mirror of
https://github.com/mihonapp/mihon.git
synced 2025-02-08 16:18:51 +01:00
Settings Grouping
This commit is contained in:
parent
ead1b82fd4
commit
60d0799d97
@ -28,14 +28,26 @@ object SettingsSecurityScreen : SearchableSettings {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun getPreferences(): List<Preference> {
|
override fun getPreferences(): List<Preference> {
|
||||||
val context = LocalContext.current
|
|
||||||
val securityPreferences = remember { Injekt.get<SecurityPreferences>() }
|
val securityPreferences = remember { Injekt.get<SecurityPreferences>() }
|
||||||
val authSupported = remember { context.isAuthenticationSupported() }
|
return listOf(
|
||||||
|
getSecurityGroup(securityPreferences),
|
||||||
|
getFirebaseGroup(securityPreferences),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun getSecurityGroup(
|
||||||
|
securityPreferences: SecurityPreferences
|
||||||
|
): Preference.PreferenceGroup {
|
||||||
|
val context = LocalContext.current
|
||||||
|
val authSupported = remember { context.isAuthenticationSupported() }
|
||||||
val useAuthPref = securityPreferences.useAuthenticator()
|
val useAuthPref = securityPreferences.useAuthenticator()
|
||||||
val useAuth by useAuthPref.collectAsState()
|
val useAuth by useAuthPref.collectAsState()
|
||||||
|
|
||||||
return listOf(
|
return Preference.PreferenceGroup(
|
||||||
|
title = stringResource(MR.strings.pref_security),
|
||||||
|
preferenceItems = persistentListOf(
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
pref = useAuthPref,
|
pref = useAuthPref,
|
||||||
title = stringResource(MR.strings.lock_with_biometrics),
|
title = stringResource(MR.strings.lock_with_biometrics),
|
||||||
@ -65,16 +77,7 @@ object SettingsSecurityScreen : SearchableSettings {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
|
||||||
pref = securityPreferences.crashlytics(),
|
|
||||||
title = stringResource(MR.strings.onboarding_permission_crashlytics),
|
|
||||||
subtitle = stringResource(MR.strings.onboarding_permission_crashlytics_description),
|
|
||||||
),
|
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
|
||||||
pref = securityPreferences.analytics(),
|
|
||||||
title = stringResource(MR.strings.onboarding_permission_analytics),
|
|
||||||
subtitle = stringResource(MR.strings.onboarding_permission_analytics_description),
|
|
||||||
),
|
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
pref = securityPreferences.hideNotificationContent(),
|
pref = securityPreferences.hideNotificationContent(),
|
||||||
title = stringResource(MR.strings.hide_notification_content),
|
title = stringResource(MR.strings.hide_notification_content),
|
||||||
@ -87,10 +90,34 @@ object SettingsSecurityScreen : SearchableSettings {
|
|||||||
.toImmutableMap(),
|
.toImmutableMap(),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.InfoPreference(stringResource(MR.strings.secure_screen_summary)),
|
Preference.PreferenceItem.InfoPreference(stringResource(MR.strings.secure_screen_summary)),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun getFirebaseGroup(
|
||||||
|
securityPreferences: SecurityPreferences
|
||||||
|
): Preference.PreferenceGroup {
|
||||||
|
return Preference.PreferenceGroup(
|
||||||
|
title = stringResource(MR.strings.pref_firebase),
|
||||||
|
preferenceItems = persistentListOf(
|
||||||
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
|
pref = securityPreferences.crashlytics(),
|
||||||
|
title = stringResource(MR.strings.onboarding_permission_crashlytics),
|
||||||
|
subtitle = stringResource(MR.strings.onboarding_permission_crashlytics_description),
|
||||||
|
),
|
||||||
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
|
pref = securityPreferences.analytics(),
|
||||||
|
title = stringResource(MR.strings.onboarding_permission_analytics),
|
||||||
|
subtitle = stringResource(MR.strings.onboarding_permission_analytics_description),
|
||||||
|
),
|
||||||
|
Preference.PreferenceItem.InfoPreference(stringResource(MR.strings.firebase_summary)),
|
||||||
|
),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private val LockAfterValues = persistentListOf(
|
private val LockAfterValues = persistentListOf(
|
||||||
0, // Always
|
0, // Always
|
||||||
1,
|
1,
|
||||||
|
@ -246,6 +246,9 @@
|
|||||||
<string name="pref_app_language">App language</string>
|
<string name="pref_app_language">App language</string>
|
||||||
|
|
||||||
<string name="pref_category_security">Security and privacy</string>
|
<string name="pref_category_security">Security and privacy</string>
|
||||||
|
<string name="pref_security">Security</string>
|
||||||
|
<string name="pref_firebase">Analytics and Crash logs</string>
|
||||||
|
|
||||||
<string name="lock_with_biometrics">Require unlock</string>
|
<string name="lock_with_biometrics">Require unlock</string>
|
||||||
<string name="lock_when_idle">Lock when idle</string>
|
<string name="lock_when_idle">Lock when idle</string>
|
||||||
<string name="lock_always">Always</string>
|
<string name="lock_always">Always</string>
|
||||||
@ -253,6 +256,7 @@
|
|||||||
<string name="hide_notification_content">Hide notification content</string>
|
<string name="hide_notification_content">Hide notification content</string>
|
||||||
<string name="secure_screen">Secure screen</string>
|
<string name="secure_screen">Secure screen</string>
|
||||||
<string name="secure_screen_summary">Secure screen hides app contents when switching apps and block screenshots</string>
|
<string name="secure_screen_summary">Secure screen hides app contents when switching apps and block screenshots</string>
|
||||||
|
<string name="firebase_summary">Sending crash logs and analytics will allow us to identify and fix issues, improve performance, and make future updates more relevant to your needs</string>
|
||||||
|
|
||||||
<string name="pref_category_nsfw_content">NSFW (18+) sources</string>
|
<string name="pref_category_nsfw_content">NSFW (18+) sources</string>
|
||||||
<string name="pref_show_nsfw_source">Show in sources and extensions lists</string>
|
<string name="pref_show_nsfw_source">Show in sources and extensions lists</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user