vikramvasudevan commited on
Commit
0eee7a6
·
verified ·
1 Parent(s): cb6f831

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. modules/firebase/messaging.py +21 -1
modules/firebase/messaging.py CHANGED
@@ -33,7 +33,9 @@ class FcmService:
33
  service_account_json = os.getenv("FIREBASE_SERVICE_ACCOUNT_JSON")
34
 
35
  if not service_account_json:
36
- raise RuntimeError("FIREBASE_SERVICE_ACCOUNT_JSON not found in environment variables")
 
 
37
 
38
  # Load service account credentials from env JSON
39
  cred_info = json.loads(service_account_json)
@@ -55,6 +57,24 @@ class FcmService:
55
  ),
56
  data=request.data or {},
57
  token=request.token,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  )
59
 
60
  response = messaging.send(message)
 
33
  service_account_json = os.getenv("FIREBASE_SERVICE_ACCOUNT_JSON")
34
 
35
  if not service_account_json:
36
+ raise RuntimeError(
37
+ "FIREBASE_SERVICE_ACCOUNT_JSON not found in environment variables"
38
+ )
39
 
40
  # Load service account credentials from env JSON
41
  cred_info = json.loads(service_account_json)
 
57
  ),
58
  data=request.data or {},
59
  token=request.token,
60
+ android=messaging.AndroidConfig(
61
+ priority="high",
62
+ notification=messaging.AndroidNotification(
63
+ sound="default",
64
+ channel_id="feedback_notifications", # optional but recommended
65
+ ),
66
+ ),
67
+ apns=messaging.APNSConfig(
68
+ payload=messaging.APNSPayload(
69
+ aps=messaging.Aps(
70
+ sound="default",
71
+ content_available=True,
72
+ )
73
+ ),
74
+ headers={
75
+ "apns-priority": "10", # 10 = immediate
76
+ },
77
+ ),
78
  )
79
 
80
  response = messaging.send(message)