Utilise TokenManager and ExpiryManager

This commit is contained in:
andrew
2023-06-16 10:38:33 +09:30
parent 153aa4ceaa
commit 667af27bfb
11 changed files with 260 additions and 184 deletions

View File

@@ -3,8 +3,12 @@ package org.session.libsignal.utilities
import nl.komponents.kovenant.Promise
import nl.komponents.kovenant.deferred
import nl.komponents.kovenant.task
import java.util.concurrent.TimeoutException
fun emptyPromise() = EMPTY_PROMISE
private val EMPTY_PROMISE: Promise<*, java.lang.Exception> = task {}
fun <V, E : Throwable> Promise<V, E>.get(defaultValue: V): V {
return try {
get()

View File

@@ -28,3 +28,4 @@ fun <V, T : Promise<V, Exception>> retryIfNeeded(maxRetryCount: Int, retryInterv
retryIfNeeded()
return deferred.promise
}