Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
flutter_boost_1.22.4
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李增强
flutter_boost_1.22.4
Commits
78c23ac1
Commit
78c23ac1
authored
Jun 11, 2019
by
Jidong Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
1ac64c20
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
804 additions
and
132 deletions
+804
-132
ios/Classes/1.0/FLBFactory.m
ios/Classes/1.0/FLBFactory.m
+5
-3
ios/Classes/1.0/FLBFlutterApplication.h
ios/Classes/1.0/FLBFlutterApplication.h
+2
-1
ios/Classes/1.0/FLBFlutterApplication.m
ios/Classes/1.0/FLBFlutterApplication.m
+32
-27
ios/Classes/1.0/FLBFlutterEngine.h
ios/Classes/1.0/FLBFlutterEngine.h
+6
-2
ios/Classes/1.0/FLBFlutterEngine.m
ios/Classes/1.0/FLBFlutterEngine.m
+22
-32
ios/Classes/1.0/FLBFlutterEngineOld.h
ios/Classes/1.0/FLBFlutterEngineOld.h
+37
-0
ios/Classes/1.0/FLBFlutterEngineOld.m
ios/Classes/1.0/FLBFlutterEngineOld.m
+108
-0
ios/Classes/1.0/FLBFlutterViewContainer.h
ios/Classes/1.0/FLBFlutterViewContainer.h
+2
-15
ios/Classes/1.0/FLBFlutterViewContainer.m
ios/Classes/1.0/FLBFlutterViewContainer.m
+211
-49
ios/Classes/1.0/FLBFlutterViewControllerAdaptor.h
ios/Classes/1.0/FLBFlutterViewControllerAdaptor.h
+39
-0
ios/Classes/1.0/FLBFlutterViewControllerAdaptor.m
ios/Classes/1.0/FLBFlutterViewControllerAdaptor.m
+105
-0
ios/Classes/1.0/FLBFlutterViewProvider.h
ios/Classes/1.0/FLBFlutterViewProvider.h
+45
-0
ios/Classes/1.0/FLBViewProviderFactory.h
ios/Classes/1.0/FLBViewProviderFactory.h
+39
-0
ios/Classes/1.0/FLBViewProviderFactory.m
ios/Classes/1.0/FLBViewProviderFactory.m
+51
-0
ios/Classes/1.0/FlutterBoostConfig.h
ios/Classes/1.0/FlutterBoostConfig.h
+40
-0
ios/Classes/1.0/FlutterBoostConfig.m
ios/Classes/1.0/FlutterBoostConfig.m
+59
-0
ios/Classes/Boost/FLBAbstractFactory.h
ios/Classes/Boost/FLBAbstractFactory.h
+1
-3
No files found.
ios/Classes/1.0/FLBFactory.m
View file @
78c23ac1
...
@@ -23,17 +23,19 @@
...
@@ -23,17 +23,19 @@
*/
*/
#import "FLBFactory.h"
#import "FLBFactory.h"
#import "FLBFlutterViewContainer.h"
#import "FLBFlutterApplication.h"
@implementation
FLBFactory
@implementation
FLBFactory
-
(
id
<
FLBFlutterApplicationInterface
>
)
createApplication
:(
id
<
FLB2Platform
>
)
platform
-
(
id
<
FLBFlutterApplicationInterface
>
)
createApplication
:(
id
<
FLB2Platform
>
)
platform
{
{
return
FLBFlutterApplication
.
new
;
}
}
-
(
id
<
FLB
2FlutterProvider
>
)
createFlutterProvider
:(
id
<
FLB2Platform
>
)
platform
-
(
id
<
FLB
FlutterContainer
>
)
createFlutterContainer
{
{
return
FLBFlutterViewContainer
.
new
;
}
}
@end
@end
ios/Classes/1.0/FLBFlutterApplication.h
View file @
78c23ac1
...
@@ -23,13 +23,14 @@
...
@@ -23,13 +23,14 @@
*/
*/
#import <Foundation/Foundation.h>
#import <Foundation/Foundation.h>
#import <Flutter/Flutter.h>
#import "FLBFlutterApplicationInterface.h"
#import "FLBFlutterApplicationInterface.h"
NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_BEGIN
@interface
FLBFlutterApplication
:
NSObject
<
FLBFlutterApplicationInterface
>
@interface
FLBFlutterApplication
:
NSObject
<
FLBFlutterApplicationInterface
>
@end
@end
NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
ios/Classes/1.0/FLBFlutterApplication.m
View file @
78c23ac1
...
@@ -23,47 +23,36 @@
...
@@ -23,47 +23,36 @@
*/
*/
#import "FLBFlutterApplication.h"
#import "FLBFlutterApplication.h"
#import "FlutterBoost.h"
#import "FLBFlutterContainerManager.h"
#import "FLBFlutterContainerManager.h"
#import "FLB
FlutterEngine
.h"
#import "FLB
ViewProviderFactory
.h"
@interface
FLBFlutterApplication
()
@interface
FLBFlutterApplication
()
@property
(
nonatomic
,
strong
)
FLBFlutterContainerManager
*
manager
;
@property
(
nonatomic
,
strong
)
FLBFlutterContainerManager
*
manager
;
@property
(
nonatomic
,
strong
)
id
<
FLB2FlutterProvider
>
viewProvider
;
@property
(
nonatomic
,
strong
)
id
<
FLBFlutterViewProvider
>
viewProvider
;
@property
(
nonatomic
,
assign
)
BOOL
isRendering
;
@property
(
nonatomic
,
assign
)
BOOL
isRunning
;
@property
(
nonatomic
,
assign
)
BOOL
isRunning
;
@end
@end
@implementation
FLBFlutterApplication
@implementation
FLBFlutterApplication
+
(
FLBFlutterApplication
*
)
sharedApplication
{
static
FLBFlutterApplication
*
instance
=
nil
;
static
dispatch_once_t
onceToken
;
dispatch_once
(
&
onceToken
,
^
{
instance
=
[
self
new
];
});
return
instance
;
}
-
(
BOOL
)
isRunning
-
(
BOOL
)
isRunning
{
{
return
_isRunning
;
return
_isRunning
;
}
}
-
(
id
)
flutterProvider
-
(
void
)
startFlutterWithPlatform
:(
id
<
FLB2Platform
>
)
platform
onStart
:(
void
(
^
)(
id
<
FlutterBinaryMessenger
,
FlutterTextureRegistry
,
FlutterPluginRegistry
>
_Nonnull
))
callback
{
return
_viewProvider
;
}
-
(
void
)
startFlutterWithPlatform
:(
id
<
FLB2Platform
>
)
platform
onStart
:(
void
(
^
)(
id
<
FlutterBinaryMessenger
,
FlutterTextureRegistry
,
FlutterPluginRegistry
>
_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
=
[[
FLBFlutterEngine
alloc
]
init
];
self
.
viewProvider
=
[[
FLBViewProviderFactory
new
]
createViewProviderWithPlatform
:
platform
];
_isRunning
=
YES
;
[
self
.
viewProvider
resume
];
if
(
callback
)
callback
(
self
.
viewProvider
.
engine
);
self
.
isRendering
=
YES
;
self
.
isRunning
=
YES
;
if
(
callback
)
callback
(
self
.
viewProvider
.
viewController
);
});
});
}
}
...
@@ -85,18 +74,23 @@
...
@@ -85,18 +74,23 @@
return
[
self
flutterViewController
].
view
;
return
[
self
flutterViewController
].
view
;
}
}
-
(
FlutterViewController
*
)
flutterViewController
{
return
self
.
viewProvider
.
viewController
;
}
-
(
BOOL
)
contains
:(
FLBFlutterViewContainer
*
)
vc
-
(
BOOL
)
contains
:(
id
<
FLBFlutterContainer
>
)
vc
{
{
return
[
_manager
contains
:
vc
];
return
[
_manager
contains
:
vc
];
}
}
-
(
void
)
addUniqueViewController
:(
FLBFlutterViewContainer
*
)
vc
-
(
void
)
addUniqueViewController
:(
id
<
FLBFlutterContainer
>
)
vc
{
{
return
[
_manager
addUnique
:
vc
];
return
[
_manager
addUnique
:
vc
];
}
}
-
(
void
)
removeViewController
:(
FLBFlutterViewContainer
*
)
vc
-
(
void
)
removeViewController
:(
id
<
FLBFlutterContainer
>
)
vc
{
{
return
[
_manager
remove
:
vc
];
return
[
_manager
remove
:
vc
];
}
}
...
@@ -109,12 +103,22 @@
...
@@ -109,12 +103,22 @@
-
(
void
)
pause
-
(
void
)
pause
{
{
if
(
!
_isRendering
)
return
;
[
self
.
viewProvider
pause
];
[
self
.
viewProvider
pause
];
_isRendering
=
NO
;
}
}
-
(
void
)
resume
-
(
void
)
resume
{
{
if
(
_isRendering
)
return
;
[
self
.
viewProvider
resume
];
[
self
.
viewProvider
resume
];
_isRendering
=
YES
;
}
}
-
(
void
)
inactive
-
(
void
)
inactive
...
@@ -122,9 +126,10 @@
...
@@ -122,9 +126,10 @@
[
self
.
viewProvider
inactive
];
[
self
.
viewProvider
inactive
];
}
}
-
(
FlutterViewController
*
)
flutterViewController
-
(
void
)
setAccessibilityEnable
:(
BOOL
)
enable
{
{
return
self
.
flutterProvider
.
engine
.
viewController
;
[
self
.
viewProvider
setAccessibilityEnable
:
enable
]
;
}
}
@end
@end
ios/Classes/1.0/FLBFlutterEngine.h
View file @
78c23ac1
...
@@ -23,11 +23,15 @@
...
@@ -23,11 +23,15 @@
*/
*/
#import <Foundation/Foundation.h>
#import <Foundation/Foundation.h>
#import "FLBFlutterProvider.h"
#import "FLBFlutter
View
Provider.h"
NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_BEGIN
@interface
FLBFlutterEngine
:
NSObject
<
FLBFlutterProvider
>
#if RELEASE_1_0
@interface
FLBFlutterEngine
:
NSObject
<
FLBFlutterViewProvider
>
@end
@end
#endif
NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
ios/Classes/1.0/FLBFlutterEngine.m
View file @
78c23ac1
...
@@ -24,12 +24,13 @@
...
@@ -24,12 +24,13 @@
#import "FLBFlutterEngine.h"
#import "FLBFlutterEngine.h"
#import <Flutter/Flutter.h>
#import <Flutter/Flutter.h>
#import "FLBFlutterViewCont
aine
r.h"
#import "FLBFlutterViewCont
rollerAdapto
r.h"
#if RELEASE_1_0
@interface
FLBFlutterEngine
()
@interface
FLBFlutterEngine
()
@property
(
nonatomic
,
strong
)
FLBFlutterViewControllerAdaptor
*
viewController
;
@property
(
nonatomic
,
strong
)
FlutterEngine
*
engine
;
@property
(
nonatomic
,
strong
)
FlutterEngine
*
engine
;
@property
(
nonatomic
,
strong
)
FLBFlutterViewContainer
*
dummy
;
@end
@end
@implementation
FLBFlutterEngine
@implementation
FLBFlutterEngine
...
@@ -42,14 +43,15 @@
...
@@ -42,14 +43,15 @@
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
_viewController
=
[[
FLBFlutterViewControllerAdaptor
alloc
]
initWithEngine
:
_engine
nibName:
nil
nibName:
nil
bundle:
nil
];
bundle:
nil
];
[
_viewController
view
];
Class
clazz
=
NSClassFromString
(
@"GeneratedPluginRegistrant"
);
Class
clazz
=
NSClassFromString
(
@"GeneratedPluginRegistrant"
);
if
(
clazz
)
{
if
(
clazz
)
{
if
([
clazz
respondsToSelector
:
NSSelectorFromString
(
@"registerWithRegistry:"
)])
{
if
([
clazz
respondsToSelector
:
NSSelectorFromString
(
@"registerWithRegistry:"
)])
{
[
clazz
performSelector
:
NSSelectorFromString
(
@"registerWithRegistry:"
)
[
clazz
performSelector
:
NSSelectorFromString
(
@"registerWithRegistry:"
)
withObject:
_
engine
];
withObject:
_
viewController
];
}
}
}
}
}
}
...
@@ -58,14 +60,23 @@
...
@@ -58,14 +60,23 @@
#pragma clang diagnostic pop
#pragma clang diagnostic pop
}
}
-
(
FlutterViewController
*
)
viewController
{
return
_viewController
;
}
-
(
void
)
pause
-
(
void
)
pause
{
{
[[
_engine
lifecycleChannel
]
sendMessage
:
@"AppLifecycleState.pause"
];
//TODO: [[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.paused"];
[
self
.
viewController
boost_viewWillDisappear
:
NO
];
[
self
.
viewController
boost_viewDidDisappear
:
NO
];
}
}
-
(
void
)
resume
-
(
void
)
resume
{
{
[[
_engine
lifecycleChannel
]
sendMessage
:
@"AppLifecycleState.resume"
];
//TODO: [[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.resumed"];
[
self
.
viewController
boost_viewWillAppear
:
NO
];
[
self
.
viewController
boost_viewDidAppear
:
NO
];
}
}
-
(
void
)
inactive
-
(
void
)
inactive
...
@@ -73,31 +84,10 @@
...
@@ -73,31 +84,10 @@
[[
_engine
lifecycleChannel
]
sendMessage
:
@"AppLifecycleState.inactive"
];
[[
_engine
lifecycleChannel
]
sendMessage
:
@"AppLifecycleState.inactive"
];
}
}
-
(
void
)
setAccessibilityEnable
:(
BOOL
)
enable
-
(
FlutterEngine
*
)
engine
{
return
_engine
;
}
-
(
void
)
atacheToViewController
:(
FlutterViewController
*
)
vc
{
if
(
_engine
.
viewController
!=
vc
){
_engine
.
viewController
=
vc
;
}
}
-
(
void
)
detach
{
if
(
_engine
.
viewController
!=
_dummy
){
_engine
.
viewController
=
_dummy
;
}
}
-
(
void
)
prepareEngineIfNeeded
{
{
[
self
detach
];
self
.
viewController
.
accessibilityEnable
=
enable
;
[
_dummy
surfaceUpdated
:
YES
];
}
}
@end
@end
#endif
ios/Classes/1.0/FLBFlutterEngineOld.h
0 → 100755
View file @
78c23ac1
/*
* 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 "FLBFlutterViewProvider.h"
#import "FLBPlatform.h"
NS_ASSUME_NONNULL_BEGIN
@interface
FLBFlutterEngineOld
:
NSObject
<
FLBFlutterViewProvider
>
-
(
instancetype
)
initWithPlatform
:(
id
<
FLBPlatform
>
)
platform
;
@end
NS_ASSUME_NONNULL_END
ios/Classes/1.0/FLBFlutterEngineOld.m
0 → 100755
View file @
78c23ac1
/*
* 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 "FLBFlutterEngineOld.h"
#import "FLBFlutterViewControllerAdaptor.h"
#import <objc/runtime.h>
@interface
FLBFlutterEngineOld
()
@property
(
nonatomic
,
strong
)
FLBFlutterViewControllerAdaptor
*
viewController
;
@end
@implementation
FLBFlutterEngineOld
-
(
instancetype
)
initWithPlatform
:(
id
<
FLBPlatform
>
)
platform
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
if
(
self
=
[
super
init
])
{
Class
class
=
[
FLBFlutterViewControllerAdaptor
class
];
SEL
originalSelector
=
@selector
(
onAccessibilityStatusChanged
:
);
SEL
swizzledSelector
=
@selector
(
fixed_onAccessibilityStatusChanged
:
);
Method
originalMethod
=
class_getInstanceMethod
(
class
,
originalSelector
);
Method
swizzledMethod
=
class_getInstanceMethod
(
class
,
swizzledSelector
);
method_exchangeImplementations
(
originalMethod
,
swizzledMethod
);
_viewController
=
[
FLBFlutterViewControllerAdaptor
new
];
if
([
platform
respondsToSelector
:
@selector
(
accessibilityEnable
)]){
_viewController
.
accessibilityEnable
=
[
platform
accessibilityEnable
];
}
else
{
_viewController
.
accessibilityEnable
=
YES
;
}
[
_viewController
view
];
Class
clazz
=
NSClassFromString
(
@"GeneratedPluginRegistrant"
);
if
(
clazz
)
{
if
([
clazz
respondsToSelector
:
NSSelectorFromString
(
@"registerWithRegistry:"
)])
{
[
clazz
performSelector
:
NSSelectorFromString
(
@"registerWithRegistry:"
)
withObject:
_viewController
];
}
}
}
return
self
;
#pragma clang diagnostic pop
}
-
(
FlutterViewController
*
)
viewController
{
return
_viewController
;
}
-
(
void
)
pause
{
[
self
.
viewController
boost_viewWillDisappear
:
NO
];
[
self
.
viewController
boost_viewDidDisappear
:
NO
];
}
-
(
void
)
resume
{
[
self
.
viewController
boost_viewWillAppear
:
NO
];
[
self
.
viewController
boost_viewDidAppear
:
NO
];
}
-
(
void
)
inactive
{
NSString
*
channel
=
@"flutter/lifecycle"
;
NSString
*
message
=
@"AppLifecycleState.inactive"
;
NSData
*
data
=
[[
FlutterStringCodec
sharedInstance
]
encode
:
message
];
[
self
.
viewController
sendOnChannel
:
channel
message
:
data
];
}
-
(
void
)
resumeFlutterOnly
{
NSString
*
channel
=
@"flutter/lifecycle"
;
NSString
*
message
=
@"AppLifecycleState.resumed"
;
NSData
*
data
=
[[
FlutterStringCodec
sharedInstance
]
encode
:
message
];
[
self
.
viewController
sendOnChannel
:
channel
message
:
data
];
}
-
(
void
)
setAccessibilityEnable
:(
BOOL
)
enable
{
self
.
viewController
.
accessibilityEnable
=
enable
;
}
@end
ios/Classes/1.0/FLBFlutterViewContainer.h
View file @
78c23ac1
...
@@ -23,25 +23,12 @@
...
@@ -23,25 +23,12 @@
*/
*/
#import <UIKit/UIKit.h>
#import <UIKit/UIKit.h>
#import <Flutter/Flutter.h>
#import "FLBFlutterContainer.h"
#import "FLBFlutterContainer.h"
NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_BEGIN
@interface
FLBFlutterViewContainer
:
FlutterViewController
@interface
FLBFlutterViewContainer
:
UIViewController
<
FLBFlutterContainer
>
@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
)
surfaceUpdated
:(
BOOL
)
appeared
;
@end
@end
...
...
ios/Classes/1.0/FLBFlutterViewContainer.m
View file @
78c23ac1
...
@@ -24,9 +24,11 @@
...
@@ -24,9 +24,11 @@
#import "FLBFlutterViewContainer.h"
#import "FLBFlutterViewContainer.h"
#import "FLBFlutterApplication.h"
#import "FLBFlutterApplication.h"
#import "FLBStackCache.h"
#import "FLBStackCacheObjectImg.h"
#import "FLBMemoryInspector.h"
#import "Service_NavigationService.h"
#import "Service_NavigationService.h"
#import "FlutterBoostConfig.h"
#import "FlutterBoostConfig.h"
#import "FLBFlutterViewContainerManager.h"
#define FLUTTER_VIEW [FLBFlutterApplication sharedApplication].flutterViewController.view
#define FLUTTER_VIEW [FLBFlutterApplication sharedApplication].flutterViewController.view
#define FLUTTER_VC [FLBFlutterApplication sharedApplication].flutterViewController
#define FLUTTER_VC [FLBFlutterApplication sharedApplication].flutterViewController
...
@@ -35,30 +37,13 @@
...
@@ -35,30 +37,13 @@
@interface
FLBFlutterViewContainer
()
@interface
FLBFlutterViewContainer
()
@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
,
strong
)
UIImageView
*
screenShotView
;
@property
(
nonatomic
,
assign
)
long
long
identifier
;
@property
(
nonatomic
,
assign
)
long
long
identifier
;
@property
(
nonatomic
,
assign
)
BOOL
interactiveGestureActive
;
@end
@end
@implementation
FLBFlutterViewContainer
@implementation
FLBFlutterViewContainer
-
(
instancetype
)
init
{
[
FLUTTER_APP
.
flutterProvider
prepareEngineIfNeeded
];
if
(
self
=
[
super
initWithEngine
:
FLUTTER_APP
.
flutterProvider
.
engine
nibName:
nil
bundle:
nil
]){
[
self
_setup
];
}
return
self
;
}
-
(
instancetype
)
initWithCoder
:(
NSCoder
*
)
aDecoder
{
if
(
self
=
[
super
initWithCoder
:
aDecoder
])
{
NSAssert
(
NO
,
@"unsupported init method!"
);
[
self
_setup
];
}
return
self
;
}
-
(
void
)
setName
:(
NSString
*
)
name
params
:(
NSDictionary
*
)
params
-
(
void
)
setName
:(
NSString
*
)
name
params
:(
NSDictionary
*
)
params
{
{
if
(
!
_name
&&
name
){
if
(
!
_name
&&
name
){
...
@@ -83,7 +68,7 @@ static NSUInteger kInstanceCounter = 0;
...
@@ -83,7 +68,7 @@ static NSUInteger kInstanceCounter = 0;
{
{
kInstanceCounter
++
;
kInstanceCounter
++
;
if
(
kInstanceCounter
==
1
){
if
(
kInstanceCounter
==
1
){
//
[FLUTTER_APP resume];
[
FLUTTER_APP
resume
];
}
}
}
}
...
@@ -91,7 +76,8 @@ static NSUInteger kInstanceCounter = 0;
...
@@ -91,7 +76,8 @@ static NSUInteger kInstanceCounter = 0;
{
{
kInstanceCounter
--
;
kInstanceCounter
--
;
if
([
self
.
class
instanceCounter
]
==
0
){
if
([
self
.
class
instanceCounter
]
==
0
){
// [[FLBFlutterApplication sharedApplication] pause];
[[
FLBStackCache
sharedInstance
]
clear
];
[[
FLBFlutterApplication
sharedApplication
]
pause
];
}
}
}
}
...
@@ -105,6 +91,43 @@ static NSUInteger kInstanceCounter = 0;
...
@@ -105,6 +91,43 @@ static NSUInteger kInstanceCounter = 0;
static
long
long
sCounter
=
0
;
static
long
long
sCounter
=
0
;
_identifier
=
sCounter
++
;
_identifier
=
sCounter
++
;
[
self
.
class
instanceCounterIncrease
];
[
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
-
(
void
)
dealloc
...
@@ -119,6 +142,7 @@ static NSUInteger kInstanceCounter = 0;
...
@@ -119,6 +142,7 @@ static NSUInteger kInstanceCounter = 0;
pageName:
_name
params
:
_params
pageName:
_name
params
:
_params
uniqueId:
[
self
uniqueIDString
]];
uniqueId:
[
self
uniqueIDString
]];
[[
FLBStackCache
sharedInstance
]
remove
:
self
.
uniqueIDString
];
[[
FLBFlutterApplication
sharedApplication
]
removeViewController
:
self
];
[[
FLBFlutterApplication
sharedApplication
]
removeViewController
:
self
];
[
self
.
class
instanceCounterDecrease
];
[
self
.
class
instanceCounterDecrease
];
...
@@ -126,26 +150,140 @@ static NSUInteger kInstanceCounter = 0;
...
@@ -126,26 +150,140 @@ static NSUInteger kInstanceCounter = 0;
-
(
void
)
viewDidLoad
{
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
[
super
viewDidLoad
];
self
.
view
.
backgroundColor
=
UIColor
.
whiteColor
;
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
#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
-
(
BOOL
)
isFlutterViewAttatched
{
{
return
FLUTTER_VIEW
.
superview
==
self
.
view
;
return
FLUTTER_VIEW
.
superview
==
self
.
view
;
}
}
-
(
void
)
attatchFlutter
Engine
-
(
void
)
attatchFlutter
View
{
{
[
FLUTTER_APP
.
flutterProvider
prepareEngineIfNeeded
];
if
([
self
isFlutterViewAttatched
])
return
;
[
FLUTTER_APP
.
flutterProvider
atacheToViewController
:
self
];
[
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
];
}
}
-
(
void
)
detatchFlutterEngine
-
(
BOOL
)
showSnapShotVew
{
{
[
FLUTTER_APP
.
flutterProvider
detach
];
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
];
}
#pragma mark - Life circle methods
#pragma mark - Life circle methods
...
@@ -157,18 +295,19 @@ static NSUInteger kInstanceCounter = 0;
...
@@ -157,18 +295,19 @@ static NSUInteger kInstanceCounter = 0;
-
(
void
)
viewWillAppear
:(
BOOL
)
animated
-
(
void
)
viewWillAppear
:(
BOOL
)
animated
{
{
if
([
FLUTTER_APP
contains
:
self
]){
if
(
self
.
navigationController
.
interactivePopGestureRecognizer
.
state
==
UIGestureRecognizerStateBegan
){
[
self
detatchFlutterEngine
];
self
.
interactiveGestureActive
=
true
;
}
else
{
[
self
attatchFlutterEngine
];
}
}
[[
FLBFlutterApplication
sharedApplication
]
resume
];
[
self
surfaceUpdated
:
YES
];
[
[
FLBFlutterApplication
sharedApplication
]
resume
];
//For new page we should attach flutter view in view will appear
//For new page we should attach flutter view in view will appear
//for better performance.
//for better performance.
if
(
!
[[
FLBFlutterApplication
sharedApplication
]
contains
:
self
]){
[
self
attatchFlutterView
];
}
[
self
showSnapShotVew
];
[
Service_NavigationService
willShowPageContainer
:
^
(
NSNumber
*
result
)
{}
[
Service_NavigationService
willShowPageContainer
:
^
(
NSNumber
*
result
)
{}
pageName:
_name
pageName:
_name
params:
_params
params:
_params
...
@@ -185,21 +324,49 @@ static NSUInteger kInstanceCounter = 0;
...
@@ -185,21 +324,49 @@ static NSUInteger kInstanceCounter = 0;
-
(
void
)
viewDidAppear
:(
BOOL
)
animated
-
(
void
)
viewDidAppear
:(
BOOL
)
animated
{
{
[
FLUTTER_APP
addUniqueViewController
:
self
];
[
[
FLBFlutterApplication
sharedApplication
]
resume
];
//Ensure flutter view is attached.
//Ensure flutter view is attached.
[
self
attatchFlutter
Engine
];
[
self
attatchFlutter
View
];
[
self
surfaceUpdated
:
YES
];
[
Service_NavigationService
didShowPageContainer
:
^
(
NSNumber
*
result
)
{}
[
Service_NavigationService
didShowPageContainer
:
^
(
NSNumber
*
result
)
{}
pageName:
_name
pageName:
_name
params:
_params
params:
_params
uniqueId:
self
.
uniqueIDString
];
uniqueId:
self
.
uniqueIDString
];
[[
FLBFlutterApplication
sharedApplication
]
addUniqueViewController
:
self
];
[
super
viewDidAppear
:
animated
];
[
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
-
(
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
)
{}
[
Service_NavigationService
willDisappearPageContainer
:
^
(
NSNumber
*
result
)
{}
pageName:
_name
pageName:
_name
params:
_params
params:
_params
...
@@ -210,12 +377,16 @@ static NSUInteger kInstanceCounter = 0;
...
@@ -210,12 +377,16 @@ static NSUInteger kInstanceCounter = 0;
-
(
void
)
viewDidDisappear
:(
BOOL
)
animated
-
(
void
)
viewDidDisappear
:(
BOOL
)
animated
{
{
[
self
detatchFlutterEngine
];
[
Service_NavigationService
didDisappearPageContainer
:
^
(
NSNumber
*
result
)
{}
[
Service_NavigationService
didDisappearPageContainer
:
^
(
NSNumber
*
result
)
{}
pageName:
_name
pageName:
_name
params:
_params
params:
_params
uniqueId:
self
.
uniqueIDString
];
uniqueId:
self
.
uniqueIDString
];
[
self
clearCurrentScreenShotImage
];
[
super
viewDidDisappear
:
animated
];
[
super
viewDidDisappear
:
animated
];
[
FLUTTER_APP
inactive
];
self
.
interactiveGestureActive
=
NO
;
}
}
#pragma mark - FLBViewControllerResultHandler
#pragma mark - FLBViewControllerResultHandler
...
@@ -228,14 +399,5 @@ static NSUInteger kInstanceCounter = 0;
...
@@ -228,14 +399,5 @@ static NSUInteger kInstanceCounter = 0;
params:
@{}];
params:
@{}];
}
}
-
(
void
)
installSplashScreenViewIfNecessary
{
//Do nothing.
}
-
(
BOOL
)
loadDefaultSplashScreenView
{
return
NO
;
}
@end
@end
ios/Classes/1.0/FLBFlutterViewControllerAdaptor.h
0 → 100755
View file @
78c23ac1
/*
* 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 <Flutter/Flutter.h>
NS_ASSUME_NONNULL_BEGIN
@interface
FLBFlutterViewControllerAdaptor
:
FlutterViewController
-
(
void
)
boost_viewWillAppear
:(
BOOL
)
animated
;
-
(
void
)
boost_viewDidAppear
:(
BOOL
)
animated
;
-
(
void
)
boost_viewWillDisappear
:(
BOOL
)
animated
;
-
(
void
)
boost_viewDidDisappear
:(
BOOL
)
animated
;
@property
(
nonatomic
,
assign
)
BOOL
accessibilityEnable
;
@end
NS_ASSUME_NONNULL_END
ios/Classes/1.0/FLBFlutterViewControllerAdaptor.m
0 → 100755
View file @
78c23ac1
/*
* 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 "FLBFlutterViewControllerAdaptor.h"
#import <objc/runtime.h>
@interface
FLBFlutterViewControllerAdaptor
()
@end
@implementation
FLBFlutterViewControllerAdaptor
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
self
.
view
.
backgroundColor
=
[
UIColor
whiteColor
];
// Do any additional setup after loading the view.
}
-
(
void
)
viewWillAppear
:(
BOOL
)
animated
{
//Left blank intentionally.
}
-
(
void
)
viewDidAppear
:(
BOOL
)
animated
{
//Left blank intentionally.
}
-
(
void
)
viewWillDisappear
:(
BOOL
)
animated
{
[[
UIApplication
sharedApplication
]
sendAction
:
@selector
(
resignFirstResponder
)
to
:
nil
from
:
nil
forEvent
:
nil
];
//Avoid super call intentionally.
}
-
(
void
)
viewDidDisappear
:(
BOOL
)
animated
{
//Avoid super call intentionally.
[[[
UIApplication
sharedApplication
]
keyWindow
]
endEditing
:
YES
];
}
-
(
void
)
boost_viewWillAppear
:(
BOOL
)
animated
{
[
super
viewWillAppear
:
animated
];
}
-
(
void
)
boost_viewDidAppear
:(
BOOL
)
animated
{
[
super
viewDidAppear
:
animated
];
}
-
(
void
)
boost_viewWillDisappear
:(
BOOL
)
animated
{
[
super
viewWillDisappear
:
animated
];
}
-
(
void
)
boost_viewDidDisappear
:(
BOOL
)
animated
{
[
super
viewDidDisappear
:
animated
];
}
-
(
UIEdgeInsets
)
paddingEdgeInsets
{
UIEdgeInsets
edgeInsets
=
UIEdgeInsetsZero
;
if
(
@available
(
iOS
11
,
*
))
{
edgeInsets
=
UIEdgeInsetsMake
(
0
,
self
.
view
.
safeAreaInsets
.
left
,
self
.
view
.
safeAreaInsets
.
bottom
,
self
.
view
.
safeAreaInsets
.
right
);
}
else
{
edgeInsets
=
UIEdgeInsetsZero
;
}
return
edgeInsets
;
}
-
(
void
)
installSplashScreenViewIfNecessary
{
//Override this to avoid unnecessary splash Screen.
}
-
(
void
)
fixed_onAccessibilityStatusChanged
:(
NSNotification
*
)
notification
{
if
(
self
.
accessibilityEnable
){
[
self
fixed_onAccessibilityStatusChanged
:
notification
];
}
}
@end
ios/Classes/1.0/FLBFlutterViewProvider.h
0 → 100755
View file @
78c23ac1
/*
* 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>
@class
FlutterViewController
;
NS_ASSUME_NONNULL_BEGIN
#define RELEASE_1_0 0
@protocol
FLBFlutterViewProvider
<
NSObject
>
@required
-
(
void
)
setAccessibilityEnable
:(
BOOL
)
enable
;
-
(
BOOL
)
accessibilityEnable
;
-
(
FlutterViewController
*
)
viewController
;
-
(
void
)
pause
;
-
(
void
)
resume
;
-
(
void
)
inactive
;
@end
NS_ASSUME_NONNULL_END
ios/Classes/1.0/FLBViewProviderFactory.h
0 → 100755
View file @
78c23ac1
/*
* 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 "FLBFlutterViewProvider.h"
#import "FLBPlatform.h"
NS_ASSUME_NONNULL_BEGIN
@interface
FLBViewProviderFactory
:
NSObject
-
(
id
<
FLBFlutterViewProvider
>
)
createViewProvider
;
-
(
id
<
FLBFlutterViewProvider
>
)
createViewProviderWithPlatform
:(
id
<
FLBPlatform
>
)
platform
;
@end
NS_ASSUME_NONNULL_END
ios/Classes/1.0/FLBViewProviderFactory.m
0 → 100755
View file @
78c23ac1
/*
* 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 "FLBViewProviderFactory.h"
#import "FLBFlutterEngine.h"
#import "FLBFlutterEngineOld.h"
#import "FLBPlatform.h"
@implementation
FLBViewProviderFactory
-
(
id
<
FLBFlutterViewProvider
>
)
createViewProviderWithPlatform
:(
id
<
FLBPlatform
>
)
platform
{
#if RELEASE_1_0
return
[
FLBFlutterEngine
new
];
#else
return
[[
FLBFlutterEngineOld
alloc
]
initWithPlatform
:
platform
];
#endif
}
-
(
id
<
FLBFlutterViewProvider
>
)
createViewProvider
{
#if RELEASE_1_0
return
[
FLBFlutterEngine
new
];
#else
return
[
FLBFlutterEngineOld
new
];
#endif
}
@end
ios/Classes/1.0/FlutterBoostConfig.h
0 → 100755
View file @
78c23ac1
/*
* 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.
*/
NS_ASSUME_NONNULL_BEGIN
@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
,
strong
)
NSDictionary
*
fParams
;
-
(
BOOL
)
firstView
;
@end
NS_ASSUME_NONNULL_END
ios/Classes/1.0/FlutterBoostConfig.m
0 → 100755
View file @
78c23ac1
/*
* 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
ios/Classes/Boost/FLBAbstractFactory.h
View file @
78c23ac1
...
@@ -33,10 +33,8 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -33,10 +33,8 @@ NS_ASSUME_NONNULL_BEGIN
@protocol
FLBAbstractFactory
<
NSObject
>
@protocol
FLBAbstractFactory
<
NSObject
>
@required
-
(
id
<
FLBFlutterApplicationInterface
>
)
createApplication
:(
id
<
FLB2Platform
>
)
platform
;
-
(
id
<
FLBFlutterApplicationInterface
>
)
createApplication
:(
id
<
FLB2Platform
>
)
platform
;
-
(
id
<
FLB2FlutterProvider
>
)
createFlutterProvider
:(
id
<
FLB2Platform
>
)
platform
;
-
(
id
<
FLBFlutterContainer
>
)
createFlutterContainer
;
-
(
id
<
FLBFlutterContainer
>
)
createFlutterContainer
;
@end
@end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment