mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 13:38:49 +03:00
Hide private key
This commit is contained in:
parent
ccd9d2961d
commit
cb4752812a
2 changed files with 12 additions and 4 deletions
|
@ -52,7 +52,7 @@ internal class SendVerificationMessageWorker(context: Context,
|
|||
lateinit var cryptoService: CryptoService
|
||||
|
||||
override suspend fun doWork(): Result {
|
||||
val errorOutputData = Data.Builder().putBoolean("failed", true).build()
|
||||
val errorOutputData = Data.Builder().putBoolean(OUTPUT_KEY_FAILED, true).build()
|
||||
val params = WorkerParamsFactory.fromData<Params>(inputData)
|
||||
?: return Result.success(errorOutputData)
|
||||
|
||||
|
@ -80,4 +80,12 @@ internal class SendVerificationMessageWorker(context: Context,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val OUTPUT_KEY_FAILED = "failed"
|
||||
|
||||
fun hasFailed(outputData: Data): Boolean {
|
||||
return outputData.getBoolean(SendVerificationMessageWorker.OUTPUT_KEY_FAILED, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@ import androidx.work.ExistingWorkPolicy
|
|||
import androidx.work.Operation
|
||||
import androidx.work.WorkInfo
|
||||
import im.vector.matrix.android.R
|
||||
import im.vector.matrix.android.api.session.crypto.verification.ValidVerificationInfoRequest
|
||||
import im.vector.matrix.android.api.session.crypto.verification.CancelCode
|
||||
import im.vector.matrix.android.api.session.crypto.verification.ValidVerificationInfoRequest
|
||||
import im.vector.matrix.android.api.session.crypto.verification.VerificationTxState
|
||||
import im.vector.matrix.android.api.session.events.model.Content
|
||||
import im.vector.matrix.android.api.session.events.model.Event
|
||||
|
@ -115,7 +115,7 @@ internal class VerificationTransportRoomMessage(
|
|||
?.filter { it.state == WorkInfo.State.SUCCEEDED }
|
||||
?.firstOrNull { it.id == enqueueInfo.second }
|
||||
?.let { wInfo ->
|
||||
if (wInfo.outputData.getBoolean("failed", false)) {
|
||||
if (SendVerificationMessageWorker.hasFailed(wInfo.outputData)) {
|
||||
Timber.e("## SAS verification [${tx?.transactionId}] failed to send verification message in state : ${tx?.state}")
|
||||
tx?.cancel(onErrorReason)
|
||||
} else {
|
||||
|
@ -196,7 +196,7 @@ internal class VerificationTransportRoomMessage(
|
|||
?.filter { it.state == WorkInfo.State.SUCCEEDED }
|
||||
?.firstOrNull { it.id == workRequest.id }
|
||||
?.let { wInfo ->
|
||||
if (wInfo.outputData.getBoolean("failed", false)) {
|
||||
if (SendVerificationMessageWorker.hasFailed(wInfo.outputData)) {
|
||||
callback(null, null)
|
||||
} else if (wInfo.outputData.getString(localId) != null) {
|
||||
callback(wInfo.outputData.getString(localId), validInfo)
|
||||
|
|
Loading…
Reference in a new issue