Deep Links

This is a mandatory step if you have the GYP product (Games You Play) enabled.

Registering for Deep Linking

If you have the GYP product (Games You Play) enabled, you must register to our deep link provider & deep link handler in order to make it work. GYP contests are shared exclusively through deep links, so the first step is to implement the code snippet below as soon as possible in your app lifecycle:

lucraClient.registerDeeplinkProvider { lucraDeeplink in 
    // use your own custom code to embed lucraDeeplink into your short link format
    await YourAppDeeplinkService().pack(deeplink: lucraDeeplink)
}

registerDeeplinkProvider callback returns a Lucra Deep Link that you can embed into your own short URL and return asynchronously to be shared by LucraSDK.

Your app also needs to listen to incoming deep links, unpack those to its raw format and pass it over to LucraClient. If LucraClient detects a Lucra deep link, it will return a LucraFlow to be displayed accordingly. If it's not Lucra's it will return nil.

private func handleDeeplink(_ url: URL) {
    YourAppDeeplinkService().unpack(deeplink: url) { url in
        if let flow = lucraClient.handleDeeplink(url: url) {
            self.flow = flow
        } else {
            // not Lucra's, resume handling in your own way
        }
    }
}

Deep Linking from QR Code

Please notice that LucraSDK provides two ways of sharing links to others: one being directly sending the link to someone using iOS native share sheet, and the other one being QR Codes. In order to properly read the data from a QR Code, your app must listen to NSUserActivityTypeBrowsingWeb activities. Set up a listener in a suitable place within your app and simply call the same Lucra Handler from the topic above.

Last updated