capacitor: bug: PushNotifications is missing the removeAllListeners function

Bug Report

Capacitor Version

npx cap doctor output:

Installed Dependencies:

  @capacitor/core 1.5.1

  @capacitor/cli 1.5.1

  @capacitor/android 1.5.2

  @capacitor/ios 1.5.2


[success] Android looking great! 👌
  Found 4 Capacitor plugins for ios:
    capacitor-fcm (2.0.0)
    cordova-plugin-add-swift-support (1.7.2)
    cordova-plugin-file (6.0.2)
    cordova-plugin-photo-library (2.2.1)
[success] iOS looking great! 👌

Affected Platform(s)

  • Android
  • iOS
  • Electron
  • Web

Current Behavior

  1. PushNotifications.removeAllListeners is not a function.

  2. PushNotifications.requestPermissions returns an empty object.

Expected Behavior

  1. Removes all listeners.

  2. Returns an object with granted property.

Sample Code or Sample Application Repo

PushNotifications.removeAllListeners();

Other Technical Details

When I do console.log(Object.keys(PushNotifications)), I get only:

[
"addListener",
"listChannels",
"removeDeliveredNotifications",
"createChannel",
"getDeliveredNotifications",
"requestPermissions",
"removeAllDeliveredNotifications",
"deleteChannel",
"register"
]

But in the docs, there is a removeAllListeners method?

npm --version output:

6.13.1

node --version output:

v13.2.0

pod --version output (iOS issues only):

1.8.4

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

In capacitor 1 calling register also requested the permission, but doesn’t do it in Capacitor 2.

But please, don’t keep asking questions on github issues.

For questions you can ask on the forum, slack or stack overflow using capacitor tag.