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
478803b2
Commit
478803b2
authored
Oct 11, 2019
by
余玠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
避免多次调用surfaceUpdate或者反复创建surface
parent
570f4acb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
24 deletions
+24
-24
ios/Classes/Engine/FLBFlutterEngine.m
ios/Classes/Engine/FLBFlutterEngine.m
+4
-6
ios/Classes/container/FLBFlutterViewContainer.m
ios/Classes/container/FLBFlutterViewContainer.m
+20
-18
No files found.
ios/Classes/Engine/FLBFlutterEngine.m
View file @
478803b2
...
@@ -81,7 +81,6 @@
...
@@ -81,7 +81,6 @@
-
(
void
)
resume
-
(
void
)
resume
{
{
[[
_engine
lifecycleChannel
]
sendMessage
:
@"AppLifecycleState.resumed"
];
[[
_engine
lifecycleChannel
]
sendMessage
:
@"AppLifecycleState.resumed"
];
[(
FLBFlutterViewContainer
*
)
_engine
.
viewController
surfaceUpdated
:
YES
];
}
}
-
(
void
)
inactive
-
(
void
)
inactive
...
@@ -110,6 +109,7 @@
...
@@ -110,6 +109,7 @@
-
(
void
)
atacheToViewController
:(
FlutterViewController
*
)
vc
-
(
void
)
atacheToViewController
:(
FlutterViewController
*
)
vc
{
{
if
(
_engine
.
viewController
!=
vc
){
if
(
_engine
.
viewController
!=
vc
){
[(
FLBFlutterViewContainer
*
)
_engine
.
viewController
surfaceUpdated
:
NO
];
_engine
.
viewController
=
vc
;
_engine
.
viewController
=
vc
;
}
}
}
}
...
@@ -123,11 +123,9 @@
...
@@ -123,11 +123,9 @@
-
(
void
)
prepareEngineIfNeeded
-
(
void
)
prepareEngineIfNeeded
{
{
// if ([_dummy respondsToSelector:@selector(setEnableForRunnersBatch:)]) {
[(
FLBFlutterViewContainer
*
)
_engine
.
viewController
surfaceUpdated
:
NO
];
// [_dummy setEnableForRunnersBatch:YES];
NSLog
(
@"[XDEBUG]---surface changed--reset-"
);
// }
// [self detach];
[
self
detach
];
[
_dummy
surfaceUpdated
:
YES
];
}
}
@end
@end
...
...
ios/Classes/container/FLBFlutterViewContainer.m
View file @
478803b2
...
@@ -27,6 +27,8 @@
...
@@ -27,6 +27,8 @@
#import "BoostMessageChannel.h"
#import "BoostMessageChannel.h"
#import "FLBFlutterContainerManager.h"
#import "FLBFlutterContainerManager.h"
#import "FlutterBoostPlugin_private.h"
#import "FlutterBoostPlugin_private.h"
#import <objc/message.h>
#import <objc/runtime.h>
#define FLUTTER_APP [FlutterBoostPlugin sharedInstance].application
#define FLUTTER_APP [FlutterBoostPlugin sharedInstance].application
#define FLUTTER_VIEW FLUTTER_APP.flutterViewController.view
#define FLUTTER_VIEW FLUTTER_APP.flutterViewController.view
...
@@ -137,7 +139,6 @@ static NSUInteger kInstanceCounter = 0;
...
@@ -137,7 +139,6 @@ static NSUInteger kInstanceCounter = 0;
-
(
void
)
attatchFlutterEngine
-
(
void
)
attatchFlutterEngine
{
{
[
FLUTTER_APP
.
flutterProvider
prepareEngineIfNeeded
];
[
FLUTTER_APP
.
flutterProvider
atacheToViewController
:
self
];
[
FLUTTER_APP
.
flutterProvider
atacheToViewController
:
self
];
}
}
...
@@ -161,16 +162,6 @@ static NSUInteger kInstanceCounter = 0;
...
@@ -161,16 +162,6 @@ static NSUInteger kInstanceCounter = 0;
-
(
void
)
viewWillAppear
:(
BOOL
)
animated
-
(
void
)
viewWillAppear
:(
BOOL
)
animated
{
{
if
([
FLUTTER_APP
contains
:
self
]){
[
self
surfaceUpdated
:
NO
];
[
self
detatchFlutterEngine
];
}
else
{
[
self
attatchFlutterEngine
];
[
self
surfaceUpdated
:
YES
];
}
[
FLUTTER_APP
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.
...
@@ -185,7 +176,13 @@ static NSUInteger kInstanceCounter = 0;
...
@@ -185,7 +176,13 @@ static NSUInteger kInstanceCounter = 0;
[
FlutterBoostPlugin
sharedInstance
].
fParams
=
_params
;
[
FlutterBoostPlugin
sharedInstance
].
fParams
=
_params
;
}
}
[
super
viewWillAppear
:
animated
];
//instead of calling [super viewWillAppear:animated];, call super's super
struct
objc_super
target
=
{
.
super_class
=
class_getSuperclass
([
FlutterViewController
class
]),
.
receiver
=
self
,
};
NSMethodSignature
*
(
*
callSuper
)(
struct
objc_super
*
,
SEL
,
BOOL
animated
)
=
(
__typeof__
(
callSuper
))
objc_msgSendSuper
;
callSuper
(
&
target
,
@selector
(
viewWillAppear
:
),
animated
);
}
}
-
(
void
)
viewDidAppear
:(
BOOL
)
animated
-
(
void
)
viewDidAppear
:(
BOOL
)
animated
...
@@ -194,13 +191,15 @@ static NSUInteger kInstanceCounter = 0;
...
@@ -194,13 +191,15 @@ static NSUInteger kInstanceCounter = 0;
//Ensure flutter view is attached.
//Ensure flutter view is attached.
[
self
attatchFlutterEngine
];
[
self
attatchFlutterEngine
];
[
FLUTTER_APP
resume
];
[
BoostMessageChannel
didShowPageContainer
:
^
(
NSNumber
*
result
)
{}
[
BoostMessageChannel
didShowPageContainer
:
^
(
NSNumber
*
result
)
{}
pageName:
_name
pageName:
_name
params:
_params
params:
_params
uniqueId:
self
.
uniqueIDString
];
uniqueId:
self
.
uniqueIDString
];
//NOTES:务必在show之后再update,否则有闪烁
[
self
surfaceUpdated
:
YES
];
[
super
viewDidAppear
:
animated
];
[
super
viewDidAppear
:
animated
];
}
}
...
@@ -217,14 +216,17 @@ static NSUInteger kInstanceCounter = 0;
...
@@ -217,14 +216,17 @@ static NSUInteger kInstanceCounter = 0;
-
(
void
)
viewDidDisappear
:(
BOOL
)
animated
-
(
void
)
viewDidDisappear
:(
BOOL
)
animated
{
{
[
FLUTTER_APP
resume
];
[
BoostMessageChannel
didDisappearPageContainer
:
^
(
NSNumber
*
result
)
{}
[
BoostMessageChannel
didDisappearPageContainer
:
^
(
NSNumber
*
result
)
{}
pageName:
_name
pageName:
_name
params:
_params
params:
_params
uniqueId:
self
.
uniqueIDString
];
uniqueId:
self
.
uniqueIDString
];
[
super
viewDidDisappear
:
animated
];
// instead of calling [super viewDidDisappear:animated];, call super's super
[
FLUTTER_APP
resume
];
struct
objc_super
target
=
{
.
super_class
=
class_getSuperclass
([
FlutterViewController
class
]),
.
receiver
=
self
,
};
NSMethodSignature
*
(
*
callSuper
)(
struct
objc_super
*
,
SEL
,
BOOL
animated
)
=
(
__typeof__
(
callSuper
))
objc_msgSendSuper
;
callSuper
(
&
target
,
@selector
(
viewDidDisappear
:
),
animated
);
}
}
-
(
void
)
installSplashScreenViewIfNecessary
{
-
(
void
)
installSplashScreenViewIfNecessary
{
...
...
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