This is not completely as requested in the issue https://github.com/JohanDegraeve/xdripswift/issues/205
It does allow watch/Libre 2 users to have a new reading every minute.
It also allows all users to have specify the minimum time between to calendar events on the watch, or to have a notification with a reading.
For the notification : an overrule of the interval is done if there's been a dis/reconnect, which means if there was a disconnect/reconnect, the next reading will generate a notification, no matter the value of the interval.
Default value for the interval = 0
The description of issue 214 is not correct : 1 day snooze does not add 1 day
In fact it's correctly snoozed, the date till when is just not shown clearly in the overview
in BluetoothTransmitter : centralManager is initialized with key CBCentralManagerOptionRestoreIdentifierKey. The assigned value must always be the same (per bluetooth peripheral), otherwise willRestoreState doesn't get called.
Previously it was always a random value, ie always a different value.
Now it's always the same value, consisting of the appname + the mac address of the peripheral, meaning unique per peripheral but the same value for each app start.
One exception is the first scan, because then we don't know yet the mac address, in that case a random value is used.
create centralManager with a CBCentralManagerOptionRestoreIdentifierKey. This to ensure that iOS relaunches the app whenever it's killed either due to a crash or due to lack of memory
iOS will restart the app as soon as a bluetooth transmitter tries to connect (which is under normal circumtances immediately
the function willRestoreState is an empty function and that seems to be enough to make it work
see https://developer.apple.com/library/archive/qa/qa1962/_index.html
It's a quick solution, it will still miss one reading, because it doesn't use the data at the moment it's relaunched. (function willRestoreState is an empty function)