Skip to content

Instantly share code, notes, and snippets.

@nparsons08 nparsons08/MainActivity.kt Secret

Created Mar 2, 2020
Embed
What would you like to do?
// mobile/android/app/src/main/kotlin/io/getstream/flutter_the_stream/MainActivity.kt:180
private fun postChatMessage(result: MethodChannel.Result, user: String, userToChatWith: String, message: String, token: String) {
val client = StreamChat.getInstance(this.application)
val channel = client.channel("messaging", listOf(user, userToChatWith).sorted().joinToString("-"))
val streamMessage = Message()
streamMessage.text = message
channel.sendMessage(streamMessage, object : MessageCallback {
override fun onSuccess(response: MessageResponse?) {
result.success(true)
}
override fun onError(errMsg: String?, errCode: Int) {
result.error("FAILURE", errMsg, null)
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.