in azure-communication-ui/calling/src/main/java/com/azure/android/communication/ui/calling/service/sdk/CallingSDKInitializer.kt [169:190]
fun handlePushNotification(pushNotification: CallCompositePushNotification): CompletableFuture<Void> {
val completableFuture: CompletableFuture<Void> = CompletableFuture<Void>()
if (pushNotification.notificationInfo == null) {
completableFuture.completeExceptionally(IllegalArgumentException("Push notification info is null"))
}
if (isAnyCallActive()) {
completableFuture.completeExceptionally(IllegalStateException("Currently UI is busy with an active call - only one call is supported"))
}
createCallAgent().whenComplete { callAgent, callAgentError ->
if (callAgentError != null) {
completableFuture.completeExceptionally(callAgentError)
}
val pushNotificationInfo = PushNotificationInfo.fromMap(pushNotification.notificationInfo)
callAgent?.handlePushNotification(pushNotificationInfo)?.whenComplete { result, exception ->
if (exception != null) {
completableFuture.completeExceptionally(exception)
}
completableFuture.complete(result)
}
}
return completableFuture
}