Skip to content

Commit

Permalink
fix: pass dialyzer checks
Browse files Browse the repository at this point in the history
  • Loading branch information
hpopp committed Jul 5, 2021
1 parent 5638e19 commit c26d19b
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/pigeon.ex
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ defmodule Pigeon do
Application.get_env(:pigeon, :json_library, Jason)
end

@spec push(pid | atom, notification :: struct, push_opts) ::
@spec push(pid | atom, notification :: notification, push_opts) ::
notification :: struct | no_return
@spec push(pid | atom, notifications :: [struct, ...], push_opts) ::
@spec push(pid | atom, notifications :: [notification, ...], push_opts) ::
notifications :: [struct, ...] | no_return
def push(pid, notifications, opts \\ [])

Expand Down
1 change: 1 addition & 0 deletions lib/pigeon/adm/notification.ex
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ defmodule Pigeon.ADM.Notification do
}
"""
@type t :: %__MODULE__{
__meta__: Pigeon.Metadata.t(),
consolidation_key: String.t(),
expires_after: integer,
md5: binary,
Expand Down
15 changes: 9 additions & 6 deletions lib/pigeon/apns/notification.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ defmodule Pigeon.APNS.Notification do
collapse_id: nil,
device_token: nil,
expiration: nil,
priority: nil,
push_type: "alert",
id: nil,
payload: %{"aps" => %{}},
priority: nil,
push_type: "alert",
topic: nil,
response: nil

Expand All @@ -20,25 +20,27 @@ defmodule Pigeon.APNS.Notification do
## Examples
%Pigeon.APNS.Notification{
__meta__: %Pigeon.Metadata{on_response: nil},
collapse_id: nil,
device_token: "device token",
expiration: nil,
priority: nil,
push_type: "alert",
id: nil, # Set on push response if nil
payload: %{"aps" => %{"alert" => "push message"}},
priority: nil,
push_type: "alert",
response: nil, # Set on push response
topic: "com.example.YourApp"
}
"""
@type t :: %__MODULE__{
__meta__: Pigeon.Metadata.t(),
collapse_id: String.t() | nil,
device_token: String.t() | nil,
expiration: non_neg_integer | nil,
priority: non_neg_integer | nil,
push_type: String.t() | nil,
id: String.t() | nil,
payload: %{String.t() => term},
priority: non_neg_integer | nil,
push_type: String.t() | nil,
response: response,
topic: String.t() | nil
}
Expand Down Expand Up @@ -96,6 +98,7 @@ defmodule Pigeon.APNS.Notification do
iex> Pigeon.APNS.Notification.new("push message", "device token")
%Pigeon.APNS.Notification{
__meta__: %Pigeon.Metadata{},
device_token: "device token",
expiration: nil,
priority: nil,
Expand Down
1 change: 1 addition & 0 deletions lib/pigeon/fcm/notification.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ defmodule Pigeon.FCM.Notification do
webpush: nil

@type t :: %__MODULE__{
__meta__: Pigeon.Metadata.t(),
android: map | nil,
apns: map | nil,
data: map | nil,
Expand Down
1 change: 1 addition & 0 deletions lib/pigeon/legacy_fcm/notification.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ defmodule Pigeon.LegacyFCM.Notification do
alias Pigeon.LegacyFCM.Notification

@type t :: %__MODULE__{
__meta__: Pigeon.Metadata.t(),
collapse_key: nil | String.t(),
condition: nil | String.t(),
content_available: boolean,
Expand Down
6 changes: 4 additions & 2 deletions lib/pigeon/metadata.ex
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
defmodule Pigeon.Metadata do
@moduledoc false
@moduledoc """
Internal push notification metadata.
"""

@type t :: %__MODULE__{
on_response: Pigeon.on_response()
on_response: Pigeon.on_response() | nil
}

defstruct on_response: nil
Expand Down

0 comments on commit c26d19b

Please sign in to comment.