Commit 01e72797 authored by Jidong Chen's avatar Jidong Chen

fix

parent aa1f6e09
...@@ -142,7 +142,7 @@ public class ContainerRecord implements IContainerRecord { ...@@ -142,7 +142,7 @@ public class ContainerRecord implements IContainerRecord {
map.put("name", mContainer.getContainerName()); map.put("name", mContainer.getContainerName());
map.put("uniqueId", mUniqueId); map.put("uniqueId", mUniqueId);
FlutterBoostPlugin.getInstance().sendEvent("backPressedCallback",map); FlutterBoostPlugin.getInstance().sendEvent("lifecycle",map);
mContainer.getBoostFlutterView().onBackPressed(); mContainer.getBoostFlutterView().onBackPressed();
} }
......
...@@ -35,7 +35,6 @@ public class NavigationService { ...@@ -35,7 +35,6 @@ public class NavigationService {
public static MethodChannel methodChannel = null; public static MethodChannel methodChannel = null;
public static void onNativePageResult(final MessageResult<Boolean> result, String uniqueId, String key, Map resultData, Map params) { public static void onNativePageResult(final MessageResult<Boolean> result, String uniqueId, String key, Map resultData, Map params) {
Map<String, Object> args = new HashMap<>(); Map<String, Object> args = new HashMap<>();
args.put("uniqueId", uniqueId); args.put("uniqueId", uniqueId);
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_boost/messaging/service/navigation_service.dart';
import 'package:flutter_boost/container/boost_container.dart'; import 'package:flutter_boost/container/boost_container.dart';
import 'package:flutter_boost/flutter_boost.dart'; import 'package:flutter_boost/flutter_boost.dart';
import 'package:flutter_boost/messaging/native_page_container_event_handler.dart'; import 'package:flutter_boost/messaging/native_page_container_event_handler.dart';
...@@ -37,7 +36,9 @@ class ContainerCoordinator implements NativePageContainerEventHandler { ...@@ -37,7 +36,9 @@ class ContainerCoordinator implements NativePageContainerEventHandler {
PageBuilder _defaultPageBuilder; PageBuilder _defaultPageBuilder;
ContainerCoordinator() { ContainerCoordinator() {
NavigationService.listenEvent(onChannelEvent); FlutterBoost.singleton.addEventListener("lifecycle", (String name , Map arguments){
onChannelEvent(arguments);
});
} }
BoostContainerSettings _createContainerSettings( BoostContainerSettings _createContainerSettings(
......
...@@ -202,4 +202,15 @@ class FlutterBoost { ...@@ -202,4 +202,15 @@ class FlutterBoost {
///register callbacks for Navigators push & pop ///register callbacks for Navigators push & pop
VoidCallback addBoostNavigatorObserver(BoostNavigatorObserver observer) => VoidCallback addBoostNavigatorObserver(BoostNavigatorObserver observer) =>
_observersHolder.addObserver<BoostNavigatorObserver>(observer); _observersHolder.addObserver<BoostNavigatorObserver>(observer);
//Listen broadcast event from native.
Function addEventListener(String name , EventListener listener){
return _broadcastor.addEventListener(name, listener);
}
//Send broadcast event to native.
void sendEvent(String name , Map arguments){
_broadcastor.sendEvent(name, arguments);
}
} }
...@@ -30,15 +30,6 @@ class NavigationService { ...@@ -30,15 +30,6 @@ class NavigationService {
static MethodChannel methodChannel; static MethodChannel methodChannel;
//List event from event channel.
static int listenEvent(void onData(dynamic event)) {
// return _service.listenEvent(onData);
}
//Cancel event for subscription with ID.
static void cancelEventForSubscription(int subID) {
// _service.cancelEventForSubscription(subID);
}
static Future<bool> onShownContainerChanged(String newName,String oldName,Map params) { static Future<bool> onShownContainerChanged(String newName,String oldName,Map params) {
Map<String,dynamic> properties = new Map<String,dynamic>(); Map<String,dynamic> properties = new Map<String,dynamic>();
properties["newName"]=newName; properties["newName"]=newName;
...@@ -67,7 +58,7 @@ class NavigationService { ...@@ -67,7 +58,7 @@ class NavigationService {
}); });
} catch (e) { } catch (e) {
print('Page on start exception'); print('Page on start exception');
return Future<Map>.value({}); return Future<Map>((){});
} }
} }
static Future<bool> openPage(String pageName,Map params,bool animated) { static Future<bool> openPage(String pageName,Map params,bool animated) {
......
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