Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ private func content() {
callKitAdapter.availabilityPolicy = .custom(MyCustomAvailabilityPolicy())
}

container {
@Injected(\.callKitAdapter) var callKitAdapter
callKitAdapter.includesCallsInRecents = false
}

container {
class IntentHandler: INExtension, INStartCallIntentHandling {
override func handler(for intent: INIntent) -> Any {
Expand Down
6 changes: 6 additions & 0 deletions Sources/StreamVideo/CallKit/CallKitAdapter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ open class CallKitAdapter {
set { callKitService.ringtoneSound = newValue }
}

/// Configure whether calls should appear in the Recents app.
open var includesCallsInRecents: Bool {
get { callKitService.includesCallsInRecents }
set { callKitService.includesCallsInRecents = newValue }
}

/// The callSettings to use when joining a call (after accepting it on CallKit)
/// default: nil
open var callSettings: CallSettings? {
Expand Down
3 changes: 3 additions & 0 deletions Sources/StreamVideo/CallKit/CallKitService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ open class CallKitService: NSObject, CXProviderDelegate, @unchecked Sendable {
/// Whether video is supported. If true, CallKit push titles add "Video";
/// otherwise "Audio". Default is `false`.
open var supportsVideo: Bool = false
/// Whether calls received will be showing in Recents app.
open var includesCallsInRecents: Bool = true

/// Policy for handling calls when mic permission is missing while the app
/// runs in the background. See `CallKitMissingPermissionPolicy`.
Expand Down Expand Up @@ -692,6 +694,7 @@ open class CallKitService: NSObject, CXProviderDelegate, @unchecked Sendable {
configuration.supportedHandleTypes = supportedHandleTypes
configuration.iconTemplateImageData = iconTemplateImageData
configuration.ringtoneSound = ringtoneSound
configuration.includesCallsInRecents = includesCallsInRecents

if supportsHolding {
// Holding a call isn't supported yet.
Expand Down
29 changes: 29 additions & 0 deletions StreamVideoTests/CallKit/CallKitServiceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,35 @@ final class CallKitServiceTests: XCTestCase, @unchecked Sendable {
XCTAssertNil(subject.callProvider.configuration.iconTemplateImageData)
}

@MainActor
func test_reportIncomingCall_withIncludesCallsInRecents_callUpdateWasConfiguredCorrectly() throws {
subject = .init()

subject.reportIncomingCall(
cid,
localizedCallerName: localizedCallerName,
callerId: callerId,
hasVideo: false
) { _ in }

XCTAssertTrue(subject.callProvider.configuration.includesCallsInRecents)
}

@MainActor
func test_reportIncomingCall_withoutIncludesCallsInRecents_callUpdateWasConfiguredCorrectly() throws {
subject = .init()
subject.includesCallsInRecents = false

subject.reportIncomingCall(
cid,
localizedCallerName: localizedCallerName,
callerId: callerId,
hasVideo: false
) { _ in }

XCTAssertFalse(subject.callProvider.configuration.includesCallsInRecents)
}

@MainActor
func test_reportIncomingCall_callProviderWasCalledWithExpectedValues() {
// Given
Expand Down
Loading