Skip to content

Commit

Permalink
[ATL-3066] Implement logic for received messages (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
cristianIOHK authored Mar 16, 2023
1 parent f78b6a1 commit a7b67bb
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import io.iohk.atala.prism.walletsdk.domain.models.Curve
import io.iohk.atala.prism.walletsdk.domain.models.DID
import io.iohk.atala.prism.walletsdk.domain.models.DIDDocument
import io.iohk.atala.prism.walletsdk.domain.models.KeyCurve
import io.iohk.atala.prism.walletsdk.domain.models.Message
import io.iohk.atala.prism.walletsdk.domain.models.PrismAgentError
import io.iohk.atala.prism.walletsdk.domain.models.Seed
import io.iohk.atala.prism.walletsdk.domain.models.Signature
Expand All @@ -26,6 +27,7 @@ import io.ktor.serialization.kotlinx.json.json
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch
import kotlinx.serialization.Serializable
Expand Down Expand Up @@ -263,6 +265,14 @@ class PrismAgent {
fetchingMessagesJob.cancel()
}

fun handleMessagesEvents(): Flow<List<Message>> {
return pluto.getAllMessages()
}

fun handleReceivedMessagesEvents(): Flow<List<Message>> {
return pluto.getAllMessagesReceived()
}

private suspend fun parsePrismInvitation(str: String): PrismOnboardingInvitation {
try {
val prismOnboarding = PrismOnboardingInvitation.prismOnboardingInvitationFromJsonString(str)
Expand Down

0 comments on commit a7b67bb

Please sign in to comment.