Commit 7876e30e authored by yangwu.jia's avatar yangwu.jia

插件注册时机调整

parent 87532b11
......@@ -58,7 +58,13 @@ public class FlutterBoost {
mCurrentActiveActivity = activity;
if (mPlatform.whenEngineStart() == ConfigBuilder.ANY_ACTIVITY_CREATED) {
doInitialFlutter();
boostPluginRegistry();
}
if (mPlatform.whenEngineStart() == ConfigBuilder.IMMEDIATELY) {
boostPluginRegistry();
}
}
@Override
......@@ -150,10 +156,16 @@ public class FlutterBoost {
flutterEngine.getDartExecutor().executeDartEntrypoint(entrypoint);
mRegistry = new BoostPluginRegistry(createEngine());
mPlatform.registerPlugins(mRegistry);
}
public void boostPluginRegistry(){
if(mRegistry!=null&& !mRegistry.hasPlugin("boostPluginRegistry")){
mPlatform.registerPlugins(mRegistry);
mRegistry.registrarFor("boostPluginRegistry");
}
}
public static class ConfigBuilder {
......
......@@ -83,6 +83,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
ensureAlive();
if (FlutterBoost.instance().platform().whenEngineStart() == FlutterBoost.ConfigBuilder.FLUTTER_ACTIVITY_CREATED) {
FlutterBoost.instance().doInitialFlutter();
FlutterBoost.instance().boostPluginRegistry();
}
// When "retain instance" is true, the FlutterEngine will survive configuration
// changes. Therefore, we create a new one only if one does not already exist.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment