Fix crash when wellknown are malformed, or redirect to some HTML content (reported by rageshakes)
This commit is contained in:
parent
bbd86661a4
commit
2dcaabe4c4
|
@ -15,7 +15,8 @@ Improvements 🙌:
|
|||
- PIN Code Improvements: Add more settings: biometrics, grace period, notification content (#1985)
|
||||
|
||||
Bugfix 🐛:
|
||||
- Long message cannot be sent/takes infinite time & blocks other messages #1397
|
||||
- Long message cannot be sent/takes infinite time & blocks other messages (#1397)
|
||||
- Fix crash when wellknown are malformed, or redirect to some HTML content (reported by rageshakes)
|
||||
- User Verification in DM not working
|
||||
- Manual import of Megolm keys does back up the imported keys
|
||||
- Auto scrolling to the latest message when sending (#2094)
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package im.vector.app.features.raw.wellknown
|
||||
|
||||
import com.squareup.moshi.JsonAdapter
|
||||
import org.matrix.android.sdk.api.extensions.tryOrNull
|
||||
import org.matrix.android.sdk.internal.di.MoshiProvider
|
||||
|
||||
object ElementWellKnownMapper {
|
||||
|
@ -24,6 +25,6 @@ object ElementWellKnownMapper {
|
|||
val adapter: JsonAdapter<ElementWellKnown> = MoshiProvider.providesMoshi().adapter(ElementWellKnown::class.java)
|
||||
|
||||
fun from(value: String): ElementWellKnown? {
|
||||
return adapter.fromJson(value)
|
||||
return tryOrNull("Unable to parse well-known data") { adapter.fromJson(value) }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ import im.vector.app.features.navigation.Navigator
|
|||
import im.vector.app.features.pin.PinActivity
|
||||
import im.vector.app.features.pin.PinCodeStore
|
||||
import im.vector.app.features.pin.PinMode
|
||||
import im.vector.app.features.raw.wellknown.ElementWellKnownMapper
|
||||
import im.vector.app.features.raw.wellknown.getElementWellknown
|
||||
import im.vector.app.features.raw.wellknown.isE2EByDefault
|
||||
import im.vector.app.features.themes.ThemeUtils
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
|
@ -153,14 +153,13 @@ class VectorSettingsSecurityPrivacyFragment @Inject constructor(
|
|||
disposables.add(it)
|
||||
}
|
||||
|
||||
vectorActivity.getVectorComponent()
|
||||
.rawService()
|
||||
.getWellknown(session.myUserId, object : MatrixCallback<String> {
|
||||
override fun onSuccess(data: String) {
|
||||
findPreference<VectorPreference>(VectorPreferences.SETTINGS_CRYPTOGRAPHY_HS_ADMIN_DISABLED_E2E_DEFAULT)?.isVisible =
|
||||
ElementWellKnownMapper.from(data)?.isE2EByDefault() == false
|
||||
}
|
||||
})
|
||||
lifecycleScope.launchWhenResumed {
|
||||
findPreference<VectorPreference>(VectorPreferences.SETTINGS_CRYPTOGRAPHY_HS_ADMIN_DISABLED_E2E_DEFAULT)?.isVisible =
|
||||
vectorActivity.getVectorComponent()
|
||||
.rawService()
|
||||
.getElementWellknown(session.myUserId)
|
||||
?.isE2EByDefault() == false
|
||||
}
|
||||
}
|
||||
|
||||
private val secureBackupCategory by lazy {
|
||||
|
|
Loading…
Reference in New Issue