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

1,rename

2,refactory
parent 80bbf5c0
...@@ -24,27 +24,28 @@ ...@@ -24,27 +24,28 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <Flutter/Flutter.h> #import <Flutter/Flutter.h>
#import "FLBPlatform.h" #import "FLB2Platform.h"
#import "FlutterBoost.h" #import "FlutterBoost.h"
#import "FLBFlutterProvider.h" #import "FLB2FlutterProvider.h"
#import "FLBFlutterApplicationInterface.h"
NS_ASSUME_NONNULL_BEGIN 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 #pragma mark - Getters
+ (FLBFlutterApplication *)sharedApplication; + (FLB2FlutterApplication *)sharedApplication;
- (void)startFlutterWithPlatform:(id<FLBPlatform>)platform - (void)startFlutterWithPlatform:(id<FLB2Platform>)platform
onStart:(void (^)(FlutterEngine * _Nonnull))callback; onStart:(void (^)(FlutterEngine * _Nonnull))callback;
- (FlutterViewController *)flutterViewController; - (FlutterViewController *)flutterViewController;
#pragma mark - Container Management #pragma mark - Container Management
- (BOOL)contains:(FLBFlutterViewContainer *)vc; - (BOOL)contains:(FLB2FlutterViewContainer *)vc;
- (void)addUniqueViewController:(FLBFlutterViewContainer *)vc; - (void)addUniqueViewController:(FLB2FlutterViewContainer *)vc;
- (void)removeViewController:(FLBFlutterViewContainer *)vc; - (void)removeViewController:(FLB2FlutterViewContainer *)vc;
- (BOOL)isTop:(NSString *)pageId; - (BOOL)isTop:(NSString *)pageId;
#pragma mark - App Control #pragma mark - App Control
......
...@@ -22,26 +22,24 @@ ...@@ -22,26 +22,24 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#import "FLBFlutterApplication.h" #import "FLB2FlutterApplication.h"
#import "FlutterBoost.h" #import "FlutterBoost.h"
#import "FLBFlutterViewContainerManager.h" #import "FLBFlutterContainerManager.h"
#import "FLBFlutterProviderFactory.h"
@interface FLBFlutterApplication() @interface FLB2FlutterApplication()
@property (nonatomic,strong) FLBFlutterViewContainerManager *manager; @property (nonatomic,strong) FLBFlutterContainerManager *manager;
@property (nonatomic,strong) id<FLBFlutterProvider> viewProvider; @property (nonatomic,strong) id<FLB2FlutterProvider> viewProvider;
@property (nonatomic,strong) NSMutableDictionary *pageBuilders; @property (nonatomic,strong) NSMutableDictionary *pageBuilders;
@property (nonatomic,copy) FLBPageBuilder defaultPageBuilder;
@property (nonatomic,assign) BOOL isRunning; @property (nonatomic,assign) BOOL isRunning;
@end @end
@implementation FLBFlutterApplication @implementation FLB2FlutterApplication
+ (FLBFlutterApplication *)sharedApplication + (FLB2FlutterApplication *)sharedApplication
{ {
static FLBFlutterApplication *instance = nil; static FLB2FlutterApplication *instance = nil;
static dispatch_once_t onceToken; static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{ dispatch_once(&onceToken, ^{
instance = [self new]; instance = [self new];
...@@ -59,13 +57,13 @@ ...@@ -59,13 +57,13 @@
return _viewProvider; return _viewProvider;
} }
- (void)startFlutterWithPlatform:(id<FLBPlatform>)platform - (void)startFlutterWithPlatform:(id<FLB2Platform>)platform
onStart:(void (^)(FlutterEngine * _Nonnull))callback onStart:(void (^)(FlutterEngine * _Nonnull))callback
{ {
static dispatch_once_t onceToken; static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{ dispatch_once(&onceToken, ^{
self.platform = platform; self.platform = platform;
self.viewProvider = [[FLBFlutterProviderFactory new] createViewProviderWithPlatform:platform]; self.viewProvider;
self.isRunning = YES; self.isRunning = YES;
if(callback) callback(self.viewProvider.engine); if(callback) callback(self.viewProvider.engine);
}); });
...@@ -74,7 +72,7 @@ ...@@ -74,7 +72,7 @@
- (instancetype)init - (instancetype)init
{ {
if (self = [super init]) { if (self = [super init]) {
_manager = [FLBFlutterViewContainerManager new]; _manager = [FLBFlutterContainerManager new];
_pageBuilders = [NSMutableDictionary new]; _pageBuilders = [NSMutableDictionary new];
} }
return self; return self;
...@@ -91,17 +89,17 @@ ...@@ -91,17 +89,17 @@
} }
- (BOOL)contains:(FLBFlutterViewContainer *)vc - (BOOL)contains:(FLB2FlutterViewContainer *)vc
{ {
return [_manager contains:vc]; return [_manager contains:vc];
} }
- (void)addUniqueViewController:(FLBFlutterViewContainer *)vc - (void)addUniqueViewController:(FLB2FlutterViewContainer *)vc
{ {
return [_manager addUnique:vc]; return [_manager addUnique:vc];
} }
- (void)removeViewController:(FLBFlutterViewContainer *)vc - (void)removeViewController:(FLB2FlutterViewContainer *)vc
{ {
return [_manager remove:vc]; return [_manager remove:vc];
} }
......
...@@ -23,11 +23,11 @@ ...@@ -23,11 +23,11 @@
*/ */
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "FLBFlutterProvider.h" #import "FLB2FlutterProvider.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface FLBFlutterEngine : NSObject<FLBFlutterProvider> @interface FLB2FlutterEngine : NSObject<FLB2FlutterProvider>
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -22,17 +22,17 @@ ...@@ -22,17 +22,17 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#import "FLBFlutterEngine.h" #import "FLB2FlutterEngine.h"
#import <Flutter/Flutter.h> #import <Flutter/Flutter.h>
#import "FLBFlutterViewContainer.h" #import "FLB2FlutterViewContainer.h"
@interface FLBFlutterEngine() @interface FLB2FlutterEngine()
@property (nonatomic,strong) FlutterEngine *engine; @property (nonatomic,strong) FlutterEngine *engine;
@property (nonatomic,strong) FLBFlutterViewContainer *dummy; @property (nonatomic,strong) FLB2FlutterViewContainer *dummy;
@end @end
@implementation FLBFlutterEngine @implementation FLB2FlutterEngine
- (instancetype)init - (instancetype)init
{ {
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
if (self = [super init]) { if (self = [super init]) {
_engine = [[FlutterEngine alloc] initWithName:@"io.flutter" project:nil]; _engine = [[FlutterEngine alloc] initWithName:@"io.flutter" project:nil];
[_engine runWithEntrypoint:nil]; [_engine runWithEntrypoint:nil];
_dummy = [[FLBFlutterViewContainer alloc] initWithEngine:_engine _dummy = [[FLB2FlutterViewContainer alloc] initWithEngine:_engine
nibName:nil nibName:nil
bundle:nil]; bundle:nil];
Class clazz = NSClassFromString(@"GeneratedPluginRegistrant"); Class clazz = NSClassFromString(@"GeneratedPluginRegistrant");
......
...@@ -22,17 +22,15 @@ ...@@ -22,17 +22,15 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#import <Foundation/Foundation.h> #import <UIKit/UIKit.h>
#import <Flutter/Flutter.h>
#import "FLBFlutterProvider.h" #import "FLBFlutterContainer.h"
#import "FLBPlatform.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface FLBFlutterProviderFactory : NSObject @interface FLB2FlutterViewContainer : FlutterViewController<FLBFlutterContainer>
- (id<FLBFlutterProvider>)createViewProvider; - (void)surfaceUpdated:(BOOL)appeared;
- (id<FLBFlutterProvider>)createViewProviderWithPlatform:(id<FLBPlatform>)platform;
@end @end
......
...@@ -22,23 +22,23 @@ ...@@ -22,23 +22,23 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#import "FLBFlutterViewContainer.h" #import "FLB2FlutterViewContainer.h"
#import "FLBFlutterApplication.h" #import "FLB2FlutterApplication.h"
#import "Service_NavigationService.h" #import "Service_NavigationService.h"
#import "FlutterBoostConfig.h" #import "FLBFlutterContainerManager.h"
#import "FLBFlutterViewContainerManager.h" #import "FlutterBoostPlugin_private.h"
#define FLUTTER_VIEW [FLBFlutterApplication sharedApplication].flutterViewController.view #define FLUTTER_VIEW [FLB2FlutterApplication sharedApplication].flutterViewController.view
#define FLUTTER_VC [FLBFlutterApplication sharedApplication].flutterViewController #define FLUTTER_VC [FLB2FlutterApplication sharedApplication].flutterViewController
#define FLUTTER_APP [FLBFlutterApplication sharedApplication] #define FLUTTER_APP [FLB2FlutterApplication sharedApplication]
@interface FLBFlutterViewContainer () @interface FLB2FlutterViewContainer ()
@property (nonatomic,copy,readwrite) NSString *name; @property (nonatomic,copy,readwrite) NSString *name;
@property (nonatomic,strong,readwrite) NSDictionary *params; @property (nonatomic,strong,readwrite) NSDictionary *params;
@property (nonatomic,assign) long long identifier; @property (nonatomic,assign) long long identifier;
@end @end
@implementation FLBFlutterViewContainer @implementation FLB2FlutterViewContainer
- (instancetype)init - (instancetype)init
{ {
...@@ -119,7 +119,7 @@ static NSUInteger kInstanceCounter = 0; ...@@ -119,7 +119,7 @@ static NSUInteger kInstanceCounter = 0;
pageName:_name params:_params pageName:_name params:_params
uniqueId:[self uniqueIDString]]; uniqueId:[self uniqueIDString]];
[[FLBFlutterApplication sharedApplication] removeViewController:self]; [[FLB2FlutterApplication sharedApplication] removeViewController:self];
[self.class instanceCounterDecrease]; [self.class instanceCounterDecrease];
} }
...@@ -152,7 +152,7 @@ static NSUInteger kInstanceCounter = 0; ...@@ -152,7 +152,7 @@ static NSUInteger kInstanceCounter = 0;
- (void)viewDidLayoutSubviews - (void)viewDidLayoutSubviews
{ {
[super viewDidLayoutSubviews]; [super viewDidLayoutSubviews];
[[FLBFlutterApplication sharedApplication] resume]; [[FLB2FlutterApplication sharedApplication] resume];
} }
- (void)viewWillAppear:(BOOL)animated - (void)viewWillAppear:(BOOL)animated
...@@ -163,7 +163,7 @@ static NSUInteger kInstanceCounter = 0; ...@@ -163,7 +163,7 @@ static NSUInteger kInstanceCounter = 0;
[self attatchFlutterEngine]; [self attatchFlutterEngine];
} }
[[FLBFlutterApplication sharedApplication] resume]; [[FLB2FlutterApplication sharedApplication] resume];
[self surfaceUpdated:YES]; [self surfaceUpdated:YES];
//For new page we should attach flutter view in view will appear //For new page we should attach flutter view in view will appear
...@@ -174,10 +174,10 @@ static NSUInteger kInstanceCounter = 0; ...@@ -174,10 +174,10 @@ static NSUInteger kInstanceCounter = 0;
params:_params params:_params
uniqueId:self.uniqueIDString]; uniqueId:self.uniqueIDString];
//Save some first time page info. //Save some first time page info.
if(![FlutterBoostConfig sharedInstance].fPagename){ if(![FlutterBoostPlugin sharedInstance].fPagename){
[FlutterBoostConfig sharedInstance].fPagename = _name; [FlutterBoostPlugin sharedInstance].fPagename = _name;
[FlutterBoostConfig sharedInstance].fPageId = self.uniqueIDString; [FlutterBoostPlugin sharedInstance].fPageId = self.uniqueIDString;
[FlutterBoostConfig sharedInstance].fParams = _params; [FlutterBoostPlugin sharedInstance].fParams = _params;
} }
[super viewWillAppear:animated]; [super viewWillAppear:animated];
...@@ -218,16 +218,6 @@ static NSUInteger kInstanceCounter = 0; ...@@ -218,16 +218,6 @@ static NSUInteger kInstanceCounter = 0;
[super viewDidDisappear:animated]; [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 { - (void)installSplashScreenViewIfNecessary {
//Do nothing. //Do nothing.
} }
......
/* /*
* The MIT License (MIT) * The MIT License (MIT)
* *
* Copyright (c) 2019 Alibaba Group * Copyright (c) 2019 Alibaba Group
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights * in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is * copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions: * furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in * The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software. * all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
...@@ -26,9 +26,8 @@ ...@@ -26,9 +26,8 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@protocol FLBViewControllerResultHandler <NSObject> @interface FLBFactory : NSObject
@required
- (void)onRecievedResult:(NSDictionary *)resultData forKey:(NSString *)key;
@end @end
NS_ASSUME_NONNULL_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 ...@@ -31,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN
#define RELEASE_1_0 1 #define RELEASE_1_0 1
@protocol FLBFlutterProvider <NSObject> @protocol FLB2FlutterProvider <NSObject>
@required @required
- (FlutterEngine *)engine; - (FlutterEngine *)engine;
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@protocol FLBPlatform <NSObject> @protocol FLB2Platform <NSObject>
@optional @optional
//Whether to enable accessibility support. Default value is Yes. //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 @@ ...@@ -23,13 +23,13 @@
*/ */
#import "FLBFlutterAppDelegate.h" #import "FLBFlutterAppDelegate.h"
#import "FLBFlutterApplication.h" #import "FLB2FlutterApplication.h"
@implementation FLBFlutterAppDelegate @implementation FLBFlutterAppDelegate
// Returns the key window's rootViewController, if it's a FlutterViewController. // Returns the key window's rootViewController, if it's a FlutterViewController.
// Otherwise, returns nil. // Otherwise, returns nil.
- (FlutterViewController*)rootFlutterViewController { - (FlutterViewController*)rootFlutterViewController {
return FLBFlutterApplication.sharedApplication.flutterViewController; return FLB2FlutterApplication.sharedApplication.flutterViewController;
} }
@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 <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 @@ ...@@ -23,16 +23,16 @@
*/ */
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "FLBFlutterViewContainer.h" #import "FLBFlutterContainer.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface FLBFlutterViewContainerManager : NSObject @interface FLBFlutterContainerManager : NSObject
- (NSString *)peak; - (NSString *)peak;
- (void)addUnique:(FLBFlutterViewContainer *)vc; - (void)addUnique:(id<FLBFlutterContainer>)vc;
- (void)remove:(FLBFlutterViewContainer *)vc; - (void)remove:(id<FLBFlutterContainer>)vc;
- (BOOL)contains:(FLBFlutterViewContainer *)vc; - (BOOL)contains:(id<FLBFlutterContainer>)vc;
@end @end
......
...@@ -22,14 +22,14 @@ ...@@ -22,14 +22,14 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#import "FLBFlutterViewContainerManager.h" #import "FLBFlutterContainerManager.h"
@interface FLBFlutterViewContainerManager() @interface FLBFlutterContainerManager()
@property (nonatomic,strong) NSMutableArray *idStk; @property (nonatomic,strong) NSMutableArray *idStk;
@property (nonatomic,strong) NSMutableDictionary *existedID; @property (nonatomic,strong) NSMutableDictionary *existedID;
@end @end
@implementation FLBFlutterViewContainerManager @implementation FLBFlutterContainerManager
- (instancetype)init - (instancetype)init
{ {
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
return self; return self;
} }
- (BOOL)contains:(FLBFlutterViewContainer *)vc - (BOOL)contains:(id<FLBFlutterContainer>)vc
{ {
if (vc) { if (vc) {
return _existedID[vc.uniqueIDString]?YES:NO; return _existedID[vc.uniqueIDString]?YES:NO;
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
return NO; return NO;
} }
- (void)addUnique:(FLBFlutterViewContainer *)vc - (void)addUnique:(id<FLBFlutterContainer>)vc
{ {
if (vc) { if (vc) {
if(!_existedID[vc.uniqueIDString]){ if(!_existedID[vc.uniqueIDString]){
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
} }
} }
- (void)remove:(FLBFlutterViewContainer *)vc - (void)remove:(id<FLBFlutterContainer>)vc
{ {
if (vc) { if (vc) {
[_existedID removeObjectForKey:vc.uniqueIDString]; [_existedID removeObjectForKey:vc.uniqueIDString];
......
...@@ -26,8 +26,11 @@ ...@@ -26,8 +26,11 @@
#define FlutterBoost_h #define FlutterBoost_h
#import "FlutterBoostPlugin.h" #import "FlutterBoostPlugin.h"
#import "FLBFlutterViewContainer.h"
#import "FLBPlatform.h"
#import "FLBFlutterAppDelegate.h" #import "FLBFlutterAppDelegate.h"
//#import "FLBFlutterViewContainer.h"
//#import "FLBPlatform.h"
#import "FLB2FlutterViewContainer.h"
#import "FLB2Platform.h"
#endif /* FlutterBoost_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 @@ ...@@ -23,19 +23,16 @@
*/ */
#import <Flutter/Flutter.h> #import <Flutter/Flutter.h>
#import "FLBFlutterViewContainer.h" #import "FLB2Platform.h"
#import "FLBPlatform.h"
typedef FLBFlutterViewContainer * (^FLBPageBuilder)(NSString *name,NSDictionary *params);
@interface FlutterBoostPlugin : NSObject<FlutterPlugin> @interface FlutterBoostPlugin : NSObject<FlutterPlugin>
#pragma mark - Initializer
- (void)setAccessibilityEnable:(BOOL)enable;
#pragma mark - Initializer
+ (instancetype)sharedInstance; + (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. #pragma mark - Some properties.
- (BOOL)isRunning; - (BOOL)isRunning;
......
...@@ -23,12 +23,9 @@ ...@@ -23,12 +23,9 @@
*/ */
#import "FlutterBoostPlugin.h" #import "FlutterBoostPlugin.h"
#import "FLBFlutterApplication.h" #import "FLB2FlutterApplication.h"
#import "FLBResultMediator.h" #import "FLBResultMediator.h"
#import "FlutterBoostPlugin_private.h"
@interface FlutterBoostPlugin()
@property (nonatomic,strong) FLBResultMediator *resultMediator;
@end
@implementation FlutterBoostPlugin @implementation FlutterBoostPlugin
...@@ -69,21 +66,24 @@ ...@@ -69,21 +66,24 @@
} }
- (void)startFlutterWithPlatform:(id<FLBPlatform>)platform - (void)startFlutterWithPlatform:(id<FLB2Platform>)platform
onStart:(void (^)(FlutterEngine *))callback; onStart:(void (^)(id<FlutterBinaryMessenger,
FlutterTextureRegistry,
FlutterPluginRegistry> engine))callback;
{ {
[FLBFlutterApplication.sharedApplication startFlutterWithPlatform:platform //TODO:
[FLB2FlutterApplication.sharedApplication startFlutterWithPlatform:platform
onStart:callback]; onStart:callback];
} }
- (BOOL)isRunning - (BOOL)isRunning
{ {
return [FLBFlutterApplication.sharedApplication isRunning]; return [FLB2FlutterApplication.sharedApplication isRunning];
} }
- (FlutterViewController *)currentViewController - (FlutterViewController *)currentViewController
{ {
return [[FLBFlutterApplication sharedApplication] flutterViewController]; return [[FLB2FlutterApplication sharedApplication] flutterViewController];
} }
- (void)openPage:(NSString *)name - (void)openPage:(NSString *)name
......
/* /*
* The MIT License (MIT) * The MIT License (MIT)
* *
* Copyright (c) 2019 Alibaba Group * Copyright (c) 2019 Alibaba Group
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights * in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is * copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions: * furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in * The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software. * all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
...@@ -21,20 +21,20 @@ ...@@ -21,20 +21,20 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * 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 *fPageId;
@property (nonatomic,copy) NSString *fPagename;
@property (nonatomic,strong) NSDictionary *fParams; @property (nonatomic,strong) NSDictionary *fParams;
- (BOOL)firstView;
@end
@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 <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 @@ ...@@ -26,7 +26,7 @@
#import "ServiceGateway.h" #import "ServiceGateway.h"
#import "NavigationService_closePage.h" #import "NavigationService_closePage.h"
#import "FLBFlutterApplication.h" #import "FLB2FlutterApplication.h"
@implementation NavigationService_closePage @implementation NavigationService_closePage
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
animated:(NSNumber *)animated animated:(NSNumber *)animated
{ {
//Add your handler code here! //Add your handler code here!
[[FLBFlutterApplication sharedApplication].platform closePage:uniqueId [[FLB2FlutterApplication sharedApplication].platform closePage:uniqueId
animated:animated.boolValue animated:animated.boolValue
params:params params:params
completion:^(BOOL finished) { completion:^(BOOL finished) {
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#import "ServiceGateway.h" #import "ServiceGateway.h"
#import "NavigationService_openPage.h" #import "NavigationService_openPage.h"
#import "FLBFlutterApplication.h" #import "FLB2FlutterApplication.h"
#import "FlutterBoost.h" #import "FlutterBoost.h"
#import "Service_NavigationService.h" #import "Service_NavigationService.h"
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
- (void)onCall:(void (^)(BOOL))result pageName:(NSString *)pageName params:(NSDictionary *)params animated:(NSNumber *)animated - (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 params:params
animated:animated.boolValue animated:animated.boolValue
completion:^(BOOL finished) { completion:^(BOOL finished) {
......
...@@ -26,17 +26,16 @@ ...@@ -26,17 +26,16 @@
#import "ServiceGateway.h" #import "ServiceGateway.h"
#import "NavigationService_pageOnStart.h" #import "NavigationService_pageOnStart.h"
#import "FLBFlutterApplication.h" #import "FlutterBoostPlugin_private.h"
#import "FlutterBoostConfig.h"
@implementation NavigationService_pageOnStart @implementation NavigationService_pageOnStart
- (void)onCall:(void (^)(NSDictionary *))result params:(NSDictionary *)params - (void)onCall:(void (^)(NSDictionary *))result params:(NSDictionary *)params
{ {
NSMutableDictionary *pageInfo = [NSMutableDictionary new]; NSMutableDictionary *pageInfo = [NSMutableDictionary new];
pageInfo[@"name"] =[FlutterBoostConfig sharedInstance].fPagename; pageInfo[@"name"] =[FlutterBoostPlugin sharedInstance].fPagename;
pageInfo[@"params"] = [FlutterBoostConfig sharedInstance].fParams; pageInfo[@"params"] = [FlutterBoostPlugin sharedInstance].fParams;
pageInfo[@"uniqueId"] = [FlutterBoostConfig sharedInstance].fPageId; pageInfo[@"uniqueId"] = [FlutterBoostPlugin sharedInstance].fPageId;
if(result) result(pageInfo); 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