@omz, I know above you say the notification module needs some work. But you seem to be talking about new features.
I have been doing a little more today and realised a few things.
1. After setting my notications, If I am not in Pythonista, I dont get the notification or sound on the screen, but it is added to the list of notifications if you pull down from the top of the screen.
2. If you are in Pythonista when the notification occurs, you get a dialog with the msg and sound, but its not added to the list of notifications that have occurred in the notifications list.
I am not sure, but I have a feeling in the past so time ago that notifications did show up correctly in other apps (I could be wrong about that).
I have put a pic of my iOS notifications below. Also a basic example of the code. It's not the code I want to use, but it acts as an example of it.
So I am asking is this behaviour correct for Pythonista? Or is this part of needs to be addressed in the notifications module.
I have tried to implement my game timers many ways. But I have so many and they vary so often. I have a feeling that the notications module would be a good way to deal with this. But I need the notifications to follow the iOS settings before its would be useful in this context.
import notification
'''
Simple example to show setting a notification in a loop each minute
for x mins.
In my real implementation I am using Arrow.span.
For example, I would like to set notifications for:
from (a local time) every 1 hour with a message
from (a local time) every 3 hours with a message
from (a local time) every 24 hours with a message
etc... With a repeat/duration I set.
I can set this up and do it using arrow correctly. But the behaviour of the
notifications module makes it unsuable for this senerio.
'''
num_mins = 5
delays = [60 * (i + 1) for i in range(num_mins)]
for i, d in enumerate(delays):
x = notification.schedule('Your Game Notification, Mins={}'.format(i + 1),
delay=d,
sound_name='arcade:Powerup_1',
action_url=None)
# A notification so you know this msg group is finished
x = notification.schedule('Game Nofications are over!!!',
delay=delays[num_mins - 1] + 10,
sound_name='arcade:Powerup_3',
action_url=None)
# just put this here in testing so you aviod running multiple times
print('Finished Running')
