|
|
@@ -27,7 +27,7 @@ import Foundation
|
|
27
|
27
|
|
|
28
|
28
|
// MARK: - CallKit proxy
|
|
29
|
29
|
|
|
30
|
|
- private static let provider: CXProvider = {
|
|
|
30
|
+ private static var provider: CXProvider = {
|
|
31
|
31
|
let configuration = CXProviderConfiguration(localizedName: "")
|
|
32
|
32
|
return CXProvider(configuration: configuration)
|
|
33
|
33
|
}()
|
|
|
@@ -52,9 +52,13 @@ import Foundation
|
|
52
|
52
|
/// Defaults to enabled, set to false when you don't want to use CallKit.
|
|
53
|
53
|
@objc public static var enabled: Bool = true {
|
|
54
|
54
|
didSet {
|
|
55
|
|
- if enabled == false {
|
|
|
55
|
+ provider.invalidate()
|
|
|
56
|
+ if enabled {
|
|
|
57
|
+ guard isProviderConfigured() else { return; }
|
|
|
58
|
+ provider = CXProvider(configuration: providerConfiguration!)
|
|
|
59
|
+ provider.setDelegate(emitter, queue: nil)
|
|
|
60
|
+ } else {
|
|
56
|
61
|
provider.setDelegate(nil, queue: nil)
|
|
57
|
|
- provider.invalidate()
|
|
58
|
62
|
}
|
|
59
|
63
|
}
|
|
60
|
64
|
}
|