customerio / customerio-reactnative

MIT License
23 stars 11 forks source link

CustomerIO.getPushPermissionStatus() on android never return PushPermissionStatus.NotDetermined #190

Closed AChevallier closed 12 months ago

AChevallier commented 12 months ago

SDK version: "customerio-reactnative": "3.1.7",

Environment: Production

Describe the bug CustomerIO.getPushPermissionStatus() on android never return PushPermissionStatus.NotDetermined only PushPermissionStatus.Denied or PushPermissionStatus.Granted

To Reproduce

  const checkNotificationPermission = async () => {
    // logger.log('CIO will check push permission')
    const permissionResponse = await CustomerIO.getPushPermissionStatus()
    // logger.log(`CIO push permission status: ${permissionResponse}`)

    if (permissionResponse === PushPermissionStatus.NotDetermined) {
      await CustomerIO.showPromptForPushNotifications({
        ios: { sound: true, badge: true },
      })
    }
  }

Expected behavior If this is not a bug then It should be in the documentation. If it's a bug then it should return PushPermissionStatus.NotDetermined the first time we install the app, before calling showPromptForPushNotifications

Shahroz16 commented 12 months ago

Hey, @AChevallier thank you for reaching out, this is just for iOS. We did try to mention it in the docs

You can configure push notifications to request authorization for sounds and badges as well (only on iOS). If a user opts into push notifications, the CustomerIO.showPromptForPushNotifications method will return Granted, otherwise, it returns Denied as a string. If the user has not yet been asked to opt into notifications, the method will return NotDetermined (only for iOS).

We will definitely look into how we could have improved the copy here to be more clear.

AChevallier commented 12 months ago

Thank you @Shahroz16 ! I missed this line !

AChevallier commented 12 months ago

I was looking at there, you could explain it there too !