Commit 6c01fb3b authored by yangwu.jia's avatar yangwu.jia

兼容新插件注册方式

parent 96b82a70
......@@ -200,7 +200,6 @@ public class FlutterBoost {
private BoostLifecycleListener lifecycleListener;
private BoostPluginsRegister boostPluginsRegister;
......@@ -235,15 +234,11 @@ public class FlutterBoost {
}
public ConfigBuilder lifecycleListener(BoostLifecycleListener lifecycleListener) {
this.lifecycleListener = lifecycleListener;
return this;
}
public ConfigBuilder pluginsRegister(BoostPluginsRegister boostPluginsRegister) {
this.boostPluginsRegister = boostPluginsRegister;
return this;
}
public Platform build() {
Platform platform = new Platform() {
......@@ -278,7 +273,6 @@ public class FlutterBoost {
};
platform.lifecycleListener = this.lifecycleListener;
platform.pluginsRegister=this.boostPluginsRegister;
return platform;
}
......
......@@ -30,21 +30,40 @@ public class MyApplication extends Application {
};
FlutterBoost.BoostPluginsRegister pluginsRegister= new FlutterBoost.BoostPluginsRegister(){
FlutterBoost.BoostLifecycleListener boostLifecycleListener= new FlutterBoost.BoostLifecycleListener(){
@Override
public void registerPlugins(PluginRegistry mRegistry) {
GeneratedPluginRegistrant.registerWith(mRegistry);
TextPlatformViewPlugin.register(mRegistry.registrarFor("TextPlatformViewPlugin"));
public void onEngineCreated() {
}
@Override
public void onPluginsRegistered() {
}
@Override
public void onEngineDestroy() {
}
};
//
// AndroidManifest.xml 中必须要添加 flutterEmbedding 版本设置
//
// <meta-data android:name="flutterEmbedding"
// android:value="2">
// </meta-data>
// GeneratedPluginRegistrant 会自动生成 新的插件方式 
//
//
Platform platform= new FlutterBoost
.ConfigBuilder(this,router)
.isDebug(true)
.whenEngineStart(FlutterBoost.ConfigBuilder.ANY_ACTIVITY_CREATED)
.renderMode(FlutterView.RenderMode.texture)
.pluginsRegister(pluginsRegister)
.lifecycleListener(boostLifecycleListener)
.build();
FlutterBoost.instance().init(platform);
......
......@@ -7,8 +7,11 @@
#import <Flutter/Flutter.h>
NS_ASSUME_NONNULL_BEGIN
@interface GeneratedPluginRegistrant : NSObject
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry;
@end
NS_ASSUME_NONNULL_END
#endif /* GeneratedPluginRegistrant_h */
......@@ -3,7 +3,12 @@
//
#import "GeneratedPluginRegistrant.h"
#if __has_include(<flutter_boost/FlutterBoostPlugin.h>)
#import <flutter_boost/FlutterBoostPlugin.h>
#else
@import flutter_boost;
#endif
@implementation GeneratedPluginRegistrant
......
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