Skip to content

Commit

Permalink
deprecate gcm (2600hz#6221)
Browse files Browse the repository at this point in the history
* google deprecated gcm in favour of firebase
  • Loading branch information
lazedo authored and icehess committed Dec 26, 2019
1 parent fb41988 commit e22975c
Show file tree
Hide file tree
Showing 23 changed files with 26 additions and 662 deletions.
24 changes: 0 additions & 24 deletions applications/crossbar/priv/api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -34756,30 +34756,6 @@
}
},
"type": "object"
},
"google": {
"default": {},
"description": "pusher google",
"properties": {
"api_key": {
"description": "API Key for gcm",
"type": "string"
},
"headers": {
"default": {},
"description": "pusher google headers",
"type": "object"
}
},
"type": "object"
},
"modules": {
"default": [],
"description": "pusher modules",
"items": {
"type": "string"
},
"type": "array"
}
},
"type": "object"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,30 +48,6 @@
}
},
"type": "object"
},
"google": {
"default": {},
"description": "pusher google",
"properties": {
"api_key": {
"description": "API Key for gcm",
"type": "string"
},
"headers": {
"default": {},
"description": "pusher google headers",
"type": "object"
}
},
"type": "object"
},
"modules": {
"default": [],
"description": "pusher modules",
"items": {
"type": "string"
},
"type": "array"
}
},
"type": "object"
Expand Down
18 changes: 0 additions & 18 deletions applications/crossbar/priv/oas3/oas3-schemas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12749,24 +12749,6 @@
'description': pusher firebase headers
'type': object
'type': object
'google':
'default': {}
'description': pusher google
'properties':
'api_key':
'description': API Key for gcm
'type': string
'headers':
'default': {}
'description': pusher google headers
'type': object
'type': object
'modules':
'default': []
'description': pusher modules
'items':
'type': string
'type': array
'type': object
'system_config.qubicle':
'description': Schema for qubicle system_config
Expand Down
127 changes: 0 additions & 127 deletions applications/pusher/src/modules/pm_google.erl

This file was deleted.

5 changes: 2 additions & 3 deletions applications/pusher/src/pusher.app.src
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{application,pusher,
[{applications,[apns,fcm,gcm,kazoo,kazoo_amqp,kazoo_apps,
[{applications,[apns,fcm,kazoo,kazoo_amqp,kazoo_apps,
kazoo_data,kazoo_sip,kazoo_stdlib,kazoo_web,
kernel,lager,public_key,stdlib]},
{description,"pusher - wake the dead"},
{env,[{is_kazoo_app,true}]},
{mod,{pusher_app,[]}},
{modules,[]},
{registered,[pusher_cache,pm_google,pm_apple,pusher_sup,
pusher_module_sup]},
{registered,[pm_apple,pm_firebase,pusher_sup,pusher_module_sup]},
{vsn,"4.0.0"}]}.
2 changes: 2 additions & 0 deletions applications/pusher/src/pusher.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
-define(TOKEN_KEY, <<"Token-ID">>).
-define(TOKEN_PROXY_KEY, <<"Proxy-Path">>).

-define(MODULES, ['pm_apple', 'pm_firebase']).

-type push_app() :: {kz_term:api_pid(), map()} | 'undefined'.

-define(PUSHER_HRL, 'true').
Expand Down
28 changes: 21 additions & 7 deletions applications/pusher/src/pusher_listener.erl
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,28 @@
-spec handle_push(kz_json:object(), kz_term:proplist()) -> 'ok'.
handle_push(JObj, _Props) ->
Token = kz_json:get_value(<<"Token-ID">>, JObj),
TokenType = kz_json:get_value(<<"Token-Type">>, JObj),
TokenType = pm_module(kz_json:get_value(<<"Token-Type">>, JObj)),
Module = kz_term:to_atom(<<"pm_",TokenType/binary>> , 'true'),
lager:debug("pushing for token ~s(~s) to module ~s", [Token, TokenType, Module]),
JObj1 = kz_json:insert_value([<<"Payload">>, <<"utc_unix_timestamp_ms">>]
,kz_term:to_binary(os:system_time(millisecond))
,JObj
),
gen_server:cast(Module, {'push', JObj1}).
case lists:member(Module, ?MODULES)
andalso whereis(Module)
of
'false' ->
lager:error("module ~s not available for token ~s(~s)", [Module, Token, TokenType]);
'undefined' ->
lager:error("module ~s not available for token ~s(~s)", [Module, Token, TokenType]);
Pid ->
lager:debug("pushing for token ~s(~s) to module ~s", [Token, TokenType, Module]),
gen_server:cast(Pid, {'push', add_timestamp_to_payload(JObj)})
end.

pm_module(<<"google">>) -> <<"firebase">>;
pm_module(<<"android">>) -> <<"firebase">>;
pm_module(Any) -> Any.

add_timestamp_to_payload(JObj) ->
kz_json:insert_value([<<"Payload">>, <<"utc_unix_timestamp_ms">>]
,kz_term:to_binary(os:system_time(millisecond))
,JObj).

-spec handle_reg_success(kz_json:object(), kz_term:proplist()) -> 'ok'.
handle_reg_success(JObj, _Props) ->
Expand Down
4 changes: 1 addition & 3 deletions applications/pusher/src/pusher_module_sup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@

-define(SERVER, ?MODULE).

-define(CHILDREN, [ ?WORKER(kz_term:to_atom(Mod, 'true'))
|| Mod <- kapps_config:get_ne_binaries(?CONFIG_CAT, <<"modules">>, [])
]).
-define(CHILDREN, [?WORKER(Mod) || Mod <- ?MODULES]).

%%%=============================================================================
%%% API functions
Expand Down
15 changes: 0 additions & 15 deletions core/gcm/.travis.yml

This file was deleted.

21 changes: 0 additions & 21 deletions core/gcm/LICENSE

This file was deleted.

7 changes: 0 additions & 7 deletions core/gcm/Makefile

This file was deleted.

Loading

0 comments on commit e22975c

Please sign in to comment.