feat(healthchat): ring calls via gateway VoIP push

CallKit rejects the NSE hand-off without the filtering entitlement.
This commit is contained in:
Sedat Qaja
2026-10-12 11:42:53 +02:00
parent c93af478a7
commit 570c7534c3
5 changed files with 127 additions and 6 deletions
@@ -26,7 +26,9 @@ final class ElementCallServiceTests {
let dateProvider: () -> Date = {
self.currentDate
}
service = ElementCallService(callProvider: callProvider, timeProvider: TimeProvider(clock: clock, now: dateProvider))
service = ElementCallService(callProvider: callProvider,
timeProvider: TimeProvider(clock: clock, now: dateProvider),
appSettings: AppSettings.volatile())
}
isolated deinit {
@@ -57,6 +59,21 @@ final class ElementCallServiceTests {
}
}
/// HealthChat: a VoIP push requested from the push gateway carries the expiration as JSON seconds.
@Test
func incomingCallFromPushGatewayVoIPPush() async {
await waitForConfirmation { confirmation in
let pkPushPayloadMock = PKPushPayloadMock().updatingExpiration(secondsSince1970: currentDate.timeIntervalSince1970 + 30)
service.pushRegistry(pushRegistry, didReceiveIncomingPushWith: pkPushPayloadMock, for: .voIP) {
confirmation()
}
}
#expect(callProvider.reportNewIncomingCallWithUpdateCompletionCalled)
#expect(!callProvider.reportCallWithEndedAtReasonCalled)
}
@Test
func incomingVoiceCall() async {
#expect(!callProvider.reportNewIncomingCallWithUpdateCompletionCalled)
@@ -280,6 +297,11 @@ private nonisolated class PKPushPayloadMock: PKPushPayload {
return self
}
func updatingExpiration(secondsSince1970: TimeInterval) -> Self {
dict[ElementCallServiceNotificationKey.expirationDate.rawValue] = secondsSince1970
return self
}
func updateIsVoice(_ isVoice: Bool) -> Self {
dict[ElementCallServiceNotificationKey.isVoiceCall.rawValue] = isVoice
return self