Skip to content

LocalNotifications Type Importance does not include value 0 #2439

@philliphall

Description

@philliphall

Bug Report

Plugin(s)

LocalNotifications

Capacitor Version

   Capacitor Doctor   

Latest Dependencies:

  @capacitor/cli: 7.4.4
  @capacitor/core: 7.4.4
  @capacitor/android: 7.4.4
  @capacitor/ios: 7.4.4

Installed Dependencies:

  @capacitor/cli: 7.4.3
  @capacitor/core: 7.4.3
  @capacitor/ios: 7.4.3
  @capacitor/android: 7.4.3

[success] Android looking great! 👌
[error] Xcode is not installed

Platform(s)

Android

Current Behavior

type Importance = 3 | 1 | 2 | 4 | 5

Expected Behavior

type Importance = 3 | 1 | 2 | 4 | 5 | 0

Other Technical Details

When users disable notifications for a channel, the Importance value Android returns is IMPORTANCE_NONE which has a value of 0. I confirmed that Capacitor LocalNotifications returns 0 in this case as well, which is confusing since the docs and the return type state the only valid return values are 1-5.

      const { channels } = await LocalNotifications.listChannels();
      const defaultChannel = channels.find(channel => channel.id === DEFAULT_ANDROID_CHANNEL_ID);
      const importance = defaultChannel.importance; // value of 0 when default channel has notifications disabled.

Additional Context

I'm new... probably didn't contribute correctly, just trying to take a few minutes to help someone else.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions