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
}
-
Transform the downloaded
SAPcpmsSettingsdata to insert into theOnboardingContextstructureDeclaration
Swift
public let transformer: ConfigurationTransforming -
The
OnboardingInfoKeyassociated with an instance of downloadedSAPcpmsSettings(PasscodePolicy and LogSettings) in theOnboardingContextinfo.Declaration
Swift
public let settingsInfoKey: OnboardingInfoKey -
Key to store the SAPcpmsSettings in CredentialStore
Declaration
Swift
public let sapcpmsSettingsStoreKey: String -
The
OnboardingInfoKeyassociated with an instance of previous context in theOnboardingContextinfo.Declaration
Swift
public let previousSettingsInfoKey: OnboardingInfoKey -
Property to set the title of info screen
Declaration
Swift
public var infoScreenText: String -
Initializes the object
Declaration
Swift
public init(transformer: ConfigurationTransforming = ConfigurationTransformer(transformationMap: SAPcpmsSettingsTransformationMap), settingsInfoKey: OnboardingInfoKey = .sapcpmsSettingsParameters, previousSettingsInfoKey: OnboardingInfoKey = .previousSettings)Parameters
transformerused to transform the settings downloaded from SAPcpms to [OnboardingInfoKey: Any] where the values are typed objects, like FUIPasscodePolicy and LogSettings
settingsInfoKeythe key where the downloaded SAPcpmsSettings can be available in the info field of the OnboardingContext in case the automatic onboarding mode is used
previousSettingsInfoKeyfor this key saved the step the previous
SAPcpmsSettings
-
Onboarding function with
OnboardingContextsupport; Downloads the configured Settings from mobile services and updates the stored settings with them in the ‘context’.Declaration
Swift
open func onboard(context: OnboardingContext, completionHandler: @escaping (OnboardingResult) -> Void)Parameters
contextOnboardingContextobject which contains every information for the OnboardingStepcompletionHandlercalled when the process finished. Error filled on failure.
-
Restore function with
OnboardingContextsupportDeclaration
Swift
open func restore(context: OnboardingContext, completionHandler: @escaping (OnboardingResult) -> Void)Parameters
contextOnboardingContextobject which contains every information for the OnboardingStepcompletionHandlercalled when the process finished. Error filled on failure.
-
resetPasscode function with
OnboardingContextsupportDeclaration
Swift
open func resetPasscode(context: OnboardingContext, completionHandler: @escaping (OnboardingResult) -> Void)Parameters
contextcompletionHandlercalled when the process finished. Step OnboardingResult filled.
-
This function resets the modifications of SAPcpmsDownloadStep modifications in
OnboardingContextDeclaration
Swift
open func reset(context: OnboardingContext, completionHandler: @escaping () -> Void)Parameters
contextOnboardingContextobject which contains every information for the OnboardingStepcompletionHandlercalled when the process finished.
-
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
sapURLSessionSAPURLSessionthat handle the connection to download settingscredentialStorecredentials will be saved in the given store
settingsParametersSAPcpmsSettingsParametersobjectpresentationDelegateFlowPresentationDelegateobject which handles the presentationcompletionHandlercalled 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
sapURLSessionSAPURLSessionthat handle the connection to download settingscredentialStorecredentials will be saved in or loaded from the given store
settingsParametersSAPcpmsSettingsParametersobjectpresentationDelegateFlowPresentationDelegateobject which handles the presentationcompletionHandlercalled 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
storeCodableStoringstorage which stores the SAPcpmsSettingscompletionHandlercalled when the process finished.
-
Loads the persisted settings from the given credentialStore
Throws
throws an error in cases of failure of parsing JSONDeclaration
Swift
public func loadPersistedSettingsData(from credentialStore: CodableStoring) throws -> [OnboardingInfoKey : Any]Parameters
credentialStorethe store that contains the settings
Return Value
dictionary with the settings