braze-inc / braze-cordova-sdk

Public repo for the Braze Cordova SDK
https://www.braze.com
Other
21 stars 62 forks source link

iOS Deep links / Universal Links from push notifications doesn't work #76

Open santiq opened 2 years ago

santiq commented 2 years ago

Hi

Deeplinks do not work from push notifications.

I've confirmed they work from clicking regular links, my app opens and redirect to the corresponding view.

Is this something that I should add on my AppDelegate.swift ? Can you provide an example?

Bucimis commented 2 years ago

@santiq is com.appboy.ios_disable_automatic_push_registration set to YES in your config.xml? If not, i.e. you are manually integrating push, you should make sure your AppDelegate is configured per our push integration docs https://www.braze.com/docs/developer_guide/platform_integration_guides/ios/push_notifications/integration/ (specifically, your User Notifications Frameworks delegates should call corresponding Braze methods, which will make deep links work)

santiq commented 2 years ago

@Bucimis It is set to 'true'

  <preference name="com.appboy.android_handle_push_deep_links_automatically" value="true" />
  <preference name="com.appboy.firebase_cloud_messaging_registration_enabled" value="true" />
  <preference name="com.appboy.android_fcm_sender_id" value="REDACTED" />
  <preference name="com.appboy.enable_location_collection" value="true" />
  <preference name="com.appboy.android_api_endpoint" value="https://sdk.iad-01.braze.com" />
  <preference name="com.appboy.ios_api_endpoint" value="https://sdk.iad-01.braze.com" />
  <preference name="com.appboy.api_key" value="REDACTED" />

However, I do see this on my AppDelegate.swift

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
      NotificationCenter.default.post(name: .capacitorDidRegisterForRemoteNotifications, object: deviceToken)
      Appboy.sharedInstance()?.registerDeviceToken(deviceToken)
    }

What code should I add code in that swift function ?

Bucimis commented 2 years ago

@santiq

  1. Are you using another library, such as Firebase or OneSignal, that is also implementing iOS push through swizzling? It's possible our library and that library are conflicting.
  2. Is that your complete config.xml for Braze?
  3. That code you posted should be fine and not affect deep links

If you're not able to solve based on ^, I would recommend reaching out to support@braze.com with verbose logs and more code samples.