Created
August 6, 2018 15:31
-
-
Save npatarino/460194fc063ce92e18f7caedecf063cb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun all(): Future<List<Either<NetError, Task>>> = Future(async(CommonPool) { | |
val snapshot: DataSnapshot = suspendCoroutine { cont: Continuation<DataSnapshot> -> | |
taskReference.addValueEventListener(object : ValueEventListener { | |
override fun onCancelled(error: DatabaseError) { | |
cont.resumeWithException(IOException("Error retrieving data")) | |
} | |
override fun onDataChange(dataSnapshot: DataSnapshot) { | |
cont.resume(dataSnapshot) | |
} | |
}) | |
} | |
listOf(Either.Left(NetError.Unknown)) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment