Skip to content

Commit

Permalink
Merge pull request #43 from yaochenfeng/master
Browse files Browse the repository at this point in the history
add custom event for app
  • Loading branch information
SoXeon authored Feb 6, 2017
2 parents 0511e4a + 20fdf06 commit 4d073d6
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion BeeHive/BHContext.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ typedef enum

//application appkey
@property(nonatomic, strong) NSString *appkey;

//customEvent>=1000
@property(nonatomic, assign) NSInteger customEvent;

@property(nonatomic, strong) UIApplication *application;

Expand Down
3 changes: 2 additions & 1 deletion BeeHive/BHModuleManager.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ typedef NS_ENUM(NSInteger, BHModuleEventType)
BHMWillContinueUserActivityEvent,
BHMContinueUserActivityEvent,
BHMDidFailToContinueUserActivityEvent,
BHMDidUpdateUserActivityEvent
BHMDidUpdateUserActivityEvent,
BHMDidCustomEvent = 1000

};

Expand Down
4 changes: 3 additions & 1 deletion BeeHive/BHModuleManager.m
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
static NSString *kContinueUserActivitySelector = @"modContinueUserActivity:";
static NSString *kDidUpdateContinueUserActivitySelector = @"modDidUpdateContinueUserActivity:";
static NSString *kFailToContinueUserActivitySelector = @"modDidFailToContinueUserActivity:";

static NSString *kAppCustomSelector = @"modDidCustomEvent:";



Expand Down Expand Up @@ -213,6 +213,8 @@ - (void)triggerEvent:(BHModuleEventType)eventType
break;

default:
[BHContext shareInstance].customEvent = eventType;
[self handleModuleEvent:kAppCustomSelector];
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion BeeHive/BHModuleProtocol.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@

- (void)modDidUpdateContinueUserActivity:(BHContext *)context;


- (void)modDidCustomEvent:(BHContext *)context;
@end
1 change: 1 addition & 0 deletions BeeHive/BeeHive.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@
//Registration is recommended to use a static way
-(void)registerService:(Protocol *)proto service:(Class) serviceClass;

- (void)tiggerCustomEvent:(NSInteger)eventType;
@end
5 changes: 5 additions & 0 deletions BeeHive/BeeHive.m
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,10 @@ -(void)loadStaticServices
[[BHServiceManager sharedManager] registerAnnotationServices];

}
- (void)tiggerCustomEvent:(NSInteger)eventType{
if(eventType<1000)
return;
[[BHModuleManager sharedManager] tiggerEvent:eventType];
}

@end

0 comments on commit 4d073d6

Please sign in to comment.