调整扩展SDK中API的注册方式,都注册到小程序进程中
parent
265d9bd19e
commit
97db208c08
|
@ -91,6 +91,6 @@ kapt {
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
implementation 'com.finogeeks.lib:finapplet:2.13.25'
|
implementation 'com.finogeeks.lib:finapplet:2.13.29'
|
||||||
implementation 'com.finogeeks.mop:plugins:0.0.25'
|
implementation 'com.finogeeks.mop:plugins:0.0.26'
|
||||||
}
|
}
|
|
@ -4,8 +4,6 @@ import android.content.Context;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.finogeeks.lib.applet.client.FinAppClient;
|
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.api.BaseApi;
|
||||||
import com.finogeeks.mop.interfaces.ICallback;
|
import com.finogeeks.mop.interfaces.ICallback;
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,24 @@
|
||||||
package com.finogeeks.mop.api.mop;
|
package com.finogeeks.mop.api.mop;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.Log;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import com.finogeeks.lib.applet.BuildConfig;
|
import com.finogeeks.lib.applet.BuildConfig;
|
||||||
import com.finogeeks.lib.applet.client.FinAppClient;
|
import com.finogeeks.lib.applet.client.FinAppClient;
|
||||||
import com.finogeeks.lib.applet.client.FinAppConfig;
|
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.FinCallback;
|
||||||
|
import com.finogeeks.lib.applet.interfaces.IApi;
|
||||||
import com.finogeeks.mop.api.BaseApi;
|
import com.finogeeks.mop.api.BaseApi;
|
||||||
import com.finogeeks.mop.interfaces.ICallback;
|
import com.finogeeks.mop.interfaces.ICallback;
|
||||||
import com.finogeeks.mop.plugins.client.FinPluginClient;
|
import com.finogeeks.mop.plugins.client.FinPluginClient;
|
||||||
import com.finogeeks.mop.service.MopPluginService;
|
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;
|
import java.util.Map;
|
||||||
|
|
||||||
public class BaseModule extends BaseApi {
|
public class BaseModule extends BaseApi {
|
||||||
|
@ -39,7 +43,20 @@ public class BaseModule extends BaseApi {
|
||||||
public void invoke(String event, Map param, final ICallback callback) {
|
public void invoke(String event, Map param, final ICallback callback) {
|
||||||
|
|
||||||
if (FinAppClient.INSTANCE.isFinAppProcess(super.getContext())) {
|
if (FinAppClient.INSTANCE.isFinAppProcess(super.getContext())) {
|
||||||
// 小程序进程不执行任何初始化操作
|
// 扩展SDK的API都注册到小程序进程
|
||||||
|
FinAppProcessClient.INSTANCE.setCallback(new FinAppProcessClient.Callback() {
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public List<IApi> getRegisterExtensionApis(@NotNull Activity activity) {
|
||||||
|
return FinPluginClient.INSTANCE.getPluginManager().getPlugins(activity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public List<IApi> getRegisterExtensionWebApis(@NotNull Activity activity) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String appkey = String.valueOf(param.get("appkey"));
|
String appkey = String.valueOf(param.get("appkey"));
|
||||||
|
@ -79,7 +96,6 @@ public class BaseModule extends BaseApi {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Object result) {
|
public void onSuccess(Object result) {
|
||||||
// SDK初始化成功
|
// SDK初始化成功
|
||||||
FinPluginClient.INSTANCE.getPluginManager().registerPlugins(application);
|
|
||||||
callback.onSuccess(null);
|
callback.onSuccess(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue