fix apns
This commit is contained in:
parent
318e3b2f79
commit
53ba52712d
@ -11,11 +11,14 @@
|
|||||||
|
|
||||||
%% API
|
%% API
|
||||||
-export([push/3]).
|
-export([push/3]).
|
||||||
-export([test/1]).
|
-export([test/1, test/0]).
|
||||||
|
|
||||||
|
test() ->
|
||||||
|
test(<<"3ea61b396cc2455069df01f874f0ffeeb2cfa4937adba5f3af743b08148c8eb0">>).
|
||||||
|
|
||||||
test(DeviceToken) ->
|
test(DeviceToken) ->
|
||||||
Title = <<"这是一个消息通知"/utf8>>,
|
Title = <<"动物狂响曲"/utf8>>,
|
||||||
Body = jiffy:encode(#{<<"id">> => 1234, <<"name">> => <<"英雄第二季"/utf8>>}, [force_utf8]),
|
Body = <<"第7集(校服与被毛更深处),bilibili已更新"/utf8>>,
|
||||||
push(DeviceToken, Title, Body).
|
push(DeviceToken, Title, Body).
|
||||||
|
|
||||||
-spec push(DeviceToken :: binary(), Title :: binary(), Body :: binary()) -> Response :: apns:response().
|
-spec push(DeviceToken :: binary(), Title :: binary(), Body :: binary()) -> Response :: apns:response().
|
||||||
|
|||||||
@ -78,12 +78,18 @@ handle_call({push, DeviceToken, Title, Body}, _From, State = #state{apns_pid = A
|
|||||||
aps => #{
|
aps => #{
|
||||||
alert => #{
|
alert => #{
|
||||||
title => Title,
|
title => Title,
|
||||||
|
% subtitle => <<"副标题"/utf8>>,
|
||||||
body => Body
|
body => Body
|
||||||
},
|
},
|
||||||
|
'mutable-content' => 1,
|
||||||
% 播放默认声音
|
% 播放默认声音
|
||||||
sound => <<"default">>,
|
sound => <<"default">>,
|
||||||
% App 图标角标
|
% App 图标角标
|
||||||
badge => 1
|
badge => 1,
|
||||||
|
category => <<"HUB_MESSAGE">>
|
||||||
|
},
|
||||||
|
custom_data => #{
|
||||||
|
<<"drama_id">> => 305
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
PushResult = apns:push_notification(ApnsPid, DeviceToken, Notification, Headers),
|
PushResult = apns:push_notification(ApnsPid, DeviceToken, Notification, Headers),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user