Skip to content

Commit 15b769a

Browse files
author
Isaac
committed
Don't show fake call UI on old iOS versions
(cherry picked from commit 78f382a)
1 parent e8cf06d commit 15b769a

File tree

1 file changed

+25
-22
lines changed

1 file changed

+25
-22
lines changed

submodules/TelegramUI/Sources/AppDelegate.swift

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2400,30 +2400,33 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
24002400
}
24012401

24022402
private func reportFailedIncomingCallKitCall() {
2403-
guard let callKitIntegration = CallKitIntegration.shared else {
2404-
return
2405-
}
2406-
let uuid = CallSessionInternalId()
2407-
callKitIntegration.reportIncomingCall(
2408-
uuid: uuid,
2409-
stableId: Int64.random(in: Int64.min ... Int64.max),
2410-
handle: "Unknown",
2411-
phoneNumber: nil,
2412-
isVideo: false,
2413-
displayTitle: "Unknown",
2414-
completion: { error in
2415-
if let error = error {
2416-
if error.domain == "com.apple.CallKit.error.incomingcall" && (error.code == -3 || error.code == 3) {
2417-
Logger.shared.log("PresentationCall", "reportFailedIncomingCallKitCall device in DND mode")
2418-
} else {
2419-
Logger.shared.log("PresentationCall", "reportFailedIncomingCallKitCall error \(error)")
2403+
if #available(iOS 14.4, *) {
2404+
} else {
2405+
guard let callKitIntegration = CallKitIntegration.shared else {
2406+
return
2407+
}
2408+
let uuid = CallSessionInternalId()
2409+
callKitIntegration.reportIncomingCall(
2410+
uuid: uuid,
2411+
stableId: Int64.random(in: Int64.min ... Int64.max),
2412+
handle: "Unknown",
2413+
phoneNumber: nil,
2414+
isVideo: false,
2415+
displayTitle: "Unknown",
2416+
completion: { error in
2417+
if let error = error {
2418+
if error.domain == "com.apple.CallKit.error.incomingcall" && (error.code == -3 || error.code == 3) {
2419+
Logger.shared.log("PresentationCall", "reportFailedIncomingCallKitCall device in DND mode")
2420+
} else {
2421+
Logger.shared.log("PresentationCall", "reportFailedIncomingCallKitCall error \(error)")
2422+
}
24202423
}
24212424
}
2422-
}
2423-
)
2424-
Queue.mainQueue().after(1.0, {
2425-
callKitIntegration.dropCall(uuid: uuid)
2426-
})
2425+
)
2426+
Queue.mainQueue().after(1.0, {
2427+
callKitIntegration.dropCall(uuid: uuid)
2428+
})
2429+
}
24272430
}
24282431

24292432
private func authorizedContext() -> Signal<AuthorizedApplicationContext, NoError> {

0 commit comments

Comments
 (0)