Skip to content

Notification system

Lars edited this page Mar 13, 2021 · 5 revisions

We use a selfmade notification system to distribute important messages to our app users.

Create notifications automatically

Every c:geo developer can create, update or delete notifications using the notification jobs on Jenkins.

Create notifications manually

To update the status page with the new release information, the following step is included in the nightly build process, at the end, when the executable is ready to be downloaded:

curl -X POST http://status.cgeo.org/api/update/nightly --data "key=SECRET" --data "version_code=YYYYMMDD" --data "version_name=YYYY.MM.DD-NB-SHA1"

Several people know the SECRET (at least @mucek4, @samueltardieu and @Bananeweizen).

Same for release candidates, using

curl -X POST http://status.cgeo.org/api/update/rc --data "key=SECRET" --data "version_code=YYYYMMDD" --data "version_name=YYYY.MM.DD-RC-SHA1"

And, for a plain release on Market, once it has appeared on Google Play:

curl -X POST http://status.cgeo.org/api/update/release --data "key=SECRET" --data "version_code=YYYYMMDD" --data "version_name=YYYY.MM.DD"

Once a release has been done, one can remove the release candidate information by using:

curl -X DELETE "http://status.cgeo.org/api/update/rc?key=SECRET"

One can also update the message sent to up-to-date clients with:

curl -X POST http://status.cgeo.org/api/update/message --data "key=SECRET" --data "message=This is the message" --data "icon=attribute_danger" --data "message_id=emergency_message" --data "url=http://www.cgeo.org/" --data-urlencode 'condition=kind == "developer"'

Only message is mandatory. icon must be an existing attribute in the application, message_id may override message if the resource can be found in the application (it would be localizable), url would make the message clickable. condition expresses a condition to match before the message is sent to the client.

The condition can use the versionCode (integer), versionName (string) and kind (string, one of "release", "rc", "nightly", "deployment", "rc-deployment", or "developer") variables, and compare them to integers or strings (depending on the type) using operators ==, !=, <=, >=, <, and >. Booleans (including the true and false constants) can be manipulated using &&, ||, ^, and !. Parentheses can be used for grouping.

For example, nightly builds are targeted by using condition kind == "nightly", and 2016 builds are targeted by using condition versionName >= "2016" && versionName < "2017".

However, remember that a message is displayed only if no upgrade-specific message is available.

A message is removed using:

curl -X DELETE "http://status.cgeo.org/api/update/message?key=SECRET"

Notifactions on the website

On the homepage you can add a notification by editing https://github.com/cgeo/cgeo.github.io/blob/master/_includes/warning.md.

Clone this wiki locally