Closed dylman123 closed 4 years ago
Need to move away from the semaphore pattern. Look at using Combine's observable objects to manage the state of the backend flow.
Also need to use the @escaping closure for the uploadAudio function. May require nested closures. But this is OK. Although maybe Combine can avoid the need for nested closures...?
Ok, plan is: Use Jonny's enum state concept to define the following states for each function in the serialised generateCaptions() function:
Or maybe the states should simply be:
Look at how to convert JSON payload into custom struct type with modifications: https://www.hackingwithswift.com/example-code/system/how-to-parse-json-using-jsonserialization
Implemented Jonny's UserAPI state-based enums. Also needed to use recursion for short polling the server whilst waiting for transcriptions to finish. Will later need to open an issue to build a "silent notification" service to replace the short polling.
The app gets stuck at the semaphore.wait() line.
Intermittent. Probably something to do with threads.