Skip to content

Commit

Permalink
Merge pull request #1077 from tchapgouv/1076-voip-les-call-events-ne-…
Browse files Browse the repository at this point in the history
…sont-pas-affichés-car-filtrés-trop-vieux

Suppression du filtrage de notification VoIP sur l'age de la notifica…
  • Loading branch information
NicolasBuquet authored Aug 13, 2024
2 parents da7debd + a0342c0 commit 2dca6f0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
12 changes: 0 additions & 12 deletions RiotNSE/NotificationService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class NotificationService: UNNotificationServiceExtension {
enum Constants {
static let voipPushRequestTimeout: TimeInterval = 15
static let timeNeededToSendVoIPPushes: TimeInterval = 20
static let tchapCallInviteNotificationDiscardDelta = 10.0 // Tchap: max age of call event before ignoring it
}
}

Expand Down Expand Up @@ -863,17 +862,6 @@ class NotificationService: UNNotificationServiceExtension {

// Starting from iOS 14.5, SDK can "Reports a new incoming call after your notification service extension decrypts a VoIP call request."
// See: https://developer.apple.com/documentation/callkit/cxprovider/3727263-reportnewincomingvoippushpayload

// from Element X : https://github.com/element-hq/element-x-ios/pull/2862/files#diff-1ff0fcebaadd2768e042e7bbafc1321cc5a73089ac1692dc3749492fa2881d91R203
// Checks if it's still time relevant (max 10 seconds old) and whether it should ring
//
// Should prevent ghost ringing when old m.call.invite are dispatched lately

let timestamp = Date(timeIntervalSince1970: TimeInterval(event.age / 1000))
guard abs(timestamp.timeIntervalSinceNow) < NSE.Constants.tchapCallInviteNotificationDiscardDelta else {
MXLog.info("Call notification is too old, handling as push notification")
return
}

// Build th payload expected by the application.
var payload = [String: String]()
Expand Down
1 change: 1 addition & 0 deletions changelog.d/1076.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Suppression du filtrage de notification VoIP sur l'age de la notification. Ne fonctionnait pas correctement sur Tchap.

0 comments on commit 2dca6f0

Please sign in to comment.