CCExtractor / beacon

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

Fix for Future Date Validation in Beacon Project #218

Closed vkprogrammer-001 closed 7 months ago

vkprogrammer-001 commented 8 months ago

fix #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/4e07da22-5e72-4d91-afc1-68b7130d5e8e

Akshatji800 commented 7 months ago

Is this the correct way to solve this issue?

vkprogrammer-001 commented 7 months ago

@Akshatji800 can you please review the changes