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
ed0036e9
Commit
ed0036e9
authored
Jul 02, 2019
by
Jidong Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
filter nsnull for data from method channel.
parent
91880134
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
123 additions
and
2 deletions
+123
-2
ios/Classes/Boost/FLBCollectionHelper.h
ios/Classes/Boost/FLBCollectionHelper.h
+37
-0
ios/Classes/Boost/FLBCollectionHelper.m
ios/Classes/Boost/FLBCollectionHelper.m
+77
-0
ios/Classes/Boost/FlutterBoostPlugin2.m
ios/Classes/Boost/FlutterBoostPlugin2.m
+9
-2
No files found.
ios/Classes/Boost/FLBCollectionHelper.h
0 → 100755
View file @
ed0036e9
/*
* 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
typedef
bool
(
^
FLBCollectionFilter
)(
id
value
);
@interface
FLBCollectionHelper
:
NSObject
+
(
NSDictionary
*
)
deepCopyNSDictionary
:(
NSDictionary
*
)
origin
filter
:(
FLBCollectionFilter
)
filter
;
+
(
NSArray
*
)
deepCopyNSArray
:(
NSArray
*
)
array
filter
:(
FLBCollectionFilter
)
filter
;
@end
NS_ASSUME_NONNULL_END
ios/Classes/Boost/FLBCollectionHelper.m
0 → 100755
View file @
ed0036e9
/*
* 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 "FLBCollectionHelper.h"
@implementation
FLBCollectionHelper
+
(
NSDictionary
*
)
deepCopyNSDictionary
:(
NSDictionary
*
)
origin
filter
:(
FLBCollectionFilter
)
filter
{
if
(
origin
.
count
<
1
)
return
origin
;
NSMutableDictionary
*
copyed
=
[
NSMutableDictionary
new
];
[
origin
enumerateKeysAndObjectsUsingBlock
:
^
(
id
_Nonnull
key
,
id
_Nonnull
obj
,
BOOL
*
_Nonnull
stop
)
{
//Filter: Do not include invalid things
if
(
filter
&&
!
filter
(
obj
))
return
;
if
([
obj
isKindOfClass
:
NSDictionary
.
class
]){
copyed
[
key
]
=
[
self
deepCopyNSDictionary
:
obj
filter
:
filter
];
}
else
if
([
obj
isKindOfClass
:
NSArray
.
class
]){
copyed
[
key
]
=
[
self
deepCopyNSArray
:
obj
filter
:
filter
];
}
else
{
copyed
[
key
]
=
obj
;
}
}];
return
copyed
;
}
+
(
NSArray
*
)
deepCopyNSArray
:(
NSArray
*
)
origin
filter
:(
FLBCollectionFilter
)
filter
{
if
(
origin
.
count
<
1
)
return
origin
;
NSMutableArray
*
copyed
=
[
NSMutableArray
new
];
[
origin
enumerateObjectsUsingBlock
:
^
(
id
_Nonnull
obj
,
NSUInteger
idx
,
BOOL
*
_Nonnull
stop
)
{
//Filter: Do not include invalid things.
if
(
filter
&&
!
filter
(
obj
))
return
;
id
nObj
=
nil
;
if
([
obj
isKindOfClass
:
NSDictionary
.
class
]){
nObj
=
[
self
deepCopyNSDictionary
:
obj
filter
:
filter
];
}
else
if
([
obj
isKindOfClass
:
NSArray
.
class
]){
nObj
=
[
self
deepCopyNSArray
:
obj
filter
:
filter
];
}
else
{
nObj
=
obj
;
}
if
(
nObj
)
{
[
copyed
addObject
:
nObj
];
}
}];
return
copyed
;
}
@end
ios/Classes/Boost/FlutterBoostPlugin2.m
View file @
ed0036e9
...
...
@@ -26,6 +26,7 @@
#import "FlutterBoostPlugin2_private.h"
#import "FLB2Factory.h"
#import "BoostMessageChannel.h"
#import "FLBCollectionHelper.h"
#define NSNull2Nil(_x_) if([_x_ isKindOfClass: NSNull.class]) _x_ = nil;
...
...
@@ -49,7 +50,10 @@
}
else
if
([
@"__event__"
isEqual
:
call
.
method
]){
[
BoostMessageChannel
handleMethodCall
:
call
result
:
result
];
}
else
if
([
@"closePage"
isEqualToString
:
call
.
method
]){
NSDictionary
*
args
=
call
.
arguments
;
NSDictionary
*
args
=
[
FLBCollectionHelper
deepCopyNSDictionary
:
call
.
arguments
filter:
^
bool
(
id
_Nonnull
value
)
{
return
!
[
value
isKindOfClass
:
NSNull
.
class
];
}];
NSDictionary
*
exts
=
args
[
@"exts"
];
NSString
*
uid
=
args
[
@"uniqueId"
];
NSDictionary
*
resultData
=
args
[
@"result"
];
...
...
@@ -69,7 +73,10 @@
object:
newName
];
}
}
else
if
([
@"openPage"
isEqualToString
:
call
.
method
]){
NSDictionary
*
args
=
call
.
arguments
;
NSDictionary
*
args
=
[
FLBCollectionHelper
deepCopyNSDictionary
:
call
.
arguments
filter:
^
bool
(
id
_Nonnull
value
)
{
return
!
[
value
isKindOfClass
:
NSNull
.
class
];
}];
NSString
*
url
=
args
[
@"url"
];
NSDictionary
*
urlParams
=
args
[
@"urlParams"
];
NSDictionary
*
exts
=
args
[
@"exts"
];
...
...
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