Pear-Trading / Foodloop-Server

1 stars 0 forks source link

Add push messaging (+ other assorted improvements) #140

Open Rumperuu opened 3 years ago

Rumperuu commented 3 years ago

NB Travis fails because it can't find the file ./localspend-47012.json, which contains the connection details for the Firebase Cloud Messaging service. This contains sensitive data and shouldn't be tracked, so I'm not sure how to handle this in Travis.

This PR was originally intended to only add push notification functionality to the server. However, it has since expanded to into a bit of a monolith, which certainly isn't ideal and should be avoided in future, but I think I'm the only person working on this at the moment so it shouldn't cause any major issues.

This PR adds the following:

Push Notifications

The message sending functionality uses Firebase Cloud Messaging (though I would like to look into alternatives to this in the future).

First, three new tables have been added to the database:

Eight new API routes have been added to lib/Pear/LocalLoop.pm:

These lead to three new modules in lib/Pear/LocalLoop/Controller/Api/:

Devices.pm provides the following subroutines:

Topic.pm provides the following subroutines:

Sendmessage.pm provides the following subroutines:

See also https://github.com/Pear-Trading/LocalSpend-Tracker/pull/12 & https://github.com/Pear-Trading/FoodLoop-Web/pull/124

Closes #133 #138 #141 #143 #146 #148 #149 #150 #159 #160

Progresses #153 #154