Skip to content

Commit

Permalink
将代理方法变为suspend方法
Browse files Browse the repository at this point in the history
  • Loading branch information
czf0613 committed Jan 29, 2023
1 parent 4a5d58b commit dd72da2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions KChatSDK/src/main/java/ltd/kevinc/kchat/KChatEventDelegate.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ interface KChatEventDelegate {
* 由于KChat设计的传输是二进制的,因此真正的消息内容是包含在message.content中
* 是一个ByteString类型,本质上就是一个不可变的字节数组,因此客户端可以自行定义解码协议以定制个性化的信息
*/
fun onReceiveC2CMessage(message: Chat.C2CChatMessage) {
suspend fun onReceiveC2CMessage(message: Chat.C2CChatMessage) {

}

fun onError(e: Throwable) {
suspend fun onError(e: Throwable) {

}

fun channelClose(e: Throwable?) {
suspend fun channelClose(e: Throwable?) {

}
}
7 changes: 3 additions & 4 deletions KChatSDK/src/main/java/ltd/kevinc/kchat/KChatServiceClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ package ltd.kevinc.kchat

import android.util.Log
import com.google.protobuf.ByteString
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.onCompletion
import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.*
import service.chat.Chat

/**
Expand Down Expand Up @@ -99,6 +97,7 @@ class KChatServiceClient {
}

this.chatChannel
.flowOn(Dispatchers.IO)
.onStart {
Log.i("KChat.Subscribe", "start listening for message.")
}
Expand Down

0 comments on commit dd72da2

Please sign in to comment.