I got it into my head that I wanted to be able to programmatically make my phone speak whatever I wanted it to. Effectively Siri, but unprompted, and without care for silent, or low volume. On a normal phone, this would be impossible. But on a jailbroken phone, there was probably a way to do it. I first started up by making an Activator event that could be passed a string, and would say it. It did this using the
AVSpeechSynthesizer class, and using the
com.apple.ttsbundle.Samantha-premium voice (which is Siri's default voice). I wanted to be able to use the voice that I normally use for Siri/Victor, which is a British man, but while it seemed to be in the system, and it was clearly being used for actual Siri, I couldn't figure out a way to trigger it through AVSpeechSynthesizer (the voice's name is Arthur).
Now though, I needed a way to trigger it. I didn't want to continuously make a request to a server, as that would cut away at my data when I was out of WiFi. I didn't want to open up a server on my phone that I could push to, as that's opening up a horrible can of worms. I also didn't know how to register for push notifications in a tweak, and figured that would definitely be overkill. So, I decided to see if there was a notification that I could hook into, and do something with.
Originally, I thought maybe I could send a text, and then read it and delete it on the phone. But I realized that it would show up on my mac, which would get really irritating. Then I thought about an email, but if my phone's on low power mode (as it nearly always seems to be), then push notifications don't get sent through. GroupMe notifications were inconsistently sent, and it would have added yet another language/environment to something that already relies on Python (WeMo/iCloud/Dash), C# (local server), PHP (server), Bash (iPhone), Objective-C (tweak), and Batch (some local server stuff).
In a flash of inspiration though, I remembered Reminders. They gave push notifications, they were handled by Apple, so they were incredibly consistent, they could be created remotely through iCloud, and there was already an iCloud API in Python. I downloaded PyiCloud, made a few requests with Fiddler to create alarmed Reminders, forked and modified the code to add in the ability to create an alarmed reminder, and bang, I could make a reminder appear on my iPhone within the minute.
I adapted the code from an open-source tweak Isolate that dealt with notification handling, and hid every notification that was from Reminders and started with 'VICTOR'. With some other parameters, I managed to be able to take a string of text in a reminder and pipe it into the Activator event that I had created, and now I could programmatically make my phone speak.
What's the use case you might ask? Mainly reminders, notifications, and gentle verbal chiding. I can make Victor wake up up in the morning, tell me I should get a move on if I'm still in my apartment by the time I should leave to catch the bus, yell at me if I haven't exercised that morning, or if I turned off my alarm and I'm still lying in bed. But all of that is still yet to come!
UPDATE: The notifications only had a granularity of every minute. Instead, just whenever it syncs, I read it, and perform the action, so it's much more immediate. I'll probably optionally add back in the scheduling aspect, but for now it's just immediate.