Skip to content

Commit ea244de

Browse files
committed
everything takes a subscribe2 now
1 parent 9e37fc8 commit ea244de

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

library/src/androidTest/java/org/xmtp/android/library/TestHelpers.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ class FakeApiClient : ApiClient {
191191
published.addAll(envelopes)
192192
return PublishResponse.newBuilder().build()
193193
}
194-
override suspend fun subscribe2(request: Flow<MessageApiOuterClass.SubscribeRequest>): Flow<MessageApiOuterClass.Envelope> {
194+
override suspend fun subscribe(request: Flow<MessageApiOuterClass.SubscribeRequest>): Flow<MessageApiOuterClass.Envelope> {
195195
val env = stream.counts().first()
196196

197197
if (request.first().contentTopicsList.contains(env.contentTopic)) {

library/src/main/java/org/xmtp/android/library/ApiClient.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ interface ApiClient {
3434
suspend fun batchQuery(requests: List<QueryRequest>): BatchQueryResponse
3535
suspend fun envelopes(topic: String, pagination: Pagination? = null): List<Envelope>
3636
suspend fun publish(envelopes: List<Envelope>): PublishResponse
37-
suspend fun subscribe2(request: Flow<SubscribeRequest>): Flow<Envelope>
37+
suspend fun subscribe(request: Flow<SubscribeRequest>): Flow<Envelope>
3838
}
3939

4040
data class GRPCApiClient(
@@ -182,7 +182,7 @@ data class GRPCApiClient(
182182
return client.publish(request, headers)
183183
}
184184

185-
override suspend fun subscribe2(request: Flow<SubscribeRequest>): Flow<Envelope> {
185+
override suspend fun subscribe(request: Flow<SubscribeRequest>): Flow<Envelope> {
186186
val headers = Metadata()
187187

188188
headers.put(CLIENT_VERSION_HEADER_KEY, Constants.VERSION)

library/src/main/java/org/xmtp/android/library/Client.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,8 @@ class Client() {
497497
return apiClient.batchQuery(requests)
498498
}
499499

500-
suspend fun subscribe2(request: Flow<MessageApiOuterClass.SubscribeRequest>): Flow<Envelope> {
501-
return apiClient.subscribe2(request = request)
500+
suspend fun subscribe(request: Flow<MessageApiOuterClass.SubscribeRequest>): Flow<Envelope> {
501+
return apiClient.subscribe(request = request)
502502
}
503503

504504
fun fetchConversation(topic: String?, includeGroups: Boolean = false): Conversation? {

library/src/main/java/org/xmtp/android/library/ConversationV1.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ data class ConversationV1(
4242
* @see Conversations.streamAllMessages
4343
*/
4444
fun streamMessages(): Flow<DecodedMessage> = flow {
45-
client.subscribe2(
45+
client.subscribe(
4646
MutableStateFlow(
4747
GRPCApiClient.makeSubscribeRequest(
4848
listOf(topic.description)
@@ -279,7 +279,7 @@ data class ConversationV1(
279279
get() = topic.description.replace("/xmtp/0/dm-", "/xmtp/0/dmE-")
280280

281281
fun streamEphemeral(): Flow<Envelope> = flow {
282-
client.subscribe2(
282+
client.subscribe(
283283
MutableStateFlow(
284284
GRPCApiClient.makeSubscribeRequest(
285285
listOf(ephemeralTopic)
@@ -291,7 +291,7 @@ data class ConversationV1(
291291
}
292292

293293
fun streamDecryptedMessages(): Flow<DecryptedMessage> = flow {
294-
client.subscribe2(
294+
client.subscribe(
295295
MutableStateFlow(
296296
GRPCApiClient.makeSubscribeRequest(
297297
listOf(topic.description)

library/src/main/java/org/xmtp/android/library/ConversationV2.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ data class ConversationV2(
139139
}
140140

141141
fun streamMessages(): Flow<DecodedMessage> = flow {
142-
client.subscribe2(
142+
client.subscribe(
143143
MutableStateFlow(
144144
GRPCApiClient.makeSubscribeRequest(
145145
listOf(topic)
@@ -276,7 +276,7 @@ data class ConversationV2(
276276
get() = topic.replace("/xmtp/0/m", "/xmtp/0/mE")
277277

278278
fun streamEphemeral(): Flow<Envelope> = flow {
279-
client.subscribe2(
279+
client.subscribe(
280280
MutableStateFlow(
281281
GRPCApiClient.makeSubscribeRequest(
282282
listOf(ephemeralTopic)
@@ -288,7 +288,7 @@ data class ConversationV2(
288288
}
289289

290290
fun streamDecryptedMessages(): Flow<DecryptedMessage> = flow {
291-
client.subscribe2(
291+
client.subscribe(
292292
MutableStateFlow(
293293
GRPCApiClient.makeSubscribeRequest(
294294
listOf(topic)

library/src/main/java/org/xmtp/android/library/Conversations.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ data class Conversations(
526526
*/
527527
fun stream(): Flow<Conversation> = flow {
528528
val streamedConversationTopics: MutableSet<String> = mutableSetOf()
529-
client.subscribe2(
529+
client.subscribe(
530530
MutableStateFlow(
531531
makeSubscribeRequest(
532532
listOf(
@@ -621,7 +621,7 @@ data class Conversations(
621621

622622
while (true) {
623623
try {
624-
client.subscribe2(request = subscribeFlow).collect { envelope ->
624+
client.subscribe(request = subscribeFlow).collect { envelope ->
625625
when {
626626
conversationsByTopic.containsKey(envelope.contentTopic) -> {
627627
val conversation = conversationsByTopic[envelope.contentTopic]
@@ -692,7 +692,7 @@ data class Conversations(
692692

693693
while (true) {
694694
try {
695-
client.subscribe2(request = subscribeFlow).collect { envelope ->
695+
client.subscribe(request = subscribeFlow).collect { envelope ->
696696
when {
697697
conversationsByTopic.containsKey(envelope.contentTopic) -> {
698698
val conversation = conversationsByTopic[envelope.contentTopic]

library/src/test/java/org/xmtp/android/library/TestHelpers.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ class FakeApiClient : ApiClient {
187187
return PublishResponse.newBuilder().build()
188188
}
189189

190-
override suspend fun subscribe2(request: Flow<MessageApiOuterClass.SubscribeRequest>): Flow<MessageApiOuterClass.Envelope> {
190+
override suspend fun subscribe(request: Flow<MessageApiOuterClass.SubscribeRequest>): Flow<MessageApiOuterClass.Envelope> {
191191
val env = stream.counts().first()
192192

193193
if (request.first().contentTopicsList.contains(env.contentTopic)) {

0 commit comments

Comments
 (0)