Skip to content

Instantly share code, notes, and snippets.

@Ayush783
Created March 7, 2024 12:06
Show Gist options
  • Save Ayush783/7c59c309669f245004de42da20845fb1 to your computer and use it in GitHub Desktop.
Save Ayush783/7c59c309669f245004de42da20845fb1 to your computer and use it in GitHub Desktop.
Iterate through methodChannels and invoke method
fun sendEvent(event: String, body: Map<String, Any>) {
eventHandlers.reapCollection().forEach { it.get()?.send(event, body) }
if (event == CallkitConstants.ACTION_CALL_DECLINE) {
for ((name, channel) in methodChannels) {
try {
channel.invokeMethod("CALL_DECLINED_CUSTOM", "")
} catch (e: Exception) {
Log.d(EXTRA_CALLKIT_CALL_DATA, e.toString())
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment