Merge pull request #955 from pipecat-ai/ios-simple-chatbot-mainactor-fixes
iOS SimpleChatbot @MainActor fixes
This commit is contained in:
@@ -684,10 +684,10 @@
|
||||
/* Begin XCRemoteSwiftPackageReference section */
|
||||
90B6AB2F2D1359ED00DFF1D9 /* XCRemoteSwiftPackageReference "pipecat-client-ios-daily" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/pipecat-ai/pipecat-client-ios-daily/";
|
||||
repositoryURL = "https://github.com/pipecat-ai/pipecat-client-ios-daily";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 0.3.0;
|
||||
minimumVersion = 0.3.1;
|
||||
};
|
||||
};
|
||||
/* End XCRemoteSwiftPackageReference section */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"originHash" : "cc17f08b06def9570d775e9c6f7a8dc10d1588b98127e977c47d052abac659b7",
|
||||
"originHash" : "72945fe9f3d71a3b546d5d2df153345b4dc9e72c00b2fda349508223e1a88501",
|
||||
"pins" : [
|
||||
{
|
||||
"identity" : "daily-client-ios",
|
||||
@@ -15,17 +15,17 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/pipecat-ai/pipecat-client-ios.git",
|
||||
"state" : {
|
||||
"revision" : "fd8418559b6f885af7662b78fabdb0e2f08fbb1a",
|
||||
"version" : "0.3.0"
|
||||
"revision" : "d2d9946cf93f1e89290c724caa1631cffa439524",
|
||||
"version" : "0.3.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "pipecat-client-ios-daily",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/pipecat-ai/pipecat-client-ios-daily/",
|
||||
"location" : "https://github.com/pipecat-ai/pipecat-client-ios-daily",
|
||||
"state" : {
|
||||
"revision" : "03e1d1da973fb1aab65ac0c8267664f334a74c50",
|
||||
"version" : "0.3.0"
|
||||
"revision" : "cec4beef8762604c9a9b5ec760081ea2a0a697bf",
|
||||
"version" : "0.3.1"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
@@ -127,55 +127,73 @@ extension CallContainerModel:RTVIClientDelegate, LLMHelperDelegate {
|
||||
}
|
||||
|
||||
func onTransportStateChanged(state: TransportState) {
|
||||
self.handleEvent(eventName: "onTransportStateChanged", eventValue: state)
|
||||
self.voiceClientStatus = state.description
|
||||
self.isInCall = ( state == .connecting || state == .connected || state == .ready || state == .authenticating )
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func onBotReady(botReadyData: BotReadyData) {
|
||||
self.handleEvent(eventName: "onBotReady.")
|
||||
self.isBotReady = true
|
||||
if let expirationTime = self.rtviClientIOS?.expiry() {
|
||||
self.startTimer(withExpirationTime: expirationTime)
|
||||
Task { @MainActor in
|
||||
self.handleEvent(eventName: "onTransportStateChanged", eventValue: state)
|
||||
self.voiceClientStatus = state.description
|
||||
self.isInCall = ( state == .connecting || state == .connected || state == .ready || state == .authenticating )
|
||||
}
|
||||
}
|
||||
|
||||
func onBotReady(botReadyData: BotReadyData) {
|
||||
Task { @MainActor in
|
||||
self.handleEvent(eventName: "onBotReady.")
|
||||
self.isBotReady = true
|
||||
if let expirationTime = self.rtviClientIOS?.expiry() {
|
||||
self.startTimer(withExpirationTime: expirationTime)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func onConnected() {
|
||||
self.isMicEnabled = self.rtviClientIOS?.isMicEnabled ?? false
|
||||
Task { @MainActor in
|
||||
self.isMicEnabled = self.rtviClientIOS?.isMicEnabled ?? false
|
||||
}
|
||||
}
|
||||
|
||||
func onDisconnected() {
|
||||
self.stopTimer()
|
||||
self.isBotReady = false
|
||||
Task { @MainActor in
|
||||
self.stopTimer()
|
||||
self.isBotReady = false
|
||||
}
|
||||
}
|
||||
|
||||
func onRemoteAudioLevel(level: Float, participant: Participant) {
|
||||
self.remoteAudioLevel = level
|
||||
Task { @MainActor in
|
||||
self.remoteAudioLevel = level
|
||||
}
|
||||
}
|
||||
|
||||
func onUserAudioLevel(level: Float) {
|
||||
self.localAudioLevel = level
|
||||
Task { @MainActor in
|
||||
self.localAudioLevel = level
|
||||
}
|
||||
}
|
||||
|
||||
func onUserTranscript(data: Transcript) {
|
||||
if (data.final ?? false) {
|
||||
self.handleEvent(eventName: "onUserTranscript", eventValue: data.text)
|
||||
Task { @MainActor in
|
||||
if (data.final ?? false) {
|
||||
self.handleEvent(eventName: "onUserTranscript", eventValue: data.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func onBotTranscript(data: String) {
|
||||
self.handleEvent(eventName: "onBotTranscript", eventValue: data)
|
||||
Task { @MainActor in
|
||||
self.handleEvent(eventName: "onBotTranscript", eventValue: data)
|
||||
}
|
||||
}
|
||||
|
||||
func onError(message: String) {
|
||||
self.handleEvent(eventName: "onError", eventValue: message)
|
||||
self.showError(message: message)
|
||||
Task { @MainActor in
|
||||
self.handleEvent(eventName: "onError", eventValue: message)
|
||||
self.showError(message: message)
|
||||
}
|
||||
}
|
||||
|
||||
func onTracksUpdated(tracks: Tracks) {
|
||||
self.handleEvent(eventName: "onTracksUpdated", eventValue: tracks)
|
||||
Task { @MainActor in
|
||||
self.handleEvent(eventName: "onTracksUpdated", eventValue: tracks)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user