Current section

57 Versions

Jump to

Compare versions

19 files changed
+529 additions
-1207 deletions
  @@ -0,0 +1,347 @@
1 + # Changelog
2 +
3 + ## v2.0.0-rc.3
4 +
5 + ### Breaking Changes
6 +
7 + - `Pigeon.LegacyFCM` has been removed entirely and migrated to [pigeon_legacy_fcm](https://github.com/codedge-llc/pigeon-legacy-fcm) package.
8 + - FCM `service_account_json` config option has been removed and replaced with `:auth`, a [Goth](https://github.com/peburrows/goth) configuration.
9 + See `Pigeon.FCM` documentation for setup and [#235](https://github.com/codedge-llc/pigeon/pull/235) for more details.
10 +
11 + **Changed**
12 +
13 + - Bump `goth` dependency to `~> 1.4.3`. ([#252](https://github.com/codedge-llc/pigeon/pull/252))
14 +
15 + **Fixed**
16 +
17 + - `DispatcherWorker` missing a clause for `{:stop, reason}` in the handle_info function.
18 +
19 + ## v2.0.0-rc.2
20 +
21 + **Fixed**
22 +
23 + - Resolve APNS `:too_many_provider_token_updates` by moving token generation into
24 + `APNS.Token` ([#227](https://github.com/codedge-llc/pigeon/pull/227)).
25 + - Support HTTPoison 2.0. ([#236](https://github.com/codedge-llc/pigeon/pull/236))
26 + - Improve handling of FCM error responses. ([#245](https://github.com/codedge-llc/pigeon/pull/245))
27 + - Fix `DispatcherWorker` missing a clause for `{:stop, reason}` in the init function.
28 + - `APNS.Config` keys now decode properly for PEMs generated with OpenSSL 3. ([#248](https://github.com/codedge-llc/pigeon/pull/248))
29 + - Add `ExpiredToken` as APNS error response. ([#240](https://github.com/codedge-llc/pigeon/pull/240))
30 + - Better handling of APNS token lifecycle between `:dev`/`:prod` environments with the same key identifier. ([#239](https://github.com/codedge-llc/pigeon/pull/239))
31 +
32 + ## v2.0.0-rc.1
33 +
34 + **Fixed**
35 +
36 + - Reset stream ID when connection is closed. ([#216](https://github.com/codedge-llc/pigeon/pull/217))
37 +
38 + **Changed**
39 +
40 + - Bump `goth` dependency to `~> 1.3.0`. ([#224](https://github.com/codedge-llc/pigeon/pull/224))
41 + - Bump minimum supported Elixir version to `1.7`.
42 +
43 + ## v2.0.0-rc.0
44 +
45 + **Changed**
46 +
47 + - Default JSON library set to Jason.
48 + ([#182](https://github.com/codedge-llc/pigeon/pull/182))
49 + - Pigeon application module moved from `Pigeon` to `Pigeon.Application`.
50 + ([#183](https://github.com/codedge-llc/pigeon/pull/183))
51 + - Kadabra bumped to v0.5.0, and now a required dependency.
52 + ([#184](https://github.com/codedge-llc/pigeon/pull/184))
53 + - Sending a list of pushes synchronously now actually sends them one at a time. For production
54 + workloads, using the async `:on_response` callback is strongly suggested.
55 +
56 + **Fixed**
57 +
58 + - Removed Elixir 1.11 compile warnings.
59 + ([#184](https://github.com/codedge-llc/pigeon/pull/184))
60 +
61 + **Removed**
62 +
63 + - `:certfile` and `:keyfile` are no longer valid options for APNS configurations.
64 + Instead, read the file before loading (e.g. `cert: File.read!("cert.pem")`)
65 + ([#183](https://github.com/codedge-llc/pigeon/pull/183))
66 + - `:debug_log` removed.
67 +
68 + ## v1.6.0
69 +
70 + **Added**
71 +
72 + - JSON library made configurable. For backwards compatibility, Poison is still a required dependency.
73 + Override in your `config.exs`.
74 +
75 + ```
76 + config :pigeon, json_library: Jason
77 + ```
78 +
79 + **Fixed**
80 +
81 + - Handle FCM single message_id's on topic pushes.
82 +
83 + ## v1.5.1
84 +
85 + - Added APNS InvalidPushType error ([#172](https://github.com/codedge-llc/pigeon/pull/172)).
86 + - Fixed various typespecs ([#170](https://github.com/codedge-llc/pigeon/pull/170)).
87 +
88 + ## v1.5.0
89 +
90 + - Bumped minimum Elixir version to 1.6
91 + - Raise `Pigeon.ConfigError` when booting invalid config structs.
92 + See below for validated keys and error types.
93 + - `APNS.JWTConfig` now validates key p8 content before connecting.
94 + - Relaxed `gen_stage` dependency to allow `~> 1.0`
95 +
96 + Validated config keys:
97 +
98 + - `ADM.Config` - `:client_id`, `:client_secret`
99 + - `APNS.Config` - `:cert`, `:key`
100 + - `APNS.JWTConfig` - `:team_id`, `:key`, `:key_identifier`
101 + - `FCM.Config` - `:key`
102 +
103 + Possible error values:
104 +
105 + - `{:error, {:invalid, value}}`
106 + - `{:error, {:nofile, value}}`
107 +
108 + ## v1.4.0
109 +
110 + - `apns-push-type` header support for iOS 13. An additional `:push_type` key has been
111 + added to the `APNS.Notification` struct.
112 +
113 + ## v1.3.2
114 +
115 + - Document workers configuration for run-time configuration of push workers.
116 + - Modify run-time configuration of push workers so that multiple (or no)
117 + workers may be returned by the startup configuration.
118 +
119 + ## v1.3.1
120 +
121 + - Joken dependency bumped to 2.1
122 +
123 + ## v1.3.0
124 +
125 + - Support for FCM `content_available`, `mutable_content`, and `condition` keys
126 + - Set `priority` of APNS notifications
127 + - Joken dependency bumped to 2.0.1
128 +
129 + ## v1.2.4
130 +
131 + - Fixed ADM handling of connection timeouts
132 +
133 + ## v1.2.3
134 +
135 + - Fixed APNS, FCM and ADM error response parse crashes. Error responses not
136 + listed in the documentation are returned as `:unknown_error`
137 +
138 + ## v1.2.2
139 +
140 + - Fixed APNS handling of notification `expiration`
141 + - Added APNS support for `collapse_id`
142 +
143 + ## v1.2.1
144 +
145 + - FCM notifications can now handle `time_to_live`, `collapse_key`, `restricted_package_name`
146 + and `dry_run` keys
147 +
148 + ## v1.2.0
149 +
150 + - Support for APNS JWT configuration
151 + - Bump `kadabra` dependency to `v0.4.2`
152 +
153 + ## v1.1.6
154 +
155 + - Relax `gen_stage` dependency to `~> 0.12`
156 + - Bump `kadabra` dependency to `v0.3.7`
157 +
158 + ## v1.1.5
159 +
160 + - Fix: relax `httpoison` dependency to allow `0.x` or `1.0`
161 +
162 + ## v1.1.4
163 +
164 + - Fix: `:on_response` callbacks spawned as supervised task instead of running
165 + in the `Worker` process
166 + - Fix: ADM token refresh failure returns updated notification instead of
167 + error tuple
168 +
169 + ## v1.1.3
170 +
171 + - More robust FCM/APNS backpressure
172 + - Bumped minimum Kadabra version to `v0.3.6`
173 +
174 + ## v1.1.2
175 +
176 + - Auto-restart connections if max stream ID is reached
177 + - FCM/APNS Workers now use GenStage to queue pending pushes
178 + - Bumped minimum Kadabra version to `v0.3.5`
179 +
180 + ## v1.1.1
181 +
182 + - Bumped minimum Kadabra version to `v0.3.4`
183 +
184 + ## v1.1.0
185 +
186 + - Minimum requirements now Elixir v1.4 and OTP 19.2 (Kadabra bumped
187 + to `v0.3.0`)
188 + - Startup worker configs. Create a functions that return config
189 + structs and specify them your `config.exs` with
190 +
191 + ```elixir
192 + config :pigeon, workers: [
193 + {YourApp.Pigeon, :apns_config},
194 + {YourApp.Pigeon, :fcm_config},
195 + {YourApp.Pigeon, :adm_config},
196 + ...
197 + ]
198 + ```
199 +
200 + **APNS**
201 +
202 + - `APNS.Config.config/1` renamed to `APNS.Config.new/1`
203 + - `APNS.push/2` tagged tuples done away with in favor of a `:response` key on
204 + the notification.
205 + - Override push server endpoint with `:uri` option in `APNS.Config.new/1`
206 + - `:use_2197` renamed to `:port`
207 + - `:uri` config option for overriding push server endpoint
208 + - `:reconnect` now false by default
209 +
210 + **FCM**
211 +
212 + - `NotificationResponse` done away with in favor of a `:response` key
213 + on `Notification`
214 + - Override push server endpoint with `:uri` and `:port` options
215 + in `FCM.Config.new/1`
216 + - `:uri` and `:port` config options for overriding push server endpoint
217 +
218 + **ADM**
219 +
220 + - `ADM.Config.config/1` renamed to `ADM.Config.new/1`
221 + - `ADM.push/2` tagged tuples done away with in favor of a `:response` key on
222 + the notification.
223 + - `ADM.start_connection/1` and `ADM.stop_connection/1` added
224 +
225 + ## v1.0.4
226 +
227 + - Fix: removed connection pinging from FCM.Worker (`:ping_period` option
228 + left in FCM config to not break API)
229 +
230 + ## v1.0.3
231 +
232 + - Fixed proper handling of large FCM push batches
233 +
234 + ## v1.0.2
235 +
236 + - Fixed FCM infinite `GOAWAY session_timed_out` loop
237 +
238 + ## v1.0.1
239 +
240 + - Configurable `:ping_period` for FCM connections
241 +
242 + ## v1.0.0
243 +
244 + - GCM migrated to FCM API (http2)
245 + - `GCM` modules renamed to `FCM`
246 + - Set priority of FCM notifications
247 + - `APNSWorker` and `ADMWorker` renamed to `APNS.Worker` and `ADM.Worker`
248 + - Disable auto-reconnect for APNS workers with `reconnect: false`
249 + - Removed Chatterbox http2 client adapter
250 +
251 + ## v0.13.0
252 +
253 + - Configurable `:ping_period` for APNS connections
254 +
255 + ## v0.12.1
256 +
257 + - Various `chatterbox` client adapter fixes
258 +
259 + ## V0.12.0
260 +
261 + - Configurable `Pigeon.Http2.Client`. Currently supports `kadabra`
262 + and `chatterbox`
263 + - `kadabra` bumped to `v0.2.0`
264 +
265 + ## v0.11.0
266 +
267 + - APNS workers can be started and referenced with pids and/or atom names
268 + - Fix: Push `:name` option renamed to `:to`
269 + - Fix: GCM/ADM async pushes now use `spawn/1` instead of `Task.async/1`
270 +
271 + ## v0.10.3
272 +
273 + - Fix: cleaned up Elixir v1.4 warnings
274 +
275 + ## v0.10.2
276 +
277 + - Fix: poison dependency version made optionally `~> 2.0 or ~> 3.0`
278 +
279 + ## v0.10.1
280 +
281 + - Fix: kadabra not started
282 +
283 + ## v0.10.0
284 +
285 + - Migrated HTTP/2 client from `chatterbox` to `kadabra`
286 + - Support for ADM (Amazon Android) push
287 + - APNS pushes are now synchronous by default. For async pushes use the
288 + new `on_response` option. GCM and ADM will have it in the next major release.
289 + - Bulk APNS pushing
290 + - Handling of multiple APNS worker connections with different configs
291 + - Re-implemented APNS socket pings to keep connections open
292 + - `:invalid_jSON` corrected to `:invalid_json`
293 +
294 + ## v0.9.2
295 +
296 + - Fixed GCM error response atom conversion
297 +
298 + ## v0.9.1
299 +
300 + - Fixed :eaddrinuse error when restarting Pigeon too quickly with
301 + :apns_2197 enabled
302 +
303 + ## v0.9.0
304 +
305 + - APNS topic made optional
306 + - APNS `put_mutable_content` helper function added
307 + - GCM can be configured on a per-push basis
308 + - Updated to use Macro.underscore
309 +
310 + ## v0.8.0
311 +
312 + - Implemented Chatterbox as APNS HTTP2 client
313 + - APNS server responses now caught asynchronously
314 + - GCM support for `notification` and `data` payload keys
315 + (`Pigeon.GCM.Notification.new` API changes)
316 +
317 + ## v0.7.0
318 +
319 + - APNS cert/key configs can now either be a file path, full-text string,
320 + or `{:your_app, "path/to/file.pem"}` (which looks in the `/priv` directory
321 + of your app)
322 + - Fixed APNSWorker crash on `:ssl.send/2` timeout
323 + - Better error-handling for invalid APNS configs
324 +
325 + ## v0.6.0
326 +
327 + - `Pigeon.APNS.Notification.new/3` returns `%Pigeon.APNS.Notification{}` struct
328 + - Configure APNS to use SSL port 2197 with `apns_2197: true` in
329 + your `config.exs`
330 + - Error feedback symbols converted from `CamelCase` to `snake_case`
331 + - APNS expiration values supported with `expiration` key in
332 + `%Pigeon.APNS.Notification{}`
333 +
334 + ## v0.5.2
335 +
336 + - Fixed bug where APNSWorker would hang up if SSL connection failed. Now
337 + retries the connection twice more before gracefully shutting down.
338 +
339 + ## v0.5.1
340 +
341 + - GCM error responses return proper chunk of regstration IDs
342 +
343 + ## v0.5.0
344 +
345 + - `Pigeon.GCM.Notification.new/2` returns `%Pigeon.GCM.Notification{}` struct
346 + - Multiple registration IDs allowed in `Pigeon.GCM.push/2`
347 + - Remove `:gcm_worker`
  @@ -1,4 +1,4 @@
1 - Copyright (c) 2015-2023 Codedge LLC (https://www.codedge.io/)
1 + Copyright (c) 2015-2024 Codedge LLC (https://www.codedge.io/)
2 2
3 3 Permission is hereby granted, free of charge, to any person obtaining a copy
4 4 of this software and associated documentation files (the "Software"), to deal
  @@ -3,8 +3,11 @@
3 3 > HTTP2-compliant wrapper for sending iOS and Android push notifications.
4 4
5 5 [![CI](https://github.com/codedge-llc/pigeon/actions/workflows/ci.yml/badge.svg)](https://github.com/codedge-llc/pigeon/actions/workflows/ci.yml)
6 - [![Hex.pm](http://img.shields.io/hexpm/v/pigeon.svg)](https://hex.pm/packages/pigeon)
7 - [![Hex.pm](http://img.shields.io/hexpm/dt/pigeon.svg)](https://hex.pm/packages/pigeon)
6 + [![Version](https://img.shields.io/hexpm/v/pigeon.svg)](https://hex.pm/packages/pigeon)
7 + [![Total Downloads](https://img.shields.io/hexpm/dt/pigeon.svg)](https://hex.pm/packages/pigeon)
8 + [![License](https://img.shields.io/hexpm/l/pigeon.svg)](https://github.com/codedge-llc/pigeon/blob/master/LICENSE)
9 + [![Last Updated](https://img.shields.io/github/last-commit/codedge-llc/pigeon.svg)](https://github.com/codedge-llc/pigeon/commits/master)
10 + [![Documentation](https://img.shields.io/badge/documentation-gray)](https://hexdocs.pm/pigeon/)
8 11
9 12 _Pigeon v2.0 is in release candidate status. See [the latest stable 1.6 on Hex](https://hex.pm/packages/pigeon)
10 13 or [the 1.6 branch on GitHub](https://github.com/codedge-llc/pigeon/tree/v1.6) for installation._
  @@ -16,7 +19,7 @@ Add `:pigeon` and as a `mix.exs` dependency:
16 19 ```elixir
17 20 def deps do
18 21 [
19 - {:pigeon, "~> 2.0.0-rc.2"}
22 + {:pigeon, "~> 2.0.0-rc.3"}
20 23 ]
21 24 end
22 25 ```
  @@ -28,7 +31,6 @@ Check the module documentation for your push notification service.
28 31 - [Pigeon.ADM](https://hexdocs.pm/pigeon/2.0.0-rc.2/Pigeon.ADM.html) - Amazon Android.
29 32 - [Pigeon.APNS](https://hexdocs.pm/pigeon/2.0.0-rc.2/Pigeon.APNS.html) - Apple iOS.
30 33 - [Pigeon.FCM](https://hexdocs.pm/pigeon/2.0.0-rc.2/Pigeon.FCM.html) - Firebase Cloud Messaging v1 API.
31 - - [Pigeon.LegacyFCM](https://hexdocs.pm/pigeon/2.0.0-rc.2/Pigeon.LegacyFCM.html) - Firebase Cloud Messaging Legacy API.
32 34
33 35 ### Creating Dynamic Runtime Dispatchers
34 36
  @@ -63,6 +65,6 @@ Git commit subjects use the [Karma style](http://karma-runner.github.io/5.0/dev/
63 65
64 66 ## License
65 67
66 - Copyright (c) 2015-2023 Codedge LLC (https://www.codedge.io/)
68 + Copyright (c) 2015-2024 Codedge LLC (https://www.codedge.io/)
67 69
68 70 This library is MIT licensed. See the [LICENSE](https://github.com/codedge-llc/pigeon/blob/master/LICENSE) for details.
  @@ -1,8 +1,9 @@
1 1 {<<"links">>,
2 2 [{<<"Changelog">>,<<"https://hexdocs.pm/pigeon/changelog.html">>},
3 - {<<"GitHub">>,<<"https://github.com/codedge-llc/pigeon">>}]}.
3 + {<<"GitHub">>,<<"https://github.com/codedge-llc/pigeon">>},
4 + {<<"Sponsor">>,<<"https://github.com/sponsors/codedge-llc">>}]}.
4 5 {<<"name">>,<<"pigeon">>}.
5 - {<<"version">>,<<"2.0.0-rc.2">>}.
6 + {<<"version">>,<<"2.0.0-rc.3">>}.
6 7 {<<"description">>,
7 8 <<"HTTP2-compliant wrapper for sending iOS (APNS), Android (FCM),\nand Amazon Android (ADM) push notifications.">>}.
8 9 {<<"elixir">>,<<"~> 1.7">>}.
  @@ -17,25 +18,23 @@
17 18 <<"lib/pigeon/apns/jwt_config.ex">>,<<"lib/pigeon/apns/shared.ex">>,
18 19 <<"lib/pigeon/dispatcher.ex">>,<<"lib/pigeon/dispatcher_worker.ex">>,
19 20 <<"lib/pigeon/metadata.ex">>,<<"lib/pigeon/tasks.ex">>,
20 - <<"lib/pigeon/legacy_fcm.ex">>,<<"lib/pigeon/fcm.ex">>,
21 - <<"lib/pigeon/http2">>,<<"lib/pigeon/http2/client.ex">>,
22 - <<"lib/pigeon/http2/stream.ex">>,<<"lib/pigeon/http2/kadabra.ex">>,
23 - <<"lib/pigeon/adm">>,<<"lib/pigeon/adm/notification.ex">>,
24 - <<"lib/pigeon/adm/result_parser.ex">>,<<"lib/pigeon/adm/config.ex">>,
25 - <<"lib/pigeon/fcm">>,<<"lib/pigeon/fcm/notification.ex">>,
26 - <<"lib/pigeon/fcm/config.ex">>,<<"lib/pigeon/fcm/error.ex">>,
27 - <<"lib/pigeon/adm.ex">>,<<"lib/pigeon/sandbox.ex">>,
28 - <<"lib/pigeon/notification_queue.ex">>,<<"lib/pigeon/application.ex">>,
29 - <<"lib/pigeon/legacy_fcm">>,<<"lib/pigeon/legacy_fcm/notification.ex">>,
30 - <<"lib/pigeon/legacy_fcm/result_parser.ex">>,
31 - <<"lib/pigeon/legacy_fcm/config.ex">>,<<"lib/pigeon/apns.ex">>,
32 - <<"lib/pigeon.ex">>,<<"mix.exs">>,<<"README.md">>,<<"LICENSE">>]}.
21 + <<"lib/pigeon/fcm.ex">>,<<"lib/pigeon/http2">>,
22 + <<"lib/pigeon/http2/client.ex">>,<<"lib/pigeon/http2/stream.ex">>,
23 + <<"lib/pigeon/http2/kadabra.ex">>,<<"lib/pigeon/adm">>,
24 + <<"lib/pigeon/adm/notification.ex">>,<<"lib/pigeon/adm/result_parser.ex">>,
25 + <<"lib/pigeon/adm/config.ex">>,<<"lib/pigeon/fcm">>,
26 + <<"lib/pigeon/fcm/notification.ex">>,<<"lib/pigeon/fcm/config.ex">>,
27 + <<"lib/pigeon/fcm/error.ex">>,<<"lib/pigeon/adm.ex">>,
28 + <<"lib/pigeon/sandbox.ex">>,<<"lib/pigeon/notification_queue.ex">>,
29 + <<"lib/pigeon/application.ex">>,<<"lib/pigeon/apns.ex">>,
30 + <<"lib/pigeon.ex">>,<<"mix.exs">>,<<"README.md">>,<<"LICENSE">>,
31 + <<"CHANGELOG.md">>]}.
33 32 {<<"licenses">>,[<<"MIT">>]}.
34 33 {<<"requirements">>,
35 34 [[{<<"name">>,<<"goth">>},
36 35 {<<"app">>,<<"goth">>},
37 36 {<<"optional">>,false},
38 - {<<"requirement">>,<<"~> 1.3.0">>},
37 + {<<"requirement">>,<<"~> 1.4.3">>},
39 38 {<<"repository">>,<<"hexpm">>}],
40 39 [{<<"name">>,<<"httpoison">>},
41 40 {<<"app">>,<<"httpoison">>},
  @@ -9,7 +9,6 @@ defmodule Pigeon do
9 9 - `Pigeon.ADM` - Amazon Android.
10 10 - `Pigeon.APNS` - Apple iOS.
11 11 - `Pigeon.FCM` - Firebase Cloud Messaging v1 API.
12 - - `Pigeon.LegacyFCM` - Firebase Cloud Messaging Legacy API.
13 12
14 13 ## Creating Dynamic Runtime Dispatchers
15 14
  @@ -97,6 +96,9 @@ defmodule Pigeon do
97 96 notification :: struct | no_return
98 97 @spec push(pid | atom, notifications :: [notification, ...], push_opts) ::
99 98 notifications :: [struct, ...] | no_return
99 + @doc """
100 + Sends a push notification with given options.
101 + """
100 102 def push(pid, notifications, opts \\ [])
101 103
102 104 def push(pid, notifications, opts) when is_list(notifications) do
Loading more files…