MM2-0 / Kvaesitso

A search-focused Android launcher
https://kvaesitso.mm20.de/
GNU General Public License v3.0
2.04k stars 57 forks source link

Chore: migrate OSM parsing of opening-hours to external library #860

Open Sir-Photch opened 1 month ago

Sir-Photch commented 1 month ago

I have come accross some cases where our current parsing of the OSM opening_hours tag is not correct. While digging into the issue, I discovered that in the meantime of merging the OSM PR, some new libraries for just that have popped up. One of them is https://github.com/westnordost/osm-opening-hours which is also used in https://github.com/streetcomplete/StreetComplete.

I suggest migrating to that library instead of re-inventing the wheel, since also, our implementation does not cover month- or season-specific opening hours. What do you think?

Also, would you prefer this change to be a seperate PR or can I just include it in #772?

MM2-0 commented 1 month ago

Feel free. Does that require any changes to the OpeningSchedule interface? Or is it just an implementation detail?

Also, would you prefer this change to be a seperate PR or can I just include it in https://github.com/MM2-0/Kvaesitso/pull/772?

I'd prefer it in a separate PR, so that it doesn't block #772 from being merged.

Sir-Photch commented 1 month ago

Does that require any changes to the OpeningSchedule interface?

Probably not; Creating some OpeningSchedule instance from results returned by that library should still be possible. We can also just skip tracking any season- or month specifics since we only show weekly previews; That is, I'd create the OpeningSchedule instance based on the library result and the users LocalTime.