Skip to content

Commit

Permalink
[Fix]StreamVideo unable to connect from CallKit
Browse files Browse the repository at this point in the history
  • Loading branch information
ipavlidakis committed Nov 13, 2024
1 parent 5bb5c45 commit 464ce59
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ protocol BackgroundTaskScheduler {
import UIKit

class IOSBackgroundTaskScheduler: BackgroundTaskScheduler {
@Injected(\.callKitService) private var callKitService

private lazy var app: UIApplication? = {
// We can't use `UIApplication.shared` directly because there's no way to convince the compiler
// this code is accessible only for non-extension executables.
Expand All @@ -36,7 +38,7 @@ class IOSBackgroundTaskScheduler: BackgroundTaskScheduler {
var isAppActive: Bool {
let app = self.app
if Thread.isMainThread {
return app?.applicationState == .active
return app?.applicationState == .active || callKitService.callCount > 0
}

var isActive = false
Expand All @@ -47,7 +49,7 @@ class IOSBackgroundTaskScheduler: BackgroundTaskScheduler {
group.leave()
}
group.wait()
return isActive
return isActive || callKitService.callCount > 0
}

func beginTask(expirationHandler: (() -> Void)?) -> Bool {
Expand Down

0 comments on commit 464ce59

Please sign in to comment.