Target Android push by Firebase installation ID
This commit is contained in:
parent
e7cfddb587
commit
a7f076514c
|
|
@ -40,7 +40,7 @@ defmodule WhoNeedHelp.Push.FCMAdapter do
|
||||||
def payload(%Notification{} = notification, %PushDevice{} = device) do
|
def payload(%Notification{} = notification, %PushDevice{} = device) do
|
||||||
%{
|
%{
|
||||||
"message" => %{
|
"message" => %{
|
||||||
"token" => device.token,
|
"fid" => device.token,
|
||||||
"data" =>
|
"data" =>
|
||||||
notification.data
|
notification.data
|
||||||
|> stringify_values()
|
|> stringify_values()
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,8 @@ defmodule WhoNeedHelp.PushProductTest do
|
||||||
|
|
||||||
message = payload["message"]
|
message = payload["message"]
|
||||||
refute Map.has_key?(message, "notification")
|
refute Map.has_key?(message, "notification")
|
||||||
assert message["token"] == "firebase-installation-id"
|
refute Map.has_key?(message, "token")
|
||||||
|
assert message["fid"] == "firebase-installation-id"
|
||||||
assert message["data"]["title"] == "New message"
|
assert message["data"]["title"] == "New message"
|
||||||
assert message["data"]["body"] == "Open Who Need Help to read the conversation."
|
assert message["data"]["body"] == "Open Who Need Help to read the conversation."
|
||||||
assert message["data"]["path"] == notification.path
|
assert message["data"]["path"] == notification.path
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user