-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "remove all the streams work and move to another PR"
This reverts commit 76bfcc7.
- Loading branch information
1 parent
76bfcc7
commit cbfdce1
Showing
6 changed files
with
140 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
17 changes: 17 additions & 0 deletions
17
library/src/main/java/org/xmtp/android/library/libxmtp/GroupEmitter.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package uniffi.xmtpv3.org.xmtp.android.library.libxmtp | ||
|
||
import kotlinx.coroutines.flow.MutableSharedFlow | ||
import kotlinx.coroutines.flow.asSharedFlow | ||
import uniffi.xmtpv3.FfiConversationCallback | ||
import uniffi.xmtpv3.FfiGroup | ||
|
||
class GroupEmitter { | ||
private val _groups = MutableSharedFlow<FfiGroup>() | ||
val groups = _groups.asSharedFlow() | ||
|
||
val callback: FfiConversationCallback = object : FfiConversationCallback { | ||
override fun onConversation(conversation: FfiGroup) { | ||
_groups.tryEmit(conversation) | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
library/src/main/java/org/xmtp/android/library/libxmtp/MessageEmitter.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.xmtp.android.library.libxmtp | ||
|
||
import kotlinx.coroutines.flow.MutableSharedFlow | ||
import kotlinx.coroutines.flow.asSharedFlow | ||
import uniffi.xmtpv3.FfiMessage | ||
import uniffi.xmtpv3.FfiMessageCallback | ||
|
||
class MessageEmitter { | ||
private val _messages = MutableSharedFlow<FfiMessage>() | ||
val messages = _messages.asSharedFlow() | ||
|
||
val callback: FfiMessageCallback = object : FfiMessageCallback { | ||
override fun onMessage(message: FfiMessage) { | ||
_messages.tryEmit(message) | ||
} | ||
} | ||
} |