From 97db208c08d520c966f9d4f7b8c8818e7f8d248f Mon Sep 17 00:00:00 2001 From: xiaoyu Date: Wed, 16 Dec 2020 14:30:47 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=89=A9=E5=B1=95SDK?= =?UTF-8?q?=E4=B8=ADAPI=E7=9A=84=E6=B3=A8=E5=86=8C=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=EF=BC=8C=E9=83=BD=E6=B3=A8=E5=86=8C=E5=88=B0=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E8=BF=9B=E7=A8=8B=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/build.gradle | 4 +-- .../finogeeks/mop/api/mop/AppletModule.java | 2 -- .../com/finogeeks/mop/api/mop/BaseModule.java | 26 +++++++++++++++---- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 5aa8629..7b5b834 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -91,6 +91,6 @@ kapt { } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation 'com.finogeeks.lib:finapplet:2.13.25' - implementation 'com.finogeeks.mop:plugins:0.0.25' + implementation 'com.finogeeks.lib:finapplet:2.13.29' + implementation 'com.finogeeks.mop:plugins:0.0.26' } \ No newline at end of file diff --git a/android/src/main/java/com/finogeeks/mop/api/mop/AppletModule.java b/android/src/main/java/com/finogeeks/mop/api/mop/AppletModule.java index 6dff660..b35821e 100644 --- a/android/src/main/java/com/finogeeks/mop/api/mop/AppletModule.java +++ b/android/src/main/java/com/finogeeks/mop/api/mop/AppletModule.java @@ -4,8 +4,6 @@ import android.content.Context; import android.util.Log; import com.finogeeks.lib.applet.client.FinAppClient; -import com.finogeeks.lib.applet.client.FinAppConfig; -import com.finogeeks.lib.applet.client.FinAppInfo; import com.finogeeks.mop.api.BaseApi; import com.finogeeks.mop.interfaces.ICallback; diff --git a/android/src/main/java/com/finogeeks/mop/api/mop/BaseModule.java b/android/src/main/java/com/finogeeks/mop/api/mop/BaseModule.java index afb73b9..9d6384c 100644 --- a/android/src/main/java/com/finogeeks/mop/api/mop/BaseModule.java +++ b/android/src/main/java/com/finogeeks/mop/api/mop/BaseModule.java @@ -1,20 +1,24 @@ package com.finogeeks.mop.api.mop; +import android.app.Activity; import android.app.Application; import android.content.Context; -import android.util.Log; -import android.widget.Toast; import com.finogeeks.lib.applet.BuildConfig; import com.finogeeks.lib.applet.client.FinAppClient; import com.finogeeks.lib.applet.client.FinAppConfig; +import com.finogeeks.lib.applet.client.FinAppProcessClient; import com.finogeeks.lib.applet.interfaces.FinCallback; +import com.finogeeks.lib.applet.interfaces.IApi; import com.finogeeks.mop.api.BaseApi; import com.finogeeks.mop.interfaces.ICallback; import com.finogeeks.mop.plugins.client.FinPluginClient; import com.finogeeks.mop.service.MopPluginService; -import java.util.HashMap; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; import java.util.Map; public class BaseModule extends BaseApi { @@ -39,7 +43,20 @@ public class BaseModule extends BaseApi { public void invoke(String event, Map param, final ICallback callback) { if (FinAppClient.INSTANCE.isFinAppProcess(super.getContext())) { - // 小程序进程不执行任何初始化操作 + // 扩展SDK的API都注册到小程序进程 + FinAppProcessClient.INSTANCE.setCallback(new FinAppProcessClient.Callback() { + @Nullable + @Override + public List getRegisterExtensionApis(@NotNull Activity activity) { + return FinPluginClient.INSTANCE.getPluginManager().getPlugins(activity); + } + + @Nullable + @Override + public List getRegisterExtensionWebApis(@NotNull Activity activity) { + return null; + } + }); return; } String appkey = String.valueOf(param.get("appkey")); @@ -79,7 +96,6 @@ public class BaseModule extends BaseApi { @Override public void onSuccess(Object result) { // SDK初始化成功 - FinPluginClient.INSTANCE.getPluginManager().registerPlugins(application); callback.onSuccess(null); }