CCExtractor / beacon

Flutter application to share location with a group. (under development)
56 stars 146 forks source link

## Title: Fix for Future Date Validation in Beacon Project #217

Closed vkprogrammer-001 closed 5 months ago

vkprogrammer-001 commented 5 months ago

Fixes #192

Description:

This pull request addresses an issue that was occurring in the Beacon project. The issue was identified in the local_notification.dart file. When creating a hike, an exception was thrown with the message: Exception: Invalid argument (scheduledDate): Must be a date in the future: Instance of 'TZDateTime'.

The root cause of this issue was that the scheduledDate argument was not properly validated to ensure it was a future date. This resulted in an invalid argument exception when the scheduledDate was not in the future.

In this pull request, I have implemented a fix for this issue. The solution involves checking the difference between the current time and the beaconStart time. If the beaconStart time is less than an hour from the current time, a message is printed: "Beacon start time must be at least an hour from now", and the function returns early.

Changes:

This fix improves the user experience by providing a more informative and understandable error message. It also prevents the application from crashing due to an unhandled exception.

Please review and provide any feedback. Thank you!

https://github.com/CCExtractor/beacon/assets/143318563/75622ffb-e00d-46d4-904c-3eeb0501f312

vkprogrammer-001 commented 5 months ago

My GitHub got a little messed up so I had to close this pull request, will make a new one in some time , sorry for the inconvenience caused.