Commit 185c1ff8 authored by Jidong Chen's avatar Jidong Chen

1,rename

2,refactory
parent 80bbf5c0
......@@ -24,27 +24,28 @@
#import <Foundation/Foundation.h>
#import <Flutter/Flutter.h>
#import "FLBPlatform.h"
#import "FLB2Platform.h"
#import "FlutterBoost.h"
#import "FLBFlutterProvider.h"
#import "FLB2FlutterProvider.h"
#import "FLBFlutterApplicationInterface.h"
NS_ASSUME_NONNULL_BEGIN
@interface FLBFlutterApplication : NSObject
@interface FLB2FlutterApplication : NSObject<FLBFlutterApplicationInterface>
@property (nonatomic,strong) id<FLBPlatform> platform;
@property (nonatomic,strong) id<FLB2Platform> platform;
- (id<FLBFlutterProvider>)flutterProvider;
- (id<FLB2FlutterProvider>)flutterProvider;
#pragma mark - Getters
+ (FLBFlutterApplication *)sharedApplication;
- (void)startFlutterWithPlatform:(id<FLBPlatform>)platform
+ (FLB2FlutterApplication *)sharedApplication;
- (void)startFlutterWithPlatform:(id<FLB2Platform>)platform
onStart:(void (^)(FlutterEngine * _Nonnull))callback;
- (FlutterViewController *)flutterViewController;
#pragma mark - Container Management
- (BOOL)contains:(FLBFlutterViewContainer *)vc;
- (void)addUniqueViewController:(FLBFlutterViewContainer *)vc;
- (void)removeViewController:(FLBFlutterViewContainer *)vc;
- (BOOL)contains:(FLB2FlutterViewContainer *)vc;
- (void)addUniqueViewController:(FLB2FlutterViewContainer *)vc;
- (void)removeViewController:(FLB2FlutterViewContainer *)vc;
- (BOOL)isTop:(NSString *)pageId;
#pragma mark - App Control
......
......@@ -22,26 +22,24 @@
* THE SOFTWARE.
*/
#import "FLBFlutterApplication.h"
#import "FLB2FlutterApplication.h"
#import "FlutterBoost.h"
#import "FLBFlutterViewContainerManager.h"
#import "FLBFlutterProviderFactory.h"
#import "FLBFlutterContainerManager.h"
@interface FLBFlutterApplication()
@property (nonatomic,strong) FLBFlutterViewContainerManager *manager;
@property (nonatomic,strong) id<FLBFlutterProvider> viewProvider;
@interface FLB2FlutterApplication()
@property (nonatomic,strong) FLBFlutterContainerManager *manager;
@property (nonatomic,strong) id<FLB2FlutterProvider> viewProvider;
@property (nonatomic,strong) NSMutableDictionary *pageBuilders;
@property (nonatomic,copy) FLBPageBuilder defaultPageBuilder;
@property (nonatomic,assign) BOOL isRunning;
@end
@implementation FLBFlutterApplication
@implementation FLB2FlutterApplication
+ (FLBFlutterApplication *)sharedApplication
+ (FLB2FlutterApplication *)sharedApplication
{
static FLBFlutterApplication *instance = nil;
static FLB2FlutterApplication *instance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
instance = [self new];
......@@ -59,13 +57,13 @@
return _viewProvider;
}
- (void)startFlutterWithPlatform:(id<FLBPlatform>)platform
- (void)startFlutterWithPlatform:(id<FLB2Platform>)platform
onStart:(void (^)(FlutterEngine * _Nonnull))callback
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
self.platform = platform;
self.viewProvider = [[FLBFlutterProviderFactory new] createViewProviderWithPlatform:platform];
self.viewProvider;
self.isRunning = YES;
if(callback) callback(self.viewProvider.engine);
});
......@@ -74,7 +72,7 @@
- (instancetype)init
{
if (self = [super init]) {
_manager = [FLBFlutterViewContainerManager new];
_manager = [FLBFlutterContainerManager new];
_pageBuilders = [NSMutableDictionary new];
}
return self;
......@@ -91,17 +89,17 @@
}
- (BOOL)contains:(FLBFlutterViewContainer *)vc
- (BOOL)contains:(FLB2FlutterViewContainer *)vc
{
return [_manager contains:vc];
}
- (void)addUniqueViewController:(FLBFlutterViewContainer *)vc
- (void)addUniqueViewController:(FLB2FlutterViewContainer *)vc
{
return [_manager addUnique:vc];
}
- (void)removeViewController:(FLBFlutterViewContainer *)vc
- (void)removeViewController:(FLB2FlutterViewContainer *)vc
{
return [_manager remove:vc];
}
......
......@@ -23,11 +23,11 @@
*/
#import <Foundation/Foundation.h>
#import "FLBFlutterProvider.h"
#import "FLB2FlutterProvider.h"
NS_ASSUME_NONNULL_BEGIN
@interface FLBFlutterEngine : NSObject<FLBFlutterProvider>
@interface FLB2FlutterEngine : NSObject<FLB2FlutterProvider>
@end
NS_ASSUME_NONNULL_END
......@@ -22,17 +22,17 @@
* THE SOFTWARE.
*/
#import "FLBFlutterEngine.h"
#import "FLB2FlutterEngine.h"
#import <Flutter/Flutter.h>
#import "FLBFlutterViewContainer.h"
#import "FLB2FlutterViewContainer.h"
@interface FLBFlutterEngine()
@interface FLB2FlutterEngine()
@property (nonatomic,strong) FlutterEngine *engine;
@property (nonatomic,strong) FLBFlutterViewContainer *dummy;
@property (nonatomic,strong) FLB2FlutterViewContainer *dummy;
@end
@implementation FLBFlutterEngine
@implementation FLB2FlutterEngine
- (instancetype)init
{
......@@ -42,7 +42,7 @@
if (self = [super init]) {
_engine = [[FlutterEngine alloc] initWithName:@"io.flutter" project:nil];
[_engine runWithEntrypoint:nil];
_dummy = [[FLBFlutterViewContainer alloc] initWithEngine:_engine
_dummy = [[FLB2FlutterViewContainer alloc] initWithEngine:_engine
nibName:nil
bundle:nil];
Class clazz = NSClassFromString(@"GeneratedPluginRegistrant");
......
......@@ -22,17 +22,15 @@
* THE SOFTWARE.
*/
#import <Foundation/Foundation.h>
#import "FLBFlutterProvider.h"
#import "FLBPlatform.h"
#import <UIKit/UIKit.h>
#import <Flutter/Flutter.h>
#import "FLBFlutterContainer.h"
NS_ASSUME_NONNULL_BEGIN
@interface FLBFlutterProviderFactory : NSObject
@interface FLB2FlutterViewContainer : FlutterViewController<FLBFlutterContainer>
- (id<FLBFlutterProvider>)createViewProvider;
- (id<FLBFlutterProvider>)createViewProviderWithPlatform:(id<FLBPlatform>)platform;
- (void)surfaceUpdated:(BOOL)appeared;
@end
......
......@@ -22,23 +22,23 @@
* THE SOFTWARE.
*/
#import "FLBFlutterViewContainer.h"
#import "FLBFlutterApplication.h"
#import "FLB2FlutterViewContainer.h"
#import "FLB2FlutterApplication.h"
#import "Service_NavigationService.h"
#import "FlutterBoostConfig.h"
#import "FLBFlutterViewContainerManager.h"
#import "FLBFlutterContainerManager.h"
#import "FlutterBoostPlugin_private.h"
#define FLUTTER_VIEW [FLBFlutterApplication sharedApplication].flutterViewController.view
#define FLUTTER_VC [FLBFlutterApplication sharedApplication].flutterViewController
#define FLUTTER_APP [FLBFlutterApplication sharedApplication]
#define FLUTTER_VIEW [FLB2FlutterApplication sharedApplication].flutterViewController.view
#define FLUTTER_VC [FLB2FlutterApplication sharedApplication].flutterViewController
#define FLUTTER_APP [FLB2FlutterApplication sharedApplication]
@interface FLBFlutterViewContainer ()
@interface FLB2FlutterViewContainer ()
@property (nonatomic,copy,readwrite) NSString *name;
@property (nonatomic,strong,readwrite) NSDictionary *params;
@property (nonatomic,assign) long long identifier;
@end
@implementation FLBFlutterViewContainer
@implementation FLB2FlutterViewContainer
- (instancetype)init
{
......@@ -119,7 +119,7 @@ static NSUInteger kInstanceCounter = 0;
pageName:_name params:_params
uniqueId:[self uniqueIDString]];
[[FLBFlutterApplication sharedApplication] removeViewController:self];
[[FLB2FlutterApplication sharedApplication] removeViewController:self];
[self.class instanceCounterDecrease];
}
......@@ -152,7 +152,7 @@ static NSUInteger kInstanceCounter = 0;
- (void)viewDidLayoutSubviews
{
[super viewDidLayoutSubviews];
[[FLBFlutterApplication sharedApplication] resume];
[[FLB2FlutterApplication sharedApplication] resume];
}
- (void)viewWillAppear:(BOOL)animated
......@@ -163,7 +163,7 @@ static NSUInteger kInstanceCounter = 0;
[self attatchFlutterEngine];
}
[[FLBFlutterApplication sharedApplication] resume];
[[FLB2FlutterApplication sharedApplication] resume];
[self surfaceUpdated:YES];
//For new page we should attach flutter view in view will appear
......@@ -174,10 +174,10 @@ static NSUInteger kInstanceCounter = 0;
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;
if(![FlutterBoostPlugin sharedInstance].fPagename){
[FlutterBoostPlugin sharedInstance].fPagename = _name;
[FlutterBoostPlugin sharedInstance].fPageId = self.uniqueIDString;
[FlutterBoostPlugin sharedInstance].fParams = _params;
}
[super viewWillAppear:animated];
......@@ -218,16 +218,6 @@ static NSUInteger kInstanceCounter = 0;
[super viewDidDisappear:animated];
}
#pragma mark - FLBViewControllerResultHandler
- (void)onRecievedResult:(NSDictionary *)resultData forKey:(NSString *)key
{
[Service_NavigationService onNativePageResult:^(NSNumber *finished) {}
uniqueId:self.uniqueIDString
key:key
resultData:resultData
params:@{}];
}
- (void)installSplashScreenViewIfNecessary {
//Do nothing.
}
......
......@@ -26,9 +26,8 @@
NS_ASSUME_NONNULL_BEGIN
@protocol FLBViewControllerResultHandler <NSObject>
@required
- (void)onRecievedResult:(NSDictionary *)resultData forKey:(NSString *)key;
@interface FLBFactory : NSObject
@end
NS_ASSUME_NONNULL_END
//
// FLBFactory.m
// flutter_boost
//
// Created by Jidong Chen on 2019/6/11.
//
#import "FLBFactory.h"
@implementation FLBFactory
@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 "FLBFlutterProviderFactory.h"
#import "FLBFlutterEngine.h"
#import "FLBPlatform.h"
@implementation FLBFlutterProviderFactory
- (id<FLBFlutterProvider>)createViewProviderWithPlatform:(id<FLBPlatform>)platform
{
return [FLBFlutterEngine new];
}
- (id<FLBFlutterProvider>)createViewProvider
{
return [FLBFlutterEngine new];
}
@end
......@@ -31,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN
#define RELEASE_1_0 1
@protocol FLBFlutterProvider <NSObject>
@protocol FLB2FlutterProvider <NSObject>
@required
- (FlutterEngine *)engine;
......
......@@ -26,7 +26,7 @@
NS_ASSUME_NONNULL_BEGIN
@protocol FLBPlatform <NSObject>
@protocol FLB2Platform <NSObject>
@optional
//Whether to enable accessibility support. Default value is Yes.
......
/*
* 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 "FLBFlutterApplicationInterface.h"
#import "FLB2FlutterProvider.h"
#import "FLB2Platform.h"
#import "FLBFlutterContainer.h"
NS_ASSUME_NONNULL_BEGIN
@protocol FLBAbstractFactory <NSObject>
- (id<FLBFlutterApplicationInterface>)createApplication:(id<FLB2Platform>)platform;
- (id<FLB2FlutterProvider>)createFlutterProvider:(id<FLB2Platform>)platform;
- (id<FLBFlutterContainer>)createFlutterContainer;
@end
NS_ASSUME_NONNULL_END
//
// FLBAbstractFactory.m
// flutter_boost
//
// Created by Jidong Chen on 2019/6/11.
//
#import "FLBAbstractFactory.h"
@implementation FLBAbstractFactory
@end
......@@ -23,13 +23,13 @@
*/
#import "FLBFlutterAppDelegate.h"
#import "FLBFlutterApplication.h"
#import "FLB2FlutterApplication.h"
@implementation FLBFlutterAppDelegate
// Returns the key window's rootViewController, if it's a FlutterViewController.
// Otherwise, returns nil.
- (FlutterViewController*)rootFlutterViewController {
return FLBFlutterApplication.sharedApplication.flutterViewController;
return FLB2FlutterApplication.sharedApplication.flutterViewController;
}
@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 <Foundation/Foundation.h>
#import <Flutter/Flutter.h>
#import "FLB2Platform.h"
#import "FlutterBoost.h"
#import "FLB2FlutterProvider.h"
#import "FLBFlutterContainer.h"
NS_ASSUME_NONNULL_BEGIN
@protocol FLBFlutterApplicationInterface <NSObject>
@property (nonatomic,strong) id<FLB2Platform> platform;
- (id<FLB2FlutterProvider>)flutterProvider;
- (void)startFlutterWithPlatform:(id<FLB2Platform>)platform
onStart:(void (^)(id<FlutterBinaryMessenger,
FlutterTextureRegistry,
FlutterPluginRegistry> engine))callback;
- (FlutterViewController *)flutterViewController;
#pragma mark - Container Management
- (BOOL)contains:(id<FLBFlutterContainer>)vc;
- (void)addUniqueViewController:(id<FLBFlutterContainer>)vc;
- (void)removeViewController:(id<FLBFlutterContainer>)vc;
- (BOOL)isTop:(NSString *)pageId;
#pragma mark - App Control
- (void)pause;
- (void)resume;
- (void)inactive;
- (BOOL)isRunning;
@end
NS_ASSUME_NONNULL_END
//
// FLBFlutterContainer.h
// flutter_boost
//
// Created by Jidong Chen on 2019/6/11.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol FLBFlutterContainer <NSObject>
- (NSString *)name;
- (NSDictionary *)params;
- (NSString *)uniqueIDString;
- (void)setName:(NSString *)name params:(NSDictionary *)params;
@end
NS_ASSUME_NONNULL_END
......@@ -23,16 +23,16 @@
*/
#import <Foundation/Foundation.h>
#import "FLBFlutterViewContainer.h"
#import "FLBFlutterContainer.h"
NS_ASSUME_NONNULL_BEGIN
@interface FLBFlutterViewContainerManager : NSObject
@interface FLBFlutterContainerManager : NSObject
- (NSString *)peak;
- (void)addUnique:(FLBFlutterViewContainer *)vc;
- (void)remove:(FLBFlutterViewContainer *)vc;
- (BOOL)contains:(FLBFlutterViewContainer *)vc;
- (void)addUnique:(id<FLBFlutterContainer>)vc;
- (void)remove:(id<FLBFlutterContainer>)vc;
- (BOOL)contains:(id<FLBFlutterContainer>)vc;
@end
......
......@@ -22,14 +22,14 @@
* THE SOFTWARE.
*/
#import "FLBFlutterViewContainerManager.h"
#import "FLBFlutterContainerManager.h"
@interface FLBFlutterViewContainerManager()
@interface FLBFlutterContainerManager()
@property (nonatomic,strong) NSMutableArray *idStk;
@property (nonatomic,strong) NSMutableDictionary *existedID;
@end
@implementation FLBFlutterViewContainerManager
@implementation FLBFlutterContainerManager
- (instancetype)init
{
......@@ -41,7 +41,7 @@
return self;
}
- (BOOL)contains:(FLBFlutterViewContainer *)vc
- (BOOL)contains:(id<FLBFlutterContainer>)vc
{
if (vc) {
return _existedID[vc.uniqueIDString]?YES:NO;
......@@ -50,7 +50,7 @@
return NO;
}
- (void)addUnique:(FLBFlutterViewContainer *)vc
- (void)addUnique:(id<FLBFlutterContainer>)vc
{
if (vc) {
if(!_existedID[vc.uniqueIDString]){
......@@ -60,7 +60,7 @@
}
}
- (void)remove:(FLBFlutterViewContainer *)vc
- (void)remove:(id<FLBFlutterContainer>)vc
{
if (vc) {
[_existedID removeObjectForKey:vc.uniqueIDString];
......
......@@ -26,8 +26,11 @@
#define FlutterBoost_h
#import "FlutterBoostPlugin.h"
#import "FLBFlutterViewContainer.h"
#import "FLBPlatform.h"
#import "FLBFlutterAppDelegate.h"
//#import "FLBFlutterViewContainer.h"
//#import "FLBPlatform.h"
#import "FLB2FlutterViewContainer.h"
#import "FLB2Platform.h"
#endif /* FlutterBoost_h */
/*
* 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 "FlutterBoostConfig.h"
@interface FlutterBoostConfig()
@property (nonatomic,assign) BOOL firstView;
@end
@implementation FlutterBoostConfig
+ (instancetype)sharedInstance
{
static FlutterBoostConfig *instance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
instance = [self new];
instance.firstView = YES;
});
return instance;
}
- (void)setFPageId:(NSString *)fPageId
{
_fPageId = fPageId;
_firstView = NO;
}
- (BOOL)firstView
{
return _firstView;
}
@end
......@@ -23,19 +23,16 @@
*/
#import <Flutter/Flutter.h>
#import "FLBFlutterViewContainer.h"
#import "FLBPlatform.h"
typedef FLBFlutterViewContainer * (^FLBPageBuilder)(NSString *name,NSDictionary *params);
#import "FLB2Platform.h"
@interface FlutterBoostPlugin : NSObject<FlutterPlugin>
#pragma mark - Initializer
- (void)setAccessibilityEnable:(BOOL)enable;
#pragma mark - Initializer
+ (instancetype)sharedInstance;
- (void)startFlutterWithPlatform:(id<FLBPlatform>)platform onStart:(void (^)(FlutterEngine *))callback;
- (void)startFlutterWithPlatform:(id<FLB2Platform>)platform
onStart:(void (^)(id<FlutterBinaryMessenger, FlutterTextureRegistry, FlutterPluginRegistry> engine))callback;
#pragma mark - Some properties.
- (BOOL)isRunning;
......
......@@ -23,12 +23,9 @@
*/
#import "FlutterBoostPlugin.h"
#import "FLBFlutterApplication.h"
#import "FLB2FlutterApplication.h"
#import "FLBResultMediator.h"
@interface FlutterBoostPlugin()
@property (nonatomic,strong) FLBResultMediator *resultMediator;
@end
#import "FlutterBoostPlugin_private.h"
@implementation FlutterBoostPlugin
......@@ -69,21 +66,24 @@
}
- (void)startFlutterWithPlatform:(id<FLBPlatform>)platform
onStart:(void (^)(FlutterEngine *))callback;
- (void)startFlutterWithPlatform:(id<FLB2Platform>)platform
onStart:(void (^)(id<FlutterBinaryMessenger,
FlutterTextureRegistry,
FlutterPluginRegistry> engine))callback;
{
[FLBFlutterApplication.sharedApplication startFlutterWithPlatform:platform
//TODO:
[FLB2FlutterApplication.sharedApplication startFlutterWithPlatform:platform
onStart:callback];
}
- (BOOL)isRunning
{
return [FLBFlutterApplication.sharedApplication isRunning];
return [FLB2FlutterApplication.sharedApplication isRunning];
}
- (FlutterViewController *)currentViewController
{
return [[FLBFlutterApplication sharedApplication] flutterViewController];
return [[FLB2FlutterApplication sharedApplication] flutterViewController];
}
- (void)openPage:(NSString *)name
......
......@@ -21,20 +21,20 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#import <Flutter/Flutter.h>
NS_ASSUME_NONNULL_BEGIN
#import "FLBFlutterApplicationInterface.h"
#import "FLBResultMediator.h"
@interface FlutterBoostPlugin()
- (id<FLBFlutterApplicationInterface>)application;
@property (nonatomic,strong) FLBResultMediator *resultMediator;
@interface FlutterBoostConfig : NSObject
#pragma mark - Store first open page
//There are some cases first page messages could be lost.
//So we store the first page info for later usage.
+ (instancetype)sharedInstance;
@property (nonatomic,copy) NSString *fPagename;
@property (nonatomic,copy) NSString *fPageId;
@property (nonatomic,copy) NSString *fPagename;
@property (nonatomic,strong) NSDictionary *fParams;
- (BOOL)firstView;
@end
NS_ASSUME_NONNULL_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 <UIKit/UIKit.h>
#import "FLBViewControllerResultHandler.h"
#import <Flutter/Flutter.h>
NS_ASSUME_NONNULL_BEGIN
@interface FLBFlutterViewContainer : FlutterViewController<FLBViewControllerResultHandler>
@property (nonatomic,copy,readonly) NSString *name;
@property (nonatomic,strong,readonly) NSDictionary *params;
@property (nonatomic,copy,readonly) NSString *uniqueIDString;
/*
You must call this one time to set flutter page name
and params.
*/
- (void)setName:(NSString *)name params:(NSDictionary *)params;
- (void)flutterViewDidAppear:(NSDictionary *)params;
- (void)surfaceUpdated:(BOOL)appeared;
@end
NS_ASSUME_NONNULL_END
......@@ -26,7 +26,7 @@
#import "ServiceGateway.h"
#import "NavigationService_closePage.h"
#import "FLBFlutterApplication.h"
#import "FLB2FlutterApplication.h"
@implementation NavigationService_closePage
......@@ -37,7 +37,7 @@
animated:(NSNumber *)animated
{
//Add your handler code here!
[[FLBFlutterApplication sharedApplication].platform closePage:uniqueId
[[FLB2FlutterApplication sharedApplication].platform closePage:uniqueId
animated:animated.boolValue
params:params
completion:^(BOOL finished) {
......
......@@ -26,7 +26,7 @@
#import "ServiceGateway.h"
#import "NavigationService_openPage.h"
#import "FLBFlutterApplication.h"
#import "FLB2FlutterApplication.h"
#import "FlutterBoost.h"
#import "Service_NavigationService.h"
......@@ -34,7 +34,7 @@
- (void)onCall:(void (^)(BOOL))result pageName:(NSString *)pageName params:(NSDictionary *)params animated:(NSNumber *)animated
{
[[FLBFlutterApplication sharedApplication].platform openPage:pageName
[[FLB2FlutterApplication sharedApplication].platform openPage:pageName
params:params
animated:animated.boolValue
completion:^(BOOL finished) {
......
......@@ -26,17 +26,16 @@
#import "ServiceGateway.h"
#import "NavigationService_pageOnStart.h"
#import "FLBFlutterApplication.h"
#import "FlutterBoostConfig.h"
#import "FlutterBoostPlugin_private.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;
pageInfo[@"name"] =[FlutterBoostPlugin sharedInstance].fPagename;
pageInfo[@"params"] = [FlutterBoostPlugin sharedInstance].fParams;
pageInfo[@"uniqueId"] = [FlutterBoostPlugin sharedInstance].fPageId;
if(result) result(pageInfo);
}
......
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