Fix java 8 build
This commit is contained in:
parent
6e7f82fa95
commit
db8676cb6d
@ -8,6 +8,7 @@ import it.tdlight.ResultHandler;
|
|||||||
import it.tdlight.TelegramClient;
|
import it.tdlight.TelegramClient;
|
||||||
import it.tdlight.jni.TdApi.Message;
|
import it.tdlight.jni.TdApi.Message;
|
||||||
import it.tdlight.jni.TdApi.Update;
|
import it.tdlight.jni.TdApi.Update;
|
||||||
|
import it.tdlight.util.FutureSupport;
|
||||||
import it.tdlight.util.UnsupportedNativeLibraryException;
|
import it.tdlight.util.UnsupportedNativeLibraryException;
|
||||||
import it.tdlight.jni.TdApi;
|
import it.tdlight.jni.TdApi;
|
||||||
import it.tdlight.jni.TdApi.ChatListArchive;
|
import it.tdlight.jni.TdApi.ChatListArchive;
|
||||||
@ -359,7 +360,7 @@ public final class SimpleTelegramClient implements Authenticable, MutableTelegra
|
|||||||
* Wait until TDLight is closed
|
* Wait until TDLight is closed
|
||||||
*/
|
*/
|
||||||
public CompletableFuture<Void> waitForExitAsync() {
|
public CompletableFuture<Void> waitForExitAsync() {
|
||||||
return closed.copy();
|
return FutureSupport.copy(closed);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onCloseUpdate() {
|
private void onCloseUpdate() {
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
package it.tdlight.util;
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
public class FutureSupport {
|
||||||
|
|
||||||
|
public static <T> CompletableFuture<T> copy(CompletableFuture<T> future) {
|
||||||
|
return CompletableFuture.completedFuture(true).thenCompose(ignored -> future);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package it.tdlight.util;
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
public class FutureSupport {
|
||||||
|
|
||||||
|
public static <T> CompletableFuture<T> copy(CompletableFuture<T> future) {
|
||||||
|
return future.copy();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user