emekalites / react-native-alarm-notification

schedule alarm and local notification in react-native
https://www.npmjs.com/package/react-native-alarm-notification
MIT License
223 stars 94 forks source link

Fix alarm scheduling on iOS by setting the alarm ID based on alarm fire date instead of current timestamp #179

Closed tensfeld closed 2 years ago

tensfeld commented 2 years ago

This should fix issue #96 for the schedule of multiple alarms. The problem is that by using NSDate.date.timeIntervalSince1970, subsequent alarm schedules get the same ID and thus overwrite the previous schedule on iOS as per [UNNotificationRequest requestWithIdentifier: content: trigger:] documentation.

The proposed fix here will use the fire date to generate the alarm ID, it will work as long as no alarm date/times clashes.