Skip to Content
0

OnboardingFlow without WelcomeScreenStep

Mar 09 at 10:35 AM

81

avatar image

Hey,

for our costumer we designed an app for recording special deals in their shops and simplify a really complex progress.

Because the application is branded in the customers colours we also have to adopt the OnboardingSteps. We don't need to describe something to the end-user (employee) and there will be no DemoMode, so the WelcomeScreenStep is useless and we want to remove it from the onboarding flow.

When i try the onboarding without the WelcomeScreenStep, i get the following error:

2018-03-09 11:23:13.074190+0100 iDeal[4776:1402829] [general] # OnbardingManager - ERROR - (Main) - OnboardingManager.swift.onboardOrRestore() - Onboarding failed! (Error: Missing argument in SAPcpmsSessionConfigurationStep: SAPcpmsSettingsParameters)

Okay ... there is something missing that is called "SAPcpmsSettingsPrameters". Let's check the configuration of the WelcomeScreenStep:

let discoveryConfigurationTransformer = DiscoveryServiceConfigurationTransformer(applicationID: "XXXX", authenticationPath: "XXXX")

let welcomeScreenStep = WelcomeScreenStep(transformer: discoveryConfigurationTransformer, providers: [FileConfigurationProvider()])

Good ... there is some configuration going on in behind. But i have no clue what configuration. I looked at the documentation but didn't found something helpful.

As far as i got, there is an info property on the OnboardingContext that contains a value with the key SAPcpmsSettingsParameters.sapcpmsSettingsParameters. But when I'm in the onboarding flow, I'm not able to debug what the WelcomeScreenStep does with that property.

Has anyone facing the same issue or can help me to configure the OnboardingContext in a way that the rest of the onboarding flow will work?

Regards,
Chris

iOS
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Andreas Schlosser
Mar 09 at 04:03 PM
1

Christoph,

I think to tackle your problem it is not necessarily required to understand how the WelcomeScreenStep works, but you need to understand what the subsequent steps in the flow might require (which is now missing as the WelcomeScreenStep doesn't put it in the context anymore). You already figured out the essential piece - the SAPcpmsSettingsParameters are needed by the SAPcpmsConfigurationStep. You can actually find out the required input of a step by inspecting the alternative initializers that don't go by the onboarding context, but by explicit list of parameters.

So, in your current situation, you need to provide the SAPcpmsSettingsParameters via the OnboardingContext so the configuration step knows where to connect to.

You can do this by setting onboardingContext.sapcpmsSettingsParameters = mySettingsParameters before starting the actual flow.

Thanks
Andreas

Show 4 Share
10 |10000 characters needed characters left characters exceeded

Hey Andreas,

thanks for that hint. Unfortunately I can't find the documentation of SAPcpmsSettingsParameters in the API Reference. It has 4 initialisers and when I try calling it in the following way. the onboardingContext.authenticationURL is nil after the onboarding is completed:

var context = OnboardingContext(presentationDelegate: self.presentationDelegate)
context.sapcpmsSettingsParameters = SAPcpmsSettingsParameters(backendURL: URL(string: "BACKEND_URL")!,
                                                              applicationID: "APP_ID")

As BACKEND_URL i took the values of ConfigurationProvider.plist (protocol + host). Maybe thats wrong?
APP_ID is clear!

And what i miss is to set the authenticationPath, that is set during the WelcomeScreenStep configuration.

Regards,
Christoph

0

Christoph,

The documentation is at https://help.sap.com/doc/978e4f6c968c4cc5a30f9d324aa4b1d7/Latest/en-US/Documents/Frameworks/SAPFoundation/Structs/SAPcpmsSettingsParameters.html - different framework... However, your use of it seems to be right.

The authenticationURL needs to be provided separately (API docs). This needs to be a valid URL that can be used during onboarding to trigger/validate authentication. This is typically the service root of your backend.

Thanks
Andreas

0

And one more thing; you also need to make sure the authentication step has all the required configuration. In case of OAuth2, you need to provide the OAuth2AuthenticationParameters into the context as well.

When I did this, I could remove the welcome step from the flow:

var context = OnboardingContext(presentationDelegate: presentationDelegate)
let settingsParameters = SAPcpmsSettingsParameters(backendURL: URL(string: "https://hcpms-dXXXXXXtrial.hanatrial.ondemand.com/")!, applicationID: "oauth2")
context.sapcpmsSettingsParameters = settingsParameters
context.authenticationURL = URL(string: "https://hcpms-dXXXXXXtrial.hanatrial.ondemand.com/com.sap.edm.sampleservice")! let oauth2Parameters = OAuth2AuthenticationParameters(authorizationEndpointURL: URL(string: "https://oauthasservices-dXXXXXXtrial.hanatrial.ondemand.com/oauth2/api/v1/authorize")!, clientID: "999abf99-3d9c-48f7-80ba-fcccbceab8ae", redirectURL: URL(string: "https://oauthasservices-dXXXXXXtrial.hanatrial.ondemand.com")!, tokenEndpointURL: URL(string: "https://oauthasservices-dXXXXXXtrial.hanatrial.ondemand.com/oauth2/api/v1/token")!)
context.info[.oauth2AuthenticationParameters] = oauth2Parameters
0

Hey Andreas,

totally overseen your answer. Thanks for the tip with the authenticationURL property. That resolves my issue and now I can access the application without the welcome screen :)

Regards,
Christoph

0