nucleus-ffm / foss_warn

An unofficial open source application to get emergency alerts from https://warnung.bund.de/meldungen.
GNU General Public License v3.0
99 stars 6 forks source link

Add support for Alertswiss alerts #38

Closed julianfairfax closed 2 years ago

julianfairfax commented 2 years ago

I'm not sure if adding support for other countries' alert systems is something you want to do or not, but if it is, adding support for alert.swiss alerts would be very much appreciated as it's entirely impossible to use the the proprietary app on a device without Google Play Services installed in any way, which are required for the app's notifications and for the app to run at all, unfortunately. Thanks for making this app!

nucleus-ffm commented 2 years ago

I hadn't actually planned to add support for other countries. There are things I need to do first to make FOSS Warn more reliable. But I'm not against it, and it would be very cool if FOSS Warn supported more countries. In fact, that would be a big advantage over all the other apps. Maybe in the future, when I have time, I will take a look at this. If there is a developer here who would like to work on this, please contact me. I created this topic (#39) here to collect possible other APIs that can be used.

julianfairfax commented 2 years ago

Have you had a chance to follow up on this yet?

nucleus-ffm commented 2 years ago

I did some research then and now and it seems possible as I found a json file that contains the warnings. But there are still questions before I can include it. First I need to check if it is allowed to use this data. If I understood the legal notice correctly, this data should be under CC BY-NC-SA 2.5 CH. The second point is the list of places for which you can get warnings. I am not sure how to interpret this. Maybe you can help me there. For example, you can get an alert for "ganzer Kanton" and the region is "AR" or "ganzer Kanton" and the region is "TG" or "ganzer Kanton Graubünden" and the region is "GR". So should I just use the regions? For example, what is "GR" exactly?

julianfairfax commented 2 years ago

I did some research then and now and it seems possible as I found a json file that contains the warnings. But there are still questions before I can include it. First I need to check if it is allowed to use this data. If I understood the legal notice correctly, this data should be under CC BY-NC-SA 2.5 CH. The second point is the list of places for which you can get warnings. I am not sure how to interpret this. Maybe you can help me there. For example, you can get an alert for "ganzer Kanton" and the region is "AR" or "ganzer Kanton" and the region is "TG" or "ganzer Kanton Graubünden" and the region is "GR". So should I just use the regions? For example, what is "GR" exactly?

You should use the regions, yes. There are 26 cantons in Switzerland. AR is Argau, TG is Thurgovie, and GR is Grisons, etc: https://en.wikipedia.org/wiki/Cantons_of_Switzerland?wprov=sfla1.

As for the license, that I don't know about. But I can definitely assure you they won't have an issue with your using the data.

julianfairfax commented 2 years ago

I see you added this in c029ae3750c76b73233e6ea3aa2899e259fde02d. I'm looking forward to testing it!

nucleus-ffm commented 2 years ago

I have published a pre-release. I am curious about feedback: https://github.com/nucleus-ffm/foss_warn/releases/tag/pre-0.4.1

julianfairfax commented 2 years ago

I have published a pre-release. I am curious about feedback: https://github.com/nucleus-ffm/foss_warn/releases/tag/pre-0.4.1

I mean it's a little hard to know what the app says because my German level isn't high enough. Stuff appears to be parsed correctly, but I have to go all the way to meine orte to show only my canton. I hope I don't get notified for other cantons, and I don't know if the notifications work, since no new alerts have been issued in the last 20 minutes.

It also seems that sometimes the phones numbers aren't parsed right. As it it says literally Fire service: <a href="tel:118">118</a>

It would be nice to be able to set the language for the alerts too. Since it seems they're all in "English" (I say that since not all cantons actually do it, even on alert.swiss)

I can't test much else since I don't know what the settings and filter options and stuff actually say. Apologies for that. I'm learning German in school, but as I'm the French-speaking part, I'm not exactly proficient yet.

Edit: It seems I can change the settings to show meine orte by default, but I still do have to click on the actual location itself afterwards.

nucleus-ffm commented 2 years ago

So this is a good opportunity to learn German. I forgot that this could be a problem, but internationality is something for later. That would be too much now. I made a simple table with the most important words in FOSS Warn: https://github.com/nucleus-ffm/foss_warn/wiki/Translation-for-Swiss (hope this helps). You are welcome to extends the table. Just write me here what you want to add.

And yes, there are maybe some parsing errors. The warnings are in different languages. I assume they are always in the main language for that region. I have seen some in German, some in English, and some in French. The feature to filter the alerts in the view "Alle Meldungen" -> "All alerts", so that only alerts for your locations are shown, does not work for alert swiss yet.

julianfairfax commented 2 years ago

So this is a good opportunity to learn German. I forgot that this could be a problem, but internationality is something for later. That would be too much now. I made a simple table with the most important words in FOSS Warn: https://github.com/nucleus-ffm/foss_warn/wiki/Translation-for-Swiss (hope this helps). You are welcome to extends the table. Just write me here what you want to add.

I'd be willing to contribute translations if there was a system for it. I can do French once I know what they are in English. I will see what I can add to that table with maybe deepl.com or something.

And yes, there are maybe some parsing errors.

Is there any way to fix that or is going to stay that way?

The warnings are in different languages. I assume they are always in the main language for that region. I have seen some in German, some in English, and some in French.

Well, English isn't the main language anywhere. I think you're just fetching the English one and that works for all of them if the canton plays along. Otherwise though, alert.swiss has a language selector.

The feature to filter the alerts in the view "Alle Meldungen" -> "All alerts", so that only alerts for your locations are shown, does not work for alert swiss yet.

Oh, I suppose that's why then. I won't get notifications for all the cantons though right?

julianfairfax commented 2 years ago

I just got 0.40.0 from F-Droid with this support. I know it's "alpha", but I think this issue can be closed? I will probably open another for UI-related things and for a translation contribution platform, but it seems the Alertswiss support itself is working as intended?