Commit ee90a5f5 authored by 余玠's avatar 余玠

re-organize the file structure for version 1.5

parent 68357859
...@@ -9,3 +9,4 @@ build/ ...@@ -9,3 +9,4 @@ build/
pubspec.lock pubspec.lock
.flutter-plugins .flutter-plugins
flutter flutter
flutter_boost
PODS: PODS:
- Flutter (1.0.0) - Flutter (1.0.0)
- flutter_boost (0.0.1): - flutter_boost (0.0.2):
- Flutter
- xservice_kit
- xservice_kit (0.0.1):
- Flutter - Flutter
DEPENDENCIES: DEPENDENCIES:
- Flutter (from `.symlinks/flutter/ios`) - Flutter (from `.symlinks/flutter/ios`)
- flutter_boost (from `/Users/jidong/Documents/projects/Flutter/flutter_boost/ios`) - flutter_boost (from `/Users/yujie/Desktop/flutter/flutter_boost/ios`)
- xservice_kit (from `/Users/jidong/.pub-cache/hosted/pub.dartlang.org/xservice_kit-0.0.29/ios`)
EXTERNAL SOURCES: EXTERNAL SOURCES:
Flutter: Flutter:
:path: ".symlinks/flutter/ios" :path: ".symlinks/flutter/ios"
flutter_boost: flutter_boost:
:path: "/Users/jidong/Documents/projects/Flutter/flutter_boost/ios" :path: "/Users/yujie/Desktop/flutter/flutter_boost/ios"
xservice_kit:
:path: "/Users/jidong/.pub-cache/hosted/pub.dartlang.org/xservice_kit-0.0.29/ios"
SPEC CHECKSUMS: SPEC CHECKSUMS:
Flutter: 9d0fac939486c9aba2809b7982dfdbb47a7b0296 Flutter: 9d0fac939486c9aba2809b7982dfdbb47a7b0296
flutter_boost: 6a083f2f1b67f9b08724d6c4b280a099d1b40797 flutter_boost: 91c0b7bfc2f93528edc0658c8c539c595bd2d46f
xservice_kit: a86c64372b3e41e7d8e9b1a0b9139866680f525c
PODFILE CHECKSUM: 2a757a7bdc03b37a2814666652fdff1cf694243f PODFILE CHECKSUM: 2a757a7bdc03b37a2814666652fdff1cf694243f
......
...@@ -180,7 +180,6 @@ ...@@ -180,7 +180,6 @@
9705A1C41CF9048500538489 /* Embed Frameworks */, 9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
3FC74F80EA9D039C70D1F681 /* [CP] Embed Pods Frameworks */, 3FC74F80EA9D039C70D1F681 /* [CP] Embed Pods Frameworks */,
6CD183C8DCF5E8247072E2F6 /* [CP] Copy Pods Resources */,
); );
buildRules = ( buildRules = (
); );
...@@ -261,7 +260,7 @@ ...@@ -261,7 +260,7 @@
files = ( files = (
); );
inputPaths = ( inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", "${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework", "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
); );
name = "[CP] Embed Pods Frameworks"; name = "[CP] Embed Pods Frameworks";
...@@ -273,21 +272,6 @@ ...@@ -273,21 +272,6 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
6CD183C8DCF5E8247072E2F6 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
9740EEB61CF901F6004384FC /* Run Script */ = { 9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
...@@ -317,7 +301,7 @@ ...@@ -317,7 +301,7 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */
......
...@@ -11,8 +11,5 @@ ...@@ -11,8 +11,5 @@
@interface AppDelegate : FLBFlutterAppDelegate <UIApplicationDelegate> @interface AppDelegate : FLBFlutterAppDelegate <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end @end
/*
* 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 "FLBFlutterViewContainer.h"
#import "FLBFlutterApplication.h"
#import "FLBStackCache.h"
#import "FLBStackCacheObjectImg.h"
#import "FLBMemoryInspector.h"
#import "Service_NavigationService.h"
#import "FlutterBoostConfig.h"
#define FLUTTER_VIEW [FLBFlutterApplication sharedApplication].flutterViewController.view
#define FLUTTER_VC [FLBFlutterApplication sharedApplication].flutterViewController
#define FLUTTER_APP [FLBFlutterApplication sharedApplication]
@interface FLBFlutterViewContainer ()
@property (nonatomic,copy,readwrite) NSString *name;
@property (nonatomic,strong,readwrite) NSDictionary *params;
@property (nonatomic,strong) UIImageView *screenShotView;
@property (nonatomic,assign) long long identifier;
@property (nonatomic,assign) BOOL interactiveGestureActive;
@end
@implementation FLBFlutterViewContainer
- (void)setName:(NSString *)name params:(NSDictionary *)params
{
if(!_name && name){
_name = name;
_params = params;
[Service_NavigationService didInitPageContainer:^(NSNumber *r) {}
pageName:name
params:params
uniqueId:[self uniqueIDString]];
}
}
static NSUInteger kInstanceCounter = 0;
+ (NSUInteger)instanceCounter
{
return kInstanceCounter;
}
+ (void)instanceCounterIncrease
{
kInstanceCounter++;
if(kInstanceCounter == 1){
[FLUTTER_APP resume];
}
}
+ (void)instanceCounterDecrease
{
kInstanceCounter--;
if([self.class instanceCounter] == 0){
[[FLBStackCache sharedInstance] clear];
[[FLBFlutterApplication sharedApplication] pause];
}
}
- (NSString *)uniqueIDString
{
return @(_identifier).stringValue;
}
- (void)_setup
{
static long long sCounter = 0;
_identifier = sCounter++;
[self.class instanceCounterIncrease];
SEL sel = @selector(flutterViewDidShow:);
NSString *notiName = @"flutter_boost_container_showed";
[NSNotificationCenter.defaultCenter addObserver:self
selector:sel
name:notiName
object:nil];
}
- (instancetype)init
{
if(self = [super init]){
[self _setup];
}
return self;
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder{
if (self = [super initWithCoder: aDecoder]) {
[self _setup];
}
return self;
}
- (void)flutterViewDidAppear:(NSDictionary *)params
{
//Notify flutter view appeared.
}
- (void)flutterViewDidShow:(NSNotification *)notification
{
__weak typeof(self) weakSelf = self;
if([notification.object isEqual: self.uniqueIDString]){
dispatch_async(dispatch_get_main_queue(), ^{
[weakSelf showFlutterView];
});
}
}
- (void)dealloc
{
[self notifyWillDealloc];
[NSNotificationCenter.defaultCenter removeObserver:self];
}
- (void)notifyWillDealloc
{
[Service_NavigationService willDeallocPageContainer:^(NSNumber *r) {}
pageName:_name params:_params
uniqueId:[self uniqueIDString]];
[[FLBStackCache sharedInstance] remove:self.uniqueIDString];
[[FLBFlutterApplication sharedApplication] removeViewController:self];
[self.class instanceCounterDecrease];
}
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = UIColor.whiteColor;
self.screenShotView = [[UIImageView alloc] initWithFrame:self.view.bounds];
self.screenShotView.backgroundColor = [UIColor whiteColor];
[self.view addSubview:self.screenShotView];
}
#pragma mark - ScreenShots
- (UIImage *)takeScreenShot
{
CGFloat scale = 1;
switch ([FLBMemoryInspector.sharedInstance currentCondition]) {
case FLBMemoryConditionNormal:
scale = 2;
break;
case FLBMemoryConditionLowMemory:
scale = 1;
break;
case FLBMemoryConditionExtremelyLow:
scale = 0.75;
break;
case FLBMemoryConditionAboutToDie:
return [UIImage new];
break;
case FLBMemoryConditionUnknown:
if([[FLBMemoryInspector sharedInstance] smallMemoryDevice]){
scale = 1;
}else{
scale = 2;
}
break;
}
self.screenShotView.opaque = YES;
CGRect flutterBounds = self.view.bounds;
CGSize snapshotSize = CGSizeMake(flutterBounds.size.width ,
flutterBounds.size.height);
UIGraphicsBeginImageContextWithOptions(snapshotSize, NO, scale);
[self.view drawViewHierarchyInRect:flutterBounds
afterScreenUpdates:NO];
UIImage *snapImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return snapImage;
}
- (void)saveScreenShot
{
UIImage *snapImage = [self takeScreenShot];
if(snapImage){
FLBStackCacheObjectImg *cImg = [[FLBStackCacheObjectImg alloc] initWithImage:snapImage];
[[FLBStackCache sharedInstance] pushObject:cImg key:self.uniqueIDString];
}
}
- (void)clearCurrentScreenShotImage
{
self.screenShotView.image = nil;
}
- (UIImage *)getSavedScreenShot
{
FLBStackCacheObjectImg *cImg = [[FLBStackCache sharedInstance] objectForKey:self.uniqueIDString];
return [cImg image];
}
- (BOOL)isFlutterViewAttatched
{
return FLUTTER_VIEW.superview == self.view;
}
- (void)attatchFlutterView
{
if([self isFlutterViewAttatched]) return;
[FLUTTER_VC willMoveToParentViewController:nil];
[FLUTTER_VC removeFromParentViewController];
[FLUTTER_VC didMoveToParentViewController:nil];
[FLUTTER_VC willMoveToParentViewController:self];
FLUTTER_VIEW.frame = self.view.bounds;
if(!self.screenShotView.image){
[self.view addSubview: FLUTTER_VIEW];
}else{
[self.view insertSubview:FLUTTER_VIEW belowSubview:self.screenShotView];
}
[self addChildViewController:FLUTTER_VC];
[FLUTTER_VC didMoveToParentViewController:self];
}
- (BOOL)showSnapShotVew
{
self.screenShotView.image = [self getSavedScreenShot];
if([self isFlutterViewAttatched]){
NSUInteger fIdx = [self.view.subviews indexOfObject:FLUTTER_VIEW];
NSUInteger sIdx = [self.view.subviews indexOfObject:self.screenShotView];
if(fIdx > sIdx){
[self.view insertSubview:FLUTTER_VIEW
atIndex:0];
}
}else{
}
return self.screenShotView.image != nil;
}
- (void)showFlutterView
{
if(FLUTTER_VIEW.superview != self.view) return;
if([self isFlutterViewAttatched] ){
NSUInteger fIdx = [self.view.subviews indexOfObject:FLUTTER_VIEW];
NSUInteger sIdx = [self.view.subviews indexOfObject:self.screenShotView];
self.screenShotView.backgroundColor = UIColor.clearColor;
if(sIdx > fIdx){
[self.view insertSubview:self.screenShotView belowSubview:FLUTTER_VIEW];
[self flutterViewDidAppear:@{@"uid":self.uniqueIDString?:@""}];
}
}
[self clearCurrentScreenShotImage];
//Invalidate obsolete screenshot.
[FLBStackCache.sharedInstance invalidate:self.uniqueIDString];
[Service_NavigationService canPopPageName:_name params:_params
uniqueId:[self uniqueIDString]];
}
#pragma mark - Life circle methods
- (void)viewDidLayoutSubviews
{
[super viewDidLayoutSubviews];
[[FLBFlutterApplication sharedApplication] resume];
}
- (void)viewWillAppear:(BOOL)animated
{
if(self.navigationController.interactivePopGestureRecognizer.state == UIGestureRecognizerStateBegan){
self.interactiveGestureActive = true;
}
[[FLBFlutterApplication sharedApplication] resume];
//For new page we should attach flutter view in view will appear
//for better performance.
if(![[FLBFlutterApplication sharedApplication] contains:self]){
[self attatchFlutterView];
}
[self showSnapShotVew];
[Service_NavigationService willShowPageContainer:^(NSNumber *result) {}
pageName:_name
params:_params
uniqueId:self.uniqueIDString];
//Save some first time page info.
if(![FlutterBoostConfig sharedInstance].fPagename){
[FlutterBoostConfig sharedInstance].fPagename = _name;
[FlutterBoostConfig sharedInstance].fPageId = self.uniqueIDString;
[FlutterBoostConfig sharedInstance].fParams = _params;
}
[super viewWillAppear:animated];
}
- (void)viewDidAppear:(BOOL)animated
{
[[FLBFlutterApplication sharedApplication] resume];
//Ensure flutter view is attached.
[self attatchFlutterView];
[Service_NavigationService didShowPageContainer:^(NSNumber *result) {}
pageName:_name
params:_params
uniqueId:self.uniqueIDString];
[[FLBFlutterApplication sharedApplication] addUniqueViewController:self];
[super viewDidAppear:animated];
__weak typeof(self) weakSelf = self;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW,
(int64_t)(2 * NSEC_PER_SEC)),
dispatch_get_main_queue(),^{
if (weakSelf.isViewLoaded && weakSelf.view.window) {
// viewController is visible
[weakSelf showFlutterView];
}
});
self.interactiveGestureActive = NO;
}
- (void)viewWillDisappear:(BOOL)animated
{
//is top.
if([FLUTTER_APP isTop:self.uniqueIDString]
&& self.navigationController.interactivePopGestureRecognizer.state != UIGestureRecognizerStateBegan
&& !self.interactiveGestureActive){
[self saveScreenShot];
}
self.interactiveGestureActive = NO;
self.screenShotView.image = [self getSavedScreenShot];
if(self.screenShotView.image){
[self.view bringSubviewToFront:self.screenShotView];
}
[Service_NavigationService willDisappearPageContainer:^(NSNumber *result) {}
pageName:_name
params:_params
uniqueId:self.uniqueIDString];
[super viewWillDisappear:animated];
}
- (void)viewDidDisappear:(BOOL)animated
{
[Service_NavigationService didDisappearPageContainer:^(NSNumber *result) {}
pageName:_name
params:_params
uniqueId:self.uniqueIDString];
[self clearCurrentScreenShotImage];
[super viewDidDisappear:animated];
[FLUTTER_APP inactive];
self.interactiveGestureActive = NO;
}
#pragma mark - FLBViewControllerResultHandler
- (void)onRecievedResult:(NSDictionary *)resultData forKey:(NSString *)key
{
[Service_NavigationService onNativePageResult:^(NSNumber *finished) {}
uniqueId:self.uniqueIDString
key:key
resultData:resultData
params:@{}];
}
@end
...@@ -184,14 +184,5 @@ ...@@ -184,14 +184,5 @@
uniqueId:uniqueId]; uniqueId:uniqueId];
} }
+ (void)canPopPageName:(NSString *)pageName params:(NSDictionary *)params uniqueId:(NSString *)uniqueId{
NSMutableDictionary *tmp = [NSMutableDictionary dictionary];
if(pageName) tmp[@"pageName"] = pageName;
if(params) tmp[@"params"] = params;
if(uniqueId) tmp[@"uniqueId"] = uniqueId;
[self.service invoke:@"canPop" args:tmp result:^(id tTesult) {
}];
}
@end @end
/*
* 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 <xservice_kit/FlutterServiceCallHandler.h>
@interface NavigationService_closePage : FlutterServiceCallHandler
@end
/*
* 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 <xservice_kit/ServiceGateway.h>
#import "NavigationService_closePage.h"
#import "FLBFlutterApplication.h"
@implementation NavigationService_closePage
- (void)onCall:(void (^)(BOOL))result
uniqueId:(NSString *)uniqueId
pageName:(NSString *)pageName
params:(NSDictionary *)params
animated:(NSNumber *)animated
{
//Add your handler code here!
[[FLBFlutterApplication sharedApplication].platform closePage:uniqueId
animated:animated.boolValue
params:params
completion:^(BOOL finished) {
if(result) result(finished);
}];
}
#pragma mark - Do not edit these method.
- (void)__flutter_p_handler_closePage:(NSDictionary *)args result:(void (^)(BOOL))result {
[self onCall:result uniqueId:args[@"uniqueId"] pageName:args[@"pageName"] params:args[@"params"] animated:args[@"animated"]];
}
+ (void)load{
[[ServiceGateway sharedInstance] registerHandler:[NavigationService_closePage new]];
}
- (NSString *)returnType
{
return @"BOOL";
}
- (NSString *)service
{
return @"NavigationService";
}
@end
/*
* 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 <xservice_kit/FlutterServiceCallHandler.h>
NS_ASSUME_NONNULL_BEGIN
@interface NavigationService_flutterCanPop : FlutterServiceCallHandler
@end
NS_ASSUME_NONNULL_END
/*
* 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 "NavigationService_flutterCanPop.h"
#import <xservice_kit/ServiceGateway.h>
#import "FLBFlutterApplication.h"
#import "FlutterBoostConfig.h"
@implementation NavigationService_flutterCanPop
- (void)onCall:(void (^)(BOOL))result
canPop:(BOOL)canPop
{
//Add your handler code here!
if ([[FLBFlutterApplication sharedApplication].platform respondsToSelector:@selector(flutterCanPop:)]) {
[[FLBFlutterApplication sharedApplication].platform flutterCanPop:canPop];
}
}
#pragma mark - Do not edit these method.
- (void)__flutter_p_handler_flutterCanPop:(NSDictionary *)args result:(void (^)(BOOL))result {
[self onCall:result canPop:[args[@"canPop"] boolValue]];
}
+ (void)load{
[[ServiceGateway sharedInstance] registerHandler:[NavigationService_flutterCanPop new]];
}
- (NSString *)service
{
return @"NavigationService";
}
@end
/*
* 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 <xservice_kit/FlutterServiceCallHandler.h>
@interface NavigationService_onFlutterPageResult : FlutterServiceCallHandler
@end
/*
* 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 <xservice_kit/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
{
//Add your handler code here!
[FlutterBoostPlugin.sharedInstance onResultForKey:key
resultData:resultData
params:params];
}
#pragma mark - Do not edit these method.
- (void)__flutter_p_handler_onFlutterPageResult:(NSDictionary *)args result:(void (^)(BOOL))result {
[self onCall:result uniqueId:args[@"uniqueId"] key:args[@"key"] resultData:args[@"resultData"] params:args[@"params"]];
}
+ (void)load{
[[ServiceGateway sharedInstance] registerHandler:[NavigationService_onFlutterPageResult new]];
}
- (NSString *)returnType
{
return @"BOOL";
}
- (NSString *)service
{
return @"NavigationService";
}
@end
/*
* 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 <xservice_kit/FlutterServiceCallHandler.h>
@interface NavigationService_onShownContainerChanged : FlutterServiceCallHandler
@end
/*
* 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 <xservice_kit/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.
- (void)__flutter_p_handler_onShownContainerChanged:(NSDictionary *)args result:(void (^)(BOOL))result {
[self onCall:result newName:args[@"newName"] oldName:args[@"oldName"] params:args[@"params"]];
}
+ (void)load{
[[ServiceGateway sharedInstance] registerHandler:[NavigationService_onShownContainerChanged new]];
}
- (NSString *)returnType
{
return @"BOOL";
}
- (NSString *)service
{
return @"NavigationService";
}
@end
/*
* 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 <xservice_kit/FlutterServiceCallHandler.h>
@interface NavigationService_openPage : FlutterServiceCallHandler
@end
/*
* 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 <xservice_kit/ServiceGateway.h>
#import "NavigationService_openPage.h"
#import "FLBFlutterApplication.h"
#import "FlutterBoost.h"
#import "Service_NavigationService.h"
@implementation NavigationService_openPage
- (void)onCall:(void (^)(BOOL))result pageName:(NSString *)pageName params:(NSDictionary *)params animated:(NSNumber *)animated
{
[[FLBFlutterApplication sharedApplication].platform openPage:pageName
params:params
animated:animated.boolValue
completion:^(BOOL finished) {
if(result)result(YES);
}];
}
#pragma mark - Do not edit these method.
- (void)__flutter_p_handler_openPage:(NSDictionary *)args result:(void (^)(BOOL))result {
[self onCall:result pageName:args[@"pageName"] params:args[@"params"] animated:args[@"animated"]];
}
+ (void)load{
[[ServiceGateway sharedInstance] registerHandler:[NavigationService_openPage new]];
}
- (NSString *)returnType
{
return @"BOOL";
}
- (NSString *)service
{
return @"NavigationService";
}
@end
/*
* 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 <xservice_kit/FlutterServiceCallHandler.h>
@interface NavigationService_pageOnStart : FlutterServiceCallHandler
@end
/*
* 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 <xservice_kit/ServiceGateway.h>
#import "NavigationService_pageOnStart.h"
#import "FLBFlutterApplication.h"
#import "FlutterBoostConfig.h"
@implementation NavigationService_pageOnStart
- (void)onCall:(void (^)(NSDictionary *))result params:(NSDictionary *)params
{
NSMutableDictionary *pageInfo = [NSMutableDictionary new];
pageInfo[@"name"] =[FlutterBoostConfig sharedInstance].fPagename;
pageInfo[@"params"] = [FlutterBoostConfig sharedInstance].fParams;
pageInfo[@"uniqueId"] = [FlutterBoostConfig sharedInstance].fPageId;
if(result) result(pageInfo);
}
#pragma mark - Do not edit these method.
- (void)__flutter_p_handler_pageOnStart:(NSDictionary *)args result:(void (^)(NSDictionary *))result {
[self onCall:result params:args[@"params"]];
}
+ (void)load{
[[ServiceGateway sharedInstance] registerHandler:[NavigationService_pageOnStart new]];
}
- (NSString *)returnType
{
return @"NSDictionary *";
}
- (NSString *)service
{
return @"NavigationService";
}
@end
...@@ -71,7 +71,6 @@ ...@@ -71,7 +71,6 @@
} }
} }
static NSUInteger kInstanceCounter = 0; static NSUInteger kInstanceCounter = 0;
+ (NSUInteger)instanceCounter + (NSUInteger)instanceCounter
......
...@@ -22,7 +22,7 @@ A new Flutter plugin make flutter better to use! ...@@ -22,7 +22,7 @@ A new Flutter plugin make flutter better to use!
'Classes/Boost/FLBTypes.h', 'Classes/Boost/FLBTypes.h',
'Classes/Boost/FlutterBoost.h', 'Classes/Boost/FlutterBoost.h',
'Classes/Boost/BoostChannel.h', 'Classes/Boost/BoostChannel.h',
'Classes/1.5/FLBFlutterViewContainer.h' 'Classes/container/FLBFlutterViewContainer.h'
s.dependency 'Flutter' s.dependency 'Flutter'
s.libraries = 'c++' s.libraries = 'c++'
......
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:xservice_kit/ServiceCallHandler.dart';
import 'package:xservice_kit/ServiceGateway.dart';
import 'package:flutter_boost/flutter_boost.dart';
import 'package:flutter_boost/AIOService/NavigationService/service/NavigationService.dart';
class NavigationService_canPop extends ServiceCallHandler {
static void regsiter() {
ServiceGateway.sharedInstance()
.registerHandler(new NavigationService_canPop());
}
@override
String name() {
return "canPop";
}
@override
String service() {
return "NavigationService";
}
@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 {
NavigatorState navigator = FlutterBoost.containerManager.onstageContainer;
bool canPop = navigator.canPop();
NavigationService.flutterCanPop(canPop);
return true;
}
}
\ No newline at end of file
/*
* 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:xservice_kit/foundation_ext/foundation_ext.dart';
import 'package:xservice_kit/ServiceTemplate.dart';
import 'package:xservice_kit/ServiceGateway.dart';
class NavigationService {
static final ServiceTemplate _service =
new ServiceTemplate("NavigationService");
static void regsiter() {
ServiceGateway.sharedInstance().registerService(_service);
}
//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) {
Map<String,dynamic> properties = new Map<String,dynamic>();
properties["newName"]=newName;
properties["oldName"]=oldName;
properties["params"]=params;
return _service.methodChannel().invokeMethod('onShownContainerChanged',properties).then<bool>((value){
return BOOL(value);
});
}
static Future<bool> onFlutterPageResult(String uniqueId,String key,Map resultData,Map params) {
Map<String,dynamic> properties = new Map<String,dynamic>();
properties["uniqueId"]=uniqueId;
properties["key"]=key;
properties["resultData"]=resultData;
properties["params"]=params;
return _service.methodChannel().invokeMethod('onFlutterPageResult',properties).then<bool>((value){
return BOOL(value);
});
}
static Future<Map> pageOnStart(Map params) async {
Map<String,dynamic> properties = new Map<String,dynamic>();
properties["params"]=params;
try {
return await _service.methodChannel().invokeMethod('pageOnStart',properties).then<Map>((value){
return value as Map;
});
} catch (e) {
print('Page on start exception');
return Future<Map>.value({});
}
}
static Future<bool> openPage(String pageName,Map params,bool animated) {
Map<String,dynamic> properties = new Map<String,dynamic>();
properties["pageName"]=pageName;
properties["params"]=params;
properties["animated"]=animated;
return _service.methodChannel().invokeMethod('openPage',properties).then<bool>((value){
return BOOL(value);
});
}
static Future<bool> closePage(String uniqueId,String pageName,Map params,bool animated) {
Map<String,dynamic> properties = new Map<String,dynamic>();
properties["uniqueId"]=uniqueId;
properties["pageName"]=pageName;
properties["params"]=params;
properties["animated"]=animated;
return _service.methodChannel().invokeMethod('closePage',properties).then<bool>((value){
return BOOL(value);
});
}
/// 通知原生模块flutter是否可以pop
static void flutterCanPop(bool canPop) {
Map<String,dynamic> properties = new Map<String,dynamic>();
properties["canPop"]=canPop;
_service.methodChannel().invokeMethod('flutterCanPop',properties);
}
}
\ No newline at end of file
/*
* 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 'NavigationService.dart';
import '../handlers/NavigationService_onNativePageResult.dart';
import '../handlers/NavigationService_didShowPageContainer.dart';
import '../handlers/NavigationService_willShowPageContainer.dart';
import '../handlers/NavigationService_willDisappearPageContainer.dart';
import '../handlers/NavigationService_didDisappearPageContainer.dart';
import '../handlers/NavigationService_didInitPageContainer.dart';
import '../handlers/NavigationService_willDeallocPageContainer.dart';
import '../handlers/NavigationService_canPop.dart';
class NavigationServiceRegister{
static register(){
NavigationService.regsiter();
NavigationService_onNativePageResult.regsiter();
NavigationService_didShowPageContainer.regsiter();
NavigationService_willShowPageContainer.regsiter();
NavigationService_willDisappearPageContainer.regsiter();
NavigationService_didDisappearPageContainer.regsiter();
NavigationService_didInitPageContainer.regsiter();
NavigationService_willDeallocPageContainer.regsiter();
NavigationService_canPop.regsiter();
}
}
\ No newline at end of file
...@@ -25,7 +25,7 @@ import 'package:flutter/material.dart'; ...@@ -25,7 +25,7 @@ import 'package:flutter/material.dart';
import 'container_manager.dart'; import 'container_manager.dart';
import '../flutter_boost.dart'; import '../flutter_boost.dart';
import 'boost_page_route.dart'; import 'boost_page_route.dart';
import '../logger.dart'; import '../support/logger.dart';
enum ContainerLifeCycle { enum ContainerLifeCycle {
Init, Init,
......
...@@ -30,7 +30,7 @@ import 'package:flutter/services.dart'; ...@@ -30,7 +30,7 @@ import 'package:flutter/services.dart';
import '../channel/boost_channel.dart'; import '../channel/boost_channel.dart';
import 'boost_container.dart'; import 'boost_container.dart';
import '../flutter_boost.dart'; import '../flutter_boost.dart';
import '../logger.dart'; import '../support/logger.dart';
class ContainerCoordinator { class ContainerCoordinator {
static ContainerCoordinator get singleton => _instance; static ContainerCoordinator get singleton => _instance;
......
...@@ -23,10 +23,10 @@ ...@@ -23,10 +23,10 @@
*/ */
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart'; import 'package:flutter/scheduler.dart';
import 'package:flutter_boost/container/boost_container.dart'; import 'boost_container.dart';
import 'package:flutter_boost/container/container_coordinator.dart'; import 'container_coordinator.dart';
import 'package:flutter_boost/flutter_boost.dart'; import '../flutter_boost.dart';
import 'package:flutter_boost/support/logger.dart'; import '../support/logger.dart';
enum ContainerOperation { Push, Onstage, Pop, Remove } enum ContainerOperation { Push, Onstage, Pop, Remove }
...@@ -99,8 +99,6 @@ class ContainerManagerState extends State<BoostContainerManager> { ...@@ -99,8 +99,6 @@ class ContainerManagerState extends State<BoostContainerManager> {
assert(widget.initNavigator != null); assert(widget.initNavigator != null);
_onstage = BoostContainer.copy(widget.initNavigator); _onstage = BoostContainer.copy(widget.initNavigator);
FlutterBoost.containerManager.navigatorObserver.addBoostNavigatorObserver(NavigatorCanPopObserver());
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
setState(() {}); setState(() {});
}); });
......
import 'package:flutter_boost/container/boost_container.dart';
import 'package:flutter/material.dart';
import 'package:flutter_boost/AIOService/NavigationService/service/NavigationService.dart';
class NavigatorCanPopObserver extends BoostNavigatorObserver{
@override
void didPush(Route route, Route previousRoute) {
super.didPush(route, previousRoute);
_noticeCanPopToNative(route);
}
@override
void didPop(Route route, Route previousRoute) {
// TODO: implement didPop
super.didPop(route, previousRoute);
_noticeCanPopToNative(route);
}
_noticeCanPopToNative(Route route){
bool canPop = route.navigator.canPop();
NavigationService.flutterCanPop(canPop);
}
}
\ No newline at end of file
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