Skip to content

Commit

Permalink
feat(ios): change hippyDeepCopyProtocol method name
Browse files Browse the repository at this point in the history
  • Loading branch information
ozonelmy authored and xuqingkuang committed May 8, 2020
1 parent c0c7bcc commit beb417e
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 28 deletions.
4 changes: 2 additions & 2 deletions ios/sdk/module/animation/HippyExtAnimationViewParams.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ - (void)parse
NSMutableDictionary *props = [[NSMutableDictionary alloc] initWithDictionary: self.originParams];
[props removeObjectForKey: @"useAnimation"];
NSAssert1(0 == strcmp("com.tencent.hippy.ShadowQueue", dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL)), @"not in shadow queue, but in %s queue", dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL));
_styles = [props mutableDeepCopy];
_styles = [props hippyMutableDeepCopy];
[self traversalPropsForFindAniamtion: props];
}
}
Expand Down Expand Up @@ -119,7 +119,7 @@ - (NSDictionary *)updateParams
{
@synchronized(self) {
NSAssert1(0 == strcmp("com.tencent.hippy.ShadowQueue", dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL)), @"not in shadow queue, but in %s queue", dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL));
NSDictionary *updateParams = [_styles mutableDeepCopy];
NSDictionary *updateParams = [_styles hippyMutableDeepCopy];
return updateParams;
}
}
Expand Down
8 changes: 2 additions & 6 deletions ios/sdk/utils/HippyDeepCopyProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,8 @@

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@protocol HippyDeepCopyProtocol <NSObject>
@required
- (id)deepCopy;
- (id)mutableDeepCopy;
- (id)hippyDeepCopy;
- (id)hippyMutableDeepCopy;
@end

NS_ASSUME_NONNULL_END
3 changes: 0 additions & 3 deletions ios/sdk/utils/NSArray+HippyArrayDeepCopy.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@

#import <Foundation/Foundation.h>
#import "HippyDeepCopyProtocol.h"
NS_ASSUME_NONNULL_BEGIN

@interface NSArray (HippyArrayDeepCopy)<HippyDeepCopyProtocol>

@end

NS_ASSUME_NONNULL_END
8 changes: 4 additions & 4 deletions ios/sdk/utils/NSArray+HippyArrayDeepCopy.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
#import "NSArray+HippyArrayDeepCopy.h"

@implementation NSArray (HippyArrayDeepCopy)
- (id)deepCopy {
- (id)hippyDeepCopy {
NSMutableArray *array = [NSMutableArray arrayWithCapacity:[self count]];
for (id item in self) {
id copiedItem = nil;
if ([item conformsToProtocol:@protocol(HippyDeepCopyProtocol)]) {
copiedItem = [item deepCopy];
copiedItem = [item hippyDeepCopy];
}
else if ([item respondsToSelector:@selector(copy)]) {
copiedItem = [item copy];
Expand All @@ -41,12 +41,12 @@ - (id)deepCopy {
return [NSArray arrayWithArray:array];
}

- (id)mutableDeepCopy {
- (id)hippyMutableDeepCopy {
NSMutableArray *array = [NSMutableArray arrayWithCapacity:[self count]];
for (id item in self) {
id copiedItem = nil;
if ([item conformsToProtocol:@protocol(HippyDeepCopyProtocol)]) {
copiedItem = [item mutableDeepCopy];
copiedItem = [item hippyMutableDeepCopy];
}
else if ([item conformsToProtocol:@protocol(NSMutableCopying)]) {
copiedItem = [item mutableCopy];
Expand Down
4 changes: 0 additions & 4 deletions ios/sdk/utils/NSDictionary+HippyDictionaryDeepCopy.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
#import <Foundation/Foundation.h>
#import "HippyDeepCopyProtocol.h"

NS_ASSUME_NONNULL_BEGIN

@interface NSDictionary (HippyDictionaryDeepCopy)<HippyDeepCopyProtocol>

@end

NS_ASSUME_NONNULL_END
8 changes: 4 additions & 4 deletions ios/sdk/utils/NSDictionary+HippyDictionaryDeepCopy.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
#import "NSDictionary+HippyDictionaryDeepCopy.h"

@implementation NSDictionary (HippyDictionaryDeepCopy)
- (id)deepCopy {
- (id)hippyDeepCopy {
NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithCapacity:[self count]];
[self enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) {
id copiedKey = [key copy];
id copiedObj = nil;
if ([obj conformsToProtocol:@protocol(HippyDeepCopyProtocol)]) {
copiedObj = [obj deepCopy];
copiedObj = [obj hippyDeepCopy];
}
else if ([obj respondsToSelector:@selector(copy)]) {
copiedObj = [obj copy];
Expand All @@ -42,14 +42,14 @@ - (id)deepCopy {
return [NSDictionary dictionaryWithDictionary:dictionary];
}

- (id)mutableDeepCopy {
- (id)hippyMutableDeepCopy {
NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithCapacity:[self count]];
for (id key in self) {
id copiedKey = [key mutableCopy];
id obj = [self objectForKey:key];
id copiedObj = nil;
if ([obj conformsToProtocol:@protocol(HippyDeepCopyProtocol)]) {
copiedObj = [obj mutableDeepCopy];
copiedObj = [obj hippyMutableDeepCopy];
}
else if ([obj conformsToProtocol:@protocol(NSMutableCopying)]) {
copiedObj = [obj mutableCopy];
Expand Down
3 changes: 0 additions & 3 deletions ios/sdk/utils/NSNumber+HippyNumberDeepCopy.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@

#import <Foundation/Foundation.h>
#import "HippyDeepCopyProtocol.h"
NS_ASSUME_NONNULL_BEGIN

@interface NSNumber (HippyNumberDeepCopy)<HippyDeepCopyProtocol>

@end

NS_ASSUME_NONNULL_END
4 changes: 2 additions & 2 deletions ios/sdk/utils/NSNumber+HippyNumberDeepCopy.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
#import "NSNumber+HippyNumberDeepCopy.h"

@implementation NSNumber (HippyNumberDeepCopy)
- (id)deepCopy {
- (id)hippyDeepCopy {
return self;
}

- (id)mutableDeepCopy {
- (id)hippyMutableDeepCopy {
return self;
}
@end

0 comments on commit beb417e

Please sign in to comment.