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
50e7acc7
Commit
50e7acc7
authored
Jun 28, 2019
by
Jidong Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactory to support co-existing of flutter_boost and flutter_boost2
parent
cffd24e3
Changes
41
Hide whitespace changes
Inline
Side-by-side
Showing
41 changed files
with
90 additions
and
1949 deletions
+90
-1949
ios/Classes/1.0/FLBFlutterApplication.h
ios/Classes/1.0/FLBFlutterApplication.h
+0
-36
ios/Classes/1.0/FLBFlutterApplication.m
ios/Classes/1.0/FLBFlutterApplication.m
+0
-180
ios/Classes/1.0/FLBFlutterEngineOld.h
ios/Classes/1.0/FLBFlutterEngineOld.h
+0
-37
ios/Classes/1.0/FLBFlutterEngineOld.m
ios/Classes/1.0/FLBFlutterEngineOld.m
+0
-99
ios/Classes/1.0/FLBFlutterProvider.h
ios/Classes/1.0/FLBFlutterProvider.h
+0
-44
ios/Classes/1.0/FLBFlutterViewContainer.h
ios/Classes/1.0/FLBFlutterViewContainer.h
+0
-35
ios/Classes/1.0/FLBFlutterViewContainer.m
ios/Classes/1.0/FLBFlutterViewContainer.m
+0
-394
ios/Classes/1.0/FLBFlutterViewControllerAdaptor.h
ios/Classes/1.0/FLBFlutterViewControllerAdaptor.h
+0
-38
ios/Classes/1.0/FLBFlutterViewControllerAdaptor.m
ios/Classes/1.0/FLBFlutterViewControllerAdaptor.m
+0
-99
ios/Classes/1.0/FLBFlutterViewProvider.h
ios/Classes/1.0/FLBFlutterViewProvider.h
+0
-43
ios/Classes/1.0/FLBViewProviderFactory.h
ios/Classes/1.0/FLBViewProviderFactory.h
+0
-39
ios/Classes/1.0/FLBViewProviderFactory.m
ios/Classes/1.0/FLBViewProviderFactory.m
+0
-42
ios/Classes/1.0/FlutterBoostConfig.h
ios/Classes/1.0/FlutterBoostConfig.h
+0
-40
ios/Classes/1.0/FlutterBoostConfig.m
ios/Classes/1.0/FlutterBoostConfig.m
+0
-59
ios/Classes/1.0/Support/Cache/FLBStackCache.h
ios/Classes/1.0/Support/Cache/FLBStackCache.h
+0
-72
ios/Classes/1.0/Support/Cache/FLBStackCache.m
ios/Classes/1.0/Support/Cache/FLBStackCache.m
+0
-210
ios/Classes/1.0/Support/Cache/FLBStackCacheObjectImg.h
ios/Classes/1.0/Support/Cache/FLBStackCacheObjectImg.h
+0
-37
ios/Classes/1.0/Support/Cache/FLBStackCacheObjectImg.m
ios/Classes/1.0/Support/Cache/FLBStackCacheObjectImg.m
+0
-116
ios/Classes/1.0/Support/Memory/FLBMemoryInspector.h
ios/Classes/1.0/Support/Memory/FLBMemoryInspector.h
+0
-47
ios/Classes/1.0/Support/Memory/FLBMemoryInspector.mm
ios/Classes/1.0/Support/Memory/FLBMemoryInspector.mm
+0
-157
ios/Classes/1.5/FLB2FlutterApplication.h
ios/Classes/1.5/FLB2FlutterApplication.h
+0
-1
ios/Classes/1.5/FLB2FlutterApplication.m
ios/Classes/1.5/FLB2FlutterApplication.m
+4
-7
ios/Classes/1.5/FLB2FlutterViewContainer.m
ios/Classes/1.5/FLB2FlutterViewContainer.m
+7
-7
ios/Classes/Boost/BoostChannel.h
ios/Classes/Boost/BoostChannel.h
+2
-5
ios/Classes/Boost/BoostChannel.m
ios/Classes/Boost/BoostChannel.m
+8
-15
ios/Classes/Boost/FLB2FlutterAppDelegate.h
ios/Classes/Boost/FLB2FlutterAppDelegate.h
+1
-1
ios/Classes/Boost/FLB2FlutterAppDelegate.m
ios/Classes/Boost/FLB2FlutterAppDelegate.m
+4
-4
ios/Classes/Boost/FLB2FlutterContainerManager.h
ios/Classes/Boost/FLB2FlutterContainerManager.h
+1
-1
ios/Classes/Boost/FLB2FlutterContainerManager.m
ios/Classes/Boost/FLB2FlutterContainerManager.m
+3
-3
ios/Classes/Boost/FLB2FlutterProvider.h
ios/Classes/Boost/FLB2FlutterProvider.h
+4
-2
ios/Classes/Boost/FLB2Platform.h
ios/Classes/Boost/FLB2Platform.h
+1
-5
ios/Classes/Boost/FLBFlutterApplicationInterface.h
ios/Classes/Boost/FLBFlutterApplicationInterface.h
+1
-1
ios/Classes/Boost/FLBFlutterContainer.h
ios/Classes/Boost/FLBFlutterContainer.h
+0
-2
ios/Classes/Boost/FLBPlatform.h
ios/Classes/Boost/FLBPlatform.h
+0
-41
ios/Classes/Boost/FLBTypes.h
ios/Classes/Boost/FLBTypes.h
+1
-1
ios/Classes/Boost/FlutterBoost2.h
ios/Classes/Boost/FlutterBoost2.h
+3
-5
ios/Classes/Boost/FlutterBoostPlugin2.h
ios/Classes/Boost/FlutterBoostPlugin2.h
+1
-1
ios/Classes/Boost/FlutterBoostPlugin2.m
ios/Classes/Boost/FlutterBoostPlugin2.m
+11
-17
ios/Classes/Boost/FlutterBoostPlugin2_private.h
ios/Classes/Boost/FlutterBoostPlugin2_private.h
+2
-2
ios/Classes/Messaging/BoostMessageChannel.mm
ios/Classes/Messaging/BoostMessageChannel.mm
+4
-4
ios/flutter_boost2.podspec
ios/flutter_boost2.podspec
+32
-0
No files found.
ios/Classes/1.0/FLBFlutterApplication.h
deleted
100755 → 0
View file @
cffd24e3
/*
* 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"
NS_ASSUME_NONNULL_BEGIN
@interface
FLBFlutterApplication
:
NSObject
<
FLBFlutterApplicationInterface
>
@property
(
nonatomic
,
strong
)
id
<
FLB2Platform
>
platform
;
@end
NS_ASSUME_NONNULL_END
ios/Classes/1.0/FLBFlutterApplication.m
deleted
100755 → 0
View file @
cffd24e3
/*
* 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 "FLBFlutterApplication.h"
#import "FlutterBoost.h"
#import "FLBFlutterContainerManager.h"
#import "FLBViewProviderFactory.h"
@interface
FLBFlutterApplication
()
@property
(
nonatomic
,
strong
)
FLBFlutterContainerManager
*
manager
;
@property
(
nonatomic
,
strong
)
id
<
FLBFlutterViewProvider
>
viewProvider
;
@property
(
nonatomic
,
assign
)
BOOL
isRendering
;
@property
(
nonatomic
,
assign
)
BOOL
isRunning
;
@end
@implementation
FLBFlutterApplication
-
(
BOOL
)
isRunning
{
return
_isRunning
;
}
-
(
void
)
startFlutterWithPlatform
:(
id
<
FLB2Platform
>
)
platform
onStart
:(
void
(
^
)(
id
<
FlutterBinaryMessenger
,
FlutterTextureRegistry
,
FlutterPluginRegistry
>
_Nonnull
))
callback
{
static
dispatch_once_t
onceToken
;
dispatch_once
(
&
onceToken
,
^
{
self
.
platform
=
platform
;
self
.
viewProvider
=
[[
FLBViewProviderFactory
new
]
createViewProviderWithPlatform
:
platform
];
[
self
.
viewProvider
resume
];
self
.
isRendering
=
YES
;
self
.
isRunning
=
YES
;
if
(
callback
)
callback
(
self
.
viewProvider
.
viewController
);
});
}
-
(
instancetype
)
init
{
if
(
self
=
[
super
init
])
{
_manager
=
[
FLBFlutterContainerManager
new
];
}
return
self
;
}
-
(
void
)
dealloc
{
[[
NSNotificationCenter
defaultCenter
]
removeObserver
:
self
];
}
-
(
UIView
*
)
flutterView
{
return
[
self
flutterViewController
].
view
;
}
-
(
FlutterViewController
*
)
flutterViewController
{
return
self
.
viewProvider
.
viewController
;
}
-
(
BOOL
)
contains
:(
id
<
FLBFlutterContainer
>
)
vc
{
return
[
_manager
contains
:
vc
];
}
-
(
void
)
addUniqueViewController
:(
id
<
FLBFlutterContainer
>
)
vc
{
return
[
_manager
addUnique
:
vc
];
}
-
(
void
)
removeViewController
:(
id
<
FLBFlutterContainer
>
)
vc
{
return
[
_manager
remove
:
vc
];
}
-
(
BOOL
)
isTop
:(
NSString
*
)
pageId
{
return
[
_manager
.
peak
isEqual
:
pageId
];
}
-
(
void
)
pause
{
if
(
!
_isRendering
)
return
;
[
self
.
viewProvider
pause
];
_isRendering
=
NO
;
}
-
(
void
)
resume
{
if
(
_isRendering
)
return
;
[
self
.
viewProvider
resume
];
_isRendering
=
YES
;
}
-
(
void
)
inactive
{
[
self
.
viewProvider
inactive
];
}
-
(
id
<
FLB2FlutterProvider
>
)
flutterProvider
{
return
(
id
)
_viewProvider
;
}
-
(
void
)
close
:(
NSString
*
)
uid
result
:(
NSDictionary
*
)
result
exts
:(
NSDictionary
*
)
exts
completion
:(
void
(
^
)(
BOOL
))
completion
{
BOOL
animated
=
YES
;
if
([
exts
[
@"animated"
]
boolValue
]){
animated
=
[
exts
[
@"animated"
]
boolValue
];
}
[
self
.
platform
closePage
:
uid
animated:
animated
params:
exts
[
@"params"
]
completion:
completion
];
}
-
(
void
)
open
:(
NSString
*
)
url
urlParams
:(
NSDictionary
*
)
urlParams
exts
:(
NSDictionary
*
)
exts
reult
:(
void
(
^
)(
NSDictionary
*
))
resultCallback
completion
:(
void
(
^
)(
BOOL
))
completion
{
BOOL
animated
=
YES
;
if
([
exts
[
@"animated"
]
boolValue
]){
animated
=
[
exts
[
@"animated"
]
boolValue
];
}
[
self
.
platform
openPage
:
url
params:
urlParams
animated:
animated
completion:
completion
];
}
-
(
void
)
didInitPageContainer
:(
NSString
*
)
url
params
:(
NSDictionary
*
)
urlParams
uniqueId
:(
NSString
*
)
uniqueId
{
}
-
(
void
)
willDeallocPageContainer
:(
NSString
*
)
url
params
:(
NSDictionary
*
)
params
uniqueId
:(
NSString
*
)
uniqueId
{
}
@end
ios/Classes/1.0/FLBFlutterEngineOld.h
deleted
100755 → 0
View file @
cffd24e3
/*
* 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
deleted
100755 → 0
View file @
cffd24e3
/*
* 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
];
[
_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
];
}
@end
ios/Classes/1.0/FLBFlutterProvider.h
deleted
100755 → 0
View file @
cffd24e3
/*
* 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
-
(
FlutterViewController
*
)
viewController
;
-
(
void
)
pause
;
-
(
void
)
resume
;
-
(
void
)
inactive
;
@end
NS_ASSUME_NONNULL_END
ios/Classes/1.0/FLBFlutterViewContainer.h
deleted
100755 → 0
View file @
cffd24e3
/*
* 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 "FLBFlutterContainer.h"
NS_ASSUME_NONNULL_BEGIN
@interface
FLBFlutterViewContainer
:
UIViewController
<
FLBFlutterContainer
>
@end
NS_ASSUME_NONNULL_END
ios/Classes/1.0/FLBFlutterViewContainer.m
deleted
100755 → 0
View file @
cffd24e3
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#import "FLBFlutterViewContainer.h"
#import "FLBFlutterApplication.h"
#import "FLBStackCache.h"
#import "FLBStackCacheObjectImg.h"
#import "FLBMemoryInspector.h"
#import "BoostMessageChannel.h"
#import "FlutterBoostConfig.h"
#import "FlutterBoostPlugin_private.h"
#define FLUTTER_APP [FlutterBoostPlugin sharedInstance].application
#define FLUTTER_VIEW FLUTTER_APP.flutterViewController.view
#define FLUTTER_VC FLUTTER_APP.flutterViewController
@interface
FLBFlutterViewContainer
()
@property
(
nonatomic
,
copy
,
readwrite
)
NSString
*
name
;
@property
(
nonatomic
,
strong
,
readwrite
)
NSDictionary
*
params
;
@property
(
nonatomic
,
strong
)
UIImageView
*
screenShotView
;
@property
(
nonatomic
,
assign
)
long
long
identifier
;
@property
(
nonatomic
,
assign
)
BOOL
interactiveGestureActive
;
@end
@implementation
FLBFlutterViewContainer
-
(
void
)
setName
:(
NSString
*
)
name
params
:(
NSDictionary
*
)
params
{
if
(
!
_name
&&
name
){
_name
=
name
;
_params
=
params
;
[
BoostMessageChannel
didInitPageContainer
:
^
(
NSNumber
*
r
)
{}
pageName:
name
params:
params
uniqueId:
[
self
uniqueIDString
]];
}
}
static
NSUInteger
kInstanceCounter
=
0
;
+
(
NSUInteger
)
instanceCounter
{
return
kInstanceCounter
;
}
+
(
void
)
instanceCounterIncrease
{
kInstanceCounter
++
;
if
(
kInstanceCounter
==
1
){
[
FLUTTER_APP
resume
];
}
}
+
(
void
)
instanceCounterDecrease
{
kInstanceCounter
--
;
if
([
self
.
class
instanceCounter
]
==
0
){
[[
FLBStackCache
sharedInstance
]
clear
];
[
FLUTTER_APP
pause
];
}
}
-
(
NSString
*
)
uniqueIDString
{
return
@
(
_identifier
).
stringValue
;
}
-
(
void
)
_setup
{
static
long
long
sCounter
=
0
;
_identifier
=
sCounter
++
;
[
self
.
class
instanceCounterIncrease
];
SEL
sel
=
@selector
(
flutterViewDidShow
:
);
NSString
*
notiName
=
@"flutter_boost_container_showed"
;
[
NSNotificationCenter
.
defaultCenter
addObserver
:
self
selector:
sel
name:
notiName
object:
nil
];
}
-
(
instancetype
)
init
{
if
(
self
=
[
super
init
]){
[
self
_setup
];
}
return
self
;
}
-
(
instancetype
)
initWithCoder
:(
NSCoder
*
)
aDecoder
{
if
(
self
=
[
super
initWithCoder
:
aDecoder
])
{
[
self
_setup
];
}
return
self
;
}
-
(
void
)
flutterViewDidAppear
:(
NSDictionary
*
)
params
{
//Notify flutter view appeared.
}
-
(
void
)
flutterViewDidShow
:(
NSNotification
*
)
notification
{
__weak
typeof
(
self
)
weakSelf
=
self
;
if
([
notification
.
object
isEqual
:
self
.
uniqueIDString
]){
dispatch_async
(
dispatch_get_main_queue
(),
^
{
[
weakSelf
showFlutterView
];
});
}
}
-
(
void
)
dealloc
{
[
self
notifyWillDealloc
];
[
NSNotificationCenter
.
defaultCenter
removeObserver
:
self
];
}
-
(
void
)
notifyWillDealloc
{
[
BoostMessageChannel
willDeallocPageContainer
:
^
(
NSNumber
*
r
)
{}
pageName:
_name
params
:
_params
uniqueId:
[
self
uniqueIDString
]];
[[
FLBStackCache
sharedInstance
]
remove
:
self
.
uniqueIDString
];
[
FLUTTER_APP
removeViewController
:
self
];
[
self
.
class
instanceCounterDecrease
];
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
self
.
view
.
backgroundColor
=
UIColor
.
whiteColor
;
self
.
screenShotView
=
[[
UIImageView
alloc
]
initWithFrame
:
self
.
view
.
bounds
];
self
.
screenShotView
.
backgroundColor
=
[
UIColor
whiteColor
];
[
self
.
view
addSubview
:
self
.
screenShotView
];
}
#pragma mark - ScreenShots
-
(
UIImage
*
)
takeScreenShot
{
CGFloat
scale
=
1
;
switch
([
FLBMemoryInspector
.
sharedInstance
currentCondition
])
{
case
FLBMemoryConditionNormal
:
scale
=
2
;
break
;
case
FLBMemoryConditionLowMemory
:
scale
=
1
;
break
;
case
FLBMemoryConditionExtremelyLow
:
scale
=
0
.
75
;
break
;
case
FLBMemoryConditionAboutToDie
:
return
[
UIImage
new
];
break
;
case
FLBMemoryConditionUnknown
:
if
([[
FLBMemoryInspector
sharedInstance
]
smallMemoryDevice
]){
scale
=
1
;
}
else
{
scale
=
2
;
}
break
;
}
self
.
screenShotView
.
opaque
=
YES
;
CGRect
flutterBounds
=
self
.
view
.
bounds
;
CGSize
snapshotSize
=
CGSizeMake
(
flutterBounds
.
size
.
width
,
flutterBounds
.
size
.
height
);
UIGraphicsBeginImageContextWithOptions
(
snapshotSize
,
NO
,
scale
);
[
self
.
view
drawViewHierarchyInRect
:
flutterBounds
afterScreenUpdates:
NO
];
UIImage
*
snapImage
=
UIGraphicsGetImageFromCurrentImageContext
();
UIGraphicsEndImageContext
();
return
snapImage
;
}
-
(
void
)
saveScreenShot
{
UIImage
*
snapImage
=
[
self
takeScreenShot
];
if
(
snapImage
){
FLBStackCacheObjectImg
*
cImg
=
[[
FLBStackCacheObjectImg
alloc
]
initWithImage
:
snapImage
];
[[
FLBStackCache
sharedInstance
]
pushObject
:
cImg
key
:
self
.
uniqueIDString
];
}
}
-
(
void
)
clearCurrentScreenShotImage
{
self
.
screenShotView
.
image
=
nil
;
}
-
(
UIImage
*
)
getSavedScreenShot
{
FLBStackCacheObjectImg
*
cImg
=
[[
FLBStackCache
sharedInstance
]
objectForKey
:
self
.
uniqueIDString
];
return
[
cImg
image
];
}
-
(
BOOL
)
isFlutterViewAttatched
{
return
FLUTTER_VIEW
.
superview
==
self
.
view
;
}
-
(
void
)
attatchFlutterView
{
if
([
self
isFlutterViewAttatched
])
return
;
[
FLUTTER_VC
willMoveToParentViewController
:
nil
];
[
FLUTTER_VC
removeFromParentViewController
];
[
FLUTTER_VC
didMoveToParentViewController
:
nil
];
[
FLUTTER_VC
willMoveToParentViewController
:
self
];
FLUTTER_VIEW
.
frame
=
self
.
view
.
bounds
;
if
(
!
self
.
screenShotView
.
image
){
[
self
.
view
addSubview
:
FLUTTER_VIEW
];
}
else
{
[
self
.
view
insertSubview
:
FLUTTER_VIEW
belowSubview
:
self
.
screenShotView
];
}
[
self
addChildViewController
:
FLUTTER_VC
];
[
FLUTTER_VC
didMoveToParentViewController
:
self
];
}
-
(
BOOL
)
showSnapShotVew
{
self
.
screenShotView
.
image
=
[
self
getSavedScreenShot
];
if
([
self
isFlutterViewAttatched
]){
NSUInteger
fIdx
=
[
self
.
view
.
subviews
indexOfObject
:
FLUTTER_VIEW
];
NSUInteger
sIdx
=
[
self
.
view
.
subviews
indexOfObject
:
self
.
screenShotView
];
if
(
fIdx
>
sIdx
){
[
self
.
view
insertSubview
:
FLUTTER_VIEW
atIndex:
0
];
}
}
else
{
}
return
self
.
screenShotView
.
image
!=
nil
;
}
-
(
void
)
showFlutterView
{
if
(
FLUTTER_VIEW
.
superview
!=
self
.
view
)
return
;
if
([
self
isFlutterViewAttatched
]
){
NSUInteger
fIdx
=
[
self
.
view
.
subviews
indexOfObject
:
FLUTTER_VIEW
];
NSUInteger
sIdx
=
[
self
.
view
.
subviews
indexOfObject
:
self
.
screenShotView
];
self
.
screenShotView
.
backgroundColor
=
UIColor
.
clearColor
;
if
(
sIdx
>
fIdx
){
[
self
.
view
insertSubview
:
self
.
screenShotView
belowSubview
:
FLUTTER_VIEW
];
[
self
flutterViewDidAppear
:@{
@"uid"
:
self
.
uniqueIDString
?:
@""
}];
}
}
[
self
clearCurrentScreenShotImage
];
//Invalidate obsolete screenshot.
[
FLBStackCache
.
sharedInstance
invalidate
:
self
.
uniqueIDString
];
}
#pragma mark - Life circle methods
-
(
void
)
viewDidLayoutSubviews
{
[
super
viewDidLayoutSubviews
];
[
FLUTTER_APP
resume
];
}
-
(
void
)
viewWillAppear
:(
BOOL
)
animated
{
if
(
self
.
navigationController
.
interactivePopGestureRecognizer
.
state
==
UIGestureRecognizerStateBegan
){
self
.
interactiveGestureActive
=
true
;
}
[
FLUTTER_APP
resume
];
//For new page we should attach flutter view in view will appear
//for better performance.
if
(
!
[
FLUTTER_APP
contains
:
self
]){
[
self
attatchFlutterView
];
}
[
self
showSnapShotVew
];
[
BoostMessageChannel
willShowPageContainer
:
^
(
NSNumber
*
result
)
{}
pageName:
_name
params:
_params
uniqueId:
self
.
uniqueIDString
];
//Save some first time page info.
if
(
!
[
FlutterBoostPlugin
sharedInstance
].
fPagename
){
[
FlutterBoostPlugin
sharedInstance
].
fPagename
=
_name
;
[
FlutterBoostPlugin
sharedInstance
].
fPageId
=
self
.
uniqueIDString
;
[
FlutterBoostPlugin
sharedInstance
].
fParams
=
_params
;
}
[
super
viewWillAppear
:
animated
];
}
-
(
void
)
viewDidAppear
:(
BOOL
)
animated
{
[
FLUTTER_APP
resume
];
//Ensure flutter view is attached.
[
self
attatchFlutterView
];
[
BoostMessageChannel
didShowPageContainer
:
^
(
NSNumber
*
result
)
{}
pageName:
_name
params:
_params
uniqueId:
self
.
uniqueIDString
];
[
FLUTTER_APP
addUniqueViewController
:
self
];
[
super
viewDidAppear
:
animated
];
__weak
typeof
(
self
)
weakSelf
=
self
;
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
2
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
if
(
weakSelf
.
isViewLoaded
&&
weakSelf
.
view
.
window
)
{
// viewController is visible
[
weakSelf
showFlutterView
];
}
});
self
.
interactiveGestureActive
=
NO
;
}
-
(
void
)
viewWillDisappear
:(
BOOL
)
animated
{
//is top.
if
([
FLUTTER_APP
isTop
:
self
.
uniqueIDString
]
&&
self
.
navigationController
.
interactivePopGestureRecognizer
.
state
!=
UIGestureRecognizerStateBegan
&&
!
self
.
interactiveGestureActive
){
[
self
saveScreenShot
];
}
self
.
interactiveGestureActive
=
NO
;
self
.
screenShotView
.
image
=
[
self
getSavedScreenShot
];
if
(
self
.
screenShotView
.
image
){
[
self
.
view
bringSubviewToFront
:
self
.
screenShotView
];
}
[
BoostMessageChannel
willDisappearPageContainer
:
^
(
NSNumber
*
result
)
{}
pageName:
_name
params:
_params
uniqueId:
self
.
uniqueIDString
];
[
super
viewWillDisappear
:
animated
];
}
-
(
void
)
viewDidDisappear
:(
BOOL
)
animated
{
[
BoostMessageChannel
didDisappearPageContainer
:
^
(
NSNumber
*
result
)
{}
pageName:
_name
params:
_params
uniqueId:
self
.
uniqueIDString
];
[
self
clearCurrentScreenShotImage
];
[
super
viewDidDisappear
:
animated
];
[
FLUTTER_APP
inactive
];
self
.
interactiveGestureActive
=
NO
;
}
@end
ios/Classes/1.0/FLBFlutterViewControllerAdaptor.h
deleted
100755 → 0
View file @
cffd24e3
/*
* 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
;
@end
NS_ASSUME_NONNULL_END
ios/Classes/1.0/FLBFlutterViewControllerAdaptor.m
deleted
100755 → 0
View file @
cffd24e3
/*
* 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.
}
@end
ios/Classes/1.0/FLBFlutterViewProvider.h
deleted
100755 → 0
View file @
cffd24e3
/*
* 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
-
(
FlutterViewController
*
)
viewController
;
-
(
void
)
pause
;
-
(
void
)
resume
;
-
(
void
)
inactive
;
@end
NS_ASSUME_NONNULL_END
ios/Classes/1.0/FLBViewProviderFactory.h
deleted
100755 → 0
View file @
cffd24e3
/*
* 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
deleted
100755 → 0
View file @
cffd24e3
/*
* 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 "FLBFlutterEngineOld.h"
#import "FLBPlatform.h"
@implementation
FLBViewProviderFactory
-
(
id
<
FLBFlutterViewProvider
>
)
createViewProviderWithPlatform
:(
id
<
FLBPlatform
>
)
platform
{
return
[[
FLBFlutterEngineOld
alloc
]
initWithPlatform
:
platform
];
}
-
(
id
<
FLBFlutterViewProvider
>
)
createViewProvider
{
return
[
FLBFlutterEngineOld
new
];
}
@end
ios/Classes/1.0/FlutterBoostConfig.h
deleted
100755 → 0
View file @
cffd24e3
/*
* 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
deleted
100755 → 0
View file @
cffd24e3
/*
* 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/1.0/Support/Cache/FLBStackCache.h
deleted
100755 → 0
View file @
cffd24e3
/*
* 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
FLBStackCache
;
@protocol
FLBStackCacheObject
<
NSObject
>
@required
@property
(
nonatomic
,
copy
)
NSString
*
key
;
-
(
BOOL
)
writeToFileWithKey
:(
NSString
*
)
key
queue
:(
dispatch_queue_t
)
queue
cache
:(
FLBStackCache
*
)
cache
completion
:(
void
(
^
)(
NSError
*
err
,
NSString
*
path
))
completion
;
+
(
BOOL
)
loadFromFileWithKey
:(
NSString
*
)
key
queue
:(
dispatch_queue_t
)
queue
cache
:(
FLBStackCache
*
)
cache
completion
:(
void
(
^
)(
NSError
*
err
,
id
<
FLBStackCacheObject
>
))
completion
;
-
(
BOOL
)
removeCachedFileWithKey
:(
NSString
*
)
key
queue
:(
dispatch_queue_t
)
queue
cache
:(
FLBStackCache
*
)
cache
completion
:(
void
(
^
)(
NSError
*
,
NSString
*
))
completion
;
@end
@interface
FLBStackCache
:
NSObject
+
(
instancetype
)
sharedInstance
;
/**
* Num of objects allowed in memory.
* Default value is set to 2.
*/
@property
(
nonatomic
,
assign
)
NSUInteger
inMemoryCount
;
#pragma mark - basic operations.
-
(
void
)
pushObject
:(
id
<
FLBStackCacheObject
>
)
obj
key
:(
NSString
*
)
key
;
-
(
id
<
FLBStackCacheObject
>
)
remove
:(
NSString
*
)
key
;
-
(
void
)
invalidate
:(
NSString
*
)
key
;
-
(
BOOL
)
empty
;
-
(
void
)
clear
;
-
(
id
<
FLBStackCacheObject
>
)
objectForKey
:(
NSString
*
)
key
;
#pragma mark - Disk thing.
-
(
NSString
*
)
cacheDir
;
@end
ios/Classes/1.0/Support/Cache/FLBStackCache.m
deleted
100755 → 0
View file @
cffd24e3
/*
* 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 "FLBStackCache.h"
@interface
FLBStackCache
()
@property
(
nonatomic
,
strong
)
NSMutableArray
*
keyStack
;
@property
(
nonatomic
,
strong
)
NSMutableDictionary
*
typesMap
;
@property
(
nonatomic
,
strong
)
NSMutableDictionary
*
inMemoryObjectsMap
;
@property
(
nonatomic
,
strong
)
NSMutableDictionary
*
loadinMap
;
@property
(
nonatomic
,
strong
)
dispatch_queue_t
queueIO
;
@end
@implementation
FLBStackCache
+
(
instancetype
)
sharedInstance
{
static
id
sInstance
=
nil
;
static
dispatch_once_t
onceToken
;
dispatch_once
(
&
onceToken
,
^
{
sInstance
=
[
self
.
class
new
];
});
return
sInstance
;
}
-
(
BOOL
)
empty
{
return
_keyStack
.
count
<=
0
;
}
-
(
void
)
clear
{
[
self
.
keyStack
removeAllObjects
];
[
self
.
inMemoryObjectsMap
removeAllObjects
];
[
self
.
typesMap
removeAllObjects
];
NSError
*
err
=
nil
;
[[
NSFileManager
defaultManager
]
removeItemAtPath
:
self
.
cacheDir
error
:
&
err
];
if
(
err
)
{
NSLog
(
@"fail to remove cache dir %@"
,
err
);
}
}
-
(
instancetype
)
init
{
if
(
self
=
[
super
init
])
{
_keyStack
=
[
NSMutableArray
new
];
_inMemoryObjectsMap
=
[
NSMutableDictionary
new
];
_loadinMap
=
[
NSMutableDictionary
new
];
_typesMap
=
[
NSMutableDictionary
new
];
_queueIO
=
dispatch_queue_create
(
"Stack cache working queue"
,
NULL
);
}
_inMemoryCount
=
2
;
return
self
;
}
-
(
void
)
pushObject
:(
id
<
FLBStackCacheObject
>
)
obj
key
:(
NSString
*
)
key
{
if
(
!
obj
||
key
.
length
<=
0
)
{
return
;
}
if
(
!
[
_keyStack
containsObject
:
key
]){
[
_keyStack
addObject
:
key
];
}
else
{
//return;
}
obj
.
key
=
key
;
_typesMap
[
key
]
=
obj
.
class
;
_inMemoryObjectsMap
[
key
]
=
obj
;
for
(
NSUInteger
i
=
_keyStack
.
count
-
_inMemoryObjectsMap
.
count
;
i
<
_keyStack
.
count
&&
_inMemoryObjectsMap
.
count
>
_inMemoryCount
;
i
++
){
NSString
*
keyToSave
=
_keyStack
[
i
];
if
(
_inMemoryObjectsMap
[
keyToSave
]){
id
<
FLBStackCacheObject
>
ob
=
_inMemoryObjectsMap
[
keyToSave
];
[
_inMemoryObjectsMap
removeObjectForKey
:
keyToSave
];
[
ob
writeToFileWithKey
:
keyToSave
queue:
_queueIO
cache:
self
completion:
^
(
NSError
*
err
,
NSString
*
path
)
{
if
(
err
)
{
NSLog
(
@"Caching object to file failed!"
);
}
}];
}
}
}
-
(
id
<
FLBStackCacheObject
>
)
objectForKey
:(
NSString
*
)
key
{
return
_inMemoryObjectsMap
[
key
];
}
-
(
id
<
FLBStackCacheObject
>
)
remove
:(
NSString
*
)
key
{
if
([
self
empty
])
return
nil
;
if
(
!
[
_keyStack
containsObject
:
key
])
return
nil
;
id
ob
=
_inMemoryObjectsMap
[
key
];
[
_keyStack
removeObject
:
key
];
[
_inMemoryObjectsMap
removeObjectForKey
:
key
];
[
_typesMap
removeObjectForKey
:
key
];
[
self
preloadIfNeeded
];
return
ob
;
}
-
(
void
)
invalidate
:(
NSString
*
)
key
{
if
(
!
key
||
[
self
empty
])
return
;
if
(
!
[
_keyStack
containsObject
:
key
])
return
;
id
<
FLBStackCacheObject
>
ob
=
_inMemoryObjectsMap
[
key
];
[
ob
removeCachedFileWithKey
:
key
queue:
_queueIO
cache:
self
completion:
^
(
NSError
*
err
,
NSString
*
k
)
{
}];
[
_inMemoryObjectsMap
removeObjectForKey
:
key
];
[
self
preloadIfNeeded
];
}
-
(
void
)
preloadIfNeeded
{
for
(
NSString
*
key
in
self
.
keyStack
.
reverseObjectEnumerator
){
Class
typeClass
=
_typesMap
[
key
];
id
cache
=
_inMemoryObjectsMap
[
key
];
if
(
typeClass
&&
!
cache
&&
[
typeClass
conformsToProtocol
:
@protocol
(
FLBStackCacheObject
)]){
_loadinMap
[
key
]
=
@
(
YES
);
[
typeClass
loadFromFileWithKey
:
key
queue:
_queueIO
cache:
self
completion:
^
(
NSError
*
err
,
id
<
FLBStackCacheObject
>
ob
){
[
self
.
loadinMap
removeObjectForKey
:
key
];
if
(
ob
&&
!
err
)
{
if
(
self
.
typesMap
[
key
]){
self
.
inMemoryObjectsMap
[
key
]
=
ob
;
}
}
else
{
NSLog
(
@"preload object from file failed!"
);
}
}];
}
if
(
_inMemoryObjectsMap
.
count
+
_loadinMap
.
count
>=
_inMemoryCount
){
break
;
}
}
}
-
(
NSString
*
)
cacheDir
{
static
NSString
*
cachePath
=
nil
;
if
(
!
cachePath
)
{
NSArray
*
paths
=
NSSearchPathForDirectoriesInDomains
(
NSCachesDirectory
,
NSUserDomainMask
,
YES
);
NSString
*
cacheDirectory
=
[
paths
objectAtIndex
:
0
];
cachePath
=
[
cacheDirectory
stringByAppendingPathComponent
:
@"FlutterScreenshots"
];
}
BOOL
dir
=
NO
;
if
(
!
[[
NSFileManager
defaultManager
]
fileExistsAtPath
:
cachePath
isDirectory
:
&
dir
]){
NSError
*
eror
=
nil
;
[[
NSFileManager
defaultManager
]
createDirectoryAtPath
:
cachePath
withIntermediateDirectories:
YES
attributes:
nil
error:
&
eror
];
if
(
eror
)
{
NSLog
(
@"%@"
,
eror
);
}
}
return
cachePath
;
}
@end
ios/Classes/1.0/Support/Cache/FLBStackCacheObjectImg.h
deleted
100755 → 0
View file @
cffd24e3
/*
* 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 "FLBStackCache.h"
@interface
FLBStackCacheObjectImg
:
NSObject
<
FLBStackCacheObject
>
@property
(
nonatomic
,
copy
)
NSString
*
key
;
-
(
instancetype
)
initWithImage
:(
UIImage
*
)
image
;
-
(
UIImage
*
)
image
;
@end
ios/Classes/1.0/Support/Cache/FLBStackCacheObjectImg.m
deleted
100755 → 0
View file @
cffd24e3
/*
* 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 "FLBStackCacheObjectImg.h"
@interface
FLBStackCacheObjectImg
()
@property
(
nonatomic
,
strong
)
UIImage
*
image
;
@end
@implementation
FLBStackCacheObjectImg
-
(
instancetype
)
initWithImage
:(
UIImage
*
)
image
{
if
(
self
=
[
super
init
])
{
_image
=
image
;
}
return
self
;
}
+
(
BOOL
)
loadFromFileWithKey
:(
NSString
*
)
key
queue
:(
dispatch_queue_t
)
queue
cache
:(
FLBStackCache
*
)
cache
completion
:(
void
(
^
)(
NSError
*
,
id
<
FLBStackCacheObject
>
))
completion
{
dispatch_async
(
queue
,
^
{
UIImage
*
image
=
[[
UIImage
alloc
]
initWithContentsOfFile
:[
self
filePathByKey
:
key
dirPath
:
cache
.
cacheDir
]];
if
(
completion
)
{
if
(
image
)
{
FLBStackCacheObjectImg
*
ob
=
[[
FLBStackCacheObjectImg
alloc
]
initWithImage
:
image
];
ob
.
key
=
key
;
completion
(
nil
,
ob
);
}
else
{
completion
([
NSError
new
],
nil
);
}
}
});
return
YES
;
}
+
(
NSString
*
)
filePathByKey
:(
NSString
*
)
key
dirPath
:(
NSString
*
)
cacheDir
{
key
=
[
key
stringByReplacingOccurrencesOfString
:
@"/"
withString
:
@""
];
key
=
[
key
stringByReplacingOccurrencesOfString
:
@":"
withString
:
@""
];
NSString
*
path
=
[
cacheDir
stringByAppendingPathComponent
:
key
];
return
path
;
}
-
(
BOOL
)
writeToFileWithKey
:(
NSString
*
)
key
queue
:(
dispatch_queue_t
)
queue
cache
:(
FLBStackCache
*
)
cache
completion
:(
void
(
^
)(
NSError
*
,
NSString
*
))
completion
{
if
(
!
_image
){
return
NO
;
}
dispatch_async
(
queue
,
^
{
NSData
*
imgData
=
UIImagePNGRepresentation
(
self
.
image
);
NSString
*
filePath
=
[
FLBStackCacheObjectImg
filePathByKey
:
key
dirPath
:
cache
.
cacheDir
];
[
imgData
writeToFile
:
filePath
atomically
:
YES
];
if
(
completion
)
{
completion
(
nil
,
key
);
}
});
return
YES
;
}
-
(
BOOL
)
removeCachedFileWithKey
:(
NSString
*
)
key
queue
:(
dispatch_queue_t
)
queue
cache
:(
FLBStackCache
*
)
cache
completion
:(
void
(
^
)(
NSError
*
,
NSString
*
))
completion
{
if
(
!
key
){
return
NO
;
}
dispatch_async
(
queue
,
^
{
NSString
*
filePath
=
[
FLBStackCacheObjectImg
filePathByKey
:
key
dirPath
:
cache
.
cacheDir
];
NSError
*
err
=
nil
;
[
NSFileManager
.
defaultManager
removeItemAtPath
:
filePath
error
:
&
err
];
if
(
completion
)
{
completion
(
err
,
key
);
}
});
return
YES
;
}
@end
ios/Classes/1.0/Support/Memory/FLBMemoryInspector.h
deleted
100755 → 0
View file @
cffd24e3
/*
* 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>
#define kFLBMemoryInspectorChangedNotification @"__FlutterMemoryInspectorChangedNotification__"
#define kFLBMemoryInspectorKeyCondition @"condition"
typedef
NS_ENUM
(
NSUInteger
,
FLBMemoryCondition
)
{
FLBMemoryConditionUnknown
,
FLBMemoryConditionNormal
,
FLBMemoryConditionLowMemory
,
FLBMemoryConditionExtremelyLow
,
FLBMemoryConditionAboutToDie
};
@interface
FLBMemoryInspector
:
NSObject
+
(
instancetype
)
sharedInstance
;
-
(
FLBMemoryCondition
)
currentCondition
;
-
(
int64_t
)
currentFootPrint
;
-
(
int64_t
)
deviceMemory
;
-
(
BOOL
)
smallMemoryDevice
;
@end
ios/Classes/1.0/Support/Memory/FLBMemoryInspector.mm
deleted
100755 → 0
View file @
cffd24e3
/*
* 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 "FLBMemoryInspector.h"
#include <mach/mach.h>
#include <stdlib.h>
#include <sys/sysctl.h>
#define MB(_v_) (_v_*1024*1024)
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
@interface
FLBMemoryInspector
()
@property
(
nonatomic
,
assign
)
FLBMemoryCondition
condition
;
@end
@implementation
FLBMemoryInspector
+
(
instancetype
)
sharedInstance
{
static
id
sInstance
=
nil
;
static
dispatch_once_t
onceToken
;
dispatch_once
(
&
onceToken
,
^
{
sInstance
=
[[
self
.
class
alloc
]
init
];
});
return
sInstance
;
}
static
bool
isHighterThanIos9
(){
bool
ret
=
SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO
(
@"9.0.0"
);
return
ret
;
}
static
int64_t
memoryFootprint
()
{
task_vm_info_data_t
vmInfo
;
mach_msg_type_number_t
count
=
TASK_VM_INFO_COUNT
;
kern_return_t
result
=
task_info
(
mach_task_self
(),
TASK_VM_INFO
,
(
task_info_t
)
&
vmInfo
,
&
count
);
if
(
result
!=
KERN_SUCCESS
)
return
-
1
;
return
vmInfo
.
phys_footprint
;
}
static
int64_t
_memoryWarningLimit
()
{
size_t
size
;
sysctlbyname
(
"hw.machine"
,
NULL
,
&
size
,
NULL
,
0
);
char
*
machine
=
(
char
*
)
malloc
(
size
);
sysctlbyname
(
"hw.machine"
,
machine
,
&
size
,
NULL
,
0
);
NSString
*
platform
=
[
NSString
stringWithUTF8String
:
machine
];
free
(
machine
);
if
([
platform
isEqualToString
:
@"iPhone5,1"
])
return
MB
(
600
);
if
([
platform
isEqualToString
:
@"iPhone5,2"
])
return
MB
(
600
);
if
([
platform
isEqualToString
:
@"iPhone5,3"
])
return
MB
(
600
);
if
([
platform
isEqualToString
:
@"iPhone5,4"
])
return
MB
(
600
);
if
([
platform
isEqualToString
:
@"iPhone6,1"
])
return
MB
(
600
);
if
([
platform
isEqualToString
:
@"iPhone6,2"
])
return
MB
(
600
);
if
([
platform
isEqualToString
:
@"iPhone7,1"
])
return
MB
(
600
);
if
([
platform
isEqualToString
:
@"iPhone7,2"
])
return
MB
(
600
);
if
([
platform
isEqualToString
:
@"iPhone8,1"
])
return
MB
(
1280
);
if
([
platform
isEqualToString
:
@"iPhone8,2"
])
return
MB
(
1280
);
if
([
platform
isEqualToString
:
@"iPhone8,4"
])
return
MB
(
1280
);
if
([
platform
isEqualToString
:
@"iPhone9,1"
])
return
MB
(
1280
);
if
([
platform
isEqualToString
:
@"iPhone9,2"
])
return
MB
(
1950
);
if
([
platform
isEqualToString
:
@"iPhone9,3"
])
return
MB
(
1280
);
if
([
platform
isEqualToString
:
@"iPhone9,4"
])
return
MB
(
1950
);
if
([
platform
isEqualToString
:
@"iPhone10,1"
])
return
MB
(
1280
);
if
([
platform
isEqualToString
:
@"iPhone10,2"
])
return
MB
(
1950
);
if
([
platform
isEqualToString
:
@"iPhone10,3"
])
return
MB
(
1950
);
if
([
platform
isEqualToString
:
@"iPhone10,4"
])
return
MB
(
1280
);
if
([
platform
isEqualToString
:
@"iPhone10,5"
])
return
MB
(
1950
);
if
([
platform
isEqualToString
:
@"iPhone10,6"
])
return
MB
(
1950
);
return
0
;
}
static
int64_t
getLimit
(){
const
static
size_t
l
=
_memoryWarningLimit
();
return
l
;
}
-
(
int64_t
)
deviceMemory
{
int64_t
size
=
[
NSProcessInfo
processInfo
].
physicalMemory
;
return
size
;
}
-
(
BOOL
)
smallMemoryDevice
{
if
([
self
deviceMemory
]
<=
MB
(
1024
)){
return
YES
;
}
else
{
return
NO
;
}
}
-
(
FLBMemoryCondition
)
currentCondition
{
FLBMemoryCondition
newCondition
=
FLBMemoryConditionUnknown
;
if
(
!
isHighterThanIos9
()
||
getLimit
()
<=
0
){
newCondition
=
FLBMemoryConditionUnknown
;
}
else
if
(
memoryFootprint
()
<
getLimit
()
*
0.40
){
newCondition
=
FLBMemoryConditionNormal
;
}
else
if
(
memoryFootprint
()
<
getLimit
()
*
0.60
){
newCondition
=
FLBMemoryConditionLowMemory
;
}
else
if
(
memoryFootprint
()
<
getLimit
()
*
0.80
){
newCondition
=
FLBMemoryConditionExtremelyLow
;
}
else
{
newCondition
=
FLBMemoryConditionAboutToDie
;
}
if
(
newCondition
!=
self
.
condition
)
{
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
kFLBMemoryInspectorChangedNotification
object:
@{
kFLBMemoryInspectorKeyCondition
:
@
(
newCondition
)}];
}
self
.
condition
=
newCondition
;
return
newCondition
;
}
-
(
int64_t
)
currentFootPrint
{
return
memoryFootprint
();
}
@end
ios/Classes/1.5/FLB2FlutterApplication.h
View file @
50e7acc7
...
...
@@ -25,7 +25,6 @@
#import <Foundation/Foundation.h>
#import <Flutter/Flutter.h>
#import "FLB2Platform.h"
#import "FlutterBoost.h"
#import "FLB2FlutterProvider.h"
#import "FLBFlutterApplicationInterface.h"
...
...
ios/Classes/1.5/FLB2FlutterApplication.m
View file @
50e7acc7
...
...
@@ -23,17 +23,14 @@
*/
#import "FLB2FlutterApplication.h"
#import "FlutterBoost.h"
#import "FLBFlutterContainerManager.h"
#import "FlutterBoost
2
.h"
#import "FLB
2
FlutterContainerManager.h"
#import "FLB2FlutterEngine.h"
@interface
FLB2FlutterApplication
()
@property
(
nonatomic
,
strong
)
FLBFlutterContainerManager
*
manager
;
@property
(
nonatomic
,
strong
)
FLB
2
FlutterContainerManager
*
manager
;
@property
(
nonatomic
,
strong
)
id
<
FLB2FlutterProvider
>
viewProvider
;
@property
(
nonatomic
,
assign
)
BOOL
isRunning
;
@property
(
nonatomic
,
strong
)
NSMutableDictionary
*
pageResultCallbacks
;
@property
(
nonatomic
,
strong
)
NSMutableDictionary
*
callbackCache
;
@end
...
...
@@ -76,7 +73,7 @@
-
(
instancetype
)
init
{
if
(
self
=
[
super
init
])
{
_manager
=
[
FLBFlutterContainerManager
new
];
_manager
=
[
FLB
2
FlutterContainerManager
new
];
_pageResultCallbacks
=
NSMutableDictionary
.
new
;
_callbackCache
=
NSMutableDictionary
.
new
;
}
...
...
ios/Classes/1.5/FLB2FlutterViewContainer.m
View file @
50e7acc7
...
...
@@ -25,10 +25,10 @@
#import "FLB2FlutterViewContainer.h"
#import "FLB2FlutterApplication.h"
#import "BoostMessageChannel.h"
#import "FLBFlutterContainerManager.h"
#import "FlutterBoostPlugin_private.h"
#import "FLB
2
FlutterContainerManager.h"
#import "FlutterBoostPlugin
2
_private.h"
#define FLUTTER_APP [FlutterBoostPlugin sharedInstance].application
#define FLUTTER_APP [FlutterBoostPlugin
2
sharedInstance].application
#define FLUTTER_VIEW FLUTTER_APP.flutterViewController.view
#define FLUTTER_VC FLUTTER_APP.flutterViewController
...
...
@@ -174,10 +174,10 @@ static NSUInteger kInstanceCounter = 0;
params:
_params
uniqueId:
self
.
uniqueIDString
];
//Save some first time page info.
if
(
!
[
FlutterBoostPlugin
sharedInstance
].
fPagename
){
[
FlutterBoostPlugin
sharedInstance
].
fPagename
=
_name
;
[
FlutterBoostPlugin
sharedInstance
].
fPageId
=
self
.
uniqueIDString
;
[
FlutterBoostPlugin
sharedInstance
].
fParams
=
_params
;
if
(
!
[
FlutterBoostPlugin
2
sharedInstance
].
fPagename
){
[
FlutterBoostPlugin
2
sharedInstance
].
fPagename
=
_name
;
[
FlutterBoostPlugin
2
sharedInstance
].
fPageId
=
self
.
uniqueIDString
;
[
FlutterBoostPlugin
2
sharedInstance
].
fParams
=
_params
;
}
[
super
viewWillAppear
:
animated
];
...
...
ios/Classes/
1.0/FLBFactory
.h
→
ios/Classes/
Boost/BoostChannel
.h
View file @
50e7acc7
...
...
@@ -21,14 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#import <Foundation/Foundation.h>
#import "FLBAbstractFactory.h"
#import <Flutter/Flutter.h>
NS_ASSUME_NONNULL_BEGIN
@interface
FLBFactory
:
NSObject
<
FLBAbstractFactory
>
@interface
BoostChannel
:
NSObject
<
FlutterPlugin
>
@end
...
...
ios/Classes/
1.0/FLBFactory
.m
→
ios/Classes/
Boost/BoostChannel
.m
View file @
50e7acc7
...
...
@@ -21,22 +21,15 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#import "BoostChannel.h"
#import "FlutterBoost2.h"
#import "FLBFactory.h"
#import "FLBFlutterViewContainer.h"
#import "FLBFlutterApplication.h"
@implementation
FLBFactory
-
(
id
<
FLBFlutterApplicationInterface
>
)
createApplication
:(
id
<
FLB2Platform
>
)
platform
{
return
FLBFlutterApplication
.
new
;
@implementation
BoostChannel
+
(
void
)
registerWithRegistrar
:(
NSObject
<
FlutterPluginRegistrar
>*
)
registrar
{
[
FlutterBoostPlugin2
registerWithRegistrar
:
registrar
];
}
-
(
id
<
FLBFlutterContainer
>
)
createFlutterContainer
{
return
FLBFlutterViewContainer
.
new
;
-
(
void
)
handleMethodCall
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
[
FlutterBoostPlugin2
.
sharedInstance
handleMethodCall
:
call
result
:
result
];
}
@end
ios/Classes/Boost/FLBFlutterAppDelegate.h
→
ios/Classes/Boost/FLB
2
FlutterAppDelegate.h
View file @
50e7acc7
...
...
@@ -25,7 +25,7 @@
#import <Flutter/Flutter.h>
NS_ASSUME_NONNULL_BEGIN
@interface
FLBFlutterAppDelegate
:
FlutterAppDelegate
@interface
FLB
2
FlutterAppDelegate
:
FlutterAppDelegate
// Returns the key window's rootViewController, if it's a FlutterViewController.
// Otherwise, returns nil.
-
(
FlutterViewController
*
)
rootFlutterViewController
;
...
...
ios/Classes/Boost/FLBFlutterAppDelegate.m
→
ios/Classes/Boost/FLB
2
FlutterAppDelegate.m
View file @
50e7acc7
...
...
@@ -22,13 +22,13 @@
* THE SOFTWARE.
*/
#import "FLBFlutterAppDelegate.h"
#import "FlutterBoostPlugin_private.h"
#import "FLB
2
FlutterAppDelegate.h"
#import "FlutterBoostPlugin
2
_private.h"
@implementation
FLBFlutterAppDelegate
@implementation
FLB
2
FlutterAppDelegate
// Returns the key window's rootViewController, if it's a FlutterViewController.
// Otherwise, returns nil.
-
(
FlutterViewController
*
)
rootFlutterViewController
{
return
FlutterBoostPlugin
.
sharedInstance
.
application
.
flutterViewController
;
return
FlutterBoostPlugin
2
.
sharedInstance
.
application
.
flutterViewController
;
}
@end
ios/Classes/Boost/FLBFlutterContainerManager.h
→
ios/Classes/Boost/FLB
2
FlutterContainerManager.h
View file @
50e7acc7
...
...
@@ -26,7 +26,7 @@
#import "FLBFlutterContainer.h"
NS_ASSUME_NONNULL_BEGIN
@interface
FLBFlutterContainerManager
:
NSObject
@interface
FLB
2
FlutterContainerManager
:
NSObject
-
(
NSString
*
)
peak
;
-
(
void
)
addUnique
:(
id
<
FLBFlutterContainer
>
)
vc
;
...
...
ios/Classes/Boost/FLBFlutterContainerManager.m
→
ios/Classes/Boost/FLB
2
FlutterContainerManager.m
View file @
50e7acc7
...
...
@@ -22,14 +22,14 @@
* THE SOFTWARE.
*/
#import "FLBFlutterContainerManager.h"
#import "FLB
2
FlutterContainerManager.h"
@interface
FLBFlutterContainerManager
()
@interface
FLB
2
FlutterContainerManager
()
@property
(
nonatomic
,
strong
)
NSMutableArray
*
idStk
;
@property
(
nonatomic
,
strong
)
NSMutableDictionary
*
existedID
;
@end
@implementation
FLBFlutterContainerManager
@implementation
FLB
2
FlutterContainerManager
-
(
instancetype
)
init
{
...
...
ios/Classes/Boost/FLB2FlutterProvider.h
View file @
50e7acc7
...
...
@@ -23,17 +23,19 @@
*/
#import <Foundation/Foundation.h>
#import "FLBFlutterViewProvider.h"
@class
FlutterViewController
;
@class
FlutterEngine
;
NS_ASSUME_NONNULL_BEGIN
@protocol
FLB2FlutterProvider
<
FLBFlutterViewProvider
>
@protocol
FLB2FlutterProvider
<
NSObject
>
@required
-
(
FlutterEngine
*
)
engine
;
-
(
void
)
atacheToViewController
:(
FlutterViewController
*
)
vc
;
-
(
void
)
detach
;
-
(
void
)
prepareEngineIfNeeded
;
-
(
void
)
pause
;
-
(
void
)
resume
;
-
(
void
)
inactive
;
@end
NS_ASSUME_NONNULL_END
ios/Classes/Boost/FLB2Platform.h
View file @
50e7acc7
...
...
@@ -23,13 +23,9 @@
*/
#import <Foundation/Foundation.h>
#import "FLBPlatform.h"
NS_ASSUME_NONNULL_BEGIN
@protocol
FLB2Platform
<
FLBPlatform
>
@optional
-
(
BOOL
)
useBoost2
;
@protocol
FLB2Platform
<
NSObject
>
@required
-
(
void
)
open
:(
NSString
*
)
url
urlParams
:(
NSDictionary
*
)
urlParams
...
...
ios/Classes/Boost/FLBFlutterApplicationInterface.h
View file @
50e7acc7
...
...
@@ -24,7 +24,7 @@
#import <Foundation/Foundation.h>
#import <Flutter/Flutter.h>
#import "FLB2Platform.h"
#import "FlutterBoost.h"
#import "FlutterBoost
2
.h"
#import "FLB2FlutterProvider.h"
#import "FLBFlutterContainer.h"
...
...
ios/Classes/Boost/FLBFlutterContainer.h
View file @
50e7acc7
...
...
@@ -21,8 +21,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
...
...
ios/Classes/Boost/FLBPlatform.h
deleted
100755 → 0
View file @
cffd24e3
/*
* 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>
NS_ASSUME_NONNULL_BEGIN
@protocol
FLBPlatform
<
NSObject
>
@required
-
(
void
)
openPage
:(
NSString
*
)
name
params
:(
NSDictionary
*
)
params
animated
:(
BOOL
)
animated
completion
:(
void
(
^
)(
BOOL
finished
))
completion
;
-
(
void
)
closePage
:(
NSString
*
)
uid
animated
:(
BOOL
)
animated
params
:(
NSDictionary
*
)
params
completion
:(
void
(
^
)(
BOOL
finished
))
completion
;
@end
NS_ASSUME_NONNULL_END
ios/Classes/Boost/FLBTypes.h
View file @
50e7acc7
...
...
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#import <Foundation/Foundation.h>
#ifndef FLBTypes_h
#define FLBTypes_h
...
...
ios/Classes/Boost/FlutterBoost.h
→
ios/Classes/Boost/FlutterBoost
2
.h
View file @
50e7acc7
...
...
@@ -25,11 +25,9 @@
#ifndef FlutterBoost_h
#define FlutterBoost_h
#import "FlutterBoostPlugin.h"
#import "FLBFlutterAppDelegate.h"
#import "FLBFlutterViewContainer.h"
#import "FLBPlatform.h"
#import "FlutterBoostPlugin2.h"
#import "FLB2FlutterAppDelegate.h"
#import "FLB2FlutterViewContainer.h"
#import "FLB
2Platform
.h"
#import "FLB
Types
.h"
#endif
/* FlutterBoost_h */
ios/Classes/Boost/FlutterBoostPlugin.h
→
ios/Classes/Boost/FlutterBoostPlugin
2
.h
View file @
50e7acc7
...
...
@@ -26,7 +26,7 @@
#import "FLB2Platform.h"
#import "FLBTypes.h"
@interface
FlutterBoostPlugin
:
NSObject
<
FlutterPlugin
>
@interface
FlutterBoostPlugin
2
:
NSObject
<
FlutterPlugin
>
#pragma mark - Initializer
+
(
instancetype
)
sharedInstance
;
...
...
ios/Classes/Boost/FlutterBoostPlugin.m
→
ios/Classes/Boost/FlutterBoostPlugin
2
.m
View file @
50e7acc7
...
...
@@ -22,25 +22,23 @@
* THE SOFTWARE.
*/
#import "FlutterBoostPlugin.h"
#import "FlutterBoostPlugin_private.h"
#import "FLBFactory.h"
#import "FlutterBoostPlugin2.h"
#import "FlutterBoostPlugin2_private.h"
#import "FLB2Factory.h"
#import "BoostMessageChannel.h"
#import "FlutterBoostPlugin_private.h"
#define NSNull2Nil(_x_) if([_x_ isKindOfClass: NSNull.class]) _x_ = nil;
@interface
FlutterBoostPlugin
()
@interface
FlutterBoostPlugin
2
()
@end
@implementation
FlutterBoostPlugin
@implementation
FlutterBoostPlugin
2
+
(
void
)
registerWithRegistrar
:(
NSObject
<
FlutterPluginRegistrar
>*
)
registrar
{
FlutterMethodChannel
*
channel
=
[
FlutterMethodChannel
methodChannelWithName:
@"flutter_boost"
binaryMessenger:
[
registrar
messenger
]];
FlutterBoostPlugin
*
instance
=
[
self
.
class
sharedInstance
];
FlutterBoostPlugin
2
*
instance
=
[
self
.
class
sharedInstance
];
instance
.
methodChannel
=
channel
;
[
registrar
addMethodCallDelegate
:
instance
channel
:
channel
];
}
...
...
@@ -58,7 +56,7 @@
NSNull2Nil
(
exts
);
NSNull2Nil
(
resultData
);
NSNull2Nil
(
uid
);
[[
FlutterBoostPlugin
sharedInstance
].
application
close
:
uid
[[
FlutterBoostPlugin
2
sharedInstance
].
application
close
:
uid
result:
resultData
exts:
exts
completion:
^
(
BOOL
r
){
...
...
@@ -78,16 +76,16 @@
NSNull2Nil
(
url
);
NSNull2Nil
(
urlParams
);
NSNull2Nil
(
exts
);
[[
FlutterBoostPlugin
sharedInstance
].
application
open
:
url
[[
FlutterBoostPlugin
2
sharedInstance
].
application
open
:
url
urlParams:
urlParams
exts:
exts
reult:
result
completion:
^
(
BOOL
r
)
{}];
}
else
if
([
@"pageOnStart"
isEqualToString
:
call
.
method
]){
NSMutableDictionary
*
pageInfo
=
[
NSMutableDictionary
new
];
pageInfo
[
@"name"
]
=
[
FlutterBoostPlugin
sharedInstance
].
fPagename
;
pageInfo
[
@"params"
]
=
[
FlutterBoostPlugin
sharedInstance
].
fParams
;
pageInfo
[
@"uniqueId"
]
=
[
FlutterBoostPlugin
sharedInstance
].
fPageId
;
pageInfo
[
@"name"
]
=
[
FlutterBoostPlugin
2
sharedInstance
].
fPagename
;
pageInfo
[
@"params"
]
=
[
FlutterBoostPlugin
2
sharedInstance
].
fParams
;
pageInfo
[
@"uniqueId"
]
=
[
FlutterBoostPlugin
2
sharedInstance
].
fPageId
;
if
(
result
)
result
(
pageInfo
);
}
else
{
result
(
FlutterMethodNotImplemented
);
...
...
@@ -125,11 +123,7 @@
{
static
dispatch_once_t
onceToken
;
dispatch_once
(
&
onceToken
,
^
{
if
([
platform
respondsToSelector
:
@selector
(
useBoost2
)]
&&
platform
.
useBoost2
){
self
->
_factory
=
FLB2Factory
.
new
;
}
else
{
self
->
_factory
=
FLBFactory
.
new
;
}
self
->
_factory
=
FLB2Factory
.
new
;
self
->
_application
=
[
self
->
_factory
createApplication
:
platform
];
[
self
->
_application
startFlutterWithPlatform
:
platform
onStart:
callback
];
...
...
ios/Classes/Boost/FlutterBoostPlugin_private.h
→
ios/Classes/Boost/FlutterBoostPlugin
2
_private.h
View file @
50e7acc7
...
...
@@ -25,8 +25,8 @@
#import "FLBFlutterApplicationInterface.h"
#import "FLBAbstractFactory.h"
@interface
FlutterBoostPlugin
(){
#import "FlutterBoostPlugin2.h"
@interface
FlutterBoostPlugin
2
(){
id
<
FLBFlutterApplicationInterface
>
_application
;
id
<
FLBAbstractFactory
>
_factory
;
}
...
...
ios/Classes/Messaging/BoostMessageChannel.mm
View file @
50e7acc7
...
...
@@ -22,7 +22,7 @@
* THE SOFTWARE.
*/
#import "BoostMessageChannel.h"
#import "FlutterBoostPlugin_private.h"
#import "FlutterBoostPlugin
2
_private.h"
@implementation
BoostMessageChannel
...
...
@@ -37,7 +37,7 @@
+
(
FlutterMethodChannel
*
)
methodChannel
{
return
FlutterBoostPlugin
.
sharedInstance
.
methodChannel
;
return
FlutterBoostPlugin
2
.
sharedInstance
.
methodChannel
;
}
+
(
void
)
sendEvent
:(
NSString
*
)
eventName
...
...
@@ -162,7 +162,7 @@
}
}];
[
FlutterBoostPlugin
.
sharedInstance
.
application
didInitPageContainer
:
pageName
[
FlutterBoostPlugin
2
.
sharedInstance
.
application
didInitPageContainer
:
pageName
params:
params
uniqueId:
uniqueId
];
}
...
...
@@ -179,7 +179,7 @@
}
}];
[
FlutterBoostPlugin
.
sharedInstance
.
application
willDeallocPageContainer
:
pageName
[
FlutterBoostPlugin
2
.
sharedInstance
.
application
willDeallocPageContainer
:
pageName
params:
params
uniqueId:
uniqueId
];
}
...
...
ios/flutter_boost2.podspec
0 → 100755
View file @
50e7acc7
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod
::
Spec
.
new
do
|
s
|
s
.
name
=
'flutter_boost2'
s
.
version
=
'0.0.1'
s
.
summary
=
'A new Flutter plugin make flutter better to use!'
s
.
description
=
<<-
DESC
A new Flutter plugin make flutter better to use!
DESC
s
.
homepage
=
'http://example.com'
s
.
license
=
{
:file
=>
'../LICENSE.md'
}
s
.
author
=
{
'Alibaba Xianyu'
=>
'email@example.com'
}
s
.
source
=
{
:path
=>
'.'
}
s
.
source_files
=
'Classes/**/*.{h,m,mm}'
s
.
public_header_files
=
'Classes/Boost/FlutterBoostPlugin2.h'
,
'Classes/Boost/FLB2Platform.h'
,
'Classes/Boost/FLBFlutterContainer.h'
,
'Classes/Boost/FLB2FlutterAppDelegate.h'
,
'Classes/Boost/FLBTypes.h'
,
'Classes/Boost/FlutterBoost2.h'
,
'Classes/Boost/BoostChannel.h'
,
'Classes/1.5/FLB2FlutterViewContainer.h'
s
.
dependency
'Flutter'
s
.
libraries
=
'c++'
s
.
ios
.
deployment_target
=
'8.0'
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