URLConfigurationProvider

open class URLConfigurationProvider : ConfigurationProviding, AppDelegateObserving

This class is used with the ConfigurationLoader class. Uses the Apple Universal Links functionality to obtain and provide the configuration information for the application to use. It depends on the application(_:continue:restorationHandler:) AppDelegate method to acquire the necessary URL as described in Apple documentation. Use the AppDelegateDispatcher class to broadcast the invocation of said delegate for this class.

The corresponding AppDelegate method is invoked right after the return of didFinishLaunchingWithOptions. This configuration provider needs to exist by that time, so instantiate it before returning from that method. You need to register and unregister this provider as AppDelegateObserving to avoid memory leaks - see code example below.

// ... in the UIApplicationDelegate file
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
   AppDelegateDispatcher.register(provider)
   let result = AppDelegateDispatcher.application(application, continue: userActivity, restorationHandler: restorationHandler)
   AppDelegateDispatcher.unregister(provider)
   return result
}
  • Static parameter key name in the URL query for the ‘host’ value.

    Declaration

    Swift

    public static let hostParameterName: String
  • Static parameter key name in the URL query for the ‘port’ value.

    Declaration

    Swift

    public static let portParameterName: String
  • Static parameter key name in the URL query for the ‘protocol’ value.

    Declaration

    Swift

    public static let protocolParameterName: String
  • Static parameter key name in the URL query for the ‘authType’ value.

    Declaration

    Swift

    public static let authTypeParameterName: String
  • Static parameter key name in the URL query for the ‘tokenEndpoint’ value.

    Declaration

    Swift

    public static let tokenEndpointParameterName: String
  • Static parameter key name in the URL query for the ‘authorizationEndpoint’ value.

    Declaration

    Swift

    public static let authorizationEndpointParameterName: String
  • Static parameter key name in the URL query for the ‘oauthEndUserUI’ value.

    Declaration

    Swift

    public static let oauthEndUserUIParameterName: String
  • Static parameter key name in the URL query for the ‘clientID’ value. There could be multiple values identified by a counter which is substituted to the place marked with ‘%@’.

    Declaration

    Swift

    public static let oauthClientIDParameterName: String
  • Static parameter key name in the URL query for the ‘redirectURL’ value. There could be multiple values identified by a counter which is substituted to the place marked with ‘%@’.

    Declaration

    Swift

    public static let oauthRedirectURLParameterName: String
  • Static parameter key name in the URL query for the ‘grantType’ value. There could be multiple values identified by a counter which is substituted to the place marked with ‘%@’.

    Declaration

    Swift

    public static let oauthGrantTypeParameterName: String
  • Static parameter key name in the URL query for the ‘authChallengeHeader’ value.

    Declaration

    Swift

    public static let authChallengeHeaderParameterName: String
  • Static parameter key name in the URL query for the ‘endpointUri’ value.

    Declaration

    Swift

    public static let endpointUriParameterName: String
  • Static parameter key name in the URL query for the ‘redirectParam’ value.

    Declaration

    Swift

    public static let redirectParamParameterName: String
  • The provider identifier.

    Declaration

    Swift

    public var providerIdentifier: String
  • The expected input for the provider - which is empty.

    Declaration

    Swift

    public var expectedInput: [String : Any]
  • The default timeout the provider waits when the universal link is not present at the time of the provideConfiguration call.

    Declaration

    Swift

    public let defaultTimeout: Double
  • Instantiates the provider

    Declaration

    Swift

    public init(defaultTimeout: Double = 1)

    Parameters

    defaultTimeout

    The default timeout the provider waits when the universal link is not present at the time of the provideConfiguration call. By default it is .now() + 1

  • Declaration

    Swift

    public func provideConfiguration(input: [String : Any]) -> (providerSuccess: Bool, configuration: NSDictionary, returnError: Error?)
  • The AppDelegate call where the URL is received could happen later in time, than this function call.

    Declaration

    Swift

    public func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any]) -> Bool
  • Declaration

    Swift

    public func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool
  • Checks if the URL from the app delegate methods is indeed a configuration URL. By default it checks against this templet: https:///mobileservices/deeplinks//config

    Declaration

    Swift

    open func isConfigurationURL(_ url: URL) -> Bool