pigeon icon indicating copy to clipboard operation
pigeon copied to clipboard

Dialyzer error FCM Notification

Open rlopzc opened this issue 3 years ago • 3 comments

Environment

  • Elixir & Erlang/OTP versions (elixir --version):
Erlang/OTP 24 [erts-12.0.3] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]

Elixir 1.12.2 (compiled with Erlang/OTP 22)
  • Operating system: Arch Linux

Current behavior

I'm implementing a module to use Pigeon FCM Notification but dialyzer complains. I'm using the example provided in the readme (2.0.0-rc.0)

Expected behavior

Dialyzer not complaining

Code

  @spec send_push_notification(String.t(), %{String.t() => String.t()}) :: :ok
  def send_push_notification(token, payload) do
    Pigeon.FCM.Notification.new({:token, token}, payload)
    |> Okani.FCM.push()

    :ok
  end

Dialyzer error

The function call will not succeed.

Okani.FCM.push(%Pigeon.FCM.Notification{
  :__meta__ => %Pigeon.Metadata{:on_response => nil},
  :android => nil,
  :apns => nil,
  :data => _,
  :error => nil,
  :fcm_options => nil,
  :name => nil,
  :notification => _,
  :response => nil,
  :target => {:condition, _} | {:token, _} | {:topic, _},
  :validate_only => nil,
  :webpush => nil
})

will never return since the 1st arguments differ
from the success typing arguments:

(
  [
    %{
      :__meta__ => %Pigeon.Metadata{:on_response => nil | (_ -> any()) | {_, _} | {_, _, _}}
    },
    ...
  ]
  | %{
      :__meta__ => %Pigeon.Metadata{
        :on_response =>
          nil | (map() -> no_return()) | {atom(), atom()} | {atom(), atom(), [any()]}
      }
    }
)

rlopzc avatar Oct 29 '21 14:10 rlopzc

I'm seeing the same error with "2.0.0-rc.0". Btw, thank you for the amazing library! 🙏

madurangae avatar Nov 01 '21 20:11 madurangae

I'm seeing the same error with 2.0.0-rc.0 using Pigeon.push

zaphod534 avatar Nov 04 '21 09:11 zaphod534

Seeing same issue on "2.0.0-rc.0".

icecapp avatar Jan 09 '22 20:01 icecapp