Fixes for iOS 17. Updated the log events. Also, it seems the final update from the speech recognizer is now empty so ignore an empty result in the final result.

This commit is contained in:
Jeremy Rand 2023-09-25 19:54:23 -04:00
parent 237310dd0f
commit bdf7a85895
7 changed files with 25 additions and 38 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View File

@ -601,6 +601,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.1;
PRODUCT_BUNDLE_IDENTIFIER = com.halcyontouch.ListenerGS;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;
@ -628,6 +629,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.1;
PRODUCT_BUNDLE_IDENTIFIER = com.halcyontouch.ListenerGS;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;

View File

@ -17,21 +17,6 @@
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>9D5155EE26A1EF7B0075EBC7</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>9D5155FF26A1EF7C0075EBC7</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>9D51560A26A1EF7C0075EBC7</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>9D62FC5F27C494D700AEE01F</key>
<dict>
<key>primary</key>

View File

@ -104,7 +104,7 @@ class GSConnection : ObservableObject {
}
if (!legalTransition) {
logger.error("Illegal requested state transition from \(oldState) to \(newState)")
logger.error("Illegal requested state transition from \(oldState, privacy: .public) to \(newState, privacy: .public)")
errorOccurred(title: "Bad State Change", message: "Illegal state transition from \(oldState) to \(newState)")
} else {
state = newState
@ -126,14 +126,14 @@ class GSConnection : ObservableObject {
private func connectionSuccessful()
{
changeState(newState:.connected)
logger.debug("Connected to \(self.destination)")
logger.debug("Connected to \(self.destination, privacy: .public)")
}
func connect(destination : String) {
self.destination = destination
changeState(newState: .connecting)
readQueue.addOperation { [weak self, destination] in
self?.logger.debug("Attempting to connect to \(destination)")
self?.logger.debug("Attempting to connect to \(destination, privacy: .public)")
let client = TCPClient(address: destination, port: Int32(GSConnection.port))
switch client.connect(timeout: 10) {
case .success:
@ -143,7 +143,7 @@ class GSConnection : ObservableObject {
}
case .failure(let error):
client.close()
self?.logger.error("Failed to connect to \(destination): \(String(describing: error))")
self?.logger.error("Failed to connect to \(destination, privacy: .public): \(String(describing: error), privacy: .public)")
self?.mainQueue.addOperation {
self?.connectionFailed()
}
@ -171,13 +171,13 @@ class GSConnection : ObservableObject {
self.trySend()
}
} else {
self.logger.error("Unexpected message on socket from \(destination)")
self.logger.error("Unexpected message on socket from \(destination, privacy: .public)")
self.errorOccurred(title: "Protocol Error", message: "Unexpected message from the GS")
break
}
}
catch {
self.logger.error("Unable to unpack message on socket from \(destination)")
self.logger.error("Unable to unpack message on socket from \(destination, privacy: .public)")
self.errorOccurred(title: "Protocol Error", message: "Unexpected message from the GS")
break
}
@ -230,7 +230,7 @@ class GSConnection : ObservableObject {
case .success:
break
case .failure(let error):
self.logger.error("Unable to send header: \(String(describing: error))")
self.logger.error("Unable to send header: \(String(describing: error), privacy: .public)")
return false
}
@ -319,14 +319,14 @@ class GSConnection : ObservableObject {
case .success:
switch (client.send(data: bytes)) {
case .success:
logger.debug("Sent text \"\(stringToSend)\"")
logger.debug("Sent text \"\(stringToSend, privacy: .public)\"")
break
case .failure(let error):
mainQueue.addOperation {
self.errorOccurred(title: "Write Error", message: "Unable to send text to the GS")
self.disconnect()
}
logger.error("Failed to send text: \(String(describing: error))")
logger.error("Failed to send text: \(String(describing: error), privacy: .public)")
return false
}
case .failure(let error):
@ -334,7 +334,7 @@ class GSConnection : ObservableObject {
self.errorOccurred(title: "Write Error", message: "Unable to send text to the GS")
self.disconnect()
}
logger.error("Failed to send text: \(String(describing: error))")
logger.error("Failed to send text: \(String(describing: error), privacy: .public)")
}
}
return true

View File

@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.0.1</string>
<key>CFBundleVersion</key>
<string>794</string>
<string>807</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSRequiresIPhoneOS</key>

View File

@ -82,7 +82,7 @@ class SpeechForwarder : SpeechForwarderProtocol {
// Configure the microphone input.
let inputFormat = inputNode.outputFormat(forBus: 0)
let speechFormat = recognitionRequest.nativeAudioFormat
logger.debug("Recording format \(inputFormat), speech format \(speechFormat)")
logger.debug("Recording format \(inputFormat, privacy: .public), speech format \(speechFormat, privacy: .public)")
var formatConverter: AVAudioConverter?
if (!inputFormat.isEqual(speechFormat)) {
formatConverter = AVAudioConverter(from:inputFormat, to: speechFormat)
@ -114,17 +114,17 @@ class SpeechForwarder : SpeechForwarderProtocol {
recognitionTask = speechRecognizer.recognitionTask(with: recognitionRequest) { [weak connection] result, error in
var isFinal = false
if let result = result {
// Update the text view with the results.
OperationQueue.main.addOperation {
guard let connection = connection else { return }
connection.set(text: result.bestTranscription.formattedString)
}
isFinal = result.isFinal
}
if error != nil {
self.logger.error("Error from recognizer: \(String(describing: error))")
self.logger.error("Error from recognizer: \(String(describing: error), privacy:.public)")
} else if let result = result {
isFinal = result.isFinal
if !isFinal || result.bestTranscription.formattedString != "" {
// Update the text view with the results.
OperationQueue.main.addOperation {
guard let connection = connection else { return }
connection.set(text: result.bestTranscription.formattedString)
}
}
}
if error != nil || isFinal {