SAPcpmsSettingsDownloadStep

open class SAPcpmsSettingsDownloadStep : OnboardingStep

Class for SAPcpmsSettings download onboarding step handling

Customization

During the onboarding flow, if there is a splash screen which shows a text, that text can be changed/localized.


// The localized SAPcpmsSettingsDownloadStep can be created like the following code snippet
func customSettingsDownloadStep() -> OnboardingStep {
   let step = SAPcpmsSettingsDownloadStep()

   let sapcpmsSettingsDownloadBundle = Bundle(for: SAPcpmsSettingsDownloadStep.self)
   step.infoScreenText = NSLocalizedString("SAPcpmsSettingsDownloadInfoScreenTextKey", tableName: "ExampleTableName", bundle: sapcpmsSettingsDownloadBundle, value: "Example Info Screen Text", comment: "")

   return step
}

  • Onboarding function without context for SAPcpmsSettings download.

    Declaration

    Swift

    open func onboard(sapURLSession: SAPURLSession, credentialStore: CodableStoring, settingsParameters: SAPcpmsSettingsParameters, presentationDelegate: FlowPresentationDelegate, completionHandler: @escaping ([OnboardingInfoKey : Any]?, Error?) -> Void)

    Parameters

    sapURLSession

    SAPURLSession that handle the connection to download settings

    credentialStore

    credentials will be saved in the given store

    settingsParameters

    SAPcpmsSettingsParameters object

    presentationDelegate

    FlowPresentationDelegate object which handles the presentation

    completionHandler

    called when the process finished. Error filled on failure.

  • Restore function without context for SAPcpmsSettings download. Tries to download the settings from SAPcpms server again then stores in the given store. Overwrites the previously applied settings.

    • If the download fails because the Settings is turned off on the server and the received statuscode is 404, then the settings are deleted from the store.
    • If the download fails for some other reason, loads the previously saved settings from the given store.

    Declaration

    Swift

    open func restore(sapURLSession: SAPURLSession, credentialStore: CodableStoring, settingsParameters: SAPcpmsSettingsParameters, presentationDelegate: FlowPresentationDelegate, completionHandler: @escaping ([OnboardingInfoKey : Any]?, Error?) -> Void)

    Parameters

    sapURLSession

    SAPURLSession that handle the connection to download settings

    credentialStore

    credentials will be saved in or loaded from the given store

    settingsParameters

    SAPcpmsSettingsParameters object

    presentationDelegate

    FlowPresentationDelegate object which handles the presentation

    completionHandler

    called when the process finished. Error filled on failure.

  • This function resets the modifications of the SAPcpmsDownloadStep in the SAPURLSession.

    Declaration

    Swift

    open func reset(store: CodableStoring, completionHandler: @escaping () -> Void)

    Parameters

    store

    CodableStoring storage which stores the SAPcpmsSettings

    completionHandler

    called when the process finished.

  • Loads the persisted settings from the given credentialStore

    Throws

    throws an error in cases of failure of parsing JSON

    Declaration

    Swift

    public func loadPersistedSettingsData(from credentialStore: CodableStoring) throws -> [OnboardingInfoKey : Any]

    Parameters

    credentialStore

    the store that contains the settings

    Return Value

    dictionary with the settings