Skip to content

Commit f00705d

Browse files
committed
feat: in app notifications scaffolding
1 parent 04fcd2e commit f00705d

3 files changed

Lines changed: 57 additions & 0 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"WELCOME_DEVELOPER": {
3+
"DANGER_SHOW_ON_EVERY_BOOT" : false,
4+
"HTML_CONTENT": "<div>Welcome to Phoenix Code dev community! Click here to <a class='notification_ack' href='https://discord.com/invite/rBpTBPttca'> chat with our Discord Community.</a></div>",
5+
"FOR_VERSIONS": ">=3.0.0",
6+
"PLATFORM" : "all"
7+
}
8+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{
2+
}

docs/appNotifications/readme.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
## overview
2+
This is used by in app banner or toast notification in phcode. It is automatically translated
3+
by Google Translate. You just need to update `<stage>/root/banner.json` and
4+
`<stage>/root/toast.json` folder in english language
5+
and a pull request will be raised by GitHub actions translating it into all supported languages.
6+
7+
You should merge the pull request if release is valid update, and then merge the `main` branch into
8+
`update-notifications branch` to trigger the updates across the installation base.
9+
10+
## banner notifications - `banner.json`
11+
Banner notifications are shown at the bottom of brackets as seen in picture. Only use this in case of
12+
emergencies to push security updates or other critical updates that needs user attention. Atmost one
13+
banner notification will be shown at a time on screen. If there are multiple, the next notification will only be shown
14+
once the current notification is closed.
15+
16+
### Format of `<stage>/root/banner.json`
17+
18+
`<stage>` can be `dev`, `staging` or `prod`.
19+
20+
A sample json is as follows:
21+
```json
22+
{
23+
"SAMPLE_NOTIFICATION_NAME": {
24+
"DANGER_SHOW_ON_EVERY_BOOT" : false,
25+
"HTML_CONTENT": "<div>hello world <a class='notification_ack'>Click to acknowledge.</a></div>",
26+
"FOR_VERSIONS": "1.x || >=2.5.0 || 5.0.0 - 7.2.3",
27+
"PLATFORM" : "allDesktop"
28+
},
29+
"ANOTHER_SAMPLE_NOTIFICATION_NAME": {...}
30+
}
31+
```
32+
33+
By default, a notification is shown only once except if `DANGER_SHOW_ON_EVERY_BOOT` is set
34+
or there is an html element with class `notification_ack`.
35+
36+
1. `SAMPLE_NOTIFICATION_NAME` : This is a unique ID. It is used to check if the notification was shown to user.
37+
2. `DANGER_SHOW_ON_EVERY_BOOT` : (Default false) Setting this to true will cause the
38+
notification to be shown on every boot. This is bad ux and only be used if there is a critical security issue
39+
that we want the version not to be used.
40+
3. `HTML_CONTENT`: The actual html content to show to the user. It can have an optional `notification_ack` class.
41+
Setting this class in any child html node will cause the notification to be shown once a day until the user explicitly clicks
42+
on any html element with class `notification_ack` or explicitly click the close button.
43+
If such a class is not present, then the notification is shown only once ever.
44+
4. `FOR_VERSIONS` : [Semver compatible version filter](https://www.npmjs.com/package/semver).
45+
The notification will be shown to all versions satisfying this.
46+
5. `PLATFORM`: A comma seperated list of all platforms in which the message will be shown.
47+
allowed values are: `mac,win,linux,allDesktop,firefox,chrome,safari,allBrowser,all`

0 commit comments

Comments
 (0)