addAccountRecoveryCallback

AppDelegate.reachfive().addAccountRecoveryCallback(recoveryCallback)

Setup

Before using this method, you need to setup deep link interception by using application(_:open:options).

About this command

Add the callback that will be executed when the account recovery url is intercepted. Parse the link and extract the verification code.

Examples

You would typically call this method in the controller handling the UI for manually entering the verification code:

import Reach5
import UIKit

class RecoveryVerificationController: UIViewController {
    override func viewDidLoad() {
        AppDelegate.reachfive().addAccountRecoveryCallback { result in
            switch result {
            case .success(let response):
                let email = response.email
                let verificationCode = response.verificationCode
                // show UI for setting up a new passkey or choosing a new password

            case .failure(let error):
                // handle failure
            }
        }
    }
}

Parameters

Parameter Description

recoveryCallback AccountRecoveryCallback

The callback that will be executed when the account recovery link is intercepted. The callback takes a Result with either an AccountRecoveryResponse or a ReachFiveError.

AccountRecoveryResponse

When the url is properly parsed and the verification code is present. Contains the profile email string and the verification code string.

ReachFiveError

When an error occured.