Mall UI BizBundle

Last Updated on : 2024-01-11 01:51:31download

Description

Mall UI BizBundle provides the iOS container that hosts Tuya’s value-added service App Mall. You can leverage the powerful mall capabilities to monetize the user traffic through your in-app store.

For more information, see App Mall.

Integrate with the UI BizBundle

Create a project

Integrate Smart Life App SDK for Android into your project with Android Studio and add the framework of the UI BizBundle to your project.

Configure the build.gradle file

dependencies {
     api enforcedPlatform("com.thingclips.smart:thingsmart-BizBundlesBom:5.8.0")
    api 'com.thingclips.smart:thingsmart-bizbundle-mall'
}

Obfuscate the code

# Obfuscates the code of all third-party dependencies in `build.gradle`.

#fastJson
-keep class com.alibaba.fastjson.**{*;}
-dontwarn com.alibaba.fastjson.**

-keep class com.squareup.okhttp.** { *; }
-keep interface com.squareup.okhttp.** { *; }
-dontwarn com.squareup.okhttp.**

-keep class okio.** { *; }
-dontwarn okio.**

-keep class com.thingclips.**{*;}
-dontwarn com.thingclips.**

Implement features

Precautions

  1. Before using any method, be sure to confirm that the user is logged in.
  2. Before obtaining any mall page, you need to first confirm whether the service area registered by the current user is open for the mall.
  3. When the login user changes, be sure to re-judge the mall availability status and re-acquire the mall page.

Query mall information

Query information related to mall business. An asynchronous callback is implemented.

API description

requestMallEntrance(@Nullable IRequestMallEntranceCallback callback);

Example

ThingMallService service = MicroContext.getServiceManager().findServiceByInterface(ThingMallService.class.getName());
        service.requestMallEntrance(new IRequestMallEntranceCallback() {
            @Override
            public void onSuccess(boolean success) {
                // It only means that the interface call is successful
            }

            @Override
            public void onError(String code, String error) {

            }
        });

Query URL of mall homepage

The mall information query interface must be called first and the interface returns successfully. Then the homepage URL of the mall where the user is located can be obtained. This is a synchronous interface.

API description

getMallHomeUrl()

Example

ThingMallService service = MicroContext.getServiceManager().findServiceByInterface(ThingMallService.class.getName());
String mallUrl = service.getMallHomeUrl();

Query URL of mall order

Returns the URL of a mall order in the user’s location. This is a synchronous interface.

API description

getMallUserCenterUrl()

Example

ThingMallService service = MicroContext.getServiceManager().findServiceByInterface(ThingMallService.class.getName());
String mallUrl = service.getMallUserCenterUrl();

Open a mall page

Displays a mall page by means of activities or fragments.

Example

Activity

Intent intent = new Intent(context, WebViewActivity.class);
intent.putExtra("Uri", url);
context.startActivity(intent);

Fragment

WebViewFragment fragment = new WebViewFragment();
Bundle args = new Bundle();
args.putString("Uri", url);
args.putBoolean("enableLeftArea", true);
fragment.setArguments(args);
getSupportFragmentManager().beginTransaction()
        .add(R.id.web_content, fragment, WebViewFragment.class.getSimpleName())
        .commit();