calcazar / react-native-push-notification-CE

The community edition of the push notification library (by Zo0r) for applications made with React Native
MIT License
52 stars 23 forks source link

[iOS] App automatically asking for permissions #26

Closed matthewfbenjamin closed 5 years ago

matthewfbenjamin commented 5 years ago

Hi! I am trying to make it so that my app doesn't ask for permissions on load. Unfortunatley, I get the Permissions Alert box on initial install immediatley after opening the app.

When the app isMounted for the first time I run this snippet of code:

if (iOS) {
    PushNotification.appStart()
    PushNotification.configure({
      onRegister: onPushRegistered,
      onNotification: (notification) => {
          if (notification.foreground) onNotificationReceivedForeground(notification)
          else onNotificationReceivedBackground(notification)

          if (notification.userInteraction) onNotificationOpened(notification, initialize)

          notification.finish(PushNotificationIOS.FetchResult.NoData)
      },
      // Manually ask for permissions on iOS
      requestPermissions: false,
    })
  }

I then, later on, after logging in, ask for permissions in the componentDidMount of the first screen rendered after logging in.

PushNotification.checkPermissions(({ alert, badge, sound }) => {
      if (!alert || !badge || !sound) {
        PushNotification.requestPermissions()
      }
    })

Is there something that I am obviously missing?

matthewfbenjamin commented 5 years ago

I realized that it's another push-notification module doing this.