You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Button and link clicks in in-app messages are handled similarly to [deep links](#deep-linking) in push notifications and emails. If a user taps a button or link in an in-app message, and its `href` contains a URL (which is usually the case), the SDK will call the `handle` method of `IterableConfig.urlDelegate` (an object of type `IterableURLDelegate`), if it is set. If this delegate is not set, by default the URL found in the `href` property will open in Safari.
470
-
471
-
Custom actions are specified by passing `action://customActionName` as the link URL (notice the `action://` scheme name). If the in-app message's `href` property contains a custom action, tapping the message will call the `handle` method of `IterableConfig.customActionDelegate` (an object that conforms to the `IterableCustomActionDelegate` protocol). If `customActionDelegate` is not set, by default nothing will happen.
468
+
The SDK handles in-app message buttons and links as follows:
469
+
470
+
- If the URL of the button or link uses the `action://` URL scheme, the SDK
471
+
passes the action to `IterableConfig.customActionDelegate.handle()`. If
472
+
`customActionDelegate` (an `IterableCustomActionDelegate` object) has not
473
+
been set, the action will not be handled.
474
+
475
+
- For the time being, the SDK will treat `itbl://` URLs the same way as
476
+
`action://` URLs. However, this behavior will eventually be deprecated
477
+
(timeline TBD), so it's best to migrate to the `action://` URL scheme
478
+
as it's possible to do so.
479
+
480
+
- The `iterable://` URL scheme is reserved for action names predefined by
481
+
the SDK. If the URL of the button or link uses an `iterable://` URL known
482
+
to the SDK, it will be handled automatically and will not be passed to the
483
+
custom action handler.
484
+
485
+
- The SDK passes all other URLs to `IterableConfig.urlDelegate.handle()`. If
486
+
`urlDelegate` (an `IterableUrlDelegate` object) has not been set, or if it
487
+
returns `false` for the provided URL, the URL will be opened by the system
488
+
(using a web browser or other application, as applicable).
489
+
490
+
Take a look at [this sample code](https://github.com/Iterable/swift-sdk/blob/master/sample-apps/swift-sample-app/swift-sample-app/AppDelegate.swift)
491
+
for a demonstration of how to implement and use the `IterableURLDelegate` and `IterableCustomActionDelegate` protocols.
492
+
493
+
The following code demonstrates how to assign a `urlDelegate` and
494
+
`customActionDelegate` to an `IterableConfig` object:
472
495
473
-
Take a look at [this sample code](https://github.com/Iterable/swift-sdk/blob/master/sample-apps/swift-sample-app/swift-sample-app/AppDelegate.swift), which demonstrates how to implement and use the `IterableURLDelegate` and `IterableCustomActionDelegate` protocols.
0 commit comments