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
0
Merge Requests
0
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
67f132b9
Commit
67f132b9
authored
Apr 01, 2019
by
Jidong Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix cache problems.
parent
fc3b7e84
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
6 deletions
+68
-6
ios/Classes/Container/FLBFlutterViewContainer.m
ios/Classes/Container/FLBFlutterViewContainer.m
+20
-4
ios/Classes/Support/Cache/FLBStackCache.h
ios/Classes/Support/Cache/FLBStackCache.h
+7
-0
ios/Classes/Support/Cache/FLBStackCache.m
ios/Classes/Support/Cache/FLBStackCache.m
+18
-1
ios/Classes/Support/Cache/FLBStackCacheObjectImg.m
ios/Classes/Support/Cache/FLBStackCacheObjectImg.m
+22
-0
pubspec.yaml
pubspec.yaml
+1
-1
No files found.
ios/Classes/Container/FLBFlutterViewContainer.m
View file @
67f132b9
...
...
@@ -39,6 +39,7 @@
@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
...
...
@@ -241,6 +242,8 @@ static NSUInteger kInstanceCounter = 0;
[
self
.
view
insertSubview
:
FLUTTER_VIEW
atIndex:
0
];
}
}
else
{
}
return
self
.
screenShotView
.
image
!=
nil
;
...
...
@@ -262,8 +265,8 @@ static NSUInteger kInstanceCounter = 0;
[
self
clearCurrentScreenShotImage
];
//
Remov
e obsolete screenshot.
[
FLBStackCache
.
sharedInstance
remov
e
:
self
.
uniqueIDString
];
//
Invalidat
e obsolete screenshot.
[
FLBStackCache
.
sharedInstance
invalidat
e
:
self
.
uniqueIDString
];
}
#pragma mark - Life circle methods
...
...
@@ -276,6 +279,10 @@ static NSUInteger kInstanceCounter = 0;
-
(
void
)
viewWillAppear
:(
BOOL
)
animated
{
if
(
self
.
navigationController
.
interactivePopGestureRecognizer
.
state
==
UIGestureRecognizerStateBegan
){
self
.
interactiveGestureActive
=
true
;
}
[[
FLBFlutterApplication
sharedApplication
]
resume
];
//For new page we should attach flutter view in view will appear
//for better performance.
...
...
@@ -319,18 +326,26 @@ static NSUInteger kInstanceCounter = 0;
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
.
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
];
...
...
@@ -355,6 +370,7 @@ static NSUInteger kInstanceCounter = 0;
[
super
viewDidDisappear
:
animated
];
[
FLUTTER_APP
inactive
];
self
.
interactiveGestureActive
=
NO
;
}
#pragma mark - FLBViewControllerResultHandler
...
...
ios/Classes/Support/Cache/FLBStackCache.h
View file @
67f132b9
...
...
@@ -41,6 +41,12 @@
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
...
...
@@ -56,6 +62,7 @@
#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
;
...
...
ios/Classes/Support/Cache/FLBStackCache.m
View file @
67f132b9
...
...
@@ -84,7 +84,7 @@
return
;
}
if
(
!
_inMemoryObjectsMap
[
key
]){
if
(
!
[
_keyStack
containsObject
:
key
]){
[
_keyStack
addObject
:
key
];
}
else
{
//return;
...
...
@@ -136,6 +136,23 @@
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
){
...
...
ios/Classes/Support/Cache/FLBStackCacheObjectImg.m
View file @
67f132b9
...
...
@@ -91,4 +91,26 @@
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
pubspec.yaml
View file @
67f132b9
name
:
flutter_boost
description
:
A next-generation Flutter-Native hybrid solution. FlutterBoost is a Flutter plugin which enables hybrid integration of Flutter for your existing native apps with minimum efforts.
version
:
0.0.
39
version
:
0.0.
407
author
:
Alibaba Xianyu
homepage
:
https://github.com/alibaba/flutter_boost
...
...
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