Displaying No-Codes

First, you need to initialize the SDK. To do this, use the same project key that you use to initialize the Qonversion SDK.

// You can initialize using only project key
let configuration = NoCodes.Configuration(projectKey: "projectKey")
NoCodes.initialize(with: configuration)
// You can initialize using only project key
val noCodesConfig = NoCodesConfig.Builder(this, "projectKey").build()
NoCodes.initialize(noCodesConfig)
// You can initialize using only project key
final NoCodesConfig noCodesConfig = new NoCodesConfig.Builder(this, "projectKey").build();
NoCodes.initialize(noCodesConfig);

Then you can set the delegates for handling events and customizing screens as follows:

NoCodes.shared.set(delegate: self)
NoCodes.shared.set(screenCustomizationDelegate: self)

// Delegates can be also passed via the initialization throught the configuration:
let configuration = NoCodes.Configuration(projectKey: "projectKey", delegate: self, screenCustomizationDelegate: self)
NoCodes.shared.setDelegate(this)
NoCodes.shared.setScreenCustomizationDelegate(this)

// Delegates can be also passed via the initialization throught the configuration:
val noCodesConfig = NoCodesConfig.Builder(this, "projectKey")
  .setDelegate(this)
  .setScreenCustomizationDelegate(this)
  .build()
NoCodes.getSharedInstance().setDelegate(this);
NoCodes.getSharedInstance().setScreenCustomizationDelegate(this);

// Delegates can be also passed via the initialization throught the configuration:
final NoCodesConfig noCodesConfig = new NoCodesConfig.Builder(this, "projectKey")
  .setDelegate(this)
  .setScreenCustomizationDelegate(this)
  .build();

After initializing the SDK, you can move forward and display the No-Codes screen:

NoCodes.shared.showNoCode(withContextKey: "contextKey")
NoCodes.shared.showScreen("yourContextKey")
NoCodes.getSharedInstance().showScreen("yourContextKey");

Delegates

Earlier, we discussed how to set delegates. Now, let’s explore their purpose.

Main delegate

The main delegate is needed so that you can receive messages about what is happening during the execution of No-Codes, as well as to provide us with the screen from which to start navigation and display the No-Codes screen. Let’s go through this step by step:

controllerForNavigation (iOS only)
func controllerForNavigation() -> UIViewController?

In this function, you must return a UIViewController from which we will start displaying the No-Codes flow. If you do not provide one, we will take the topmost screen in the current stack.

Screen shown event
func noCodesHasShownScreen(id: String)
fun onScreenShown(screenId: String)
void onScreenShown(String screenId)

This function notifies about the display of a screen with a specific identifier

Action execution start event

func noCodesStartsExecuting(action: NoCodes.Action)
fun onActionStartedExecuting(action: QAction)
void onActionStartedExecuting(QAction action)

This function notifies you that executing the action you set up through our dashboard has begun.

Action execution fail event

func noCodesFailedToExecute(action: NoCodes.Action, error: Error?)
fun onActionFailedToExecute(action: QAction) {
  // For details look at the `error` property of the action
}
void onActionFailedToExecute(QAction action) {
  // For details look at the `error` property of the action
}

This function notifies you that executing the action you set up through our dashboard has failed.

Action execution finish event

func noCodesFinishedExecuting(action: NoCodes.Action)
fun onActionFinishedExecuting(action: QAction)
void onActionFinishedExecuting(QAction action)

This function notifies you that the action you set up through our dashboard has been executed.

Screen finished event

func noCodesFinished()
fun onFinished()
void onFinished()

This function notifies that the NoCodes flow has been completed and NoCodes has been finished.

noCodesFailedToLoadScreen

func noCodesFailedToLoadScreen(error: Error?)
fun onScreenFailedToLoad(error: NoCodesError)
void onScreenFailedToLoad(NoCodesError error)

This function is called when NoCodes screen loading has failed.

Screen customization delegate

Use this delegate to customize the screen opening animation. For example, to enable or disable the animation (iOS only), specify the type of opening: push/full screen/popover (iOS only).
You can also pass a statusBarHidden flag that determines whether to show or hide the status bar when displaying the screen (iOS only).

For example:

func presentationConfigurationForScreen(contextKey: String) -> NoCodes.PresentationConfiguration {
  return NoCodes.PresentationConfiguration(animated: true, presentationStyle: .push)
}
override fun getPresentationConfigurationForScreen(contextKey: String): QScreenPresentationConfig {
  return QScreenPresentationConfig(QScreenPresentationStyle.Push)
}
@NonNull
@Override
public QScreenPresentationConfig getPresentationConfigurationForScreen(@NonNull String contextKey) {
  return new QScreenPresentationConfig(QScreenPresentationStyle.Push);
}