File tree Expand file tree Collapse file tree 2 files changed +26
-3
lines changed
Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ If (Not:C34($isMissingRecipients))
131131 $notificationInput := New object:C1471 (\
132132 "project" ; $Obj_auth .project ; \
133133 "serverKey" ; $Obj_auth .serverKey ; \
134- "message" ; JSON Stringify :C1217 ( $message ) )
134+ "message" ; $message )
135135
136136 $status := android_sendNotification ($notificationInput )
137137
Original file line number Diff line number Diff line change @@ -9,15 +9,38 @@ $Obj_result:=New object:C1471("success"; False:C215)
99
1010// ENDPOINT
1111// ________________________________________
12+
13+ var $message : Variant
14+ $message := $input .message
15+
1216var $endpoint : Text
1317If ($input .project # Null:C1517)
18+
1419 $endpoint := "https://fcm.googleapis.com/v1/projects/" + String:C10 ($input .project )+ "/messages:send"
20+
21+ If (Value type:C1509 ($input .message )= Is object:K8:27)
22+
23+ If ($input .message .to # Null:C1517)
24+ // old format, convert
25+ $message := New object:C1471 ("message" ; New object:C1471 ("token" ; $input .message .to ; "notification" ; $input .message .data ))
26+ End if
27+
28+ End if
29+
1530Else
1631 $endpoint := "https://fcm.googleapis.com/fcm/send"
1732End if
1833
34+ var $messageText : Text
35+ Case of
36+ : (Value type:C1509 ($message )= Is object:K8:27)
37+ $messageText := JSON Stringify:C1217 ($message )
38+ Else
39+ $messageText := String:C10 ($message )
40+ End case
41+
1942If ((Length:C16 (String:C10 ($input .serverKey ))> 0)\
20- & (Length:C16 (String :C10 ( $input . message ) )> 0))
43+ & (Length:C16 ($messageText )> 0))
2144
2245 $cmdPush := "curl"
2346
@@ -37,7 +60,7 @@ If ((Length:C16(String:C10($input.serverKey))>0)\
3760 "--header \" Authorization: " + $authorizationHeader + "\" " + \
3861 "--header \" Content-Type: application/json\" " + \
3962 $endpoint + " " + \
40- "-d \" " + Replace string:C233 ($input . message ; "\" " ; "\\\" " )+ "\" "
63+ "-d \" " + Replace string:C233 ($messageText ; "\" " ; "\\\" " )+ "\" "
4164
4265 LAUNCH EXTERNAL PROCESS:C811 ($cmdPush ; $cmdPush_in ; $cmdPush_out ; $cmdPush_err )
4366
You can’t perform that action at this time.
0 commit comments