Updated on 2026-08-14
This commit is contained in:
parent
65ace6c5f2
commit
99a5efd7e2
8 changed files with 43 additions and 20 deletions
|
|
@ -20,6 +20,7 @@ import com.tangem.domain.walletconnect.usecase.pair.WcPairUseCase
|
|||
import dagger.assisted.Assisted
|
||||
import dagger.assisted.AssistedFactory
|
||||
import dagger.assisted.AssistedInject
|
||||
import kotlinx.coroutines.TimeoutCancellationException
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
import kotlinx.coroutines.flow.*
|
||||
import org.joda.time.DateTime
|
||||
|
|
@ -119,14 +120,21 @@ internal class DefaultWcPairUseCase @AssistedInject constructor(
|
|||
Timber.tag(WC_TAG).e(it, "Failed to approve session ${sdkSessionProposal.name}")
|
||||
}
|
||||
emit(WcPairState.Approving.Result(sessionForApprove, either))
|
||||
}.onCompletion {
|
||||
if (it != null) {
|
||||
Timber.tag(WC_TAG).e(it, "Completed with error $pairRequest")
|
||||
emit(WcPairState.Error(WcPairError.Unknown(it.message.orEmpty())))
|
||||
} else {
|
||||
Timber.tag(WC_TAG).i("Completed successfully $pairRequest")
|
||||
}
|
||||
}
|
||||
.catch {
|
||||
val pairError: WcPairError = when (it) {
|
||||
is TimeoutCancellationException -> WcPairError.TimeoutException(it.message.orEmpty())
|
||||
else -> WcPairError.Unknown(it.message.orEmpty())
|
||||
}
|
||||
emit(WcPairState.Error(pairError))
|
||||
}
|
||||
.onCompletion {
|
||||
if (it != null) {
|
||||
Timber.tag(WC_TAG).e(it, "Completed with error $pairRequest")
|
||||
} else {
|
||||
Timber.tag(WC_TAG).i("Completed successfully $pairRequest")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun approve(sessionForApprove: WcSessionApprove) {
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ internal class WcPairSdkDelegate : WcSdkObserver {
|
|||
private fun Throwable.toApproveError() = WcPairError.ApprovalFailed(this.localizedMessage.orEmpty()).left()
|
||||
|
||||
companion object {
|
||||
private const val CALLBACK_TIMEOUT = 60
|
||||
private const val CALLBACK_TIMEOUT = 15
|
||||
// com.reown.android.pairing.engine.domain.PairingEngine.pair
|
||||
private val pairingExpiredMessages = listOf(
|
||||
"Pairing URI expired",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue