Showing custom popups
How popups are delivered
Rendering a popup from a campaign deeplink
import AmplySDK
import UIKit
class PopupHandler: DeepLinkListener {
func onDeepLink(url: String, info: [String: Any]) -> Bool {
guard url.hasPrefix("yourapp://popup/") else { return false }
let popupId = String(url.dropFirst("yourapp://popup/".count))
let title = info["title"] as? String ?? ""
let body = info["body"] as? String ?? ""
let cta = info["cta"] as? String ?? "OK"
DispatchQueue.main.async {
PopupRouter.shared.show(
id: popupId,
title: title,
body: body,
cta: cta,
metadata: info
)
}
return true
}
}
amply.registerDeepLinkListener(listener: PopupHandler())Why the app owns the rendering
Recommended pattern
What happens if no listener handles the URL
Related
Last updated