config-plugin-react-native-intercom icon indicating copy to clipboard operation
config-plugin-react-native-intercom copied to clipboard

Disable Request Notification Permission

Open frknylmzcom2 opened this issue 2 years ago • 18 comments

Hello, the plugin currently automatically asks for notification permission when the app is opened, can we add this to a config?

This is my current config, can we add one here like disableNotificationRegistration? Because there is already a place inside where we get notification permission. It seems like it is not user friendly to ask for notification permission as soon as the application is opened at first.

[
  'config-plugin-react-native-intercom',
    {
      androidApiKey: INTERCOM_ANDROID_API_KEY as string,
      iosApiKey: INTERCOM_IOS_API_KEY as string,
      appId: INTERCOM_APP_ID as string,
      isPushNotificationsEnabledAndroid: true,
      isPushNotificationsEnabledIOS: true,
    },
],

Thank You!

frknylmzcom2 avatar Mar 09 '23 14:03 frknylmzcom2

Are you sure this is an intercom issue and not an issue elsewhere in your code? I.e are you sure you're not calling requestNotificationPermissionsAsync on startup etc. Just making sure

elmaxe avatar Mar 12 '23 22:03 elmaxe

Hello,

What OS are you referring to? If iOS, just remove isPushNotificationsEnabledIOS from the config, and you're good to go, you'll be able to request for the permission whenever you wish in your app.

For Android, it should not request the permission upon the app start unless you request to add a new notification channel.

Hope this helps!

eexit avatar Mar 13 '23 10:03 eexit

Are you sure this is an intercom issue and not an issue elsewhere in your code? I.e are you sure you're not calling requestNotificationPermissionsAsync on startup etc. Just making sure

I don't think this is related to the intercom side, because the part that triggers the push notification permission is in the config package. Please see here;

https://github.com/cmaycumber/config-plugin-react-native-intercom/blob/e7f6033d591743c731413407c8a2a4b249027c88/packages/intercom-react-native/src/withIntercomIOS.ts#L93-L116

frknylmzcom2 avatar Mar 14 '23 12:03 frknylmzcom2

Hello,

What OS are you referring to? If iOS, just remove isPushNotificationsEnabledIOS from the config, and you're good to go, you'll be able to request for the permission whenever you wish in your app.

For Android, it should not request the permission upon the app start unless you request to add a new notification channel.

Hope this helps!

Hello, If I remove isPushNotificationsEnabledIOS, I cannot receive push notification by intercom, so when we reply to a user, if the app is not open, we want receive the push notification.

frknylmzcom2 avatar Mar 14 '23 12:03 frknylmzcom2

I'll second the use case that @frknylmzcom2 is asking for. We want to be able to receive Intercom's push notifications on iOS in the app, but would like to disable the config plugin from asking for the permission. Then, we can ask the user for permission in our app code when it makes sense within the app instead of at launch.

We're using a solution based on the fork at https://github.com/EnhanceTech/config-plugin-react-native-intercom for now, but it would be great to have an additional option for the plugin. Perhaps something like requestPushNotificationsPermission: true/false that decides whether the config plugin adds the permission request or not.

Thanks for the work on this config plugin!

noahsettersten avatar May 19 '23 13:05 noahsettersten

I'll third the need for this feature. We have a screen explaining how notifications benefit the user that shows after login. Since implementing this AMAZING plugin, that screen has become a little confused as the permission has already been requested. We are also seeing more users deny the permission, which would be lovely to rectify.

This plugin is great, thanks for the hard work.

patrickomeara avatar Jun 21 '23 09:06 patrickomeara

+1 any updates on this?

itajenglish avatar Aug 14 '23 14:08 itajenglish

+1 any updates on this?

ucakyunus avatar Aug 15 '23 12:08 ucakyunus

+1 on this. I've spent countless hours trying to figure out why do notifications show up at app start.

ovidb avatar Aug 16 '23 17:08 ovidb

@patrickomeara, @ucakyunus, and @ovidb Feel free to use this patch file I created of @noahsettersten's solution.

https://gist.github.com/itajenglish/667791a5b97447f4c2ca2d5c10d54cd5

Patch Package: https://www.npmjs.com/package/patch-package

itajenglish avatar Aug 16 '23 18:08 itajenglish

@itajenglish do you do anything else besides this? If I do this for me Intercom doesn't seem to work anymore.

ovidb avatar Aug 20 '23 13:08 ovidb

@itajenglish do you do anything else besides this? If I do this for me Intercom doesn't seem to work anymore.

@ovidb This is working for us. What seems to be the problem exactly?

itajenglish avatar Aug 20 '23 13:08 itajenglish

@itajenglish I'm now getting this error when I'm trying to send the token to Intercom

 ERROR  Invariant Violation: No callback found with cbID 11392 and callID 5696 for  IntercomModule.sendTokenToIntercom - most likely the callback was already invoked. Args: '[true]', js engine: hermes

And I'm not receiving any messages from intercom, nor can I instantiate it on my side

ovidb avatar Aug 20 '23 13:08 ovidb

@itajenglish

I'm now getting this error when I'm trying to send the token to Intercom


 ERROR  Invariant Violation: No callback found with cbID 11392 and callID 5696 for  IntercomModule.sendTokenToIntercom - most likely the callback was already invoked. Args: '[true]', js engine: hermes

And I'm not receiving any messages from intercom, nor can I instantiate it on my side

@ovidb that's odd. Let's jump on a video call and I can help you troubleshoot https://meet.google.com/zem-rtdh-jps

itajenglish avatar Aug 20 '23 14:08 itajenglish

@itajenglish uhm that's new 😅.

Never had someone offer to jump on a call from a github issue. As you can imagine I didn't expect that, otherwise I would have been paying more attention here

ovidb avatar Aug 20 '23 14:08 ovidb

Hello,

Could you share the solution if you found any?

Thanks.

eexit avatar Aug 21 '23 08:08 eexit

Hello,

Could you share the solution if you found any?

Thanks.

Hi @eexit is the patch file not working for you?

https://github.com/cmaycumber/config-plugin-react-native-intercom/issues/58#issuecomment-1681056994

itajenglish avatar Aug 21 '23 12:08 itajenglish

@itajenglish Aww, sorry. I thought you guys found a solution during your call. I just wanted to be sure you'd share with everyone ^^

Thanks 🙏🏻

eexit avatar Aug 21 '23 14:08 eexit