Compare commits

...

1 Commits

Author SHA1 Message Date
Tiago Jacobs
7a5b3f8e86 Quick test for faking a call in callKit 2022-04-18 19:20:49 -03:00
5 changed files with 61 additions and 7 deletions

View File

@ -40,6 +40,7 @@
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
<string>voip</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>

View File

@ -33,7 +33,7 @@ export default function App() {
<View style={styles.container}>
{loadComponent ? (
<BigBlueButtonMobile
url="https://mobile.bbb.imdt.dev"
url="https://demo-ios.bigbluebutton.org"
style={styles.bbb}
onError={(content: any) => handleOnError(content)}
onSuccess={() => console.log('URL Valid')}

View File

@ -0,0 +1,35 @@
//
// CallKitDelegate.swift
// bigbluebutton-mobile-sdk
//
// Created by Tiago Daniel Jacobs on 18/04/22.
//
import Foundation
import CallKit
import os
class CallKitDelegate : NSObject {
private var logger = os.Logger(subsystem: "BigBlueButtonMobileSDK", category: "CallKitDelegate")
}
extension CallKitDelegate : CXProviderDelegate {
func providerDidReset(_ provider: CXProvider) {
logger.info("OI1")
}
func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) {
action.fulfill()
}
func provider(_ provider: CXProvider, perform action: CXStartCallAction) {
action.fulfill()
}
func provider(_ provider: CXProvider, perform action: CXEndCallAction) {
action.fulfill()
}
}

View File

@ -22,7 +22,8 @@ class ScreenShareServiceManager: NSObject {
Task.init {
do{
try audioSession.setCategory(AVAudioSession.Category.playback, options: [AVAudioSession.CategoryOptions.mixWithOthers])
// try audioSession.setCategory(AVAudioSession.Category.playback, options: [AVAudioSession.CategoryOptions.mixWithOthers])
try audioSession.setCategory(AVAudioSession.Category.playAndRecord, options: [AVAudioSession.CategoryOptions.mixWithOthers])
try audioSession.setPrefersNoInterruptionsFromSystemAlerts(true)
try audioSession.setActive(true)

View File

@ -6,6 +6,7 @@
import ReplayKit
import os
import CallKit
@objc(SystemBroadcastPickerManager)
class SystemBroadcastPickerManager: RCTViewManager {
@ -18,10 +19,14 @@ class SystemBroadcastPicker : UIView {
// Logger (these messages are displayed in the console application)
private var logger = os.Logger(subsystem: "BigBlueButtonMobileSDK", category: "SystemBroadcastPicker")
private static var logger2 = os.Logger(subsystem: "BigBlueButtonMobileSDK", category: "SystemBroadcastPicker")
// Reference to the broadcast screen picker
private static var broadcastPicker: RPSystemBroadcastPickerView?
// Delegate for call kit methods
private static var callKitDelegate: CallKitDelegate = CallKitDelegate()
//initWithFrame to init view from code
override init(frame: CGRect) {
super.init(frame: frame)
@ -55,13 +60,25 @@ class SystemBroadcastPicker : UIView {
*/
public static func requestBroadcast(/*data*/) {
// write the data that will be accessed from broadcast application
// DispatchQueue.main.async {
// for view in broadcastPicker?.subviews ?? [] {
// if let button = view as? UIButton {
// button.sendActions(for: .allEvents)
// }
// }
// }
self.logger2.info("AAAAAA!")
DispatchQueue.main.async {
for view in broadcastPicker?.subviews ?? [] {
if let button = view as? UIButton {
button.sendActions(for: .allEvents)
}
}
let provider = CXProvider(configuration: CXProviderConfiguration(localizedName: "My App"));
let controller = CXCallController();
provider.setDelegate(callKitDelegate, queue: nil)
let transaction = CXTransaction(action: CXStartCallAction(call: UUID(), handle: CXHandle(type: .generic, value: "Hey I am calling you!")))
controller.request(transaction, completion: { error in })
}
}
}