Initialization

After installing the Wepin Compose Multiplatform Widget Library, the next step is to initialize the SDK. SDK initialization involves creating an instance of WepinWidgetSDK and using the init() function to proceed.

Import SDK

To use the Wepin Compose Multiplatform Widget Library, you first need to import the SDK. Add the following import statements:

import com.wepin.cm.widgetlib.WepinWidgetSDK
import com.wepin.cm.widgetlib.types.*

Creating and Initializing the WepinWidgetSDK Instance

Before creating an instance of WepinWidgetSDK , you must register your app's Android/iOS information in the Wepin Workspace.

Using the registered app information, create an instance of WepinWidgetSDK .

private val wepinWidgetSDK: WepinWidgetSDK= WepinWidgetSDK(
    WepinLoginOptions(
        context = context,    //Android: Context, ios: UIViewController
        appId = appId,
        appKey = appKey
    )
)
wepinWidgetSDK.init(WidgetAttributes(defaultLanguage = "ko", defaultCurrency = "KRW"))

Parameters

  • attributes <WidgetAttributes> - Widget properties to define during initialization.

    • defaultLanguage <String> - Set the default language of the widget. The default value is ko, and currently supported languages are en and ko.

    • defaultCurrency <String> - Set the default currency of the widget. The default value is KRW, and currently supported currencies are USD and KRW.

Returns

  • <Boolean>

Checking Initialization Status (isInitialized)

You can check whether the WepinWidgetSDK instance has been successfully initialized by using the isInitialized method.

The return value is as follows:

  • <Boolean> Returns true if initialization was successful, and false if it failed.

if(wepinWidgetSDK.isInitialized()) {
    // Success to initialize WepinLogin
}

Last updated