Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
flutter_boost_1.22.4
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李增强
flutter_boost_1.22.4
Commits
c16f3c12
Commit
c16f3c12
authored
Jun 25, 2019
by
Jidong Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code opt.
parent
786e5617
Changes
45
Show whitespace changes
Inline
Side-by-side
Showing
45 changed files
with
247 additions
and
1689 deletions
+247
-1689
android/build.gradle
android/build.gradle
+1
-1
example/ios/Runner/DemoRouter.m
example/ios/Runner/DemoRouter.m
+3
-3
ios/Classes/1.0/FLBFlutterViewContainer.m
ios/Classes/1.0/FLBFlutterViewContainer.m
+7
-7
ios/Classes/1.5/FLB2FlutterViewContainer.m
ios/Classes/1.5/FLB2FlutterViewContainer.m
+7
-7
ios/Classes/Boost/FLB2Platform.h
ios/Classes/Boost/FLB2Platform.h
+1
-1
ios/Classes/Boost/FlutterBoostPlugin.m
ios/Classes/Boost/FlutterBoostPlugin.m
+46
-46
ios/Classes/Boost/FlutterBoostPlugin_private.h
ios/Classes/Boost/FlutterBoostPlugin_private.h
+0
-2
ios/Classes/Messaging/BoostMessageChannel.h
ios/Classes/Messaging/BoostMessageChannel.h
+14
-1
ios/Classes/Messaging/BoostMessageChannel.mm
ios/Classes/Messaging/BoostMessageChannel.mm
+58
-3
ios/Classes/Messaging/Generated/NavigationService/handlers/NavigationService_closePage.h
.../NavigationService/handlers/NavigationService_closePage.h
+0
-29
ios/Classes/Messaging/Generated/NavigationService/handlers/NavigationService_closePage.mm
...NavigationService/handlers/NavigationService_closePage.mm
+0
-59
ios/Classes/Messaging/Generated/NavigationService/handlers/NavigationService_onFlutterPageResult.h
...nService/handlers/NavigationService_onFlutterPageResult.h
+0
-28
ios/Classes/Messaging/Generated/NavigationService/handlers/NavigationService_onFlutterPageResult.mm
...Service/handlers/NavigationService_onFlutterPageResult.mm
+0
-56
ios/Classes/Messaging/Generated/NavigationService/handlers/NavigationService_onShownContainerChanged.h
...vice/handlers/NavigationService_onShownContainerChanged.h
+0
-28
ios/Classes/Messaging/Generated/NavigationService/handlers/NavigationService_onShownContainerChanged.mm
...ice/handlers/NavigationService_onShownContainerChanged.mm
+0
-58
ios/Classes/Messaging/Generated/NavigationService/handlers/NavigationService_openPage.h
...d/NavigationService/handlers/NavigationService_openPage.h
+0
-28
ios/Classes/Messaging/Generated/NavigationService/handlers/NavigationService_openPage.mm
.../NavigationService/handlers/NavigationService_openPage.mm
+0
-60
ios/Classes/Messaging/Generated/NavigationService/handlers/NavigationService_pageOnStart.h
...avigationService/handlers/NavigationService_pageOnStart.h
+0
-28
ios/Classes/Messaging/Generated/NavigationService/handlers/NavigationService_pageOnStart.mm
...vigationService/handlers/NavigationService_pageOnStart.mm
+0
-61
ios/Classes/Messaging/base/FLBBroadcastor.h
ios/Classes/Messaging/base/FLBBroadcastor.h
+0
-46
ios/Classes/Messaging/base/FLBBroadcastor.m
ios/Classes/Messaging/base/FLBBroadcastor.m
+0
-89
ios/Classes/Messaging/base/FLBMessageDispather.h
ios/Classes/Messaging/base/FLBMessageDispather.h
+0
-30
ios/Classes/Messaging/base/FLBMessageDispather.m
ios/Classes/Messaging/base/FLBMessageDispather.m
+0
-79
ios/Classes/Messaging/base/FLBMessageHandlerImp.h
ios/Classes/Messaging/base/FLBMessageHandlerImp.h
+0
-30
ios/Classes/Messaging/base/FLBMessageHandlerImp.m
ios/Classes/Messaging/base/FLBMessageHandlerImp.m
+0
-176
ios/Classes/Messaging/base/FLBMessageImp.h
ios/Classes/Messaging/base/FLBMessageImp.h
+0
-36
ios/Classes/Messaging/base/FLBMessageImp.m
ios/Classes/Messaging/base/FLBMessageImp.m
+0
-38
ios/Classes/Messaging/base/FLBMessageing.h
ios/Classes/Messaging/base/FLBMessageing.h
+0
-48
lib/container/container_coordinator.dart
lib/container/container_coordinator.dart
+2
-2
lib/container/container_manager.dart
lib/container/container_manager.dart
+2
-2
lib/flutter_boost.dart
lib/flutter_boost.dart
+44
-34
lib/messaging/base/broadcastor.dart
lib/messaging/base/broadcastor.dart
+0
-89
lib/messaging/base/message_dispatcher.dart
lib/messaging/base/message_dispatcher.dart
+0
-47
lib/messaging/base/message_handler.dart
lib/messaging/base/message_handler.dart
+0
-31
lib/messaging/boost_message_channel.dart
lib/messaging/boost_message_channel.dart
+57
-1
lib/messaging/handlers/did_disappear_page_container_handler.dart
...saging/handlers/did_disappear_page_container_handler.dart
+0
-50
lib/messaging/handlers/did_init_page_container_handler.dart
lib/messaging/handlers/did_init_page_container_handler.dart
+0
-55
lib/messaging/handlers/did_show_page_container_handler.dart
lib/messaging/handlers/did_show_page_container_handler.dart
+0
-49
lib/messaging/handlers/on_native_page_result_handler.dart
lib/messaging/handlers/on_native_page_result_handler.dart
+0
-45
lib/messaging/handlers/will_dealloc_page_container_handler.dart
...ssaging/handlers/will_dealloc_page_container_handler.dart
+0
-48
lib/messaging/handlers/will_disappear_page_container_handler.dart
...aging/handlers/will_disappear_page_container_handler.dart
+0
-49
lib/messaging/handlers/will_show_page_container_handler.dart
lib/messaging/handlers/will_show_page_container_handler.dart
+0
-49
lib/messaging/message_proxy.dart
lib/messaging/message_proxy.dart
+0
-47
lib/messaging/native_container_event_handler.dart
lib/messaging/native_container_event_handler.dart
+1
-1
lib/router/router.dart
lib/router/router.dart
+4
-12
No files found.
android/build.gradle
View file @
c16f3c12
...
...
@@ -23,7 +23,7 @@ apply plugin: 'com.android.library'
android
{
compileSdkVersion
26
buildToolsVersion
"26.0.2"
buildToolsVersion
'27.0.3'
defaultConfig
{
minSdkVersion
16
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
...
...
example/ios/Runner/DemoRouter.m
View file @
c16f3c12
...
...
@@ -22,7 +22,7 @@
}
// Boost 2 switch
-
(
BOOL
)
use
r
Boost2
-
(
BOOL
)
useBoost2
{
return
YES
;
}
...
...
@@ -70,7 +70,7 @@
animated
:(
BOOL
)
animated
completion
:(
void
(
^
)(
BOOL
))
completion
{
if
([
self
use
r
Boost2
]){
if
([
self
useBoost2
]){
NSMutableDictionary
*
exts
=
NSMutableDictionary
.
new
;
exts
[
@"url"
]
=
name
;
exts
[
@"params"
]
=
params
;
...
...
@@ -98,7 +98,7 @@
-
(
void
)
closePage
:(
NSString
*
)
uid
animated
:(
BOOL
)
animated
params
:(
NSDictionary
*
)
params
completion
:(
void
(
^
)(
BOOL
))
completion
{
if
([
self
use
r
Boost2
]){
if
([
self
useBoost2
]){
NSMutableDictionary
*
exts
=
NSMutableDictionary
.
new
;
exts
[
@"params"
]
=
params
;
exts
[
@"animated"
]
=
@
(
animated
);
...
...
ios/Classes/1.0/FLBFlutterViewContainer.m
View file @
c16f3c12
...
...
@@ -27,7 +27,7 @@
#import "FLBStackCache.h"
#import "FLBStackCacheObjectImg.h"
#import "FLBMemoryInspector.h"
#import "
Service_NavigationService
.h"
#import "
BoostMessageChannel
.h"
#import "FlutterBoostConfig.h"
#import "FlutterBoostPlugin_private.h"
...
...
@@ -51,7 +51,7 @@
if
(
!
_name
&&
name
){
_name
=
name
;
_params
=
params
;
[
Service_NavigationService
didInitPageContainer
:
^
(
NSNumber
*
r
)
{}
[
BoostMessageChannel
didInitPageContainer
:
^
(
NSNumber
*
r
)
{}
pageName:
name
params:
params
uniqueId:
[
self
uniqueIDString
]];
...
...
@@ -140,7 +140,7 @@ static NSUInteger kInstanceCounter = 0;
-
(
void
)
notifyWillDealloc
{
[
Service_NavigationService
willDeallocPageContainer
:
^
(
NSNumber
*
r
)
{}
[
BoostMessageChannel
willDeallocPageContainer
:
^
(
NSNumber
*
r
)
{}
pageName:
_name
params
:
_params
uniqueId:
[
self
uniqueIDString
]];
...
...
@@ -310,7 +310,7 @@ static NSUInteger kInstanceCounter = 0;
[
self
showSnapShotVew
];
[
Service_NavigationService
willShowPageContainer
:
^
(
NSNumber
*
result
)
{}
[
BoostMessageChannel
willShowPageContainer
:
^
(
NSNumber
*
result
)
{}
pageName:
_name
params:
_params
uniqueId:
self
.
uniqueIDString
];
...
...
@@ -331,7 +331,7 @@ static NSUInteger kInstanceCounter = 0;
//Ensure flutter view is attached.
[
self
attatchFlutterView
];
[
Service_NavigationService
didShowPageContainer
:
^
(
NSNumber
*
result
)
{}
[
BoostMessageChannel
didShowPageContainer
:
^
(
NSNumber
*
result
)
{}
pageName:
_name
params:
_params
uniqueId:
self
.
uniqueIDString
];
...
...
@@ -369,7 +369,7 @@ static NSUInteger kInstanceCounter = 0;
[
self
.
view
bringSubviewToFront
:
self
.
screenShotView
];
}
[
Service_NavigationService
willDisappearPageContainer
:
^
(
NSNumber
*
result
)
{}
[
BoostMessageChannel
willDisappearPageContainer
:
^
(
NSNumber
*
result
)
{}
pageName:
_name
params:
_params
uniqueId:
self
.
uniqueIDString
];
...
...
@@ -379,7 +379,7 @@ static NSUInteger kInstanceCounter = 0;
-
(
void
)
viewDidDisappear
:(
BOOL
)
animated
{
[
Service_NavigationService
didDisappearPageContainer
:
^
(
NSNumber
*
result
)
{}
[
BoostMessageChannel
didDisappearPageContainer
:
^
(
NSNumber
*
result
)
{}
pageName:
_name
params:
_params
uniqueId:
self
.
uniqueIDString
];
...
...
ios/Classes/1.5/FLB2FlutterViewContainer.m
View file @
c16f3c12
...
...
@@ -24,7 +24,7 @@
#import "FLB2FlutterViewContainer.h"
#import "FLB2FlutterApplication.h"
#import "
Service_NavigationService
.h"
#import "
BoostMessageChannel
.h"
#import "FLBFlutterContainerManager.h"
#import "FlutterBoostPlugin_private.h"
...
...
@@ -64,7 +64,7 @@
if
(
!
_name
&&
name
){
_name
=
name
;
_params
=
params
;
[
Service_NavigationService
didInitPageContainer
:
^
(
NSNumber
*
r
)
{}
[
BoostMessageChannel
didInitPageContainer
:
^
(
NSNumber
*
r
)
{}
pageName:
name
params:
params
uniqueId:
[
self
uniqueIDString
]];
...
...
@@ -115,7 +115,7 @@ static NSUInteger kInstanceCounter = 0;
-
(
void
)
notifyWillDealloc
{
[
Service_NavigationService
willDeallocPageContainer
:
^
(
NSNumber
*
r
)
{}
[
BoostMessageChannel
willDeallocPageContainer
:
^
(
NSNumber
*
r
)
{}
pageName:
_name
params
:
_params
uniqueId:
[
self
uniqueIDString
]];
...
...
@@ -169,7 +169,7 @@ static NSUInteger kInstanceCounter = 0;
//For new page we should attach flutter view in view will appear
//for better performance.
[
Service_NavigationService
willShowPageContainer
:
^
(
NSNumber
*
result
)
{}
[
BoostMessageChannel
willShowPageContainer
:
^
(
NSNumber
*
result
)
{}
pageName:
_name
params:
_params
uniqueId:
self
.
uniqueIDString
];
...
...
@@ -190,7 +190,7 @@ static NSUInteger kInstanceCounter = 0;
//Ensure flutter view is attached.
[
self
attatchFlutterEngine
];
[
self
surfaceUpdated
:
YES
];
[
Service_NavigationService
didShowPageContainer
:
^
(
NSNumber
*
result
)
{}
[
BoostMessageChannel
didShowPageContainer
:
^
(
NSNumber
*
result
)
{}
pageName:
_name
params:
_params
uniqueId:
self
.
uniqueIDString
];
...
...
@@ -200,7 +200,7 @@ static NSUInteger kInstanceCounter = 0;
-
(
void
)
viewWillDisappear
:(
BOOL
)
animated
{
[
Service_NavigationService
willDisappearPageContainer
:
^
(
NSNumber
*
result
)
{}
[
BoostMessageChannel
willDisappearPageContainer
:
^
(
NSNumber
*
result
)
{}
pageName:
_name
params:
_params
uniqueId:
self
.
uniqueIDString
];
...
...
@@ -211,7 +211,7 @@ static NSUInteger kInstanceCounter = 0;
-
(
void
)
viewDidDisappear
:(
BOOL
)
animated
{
[
self
detatchFlutterEngine
];
[
Service_NavigationService
didDisappearPageContainer
:
^
(
NSNumber
*
result
)
{}
[
BoostMessageChannel
didDisappearPageContainer
:
^
(
NSNumber
*
result
)
{}
pageName:
_name
params:
_params
uniqueId:
self
.
uniqueIDString
];
...
...
ios/Classes/Boost/FLB2Platform.h
View file @
c16f3c12
...
...
@@ -30,7 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
@protocol
FLB2Platform
<
FLBPlatform
>
@optional
-
(
BOOL
)
use
r
Boost2
;
-
(
BOOL
)
useBoost2
;
@required
-
(
void
)
open
:(
NSString
*
)
url
...
...
ios/Classes/Boost/FlutterBoostPlugin.m
View file @
c16f3c12
...
...
@@ -26,29 +26,20 @@
#import "FlutterBoostPlugin_private.h"
#import "FLBFactory.h"
#import "FLB2Factory.h"
#import "FLBMessageDispather.h"
#import "FLBMessageImp.h"
#import "NavigationService_closePage.h"
#import "NavigationService_openPage.h"
#import "NavigationService_pageOnStart.h"
#import "NavigationService_onShownContainerChanged.h"
#import "NavigationService_onFlutterPageResult.h"
#import "BoostMessageChannel.h"
#import "FlutterBoostPlugin_private.h"
@interface
FlutterBoostPlugin
()
@property
(
nonatomic
,
strong
)
FLBMessageDispather
*
dispatcher
;
@end
@implementation
FlutterBoostPlugin
+
(
void
)
registerWithRegistrar
:(
NSObject
<
FlutterPluginRegistrar
>*
)
registrar
{
FlutterMethodChannel
*
channel
=
[
FlutterMethodChannel
methodChannelWithName:
@"flutter_boost"
methodChannelWithName:
@"flutter_boost
_method
"
binaryMessenger:
[
registrar
messenger
]];
FlutterBoostPlugin
*
instance
=
[
self
.
class
sharedInstance
];
[
instance
registerHandlers
];
instance
.
methodChannel
=
channel
;
instance
.
broadcastor
=
[[
FLBBroadcastor
alloc
]
initWithMethodChannel
:
channel
];
[
registrar
addMethodCallDelegate
:
instance
channel
:
channel
];
}
...
...
@@ -56,31 +47,48 @@
if
([
@"getPlatformVersion"
isEqualToString
:
call
.
method
])
{
result
([
@"iOS "
stringByAppendingString
:[[
UIDevice
currentDevice
]
systemVersion
]]);
}
else
if
([
@"__event__"
isEqual
:
call
.
method
]){
[
_broadcastor
handleMethodCall
:
call
result
:
result
];
[
BoostMessageChannel
handleMethodCall
:
call
result
:
result
];
}
else
if
([
@"closePage"
isEqualToString
:
call
.
method
]){
NSDictionary
*
args
=
call
.
arguments
;
NSDictionary
*
exts
=
args
[
@"exts"
];
NSString
*
uid
=
args
[
@"uniqueId"
];
NSDictionary
*
resultData
=
args
[
@"result"
];
[[
FlutterBoostPlugin
sharedInstance
].
application
close
:
uid
result:
resultData
exts:
exts
completion:
^
(
BOOL
r
){
result
(
@
(
r
));
}];
}
else
if
([
@"onFlutterPageResult"
isEqualToString
:
call
.
method
]){
//Do nothing
}
else
if
([
@"onShownContainerChanged"
isEqualToString
:
call
.
method
]){
NSString
*
newName
=
call
.
arguments
[
@"newName"
];
if
(
newName
){
[
NSNotificationCenter
.
defaultCenter
postNotificationName
:
@"flutter_boost_container_showed"
object:
newName
];
}
}
else
if
([
@"openPage"
isEqualToString
:
call
.
method
]){
NSDictionary
*
args
=
call
.
arguments
;
NSString
*
url
=
args
[
@"url"
];
NSDictionary
*
urlParams
=
args
[
@"urlParams"
];
NSDictionary
*
exts
=
args
[
@"exts"
];
[[
FlutterBoostPlugin
sharedInstance
].
application
open
:
url
urlParams:
urlParams
exts:
exts
reult:
result
completion:
^
(
BOOL
r
)
{}];
}
else
if
([
@"pageOnStart"
isEqualToString
:
call
.
method
]){
NSMutableDictionary
*
pageInfo
=
[
NSMutableDictionary
new
];
pageInfo
[
@"name"
]
=
[
FlutterBoostPlugin
sharedInstance
].
fPagename
;
pageInfo
[
@"params"
]
=
[
FlutterBoostPlugin
sharedInstance
].
fParams
;
pageInfo
[
@"uniqueId"
]
=
[
FlutterBoostPlugin
sharedInstance
].
fPageId
;
if
(
result
)
result
(
pageInfo
);
}
else
{
FLBMessageImp
*
msg
=
FLBMessageImp
.
new
;
msg
.
name
=
call
.
method
;
msg
.
params
=
call
.
arguments
;
if
(
!
[
self
.
dispatcher
dispatch
:
msg
result
:
result
]){
result
(
FlutterMethodNotImplemented
);
}
}
}
-
(
void
)
registerHandlers
{
NSArray
*
handlers
=
@[
NavigationService_openPage
.
class
,
NavigationService_closePage
.
class
,
NavigationService_pageOnStart
.
class
,
NavigationService_onShownContainerChanged
.
class
,
NavigationService_onFlutterPageResult
.
class
];
for
(
Class
cls
in
handlers
){
[
self
.
dispatcher
registerHandler
:
cls
.
new
];
}
}
+
(
instancetype
)
sharedInstance
{
...
...
@@ -93,14 +101,6 @@
return
_instance
;
}
-
(
instancetype
)
init
{
if
(
self
=
[
super
init
])
{
_dispatcher
=
FLBMessageDispather
.
new
;
}
return
self
;
}
-
(
id
<
FLBFlutterApplicationInterface
>
)
application
{
...
...
@@ -121,7 +121,7 @@
static
dispatch_once_t
onceToken
;
dispatch_once
(
&
onceToken
,
^
{
if
([
platform
respondsToSelector
:
@selector
(
use
rBoost2
)]
&&
platform
.
user
Boost2
){
if
([
platform
respondsToSelector
:
@selector
(
use
Boost2
)]
&&
platform
.
use
Boost2
){
_factory
=
FLB2Factory
.
new
;
}
else
{
_factory
=
FLBFactory
.
new
;
...
...
@@ -148,14 +148,14 @@
-
(
void
)
sendEvent
:(
NSString
*
)
eventName
arguments
:(
NSDictionary
*
)
arguments
{
[
_broadcastor
sendEvent
:
eventName
[
BoostMessageChannel
sendEvent
:
eventName
arguments:
arguments
];
}
-
(
FLBVoidCallback
)
addEventListener
:(
FLBEventListener
)
listner
forName
:(
NSString
*
)
name
{
return
[
_broadcastor
addEventListener
:
listner
return
[
BoostMessageChannel
addEventListener
:
listner
forName:
name
];
}
...
...
ios/Classes/Boost/FlutterBoostPlugin_private.h
View file @
c16f3c12
...
...
@@ -25,7 +25,6 @@
#import "FLBFlutterApplicationInterface.h"
#import "FLBAbstractFactory.h"
#import "FLBBroadcastor.h"
@interface
FlutterBoostPlugin
(){
id
<
FLBFlutterApplicationInterface
>
_application
;
...
...
@@ -36,7 +35,6 @@
-
(
id
<
FLBAbstractFactory
>
)
factory
;
@property
(
nonatomic
,
strong
)
FlutterMethodChannel
*
methodChannel
;
@property
(
nonatomic
,
strong
)
FLBBroadcastor
*
broadcastor
;
@property
(
nonatomic
,
copy
)
NSString
*
fPageId
;
@property
(
nonatomic
,
copy
)
NSString
*
fPagename
;
@property
(
nonatomic
,
strong
)
NSDictionary
*
fParams
;
...
...
ios/Classes/Messaging/
Generated/NavigationService/service/Service_NavigationService
.h
→
ios/Classes/Messaging/
BoostMessageChannel
.h
View file @
c16f3c12
...
...
@@ -23,8 +23,10 @@
*/
#import <Foundation/Foundation.h>
#import <Flutter/Flutter.h>
#import "FLBTypes.h"
@interface
Service_NavigationService
:
NSObject
@interface
BoostMessageChannel
:
NSObject
+
(
void
)
onNativePageResult
:(
void
(
^
)(
NSNumber
*
))
result
uniqueId
:(
NSString
*
)
uniqueId
key
:(
NSString
*
)
key
resultData
:(
NSDictionary
*
)
resultData
params
:(
NSDictionary
*
)
params
;
+
(
void
)
didShowPageContainer
:(
void
(
^
)(
NSNumber
*
))
result
pageName
:(
NSString
*
)
pageName
params
:(
NSDictionary
*
)
params
uniqueId
:(
NSString
*
)
uniqueId
;
...
...
@@ -33,4 +35,15 @@
+
(
void
)
didDisappearPageContainer
:(
void
(
^
)(
NSNumber
*
))
result
pageName
:(
NSString
*
)
pageName
params
:(
NSDictionary
*
)
params
uniqueId
:(
NSString
*
)
uniqueId
;
+
(
void
)
didInitPageContainer
:(
void
(
^
)(
NSNumber
*
))
result
pageName
:(
NSString
*
)
pageName
params
:(
NSDictionary
*
)
params
uniqueId
:(
NSString
*
)
uniqueId
;
+
(
void
)
willDeallocPageContainer
:(
void
(
^
)(
NSNumber
*
))
result
pageName
:(
NSString
*
)
pageName
params
:(
NSDictionary
*
)
params
uniqueId
:(
NSString
*
)
uniqueId
;
+
(
void
)
sendEvent
:(
NSString
*
)
eventName
arguments
:(
NSDictionary
*
)
arguments
;
+
(
FLBVoidCallback
)
addEventListener
:(
FLBEventListener
)
listner
forName
:(
NSString
*
)
name
;
+
(
void
)
handleMethodCall
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
;
@end
ios/Classes/Messaging/
Generated/NavigationService/service/Service_NavigationService
.mm
→
ios/Classes/Messaging/
BoostMessageChannel
.mm
View file @
c16f3c12
...
...
@@ -23,17 +23,72 @@
*/
#import "Service_NavigationService.h"
#import <Flutter/Flutter.h>
#import "BoostMessageChannel.h"
#import "FlutterBoostPlugin_private.h"
@implementation
Service_NavigationService
@implementation
BoostMessageChannel
+
(
NSMutableDictionary
*
)
lists
{
static
NSMutableDictionary
*
_list
=
nil
;
static
dispatch_once_t
onceToken
;
dispatch_once
(
&
onceToken
,
^
{
_list
=
[
NSMutableDictionary
new
];
});
return
_list
;
}
+
(
FlutterMethodChannel
*
)
methodChannel
{
return
FlutterBoostPlugin
.
sharedInstance
.
methodChannel
;
}
+
(
void
)
sendEvent
:(
NSString
*
)
eventName
arguments
:(
NSDictionary
*
)
arguments
{
if
(
!
eventName
)
return
;
NSMutableDictionary
*
msg
=
[
NSMutableDictionary
new
];
msg
[
@"name"
]
=
eventName
;
msg
[
@"arguments"
]
=
arguments
;
[
self
.
methodChannel
invokeMethod
:
@"__event__"
arguments:
msg
result:
^
(
id
r
){}];
}
+
(
FLBVoidCallback
)
addEventListener
:(
FLBEventListener
)
listner
forName
:(
NSString
*
)
name
{
if
(
!
name
||
!
listner
)
return
^
{};
NSMutableArray
*
list
=
[
self
lists
][
name
];
if
(
!
list
){
list
=
[
NSMutableArray
new
];
[
self
lists
][
name
]
=
list
;
}
[
list
addObject
:
listner
];
return
^
{
[
list
removeObject
:
listner
];
};
}
+
(
void
)
handleMethodCall
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
if
([
call
.
method
isEqual
:
@"__event__"
]){
NSString
*
name
=
call
.
arguments
[
@"name"
];
NSDictionary
*
arguments
=
call
.
arguments
[
@"arguments"
];
if
(
name
){
NSMutableArray
*
list
=
[
self
lists
][
name
];
if
(
list
){
for
(
FLBEventListener
l
in
list
){
l
(
name
,
arguments
);
}
}
}
}
}
+
(
void
)
onNativePageResult
:(
void
(
^
)(
NSNumber
*
))
result
uniqueId
:(
NSString
*
)
uniqueId
key
:(
NSString
*
)
key
resultData
:(
NSDictionary
*
)
resultData
params
:(
NSDictionary
*
)
params
{
NSMutableDictionary
*
tmp
=
[
NSMutableDictionary
dictionary
];
...
...
ios/Classes/Messaging/Generated/NavigationService/handlers/NavigationService_closePage.h
deleted
100755 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
// Generated by AIOCodeGen do not edit!
#import "FLBMessageHandlerImp.h"
@interface
NavigationService_closePage
:
FLBMessageHandlerImp
@end
ios/Classes/Messaging/Generated/NavigationService/handlers/NavigationService_closePage.mm
deleted
100755 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#import "ServiceGateway.h"
#import "NavigationService_closePage.h"
#import "FlutterBoostPlugin_private.h"
#define FLUTTER_APP [FlutterBoostPlugin sharedInstance].application
@implementation
NavigationService_closePage
#pragma mark - Do not edit these method.
-
(
BOOL
)
call
:(
id
<
FLBMessage
>
)
msg
result
:(
void
(
^
)(
BOOL
))
resultBlock
{
NSDictionary
*
args
=
msg
.
params
;
NSDictionary
*
exts
=
args
[
@"exts"
];
NSString
*
uid
=
args
[
@"uniqueId"
];
NSDictionary
*
resultData
=
args
[
@"result"
];
[
FLUTTER_APP
close
:
uid
result:
resultData
exts:
exts
completion:
resultBlock
];
return
YES
;
}
-
(
NSString
*
)
returnType
{
return
@"BOOL"
;
}
-
(
NSArray
*
)
handledMessageNames
{
return
@[
@"closePage"
];
}
@end
ios/Classes/Messaging/Generated/NavigationService/handlers/NavigationService_onFlutterPageResult.h
deleted
100755 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
// Generated by AIOCodeGen do not edit!
#import "FLBMessageHandlerImp.h"
@interface
NavigationService_onFlutterPageResult
:
FLBMessageHandlerImp
@end
ios/Classes/Messaging/Generated/NavigationService/handlers/NavigationService_onFlutterPageResult.mm
deleted
100755 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
//Generated by AIOCodeGen.
#import "ServiceGateway.h"
#import "NavigationService_onFlutterPageResult.h"
#import "FlutterBoost.h"
@implementation
NavigationService_onFlutterPageResult
-
(
void
)
onCall
:(
void
(
^
)(
BOOL
))
result
uniqueId
:(
NSString
*
)
uniqueId
key
:(
NSString
*
)
key
resultData
:(
NSDictionary
*
)
resultData
params
:(
NSDictionary
*
)
params
{
}
#pragma mark - Do not edit these method.
-
(
BOOL
)
call
:(
id
<
FLBMessage
>
)
msg
result
:(
void
(
^
)(
BOOL
))
result
{
NSDictionary
*
args
=
msg
.
params
;
[
self
onCall
:
result
uniqueId
:
args
[
@"uniqueId"
]
key
:
args
[
@"key"
]
resultData
:
args
[
@"resultData"
]
params
:
args
[
@"params"
]];
return
YES
;
}
-
(
NSArray
*
)
handledMessageNames
{
return
@[
@"onFlutterPageResult"
];
}
-
(
NSString
*
)
returnType
{
return
@"BOOL"
;
}
@end
ios/Classes/Messaging/Generated/NavigationService/handlers/NavigationService_onShownContainerChanged.h
deleted
100755 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
// Generated by AIOCodeGen do not edit!
#import "FLBMessageHandlerImp.h"
@interface
NavigationService_onShownContainerChanged
:
FLBMessageHandlerImp
@end
ios/Classes/Messaging/Generated/NavigationService/handlers/NavigationService_onShownContainerChanged.mm
deleted
100755 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
//Generated by AIOCodeGen.
#import "ServiceGateway.h"
#import "NavigationService_onShownContainerChanged.h"
@implementation
NavigationService_onShownContainerChanged
-
(
void
)
onCall
:(
void
(
^
)(
BOOL
))
result
newName
:(
NSString
*
)
newName
oldName
:(
NSString
*
)
oldName
params
:(
NSDictionary
*
)
params
{
if
(
newName
){
[
NSNotificationCenter
.
defaultCenter
postNotificationName
:
@"flutter_boost_container_showed"
object:
newName
];
}
}
#pragma mark - Do not edit these method.
-
(
BOOL
)
call
:(
id
<
FLBMessage
>
)
msg
result
:(
void
(
^
)(
BOOL
))
result
{
NSDictionary
*
args
=
msg
.
params
;
[
self
onCall
:
result
newName
:
args
[
@"newName"
]
oldName
:
args
[
@"oldName"
]
params
:
args
[
@"params"
]];
return
YES
;
}
-
(
NSString
*
)
returnType
{
return
@"BOOL"
;
}
-
(
NSArray
*
)
handledMessageNames
{
return
@[
@"onShownContainerChanged"
];
}
@end
ios/Classes/Messaging/Generated/NavigationService/handlers/NavigationService_openPage.h
deleted
100755 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
// Generated by AIOCodeGen do not edit!
#import "FLBMessageHandlerImp.h"
@interface
NavigationService_openPage
:
FLBMessageHandlerImp
@end
ios/Classes/Messaging/Generated/NavigationService/handlers/NavigationService_openPage.mm
deleted
100755 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
//Generated by AIOCodeGen.
#import "ServiceGateway.h"
#import "NavigationService_openPage.h"
#import "Service_NavigationService.h"
#import "FlutterBoostPlugin_private.h"
#define FLUTTER_APP [FlutterBoostPlugin sharedInstance].application
@implementation
NavigationService_openPage
#pragma mark - Do not edit these method.
-
(
BOOL
)
call
:(
id
<
FLBMessage
>
)
msg
result
:(
void
(
^
)(
NSDictionary
*
))
result
{
NSDictionary
*
args
=
msg
.
params
;
NSString
*
url
=
args
[
@"url"
];
NSDictionary
*
urlParams
=
args
[
@"urlParams"
];
NSDictionary
*
exts
=
args
[
@"exts"
];
[
FLUTTER_APP
open
:
url
urlParams:
urlParams
exts:
exts
reult:
result
completion:
^
(
BOOL
)
{}];
return
YES
;
}
-
(
NSString
*
)
returnType
{
return
@"NSDictionary *"
;
}
-
(
NSArray
*
)
handledMessageNames
{
return
@[
@"openPage"
];
}
@end
ios/Classes/Messaging/Generated/NavigationService/handlers/NavigationService_pageOnStart.h
deleted
100755 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
// Generated by AIOCodeGen do not edit!
#import "FLBMessageHandlerImp.h"
@interface
NavigationService_pageOnStart
:
FLBMessageHandlerImp
@end
ios/Classes/Messaging/Generated/NavigationService/handlers/NavigationService_pageOnStart.mm
deleted
100755 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
//Generated by AIOCodeGen.
#import "ServiceGateway.h"
#import "NavigationService_pageOnStart.h"
#import "FlutterBoostPlugin_private.h"
@implementation
NavigationService_pageOnStart
-
(
void
)
onCall
:(
void
(
^
)(
NSDictionary
*
))
result
params
:(
NSDictionary
*
)
params
{
NSMutableDictionary
*
pageInfo
=
[
NSMutableDictionary
new
];
pageInfo
[
@"name"
]
=
[
FlutterBoostPlugin
sharedInstance
].
fPagename
;
pageInfo
[
@"params"
]
=
[
FlutterBoostPlugin
sharedInstance
].
fParams
;
pageInfo
[
@"uniqueId"
]
=
[
FlutterBoostPlugin
sharedInstance
].
fPageId
;
if
(
result
)
result
(
pageInfo
);
}
#pragma mark - Do not edit these method.
-
(
BOOL
)
call
:(
id
<
FLBMessage
>
)
msg
result
:(
void
(
^
)(
NSDictionary
*
))
result
{
NSDictionary
*
args
=
msg
.
params
;
[
self
onCall
:
result
params
:
args
[
@"params"
]];
return
YES
;
}
-
(
NSString
*
)
returnType
{
return
@"NSDictionary *"
;
}
-
(
NSArray
*
)
handledMessageNames
{
return
@[
@"pageOnStart"
];
}
@end
ios/Classes/Messaging/base/FLBBroadcastor.h
deleted
100644 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#import <Foundation/Foundation.h>
#import <Flutter/Flutter.h>
#import "FLBTypes.h"
NS_ASSUME_NONNULL_BEGIN
@interface
FLBBroadcastor
:
NSObject
-
(
instancetype
)
initWithMethodChannel
:(
FlutterMethodChannel
*
)
channel
;
-
(
void
)
sendEvent
:(
NSString
*
)
eventName
arguments
:(
NSDictionary
*
)
arguments
;
-
(
FLBVoidCallback
)
addEventListener
:(
FLBEventListener
)
listner
forName
:(
NSString
*
)
name
;
-
(
void
)
handleMethodCall
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
;
@end
NS_ASSUME_NONNULL_END
ios/Classes/Messaging/base/FLBBroadcastor.m
deleted
100644 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#import "FLBBroadcastor.h"
@interface
FLBBroadcastor
()
@property
(
nonatomic
,
strong
)
FlutterMethodChannel
*
channel
;
@property
(
nonatomic
,
strong
)
NSMutableDictionary
*
lists
;
@end
@implementation
FLBBroadcastor
-
(
instancetype
)
initWithMethodChannel
:(
FlutterMethodChannel
*
)
channel
{
if
(
self
=
[
super
init
])
{
_channel
=
channel
;
_lists
=
NSMutableDictionary
.
new
;
}
return
self
;
}
-
(
void
)
sendEvent
:(
NSString
*
)
eventName
arguments
:(
NSDictionary
*
)
arguments
{
if
(
!
eventName
)
return
;
NSMutableDictionary
*
msg
=
NSMutableDictionary
.
new
;
msg
[
@"name"
]
=
eventName
;
msg
[
@"arguments"
]
=
arguments
;
[
_channel
invokeMethod
:
@"__event__"
arguments:
msg
result:
^
(
id
r
){}];
}
-
(
FLBVoidCallback
)
addEventListener
:(
FLBEventListener
)
listner
forName
:(
NSString
*
)
name
{
if
(
!
name
||
!
listner
)
return
^
{};
NSMutableArray
*
list
=
_lists
[
name
];
if
(
!
list
){
list
=
NSMutableArray
.
new
;
_lists
[
name
]
=
list
;
}
[
list
addObject
:
listner
];
return
^
{
[
list
removeObject
:
listner
];
};
}
-
(
void
)
handleMethodCall
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
if
([
call
.
method
isEqual
:
@"__event__"
]){
NSString
*
name
=
call
.
arguments
[
@"name"
];
NSDictionary
*
arguments
=
call
.
arguments
[
@"arguments"
];
if
(
name
){
NSMutableArray
*
list
=
_lists
[
name
];
if
(
list
){
for
(
FLBEventListener
l
in
list
){
l
(
name
,
arguments
);
}
}
}
}
}
@end
ios/Classes/Messaging/base/FLBMessageDispather.h
deleted
100755 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#import <Foundation/Foundation.h>
#import "FLBMessageing.h"
@interface
FLBMessageDispather
:
NSObject
<
FLBMessageDispatcher
>
@end
ios/Classes/Messaging/base/FLBMessageDispather.m
deleted
100755 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#import "FLBMessageDispather.h"
@interface
FLBMessageDispather
()
@property
(
nonatomic
,
strong
)
NSMutableDictionary
*
handlerMap
;
@end
@implementation
FLBMessageDispather
-
(
instancetype
)
init
{
if
(
self
=
[
super
init
])
{
_handlerMap
=
NSMutableDictionary
.
new
;
}
return
self
;
}
-
(
BOOL
)
dispatch
:(
id
<
FLBMessage
>
)
msg
result
:(
void
(
^
)(
id
date
))
result
{
if
(
msg
)
{
id
<
FLBMessageHandler
>
handler
=
_handlerMap
[
msg
.
name
];
[
handler
handle
:
msg
result
:
result
];
return
handler
!=
nil
;
}
else
{
return
NO
;
}
}
-
(
void
)
registerHandler
:(
id
<
FLBMessageHandler
>
)
handler
{
if
(
!
handler
)
return
;
NSArray
*
methods
=
handler
.
handledMessageNames
;
for
(
NSString
*
name
in
methods
){
if
(
_handlerMap
[
name
]){
NSAssert
(
NO
,
@"Conflicted method call name results in undefined error!"
);
}
else
{
_handlerMap
[
name
]
=
handler
;
}
}
}
-
(
void
)
removeHandler
:(
id
<
FLBMessageHandler
>
)
handler
{
NSArray
*
methods
=
handler
.
handledMessageNames
;
[
_handlerMap
removeObjectsForKeys
:
methods
];
}
-
(
void
)
removeAll
{
[
_handlerMap
removeAllObjects
];
}
@end
ios/Classes/Messaging/base/FLBMessageHandlerImp.h
deleted
100755 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#import <Foundation/Foundation.h>
#import "FLBMessageing.h"
@interface
FLBMessageHandlerImp
:
NSObject
<
FLBMessageHandler
>
@end
ios/Classes/Messaging/base/FLBMessageHandlerImp.m
deleted
100755 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#import "FLBMessageHandlerImp.h"
#import "FLBMessageImp.h"
typedef
void
(
^
SendResult
)(
NSObject
*
result
);
@interface
FLBMessageHandlerImp
()
@property
(
nonatomic
,
strong
)
NSMutableDictionary
*
callHandlers
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
methodNames
;
@end
@implementation
FLBMessageHandlerImp
-
(
instancetype
)
init
{
if
(
self
=
[
super
init
])
{
_callHandlers
=
[
NSMutableDictionary
new
];
_methodNames
=
NSMutableArray
.
new
;
[
self
bindCallMethod
];
}
return
self
;
}
#pragma mark - method handling logic.
//Farward this msg to old entry.
-
(
BOOL
)
handle
:(
id
<
FLBMessage
>
)
msg
result
:(
void
(
^
)(
id
data
))
result
{
return
[
self
handleMethodCall
:
msg
.
name
args
:
msg
.
params
result
:
result
];
}
-
(
NSArray
*
)
handledMessageNames
{
return
_methodNames
;
}
-
(
bool
)
handleMethodCall
:(
NSString
*
)
call
args
:(
NSDictionary
*
)
args
result
:(
void
(
^
)(
id
data
))
result
{
void
(
^
handler
)(
NSDictionary
*
,
SendResult
)
=
[
self
findHandler
:
call
];
if
(
handler
)
{
handler
(
args
,
result
);
return
YES
;
}
return
NO
;
}
-
(
id
)
findHandler
:(
NSString
*
)
call
{
return
_callHandlers
[
call
];
}
-
(
void
)
bindCallMethod
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
SEL
method
=
@selector
(
call
:
result
:
);
for
(
NSString
*
name
in
self
.
handledMessageNames
){
if
(
_callHandlers
[
name
])
{
continue
;
}
__weak
typeof
(
self
)
weakSelf
=
self
;
_callHandlers
[
name
]
=
^
(
NSDictionary
*
args
,
SendResult
result
){
id
resultBlock
=
[
weakSelf
getHandlerBlockForType
:
weakSelf
.
returnType
result
:
result
];
if
(
resultBlock
&&
result
)
{
FLBMessageImp
*
msg
=
FLBMessageImp
.
new
;
msg
.
name
=
name
;
msg
.
params
=
args
;
[
weakSelf
performSelector
:
method
withObject
:
msg
withObject
:
resultBlock
];
}
else
{
#if DEBUG
[
NSException
raise
:
@"invalid call"
format
:
@"missing handler and result!"
];
#endif
}
};
}
#pragma clang diagnostic pop
}
-
(
id
)
getHandlerBlockForType
:(
NSString
*
)
type
result
:(
SendResult
)
result
{
if
([
type
isEqual
:
@"int64_t"
])
{
return
^
(
int64_t
value
){
result
(
@
(
value
));
};
}
if
([
type
isEqual
:
@"double"
])
{
return
^
(
double
value
){
result
(
@
(
value
));
};
}
if
([
type
isEqual
:
@"BOOL"
])
{
return
^
(
BOOL
value
){
result
(
@
(
value
));
};
}
if
([
type
hasPrefix
:
@"NSString"
])
{
return
^
(
NSString
*
value
){
if
([
value
isKindOfClass
:
NSNumber
.
class
])
{
#if DEBUG
[
NSException
raise
:
@"invalid type"
format
:
@"require NSString!"
];
#endif
value
=
((
NSNumber
*
)
value
).
stringValue
;
}
result
(
value
);
};
}
if
([
type
hasPrefix
:
@"NSArray"
])
{
return
^
(
NSArray
*
value
){
result
(
value
);
};
}
if
([
type
hasPrefix
:
@"NSDictionary"
])
{
return
^
(
NSDictionary
*
value
){
result
(
value
);
};
}
if
([
type
isEqual
:
@"id"
])
{
return
result
;
}
/*
@"int":@"int64_t",
@"double":@"double",
@"bool":@"BOOL",
@"String":@"NSString *",
*/
return
nil
;
}
-
(
NSString
*
)
returnType
{
return
@"id"
;
}
-
(
NSString
*
)
service
{
return
@"root"
;
}
@end
ios/Classes/Messaging/base/FLBMessageImp.h
deleted
100644 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#import <Foundation/Foundation.h>
#import "FLBMessageing.h"
NS_ASSUME_NONNULL_BEGIN
@interface
FLBMessageImp
:
NSObject
<
FLBMessage
>
@property
(
nonatomic
,
copy
)
NSString
*
name
;
@property
(
nonatomic
,
strong
)
NSDictionary
*
params
;
@end
NS_ASSUME_NONNULL_END
ios/Classes/Messaging/base/FLBMessageImp.m
deleted
100644 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#import "FLBMessageImp.h"
@implementation
FLBMessageImp
-
(
NSString
*
)
name
{
return
_name
;
}
-
(
NSDictionary
*
)
params
{
return
_params
;
}
@end
ios/Classes/Messaging/base/FLBMessageing.h
deleted
100755 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#import <Foundation/Foundation.h>
@protocol
FLBMessage
<
NSObject
>
@required
-
(
NSString
*
)
name
;
-
(
NSDictionary
*
)
params
;
@end
@protocol
FLBMessageHandler
<
NSObject
>
@required
-
(
BOOL
)
handle
:(
id
<
FLBMessage
>
)
msg
result
:(
void
(
^
)(
id
result
))
result
;
-
(
NSArray
*
)
handledMessageNames
;
-
(
NSString
*
)
service
;
@end
@protocol
FLBMessageDispatcher
<
NSObject
>
@required
-
(
BOOL
)
dispatch
:(
id
<
FLBMessage
>
)
msg
result
:(
void
(
^
)(
id
result
))
result
;
-
(
void
)
registerHandler
:(
id
<
FLBMessageHandler
>
)
handler
;
-
(
void
)
removeHandler
:(
id
<
FLBMessageHandler
>
)
handler
;
-
(
void
)
removeAll
;
@end
lib/container/container_coordinator.dart
View file @
c16f3c12
...
...
@@ -26,10 +26,10 @@ import 'dart:async';
import
'package:flutter/material.dart'
;
import
'package:flutter_boost/container/boost_container.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_container_event_handler.dart'
;
import
'package:flutter_boost/support/logger.dart'
;
class
ContainerCoordinator
implements
Native
Page
ContainerEventHandler
{
class
ContainerCoordinator
implements
NativeContainerEventHandler
{
static
final
ContainerCoordinator
singleton
=
ContainerCoordinator
();
final
Map
<
String
,
PageBuilder
>
_pageBuilders
=
<
String
,
PageBuilder
>{};
...
...
lib/container/container_manager.dart
View file @
c16f3c12
...
...
@@ -23,7 +23,7 @@
*/
import
'package:flutter/material.dart'
;
import
'package:flutter/scheduler.dart'
;
import
'package:flutter_boost/messaging/
service/navigation_service
.dart'
;
import
'package:flutter_boost/messaging/
boost_message_channel
.dart'
;
import
'package:flutter_boost/container/boost_container.dart'
;
import
'package:flutter_boost/container/container_coordinator.dart'
;
import
'package:flutter_boost/flutter_boost.dart'
;
...
...
@@ -135,7 +135,7 @@ class ContainerManagerState extends State<BoostContainerManager> {
void
_onShownContainerChanged
(
String
old
,
String
now
)
{
Logger
.
log
(
'onShownContainerChanged old:
$old
now:
$now
'
);
NavigationService
.
onShownContainerChanged
(
now
,
old
,
<
dynamic
,
dynamic
>{});
BoostMessageChannel
.
onShownContainerChanged
(
now
,
old
,
<
dynamic
,
dynamic
>{});
}
void
_refreshOverlayEntries
()
{
...
...
lib/flutter_boost.dart
View file @
c16f3c12
...
...
@@ -24,21 +24,12 @@
import
'dart:async'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_boost/messaging/
service/navigation_service
.dart'
;
import
'package:flutter_boost/messaging/
boost_message_channel
.dart'
;
import
'package:flutter_boost/container/boost_container.dart'
;
import
'package:flutter_boost/container/container_manager.dart'
;
import
'package:flutter_boost/router/router.dart'
;
import
'container/container_coordinator.dart'
;
import
'messaging/base/message_dispatcher.dart'
;
import
'messaging/handlers/did_disappear_page_container_handler.dart'
;
import
'messaging/handlers/did_show_page_container_handler.dart'
;
import
'messaging/handlers/did_init_page_container_handler.dart'
;
import
'messaging/handlers/on_native_page_result_handler.dart'
;
import
'messaging/handlers/will_dealloc_page_container_handler.dart'
;
import
'messaging/handlers/will_show_page_container_handler.dart'
;
import
'messaging/handlers/will_disappear_page_container_handler.dart'
;
import
'messaging/base/broadcastor.dart'
;
import
'observers_holders.dart'
;
export
'container/boost_container.dart'
;
...
...
@@ -61,13 +52,9 @@ class FlutterBoost {
final
ObserversHolder
_observersHolder
=
ObserversHolder
();
final
Router
_router
=
Router
();
final
MethodChannel
_methodChannel
=
MethodChannel
(
'flutter_boost_method'
);
final
EventChannel
_eventChannel
=
EventChannel
(
'flutter_boost_event'
);
final
MessageDispatcher
_dispatcher
=
MessageDispatcher
();
int
_callbackID
=
0
;
Broadcastor
_broadcastor
;
static
FlutterBoost
get
singleton
=>
_instance
;
static
ContainerManagerState
get
containerManager
=>
...
...
@@ -99,26 +86,49 @@ class FlutterBoost {
ObserversHolder
get
observersHolder
=>
_observersHolder
;
FlutterBoost
()
{
_broadcastor
=
Broadcastor
(
_methodChannel
);
//Config message handlers
NavigationService
.
methodChannel
=
_methodChannel
;
_dispatcher
.
registerHandler
(
DidDisappearPageContainerHandler
());
_dispatcher
.
registerHandler
(
DidInitPageContainerHandler
());
_dispatcher
.
registerHandler
(
DidShowPageContainerHandler
());
_dispatcher
.
registerHandler
(
OnNativePageResultHandler
());
_dispatcher
.
registerHandler
(
WillDeallocPageContainerHandler
());
_dispatcher
.
registerHandler
(
WillShowPageContainerHandler
());
_dispatcher
.
registerHandler
(
WillDisappearPageContainerHandler
());
BoostMessageChannel
.
methodChannel
=
_methodChannel
;
_methodChannel
.
setMethodCallHandler
((
MethodCall
call
){
if
(
call
.
method
==
"__event__"
){
//Handler broadcast event.
return
_broadcastor
.
handleCall
(
call
);
}
else
{
return
_dispatcher
.
dispatch
(
call
);
}
return
BoostMessageChannel
.
handleEventCall
(
call
);
}
else
if
(
call
.
method
==
"didDisappearPageContainer"
){
String
pageName
=
call
.
arguments
[
"pageName"
];
Map
params
=
call
.
arguments
[
"params"
];
String
uniqueId
=
call
.
arguments
[
"uniqueId"
];
ContainerCoordinator
.
singleton
.
nativeContainerDidDisappear
(
pageName
,
params
,
uniqueId
);
}
else
if
(
call
.
method
==
"nativeContainerDidInit"
){
String
pageName
=
call
.
arguments
[
"pageName"
];
Map
params
=
call
.
arguments
[
"params"
];
String
uniqueId
=
call
.
arguments
[
"uniqueId"
];
ContainerCoordinator
.
singleton
.
nativeContainerDidInit
(
pageName
,
params
,
uniqueId
);
}
else
if
(
call
.
method
==
"didShowPageContainer"
){
String
pageName
=
call
.
arguments
[
"pageName"
];
Map
params
=
call
.
arguments
[
"params"
];
String
uniqueId
=
call
.
arguments
[
"uniqueId"
];
ContainerCoordinator
.
singleton
.
nativeContainerDidShow
(
pageName
,
params
,
uniqueId
);
}
else
if
(
call
.
method
==
"willDeallocPageContainer"
){
String
pageName
=
call
.
arguments
[
"pageName"
];
Map
params
=
call
.
arguments
[
"params"
];
String
uniqueId
=
call
.
arguments
[
"uniqueId"
];
ContainerCoordinator
.
singleton
.
nativeContainerWillDealloc
(
pageName
,
params
,
uniqueId
);
}
else
if
(
call
.
method
==
"willDisappearPageContainer"
){
String
pageName
=
call
.
arguments
[
"pageName"
];
Map
params
=
call
.
arguments
[
"params"
];
String
uniqueId
=
call
.
arguments
[
"uniqueId"
];
ContainerCoordinator
.
singleton
.
nativeContainerWillDisappear
(
pageName
,
params
,
uniqueId
);
}
else
if
(
call
.
method
==
"willShowPageContainer"
){
String
pageName
=
call
.
arguments
[
"pageName"
];
Map
params
=
call
.
arguments
[
"params"
];
String
uniqueId
=
call
.
arguments
[
"uniqueId"
];
ContainerCoordinator
.
singleton
.
nativeContainerWillShow
(
pageName
,
params
,
uniqueId
);
}
return
Future
<
dynamic
>((){});
});
}
...
...
@@ -157,12 +167,12 @@ class FlutterBoost {
//Listen broadcast event from native.
Function
addEventListener
(
String
name
,
EventListener
listener
){
return
_broadcastor
.
addEventListener
(
name
,
listener
);
return
BoostMessageChannel
.
addEventListener
(
name
,
listener
);
}
//Send broadcast event to native.
void
sendEvent
(
String
name
,
Map
arguments
){
_broadcastor
.
sendEvent
(
name
,
arguments
);
BoostMessageChannel
.
sendEvent
(
name
,
arguments
);
}
Future
<
Map
<
String
,
dynamic
>>
openPage
(
String
name
,
Map
params
,{
bool
animated
})
{
...
...
@@ -193,7 +203,7 @@ class FlutterBoost {
exts
[
"params"
]
=
params
;
}
close
(
id
,
result:
{}
,
exts:
exts
);
return
close
(
id
,
result:
{}
,
exts:
exts
);
}
...
...
@@ -211,7 +221,7 @@ class FlutterBoost {
///query current top page and show it
static
void
handleOnStartPage
()
async
{
final
Map
<
dynamic
,
dynamic
>
pageInfo
=
await
NavigationService
.
pageOnStart
(<
dynamic
,
dynamic
>{});
await
BoostMessageChannel
.
pageOnStart
(<
dynamic
,
dynamic
>{});
if
(
pageInfo
==
null
||
pageInfo
.
isEmpty
)
return
;
if
(
pageInfo
.
containsKey
(
"name"
)
&&
...
...
lib/messaging/base/broadcastor.dart
deleted
100644 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import
'package:flutter/services.dart'
;
typedef
Future
<
dynamic
>
EventListener
(
String
name
,
Map
arguments
);
class
Broadcastor
{
MethodChannel
_channel
;
Map
<
String
,
List
<
EventListener
>>
_lists
=
Map
();
Broadcastor
(
MethodChannel
channel
){
_channel
=
channel
;
}
void
sendEvent
(
String
name
,
Map
arguments
){
if
(
name
==
null
)
{
return
;
}
if
(
arguments
==
null
){
arguments
=
Map
();
}
Map
msg
=
Map
();
msg
[
"name"
]
=
name
;
msg
[
"arguments"
]
=
arguments
;
_channel
.
invokeMethod
(
"__event__"
,
msg
);
}
Function
addEventListener
(
String
name
,
EventListener
listener
){
if
(
name
==
null
||
listener
==
null
){
return
(){};
}
List
<
EventListener
>
list
=
_lists
[
name
];
if
(
list
==
null
){
list
=
List
();
_lists
[
name
]
=
list
;
}
list
.
add
(
listener
);
return
(){
list
.
remove
(
listener
);
};
}
Future
<
dynamic
>
handleCall
(
MethodCall
call
){
if
(
call
.
method
!=
"__event__"
){
return
Future
<
dynamic
>((){});
}
String
name
=
call
.
arguments
[
"name"
];
Map
arg
=
call
.
arguments
[
"arguments"
];
List
<
EventListener
>
list
=
_lists
[
name
];
if
(
list
!=
null
){
for
(
EventListener
l
in
list
){
l
(
name
,
arg
);
}
}
return
Future
<
dynamic
>((){});
}
}
\ No newline at end of file
lib/messaging/base/message_dispatcher.dart
deleted
100644 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import
'dart:async'
;
import
'package:flutter/services.dart'
;
import
'message_handler.dart'
;
class
MessageDispatcher
{
Map
<
String
,
MessageHandler
>
_handlers
=
Map
();
Future
<
dynamic
>
dispatch
(
MethodCall
call
){
if
(
_handlers
.
containsKey
(
call
.
method
)){
return
_handlers
[
call
.
method
].
onMethodCall
(
call
);
}{
return
null
;
}
}
void
registerHandler
(
MessageHandler
handler
){
_handlers
[
handler
.
name
()]
=
handler
;
}
}
lib/messaging/base/message_handler.dart
deleted
100644 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import
'dart:async'
;
import
'package:flutter/services.dart'
;
abstract
class
MessageHandler
{
String
name
();
Future
<
dynamic
>
onMethodCall
(
MethodCall
call
);
}
\ No newline at end of file
lib/messaging/
service/navigation_service
.dart
→
lib/messaging/
boost_message_channel
.dart
View file @
c16f3c12
...
...
@@ -25,11 +25,67 @@
import
'dart:async'
;
import
'package:flutter/services.dart'
;
typedef
Future
<
dynamic
>
EventListener
(
String
name
,
Map
arguments
);
class
NavigationService
{
class
BoostMessageChannel
{
static
MethodChannel
methodChannel
;
static
Map
<
String
,
List
<
EventListener
>>
_lists
=
Map
();
static
void
sendEvent
(
String
name
,
Map
arguments
){
if
(
name
==
null
)
{
return
;
}
if
(
arguments
==
null
){
arguments
=
Map
();
}
Map
msg
=
Map
();
msg
[
"name"
]
=
name
;
msg
[
"arguments"
]
=
arguments
;
methodChannel
.
invokeMethod
(
"__event__"
,
msg
);
}
static
Function
addEventListener
(
String
name
,
EventListener
listener
){
if
(
name
==
null
||
listener
==
null
){
return
(){};
}
List
<
EventListener
>
list
=
_lists
[
name
];
if
(
list
==
null
){
list
=
List
();
_lists
[
name
]
=
list
;
}
list
.
add
(
listener
);
return
(){
list
.
remove
(
listener
);
};
}
static
Future
<
dynamic
>
handleEventCall
(
MethodCall
call
){
if
(
call
.
method
!=
"__event__"
){
return
Future
<
dynamic
>((){});
}
String
name
=
call
.
arguments
[
"name"
];
Map
arg
=
call
.
arguments
[
"arguments"
];
List
<
EventListener
>
list
=
_lists
[
name
];
if
(
list
!=
null
){
for
(
EventListener
l
in
list
){
l
(
name
,
arg
);
}
}
return
Future
<
dynamic
>((){});
}
static
Future
<
bool
>
onShownContainerChanged
(
String
newName
,
String
oldName
,
Map
params
)
{
Map
<
String
,
dynamic
>
properties
=
new
Map
<
String
,
dynamic
>();
properties
[
"newName"
]=
newName
;
...
...
lib/messaging/handlers/did_disappear_page_container_handler.dart
deleted
100755 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import
'dart:async'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_boost/container/container_coordinator.dart'
;
import
'package:flutter_boost/messaging/base/message_handler.dart'
;
class
DidDisappearPageContainerHandler
implements
MessageHandler
{
@override
String
name
()
{
return
"didDisappearPageContainer"
;
}
@override
Future
<
bool
>
onMethodCall
(
MethodCall
call
)
{
return
onCall
(
call
.
arguments
[
"pageName"
],
call
.
arguments
[
"params"
],
call
.
arguments
[
"uniqueId"
]);
}
//==============================================Do not edit code above!
Future
<
bool
>
onCall
(
String
pageName
,
Map
params
,
String
uniqueId
)
async
{
return
ContainerCoordinator
.
singleton
.
nativeContainerDidDisappear
(
pageName
,
params
,
uniqueId
);
}
}
lib/messaging/handlers/did_init_page_container_handler.dart
deleted
100755 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import
'dart:async'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_boost/container/container_coordinator.dart'
;
import
'package:flutter_boost/messaging/base/message_handler.dart'
;
class
DidInitPageContainerHandler
implements
MessageHandler
{
static
void
regsiter
()
{
// ServiceGateway.sharedInstance()
// .registerHandler(new NavigationService_didInitPageContainer());
}
@override
String
name
()
{
return
"didInitPageContainer"
;
}
@override
Future
<
bool
>
onMethodCall
(
MethodCall
call
)
{
return
onCall
(
call
.
arguments
[
"pageName"
],
call
.
arguments
[
"params"
],
call
.
arguments
[
"uniqueId"
]);
}
//==============================================Do not edit code above!
Future
<
bool
>
onCall
(
String
pageName
,
Map
params
,
String
uniqueId
)
async
{
return
ContainerCoordinator
.
singleton
.
nativeContainerDidInit
(
pageName
,
params
,
uniqueId
);
}
}
lib/messaging/handlers/did_show_page_container_handler.dart
deleted
100755 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import
'dart:async'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_boost/container/container_coordinator.dart'
;
import
'package:flutter_boost/messaging/base/message_handler.dart'
;
class
DidShowPageContainerHandler
implements
MessageHandler
{
@override
String
name
()
{
return
"didShowPageContainer"
;
}
@override
Future
<
bool
>
onMethodCall
(
MethodCall
call
)
{
return
onCall
(
call
.
arguments
[
"pageName"
],
call
.
arguments
[
"params"
],
call
.
arguments
[
"uniqueId"
]);
}
//==============================================Do not edit code above!
Future
<
bool
>
onCall
(
String
pageName
,
Map
params
,
String
uniqueId
)
async
{
return
ContainerCoordinator
.
singleton
.
nativeContainerDidShow
(
pageName
,
params
,
uniqueId
);
}
}
lib/messaging/handlers/on_native_page_result_handler.dart
deleted
100755 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import
'dart:async'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_boost/messaging/base/message_handler.dart'
;
class
OnNativePageResultHandler
implements
MessageHandler
{
@override
String
name
()
{
return
"onNativePageResult"
;
}
@override
Future
<
bool
>
onMethodCall
(
MethodCall
call
)
{
return
onCall
(
call
.
arguments
[
"uniqueId"
],
call
.
arguments
[
"key"
],
call
.
arguments
[
"resultData"
],
call
.
arguments
[
"params"
]);
}
//==============================================Do not edit code above!
Future
<
bool
>
onCall
(
String
uniqueId
,
String
key
,
Map
resultData
,
Map
params
)
async
{
}
}
lib/messaging/handlers/will_dealloc_page_container_handler.dart
deleted
100755 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import
'dart:async'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_boost/container/container_coordinator.dart'
;
import
'package:flutter_boost/messaging/base/message_handler.dart'
;
class
WillDeallocPageContainerHandler
implements
MessageHandler
{
@override
String
name
()
{
return
"willDeallocPageContainer"
;
}
@override
Future
<
bool
>
onMethodCall
(
MethodCall
call
)
{
return
onCall
(
call
.
arguments
[
"pageName"
],
call
.
arguments
[
"params"
],
call
.
arguments
[
"uniqueId"
]);
}
//==============================================Do not edit code above!
Future
<
bool
>
onCall
(
String
pageName
,
Map
params
,
String
uniqueId
)
async
{
return
ContainerCoordinator
.
singleton
.
nativeContainerWillDealloc
(
pageName
,
params
,
uniqueId
);
}
}
lib/messaging/handlers/will_disappear_page_container_handler.dart
deleted
100755 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import
'dart:async'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_boost/container/container_coordinator.dart'
;
import
'package:flutter_boost/messaging/base/message_handler.dart'
;
class
WillDisappearPageContainerHandler
implements
MessageHandler
{
@override
String
name
()
{
return
"willDisappearPageContainer"
;
}
@override
Future
<
bool
>
onMethodCall
(
MethodCall
call
)
{
return
onCall
(
call
.
arguments
[
"pageName"
],
call
.
arguments
[
"params"
],
call
.
arguments
[
"uniqueId"
]);
}
//==============================================Do not edit code above!
Future
<
bool
>
onCall
(
String
pageName
,
Map
params
,
String
uniqueId
)
async
{
return
ContainerCoordinator
.
singleton
.
nativeContainerWillDisappear
(
pageName
,
params
,
uniqueId
);
}
}
lib/messaging/handlers/will_show_page_container_handler.dart
deleted
100755 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import
'dart:async'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_boost/container/container_coordinator.dart'
;
import
'package:flutter_boost/messaging/base/message_handler.dart'
;
class
WillShowPageContainerHandler
implements
MessageHandler
{
@override
String
name
()
{
return
"willShowPageContainer"
;
}
@override
Future
<
bool
>
onMethodCall
(
MethodCall
call
)
{
return
onCall
(
call
.
arguments
[
"pageName"
],
call
.
arguments
[
"params"
],
call
.
arguments
[
"uniqueId"
]);
}
//==============================================Do not edit code above!
Future
<
bool
>
onCall
(
String
pageName
,
Map
params
,
String
uniqueId
)
async
{
return
ContainerCoordinator
.
singleton
.
nativeContainerWillShow
(
pageName
,
params
,
uniqueId
);
}
}
lib/messaging/message_proxy.dart
deleted
100755 → 0
View file @
786e5617
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import
'package:flutter_boost/messaging/service/navigation_service.dart'
;
import
'dart:async'
;
abstract
class
MessageProxy
{
Future
<
Map
<
dynamic
,
dynamic
>>
open
(
String
url
,{
Map
<
String
,
dynamic
>
urlParams
,
Map
<
String
,
dynamic
>
exts
});
Future
<
bool
>
close
(
String
id
,{
Map
<
String
,
dynamic
>
result
,
Map
<
String
,
dynamic
>
exts
});
}
class
MessageProxyImp
implements
MessageProxy
{
@override
Future
<
Map
<
dynamic
,
dynamic
>>
open
(
String
url
,{
Map
<
String
,
dynamic
>
urlParams
,
Map
<
String
,
dynamic
>
exts
}){
return
NavigationService
.
openPage
(
url
,
urlParams
,
exts
);
}
@override
Future
<
bool
>
close
(
String
id
,{
Map
<
String
,
dynamic
>
result
,
Map
<
String
,
dynamic
>
exts
}){
return
NavigationService
.
closePage
(
id
,
result:
result
,
exts:
exts
);
}
}
lib/messaging/native_
page_
container_event_handler.dart
→
lib/messaging/native_container_event_handler.dart
View file @
c16f3c12
...
...
@@ -22,7 +22,7 @@
* THE SOFTWARE.
*/
abstract
class
Native
Page
ContainerEventHandler
{
abstract
class
NativeContainerEventHandler
{
bool
nativeContainerWillShow
(
String
name
,
Map
params
,
String
pageId
);
bool
nativeContainerDidShow
(
String
name
,
Map
params
,
String
pageId
);
bool
nativeContainerWillDisappear
(
String
name
,
Map
params
,
String
pageId
);
...
...
lib/router/router.dart
View file @
c16f3c12
...
...
@@ -25,25 +25,17 @@ import 'dart:async';
import
'package:flutter_boost/container/boost_container.dart'
;
import
'package:flutter_boost/flutter_boost.dart'
;
import
'package:flutter_boost/messaging/message_proxy.dart'
;
import
'package:flutter_boost/support/logger.dart'
;
import
'package:flutter_boost/messaging/boost_message_channel.dart'
;
class
Router
{
MessageProxy
_msgProxy
=
MessageProxyImp
();
void
setMessageProxy
(
MessageProxy
prx
)
{
if
(
prx
!=
null
)
{
_msgProxy
=
prx
;
}
}
Future
<
Map
<
dynamic
,
dynamic
>>
open
(
String
url
,{
Map
<
String
,
dynamic
>
urlParams
,
Map
<
String
,
dynamic
>
exts
}){
return
_msgProxy
.
open
(
url
,
urlParams:
urlParams
,
exts:
exts
);
return
BoostMessageChannel
.
openPage
(
url
,
urlParams
,
exts
);
}
Future
<
bool
>
close
(
String
id
,{
Map
<
String
,
dynamic
>
result
,
Map
<
String
,
dynamic
>
exts
}){
return
_msgProxy
.
clos
e
(
id
,
result:
result
,
exts:
exts
);
return
BoostMessageChannel
.
closePag
e
(
id
,
result:
result
,
exts:
exts
);
}
...
...
@@ -74,6 +66,6 @@ class Router {
Map
<
String
,
dynamic
>
exts
=
Map
();
exts
[
"animated"
]
=
animated
;
return
_msgProxy
.
clos
e
(
settings
.
uniqueId
,
result:
{}
,
exts:
exts
);
return
BoostMessageChannel
.
closePag
e
(
settings
.
uniqueId
,
result:
{}
,
exts:
exts
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment