31 lines
1.3 KiB
Swift
31 lines
1.3 KiB
Swift
import Foundation
|
|
import UIKit
|
|
import LiveCommunicationKit
|
|
|
|
@objc class LCKBridge: NSObject {
|
|
@objc static func presentCallInterfaceFromRootVC(_ rootVC: UIViewController, callerName: String) {
|
|
if #available(iOS 17.4, *) {
|
|
// 配置ConversationManager
|
|
let config = ConversationManager.Configuration(
|
|
ringtoneName: "notes_of_the_optimistic",
|
|
iconTemplateImageData: UIImage(named: "AppIcon")?.pngData(),
|
|
maximumConversationGroups: 1,
|
|
maximumConversationsPerConversationGroup: 1,
|
|
includesConversationInRecents: false,
|
|
supportsVideo: false,
|
|
supportedHandleTypes: [.generic, .phoneNumber, .emailAddress]
|
|
)
|
|
let manager = ConversationManager(configuration: config)
|
|
let local = Handle(type: .generic, value: callerName, displayName: callerName)
|
|
let update = Conversation.Update(localMember: local, members: [local], activeRemoteMembers: [local])
|
|
Task {
|
|
do {
|
|
try await manager.reportNewIncomingConversation(uuid: UUID(), update: update)
|
|
print("成功报告新来电")
|
|
} catch {
|
|
print("报告新来电失败: \(error.localizedDescription)")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |