Skip to content

Bugfixes and additions of callbacks#32

Open
simongcx wants to merge 2 commits intoWizcorp:masterfrom
simongcx:master
Open

Bugfixes and additions of callbacks#32
simongcx wants to merge 2 commits intoWizcorp:masterfrom
simongcx:master

Conversation

@simongcx
Copy link

For full details, please see commit notes.

cancel
------
Issue: the alarm ID was unpersisted before, and therefore was not
contingent on the success of, the cancellation operation
Fix: the unpersist call is placed after the cancellation operation, and
is contingent on its success

cancelAll
---------

Issue: the cancelAllNotifications was never reached as in line 58 of
LocalNotification.java, where was call to args.getString(0) occurs in
the error catching code. As the cancelAll function does not take a
notification ID parameter, fails and is not handled (as it's within a
catch statement).
Fix: move the check if an id is present into the sections for add and
cancel.
Sub-issue: the error message associated with this id check said "Cannot
use string for notification id.", however a string is always the output
of the getString call its testing.
Sub-issue fix: error message changed

Issue: unpersistAlarmAll called before the references to the local
storage to get the ids to delete
Fix: now relying on the unpersist call per ID, allowing for partial
success

Issue: the AlarmHelper.cancelAll method returns true regardless of
whether the cancellations are successful
Fix: the AlarmHelper.cancelAll method is no longer used, instead, the
LocalNotification.cancelAllNotifications method sequentially calls the
LocalNotification.cancelNotification method.

AlarmRestoreOnBoot
------------------

Issue: the notification storage in sharedPreferences is a seconds
differential to system time at the point of original creation. Hence on
recreation, all alarms are moved into the future.
Fix: in the LocalNotification addNotification code, the system time is
added to the seconds differential before storage

Issue: the AlarmOptions.parseOptions is accessing the wrong index of
optionsArr (zero rather than 1)
Fix: AlarmOptions no longer used

Issue: the AlarmOptions.parseOptions relies on a date field that's not
constructed anywhere
Fix: AlarmOptions no longer used. The stored parameters are processed
within AlarmRestoreOnBoot, and the full time is persisted, not the
differential (see above)

AlarmReceiver
-------------

Issue: AlarmReceiver does not unpersist the alarm ID of the handled
alarm
Fix: AlarmReceiver now unpersists the alarm ID of the handled alarm
Added success and failure callbacks to cancelAll, added
cancelwithcallback which is as cancel, except with success and failure
callbacks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant