mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-15 18:59:12 +03:00
Show CrossSigning info even if not developer mode
This commit is contained in:
parent
ce2f4e163d
commit
7ac5f58f32
3 changed files with 26 additions and 49 deletions
|
@ -58,23 +58,10 @@ class VectorSettingsSecurityPrivacyFragment @Inject constructor(
|
|||
override var titleRes = R.string.settings_security_and_privacy
|
||||
override val preferenceXmlRes = R.xml.vector_settings_security_privacy
|
||||
|
||||
// devices: device IDs and device names
|
||||
private val mDevicesNameList: MutableList<DeviceInfo> = mutableListOf()
|
||||
|
||||
private var mMyDeviceInfo: DeviceInfo? = null
|
||||
|
||||
// cryptography
|
||||
private val mCryptographyCategory by lazy {
|
||||
findPreference<PreferenceCategory>(VectorPreferences.SETTINGS_CRYPTOGRAPHY_PREFERENCE_KEY)!!
|
||||
}
|
||||
// cryptography manage
|
||||
private val mCryptographyManageCategory by lazy {
|
||||
findPreference<PreferenceCategory>(VectorPreferences.SETTINGS_CRYPTOGRAPHY_MANAGE_PREFERENCE_KEY)!!
|
||||
}
|
||||
// displayed pushers
|
||||
private val mPushersSettingsCategory by lazy {
|
||||
findPreference<PreferenceCategory>(VectorPreferences.SETTINGS_NOTIFICATIONS_TARGETS_PREFERENCE_KEY)!!
|
||||
}
|
||||
|
||||
private val mCrossSigningStatePreference by lazy {
|
||||
findPreference<VectorPreference>(VectorPreferences.SETTINGS_ENCRYPTION_CROSS_SIGNING_PREFERENCE_KEY)!!
|
||||
|
@ -106,7 +93,6 @@ class VectorSettingsSecurityPrivacyFragment @Inject constructor(
|
|||
// My device name may have been updated
|
||||
refreshMyDevice()
|
||||
refreshXSigningStatus()
|
||||
mCryptographyCategory.isVisible = vectorPreferences.developerMode()
|
||||
}
|
||||
|
||||
override fun bindPref() {
|
||||
|
@ -133,7 +119,6 @@ class VectorSettingsSecurityPrivacyFragment @Inject constructor(
|
|||
}
|
||||
|
||||
private fun refreshXSigningStatus() {
|
||||
if (vectorPreferences.developerMode()) {
|
||||
val crossSigningKeys = session.cryptoService().crossSigningService().getMyCrossSigningKeys()
|
||||
val xSigningIsEnableInAccount = crossSigningKeys != null
|
||||
val xSigningKeysAreTrusted = session.cryptoService().crossSigningService().checkUserTrust(session.myUserId).isVerified()
|
||||
|
@ -154,9 +139,6 @@ class VectorSettingsSecurityPrivacyFragment @Inject constructor(
|
|||
}
|
||||
|
||||
mCrossSigningStatePreference.isVisible = true
|
||||
} else {
|
||||
mCrossSigningStatePreference.isVisible = false
|
||||
}
|
||||
}
|
||||
|
||||
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
|
||||
|
@ -349,15 +331,6 @@ class VectorSettingsSecurityPrivacyFragment @Inject constructor(
|
|||
// Cryptography
|
||||
// ==============================================================================================================
|
||||
|
||||
private fun removeCryptographyPreference() {
|
||||
preferenceScreen.let {
|
||||
it.removePreference(mCryptographyCategory)
|
||||
|
||||
// Also remove keys management section
|
||||
it.removePreference(mCryptographyManageCategory)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the cryptography preference section.
|
||||
*
|
||||
|
|
|
@ -24,13 +24,15 @@ import im.vector.riotx.core.ui.list.genericItem
|
|||
import im.vector.riotx.core.ui.list.genericItemWithValue
|
||||
import im.vector.riotx.core.utils.DimensionConverter
|
||||
import im.vector.riotx.features.crypto.verification.epoxy.bottomSheetVerificationActionItem
|
||||
import im.vector.riotx.features.settings.VectorPreferences
|
||||
import me.gujun.android.span.span
|
||||
import javax.inject.Inject
|
||||
|
||||
class CrossSigningEpoxyController @Inject constructor(
|
||||
private val stringProvider: StringProvider,
|
||||
private val colorProvider: ColorProvider,
|
||||
private val dimensionConverter: DimensionConverter
|
||||
private val dimensionConverter: DimensionConverter,
|
||||
private val vectorPreferences: VectorPreferences
|
||||
) : TypedEpoxyController<CrossSigningSettingsViewState>() {
|
||||
|
||||
interface InteractionListener {
|
||||
|
@ -49,7 +51,7 @@ class CrossSigningEpoxyController @Inject constructor(
|
|||
titleIconResourceId(R.drawable.ic_shield_trusted)
|
||||
title(stringProvider.getString(R.string.encryption_information_dg_xsigning_complete))
|
||||
}
|
||||
if (!data.isUploadingKeys) {
|
||||
if (vectorPreferences.developerMode() && !data.isUploadingKeys) {
|
||||
bottomSheetVerificationActionItem {
|
||||
id("resetkeys")
|
||||
title("Reset keys")
|
||||
|
@ -68,14 +70,16 @@ class CrossSigningEpoxyController @Inject constructor(
|
|||
title(stringProvider.getString(R.string.encryption_information_dg_xsigning_trusted))
|
||||
}
|
||||
if (!data.isUploadingKeys) {
|
||||
bottomSheetVerificationActionItem {
|
||||
id("resetkeys")
|
||||
title("Reset keys")
|
||||
titleColor(colorProvider.getColor(R.color.riotx_destructive_accent))
|
||||
iconRes(R.drawable.ic_arrow_right)
|
||||
iconColor(colorProvider.getColor(R.color.riotx_destructive_accent))
|
||||
listener {
|
||||
interactionListener?.onResetCrossSigningKeys()
|
||||
if (vectorPreferences.developerMode()) {
|
||||
bottomSheetVerificationActionItem {
|
||||
id("resetkeys")
|
||||
title("Reset keys")
|
||||
titleColor(colorProvider.getColor(R.color.riotx_destructive_accent))
|
||||
iconRes(R.drawable.ic_arrow_right)
|
||||
iconColor(colorProvider.getColor(R.color.riotx_destructive_accent))
|
||||
listener {
|
||||
interactionListener?.onResetCrossSigningKeys()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,14 +110,16 @@ class CrossSigningEpoxyController @Inject constructor(
|
|||
interactionListener?.verifySession()
|
||||
}
|
||||
}
|
||||
bottomSheetVerificationActionItem {
|
||||
id("resetkeys")
|
||||
title("Reset keys")
|
||||
titleColor(colorProvider.getColor(R.color.riotx_destructive_accent))
|
||||
iconRes(R.drawable.ic_arrow_right)
|
||||
iconColor(colorProvider.getColor(R.color.riotx_destructive_accent))
|
||||
listener {
|
||||
interactionListener?.onResetCrossSigningKeys()
|
||||
if (vectorPreferences.developerMode()) {
|
||||
bottomSheetVerificationActionItem {
|
||||
id("resetkeys")
|
||||
title("Reset keys")
|
||||
titleColor(colorProvider.getColor(R.color.riotx_destructive_accent))
|
||||
iconRes(R.drawable.ic_arrow_right)
|
||||
iconColor(colorProvider.getColor(R.color.riotx_destructive_accent))
|
||||
listener {
|
||||
interactionListener?.onResetCrossSigningKeys()
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -121,7 +127,7 @@ class CrossSigningEpoxyController @Inject constructor(
|
|||
id("not")
|
||||
title(stringProvider.getString(R.string.encryption_information_dg_xsigning_disabled))
|
||||
}
|
||||
if (!data.isUploadingKeys) {
|
||||
if (vectorPreferences.developerMode() && !data.isUploadingKeys) {
|
||||
bottomSheetVerificationActionItem {
|
||||
id("initKeys")
|
||||
title("Initialize keys")
|
||||
|
|
|
@ -6,9 +6,7 @@
|
|||
<!-- ************ Cryptography section ************ -->
|
||||
<im.vector.riotx.core.preference.VectorPreferenceCategory
|
||||
android:key="SETTINGS_CRYPTOGRAPHY_PREFERENCE_KEY"
|
||||
android:title="@string/settings_cryptography"
|
||||
app:isPreferenceVisible="false"
|
||||
tools:isPreferenceVisible="true">
|
||||
android:title="@string/settings_cryptography">
|
||||
<im.vector.riotx.core.preference.VectorPreference
|
||||
android:key="SETTINGS_ENCRYPTION_CROSS_SIGNING_PREFERENCE_KEY"
|
||||
android:persistent="false"
|
||||
|
|
Loading…
Add table
Reference in a new issue