Browse Source

Merge pull request #3140 from element-hq/feature/fga/fix_npe_on_verification_service

Bugfix : avoid potential NPE on verification service.
pull/3139/head
ganfra 3 months ago committed by GitHub
parent
commit
d9d5a06e57
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 12
      libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/verification/RustSessionVerificationService.kt

12
libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/verification/RustSessionVerificationService.kt

@ -57,6 +57,12 @@ class RustSessionVerificationService( @@ -57,6 +57,12 @@ class RustSessionVerificationService(
private val encryptionService: Encryption = client.encryption()
private lateinit var verificationController: SessionVerificationController
private val _verificationFlowState = MutableStateFlow<VerificationFlowState>(VerificationFlowState.Initial)
override val verificationFlowState = _verificationFlowState.asStateFlow()
private val _sessionVerifiedStatus = MutableStateFlow<SessionVerifiedStatus>(SessionVerifiedStatus.Unknown)
override val sessionVerifiedStatus: StateFlow<SessionVerifiedStatus> = _sessionVerifiedStatus.asStateFlow()
// Listen for changes in verification status and update accordingly
private val verificationStateListenerTaskHandle = encryptionService.verificationStateListener(object : VerificationStateListener {
override fun onUpdate(status: VerificationState) {
@ -74,12 +80,6 @@ class RustSessionVerificationService( @@ -74,12 +80,6 @@ class RustSessionVerificationService(
}
})
private val _verificationFlowState = MutableStateFlow<VerificationFlowState>(VerificationFlowState.Initial)
override val verificationFlowState = _verificationFlowState.asStateFlow()
private val _sessionVerifiedStatus = MutableStateFlow<SessionVerifiedStatus>(SessionVerifiedStatus.Unknown)
override val sessionVerifiedStatus: StateFlow<SessionVerifiedStatus> = _sessionVerifiedStatus.asStateFlow()
/**
* The internal service that checks verification can only run after the initial sync.
* This [StateFlow] will notify consumers when the service is ready to be used.

Loading…
Cancel
Save