From 7bec0b85e05a719131f21c157166f479910786cd Mon Sep 17 00:00:00 2001 From: kyle <282696845@qq.com> Date: Wed, 29 Aug 2018 14:27:23 +0800 Subject: [PATCH 1/3] Update BHModuleManager.m --- BeeHive/BHModuleManager.m | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/BeeHive/BHModuleManager.m b/BeeHive/BHModuleManager.m index 83fd270..53a845e 100755 --- a/BeeHive/BHModuleManager.m +++ b/BeeHive/BHModuleManager.m @@ -527,6 +527,10 @@ - (void)handleModuleEvent:(NSInteger)eventType BHContext *context = [BHContext shareInstance].copy; context.customParam = customParam; context.customEvent = eventType; + + if(eventType >= BHMDidCustomEvent){ //系统自定义事件调用 + [self handleModuleCustomEvent:eventType forTarget:target withContext:context andCustomParam:customParam]; + } if (!selectorStr.length) { selectorStr = [self.BHSelectorByEvent objectForKey:@(eventType)]; } @@ -553,6 +557,30 @@ - (void)handleModuleEvent:(NSInteger)eventType } }]; } - +//系统modDidCustomEvent 事件 +- (void)handleModuleCustomEvent:(NSInteger)eventType + forTarget:(id)target + withContext:(BHContext *)context + andCustomParam:(NSDictionary *)customParam +{ + SEL seletor = NSSelectorFromString(kAppCustomSelector); + NSArray> *moduleInstances; + if (target) { + moduleInstances = @[target]; + } else { + moduleInstances = [self.BHModulesByEvent objectForKey:@(eventType)]; + } + [moduleInstances enumerateObjectsUsingBlock:^(id moduleInstance, NSUInteger idx, BOOL * _Nonnull stop) { + if ([moduleInstance respondsToSelector:seletor]) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-performSelector-leaks" + [moduleInstance performSelector:seletor withObject:context]; +#pragma clang diagnostic pop + + [[BHTimeProfiler sharedTimeProfiler] recordEventTime:[NSString stringWithFormat:@"%@ --- %@", [moduleInstance class], NSStringFromSelector(seletor)]]; + + } + }]; +} @end From 465ef14acef498eca5bfe01f8d3749aa5fcc117d Mon Sep 17 00:00:00 2001 From: kyle <282696845@qq.com> Date: Thu, 30 Aug 2018 16:45:02 +0800 Subject: [PATCH 2/3] Update BHModuleManager.m --- BeeHive/BHModuleManager.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BeeHive/BHModuleManager.m b/BeeHive/BHModuleManager.m index 53a845e..e3bf108 100755 --- a/BeeHive/BHModuleManager.m +++ b/BeeHive/BHModuleManager.m @@ -568,7 +568,7 @@ - (void)handleModuleCustomEvent:(NSInteger)eventType if (target) { moduleInstances = @[target]; } else { - moduleInstances = [self.BHModulesByEvent objectForKey:@(eventType)]; + moduleInstances = [self.BHModulesByEvent objectForKey:@(BHMDidCustomEvent)]; } [moduleInstances enumerateObjectsUsingBlock:^(id moduleInstance, NSUInteger idx, BOOL * _Nonnull stop) { if ([moduleInstance respondsToSelector:seletor]) { From 54202159f87d845c21f42e1a80e3509ce62a4bb5 Mon Sep 17 00:00:00 2001 From: kyle <282696845@qq.com> Date: Thu, 30 Aug 2018 18:04:11 +0800 Subject: [PATCH 3/3] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d48c3c1..b6374ac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ language: objective-c xcode_project: BeeHive.xcodeproj xcode_scheme: BeeHive -xcode_sdk: iphonesimulator +xcode_destination: platform=iOS Simulator,OS=9.3,name=iPhone 5s