mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-28 14:08:44 +03:00
Fix disable MSC3061 lab for rust crypto
This commit is contained in:
parent
2f1e282950
commit
6f859c9ca6
4 changed files with 20 additions and 9 deletions
|
@ -1187,6 +1187,8 @@ internal class DefaultCryptoService @Inject constructor(
|
|||
|
||||
override fun isShareKeysOnInviteEnabled() = cryptoStore.isShareKeysOnInviteEnabled()
|
||||
|
||||
override fun supportsShareKeysOnInvite() = true
|
||||
|
||||
override fun enableShareKeyOnInvite(enable: Boolean) = cryptoStore.enableShareKeyOnInvite(enable)
|
||||
|
||||
/**
|
||||
|
|
|
@ -89,6 +89,10 @@ interface CryptoService {
|
|||
|
||||
fun isKeyGossipingEnabled(): Boolean
|
||||
|
||||
/*
|
||||
* Tells if the current crypto implementation supports MSC3061
|
||||
*/
|
||||
fun supportsShareKeysOnInvite(): Boolean
|
||||
/**
|
||||
* As per MSC3061.
|
||||
* If true will make it possible to share part of e2ee room history
|
||||
|
|
|
@ -724,15 +724,15 @@ internal class RustCryptoService @Inject constructor(
|
|||
return cryptoStore.isKeyGossipingEnabled()
|
||||
}
|
||||
|
||||
override fun supportsShareKeysOnInvite() = false
|
||||
|
||||
override fun enableShareKeyOnInvite(enable: Boolean) {
|
||||
if (enable) {
|
||||
TODO("Enable share key on invite not implemented")
|
||||
}
|
||||
}
|
||||
|
||||
override fun isShareKeysOnInviteEnabled(): Boolean {
|
||||
return false
|
||||
}
|
||||
override fun isShareKeysOnInviteEnabled() = false
|
||||
|
||||
override fun setRoomUnBlockUnverifiedDevices(roomId: String) {
|
||||
cryptoStore.blockUnverifiedDevicesInRoom(roomId, false)
|
||||
|
|
|
@ -72,13 +72,18 @@ class VectorSettingsLabsFragment :
|
|||
}
|
||||
|
||||
findPreference<SwitchPreference>(VectorPreferences.SETTINGS_LABS_MSC3061_SHARE_KEYS_HISTORY)?.let { pref ->
|
||||
// ensure correct default
|
||||
pref.isChecked = session.cryptoService().isShareKeysOnInviteEnabled()
|
||||
if (session.cryptoService().supportsShareKeysOnInvite()) {
|
||||
// ensure correct default
|
||||
pref.isChecked = session.cryptoService().isShareKeysOnInviteEnabled()
|
||||
|
||||
pref.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||
session.cryptoService().enableShareKeyOnInvite(pref.isChecked)
|
||||
MainActivity.restartApp(requireActivity(), MainActivityArgs(clearCache = true))
|
||||
true
|
||||
pref.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||
session.cryptoService().enableShareKeyOnInvite(pref.isChecked)
|
||||
MainActivity.restartApp(requireActivity(), MainActivityArgs(clearCache = true))
|
||||
true
|
||||
}
|
||||
} else {
|
||||
pref.isEnabled = false
|
||||
pref.isChecked = false
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue