klaviyo / klaviyo-react-native-sdk

MIT License
4 stars 3 forks source link

Future seamless integration plans #103

Closed niklavsBariss closed 6 months ago

niklavsBariss commented 7 months ago

We are about to integrate Klaviyo in our React Native project for notifications and I'm wondering if you are planing on supporting initialising, setup and collecting push tokens without so much native code from users(of this package) perspective - just react-native layer

Klaviyo.initialize()
Klaviyo.getNotificationPermission()
Klaviyo.setPushToken()

Would be helpful to have in js

niklavsBariss commented 7 months ago

I'm just wondering about the planned timeline of #65 and #69

niklavsBariss commented 7 months ago

Excuse my eagerness - I just realised #98 is in progress. Feel free to close this

mTdev1 commented 7 months ago

Also waiting on #98. Hopefully it will be released soon.

youcefswoo commented 7 months ago

Also, a way to switch between subscribing and unsubscribing Mobile Push Notification for the current profile in the React Native layer ?

image image
evan-masseau commented 7 months ago

Thanks for getting in touch! As you already discovered, we are hard at work expanding upon our MVP to bridge initialize and setPushToken into the RN layer. Adding permission requesting to our SDK is not yet scoped. From feedback so far, we anticipate many customers to be using third party libraries for permissions and cross-platform push already. We’d be happy to hear additional feedback from you about your app setup! I’ll keep you posted about #98, we’re doing our due diligence to test it out and draft readme updates. Of course if you want a sneak peak, you can npm install it with the latest commit hash for that branch. I’d welcome early feedback. Just be aware we haven’t completed testing it ourselves!

evan-masseau commented 7 months ago

Also, a way to switch between subscribing and unsubscribing Mobile Push Notification for the current profile in the React Native layer

An actual unsubscribe function is coming, needs to be added to the native SDKs first. We fielded a similar question in the android repo here: https://github.com/klaviyo/klaviyo-android-sdk/issues/106. The current, imperfect recommendation is for the user to control their push notifications by enabling or disabling the notification permission.

youcefswoo commented 7 months ago

Also, a way to switch between subscribing and unsubscribing Mobile Push Notification for the current profile in the React Native layer

An actual unsubscribe function is coming, needs to be added to the native SDKs first. We fielded a similar question in the android repo here: klaviyo/klaviyo-android-sdk#106. The current, imperfect recommendation is for the user to control their push notifications by enabling or disabling the notification permission.

My scenario is that I don't want the notification popup to appear at the start of the application. Instead, within the React Native side, when the user allows notification permission, the Klaviyo profile always remains unsubscribed.

ajaysubra commented 7 months ago

Also, a way to switch between subscribing and unsubscribing Mobile Push Notification for the current profile in the React Native layer

An actual unsubscribe function is coming, needs to be added to the native SDKs first. We fielded a similar question in the android repo here: klaviyo/klaviyo-android-sdk#106. The current, imperfect recommendation is for the user to control their push notifications by enabling or disabling the notification permission.

My scenario is that I don't want the notification popup to appear at the start of the application. Instead, within the React Native side, when the user allows notification permission, the Klaviyo profile always remains unsubscribed.

@youcefswoo we are aware of this limitation and are working to find a solution, in the mean time to workaround the issue, if in your iOS AppDelegate's didFinishLaunchingWithOptions you call registerForRemoteNotifications and you've implemented didRegisterForRemoteNotificationsWithDeviceToken delegate something like this the push enablement status will refresh. We also have an enhancement task in our backlog for our native SDKs to refresh the push enablement status on their own without requiring developers to do the above. When we do that we'll bridge it over to reach native to simplify this workflow.

youcefswoo commented 7 months ago

Also, a way to switch between subscribing and unsubscribing Mobile Push Notification for the current profile in the React Native layer

An actual unsubscribe function is coming, needs to be added to the native SDKs first. We fielded a similar question in the android repo here: klaviyo/klaviyo-android-sdk#106. The current, imperfect recommendation is for the user to control their push notifications by enabling or disabling the notification permission.

My scenario is that I don't want the notification popup to appear at the start of the application. Instead, within the React Native side, when the user allows notification permission, the Klaviyo profile always remains unsubscribed.

@youcefswoo we are aware of this limitation and are working to find a solution, in the mean time to workaround the issue, if in your iOS AppDelegate's didFinishLaunchingWithOptions you call registerForRemoteNotifications and you've implemented didRegisterForRemoteNotificationsWithDeviceToken delegate something like this the push enablement status will refresh. We also have an enhancement task in our backlog for our native SDKs to refresh the push enablement status on their own without requiring developers to do the above. When we do that we'll bridge it over to reach native to simplify this workflow.

and for Android ?

evan-masseau commented 7 months ago

Likewise on android we're implementing an internal solution to more closely track push permission changes. But if you follow the instructions in the readme about collecting push tokens, then just like ajay explained for iOS the enablement status will be refreshed on app open, whenever Klaviyo.setPushToken is invoked.

evan-masseau commented 6 months ago

If you've been watching #98 closely, you'll see it has been merged. We are just updating the example app and documentation and anticipate its release soon. Thanks

ajaysubra commented 6 months ago

@niklavsBariss as @evan-masseau mentioned above we should have a release 0.2.0 soon that should solve two of your requests I.E bridging initialize and setToken. For getNotificationPermission we found certain libraries like @react-native-firebase/messaging provide utility methods for doing this and we didn't feel like it's specific enough to a Klaviyo use case that made sense to bridge. Further, in order to set token from react native, one such library is required anyways to get the APNs token over to the react native layer. So we felt it made sense for developers to leverage that instead of us adding a bridge over to this functionality. If you still feel strongly about this, please open a discussion and we can look into it more.

Please keep an eye out for that release. Closing this out now and appreciate the feedback. Thanks!

evan-masseau commented 6 months ago

Hi folks, our first release supporting initialize and setPushToken from react native has just gone out: v0.2.0