fix apns
This commit is contained in:
parent
ad518db266
commit
318e3b2f79
@ -6,7 +6,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
%%% Created : 03. 4月 2025 15:41
|
%%% Created : 03. 4月 2025 15:41
|
||||||
%%%-------------------------------------------------------------------
|
%%%-------------------------------------------------------------------
|
||||||
-module(dimension_spn_pusher).
|
-module(dimension_apn_pusher).
|
||||||
-author("anlicheng").
|
-author("anlicheng").
|
||||||
|
|
||||||
%% API
|
%% API
|
||||||
@ -18,8 +18,6 @@ test(DeviceToken) ->
|
|||||||
Body = jiffy:encode(#{<<"id">> => 1234, <<"name">> => <<"英雄第二季"/utf8>>}, [force_utf8]),
|
Body = jiffy:encode(#{<<"id">> => 1234, <<"name">> => <<"英雄第二季"/utf8>>}, [force_utf8]),
|
||||||
push(DeviceToken, Title, Body).
|
push(DeviceToken, Title, Body).
|
||||||
|
|
||||||
-spec push(DeviceToken :: binary(), Title :: binary(), Body :: binary()) -> no_return().
|
-spec push(DeviceToken :: binary(), Title :: binary(), Body :: binary()) -> Response :: apns:response().
|
||||||
push(DeviceToken, Title, Body) when is_binary(DeviceToken), is_binary(Title), is_binary(Body) ->
|
push(DeviceToken, Title, Body) when is_binary(DeviceToken), is_binary(Title), is_binary(Body) ->
|
||||||
poolboy:transaction(apns_pool, fun(WorkerPid) ->
|
poolboy:transaction(apns_pool, fun(WorkerPid) -> dimension_apn_worker:push(WorkerPid, DeviceToken, Title, Body) end).
|
||||||
dimension_apn_worker:push(WorkerPid, DeviceToken, Title, Body)
|
|
||||||
end).
|
|
||||||
@ -29,7 +29,7 @@
|
|||||||
%%% API
|
%%% API
|
||||||
%%%===================================================================
|
%%%===================================================================
|
||||||
|
|
||||||
-spec push(Pid :: pid(), DeviceToken :: binary(), Title :: binary(), Body :: binary()) -> no_return().
|
-spec push(Pid :: pid(), DeviceToken :: binary(), Title :: binary(), Body :: binary()) -> Response :: apns:response().
|
||||||
push(Pid, DeviceToken, Title, Body) when is_pid(Pid), is_binary(DeviceToken), is_binary(Title), is_binary(Body) ->
|
push(Pid, DeviceToken, Title, Body) when is_pid(Pid), is_binary(DeviceToken), is_binary(Title), is_binary(Body) ->
|
||||||
gen_server:call(Pid, {push, DeviceToken, Title, Body}).
|
gen_server:call(Pid, {push, DeviceToken, Title, Body}).
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ handle_call({push, DeviceToken, Title, Body}, _From, State = #state{apns_pid = A
|
|||||||
},
|
},
|
||||||
PushResult = apns:push_notification(ApnsPid, DeviceToken, Notification, Headers),
|
PushResult = apns:push_notification(ApnsPid, DeviceToken, Notification, Headers),
|
||||||
lager:debug("[dimension_apn_pusher] push result is: ~p", [PushResult]),
|
lager:debug("[dimension_apn_pusher] push result is: ~p", [PushResult]),
|
||||||
{reply, ok, State}.
|
{reply, PushResult, State}.
|
||||||
|
|
||||||
%% @private
|
%% @private
|
||||||
%% @doc Handling cast messages
|
%% @doc Handling cast messages
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user