feat: add descriptions to Push Notification Settings
- mark it as beta - validate relay server url key
This commit is contained in:
parent
ec0b1f393a
commit
2e79f6acb4
2 changed files with 26 additions and 6 deletions
|
|
@ -1,12 +1,14 @@
|
|||
{
|
||||
"actions": [],
|
||||
"allow_rename": 1,
|
||||
"beta": 1,
|
||||
"creation": "2024-01-04 11:36:08.013039",
|
||||
"doctype": "DocType",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"authentication_credential_section",
|
||||
"section_break_qgjr",
|
||||
"enable_push_notification_relay",
|
||||
"authentication_credential_section",
|
||||
"api_key",
|
||||
"api_secret"
|
||||
],
|
||||
|
|
@ -18,6 +20,7 @@
|
|||
"label": "Enable Push Notification Relay"
|
||||
},
|
||||
{
|
||||
"description": "API Key and Secret to interact with the relay server. These will be auto-generated when the first push notification is sent from any of the apps installed on this site.",
|
||||
"fieldname": "authentication_credential_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Authentication"
|
||||
|
|
@ -25,18 +28,26 @@
|
|||
{
|
||||
"fieldname": "api_key",
|
||||
"fieldtype": "Data",
|
||||
"label": "API Key"
|
||||
"label": "API Key",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "api_secret",
|
||||
"fieldtype": "Password",
|
||||
"label": "API Secret"
|
||||
"label": "API Secret",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"description": "Enabling this will register your site on a central relay server to send push notifications for all installed apps through Firebase Cloud Messaging. This server only stores user tokens and error logs, and no messages are saved. ",
|
||||
"fieldname": "section_break_qgjr",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Relay Settings"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"issingle": 1,
|
||||
"links": [],
|
||||
"modified": "2024-01-04 17:52:41.383109",
|
||||
"modified": "2024-02-28 00:37:18.398000",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Integrations",
|
||||
"name": "Push Notification Settings",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
# Copyright (c) 2024, Frappe Technologies and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
# import frappe
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
|
||||
|
||||
|
|
@ -19,4 +20,12 @@ class PushNotificationSettings(Document):
|
|||
enable_push_notification_relay: DF.Check
|
||||
# end: auto-generated types
|
||||
|
||||
pass
|
||||
def validate(self):
|
||||
self.validate_relay_server_setup()
|
||||
|
||||
def validate_relay_server_setup(self):
|
||||
if self.enable_push_notification_relay and not frappe.conf.get("push_relay_server_url"):
|
||||
frappe.throw(
|
||||
_("The Push Relay Server URL key (`push_relay_server_url`) is missing in your site config"),
|
||||
title=_("Relay Server URL missing"),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue